|
@@ -27,6 +27,7 @@ import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/workflow/task/")
|
|
@@ -184,7 +185,26 @@ public class PlanManageController {
|
|
|
@ApiOperation(value = "APP查询任务详情")
|
|
|
public AjaxMessage<PlanManageDto> selectPlanDetail(
|
|
|
@ApiParam(value = "任务id", required = true) @RequestParam Integer flowId) {
|
|
|
- return new AjaxMessage<>(ResultStatus.OK, planManageService.selectPlanDetail(flowId));
|
|
|
+ PlanManageDto result=planManageService.selectPlanDetail(flowId);
|
|
|
+
|
|
|
+ setName(new ArrayList<PlanManageDto>(){{
|
|
|
+ this.add(result);
|
|
|
+ }});
|
|
|
+ /*try{
|
|
|
+ Long[] ids = new Long[4];
|
|
|
+ ids[0]=Long.parseLong(result.getUserId());
|
|
|
+ ids[1]=Long.parseLong(result.getPlanUserId());
|
|
|
+ ids[2]=Long.parseLong(result.getCreateBy());
|
|
|
+ ids[3]=Long.parseLong(result.getUpdateBy());
|
|
|
+ Map<Long,String> userMap = userCenterClient.findUserIdsByUserIds(ids).stream().collect(Collectors.toMap(UserEntity::getId, UserEntity::getUsername));
|
|
|
+ result.setUserName(userMap.get(ids[0]));
|
|
|
+ result.setPlanUserName(userMap.get(ids[1]));
|
|
|
+ result.setCreateByName(userMap.get(ids[2]));
|
|
|
+ result.setUpdateByName(userMap.get(ids[3]));
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }*/
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result );
|
|
|
}
|
|
|
|
|
|
|
|
@@ -354,4 +374,51 @@ public class PlanManageController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取并设置用户、任务工单类型名称
|
|
|
+ * @param
|
|
|
+ */
|
|
|
+ private void setName(List<PlanManageDto> planManageDtoList){
|
|
|
+ try {
|
|
|
+ if(planManageDtoList.size()>0) {
|
|
|
+ List<Long> idList = new ArrayList<Long>();
|
|
|
+ for (PlanManageDto plan : planManageDtoList) {
|
|
|
+ if(plan.getUserId() != null) {
|
|
|
+ idList.add(Long.parseLong(plan.getUserId()));
|
|
|
+ }
|
|
|
+ if(plan.getPlanUserId() != null){
|
|
|
+ idList.add(Long.parseLong(plan.getPlanUserId()));
|
|
|
+ }
|
|
|
+ if(plan.getCreateBy() != null){
|
|
|
+ idList.add(Long.parseLong(plan.getCreateBy()));
|
|
|
+ }
|
|
|
+ if(plan.getUpdateBy() != null){
|
|
|
+ idList.add(Long.parseLong(plan.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 (PlanManageDto plan : planManageDtoList) {
|
|
|
+ if(plan.getTaskType() != null){
|
|
|
+ plan.setTypeName(dictMap.get(plan.getTaskType().toString()));
|
|
|
+ }
|
|
|
+ if(plan.getUserId() != null) {
|
|
|
+ plan.setUserName(userMap.get(Long.valueOf(plan.getUserId())));
|
|
|
+ }
|
|
|
+ if(plan.getPlanUserId() != null){
|
|
|
+ plan.setPlanUserName(userMap.get(Long.valueOf(plan.getPlanUserId())));
|
|
|
+ }
|
|
|
+ if(plan.getCreateBy() != null){
|
|
|
+ plan.setCreateByName(userMap.get(Long.valueOf(plan.getCreateBy())));
|
|
|
+ }
|
|
|
+ if(plan.getUpdateBy() != null){
|
|
|
+ plan.setUpdateByName(userMap.get(Long.valueOf(plan.getUpdateBy())));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|