Commit 1ac16d5d authored by 李秀明's avatar 李秀明

巡检计划新增及编辑接口修改

parent 350a889e
package com.yeejoin.amos.patrol.business.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dto.UserDetailsDto;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.feign.TzsFeign;
import com.yeejoin.amos.patrol.business.param.PlanInfoPageParam;
......@@ -12,6 +10,7 @@ import com.yeejoin.amos.patrol.business.service.intfc.IPlanService;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.business.util.PlanPageParamUtil;
import com.yeejoin.amos.patrol.business.util.StringUtil;
import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
import com.yeejoin.amos.patrol.core.common.request.ToJson;
......@@ -23,12 +22,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
@RestController
@RequestMapping(value = "/api/plan")
......@@ -153,39 +154,31 @@ public class PlanController extends AbstractBaseController {
return CommonResponseUtil.failure("工作时长超出结束时间");
}
}
String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> map = new HashMap<>();
map.put("org_code", loginOrgCode);
map.put("user_id", userId);
// Map<String, String> deptMap = new HashMap<>();
// Set<String> departmentIds = new HashSet<>();
// List<String> groupIds = Arrays.asList(param.getUserGroupId().split(","));
// depts.stream().forEach(dept -> {
// deptMap.put(dept.substring(0, dept.indexOf("@")), dept.substring(dept.indexOf("@") + 1));
// });
// for (String entry : deptMap.keySet()) {
// String entryValue = deptMap.get(entry);
// departmentIds.add(entryValue);
// }
// StringBuffer departmentIdBuffer = new StringBuffer();
// Iterator<String> it = departmentIds.iterator();
// while (it.hasNext()) {
// departmentIdBuffer.append(it.next()).append(",");
// }
// if(departmentIds.size() > 0){
// FeignClientResult<List<Map<String, Object>>> departmentModeldate= jcsFeignClient.selectByIdDeptList
// (departmentIdBuffer.toString().substring(0, departmentIdBuffer.toString().length() - 1));
// List<Map<String, Object>> departmentModels = departmentModeldate.getResult();
// if(departmentModels!=null&&departmentModels.size()>0){
// Map<String, Object> mapj= departmentModels.get(0);
// param.setBizOrgCode(mapj.get("bizOrgCode").toString());
// param.setBizOrgName(mapj.get("bizOrgName").toString());
// }
// }
List<String> userGroupIds = Objects.nonNull(param.getUserGroupId()) ? Arrays.asList(param.getUserGroupId().split(",")) : Collections.emptyList();
StringBuilder userIdSB = new StringBuilder(), userDeptSB = new StringBuilder(), userNameSB = new StringBuilder();
ResponseModel<List<UserDetailsDto>> response;
for (String userGroupId : userGroupIds) {
response = tzsFeign.getGroupAndPersonInfo(Long.valueOf(userGroupId));
if (response.getStatus() == 200) {
List<UserDetailsDto> resultList = response.getResult();
for (UserDetailsDto udd : resultList) {
userIdSB.append(",").append(udd.getUserId());
userDeptSB.append(",").append(udd.getUserId()).append("@").append(udd.getUnitCode());
userNameSB.append(",").append(udd.getUserName());
}
}
}
String userId = StringUtils.hasText(userIdSB) ? userIdSB.substring(1) : "";
String userDept = StringUtils.hasText(userDeptSB) ? userDeptSB.substring(1) : "";
String userName = StringUtils.hasText(userNameSB) ? userNameSB.substring(1) : "";
param.setUserId(userId);
param.setUserDept(userDept);
param.setBizOrgCode(loginOrgCode);
param.setBizOrgName(getCompanyName(reginParams));
map.put("param", param);
......
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