zhuwei 1 жил өмнө
parent
commit
a751641deb

+ 1 - 1
blade-common/src/main/java/org/springblade/common/constant/LauncherConstant.java

@@ -76,7 +76,7 @@ public interface LauncherConstant {
      * nacos dev 地址 215==172.31.222.127   192.168.0.109     127.0.0.1  210-=-172.30.224.81
      * nacos dev 地址 215==172.31.222.127   192.168.0.109     127.0.0.1  210-=-172.30.224.81
      * nacos dev 地址 172.31.222.127   192.168.0.109     127.0.0.1    172.30.224.81(39.108.216.210)
      * nacos dev 地址 172.31.222.127   192.168.0.109     127.0.0.1    172.30.224.81(39.108.216.210)
      */
      */
-    String NACOS_DEV_ADDR = "172.30.224.81:8848";
+    String NACOS_DEV_ADDR = "127.0.0.1:8848";
 
 
     /**
     /**
      * nacos prod 地址
      * nacos prod 地址

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/TaskClientImpl.java

@@ -109,7 +109,7 @@ public class TaskClientImpl implements TaskClient {
         //找到任务
         //找到任务
         Task task = this.queryTask(taskId);
         Task task = this.queryTask(taskId);
         if (task != null) {
         if (task != null) {
-            return task.getContractId();
+            return task.getContractId()+","+task.getProjectId();
         }
         }
         return null;
         return null;
     }
     }

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

@@ -38,6 +38,9 @@ import lombok.AllArgsConstructor;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDPage;
+import org.apache.pdfbox.pdmodel.PDPageContentStream;
+import org.apache.pdfbox.pdmodel.font.PDType1Font;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.entity.ArchiveFile;
@@ -87,14 +90,18 @@ import java.awt.image.BufferedImage;
 import java.io.*;
 import java.io.*;
 import java.net.URL;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.*;
 import java.util.*;
+import java.util.stream.Collectors;
 
 
 @Service
 @Service
 @AllArgsConstructor
 @AllArgsConstructor
 public class EVisaServiceImpl implements EVisaService {
 public class EVisaServiceImpl implements EVisaService {
 
 
     private static final String SIGN_HOST = "172.30.224.79";
     private static final String SIGN_HOST = "172.30.224.79";
-   // private static final String SIGN_HOST = "47.115.117.246";
+    //private static final String SIGN_HOST = "47.115.117.246";
 
 
     private static final String SIGN_PORT = "8183";
     private static final String SIGN_PORT = "8183";
 
 
@@ -250,7 +257,8 @@ public class EVisaServiceImpl implements EVisaService {
                 if (eVisaConfigList == null || eVisaConfigList.size() == 0) {
                 if (eVisaConfigList == null || eVisaConfigList.size() == 0) {
                     return finalPdfUrl;
                     return finalPdfUrl;
                 }
                 }
-                String contractId = this.taskClient.queryTaskContractId(task.getParallelProcessInstanceId());
+                String dataInfo = this.taskClient.queryTaskContractId(task.getParallelProcessInstanceId());
+                String contractId = Func.toStrArray(dataInfo)[0];
 
 
                 String ids = String.join(",", eVisaConfigList);
                 String ids = String.join(",", eVisaConfigList);
                 String sqlinfo = "SELECT a.id,a.pyzbx,a.pyzby,b.signature_file_url,b.id as sfId,b.certificate_password,b.certificate_user_name,b.certificate_number from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + contractId + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ")";
                 String sqlinfo = "SELECT a.id,a.pyzbx,a.pyzby,b.signature_file_url,b.id as sfId,b.certificate_password,b.certificate_user_name,b.certificate_number from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + contractId + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ")";
@@ -372,7 +380,6 @@ public class EVisaServiceImpl implements EVisaService {
     @Override
     @Override
     public String eVisa(EVisaTaskApprovalVO task) {
     public String eVisa(EVisaTaskApprovalVO task) {
         String resultMessage = E_VISA_ERROR;
         String resultMessage = E_VISA_ERROR;
-
         //用户默认的电签批次参数
         //用户默认的电签批次参数
         String sysBatch = ParamCache.getValue(CommonConstant.SYS_USER_TASK_BATCH);
         String sysBatch = ParamCache.getValue(CommonConstant.SYS_USER_TASK_BATCH);
         int batch = 2;
         int batch = 2;
@@ -382,7 +389,7 @@ public class EVisaServiceImpl implements EVisaService {
 
 
         //根据任务类型获取对应的文件信息
         //根据任务类型获取对应的文件信息
         TaskApprovalVO taskFile=new TaskApprovalVO();
         TaskApprovalVO taskFile=new TaskApprovalVO();
-        if(task.getApprovalType()<=4 || task.getApprovalType()<=8){
+        if(task.getApprovalType()<=4 || task.getApprovalType()==8){
             //上报类型,1填报资料,2工程文件,3日志资料  ,  4档案数据
             //上报类型,1填报资料,2工程文件,3日志资料  ,  4档案数据
             taskFile = this.taskClient.queryBusinessDataTask(JSONObject.parseObject(JSONObject.toJSONString(task), TaskApprovalVO.class));
             taskFile = this.taskClient.queryBusinessDataTask(JSONObject.parseObject(JSONObject.toJSONString(task), TaskApprovalVO.class));
         } else if ( task.getApprovalType()>=5) {
         } else if ( task.getApprovalType()>=5) {
@@ -410,6 +417,7 @@ public class EVisaServiceImpl implements EVisaService {
             //获取需要签章的数据
             //获取需要签章的数据
             List<TaskApprovalVO.ApprovalFile> files = taskFile.getApprovalFileList();
             List<TaskApprovalVO.ApprovalFile> files = taskFile.getApprovalFileList();
 
 
+
             //这里的文件只会是一张拼接好的PDF
             //这里的文件只会是一张拼接好的PDF
             for (TaskApprovalVO.ApprovalFile file : files) {
             for (TaskApprovalVO.ApprovalFile file : files) {
 
 
@@ -426,15 +434,34 @@ public class EVisaServiceImpl implements EVisaService {
                     RedisTemplate.delete("sign-" + task.getFormDataId());
                     RedisTemplate.delete("sign-" + task.getFormDataId());
                     return SUCCESS + "@@@@" + taskFile.getApprovalFileList().get(0).getFileUrl();
                     return SUCCESS + "@@@@" + taskFile.getApprovalFileList().get(0).getFileUrl();
                 }
                 }
-                String contractId = this.taskClient.queryTaskContractId(task.getParallelProcessInstanceId());
+                String dataInfo = this.taskClient.queryTaskContractId(task.getParallelProcessInstanceId());
                 String ids = String.join(",", eVisaConfigList);
                 String ids = String.join(",", eVisaConfigList);
                 //判断电签类型
                 //判断电签类型
+                String contractId = Func.toStrArray(dataInfo)[0];
+                String projectId = Func.toStrArray(dataInfo)[1];
 
 
                 if (taskFile.getRemarkType().equals("2")) {//东方 中讯 daMap.put("keyWord","1673632651551965184");
                 if (taskFile.getRemarkType().equals("2")) {//东方 中讯 daMap.put("keyWord","1673632651551965184");
-                    String sqlinfo = " SELECT a.id as keyWord,(SELECT acc_code from blade_user where id='" + task.getUserId() + "' and is_deleted=0  ) as sealId from m_textdict_info a where  a.type =2 and a.id in (" + ids + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + contractId + " and user_id=" + task.getUserId() + " and c.is_deleted=0 )";
+                    String sqlinfo = " SELECT a.id as keyWord,a.project_id,(SELECT acc_code from blade_user where id='" + task.getUserId() + "' and is_deleted=0  ) as sealId from m_textdict_info a where  a.type =2 and a.id in (" + ids + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + contractId + " and user_id=" + task.getUserId() + " and c.is_deleted=0 )";
                     System.out.println("东方中讯-个人-user-id" + task.getUserId() + "--SQL=" + sqlinfo);
                     System.out.println("东方中讯-个人-user-id" + task.getUserId() + "--SQL=" + sqlinfo);
-                    List<Map<String, Object>> maps = jdbcTemplate.queryForList(sqlinfo);
-                    if (maps != null && !maps.isEmpty()) {
+                    List<Map<String, Object>> maps2 = jdbcTemplate.queryForList(sqlinfo);
+                    if (maps2 != null && !maps2.isEmpty()) {
+                        List<Map<String, Object>> maps = new ArrayList<>();
+                        Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
+                                .collect(Collectors.groupingBy( hada ->(Func.toStr(hada.get("id")))));
+
+                        for(String keyId :peopleByAge.keySet()){
+                            List<Map<String, Object>> keyList = peopleByAge.get(keyId);
+                            if(keyList!=null && keyList.size()==1){
+                                maps.addAll(keyList);
+                            }else if(keyList!=null && keyList.size()>=1){
+                                for(Map<String, Object> datax : keyList){
+                                    if((datax.get("project_id")+"").equals(projectId)){
+                                        maps.add(datax);
+                                    }
+                                }
+                            }
+                        }
+
                         String fileUrl = pdfUrl;
                         String fileUrl = pdfUrl;
                         for (Map<String, Object> dataMap : maps) {
                         for (Map<String, Object> dataMap : maps) {
                             HashMap<String, Object> daMa = new HashMap<>();
                             HashMap<String, Object> daMa = new HashMap<>();
@@ -484,8 +511,26 @@ public class EVisaServiceImpl implements EVisaService {
                         return SUCCESS + "@@@@" + taskFile.getApprovalFileList().get(0).getFileUrl();
                         return SUCCESS + "@@@@" + taskFile.getApprovalFileList().get(0).getFileUrl();
                     }
                     }
                 } else { //安心签证
                 } else { //安心签证
-                    String sqlinfo = " SELECT DISTINCT a.id,a.pyzbx ,a.pyzby,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='" + task.getUserId() + "' and is_deleted=0  ) as signature_file_url from m_textdict_info a where  a.type =2 and a.id in (" + ids + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + contractId + " and user_id=" + task.getUserId() + " and c.is_deleted=0 )";
-                    List<Map<String, Object>> maps = jdbcTemplate.queryForList(sqlinfo);
+                    String sqlinfo = " SELECT DISTINCT a.id,a.pyzbx ,a.pyzby,a.project_id,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='" + task.getUserId() + "' and is_deleted=0  ) as signature_file_url from m_textdict_info a where  a.type =2 and a.id in (" + ids + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + contractId + " and user_id=" + task.getUserId() + " and c.is_deleted=0 )";
+                    List<Map<String, Object>> maps2 = jdbcTemplate.queryForList(sqlinfo);
+
+                    List<Map<String, Object>> maps = new ArrayList<>();
+                    Map<String, List<Map<String, Object>>> peopleByAge = maps2.stream()
+                            .collect(Collectors.groupingBy( hada ->(Func.toStr(hada.get("id")))));
+
+                    for(String keyId :peopleByAge.keySet()){
+                        List<Map<String, Object>> keyList = peopleByAge.get(keyId);
+                        if(keyList!=null && keyList.size()==1){
+                            maps.addAll(keyList);
+                        }else if(keyList!=null && keyList.size()>=1){
+                            for(Map<String, Object> datax : keyList){
+                                if((datax.get("project_id")+"").equals(projectId)){
+                                    maps.add(datax);
+                                }
+                            }
+                        }
+                    }
+
                     System.out.println("安心签-个人-user-id" + task.getUserId() + "--SQL=" + sqlinfo);
                     System.out.println("安心签-个人-user-id" + task.getUserId() + "--SQL=" + sqlinfo);
                     if (maps == null || maps.size() <= 0) {
                     if (maps == null || maps.size() <= 0) {
                         //没有签章,不执行电签
                         //没有签章,不执行电签
@@ -700,21 +745,21 @@ public class EVisaServiceImpl implements EVisaService {
         return "";
         return "";
     }
     }
 
 
-/*
-    public static void main(String[] args) throws Exception {
-        String pdfPath ="/Users/hongchuangyanfa/Downloads/2207f338ed7d2d65eba145fbb75a1ee9.pdf";
+    public static void main22(String[] args) throws Exception {
+       // String pdfPath ="/Users/hongchuangyanfa/Desktop/pdf/1788120810012016640123.pdf";
+        String pdfPath ="/Users/hongchuangyanfa/Desktop/pdf/outPdf.pdf";
         String sealId ="0ff724e095fc4a16b9c9c25ebe44e68f";
         String sealId ="0ff724e095fc4a16b9c9c25ebe44e68f";
         String formDataId ="vv";
         String formDataId ="vv";
         List<Map<String,Object>> maps = new ArrayList<>();
         List<Map<String,Object>> maps = new ArrayList<>();
         Map<String,Object> daMap = new HashMap<>();
         Map<String,Object> daMap = new HashMap<>();
-        daMap.put("keyWord","1778694778876067840");
+        daMap.put("keyWord","12345");
         daMap.put("sealId",sealId);
         daMap.put("sealId",sealId);
         //设置显示签字体的宽高
         //设置显示签字体的宽高
         daMap.put("showHeight",30);
         daMap.put("showHeight",30);
         daMap.put("showWidth",60);
         daMap.put("showWidth",60);
         //设置显示签字体的位置
         //设置显示签字体的位置
-        daMap.put("sealOffsetY",-15);
-        daMap.put("sealOffsetX",-30);
+       // daMap.put("sealOffsetY",-15);
+       // daMap.put("sealOffsetX",-30);
 
 
         maps.add(daMap);
         maps.add(daMap);
 
 
@@ -738,7 +783,7 @@ public class EVisaServiceImpl implements EVisaService {
             System.out.println(fileUrl);
             System.out.println(fileUrl);
         }
         }
     }
     }
-*/
+
 
 
     /**
     /**
      * 东方 中讯
      * 东方 中讯
@@ -1535,4 +1580,5 @@ public class EVisaServiceImpl implements EVisaService {
         return sealStrategy;
         return sealStrategy;
     }
     }
 
 
+
 }
 }

+ 0 - 49
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/utils/PDFUtils.java

@@ -24,55 +24,6 @@ import java.util.stream.Collectors;
 
 
 
 
 public class PDFUtils {
 public class PDFUtils {
-/*
-    public static List<String> getPdfSignIds(String pdfUrl) {
-        PdfDocument pdf = new PdfDocument();
-        List<String> eVisaConfigList = new ArrayList<>();
-
-        try {
-            InputStream ossInputStream = CommonUtil.getOSSInputStream(pdfUrl);
-            //加载PDF文档
-            pdf.loadFromStream(ossInputStream);
-            //创建PdfTableExtractor类的对象
-            PdfTableExtractor extractor = new PdfTableExtractor(pdf);
-            for (int page = 0; page < pdf.getPages().getCount(); page++) {
-                //提取页面中的表格存入PdfTable[]数组
-                PdfTable[] tableLists = extractor.extractTable(page);
-                if (tableLists != null && tableLists.length > 0) {
-                    //遍历表格
-                    for (PdfTable table : tableLists) {
-                        int row = table.getRowCount();//获取表格行
-                        int column = table.getColumnCount();//获取表格列
-                        for (int i = 0; i < row; i++) {
-                            for (int j = 0; j < column; j++) {
-                                //获取表格中的文本内容
-                                String text = table.getText(i, j);
-                                System.out.println(text);
-                                String textVal[] = text.split(" ");
-                                for (String textStr : textVal) {
-                                    if (textStr.length() >= 15 && Func.isNumeric(textStr)) {
-                                        eVisaConfigList.add(textStr);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            ossInputStream.close();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-        return eVisaConfigList;
-    }
-*/
-public static void main11(String[] args) {
-    String data = "/Users/hongchuangyanfa/Desktop/excel/123456.xlsx";
-
-
-
-
-}
     public static synchronized List<String>  getPdfSignIds(String pdfUrl) {
     public static synchronized List<String>  getPdfSignIds(String pdfUrl) {
         PdfDocument pdf = new PdfDocument();
         PdfDocument pdf = new PdfDocument();
         List<String> eVisaConfigList = new ArrayList<>();
         List<String> eVisaConfigList = new ArrayList<>();

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

@@ -162,6 +162,16 @@ public class FileUtils {
         return -1;
         return -1;
     }
     }
 
 
+/*    public static void main(String[] args) {
+        String outPdfUrl = "/Users/hongchuangyanfa/Desktop/pdf/outPdf.pdf";
+
+        List<String> urlList = new ArrayList<>();
+        for(int i=0; i<=500 ;i++){
+            urlList.add("/Users/hongchuangyanfa/Desktop/pdf/1788120810012016640123.pdf");
+        }
+        mergePdfPublicMethods(urlList, outPdfUrl);
+    }*/
+
     /**
     /**
      * 合并方法
      * 合并方法
      */
      */
@@ -178,7 +188,8 @@ public class FileUtils {
             for (String urlStr : urlList) {
             for (String urlStr : urlList) {
                 try {
                 try {
                     //获取OSS文件输入流
                     //获取OSS文件输入流
-                    reader = new PdfReader(Objects.requireNonNull(CommonUtil.getOSSInputStream(urlStr)));
+                   // reader = new PdfReader(Objects.requireNonNull(CommonUtil.getOSSInputStream(urlStr)));
+                    reader = new PdfReader(Objects.requireNonNull(FileUtils.getInputStreamByUrl(urlStr)));
 
 
                     pageCount = reader.getNumberOfPages();
                     pageCount = reader.getNumberOfPages();
 
 

+ 3 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -967,6 +967,9 @@ public class TaskController extends BladeController {
                         List<StartPayMeterForm> startPayMeterForms = startPayMeterFormService.getBaseMapper().selectList(Wrappers.<StartPayMeterForm>lambdaQuery()
                         List<StartPayMeterForm> startPayMeterForms = startPayMeterFormService.getBaseMapper().selectList(Wrappers.<StartPayMeterForm>lambdaQuery()
                                 .eq(StartPayMeterForm::getMeterPeriodId, periodId));
                                 .eq(StartPayMeterForm::getMeterPeriodId, periodId));
                         List<Long> startPayMeterFormsIds = startPayMeterForms.stream().map(StartPayMeterForm::getId).collect(Collectors.toList());
                         List<Long> startPayMeterFormsIds = startPayMeterForms.stream().map(StartPayMeterForm::getId).collect(Collectors.toList());
+                        if(startPayMeterFormsIds ==null && startPayMeterFormsIds.size()==0){
+                            startPayMeterFormsIds.add(1234567890L);
+                        }
 
 
                         /*修改数据源状态为=未上报*/
                         /*修改数据源状态为=未上报*/
                         List<BaseService<?>> baseServiceList_1 = new ArrayList<>();
                         List<BaseService<?>> baseServiceList_1 = new ArrayList<>();