张涛 1年前
父节点
当前提交
2d1de69ac2

+ 21
- 19
application/src/main/java/com/lyg/application/controller/TaIncompatibleController.java 查看文件

5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
 import com.lyg.application.entity.TaIncompatible;
7
 import com.lyg.application.entity.TaIncompatible;
8
+import com.lyg.application.entity.TaRotation;
8
 import com.lyg.application.service.TaIncompatibleService;
9
 import com.lyg.application.service.TaIncompatibleService;
9
 import com.lyg.common.util.StringUtil;
10
 import com.lyg.common.util.StringUtil;
10
 import com.lyg.framework.accesslimit.AccessLimit;
11
 import com.lyg.framework.accesslimit.AccessLimit;
128
 
129
 
129
     /**
130
     /**
130
      * 分页查询
131
      * 分页查询
131
-     *
132
-     * @return 查询结果
133
      */
132
      */
134
     @OpLog(module = "不相容规则查询", action = "")
133
     @OpLog(module = "不相容规则查询", action = "")
135
     @AccessLimit()
134
     @AccessLimit()
136
     @ApiOperation("不相容规则查询")
135
     @ApiOperation("不相容规则查询")
137
     @GetMapping("/taIncompatible/rule")
136
     @GetMapping("/taIncompatible/rule")
138
     public SaResult listRule(
137
     public SaResult listRule(
139
-            @ApiParam("当前时间") @RequestParam(value = "newTime", required = false) String newTime,
140
-            @ApiParam("原机构/网点") @RequestParam(value = "orgCode", required = false) String oldOrgCode,
138
+            @ApiParam("当前时间") @RequestParam(value = "passTime", required = false) String passTime,
139
+            @ApiParam("原机构/网点") @RequestParam(value = "oldOrgCode", required = false) String oldOrgCode,
141
             @ApiParam("原岗位") @RequestParam(value = "primaryPost", required = false) String primaryPost,
140
             @ApiParam("原岗位") @RequestParam(value = "primaryPost", required = false) String primaryPost,
142
-            @ApiParam("目标机构/网点") @RequestParam(value = "orgCode", required = false) String newOrgCode,
141
+            @ApiParam("目标机构/网点") @RequestParam(value = "newOrgCode", required = false) String newOrgCode,
143
             @ApiParam("目标岗位") @RequestParam(value = "targetPost", required = false) String targetPost) throws Exception {
142
             @ApiParam("目标岗位") @RequestParam(value = "targetPost", required = false) String targetPost) throws Exception {
144
 
143
 
145
 
144
 
146
         Map<String, String> params = new Hashtable<>();
145
         Map<String, String> params = new Hashtable<>();
147
-        params.put("oldOrgCode", oldOrgCode);
148
-        params.put("newOrgCode", newOrgCode);
149
-        params.put("primaryPost", primaryPost);
150
-        params.put("targetPost", targetPost);
151
-        if (oldOrgCode != null && newOrgCode != null && primaryPost != null && targetPost != null && newTime != null) {
152
 
146
 
147
+        if (oldOrgCode != null && newOrgCode != null && primaryPost != null && targetPost != null && passTime != null) {
153
             //普通规则
148
             //普通规则
154
             if (oldOrgCode.equals(newOrgCode)) {
149
             if (oldOrgCode.equals(newOrgCode)) {
155
                 List<TaIncompatible> taIncompatibleList = taIncompatibleService.getRegularRules(primaryPost, targetPost);
150
                 List<TaIncompatible> taIncompatibleList = taIncompatibleService.getRegularRules(primaryPost, targetPost);
156
 
151
 
157
                 if (taIncompatibleList.size() == 0) {
152
                 if (taIncompatibleList.size() == 0) {
158
-                   return SaResult.data("普通规则:根据不相容设置这两个岗位是相容的");
153
+                    return SaResult.data("普通规则:根据不相容设置这两个岗位是相容的");
159
                 } else {
154
                 } else {
160
                     return SaResult.data(taIncompatibleList);
155
                     return SaResult.data(taIncompatibleList);
161
                 }
156
                 }
162
 
157
 
163
             } else {
158
             } else {
164
-//三个月规则
165
-
166
-
167
-                taIncompatibleService.getMonthRules(params);
168
-
159
+                params.put("oldOrgCode", oldOrgCode);
160
+                params.put("newOrgCode", newOrgCode);
161
+                params.put("primaryPost", primaryPost);
162
+                params.put("targetPost", targetPost);
163
+                params.put("passTime", passTime);
164
+                //三个月规则
165
+
166
+                List<TaRotation> repelList = taIncompatibleService.getMonthRules(params);
167
+                if (repelList.size() == 0) {
168
+                    return SaResult.data("三个月规则: 这是两个岗位是相容的");
169
+                } else {
170
+                    return SaResult.data(repelList);
171
+                }
169
 
172
 
170
             }
173
             }
171
-        } else {
172
-            return SaResult.error("请输入岗位或机构号");
173
         }
174
         }
175
+        return SaResult.error("请输入岗位或机构号");
176
+
174
 
177
 
175
-        return null;
176
     }
178
     }
