张涛 1 年之前
父節點
當前提交
bcee8a75dd

+ 17
- 1
application/src/main/java/com/lyg/application/controller/TaMandatoryLeaveController.java 查看文件

18
 import org.springframework.validation.annotation.Validated;
18
 import org.springframework.validation.annotation.Validated;
19
 import org.springframework.web.bind.annotation.*;
19
 import org.springframework.web.bind.annotation.*;
20
 
20
 
21
+import java.time.LocalDate;
22
+import java.time.format.DateTimeFormatter;
23
+
21
 /**
24
 /**
22
  * 强制休假表;(ta_mandatory_leave)表控制层
25
  * 强制休假表;(ta_mandatory_leave)表控制层
23
  *
26
  *
77
                          @ApiParam("对应重要岗位") @RequestParam(value = "counterImpPost", required = false) String counterImpPost,
80
                          @ApiParam("对应重要岗位") @RequestParam(value = "counterImpPost", required = false) String counterImpPost,
78
                          @ApiParam("对应总行条线") @RequestParam(value = "counterHeadOfficeLine", required = false) String counterHeadOfficeLine,
81
                          @ApiParam("对应总行条线") @RequestParam(value = "counterHeadOfficeLine", required = false) String counterHeadOfficeLine,
79
 
82
 
83
+                         @ApiParam("休假起始时间开始") @RequestParam(value = "startVacation", required = false) String startVacation,
84
+                         @ApiParam("休假起始时间结束") @RequestParam(value = "endVacation", required = false) String endVacation,
85
+
86
+
80
                          @ApiParam("正序排列") @RequestParam(value = "sortAsc", defaultValue = "create_date") String sortAsc,
87
                          @ApiParam("正序排列") @RequestParam(value = "sortAsc", defaultValue = "create_date") String sortAsc,
81
                          @ApiParam("倒序排列") @RequestParam(value = "sortDesc", required = false) String sortDesc
88
                          @ApiParam("倒序排列") @RequestParam(value = "sortDesc", required = false) String sortDesc
82
     ) throws Exception {
89
     ) throws Exception {
83
-
90
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式化模式
91
+        LocalDate startDate = null;
92
+        LocalDate endDate = null;
93
+        if (StringUtil.isNotEmpty(startVacation)) {
94
+            startDate = LocalDate.parse(startVacation, formatter);
95
+            endDate = LocalDate.parse(endVacation, formatter);
96
+        }
84
         IPage<TaMandatoryLeave> pg = new Page<>(pageNum, pageSize);
97
         IPage<TaMandatoryLeave> pg = new Page<>(pageNum, pageSize);
85
         QueryWrapper<TaMandatoryLeave> queryWrapper = new QueryWrapper<>();
98
         QueryWrapper<TaMandatoryLeave> queryWrapper = new QueryWrapper<>();
99
+
100
+        queryWrapper.between(startDate != null, "start_time_vacation", startDate, endDate);
101
+
86
         queryWrapper.eq(StringUtil.isNotEmpty(checkAuth()), "CREATE_USER", checkAuth());
102
         queryWrapper.eq(StringUtil.isNotEmpty(checkAuth()), "CREATE_USER", checkAuth());
87
         queryWrapper.like(StringUtil.isNotEmpty(headOfficeOrg), "head_office_org", headOfficeOrg);
103
         queryWrapper.like(StringUtil.isNotEmpty(headOfficeOrg), "head_office_org", headOfficeOrg);
88
         queryWrapper.eq(StringUtil.isNotEmpty(employeeNum), "employee_num", employeeNum);
104
         queryWrapper.eq(StringUtil.isNotEmpty(employeeNum), "employee_num", employeeNum);

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

4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.DTO.ErrorDto;
8
 import com.lyg.application.entity.TaRotation;
7
 import com.lyg.application.entity.TaRotation;
9
 import com.lyg.application.service.TaRotationService;
8
 import com.lyg.application.service.TaRotationService;
10
-import com.lyg.application.util.CreateResponse;
11
 import com.lyg.application.util.Rule;
9
 import com.lyg.application.util.Rule;
12
 import com.lyg.common.util.StringUtil;
10
 import com.lyg.common.util.StringUtil;
13
 import com.lyg.framework.accesslimit.AccessLimit;
11
 import com.lyg.framework.accesslimit.AccessLimit;
21
 import org.springframework.validation.annotation.Validated;
19
 import org.springframework.validation.annotation.Validated;
22
 import org.springframework.web.bind.annotation.*;
20
 import org.springframework.web.bind.annotation.*;
23
 
21
 
24
-import java.util.ArrayList;
25
-import java.util.List;
22
+import java.time.LocalDate;
23
+import java.time.format.DateTimeFormatter;
26
 
24
 
27
 /**
25
 /**
28
  * 轮岗列表;(ta_rotation)表控制层
26
  * 轮岗列表;(ta_rotation)表控制层
87
                          @ApiParam("对应机构层次") @RequestParam(value = "counterInstitutionsLevel", required = false) String counterInstitutionsLevel,
85
                          @ApiParam("对应机构层次") @RequestParam(value = "counterInstitutionsLevel", required = false) String counterInstitutionsLevel,
88
                          @ApiParam("对应重要岗位") @RequestParam(value = "counterImpPositions", required = false) String counterImpPositions,
86
                          @ApiParam("对应重要岗位") @RequestParam(value = "counterImpPositions", required = false) String counterImpPositions,
89
                          @ApiParam("对应总行条线") @RequestParam(value = "counterHeadOfficeLine", required = false) String counterHeadOfficeLine,
87
                          @ApiParam("对应总行条线") @RequestParam(value = "counterHeadOfficeLine", required = false) String counterHeadOfficeLine,
88
+                         @ApiParam("轮岗截止日期开始") @RequestParam(value = "startDeadline", required = false) String startDeadline,
89
+                         @ApiParam("轮岗截止日期结束") @RequestParam(value = "endDeadline", required = false) String endDeadline,
90
 
90
 
91
+                         @ApiParam("轮岗执行时间开始") @RequestParam(value = "startExeTime", required = false) String startExeTime,
92
+                         @ApiParam("轮岗执行时间结束") @RequestParam(value = "endExeTime", required = false) String endExeTime,
91
 
93
 
92
                          @ApiParam("正序排列") @RequestParam(value = "sortAsc", defaultValue = "create_date") String sortAsc,
94
                          @ApiParam("正序排列") @RequestParam(value = "sortAsc", defaultValue = "create_date") String sortAsc,
93
                          @ApiParam("倒序排列") @RequestParam(value = "sortDesc", required = false) String sortDesc
95
                          @ApiParam("倒序排列") @RequestParam(value = "sortDesc", required = false) String sortDesc
94
     ) throws Exception {
96
     ) throws Exception {
95
 
97
 
98
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式化模式
99
+        LocalDate startDate = null;
100
+        LocalDate endDate = null;
101
+        if (StringUtil.isNotEmpty(startDeadline)) {
102
+            startDate = LocalDate.parse(startDeadline, formatter);
103
+            endDate = LocalDate.parse(endDeadline, formatter);
104
+        }
105
+        if (StringUtil.isNotEmpty(startExeTime)) {
106
+            startDate = LocalDate.parse(startExeTime, formatter);
107
+            endDate = LocalDate.parse(endExeTime, formatter);
108
+        }
109
+
110
+
96
         IPage<TaRotation> pg = new Page<>(pageNum, pageSize);
111
         IPage<TaRotation> pg = new Page<>(pageNum, pageSize);
97
         QueryWrapper<TaRotation> queryWrapper = new QueryWrapper<>();
112
         QueryWrapper<TaRotation> queryWrapper = new QueryWrapper<>();
98
         queryWrapper.eq(StringUtil.isNotEmpty(checkAuth()), "CREATE_USER", checkAuth());
113
         queryWrapper.eq(StringUtil.isNotEmpty(checkAuth()), "CREATE_USER", checkAuth());
114
+        queryWrapper.between(startDate != null, "rotation_deadline", startDate, endDate);
115
+        queryWrapper.between(startDate != null, "rotation_exe_time", startDate, endDate);
116
+
117
+
99
         queryWrapper.like(StringUtil.isNotEmpty(headOfficeOrg), "head_office_org", headOfficeOrg);
118
         queryWrapper.like(StringUtil.isNotEmpty(headOfficeOrg), "head_office_org", headOfficeOrg);
100
         queryWrapper.eq(StringUtil.isNotEmpty(employeeNum), "employee_num", employeeNum);
119
         queryWrapper.eq(StringUtil.isNotEmpty(employeeNum), "employee_num", employeeNum);
101
         queryWrapper.like(StringUtil.isNotEmpty(employeeName), "employee_name", employeeName);
120
         queryWrapper.like(StringUtil.isNotEmpty(employeeName), "employee_name", employeeName);

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

125
     public void promptWarning() throws Exception {
125
     public void promptWarning() throws Exception {
126
 
126
 
127
 //        taRotationService.selectGetWaring();
127
 //        taRotationService.selectGetWaring();
128
-//        taMandatoryLeaveService.selectGetPrompt();
128
+        taMandatoryLeaveService.selectGetPrompt();
129
 
129
 
130
     }
130
     }
131
 
131
 

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

2
 
2
 
3
 
3
 
4
 import com.lyg.application.service.TaMandatoryLeaveService;
4
 import com.lyg.application.service.TaMandatoryLeaveService;
5
-import com.lyg.application.service.TaRotationService;
6
 import com.lyg.framework.accesslimit.AccessLimit;
5
 import com.lyg.framework.accesslimit.AccessLimit;
7
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.beans.factory.annotation.Value;
8
 import org.springframework.scheduling.annotation.Scheduled;
8
 import org.springframework.scheduling.annotation.Scheduled;
9
 import org.springframework.stereotype.Component;
9
 import org.springframework.stereotype.Component;
10
 
10
 
14
     @Autowired
14
     @Autowired
15
     private TaMandatoryLeaveService taMandatoryLeaveService;
15
     private TaMandatoryLeaveService taMandatoryLeaveService;
16
 
16
 
17
+
17
     /**
18
     /**
18
      *  定时提醒   每年12月20号8点
19
      *  定时提醒   每年12月20号8点
19
      * @throws Exception
20
      * @throws Exception
20
      */
