Commit ac1957cf by hzc

消息信息添加任务id和类别(完成驳回时生产消息)

parent 6a533192
...@@ -32,6 +32,8 @@ public class NoticeInfoCtrl { ...@@ -32,6 +32,8 @@ public class NoticeInfoCtrl {
@ApiParam("每页条数") @RequestParam("pageSize") int pageSize) { @ApiParam("每页条数") @RequestParam("pageSize") int pageSize) {
PageRequest request = PageRequest.of(pageNo, pageSize); PageRequest request = PageRequest.of(pageNo, pageSize);
List<NoticeInfo> list = new ArrayList<>(); List<NoticeInfo> list = new ArrayList<>();
String currentUserId = SystemUserUtil.getCurrentUserId();
System.out.println(currentUserId);
long total = noticeInfoService.findByPageCount(keyword, null, SystemUserUtil.getCurrentUserId()); long total = noticeInfoService.findByPageCount(keyword, null, SystemUserUtil.getCurrentUserId());
if (total > 0) { if (total > 0) {
list = noticeInfoService.findByPage(keyword, null, SystemUserUtil.getCurrentUserId(), request.getOffset(), pageSize); list = noticeInfoService.findByPage(keyword, null, SystemUserUtil.getCurrentUserId(), request.getOffset(), pageSize);
...@@ -68,4 +70,18 @@ public class NoticeInfoCtrl { ...@@ -68,4 +70,18 @@ public class NoticeInfoCtrl {
} }
return Result.genOkResult(); return Result.genOkResult();
} }
@ApiOperation("创建消息")
@PostMapping("createNotice")
public Result createNotice(@RequestBody NoticeInfo noticeInfo){
noticeInfoService.insertNotice(noticeInfo);
return Result.genOkResult();
}
@ApiOperation("批量创建消息(异步)")
@PostMapping("batchCreateNotice")
public Result batchCreateNotice(@RequestBody List<NoticeInfo> noticeInfos){
noticeInfoService.createNotices(noticeInfos);
return Result.genOkResult();
}
} }
...@@ -107,6 +107,15 @@ public class Constants { ...@@ -107,6 +107,15 @@ public class Constants {
/** /**
* 消息类别-数据填报
*/
public static final int NOTICEINFO_DATA_ENTER=1;
/**
* 消息类别-数据审核
*/
public static final int NOTICEINFO_DATA_AUDIT=2;
/**
* 数据项数据来源- excel填报-1 * 数据项数据来源- excel填报-1
*/ */
public static final int INPUT_EXCEL = 1; public static final int INPUT_EXCEL = 1;
......
...@@ -27,4 +27,14 @@ public class NoticeInfo extends BaseModel { ...@@ -27,4 +27,14 @@ public class NoticeInfo extends BaseModel {
@ApiModelProperty("通知标题") @ApiModelProperty("通知标题")
private String toUserId; private String toUserId;
@ApiModelProperty("任务id")
private String taskId;
@ApiModelProperty("消息类别 1)数据填报2)数据审核")
private Integer noticeClass;
@ApiModelProperty("跳转路径")
private String url;
} }
...@@ -327,7 +327,12 @@ public class TaskServiceImpl implements TaskService { ...@@ -327,7 +327,12 @@ public class TaskServiceImpl implements TaskService {
noticeInfo.setState(Constants.DATA_STATE_A); noticeInfo.setState(Constants.DATA_STATE_A);
noticeInfo.setUpdater(user); noticeInfo.setUpdater(user);
noticeInfo.setUpdateTime(now); noticeInfo.setUpdateTime(now);
//跳转到审核
noticeInfo.setTaskId(taskId);
noticeInfo.setNoticeClass(Constants.NOTICEINFO_DATA_AUDIT);
noticeInfos.add(noticeInfo); noticeInfos.add(noticeInfo);
} }
} }
if (found) { if (found) {
...@@ -398,6 +403,34 @@ public class TaskServiceImpl implements TaskService { ...@@ -398,6 +403,34 @@ public class TaskServiceImpl implements TaskService {
taskAuditRecordMapper.insert(auditRecord); taskAuditRecordMapper.insert(auditRecord);
LogManager.logInfo(Constants.LOG_CONTEXT_API, "{} {}任务:{}Id:{},ruleId:{}, ruleLevel:{}", LogManager.logInfo(Constants.LOG_CONTEXT_API, "{} {}任务:{}Id:{},ruleId:{}, ruleLevel:{}",
auditUser, recordType, task.getRuleName(), task.getId(), task.getRuleId(), task.getRuleLevel()); auditUser, recordType, task.getRuleName(), task.getId(), task.getRuleId(), task.getRuleLevel());
if(status==Constants.APPLY_STATE_DRAFT){
String user = SystemUserUtil.getCurrentUser();
String enterUserStr = task.getEnterUsers();
if(StringUtils.isNotBlank(enterUserStr)){
List<NoticeInfo> noticeInfos = new ArrayList<>();
String[] enterUsers = enterUserStr.split(Constants.SEP_COMMA);
//enterUserStr = ,42, 所以要忽略数组前后值
for(int i=1;i<enterUsers.length-1;i++){
NoticeInfo noticeInfo = new NoticeInfo();
noticeInfo.setTaskId(task.getId());
noticeInfo.setNoticeClass(Constants.NOTICEINFO_DATA_ENTER);
noticeInfo.setCreateTime(now);
noticeInfo.setCreator(user);
noticeInfo.setDetail(task.getRuleName() + "-任务已经被"+auditUser+"驳回");
noticeInfo.setTitle("你有被驳回的任务:" + task.getRuleName() );
noticeInfo.setToUserId(enterUsers[i]);
noticeInfo.setIsRead(false);
noticeInfo.setState(Constants.DATA_STATE_A);
noticeInfo.setUpdater(user);
noticeInfo.setUpdateTime(now);
noticeInfos.add(noticeInfo);
}
noticeInfoService.createNotices(noticeInfos);
}
}
} }
/** /**
...@@ -729,6 +762,12 @@ public class TaskServiceImpl implements TaskService { ...@@ -729,6 +762,12 @@ public class TaskServiceImpl implements TaskService {
noticeInfo.setState(Constants.DATA_STATE_A); noticeInfo.setState(Constants.DATA_STATE_A);
noticeInfo.setUpdater(user); noticeInfo.setUpdater(user);
noticeInfo.setUpdateTime(now); noticeInfo.setUpdateTime(now);
//提供跳转到填报路径
noticeInfo.setTaskId(task.getId());
noticeInfo.setNoticeClass(Constants.NOTICEINFO_DATA_ENTER);
noticeInfos.add(noticeInfo); noticeInfos.add(noticeInfo);
} }
task.setEnterUsers(userIds.toString()); task.setEnterUsers(userIds.toString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment