Browse Source

大中型流程细节优化3

wucl 1 year ago
parent
commit
942b09b3d2

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

@@ -517,10 +517,13 @@
             m.order_id,
             mp.report_no,
             mp.production,
-            m.client_manager_id
+            m.client_manager_id,
+            m.department_id,
+            d.leader_id as departmentLeaderId
         FROM
             major_production mp
                 LEFT JOIN major m ON m.id = mp.major_id
+                left join department d on d.id = m.department_id
         WHERE
             mp.id = #{productionId} and mp.deleted = 0 and m.deleted = 0
     </select>

+ 58 - 51
dao/src/main/resources/mapper/WorkTaskRecordMapper.xml

@@ -97,56 +97,64 @@
 
     <select id="taskTodoPage" parameterType="com.dayou.vo.TaskTodoVO" resultType="com.dayou.vo.TaskTodoVO">
         SELECT
-            wfni.id,
-            wtr.id as taskId,
-            wfni.id AS currentNodeId,
-            wfni.business_sub_id,
-            wfni.business_sub_id as statementNo,
-            wfni.business_min_id as reportNo,
-            wfni.business_id,
-            m.name as orderName,
-            m.order_id,
-            m.financial,
-            m.allot_type,
-            u1.name as clientManager,
-            u2.name as principal,
-            d.name as departmentName,
-            m.business_object_type,
-            wfni.name AS nodeName,
-            wfni.code as nodeCode,
-            u.name AS handler,
-            wnt.description AS taskName,
-            wtr.handler_id,
-            wtr.finished as taskFinished,
-            m.created,
-            m.id as majorId,
-            (select name from major_production where deleted = 0 and major_id = m.id and  report_no= ifnull(wfni.business_min_id,wfni.business_sub_id)) as productionName
+        wfni.id,
+        wtr.id as taskId,
+        wfni.id AS currentNodeId,
+        wfni.business_sub_id,
+        wfni.business_sub_id as statementNo,
+        wfni.business_min_id as reportNo,
+        wfni.business_id,
+        m.name as orderName,
+        m.order_id,
+        m.financial,
+        m.allot_type,
+        u1.name as clientManager,
+        u2.name as principal,
+        d.name as departmentName,
+        m.business_object_type,
+        wfni.name AS nodeName,
+        wfni.code as nodeCode,
+        u.name AS handler,
+        wnt.description AS taskName,
+        wtr.handler_id,
+        wtr.finished as taskFinished,
+        m.created,
+        m.id as majorId,
+        (select name from major_production where deleted = 0 and major_id = m.id and  report_no= ifnull(wfni.business_min_id,wfni.business_sub_id)) as productionName,
+        cc1.NAME AS cClienteleName,
+        cc2.NAME AS cClienteleSubName,
+        cl1.NAME AS cClienteleContactName,
+        cl1.mobile AS cMobile,
+        wtr.created as taskCreated
         FROM
-            work_task_record wtr
-                LEFT JOIN work_node_task wnt ON wnt.id = wtr.task_id
-                inner JOIN (
-                SELECT
-                    wn.NAME,
-                    wn.CODE,
-                    wfni.id,
-                    wfni.business_id ,
-                    wfni.business_sub_id,
-                    wfni.business_min_id,
-                    wfni.state
-                FROM
-                    work_flow_node_instance wfni
-                        LEFT JOIN work_node wn ON wn.id = wfni.node_id
-                WHERE
-                    wfni.business_type = 'MAJOR_BUSINESS'
-                  AND wfni.state = 'PENDING'
-                  AND wfni.deleted = 0
-                  AND wn.deleted = 0
-            ) wfni ON wtr.instance_id = wfni.id
-                LEFT JOIN major m ON m.id = wfni.business_id
-                LEFT JOIN user u ON u.id = wtr.handler_id
-                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
+        work_task_record wtr
+        LEFT JOIN work_node_task wnt ON wnt.id = wtr.task_id
+        inner JOIN (
+        SELECT
+        wn.NAME,
+        wn.CODE,
+        wfni.id,
+        wfni.business_id ,
+        wfni.business_sub_id,
+        wfni.business_min_id,
+        wfni.state
+        FROM
+        work_flow_node_instance wfni
+        LEFT JOIN work_node wn ON wn.id = wfni.node_id
+        WHERE
+        wfni.business_type = 'MAJOR_BUSINESS'
+        AND wfni.state = 'PENDING'
+        AND wfni.deleted = 0
+        AND wn.deleted = 0
+        ) wfni ON wtr.instance_id = wfni.id
+        LEFT JOIN major m ON m.id = wfni.business_id
+        LEFT JOIN user u ON u.id = wtr.handler_id
+        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 customer_company cc1 ON cc1.id = m.clientele_id
+        LEFT JOIN customer_company cc2 ON cc2.id = m.clientele_sub_id
+        LEFT JOIN customer_linkman cl1 ON cl1.id = m.clientele_contact_id
         WHERE
             wtr.handler_id =#{todoVO.handlerId}
           AND u.deleted = 0
