shengyang000 3 år sedan
förälder
incheckning
81f5d05915

+ 11 - 1
src/main/java/com/unissoft/job/ToBeDoneJob.java

@@ -11,6 +11,7 @@ import com.unissoft.service.QuartzService;
11 11
 import com.unissoft.service.SysMessageService;
12 12
 import com.unissoft.utils.DateUtil;
13 13
 import com.unissoft.vo.WarnScheduleVO;
14
+import org.apache.commons.lang3.StringUtils;
14 15
 import org.apache.commons.lang3.time.DateUtils;
15 16
 import org.quartz.*;
16 17
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,6 +52,7 @@ public class ToBeDoneJob implements Job, Serializable {
51 52
         String usersInfo = dataMap.getString("usersInfo");
52 53
         String timePeriod = dataMap.getString("timePeriod");
53 54
         String aheadTime = dataMap.getString("aheadTime");//预警时间
55
+        Integer levelDepotHouse = dataMap.getInt("levelDepotHouse");
54 56
         String toPage = dataMap.getString("toPage");
55 57
         String type = dataMap.getString("type");
56 58
         //
@@ -61,6 +63,7 @@ public class ToBeDoneJob implements Job, Serializable {
61 63
         done.setStartDate(startDate);
62 64
         Date endDate = getEndDate(startDate, timePeriod);
63 65
         done.setEndDate(endDate);
66
+        done.setLevelDepotHouse(levelDepotHouse);
64 67
         done.setToPage(toPage);
65 68
         done.setType(type);
66 69
         //生成待办数据
@@ -72,7 +75,14 @@ public class ToBeDoneJob implements Job, Serializable {
72 75
             for(ToBeDoneCallbackVO vo : toBeDoneCallbackList) {
73 76
                 MessageVO messageVO = new MessageVO();
74 77
                 messageVO.setTitle(title);
75
-                String content = vo.getDepotName() + "-" + vo.getHouseName() + "-" + "待处理";
78
+                StringBuilder stringBuilder = new StringBuilder();
79
+                stringBuilder.append(vo.getDepotName()).append("-");
80
+                if(StringUtils.isNotBlank(vo.getHouseName())) {
81
+                    stringBuilder.append(vo.getHouseName()).append("-");
82
+                }
83
+                stringBuilder.append("待处理");
84
+
85
+                String content = stringBuilder.toString();
76 86
                 messageVO.setContent(content);
77 87
                 //
78 88
                 messageVO.setFromUserId(-1);//-1 代表系统推送

+ 10 - 1
src/main/java/com/unissoft/job/ToBeDoneNoticeWarnJob.java

@@ -68,7 +68,16 @@ public class ToBeDoneNoticeWarnJob implements Job, Serializable {
68 68
                 sysNoticeVO.setNoticeType(NoticeTypeEnum.WARN.getCode());
69 69
                 sysNoticeVO.setNoticeTime(new Date());
70 70
                 sysNoticeVO.setTitle(title);
71
-                String content = warnNotice.getDepotName() + "-" + warnNotice.getHouseName() + "-" + "即将逾期";
71
+
72
+
73
+                StringBuilder stringBuilder = new StringBuilder();
74
+                stringBuilder.append(warnNotice.getDepotName()).append("-");
75
+                if(StringUtils.isNotBlank(warnNotice.getHouseName())) {
76
+                    stringBuilder.append(warnNotice.getHouseName()).append("-");
77
+                }
78
+                stringBuilder.append("即将逾期");
79
+
80
+                String content = stringBuilder.toString();
72 81
                 sysNoticeVO.setContent(content);
73 82
                 sysNoticeVO.setWarehouse(warnNotice.getHouseName());
74 83
                 sysNoticeVO.setOrgName(warnNotice.getDepotName());

+ 2 - 1
src/main/java/com/unissoft/mapper/SysEarlyWarningMapper.xml

@@ -13,6 +13,7 @@
13 13
         <result column="warn_target" property="warnTarget" />
14 14
         <result column="warn_target_names" property="warnTargetNames" />
15 15
         <result column="warn_status" property="warnStatus" />
16
+        <result column="level_depot_house" property="levelDepotHouse" />
16 17
         <result column="to_page" property="toPage" />
17 18
         <result column="create_by" property="createBy" />
18 19
         <result column="create_time" property="createTime" />
@@ -24,7 +25,7 @@
24 25
 
25 26
     <!-- 通用查询结果列 -->
26 27
     <sql id="Base_Column_List">
27
-        id, warn_name, warn_code, inspect_cycle, warning_time, warn_target_type, warn_target, warn_target_names, warn_status, to_page, create_by, create_time, update_by, update_time, delete_by, delete_time
28
+        id, warn_name, warn_code, inspect_cycle, warning_time, warn_target_type, warn_target, warn_target_names, warn_status, level_depot_house, to_page, create_by, create_time, update_by, update_time, delete_by, delete_time
28 29
     </sql>
29 30
 
30 31
 </mapper>

+ 4 - 0
src/main/java/com/unissoft/model/SysEarlyWarning.java

@@ -57,6 +57,10 @@ public class SysEarlyWarning extends BaseModel implements Serializable {
57 57
     @TableField("warn_status")
58 58
     private Boolean warnStatus;
59 59
 
60
+    @ApiModelProperty(value = "按库或仓房为单位进行预警:1库,2仓房")
61
+    @TableField("level_depot_house")
62
+    private Integer levelDepotHouse;
63
+
60 64
     @ApiModelProperty(value = "跳转页面")
61 65
     @TableField("to_page")
62 66
     private String toPage;

+ 2 - 1
src/main/java/com/unissoft/service/impl/SysEarlyWarningServiceImpl.java

@@ -21,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
21 21
 import org.springframework.stereotype.Service;
22 22
 import org.springframework.transaction.annotation.Transactional;
23 23
 
24
-import java.text.SimpleDateFormat;
25 24
 import java.util.Date;
26 25
 
27 26
 import static org.quartz.CalendarIntervalScheduleBuilder.calendarIntervalSchedule;
@@ -285,12 +284,14 @@ public class SysEarlyWarningServiceImpl extends ServiceImpl<SysEarlyWarningMappe
285 284
         String usersInfo = earlyWarning.getWarnTarget();                //通知对象(用户ID|用户姓名)
286 285
         String timePeriod = earlyWarning.getInspectCycle();             //检查周期:每2周、每个月等
287 286
         String aheadTime = earlyWarning.getWarningTime();               //预警时间:提前几个小时或几天
287
+        Integer levelDepotHouse = earlyWarning.getLevelDepotHouse();    //按库或仓房为单位进行预警:1库,2仓房
288 288
 
289 289
         JobDetail toBeDoneJob = JobBuilder.newJob(ToBeDoneJob.class).withIdentity(jobName, GROUP).withDescription(title).build();
290 290
         toBeDoneJob.getJobDataMap().put("title", title);
291 291
         toBeDoneJob.getJobDataMap().put("usersInfo", usersInfo);
292 292
         toBeDoneJob.getJobDataMap().put("timePeriod", timePeriod);//检查周期
293 293
         toBeDoneJob.getJobDataMap().put("aheadTime", aheadTime);//预警时间
294
+        toBeDoneJob.getJobDataMap().put("levelDepotHouse", levelDepotHouse);
294 295
         toBeDoneJob.getJobDataMap().put("toPage", earlyWarning.getToPage());
295 296
         toBeDoneJob.getJobDataMap().put("type", earlyWarning.getWarnCode());//类型 用 预警Code
296 297
 

+ 8 - 6
src/main/java/com/unissoft/service/impl/SysPolicySystemServiceImpl.java

@@ -141,9 +141,12 @@ public class SysPolicySystemServiceImpl extends ServiceImpl<SysPolicySystemMappe
141 141
         //
142 142
         save(model);
143 143
 
144
+        Map<Integer, String> users = getNoticeUserInfo(null, "10", null);//接收对象:recvType=10 全员
145
+        saveSysPolicySystemUsers(model.getId(), users);
146
+
144 147
         //如果需要通知
145 148
         if(model.getIsNotice()) {
146
-            saveSysPolicySystemUsersAndSendMessage(model, userPO);
149
+            sendMessage4PolicySystemUsers(model, userPO, users);
147 150
         }
148 151
 
149 152
         return true;
@@ -165,9 +168,10 @@ public class SysPolicySystemServiceImpl extends ServiceImpl<SysPolicySystemMappe
165 168
         //
166 169
         updateById(model);
167 170
 
171
+        Map<Integer, String> users = getNoticeUserInfo(null, "10", null);//接收对象:recvType=10 全员
168 172
         //如果需要通知
169 173
         if(model.getIsNotice()) {
170
-            saveSysPolicySystemUsersAndSendMessage(model, userPO);
174
+            sendMessage4PolicySystemUsers(model, userPO, users);
171 175
         }
172 176
 
173 177
         return true;
@@ -197,16 +201,14 @@ public class SysPolicySystemServiceImpl extends ServiceImpl<SysPolicySystemMappe
197 201
         return users;
198 202
     }
199 203
 
204
+
200 205
     /**
201 206
      *
202 207
      * @param model
203 208
      * @param userPO
204 209
      */
205
-    private void saveSysPolicySystemUsersAndSendMessage(SysPolicySystem model, SysUserPO userPO) {
206
-        Map<Integer, String> users = getNoticeUserInfo(null, "10", null);//接收对象:recvType=10 全员
210
+    private void sendMessage4PolicySystemUsers(SysPolicySystem model, SysUserPO userPO, Map<Integer, String> users) {
207 211
         if(null != users && users.isEmpty() == false) {
208
-            saveSysPolicySystemUsers(model.getId(), users);
209
-
210 212
             SendNoticeVO sendNoticeVO = new SendNoticeVO();
211 213
             sendNoticeVO.setUsers(users);
212 214