177
 
179
 
178
 
180
 

+ 23
- 0
application/src/main/java/com/lyg/application/controller/UploadController.java 查看文件

14
 import io.swagger.annotations.ApiOperation;
14
 import io.swagger.annotations.ApiOperation;
15
 import io.swagger.annotations.ApiParam;
15
 import io.swagger.annotations.ApiParam;
16
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.beans.factory.annotation.Autowired;
17
+import org.springframework.scheduling.annotation.Scheduled;
17
 import org.springframework.web.bind.annotation.*;
18
 import org.springframework.web.bind.annotation.*;
18
 import org.springframework.web.multipart.MultipartFile;
19
 import org.springframework.web.multipart.MultipartFile;
19
 
20
 
111
     }
112
     }
112
 
113
 
113
 
114
 
115
+
116
+
117
+//
118
+//    @AccessLimit()
119
+//    @ApiOperation("提示/预警")
120
+//    @Scheduled(cron = "0 45 2 1 1,4,7,10 ?")
121
+//    @GetMapping("/prompt/warning")
122
+//    public SaResult promptWarning() throws Exception {
123
+//
124
+//
125
+//return  SaResult.data("");
126
+//
127
+//
128
+//    }
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
114
 }
137
 }

+ 9
- 4
application/src/main/java/com/lyg/application/mapper/TaRotationMapper.java 查看文件

1
 package com.lyg.application.mapper;
1
 package com.lyg.application.mapper;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.lyg.application.entity.TaRotation;
4
 import org.apache.ibatis.annotations.Mapper;
5
 import org.apache.ibatis.annotations.Mapper;
5
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
6
-import com.lyg.application.entity.TaRotation;
7
 
7
 
8
- /**
8
+import java.time.LocalDate;
9
+import java.util.List;
10
+
11
+/**
9
  * 轮岗列表;(ta_rotation)表数据库访问层
12
  * 轮岗列表;(ta_rotation)表数据库访问层
13
+ *
10
  * @author : http://njyunzhi.com
14
  * @author : http://njyunzhi.com
11
  * @date : 2024-3-6
15
  * @date : 2024-3-6
12
  */
16
  */
13
 @Mapper
17
 @Mapper
14
-public interface TaRotationMapper  extends BaseMapper<TaRotation>{
15
-    
18
+public interface TaRotationMapper extends BaseMapper<TaRotation> {
19
+
20
+    List<TaRotation> selectRepel(@Param("orgList") List<String> orgList, @Param("targetList") List<String> targetList,@Param("newDate") LocalDate newDate);
16
 }
21
 }

+ 98
- 0
application/src/main/java/com/lyg/application/schedule/TaskSchedule.java 查看文件

