Explorar o código

大中型部分逻辑修改

wucl hai 1 mes
pai
achega
1b1b4f24e9

+ 3 - 1
common/src/main/java/com/dayou/dao/CustomBaseMapper.java

@@ -1,6 +1,7 @@
 package com.dayou.dao;
 
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.enums.SqlMethod;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.TableInfo;
@@ -12,6 +13,7 @@ import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWra
 import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
 import com.baomidou.mybatisplus.extension.toolkit.ChainWrappers;
 import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
+import com.dayou.entity.Major;
 import com.dayou.exception.ErrorCode;
 import org.apache.ibatis.binding.MapperMethod;
 import org.apache.ibatis.reflection.ExceptionUtil;
@@ -156,7 +158,7 @@ public interface CustomBaseMapper<T> extends BaseMapper<T> {
      *
      * @return
      */
-    default UpdateChainWrapper<T> update() {
+    default UpdateChainWrapper<T> update(LambdaUpdateWrapper<Major> set) {
         return ChainWrappers.updateChain(this);
     }
 

+ 37 - 8
dao/src/main/resources/mapper/MajorMapper.xml

@@ -505,8 +505,11 @@
         <if test="major!=null and major.nodeId!=null">
             and wfni.node_id = #{major.nodeId}
         </if>
-        <if test="major!=null and major.clientName!=null and major.clientName!=''">
-            and wfni.client_name like concat('%',#{major.clientName},'%')
+        <if test="major!=null and major.clienteleName!=null and major.clienteleName!=''">
+            and cc1.name like concat('%',#{major.clienteleName},'%')
+        </if>
+        <if test="major!=null and major.clienteleSubName!=null and major.clienteleSubName!=''">
+            and cc2.name like concat('%',#{major.clienteleSubName},'%')
         </if>
         <if test="major!=null and major.clientManagerId!=null ">
             and m.client_manager_id = #{major.clientManagerId}
@@ -573,12 +576,18 @@
         <if test="major!=null and major.nodeId!=null">
             and wfni.node_id = #{major.nodeId}
         </if>
-        <if test="major!=null and major.clientName!=null and major.clientName!=''">
-            and wfni.client_name like concat('%',#{major.clientName},'%')
+        <if test="major!=null and major.clienteleName!=null and major.clienteleName!=''">
+            and cc1.name like concat('%',#{major.clienteleName},'%')
+        </if>
+        <if test="major!=null and major.clienteleSubName!=null and major.clienteleSubName!=''">
+            and cc2.name like concat('%',#{major.clienteleSubName},'%')
         </if>
         <if test="major!=null and major.principalId!=null ">
             and m.principal_id = #{major.principalId}
         </if>
+        <if test="major!=null and major.clientManagerId!=null ">
+            and m.client_manager_id = #{major.clientManagerId}
+        </if>
         <if test="major!=null and major.departmentId!=null ">
             and m.department_id = #{major.departmentId}
         </if>
@@ -622,8 +631,11 @@
         <if test="major!=null and major.nodeId!=null">
             and wfni.node_id = #{major.nodeId}
         </if>
-        <if test="major!=null and major.clientName!=null and major.clientName!=''">
-            and wfni.client_name like concat('%',#{major.clientName},'%')
+        <if test="major!=null and major.clienteleName!=null and major.clienteleName!=''">
+            and cc1.name like concat('%',#{major.clienteleName},'%')
+        </if>
+        <if test="major!=null and major.clienteleSubName!=null and major.clienteleSubName!=''">
+            and cc2.name like concat('%',#{major.clienteleSubName},'%')
         </if>
         <if test="major!=null and major.principalId!=null ">
             and m.principal_id = #{major.principalId}
@@ -631,6 +643,13 @@
         <if test="major!=null and major.businessObjectType!=null and major.businessObjectType!=''">
             and m.business_object_type = #{major.businessObjectType}
         </if>
+        <if test="major!=null and major.userIds!=null and major.userIds.size!=0">
+            or
+            m.client_manager_id  in
+            <foreach collection="
+            major.userIds" open="(" close=")" separator="," item="userId">#{userId}
+            </foreach>
+        </if>
         order by wfni.currentNodeId DESC
     </select>
 
@@ -668,8 +687,11 @@
         <if test="major!=null and major.nodeId!=null">
             and wfni.node_id = #{major.nodeId}
         </if>
-        <if test="major!=null and major.clientName!=null and major.clientName!=''">
-            and wfni.client_name like concat('%',#{major.clientName},'%')
+        <if test="major!=null and major.clienteleName!=null and major.clienteleName!=''">
+            and cc1.name like concat('%',#{major.clienteleName},'%')
+        </if>
+        <if test="major!=null and major.clienteleSubName!=null and major.clienteleSubName!=''">
+            and cc2.name like concat('%',#{major.clienteleSubName},'%')
         </if>
         <if test="major!=null and major.principalId!=null ">
             and m.principal_id = #{major.principalId}
@@ -677,6 +699,13 @@
         <if test="major!=null and major.businessObjectType!=null and major.businessObjectType!=''">
             and m.business_object_type = #{major.businessObjectType}
         </if>
+        <if test="major!=null and major.userIds!=null and major.userIds.size!=0">
+            or
+            m.client_manager_id  in
+            <foreach collection="
+            major.userIds" open="(" close=")" separator="," item="userId">#{userId}
+            </foreach>
+        </if>
         order by wfni.currentNodeId DESC
     </select>
 

+ 1 - 1
dao/src/main/resources/mapper/PaymentCollectionMapper.xml

@@ -90,7 +90,7 @@
             </foreach>
         </if>
         <if test="dto!=null and dto.startDate!=null and dto.endDate!=null">
-            AND fc.claim_datetime BETWEEN #{dto.startDate} AND #{dto.endDate}
+            AND pc.payment_date BETWEEN #{dto.startDate} AND #{dto.endDate}
         </if>
         union
         select

+ 2 - 0
domain/src/main/java/com/dayou/vo/MajorVO.java

@@ -127,6 +127,8 @@ public class MajorVO extends Major {
     private Set<Long> userIds;
     private String comment;
     private Long nodeId;
+    private String clienteleSubName;
+    private String clienteleName;
 
 
 }

+ 3 - 3
service/src/main/java/com/dayou/dyoa/DyoaHistoryServiceImpl.java

@@ -703,9 +703,9 @@ public class DyoaHistoryServiceImpl implements IDyoaHistoryService{
                                 break;
                             case "realFundId":
                                 Long realFundId = findRealAmountMbsId((String) columValue);
-                                if (realFundId==null){
-                                    return;
-                                }
+//                                if (realFundId==null){
+//                                    return;
+//                                }
                                 field.set(invoice, realFundId);
                                 break;
                             case "planAmount":

+ 15 - 6
service/src/main/java/com/dayou/service/impl/MajorServiceImpl.java

@@ -35,6 +35,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import static com.dayou.common.Constants.ASSIGN;
 import static com.dayou.common.Constants.BY_TURNS;
 import static com.dayou.enums.GlobalConfigEnum.DepartmentTurns.MAJOR_BUSINESS;
 
@@ -133,6 +134,10 @@ public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major> implements
 
     @Override
     public Boolean update(Major major){
+        if (ASSIGN.equals(major.getAllotType())){
+            //指派单:校验轮单是否积压
+            checkOrderOverStock(major.getDepartmentId());
+        }
         return  this.updateById(major);
     }
 
@@ -222,18 +227,22 @@ public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major> implements
                 .eq(WorkFlowNodeInstance::getBusinessType, MainBusinessEnum.MAJOR_BUSINESS.name())
                 .eq(WorkFlowNodeInstance::getBusinessId, id)
                 .eq(BaseEntity::getDeleted, Boolean.FALSE));
-        if (exists.size()>2){
+        WorkFlowNodeInstance allotNode = exists.stream().filter(x -> x.getSequence().equals(1) && x.getState().equals(NodeStateEnum.FINISHED.name())).findFirst().orElse(null);
+        if (allotNode!=null){
             ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"业务部已分单,无法撤回。若需撤回请联系当前节点待办人退回流程。");
             return Boolean.FALSE;
         }else{
             try {
-                for (WorkFlowNodeInstance workFlowNodeInstance: exists){
-                    if (workFlowNodeInstance.getSequence().equals(0)){
-                        workFlowNodeInstance.setState(NodeStateEnum.PENDING.name());
-                        workFlowNodeInstanceService.updateById(workFlowNodeInstance);
-                    }else {
+                WorkFlowNodeInstance instance = exists.stream().filter(x -> x.getState().equals(NodeStateEnum.PENDING.name())).findFirst().get();
+                //撤回时,当前节点有可能是下单加点和分单节点。如果不是下单节点,就找到分单节点状态改为pending。sequence:0 代表下单节点
+                if (!instance.getSequence().equals(0)){
+                    WorkFlowNodeInstance openNode = exists.stream().filter(x -> x.getSequence().equals(0)).findFirst().get();
+                    List<WorkFlowNodeInstance> others = exists.stream().filter(x -> !x.getSequence().equals(0)).collect(Collectors.toList());
+                    for (WorkFlowNodeInstance workFlowNodeInstance: others){
                         workFlowNodeInstanceService.removeById(workFlowNodeInstance.getId());
                     }
+                    openNode.setState(NodeStateEnum.PENDING.name());
+                    workFlowNodeInstanceService.updateById(openNode);
                 }
             } catch (Exception e) {
                 ErrorCode.throwBusinessException(ErrorCode.DATA_NOT_EXISTS);

+ 6 - 1
service/src/main/java/com/dayou/workflow/handler/MajorNodeHandler.java

@@ -79,6 +79,9 @@ public class MajorNodeHandler extends WorkNodeProcessable {
     @Autowired
     private IUserService userService;
 
+    @Autowired
+    private IMajorService majorService;
+
 
     @Override
     public boolean forward(WorkNodeCommit workNodeCommit) {
@@ -393,7 +396,8 @@ public class MajorNodeHandler extends WorkNodeProcessable {
                 workFlowNodeInstanceService.save(orderInstance);
 
                 WorkFlowNodeInstance oldOrderNode = workFlowNodeInstanceService.list(new LambdaQueryWrapper<WorkFlowNodeInstance>()
-                        .eq(WorkFlowNodeInstance::getBusinessId, currentNode.getBusinessId()).orderByAsc(BaseEntity::getCreated)).get(0);
+                        .eq(WorkFlowNodeInstance::getBusinessId, currentNode.getBusinessId())
+                        .eq(WorkFlowNodeInstance::getBusinessType,MAJOR_BUSINESS.name()).orderByAsc(BaseEntity::getCreated)).get(0);
 
                 WorkTaskRecord oldTask = workTaskRecordService.getOne(new LambdaQueryWrapper<WorkTaskRecord>().eq(WorkTaskRecord::getInstanceId, oldOrderNode.getId()));
                 WorkTaskRecord workTaskRecord = new WorkTaskRecord();
@@ -402,6 +406,7 @@ public class MajorNodeHandler extends WorkNodeProcessable {
                 workTaskRecord.setHandlerId(oldTask.getHandlerId());
                 workTaskRecord.setFinished(true);
                 workTaskRecord.setFinishTime(oldTask.getFinishTime());
+
                 workTaskRecordService.save(workTaskRecord);
             }