This commit is contained in:
磷叶 2024-12-26 21:15:38 +08:00
parent 29080f29bc
commit f0fd164daa
14 changed files with 198 additions and 6 deletions

View File

@ -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;
}

View File

@ -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<LocalDate> 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;
}
}

View File

@ -24,4 +24,13 @@ public class OrderQuery extends OrderVO{
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("交货日期范围") @ApiModelProperty("交货日期范围")
private List<LocalDate> deliveryDateRange; private List<LocalDate> deliveryDateRange;
@ApiModelProperty("是否包含产品")
private Boolean needProd;
@ApiModelProperty("是否包含产品进度")
private Boolean needProdProgress;
@ApiModelProperty("是否包含工序")
private Boolean needProcess;
} }

View File

@ -67,4 +67,9 @@ public interface OrderMapper
* 条件更新 * 条件更新
*/ */
int updateByQuery(@Param("data") Order data, @Param("query") OrderQuery query); int updateByQuery(@Param("data") Order data, @Param("query") OrderQuery query);
/**
* 查询数量
*/
int selectCount(@Param("query") OrderQuery query);
} }

View File

@ -61,6 +61,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectCount" resultType="java.lang.Integer">
select count(bo.id)
from bst_order bo
<where>
<include refid="searchCondition"/>
</where>
</select>
<insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id"> <insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
insert into bst_order insert into bst_order
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -12,10 +12,12 @@ public interface OrderAssembler {
/** /**
* 拼接产品列表 * 拼接产品列表
* @param list 订单列表 *
* @param assembleProcess 是否拼接工序 * @param list 订单列表
* @param assembleProcess 是否拼接工序
* @param assembleProgress
*/ */
void assembleProdList(List<OrderVO> list, boolean assembleProcess); void assembleProdList(List<OrderVO> list, boolean assembleProcess, boolean assembleProgress);
/** /**
* 拼接进度 * 拼接进度

View File

@ -82,4 +82,9 @@ public interface OrderService
* 完成订单 * 完成订单
*/ */
int finish(Long id); int finish(Long id);
/**
* 查询数量
*/
int selectCount(OrderQuery query);
} }

View File

@ -31,7 +31,7 @@ public class OrderAssemblerImpl implements OrderAssembler {
private OrderProdAssembler orderProdAssembler; private OrderProdAssembler orderProdAssembler;
@Override @Override
public void assembleProdList(List<OrderVO> list, boolean assembleProcess) { public void assembleProdList(List<OrderVO> list, boolean assembleProcess, boolean assembleProgress) {
if (CollectionUtils.isEmptyElement(list)) { if (CollectionUtils.isEmptyElement(list)) {
return; return;
} }
@ -41,6 +41,11 @@ public class OrderAssemblerImpl implements OrderAssembler {
query.setOrderIds(CollectionUtils.map(list, OrderVO::getId)); query.setOrderIds(CollectionUtils.map(list, OrderVO::getId));
List<OrderProdVO> prodList = orderProdService.selectOrderProdList(query); List<OrderProdVO> prodList = orderProdService.selectOrderProdList(query);
// 拼接进度
if (assembleProgress) {
orderProdAssembler.assembleProgress(prodList);
}
// 拼接明细 // 拼接明细
if (assembleProcess) { if (assembleProcess) {
orderProdAssembler.assembleProcessList(prodList, true); orderProdAssembler.assembleProcessList(prodList, true);

View File

@ -240,6 +240,11 @@ public class OrderServiceImpl implements OrderService
return updateByQuery(data, query); return updateByQuery(data, query);
} }
@Override
public int selectCount(OrderQuery query) {
return orderMapper.selectCount(query);
}
private int updateByQuery(Order data, OrderQuery query) { private int updateByQuery(Order data, OrderQuery query) {
return orderMapper.updateByQuery(data, query); return orderMapper.updateByQuery(data, query);
} }

View File

@ -6,6 +6,8 @@ import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
/** /**
* @author wjh * @author wjh
@ -26,6 +28,30 @@ public class ProdProcessVO extends ProdProcess{
@ApiModelProperty("订单图片") @ApiModelProperty("订单图片")
private String orderPicture; 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("生产车间名称") @ApiModelProperty("生产车间名称")
private String deptName; private String deptName;
@ -41,6 +67,15 @@ public class ProdProcessVO extends ProdProcess{
@ApiModelProperty("有效清点数") @ApiModelProperty("有效清点数")
private BigDecimal storeNum; private BigDecimal storeNum;
@ApiModelProperty("产品规格")
private String orderProdSpec;
@ApiModelProperty("产品物料编码")
private String orderProdMaterialNo;
@ApiModelProperty("产品备注")
private String orderProdRemark;
@Excel(name = "处理方式") @Excel(name = "处理方式")
@ApiModelProperty("处理方式") @ApiModelProperty("处理方式")
private String handleWay; private String handleWay;
@ -57,6 +92,8 @@ public class ProdProcessVO extends ProdProcess{
@ApiModelProperty("盖子颜色") @ApiModelProperty("盖子颜色")
private String coverColor; private String coverColor;
@ApiModelProperty("进度") @ApiModelProperty("进度")
public BigDecimal getProgress() { public BigDecimal getProgress() {
if (this.storeNum == null || this.getNum() == null) { if (this.storeNum == null || this.getNum() == null) {

View File

@ -25,9 +25,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bop.color, bop.color,
bop.cover_color, bop.cover_color,
bop.picture as order_prod_picture, 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.order_no as order_no,
bo.picture as order_picture, bo.picture as order_picture,
bo.status as order_status, 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 sd.dept_name as dept_name
from bst_prod_process bpp from bst_prod_process bpp
left join bst_order_prod bop on bop.id = bpp.order_prod_id left join bst_order_prod bop on bop.id = bpp.order_prod_id

View File

@ -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());
}
}

View File

@ -52,6 +52,12 @@ public class OrderController extends BaseController
startOrderBy(); startOrderBy();
List<OrderVO> list = orderService.selectOrderList(query); List<OrderVO> list = orderService.selectOrderList(query);
orderAssembler.assembleProgress(list); 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); return getDataTable(list);
} }
@ -77,7 +83,7 @@ public class OrderController extends BaseController
{ {
OrderVO vo = orderService.selectOrderById(id); OrderVO vo = orderService.selectOrderById(id);
List<OrderVO> list = Collections.singletonList(vo); List<OrderVO> list = Collections.singletonList(vo);
orderAssembler.assembleProdList(list, true); orderAssembler.assembleProdList(list, true, false);
orderAssembler.assembleProgress(list); orderAssembler.assembleProgress(list);
return success(vo); return success(vo);
} }

View File

@ -17,6 +17,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -81,7 +82,10 @@ public class ProdProcessController extends BaseController
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
return success(prodProcessService.selectProdProcessById(id)); ProdProcessVO process = prodProcessService.selectProdProcessById(id);
List<ProdProcessVO> list = Collections.singletonList(process);
prodProcessAssembler.assembleProgress(list);
return success(process);
} }
/** /**