@@ -173,8 +181,7 @@
         <if test="todoVO!=null and todoVO.endDate!=null and todoVO.endDate!=''">
             and m.created &lt;= #{todoVO.endDate}
         </if>
-        ORDER BY
-            wtr.created DESC
+        ORDER BY  wtr.created DESC
     </select>
 
     <select id="majorTaskDonePage" parameterType="com.dayou.vo.MajorTaskDoneVO" resultType="com.dayou.vo.MajorTaskDoneVO">

+ 5 - 0
domain/src/main/java/com/dayou/vo/MajorProductionVO.java

@@ -147,4 +147,9 @@ public class MajorProductionVO {
      */
     private Long productionFundId;
 
+    /**
+     * 部门领导id
+     */
+    private Long departmentLeaderId;
+
 }

+ 8 - 0
domain/src/main/java/com/dayou/vo/TaskTodoVO.java

@@ -80,4 +80,12 @@ public class TaskTodoVO {
 
     private Date instanceCreated;
 
+    private String cClienteleName;
+
+    private String cClienteleSubName ;
+
+    private String cClienteleContactName ;
+
+    private String cMobile;
+
 }

+ 10 - 2
service/src/main/java/com/dayou/aspect/SendMessageAOP.java

@@ -1,5 +1,6 @@
 package com.dayou.aspect;
 
+import com.dayou.dto.OrderReportDTO;
 import com.dayou.dto.WareHouseDTO;
 import com.dayou.enums.ProductionEnum;
 import com.dayou.message.MessageTypeEnum;
@@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.lang.reflect.Field;
+import java.util.List;
 
 import static com.dayou.message.MessageTypeEnum.*;
 
@@ -47,9 +49,15 @@ public class SendMessageAOP {
                 messageService.packagingMajorOutRepertoryRemind(wareHouseDTO);
             }
         }
-        if (messageTypeEnum.equals(MAJOR_ALLOT_COMMISSION_REMIND) && (Boolean) proceed){
+        if (messageTypeEnum.equals(MAJOR_ALLOT_COMMISSION_REMIND1) && (Boolean) proceed){
             Object arg = joinPoint.getArgs()[0];
-            messageService.packagingMajorAllotCommissionRemind(arg);
+            List<OrderReportDTO> list = (List<OrderReportDTO>) arg;
+            messageService.packagingMajorAllotCommissionRemind(list);
+        }
+        if (messageTypeEnum.equals(MAJOR_ALLOT_COMMISSION_REMIND2) && (Boolean) proceed){
+            Object arg = joinPoint.getArgs()[0];
+            OrderReportDTO orderReportDTO = (OrderReportDTO) arg;
+            messageService.packagingMajorAllotCommissionRemind1(orderReportDTO);
         }
         return proceed;
     }

+ 2 - 2
service/src/main/java/com/dayou/message/MessageTitle.java

@@ -21,8 +21,8 @@ public interface MessageTitle
 
     String MAJOR_DECLARE_REMIND_CONTENT="您好,请及时对项目[name]发起提成申报。";
 
-    String MAJOR_PRODUCTION_OUT_TITLE = "大中型产品出库通知";
-
     String MAJOR_PRODUCTION_OUT_CONTENT = "[reportNo]已出库,请在产品送达后在“我的订单-产品包”中确认送达,以免影响当月提成计算。";
 
+    String MAJOR_ALLOT_COMMISSION_CONTENT = "[reportNo]已收款,请在产品送达后在“大中型提成申报-提成分配”为评估人员设置提成分配比例。";
+
 }

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

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

+ 4 - 1
service/src/main/java/com/dayou/service/IMessageService.java

@@ -1,4 +1,5 @@
 package com.dayou.service;
+import com.dayou.dto.OrderReportDTO;
 import com.dayou.dto.WareHouseDTO;
 import com.dayou.entity.BusinessReply;
 import com.dayou.entity.Message;
@@ -41,5 +42,7 @@ public interface IMessageService extends IService<Message> {
 
     void packagingMajorOutRepertoryRemind(WareHouseDTO wareHouseDTO);
 
-    void packagingMajorAllotCommissionRemind(Object arg);
+    void packagingMajorAllotCommissionRemind(List<OrderReportDTO> list);
+
+    void packagingMajorAllotCommissionRemind1(OrderReportDTO orderReportDTO);
 }

+ 3 - 4
service/src/main/java/com/dayou/service/impl/MajorProductionServiceImpl.java