1
+package com.lyg.application.schedule;
2
+
3
+import com.lyg.application.service.TaRotationService;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.scheduling.annotation.Scheduled;
6
+import org.springframework.stereotype.Component;
7
+
8
+
9
+@Component
10
+public class TaskSchedule {
11
+
12
+    @Autowired
13
+    TaRotationService taRotationService;
14
+
15
+    @Scheduled(cron = "0 14 18 * * ?")
16
+    public void lockOver() {
17
+        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!");
18
+
19
+    }
20
+
21
+//    /**
22
+//     * 每天晚上 11 点 50 执行
23
+//     * 锁定任务, 并设置为过期
24
+//     */
25
+//    @Scheduled(cron = "0 50 23 * * ?")
26
+//    public void lockOver() {
27
+//        try {
28
+//            taTaskService.lockTask();
29
+//        } catch (Exception e) {
30
+//            e.printStackTrace();
31
+//        }
32
+//    }
33
+//
34
+//    /**
35
+//     * 每天凌晨 1:00 执行
36
+//     */
37
+//    @Scheduled(cron = "0 0 1 * * ?")
38
+//    public void daily() {
39
+//        try {
40
+//            String batchId = TaskUtil.getDailyBatchId();
41
+//            taTaskService.syncTask(batchId, FrequencyEnum.BEFORE_WORK.getValue());
42
+//        } catch (Exception e) {
43
+//            e.printStackTrace();
44
+//        }
45
+//        try {
46
+//            String batchId = TaskUtil.getDailyBatchId();
47
+//            taTaskService.syncTask(batchId, FrequencyEnum.AT_WORK.getValue());
48
+//        } catch (Exception e) {
49
+//            e.printStackTrace();
50
+//        }
51
+//        try {
52
+//            String batchId = TaskUtil.getDailyBatchId();
53
+//            taTaskService.syncTask(batchId, FrequencyEnum.AFTER_WORK.getValue());
54
+//        } catch (Exception e) {
55
+//            e.printStackTrace();
56
+//        }
57
+//    }
58
+//
59
+//    /**
60
+//     * 每周一凌晨 2:00 执行
61
+//     */
62
+//    @Scheduled(cron = "0 0 2 * * MON")
63
+//    public void weekly() {
64
+//        try {
65
+//            String batchId = TaskUtil.getWeeklyBatchId();
66
+//            taTaskService.syncTask(batchId, FrequencyEnum.WEEKLY.getValue());
67
+//        } catch (Exception e) {
68
+//            e.printStackTrace();
69
+//        }
70
+//    }
71
+//
72
+//    /**
73
+//     * 每月1号凌晨 2:30 执行
74
+//     */
75
+//    @Scheduled(cron = "0 30 2 1 * ?")
76
+//    public void monthly() {
77
+//        try {
78
+//            String batchId = TaskUtil.getMonthlyBatchId();
79
+//            taTaskService.syncTask(batchId, FrequencyEnum.MONTHLY.getValue());
80
+//        } catch (Exception e) {
81
+//            e.printStackTrace();
82
+//        }
83
+//    }
84
+//
85
+//
86
+//    /**
87
+//     * 每季度第一个月 1号凌晨 2:45 执行
88
+//     */
89
+//    @Scheduled(cron = "0 45 2 1 1,4,7,10 ?")
90
+//    public void quarterly() {
91
+//        try {
92
+//            String batchId = TaskUtil.getQuarterlyBatchId();
93
+//            taTaskService.syncTask(batchId, FrequencyEnum.QUARTERLY.getValue());
94
+//        } catch (Exception e) {
95
+//            e.printStackTrace();
96
+//        }
97
+//    }
98
+}

+ 3
- 2
application/src/main/java/com/lyg/application/service/TaIncompatibleService.java 查看文件

1
 package com.lyg.application.service;
1
 package com.lyg.application.service;
2
 
2
 
3
-import com.baomidou.mybatisplus.extension.service.IService;
3
+import cn.dev33.satoken.util.SaResult;
4
 import com.lyg.application.entity.TaIncompatible;
4
 import com.lyg.application.entity.TaIncompatible;
5
+import com.lyg.application.entity.TaRotation;
5
 import com.lyg.system.service.IBaseService;
6
 import com.lyg.system.service.IBaseService;
6
 
7
 
7
 import java.util.List;
8
 import java.util.List;
17
 
18
 
18
     List<TaIncompatible> getRegularRules(String primaryPost, String targetPost);
19
     List<TaIncompatible> getRegularRules(String primaryPost, String targetPost);
19
 
20
 
20
-    void getMonthRules(Map<String, String> params);
21
+    List<TaRotation> getMonthRules(Map<String, String> params);
21
 }
22
 }

+ 34
- 5
application/src/main/java/com/lyg/application/service/impl/TaIncompatibleServiceImpl.java 查看文件

1
 package com.lyg.application.service.impl;
1
 package com.lyg.application.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.lyg.application.entity.TaIncompatible;
4
 import com.lyg.application.entity.TaIncompatible;
5
+import com.lyg.application.entity.TaRotation;
4
 import com.lyg.application.mapper.TaIncompatibleMapper;
6
 import com.lyg.application.mapper.TaIncompatibleMapper;
7
+import com.lyg.application.mapper.TaRotationMapper;
5
 import com.lyg.application.service.TaIncompatibleService;
8
 import com.lyg.application.service.TaIncompatibleService;
6
 import com.lyg.application.util.IncompatibleRule;
9
 import com.lyg.application.util.IncompatibleRule;
7
 import com.lyg.system.service.impl.BaseServiceImpl;
10
 import com.lyg.system.service.impl.BaseServiceImpl;
9
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.stereotype.Service;
13
 import org.springframework.stereotype.Service;
11
 
14
 
15
+import java.time.LocalDate;
16
+import java.time.format.DateTimeFormatter;
12
 import java.util.ArrayList;
17
 import java.util.ArrayList;
13
 import java.util.List;
18
 import java.util.List;
14
 import java.util.Map;
19
 import java.util.Map;
23
 public class TaIncompatibleServiceImpl extends BaseServiceImpl<TaIncompatibleMapper, TaIncompatible> implements TaIncompatibleService {
28
 public class TaIncompatibleServiceImpl extends BaseServiceImpl<TaIncompatibleMapper, TaIncompatible> implements TaIncompatibleService {
24
     @Autowired
29
     @Autowired
25
     private IncompatibleRule incompatibleRule;
30
     private IncompatibleRule incompatibleRule;
31
+    @Autowired
32
+    private TaRotationMapper taRotationMapper;
26
 
33
 
27
 //    @Override
34
 //    @Override
28
 //    public List<TaIncompatible> selectRule(String oldOrgName, String newOrgName) {
35
 //    public List<TaIncompatible> selectRule(String oldOrgName, String newOrgName) {
38
     }
45
     }
39
 
46
 
40
     @Override
47
     @Override
41
-    public void getMonthRules(Map<String, String> params) {
42
-        String primaryPost=params.get("primaryPost");
43
-        String targetPost=params.get("targetPost");
44
-        List<String> oldPostList = baseMapper.getMonthRulesPrimary(primaryPost);//原来岗位+不容岗位
45
-        List<String> newPostList = baseMapper.getMonthRulesTarget(targetPost);//目标岗位+不容岗位
48
+    public List<TaRotation> getMonthRules(Map<String, String> params) {
49
+        List<TaRotation> repelList = new ArrayList<>();
50
+
51
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
52
+
53
+        QueryWrapper<TaRotation> queryWrapper = new QueryWrapper<>();
54
+        String primaryPost = params.get("primaryPost");
55
+        String targetPost = params.get("targetPost");
56
+        String passTime = params.get("passTime");
57
+        LocalDate newDate = LocalDate.parse(passTime, formatter).minusMonths(3);
58
+
59
+        List<String> oldPostList = baseMapper.getMonthRulesPrimary(primaryPost);//原来岗位+目标不相容岗位
60
+        List<String> newPostList = baseMapper.getMonthRulesTarget(targetPost);//目标岗位+原来不相容岗位
61
+
62
+        if (oldPostList.size() == 0 && newPostList.size() == 0) {
63
+            return repelList;
64
+        } else {
65
+            List<String> orgList = newPostList;//原来岗位 不相容的
66
+            orgList.add(orgList.size() - 1, primaryPost);
67
+
68
+            List<String> targetList = oldPostList;//目标岗位 不相容的
69
+            targetList.add(targetList.size() - 1, targetPost);
70
+
71
+            //                拿到数据 不相容轮岗数据
72
+            repelList = taRotationMapper.selectRepel(orgList, targetList,newDate);
46
 
73
 
74
+            return repelList;
75
+        }
47
 
76
 
48
     }
77
     }
49
 }
78
 }

+ 10
- 2
application/src/main/resources/mapper/TaIncompatibleMapper.xml 查看文件

13
     </select>
13
     </select>
14
 
14
 
15
     <select id="getMonthRulesPrimary" resultType="java.lang.String">
15
     <select id="getMonthRulesPrimary" resultType="java.lang.String">
16
-        SELECT * FROM TA_INCOMPATIBLE i
16
+        SELECT i.TARGET_POST FROM TA_INCOMPATIBLE i
17
         WHERE
17
         WHERE
18
         i.PRIMARY_POST=#{primaryPost}
18
         i.PRIMARY_POST=#{primaryPost}
19
         and
19
         and
23
     </select>
23
     </select>
24
 
24
 
25
 
25
 
26
-    <select id="getMonthRulesTarget" resultType="java.lang.String"></select>
26
+    <select id="getMonthRulesTarget" resultType="java.lang.String">
27
+        SELECT i.PRIMARY_POST FROM TA_INCOMPATIBLE i
28
+        WHERE
29
+        i.TARGET_POST=#{targetPost}
30
+        and
31
+        i.DELETED=0
32
+        and
33
+        i.RULE='monthRules'
34
+    </select>
27
 </mapper>
35
 </mapper>

+ 16
- 1
application/src/main/resources/mapper/TaRotationMapper.xml 查看文件

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 
3
 
4
 <mapper namespace="com.lyg.application.mapper.TaRotationMapper">
4
 <mapper namespace="com.lyg.application.mapper.TaRotationMapper">
5
-    
5
+    <select id="selectRepel" resultType="com.lyg.application.entity.TaRotation">
6
+        SELECT r.counter_imp_positions, r.counter_imp_post_rotation, r.*
7
+        FROM TA_ROTATION r
8
+        WHERE
9
+        r.rotation_exe_time IS NOT NULL
10
+        and r.rotation_exe_time &lt;=#{newDate}
11
+        and r.counter_imp_positions IN
12
+        <foreach item="item" index="index" collection="orgList" open="(" separator="," close=")">
13
+            #{item}
14
+        </foreach>
15
+        AND
16
+        r.counter_imp_post_rotation IN
17
+        <foreach item="item" index="index" collection="targetList" open="(" separator="," close=")">
18
+            #{item}
19
+        </foreach>
20
+    </select>
6
 </mapper>
21
 </mapper>