From 567f923ff6b9147229def8562258493922232a33 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期三, 23 十月 2024 17:55:53 +0800
Subject: [PATCH] 关于修改可靠性产品重复

---
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java |    6 +++---
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java      |    9 +++++----
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java              |    2 ++
 modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml                                    |   18 +++++++++++++++++-
 4 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
index 25ab7c6..1df0062 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
@@ -45,4 +45,6 @@
     Long[] getByPid(Long id);
 
     List<ProductDto> getProductByShip(Long shipId);
+
+    List<XhProductModel> getProductListByShip(Long productId, int level1, int level2);
 }
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
index d0f96b8..bf0b6f3 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
@@ -102,10 +102,9 @@
                     productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE,
                             Constant.Bool.NO).lt("product_type", 5).ne("product_type", 1).and(wrapper -> wrapper.eq("ship_id", productId).or().eq("id", productId)).orderByAsc(Constant.TableColumn.SORT));
                 } else if (ztShow == 5) {
-                    List<XhProductModel> dbList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE,
-                            Constant.Bool.NO).gt("product_type", 1).and(wrapper -> wrapper.eq("ship_id", productId).or().eq("id", productId)));
+                    List<XhProductModel> dbList = baseDao.getProductListByShip(productId,2,5);
                     for (XhProductModel row : dbList) {
-                        if (row.getSameSbNum() > 1) {
+                        if (row.getSameSbNum()!=null && row.getSameSbNum() > 1) {
                             for (int i = 1; i <= row.getSameSbNum(); i++) {
                                 try {
                                     XhProductModel newRow = row.clone();
@@ -325,6 +324,7 @@
                         ParamData itemEntity = new ParamData();
                         itemEntity.setShipId(shipId);
                         itemEntity.setProductId(curXtId);
+                        itemEntity.setBasicUnitNum(1);
                         paramDataService.insert(itemEntity);
                     }
 
@@ -344,6 +344,7 @@
                         ParamData itemEntity = new ParamData();
                         itemEntity.setShipId(shipId);
                         itemEntity.setProductId(curFxtId);
+                        itemEntity.setBasicUnitNum(1);
                         paramDataService.insert(itemEntity);
                     }
 
@@ -368,9 +369,9 @@
                     //缁戝畾璁惧ID
                     itemEntity.setShipId(shipId);
                     itemEntity.setProductId(curSbId);
+                    itemEntity.setBasicUnitNum(sameSbNum);
                     itemEntity.setReliabDistribType(reliabType.get(reliabDistribType));
                     itemEntity.setBasicJoinCompute(isOrNot.get(basicJoinCompute));
-                    itemEntity.setBasicUnitNum(sameSbNum);
                     itemEntity.setBasicMtbfRegulate(basicMtbfRegulate);
                     itemEntity.setBasicMtbfRegulSuccRate(basicMtbfRegulSuccRate);
                     itemEntity.setBasicMtbfOperatingRatio(basicMtbfOperatingRatio);
diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
index c70d629..0829c56 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java
@@ -354,9 +354,9 @@
                         currentStatusDto.setX2(nextStatusDto.getX1());
                         statusDtoListNew.add(new TimeDiagramStatusDto(nextStatusDto.getX1(), nextStatusDto.getX2(), nextStatusDto.getStatus()));
                     } else if (nextStatusDto.getX1() > currentStatusDto.getX1() && nextStatusDto.getX2() < currentStatusDto.getX2()) {
-                        currentStatusDto.setX2(nextStatusDto.getX1());
                         statusDtoListNew.add(new TimeDiagramStatusDto(nextStatusDto.getX1(), nextStatusDto.getX2(), nextStatusDto.getStatus()));
                         statusDtoListOld.add(new TimeDiagramStatusDto(nextStatusDto.getX2(), currentStatusDto.getX2(), currentStatusDto.getStatus()));
+                        currentStatusDto.setX2(nextStatusDto.getX1());
                     }
                 } else {
                     if (nextStatusDto.getX1() >= currentStatusDto.getX2()) {
@@ -1193,10 +1193,10 @@
         return failureModel;
     }
 
-    private boolean isRepairDirac(boolean repairDiracFlag, TaskPhaseModel taskPhaseModel, Long productId) {
+    private boolean isRepairDirac(Boolean repairDiracFlag, TaskPhaseModel taskPhaseModel, Long productId) {
         boolean result = false;
 
-        if (repairDiracFlag) {
+        if (repairDiracFlag != null && repairDiracFlag) {
             if (taskPhaseModel.getPhaseConstraints() == null) {
                 result = true;
             } else {
diff --git a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
index 6355eb0..e1d3552 100644
--- a/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
@@ -65,7 +65,7 @@
                ''                           as statusImg,
                d.dict_code                  as productType,
                p.repairable                 as isRepair,
-               p.task_mtbcf_accept          as taskMtbcf,
+               p.task_mtbcf_regulate        as taskMtbcf,
                p.task_mtbcf_other_params2   as taskMtbcfOtherParams2,
                p.task_mtbcf_other_params3   as taskMtbcfOtherParams3,
                p.reliab_distrib_type        as reliabDistribType,
@@ -186,4 +186,20 @@
           AND a.id &lt;&gt; a.ship_id
           and a.id = b.product_id
     </select>
+    <select id="getProductListByShip" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel">
+        select a.*, b.basic_unit_num as sameSbNum
+        from product_model a,
+             param_data b
+        where a.IS_DELETE = 0 and b.IS_DELETE = 0
+          and a.id = b.product_id
+        <if test="productId !=null">
+            and a.ship_id = #{productId}
+        </if>
+        <if test="level1 !=null">
+            and a.product_type &gt;= #{level1}
+        </if>
+        <if test="level2 !=null">
+            and a.product_type &lt;= #{level2}
+        </if>
+    </select>
 </mapper>

--
Gitblit v1.9.1