Forráskód Böngészése

aps-匹配技术要求需求增加优化

sucheng 9 hónapja
szülő
commit
56b0dc427e

+ 4 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProductDetailDao.java

@@ -65,4 +65,8 @@ public interface ApsProductDetailDao extends BaseMapper<ApsProductDetailDo> {
     void publishCancel(@Param("productionOrderIds") List<String> productionOrderIds);
 
     List<GetOldTechnicalRequirementRes> selectMyList(@Param("technicalRequirementId") String technicalRequirementId, @Param("id") String id, @Param("alloy") String alloy, @Param("alloystatus") String alloystatus, @Param("orderProductTypeId") String orderProductTypeId);
+
+    List<GetOldTechnicalRequirementRes> selectMyList1(@Param("technicalRequirementId") String technicalRequirementId, @Param("id") String id, @Param("alloy") String alloy);
+    List<GetOldTechnicalRequirementRes> selectMyList2(@Param("technicalRequirementId") String technicalRequirementId, @Param("id") String id, @Param("alloystatus") String alloystatus);
+    List<GetOldTechnicalRequirementRes> selectMyList3(@Param("technicalRequirementId") String technicalRequirementId, @Param("id") String id, @Param("orderProductTypeId") String orderProductTypeId);
 }

+ 14 - 4
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductDetailServiceImpl.java

@@ -625,18 +625,28 @@ public class ApsProductDetailServiceImpl extends ServiceImpl<ApsProductDetailDao
         String alloy = orderDetail.getAlloy();
         String alloystatus = orderDetail.getAlloystatus();
 
-        List<GetOldTechnicalRequirementRes> apsProductDetailDoList = this.baseMapper.selectMyList(technicalRequirementId, orderDetail.getId(), alloy, alloystatus, orderProductTypeId);
+//        List<GetOldTechnicalRequirementRes> apsProductDetailDoList = this.baseMapper.selectMyList(technicalRequirementId, orderDetail.getId(), alloy, alloystatus, orderProductTypeId);
+        List<GetOldTechnicalRequirementRes> list1 = this.baseMapper.selectMyList1(technicalRequirementId, orderDetail.getId(), alloy);
+        List<GetOldTechnicalRequirementRes> list2 = this.baseMapper.selectMyList2(technicalRequirementId, orderDetail.getId(), alloystatus);
+        List<GetOldTechnicalRequirementRes> list3 = this.baseMapper.selectMyList3(technicalRequirementId, orderDetail.getId(), orderProductTypeId);
+
+        //合并三个list
+        List<GetOldTechnicalRequirementRes> apsProductDetailDoList = new LinkedList<>();
+        apsProductDetailDoList.addAll(list1);
+        apsProductDetailDoList.addAll(list2);
+        apsProductDetailDoList.addAll(list3);
+        apsProductDetailDoList = apsProductDetailDoList.stream().distinct().collect(Collectors.toList());
 
         List<GetOldTechnicalRequirementRes> list = new LinkedList<>();
         for (GetOldTechnicalRequirementRes vo : apsProductDetailDoList) {
             int score = 0;
-            if (vo.getAlloy().equals(alloy)) {
+            if (ObjectUtil.isNotEmpty(vo.getAlloy()) && vo.getAlloy().equals(alloy)) {
                 score += 10;
             }
-            if (vo.getAlloystatus().equals(alloystatus)) {
+            if (ObjectUtil.isNotEmpty(vo.getAlloystatus()) && vo.getAlloystatus().equals(alloystatus)) {
                 score += 1;
             }
-            if (vo.getOrderproducttypeid().equals(orderProductTypeId)) {
+            if (ObjectUtil.isNotEmpty(vo.getOrderproducttypeid()) && vo.getOrderproducttypeid().equals(orderProductTypeId)) {
                 score += 100;
             }
             vo.setScore(score);

+ 54 - 0
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProductDetailDao.xml

@@ -158,4 +158,58 @@
                   OR aptr.ORDERPRODUCTTYPEID = #{orderProductTypeId}
               )
     </select>
+    <select id="selectMyList1" resultType="com.rongwei.bsentity.vo.GetOldTechnicalRequirementRes">
+        select
+            apd.ID AS 'orderDetailId',
+            apd.ALLOY AS 'alloy',
+            apd.ALLOYSTATUS AS 'alloystatus',
+            apd.PRODUCTTYPEID AS 'producttypeid',
+            apd.PRODUCTTYPE AS 'producttype',
+            aptr.*
+        from aps_product_detail apd
+                 LEFT JOIN aps_production_technical_requirement aptr
+                           ON  FIND_IN_SET(apd.ID,aptr.ORDERDETAILIDS)
+        where apd.DELETED = 0
+          AND aptr.DELETED = 0
+          AND apd.ID != #{id}
+          AND aptr.ID != #{technicalRequirementId}
+          AND aptr.ID is not null
+          AND apd.ALLOY = #{alloy}
+    </select>
+    <select id="selectMyList2" resultType="com.rongwei.bsentity.vo.GetOldTechnicalRequirementRes">
+        select
+            apd.ID AS 'orderDetailId',
+            apd.ALLOY AS 'alloy',
+            apd.ALLOYSTATUS AS 'alloystatus',
+            apd.PRODUCTTYPEID AS 'producttypeid',
+            apd.PRODUCTTYPE AS 'producttype',
+            aptr.*
+        from aps_product_detail apd
+                 LEFT JOIN aps_production_technical_requirement aptr
+                           ON  FIND_IN_SET(apd.ID,aptr.ORDERDETAILIDS)
+        where apd.DELETED = 0
+          AND aptr.DELETED = 0
+          AND apd.ID != #{id}
+          AND aptr.ID != #{technicalRequirementId}
+          AND aptr.ID is not null
+          AND apd.ALLOYSTATUS = #{alloystatus}
+    </select>
+    <select id="selectMyList3" resultType="com.rongwei.bsentity.vo.GetOldTechnicalRequirementRes">
+        select
+            apd.ID AS 'orderDetailId',
+            apd.ALLOY AS 'alloy',
+            apd.ALLOYSTATUS AS 'alloystatus',
+            apd.PRODUCTTYPEID AS 'producttypeid',
+            apd.PRODUCTTYPE AS 'producttype',
+            aptr.*
+        from aps_product_detail apd
+                 LEFT JOIN aps_production_technical_requirement aptr
+                           ON  FIND_IN_SET(apd.ID,aptr.ORDERDETAILIDS)
+        where apd.DELETED = 0
+          AND aptr.DELETED = 0
+          AND apd.ID != #{id}
+          AND aptr.ID != #{technicalRequirementId}
+          AND aptr.ID is not null
+          AND aptr.ORDERPRODUCTTYPEID = #{orderProductTypeId}
+    </select>
 </mapper>