|
@@ -1,5 +1,6 @@
|
|
|
package org.springblade.business.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -9,15 +10,18 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
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.IInformationQueryService;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
|
import org.springblade.manager.entity.SignPfxFile;
|
|
|
-import org.springblade.manager.feign.ContractClient;
|
|
|
-import org.springblade.manager.feign.EVisaConfigClient;
|
|
|
-import org.springblade.manager.feign.SignPfxClient;
|
|
|
+import org.springblade.manager.entity.WbsTreePrivate;
|
|
|
+import org.springblade.manager.feign.*;
|
|
|
+import org.springblade.system.user.entity.User;
|
|
|
+import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -37,11 +41,19 @@ public class EVisaTaskCheckController {
|
|
|
|
|
|
private final SignPfxClient signPfxClient;
|
|
|
|
|
|
+ private final SaveUserInfoByProjectClient saveUserInfoByProjectClient;
|
|
|
+
|
|
|
+ private final WbsTreePrivateClient wbsTreePrivateClient;
|
|
|
+
|
|
|
+ private final IUserClient userClient;
|
|
|
+
|
|
|
+ private final IInformationQueryService informationQueryService;
|
|
|
+
|
|
|
/**
|
|
|
* 检查当前审批人是否存在证书
|
|
|
*/
|
|
|
@GetMapping("/checkFlowUserIsExistPfxFile")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
@ApiOperation(value = "检查当前审批人是否存在证书")
|
|
|
public R<Boolean> checkTaskUserIsExistPfxFile(){
|
|
|
//获取当前审批人的证书
|
|
@@ -63,14 +75,46 @@ public class EVisaTaskCheckController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 检查所选的流程环节处理人是否具有审批权限
|
|
|
+ * 检查所选的流程环节处理人是否具有审批权限(资料查询批量上报)
|
|
|
+ */
|
|
|
+ @PostMapping("/batchCheckFlowUserIsEVisaPermissions")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "检查所选的流程环节处理人是否具有审批权限(资料查询批量上报)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "flowId", value = "所选的流程ID", required = true),
|
|
|
+ @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true),
|
|
|
+ @ApiImplicitParam(name = "queryIds", value = "资料查询列表中的记录ID,以数组的形式")
|
|
|
+ })
|
|
|
+ public R<Boolean> batchCheckFlowUserIsEVisaPermissions(@RequestBody JSONObject json){
|
|
|
+ if(json.containsKey("flowId")) {
|
|
|
+ //首先找到对应流程下的审批人组
|
|
|
+ List<FixedFlowLink> flowLink = this.fixedFlowLinkService.selectFixedFlowLink(json.getString("flowId"));
|
|
|
+
|
|
|
+ //获取这些人当前合同段下的权限
|
|
|
+ List<Long> linkUserList = flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList());
|
|
|
+ List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(linkUserList, json.getString("contractId"));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return R.data(300, false, "未找到流程");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)
|
|
|
*/
|
|
|
@PostMapping("/checkFlowUserIsEVisaPermissions")
|
|
|
- @ApiOperation(value = "检查当前合同段是否开启电签")
|
|
|
+ @ApiOperation(value = "检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "flowId", value = "所选的流程ID", required = true),
|
|
|
- @ApiImplicitParam(name = "privatePKeyId", value = "表单列表中的isTypePrivatePid字段,集合形式", 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<Boolean> checkFlowUserIsEVisaPermissions(@RequestBody JSONObject json){
|
|
|
if(json.containsKey("flowId")){
|
|
@@ -79,13 +123,62 @@ public class EVisaTaskCheckController {
|
|
|
|
|
|
//获取这些人当前合同段下的权限
|
|
|
List<Long> linkUserList = flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList());
|
|
|
+ List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(linkUserList, json.getString("contractId"));
|
|
|
|
|
|
//获取对应表格的所有电签配置
|
|
|
- List<JSONObject> jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(jsonList == null){
|
|
|
+ return R.data(300, false, "当前表格均未配置电签关键字,请联系维护人员处理");
|
|
|
+ }
|
|
|
+ //汇总电签配置的审批角色
|
|
|
+ List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ //循环审批人的角色集合,并判断电签配置中是否含有这个角色
|
|
|
+ for(JSONObject userRole : userRoleList){
|
|
|
+ if(!eVisaRoleList.contains(userRole.getString("roleId"))){
|
|
|
+ User user = this.userClient.userInfoById(userRole.getLong("userId")).getData();
|
|
|
+ return R.data(300, false, "所选流程中的用户【" + user.getRealName() + "】不具有相关审批角色,请联系维护人员处理或更换审批流程");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(200, true, "满足上报条件");
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(300, false, "未找到对应流程,请重新选择");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取表格的电签配置
|
|
|
+ */
|
|
|
+ private List<JSONObject> queryTableEVisaConfig(List<String> primaryKeyIds){
|
|
|
+ List<JSONObject> jsonList;
|
|
|
|
|
|
+ List<WbsTreePrivate> privateTreeList = this.wbsTreePrivateClient.queryExcelTableByParentId(this.wbsTreePrivateClient.queryByPKeyIds(primaryKeyIds).get(0));
|
|
|
+ if(privateTreeList != null && privateTreeList.size() > 0){
|
|
|
+ List<Long> pKeyList = privateTreeList.stream().map(WbsTreePrivate::getPKeyId).distinct().collect(Collectors.toList());
|
|
|
+ jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(JSONArray.parseArray(JSONObject.toJSONString(pKeyList), String.class));
|
|
|
+ } else {
|
|
|
+ jsonList = null;
|
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
+ return jsonList;
|
|
|
}
|
|
|
|
|
|
/**
|