|
@@ -21,12 +21,14 @@ import org.springblade.business.service.IFixedFlowLinkService;
|
|
|
import org.springblade.business.service.IFixedFlowService;
|
|
import org.springblade.business.service.IFixedFlowService;
|
|
|
import org.springblade.business.service.IInformationQueryService;
|
|
import org.springblade.business.service.IInformationQueryService;
|
|
|
import org.springblade.business.utils.PDFUtil;
|
|
import org.springblade.business.utils.PDFUtil;
|
|
|
|
|
+import org.springblade.business.vo.FixedFlowInfoVO;
|
|
|
import org.springblade.business.vo.FixedFlowVO;
|
|
import org.springblade.business.vo.FixedFlowVO;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
|
|
+import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.feign.*;
|
|
import org.springblade.manager.feign.*;
|
|
|
import org.springblade.manager.vo.ExecutionTime;
|
|
import org.springblade.manager.vo.ExecutionTime;
|
|
@@ -38,7 +40,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
@@ -340,9 +344,9 @@ public class EVisaTaskCheckController {
|
|
|
@ApiImplicitParam(name = "theLogPrimaryKeyId", value = "日志左侧所选的填报类型ID"),
|
|
@ApiImplicitParam(name = "theLogPrimaryKeyId", value = "日志左侧所选的填报类型ID"),
|
|
|
@ApiImplicitParam(name = "firstId", value = "首件记录ID,列表批量上报时传任意一个即可")
|
|
@ApiImplicitParam(name = "firstId", value = "首件记录ID,列表批量上报时传任意一个即可")
|
|
|
})
|
|
})
|
|
|
- public R<List<FixedFlowVO>> queryFixedFlow(@RequestBody JSONObject json) {
|
|
|
|
|
|
|
+ public R<List<FixedFlowInfoVO>> queryFixedFlow(@RequestBody JSONObject json) {
|
|
|
ExecutionTime executionTime = new ExecutionTime();
|
|
ExecutionTime executionTime = new ExecutionTime();
|
|
|
- List<FixedFlowVO> flowList = this.fixedFlowService.getFixedFlowList(json.getLong("contractId"), json.getLong("projectId"));
|
|
|
|
|
|
|
+ List<FixedFlowInfoVO> flowList = this.fixedFlowService.getFixedFlowList(json.getLong("contractId"), json.getLong("projectId"));
|
|
|
//获取对应表格的所有电签配置
|
|
//获取对应表格的所有电签配置
|
|
|
String tableOwner = json.getString("tableOwner");
|
|
String tableOwner = json.getString("tableOwner");
|
|
|
if (StringUtils.isBlank(tableOwner)) {
|
|
if (StringUtils.isBlank(tableOwner)) {
|
|
@@ -368,8 +372,91 @@ public class EVisaTaskCheckController {
|
|
|
if (jsonList == null || jsonList.size() == 0) {
|
|
if (jsonList == null || jsonList.size() == 0) {
|
|
|
return R.fail(300, "未找到符合电签配置的相关流程,请重新保存再上报");
|
|
return R.fail(300, "未找到符合电签配置的相关流程,请重新保存再上报");
|
|
|
}
|
|
}
|
|
|
|
|
+ //汇总电签配置的审批角色
|
|
|
|
|
+ List<String> eVisaRoleList = jsonList.stream().map(jsonObject -> jsonObject.getString("sigRoleId")).distinct().collect(Collectors.toList());
|
|
|
|
|
+ List<User> users = userClient.selectUserAll();
|
|
|
|
|
+ if (ObjectUtil.isEmpty(users)){
|
|
|
|
|
+ return R.fail(300, "未获取到当前项目用户信息");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- executionTime.info("d第一阶段结束");
|
|
|
|
|
|
|
+ Map<Long, User> userNamesMap = users.stream().collect(Collectors.toMap(User::getId,Function.identity(),
|
|
|
|
|
+ (v1, v2) -> v1 // 冲突时保留第一个值
|
|
|
|
|
+ ));
|
|
|
|
|
+
|
|
|
|
|
+ List<Long> userIds = users.stream().map(l -> l.getId()).collect(Collectors.toList());
|
|
|
|
|
+ executionTime.info("122222");
|
|
|
|
|
+ List<SaveUserInfoByProjectDTO> userRoleInfo = jdbcTemplate.query("SELECT project_id as projectId,contract_id as contractId,user_id as userId,role_id as roleId from m_project_assignment_user where is_deleted=0 ", new BeanPropertyRowMapper<>(SaveUserInfoByProjectDTO.class));
|
|
|
|
|
+ executionTime.info("3333333");
|
|
|
|
|
+ for (FixedFlowInfoVO flow : flowList){
|
|
|
|
|
+ //先将流程设置为可选
|
|
|
|
|
+ executionTime.info("1");
|
|
|
|
|
+ flow.setDisabled(false);
|
|
|
|
|
+ List<Long> ids = Func.toLongList(flow.getLinkUserIds());
|
|
|
|
|
+ Set<Long> flowUser = new HashSet<>(ids);
|
|
|
|
|
+ flowUser.removeAll(userIds);
|
|
|
|
|
+ if (flowUser.size() > 0){
|
|
|
|
|
+ flow.setDisabled(true);
|
|
|
|
|
+ List<String> names = new ArrayList<>();
|
|
|
|
|
+ for (Long id : flowUser) {
|
|
|
|
|
+ names.add(userNamesMap.get(id).getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ flow.setTips("以下用户账号已经删除:"+String.join(",",names));
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 为流程设置用户名称
|
|
|
|
|
+ List<String> taskUserNames = new ArrayList<>();
|
|
|
|
|
+ for( Long id: ids) {
|
|
|
|
|
+ taskUserNames.add(userNamesMap.get(id).getName()) ;
|
|
|
|
|
+ }
|
|
|
|
|
+ flow.setLinkUserJoinString(String.join(",",taskUserNames));
|
|
|
|
|
+ //获取这些人资料合同段下的权限
|
|
|
|
|
+ executionTime.info("2");
|
|
|
|
|
+
|
|
|
|
|
+ //&& user.getContractId().equals(finalContractId) ids.contains(user.getUserId())
|
|
|
|
|
+ String finalContractId = contractId+"";
|
|
|
|
|
+ List<SaveUserInfoByProjectDTO> userRoleList =userRoleInfo.stream().filter(user -> flow.getLinkUserIds().indexOf((user.getUserId()+""))>=0 && (user.getContractId()+"").equals(finalContractId) ).collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ executionTime.info("3");
|
|
|
|
|
+ if (userRoleList == null || userRoleList.size() <= 0) {
|
|
|
|
|
+ executionTime.info("4");
|
|
|
|
|
+ //查看当前项目下是否有监理合同段关联此合同段
|
|
|
|
|
+ String sql = "SELECT id from m_contract_info mci WHERE contract_type = 2 and id in (SELECT contract_id_jlyz FROM m_contract_relation_jlyz WHERE contract_id_sg = " + node.getContractId() + ")";
|
|
|
|
|
+ ContractInfo contractInfo = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
|
|
+ if (contractInfo != null) {
|
|
|
|
|
+ // userRoleList = userRoleInfo.stream().filter(user -> ids.contains(user.getUserId()) && user.getContractId().equals(contractInfo.getId()+"")).collect(Collectors.toList());
|
|
|
|
|
+ userRoleList =userRoleInfo.stream().filter(user -> flow.getLinkUserIds().indexOf((user.getUserId()+""))>=0 && (user.getContractId()+"").equals(contractInfo.getId()+"") ).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+ executionTime.info("5");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (userRoleList == null) {
|
|
|
|
|
+ flow.setDisabled(true);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //校验流程
|
|
|
|
|
+ //循环审批人的角色集合,并判断电签配置中是否含有这个角色
|
|
|
|
|
+ executionTime.info("6");
|
|
|
|
|
+ for (SaveUserInfoByProjectDTO userRole : userRoleList) {
|
|
|
|
|
+ if (!eVisaRoleList.contains(userRole.getRoleId())) {
|
|
|
|
|
+ //但凡有个不符合条件,禁选
|
|
|
|
|
+ flow.setDisabled(true);
|
|
|
|
|
+ //设置提示信息
|
|
|
|
|
+ String name="";
|
|
|
|
|
+ executionTime.info("11");
|
|
|
|
|
+ User userInfo = userNamesMap.get(userRole.getUserId());
|
|
|
|
|
+ executionTime.info("12");
|
|
|
|
|
+ if(userInfo!=null ){
|
|
|
|
|
+ name = userInfo.getName();
|
|
|
|
|
+ flow.setTips(name + "没有电签权限,请检查电签配置或查看表单是否隐藏");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ name = userRole.getUserId();
|
|
|
|
|
+ flow.setTips(name + "该用户不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ executionTime.info("7");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return R.data(flowList);
|
|
return R.data(flowList);
|
|
|
}
|
|
}
|
|
|
|
|
|