Parcourir la source

Merge branch 'master' of http://219.151.185.227:3000/zhuwei/bladex into lihb

LHB il y a 3 mois
Parent
commit
1c30162e85
14 fichiers modifiés avec 220 ajouts et 262 suppressions
  1. 12 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/LogSaveAgainDto.java
  2. 8 5
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  3. 8 3
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java
  4. 3 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java
  5. 75 39
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java
  6. 5 1
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java
  7. 8 2
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVisaServiceImpl.java
  8. 8 6
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/utils/SignFtpUtil.java
  9. 0 169
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  10. 0 5
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java
  11. 1 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java
  12. 14 12
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  13. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java
  14. 77 17
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

+ 12 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/LogSaveAgainDto.java

@@ -0,0 +1,12 @@
+package org.springblade.business.dto;
+
+import lombok.Data;
+
+@Data
+public class LogSaveAgainDto {
+    private String logIds;
+    private String logPkeyId;
+    private String nodePrimaryKeyId;
+    private String contractId;
+
+}

+ 8 - 5
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -3309,14 +3309,17 @@ public R<Boolean> saveContractTreeNode(@RequestBody AddContractTreeNodeVO vo) {
         .map(WbsTreePrivate::getNodeType)
         .collect(Collectors.toSet());
     Integer type = treeContract.getNodeType();
-    type = (type == 1) ? 1 : (type == 18) ? 2 : type + 1;
-    for (Integer i : nodeType) {
-        i = (i == 1) ? 1 : (i == 18) ? 2 : i + 1;
-        if (i <=type) {
-            throw new ServiceException("当前新增节点类型不能大于或等于父级节点类型");
+    if(type<=6||type==18){
+        type = (type == 1) ? 1 : (type == 18) ? 2 : type + 1;
+        for (Integer i : nodeType) {
+            i = (i == 1) ? 1 : (i == 18) ? 2 : i + 1;
+            if (i <=type) {
+                throw new ServiceException("当前新增节点类型不能大于或等于父级节点类型");
+            }
         }
     }
 
+
     //保存集合
     List<WbsTreeContract> saveList = new ArrayList<>();
     List<ConstructionLedger> saveLedger = new ArrayList<>();

+ 8 - 3
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -1492,9 +1492,7 @@ public class TaskController extends BladeController {
                 Date createTime = task.getCreateTime();
                 //废除时间肯定在任务创建时间之后  选择距离当前任务创建时间最近的一条数据
                 List<OperationLog> operationLogsF = operationLogMap.get(task.getFormDataId());
-                /*List<OperationLog> operationLogs = jdbcTemplate.query("select create_user_name ,create_time from u_operation_log where business_id = '" +
-                                task.getFormDataId() + "'and operation_content like '%废除%' and create_time >= '"+format+"' ORDER BY ABS(TIMESTAMPDIFF(SECOND, '"+format+"', create_time)) LIMIT 1"
-                        , new BeanPropertyRowMapper<>(OperationLog.class));*/
+
                 if(ObjectUtil.isNotEmpty(operationLogsF)){
                     Optional<OperationLog> min = operationLogsF.stream().filter(o -> o.getCreateTime().compareTo(createTime) >= 0)
                             .min(Comparator.comparing(t -> t.getCreateTime().getTime() - createTime.getTime()));
@@ -2042,6 +2040,13 @@ public class TaskController extends BladeController {
         return R.success("任务已经成功提交重签,请耐心等待!");
     }
 
+    @PostMapping("/logSaveAgain")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "日志-未上报-重刷")
+    public R<Object>logSaveAgain(@RequestBody LogSaveAgainDto dto) throws Exception {
+        taskService.logSaveAgain(dto);
+        return R.success("操作成功");
+    }
     /**
      * 任务超时提示信息
      */

+ 3 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.business.service;
 
+import org.springblade.business.dto.LogSaveAgainDto;
 import org.springblade.business.dto.ReSigningEntrustDto;
 import org.springblade.business.dto.TrialResignDto;
 import org.springblade.business.dto.reSigningEVisaStatus;
@@ -133,4 +134,6 @@ public interface ITaskService extends BaseService<Task> {
     void reSigningEntrust(List<ReSigningEntrustDto> dtos, String header, HttpServletRequest request);
 
     R reSigningEVisaStatus0(List<reSigningEVisaStatus> dtos, String header) throws Exception;
+
+    void logSaveAgain(LogSaveAgainDto dto) throws Exception;
 }

+ 75 - 39
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -13,10 +13,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springblade.archive.entity.ArchiveProjectConfig;
 import org.springblade.archive.feign.ArchiveAutoClient;
-import org.springblade.business.dto.ReSigningEntrustDto;
-import org.springblade.business.dto.TrialResignDto;
-import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
-import org.springblade.business.dto.reSigningEVisaStatus;
+import org.springblade.business.dto.*;
 import org.springblade.business.entity.*;
 import org.springblade.business.mapper.TaskMapper;
 import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
@@ -623,47 +620,72 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     public void batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS) {
         Long userId = AuthUtil.getUserId();
         String nickName = AuthUtil.getNickName();
-        List<String> taskIds = taskApprovalVOS.stream().map(TaskApprovalVO::getParallelProcessInstanceId).distinct().collect(Collectors.toList());
-        this.taskParallelService.update(Wrappers.<TaskParallel>lambdaUpdate()
-                .set(TaskParallel::getEVisaContent, "当前等待电签的批次较多,请等待几分钟后刷新页面查看........")
-                .set(TaskParallel::getStatus, 1)
-                .set(TaskParallel::getEVisaStatus, 0)
+        // 批量审批接口
+        if(taskApprovalVOS!=null && taskApprovalVOS.size()>0){
+            TaskApprovalVO taskAppr = taskApprovalVOS.get(0);
+            if(taskAppr.getFlag().equals("OK")){ //同意
+                List<String> taskIds = taskApprovalVOS.stream().map(TaskApprovalVO::getParallelProcessInstanceId).distinct().collect(Collectors.toList());
+                this.taskParallelService.update(Wrappers.<TaskParallel>lambdaUpdate()
+                        .set(TaskParallel::getEVisaContent, "当前等待电签的批次较多,请等待几分钟后刷新页面查看........")
+                        .set(TaskParallel::getStatus, 1)
+                        .set(TaskParallel::getEVisaStatus, 0)
                         .set(TaskParallel::getInitiative, 1)
-                .in(TaskParallel::getParallelProcessInstanceId, taskIds));
+                        .in(TaskParallel::getParallelProcessInstanceId, taskIds));
 
-        List<TaskBatch> taskList = new ArrayList<>();
-        for (TaskApprovalVO taskApprovalVO : taskApprovalVOS) {
-            //重签时,需要对应任务的签字人
-            if (ObjectUtil.isNotEmpty(taskApprovalVO.getYsNickName())) {
-                nickName = taskApprovalVO.getYsNickName();
-            }
+                List<TaskBatch> taskList = new ArrayList<>();
+                for (TaskApprovalVO taskApprovalVO : taskApprovalVOS) {
+                    //重签时,需要对应任务的签字人
+                    if (ObjectUtil.isNotEmpty(taskApprovalVO.getYsNickName())) {
+                        nickName = taskApprovalVO.getYsNickName();
+                    }
 
-            //保存批次
-            TaskBatch taskBatch = new TaskBatch(null, JSONObject.toJSONString(taskApprovalVO));
-            if (taskApprovalVO.getUserId() == null || StringUtils.isEmpty(taskApprovalVO.getUserId() + "")) {
-                taskBatch.setCreateUser(userId);
-            } else {
-                taskBatch.setCreateUser(taskApprovalVO.getUserId());
-            }
-            taskBatch.setNickName(nickName);
-            taskBatch.setCreateTime(new Date());
-            taskList.add(taskBatch);
-            //设置委托单的状态
-            try {
-                String sql="SELECT uei.* FROM u_entrust_info uei JOIN u_trial_self_inspection_record utsr ON uei.id = utsr.entrust_id JOIN u_information_query uiq ON utsr.id = uiq.wbs_id WHERE uiq.id = "+taskApprovalVO.getFormDataId()+" and uiq.status !=3 and uiq.is_deleted=0";
-                List<EntrustInfo> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(EntrustInfo.class));
-                if(!query.isEmpty()){
-                    EntrustInfo entrustInfo = query.get(0);
-                    if(entrustInfo.getStatus()==3){
-                        String update="update u_entrust_info set status = 4 where id="+entrustInfo.getId();
-                        jdbcTemplate.execute(update);
+                    //保存批次
+                    TaskBatch taskBatch = new TaskBatch(null, JSONObject.toJSONString(taskApprovalVO));
+                    if (taskApprovalVO.getUserId() == null || StringUtils.isEmpty(taskApprovalVO.getUserId() + "")) {
+                        taskBatch.setCreateUser(userId);
+                    } else {
+                        taskBatch.setCreateUser(taskApprovalVO.getUserId());
+                    }
+                    taskBatch.setNickName(nickName);
+                    taskBatch.setCreateTime(new Date());
+                    taskList.add(taskBatch);
+                    //设置委托单的状态
+                    try {
+                        String sql="SELECT uei.* FROM u_entrust_info uei JOIN u_trial_self_inspection_record utsr ON uei.id = utsr.entrust_id JOIN u_information_query uiq ON utsr.id = uiq.wbs_id WHERE uiq.id = "+taskApprovalVO.getFormDataId()+" and uiq.status !=3 and uiq.is_deleted=0";
+                        List<EntrustInfo> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(EntrustInfo.class));
+                        if(!query.isEmpty()){
+                            EntrustInfo entrustInfo = query.get(0);
+                            if(entrustInfo.getStatus()==3){
+                                String update="update u_entrust_info set status = 4 where id="+entrustInfo.getId();
+                                jdbcTemplate.execute(update);
+                            }
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+                this.taskBatchService.saveBatch(taskList);
+            }else if (taskAppr.getFlag().equals("NO")){ //废除
+                for (TaskApprovalVO taskApp : taskApprovalVOS) {
+                    // 废除信息
+                    Integer appType = taskApp.getApprovalType();
+                    //质检系统
+                    String up_task_par = "update u_task_parallel set status=3 , e_visa_content = '废除成功', initiative=10,update_time=SYSDATE(),update_user="+userId+"  where parallel_process_instance_id='"+taskApp.getParallelProcessInstanceId()+"'";
+                    String up_task = "update u_task set status=3, update_time=SYSDATE(),update_user="+userId+" where id='"+taskApp.getTaskId()+"'";
+                    this.jdbcTemplate.execute("delete from u_task_batch where JSON_UNQUOTE(JSON_EXTRACT(json_data, '$.taskId'))="+taskApp.getTaskId()+"");
+                    jdbcTemplate.execute(up_task_par);
+                    jdbcTemplate.execute(up_task);
+
+                    if(taskApp.getApprovalType() == 3){
+                        jdbcTemplate.execute("update u_contract_log set status=0 where id='"+taskApp.getFormDataId()+"'");
+                    }else if (taskApp.getApprovalType()==8) {
+                        this.jdbcTemplate.execute("update u_entrust_info set status=1 where id=(SELECT wbs_id from u_information_query where id='"+taskApp.getFormDataId()+"')");
+                    }else {
+                        jdbcTemplate.execute("update u_information_query set e_visa_pdf_url='',status=0 where id='"+taskApp.getFormDataId()+"'");
                     }
                 }
-            } catch (Exception e) {
-                e.printStackTrace();
             }
         }
-        this.taskBatchService.saveBatch(taskList);
     }
 
 
@@ -1885,7 +1907,21 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         }
          return R.success("操作成功");
         }
-        @Override
+
+    @Override
+    public void logSaveAgain(LogSaveAgainDto dto) throws Exception {
+        List<ContractLog> contractLogList = jdbcTemplate.query("select * from u_contract_log where id in (" + dto.getLogIds() + ")", new BeanPropertyRowMapper<>(ContractLog.class));
+        if(contractLogList.size()>0){
+            for (ContractLog contractLog : contractLogList) {
+                contractLogService.update(new LambdaUpdateWrapper<ContractLog>().eq(ContractLog::getId, contractLog.getId())
+                    .set(ContractLog::getEVisaPdfUrl, null)
+                    .set(ContractLog::getPdfUrl, null));
+                excelTabClient.getTheContractLogBusinessData(dto.getLogPkeyId(), dto.getNodePrimaryKeyId(), contractLog.getRecordTime(), dto.getContractId(), contractLog.getCreateUser());
+            }
+        }
+    }
+
+    @Override
         public void reSigningEVisa(String classify, String taskIds, String contractId, String projectId, Integer type, String header , HttpServletRequest request) {
         //查询任务信息
         List<Task> taskList = jdbcTemplate.query("select * from u_task where id in(" + taskIds + ")", new BeanPropertyRowMapper<>(Task.class));

+ 5 - 1
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java

@@ -86,6 +86,7 @@ public class EVDataServiceImpl implements EVDataService {
             String fileUrl = CommonUtil.replaceOssUrl(taskApp.getSignPdfUrl());
             System.out.println("s1231312"+fileUrl);
             List<String> eVisaConfigList = PDFUtils.getPdfSignIds(fileUrl, taskApp);
+            System.out.println("安心签关键字个数" + eVisaConfigList.size());
             if (eVisaConfigList == null || eVisaConfigList.size() == 0) {
                 //没有电签配置,默认当前任务为不签字审批,返回成功
                 taskApp.setSigState(2);
@@ -96,8 +97,10 @@ public class EVDataServiceImpl implements EVDataService {
             // 获取pdf上的电签Ids
             String ids = String.join(",", eVisaConfigList);
             if (taskApp.getRemarkType().equals("1")) { //安心签
+                System.out.println("进入安心签");
                 //添加电签策略
                 List<SealStrategyVO> strategyListByAXQ = getStrategyListByAXQ(taskApp, ids);
+                System.out.println("安心签策略个数" + strategyListByAXQ.size());
                 if (strategyListByAXQ == null || Func.isEmpty(strategyListByAXQ) || strategyListByAXQ.size() == 0) {
                     List<Map<String, Object>> mapList = jdbcTemplate.queryForList("SELECT * from m_textdict_info where type=6  and is_deleted=0 and id in(" + ids + ")");
                     if (mapList != null && mapList.size() > 0) {
@@ -118,6 +121,7 @@ public class EVDataServiceImpl implements EVDataService {
                 }
 
                 //调用签字逻辑
+                System.out.println("安心签完毕开始签字" );
                 signTaskBatchByAXQZ(strategyListByAXQ, taskApp);
                 if (taskApp.getSigState() != 1) {
                     return;
@@ -689,7 +693,7 @@ public class EVDataServiceImpl implements EVDataService {
 
         Object[] result = null;
         String fileUrl = pdfUrl;
-        if (list.size() >= 10000 || fileByte.length > 100000 * 1000 * 1000) {
+        if (list.size() >= 1000 || fileByte.length > 1000 * 1000 * 1000) {
             String inUrl = "/inp/" + DateUtil.today();
             String outUrl = "/out/" + DateUtil.today();
             SignFtpUtil.FTPCreateDir(inUrl);

+ 8 - 2
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVisaServiceImpl.java

@@ -854,8 +854,10 @@ public class EVisaServiceImpl implements EVisaService {
             if ("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()) {
                 SIGN_HOST = "219.151.181.43";
             }
+            SIGN_HOST = "219.151.181.43";
             System.out.println("电签Ip===:" + SIGN_HOST);
-            PaperlessClient paperlessClient = new PaperlessClient(SIGN_HOST, SIGN_PORT, 240000000, 810000000);
+            PaperlessClient paperlessClient = new PaperlessClient(SIGN_HOST, SIGN_PORT, 24000000, 81000000);
+            System.out.println("paperlessClient创建成功");
             paperlessClient.setSSL(false);
             //*****************************************************************************
             CompoundSealPdfListDetachedRequest compoundSealPdfListDetachedRequest = new CompoundSealPdfListDetachedRequest();
@@ -882,6 +884,7 @@ public class EVisaServiceImpl implements EVisaService {
             pdfBean.setBizSerialNo(GUIDUtil.generateId());
             pdfBean.setInputSource("");
             pdfBean.setInputType(BaseConstants.INPUT_TYPE_FILEDATA);
+            System.out.println("【电签模块】pdf{}长度" + fileByte.length);
             logger.info("【电签模块】pdf{}", "长度" + fileByte.length);
             pdfBean.setPdfData(fileByte);
             // pdfBean.set
@@ -890,6 +893,7 @@ public class EVisaServiceImpl implements EVisaService {
 
             requestBody.setPdfBeans(pdfBeans);
             //***********************构造机构章策略 ********************************
+            System.out.println("【电签模块】10" + pdfVO.getStrategyVoList().size());
             List<SealStrategy> sealStrategies = this.generateSealStrategies(pdfVO.getStrategyVoList());
             if (null == sealStrategies || sealStrategies.size() <= 0) {
                 logger.info("【电签模块】{}", "签章策略为空");
@@ -897,6 +901,7 @@ public class EVisaServiceImpl implements EVisaService {
             }
             requestBody.setSealStrategies(sealStrategies);
 
+            System.out.println("【电签模块】11" + sealStrategies.size());
             //签章后文件保存地址,不为空时,直接将签章文件保存在此地址,不再返回签章后文档数据;ftp:auto
             requestBody.setOutputFilepath("");
 
@@ -904,7 +909,7 @@ public class EVisaServiceImpl implements EVisaService {
             requestBody.setTimestampChannel(BaseConstants.TIME_STAMP_CHANNEL_CFCA);
             //获取场景证书的方式默认值为0;0:实时从CFCA CA服务申请下载场景证书;1:使用从CFCA CA服务预先申请下载并存储在本地的场景证书;
             requestBody.setSceneCertChannel(BaseConstants.SCEND_CERT_CHANNEL_REAL);
-
+            System.out.println("【电签模块】12" + sealStrategies.size());
             compoundSealPdfListDetachedRequest.setBody(requestBody);
             //****************************** 请求服务端进行签章 *********************************************
             System.out.println("-----------------------" + new Date().toString() + "开始" + transactionNo + "----------------------------");
@@ -930,6 +935,7 @@ public class EVisaServiceImpl implements EVisaService {
                 result[2] = responseHead.getMessage();
             }
         } catch (Exception e) {
+            logger.info("【电签模块】{}", "签章异常:" + e.getMessage());
             e.printStackTrace();
         }
         return result;

+ 8 - 6
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/utils/SignFtpUtil.java

@@ -4,6 +4,7 @@ import org.apache.commons.net.ftp.FTP;
 import org.apache.commons.net.ftp.FTPClient;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.SystemUtils;
+import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.system.cache.ParamCache;
 
 import java.io.*;
@@ -33,7 +34,7 @@ public class SignFtpUtil {
             // 连接到FTP服务器
             String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
             if("20".equals(sys_isonline) || SystemUtils.isWindows() || SystemUtils.isMacOs()){
-                SERVER = "219.151.181.43";
+                SERVER = "219.151.185.227";
             }
             System.out.println("ftp上传ip地址:"+SERVER);
             ftp.connect(SERVER, PORT);
@@ -140,11 +141,14 @@ public class SignFtpUtil {
         FTPClient ftpClinet = SignFtpUtil.getFTPClinet();
         try {
             if (ftpClinet.deleteFile(remoteFilePath)) {
+                System.out.println(remoteFilePath+"-s");
                 return 1;
             } else {
+                System.out.println(remoteFilePath+"-f");
                 return 2;
             }
         } catch (Exception e) {
+            System.out.println(e+"-f");
             e.printStackTrace();
             return 2;
         } finally {
@@ -228,10 +232,8 @@ public class SignFtpUtil {
     }
 
 /*    public static void main(String[] args) {
-        String loudUrl = "/Users/hongchuangyanfa/Desktop/excel/头像.jpeg";
-        uploadFile(loudUrl,"/inp/20250317/123.jpeg");
-
-      //  ftp://signAdmin:123456@219.151.181.43:6233/inp/20250317/bc64d878fed6eff18a896641874594ea.jpg
-       // downloadFile("/Users/hongchuangyanfa/Desktop/22222/头像.jpeg","/inp/20250317/bc64d878fed6eff18a896641874594ea.jpg");
+        String inUrl = "/inp/" + DateUtil.today();
+        System.out.println(inUrl);
+        FTPCreateDir(inUrl);
     }*/
 }

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

@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.fasterxml.jackson.annotation.JsonProperty;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.google.gson.Gson;
 import com.spire.xls.*;
@@ -32,7 +31,6 @@ import org.springblade.business.entity.ContractLog;
 import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.feign.ContractLogClient;
 import org.springblade.business.feign.InformationQueryClient;
-import org.springblade.business.feign.TaskClient;
 import org.springblade.business.vo.SaveContractLogVO;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.BaseUtils;
@@ -44,7 +42,6 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.oss.model.BladeFile;
-import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
@@ -66,18 +63,15 @@ import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.resource.vo.NewBladeFile;
 import org.springblade.system.cache.ParamCache;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Lazy;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
@@ -93,10 +87,7 @@ import java.nio.file.StandardCopyOption;
 import java.text.SimpleDateFormat;
 import java.util.List;
 import java.util.*;
-import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -132,12 +123,9 @@ public class ExcelTabController extends BladeController {
     // 元素信息表-
     private final IWbsFormElementService wbsFormElementService;
 
-
     // 元素信息表-
     private final IWbsTreeContractService wbsTreeContractService;
 
-    private final INodeBaseInfoService nodeBaseInfoService;
-
     private final WbsTreePrivateMapper wbsTreePrivateMapper;
 
     private final JdbcTemplate jdbcTemplate;
@@ -164,17 +152,6 @@ public class ExcelTabController extends BladeController {
 
     private final IContractInfoService contractInfoService;
 
-    /*private final IWbsParamService wbsParamService;*/
-
-    private final TaskClient taskClient;
-
-    private final BladeRedis bladeRedis;
-
-
-    // 线程池
-    @Resource(name = "taskExecutor1")
-    private ThreadPoolExecutor executor;
-
 
     @Autowired
     StringRedisTemplate RedisTemplate;
@@ -4422,95 +4399,6 @@ public class ExcelTabController extends BladeController {
         return R.data(bussDataInfoTrial);
     }
 
-
-    // @Scheduled(cron = "0/20 * * * * ?")
-    public void HtmlCope() {
-        //执行代码
-        String sql = "SELECT * from m_wbs_tree_private_0425 where project_id=1750070685257990145 and wbs_id=1745384228667129857 and type =2 and is_deleted=0 LIMIT 200";
-        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
-        if (maps != null && maps.size() >= 1) {
-            for (Map<String, Object> dataInfo : maps) {
-                if (executor.getQueue().size() <= 40) {
-                    String idkey = dataInfo.get("p_key_id") + "";
-                    Boolean aBoolean = RedisTemplate.hasKey("sign-" + idkey);
-                    if (!aBoolean) {
-                        RedisTemplate.opsForValue().set("sign-" + idkey, "1", 30, TimeUnit.SECONDS);
-                        CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
-                            try {
-                                this.checkHtmlCope(dataInfo);
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }, executor);
-                    }
-
-                }
-            }
-        }
-        System.out.println("队列数量" + executor.getQueue().size());
-        System.out.println("活跃数量" + executor.getActiveCount());
-        System.out.println("总共数量" + executor.getTaskCount());
-        System.out.println("完成数量" + executor.getCompletedTaskCount());
-    }
-
-    public void checkHtmlCope(Map<String, Object> dataInfo) throws Exception {
-
-        String pkey_id = dataInfo.get("p_key_id") + "";
-        String sql = "update m_wbs_tree_private_0425 set is_deleted=1 where p_key_id='" + pkey_id + "'";
-        jdbcTemplate.execute(sql);
-        String Html1 = dataInfo.get("html_url") + "";
-        String fileName = Html1.substring(Html1.lastIndexOf("/") + 1, Html1.length());
-        String Html2 = Html1.replaceAll("privateUrl", "/privateUrlCopy/1795277868551389185/").replaceAll("//", "/");
-        String Html3 = Html1.replaceAll("privateUrl", "/privateUrlCopy/1792760669353865218/").replaceAll("//", "/");
-        String url183 = "http://183.247.216.148:22776/";
-        String local183 = "/www/wwwroot/Users/hongchuangyanfa/Desktop/";
-        if (Html1.indexOf("/home/") >= 0) {
-            local183 = "/home/www/wwwroot/Users/hongchuangyanfa/Desktop/";
-        }
-        String url210 = "http://fileinfo.hczcxx.cn/";
-        String local210 = "/www/wwwroot/Users/hongchuangyanfa/Desktop/";
-        String saveUrl = "/Users/hongchuangyanfa/Desktop/privateUrl/" + fileName;
-
-        // 先判断 基础路径是否存在
-        String file1 = Html1.replaceAll(local183, url183);
-        String file2 = Html2.replaceAll(local183, url183);
-        String file3 = Html3.replaceAll(local183, url183);
-        String file4 = Html1.replaceAll(local210, url210).replace("/home", "");
-        String file5 = Html2.replaceAll(local210, url210).replace("/home", "");
-        String file6 = Html3.replaceAll(local210, url210).replace("/home", "");
-
-        List<String> dataUrl = new ArrayList<>();
-        dataUrl.add(file2);
-        dataUrl.add(file3);
-        //  dataUrl.add(file4);
-        //  dataUrl.add(file5);
-        //  dataUrl.add(file6);
-        InputStream stream1 = getOSSInputStream2(file1);
-        System.out.println(fileName);
-        if (stream1 == null) {
-            String sql2 = "update m_wbs_tree_private_0425 set is_deleted=5 where p_key_id='" + pkey_id + "'";
-            jdbcTemplate.execute(sql2);
-
-            for (String fileUrl : dataUrl) {
-                InputStream str = getOSSInputStream2(fileUrl);
-                if (str != null) {
-                    OutputStream outputStream = new FileOutputStream(saveUrl);
-                    byte[] bytes = CommonUtil.InputStreamToBytes(str);
-                    outputStream.write(bytes);
-
-                    if (outputStream != null) {
-                        outputStream.close();
-                    }
-                    String sql3 = "update m_wbs_tree_private_0425 set is_deleted=2 where p_key_id='" + pkey_id + "'";
-                    jdbcTemplate.execute(sql3);
-                    return;
-                }
-            }
-        }
-
-
-    }
-
     public static synchronized InputStream getOSSInputStream2(String urlStr) throws Exception {
         //获取OSS文件流
         URL url = new URL(urlStr);
@@ -4523,63 +4411,6 @@ public class ExcelTabController extends BladeController {
         }
     }
 
-    //  @Scheduled(cron = "0/20 * * * * ?")
-    public void SignInfo() {
-        //执行代码
-        String sql = "SELECT * from m_wbs_tree_contract where id in(SELECT parent_id from m_wbs_tree_contract where contract_id=1750757576810766337 and is_cope_tab=2  ) and type =1 and contract_id=1750757576810766337 and is_deleted<>4 ";
-        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
-        if (maps != null && maps.size() >= 1) {
-            for (Map<String, Object> dataInfo : maps) {
-                if (executor.getQueue().size() <= 40) {
-                    String idkey = dataInfo.get("p_key_id") + "";
-                    Boolean aBoolean = RedisTemplate.hasKey("sign-" + idkey);
-                    if (!aBoolean) {
-                        RedisTemplate.opsForValue().set("sign-" + idkey, "1", 30, TimeUnit.SECONDS);
-                        CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
-                            try {
-                                this.checkIsExsitTaskBatch(dataInfo);
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }, executor);
-                    }
-
-                }
-            }
-        }
-        System.out.println("队列数量" + executor.getQueue().size());
-        System.out.println("活跃数量" + executor.getActiveCount());
-        System.out.println("总共数量" + executor.getTaskCount());
-        System.out.println("完成数量" + executor.getCompletedTaskCount());
-    }
-
-    public void checkIsExsitTaskBatch(Map<String, Object> dataInfo) {
-        String sql = "SELECT * from m_wbs_tree_contract where parent_id =(select id from m_wbs_tree_contract where p_key_id='" + dataInfo.get("p_key_id") + "' and is_deleted=0 ) and type =2  and is_cope_tab=2 and contract_id=1750757576810766337 ORDER BY sort,create_time,node_name ASC";
-        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
-        String node_name = "";
-        System.out.println(sql);
-        int index = 0;
-        if (maps != null && maps.size() >= 1) {
-            for (int i = 0; i < maps.size(); i++) {
-                Map<String, Object> dataIn = maps.get(i);
-                String nodeName = dataIn.get("node_name") + "";
-                if (node_name.equals(nodeName)) {
-                    index = index + 1;
-                } else {
-                    index = 1;
-                }
-                node_name = nodeName;
-                if (nodeName.indexOf("__") >= 0) {
-                    nodeName = nodeName.split("__")[0];
-                }
-                String newNmae = nodeName + "__" + index;
-                System.out.println(newNmae);
-                // jdbcTemplate.update("update m_wbs_tree_contract set node_name='"+node_name+"' set is_deleted=4 where p_key_id='"+dataIn.get("p_key_id")+"' ");
-
-            }
-        }
-    }
-
     //@Scheduled(fixedDelay = 1000*60*60*24)
     //检查excel路径有错的
     public void cheackExcel() throws IOException {

+ 0 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java

@@ -26,12 +26,10 @@ import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springblade.business.dto.ImportTreeDto;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.IoUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.core.tool.utils.ResourceUtil;
@@ -48,9 +46,6 @@ import org.springblade.manager.utils.RandomNumberHolder;
 import org.springblade.manager.vo.*;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.SingleColumnRowMapper;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 

+ 1 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java

@@ -38,6 +38,7 @@ import org.springblade.manager.service.IWbsTreePrivateService;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.manager.vo.TrialSelfDataRecordVO1;
 import org.springblade.resource.feign.NewIOSSClient;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.RestController;
@@ -68,8 +69,6 @@ public class ExcelTabClientImpl implements ExcelTabClient {
     private final IProjectInfoService projectInfoService;
     private final IContractInfoService contractInfoService;
     private final EntrustInfoServiceClient entrustInfoServiceClient;
-    private static final Logger logger = LoggerFactory.getLogger(ExcelTabClientImpl.class);
-
     @Override
     public ExcelTab getById(String id) {
         return this.excelTabService.getById(id);

+ 14 - 12
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -1414,7 +1414,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             String htmlString = IoUtil.readToString(inputStreamByUrl);
             Document doc = Jsoup.parse(htmlString);
             document = doc;
-            keyNameList= getKeyNameList(doc);
+            //keyNameList= getKeyNameList(doc);
 
             // 解析
             // 模糊匹配
@@ -1679,18 +1679,20 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         }
         /*获取参数库数据*/
 //        Map<String, Object> nodeBaseInfo = nodeBaseInfoService.getAllNodeBaseInfoByPkeyId(pkeyId, nodeId);
-//        for (Map.Entry<String, Object> entry : nodeBaseInfo.entrySet()) {
-//            reData.putIfAbsent(entry.getKey(), entry.getValue());
+//        if(nodeBaseInfo!=null){
+//            for (Map.Entry<String, Object> entry : nodeBaseInfo.entrySet()) {
+//                reData.putIfAbsent(entry.getKey(), entry.getValue());
+//            }
+//        }
+//        if(reData.size()>0){
+//            //处理key重复导致pdf数据错位
+//            for (Iterator<Map.Entry<String, Object>> iterator = reData.entrySet().iterator(); iterator.hasNext(); ) {
+//                Map.Entry<String, Object> entry = iterator.next();
+//                if (!keyNameList.equals("") && keyNameList.indexOf(entry.getKey()) <= 0) {
+//                    iterator.remove();
+//                }
+//            }
 //        }
-        if(reData.size()>0){
-            //处理key重复导致pdf数据错位
-            for (Iterator<Map.Entry<String, Object>> iterator = reData.entrySet().iterator(); iterator.hasNext(); ) {
-                Map.Entry<String, Object> entry = iterator.next();
-                if (!keyNameList.equals("") && keyNameList.indexOf(entry.getKey()) <= 0) {
-                    iterator.remove();
-                }
-            }
-        }
         return reData;
     }
 

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java

@@ -534,7 +534,7 @@ public class FileUtils {
         String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
         String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
 
-        if (fileUrl.indexOf("aliyuncs.com") >= 0) {
+        if (fileUrl.indexOf("aliyuncs.com") >= 0 || fileUrl.indexOf("/mnt/sdc/Users/hongchuangyanfa/Desktop/")>=0) {
             return fileUrl;
         } else {
             file_path2 = file_path;

+ 77 - 17
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -1082,6 +1082,80 @@ public class TaskController extends BladeController {
         }
     }
 
+    @GetMapping("/getTaskCount")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "获取任务数量")
+    public R<Integer> getTaskCount(@RequestParam Long projectId,@RequestParam(required = false) Long contractId){
+        /*封装入参SQL*/
+        List<Object> params = new ArrayList<>();
+        StringBuilder sqlString = new StringBuilder("SELECT * FROM u_task WHERE 1=1 AND is_deleted = 0 AND approval_type in (5,6,7,8) "); //approval_type = 5 计量任务
+        Long userId1 = SecureUtil.getUserId();
+        List<Long> projectIdss = jdbcTemplate.query("select project_id from m_project_assignment_user where user_id=" + userId1, new SingleColumnRowMapper<>(Long.class));
+        sqlString.append(" AND project_id in(").append(StringUtils.join(projectIdss, ",")).append(")");
+        sqlString.append(" AND status = 1");
+        sqlString.append(" AND (");
+        sqlString.append("EXISTS (SELECT 1 FROM u_task_parallel WHERE u_task.process_instance_id = u_task_parallel.process_instance_id AND u_task_parallel.status = ? AND u_task_parallel.task_user = ?)");
+        params.add(1);
+        params.add(SecureUtil.getUserId());
+        sqlString.append(")");
+
+        /*执行SQL获取数据*/
+        String sqlPage = sqlString.toString();
+        List<Task> resultList = jdbcTemplate.query(sqlPage, new BeanPropertyRowMapper<>(Task.class), params.toArray());
+
+        /*获取任务详情信息Map*/
+        Set<String> processInstanceIds = resultList.stream().map(Task::getProcessInstanceId).collect(Collectors.toSet());
+        Map<String, List<TaskParallel>> taskParallelGroupMap = new HashMap<>();
+        if (processInstanceIds.size() > 0) {
+            String resultIds = processInstanceIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
+            taskParallelGroupMap = jdbcTemplate.query("select process_instance_id,task_user,task_user_name,e_visa_status,e_visa_content,status,initiative,sort from u_task_parallel where process_instance_id in(" + resultIds + ") order by id", new BeanPropertyRowMapper<>(TaskParallel.class)).stream().collect(Collectors.groupingBy(TaskParallel::getProcessInstanceId));
+        }
+        //筛选出可审批的数据
+        if(ObjectUtil.isNotEmpty(resultList)){
+            //获取当前用户id
+            Long userId = AuthUtil.getUserId();
+
+            String processIdsStr = resultList.stream().map(task -> task.getProcessInstanceId()).collect(Collectors.joining(","));
+            //查询出所有proccesId的数据转换成map  map为processId键为u_task_papallel对象
+            Map<String, List<TaskParallel>> taskParallelMap = jdbcTemplate.query("select * from u_task_parallel where process_instance_id in (" + processIdsStr + ")", new BeanPropertyRowMapper<>(TaskParallel.class)).stream().collect(Collectors.groupingBy(TaskParallel::getProcessInstanceId));
+
+            //根据条件过滤出可审批的数据(流程审批-非自定义流程)   flowid为0的是自定义审批的流程
+            Map<Long, List<Task>> flowIdMaps = resultList.stream().filter(task->!"0".equals(task.getFixedFlowId().toString())).collect(Collectors.groupingBy(Task::getFixedFlowId));
+            if(ObjectUtil.isNotEmpty(flowIdMaps)){
+                String join = StringUtils.join(flowIdMaps.keySet(), ",");
+                //结果集所有数据
+                String sql = "select fixed_flow_id ,fixed_flow_branch_sort,fixed_flow_link_type,fixed_flow_link_sort from u_fixed_flow_link where  is_deleted = 0  and  fixed_flow_id in ( "+join+")";
+                List<FixedFlowLink> fixedFlowLinks = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(FixedFlowLink.class));
+                Map<Long, List<FixedFlowLink>> fixedsMap = fixedFlowLinks.stream().collect(Collectors.groupingBy(FixedFlowLink::getFixedFlowId));
+                for (Long l : flowIdMaps.keySet()) {
+                    List<Task> tasks = flowIdMaps.get(l);
+                    for (Task task : tasks) {
+                        handleTaskParallel1(task,fixedsMap, taskParallelMap,userId, resultList);
+                    }
+                }
+            }
+            //自定义流程判断 查询出所有垂直审批的项目
+            //String sqlForchuizhi = "select id from m_project_info where approval_type = 1 and is_deleted = 0";
+            //目前默认所有项目都是垂直审批  上面的注释掉的是以后要用的内容 1为垂直审批2为流程审批
+            String sqlForchuizhi = "select id from m_project_info where  is_deleted = 0";
+            List<Long> projectIds = jdbcTemplate.query(sqlForchuizhi, new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().map(ProjectInfo::getId).collect(Collectors.toList());
+            if(ObjectUtil.isNotEmpty(projectIds)){
+                //所有自定义审批的任务
+                Set<Task> tasks = resultList.stream().filter(task -> "0".equals(task.getFixedFlowId().toString())).collect(Collectors.toSet());
+                if(ObjectUtil.isNotEmpty(tasks)){
+                    for (Task task : tasks) {
+                        if(projectIds.contains(Long.parseLong(task.getProjectId()))){
+                            //是自定义垂直审批
+                            handleTaskParallel(task, taskParallelMap,userId, resultList);
+                        }
+                    }
+                }
+            }
+        }
+        return R.data(resultList.size(),"获取成功");
+
+    }
+
     /**
      * 分页查询
      */
@@ -1097,23 +1171,9 @@ public class TaskController extends BladeController {
         int size = dto.getSize();
         List<Object> params = new ArrayList<>();
         StringBuilder sqlString = new StringBuilder("SELECT * FROM u_task WHERE 1=1 AND is_deleted = 0 AND approval_type in (5,6,7,8) "); //approval_type = 5 计量任务
-
-        ContractInfo contractInfo = jdbcTemplate.queryForObject("select contract_type from m_contract_info where id = " + dto.getContractId(), new BeanPropertyRowMapper<>(ContractInfo.class));
-        if (contractInfo != null && Arrays.asList(1, 4).contains(contractInfo.getContractType())) {
-            /*施工、计量合同段(总承包合同段)按照项目id、合同段id正常查询*/
-            if (ObjectUtil.isNotEmpty(dto.getProjectId()) && ObjectUtil.isNotEmpty(dto.getContractId())) {
-                sqlString.append(" AND project_id = ? AND contract_id = ?");
-                params.add(dto.getProjectId());
-                params.add(dto.getContractId());
-            }
-
-        } else if (contractInfo != null && Arrays.asList(2, 3).contains(contractInfo.getContractType())) {
-            /*监理、业主(指挥部)合同段,默认查询当前项目下所有关联的合同段*/
-            List<ContractRelationJlyz> contractRelationJLYZ = jdbcTemplate.query("select contract_id_sg from m_contract_relation_jlyz where contract_id_jlyz = " + dto.getContractId(), new BeanPropertyRowMapper<>(ContractRelationJlyz.class));
-            Set<Long> ids = contractRelationJLYZ.stream().map(ContractRelationJlyz::getContractIdSg).collect(Collectors.toSet());
-            ids.add(Long.parseLong(dto.getContractId())); //把本身合同段也加入查询
-            sqlString.append(" AND contract_id in(").append(StringUtils.join(ids, ",")).append(")");
-        }
+        Long userId1 = SecureUtil.getUserId();
+        List<Long> projectIdss = jdbcTemplate.query("select project_id from m_project_assignment_user where user_id=" + userId1, new SingleColumnRowMapper<>(Long.class));
+        sqlString.append(" AND project_id in(").append(StringUtils.join(projectIdss, ",")).append(")");
 
         if (ObjectUtil.isNotEmpty(dto.getTypeValue())) {
             sqlString.append(" AND meter_task_type = ?");