|
@@ -49,7 +49,7 @@ public class PlanManageController {
|
|
|
* @param taskAreaName 任务区域名称
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping("/plan/add")
|
|
|
+ @GetMapping("/plan/add")
|
|
|
@ApiOperation(value = "新增巡检计划")
|
|
|
public AjaxMessage addPlan(@ApiParam(value = "任务名称", required = true) @RequestParam(required = true) String planName,
|
|
|
@ApiParam(value = "任务类型", required = true) @RequestParam(required = true) Integer taskType,
|
|
@@ -58,7 +58,8 @@ public class PlanManageController {
|
|
|
@ApiParam(value = "计划巡检人ID", required = true) @RequestParam(required = true) String userId,
|
|
|
@ApiParam(value = "任务内容", required = true) @RequestParam(required = true) String taskContent,
|
|
|
@ApiParam(value = "任务区域坐标", required = true) @RequestParam(required = true) String taskAreaShape,
|
|
|
- @ApiParam(value = "任务区域名称", required = true) @RequestParam(required = true) String taskAreaName) {
|
|
|
+ @ApiParam(value = "任务区域名称", required = true) @RequestParam(required = true) String taskAreaName,
|
|
|
+ @ApiParam(value = "任务签到点", required = false) @RequestParam(required = false) String taskChecked) {
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
String planId=DatesUtil.formatDate(new Date(),"yyyyMMddHHmmss")+String.valueOf((int) (Math.random()*(9999-1000)+1000));
|
|
|
PlanManage record = new PlanManage();
|
|
@@ -66,16 +67,17 @@ public class PlanManageController {
|
|
|
record.setPlanId(planId);
|
|
|
record.setPlanName(planName);
|
|
|
record.setTaskType(taskType);
|
|
|
+ record.setTaskChecked(taskChecked);
|
|
|
record.setPlanStartDate(DatesUtil.parseDate(planStartDate,"yyyy-MM-dd HH:mm:ss"));
|
|
|
record.setPlanEndDate(DatesUtil.parseDate(planEndDate,"yyyy-MM-dd HH:mm:ss"));
|
|
|
- record.setUserId(userId);
|
|
|
+ record.setPlanStatus(0);
|
|
|
record.setTaskContent(taskContent);
|
|
|
record.setTaskAreaShape(taskAreaShape);
|
|
|
record.setTaskAreaName(taskAreaName);
|
|
|
record.setDateCreate(DatesUtil.parseDate(DatesUtil.formatNow(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
if(loginUser.getId() != null) {
|
|
|
- record.setPlanUserId(loginUser.getId().toString());
|
|
|
- record.setCreateBy(loginUser.getId().toString());
|
|
|
+ record.setPlanUserId(String.valueOf(loginUser.getId()));
|
|
|
+ record.setCreateBy(String.valueOf(loginUser.getId()));
|
|
|
}
|
|
|
if(loginUser.getTenantId() != null) {
|
|
|
record.setTenantId(loginUser.getTenantId());
|
|
@@ -92,9 +94,10 @@ public class PlanManageController {
|
|
|
public AjaxMessage<Pagination<PlanManageDto>> selectPlan(
|
|
|
@ApiParam(value = "页数", required = true)@RequestParam Integer pageNum,
|
|
|
@ApiParam(value = "条数", required = true)@RequestParam Integer pageSize,
|
|
|
- @ApiParam(value = "计划单号或计划名称", required = true) @RequestParam(required = false) String key,
|
|
|
- @ApiParam(value = "计划安排起始日期", required = true) @RequestParam(required = false) String startDate,
|
|
|
- @ApiParam(value = "计划安排截至日期", required = true) @RequestParam(required = false) String endDate){
|
|
|
+ @ApiParam(value = "状态", required = false) @RequestParam(required = false) Integer planStatus,
|
|
|
+ @ApiParam(value = "计划单号或计划名称", required = false) @RequestParam(required = false) String key,
|
|
|
+ @ApiParam(value = "计划安排起始日期", required = false) @RequestParam(required = false) String startDate,
|
|
|
+ @ApiParam(value = "计划安排截至日期", required = false) @RequestParam(required = false) String endDate){
|
|
|
PlanManageDto planManageDto = new PlanManageDto();
|
|
|
//根据用户编号,获取用户的权限
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
@@ -103,6 +106,7 @@ public class PlanManageController {
|
|
|
planManageDto.setStartDate(startDate);
|
|
|
planManageDto.setEndDate(endDate);
|
|
|
}
|
|
|
+ planManageDto.setPlanStatus(planStatus);
|
|
|
planManageDto.setTenantId(loginUser.getTenantId());
|
|
|
planManageDto.setProgramItems(loginUser.getProgramItemList());
|
|
|
planManageDto.setUserType(loginUser.getType());
|
|
@@ -119,7 +123,7 @@ public class PlanManageController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @PostMapping("/plan/submit")
|
|
|
+ @GetMapping("/plan/submit")
|
|
|
@ApiOperation(value = "提交巡检计划")
|
|
|
public AjaxMessage submitPlan(
|
|
|
@ApiParam(value = "计划单号", required = true) @RequestParam(required = false) Integer id){
|
|
@@ -144,19 +148,59 @@ public class PlanManageController {
|
|
|
String startProcess = workFlowService.startProcess(processDefinition,vars);
|
|
|
Task task = workFlowService.getProcessRuntimeTask(startProcess).get(0);
|
|
|
Set<String> taskParticipator = workFlowService.getTaskParticipator(task.getId(),false,null);
|
|
|
+ String currentUsers = null;
|
|
|
+ for (String str : taskParticipator) {
|
|
|
+ if(currentUsers == null){
|
|
|
+ currentUsers = str;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ currentUsers +=String.format(",%s",str);
|
|
|
+ }
|
|
|
+ }
|
|
|
//更新计划表的流程相关字段值。
|
|
|
planManage.setPlanStatus(1);//已执行
|
|
|
- planManage.setUpdateBy(loginUser.getId().toString());
|
|
|
+ if(planManage.getId() != null) {
|
|
|
+ planManage.setUpdateBy(String.valueOf(loginUser.getId()));
|
|
|
+ }
|
|
|
planManage.setDateUpdate(new Date());
|
|
|
- planManage.setProcessInstanceId("");
|
|
|
- planManage.setProcessDefId("");
|
|
|
- planManage.setCurrentTaskId("");
|
|
|
- planManage.setCurrentUsers("");
|
|
|
- planManage.setCurrentTaskName("");
|
|
|
+ planManage.setProcessInstanceId(task.getProcessInstanceId());
|
|
|
+ planManage.setProcessDefId(task.getProcessDefinitionId());
|
|
|
+ planManage.setCurrentTaskId(task.getId());
|
|
|
+ planManage.setCurrentUsers(currentUsers);
|
|
|
+ planManage.setCurrentTaskName(task.getName());
|
|
|
int rows = planManageService.updateByPrimaryKeySelective(planManage);
|
|
|
if(rows > 0) {
|
|
|
return new AjaxMessage<>(ResultStatus.OK);
|
|
|
}
|
|
|
return new AjaxMessage<>(ResultStatus.ERROR);
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/plan/update")
|
|
|
+ @ApiOperation(value = "修改巡检计划")
|
|
|
+ public AjaxMessage updatePlan( @ApiParam(value = "修改巡检计划", required = true) @RequestBody PlanManage planManage) {
|
|
|
+ PlanManage record = new PlanManage();
|
|
|
+ record.setId(planManage.getId());
|
|
|
+ record.setUserId(planManage.getUserId());
|
|
|
+ record.setPlanName(planManage.getPlanName());
|
|
|
+ record.setTaskType(planManage.getTaskType());
|
|
|
+ record.setTaskChecked(planManage.getTaskChecked());
|
|
|
+ record.setPlanStartDate(planManage.getPlanStartDate());
|
|
|
+ record.setPlanEndDate(planManage.getPlanDate());
|
|
|
+ record.setTaskContent(planManage.getTaskContent());
|
|
|
+ record.setTaskAreaShape(planManage.getTaskAreaShape());
|
|
|
+ record.setTaskAreaName(planManage.getTaskAreaName());
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ if(loginUser.getId() != null) {
|
|
|
+ record.setUpdateBy(String.valueOf(loginUser.getId()));
|
|
|
+ }
|
|
|
+ record.setDateUpdate(new Date());
|
|
|
+ int rows = planManageService.updateByPrimaryKeySelective(record);
|
|
|
+ if(rows > 0) {
|
|
|
+ return new AjaxMessage(ResultStatus.OK);
|
|
|
+ }
|
|
|
+ return new AjaxMessage(ResultStatus.ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|