|
@@ -199,76 +199,139 @@ public class SampleXxlJob {
|
|
|
String taskName = null;
|
|
|
String titleStr = null;
|
|
|
//如果还剩三天则发送通知
|
|
|
- if (interval1<=3 && interval1 >=0){
|
|
|
+ if (interval1<=5 && interval1 >=0){
|
|
|
taskName="月报还未提交";
|
|
|
titleStr="距离月报提交截至日期还剩"+interval1+"天,请尽快提交";
|
|
|
//获得月报中的数据
|
|
|
String list = SpringUtil.getBean(MonthlyApi.class).getList();
|
|
|
List<MonthlyDTO> monthlyDTOS = JSON.parseObject(list, new TypeReference<List<MonthlyDTO>>() {});
|
|
|
- for (MonthlyDTO monthlyDTO : monthlyDTOS) {
|
|
|
- //遍历嘉溢公司的所有人员
|
|
|
- for (UserDTO userDTO : dtoList) {
|
|
|
- if (!monthlyDTO.getCreateById().equals(userDTO.getId())){
|
|
|
- Set<String> noticeUserSet = new HashSet<String>();
|
|
|
-
|
|
|
- String byIdForXXL = SpringUtil.getBean(IUserApi.class).getByIdForXXL(userDTO.getId());
|
|
|
- UserDTO createUser = JSON.parseObject(byIdForXXL, new TypeReference<UserDTO>() {});
|
|
|
- if(null != createUser && StringUtils.isNotBlank(createUser.getId())){
|
|
|
- noticeUserSet.add(createUser.getId());
|
|
|
- }
|
|
|
+ //遍历嘉溢公司的所有人员
|
|
|
+ for (UserDTO userDTO : dtoList) {
|
|
|
+ if (CollectionUtil.isNotEmpty(monthlyDTOS)){
|
|
|
+ for (MonthlyDTO monthlyDTO : monthlyDTOS) {
|
|
|
+ if (!monthlyDTO.getCreateById().equals(userDTO.getId())){
|
|
|
+ Set<String> noticeUserSet = new HashSet<String>();
|
|
|
|
|
|
- List<String> noticeUserList = new ArrayList<String>(noticeUserSet);
|
|
|
- if(noticeUserList.size()>0) {
|
|
|
- MyNoticeList myNotice = new MyNoticeList();
|
|
|
- myNotice.setCreateById("1");
|
|
|
- myNotice.setCreateTime(new Date());
|
|
|
- myNotice.setUpdateById("1");
|
|
|
- myNotice.setUpdateTime(new Date());
|
|
|
- myNotice.setDelFlag(0);
|
|
|
- //根据procInsId获取taskId
|
|
|
-// String currentTask = SpringUtil.getBean(IFlowableApi.class).getTaskIdByprocInstId(jyAudit.getProjectProId());
|
|
|
- myNotice.setTaskId("");
|
|
|
- myNotice.setDefId("");
|
|
|
- myNotice.setTitle(titleStr);
|
|
|
- myNotice.setTaskName(taskName);
|
|
|
- myNotice.setLink("结束");
|
|
|
- myNotice.setType("0");
|
|
|
- myNotice.setCreateUser("管理员");
|
|
|
- myNotice.setCreateTime(new Date());
|
|
|
-
|
|
|
- for (String noticeUserId : noticeUserList) {
|
|
|
- myNotice.setNoticeId(noticeUserId);
|
|
|
- myNotice.setNoticeName(createUser.getName());
|
|
|
- //根据taskName和通知人 查询重复数量
|
|
|
- String myNoticeInfo = JSON.toJSONString(myNotice);
|
|
|
- Map<String, String> map = new HashMap();
|
|
|
- map.put("myNoticeInfo", myNoticeInfo);
|
|
|
- String jsonInfo = SpringUtil.getBean(IFlowableApi.class).getRepetitionCountBymyNoticeTitle(map);
|
|
|
- MyNoticeList repetitionCountBymyNotice = JSON.parseObject(jsonInfo, new TypeReference<MyNoticeList>() {
|
|
|
- });
|
|
|
+ String byIdForXXL = SpringUtil.getBean(IUserApi.class).getByIdForXXL(userDTO.getId());
|
|
|
+ UserDTO createUser = JSON.parseObject(byIdForXXL, new TypeReference<UserDTO>() {});
|
|
|
+ if(null != createUser && StringUtils.isNotBlank(createUser.getId())){
|
|
|
+ noticeUserSet.add(createUser.getId());
|
|
|
+ }
|
|
|
|
|
|
- if (null == repetitionCountBymyNotice) {
|
|
|
- // 生成id
|
|
|
- String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
- myNotice.setId(id);
|
|
|
- myNotice.setRepetitionCount(0);
|
|
|
+ List<String> noticeUserList = new ArrayList<String>(noticeUserSet);
|
|
|
+ if(noticeUserList.size()>0) {
|
|
|
+ MyNoticeList myNotice = new MyNoticeList();
|
|
|
+ myNotice.setCreateById("1");
|
|
|
+ myNotice.setCreateTime(new Date());
|
|
|
+ myNotice.setUpdateById("1");
|
|
|
+ myNotice.setUpdateTime(new Date());
|
|
|
+ myNotice.setDelFlag(0);
|
|
|
+ //根据procInsId获取taskId
|
|
|
+// String currentTask = SpringUtil.getBean(IFlowableApi.class).getTaskIdByprocInstId(jyAudit.getProjectProId());
|
|
|
+ myNotice.setTaskId("");
|
|
|
+ myNotice.setDefId("");
|
|
|
+ myNotice.setTitle(titleStr);
|
|
|
+ myNotice.setTaskName(taskName);
|
|
|
+ myNotice.setLink("结束");
|
|
|
+ myNotice.setType("0");
|
|
|
+ myNotice.setCreateUser("管理员");
|
|
|
+ myNotice.setCreateTime(new Date());
|
|
|
|
|
|
- myNoticeInfo = JSON.toJSONString(myNotice);
|
|
|
+ for (String noticeUserId : noticeUserList) {
|
|
|
+ myNotice.setNoticeId(noticeUserId);
|
|
|
+ myNotice.setNoticeName(createUser.getName());
|
|
|
+ //根据taskName和通知人 查询重复数量
|
|
|
+ String myNoticeInfo = JSON.toJSONString(myNotice);
|
|
|
+ Map<String, String> map = new HashMap();
|
|
|
map.put("myNoticeInfo", myNoticeInfo);
|
|
|
- SpringUtil.getBean(IFlowableApi.class).insertMyNotice(map);
|
|
|
- } else {
|
|
|
- myNotice.setId(repetitionCountBymyNotice.getId());
|
|
|
- myNotice.setRepetitionCount(repetitionCountBymyNotice.getRepetitionCount() + 1);
|
|
|
+ String jsonInfo = SpringUtil.getBean(IFlowableApi.class).getRepetitionCountBymyNoticeTitle(map);
|
|
|
+ MyNoticeList repetitionCountBymyNotice = JSON.parseObject(jsonInfo, new TypeReference<MyNoticeList>() {
|
|
|
+ });
|
|
|
|
|
|
- myNoticeInfo = JSON.toJSONString(myNotice);
|
|
|
- map.put("myNoticeInfo", myNoticeInfo);
|
|
|
- SpringUtil.getBean(IFlowableApi.class).updateMyNotice(map);
|
|
|
+ if (null == repetitionCountBymyNotice) {
|
|
|
+ // 生成id
|
|
|
+ String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ myNotice.setId(id);
|
|
|
+ myNotice.setRepetitionCount(0);
|
|
|
+
|
|
|
+ myNoticeInfo = JSON.toJSONString(myNotice);
|
|
|
+ map.put("myNoticeInfo", myNoticeInfo);
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).insertMyNotice(map);
|
|
|
+ } else {
|
|
|
+ myNotice.setId(repetitionCountBymyNotice.getId());
|
|
|
+ myNotice.setRepetitionCount(repetitionCountBymyNotice.getRepetitionCount() + 1);
|
|
|
+
|
|
|
+ myNoticeInfo = JSON.toJSONString(myNotice);
|
|
|
+ map.put("myNoticeInfo", myNoticeInfo);
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).updateMyNotice(map);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }else {
|
|
|
+ Set<String> noticeUserSet = new HashSet<String>();
|
|
|
+
|
|
|
+ String byIdForXXL = SpringUtil.getBean(IUserApi.class).getByIdForXXL(userDTO.getId());
|
|
|
+ UserDTO createUser = JSON.parseObject(byIdForXXL, new TypeReference<UserDTO>() {});
|
|
|
+ if(null != createUser && StringUtils.isNotBlank(createUser.getId())){
|
|
|
+ noticeUserSet.add(createUser.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> noticeUserList = new ArrayList<String>(noticeUserSet);
|
|
|
+ if(noticeUserList.size()>0) {
|
|
|
+ MyNoticeList myNotice = new MyNoticeList();
|
|
|
+ myNotice.setCreateById("1");
|
|
|
+ myNotice.setCreateTime(new Date());
|
|
|
+ myNotice.setUpdateById("1");
|
|
|
+ myNotice.setUpdateTime(new Date());
|
|
|
+ myNotice.setDelFlag(0);
|
|
|
+ //根据procInsId获取taskId
|
|
|
+// String currentTask = SpringUtil.getBean(IFlowableApi.class).getTaskIdByprocInstId(jyAudit.getProjectProId());
|
|
|
+ myNotice.setTaskId("");
|
|
|
+ myNotice.setDefId("");
|
|
|
+ myNotice.setTitle(titleStr);
|
|
|
+ myNotice.setTaskName(taskName);
|
|
|
+ myNotice.setLink("结束");
|
|
|
+ myNotice.setType("0");
|
|
|
+ myNotice.setCreateUser("管理员");
|
|
|
+ myNotice.setCreateTime(new Date());
|
|
|
+
|
|
|
+ for (String noticeUserId : noticeUserList) {
|
|
|
+ myNotice.setNoticeId(noticeUserId);
|
|
|
+ myNotice.setNoticeName(createUser.getName());
|
|
|
+ //根据taskName和通知人 查询重复数量
|
|
|
+ String myNoticeInfo = JSON.toJSONString(myNotice);
|
|
|
+ Map<String, String> map = new HashMap();
|
|
|
+ map.put("myNoticeInfo", myNoticeInfo);
|
|
|
+ String jsonInfo = SpringUtil.getBean(IFlowableApi.class).getRepetitionCountBymyNoticeTitle(map);
|
|
|
+ MyNoticeList repetitionCountBymyNotice = JSON.parseObject(jsonInfo, new TypeReference<MyNoticeList>() {
|
|
|
+ });
|
|
|
+
|
|
|
+ if (null == repetitionCountBymyNotice) {
|
|
|
+ // 生成id
|
|
|
+ String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ myNotice.setId(id);
|
|
|
+ myNotice.setRepetitionCount(0);
|
|
|
+
|
|
|
+ myNoticeInfo = JSON.toJSONString(myNotice);
|
|
|
+ map.put("myNoticeInfo", myNoticeInfo);
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).insertMyNotice(map);
|
|
|
+ } else {
|
|
|
+ myNotice.setId(repetitionCountBymyNotice.getId());
|
|
|
+ myNotice.setRepetitionCount(repetitionCountBymyNotice.getRepetitionCount() + 1);
|
|
|
+
|
|
|
+ myNoticeInfo = JSON.toJSONString(myNotice);
|
|
|
+ map.put("myNoticeInfo", myNoticeInfo);
|
|
|
+ SpringUtil.getBean(IFlowableApi.class).updateMyNotice(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|