From eccacd586dfbaace7c47bf52f4c96d096d8ef7dc Mon Sep 17 00:00:00 2001
From: zhanghl <253316343@qq.com>
Date: 星期三, 23 四月 2025 18:20:20 +0800
Subject: [PATCH] 钣金按部门统计时间
---
aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml | 37 +-
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java | 67 ++++
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopStat.java | 140 +++++++++
aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateProcessShopStatMapper.xml | 118 +++++++
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopPlanStat.java | 68 ++++
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateProcessShopStatService.java | 67 ++++
aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml | 1
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java | 3
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateProcessShopStatController.java | 74 ++++
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateProcessShopStatServiceImpl.java | 283 ++++++++++++++++++
10 files changed, 840 insertions(+), 18 deletions(-)
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateProcessShopStatController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateProcessShopStatController.java
new file mode 100644
index 0000000..687fc25
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateProcessShopStatController.java
@@ -0,0 +1,74 @@
+package com.aps.core.controller.mainPlan;
+
+import com.aps.common.core.utils.poi.ExcelUtil;
+import com.aps.common.core.web.controller.BaseController;
+import com.aps.common.core.web.domain.AjaxResult;
+import com.aps.common.core.web.page.TableDataInfo;
+import com.aps.common.log.annotation.Log;
+import com.aps.common.log.enums.BusinessType;
+import com.aps.common.security.annotation.RequiresPermissions;
+import com.aps.core.domain.ApsPlateProcessShopStat;
+import com.aps.core.service.IApsPlateProcessShopStatService;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 閽i噾杞﹂棿缁熻Controller
+ *
+ * @author zhl
+ * @date 2025-04-23
+ */
+
+
+@RestController
+@RequestMapping("/ApsPlateProcessShopStat")
+public class ApsPlateProcessShopStatController extends BaseController
+{
+ @Autowired
+ private IApsPlateProcessShopStatService apsPlateProcessShopStatService;
+
+
+ /**
+ * 瀵煎嚭閽i噾杞﹂棿缁熻鍒楄〃
+ */
+
+ @RequiresPermissions("ApsPlateProcessShopStat:ApsPlateProcessShopStat:export")
+ @Log(title = "閽i噾杞﹂棿缁熻", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ApsPlateProcessShopStat apsPlateProcessShopStat)
+ {
+ List<ApsPlateProcessShopStat> list = apsPlateProcessShopStatService.selectApsPlateProcessShopStatList(apsPlateProcessShopStat);
+ ExcelUtil<ApsPlateProcessShopStat> util = new ExcelUtil<ApsPlateProcessShopStat>(ApsPlateProcessShopStat.class);
+ util.exportExcel(response, list, "閽i噾杞﹂棿缁熻鏁版嵁");
+ }
+
+
+ /**
+ * 淇敼閽i噾杞﹂棿缁熻
+ */
+
+
+ @Log(title = "閽i噾杞﹂棿缁熻", businessType = BusinessType.UPDATE)
+ @PostMapping("/update")
+ public AjaxResult update(@RequestBody ApsPlateProcessShopStat apsPlateProcessShopStat)
+ {
+ apsPlateProcessShopStatService.saveShopStat();
+ return toAjax(true);
+ }
+
+ /**
+ * 鏌ヨ閽i噾杞﹂棿缁熻鍒楄〃
+ */
+
+
+ @GetMapping("/list")
+ public AjaxResult list(ApsPlateProcessShopStat apsPlateProcessShopStat)
+ {
+ return apsPlateProcessShopStatService.getShopPlanStat();
+
+ }
+
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopPlanStat.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopPlanStat.java
new file mode 100644
index 0000000..dbf0d80
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopPlanStat.java
@@ -0,0 +1,68 @@
+package com.aps.core.domain;
+
+import com.aps.common.core.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class ApsPlateProcessShopPlanStat implements Serializable {
+ @Serial
+ private static final long serialVersionUID = 1L;
+
+ /** 涓婚敭id */
+ private String id;
+ /** 涓讳欢鏂欏彿 */
+ @Excel(name = "涓讳欢鏂欏彿")
+ private String mainPartNumber;
+
+ /** 涓氬姟绫诲瀷 */
+ @Excel(name = "涓氬姟绫诲瀷")
+ private String businessType;
+
+ /** 鍗曟嵁鍙� */
+ @Excel(name = "鍗曟嵁鍙�")
+ private String documentNumber;
+
+ /** 闇�姹傚垎绫� */
+ @Excel(name = "闇�姹傚垎绫�")
+ private String requirementType;
+
+ /** 鍗曟嵁鐘舵�� */
+ @Excel(name = "鍗曟嵁鐘舵��")
+ private String documentStatus;
+
+ /** 褰撳墠宸ュ簭 */
+ @Excel(name = "褰撳墠宸ュ簭")
+ private String workCenter;
+
+
+ /** 鏂欏彿 */
+ @Excel(name = "鏂欏彿")
+ private String itemNumber;
+
+ /** 鍥惧彿 */
+ @Excel(name = "鍥惧彿")
+ private String drawingNo;
+
+ /** 鐗堟湰鍙� */
+ @Excel(name = "鐗堟湰鍙�")
+ private String versionNumber;
+
+ /** 鐢熶骇鏁伴噺 */
+ @Excel(name = "鐢熶骇鏁伴噺")
+ private BigDecimal productionQuantity;
+
+ /** 璁″垝瀹屽伐鏃� */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "璁″垝瀹屽伐鏃�", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date planEndDay;
+
+ private List<ApsPlateProcessShopStat> deptPlans=new ArrayList<>();
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopStat.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopStat.java
new file mode 100644
index 0000000..7ce2638
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessShopStat.java
@@ -0,0 +1,140 @@
+package com.aps.core.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.aps.common.core.annotation.Excel;
+//import io.swagger.annotations.ApiModel;
+//import io.swagger.annotations.ApiModelProperty;
+import com.aps.common.core.web.domain.BaseEntity;
+
+/**
+ * 閽i噾杞﹂棿缁熻瀵硅薄 aps_plate_process_shop_stat
+ *
+ * @author zhl
+ * @date 2025-04-23
+ */
+//@ApiModel("閽i噾杞﹂棿缁熻瀹炰綋绫�")
+public class ApsPlateProcessShopStat extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** $column.columnComment */
+ //@ApiModelProperty("$column.columnComment")
+ private Long id;
+
+ /** 鍗曟嵁鍙� */
+ @Excel(name = "鍗曟嵁鍙�")
+ ///@ApiModelProperty("鍗曟嵁鍙�")
+ private String docNo;
+
+ /** 杞﹂棿缂栫爜 */
+ @Excel(name = "杞﹂棿缂栫爜")
+ //@ApiModelProperty("杞﹂棿缂栫爜")
+ private String shopCode;
+
+ /** 杞﹂棿鍚嶇О */
+ @Excel(name = "杞﹂棿鍚嶇О")
+ //@ApiModelProperty("杞﹂棿鍚嶇О")
+ private String shopName;
+
+ /** 璁″垝寮�濮嬫椂闂� */
+ @Excel(name = "璁″垝寮�濮嬫椂闂�")
+ //@ApiModelProperty("璁″垝寮�濮嬫椂闂�")
+ private String planStartDate;
+
+ /** 璁″垝缁撴潫鏃ユ湡 */
+ @Excel(name = "璁″垝缁撴潫鏃ユ湡")
+ //@ApiModelProperty("璁″垝缁撴潫鏃ユ湡")
+ private String planEndDate;
+
+ /** 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� */
+ //@ApiModelProperty("鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�")
+ private String delFlag;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setDocNo(String docNo)
+ {
+ this.docNo = docNo;
+ }
+
+ public String getDocNo()
+ {
+ return docNo;
+ }
+
+ public void setShopCode(String shopCode)
+ {
+ this.shopCode = shopCode;
+ }
+
+ public String getShopCode()
+ {
+ return shopCode;
+ }
+
+ public void setShopName(String shopName)
+ {
+ this.shopName = shopName;
+ }
+
+ public String getShopName()
+ {
+ return shopName;
+ }
+
+ public void setPlanStartDate(String planStartDate)
+ {
+ this.planStartDate = planStartDate;
+ }
+
+ public String getPlanStartDate()
+ {
+ return planStartDate;
+ }
+
+ public void setPlanEndDate(String planEndDate)
+ {
+ this.planEndDate = planEndDate;
+ }
+
+ public String getPlanEndDate()
+ {
+ return planEndDate;
+ }
+
+ public void setDelFlag(String delFlag)
+ {
+ this.delFlag = delFlag;
+ }
+
+ public String getDelFlag()
+ {
+ return delFlag;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("docNo", getDocNo())
+ .append("shopCode", getShopCode())
+ .append("shopName", getShopName())
+ .append("planStartDate", getPlanStartDate())
+ .append("planEndDate", getPlanEndDate())
+ .append("delFlag", getDelFlag())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .toString();
+ }
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java
new file mode 100644
index 0000000..bca065d
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessShopStatMapper.java
@@ -0,0 +1,67 @@
+package com.aps.core.mapper;
+
+import java.util.List;
+import com.aps.core.domain.ApsPlateProcessShopStat;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 閽i噾杞﹂棿缁熻Mapper鎺ュ彛
+ *
+ * @author zhl
+ * @date 2025-04-23
+ */
+@Mapper
+public interface ApsPlateProcessShopStatMapper
+{
+ /**
+ * 鏌ヨ閽i噾杞﹂棿缁熻
+ *
+ * @param id 閽i噾杞﹂棿缁熻涓婚敭
+ * @return 閽i噾杞﹂棿缁熻
+ */
+ public ApsPlateProcessShopStat selectApsPlateProcessShopStatById(Long id);
+
+ /**
+ * 鏌ヨ閽i噾杞﹂棿缁熻鍒楄〃
+ *
+ * @param apsPlateProcessShopStat 閽i噾杞﹂棿缁熻
+ * @return 閽i噾杞﹂棿缁熻闆嗗悎
+ */
+ public List<ApsPlateProcessShopStat> selectApsPlateProcessShopStatList(ApsPlateProcessShopStat apsPlateProcessShopStat);
+
+ /**
+ * 鏂板閽i噾杞﹂棿缁熻
+ *
+ * @param apsPlateProcessShopStat 閽i噾杞﹂棿缁熻
+ * @return 缁撴灉
+ */
+ public int insertApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat);
+
+ /**
+ * 淇敼閽i噾杞﹂棿缁熻
+ *
+ * @param apsPlateProcessShopStat 閽i噾杞﹂棿缁熻
+ * @return 缁撴灉
+ */
+ public int updateApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat);
+
+ /**
+ * 鍒犻櫎閽i噾杞﹂棿缁熻
+ *
+ * @param id 閽i噾杞﹂棿缁熻涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteApsPlateProcessShopStatById(Long id);
+
+ /**
+ * 鎵归噺鍒犻櫎閽i噾杞﹂棿缁熻
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteApsPlateProcessShopStatByIds(Long[] ids);
+
+ int deleteAll();
+
+ void batchInsert(List<ApsPlateProcessShopStat> stats);
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateProcessShopStatService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateProcessShopStatService.java
new file mode 100644
index 0000000..2d76dc3
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateProcessShopStatService.java
@@ -0,0 +1,67 @@
+package com.aps.core.service;
+
+import java.util.List;
+
+import com.aps.common.core.web.domain.AjaxResult;
+import com.aps.core.domain.ApsPlateProcessShopStat;
+
+/**
+ * 閽i噾杞﹂棿缁熻Service鎺ュ彛
+ *
+ * @author zhl
+ * @date 2025-04-23
+ */
+public interface IApsPlateProcessShopStatService
+{
+ /**
+ * 鏌ヨ閽i噾杞﹂棿缁熻
+ *
+ * @param id 閽i噾杞﹂棿缁熻涓婚敭
+ * @return 閽i噾杞﹂棿缁熻
+ */
+ public ApsPlateProcessShopStat selectApsPlateProcessShopStatById(Long id);
+
+ /**
+ * 鏌ヨ閽i噾杞﹂棿缁熻鍒楄〃
+ *
+ * @param apsPlateProcessShopStat 閽i噾杞﹂棿缁熻
+ * @return 閽i噾杞﹂棿缁熻闆嗗悎
+ */
+ public List<ApsPlateProcessShopStat> selectApsPlateProcessShopStatList(ApsPlateProcessShopStat apsPlateProcessShopStat);
+
+ /**
+ * 鏂板閽i噾杞﹂棿缁熻
+ *
+ * @param apsPlateProcessShopStat 閽i噾杞﹂棿缁熻
+ * @return 缁撴灉
+ */
+ public int insertApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat);
+
+ /**
+ * 淇敼閽i噾杞﹂棿缁熻
+ *
+ * @param apsPlateProcessShopStat 閽i噾杞﹂棿缁熻
+ * @return 缁撴灉
+ */
+ public int updateApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat);
+
+ /**
+ * 鎵归噺鍒犻櫎閽i噾杞﹂棿缁熻
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑閽i噾杞﹂棿缁熻涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteApsPlateProcessShopStatByIds(Long[] ids);
+
+ /**
+ * 鍒犻櫎閽i噾杞﹂棿缁熻淇℃伅
+ *
+ * @param id 閽i噾杞﹂棿缁熻涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteApsPlateProcessShopStatById(Long id);
+
+ void saveShopStat();
+
+ AjaxResult getShopPlanStat();
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java
index defb7ec..eb57e76 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java
@@ -183,4 +183,7 @@
return Strings.EMPTY;
}
}
+
+
+
}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateProcessShopStatServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateProcessShopStatServiceImpl.java
new file mode 100644
index 0000000..dcaec74
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateProcessShopStatServiceImpl.java
@@ -0,0 +1,283 @@
+package com.aps.core.service.impl;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+import com.alibaba.fastjson.JSONObject;
+import com.aps.common.core.utils.DateUtils;
+import com.aps.common.core.utils.bean.BeanUtils;
+import com.aps.common.core.web.domain.AjaxResult;
+import com.aps.common.security.utils.SecurityUtils;
+import com.aps.core.domain.*;
+import com.aps.core.mapper.*;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.aps.core.service.IApsPlateProcessShopStatService;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 閽i噾杞﹂棿缁熻Service涓氬姟灞傚鐞�
+ *
+ * @author zhl
+ * @date 2025-04-23
+ */
+@Slf4j
+@Service
+public class ApsPlateProcessShopStatServiceImpl implements IApsPlateProcessShopStatService {
+ @Autowired
+ private ApsPlateProcessShopStatMapper apsPlateProcessShopStatMapper;
+ @Resource
+ private ApsPlateProcessStatMapper apsPlateProcessStatMapper;
+
+ @Resource
+ private ApsShopMapper shopMapper;
+
+ @Resource
+ private ApsStandardProcessMapper standardProcessMapper;
+
+ @Resource
+ private ApsPlatePlanMapper apsPlatePlanMapper;
+
+
+ /**
+ * 鏌ヨ閽i噾杞﹂棿缁熻
+ *
+ * @param id 閽i噾杞﹂棿缁熻涓婚敭
+ * @return 閽i噾杞﹂棿缁熻
+ */
+ @Override
+ public ApsPlateProcessShopStat selectApsPlateProcessShopStatById(Long id) {
+ return apsPlateProcessShopStatMapper.selectApsPlateProcessShopStatById(id);
+ }
+
+ /**
+ * 鏌ヨ閽i噾杞﹂棿缁熻鍒楄〃
+ *
+ * @param apsPlateProcessShopStat 閽i噾杞﹂棿缁熻
+ * @return 閽i噾杞﹂棿缁熻
+ */
+ @Override
+ public List<ApsPlateProcessShopStat> selectApsPlateProcessShopStatList(ApsPlateProcessShopStat apsPlateProcessShopStat) {
+ return apsPlateProcessShopStatMapper.selectApsPlateProcessShopStatList(apsPlateProcessShopStat);
+ }
+
+ /**
+ * 鏂板閽i噾杞﹂棿缁熻
+ *
+ * @param apsPlateProcessShopStat 閽i噾杞﹂棿缁熻
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat) {
+ apsPlateProcessShopStat.setCreateTime(DateUtils.getNowDate());
+ return apsPlateProcessShopStatMapper.insertApsPlateProcessShopStat(apsPlateProcessShopStat);
+ }
+
+ /**
+ * 淇敼閽i噾杞﹂棿缁熻
+ *
+ * @param apsPlateProcessShopStat 閽i噾杞﹂棿缁熻
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateApsPlateProcessShopStat(ApsPlateProcessShopStat apsPlateProcessShopStat) {
+ apsPlateProcessShopStat.setUpdateTime(DateUtils.getNowDate());
+ return apsPlateProcessShopStatMapper.updateApsPlateProcessShopStat(apsPlateProcessShopStat);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎閽i噾杞﹂棿缁熻
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑閽i噾杞﹂棿缁熻涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteApsPlateProcessShopStatByIds(Long[] ids) {
+ return apsPlateProcessShopStatMapper.deleteApsPlateProcessShopStatByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎閽i噾杞﹂棿缁熻淇℃伅
+ *
+ * @param id 閽i噾杞﹂棿缁熻涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteApsPlateProcessShopStatById(Long id) {
+ return apsPlateProcessShopStatMapper.deleteApsPlateProcessShopStatById(id);
+ }
+
+ /**
+ * 淇濆瓨閽i噾杞﹂棿缁熻
+ */
+ @Transactional
+ @Override
+ public void saveShopStat() {
+ try {
+ // 寮�濮嬩箣鍓嶅厛鍒犻櫎鎵�鏈夊巻鍙叉暟鎹�
+ apsPlateProcessShopStatMapper.deleteAll();
+
+ // 瀹氫箟璇ュ姛鑳戒娇鐢ㄦ暟鎹簮涓哄崡閫氱殑宸ュ巶
+ final String plant = "FORTUNA";
+
+ // 鏌ヨ鐩稿叧鏁版嵁
+ ApsPlatePlan platePlan = new ApsPlatePlan();
+ platePlan.setPlant(plant);
+ List<ApsPlatePlan> planList = apsPlatePlanMapper.selectApsPlatePlanList(platePlan);
+
+ List<ApsPlateProcessStat> statList = apsPlateProcessStatMapper.selectApsPlateProcessStatList(new ApsPlateProcessStat());
+
+ ApsShop apsShop = new ApsShop();
+ apsShop.setPlantCode(plant);
+ List<ApsShop> shopList = shopMapper.selectApsShopList(apsShop);
+
+ ApsStandardProcess process = new ApsStandardProcess();
+ process.setPlant(plant);
+ List<ApsStandardProcess> shopProcesses = standardProcessMapper.selectApsStandardProcessList(process);
+ if (planList.isEmpty() || shopList.isEmpty() || shopProcesses.isEmpty()) {
+ log.warn("璁″垝鍒楄〃銆佽溅闂村垪琛ㄦ垨宸ュ簭鍒楄〃涓虹┖锛屾棤娉曠敓鎴愮粺璁′俊鎭�");
+ return;
+ }
+ // 鏋勫缓杞﹂棿鍚嶇О鍒板伐搴忓悕绉扮殑鏄犲皠
+ Map<String, List<String>> shopToProcessNames = shopProcesses.stream()
+ .collect(Collectors.groupingBy(ApsStandardProcess::getWorkShop,
+ Collectors.mapping(ApsStandardProcess::getProcessName, Collectors.toList())
+ ));
+ // 鎵归噺鎻掑叆缁熻鏁版嵁
+ List<ApsPlateProcessShopStat> statsToInsert = new ArrayList<>();
+ for (ApsPlatePlan plan : planList) {
+ for (ApsShop shop : shopList) {
+ ApsPlateProcessShopStat stat = createShopStat(plan, shop, shopToProcessNames, statList);
+ statsToInsert.add(stat);
+ }
+ }
+ // 鎵归噺鎻掑叆浠ユ彁楂樻�ц兘
+ if (!statsToInsert.isEmpty()) {
+ int batchSize = 1000;
+ for (int i = 0; i < statsToInsert.size(); i += batchSize) {
+ int end = Math.min(i + batchSize, statsToInsert.size());
+ List<ApsPlateProcessShopStat> batch = statsToInsert.subList(i, end);
+ apsPlateProcessShopStatMapper.batchInsert(batch);
+ }
+ }
+ } catch (Exception e) {
+ log.error("淇濆瓨閽i噾杞﹂棿缁熻鏃跺彂鐢熷紓甯�", e);
+ throw new RuntimeException("淇濆瓨閽i噾杞﹂棿缁熻澶辫触", e);
+ }
+ }
+
+ /**
+ * 鍒涘缓鍗曚釜杞﹂棿缁熻瀵硅薄
+ */
+ private ApsPlateProcessShopStat createShopStat(ApsPlatePlan plan, ApsShop shop,
+ Map<String, List<String>> shopToProcessNames, List<ApsPlateProcessStat> statList) {
+ String shopName = shop.getShopName();
+ ApsPlateProcessShopStat stat = new ApsPlateProcessShopStat();
+ stat.setDocNo(plan.getDocumentNumber());
+ stat.setShopCode(shop.getShopCode());
+ stat.setShopName(shopName);
+ stat.setDelFlag("0");
+ stat.setCreateBy(SecurityUtils.getUsername());
+ stat.setCreateTime(DateUtils.getNowDate());
+
+ try {
+
+
+ List<String> processNames = shopToProcessNames.getOrDefault(shopName, Collections.emptyList());
+ if (!processNames.isEmpty()) {
+ // 鏍规嵁宸ュ簭鍚嶇О锛屾煡璇㈣宸ュ崟涓嬫墍鏈夌殑宸ュ簭淇℃伅
+ List<ApsPlateProcessStat> processStats = statList.stream()
+ .filter(x -> processNames.contains(x.getProcessName()) && x.getWorkOrderNo().equals(plan.getDocumentNumber()))
+ .toList();
+ if (!processStats.isEmpty()) {
+ // 鍙栧嚭宸ュ崟涓嬪伐搴忕殑鏈�灏忓紑濮嬫椂闂村拰鏈�澶х粨鏉熸椂闂�
+ List<Date> startDayList = processStats.stream().map(ApsPlateProcessStat::getProcessPlanStartDay).filter(Objects::nonNull).toList();
+ if (!startDayList.isEmpty()) {
+ if (startDayList.size() == 1) {
+ stat.setPlanStartDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", startDayList.get(0)));
+ } else {
+ Optional<Date> minStartDay = processStats.stream()
+ .map(ApsPlateProcessStat::getProcessPlanStartDay)
+ .min(Comparator.naturalOrder());
+ Date date = minStartDay.get();
+ stat.setPlanStartDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", date));
+ }
+
+
+ }
+ List<Date> endDayList = processStats.stream().map(ApsPlateProcessStat::getProcessPlanEndDay).filter(Objects::nonNull).toList();
+ if (!endDayList.isEmpty()) {
+ if (endDayList.size() == 1) {
+ stat.setPlanEndDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", endDayList.get(0)));
+ } else {
+ Optional<Date> maxEndDay = processStats.stream()
+ .map(ApsPlateProcessStat::getProcessPlanEndDay)
+ .max(Comparator.naturalOrder());
+ Date date = maxEndDay.get();
+ stat.setPlanEndDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", date));
+ }
+
+ }
+
+ }
+ }
+ } catch (Exception e) {
+ log.error("computer error:"+ JSONObject.toJSONString(stat));
+ }
+ return stat;
+ }
+
+ @Override
+ public AjaxResult getShopPlanStat() {
+ // 鎻愬彇纭紪鐮佸�间负甯搁噺
+ final String PLANT_CODE = "FORTUNA";
+
+ // 鍒濆鍖栧璞�
+ ApsPlatePlan platePlan = new ApsPlatePlan();
+ platePlan.setPlant(PLANT_CODE);
+
+ ApsShop apsShop = new ApsShop();
+ apsShop.setPlantCode(PLANT_CODE);
+
+ // 鑾峰彇杞﹂棿鍒楄〃骞跺鐞嗙┖鍊�
+ List<String> shopList = Optional.ofNullable(shopMapper.selectApsShopList(apsShop))
+ .orElse(Collections.emptyList())
+ .stream()
+ .map(ApsShop::getShopName)
+ .toList();
+
+ // 鑾峰彇璁″垝鍒楄〃鍜岀姸鎬佸垪琛�
+ List<ApsPlatePlan> planList = Optional.ofNullable(apsPlatePlanMapper.selectApsPlatePlanList(platePlan))
+ .orElse(Collections.emptyList());
+
+ List<ApsPlateProcessShopStat> shopStates = Optional.ofNullable(apsPlateProcessShopStatMapper.selectApsPlateProcessShopStatList(new ApsPlateProcessShopStat()))
+ .orElse(Collections.emptyList());
+
+ // 鎻愬墠瀵� shopStates 鎸� docNo 鍒嗙粍锛屽噺灏戦噸澶嶆祦鎿嶄綔
+ Map<String, List<ApsPlateProcessShopStat>> shopStatesByDocNo = shopStates.stream()
+ .collect(Collectors.groupingBy(ApsPlateProcessShopStat::getDocNo));
+
+ // 鏋勫缓缁撴灉鍒楄〃
+ List<ApsPlateProcessShopPlanStat> shopPlanStats = planList.stream()
+ .map(plan -> {
+ ApsPlateProcessShopPlanStat shopPlanStat = new ApsPlateProcessShopPlanStat();
+ BeanUtils.copyProperties(plan, shopPlanStat); // 纭繚鐩爣瀵硅薄鏄悎娉曠殑鍗曚釜瀵硅薄瀹炰緥
+
+ // 鏍规嵁 docNo 鑾峰彇瀵瑰簲鐨� shopStatList
+ List<ApsPlateProcessShopStat> shopStatList = shopStatesByDocNo.getOrDefault(plan.getDocumentNumber(), Collections.emptyList());
+ shopPlanStat.setDeptPlans(shopStatList);
+
+ return shopPlanStat;
+ })
+ .toList();
+
+ // 鏋勫缓杩斿洖缁撴灉
+ AjaxResult success = AjaxResult.success(shopPlanStats);
+ success.put("shopNames", shopList);
+ return success;
+ }
+
+
+}
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml
index 9231a28..6d758ea 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml
@@ -49,40 +49,41 @@
<select id="selectApsPlatePlanList" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult">
<include refid="selectApsPlatePlanVo"/>
<where>
- <if test="masterPlanner != null and masterPlanner != ''"> and master_planner like concat('%', #{masterPlanner}, '%')</if>
+ <if test="masterPlanner != null and masterPlanner != ''"> and master_planner like '%'|| #{masterPlanner}|| '%'</if>
<if test="weekDay != null "> and week_day = #{weekDay}</if>
- <if test="weekCycle != null and weekCycle != ''"> and week_cycle like concat('%', #{weekCycle}, '%')</if>
- <if test="mainPartNumber != null and mainPartNumber != ''"> and main_part_number like concat('%', #{mainPartNumber}, '%')</if>
- <if test="mainPartDrawingNumber != null and mainPartDrawingNumber != ''"> and main_part_drawing_number like concat('%', #{mainPartDrawingNumber}, '%')</if>
+ <if test="weekCycle != null and weekCycle != ''"> and week_cycle like '%'|| #{weekCycle}|| '%' </if>
+ <if test="mainPartNumber != null and mainPartNumber != ''"> and main_part_number like '%'|| #{mainPartNumber} ||'%' </if>
+ <if test="mainPartDrawingNumber != null and mainPartDrawingNumber != ''"> and main_part_drawing_number like '%'|| #{mainPartDrawingNumber}|| '%'</if>
<if test="customer != null and customer != ''"> and customer like '%' || #{customer} || '%'</if>
<if test="businessType != null and businessType != ''"> and business_type = #{businessType}</if>
<if test="documentNumber != null and documentNumber != ''"> and document_number like '%'|| #{documentNumber}|| '%'</if>
- <if test="requirementType != null and requirementType != ''"> and requirement_type like concat('%', #{requirementType}, '%')</if>
+ <if test="requirementType != null and requirementType != ''"> and requirement_type like '%'|| #{requirementType}||'%' </if>
<if test="documentStatus != null and documentStatus != ''"> and document_status = #{documentStatus}</if>
- <if test="itemNumber != null and itemNumber != ''"> and item_number like concat('%', #{itemNumber}, '%')</if>
- <if test="drawingNo != null and drawingNo != ''"> and drawing_no like concat('%', #{drawingNo}, '%')</if>
- <if test="versionNumber != null and versionNumber != ''"> and version_number like concat('%', #{versionNumber}, '%')</if>
+ <if test="itemNumber != null and itemNumber != ''"> and item_number like '%'|| #{itemNumber}|| '%'</if>
+ <if test="drawingNo != null and drawingNo != ''"> and drawing_no like '%'|| #{drawingNo}|| '%'</if>
+ <if test="versionNumber != null and versionNumber != ''"> and version_number like '%'|| #{versionNumber}|| '%'</if>
<if test="productionQuantity != null "> and production_quantity = #{productionQuantity}</if>
<if test="goodProductsQuantity != null "> and good_products_quantity = #{goodProductsQuantity}</if>
- <if test="processNumber != null and processNumber != ''"> and process_number like concat('%', #{processNumber}, '%')</if>
- <if test="workCenter != null and workCenter != ''"> and work_center like concat('%', #{workCenter}, '%')</if>
- <if test="department != null and department != ''"> and department like concat('%', #{department}, '%')</if>
+ <if test="processNumber != null and processNumber != ''"> and process_number like '%'|| #{processNumber}||'%'</if>
+ <if test="workCenter != null and workCenter != ''"> and work_center like '%'|| #{workCenter}||'%'</if>
+ <if test="department != null and department != ''"> and department like '%'|| #{department}||'%'</if>
<if test="params.beginPlanStartDay != null and params.beginPlanStartDay != '' and params.endPlanStartDay != null and params.endPlanStartDay != ''"> and plan_start_day between #{params.beginPlanStartDay} and #{params.endPlanStartDay}</if>
<if test="params.beginPlanEndDay != null and params.beginPlanEndDay != '' and params.endPlanEndDay != null and params.endPlanEndDay != ''"> and plan_end_day between #{params.beginPlanEndDay} and #{params.endPlanEndDay}</if>
- <if test="standbyNumber != null and standbyNumber != ''"> and standby_number like concat('%', #{standbyNumber}, '%')</if>
- <if test="standbyName != null and standbyName != ''"> and standby_name like concat('%', #{standbyName}, '%')</if>
+ <if test="standbyNumber != null and standbyNumber != ''"> and standby_number like '%'|| #{standbyNumber}|| '%'</if>
+ <if test="standbyName != null and standbyName != ''"> and standby_name like '%'|| #{standbyName}||'%'</if>
<if test="standbyStock != null "> and standby_stock = #{standbyStock}</if>
- <if test="nextProcessDeparment != null and nextProcessDeparment != ''"> and next_process_deparment like concat('%', #{nextProcessDeparment}, '%')</if>
+ <if test="nextProcessDeparment != null and nextProcessDeparment != ''"> and next_process_deparment like '%'|| #{nextProcessDeparment}|| '%'</if>
<if test="isSuspended != null "> and is_suspended = #{isSuspended}</if>
- <if test="isOutsourcing != null and isOutsourcing != ''"> and is_outsourcing like concat('%', #{isOutsourcing}, '%')</if>
- <if test="account != null and account != ''"> and account like concat('%', #{account}, '%')</if>
- <if test="advancedMaterials != null and advancedMaterials != ''"> and advanced_materials like concat('%', #{advancedMaterials}, '%')</if>
- <if test="advancedDocumentNumber != null and advancedDocumentNumber != ''"> and advanced_document_number like concat('%', #{advancedDocumentNumber}, '%')</if>
+ <if test="isOutsourcing != null and isOutsourcing != ''"> and is_outsourcing like '%'|| #{isOutsourcing}||'%'</if>
+ <if test="account != null and account != ''"> and account like '%'|| #{account}|| '%'</if>
+ <if test="advancedMaterials != null and advancedMaterials != ''"> and advanced_materials like '%'|| #{advancedMaterials}|| '%'</if>
+ <if test="advancedDocumentNumber != null and advancedDocumentNumber != ''"> and advanced_document_number '%'|| #{advancedDocumentNumber}|| '%'</if>
<if test="params.beginAdvancedRequirementDay != null and params.beginAdvancedRequirementDay != '' and params.endAdvancedRequirementDay != null and params.endAdvancedRequirementDay != ''"> and advanced_requirement_day between #{params.beginAdvancedRequirementDay} and #{params.endAdvancedRequirementDay}</if>
<if test="isPlanComplete != null "> and is_plan_complete = #{isPlanComplete}</if>
<if test="isStockComplete != null "> and is_stock_complete = #{isStockComplete}</if>
<if test="hasTurnback != null "> and has_turnback = #{hasTurnback}</if>
<if test="hasRisk != null "> and has_risk = #{hasRisk}</if>
+ <if test="plant != null "> and plant = #{plant}</if>
and del_flag='0'
</where>
</select>
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateProcessShopStatMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateProcessShopStatMapper.xml
new file mode 100644
index 0000000..3292fc1
--- /dev/null
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateProcessShopStatMapper.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.aps.core.mapper.ApsPlateProcessShopStatMapper">
+
+ <resultMap type="ApsPlateProcessShopStat" id="ApsPlateProcessShopStatResult">
+ <result property="id" column="id" />
+ <result property="docNo" column="doc_no" />
+ <result property="shopCode" column="shop_code" />
+ <result property="shopName" column="shop_name" />
+ <result property="planStartDate" column="plan_start_date" />
+ <result property="planEndDate" column="plan_end_date" />
+ <result property="delFlag" column="del_flag" />
+ <result property="createBy" column="create_by" />
+ <result property="createTime" column="create_time" />
+ <result property="updateBy" column="update_by" />
+ <result property="updateTime" column="update_time" />
+ </resultMap>
+
+ <sql id="selectApsPlateProcessShopStatVo">
+ select id, doc_no, shop_code, shop_name, plan_start_date, plan_end_date, del_flag, create_by, create_time, update_by, update_time from aps_plate_process_shop_stat
+ </sql>
+
+ <select id="selectApsPlateProcessShopStatList" parameterType="ApsPlateProcessShopStat" resultMap="ApsPlateProcessShopStatResult">
+ <include refid="selectApsPlateProcessShopStatVo"/>
+ <where>
+ <if test="docNo != null and docNo != ''"> and doc_no = #{docNo}</if>
+ <if test="shopCode != null and shopCode != ''"> and shop_code = #{shopCode}</if>
+ <if test="shopName != null and shopName != ''"> and shop_name = #{shopName}</if>
+ <if test="planStartDate != null and planStartDate != ''"> and plan_start_date = #{planStartDate}</if>
+ <if test="planEndDate != null and planEndDate != ''"> and plan_end_date = #{planEndDate}</if>
+ and del_flag='0'
+ </where>
+ </select>
+
+ <select id="selectApsPlateProcessShopStatById" parameterType="Long" resultMap="ApsPlateProcessShopStatResult">
+ <include refid="selectApsPlateProcessShopStatVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertApsPlateProcessShopStat" parameterType="ApsPlateProcessShopStat" useGeneratedKeys="true" keyProperty="id">
+ insert into aps_plate_process_shop_stat
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="docNo != null">doc_no,</if>
+ <if test="shopCode != null">shop_code,</if>
+ <if test="shopName != null">shop_name,</if>
+ <if test="planStartDate != null">plan_start_date,</if>
+ <if test="planEndDate != null">plan_end_date,</if>
+ <if test="delFlag != null">del_flag,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="updateBy != null">update_by,</if>
+ <if test="updateTime != null">update_time,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="docNo != null">#{docNo},</if>
+ <if test="shopCode != null">#{shopCode},</if>
+ <if test="shopName != null">#{shopName},</if>
+ <if test="planStartDate != null">#{planStartDate},</if>
+ <if test="planEndDate != null">#{planEndDate},</if>
+ <if test="delFlag != null">#{delFlag},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="updateBy != null">#{updateBy},</if>
+ <if test="updateTime != null">#{updateTime},</if>
+ </trim>
+ </insert>
+
+ <update id="updateApsPlateProcessShopStat" parameterType="ApsPlateProcessShopStat">
+ update aps_plate_process_shop_stat
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="docNo != null">doc_no = #{docNo},</if>
+ <if test="shopCode != null">shop_code = #{shopCode},</if>
+ <if test="shopName != null">shop_name = #{shopName},</if>
+ <if test="planStartDate != null">plan_start_date = #{planStartDate},</if>
+ <if test="planEndDate != null">plan_end_date = #{planEndDate},</if>
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="updateBy != null">update_by = #{updateBy},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteApsPlateProcessShopStatById" parameterType="Long">
+ delete from aps_plate_process_shop_stat where id = #{id}
+ </delete>
+
+ <delete id="deleteApsPlateProcessShopStatByIds" parameterType="String">
+ delete from aps_plate_process_shop_stat where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+ <delete id="deleteAll" >
+ delete from aps_plate_process_shop_stat where del_flag in ('0','1')
+ </delete>
+
+ <insert id="batchInsert" parameterType="java.util.List">
+ insert into aps_plate_process_shop_stat
+ (doc_no, shop_code, shop_name, plan_start_date, plan_end_date, del_flag, create_by, create_time)
+ values
+ <foreach collection="list" item="item" separator=",">
+ (
+ #{item.docNo},
+ #{item.shopCode},
+ #{item.shopName},
+ #{item.planStartDate},
+ #{item.planEndDate},
+ #{item.delFlag},
+ #{item.createBy},
+ #{item.createTime}
+ )
+ </foreach>
+ </insert>
+</mapper>
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml
index dc82aa4..fcb5e28 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml
@@ -27,6 +27,7 @@
<if test="shopCode != null and shopCode != ''"> and shop_code = #{shopCode}</if>
<if test="plantCode != null and plantCode != ''"> and plant_code = #{plantCode}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
+ and status='1'
</where>
</select>
--
Gitblit v1.9.3