|
@@ -241,7 +241,7 @@ public class EVisaServiceImpl implements EVisaService {
|
|
|
String sqlinfo = "SELECT a.id,a.pyzbx,a.pyzby,b.signature_file_url,b.id as sfId,b.certificate_password,b.certificate_user_name 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 + ")";
|
|
|
List<Map<String, Object>> maps = jdbcTemplate.queryForList(sqlinfo);
|
|
|
System.out.println("合同-" + contractId + "--" + sqlinfo);
|
|
|
- if(maps==null ||maps.isEmpty()){
|
|
|
+ if (maps == null || maps.isEmpty()) {
|
|
|
return finalPdfUrl;
|
|
|
}
|
|
|
//准备签章策略
|
|
@@ -436,17 +436,17 @@ public class EVisaServiceImpl implements EVisaService {
|
|
|
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 )";
|
|
|
System.out.println("东方中讯-个人-user-id" + task.getUserId() + "--SQL=" + sqlinfo);
|
|
|
List<Map<String, Object>> maps = jdbcTemplate.queryForList(sqlinfo);
|
|
|
- if(maps != null && !maps.isEmpty()){
|
|
|
+ if (maps != null && !maps.isEmpty()) {
|
|
|
String fileUrl = pdfUrl;
|
|
|
- for(Map<String, Object> dataMap : maps){
|
|
|
- HashMap<String,Object> daMa = new HashMap<>();
|
|
|
- daMa.put("keyWord",dataMap.get("keyWord"));
|
|
|
- daMa.put("sealId",dataMap.get("sealId"));
|
|
|
+ for (Map<String, Object> dataMap : maps) {
|
|
|
+ HashMap<String, Object> daMa = new HashMap<>();
|
|
|
+ daMa.put("keyWord", dataMap.get("keyWord"));
|
|
|
+ daMa.put("sealId", dataMap.get("sealId"));
|
|
|
|
|
|
byte[] fileByte;
|
|
|
- if(fileUrl.indexOf("aliyuncs.com")>=0){
|
|
|
+ if (fileUrl.indexOf("aliyuncs.com") >= 0) {
|
|
|
fileByte = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(fileUrl));
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
FileReader fileReader = new FileReader(fileUrl);
|
|
|
fileByte = fileReader.readBytes();
|
|
|
}
|
|
@@ -454,23 +454,23 @@ public class EVisaServiceImpl implements EVisaService {
|
|
|
String originalFileB64 = Base64.toBase64String(fileByte);
|
|
|
daMa.put("fileB64", originalFileB64);
|
|
|
daMa.put("lastSignFlag", false);
|
|
|
- String reData = signPdfByDFZX(daMa);
|
|
|
- if(reData.indexOf("success@")>=0){
|
|
|
+ String reData = signPdfByDFZX(daMa);
|
|
|
+ if (reData.indexOf("success@") >= 0) {
|
|
|
fileUrl = reData.split("@@@@")[1];
|
|
|
}
|
|
|
}
|
|
|
- if(fileUrl.indexOf("aliyuncs.com")>=0){
|
|
|
+ if (fileUrl.indexOf("aliyuncs.com") >= 0) {
|
|
|
return E_VISA_ERROR;
|
|
|
- }else{
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(fileUrl.substring(fileUrl.lastIndexOf("/")+1,fileUrl.length()),fileUrl);
|
|
|
+ } else {
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(fileUrl.substring(fileUrl.lastIndexOf("/") + 1, fileUrl.length()), fileUrl);
|
|
|
if (bladeFile != null) {
|
|
|
- System.out.println("pdf上传="+bladeFile.getLink());
|
|
|
+ System.out.println("pdf上传=" + bladeFile.getLink());
|
|
|
return SUCCESS + "@@@@" + bladeFile.getLink();
|
|
|
} else {
|
|
|
return E_VISA_ERROR;
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
RedisTemplate.delete("sign-" + task.getFormDataId());
|
|
|
return SUCCESS + "@@@@" + taskFile.getApprovalFileList().get(0).getFileUrl();
|
|
|
}
|
|
@@ -540,7 +540,7 @@ public class EVisaServiceImpl implements EVisaService {
|
|
|
*
|
|
|
* @param taskArchiveDTO
|
|
|
*/
|
|
|
- public void eVisaCustom(org.springblade.evisa.vo.TaskArchiveDTO taskArchiveDTO) {
|
|
|
+ public String eVisaCustom(org.springblade.evisa.vo.TaskArchiveDTO taskArchiveDTO) {
|
|
|
//type=1表示任务审批自定义签章,type=2表示认证电签签章(不涉及审批任务)
|
|
|
if (taskArchiveDTO.getSealStrategy().size() > 0 && taskArchiveDTO.getType() == 1) {
|
|
|
//获取档案任务
|
|
@@ -599,15 +599,18 @@ public class EVisaServiceImpl implements EVisaService {
|
|
|
jdbcTemplate.execute("update u_archive_file set e_visa_file = '" + bladeFile.getLink() + "' where id = " + task.getFormDataId());
|
|
|
String successMsg = SUCCESS + "@@@@" + bladeFile.getLink();
|
|
|
logger.info(successMsg);
|
|
|
+ return successMsg;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
+ return e.getMessage();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ return "";
|
|
|
} else if (taskArchiveDTO.getSealStrategy().size() > 0 && taskArchiveDTO.getType() == 2) {
|
|
|
//此时的taskArchiveDTO.taskId=档案数据业务id(档案认证不涉及审批流任务)
|
|
|
//获取档案任务的文件信息(这里根据id再查询一次,入参的时候不想重新构造入参的dto了)
|
|
@@ -655,11 +658,6 @@ public class EVisaServiceImpl implements EVisaService {
|
|
|
//返回结果集
|
|
|
if (result != null) {
|
|
|
if (result[0] != null) {
|
|
|
- /*byte[] byteArray = IOUtils.toByteArray(new ByteArrayInputStream((byte[]) result[0]));
|
|
|
- String dataUrl = "C:\\pdfFiles\\" + SnowFlakeUtil.getId() + ".pdf";
|
|
|
- File file1 = new File(dataUrl);
|
|
|
- FileUtils.writeByteArrayToFile(file1, byteArray);*/
|
|
|
-
|
|
|
MultipartFile newFiles = new MockMultipartFile("file", SnowFlakeUtil.getId() + ".pdf", "text/plain", IOUtils.toByteArray(new ByteArrayInputStream((byte[]) result[0])));
|
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFileByInputStream(newFiles);
|
|
|
if (bladeFile != null) {
|
|
@@ -667,15 +665,18 @@ public class EVisaServiceImpl implements EVisaService {
|
|
|
jdbcTemplate.execute("update u_archive_file set is_certification = 1,e_visa_file = '" + bladeFile.getLink() + "',certification_time = '" + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + "' where id = " + taskArchiveDTO.getTaskId());
|
|
|
String successMsg = SUCCESS + "@@@@" + bladeFile.getLink();
|
|
|
logger.info(successMsg);
|
|
|
+ return successMsg;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
+ return e.getMessage();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
/* public static void main(String[] args) throws Exception {
|
|
@@ -714,16 +715,17 @@ public class EVisaServiceImpl implements EVisaService {
|
|
|
System.out.println(fileUrl);
|
|
|
}
|
|
|
}*/
|
|
|
+
|
|
|
/**
|
|
|
* 东方 中讯
|
|
|
*
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public static String signPdfByDFZX(HashMap<String, Object> request) {
|
|
|
+ public static String signPdfByDFZX(HashMap<String, Object> request) {
|
|
|
String url = "http://47.110.251.215:9125/FrontSysGs/SealServicezx/FileSignByKeyWord";
|
|
|
String sysLocalFileUrl = FileUtils.getSysLocalFileUrl();
|
|
|
String filecode = SnowFlakeUtil.getId() + "";
|
|
|
- String dataFileUrl = sysLocalFileUrl+"/pdf/"+filecode+".pdf";
|
|
|
+ String dataFileUrl = sysLocalFileUrl + "/pdf/" + filecode + ".pdf";
|
|
|
try {
|
|
|
HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory();
|
|
|
httpRequestFactory.setConnectionRequestTimeout(30000);
|
|
@@ -762,7 +764,7 @@ public class EVisaServiceImpl implements EVisaService {
|
|
|
fout.close();
|
|
|
return SUCCESS + "@@@@" + dataFileUrl;
|
|
|
} catch (Exception e) {
|
|
|
- return ERROR + "@@@@异常出错";
|
|
|
+ return ERROR + "@@@@异常出错";
|
|
|
}
|
|
|
}
|
|
|
|