From 3bbf11c99f594a2757f601fa3c680917cea33c17 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Wed, 27 Sep 2023 11:09:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wb' into qa

---
 screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java |   38 +++++++++++++++++++++++++++-----------
 1 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java
index 4558db6..2a0cad4 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java
@@ -13,10 +13,12 @@
 import com.moral.api.pojo.query.PageCond;
 import com.moral.api.pojo.query.allocation.*;
 import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond;
+import com.moral.api.pojo.vo.approvetable.ApproveTableListVo;
 import com.moral.api.pojo.vo.user.QxUser;
 import com.moral.api.service.AllocationExtensionService;
 import com.moral.api.service.ApproveTableService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -68,17 +70,16 @@
     @Autowired
     private SysDictTypeMapper sysDictTypeMapper;
     @Autowired
-    private SysDictDataMapper sysDictDataMapper;
-    @Autowired
     private ResponsibilityUnitMapper responsibilityUnitMapper;
+    @Autowired
+    private SysDictDataMapper sysDictDataMapper;
     @Autowired
     private RedisTemplate redisTemplate;
     @Autowired
     private AllocationMapper allocationMapper;
     @Autowired
-    private ApproveTableMapper approveTableMapper;
-    @Autowired
     private  SysAreaService sysAreaService;
+    @Autowired
     private ApproveTableService approveTableService;
     @Autowired
     private FileTableService fileTableService;
@@ -334,7 +335,6 @@
             endTime = DateUtils.getCurDateTime();
             if (s.equals("-1")){
                 //���������������
-
                  startTime = DateUtils.getDateStringOfMon(Integer.parseInt(s), DateUtils.yyyy_MM_dd_HH_mm_ss_EN);
             }
             if (s.equals("-2")){
@@ -363,7 +363,7 @@
          int complete=0;
          int unComplete=0;
         for (Allocation allocation : allocations) {
-            String state = allocation.getState();
+            String state = allocation.getState()+"";
             if (state.equals("40")||state.equals("50")){
                  complete++;
             }else if(state.equals("10")||state.equals("20") ||state.equals("30")) {
@@ -398,7 +398,6 @@
 
             AllocationUnitViewDto allocationUnitViewDto = new AllocationUnitViewDto();
             List<Allocation> allocations1 = unitMap.get(integer);
-
             //������
             int marks=0;
             //������
@@ -408,7 +407,7 @@
 
                 Date dateOfDay = DateUtils.getDateOfDay(allocation.getEscalationTime(), allocation.getChangeDay());
                 Date date = new Date();
-                String state = allocation.getState();
+                String state = allocation.getState()+"";
                 boolean timeBefor = DateUtils.isTimeBefor(date, dateOfDay);
                 if (timeBefor && !state.equals("40") && !state.equals("50")){
                     //������������
@@ -457,6 +456,8 @@
 
     @Override
     public Page<AllocationPageExt> extPage(AllocationPageCond allocationPageCond) {
+        List<Integer> unitList = unitResult();
+        allocationPageCond.setUnitList(unitList);
         return this.baseMapper.extPage(allocationPageCond.getPage().convertPage(), allocationPageCond);
     }
 
@@ -466,7 +467,7 @@
         allocationExt.setFileBaseList(fileTableService.list(id,FileTableEnum.ALLOCATION_FOUNDATION.value));
         allocationExt.setFileChangeList(fileTableService.list(id,FileTableEnum.ALLOCATION_RECTIFICATION.value));
         allocationExt.setFileApproveList(fileTableService.list(id,FileTableEnum.ALLOCATION_APPROVE.value));
-        allocationExt.setApproveList(approveTableService.listAll(id,FileTableEnum.ALLOCATION_FOUNDATION.value));
+        allocationExt.setApproveList(approveTableService.listAll(id, FileTableEnum.ALLOCATION_FOUNDATION.value));
         return allocationExt;
     }
 
@@ -527,7 +528,7 @@
         }
         approveTable.setApproveModule(FileTableEnum.ALLOCATION_FOUNDATION.value);
         approveTableService.saveResult(approveTable);
-        fileTableService.upDateResult(checkCond.getFileApproveList(),allocation.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value);
+        fileTableService.upDateResult(checkCond.getFileApproveList(),checkCond.getAllocationId(), FileTableEnum.ALLOCATION_FOUNDATION.value);
     }
 
     @Override
@@ -566,7 +567,7 @@
         if( !AllocationApproveEnum.UNDER_RECTIFICATION.value.equals(allocationExt.getState())) {
             type = true;
         }
-        if(!ChangeEnum.DEADLINE.value.equals(allocationExt.getState())){
+        if(!ChangeEnum.DEADLINE.value.equals(allocationExt.getChangeType())){
             type = true;
         }
         if(type){
@@ -578,4 +579,19 @@
         fileTableService.upDateResult(allocationExtensionAddCond.getFileList(),allocationExtension.getId(), FileTableEnum.ALLOCATION_EXTENSION.value);
         return true;
     }
+
+    @Override
+    public List<Integer>  unitResult() {
+        QxUser user = UserHelper.getCurrentUser();
+        Integer unitId = Objects.nonNull(user.getUnitId())?user.getUnitId():0;
+        List<Integer> userList = responsibilityUnitMapper.selectCodeList("JBD",user.getUserId());
+        if(CollectionUtils.isNotEmpty(userList)){
+            return new ArrayList<>();
+        }
+        userList = responsibilityUnitMapper.selectResultList(unitId);
+        if(CollectionUtils.isNotEmpty(userList)){
+            return userList;
+        }
+        return Arrays.asList(0);
+    }
 }

--
Gitblit v1.8.0