|
@@ -2,6 +2,7 @@ package org.springblade.business.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -13,7 +14,9 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.springblade.business.entity.FixedFlowLink;
|
|
|
import org.springblade.business.entity.InformationQuery;
|
|
|
import org.springblade.business.service.IFixedFlowLinkService;
|
|
|
+import org.springblade.business.service.IFixedFlowService;
|
|
|
import org.springblade.business.service.IInformationQueryService;
|
|
|
+import org.springblade.business.vo.FixedFlowVO;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
@@ -53,6 +56,72 @@ public class EVisaTaskCheckController {
|
|
|
|
|
|
private final IInformationQueryService informationQueryService;
|
|
|
|
|
|
+ private final IFixedFlowService fixedFlowService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取符合条件的预设流程(三大填报页、日志列表的批量上报、首件列表的批量上报)
|
|
|
+ */
|
|
|
+ @PostMapping("/queryFixedFlow")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "获取符合条件的预设流程(三大填报页、日志列表的批量上报、首件列表的批量上报)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "flowId", value = "所选的流程ID", required = true),
|
|
|
+ @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true),
|
|
|
+ @ApiImplicitParam(name = "privatePKeyId", value = "表单列表中的isTypePrivatePid字段,集合形式"),
|
|
|
+ @ApiImplicitParam(name = "theLogPrimaryKeyId", value = "日志左侧所选的填报类型ID"),
|
|
|
+ @ApiImplicitParam(name = "firstId", value = "首件记录ID,列表批量上报时传任意一个即可")
|
|
|
+ })
|
|
|
+ public R<IPage<FixedFlowVO>> queryFixedFlow(@RequestBody JSONObject json){
|
|
|
+ //获取所有流程
|
|
|
+ FixedFlowVO vo = new FixedFlowVO();
|
|
|
+ vo.setCurrent(1);
|
|
|
+ vo.setSize(100);
|
|
|
+ vo.setContractId(json.getLong("contractId"));
|
|
|
+
|
|
|
+ IPage<FixedFlowVO> flowPage = this.fixedFlowService.selectFixedFlowPage(vo);
|
|
|
+ List<FixedFlowVO> flowList = flowPage.getRecords();
|
|
|
+
|
|
|
+ //获取对应表格的所有电签配置
|
|
|
+ List<JSONObject> jsonList = this.queryTableEVisaConfig(json);
|
|
|
+
|
|
|
+ if(jsonList == null){
|
|
|
+ return R.data(300, null, "未找到符合电签配置的相关流程,请联系服务人员处理");
|
|
|
+ }
|
|
|
+
|
|
|
+ //汇总电签配置的审批角色
|
|
|
+ List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ //校验这些预设流程哪些是符合条件的
|
|
|
+ for(FixedFlowVO next : flowList){
|
|
|
+ //先将流程设置为可选
|
|
|
+ next.setDisabled(true);
|
|
|
+
|
|
|
+ //首先找到对应流程下的审批人组
|
|
|
+ List<FixedFlowLink> flowLink = this.fixedFlowLinkService.selectFixedFlowLink(next.getId().toString());
|
|
|
+
|
|
|
+ //获取这些人当前合同段下的权限
|
|
|
+ List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList()), json.getString("contractId"));
|
|
|
+ if(userRoleList == null){
|
|
|
+ next.setDisabled(false);
|
|
|
+ } else {
|
|
|
+ //校验流程
|
|
|
+ //循环审批人的角色集合,并判断电签配置中是否含有这个角色
|
|
|
+ for(JSONObject userRole : userRoleList){
|
|
|
+ if(!eVisaRoleList.contains(userRole.getString("roleId"))){
|
|
|
+ //但凡有个不符合条件,删除
|
|
|
+ next.setDisabled(false);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //设置流程
|
|
|
+ flowPage.setRecords(flowList);
|
|
|
+
|
|
|
+ return R.data(flowPage);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 检查当前审批人是否存在证书
|
|
|
*/
|
|
@@ -183,24 +252,7 @@ public class EVisaTaskCheckController {
|
|
|
List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(linkUserList, json.getString("contractId"));
|
|
|
|
|
|
//获取对应表格的所有电签配置
|
|
|
- List<JSONObject> jsonList;
|
|
|
- if(json.containsKey("theLogPrimaryKeyId") && StringUtils.isNotEmpty(json.getString("theLogPrimaryKeyId"))){
|
|
|
- //日志,需要先获取对应的表格
|
|
|
- jsonList = this.queryTableEVisaConfig(Func.toStrList(json.getString("theLogPrimaryKeyId")));
|
|
|
-
|
|
|
- } else if(json.containsKey("firstId") && StringUtils.isNotEmpty(json.getString("firstId"))){
|
|
|
- //首件,先获取记录
|
|
|
- InformationQuery query = this.informationQueryService.getById(json.getLong("firstId"));
|
|
|
- if(query != null){
|
|
|
- jsonList = this.queryTableEVisaConfig(Func.toStrList(query.getTableId()));
|
|
|
- } else {
|
|
|
- jsonList = null;
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- //资料填报
|
|
|
- jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
|
|
|
- }
|
|
|
+ List<JSONObject> jsonList = this.queryTableEVisaConfig(json);
|
|
|
|
|
|
if(jsonList == null){
|
|
|
return R.data(300, false, "当前表格均未配置电签关键字,请联系维护人员处理");
|
|
@@ -222,6 +274,31 @@ public class EVisaTaskCheckController {
|
|
|
return R.data(300, false, "未找到对应流程,请重新选择");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取表格的电签配置
|
|
|
+ */
|
|
|
+ private List<JSONObject> queryTableEVisaConfig(JSONObject json){
|
|
|
+ List<JSONObject> jsonList;
|
|
|
+ if(json.containsKey("theLogPrimaryKeyId") && StringUtils.isNotEmpty(json.getString("theLogPrimaryKeyId"))){
|
|
|
+ //日志,需要先获取对应的表格
|
|
|
+ jsonList = this.queryTableEVisaConfig(Func.toStrList(json.getString("theLogPrimaryKeyId")));
|
|
|
+
|
|
|
+ } else if(json.containsKey("firstId") && StringUtils.isNotEmpty(json.getString("firstId"))){
|
|
|
+ //首件,先获取记录
|
|
|
+ InformationQuery query = this.informationQueryService.getById(json.getLong("firstId"));
|
|
|
+ if(query != null){
|
|
|
+ jsonList = this.queryTableEVisaConfig(Func.toStrList(query.getTableId()));
|
|
|
+ } else {
|
|
|
+ jsonList = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //资料填报
|
|
|
+ jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
|
|
|
+ }
|
|
|
+ return jsonList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取表格的电签配置
|
|
|
*/
|