张涛 1 ano atrás
pai
commit
0704c91583

+ 33
- 0
application/src/main/java/com/lyg/application/DTO/ErrorDto.java Ver arquivo

@@ -0,0 +1,33 @@
1
+package com.lyg.application.DTO;
2
+
3
+
4
+import lombok.Data;
5
+
6
+@Data
7
+public class ErrorDto {
8
+    private String regularRules;//普通规则 提示
9
+    private String primaryPost; //原来的岗位
10
+    private String targetPost;// 轮岗之后的岗位
11
+
12
+
13
+    private String monthRules;//三个月规则 提示
14
+    private  String employeeNum;//员工工号
15
+    private  String employeeName;//员工姓名
16
+
17
+    private String counterImpPositions; //不相容 原来的岗位
18
+    private String counterImpPost;//不相容 轮岗之后的岗位
19
+
20
+
21
+    private String specificOrgName; //轮岗列表 原来单位名
22
+    private String specificOrgNum; //轮岗列表 原来单位号
23
+
24
+    private String specificNameOrgRotation; //轮岗列表 轮岗之后单位名
25
+    private String orgNumJobRotation; //轮岗列表 轮岗之后单位号
26
+
27
+//    private String counterImpPositionRotation; //轮岗列表 原来岗位
28
+//    private String counterImpPostRotation;//轮岗列表 轮岗之后的岗位
29
+
30
+
31
+
32
+
33
+}

+ 0
- 8
application/src/main/java/com/lyg/application/Listener/EntityHandler.java Ver arquivo

@@ -1,8 +0,0 @@
1
-package com.lyg.application.Listener;
2
-
3
-import java.util.List;
4
-
5
-public interface EntityHandler<T> {
6
-    T handleEntity(T entity,Integer index) throws Exception;
7
-    void saveEntityBatch(List<T> entityList);
8
-}

+ 9
- 3
application/src/main/java/com/lyg/application/controller/TaIncompatibleController.java Ver arquivo

@@ -4,6 +4,7 @@ import cn.dev33.satoken.util.SaResult;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
+import com.lyg.application.DTO.ErrorDto;
7 8
 import com.lyg.application.entity.TaIncompatible;
8 9
 import com.lyg.application.service.TaIncompatibleService;
9 10
 import com.lyg.application.util.Rule;
@@ -19,6 +20,7 @@ import org.springframework.validation.annotation.Validated;
19 20
 import org.springframework.web.bind.annotation.*;
20 21
 
21 22
 import java.util.Hashtable;
23
+import java.util.List;
22 24
 import java.util.Map;
23 25
 
