2 Commits ceb045066c ... f17d64907d

Author SHA1 Message Date
  wangzhun f17d64907d Merge branch 'master' of http://192.168.2.241:3000/haiqiu/tofly-zmrq 3 months ago
  wangzhun f7881cb007 添加退库重推手动 3 months ago

+ 1 - 0
pom.xml

@@ -18,6 +18,7 @@
         <module>gateway</module>
         <module>workflow</module>
         <module>common</module>
+        <module>test</module>
     </modules>
 
     <properties>

+ 6 - 2
system/src/main/resources/bootstrap-test.yml

@@ -5,7 +5,7 @@ spring:
         # nacos配置中心指定空间
         namespace: tofly-zmrq
         # nacos部署IP
-        server-addr: 192.168.2.235:8848
+        server-addr: 192.168.2.6:8848
         # 配置后缀
         file-extension: yaml
         shared-configs[0]:
@@ -16,11 +16,15 @@ spring:
           dataId: public_config_ftp.yaml
         shared-configs[3]:
           dataId: public_config_redis.yaml
+        username: nacos
+        password: nacos
       discovery:
         # nacos配置中心指定空间
         namespace: tofly-zmrq
         # nacos部署IP
-        server-addr: 192.168.2.235:8848
+        server-addr: 192.168.2.6:8848
+        username: nacos
+        password: nacos
   application:
     # 该应用在nacos配置中的名称
     name: tofly-auth

+ 1 - 1
system/src/main/resources/bootstrap.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: pro
+    active: test

+ 27 - 0
test/pom.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.tofly</groupId>
+        <artifactId>tofly_zmrq</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>com.tofly</groupId>
+    <artifactId>test</artifactId>
+
+    <properties>
+        <maven.compiler.source>11</maven.compiler.source>
+        <maven.compiler.target>11</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>com.tofly</groupId>
+            <artifactId>file-api8</artifactId>
+            <version>1.0</version>
+        </dependency>
+    </dependencies>
+</project>

+ 16 - 0
test/src/main/java/com/tofly/StartApplication.java

@@ -0,0 +1,16 @@
+package com.tofly;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@SpringBootApplication
+@EnableFeignClients
+public class StartApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(StartApplication.class, args);
+    }
+
+
+}

+ 96 - 0
test/src/main/java/com/tofly/controller/TestController.java

