Commit 8149d19c authored by lisong's avatar lisong

调整监察值守逻辑

parent 2620a246
...@@ -44,13 +44,17 @@ import com.yeejoin.amos.feign.systemctl.Systemctl; ...@@ -44,13 +44,17 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.mock.web.MockMultipartFile; import org.springframework.mock.web.MockMultipartFile;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -126,6 +130,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -126,6 +130,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Autowired @Autowired
WorkflowFeignService workflowFeignService; WorkflowFeignService workflowFeignService;
private final Logger logger = LogManager.getLogger(RegUnitInfoServiceImpl.class);
/** /**
* 使用单位的类型,数据来源:cb_data_dictionary code = 1232 * 使用单位的类型,数据来源:cb_data_dictionary code = 1232
*/ */
...@@ -713,15 +720,18 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -713,15 +720,18 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
String roleId = ""; String roleId = "";
// 根据指标taskId查询 // 根据指标taskId查询
FeignClientResult<Map<String, Object>> taskMessage = idxFeignService.getTaskId(taskId); FeignClientResult<Map<String, Object>> taskMessage = idxFeignService.getTaskId(taskId);
logger.info("idx返回任务信息,{}", JSONObject.toJSONString(taskMessage));
if ("200".equals(String.valueOf(taskMessage.getStatus())) && !ObjectUtils.isEmpty(taskMessage)) { if ("200".equals(String.valueOf(taskMessage.getStatus())) && !ObjectUtils.isEmpty(taskMessage)) {
Object id = taskMessage.getResult().get("processInstanceId"); Object id = taskMessage.getResult().get("processInstanceId");
// 根据processInstanceId查询workFlow服务对应的taskId // 根据processInstanceId查询workFlow服务对应的taskId
JSONObject flowTask = workflowFeignService.getTaskId(String.valueOf(id)); JSONObject flowTask = workflowFeignService.getTaskId(String.valueOf(id));
logger.info("workFlow返回任务id,{}", JSONObject.toJSONString(flowTask));
if (!ObjectUtils.isEmpty(flowTask) && !ObjectUtils.isEmpty(flowTask.get("data"))) { if (!ObjectUtils.isEmpty(flowTask) && !ObjectUtils.isEmpty(flowTask.get("data"))) {
JSONObject data = JSON.parseObject(JSON.toJSONString(flowTask.get("data"))); JSONObject data = JSON.parseObject(JSON.toJSONString(flowTask.get("data")));
Object id1 = data.get("id"); Object id1 = data.get("id");
// 根据taskId查询流程节点绑定角色id // 根据taskId查询流程节点绑定角色id
JSONObject result = workflowFeignService.getRoleId(String.valueOf(id1)); JSONObject result = workflowFeignService.getRoleId(String.valueOf(id1));
logger.info("workFlow返回角色id,{}", JSONObject.toJSONString(result));
if (!ObjectUtils.isEmpty(result) && !ObjectUtils.isEmpty(result.get("result"))) { if (!ObjectUtils.isEmpty(result) && !ObjectUtils.isEmpty(result.get("result"))) {
JSONObject result1 = JSON.parseObject(JSON.toJSONString(result.get("result"))); JSONObject result1 = JSON.parseObject(JSON.toJSONString(result.get("result")));
roleId = String.valueOf(result1.get("roleId")); roleId = String.valueOf(result1.get("roleId"));
...@@ -736,6 +746,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -736,6 +746,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
String companyName = ""; String companyName = "";
// 查询流程第一个节点所选择的执行企业信息 // 查询流程第一个节点所选择的执行企业信息
FeignClientResult<JSONObject> firstTask = idxFeignService.getFirstTask(taskId); FeignClientResult<JSONObject> firstTask = idxFeignService.getFirstTask(taskId);
logger.info("idx返回第一个节点任务信息,{}", JSONObject.toJSONString(firstTask));
if (!ObjectUtils.isEmpty(firstTask)) { if (!ObjectUtils.isEmpty(firstTask)) {
companyName = String.valueOf(firstTask.getResult().get("CHECKED_COMPANY")); companyName = String.valueOf(firstTask.getResult().get("CHECKED_COMPANY"));
} }
...@@ -745,12 +756,16 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -745,12 +756,16 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
//FeignClientResult<Set<AgencyUserModel>> setFeignClientResult = Privilege.agencyUserClient.queryByOrgCode(companyModelFeignClientResult.getResult().getOrgCode(), null); //FeignClientResult<Set<AgencyUserModel>> setFeignClientResult = Privilege.agencyUserClient.queryByOrgCode(companyModelFeignClientResult.getResult().getOrgCode(), null);
Long sequenceNbr = companyModelFeignClientResult.getResult().getSequenceNbr(); Long sequenceNbr = companyModelFeignClientResult.getResult().getSequenceNbr();
// 查询企业对应角色下的用户 // 查询企业对应角色下的用户
logger.info("向privilege发送参数roleId,companyId,{},{}", roleId, sequenceNbr);
FeignClientResult<List<AgencyUserModel>> listFeignClientResult = Privilege.agencyUserClient.queryByCompanyRoles(sequenceNbr, roleId, null, null); FeignClientResult<List<AgencyUserModel>> listFeignClientResult = Privilege.agencyUserClient.queryByCompanyRoles(sequenceNbr, roleId, null, null);
if (!ObjectUtils.isEmpty(listFeignClientResult)){ logger.info("privilege返回用户信息,{}", JSONObject.toJSONString(listFeignClientResult));
if (!ObjectUtils.isEmpty(listFeignClientResult) && !ObjectUtils.isEmpty(listFeignClientResult.getResult())){
listFeignClientResult.getResult().forEach(item ->{ listFeignClientResult.getResult().forEach(item ->{
flow.add(item.getUserName()); flow.add(item.getUserName());
task.add(item.getUserId()); task.add(item.getUserId());
}); });
}else {
throw new BadRequest("没有对应企业整改执行人!");
} }
// if (!ObjectUtils.isEmpty(setFeignClientResult)) { // if (!ObjectUtils.isEmpty(setFeignClientResult)) {
...@@ -771,11 +786,27 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -771,11 +786,27 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("title", "企业整改"); jsonObject.put("title", "企业整改");
jsonObject.put("userIds", userIdsTask); jsonObject.put("userIds", userIdsTask);
idxFeignService.updateAmosTask(taskId, jsonObject); logger.info("idx执行任务更新参数,{}", JSONObject.toJSONString(jsonObject));
//FeignClientResult<JSONObject> jsonObjectFeignClientResult = idxFeignService.updateAmosTask(taskId, jsonObject);
updateAmosTask(taskId, jsonObject);
//logger.info("idx执行任务更新任务返回参数,{}", JSONObject.toJSONString(jsonObjectFeignClientResult));
} }
return "ok"; return "ok";
} }
/***
* idx通用提交接口为异步,解决任务还未创建成功时执行更新失败
* @param taskId
* @param object
* @throws InterruptedException
*/
@Async
void updateAmosTask(String taskId, JSONObject object) throws InterruptedException {
Thread.sleep(1000*2);
FeignClientResult<JSONObject> jsonObjectFeignClientResult = idxFeignService.updateAmosTask(taskId, object);
logger.info("idx执行任务更新任务返回参数,{}", JSONObject.toJSONString(jsonObjectFeignClientResult));
}
private String dealNull2EmptyString(String t) { private String dealNull2EmptyString(String t) {
return StringUtils.isEmpty(t) ? "" : t; return StringUtils.isEmpty(t) ? "" : t;
} }
......
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