Prechádzať zdrojové kódy

任务优化+计量资金预算期 逻辑删除

zhuwei 18 hodín pred
rodič
commit
b2c98f3112

+ 54 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/FixedFlowInfoVO.java

@@ -0,0 +1,54 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.business.entity.FixedFlow;
+import org.springblade.business.entity.FixedFlowLink;
+import org.springblade.core.mp.support.Query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-07-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FixedFlowInfoVO extends FixedFlow {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("环节处理人姓名及ID,拼接格式为:环节处理人姓名-环节处理人ID(英文逗号)环节处理人姓名-环节处理人ID")
+    private String linkUserJoinString;
+
+    private String linkUserIds;
+
+    @ApiModelProperty("是否可选")
+    private boolean disabled;
+
+    @ApiModelProperty("提示信息")
+    private String tips;
+
+    @ApiModelProperty("是否删除")
+    private boolean deletedIs;
+
+}

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsNodeTableVO.java

@@ -105,4 +105,8 @@ public class WbsNodeTableVO implements Serializable {
 
     @ApiModelProperty(value = "是否默认隐藏,0:否,1:是")
     private Integer defaultConceal;
+
+    @ApiModelProperty("是否隐藏:1显示 其他 代表隐藏")
+    private Integer isBussShow;
+
 }

+ 90 - 3
blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java

@@ -21,12 +21,14 @@ import org.springblade.business.service.IFixedFlowLinkService;
 import org.springblade.business.service.IFixedFlowService;
 import org.springblade.business.service.IInformationQueryService;
 import org.springblade.business.utils.PDFUtil;
+import org.springblade.business.vo.FixedFlowInfoVO;
 import org.springblade.business.vo.FixedFlowVO;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.feign.*;
 import org.springblade.manager.vo.ExecutionTime;
@@ -38,7 +40,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @RestController
 @AllArgsConstructor
@@ -340,9 +344,9 @@ public class EVisaTaskCheckController {
             @ApiImplicitParam(name = "theLogPrimaryKeyId", 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();
-        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");
         if (StringUtils.isBlank(tableOwner)) {
@@ -368,8 +372,91 @@ public class EVisaTaskCheckController {
         if (jsonList == null || jsonList.size() == 0) {
             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);
     }
 

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/FixedFlowMapper.java

@@ -2,6 +2,7 @@ package org.springblade.business.mapper;
 
 import org.apache.ibatis.annotations.Param;
 import org.springblade.business.entity.FixedFlow;
+import org.springblade.business.vo.FixedFlowInfoVO;
 import org.springblade.business.vo.FixedFlowVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -22,6 +23,6 @@ public interface FixedFlowMapper extends BaseMapper<FixedFlow> {
      */
     List<FixedFlow> selectFixedFlowPage(@Param("current") Long current, @Param("size") Integer size, @Param("vo") FixedFlowVO vo);
 
-    List<FixedFlowVO> getFixedFlowList(@Param("contractId") Long contractId, @Param("projectId") Long projectId);
+    List<FixedFlowInfoVO> getFixedFlowList(@Param("contractId") Long contractId, @Param("projectId") Long projectId);
 
 }

+ 2 - 2
blade-service/blade-business/src/main/java/org/springblade/business/mapper/FixedFlowMapper.xml

@@ -39,9 +39,9 @@
         order by sort ASC limit ${current}, ${size}
     </select>
 
-    <select id="getFixedFlowList" resultType="org.springblade.business.vo.FixedFlowVO">
+    <select id="getFixedFlowList" resultType="org.springblade.business.vo.FixedFlowInfoVO">
         select a.*,
-               (select  group_concat(fixed_flow_link_user_name) from u_fixed_flow_link where is_deleted = 0 and fixed_flow_id =a.id GROUP BY fixed_flow_id order by fixed_flow_link_sort ASC) as linkUserJoinString,
+               (select  group_concat(fixed_flow_link_user) from u_fixed_flow_link where is_deleted = 0 and fixed_flow_id =a.id GROUP BY fixed_flow_id order by fixed_flow_link_sort ASC) as linkUserIds,
                (SELECT COUNT(*)>1 FROM u_task WHERE fixed_flow_id = a.id AND is_deleted = 0 And status !=3) as deletedIs
         from u_fixed_flow a where a.is_deleted = 0 AND ( a.is_meter != 1 OR a.is_meter IS NULL )
           and project_id = #{projectId}

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/IFixedFlowService.java

@@ -1,6 +1,7 @@
 package org.springblade.business.service;
 
 import org.springblade.business.entity.FixedFlow;
+import org.springblade.business.vo.FixedFlowInfoVO;
 import org.springblade.business.vo.FixedFlowVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -20,5 +21,5 @@ public interface IFixedFlowService extends BaseService<FixedFlow> {
      */
     IPage<FixedFlowVO> selectFixedFlowPage(FixedFlowVO vo);
 
-    List<FixedFlowVO> getFixedFlowList(Long contractId, Long projectId);
+    List<FixedFlowInfoVO> getFixedFlowList(Long contractId, Long projectId);
 }

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/FixedFlowServiceImpl.java

@@ -22,6 +22,7 @@ import lombok.AllArgsConstructor;
 import org.springblade.business.entity.FixedFlow;
 import org.springblade.business.entity.FixedFlowLink;
 import org.springblade.business.service.IFixedFlowLinkService;
+import org.springblade.business.vo.FixedFlowInfoVO;
 import org.springblade.business.vo.FixedFlowVO;
 import org.springblade.business.mapper.FixedFlowMapper;
 import org.springblade.business.service.IFixedFlowService;
@@ -79,7 +80,7 @@ public class FixedFlowServiceImpl extends BaseServiceImpl<FixedFlowMapper, Fixed
     }
 
     @Override
-    public List<FixedFlowVO> getFixedFlowList(Long contractId, Long projectId) {
+    public List<FixedFlowInfoVO> getFixedFlowList(Long contractId, Long projectId) {
         return  this.baseMapper.getFixedFlowList(contractId, projectId);
     }
 

+ 1 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.xml

@@ -515,6 +515,7 @@
                wt.id                                                                                AS id,
                wt.wbs_type                                                                          AS wbsType,
                wt.node_name                                                                         AS tableName,
+               wt.is_buss_show                                                                      AS isBussShow,
                IFNULL(if(length(trim(wt.full_name)) > 0, wt.full_name, wt.node_name), wt.node_name) AS fullName,
                case
                    when wt.table_type in (1, 9) then 1

+ 4 - 4
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/FormPeriodMapper.xml

@@ -2,11 +2,11 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.springblade.meter.mapper.FormPeriodMapper">
     <delete id="removeByContractId">
-        delete from s_form_period where contract_id = #{contractId}
-    </delete>
-    <delete id="removeById">
-        delete from s_form_period where id = #{id}
+        delete from s_form_period where contract_id = #{contractId} and is_deleted = 0
     </delete>
+    <update id="removeById">
+        update s_form_period set is_deleted = 1 where id = #{id}
+    </update>
 
 
     <select id="periodPage" resultType="org.springblade.meter.vo.FormPeriodVO">

+ 1 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/FormPeriodServiceImpl.java

@@ -98,6 +98,7 @@ public class FormPeriodServiceImpl extends BaseServiceImpl<FormPeriodMapper, For
                 throw new ServiceException("删除失败:当前资金预算期已经被引用");
             }
             baseMapper.removeById(formPeriodId);
+
         }
     }
 }