浏览代码

日志签字状态,质检资料查询预览问题

DengLinLang 3 周之前
父节点
当前提交
456fe4d968

+ 2 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ContractLogVO.java

@@ -46,6 +46,8 @@ public class ContractLogVO extends ContractLog {
 
     @ApiModelProperty("是否有删除、废除权限")
     private boolean operation;
+    @ApiModelProperty(value = "签字人员集合")
+    private List<Object> taskApproveUserNamesList;
 
     public void setSelectNodeList(String primaryKeyId, String title) {
         if (this.selectNodeList == null) {

+ 79 - 6
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ContractLogServiceImpl.java

@@ -18,23 +18,25 @@ package org.springblade.business.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.commons.lang.StringUtils;
 import org.springblade.business.entity.ContractLog;
-import org.springblade.business.vo.ContractLogVO;
+import org.springblade.business.entity.Task;
+import org.springblade.business.entity.TaskParallel;
 import org.springblade.business.mapper.ContractLogMapper;
 import org.springblade.business.service.IContractLogService;
+import org.springblade.business.vo.ContractLogVO;
 import org.springblade.business.vo.FileUserVO;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.utils.ObjectUtil;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -46,6 +48,12 @@ import java.util.stream.Collectors;
 @Service
 public class ContractLogServiceImpl extends BaseServiceImpl<ContractLogMapper, ContractLog> implements IContractLogService {
 
+    private final JdbcTemplate jdbcTemplate;
+
+    public ContractLogServiceImpl(JdbcTemplate jdbcTemplate) {
+        this.jdbcTemplate = jdbcTemplate;
+    }
+
     @Override
     public List<String> queryReportLogTimeTree(String contractId, String nodePrimaryKeyId) {
         return this.baseMapper.queryReportLogTimeTree(contractId, nodePrimaryKeyId);
@@ -112,6 +120,71 @@ public class ContractLogServiceImpl extends BaseServiceImpl<ContractLogMapper, C
 
         IPage<ContractLogVO> iPage = Condition.getPage(query);
         iPage.setTotal(count);
+
+        //待审批和已审批的id集合
+        List<Long> ids = deduplicatedList.stream().filter(vo -> vo.getStatus() == 1 || vo.getStatus() == 2).map(ContractLogVO::getId).collect(Collectors.toList());
+        //构造map
+        HashMap<String, String> taskMap = new HashMap<>();
+        Map<String, List<TaskParallel>> taskParallelMap = new HashMap<>();
+        if(ObjectUtil.isNotEmpty(ids)){
+            List<Task> tasks = jdbcTemplate.query("select form_data_id ,process_instance_id from u_task where status != 3 and  form_data_id in (" + StringUtils.join(ids, ",") + ")"
+                    , new BeanPropertyRowMapper<>(Task.class));
+            if(ObjectUtil.isNotEmpty(tasks)){
+                 taskMap = tasks.stream()
+                        .collect(Collectors.toMap(
+                                Task::getFormDataId,
+                                Task::getProcessInstanceId,
+                                (existingValue, newValue) -> existingValue,
+                                HashMap::new
+                        ));
+
+                String processInstanceIds = taskMap.values().stream().collect(Collectors.joining("\',\'"));
+                processInstanceIds = "\'" + processInstanceIds+"\'";
+
+                List<TaskParallel> taskParallels = jdbcTemplate.query("select * from u_task_parallel where process_instance_id in (" + processInstanceIds + ")"
+                        , new BeanPropertyRowMapper<>(TaskParallel.class));
+                if (ObjectUtil.isNotEmpty(taskParallels)){
+                     taskParallelMap = taskParallels.stream().collect(Collectors.groupingBy(
+                            TaskParallel::getProcessInstanceId
+                    ));
+                }
+            }
+            for (Long id : ids) {
+                String processInstanceId = taskMap.get(id.toString());
+                /*判断签字人的验证 2=绿色 3=黄色 999=红色 其他代表=灰色*/
+                List<TaskParallel> statList = new ArrayList<>();
+                if(StringUtils.isNotEmpty(processInstanceId)){
+                    List<TaskParallel> taskParallels = taskParallelMap.get(processInstanceId);
+                    if(ObjectUtil.isNotEmpty(taskParallels)){
+                        for (TaskParallel taskPa : taskParallels) {
+                            if (taskPa.getStatus() == 2 && ObjectUtil.isNotEmpty(taskPa.getEVisaStatus()) && taskPa.getEVisaStatus() == 1) {
+                                taskPa.setEVisaStatus(2);
+                            } else if (taskPa.getStatus() == 3) {
+                                if (taskPa.getInitiative() == 2) {
+                                    taskPa.setEVisaStatus(3);
+                                }
+                            } else if (ObjectUtil.isNotEmpty(taskPa.getEVisaStatus()) && taskPa.getEVisaStatus() == 99) {
+                                taskPa.setEVisaStatus(999);
+                            } else {
+                                taskPa.setEVisaStatus(1);
+                            }
+                            statList.add(taskPa);
+                        }
+                    }
+                }
+                List<Object> objectList = statList.stream().map(taskPa -> (Object) taskPa).collect(Collectors.toList());
+                Optional<ContractLogVO> first = deduplicatedList.stream().filter(vo -> vo.getId().equals(id)).findFirst();
+                first.ifPresent(vo -> vo.setTaskApproveUserNamesList(objectList));
+                /*if (statList.size() > 0) {
+                    List<Object> objectList = statList.stream().map(taskPa -> (Object) taskPa).collect(Collectors.toList());
+                    ContractLogVO contractLogVO = deduplicatedMap.get(id);
+                    if(ObjectUtil.isNotEmpty(contractLogVO)){
+                        contractLogVO.setTaskApproveUserNamesList(objectList);
+                        resultList.add(contractLogVO);
+                    }
+                }*/
+            }
+        }
         return iPage.setRecords(deduplicatedList);
     }
 

+ 18 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -1819,6 +1819,24 @@ public class ExcelTabController extends BladeController {
         //获取节点下的所有表单,和附件,如果表单全是隐藏的,并且没有附件,则提示暂无数据
         String sql = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position,status from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
+        if(maps.size() < 1){
+            //判断当前合同段的类型
+            ContractInfo contractInfo = contractInfoService.selectById(contractId);
+            if(ObjectUtil.isNotEmpty(contractInfo)){
+                Integer contractType = contractInfo.getContractType();
+                if(contractType == 3 || contractType == 2 ){//业主和监理
+                    //当前业主合同段关联的施工合同段数据
+                    String sqlForSG = "select contract_id_sg from m_contract_relation_jlyz where contract_id_jlyz = " + contractId;
+                    List<ContractRelationJlyz> ContractRelationJlyzs = jdbcTemplate.query(sqlForSG, new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
+                    if(ObjectUtil.isNotEmpty(ContractRelationJlyzs)){
+                        List<Long> contractsIds = ContractRelationJlyzs.stream().map(ContractRelationJlyz::getContractIdSg).collect(Collectors.toList());
+                        String contractsIdsStr = StringUtils.join(contractsIds, ",");
+                        String sql1 = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position,status from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id in('" + contractsIdsStr + "')";
+                        maps = jdbcTemplate.queryForList(sql1);
+                    }
+                }
+            }
+        }
         if (maps.size() >= 1) {
             Map<String, Object> stringObjectMap = maps.get(0);
             String pdfUrl = stringObjectMap.get("pdf_url") + "";

+ 25 - 8
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeController.java

@@ -1,15 +1,16 @@
 package org.springblade.manager.controller;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.mixsmart.utils.FormulaUtils;
-import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
-import org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTermType;
+import org.springblade.business.feign.OperationLogClient;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SystemUtils;
+import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.log.exception.ServiceException;
@@ -21,14 +22,19 @@ import org.springblade.core.tool.support.Kv;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.manager.dto.*;
+import org.springblade.manager.dto.FormElementDTO;
+import org.springblade.manager.dto.WbsTreeDTO;
+import org.springblade.manager.dto.WbsTreeDTO2;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.excel.WbsFormElementBatchExcel;
 import org.springblade.manager.excel.WbsTreeExcel;
 import org.springblade.manager.mapper.WbsInfoMapper;
 import org.springblade.manager.mapper.WbsTreeContractMapper;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
-import org.springblade.manager.service.*;
+import org.springblade.manager.service.IContractInfoService;
+import org.springblade.manager.service.IProjectInfoService;
+import org.springblade.manager.service.IWbsFormElementService;
+import org.springblade.manager.service.IWbsTreeService;
 import org.springblade.manager.vo.*;
 import org.springblade.system.cache.DictCache;
 import org.springblade.system.entity.Role;
@@ -39,8 +45,6 @@ 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 org.springframework.web.bind.annotation.RequestParam;
-import org.springblade.core.boot.ctrl.BladeController;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
@@ -48,7 +52,6 @@ import javax.validation.Valid;
 import java.io.IOException;
 import java.net.URL;
 import java.util.*;
-import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
 import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
@@ -69,6 +72,7 @@ public class WbsTreeController extends BladeController {
     private final JdbcTemplate jdbcTemplate;
     private final IUserClient iUserClient;
     private final ISysClient iSysClient;
+    private final OperationLogClient operationLogClient;
 
     /**
      * 详情
@@ -205,6 +209,14 @@ public class WbsTreeController extends BladeController {
                     }
                 }
             }
+            //校验当前系统级表单是否已经被项目级关联
+            List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
+                    .select(WbsTreePrivate::getPKeyId).eq(WbsTreePrivate::getType, 2).eq(WbsTreePrivate::getId, id));
+            List<WbsTreeContract> wbsTreeContracts = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
+                    .select(WbsTreeContract::getPKeyId).eq(WbsTreeContract::getType, 2).and(obj -> obj.eq(WbsTreeContract::getId, id).or().eq(WbsTreeContract::getOldId, id)));
+            if(ObjectUtil.isNotEmpty(wbsTreePrivates) || ObjectUtil.isNotEmpty(wbsTreeContracts)){
+                throw new ServiceException("当前表单已被项目引用,删除失败");
+            }
 
             if (var) {
                 if (wbsTreeService.removeTableById(id)) {
@@ -220,6 +232,11 @@ public class WbsTreeController extends BladeController {
                             }
                         }
                     }
+                    //保存操作记录
+                    JSONObject json = new JSONObject();
+                    json.put("operationObjIds",id);
+                    json.put("operationObjName", "删除系统级表单");
+                    this.operationLogClient.saveUserOperationLog(4, "后台管理", "系统表单", json);
 
                     //删除对应到项目合同段的表
                     List<String> projectPKeyIds = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()

+ 25 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -675,6 +675,18 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             //删除填报记录
             String delSql = "delete from u_contract_log where id in(" + ids + ")";
             this.jdbcTemplate.execute(delSql);
+            //添加操作日志
+            String delSqlNew = delSql.replace("\"", "'");
+            StringBuffer sb = new StringBuffer();
+            sb.append("insert into blade_log_sql (p_key_id,contract_log_id,user_id,create_time,sql_info) VALUES");
+            sb.append("(" + tableNode.getPKeyId());
+            sb.append("," + ids);
+            sb.append(","+ AuthUtil.getUserId());
+            sb.append(",SYSDATE()");
+            sb.append(",\"");
+            sb.append(delSqlNew);
+            sb.append("\")");
+            jdbcTemplate.execute(sb.toString());
         }
 
         List<String> dataIds = new LinkedList<>();
@@ -703,6 +715,19 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             //新增数据
             try {
                 this.jdbcTemplate.execute(sql.toString());
+                //添加操作日志
+                String delSqlNew = sql.toString().replace("\"", "'");
+                String sqlNew = sql.toString().replace("\"", "'");
+                StringBuffer sb = new StringBuffer();
+                sb.append("insert into blade_log_sql (p_key_id,contract_log_id,user_id,create_time,sql_info) VALUES ");
+                sb.append("("+tableNode.getPKeyId());
+                sb.append(","+tableInfo.getBusinessId());
+                sb.append(","+AuthUtil.getUserId());
+                sb.append(",SYSDATE()");
+                sb.append(",\"");
+                sb.append(delSqlNew);
+                sb.append("\")");
+                jdbcTemplate.execute(sb.toString());
             } catch (Exception e) {
                 String errorKeyName = null;
                 String errorMessage = e.getMessage();
@@ -740,7 +765,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 List<JSONObject> collect = jsonLinkTabIds.stream().distinct().collect(Collectors.toList()); //去重,每个businessId不一样
                 logWbsList.addAll(collect);
             }
-
             //保存日志记录
             String dataId = this.contractLogClient.saveContractLog(new SaveContractLogVO(
                     Long.parseLong(tableInfo.getBusinessId()),