|
@@ -23,10 +23,12 @@ import com.huaxu.process.entity.ProcessDefinition;
|
|
import com.huaxu.process.service.WorkFlowService;
|
|
import com.huaxu.process.service.WorkFlowService;
|
|
import com.huaxu.process.utils.Action;
|
|
import com.huaxu.process.utils.Action;
|
|
import com.huaxu.task.entity.PlanManage;
|
|
import com.huaxu.task.entity.PlanManage;
|
|
|
|
+import com.huaxu.task.entity.UserEntity;
|
|
import com.huaxu.task.service.PlanManageService;
|
|
import com.huaxu.task.service.PlanManageService;
|
|
import com.huaxu.util.DatesUtil;
|
|
import com.huaxu.util.DatesUtil;
|
|
import com.huaxu.util.MessageSendUtil;
|
|
import com.huaxu.util.MessageSendUtil;
|
|
import com.huaxu.util.UserUtil;
|
|
import com.huaxu.util.UserUtil;
|
|
|
|
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
@@ -39,6 +41,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/order/workOrderManage")
|
|
@RequestMapping("/order/workOrderManage")
|
|
@@ -123,12 +126,7 @@ public class WorkOrderManageController {
|
|
@ApiOperation(value = "APP运维管理待处理查询")
|
|
@ApiOperation(value = "APP运维管理待处理查询")
|
|
public AjaxMessage<List<WorkOrderManageDto>> selectAppTodo() {
|
|
public AjaxMessage<List<WorkOrderManageDto>> selectAppTodo() {
|
|
List<WorkOrderManageDto> result=workOrderManageService.selectAppTodo();
|
|
List<WorkOrderManageDto> result=workOrderManageService.selectAppTodo();
|
|
- Map<String,String> dictMap=userCenterClient.selectListByPCodes("SC_WORK_ORDER_TYPE,SC_TASK_TYPE");
|
|
|
|
- if(result.size()>0&&dictMap.size()>0){
|
|
|
|
- for(WorkOrderManageDto workOrderManageDto:result) {
|
|
|
|
- workOrderManageDto.setTypeName(dictMap.get(workOrderManageDto.getOrderTypeId().toString()));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ setName(result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -139,12 +137,7 @@ public class WorkOrderManageController {
|
|
@ApiOperation(value = "APP运维管理全部查询")
|
|
@ApiOperation(value = "APP运维管理全部查询")
|
|
public AjaxMessage<List<WorkOrderManageDto>> selectAppAll() {
|
|
public AjaxMessage<List<WorkOrderManageDto>> selectAppAll() {
|
|
List<WorkOrderManageDto> result=workOrderManageService.selectAppAll();
|
|
List<WorkOrderManageDto> result=workOrderManageService.selectAppAll();
|
|
- Map<String,String> dictMap=userCenterClient.selectListByPCodes("SC_WORK_ORDER_TYPE,SC_TASK_TYPE");
|
|
|
|
- if(result.size()>0&&dictMap.size()>0){
|
|
|
|
- for(WorkOrderManageDto workOrderManageDto:result) {
|
|
|
|
- workOrderManageDto.setTypeName(dictMap.get(workOrderManageDto.getOrderTypeId().toString()));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ setName(result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -260,12 +253,7 @@ public class WorkOrderManageController {
|
|
public AjaxMessage<List<WorkOrderManageDto>> selectOrderDetail(
|
|
public AjaxMessage<List<WorkOrderManageDto>> selectOrderDetail(
|
|
@ApiParam(value = "工单id", required = true) @RequestParam Integer flowId) {
|
|
@ApiParam(value = "工单id", required = true) @RequestParam Integer flowId) {
|
|
List<WorkOrderManageDto> result=workOrderManageService.selectOrderDetail(flowId);
|
|
List<WorkOrderManageDto> result=workOrderManageService.selectOrderDetail(flowId);
|
|
- Map<String,String> dictMap=userCenterClient.selectListByPCodes("SC_WORK_ORDER_TYPE,SC_TASK_TYPE");
|
|
|
|
- if(result.size()>0&&dictMap.size()>0){
|
|
|
|
- for(WorkOrderManageDto workOrderManageDto:result) {
|
|
|
|
- workOrderManageDto.setTypeName(dictMap.get(workOrderManageDto.getOrderTypeId().toString()));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ setName(result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
}
|
|
}
|
|
@RequestMapping(value = "saveDetail", method = RequestMethod.GET)
|
|
@RequestMapping(value = "saveDetail", method = RequestMethod.GET)
|
|
@@ -442,6 +430,35 @@ public class WorkOrderManageController {
|
|
return new AjaxMessage<>(ResultStatus.ERROR);
|
|
return new AjaxMessage<>(ResultStatus.ERROR);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @GetMapping("/delProcInst")
|
|
|
|
+ @ApiOperation(value = "终止流程")
|
|
|
|
+ public AjaxMessage deleteProcessInstance(
|
|
|
|
+ @ApiParam(value = "任务ID", required = true) @RequestParam(required = true) Integer id,
|
|
|
|
+ @ApiParam(value = "流程ID", required = true) @RequestParam(required = true) String processInstanceId,
|
|
|
|
+ @ApiParam(value = "流程备注", required = false) @RequestParam(required = false) String remark) {
|
|
|
|
+ Boolean delFlow = workFlowService.deleteProcessInstance(processInstanceId,remark);
|
|
|
|
+ if(delFlow ==true) {
|
|
|
|
+ WorkOrderManage workOrderManage = new WorkOrderManage();
|
|
|
|
+ workOrderManage.setId(id);
|
|
|
|
+ workOrderManage.setOrderStatus(3);//工单终止状态
|
|
|
|
+ workOrderManage.setCurrentUsers("");
|
|
|
|
+ workOrderManageService.updateByPrimaryKeySelective(workOrderManage);
|
|
|
|
+ LoginUser currentUser = UserUtil.getCurrentUser();
|
|
|
|
+ WorkFlowLog workFlowLog=new WorkFlowLog();
|
|
|
|
+ workFlowLog.setFlowId(id);
|
|
|
|
+ workFlowLog.setFlowType(1);
|
|
|
|
+ workFlowLog.setFlowResult(remark);
|
|
|
|
+ workFlowLog.setCreateBy(currentUser.getId()!=null?currentUser.getId().toString():null);
|
|
|
|
+ workFlowLog.setDateCreate(new Date());
|
|
|
|
+ workFlowLog.setHandleUserId(currentUser.getId()!=null?currentUser.getId().toString():null);
|
|
|
|
+ workFlowLog.setHandleUserName(currentUser.getUsername());
|
|
|
|
+ //记录日志
|
|
|
|
+ workFlowLogService.insert(workFlowLog);
|
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK);
|
|
|
|
+ }
|
|
|
|
+ return new AjaxMessage<>(ResultStatus.ERROR);
|
|
|
|
+ }
|
|
|
|
+
|
|
@RequestMapping(value="batchDelete" , method = RequestMethod.DELETE)
|
|
@RequestMapping(value="batchDelete" , method = RequestMethod.DELETE)
|
|
@ApiOperation(value = "批量删除")
|
|
@ApiOperation(value = "批量删除")
|
|
public AjaxMessage<Integer> batchDelete( @ApiParam(value = "工单Ids") @RequestParam List<Integer> ids){
|
|
public AjaxMessage<Integer> batchDelete( @ApiParam(value = "工单Ids") @RequestParam List<Integer> ids){
|
|
@@ -458,4 +475,79 @@ public class WorkOrderManageController {
|
|
|
|
|
|
return workOrderManageService.batchInsertByAlarms(workOrderManages);
|
|
return workOrderManageService.batchInsertByAlarms(workOrderManages);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @GetMapping("/selectOrderPower")
|
|
|
|
+ @ApiOperation(value = "获取工单派单权限")
|
|
|
|
+ public AjaxMessage<Map<String,Object>> selectOrderPower(
|
|
|
|
+ @ApiParam(value = "工单ID", required = true) @RequestParam(required = true) Integer id){
|
|
|
|
+ Map<String,Object> result = new HashMap<String,Object>();
|
|
|
|
+ WorkOrderManage workOrderManage = workOrderManageService.selectByPrimaryKey(id);
|
|
|
|
+ //抢修工单,可以派漏点定位和停水工单
|
|
|
|
+ if(workOrderManage.getOrderTypeId() == 3 && workOrderManage.getOrderStatus() == 1){
|
|
|
|
+ result.put("2","true");
|
|
|
|
+ result.put("4","true");
|
|
|
|
+ Map<String,Object> map = new HashMap<String,Object>();
|
|
|
|
+ map.put("orderPid",workOrderManage.getId());
|
|
|
|
+ List<WorkOrderManage> workOrderManageList = workOrderManageService.selectByPId(map);
|
|
|
|
+ for(WorkOrderManage wom: workOrderManageList){
|
|
|
|
+ if (wom.getOrderStatus() == 0 || wom.getOrderStatus() == 1){
|
|
|
|
+ if(wom.getOrderTypeId()==2 ){
|
|
|
|
+ result.put("2","false");
|
|
|
|
+ }
|
|
|
|
+ else if(wom.getOrderTypeId()==4){
|
|
|
|
+ result.put("4","false");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK,result);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 获取并设置用户、任务工单类型名称
|
|
|
|
+ * @param result
|
|
|
|
+ */
|
|
|
|
+ private void setName(List<WorkOrderManageDto> result){
|
|
|
|
+ if(result.size()>0){
|
|
|
|
+ try{
|
|
|
|
+ List<Long> idList = new ArrayList<Long>();
|
|
|
|
+ for(WorkOrderManageDto workOrder:result) {
|
|
|
|
+ if(workOrder.getSendBy()!=null) {
|
|
|
|
+ idList.add(Long.valueOf(workOrder.getSendBy()));
|
|
|
|
+ }
|
|
|
|
+ if(workOrder.getOrderUserId()!=null) {
|
|
|
|
+ idList.add(Long.valueOf(workOrder.getOrderUserId()));
|
|
|
|
+ }
|
|
|
|
+ if(workOrder.getCreateBy()!=null) {
|
|
|
|
+ idList.add(Long.valueOf(workOrder.getCreateBy()));
|
|
|
|
+ }
|
|
|
|
+ if(workOrder.getUpdateBy()!=null) {
|
|
|
|
+ idList.add(Long.valueOf(workOrder.getUpdateBy()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Long[] ids = idList.toArray(new Long[0]);
|
|
|
|
+ Map<Long,String> userMap = userCenterClient.findUserIdsByUserIds(ids).stream().collect(Collectors.toMap(UserEntity::getId, UserEntity::getUsername));
|
|
|
|
+ Map<String,String> dictMap=userCenterClient.selectListByPCodes("SC_WORK_ORDER_TYPE,SC_TASK_TYPE");
|
|
|
|
+ for(WorkOrderManageDto workOrder:result) {
|
|
|
|
+ if(workOrder.getOrderTypeId()!=null) {
|
|
|
|
+ workOrder.setTypeName(dictMap.get(workOrder.getOrderTypeId().toString()));
|
|
|
|
+ }
|
|
|
|
+ if(workOrder.getSendBy()!=null) {
|
|
|
|
+ workOrder.setSendByName(userMap.get(Long.valueOf(workOrder.getSendBy())));
|
|
|
|
+ }
|
|
|
|
+ if(workOrder.getOrderUserId()!=null) {
|
|
|
|
+ workOrder.setOrderUserName(userMap.get(Long.valueOf(workOrder.getOrderUserId())));
|
|
|
|
+ }
|
|
|
|
+ if(workOrder.getCreateBy()!=null) {
|
|
|
|
+ workOrder.setCreateByName(userMap.get(Long.valueOf(workOrder.getCreateBy())));
|
|
|
|
+ }
|
|
|
|
+ if(workOrder.getUpdateBy()!=null) {
|
|
|
|
+ workOrder.setUpdateByName(userMap.get(Long.valueOf(workOrder.getUpdateBy())));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|