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

大中型流程细节优化1

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

+ 10 - 1
biz-base/src/main/java/com/dayou/controller/MajorProductionController.java

@@ -274,7 +274,7 @@ public class MajorProductionController extends BaseController {
     }
 
     /**
-     * 大中心产品确认送达
+     * 大中型 价值意见书确认送达
      */
     @FinishTask
     @PostMapping("/confirmDelivery")
@@ -284,6 +284,15 @@ public class MajorProductionController extends BaseController {
     }
 
     /**
+     * 大中型 报告或复评函确认送达
+     */
+    @GetMapping("/confirmDelivery/{id}")
+    public RestResponse<Boolean> noTaskConfirmDelivery(@PathVariable("id") Long id) {
+        Boolean ret = majorProductionService.noTaskConfirmDelivery(id);
+        return RestResponse.data(ret);
+    }
+
+    /**
      * 待归档列表
      * @param page
      * @param todoVO

+ 4 - 0
dao/src/main/java/com/dayou/mapper/MajorProductionMapper.java

@@ -39,4 +39,8 @@ public interface MajorProductionMapper extends CustomBaseMapper<MajorProduction>
     ProdValidateVO validateProd(@Param("id") Long id);
 
     Page<MajorProductionVO> waitingClaimProd(Page page, @Param("vo")MajorProductionVO production);
+
+    void cancelDelivery(@Param("businessId")Long businessId, @Param("businessSubId")String businessSubId, @Param("productionType")String productionType );
+
+    MajorProductionVO getMajorProductionById(@Param("productionId") Long productionId);
 }

+ 21 - 2
dao/src/main/resources/mapper/MajorProductionMapper.xml

@@ -320,7 +320,7 @@
         mp.repertory_state,
         wtr.id AS taskId,
         wfni.id AS currentNodeId,
-        wfni.business_min_id ,
+        ifnull(wfni.business_min_id,wfni.business_sub_id) as businessMinId,
         wfni.business_id,
         m.NAME AS orderName,
         m.order_id,
@@ -363,7 +363,7 @@
         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 production != 'STATEMENT' AND 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 = wfni.business_min_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)
@@ -502,4 +502,23 @@
         ORDER BY
             mp.created DESC
     </select>
+
+    <update id="cancelDelivery">
+        update major_production set delivery = 0 ,delivery_date = null where major_id = #{businessId} and report_no = #{businessSubId} and production = #{productionType}
+    </update>
+
+    <select id="getMajorProductionById" parameterType="java.lang.Long" resultType="com.dayou.vo.MajorProductionVO">
+        SELECT
+            mp.id,
+            mp.major_id,
+            m.order_id,
+            mp.report_no,
+            mp.production,
+            m.client_manager_id
+        FROM
+            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
+    </select>
  </mapper>

+ 14 - 4
service/src/main/java/com/dayou/aspect/SendMessageAOP.java

@@ -1,5 +1,6 @@
 package com.dayou.aspect;
 
+import com.dayou.dto.WareHouseDTO;
 import com.dayou.message.MessageTypeEnum;
 import com.dayou.message.annotation.SendMessage;
 import com.dayou.service.IMessageService;
@@ -12,7 +13,7 @@ import org.springframework.stereotype.Component;
 
 import java.lang.reflect.Field;
 
-import static com.dayou.message.MessageTypeEnum.MAJOR_DECLARE_REMIND;
+import static com.dayou.message.MessageTypeEnum.*;
 
 /**
  * 类说明:
@@ -31,11 +32,20 @@ public class SendMessageAOP {
 
     @Around("@annotation(sendMessage)")
     public Object sendMessageAround(ProceedingJoinPoint joinPoint, SendMessage sendMessage) throws Throwable {
-        Long proceed = (Long) joinPoint.proceed(joinPoint.getArgs());
+        Object proceed = joinPoint.proceed(joinPoint.getArgs());
         MessageTypeEnum messageTypeEnum = sendMessage.messageType();
         if (messageTypeEnum.equals(MAJOR_DECLARE_REMIND)){
-            messageService.packagingMajorDeclareRemind(proceed);
+            messageService.packagingMajorDeclareRemind((Long) proceed);
         }
-        return null;
+        if (messageTypeEnum.equals(MAJOR_OUT_REPERTORY_REMIND) && (Boolean) proceed){
+            Object arg = joinPoint.getArgs()[0];
+            Field field = arg.getClass().getDeclaredField("taskData");
+            field.setAccessible(true);
+            WareHouseDTO wareHouseDTO = (WareHouseDTO) field.get(arg);
+            if (wareHouseDTO.getRepertoryState()){
+                messageService.packagingMajorOutRepertoryRemind(wareHouseDTO);
+            }
+        }
+        return proceed;
     }
 }

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

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

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

@@ -15,7 +15,9 @@ public enum MessageTypeEnum {
 
     BUSINESS("BUSINESS","业务消息"),
 
-    MAJOR_DECLARE_REMIND("MAJOR_DECLARE_REMIND","大中型提成申报提醒")
+    MAJOR_DECLARE_REMIND("MAJOR_DECLARE_REMIND","大中型提成申报提醒"),
+
+    MAJOR_OUT_REPERTORY_REMIND("MAJOR_OUT_REPERTORY_REMIND","大中型产品出库提醒")
     ;
 
     private String code;

+ 4 - 1
service/src/main/java/com/dayou/message/handler/SystemMessageHandler.java

@@ -1,5 +1,6 @@
 package com.dayou.message.handler;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.dayou.entity.Message;
 import com.dayou.mapper.MessageMapper;
 import com.dayou.message.MessageServerCenter;
@@ -30,7 +31,9 @@ public class SystemMessageHandler extends MessageServerCenter<SystemMessageBO> {
 
     @Override
     public Boolean sendMessage(SystemMessageBO systemMessageBO) {
-        return null;
+        Message message = BeanUtil.copyProperties(systemMessageBO, Message.class);
+        messageMapper.insert(message);
+        return Boolean.TRUE;
     }
 
 }

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

@@ -81,4 +81,6 @@ public interface IMajorProductionService extends IService<MajorProduction> {
 
     Boolean allotRealAmountToOrder(List<OrderReportDTO> claimOrders);
     Boolean doAllotRealAmountToOrder(List<OrderReportDTO> claimOrders);
+
+    Boolean noTaskConfirmDelivery(Long id);
 }

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

@@ -1,4 +1,5 @@
 package com.dayou.service;
+import com.dayou.dto.WareHouseDTO;
 import com.dayou.entity.BusinessReply;
 import com.dayou.entity.Message;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -37,4 +38,6 @@ public interface IMessageService extends IService<Message> {
     void packagingEvaluateRemind(List<ItemVO> completedNotEvaluateItem);
 
     Boolean allRead();
+
+    void packagingMajorOutRepertoryRemind(WareHouseDTO wareHouseDTO);
 }

+ 13 - 8
service/src/main/java/com/dayou/service/impl/MajorProductionServiceImpl.java

@@ -6,31 +6,26 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dayou.common.BaseEntity;
-import com.dayou.configuration.DfsConfig;
 import com.dayou.dto.*;
 import com.dayou.entity.*;
-import com.dayou.enums.BusinessFileEnum;
 import com.dayou.enums.MainBusinessEnum;
 import com.dayou.enums.ProductionEnum;
 import com.dayou.enums.ReportStatus;
 import com.dayou.enums.workflow.NodeLogEnum;
 import com.dayou.exception.ErrorCode;
 import com.dayou.mapper.*;
+import com.dayou.message.annotation.SendMessage;
 import com.dayou.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.dayou.utils.FileUploadUtils;
 import com.dayou.utils.LoginContext;
-import com.dayou.utils.QRCodeUtil;
 import com.dayou.vo.*;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.io.File;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -38,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_OUT_REPERTORY_REMIND;
 
 /**
  * <p>
@@ -245,6 +241,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
         return businessFileService.save(file);
     }
 
+    @SendMessage(messageType = MAJOR_OUT_REPERTORY_REMIND)
     @Override
     public Boolean warehouse(TaskRecordDTO<WareHouseDTO> taskRecordDTO) {
         WareHouseDTO taskData = taskRecordDTO.getTaskData();
@@ -277,8 +274,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
                 if (outId!=null){
                     outWarehouseService.update(new LambdaUpdateWrapper<ProductionOutWarehouse>().set(ProductionOutWarehouse::getProductionOut,Boolean.TRUE).eq(BaseEntity::getId,outId));
                     return this.update(new LambdaUpdateWrapper<MajorProduction>().set(MajorProduction::getRepertoryState, Boolean.TRUE)
-                            .set(MajorProduction::getRepertoryOutTime,new Date()).set(MajorProduction::getDelivery,Boolean.TRUE)
-                            .eq(BaseEntity::getId, production.getId()));
+                            .set(MajorProduction::getRepertoryOutTime,new Date()).eq(BaseEntity::getId, production.getId()));
                 }else{
                     ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "财务部未审核或审核不通过,产品暂时无法出库。");
                     return Boolean.FALSE;
@@ -472,6 +468,15 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
         }
         return Boolean.FALSE;
     }
+
+    @Override
+    public Boolean noTaskConfirmDelivery(Long id) {
+        boolean update = this.update(new LambdaUpdateWrapper<MajorProduction>()
+                .set(MajorProduction::getDelivery, Boolean.TRUE)
+                .set(MajorProduction::getDeliveryDate,new Date()).eq(BaseEntity::getId, id));
+        return update;
+    }
+
     @Override
     public Page<TaskTodoVO> todoSaveFilePage(Page page, TaskTodoVO todoVO,String keyword) {
         todoVO.setHandlerId(LoginContext.getCurrentUserId());

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

@@ -2,8 +2,10 @@ package com.dayou.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.dayou.common.BaseEntity;
+import com.dayou.dto.WareHouseDTO;
 import com.dayou.entity.*;
 import com.dayou.enums.MainBusinessEnum;
+import com.dayou.mapper.MajorProductionMapper;
 import com.dayou.mapper.MessageMapper;
 import com.dayou.message.MessageTypeEnum;
 import com.dayou.message.bo.BusinessMessageBO;
@@ -15,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.utils.LoginContext;
 import com.dayou.vo.CommissionDeclareVO;
 import com.dayou.vo.ItemVO;
+import com.dayou.vo.MajorProductionVO;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -75,6 +78,9 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
     @Autowired
     private IUserService userService;
 
+    @Autowired
+    private MajorProductionMapper majorProductionMapper;
+
     @Override
     public Boolean packagingBusinessMessage(BusinessReply originalBO) {
         BusinessMessageBO messageBO = new BusinessMessageBO();
@@ -203,4 +209,16 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
         Long currentUserId = LoginContext.getCurrentUserId();
         return this.update(new LambdaUpdateWrapper<Message>().eq(Message::getReceiver,currentUserId).set(Message::getIsRead,true));
     }
+
+    @Override
+    public void packagingMajorOutRepertoryRemind(WareHouseDTO wareHouseDTO) {
+        MajorProductionVO majorProductionVO = majorProductionMapper.getMajorProductionById(wareHouseDTO.getProductionId());
+        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.setType(MAJOR_OUT_REPERTORY_REMIND.name());
+        systemMessageBO.setParams(JSON.toJSONString(majorProductionVO));
+        systemMessageHandler.sendMessage(systemMessageBO);
+    }
 }

+ 10 - 7
service/src/main/java/com/dayou/service/impl/ProductionFundServiceImpl.java

@@ -106,13 +106,16 @@ public class ProductionFundServiceImpl extends ServiceImpl<ProductionFundMapper,
                 .eq(ProductionFund::getProductionType, productionFundVO.getProductionType().name()).eq(BaseEntity::getDeleted, Boolean.FALSE));
         //认领在订单上
         if (productionFund==null || productionFund.getRealAmount()==null || productionFund.getRealAmount().compareTo(BigDecimal.ZERO)==0){
-            OrderFund orderFund = orderFundService.getOne(new LambdaQueryWrapper<OrderFund>().eq(OrderFund::getBusinessType, productionFundVO.getBusinessType().name())
-                    .eq(OrderFund::getBusinessId, productionFundVO.getBusinessId()).eq(BaseEntity::getDeleted, Boolean.FALSE));
-            if (orderFund == null || orderFund.getRealAmount()==null || orderFund.getRealAmount().compareTo(BigDecimal.ZERO)==0){
-                productionFundVO.setRealAmount(BigDecimal.ZERO);
-            }else {
-                productionFundVO.setRealAmount(orderFund.getRealAmount());
-            }
+            //产品收款无记录,查询订单是否有收款
+//            OrderFund orderFund = orderFundService.getOne(new LambdaQueryWrapper<OrderFund>().eq(OrderFund::getBusinessType, productionFundVO.getBusinessType().name())
+//                    .eq(OrderFund::getBusinessId, productionFundVO.getBusinessId()).eq(BaseEntity::getDeleted, Boolean.FALSE));
+//            if (orderFund == null || orderFund.getRealAmount()==null || orderFund.getRealAmount().compareTo(BigDecimal.ZERO)==0){
+//                productionFundVO.setRealAmount(BigDecimal.ZERO);
+//            }else {
+//                productionFundVO.setRealAmount(orderFund.getRealAmount());
+//            }
+            // 以产品收款为准,不查询订单收款
+            productionFundVO.setRealAmount(BigDecimal.ZERO);
         }else {
             productionFundVO.setRealAmount(productionFund.getRealAmount());
         }

+ 4 - 0
service/src/main/java/com/dayou/workflow/handler/MajorNodeHandler.java

@@ -27,6 +27,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
+import static com.dayou.enums.ProductionEnum.STATEMENT;
 import static com.dayou.enums.workflow.NodeStateEnum.SKIP;
 import static com.dayou.enums.workflow.WorkflowNodeEnum.*;
 
@@ -149,6 +150,9 @@ public class MajorNodeHandler extends WorkNodeProcessable {
                 majorProductionMapper.delete(new LambdaQueryWrapper<MajorProduction>().eq(MajorProduction::getMajorId,currentNode.getBusinessId()));
             }
         }
+        if (currentNode.getNodeCode().equals(STATEMENT_FEEDBACK.name())){
+            majorProductionMapper.cancelDelivery(currentNode.getBusinessId(),currentNode.getBusinessSubId(),STATEMENT.name());
+        }
         return super.goBack(commit);
     }