21
      */
21
     @AccessLimit()
22
     @AccessLimit()
22
-    @Scheduled(cron = "0 0 8 20 12 *")
23
+    @Scheduled(cron = "${yz.job.task2}")
23
     public void promptWarning() throws Exception {
24
     public void promptWarning() throws Exception {
24
         taMandatoryLeaveService.selectGetPrompt();
25
         taMandatoryLeaveService.selectGetPrompt();
25
     }
26
     }

+ 1
- 1
application/src/main/java/com/lyg/application/job/TotationJobTime.java 查看文件

22
      */
22
      */
23
 
23
 
24
     @AccessLimit()
24
     @AccessLimit()
25
-    @Scheduled(cron = "0 0 8 * * *")
25
+    @Scheduled(cron = "${yz.job.task1}")
26
     public void promptWarning() throws Exception {
26
     public void promptWarning() throws Exception {
27
         taRotationService.selectGetWaring();
27
         taRotationService.selectGetWaring();
28
 
28
 

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

29
  */
29
  */
30
 @Service
30
 @Service
31
 public class TaMandatoryLeaveServiceImpl extends BaseServiceImpl<TaMandatoryLeaveMapper, TaMandatoryLeave> implements TaMandatoryLeaveService {
31
 public class TaMandatoryLeaveServiceImpl extends BaseServiceImpl<TaMandatoryLeaveMapper, TaMandatoryLeave> implements TaMandatoryLeaveService {
32
-    private final List<String> errorMessages = new ArrayList<>();
33
-
34
     private static final String MESSAGE_SOURCE_NAME = "taMandatoryLeave";
32
     private static final String MESSAGE_SOURCE_NAME = "taMandatoryLeave";
35
     private static final String PROMPT_TYPE = "prompt";
33
     private static final String PROMPT_TYPE = "prompt";
36
-
34
+    private final List<String> errorMessages = new ArrayList<>();
35
+    
36
+    @Autowired
37
     @Value("${yz.holidayTmp}")
37
     @Value("${yz.holidayTmp}")
38
     String holidayTmp;
38
     String holidayTmp;
39
 
39
 
122
 
122
 
123
 //        messageHandle.handleMandatoryLeaves(localDate, holidayTmp, PROMPT_TYPE);
123
 //        messageHandle.handleMandatoryLeaves(localDate, holidayTmp, PROMPT_TYPE);
124
         // 提示消息处理
124
         // 提示消息处理
125
-        messageHandle.handleMandatoryLeaves(localDate, holidayTmp, PROMPT_TYPE,MESSAGE_SOURCE_NAME, baseMapper::prompt);
126
-//        List<TaMandatoryLeave> promptList = baseMapper.prompt(localDate);
125
+        messageHandle.handleMandatoryLeaves(localDate, holidayTmp, PROMPT_TYPE, MESSAGE_SOURCE_NAME, baseMapper::prompt);
126
+//        List<TaMandatoryLeave> promptList = baseMapper.prompt(localDate)PROMPT_TYPE;
127
 //
127
 //
128
 //        if (promptList.size() != 0) {
128
 //        if (promptList.size() != 0) {
129
 //            for (TaMandatoryLeave item : promptList) {
129
 //            for (TaMandatoryLeave item : promptList) {

+ 22
- 16
application/src/main/java/com/lyg/application/util/MessageHandle.java 查看文件

67
      * @param messageType 消息类型
67
      * @param messageType 消息类型
68
      */
68
      */
69
     private void processItem(TaRotation item, String tmp, String messageType, String sourceName) {
69
     private void processItem(TaRotation item, String tmp, String messageType, String sourceName) {
70
-        StringBuilder stringBuilder = new StringBuilder();
70
+        String newTmp = null;
71
         TaMessage taMessage = new TaMessage();
71
         TaMessage taMessage = new TaMessage();
72
         Map<String, String> params = new HashMap<>();
72
         Map<String, String> params = new HashMap<>();
73
 
73
 
76
         taMessage.setMessageId(uuid);
76
         taMessage.setMessageId(uuid);
77
         taMessage.setSourceId(item.getRotationId());
77
         taMessage.setSourceId(item.getRotationId());
78
 
78
 
79
-        // 使用描述性强的常量代替硬编码值
80
-        stringBuilder.append(tmp); // 假设warningTmp或promptTmp已经定义且包含插入点
81
-        stringBuilder.insert(Constants.numI, item.getEmployeeNum());
82
-        int insertPos = item.getEmployeeNum().length() + Constants.nameI;
83
-        stringBuilder.insert(insertPos, item.getEmployeeName());
84
-        taMessage.setContentSent(stringBuilder.toString());
79
+//        // 使用描述性强的常量代替硬编码值
80
+//        stringBuilder.insert(Constants.numI, item.getEmployeeNum());
81
+//        int insertPos = item.getEmployeeNum().length() + Constants.nameI;
82
+//        stringBuilder.insert(insertPos, item.getEmployeeName());
83
+        String employeeNum = item.getEmployeeNum();
84
+        String employeeName = item.getEmployeeName();
85
+        newTmp = tmp.replace("code", employeeNum).replace("name", employeeName);
86
+        taMessage.setContentSent(newTmp);
85
         taMessage.setSourceName(sourceName);
87
         taMessage.setSourceName(sourceName);
86
         taMessage.setWaringType(messageType);
88
         taMessage.setWaringType(messageType);
87
         params.put("sourceName", sourceName);
89
         params.put("sourceName", sourceName);
88
         params.put("waringType", messageType);
90
         params.put("waringType", messageType);
89
-        params.put("contentSent", stringBuilder.toString());
91
+        params.put("contentSent", newTmp);
90
         Long count = taMessageService.countBy("source_id", item.getRotationId(), true);
92
         Long count = taMessageService.countBy("source_id", item.getRotationId(), true);
91
         if (count == 0) {
93
         if (count == 0) {
92
             taMessageMapper.insert(taMessage);
94
             taMessageMapper.insert(taMessage);
109
     }
111
     }
110
 
112
 
111
     private void processItemLeaves(TaMandatoryLeave item, String tmp, String messageType, String sourceName) {
113
     private void processItemLeaves(TaMandatoryLeave item, String tmp, String messageType, String sourceName) {
112
-        StringBuilder stringBuilder = new StringBuilder();
113
         TaMessage taMessage = new TaMessage();
114
         TaMessage taMessage = new TaMessage();
114
         Map<String, String> params = new HashMap<>();
115
         Map<String, String> params = new HashMap<>();
115
 
116
 
117
         taMessage.setMessageId(uuid);
118
         taMessage.setMessageId(uuid);
118
         taMessage.setSourceId(item.getLeaveId());
119
         taMessage.setSourceId(item.getLeaveId());
119
 
120
 
120
-        // 使用描述性强的常量代替硬编码值
121
-        stringBuilder.append(tmp); // 假设warningTmp或promptTmp已经定义且包含插入点
122
-        stringBuilder.insert(Constants.numI, item.getEmployeeNum());
123
-        int insertPos = item.getEmployeeNum().length() + Constants.nameI;
124
-        stringBuilder.insert(insertPos, item.getEmployeeName());
125
-        taMessage.setContentSent(stringBuilder.toString());
121
+//        // 使用描述性强的常量代替硬编码值
122
+        StringBuilder sb = new StringBuilder(tmp);
123
+        // 假设warningTmp或promptTmp已经定义且包含插入点
124
+//        stringBuilder.insert(Constants.numI, item.getEmployeeNum());
125
+//        int insertPos = item.getEmployeeNum().length() + Constants.nameI;
126
+//        stringBuilder.insert(insertPos, item.getEmployeeName());
127
+        String employeeNum = item.getEmployeeNum();
128
+        String employeeName = item.getEmployeeName();
129
+        String newTmp = null;
130
+        newTmp = tmp.replace("code", employeeNum).replace("name", employeeName);
131
+        taMessage.setContentSent(newTmp);
126
         taMessage.setSourceName(sourceName);
132
         taMessage.setSourceName(sourceName);
127
         taMessage.setWaringType(messageType);
133
         taMessage.setWaringType(messageType);
128
         params.put("sourceName", "taMandatoryLeave");
134
         params.put("sourceName", "taMandatoryLeave");
129
         params.put("waringType", "prompt");
135
         params.put("waringType", "prompt");
130
-        params.put("contentSent", stringBuilder.toString());
136
+        params.put("contentSent", newTmp);
131
         Long count = taMessageService.countBy("source_id", item.getLeaveId(), true);
137
         Long count = taMessageService.countBy("source_id", item.getLeaveId(), true);
132
         if (count == 0) {
138
         if (count == 0) {
133
             taMessageMapper.insert(taMessage);
139
             taMessageMapper.insert(taMessage);

+ 7
- 5
application/src/main/resources/application.yml 查看文件

1
-
2
 # 端口
1
 # 端口
3
 server:
2
 server:
4
   port: 8001
3
   port: 8001
16
     date-format: yyyy-MM-dd HH:mm:ss
15
     date-format: yyyy-MM-dd HH:mm:ss
17
     time-zone: GMT+8
16
     time-zone: GMT+8
18
   datasource:
17
   datasource:
19
-    url: jdbc:oracle:thin:@192.168.89.10:1521:orcl
18
+    url: jdbc:oracle:thin:@192.168.89.147:1521:orcl
20
     username: job_waring
19
     username: job_waring
21
     password: job_waring@ABCD1234
20
     password: job_waring@ABCD1234
22
     driver-class-name: oracle.jdbc.OracleDriver
21
     driver-class-name: oracle.jdbc.OracleDriver
49
 ###
48
 ###
50
 yz:
49
 yz:
51
   appid: job_warning
50
   appid: job_warning
52
-  warningTmp: 工号:, 名字:, 超过轮岗截止日期, 请及时处理
53
-  promptTmp: 工号:, 名字:, 即将轮岗, 请及时处理
54
-  holidayTmp: 工号:, 名字:, 还未休假, 请及时处理
51
+  warningTmp: 工号:code, 名字:name, 超过轮岗截止日期, 请及时处理
52
+  promptTmp: 工号:code, 名字:name, 即将轮岗, 请及时处理
53
+  holidayTmp: 工号:code, 名字:name, 还未休假, 请及时处理
54
+  job:
55
+    task1: 0 0 8 * * *
56
+    task2: 0 30 8 20 12 *
55
   upload:
57
   upload:
56
     path: E:\work\public-upload
58
     path: E:\work\public-upload
57
   sso:
59
   sso: