Commit 4f452ff9 by 翁国栋

8小时后台--

异常输出记录到日志
parent 902d8608
...@@ -197,3 +197,4 @@ ALTER TABLE `insure_product` ...@@ -197,3 +197,4 @@ ALTER TABLE `insure_product`
ALTER TABLE `insure_policy` ALTER TABLE `insure_policy`
ADD COLUMN `policy_pay_type` int(11) NOT NULL DEFAULT 1 COMMENT '1在线支付 2预付款 3线下支付' AFTER `create_time`, ADD COLUMN `policy_pay_type` int(11) NOT NULL DEFAULT 1 COMMENT '1在线支付 2预付款 3线下支付' AFTER `create_time`,
ADD COLUMN `pay_id` int(11) NULL DEFAULT NULL COMMENT 'insure_pay表的id' AFTER `policy_pay_type`; ADD COLUMN `pay_id` int(11) NULL DEFAULT NULL COMMENT 'insure_pay表的id' AFTER `policy_pay_type`;
...@@ -58,5 +58,5 @@ public class AttendanceAssistant implements Serializable{ ...@@ -58,5 +58,5 @@ public class AttendanceAssistant implements Serializable{
int restdayclock;//休息日打卡 int restdayclock;//休息日打卡
String PagetransferDate;//页面传输修改日期 String transferDate;//页面传输修改日期
} }
...@@ -160,7 +160,7 @@ public class CallBackContorll { ...@@ -160,7 +160,7 @@ public class CallBackContorll {
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("增员核保回调异常:",e);
throw new CustomException("增员核保回调异常"); throw new CustomException("增员核保回调异常");
} finally { } finally {
Map trueMap = Maps.newHashMap(); Map trueMap = Maps.newHashMap();
...@@ -256,7 +256,7 @@ public class CallBackContorll { ...@@ -256,7 +256,7 @@ public class CallBackContorll {
insurePolicy.updateById(); insurePolicy.updateById();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("保全增员申请回调异常:",e);
throw new CustomException("保全增员申请回调异常"); throw new CustomException("保全增员申请回调异常");
} finally { } finally {
Map trueMap = Maps.newHashMap(); Map trueMap = Maps.newHashMap();
...@@ -328,7 +328,7 @@ public class CallBackContorll { ...@@ -328,7 +328,7 @@ public class CallBackContorll {
.returnCode(dataMap.get("errcode").toString()).policyId(insurePay.getPolicyId()).returnMsg(dataMap.get("errmsg").toString()).build().insert(); .returnCode(dataMap.get("errcode").toString()).policyId(insurePay.getPolicyId()).returnMsg(dataMap.get("errmsg").toString()).build().insert();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("投保支付收银台回调异常:",e);
throw new CustomException("投保支付收银台回调异常"); throw new CustomException("投保支付收银台回调异常");
} finally { } finally {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
...@@ -383,7 +383,7 @@ public class CallBackContorll { ...@@ -383,7 +383,7 @@ public class CallBackContorll {
InsureLog.builder().type(7).createTime(new Date()).requestType(1).returnBody(sb.toString()).requestPath(getPolicyUrl) InsureLog.builder().type(7).createTime(new Date()).requestType(1).returnBody(sb.toString()).requestPath(getPolicyUrl)
.returnCode(callBack.getStatus()).policyId(insurePay.getPolicyId()).returnMsg(callBack.getErr_msg()).build().insert(); .returnCode(callBack.getStatus()).policyId(insurePay.getPolicyId()).returnMsg(callBack.getErr_msg()).build().insert();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("保单出单回调:",e);
throw new CustomException("保单出单回调"); throw new CustomException("保单出单回调");
} finally { } finally {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
...@@ -415,7 +415,7 @@ public class CallBackContorll { ...@@ -415,7 +415,7 @@ public class CallBackContorll {
InsureLog.builder().type(7).createTime(new Date()).requestType(1).returnBody(sb.toString()).requestPath(base_api_url + "/callBack/policy/batchPayCallback") InsureLog.builder().type(7).createTime(new Date()).requestType(1).returnBody(sb.toString()).requestPath(base_api_url + "/callBack/policy/batchPayCallback")
.returnCode(callBack.getPay_status()).policyId(insurePay.getPolicyId()).returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + insurePay.getAmount()).build().insert(); .returnCode(callBack.getPay_status()).policyId(insurePay.getPolicyId()).returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + insurePay.getAmount()).build().insert();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("增员支付回调异常:",e);
throw new CustomException("增员支付回调异常"); throw new CustomException("增员支付回调异常");
} finally { } finally {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
......
...@@ -46,6 +46,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -46,6 +46,7 @@ import org.springframework.web.multipart.MultipartFile;
@Transactional @Transactional
@RequestMapping(value = "/insureApplicant", produces = {"application/json"}) @RequestMapping(value = "/insureApplicant", produces = {"application/json"})
public class InsureApplicantController { public class InsureApplicantController {
private static final Logger log = LoggerFactory.getLogger(InsureApplicantController.class);
@PostMapping("/insureApplicationSetting") @PostMapping("/insureApplicationSetting")
@ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请") @ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请")
...@@ -56,7 +57,7 @@ public class InsureApplicantController { ...@@ -56,7 +57,7 @@ public class InsureApplicantController {
params.updateById(); params.updateById();
return ResultUtil.data(params); return ResultUtil.data(params);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("设置投保人异常:",e);
throw new CustomException("设置投保人异常"); throw new CustomException("设置投保人异常");
} }
} }
...@@ -75,7 +76,7 @@ public class InsureApplicantController { ...@@ -75,7 +76,7 @@ public class InsureApplicantController {
} }
return ResultUtil.data(insureApplicant); return ResultUtil.data(insureApplicant);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("获取投保人异常:",e);
throw new CustomException("获取投保人异常"); throw new CustomException("获取投保人异常");
} }
} }
...@@ -107,7 +108,7 @@ public class InsureApplicantController { ...@@ -107,7 +108,7 @@ public class InsureApplicantController {
} }
return ResultUtil.data(insureApplicant); return ResultUtil.data(insureApplicant);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("获取投保人异常:",e);
throw new CustomException("获取投保人异常"); throw new CustomException("获取投保人异常");
} }
} }
......
...@@ -504,7 +504,7 @@ public class ExcelUtils { ...@@ -504,7 +504,7 @@ public class ExcelUtils {
} else if (xssfCell.getCellTypeEnum() == CellType.BOOLEAN) { } else if (xssfCell.getCellTypeEnum() == CellType.BOOLEAN) {
return String.valueOf(xssfCell.getBooleanCellValue()); return String.valueOf(xssfCell.getBooleanCellValue());
} else { } else {
return xssfCell.getStringCellValue(); return xssfCell.getStringCellValue().trim();
} }
} }
} }
......
...@@ -8,11 +8,15 @@ import java.util.*; ...@@ -8,11 +8,15 @@ import java.util.*;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import cn.timer.api.config.sftp.SftpConfiguration;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.jcraft.jsch.ChannelSftp;
import io.swagger.models.auth.In;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.bouncycastle.jce.exception.ExtIOException; import org.bouncycastle.jce.exception.ExtIOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -77,6 +81,11 @@ public class OSSUtil { ...@@ -77,6 +81,11 @@ public class OSSUtil {
@Value("${zip.path}") @Value("${zip.path}")
private String zipPath; private String zipPath;
@Autowired
private SftpConfiguration config;
/** /**
* 1.创建储存空间 sout控制台輸出 储存空间名 * 1.创建储存空间 sout控制台輸出 储存空间名
* *
...@@ -594,10 +603,10 @@ public class OSSUtil { ...@@ -594,10 +603,10 @@ public class OSSUtil {
String Suffix; String Suffix;
try { try {
File folder = new File(zipPath); File folder = new File(zipPath);
if(!folder.exists()&& !folder .isDirectory()){ if (!folder.exists() && !folder.isDirectory()) {
folder.mkdirs(); folder.mkdirs();
} }
fos = new FileOutputStream(zipPath+fileName); fos = new FileOutputStream(zipPath + fileName);
zos = new ZipOutputStream(fos); zos = new ZipOutputStream(fos);
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
for (String m : urlMap.keySet()) { for (String m : urlMap.keySet()) {
...@@ -641,4 +650,68 @@ public class OSSUtil { ...@@ -641,4 +650,68 @@ public class OSSUtil {
} }
return fileName; return fileName;
} }
/**
* @Author wgd
* @Description 获取OSS文件字符流
* @Date 2021/12/2 18:06
**/
private Map getOssFileList(Map<String, String> urlMap) throws IOException {
Map<String, InputStream> map = Maps.newHashMap();
BufferedInputStream inputStream;
OSSObject ossObject;
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
for (String m : urlMap.keySet()) {
ossObject = ossClient.getObject(bucketName, urlMap.get(m));
inputStream = new BufferedInputStream(ossObject.getObjectContent());
String suffix = urlMap.get(m).substring(urlMap.get(m).lastIndexOf("."));
map.put(m + urlMap.get(m), inputStream);
}
ossClient.shutdown();
return map;
}
private Map getFtpFileList(Map<String, String> urlMap) throws IOException {
Map<String, InputStream> map = Maps.newHashMap();
InputStream inputStream;
for (String m : urlMap.keySet()) {
File file = new File(urlMap.get(m));
inputStream = new FileInputStream(file);
map.put(m, inputStream);
}
return map;
}
public String newZip(Map<String, String> ossMap, Map<String, String> ftpMap) throws IOException {
Map<String, InputStream> ossNewMap = getOssFileList(ossMap);
Map<String, InputStream> ftpNewMap = getFtpFileList(ftpMap);
ossNewMap.putAll(ftpNewMap);
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = dateFormat.format(new Date()) + ".zip";
FileOutputStream fos = null;
ZipOutputStream zos = null;
InputStream inputStream = null;
for (String m : ossNewMap.keySet()) {
ZipEntry entry = new ZipEntry(m);
try {
zos.putNextEntry(entry);
int nNumber;
byte[] buffer = new byte[4096];
while ((nNumber = ossNewMap.get(m).read(buffer)) > 0) {
zos.write(buffer, 0, nNumber);
}
} catch (IOException e) {
throw new IOException("写入失败");//TODO 应作为自定义异常
} finally {
try {
inputStream.close();
} catch (IOException e) {
throw new IOException("关闭失败");//TODO 应作为自定义异常
}
}
}
return fileName;
}
} }
spring: spring:
profiles: profiles:
active: test active: dev
#active: '@environment@' #active: '@environment@'
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