|
@@ -1,5 +1,6 @@
|
|
|
package org.springblade.business.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -20,13 +21,12 @@ 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;
|
|
|
-import org.springblade.manager.entity.ContractInfo;
|
|
|
-import org.springblade.manager.entity.SignPfxFile;
|
|
|
-import org.springblade.manager.entity.WbsTreeContract;
|
|
|
-import org.springblade.manager.entity.WbsTreePrivate;
|
|
|
+import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.feign.*;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.*;
|
|
@@ -58,6 +58,8 @@ public class EVisaTaskCheckController {
|
|
|
|
|
|
private final IFixedFlowService fixedFlowService;
|
|
|
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
/**
|
|
|
* 检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)
|
|
|
*/
|
|
@@ -71,19 +73,19 @@ public class EVisaTaskCheckController {
|
|
|
@ApiImplicitParam(name = "theLogPrimaryKeyId", value = "日志左侧所选的填报类型ID"),
|
|
|
@ApiImplicitParam(name = "firstId", value = "首件记录ID,列表批量上报时传任意一个即可")
|
|
|
})
|
|
|
- public R<Boolean> checkCustomFlowUserIsEVisaPermissions(@RequestBody JSONObject json){
|
|
|
- if(json.containsKey("customFlowUserList") && !json.getJSONArray("customFlowUserList").isEmpty()){
|
|
|
+ public R<Boolean> checkCustomFlowUserIsEVisaPermissions(@RequestBody JSONObject json) {
|
|
|
+ if (json.containsKey("customFlowUserList") && !json.getJSONArray("customFlowUserList").isEmpty()) {
|
|
|
//获取审批人
|
|
|
List<Long> customFlowUserList = json.getJSONArray("customFlowUserList").toJavaList(Long.class);
|
|
|
//获取这些审批人在当前合同段的权限
|
|
|
List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(customFlowUserList, json.getString("contractId"));
|
|
|
- if(userRoleList == null || userRoleList.size() <= 0){
|
|
|
+ if (userRoleList == null || userRoleList.size() <= 0) {
|
|
|
return R.data(300, false, "所选审批人均未找到当前表格所需要的签字岗位,请联系服务人员处理");
|
|
|
}
|
|
|
|
|
|
//获取电签配置
|
|
|
List<JSONObject> jsonList = this.queryTableEVisaConfig(json);
|
|
|
- if(jsonList == null){
|
|
|
+ if (jsonList == null) {
|
|
|
return R.data(300, false, "未找到符合电签配置的相关流程,请联系服务人员处理");
|
|
|
}
|
|
|
|
|
@@ -91,8 +93,8 @@ public class EVisaTaskCheckController {
|
|
|
List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
|
|
|
//检查
|
|
|
//循环审批人的角色集合,并判断电签配置中是否含有这个角色
|
|
|
- for(JSONObject userRole : userRoleList){
|
|
|
- if(!eVisaRoleList.contains(userRole.getString("roleId"))){
|
|
|
+ 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() + "】不具备当前表格所需要的签字岗位,请联系维护人员处理或更换审批人员");
|
|
|
}
|
|
@@ -116,7 +118,7 @@ public class EVisaTaskCheckController {
|
|
|
@ApiImplicitParam(name = "theLogPrimaryKeyId", value = "日志左侧所选的填报类型ID"),
|
|
|
@ApiImplicitParam(name = "firstId", value = "首件记录ID,列表批量上报时传任意一个即可")
|
|
|
})
|
|
|
- public R<IPage<FixedFlowVO>> queryFixedFlow(@RequestBody JSONObject json){
|
|
|
+ public R<IPage<FixedFlowVO>> queryFixedFlow(@RequestBody JSONObject json) {
|
|
|
//获取所有流程
|
|
|
FixedFlowVO vo = new FixedFlowVO();
|
|
|
vo.setCurrent(1);
|
|
@@ -130,7 +132,7 @@ public class EVisaTaskCheckController {
|
|
|
//获取对应表格的所有电签配置
|
|
|
List<JSONObject> jsonList = this.queryTableEVisaConfig(json);
|
|
|
|
|
|
- if(jsonList == null){
|
|
|
+ if (jsonList == null) {
|
|
|
return R.fail(300, "未找到符合电签配置的相关流程,请联系服务人员处理");
|
|
|
}
|
|
|
|
|
@@ -138,7 +140,7 @@ public class EVisaTaskCheckController {
|
|
|
List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
|
|
|
|
|
|
//校验这些预设流程哪些是符合条件的
|
|
|
- for(FixedFlowVO next : flowList){
|
|
|
+ for (FixedFlowVO next : flowList) {
|
|
|
//先将流程设置为可选
|
|
|
next.setDisabled(false);
|
|
|
|
|
@@ -147,14 +149,14 @@ public class EVisaTaskCheckController {
|
|
|
|
|
|
//获取这些人当前合同段下的权限
|
|
|
List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(flowLink.stream().map(FixedFlowLink::getFixedFlowLinkUser).distinct().collect(Collectors.toList()), json.getString("contractId"));
|
|
|
- if(userRoleList == null){
|
|
|
+ if (userRoleList == null) {
|
|
|
next.setDisabled(true);
|
|
|
} else {
|
|
|
//校验流程
|
|
|
- if(eVisaRoleList.size() >= userRoleList.size()){
|
|
|
+ if (eVisaRoleList.size() >= userRoleList.size()) {
|
|
|
//循环审批人的角色集合,并判断电签配置中是否含有这个角色
|
|
|
- for(JSONObject userRole : userRoleList){
|
|
|
- if(!eVisaRoleList.contains(userRole.getString("roleId"))){
|
|
|
+ for (JSONObject userRole : userRoleList) {
|
|
|
+ if (!eVisaRoleList.contains(userRole.getString("roleId"))) {
|
|
|
//但凡有个不符合条件,禁选
|
|
|
next.setDisabled(true);
|
|
|
break;
|
|
@@ -163,8 +165,8 @@ public class EVisaTaskCheckController {
|
|
|
} else {
|
|
|
//小于,反向判断
|
|
|
List<String> userRoleIds = userRoleList.stream().map(jsonObject -> jsonObject.getString("roleId")).distinct().collect(Collectors.toList());
|
|
|
- for(String eVisaRole : eVisaRoleList){
|
|
|
- if(!userRoleIds.contains(eVisaRole)){
|
|
|
+ for (String eVisaRole : eVisaRoleList) {
|
|
|
+ if (!userRoleIds.contains(eVisaRole)) {
|
|
|
//但凡有个不符合条件,禁选
|
|
|
next.setDisabled(true);
|
|
|
break;
|
|
@@ -186,18 +188,18 @@ public class EVisaTaskCheckController {
|
|
|
@GetMapping("/checkFlowUserIsExistPfxFile")
|
|
|
@ApiOperationSupport(order = 4)
|
|
|
@ApiOperation(value = "检查当前审批人是否存在证书")
|
|
|
- public R<Boolean> checkTaskUserIsExistPfxFile(){
|
|
|
+ public R<Boolean> checkTaskUserIsExistPfxFile() {
|
|
|
//获取当前审批人的证书
|
|
|
List<SignPfxFile> signPfxFiles = this.signPfxClient.querySignPfxByUserIdOrContractId(AuthUtil.getUserId().toString(), "");
|
|
|
- if(signPfxFiles != null && signPfxFiles.size() > 0){
|
|
|
+ if (signPfxFiles != null && signPfxFiles.size() > 0) {
|
|
|
SignPfxFile signPfxFile = signPfxFiles.get(0);
|
|
|
- if(StringUtils.isEmpty(signPfxFile.getCertificateFileUrl())){
|
|
|
+ if (StringUtils.isEmpty(signPfxFile.getCertificateFileUrl())) {
|
|
|
return R.data(300, false, "当前用户未配置签字证书,请联系维护人员处理");
|
|
|
}
|
|
|
- if(!new Integer("1").equals(signPfxFile.getIsRegister())){
|
|
|
+ if (!new Integer("1").equals(signPfxFile.getIsRegister())) {
|
|
|
return R.data(300, false, "当前用户的证书未注册,请联系维护人员处理");
|
|
|
}
|
|
|
- if(StringUtils.isEmpty(signPfxFile.getSignatureFileUrl())){
|
|
|
+ if (StringUtils.isEmpty(signPfxFile.getSignatureFileUrl())) {
|
|
|
return R.data(300, false, "当前用户未配置签字体,请联系维护人员处理");
|
|
|
}
|
|
|
return R.data(true);
|
|
@@ -216,8 +218,8 @@ public class EVisaTaskCheckController {
|
|
|
@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true),
|
|
|
@ApiImplicitParam(name = "queryIds", value = "资料查询列表中的记录ID,以数组的形式")
|
|
|
})
|
|
|
- public R<Boolean> batchCheckFlowUserIsEVisaPermissions(@RequestBody JSONObject json){
|
|
|
- if(json.containsKey("flowId")) {
|
|
|
+ public R<Boolean> batchCheckFlowUserIsEVisaPermissions(@RequestBody JSONObject json) {
|
|
|
+ if (json.containsKey("flowId")) {
|
|
|
//首先找到对应流程下的审批人组
|
|
|
List<FixedFlowLink> flowLink = this.fixedFlowLinkService.selectFixedFlowLink(json.getString("flowId"));
|
|
|
|
|
@@ -234,11 +236,11 @@ public class EVisaTaskCheckController {
|
|
|
//做一一对应处理
|
|
|
Map<String, InformationQuery> queryMap = new HashMap<>();
|
|
|
Map<String, WbsTreeContract> queryToNodeMap = new HashMap<>();
|
|
|
- for(InformationQuery query : queryList){
|
|
|
+ for (InformationQuery query : queryList) {
|
|
|
Iterator<WbsTreeContract> iterator = contractTreeList.iterator();
|
|
|
- while (iterator.hasNext()){
|
|
|
+ while (iterator.hasNext()) {
|
|
|
WbsTreeContract next = iterator.next();
|
|
|
- if(next.getPKeyId().equals(query.getWbsId())){
|
|
|
+ if (next.getPKeyId().equals(query.getWbsId())) {
|
|
|
queryToNodeMap.put(query.getId().toString(), next);
|
|
|
iterator.remove();
|
|
|
break;
|
|
@@ -248,12 +250,12 @@ public class EVisaTaskCheckController {
|
|
|
}
|
|
|
//循环判断
|
|
|
Set<String> keys = queryMap.keySet();
|
|
|
- for(String key : keys){
|
|
|
+ for (String key : keys) {
|
|
|
//获取记录
|
|
|
InformationQuery query = queryMap.get(key);
|
|
|
//获取节点
|
|
|
WbsTreeContract contractNode = queryToNodeMap.get(key);
|
|
|
- if(contractNode == null){
|
|
|
+ if (contractNode == null) {
|
|
|
//避免未找到对应的节点
|
|
|
contractNode = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(query.getWbsId());
|
|
|
}
|
|
@@ -265,7 +267,7 @@ public class EVisaTaskCheckController {
|
|
|
|
|
|
//获取这些表格的电签配置信息
|
|
|
List<JSONObject> jsonList = this.queryTableEVisaConfig(JSONArray.parseArray(JSONObject.toJSONString(privateTablePrimaryKeyIds), String.class));
|
|
|
- if(jsonList == null){
|
|
|
+ if (jsonList == null) {
|
|
|
return R.data(300, false, "所选资料【" + query.getName() + "】未找到电签配置,请联系维护人员处理或暂时取消这份资料的上报");
|
|
|
}
|
|
|
|
|
@@ -273,8 +275,8 @@ public class EVisaTaskCheckController {
|
|
|
List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
|
|
|
|
|
|
//循环审批人的角色集合,并判断电签配置中是否含有这个角色
|
|
|
- for(JSONObject userRole : userRoleList){
|
|
|
- if(!eVisaRoleList.contains(userRole.getString("roleId"))){
|
|
|
+ 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() + "】对于所选资料【" + query.getName() + "】不具有相关审批权限,请联系维护人员处理或更换审批流程");
|
|
|
}
|
|
@@ -300,8 +302,8 @@ public class EVisaTaskCheckController {
|
|
|
@ApiImplicitParam(name = "theLogPrimaryKeyId", value = "日志左侧所选的填报类型ID"),
|
|
|
@ApiImplicitParam(name = "firstId", value = "首件记录ID,列表批量上报时传任意一个即可")
|
|
|
})
|
|
|
- public R<Boolean> checkFlowUserIsEVisaPermissions(@RequestBody JSONObject json){
|
|
|
- if(json.containsKey("flowId")){
|
|
|
+ public R<Boolean> checkFlowUserIsEVisaPermissions(@RequestBody JSONObject json) {
|
|
|
+ if (json.containsKey("flowId")) {
|
|
|
//首先找到对应流程下的审批人组
|
|
|
List<FixedFlowLink> flowLink = this.fixedFlowLinkService.selectFixedFlowLink(json.getString("flowId"));
|
|
|
|
|
@@ -312,15 +314,15 @@ public class EVisaTaskCheckController {
|
|
|
//获取对应表格的所有电签配置
|
|
|
List<JSONObject> jsonList = this.queryTableEVisaConfig(json);
|
|
|
|
|
|
- if(jsonList == null){
|
|
|
+ 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"))){
|
|
|
+ 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() + "】不具有相关审批权限,请联系维护人员处理或更换审批流程");
|
|
|
}
|
|
@@ -335,16 +337,16 @@ public class EVisaTaskCheckController {
|
|
|
/**
|
|
|
* 获取表格的电签配置
|
|
|
*/
|
|
|
- private List<JSONObject> queryTableEVisaConfig(JSONObject json){
|
|
|
+ private List<JSONObject> queryTableEVisaConfig(JSONObject json) {
|
|
|
List<JSONObject> jsonList;
|
|
|
- if(json.containsKey("theLogPrimaryKeyId") && StringUtils.isNotEmpty(json.getString("theLogPrimaryKeyId"))){
|
|
|
+ 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"))){
|
|
|
+ } else if (json.containsKey("firstId") && StringUtils.isNotEmpty(json.getString("firstId"))) {
|
|
|
//首件,先获取记录
|
|
|
InformationQuery query = this.informationQueryService.getById(json.getLong("firstId"));
|
|
|
- if(query != null){
|
|
|
+ if (query != null) {
|
|
|
jsonList = this.queryTableEVisaConfig(Func.toStrList(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(query.getTableId()).getIsTypePrivatePid().toString()));
|
|
|
} else {
|
|
|
jsonList = null;
|
|
@@ -352,7 +354,12 @@ public class EVisaTaskCheckController {
|
|
|
|
|
|
} else {
|
|
|
//资料填报
|
|
|
- jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
|
|
|
+ //jsonList = this.eVisaConfigClient.queryEVisaConfigAllByTableIds(json.getJSONArray("privatePKeyId").toJavaList(String.class));
|
|
|
+
|
|
|
+ List<String> ids = json.getJSONArray("privatePKeyId").toJavaList(String.class);
|
|
|
+ String sql = "select * from m_textdict_info where tab_id in(" + StringUtils.join(ids, ",") + ")";
|
|
|
+ List<TextdictInfo> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TextdictInfo.class));
|
|
|
+ jsonList = JSONArray.parseArray(JSONObject.toJSONString(query), JSONObject.class);
|
|
|
}
|
|
|
return jsonList;
|
|
|
}
|
|
@@ -360,11 +367,11 @@ public class EVisaTaskCheckController {
|
|
|
/**
|
|
|
* 获取表格的电签配置
|
|
|
*/
|
|
|
- private List<JSONObject> queryTableEVisaConfig(List<String> primaryKeyIds){
|
|
|
+ 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){
|
|
|
+ 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 {
|
|
@@ -381,9 +388,9 @@ public class EVisaTaskCheckController {
|
|
|
@GetMapping("/checkContractIsOpenEVisa")
|
|
|
@ApiOperation(value = "检查当前合同段是否开启电签")
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
- public R<Boolean> checkContractIsOpenEVisa(@RequestParam String contractId){
|
|
|
+ public R<Boolean> checkContractIsOpenEVisa(@RequestParam String contractId) {
|
|
|
ContractInfo contract = this.contractClient.getContractById(Func.toLong(contractId));
|
|
|
- if(contract != null){
|
|
|
+ if (contract != null) {
|
|
|
boolean isOpen = new Integer("1").equals(contract.getIsElectronicSignature());
|
|
|
return R.data(isOpen, isOpen ? "当前合同段已经开启电签" : "当前合同段未开启电签,不允许上报,请联系维护人员处理");
|
|
|
}
|