|
@@ -61,111 +61,6 @@ public class SampleXxlJob {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 1、简单任务示例(Bean模式)
|
|
|
- */
|
|
|
- @XxlJob("projectArchiveTask")
|
|
|
- public void projectArchiveTask() throws Exception {
|
|
|
- System.out.println("进来了---");
|
|
|
- String json = SpringUtil.getBean ( AssessFeignApi.class ).getOverdueFilingProjectList();
|
|
|
- List<ProgramProjectListInfo> projectList = JSON.parseObject(json, new TypeReference<List<ProgramProjectListInfo>>() {});
|
|
|
-
|
|
|
-// List<ProgramProjectListInfo> projectList = pgProjectListService.getOverdueFilingProjectList();
|
|
|
- //遍历查询的项目,对所有项目的归档状态进行调整。添加超期归档状态值(over_archive_status:0:未超期;1:已超期),归档状态,若是0或者空值则调整为6。若为其他值则不进行调整
|
|
|
- for (ProgramProjectListInfo info : projectList) {
|
|
|
- //判定是否以发起归档申请(即归档状态是否为空或者0)
|
|
|
- String archiveStatus = "";
|
|
|
- if(StringUtils.isBlank(info.getArchiveStatus()) || "0".equals(info.getArchiveStatus())){
|
|
|
- archiveStatus = "6";
|
|
|
- }else{
|
|
|
- archiveStatus = info.getArchiveStatus();
|
|
|
- }
|
|
|
- //修改报告归档 归档状态信息
|
|
|
- SpringUtil.getBean ( IAssessApi.class ).updateArchiveStatus(info.getArchiveId(),archiveStatus,"1");
|
|
|
- //对数据进行发送通知
|
|
|
- String taskName = null;
|
|
|
- String titleStr = null;
|
|
|
-
|
|
|
- //如果当前时间大于过期时间
|
|
|
- //Date类的一个方法,如果info.getAdventDateDate()早于 new Date() 返回true,否则返回false
|
|
|
- if(info.getAgreeTime().before(new Date())){
|
|
|
- taskName = "评估-超期归档";
|
|
|
- titleStr = "项目【"+ info.getName()+"】归档已超期。超期时间:"+dateToString(info.getAgreeTime()) +"。";
|
|
|
- }else{
|
|
|
- taskName = "评估-超期归档";
|
|
|
- titleStr = "项目【"+ info.getName()+"】即将归档超期。超期时间:"+dateToString(info.getAgreeTime());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //计算两日期之间的天数
|
|
|
- int interval = Integer.parseInt(this.getInterval(info.getAgreeTime(), new Date()));
|
|
|
- if(interval > 0){
|
|
|
- titleStr = titleStr + "已超期:" + interval + "天。请尽快归还";
|
|
|
- }
|
|
|
-
|
|
|
- Set<String> noticeUserSet = new HashSet<String>();
|
|
|
- if(StringUtils.isNotBlank(info.getCreateBy())){
|
|
|
-
|
|
|
- String byIdForXXL = SpringUtil.getBean(IUserApi.class).getByIdForXXL(info.getCreateBy());
|
|
|
- UserDTO createUser = JSON.parseObject(byIdForXXL, new TypeReference<UserDTO>() {});
|
|
|
-// UserDTO createUser = SpringUtil.getBean ( IUserApi.class ).getById(info.getCreateBy());
|
|
|
- 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(info.getProcInsId());
|
|
|
- myNotice.setTaskId(currentTask);
|
|
|
- myNotice.setDefId(info.getProcessDefinitionId());
|
|
|
- myNotice.setTitle(titleStr);
|
|
|
- myNotice.setTaskName(taskName);
|
|
|
- myNotice.setLink("结束");
|
|
|
- myNotice.setType("0");
|
|
|
- myNotice.setCreateUser("管理员");
|
|
|
- myNotice.setCreateTime(new Date());
|
|
|
-
|
|
|
- for (String noticeUserId : noticeUserList) {
|
|
|
- myNotice.setNoticeId(noticeUserId);
|
|
|
- String byIdForXXL = SpringUtil.getBean(IUserApi.class).getByIdForXXL(info.getCreateBy());
|
|
|
- UserDTO createUser = JSON.parseObject(byIdForXXL, new TypeReference<UserDTO>() {});
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 嘉溢项目校审发送通知
|
|
|
*/
|
|
|
@XxlJob("projectAuditTask")
|