@@ -33,8 +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;
+import static com.dayou.message.MessageTypeEnum.*;
 
 /**
  * <p>
@@ -370,7 +369,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
     }
 
     @Override
-    @SendMessage(messageType = MAJOR_ALLOT_COMMISSION_REMIND)
+    @SendMessage(messageType = MAJOR_ALLOT_COMMISSION_REMIND1)
     @Transactional
     public Boolean doAllotRealAmount(List<OrderReportDTO> claimOrders){
         if (CollectionUtil.isNotEmpty(claimOrders)){
@@ -537,7 +536,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
         return majorProductionService.doAllotRealAmountToProduction(orderReportDTO);
     }
     @Override
-    @SendMessage(messageType = MAJOR_ALLOT_COMMISSION_REMIND )
+    @SendMessage(messageType = MAJOR_ALLOT_COMMISSION_REMIND2 )
     @Transactional
     public  Boolean doAllotRealAmountToProduction(OrderReportDTO orderReportDTO) {
         List<ReportDTO> reports = orderReportDTO.getReports();

+ 40 - 3
service/src/main/java/com/dayou/service/impl/MessageServiceImpl.java

@@ -1,10 +1,13 @@
 package com.dayou.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSON;
 import com.dayou.common.BaseEntity;
+import com.dayou.dto.OrderReportDTO;
 import com.dayou.dto.WareHouseDTO;
 import com.dayou.entity.*;
 import com.dayou.enums.MainBusinessEnum;
+import com.dayou.enums.UserTypeEnum;
 import com.dayou.mapper.MajorProductionMapper;
 import com.dayou.mapper.MessageMapper;
 import com.dayou.message.MessageTypeEnum;
@@ -81,6 +84,9 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
     @Autowired
     private MajorProductionMapper majorProductionMapper;
 
+    @Autowired
+    private IMajorProductionAllotService majorProductionAllotService;
+
     @Override
     public Boolean packagingBusinessMessage(BusinessReply originalBO) {
         BusinessMessageBO messageBO = new BusinessMessageBO();
@@ -216,14 +222,45 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
         SystemMessageBO systemMessageBO = new SystemMessageBO();
         systemMessageBO.setReceiver(majorProductionVO.getClientManagerId());
         systemMessageBO.setMessage(MAJOR_PRODUCTION_OUT_CONTENT.replace("reportNo",majorProductionVO.getReportNo()));
-        systemMessageBO.setTitle(MAJOR_PRODUCTION_OUT_TITLE);
+        systemMessageBO.setTitle(MAJOR_OUT_REPERTORY_REMIND.getName());
         systemMessageBO.setType(MAJOR_OUT_REPERTORY_REMIND.name());
         systemMessageBO.setParams(JSON.toJSONString(majorProductionVO));
         systemMessageHandler.sendMessage(systemMessageBO);
     }
 
     @Override
-    public void packagingMajorAllotCommissionRemind(Object arg) {
-        //TODO 发送部门经理分配绩效消息
+    public void packagingMajorAllotCommissionRemind(List<OrderReportDTO> list) {
+        for (OrderReportDTO orderReportDTO : list){
+            List<MajorProductionAllot> allots = majorProductionAllotService.list(new LambdaQueryWrapper<MajorProductionAllot>().eq(MajorProductionAllot::getMajorProductionId, orderReportDTO.getId())
+                    .eq(MajorProductionAllot::getUserType, UserTypeEnum.EVALUATE.name()).eq(BaseEntity::getDeleted, Boolean.FALSE));
+            if (CollectionUtil.isEmpty(allots)){
+                MajorProductionVO majorProductionVO = majorProductionMapper.getMajorProductionById(orderReportDTO.getId());
+                SystemMessageBO systemMessageBO = new SystemMessageBO();
+                systemMessageBO.setReceiver(majorProductionVO.getDepartmentLeaderId());
+                systemMessageBO.setMessage(MAJOR_ALLOT_COMMISSION_CONTENT.replace("reportNo",majorProductionVO.getReportNo()));
+                systemMessageBO.setTitle(MAJOR_ALLOT_COMMISSION_REMIND1.getName());
+                systemMessageBO.setType(MAJOR_ALLOT_COMMISSION_REMIND1.name());
+                systemMessageBO.setParams(JSON.toJSONString(majorProductionVO));
+                systemMessageHandler.sendMessage(systemMessageBO);
+            }
+        }
+
+    }
+
+    @Override
+    public void packagingMajorAllotCommissionRemind1(OrderReportDTO orderReportDTO) {
+        List<MajorProductionAllot> allots = majorProductionAllotService.list(new LambdaQueryWrapper<MajorProductionAllot>().eq(MajorProductionAllot::getMajorProductionId, orderReportDTO.getId())
+                .eq(MajorProductionAllot::getUserType, UserTypeEnum.EVALUATE.name()).eq(BaseEntity::getDeleted, Boolean.FALSE));
+        if (CollectionUtil.isEmpty(allots)){
+            MajorProductionVO majorProductionVO = majorProductionMapper.getMajorProductionById(orderReportDTO.getId());
+            SystemMessageBO systemMessageBO = new SystemMessageBO();
+            systemMessageBO.setReceiver(majorProductionVO.getDepartmentLeaderId());
+            systemMessageBO.setMessage(MAJOR_ALLOT_COMMISSION_CONTENT.replace("reportNo",majorProductionVO.getReportNo()));
+            systemMessageBO.setTitle(MAJOR_ALLOT_COMMISSION_REMIND1.getName());
+            systemMessageBO.setType(MAJOR_ALLOT_COMMISSION_REMIND1.name());
+            systemMessageBO.setParams(JSON.toJSONString(majorProductionVO));
+            systemMessageHandler.sendMessage(systemMessageBO);
+        }
+
     }
 }