|
@@ -0,0 +1,106 @@
|
|
|
+package org.springblade.business.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springblade.business.entity.FixedFlowLink;
|
|
|
+import org.springblade.business.service.IFixedFlowLinkService;
|
|
|
+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.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/eVisaTaskCheck")
|
|
|
+@Api(value = "所有上报前的相关检查接口", tags = "所有上报前的相关检查接口")
|
|
|
+public class EVisaTaskCheckController {
|
|
|
+
|
|
|
+ private final ContractClient contractClient;
|
|
|
+
|
|
|
+ private final IFixedFlowLinkService fixedFlowLinkService;
|
|
|
+
|
|
|
+ private final EVisaConfigClient eVisaConfigClient;
|
|
|
+
|
|
|
+ private final SignPfxClient signPfxClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查当前审批人是否存在证书
|
|
|
+ */
|
|
|
+ @GetMapping("/checkFlowUserIsExistPfxFile")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "检查当前审批人是否存在证书")
|
|
|
+ public R<Boolean> checkTaskUserIsExistPfxFile(){
|
|
|
+ //获取当前审批人的证书
|
|
|
+ List<SignPfxFile> signPfxFiles = this.signPfxClient.querySignPfxByUserIdOrContractId(AuthUtil.getUserId().toString(), "");
|
|
|
+ if(signPfxFiles != null && signPfxFiles.size() > 0){
|
|
|
+ SignPfxFile signPfxFile = signPfxFiles.get(0);
|
|
|
+ if(StringUtils.isEmpty(signPfxFile.getCertificateFileUrl())){
|
|
|
+ return R.data(300, false, "当前用户未配置签字证书,请联系维护人员处理");
|
|
|
+ }
|
|
|
+ if(!new Integer("1").equals(signPfxFile.getIsRegister())){
|
|
|
+ return R.data(300, false, "当前用户的证书未注册,请联系维护人员处理");
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(signPfxFile.getSignatureFileUrl())){
|
|
|
+ return R.data(300, false, "当前用户未配置签字体,请联系维护人员处理");
|
|
|
+ }
|
|
|
+ return R.data(true);
|
|
|
+ }
|
|
|
+ return R.data(300, false, "当前用户未找到签字证书,请联系维护人员处理");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查所选的流程环节处理人是否具有审批权限
|
|
|
+ */
|
|
|
+ @PostMapping("/checkFlowUserIsEVisaPermissions")
|
|
|
+ @ApiOperation(value = "检查当前合同段是否开启电签")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "flowId", value = "所选的流程ID", required = true),
|
|
|
+ @ApiImplicitParam(name = "privatePKeyId", value = "表单列表中的isTypePrivatePid字段,集合形式", required = true)
|
|
|
+ })
|
|
|
+ public R<Boolean> checkFlowUserIsEVisaPermissions(@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> jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查当前合同段是否开启电签
|
|
|
+ */
|
|
|
+ @GetMapping("/checkContractIsOpenEVisa")
|
|
|
+ @ApiOperation(value = "检查当前合同段是否开启电签")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ public R<Boolean> checkContractIsOpenEVisa(@RequestParam String contractId){
|
|
|
+ ContractInfo contract = this.contractClient.getContractById(Func.toLong(contractId));
|
|
|
+ if(contract != null){
|
|
|
+ boolean isOpen = new Integer("1").equals(contract.getIsElectronicSignature());
|
|
|
+ return R.data(isOpen, isOpen ? "当前合同段已经开启电签" : "当前合同段未开启电签,不允许上报,请联系维护人员处理");
|
|
|
+ }
|
|
|
+ return R.data(300, false, "未找到对应合同段");
|
|
|
+ }
|
|
|
+
|
|
|
+}
|