@Log(title = "维修业务", businessType = BusinessType.UPDATE)
@PostMapping( "/submitApply/{id}")
@ResponseBody
public AjaxResult submitApply(@PathVariable Long id ,String variablesStr){
try {
System.out.println("variables: " + variablesStr);
Map<String, Object> vars = (Map<String, Object>) JSON.parse(variablesStr);
String[] users = vars.get("users").toString().split(",");
Map<String, Object> variables = new HashMap<>();
if (users.length > 0) {
Object value = Arrays.asList(users);
variables.put("users", value);
}
BizMaintenanceTask maintenanceTask = bizMaintenanceTaskService.selectBizMaintenanceTaskById(id);
processService.submitApply(maintenanceTask, "maintenance",variables);
maintenanceTask.setAssign("已指派");
maintenanceTask.setAssignMaintainer(users[0]);
bizMaintenanceTaskService.updateBizMaintenanceTask(maintenanceTask);
} catch (Exception e) {
e.printStackTrace();
return error("提交申请出错:" + e.getMessage());
}
return success();
}
@PostMapping( "/complete")
@ResponseBody
public AjaxResult complete(String taskId, String instanceId, String variables) {
processService.complete(taskId, instanceId, variables);
JSONObject jsonObject = JSON.parseObject(variables);
String isRepaired = jsonObject.getJSONObject("formData").getString("isRepaired");
String symptoms = jsonObject.getJSONObject("formData").getString("symptoms");
String maintenanceStatus = jsonObject.getJSONObject("formData").getString("maintenanceStatus");
String busTaskId = jsonObject.getJSONObject("formData").getString("busTaskId");
String repairedImage = jsonObject.getJSONObject("formData").getString("repairedImage");
String faultCause = jsonObject.getJSONObject("formData").getString("faultCause");
BizMaintenanceTask bizMaintenanceTask = new BizMaintenanceTask();
bizMaintenanceTask.setBusTaskId(busTaskId);
bizMaintenanceTask.setSymptoms(symptoms);
bizMaintenanceTask.setIsRepaired(isRepaired);
bizMaintenanceTask.setFaultCause(faultCause);
bizMaintenanceTask.setMaintenanceStatus(maintenanceStatus);
bizMaintenanceTask.setRepairedImage(repairedImage);
bizMaintenanceTaskService.updateBizMaintenanceTaskByTaskId(bizMaintenanceTask);
return success();
}