@@ -0,0 +1,96 @@
+package com.tofly.controller;
+
+import com.tofly.client.MinioFileClient;
+import com.tofly.client.MinioFileUploadClient;
+import com.tofly.common.core.result.ResultData;
+import com.tofly.vo.FileInfo;
+import com.tofly.vo.FileUploadResponse;
+import feign.Response;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+
+
+@RestController
+@RequestMapping("testupload")
+public class TestController {
+@Autowired
+private MinioFileClient minioFileClient;
+
+    @RequestMapping("/getFile")
+    public ResultData  test2(){
+        final FileInfo byFileId = minioFileClient.getByFileId("1");
+        return new ResultData().ok(byFileId);
+    }
+    @PostMapping("/uploadFile")
+    public ResultData  test3(@RequestPart("file") MultipartFile file){
+        final FileUploadResponse test = minioFileClient.uploadFile(file);
+        return new ResultData().ok(test);
+    }
+    @PostMapping("/uploadZip")
+    public ResultData  testuploadzip(@RequestPart("file") MultipartFile file){
+        final ResponseEntity<List<FileInfo>> listResponseEntity = minioFileClient.uploadZip( file);
+        return new ResultData().ok(listResponseEntity.getBody());
+    }
+
+    @GetMapping("/downZip")
+    public void  testDownloadzip(String[] fileNames, HttpServletResponse response){
+        final ResponseEntity<byte[]> responseEntity = minioFileClient.downloadZip(fileNames);
+        final byte[] zipContent = responseEntity.getBody();
+
+        if (zipContent != null) {
+            response.setStatus(HttpServletResponse.SC_OK);
+            response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=downloaded_files.zip");
+            response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
+            response.setContentLength(zipContent.length);
+            try {
+                response.getOutputStream().write(zipContent);
+                response.getOutputStream().flush();
+            } catch (IOException e) {
+                e.printStackTrace();
+                response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+            }
+        } else {
+            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+        }
+    }
+
+    @GetMapping("/getFileInfo")
+    public ResultData  test3(String fileName){
+        final FileInfo fileInfo = minioFileClient.getFileInfo(fileName);
+
+        return new ResultData().ok(fileInfo);
+    }
+
+    @GetMapping("/download")
+    public void  test3(String fileName, HttpServletResponse response){
+        Response feignResponse = minioFileClient.download(fileName);
+
+        response.setContentType("application/octet-stream");
+        response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
+
+        try (InputStream inputStream = feignResponse.body().asInputStream();
+             OutputStream outputStream = response.getOutputStream()) {
+
+            byte[] buffer = new byte[8192];
+            int bytesRead;
+
+            while ((bytesRead = inputStream.read(buffer)) != -1) {
+                outputStream.write(buffer, 0, bytesRead);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            // Handle exception
+        }
+
+    }
+}

+ 39 - 0
test/src/main/resources/bootstrap-dev.yml

@@ -0,0 +1,39 @@
+spring:
+   cloud:
+      nacos:
+         config:
+            # nacos配置中心指定空间
+            namespace: tofly-zmrq
+            # nacos部署IP
+            server-addr: 192.168.2.6:8848
+            # 配置后缀
+            file-extension: yaml
+            shared-configs[0]:
+               dataId: public_config_public.yaml
+            shared-configs[1]:
+               dataId: public_config_oracle.yaml
+            shared-configs[2]:
+               dataId: public_config_ftp.yaml
+            shared-configs[3]:
+               dataId: public_config_redis.yaml
+            username: nacos
+            password: nacos
+         discovery:
+            # nacos配置中心指定空间
+            namespace: tofly-zmrq
+            # nacos部署IP
+            server-addr: 192.168.2.6:8848
+         username: nacos
+         password: nacos
+   application:
+      # 该应用在nacos配置中的名称
+      name: tofly-flow-test
+
+
+tofly:
+   filecenter:
+      url: http://192.168.2.6:29001/
+   bucket:
+      name: test18
+   minio:
+      localDownUrl: http://192.168.2.15/tofly-flow-test/

+ 3 - 0
test/src/main/resources/bootstrap.yml

@@ -0,0 +1,3 @@
+spring:
+  profiles:
+    active: dev

+ 0 - 4
workflow/src/main/java/com/tofly/workflow/process/controller/TfProcessNodeLController.java

@@ -114,10 +114,6 @@ public class TfProcessNodeLController extends BaseController {
     public ResultData save(@RequestPart @Valid PNodeSaveDto dto, @RequestPart List<MultipartFile> files) {
 
         log.info("新增流程节点:{}", JSON.toJSONString(dto));
-
-        for (MultipartFile multipartFile : files) {
-            log.info("multipartFile.getOriginalFilename()"+multipartFile.getOriginalFilename());
-        }
         Object obj = tfProcessNodeLService.processNodeSave(dto,files);
         if(obj instanceof String){
             return ResultData.fail(obj.toString());

+ 9 - 3
workflow/src/main/java/com/tofly/workflow/process/service/impl/TfProcessNodeLServiceImpl.java

@@ -911,7 +911,7 @@ public class TfProcessNodeLServiceImpl extends ServiceImpl<TfProcessNodeLMapper,
      * @param map         步骤配置信息
      */
     private List<TfProcessNodeL> saveSubmitNextStepAll(TfProcessL processL, List<NextStepDto> nextSteps, TfProcessNodeL processNode, Long deptId, Long postId, Map<Integer, TfProcessConfigStepL> map) {
-        /**保存下一步基础信息*/
+        /**生成下一步基础信息  未保存*/
         List<TfProcessNodeL> pns = saveNextStep(processL, nextSteps, deptId, postId, map);
         /**填充保存下一步的其它数据信息*/
         for (TfProcessNodeL pn : pns) {
@@ -1038,14 +1038,18 @@ public class TfProcessNodeLServiceImpl extends ServiceImpl<TfProcessNodeLMapper,
                         List<TfNowHandleL> nhs = nHandleService.list(new QueryWrapper<TfNowHandleL>().lambda().eq(TfNowHandleL::getProcessId, processL.getId())
                                 .ne(TfNowHandleL::getProcessStep, processNode.getProcessStep()));
                         if (CollUtil.isNotEmpty(nhs)) {
+                            //获取该节点的上游已经完成节点
                             List<Integer> psteps = pUNodeService.getUpperProcessStep(processL.getId(), processNode.getId(), 1, 1);
                             boolean istemp = false;
                             sign:
                             for (TfNowHandleL nh : nhs) {
+                                //判断当前进行的任务  是否还存在 正在执行的任务
                                 List<Integer> lsteps = pUNodeService.getUpperProcessStep(processL.getId(), nh.getNodeId(), 1, 1);
                                 for (Integer s : lsteps) {
                                     if (psteps.contains(s)) {
+
                                         istemp = true;
+
                                         break sign;
                                     }
                                 }
@@ -1272,7 +1276,7 @@ public class TfProcessNodeLServiceImpl extends ServiceImpl<TfProcessNodeLMapper,
     }
 
     /**
-     * 保存下节点关联关系
+     * 保存下一个节点关联关系
      *
      * @param processL    流程ID
      * @param processNode 本步骤节点信息
@@ -1397,7 +1401,7 @@ public class TfProcessNodeLServiceImpl extends ServiceImpl<TfProcessNodeLMapper,
                     }
                 }
 
-
+                //步骤节点
                 if (FlowConstant.INTEGER_ONE == ns.getStepNode()) {
                     String[] steps = pcs.getUpperStep().split("\\|");
                     for (String step : steps) {
@@ -1407,11 +1411,13 @@ public class TfProcessNodeLServiceImpl extends ServiceImpl<TfProcessNodeLMapper,
                             list.remove(ns.getProcessStep());
                             int count = nHandleService.count(new QueryWrapper<TfNowHandleL>().lambda().eq(TfNowHandleL::getProcessId, processL.getId()).eq(TfNowHandleL::getProcessStep, list));
                             if (count > 0) {
+                                log.info("continue sign;");
                                 continue sign;
                             }
                         }
                     }
                 }
+                //
                 TfPageControlL pc = pControlService.getOne(new QueryWrapper<TfPageControlL>().lambda().eq(TfPageControlL::getStepId, pcs.getId())
                         .eq(TfPageControlL::getStepNode, ns.getStepNode()).eq(TfPageControlL::getIsDel, FlowConstant.SHORT_ZERO));
                 TfProcessNodeL pn = new TfProcessNodeL();

+ 24 - 6
workflow/src/main/java/com/tofly/workflow/report/service/impl/ReportServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
 import com.tofly.workflow.buss.entity.TfChargeW;
 import com.tofly.workflow.buss.entity.vo.ProjectBaseVo;
 import com.tofly.workflow.buss.service.TfChargeWService;
@@ -168,19 +169,32 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, SignApplyVo> im
             allRoundVo.setNoAccept((v.size() - Integer.parseInt(hasAccept)) + "");
 
             List<Long> processIdList = v.stream().map(ProcessType::getProcessId).collect(Collectors.toList());
+            //如果processIdListsize 超过1000,拆分为数组 list<List<Long>>
+            List<List<Long>> processIdListList = Lists.partition(processIdList, 1000);
+
+
             if ("新安装工程".equals(k)) {
              //总户数 已缴费数 已结算
-                String totalHouseholdNumber = baseMapper.getHouseHoldNumber(processIdList);
-                allRoundVo.setTotalHouseholdNumber(totalHouseholdNumber);
+                long totalHouseholdNumber=0;
+                for (List<Long> longs : processIdListList) {
+                    totalHouseholdNumber +=Double.valueOf(baseMapper.getHouseHoldNumber(processIdList)) ;
+                }
+
+
+                allRoundVo.setTotalHouseholdNumber(String.valueOf(totalHouseholdNumber));
                 String hasCharge = getHasStep("合同签订及缴费", v);
                 allRoundVo.setHasCharge(hasCharge);
                 String hasSettle = getHasStep("用户结算", v);
                 allRoundVo.setHasSettle(hasSettle);
             }
             if ("户内改造工程".equals(k)) {
+                long totalHouseholdNumber=0;
+                for (List<Long> longs : processIdListList) {
+                    totalHouseholdNumber +=Double.valueOf( baseMapper.getHouseHoldNumber(longs)) ;
+                }
              //总户数 已缴费数 已结算
-                String totalHouseholdNumber = baseMapper.getHouseHoldNumber(processIdList);
-                allRoundVo.setTotalHouseholdNumber(totalHouseholdNumber);
+               // String totalHouseholdNumber = baseMapper.getHouseHoldNumber(processIdList);
+                allRoundVo.setTotalHouseholdNumber(String.valueOf(totalHouseholdNumber));
                 String hasCharge = getHasStep("用户缴费", v);
                 allRoundVo.setHasCharge(hasCharge);
                 String hasSettle = getHasStep("用户结算", v);
@@ -188,9 +202,13 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, SignApplyVo> im
 
             }
             if ("市政工程".equals(k)) {
+
+                long totalHouseholdNumber=0;
+                for (List<Long> longs : processIdListList) {
+                     totalHouseholdNumber += Double.valueOf(baseMapper.getToRegularCount(longs));
+                }
                 //转固  TF_TRANSFER_FIXED_ASSETS_W
-                String toRegularCount = baseMapper.getToRegularCount(processIdList);
-                allRoundVo.setToRegularCount(toRegularCount);
+                allRoundVo.setToRegularCount(String.valueOf(totalHouseholdNumber));
             }
             result.add(allRoundVo);
         });

+ 6 - 6
workflow/src/main/java/com/tofly/workflow/utils/RedisQueueUtil.java

@@ -75,7 +75,7 @@ public class RedisQueueUtil {
                 Object message;
                 log.info("============启动监听 流程终止  {}",flag && !Thread.currentThread().isInterrupted());
                 while(flag && !Thread.currentThread().isInterrupted()) {
-                    log.info("GCZZ::"+FlowConstant.REDIS_QUERY_KEY+foreignConfig.getQueueGczzKey());
+                    log.debug("GCZZ::"+FlowConstant.REDIS_QUERY_KEY+foreignConfig.getQueueGczzKey());
                     message =  redisTemplate.opsForList().rightPop(FlowConstant.REDIS_QUERY_KEY+foreignConfig.getQueueGczzKey(), popTimeout, TimeUnit.SECONDS);
                     if(message!=null) {
                         log.info("流程终止 流程id" + message);
@@ -91,7 +91,7 @@ public class RedisQueueUtil {
                 Object message;
                 log.info("============启动监听 负责人变更  {}",flag && !Thread.currentThread().isInterrupted());
                 while(flag && !Thread.currentThread().isInterrupted()) {
-                    log.info("FZRBG::"+FlowConstant.REDIS_QUERY_KEY+foreignConfig.getQueueFzrbgKey());
+                    log.debug("FZRBG::"+FlowConstant.REDIS_QUERY_KEY+foreignConfig.getQueueFzrbgKey());
                     message =  redisTemplate.opsForList().rightPop(FlowConstant.REDIS_QUERY_KEY+foreignConfig.getQueueFzrbgKey(), popTimeout, TimeUnit.SECONDS);
                     if(message!=null) {
                         Thread.sleep(1000*10);
@@ -108,7 +108,7 @@ public class RedisQueueUtil {
         executorService.execute(()->{
             try {
                 Object message;
-                log.info("============启动监听 工程物料出库  {}",flag && !Thread.currentThread().isInterrupted());
+                log.debug("============启动监听 工程物料出库  {}",flag && !Thread.currentThread().isInterrupted());
                 String[]keys = foreignConfig.getQueueGcllKey().split(",");
                 while(flag && !Thread.currentThread().isInterrupted()) {
                     for (String key:keys) {
@@ -134,7 +134,7 @@ public class RedisQueueUtil {
                 String[]keys = foreignConfig.getQueueGctlKey().split(",");
                 while(flag && !Thread.currentThread().isInterrupted()) {
                     for (String key:keys) {
-                        log.info("GCTL::" + FlowConstant.REDIS_QUERY_KEY + key);
+                        log.debug("GCTL::" + FlowConstant.REDIS_QUERY_KEY + key);
                         message = redisTemplate.opsForList().rightPop(FlowConstant.REDIS_QUERY_KEY + key, popTimeout, TimeUnit.SECONDS);
                         if (message != null) {
                             Thread.sleep(1000 * 10);
@@ -186,13 +186,13 @@ public class RedisQueueUtil {
                 Object message;
                 log.info("============启动监听 小仓库核销  {}",flag && !Thread.currentThread().isInterrupted());
                 while(flag && !Thread.currentThread().isInterrupted()) {
-                    log.info("HX-CLHX::"+FlowConstant.REDIS_QUERY_KEY+foreignConfig.getQueueClhxKey());
+                    log.debug("HX-CLHX::"+FlowConstant.REDIS_QUERY_KEY+foreignConfig.getQueueClhxKey());
                     message =  redisTemplate.opsForList().rightPop(FlowConstant.REDIS_QUERY_KEY+foreignConfig.getQueueClhxKey(), popTimeout, TimeUnit.SECONDS);
                     if(message!=null) {
                         //查询
 
                         Thread.sleep(1000*10);
-                        log.info("小仓库核销 流程id" + message);
+                        log.debug("小仓库核销 流程id" + message);
                         Long processId = Long.parseLong(String.valueOf(message).trim());
                         //用友小仓库出库
                         mOutInService.materialOut(processId,FlowConstant.SHORT_THREE);