diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/dashboard/domain/vo/BriefVO.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/dashboard/domain/vo/BriefVO.java new file mode 100644 index 0000000..31c51dd --- /dev/null +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/dashboard/domain/vo/BriefVO.java @@ -0,0 +1,22 @@ +package com.ruoyi.bst.dashboard.domain.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author wjh + * 2024/12/26 + */ +@Data +public class BriefVO { + + @ApiModelProperty("本月订单数") + private Integer monthOrderCount; + + @ApiModelProperty("总订单数") + private Integer totalOrderCount; + + @ApiModelProperty("待完成订单数") + private Integer releasedOrderCount; + +} diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/dashboard/service/DashboardService.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/dashboard/service/DashboardService.java new file mode 100644 index 0000000..db7027a --- /dev/null +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/dashboard/service/DashboardService.java @@ -0,0 +1,47 @@ +package com.ruoyi.bst.dashboard.service; + +import com.ruoyi.bst.dashboard.domain.vo.BriefVO; +import com.ruoyi.bst.order.domain.OrderQuery; +import com.ruoyi.bst.order.domain.enums.OrderStatus; +import com.ruoyi.bst.order.service.OrderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.util.Arrays; +import java.util.List; + +/** + * @author wjh + * 2024/12/26 + */ +@Service +public class DashboardService { + + @Autowired + private OrderService orderService; + + + public BriefVO selectBrief() { + BriefVO vo = new BriefVO(); + + // 总订单数 + int total = orderService.selectCount(new OrderQuery()); + vo.setTotalOrderCount(total); + + // 本月起始到今日 + OrderQuery monthQuery = new OrderQuery(); + List orderDateRange = Arrays.asList(LocalDate.now().withDayOfMonth(1), LocalDate.now()); + monthQuery.setOrderDateRange(orderDateRange); + int monthCount = orderService.selectCount(monthQuery); + vo.setMonthOrderCount(monthCount); + + // 待完成的订单数 + OrderQuery releasedQuery = new OrderQuery(); + releasedQuery.setStatus(OrderStatus.RELEASED.getStatus()); + int releasedCount = orderService.selectCount(releasedQuery); + vo.setReleasedOrderCount(releasedCount); + + return vo; + } +} diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/domain/OrderQuery.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/domain/OrderQuery.java index 8087cf9..d616a65 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/domain/OrderQuery.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/domain/OrderQuery.java @@ -24,4 +24,13 @@ public class OrderQuery extends OrderVO{ @DateTimeFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("交货日期范围") private List deliveryDateRange; + + @ApiModelProperty("是否包含产品") + private Boolean needProd; + + @ApiModelProperty("是否包含产品进度") + private Boolean needProdProgress; + + @ApiModelProperty("是否包含工序") + private Boolean needProcess; } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.java index 9221992..915d7d9 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.java @@ -67,4 +67,9 @@ public interface OrderMapper * 条件更新 */ int updateByQuery(@Param("data") Order data, @Param("query") OrderQuery query); + + /** + * 查询数量 + */ + int selectCount(@Param("query") OrderQuery query); } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.xml b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.xml index f2531d3..15391a4 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.xml +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/mapper/OrderMapper.xml @@ -61,6 +61,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + insert into bst_order diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderAssembler.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderAssembler.java index 3940622..4876130 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderAssembler.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderAssembler.java @@ -12,10 +12,12 @@ public interface OrderAssembler { /** * 拼接产品列表 - * @param list 订单列表 - * @param assembleProcess 是否拼接工序 + * + * @param list 订单列表 + * @param assembleProcess 是否拼接工序 + * @param assembleProgress */ - void assembleProdList(List list, boolean assembleProcess); + void assembleProdList(List list, boolean assembleProcess, boolean assembleProgress); /** * 拼接进度 diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderService.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderService.java index 41a0ed0..cfedaf9 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderService.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/OrderService.java @@ -82,4 +82,9 @@ public interface OrderService * 完成订单 */ int finish(Long id); + + /** + * 查询数量 + */ + int selectCount(OrderQuery query); } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderAssemblerImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderAssemblerImpl.java index 6729f29..7c48560 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderAssemblerImpl.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderAssemblerImpl.java @@ -31,7 +31,7 @@ public class OrderAssemblerImpl implements OrderAssembler { private OrderProdAssembler orderProdAssembler; @Override - public void assembleProdList(List list, boolean assembleProcess) { + public void assembleProdList(List list, boolean assembleProcess, boolean assembleProgress) { if (CollectionUtils.isEmptyElement(list)) { return; } @@ -41,6 +41,11 @@ public class OrderAssemblerImpl implements OrderAssembler { query.setOrderIds(CollectionUtils.map(list, OrderVO::getId)); List prodList = orderProdService.selectOrderProdList(query); + // 拼接进度 + if (assembleProgress) { + orderProdAssembler.assembleProgress(prodList); + } + // 拼接明细 if (assembleProcess) { orderProdAssembler.assembleProcessList(prodList, true); diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderServiceImpl.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderServiceImpl.java index 4c1dbf3..db1f04a 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderServiceImpl.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/order/service/impl/OrderServiceImpl.java @@ -240,6 +240,11 @@ public class OrderServiceImpl implements OrderService return updateByQuery(data, query); } + @Override + public int selectCount(OrderQuery query) { + return orderMapper.selectCount(query); + } + private int updateByQuery(Order data, OrderQuery query) { return orderMapper.updateByQuery(data, query); } diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/prodProcess/domain/ProdProcessVO.java b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/prodProcess/domain/ProdProcessVO.java index 75ce7fd..d63468c 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/prodProcess/domain/ProdProcessVO.java +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/prodProcess/domain/ProdProcessVO.java @@ -6,6 +6,8 @@ import lombok.Data; import java.math.BigDecimal; import java.math.RoundingMode; +import java.time.LocalDate; +import java.time.LocalDateTime; /** * @author wjh @@ -26,6 +28,30 @@ public class ProdProcessVO extends ProdProcess{ @ApiModelProperty("订单图片") private String orderPicture; + @ApiModelProperty("订单日期") + private LocalDate orderDate; + + @ApiModelProperty("客户") + private String orderCustomer; + + @ApiModelProperty("交货日期") + private LocalDate orderDeliveryDate; + + @ApiModelProperty("用料") + private String orderMaterial; + + @ApiModelProperty("特殊要求") + private String orderRemark; + + @ApiModelProperty("订单创建人") + private String orderCreateBy; + + @ApiModelProperty("订单创建时间") + private LocalDateTime orderCreateTime; + + @ApiModelProperty("订单数量") + private BigDecimal orderNum; + @ApiModelProperty("生产车间名称") private String deptName; @@ -41,6 +67,15 @@ public class ProdProcessVO extends ProdProcess{ @ApiModelProperty("有效清点数") private BigDecimal storeNum; + @ApiModelProperty("产品规格") + private String orderProdSpec; + + @ApiModelProperty("产品物料编码") + private String orderProdMaterialNo; + + @ApiModelProperty("产品备注") + private String orderProdRemark; + @Excel(name = "处理方式") @ApiModelProperty("处理方式") private String handleWay; @@ -57,6 +92,8 @@ public class ProdProcessVO extends ProdProcess{ @ApiModelProperty("盖子颜色") private String coverColor; + + @ApiModelProperty("进度") public BigDecimal getProgress() { if (this.storeNum == null || this.getNum() == null) { diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/prodProcess/mapper/ProdProcessMapper.xml b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/prodProcess/mapper/ProdProcessMapper.xml index ac995bd..f71b8d5 100644 --- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/prodProcess/mapper/ProdProcessMapper.xml +++ b/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/prodProcess/mapper/ProdProcessMapper.xml @@ -25,9 +25,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bop.color, bop.cover_color, bop.picture as order_prod_picture, + bop.spec as order_prod_spec, + bop.material_no as order_prod_material_no, bo.order_no as order_no, bo.picture as order_picture, bo.status as order_status, + bo.order_date as order_date, + bo.customer as order_customer, + bo.delivery_date as order_delivery_date, + bo.material as order_material, + bo.remark as order_remark, + bo.create_by as order_create_by, + bo.create_time as order_create_time, + bo.num as order_num, sd.dept_name as dept_name from bst_prod_process bpp left join bst_order_prod bop on bop.id = bpp.order_prod_id diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/bst/DashboardController.java b/ruoyi-web/src/main/java/com/ruoyi/web/bst/DashboardController.java new file mode 100644 index 0000000..4f650b5 --- /dev/null +++ b/ruoyi-web/src/main/java/com/ruoyi/web/bst/DashboardController.java @@ -0,0 +1,27 @@ +package com.ruoyi.web.bst; + +import com.ruoyi.bst.dashboard.service.DashboardService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author wjh + * 2024/12/26 + */ +@RestController +@RequestMapping("/dashboard") +public class DashboardController extends BaseController { + + @Autowired + private DashboardService dashboardService; + + @GetMapping("/brief") + public AjaxResult brief() { + return success(dashboardService.selectBrief()); + } + +} diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/bst/OrderController.java b/ruoyi-web/src/main/java/com/ruoyi/web/bst/OrderController.java index 6e4da6d..27c48f9 100644 --- a/ruoyi-web/src/main/java/com/ruoyi/web/bst/OrderController.java +++ b/ruoyi-web/src/main/java/com/ruoyi/web/bst/OrderController.java @@ -52,6 +52,12 @@ public class OrderController extends BaseController startOrderBy(); List list = orderService.selectOrderList(query); orderAssembler.assembleProgress(list); + + if (query.getNeedProd() != null && query.getNeedProd()) { + orderAssembler.assembleProdList(list, + query.getNeedProcess() != null && query.getNeedProcess(), + query.getNeedProdProgress() != null && query.getNeedProdProgress()); + } return getDataTable(list); } @@ -77,7 +83,7 @@ public class OrderController extends BaseController { OrderVO vo = orderService.selectOrderById(id); List list = Collections.singletonList(vo); - orderAssembler.assembleProdList(list, true); + orderAssembler.assembleProdList(list, true, false); orderAssembler.assembleProgress(list); return success(vo); } diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/bst/ProdProcessController.java b/ruoyi-web/src/main/java/com/ruoyi/web/bst/ProdProcessController.java index 503d4d1..7854d90 100644 --- a/ruoyi-web/src/main/java/com/ruoyi/web/bst/ProdProcessController.java +++ b/ruoyi-web/src/main/java/com/ruoyi/web/bst/ProdProcessController.java @@ -17,6 +17,7 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.util.Collections; import java.util.List; /** @@ -81,7 +82,10 @@ public class ProdProcessController extends BaseController @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { - return success(prodProcessService.selectProdProcessById(id)); + ProdProcessVO process = prodProcessService.selectProdProcessById(id); + List list = Collections.singletonList(process); + prodProcessAssembler.assembleProgress(list); + return success(process); } /**