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

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

@@ -18,6 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
18 18
 import org.springframework.validation.annotation.Validated;
19 19
 import org.springframework.web.bind.annotation.*;
20 20
 
21
+import java.time.LocalDate;
22
+import java.time.format.DateTimeFormatter;
23
+
21 24
 /**
22 25
  * 强制休假表;(ta_mandatory_leave)表控制层
23 26
  *
@@ -77,12 +80,25 @@ public class TaMandatoryLeaveController extends BaseController {
77 80
                          @ApiParam("对应重要岗位") @RequestParam(value = "counterImpPost", required = false) String counterImpPost,
78 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 87
                          @ApiParam("正序排列") @RequestParam(value = "sortAsc", defaultValue = "create_date") String sortAsc,
81 88
                          @ApiParam("倒序排列") @RequestParam(value = "sortDesc", required = false) String sortDesc
82 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 97
         IPage<TaMandatoryLeave> pg = new Page<>(pageNum, pageSize);
85 98
         QueryWrapper<TaMandatoryLeave> queryWrapper = new QueryWrapper<>();
99
+
100
+        queryWrapper.between(startDate != null, "start_time_vacation", startDate, endDate);
101
+
86 102
         queryWrapper.eq(StringUtil.isNotEmpty(checkAuth()), "CREATE_USER", checkAuth());
87 103
         queryWrapper.like(StringUtil.isNotEmpty(headOfficeOrg), "head_office_org", headOfficeOrg);
88 104
         queryWrapper.eq(StringUtil.isNotEmpty(employeeNum), "employee_num", employeeNum);

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

@@ -4,10 +4,8 @@ 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;
8 7
 import com.lyg.application.entity.TaRotation;
9 8
 import com.lyg.application.service.TaRotationService;
10
-import com.lyg.application.util.CreateResponse;
11 9
 import com.lyg.application.util.Rule;
12 10
 import com.lyg.common.util.StringUtil;
13 11
 import com.lyg.framework.accesslimit.AccessLimit;
@@ -21,8 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
21 19
 import org.springframework.validation.annotation.Validated;
22 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 26
  * 轮岗列表;(ta_rotation)表控制层
@@ -87,15 +85,36 @@ public class TaRotationController extends BaseController {
87 85
                          @ApiParam("对应机构层次") @RequestParam(value = "counterInstitutionsLevel", required = false) String counterInstitutionsLevel,
88 86
                          @ApiParam("对应重要岗位") @RequestParam(value = "counterImpPositions", required = false) String counterImpPositions,
89 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 94
                          @ApiParam("正序排列") @RequestParam(value = "sortAsc", defaultValue = "create_date") String sortAsc,
93 95
                          @ApiParam("倒序排列") @RequestParam(value = "sortDesc", required = false) String sortDesc
94 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 111
         IPage<TaRotation> pg = new Page<>(pageNum, pageSize);
97 112
         QueryWrapper<TaRotation> queryWrapper = new QueryWrapper<>();
98 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 118
         queryWrapper.like(StringUtil.isNotEmpty(headOfficeOrg), "head_office_org", headOfficeOrg);
100 119
         queryWrapper.eq(StringUtil.isNotEmpty(employeeNum), "employee_num", employeeNum);
101 120
         queryWrapper.like(StringUtil.isNotEmpty(employeeName), "employee_name", employeeName);

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

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

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

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

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

@@ -29,11 +29,11 @@ import java.util.function.Function;
29 29
  */
30 30
 @Service
31 31
 public class TaMandatoryLeaveServiceImpl extends BaseServiceImpl<TaMandatoryLeaveMapper, TaMandatoryLeave> implements TaMandatoryLeaveService {
32
-    private final List<String> errorMessages = new ArrayList<>();
33
-
34 32
     private static final String MESSAGE_SOURCE_NAME = "taMandatoryLeave";
35 33
     private static final String PROMPT_TYPE = "prompt";
36
-
34
+    private final List<String> errorMessages = new ArrayList<>();
35
+    
36
+    @Autowired
37 37
     @Value("${yz.holidayTmp}")
38 38
     String holidayTmp;
39 39
 
@@ -122,8 +122,8 @@ public class TaMandatoryLeaveServiceImpl extends BaseServiceImpl<TaMandatoryLeav
122 122
 
123 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 128
 //        if (promptList.size() != 0) {
129 129
 //            for (TaMandatoryLeave item : promptList) {

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

@@ -67,7 +67,7 @@ public class MessageHandle {
67 67
      * @param messageType 消息类型
68 68
      */
69 69
     private void processItem(TaRotation item, String tmp, String messageType, String sourceName) {
70
-        StringBuilder stringBuilder = new StringBuilder();
70
+        String newTmp = null;
71 71
         TaMessage taMessage = new TaMessage();
72 72
         Map<String, String> params = new HashMap<>();
73 73
 
@@ -76,17 +76,19 @@ public class MessageHandle {
76 76
         taMessage.setMessageId(uuid);
77 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 87
         taMessage.setSourceName(sourceName);
86 88
         taMessage.setWaringType(messageType);
87 89
         params.put("sourceName", sourceName);
88 90
         params.put("waringType", messageType);
89
-        params.put("contentSent", stringBuilder.toString());
91
+        params.put("contentSent", newTmp);
90 92
         Long count = taMessageService.countBy("source_id", item.getRotationId(), true);
91 93
         if (count == 0) {
92 94
             taMessageMapper.insert(taMessage);
@@ -109,7 +111,6 @@ public class MessageHandle {
109 111
     }
110 112
 
111 113
     private void processItemLeaves(TaMandatoryLeave item, String tmp, String messageType, String sourceName) {
112
-        StringBuilder stringBuilder = new StringBuilder();
113 114
         TaMessage taMessage = new TaMessage();
114 115
         Map<String, String> params = new HashMap<>();
115 116
 
@@ -117,17 +118,22 @@ public class MessageHandle {
117 118
         taMessage.setMessageId(uuid);
118 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 132
         taMessage.setSourceName(sourceName);
127 133
         taMessage.setWaringType(messageType);
128 134
         params.put("sourceName", "taMandatoryLeave");
129 135
         params.put("waringType", "prompt");
130
-        params.put("contentSent", stringBuilder.toString());
136
+        params.put("contentSent", newTmp);
131 137
         Long count = taMessageService.countBy("source_id", item.getLeaveId(), true);
132 138
         if (count == 0) {
133 139
             taMessageMapper.insert(taMessage);

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

@@ -1,4 +1,3 @@
1
-
2 1
 # 端口
3 2
 server:
4 3
   port: 8001
@@ -16,7 +15,7 @@ spring:
16 15
     date-format: yyyy-MM-dd HH:mm:ss
17 16
     time-zone: GMT+8
18 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 19
     username: job_waring
21 20
     password: job_waring@ABCD1234
22 21
     driver-class-name: oracle.jdbc.OracleDriver
@@ -49,9 +48,12 @@ spring:
49 48
 ###
50 49
 yz:
51 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 57
   upload:
56 58
     path: E:\work\public-upload
57 59
   sso: