更新优化
This commit is contained in:
parent
9e18014c22
commit
e8b422510f
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"java.compile.nullAnalysis.mode": "automatic"
|
||||
}
|
|
@ -21,22 +21,40 @@ public class OrderVO extends Order{
|
|||
@ApiModelProperty("最终产品ID")
|
||||
private Long finalProdId;
|
||||
|
||||
@ApiModelProperty("最终工序总上报数")
|
||||
@ApiModelProperty("产品总上报数")
|
||||
private BigDecimal reportNum;
|
||||
|
||||
@ApiModelProperty("最终工序有效清点数")
|
||||
@ApiModelProperty("产品有效清点数")
|
||||
private BigDecimal storeNum;
|
||||
|
||||
@ApiModelProperty("总数量")
|
||||
@ApiModelProperty("产品总数")
|
||||
private BigDecimal totalNum;
|
||||
|
||||
@ApiModelProperty("进度")
|
||||
@ApiModelProperty("成品总上报数")
|
||||
private BigDecimal endReportNum;
|
||||
|
||||
@ApiModelProperty("成品有效清点数")
|
||||
private BigDecimal endStoreNum;
|
||||
|
||||
@ApiModelProperty("生产进度")
|
||||
public BigDecimal getProgress() {
|
||||
if (this.storeNum == null || this.getNum() == null) {
|
||||
if (this.storeNum == null || this.getTotalNum() == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return this.storeNum
|
||||
.subtract(this.getNum())
|
||||
.multiply(new BigDecimal(100))
|
||||
.divide(this.getTotalNum(), 2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
@ApiModelProperty("产品进度")
|
||||
public BigDecimal getEndProgress() {
|
||||
if (this.endStoreNum == null || this.getNum() == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return this.endStoreNum
|
||||
.multiply(new BigDecimal(100))
|
||||
.divide(this.getNum(), 2, RoundingMode.HALF_UP);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,4 +27,9 @@ public interface OrderAssembler {
|
|||
*/
|
||||
void assembleProdProcessList(List<OrderVO> list);
|
||||
|
||||
/**
|
||||
* 拼接成为VO
|
||||
* @param list
|
||||
*/
|
||||
void assembleVO(List<OrderVO> list);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.ruoyi.common.utils.collection.CollectionUtils;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -39,15 +40,6 @@ public class OrderAssemblerImpl implements OrderAssembler {
|
|||
query.setOrderIds(CollectionUtils.map(list, OrderVO::getId));
|
||||
List<OrderProdVO> prodList = orderProdService.selectOrderProdList(query);
|
||||
|
||||
// 拼接进度
|
||||
if (assembleProgress) {
|
||||
orderProdAssembler.assembleProgress(prodList);
|
||||
}
|
||||
|
||||
// 拼接明细
|
||||
if (assembleProcess) {
|
||||
}
|
||||
|
||||
// 分组
|
||||
Map<Long, List<OrderProdVO>> group = prodList.stream().collect(Collectors.groupingBy(OrderProdVO::getOrderId));
|
||||
|
||||
|
@ -59,23 +51,6 @@ public class OrderAssemblerImpl implements OrderAssembler {
|
|||
}
|
||||
vo.setProdList(productList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assembleProgress(List<OrderVO> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.assembleProdList(list);
|
||||
|
||||
for (OrderVO order : list) {
|
||||
order.setTotalNum(CollectionUtils.sumDecimal(order.getProdList(), OrderProdVO::getNum));
|
||||
order.setReportNum(CollectionUtils.sumDecimal(order.getProdList(), OrderProdVO::getReportNum));
|
||||
order.setStoreNum(CollectionUtils.sumDecimal(order.getProdList(), OrderProdVO::getStoreNum));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,4 +61,39 @@ public class OrderAssemblerImpl implements OrderAssembler {
|
|||
List<OrderProdVO> prodList = list.stream().map(OrderVO::getProdList).flatMap(List::stream).collect(Collectors.toList());
|
||||
orderProdAssembler.assembleProcessList(prodList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assembleVO(List<OrderVO> list) {
|
||||
this.assembleProdList(list);
|
||||
this.assembleProdProcessList(list);
|
||||
this.assembleProgress(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assembleProgress(List<OrderVO> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return;
|
||||
}
|
||||
List<OrderProdVO> prodList = list.stream().map(OrderVO::getProdList).flatMap(List::stream).collect(Collectors.toList());
|
||||
orderProdAssembler.assembleProgress(prodList);
|
||||
|
||||
for (OrderVO order : list) {
|
||||
order.setTotalNum(CollectionUtils.sumDecimal(order.getProdList(), OrderProdVO::getNum));
|
||||
order.setReportNum(CollectionUtils.sumDecimal(order.getProdList(), OrderProdVO::getReportNum));
|
||||
order.setStoreNum(CollectionUtils.sumDecimal(order.getProdList(), OrderProdVO::getStoreNum));
|
||||
|
||||
// 成品
|
||||
OrderProdVO endProd = order.getProdList().stream()
|
||||
.filter(item -> item.getIsEnd() != null && item.getIsEnd())
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (endProd != null) {
|
||||
order.setEndReportNum(endProd.getReportNum());
|
||||
order.setEndStoreNum(endProd.getStoreNum());
|
||||
} else {
|
||||
order.setEndReportNum(BigDecimal.ZERO);
|
||||
order.setEndStoreNum(BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,8 +238,8 @@ public class OrderServiceImpl implements OrderService
|
|||
ServiceUtil.assertion(!OrderStatus.canFinished().contains(old.getStatus()), "当前订单状态不允许完工");
|
||||
|
||||
List<OrderVO> list = Collections.singletonList(old);
|
||||
orderAssembler.assembleProgress(list);
|
||||
ServiceUtil.assertion(old.getProgress().compareTo(new BigDecimal("100")) < 0, "当前订单进度:%s%%,暂不满足完工条件:100%%", old.getProgress());
|
||||
orderAssembler.assembleVO(list);
|
||||
ServiceUtil.assertion(old.getEndProgress().compareTo(new BigDecimal("100")) < 0, "当前订单进度:%s%%,暂不满足完工条件:100%%", old.getEndProgress());
|
||||
|
||||
// 更新订单状态
|
||||
Order data = new Order();
|
||||
|
|
|
@ -25,9 +25,9 @@ public class OrderProd extends BaseEntity
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "ID")
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "订单ID")
|
||||
@ApiModelProperty("订单ID")
|
||||
private Long orderId;
|
||||
|
||||
|
|
|
@ -17,4 +17,7 @@ public class OrderProdQuery extends OrderProdVO{
|
|||
|
||||
@ApiModelProperty("是否拼接明细")
|
||||
private Boolean assembleProcessList;
|
||||
|
||||
@ApiModelProperty("产品名称列表")
|
||||
private List<String> eqNames;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.bst.orderProd.domain.vo;
|
||||
|
||||
import com.ruoyi.bst.orderProd.domain.OrderProdVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/3/4
|
||||
*/
|
||||
@Data
|
||||
public class OrderProdGroupNameVO {
|
||||
|
||||
@ApiModelProperty("产品名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private BigDecimal totalNum;
|
||||
|
||||
@ApiModelProperty("上报数量")
|
||||
private BigDecimal reportNum;
|
||||
|
||||
@ApiModelProperty("清点数量")
|
||||
private BigDecimal storeNum;
|
||||
|
||||
@ApiModelProperty("产品列表")
|
||||
private List<OrderProdVO> prodList;
|
||||
}
|
|
@ -79,4 +79,9 @@ public interface OrderProdMapper
|
|||
int logicDel(@Param("ids") List<Long> ids);
|
||||
|
||||
int logicDelByOrderId(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 查询产品名称列表
|
||||
*/
|
||||
List<String> selectNameList(@Param("query") OrderProdQuery query);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.coverColor != null and query.coverColor != ''"> and bop.cover_color like concat('%', #{query.coverColor}, '%')</if>
|
||||
<if test="query.no != null and query.no != ''"> and bop.no like concat('%', #{query.no}, '%')</if>
|
||||
<if test="query.workName != null and query.workName != ''"> and bop.work_name like concat('%', #{query.workName}, '%')</if>
|
||||
<if test="query.eqNames != null and query.eqNames.size() > 0">
|
||||
and bop.name in
|
||||
<foreach collection="query.eqNames" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="query.orderIds != null and query.orderIds.size() > 0">
|
||||
and bop.order_id in
|
||||
<foreach collection="query.orderIds" item="item" open="(" close=")" separator=",">
|
||||
|
@ -72,6 +78,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectNameList" resultType="java.lang.String">
|
||||
select distinct
|
||||
bop.name
|
||||
from bst_order_prod bop
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertOrderProd" parameterType="OrderProd" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into bst_order_prod
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
|
@ -83,4 +83,12 @@ public interface IOrderProdService
|
|||
int batchLogicDel(List<? extends OrderProd> list);
|
||||
|
||||
int logicDelByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 查询订单产品列表
|
||||
*
|
||||
* @param query 订单产品列表
|
||||
* @return
|
||||
*/
|
||||
List<String> selectNameList(OrderProdQuery query);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.bst.orderProd.service;
|
||||
|
||||
import com.ruoyi.bst.orderProd.domain.OrderProdQuery;
|
||||
import com.ruoyi.bst.orderProd.domain.OrderProdVO;
|
||||
import com.ruoyi.bst.orderProd.domain.vo.OrderProdGroupNameVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -20,4 +22,14 @@ public interface OrderProdAssembler {
|
|||
*/
|
||||
void assembleProgress(List<OrderProdVO> list);
|
||||
|
||||
/**
|
||||
* 拼接产品列表
|
||||
*/
|
||||
void assembleProdList(List<OrderProdGroupNameVO> list, OrderProdQuery query);
|
||||
|
||||
/**
|
||||
* 汇总数量
|
||||
*/
|
||||
void assembleTotalNum(List<OrderProdGroupNameVO> list);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.ruoyi.bst.orderProd.service.impl;
|
||||
|
||||
import com.ruoyi.bst.orderProd.domain.OrderProdQuery;
|
||||
import com.ruoyi.bst.orderProd.domain.OrderProdVO;
|
||||
import com.ruoyi.bst.orderProd.domain.enums.OrderProdWorkType;
|
||||
import com.ruoyi.bst.orderProd.domain.vo.OrderProdGroupNameVO;
|
||||
import com.ruoyi.bst.orderProd.service.IOrderProdService;
|
||||
import com.ruoyi.bst.orderProd.service.OrderProdAssembler;
|
||||
import com.ruoyi.bst.prodProcess.domain.ProdProcess;
|
||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
||||
|
@ -32,6 +35,9 @@ public class OrderProdAssemblerImpl implements OrderProdAssembler {
|
|||
@Autowired
|
||||
private ProdProcessAssembler prodProcessAssembler;
|
||||
|
||||
@Autowired
|
||||
private IOrderProdService orderProdService;
|
||||
|
||||
@Override
|
||||
public void assembleProcessList(List<OrderProdVO> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
|
@ -67,7 +73,9 @@ public class OrderProdAssemblerImpl implements OrderProdAssembler {
|
|||
for (OrderProdVO prod : list) {
|
||||
// 自加工
|
||||
if (OrderProdWorkType.SELF.getType().equals(prod.getWorkType())) {
|
||||
ProdProcessVO process = processList.stream().filter(item -> Objects.equals(item.getOrderProdId(), prod.getId())).findFirst().orElse(null);
|
||||
ProdProcessVO process = processList.stream()
|
||||
.filter(item -> Objects.equals(item.getOrderProdId(), prod.getId()))
|
||||
.findFirst().orElse(null);
|
||||
if (process == null) {
|
||||
prod.setReportNum(BigDecimal.ZERO);
|
||||
prod.setStoreNum(BigDecimal.ZERO);
|
||||
|
@ -84,4 +92,44 @@ public class OrderProdAssemblerImpl implements OrderProdAssembler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assembleProdList(List<OrderProdGroupNameVO> list, OrderProdQuery query) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
query.setEqNames(CollectionUtils.map(list, OrderProdGroupNameVO::getName));
|
||||
List<OrderProdVO> prodList = orderProdService.selectOrderProdList(query);
|
||||
this.assembleProcessList(prodList);
|
||||
this.assembleProgress(prodList);
|
||||
Map<String, List<OrderProdVO>> group = prodList.stream().collect(Collectors.groupingBy(OrderProdVO::getName));
|
||||
|
||||
for (OrderProdGroupNameVO vo : list) {
|
||||
List<OrderProdVO> groupList = group.get(vo.getName());
|
||||
if (groupList == null) {
|
||||
groupList = new ArrayList<>();
|
||||
}
|
||||
vo.setProdList(groupList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assembleTotalNum(List<OrderProdGroupNameVO> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return;
|
||||
}
|
||||
List<OrderProdVO> prodList = list.stream()
|
||||
.map(OrderProdGroupNameVO::getProdList)
|
||||
.flatMap(List::stream).collect(Collectors.toList());
|
||||
|
||||
this.assembleProgress(prodList);
|
||||
|
||||
for (OrderProdGroupNameVO vo : list) {
|
||||
vo.setTotalNum(CollectionUtils.sumDecimal(vo.getProdList(), OrderProdVO::getNum));
|
||||
vo.setReportNum(CollectionUtils.sumDecimal(vo.getProdList(), OrderProdVO::getReportNum));
|
||||
vo.setStoreNum(CollectionUtils.sumDecimal(vo.getProdList(), OrderProdVO::getStoreNum));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,4 +148,9 @@ public class OrderProdServiceImpl implements IOrderProdService
|
|||
}
|
||||
return orderProdMapper.logicDelByOrderId(orderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> selectNameList(OrderProdQuery query) {
|
||||
return orderProdMapper.selectNameList(query); // 新增的方法实现
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 产品工序Mapper接口
|
||||
|
@ -76,4 +77,9 @@ public interface ProdProcessMapper
|
|||
int logicDel(@Param("ids") List<Long> ids);
|
||||
|
||||
int logicDelByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 查询汇总
|
||||
*/
|
||||
public List<Map<String, Object>> selectSum(@Param("query")ProdProcessQuery query, @Param("groupBy")List<String> groupBy);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bo.content_num as order_content_num,
|
||||
bo.package_size as order_package_size,
|
||||
sd.dept_name as dept_name
|
||||
from bst_prod_process bpp
|
||||
from <include refid="searchTables"/>
|
||||
</sql>
|
||||
|
||||
<sql id="searchTables">
|
||||
bst_prod_process bpp
|
||||
left join bst_order_prod bop on bop.id = bpp.order_prod_id
|
||||
left join bst_order bo on bo.id = bop.order_id
|
||||
left join sys_dept sd on sd.dept_id = bpp.dept_id
|
||||
|
@ -315,4 +319,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- selectSum -->
|
||||
<select id="selectSum">
|
||||
select
|
||||
<if test="groupBy != null and groupBy.size() > 0">
|
||||
<foreach collection="groupBy" item="item">
|
||||
${item},
|
||||
</foreach>
|
||||
</if>
|
||||
sum(bpp.num) as num,
|
||||
sum((select sum(num) from bst_store bs where bs.process_id = bpp.id group by bs.process_id)) as reportNum,
|
||||
sum((select sum(store_num) from bst_store bs where bs.process_id = bpp.id group by bs.process_id)) as storeNum
|
||||
from <include refid="searchTables"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
<if test="groupBy != null and groupBy.size() > 0">
|
||||
group by
|
||||
<foreach collection="groupBy" item="item" separator=",">
|
||||
${item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -70,8 +70,15 @@ public class Store extends BaseEntity
|
|||
@Size(max = 200, message = "备注长度不能超过200个字符")
|
||||
private String remark;
|
||||
|
||||
@Excel(name = "上报时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 10)
|
||||
@Excel(name = "上报时间", width = 30, dateFormat = "yyyy-MM-dd", sort = 10)
|
||||
@ApiModelProperty("上报时间")
|
||||
private Date createTime;
|
||||
|
||||
public Date getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="num != null">num,</if>
|
||||
<if test="storeNum != null">store_num,</if>
|
||||
<if test="createId != null">create_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="status != null and status != ''">`status`,</if>
|
||||
<if test="storeUserId != null">store_user_id,</if>
|
||||
<if test="storeTime != null">store_time,</if>
|
||||
|
@ -115,13 +114,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createBy != null">create_by,</if>
|
||||
<if test="storeBy != null">store_by,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
create_time,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="processId != null">#{processId},</if>
|
||||
<if test="num != null">#{num},</if>
|
||||
<if test="storeNum != null">#{storeNum},</if>
|
||||
<if test="createId != null">#{createId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="storeUserId != null">#{storeUserId},</if>
|
||||
<if test="storeTime != null">#{storeTime},</if>
|
||||
|
@ -129,6 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="storeBy != null">#{storeBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
now(),
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.ruoyi.dashboard.prodProcess.domain.sum;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ProdProcessSumVO {
|
||||
|
||||
@ApiModelProperty("总数量")
|
||||
private BigDecimal num;
|
||||
|
||||
@ApiModelProperty("上报数量")
|
||||
private BigDecimal reportNum;
|
||||
|
||||
@ApiModelProperty("清点数量")
|
||||
private BigDecimal storeNum;
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.ruoyi.dashboard.prodProcess.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
||||
import com.ruoyi.bst.prodProcess.mapper.ProdProcessMapper;
|
||||
import com.ruoyi.dashboard.prodProcess.domain.sum.ProdProcessSumVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ProdProcessDashboardService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProdProcessMapper prodProcessMapper;
|
||||
|
||||
// 查询数量汇总, 并分组
|
||||
public <T> List<T> selectSum(ProdProcessQuery query, List<String> groupBy, Class<T> clazz) {
|
||||
List<Map<String, Object>> list = prodProcessMapper.selectSum(query, groupBy);
|
||||
if (list.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return JSON.parseArray(JSON.toJSONString(list), clazz);
|
||||
}
|
||||
|
||||
// 查询数量汇总
|
||||
public ProdProcessSumVO selectSum(ProdProcessQuery query) {
|
||||
List<ProdProcessSumVO> list = selectSum(query, null, ProdProcessSumVO.class);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
}
|
|
@ -52,9 +52,7 @@ public class OrderController extends BaseController
|
|||
startPage();
|
||||
startOrderBy();
|
||||
List<OrderVO> list = orderService.selectOrderList(query);
|
||||
orderAssembler.assembleProdList(list);
|
||||
orderAssembler.assembleProdProcessList(list);
|
||||
orderAssembler.assembleProgress(list);
|
||||
orderAssembler.assembleVO(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -80,8 +78,7 @@ public class OrderController extends BaseController
|
|||
{
|
||||
OrderVO vo = orderService.selectOrderById(id);
|
||||
List<OrderVO> list = Collections.singletonList(vo);
|
||||
orderAssembler.assembleProdList(list, true, true);
|
||||
orderAssembler.assembleProgress(list);
|
||||
orderAssembler.assembleVO(list);
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.web.bst;
|
|||
import com.ruoyi.bst.orderProd.domain.OrderProd;
|
||||
import com.ruoyi.bst.orderProd.domain.OrderProdQuery;
|
||||
import com.ruoyi.bst.orderProd.domain.OrderProdVO;
|
||||
import com.ruoyi.bst.orderProd.domain.vo.OrderProdGroupNameVO;
|
||||
import com.ruoyi.bst.orderProd.service.IOrderProdService;
|
||||
import com.ruoyi.bst.orderProd.service.OrderProdAssembler;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
|
@ -16,6 +17,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -44,9 +46,9 @@ public class OrderProdController extends BaseController
|
|||
startPage();
|
||||
startOrderBy();
|
||||
List<OrderProdVO> list = orderProdService.selectOrderProdList(query);
|
||||
orderProdAssembler.assembleProgress(list);
|
||||
if (query.getAssembleProcessList() != null && query.getAssembleProcessList()) {
|
||||
orderProdAssembler.assembleProcessList(list, true);
|
||||
orderProdAssembler.assembleProcessList(list);
|
||||
orderProdAssembler.assembleProgress(list);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
@ -59,6 +61,7 @@ public class OrderProdController extends BaseController
|
|||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, OrderProdQuery query)
|
||||
{
|
||||
startPage();
|
||||
List<OrderProdVO> list = orderProdService.selectOrderProdList(query);
|
||||
ExcelUtil<OrderProdVO> util = new ExcelUtil<OrderProdVO>(OrderProdVO.class);
|
||||
util.exportExcel(response, list, "订单产品数据");
|
||||
|
@ -106,4 +109,27 @@ public class OrderProdController extends BaseController
|
|||
{
|
||||
return toAjax(orderProdService.deleteOrderProdByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据产品名称分组查询列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:orderProd:list')")
|
||||
@GetMapping("/groupByName")
|
||||
public TableDataInfo groupByName(OrderProdQuery query)
|
||||
{
|
||||
startPage();
|
||||
List<String> list = orderProdService.selectNameList(query);
|
||||
List<OrderProdGroupNameVO> groupList = new ArrayList<>();
|
||||
for (String name : list) {
|
||||
OrderProdGroupNameVO vo = new OrderProdGroupNameVO();
|
||||
vo.setName(name);
|
||||
groupList.add(vo);
|
||||
}
|
||||
|
||||
// 拼接明细
|
||||
orderProdAssembler.assembleProdList(groupList, query);
|
||||
// 汇总数量
|
||||
orderProdAssembler.assembleTotalNum(groupList);
|
||||
return getDataTable(groupList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.ruoyi.web.dashboard;
|
||||
|
||||
import com.ruoyi.bst.prodProcess.domain.ProdProcessQuery;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.dashboard.prodProcess.service.ProdProcessDashboardService;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dashboard/prodProcess")
|
||||
public class DashboardProdProcessController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ProdProcessDashboardService prodProcessDashboardService;
|
||||
|
||||
@GetMapping("/sum")
|
||||
public AjaxResult sum(ProdProcessQuery query) {
|
||||
return success(prodProcessDashboardService.selectSum(query));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user