Преглед изворни кода

大中型流程细节优化2

wucl пре 1 година
родитељ
комит
be55e34f63

+ 7 - 4
dao/src/main/resources/mapper/CommissionDeclareMapper.xml

@@ -27,13 +27,14 @@
 
     <select id="majorMarketDeclarePage" parameterType="com.dayou.vo.CommissionDeclareVO" resultType="com.dayou.vo.CommissionDeclareVO">
         SELECT
+        (@i := @i + 1) AS id,
         bus.*,
         dd.NAME AS commissionType
         FROM
         (
         SELECT
         IFNULL( cd.id,( SELECT id FROM commission_declare WHERE deleted = 0 AND business_id = major.businessId AND production_id IS NULL
-        AND business_type ='COMMISSION_DECLARE_MAJOR_MARKET' and declare_user_id =#{marketUserId}) ) id,
+        AND business_type ='COMMISSION_DECLARE_MAJOR_MARKET' and declare_user_id =#{marketUserId}) ) cId,
         IFNULL( cd.commission_rate_id,( SELECT commission_rate_id FROM commission_declare WHERE deleted = 0 AND business_id = major.businessId AND production_id IS NULL
         AND business_type ='COMMISSION_DECLARE_MAJOR_MARKET' and declare_user_id =#{marketUserId} ) ) commission_rate_id,
         IFNULL( cd.declare_result,( SELECT declare_result FROM commission_declare WHERE deleted = 0 AND business_id = major.businessId AND production_id IS NULL
@@ -60,6 +61,7 @@
         mp.report_no,
         mp.created
         FROM
+        (SELECT @i := 0) AS sort,
         major m
         LEFT JOIN ( SELECT id, NAME, major_id, report_no, created FROM major_production WHERE deleted = 0 ) mp ON m.id = mp.major_id
         LEFT JOIN `user` u ON u.id = m.client_manager_id
@@ -122,9 +124,10 @@
 
 
     <select id="majorEvaluateDeclarePage" parameterType="com.dayou.vo.CommissionDeclareVO" resultType="com.dayou.vo.CommissionDeclareVO">
-        select bus.*,dd.name as commissionType from (SELECT
+        select
+        (@i := @i + 1) AS id,bus.*,dd.name as commissionType from (SELECT
         IFNULL(cd.id,(SELECT id from commission_declare where deleted = 0 and business_id= major.businessId and production_id is null
-        AND business_type ='COMMISSION_DECLARE_MAJOR_EVALUATE' and declare_user_id =#{evaluateUserId}) ) id,
+        AND business_type ='COMMISSION_DECLARE_MAJOR_EVALUATE' and declare_user_id =#{evaluateUserId}) ) cId,
         IFNULL(cd.commission_rate_id,(SELECT commission_rate_id from commission_declare where deleted = 0 and business_id= major.businessId and production_id is null
         AND business_type ='COMMISSION_DECLARE_MAJOR_EVALUATE' and declare_user_id = #{evaluateUserId}) ) commission_rate_id,
         IFNULL(cd.declare_result,(SELECT declare_result from commission_declare where deleted = 0 and business_id= major.businessId and production_id is null
@@ -150,7 +153,7 @@
         mp.NAME,
         mp.report_no ,
         mp.created
-        FROM
+        FROM (SELECT @i := 0) AS sort,
         major m
         LEFT JOIN ( SELECT id, NAME, major_id, report_no,created FROM major_production WHERE deleted = 0 ) mp ON m.id = mp.major_id
         LEFT JOIN user u ON u.id = m.client_manager_id

+ 7 - 4
dao/src/main/resources/mapper/MajorProductionMapper.xml

@@ -320,7 +320,9 @@
         mp.repertory_state,
         wtr.id AS taskId,
         wfni.id AS currentNodeId,
-        ifnull(wfni.business_min_id,wfni.business_sub_id) as businessMinId,
+        wfni.business_min_id,
+        wfni.business_sub_id,
+        mp.report_no,
         wfni.business_id,
         m.NAME AS orderName,
         m.order_id,
@@ -363,7 +365,8 @@
         LEFT JOIN user u1 ON u1.id = m.client_manager_id
         LEFT JOIN user u2 ON u2.id = m.principal_id
         LEFT JOIN department d ON d.id = m.department_id
-        LEFT JOIN ( SELECT id, major_id, report_no, NAME, repertory_state, production FROM major_production WHERE  deleted = 0 ) mp ON ( mp.major_id = m.id AND mp.report_no = wfni.business_min_id )
+        LEFT JOIN ( SELECT id, major_id, report_no, NAME, repertory_state, production FROM major_production WHERE  deleted = 0 ) mp
+        ON ( mp.major_id = m.id AND mp.report_no = ifnull(wfni.business_min_id,wfni.business_sub_id) )
         LEFT JOIN ( SELECT business_id, production_no, real_amount FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON (
         pf.business_id = m.id
         AND pf.production_no = wfni.business_min_id)
@@ -405,7 +408,7 @@
             mp.report_no,
             (case mp.production when 'REPORT' then '报告' when 'STATEMENT' THEN '价值意见书' else '复评函' end ) as production,
             ( SELECT count(id) FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND business_id = m.id AND production_no = mp.report_no AND deleted = 0 ) AS claimTimes,
-            ( SELECT major_production_id FROM major_production_allot WHERE deleted = 0 GROUP BY major_production_id HAVING major_production_id = mp.id ) AS isAllot
+            ( SELECT major_production_id FROM major_production_allot WHERE deleted = 0 and user_type = 'EVALUATE' GROUP BY major_production_id HAVING major_production_id = mp.id ) AS isAllot
         FROM
             major_production mp
                 LEFT JOIN major m ON m.id = mp.major_id
@@ -519,6 +522,6 @@
             major_production mp
                 LEFT JOIN major m ON m.id = mp.major_id
         WHERE
-            mp.id = 124 and mp.deleted = 0 and m.deleted = 0
+            mp.id = #{productionId} and mp.deleted = 0 and m.deleted = 0
     </select>
  </mapper>

+ 6 - 1
domain/src/main/java/com/dayou/vo/CommissionDeclareVO.java

@@ -15,11 +15,16 @@ import java.util.Date;
 public class CommissionDeclareVO {
 
     /**
-     * 申报id
+     * 排序id
      */
     private Long id;
 
     /**
+     * 申报id
+     */
+    private Long cId;
+
+    /**
      * 主营业务id
      */
     private Long businessId;

+ 6 - 1
service/src/main/java/com/dayou/aspect/SendMessageAOP.java

@@ -1,6 +1,7 @@
 package com.dayou.aspect;
 
 import com.dayou.dto.WareHouseDTO;
+import com.dayou.enums.ProductionEnum;
 import com.dayou.message.MessageTypeEnum;
 import com.dayou.message.annotation.SendMessage;
 import com.dayou.service.IMessageService;
@@ -42,10 +43,14 @@ public class SendMessageAOP {
             Field field = arg.getClass().getDeclaredField("taskData");
             field.setAccessible(true);
             WareHouseDTO wareHouseDTO = (WareHouseDTO) field.get(arg);
-            if (wareHouseDTO.getRepertoryState()){
+            if (wareHouseDTO.getRepertoryState() && !wareHouseDTO.getProductionType().equals(ProductionEnum.STATEMENT.name())){
                 messageService.packagingMajorOutRepertoryRemind(wareHouseDTO);
             }
         }
+        if (messageTypeEnum.equals(MAJOR_ALLOT_COMMISSION_REMIND) && (Boolean) proceed){
+            Object arg = joinPoint.getArgs()[0];
+            messageService.packagingMajorAllotCommissionRemind(arg);
+        }
         return proceed;
     }
 }

+ 3 - 1
service/src/main/java/com/dayou/message/MessageTypeEnum.java

@@ -17,7 +17,9 @@ public enum MessageTypeEnum {
 
     MAJOR_DECLARE_REMIND("MAJOR_DECLARE_REMIND","大中型提成申报提醒"),
 
-    MAJOR_OUT_REPERTORY_REMIND("MAJOR_OUT_REPERTORY_REMIND","大中型产品出库提醒")
+    MAJOR_OUT_REPERTORY_REMIND("MAJOR_OUT_REPERTORY_REMIND","大中型产品出库提醒"),
+
+    MAJOR_ALLOT_COMMISSION_REMIND("MAJOR_ALLOT_COMMISSION_REMIND","大中型产品提成分配提醒")
     ;
 
     private String code;

+ 2 - 0
service/src/main/java/com/dayou/service/IMajorProductionService.java

@@ -75,6 +75,8 @@ public interface IMajorProductionService extends IService<MajorProduction> {
 
     Boolean allotRealAmountToProduction(OrderReportDTO orderReportDTO);
 
+    Boolean doAllotRealAmountToProduction(OrderReportDTO orderReportDTO);
+
     Page<MajorProductionPerformanceVO> performanceAllotPage(Page page, MajorProductionPerformanceVO productionPerformance);
 
     Page<MajorProductionVO> waitingClaimProd(Page page, MajorProductionVO production);

+ 2 - 0
service/src/main/java/com/dayou/service/IMessageService.java

@@ -40,4 +40,6 @@ public interface IMessageService extends IService<Message> {
     Boolean allRead();
 
     void packagingMajorOutRepertoryRemind(WareHouseDTO wareHouseDTO);
+
+    void packagingMajorAllotCommissionRemind(Object arg);
 }

+ 10 - 2
service/src/main/java/com/dayou/service/impl/MajorProductionServiceImpl.java

@@ -33,6 +33,7 @@ import java.util.stream.Collectors;
 
 import static com.dayou.common.Constants.*;
 import static com.dayou.enums.ProductionEnum.*;
+import static com.dayou.message.MessageTypeEnum.MAJOR_ALLOT_COMMISSION_REMIND;
 import static com.dayou.message.MessageTypeEnum.MAJOR_OUT_REPERTORY_REMIND;
 
 /**
@@ -369,6 +370,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
     }
 
     @Override
+    @SendMessage(messageType = MAJOR_ALLOT_COMMISSION_REMIND)
     @Transactional
     public Boolean doAllotRealAmount(List<OrderReportDTO> claimOrders){
         if (CollectionUtil.isNotEmpty(claimOrders)){
@@ -509,6 +511,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
                     log.setState(NodeLogEnum.PASS.name());
                     log.setInstanceId(x.getCurrentNodeId());
                     log.setBusinessSubId(x.getBusinessSubId());
+                    log.setBusinessMinId(x.getBusinessMinId());
                     return log;
                 }).collect(Collectors.toList());
                 workFlowLogMapper.insertBatch(workFlowLogs);
@@ -529,9 +532,14 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
         return list;
     }
 
-    @Transactional
     @Override
-    public synchronized Boolean allotRealAmountToProduction(OrderReportDTO orderReportDTO) {
+    public synchronized  Boolean allotRealAmountToProduction(OrderReportDTO orderReportDTO){
+        return majorProductionService.doAllotRealAmountToProduction(orderReportDTO);
+    }
+    @Override
+    @SendMessage(messageType = MAJOR_ALLOT_COMMISSION_REMIND )
+    @Transactional
+    public  Boolean doAllotRealAmountToProduction(OrderReportDTO orderReportDTO) {
         List<ReportDTO> reports = orderReportDTO.getReports();
         Long orderFundId = orderReportDTO.getOrderFundId();
         BigDecimal residueAmount = orderFundMapper.residueNotAllotAmount(orderFundId);

+ 5 - 0
service/src/main/java/com/dayou/service/impl/MessageServiceImpl.java

@@ -221,4 +221,9 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
         systemMessageBO.setParams(JSON.toJSONString(majorProductionVO));
         systemMessageHandler.sendMessage(systemMessageBO);
     }
+
+    @Override
+    public void packagingMajorAllotCommissionRemind(Object arg) {
+        //TODO 发送部门经理分配绩效消息
+    }
 }