24 26
 /**
@@ -64,14 +66,18 @@ public class TaIncompatibleController extends BaseController {
64 66
     @GetMapping("/taIncompatible")
65 67
     public SaResult list(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
66 68
                          @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
67
-//                         @ApiParam("原岗位") @RequestParam(value ="primaryPost", required = false) String primaryPost,
68
-//                         @ApiParam("目标岗位") @RequestParam(value ="targetPost", required = false) String targetPost,
69
+                         @ApiParam("原岗位") @RequestParam(value ="primaryPost", required = false) String primaryPost,
70
+                         @ApiParam("目标岗位") @RequestParam(value ="targetPost", required = false) String targetPost,
71
+                         @ApiParam("规则") @RequestParam(value ="rule", required = false) String rule,
69 72
 
70 73
                          @ApiParam("正序排列") @RequestParam(value = "sortAsc", required = false) String sortAsc,
71 74
                          @ApiParam("倒序排列") @RequestParam(value = "sortDesc", defaultValue = "create_date") String sortDesc) throws Exception {
72 75
 
73 76
         IPage<TaIncompatible> pg = new Page<>(pageNum, pageSize);
74 77
         QueryWrapper<TaIncompatible> queryWrapper = new QueryWrapper<>();
78
+        queryWrapper.eq(StringUtil.isNotEmpty(primaryPost),"primary_post",primaryPost);
79
+        queryWrapper.eq(StringUtil.isNotEmpty(targetPost),"target_post",targetPost);
80
+        queryWrapper.eq(StringUtil.isNotEmpty(rule),"rule",rule);
75 81
         queryWrapper.orderByAsc(StringUtil.isNotEmpty(sortAsc), StringUtil.humpToLine(sortAsc));
76 82
         queryWrapper.orderByDesc(StringUtil.isNotEmpty(sortDesc), StringUtil.humpToLine(sortDesc));
77 83
         IPage<TaIncompatible> result = taIncompatibleService.page(pg, queryWrapper);
@@ -151,7 +157,7 @@ public class TaIncompatibleController extends BaseController {
151 157
             params.put("targetPost", targetPost);
152 158
             params.put("passTime", passTime);
153 159
 
154
-            Object result = rule.siftRule(params);
160
+            List<ErrorDto> result = rule.siftRule(params);
155 161
 
156 162
             return SaResult.data(result);
157 163
 

+ 2
- 1
application/src/main/java/com/lyg/application/mapper/TaRotationMapper.java Ver arquivo

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
7 7
 
8 8
 import java.time.LocalDate;
9 9
 import java.util.List;
10
+import java.util.Map;
10 11
 
11 12
 /**
12 13
  * 轮岗列表;(ta_rotation)表数据库访问层
@@ -17,5 +18,5 @@ import java.util.List;
17 18
 @Mapper
18 19
 public interface TaRotationMapper extends BaseMapper<TaRotation> {
19 20
 
20
-    List<TaRotation> selectRepel(@Param("orgList") List<String> orgList, @Param("targetList") List<String> targetList,@Param("newDate") LocalDate newDate);
21
+    List<TaRotation> selectRepel(@Param("orgList") List<String> orgList, @Param("targetList") List<String> targetList, @Param("newDate") LocalDate newDate, @Param("params") Map<String, String> params);
21 22
 }

+ 13
- 34
application/src/main/java/com/lyg/application/util/Rule.java Ver arquivo

@@ -1,8 +1,7 @@
1 1
 package com.lyg.application.util;
2 2
 
3 3
 
4
-import cn.dev33.satoken.util.SaResult;
5
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.lyg.application.DTO.ErrorDto;
6 5
 import com.lyg.application.entity.TaIncompatible;
7 6
 import com.lyg.application.entity.TaRotation;
8 7
 import com.lyg.application.mapper.TaIncompatibleMapper;
@@ -47,7 +46,7 @@ public class Rule {
47 46
             params.put("passTime", passTime);
48 47
 
49 48
 
50
-            Object result = siftRule(params);
49
+            List<ErrorDto> result = siftRule(params);
51 50
 
52 51
             return result;
53 52
         }
@@ -55,41 +54,21 @@ public class Rule {
55 54
     }
56 55
 
57 56
 
58
-    public Object siftRule(Map<String, String> params) {
59
-        String oldOrgCode = params.get("oldOrgCode");
60
-        String newOrgCode = params.get("newOrgCode");
57
+    public List<ErrorDto> siftRule(Map<String, String> params) {
61 58
         String primaryPost = params.get("primaryPost");
62 59
         String targetPost = params.get("targetPost");
63
-        String passTime = params.get("passTime");
64 60
 
65
-        //普通规则
66
-        if (oldOrgCode.equals(newOrgCode)) {
67
-            List<TaIncompatible> taIncompatibleList = regularRules(primaryPost, targetPost);
61
+        List<TaRotation> repelList = getMonthRules(params);
68 62
 
69
-//                List<TaIncompatible> taIncompatibleList = taIncompatibleService.getRegularRules(, );
63
+        List<TaIncompatible> taIncompatibleList = regularRules(primaryPost, targetPost);
70 64
 
71
-            if (taIncompatibleList.size() == 0) {
72
-                return "普通规则:根据不相容设置这两个岗位是相容的";
73
-            } else {
74
-                return taIncompatibleList;
75
-            }
65
+        RuleDetail ruleDetail=new RuleDetail();
76 66
 
77
-        } else {
78
-            params.put("oldOrgCode", oldOrgCode);
79
-            params.put("newOrgCode", newOrgCode);
80
-            params.put("primaryPost", primaryPost);
81
-            params.put("targetPost", targetPost);
82
-            params.put("passTime", passTime);
83
-            //三个月规则
84
-            List<TaRotation> repelList = getMonthRules(params);
85
-//                List<TaRotation> repelList = taIncompatibleService.getMonthRules(params);
86
-            if (repelList.size() == 0) {
87
-                return "三个月规则: 这是两个岗位是相容的";
88
-            } else {
89
-                return repelList;
90
-            }
67
+        List<ErrorDto> result = ruleDetail.planRuleType(taIncompatibleList,repelList);
68
+
69
+
70
+        return result;
91 71
 
92
-        }
93 72
 
94 73
     }
95 74
 
@@ -111,7 +90,7 @@ public class Rule {
111 90
         LocalDate newDate = LocalDate.parse(passTime, formatter).minusMonths(3);
112 91
 
113 92
         List<String> oldPostList = taIncompatibleMapper.getMonthRulesPrimary(primaryPost, Constants.MONTH_RULE);
114
-        List<String> newPostList = taIncompatibleMapper.getMonthRulesTarget(targetPost, Constants.MONTH_RULE);
93
+        List<String> newPostList = taIncompatibleMapper.getMonthRulesPrimary(targetPost, Constants.MONTH_RULE);
115 94
 
116 95
         if (oldPostList.size() == 0 && newPostList.size() == 0) {
117 96
             return repelList;
@@ -122,8 +101,8 @@ public class Rule {
122 101
             List<String> targetList = oldPostList;//目标岗位+原来不相容岗位
123 102
             targetList.add(targetPost);
124 103
 
125
-            //                拿到数据 不相容轮岗数据
126
-            repelList = taRotationMapper.selectRepel(orgList, targetList, newDate);
104
+            //拿到数据 不相容轮岗数据
105
+            repelList = taRotationMapper.selectRepel(orgList, targetList, newDate,params);
127 106
 
128 107
             return repelList;
129 108
         }

+ 47
- 0
application/src/main/java/com/lyg/application/util/RuleDetail.java Ver arquivo

@@ -0,0 +1,47 @@
1
+package com.lyg.application.util;
2
+
3
+import com.lyg.application.DTO.ErrorDto;
4
+import com.lyg.application.entity.TaIncompatible;
5
+import com.lyg.application.entity.TaRotation;
6
+
7
+import java.util.ArrayList;
8
+import java.util.List;
9
+
10
+public class RuleDetail {
11
+
12
+    public List<ErrorDto> planRuleType(List<TaIncompatible> taIncompatibleList, List<TaRotation> repelList) {
13
+
14
+        ErrorDto errorDto = new ErrorDto();
15
+        List<ErrorDto> result = new ArrayList<>();
16
+
17
+        //普通规则
18
+        if (taIncompatibleList.size() == 0) {
19
+            errorDto.setRegularRules("普通规则:根据不相容设置这两个岗位是相容的");
20
+        } else {
21
+            for (TaIncompatible item : taIncompatibleList) {
22
+                errorDto.setPrimaryPost(item.getPrimaryPost());
23
+                errorDto.setTargetPost(item.getTargetPost());
24
+
25
+            }
26
+        }
27
+
28
+
29
+        if (repelList.size() == 0) {
30
+            errorDto.setMonthRules("三个月规则: 这是两个岗位是相容的");
31
+        } else {
32
+            for (TaRotation item : repelList) {
33
+                errorDto.setCounterImpPositions(item.getCounterImpPositions());
34
+                errorDto.setCounterImpPost(item.getCounterImpPostRotation());
35
+                errorDto.setSpecificOrgName(item.getSpecificOrgName());
36
+                errorDto.setSpecificOrgNum(item.getSpecificOrgNum());
37
+                errorDto.setSpecificNameOrgRotation(item.getSpecificNameOrgRotation());
38
+                errorDto.setOrgNumJobRotation(item.getOrgNumJobRotation());
39
+                errorDto.setEmployeeNum(item.getEmployeeNum());
40
+                errorDto.setEmployeeName(item.getEmployeeName());
41
+            }
42
+        }
43
+        result.add(errorDto);
44
+        return result;
45
+    }
46
+
47
+}

+ 2
- 2
application/src/main/resources/mapper/TaIncompatibleMapper.xml Ver arquivo

@@ -16,9 +16,9 @@
16 16
         SELECT i.TARGET_POST FROM TA_INCOMPATIBLE i
17 17
         WHERE
18 18
         i.PRIMARY_POST=#{primaryPost}
19
-        and
19
+        AND
20 20
         i.DELETED=0
21
-        and
21
+        AND
22 22
         i.RULE=#{monthRule}
23 23
     </select>
24 24
 

+ 4
- 2
application/src/main/resources/mapper/TaRotationMapper.xml Ver arquivo

@@ -8,8 +8,10 @@
8 8
         WHERE
9 9
         r.rotation_exe_time IS NOT NULL
10 10
         AND r.specific_org_num != r.org_num_job_rotation
11
-        and r.rotation_exe_time &lt;=#{newDate}
12
-        and r.counter_imp_positions IN
11
+        AND r.specific_org_num=#{params.oldOrgCode}
12
+        AND r.org_num_job_rotation=#{params.newOrgCode}
13
+        AND r.rotation_exe_time &lt;=#{newDate}
14
+        AND r.counter_imp_positions IN
13 15
         <foreach item="item" index="index" collection="orgList" open="(" separator="," close=")">
14 16
             #{item}
15 17
         </foreach>

+ 3
- 2
system/src/main/java/com/lyg/system/controller/BaseController.java Ver arquivo

@@ -34,10 +34,11 @@ public class BaseController {
34 34
     public void checkAuth() {
35 35
         SysUser sysUser = currentUser();
36 36
         Integer isAdmin = sysUser.getIsAdmin();
37
-        if (isAdmin.equals(1)){
37
+        if (isAdmin.equals(1)) {
38 38
             //是超级管理员
39
-        }else{
39
+        } else {
40 40
 //            不是管理员
41
+            String userId = sysUser.getUserId();
41 42
         }
42 43
 
43 44
     }