Commit 05ea10b7 authored by hongguangwu's avatar hongguangwu

MVP1.7.10-税友临时版本-加点附件的日志

parent 609a1ec1
...@@ -248,12 +248,13 @@ public class SocialFriendConfig { ...@@ -248,12 +248,13 @@ public class SocialFriendConfig {
// 行政区划代码 户里的缴纳地,精确到市 "340100" // 行政区划代码 户里的缴纳地,精确到市 "340100"
HttpEntity<String> formEntity = new HttpEntity<>(json.toString(), headers); HttpEntity<String> formEntity = new HttpEntity<>(json.toString(), headers);
backLog.setLogInfo(String.valueOf(formEntity));
backLog.setCreateTime(LocalDateTime.now());
String dataResultList = restTemplate.postForObject(appAddUrl, formEntity, String.class); String dataResultList = restTemplate.postForObject(appAddUrl, formEntity, String.class);
// {"head":{"code":"00000000","description":"成功","msg":"成功","time":"2024-12-06 17:10:26","status":"Y" // {"head":{"code":"00000000","description":"成功","msg":"成功","time":"2024-12-06 17:10:26","status":"Y"
// ,"body":{"requestId":"85440b327d71466abcd9c5c81d5bb172" // ,"body":{"requestId":"85440b327d71466abcd9c5c81d5bb172"
if (Common.isNotNull(dataResultList)) { if (Common.isNotNull(dataResultList)) {
backLog.setLogInfo(dataResultList); backLog.setLogInfo(dataResultList);
backLog.setCreateTime(LocalDateTime.now());
JSONObject dataObject = JSON.parseObject(dataResultList); JSONObject dataObject = JSON.parseObject(dataResultList);
String head = dataObject.getString("head"); String head = dataObject.getString("head");
if (Common.isNotNull(head)) { if (Common.isNotNull(head)) {
...@@ -265,6 +266,8 @@ public class SocialFriendConfig { ...@@ -265,6 +266,8 @@ public class SocialFriendConfig {
urlStr = bodyObject.getString("wjlj"); urlStr = bodyObject.getString("wjlj");
} }
} }
} else {
backLog.setSocialId(appAddUrl+"返回dataResultList为空");
} }
return urlStr; return urlStr;
} }
......
...@@ -46,6 +46,7 @@ import org.springframework.web.client.RestTemplate; ...@@ -46,6 +46,7 @@ import org.springframework.web.client.RestTemplate;
import java.io.*; import java.io.*;
import java.net.URL; import java.net.URL;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
...@@ -1106,6 +1107,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -1106,6 +1107,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
TSocialFriendBackLog backLog = new TSocialFriendBackLog(); TSocialFriendBackLog backLog = new TSocialFriendBackLog();
backLog.setSocialId(searchVo.getSocialId()); backLog.setSocialId(searchVo.getSocialId());
backLog.setType(CommonConstants.SIX_INT); backLog.setType(CommonConstants.SIX_INT);
backLog.setCreateTime(LocalDateTime.now());
R<String> ulrR = excelToImage.excelToImg(inputStreamOut, socialFriendConfig, restTemplate, backLog); R<String> ulrR = excelToImage.excelToImg(inputStreamOut, socialFriendConfig, restTemplate, backLog);
tSocialFriendBackLogService.save(backLog); tSocialFriendBackLogService.save(backLog);
return ulrR; return ulrR;
......
...@@ -43,6 +43,7 @@ public class ExcelToImage { ...@@ -43,6 +43,7 @@ public class ExcelToImage {
public R<String> excelToImg(InputStream inputStream , SocialFriendConfig socialFriendConfig public R<String> excelToImg(InputStream inputStream , SocialFriendConfig socialFriendConfig
, RestTemplate restTemplate, TSocialFriendBackLog backLog){ , RestTemplate restTemplate, TSocialFriendBackLog backLog){
backLog.setLogInfo("开始转换excel为图片");
if (null == inputStream || null == socialFriendConfig){ if (null == inputStream || null == socialFriendConfig){
return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagParamError); return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagParamError);
} }
...@@ -61,10 +62,12 @@ public class ExcelToImage { ...@@ -61,10 +62,12 @@ public class ExcelToImage {
file = new File(projectRoot+toImag); file = new File(projectRoot+toImag);
if (file.exists()){ if (file.exists()){
// file 压缩到1M以内 // file 压缩到1M以内
backLog.setLogInfo("压缩大小前");
file = compressImage(projectRoot, toImag, 1024 * 1024); file = compressImage(projectRoot, toImag, 1024 * 1024);
String key = System.currentTimeMillis() + file.getName(); String key = System.currentTimeMillis() + file.getName();
byte[] fileContent = Files.readAllBytes(file.toPath()); byte[] fileContent = Files.readAllBytes(file.toPath());
String base64String = Base64.getEncoder().encodeToString(fileContent); String base64String = Base64.getEncoder().encodeToString(fileContent);
backLog.setLogInfo("转化为base64String");
String url = socialFriendConfig.uploadPng(restTemplate, key, base64String, backLog); String url = socialFriendConfig.uploadPng(restTemplate, key, base64String, backLog);
if (Common.isEmpty(url)){ if (Common.isEmpty(url)){
return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagOSSError); return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagOSSError);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment