|
@@ -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;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|