修改:知识库列表审批人批量查询返回
This commit is contained in:
@@ -10,6 +10,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统评审
|
||||
@@ -48,6 +50,16 @@ public class SystemApproveController implements IApproveFeignClient {
|
||||
return approveServer.queryApproveFlowStatus(flowId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据flowId批量查询审批详情
|
||||
* @param flowIds
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("queryBatchApproveFlowStatus")
|
||||
public SdmResponse queryBatchApproveFlowStatus(@RequestBody List<String> flowIds) {
|
||||
return approveServer.queryBatchApproveFlowStatus(flowIds);
|
||||
}
|
||||
|
||||
@PostMapping("/stopApprove")
|
||||
public SdmResponse stopApproval(@RequestParam ("flowId") String flowId) {
|
||||
return approveServer.stopCidApprovalFlow(flowId);
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.sdm.system.dao;
|
||||
|
||||
import com.sdm.common.entity.req.system.FlowStatusParam;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SimulationApproveMapper {
|
||||
|
||||
@@ -19,4 +22,16 @@ public interface SimulationApproveMapper {
|
||||
@Select("SELECT * FROM simulation_approve_flow WHERE cidFlowId=#{flowId} LIMIT 1")
|
||||
LaunchApproveReq querySimulationApproveFlowByCidFlowId(@Param("flowId") String flowId);
|
||||
|
||||
@Select({
|
||||
"<script>",
|
||||
"SELECT templateId AS flowId, cidFlowId AS processInstanceId, tenantId AS tenantId",
|
||||
"FROM simulation_approve_flow",
|
||||
"WHERE cidFlowId IN",
|
||||
"<foreach collection='flowIds' item='flowId' open='(' close=')' separator=','>",
|
||||
" #{flowId}",
|
||||
"</foreach>",
|
||||
"</script>"
|
||||
})
|
||||
List<FlowStatusParam> queryBatchFlowStatusFromSpdmDb(@Param("flowIds")List<String> flowIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ package com.sdm.system.service;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统提交评审服务
|
||||
@@ -56,6 +58,8 @@ public interface ISimulatinoApprovalService {
|
||||
*/
|
||||
SdmResponse queryApproveFlowStatus(String flowId);
|
||||
|
||||
SdmResponse queryBatchApproveFlowStatus(List<String> flowIds);
|
||||
|
||||
/**
|
||||
* 查询流程实例详情
|
||||
* @param flowId
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.constants.NumberConstants;
|
||||
import com.sdm.common.entity.req.system.FlowStatusParam;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.log.CoreLogger;
|
||||
import com.sdm.common.utils.HttpClientUtil;
|
||||
import com.sdm.system.dao.SimulationApproveMapper;
|
||||
import com.sdm.system.model.entity.ApproveTemplateBean;
|
||||
@@ -13,6 +15,7 @@ import com.sdm.system.service.ISimulatinoApprovalService;
|
||||
import com.sdm.system.service.impl.approvalNotice.ApproveNoticeStrategy;
|
||||
import com.sdm.system.service.impl.approvalNotice.ApproveNoticeStrategyFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -29,7 +32,6 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
@Autowired
|
||||
private HttpClientUtil httpClientUtil;
|
||||
|
||||
|
||||
@Autowired
|
||||
private SimulationApproveMapper approveMapper;
|
||||
|
||||
@@ -51,6 +53,13 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
@Value("${cid.flow.group}")
|
||||
private String groupName;
|
||||
|
||||
// 单次批量查询cid流程的条数,默认500
|
||||
@Value("${cid.flow.batchCount:500}")
|
||||
private Integer cidBatchCounts;
|
||||
|
||||
@Value("${cid.flow.batchInterfacePath:/spdm-flow/listFlowNodeDetail}")
|
||||
private String batchInterfacePath;
|
||||
|
||||
@Autowired
|
||||
private ApproveNoticeStrategyFactory approveNoticeStrategyFactory;
|
||||
|
||||
@@ -118,6 +127,37 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取Cid评审流程状态
|
||||
* @param url
|
||||
* @param flowParamDtoList
|
||||
* @return
|
||||
*/
|
||||
private JSONArray queryBatchCidApproveFlowStatus( String url,List<FlowStatusParam> flowParamDtoList)
|
||||
{
|
||||
JSONObject paramJson = new JSONObject();
|
||||
paramJson.put("flowParamDtoList",flowParamDtoList);
|
||||
JSONArray array = null;
|
||||
try {
|
||||
String resultString = httpClientUtil.doPostJson(url, paramJson.toJSONString());
|
||||
if (resultString != null && !resultString.isEmpty()) {
|
||||
JSONObject resultJson = JSONObject.parseObject(resultString);
|
||||
if (resultJson != null && resultJson.containsKey("success")) {
|
||||
boolean success = resultJson.getBoolean("success");
|
||||
if (success) {
|
||||
array = resultJson.getJSONArray("data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CoreLogger.error("queryBatchCidApproveFlowStatus error,params:{},errMsg:{}",JSONObject.toJSONString(flowParamDtoList),e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止CID评审流程
|
||||
* @param cidFlowId
|
||||
@@ -242,6 +282,30 @@ public class SimulationApproveServiceImpl implements ISimulatinoApprovalService
|
||||
return sdmResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse queryBatchApproveFlowStatus(List<String> flowIds) {
|
||||
SdmResponse sdmResponse ;
|
||||
if(CollectionUtils.isEmpty(flowIds)){
|
||||
sdmResponse= SdmResponse.failed("参数null非法");
|
||||
return sdmResponse;
|
||||
}
|
||||
if(flowIds.size()>cidBatchCounts){
|
||||
sdmResponse= SdmResponse.failed("单次查询数据不允许超过"+cidBatchCounts+"次");
|
||||
return sdmResponse;
|
||||
}
|
||||
List<FlowStatusParam> flowStatusParamList= approveMapper.queryBatchFlowStatusFromSpdmDb(flowIds);
|
||||
String url = cidUrl+batchInterfacePath;
|
||||
JSONArray array = queryBatchCidApproveFlowStatus(url, flowStatusParamList);
|
||||
if(array != null){
|
||||
sdmResponse = SdmResponse.success();
|
||||
sdmResponse.setData(array);
|
||||
}
|
||||
else{
|
||||
sdmResponse = SdmResponse.failed("获取评审流程状态信息失败");
|
||||
}
|
||||
return sdmResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收CID审批流状态
|
||||
* @param cidFlowId
|
||||
|
||||
@@ -158,4 +158,7 @@ cid:
|
||||
queryApproveDetail: /spdm-flow/queryFlowNodeDetail
|
||||
stopApproveFlow: /spdm-flow/stopFlow
|
||||
group: SPDM
|
||||
|
||||
# 单次批量查询cid审批流详情的条数
|
||||
batchCount: 500
|
||||
# 批量查询的cid 接口,配合上面url使用
|
||||
batchInterfacePath: /spdm-flow/listFlowNodeDetail
|
||||
|
||||
@@ -158,6 +158,10 @@ cid:
|
||||
queryApproveDetail: /spdm-flow/queryFlowNodeDetail
|
||||
stopApproveFlow: /spdm-flow/stopFlow
|
||||
group: SPDM
|
||||
# 单次批量查询cid审批流详情的条数
|
||||
batchCount: 500
|
||||
# 批量查询的cid 接口,配合上面url使用
|
||||
batchInterfacePath: /spdm-flow/listFlowNodeDetail
|
||||
|
||||
# 0单机处理,可以指向本地,1负载均衡轮询
|
||||
serverType: 0
|
||||
|
||||
@@ -169,4 +169,8 @@ cid:
|
||||
queryFlowTemplate: /spdm-flow/listProcessByGroup
|
||||
queryApproveDetail: /spdm-flow/queryFlowNodeDetail
|
||||
stopApproveFlow: /spdm-flow/stopFlow
|
||||
group: SPDM
|
||||
group: SPDM
|
||||
# 单次批量查询cid审批流详情的条数
|
||||
batchCount: 500
|
||||
# 批量查询的cid 接口,配合上面url使用
|
||||
batchInterfacePath: /spdm-flow/listFlowNodeDetail
|
||||
@@ -160,4 +160,9 @@ cid:
|
||||
listRoles: /spdm-role/listRoles
|
||||
tenant:
|
||||
getTenantDetailById: /spdm-tenant/getTenantDetailById
|
||||
listTenant: /spdm-tenant/listTenant
|
||||
listTenant: /spdm-tenant/listTenant
|
||||
flow:
|
||||
# 单次批量查询cid审批流详情的条数
|
||||
batchCount: 500
|
||||
# 批量查询的cid 接口,配合上面url使用
|
||||
batchInterfacePath: /spdm-flow/listFlowNodeDetail
|
||||
Reference in New Issue
Block a user