Commit 91d0e935 by 翁国栋

8小时后台--

导入保单时,产品id对应返回
添加失败回滚事务
parent 420719e1
...@@ -95,7 +95,8 @@ public class CallBackContorll { ...@@ -95,7 +95,8 @@ public class CallBackContorll {
@PostMapping(value = "/addpPayCallBack") @PostMapping(value = "/addpPayCallBack")
@ApiOperation(value = "11.增员核保回调", httpMethod = "POST", notes = "增员核保回调") @ApiOperation(value = "11.增员核保回调", httpMethod = "POST", notes = "增员核保回调")
private Map addpPayCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { @Transactional(rollbackFor = Exception.class)
public Map addpPayCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
/*核保*/ /*核保*/
/*如果是在线支付的话*/ /*如果是在线支付的话*/
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
...@@ -171,8 +172,8 @@ public class CallBackContorll { ...@@ -171,8 +172,8 @@ public class CallBackContorll {
@PostMapping(value = "/CallBack") @PostMapping(value = "/CallBack")
@ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调") @ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调")
@ApiOperationSupport(order = 2) @Transactional(rollbackFor = Exception.class)
private Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { public Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("status", "error"); map.put("status", "error");
if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) { if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) {
...@@ -269,7 +270,8 @@ public class CallBackContorll { ...@@ -269,7 +270,8 @@ public class CallBackContorll {
@GetMapping(value = "/payStatus") @GetMapping(value = "/payStatus")
@ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态") @ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态")
private ModelAndView callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException { @Transactional(rollbackFor = Exception.class)
public ModelAndView callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException {
InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById(); InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById();
InsurePay insurePay = InsurePay.builder().id(insurePolicy.getPayId()).build().selectById(); InsurePay insurePay = InsurePay.builder().id(insurePolicy.getPayId()).build().selectById();
insurePay.setPayTime(new Date()); insurePay.setPayTime(new Date());
...@@ -283,7 +285,8 @@ public class CallBackContorll { ...@@ -283,7 +285,8 @@ public class CallBackContorll {
@PostMapping(value = "/payCallBack") @PostMapping(value = "/payCallBack")
@ApiOperation(value = "9.投保支付收银台回调", httpMethod = "POST", notes = "支付完成跳转") @ApiOperation(value = "9.投保支付收银台回调", httpMethod = "POST", notes = "支付完成跳转")
private Map payCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { @Transactional(rollbackFor = Exception.class)
public Map payCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
try { try {
InputStream is = null; InputStream is = null;
is = request.getInputStream(); is = request.getInputStream();
...@@ -339,7 +342,8 @@ public class CallBackContorll { ...@@ -339,7 +342,8 @@ public class CallBackContorll {
@PostMapping(value = "/issueCallback") @PostMapping(value = "/issueCallback")
@ApiOperation(value = "10.保单出单回调", httpMethod = "POST", notes = "支付完成跳转") @ApiOperation(value = "10.保单出单回调", httpMethod = "POST", notes = "支付完成跳转")
private Map issueCallback(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { @Transactional(rollbackFor = Exception.class)
public Map issueCallback(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
try { try {
InputStream is = null; InputStream is = null;
is = request.getInputStream(); is = request.getInputStream();
...@@ -394,7 +398,8 @@ public class CallBackContorll { ...@@ -394,7 +398,8 @@ public class CallBackContorll {
@PostMapping(value = "/batchPayCallback") @PostMapping(value = "/batchPayCallback")
@ApiOperation(value = "增员支付回调-保司接口没启用", httpMethod = "POST", notes = "增员支付回调") @ApiOperation(value = "增员支付回调-保司接口没启用", httpMethod = "POST", notes = "增员支付回调")
private Map batchPayCallback(HttpServletRequest request) throws IOException { @Transactional(rollbackFor = Exception.class)
public Map batchPayCallback(HttpServletRequest request) throws IOException {
try { try {
InputStream is = null; InputStream is = null;
......
...@@ -50,7 +50,8 @@ public class InsureApplicantController { ...@@ -50,7 +50,8 @@ public class InsureApplicantController {
@PostMapping("/insureApplicationSetting") @PostMapping("/insureApplicationSetting")
@ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请") @ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请")
private Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) { @Transactional(rollbackFor = Exception.class)
public Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) {
try { try {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, params.getOrgCode())); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, params.getOrgCode()));
params.setId(insureApplicant.getId()); params.setId(insureApplicant.getId());
...@@ -65,7 +66,8 @@ public class InsureApplicantController { ...@@ -65,7 +66,8 @@ public class InsureApplicantController {
@GetMapping("/getApplicantAdmin") @GetMapping("/getApplicantAdmin")
@ApiOperation(value = "获取投保人--运营后台", httpMethod = "GET", notes = "获取投保人") @ApiOperation(value = "获取投保人--运营后台", httpMethod = "GET", notes = "获取投保人")
private Result<Object> getApplicant(@RequestParam("orgCode") Integer orgCode) { @Transactional(rollbackFor = Exception.class)
public Result<Object> getApplicant(@RequestParam("orgCode") Integer orgCode) {
try { try {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, orgCode)); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, orgCode));
if (insureApplicant == null) { if (insureApplicant == null) {
...@@ -97,7 +99,8 @@ public class InsureApplicantController { ...@@ -97,7 +99,8 @@ public class InsureApplicantController {
@GetMapping("/getApplicant") @GetMapping("/getApplicant")
@ApiOperation(value = "获取投保人--8小时", httpMethod = "GET", notes = "获取投保人") @ApiOperation(value = "获取投保人--8小时", httpMethod = "GET", notes = "获取投保人")
private Result<Object> getApplicant(@CurrentUser UserBean userBean) { @Transactional(rollbackFor = Exception.class)
public Result<Object> getApplicant(@CurrentUser UserBean userBean) {
try { try {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, userBean.getOrgCode())); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, userBean.getOrgCode()));
if (insureApplicant == null) { if (insureApplicant == null) {
......
...@@ -127,7 +127,6 @@ public class InsureContorll { ...@@ -127,7 +127,6 @@ public class InsureContorll {
private InsurePolicyMapper insurePolicyMapper; private InsurePolicyMapper insurePolicyMapper;
/** /**
* 设置请求参数 * 设置请求参数
* *
...@@ -157,7 +156,8 @@ public class InsureContorll { ...@@ -157,7 +156,8 @@ public class InsureContorll {
@PostMapping(value = "/insured_add") @PostMapping(value = "/insured_add")
@ApiOperation(value = "1.投保申请", httpMethod = "POST", notes = "投保申请") @ApiOperation(value = "1.投保申请", httpMethod = "POST", notes = "投保申请")
public Result<Object> insured_add(@RequestBody InsureDto insureDto){ @Transactional(rollbackFor = Exception.class)
public Result<Object> insured_add(@RequestBody InsureDto insureDto) {
InsureProduct insureProduct = InsureProduct.builder().id(Integer.parseInt(insureDto.getProductId())).build().selectById(); InsureProduct insureProduct = InsureProduct.builder().id(Integer.parseInt(insureDto.getProductId())).build().selectById();
if (insureProduct == null) { if (insureProduct == null) {
return ResultUtil.error("产品不存在"); return ResultUtil.error("产品不存在");
...@@ -175,7 +175,7 @@ public class InsureContorll { ...@@ -175,7 +175,7 @@ public class InsureContorll {
bodyMap.put("is_ss", 0); bodyMap.put("is_ss", 0);
bodyMap.put("quotations_method", "1"); bodyMap.put("quotations_method", "1");
Map quotations = Maps.newHashMap(); Map quotations = Maps.newHashMap();
if(insureDto.getPlans().size()<=0){ if (insureDto.getPlans().size() <= 0) {
return ResultUtil.error("请选择计划和职业类别"); return ResultUtil.error("请选择计划和职业类别");
} }
insureDto.getPlans().forEach(i -> { insureDto.getPlans().forEach(i -> {
...@@ -204,7 +204,7 @@ public class InsureContorll { ...@@ -204,7 +204,7 @@ public class InsureContorll {
return ResultUtil.error("未设置投保人"); return ResultUtil.error("未设置投保人");
} }
Map companyApplicantMap = Maps.newHashMap(); Map companyApplicantMap = Maps.newHashMap();
if(!insureApplicant.checkValiad().equals("true")){ if (!insureApplicant.checkValiad().equals("true")) {
return ResultUtil.error(insureApplicant.checkValiad()); return ResultUtil.error(insureApplicant.checkValiad());
} }
/*必要字段,空值影响到投保的成功*/ /*必要字段,空值影响到投保的成功*/
...@@ -218,11 +218,11 @@ public class InsureContorll { ...@@ -218,11 +218,11 @@ public class InsureContorll {
companyApplicantMap.put("applicant_province_city", "21024");/*省市区*/ companyApplicantMap.put("applicant_province_city", "21024");/*省市区*/
/*非必要字段*/ /*非必要字段*/
companyApplicantMap.put("applicant_invoice_receiving_address", StringUtils.isNullOrEmpty(insureApplicant.getApplicantInvoiceReceivingAddress())?"":insureApplicant.getApplicantInvoiceReceivingAddress()); companyApplicantMap.put("applicant_invoice_receiving_address", StringUtils.isNullOrEmpty(insureApplicant.getApplicantInvoiceReceivingAddress()) ? "" : insureApplicant.getApplicantInvoiceReceivingAddress());
companyApplicantMap.put("applicant_invoice_billing_phone",StringUtils.isNullOrEmpty(insureApplicant.getApplicantInvoiceBillingPhone())?"":insureApplicant.getApplicantInvoiceBillingPhone()); companyApplicantMap.put("applicant_invoice_billing_phone", StringUtils.isNullOrEmpty(insureApplicant.getApplicantInvoiceBillingPhone()) ? "" : insureApplicant.getApplicantInvoiceBillingPhone());
companyApplicantMap.put("applicant_invoiced_amount",StringUtils.isNullOrEmpty(insureApplicant.getApplicantInvoicedAmount())?"":insureApplicant.getApplicantInvoicedAmount()); companyApplicantMap.put("applicant_invoiced_amount", StringUtils.isNullOrEmpty(insureApplicant.getApplicantInvoicedAmount()) ? "" : insureApplicant.getApplicantInvoicedAmount());
companyApplicantMap.put("applicant_corporate_bank_account",StringUtils.isNullOrEmpty(insureApplicant.getApplicantCorporateBankAccount())?"":insureApplicant.getApplicantCorporateBankAccount()); companyApplicantMap.put("applicant_corporate_bank_account", StringUtils.isNullOrEmpty(insureApplicant.getApplicantCorporateBankAccount()) ? "" : insureApplicant.getApplicantCorporateBankAccount());
companyApplicantMap.put("applicant_business_bank_name",StringUtils.isNullOrEmpty(insureApplicant.getApplicantBusinessBankName())?"":insureApplicant.getApplicantBusinessBankName()); companyApplicantMap.put("applicant_business_bank_name", StringUtils.isNullOrEmpty(insureApplicant.getApplicantBusinessBankName()) ? "" : insureApplicant.getApplicantBusinessBankName());
...@@ -264,9 +264,9 @@ public class InsureContorll { ...@@ -264,9 +264,9 @@ public class InsureContorll {
insured.put("insured_applicant_relations", "36960"); insured.put("insured_applicant_relations", "36960");
insured.put("insured_mobile", insureApplicant.getApplicantEPhone()); insured.put("insured_mobile", insureApplicant.getApplicantEPhone());
insured.put("insured_e_contact", insureApplicant.getApplicantEContacts()); insured.put("insured_e_contact", insureApplicant.getApplicantEContacts());
insured.put("insured_name", StringUtils.isNullOrEmpty(qyzxEntInfoM.getAttestName())?qyzxEntInfoM.getName():qyzxEntInfoM.getAttestName()); insured.put("insured_name", StringUtils.isNullOrEmpty(qyzxEntInfoM.getAttestName()) ? qyzxEntInfoM.getName() : qyzxEntInfoM.getAttestName());
insured.put("insured_no_type", "3306"); insured.put("insured_no_type", "3306");
insured.put("insured_no", StringUtils.isNullOrEmpty(qyzxEntInfoM.getCreditCode())?insureApplicant.getApplicantENo():qyzxEntInfoM.getCreditCode()); insured.put("insured_no", StringUtils.isNullOrEmpty(qyzxEntInfoM.getCreditCode()) ? insureApplicant.getApplicantENo() : qyzxEntInfoM.getCreditCode());
insured.put("insured_zm_openid", ""); insured.put("insured_zm_openid", "");
insured.put("benefit_basic_plan", p.getBenefitBasicPlan()); insured.put("benefit_basic_plan", p.getBenefitBasicPlan());
insured.put("benefit_occupation_category", p.getBenefitOccupationCategory()); insured.put("benefit_occupation_category", p.getBenefitOccupationCategory());
...@@ -398,15 +398,16 @@ public class InsureContorll { ...@@ -398,15 +398,16 @@ public class InsureContorll {
return ResultUtil.error(dataMap.get("errmsg").toString()); return ResultUtil.error(dataMap.get("errmsg").toString());
} }
return ResultUtil.error("投保错误"); return ResultUtil.error("投保错误");
}catch (Exception e){ } catch (Exception e) {
log.error("投保异常:",e); log.error("投保异常:", e);
throw new CustomException("投保异常"); throw new CustomException("投保异常");
} }
} }
@PostMapping(value = "/joinUser") @PostMapping(value = "/joinUser")
@ApiOperation(value = "2.增员", httpMethod = "POST", notes = "增员") @ApiOperation(value = "2.增员", httpMethod = "POST", notes = "增员")
public Result<Object> joinUser(@RequestBody InsureDto insureDto) throws ParseException { @Transactional(rollbackFor = Exception.class)
public Result<Object> joinUser(@RequestBody InsureDto insureDto) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(Integer.parseInt(insureDto.getId())).build().selectById(); InsurePolicy insurePolicy = InsurePolicy.builder().id(Integer.parseInt(insureDto.getId())).build().selectById();
InsureProduct insureProduct = InsureProduct.builder().id(insurePolicy.getProductId()).build().selectById(); InsureProduct insureProduct = InsureProduct.builder().id(insurePolicy.getProductId()).build().selectById();
...@@ -468,7 +469,7 @@ public class InsureContorll { ...@@ -468,7 +469,7 @@ public class InsureContorll {
.createTime(new Date()) .createTime(new Date())
.insureStatus(3).policyId(insurePolicy.getId()).build().insert(); .insureStatus(3).policyId(insurePolicy.getId()).build().insert();
} catch (ParseException e) { } catch (ParseException e) {
log.info("增员异常:policyDateStart:"+insureDto.getPolicyDateStart()+"policyDateEnd:"+insureDto.getPolicyDateEnd()); log.info("增员异常:policyDateStart:" + insureDto.getPolicyDateStart() + "policyDateEnd:" + insureDto.getPolicyDateEnd());
throw new CustomException("增员异常"); throw new CustomException("增员异常");
} }
y.setIsInsure(1); y.setIsInsure(1);
...@@ -484,14 +485,15 @@ public class InsureContorll { ...@@ -484,14 +485,15 @@ public class InsureContorll {
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).build().insert(); .returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).build().insert();
return ResultUtil.error(dataMap.get("errmsg").toString()); return ResultUtil.error(dataMap.get("errmsg").toString());
}catch (Exception e){ } catch (Exception e) {
log.error("增员异常:",e); log.error("增员异常:", e);
throw new CustomException("增员异常"); throw new CustomException("增员异常");
} }
} }
@PostMapping(value = "/policyListAdmin") @PostMapping(value = "/policyListAdmin")
@ApiOperation(value = "4.保单列表--运营后台端", httpMethod = "POST", notes = "保单列表--运营后台端") @ApiOperation(value = "4.保单列表--运营后台端", httpMethod = "POST", notes = "保单列表--运营后台端")
@Transactional(rollbackFor = Exception.class)
public Result<Object> policyListAdmin(@RequestBody PolicyDto policyDto) { public Result<Object> policyListAdmin(@RequestBody PolicyDto policyDto) {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
try { try {
...@@ -499,14 +501,15 @@ public class InsureContorll { ...@@ -499,14 +501,15 @@ public class InsureContorll {
map.put("list", list); map.put("list", list);
map.put("total", insurePolicyMapper.totalPolicy(policyDto)); map.put("total", insurePolicyMapper.totalPolicy(policyDto));
return ResultUtil.data(map); return ResultUtil.data(map);
}catch (Exception e){ } catch (Exception e) {
log.error("获取保单列表异常:",e); log.error("获取保单列表异常:", e);
throw new CustomException("获取保单列表异常"); throw new CustomException("获取保单列表异常");
} }
} }
@GetMapping(value = "/policyDetail") @GetMapping(value = "/policyDetail")
@ApiOperation(value = "5.保单信息", httpMethod = "GET", notes = "保单信息") @ApiOperation(value = "5.保单信息", httpMethod = "GET", notes = "保单信息")
@Transactional(rollbackFor = Exception.class)
public Result<Object> policyDetail(@RequestParam("policyId") Integer policyId) { public Result<Object> policyDetail(@RequestParam("policyId") Integer policyId) {
try { try {
// Map map = Maps.newHashMap(); // Map map = Maps.newHashMap();
...@@ -522,14 +525,15 @@ public class InsureContorll { ...@@ -522,14 +525,15 @@ public class InsureContorll {
// map.put("plans",plansList.stream().map(InsureUser::getBenefitBasicPlan).toArray()); // map.put("plans",plansList.stream().map(InsureUser::getBenefitBasicPlan).toArray());
// map.put("category",categoryList.stream().map(InsureUser::getBenefitOccupationCategory).toArray()); // map.put("category",categoryList.stream().map(InsureUser::getBenefitOccupationCategory).toArray());
return ResultUtil.data(policyDto); return ResultUtil.data(policyDto);
}catch (Exception e){ } catch (Exception e) {
log.error("获取保单信息异常:",e); log.error("获取保单信息异常:", e);
throw new CustomException("获取保单信息异常"); throw new CustomException("获取保单信息异常");
} }
} }
@PostMapping(value = "/replaceUser") @PostMapping(value = "/replaceUser")
@ApiOperation(value = "6.保全替换", httpMethod = "POST", notes = "保全替换") @ApiOperation(value = "6.保全替换", httpMethod = "POST", notes = "保全替换")
@Transactional(rollbackFor = Exception.class)
public Result<Object> replaceUser(@RequestBody InsureDto insureDto) { public Result<Object> replaceUser(@RequestBody InsureDto insureDto) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(Integer.parseInt(insureDto.getId())).build().selectById(); InsurePolicy insurePolicy = InsurePolicy.builder().id(Integer.parseInt(insureDto.getId())).build().selectById();
if (insurePolicy == null) { if (insurePolicy == null) {
...@@ -614,7 +618,7 @@ public class InsureContorll { ...@@ -614,7 +618,7 @@ public class InsureContorll {
.createTime(new Date()) .createTime(new Date())
.status("1").insureStatus(3).policyId(insurePolicy.getId()).build().insert(); .status("1").insureStatus(3).policyId(insurePolicy.getId()).build().insert();
} catch (ParseException e) { } catch (ParseException e) {
log.error("获取保单信息异常:",e); log.error("获取保单信息异常:", e);
} }
y.setIsInsure(1); y.setIsInsure(1);
y.insertOrUpdate(); y.insertOrUpdate();
...@@ -628,14 +632,15 @@ public class InsureContorll { ...@@ -628,14 +632,15 @@ public class InsureContorll {
} }
} }
return ResultUtil.data("成功"); return ResultUtil.data("成功");
}catch (Exception e){ } catch (Exception e) {
log.error("保全替换异常:",e); log.error("保全替换异常:", e);
throw new CustomException("保全替换异常"); throw new CustomException("保全替换异常");
} }
} }
@GetMapping(value = "/downPolicyFile") @GetMapping(value = "/downPolicyFile")
@ApiOperation(value = "7.下载电子保单", httpMethod = "GET", notes = "下载电子保单") @ApiOperation(value = "7.下载电子保单", httpMethod = "GET", notes = "下载电子保单")
@Transactional(rollbackFor = Exception.class)
public void downPolicyFile(@RequestParam("policyId") String policyId, HttpServletRequest request, HttpServletResponse response) { public void downPolicyFile(@RequestParam("policyId") String policyId, HttpServletRequest request, HttpServletResponse response) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(Integer.parseInt(policyId)).build().selectById(); InsurePolicy insurePolicy = InsurePolicy.builder().id(Integer.parseInt(policyId)).build().selectById();
if (insurePolicy == null || StringUtils.isNullOrEmpty(insurePolicy.getPolicyFile())) { if (insurePolicy == null || StringUtils.isNullOrEmpty(insurePolicy.getPolicyFile())) {
...@@ -660,26 +665,27 @@ public class InsureContorll { ...@@ -660,26 +665,27 @@ public class InsureContorll {
sos.write(b); sos.write(b);
} }
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
log.error("下载电子保单:",e); log.error("下载电子保单:", e);
} catch (IOException e) { } catch (IOException e) {
log.error("下载电子保单:",e); log.error("下载电子保单:", e);
} finally { } finally {
try { try {
sos.close(); sos.close();
} catch (IOException e) { } catch (IOException e) {
log.error("下载电子保单:",e); log.error("下载电子保单:", e);
} }
try { try {
bis.close(); bis.close();
} catch (IOException e) { } catch (IOException e) {
log.error("下载电子保单:",e); log.error("下载电子保单:", e);
} }
} }
} }
@PostMapping(value = "/policyTotal") @PostMapping(value = "/policyTotal")
@ApiOperation(value = "8.保单统计列表", httpMethod = "POST", notes = "保单统计列表") @ApiOperation(value = "8.保单统计列表", httpMethod = "POST", notes = "保单统计列表")
@Transactional(rollbackFor = Exception.class)
public Result<Object> policyTotal() { public Result<Object> policyTotal() {
List<PolicyDto> list = insurePolicyMapper.policyTotalList(); List<PolicyDto> list = insurePolicyMapper.policyTotalList();
return ResultUtil.data(list); return ResultUtil.data(list);
...@@ -687,6 +693,7 @@ public class InsureContorll { ...@@ -687,6 +693,7 @@ public class InsureContorll {
@GetMapping(value = "/isInsured") @GetMapping(value = "/isInsured")
@ApiOperation(value = "9.企业是否已投保-弃用", httpMethod = "POST", notes = "企业是否已投保") @ApiOperation(value = "9.企业是否已投保-弃用", httpMethod = "POST", notes = "企业是否已投保")
@Transactional(rollbackFor = Exception.class)
public Result<Object> isInsured(@RequestParam("orgCode") String orgCode) { public Result<Object> isInsured(@RequestParam("orgCode") String orgCode) {
InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getOrgCode, orgCode).eq(InsurePolicy::getStatus, 1)); InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getOrgCode, orgCode).eq(InsurePolicy::getStatus, 1));
if (insurePolicy != null) { if (insurePolicy != null) {
...@@ -697,6 +704,7 @@ public class InsureContorll { ...@@ -697,6 +704,7 @@ public class InsureContorll {
@GetMapping(value = "/verification") @GetMapping(value = "/verification")
@ApiOperation(value = "10.一键校验", httpMethod = "POST", notes = "一键校验") @ApiOperation(value = "10.一键校验", httpMethod = "POST", notes = "一键校验")
@Transactional(rollbackFor = Exception.class)
public Result<Object> verification() { public Result<Object> verification() {
try { try {
/*校验投保*/ /*校验投保*/
...@@ -738,8 +746,8 @@ public class InsureContorll { ...@@ -738,8 +746,8 @@ public class InsureContorll {
/*校验人员*/ /*校验人员*/
return ResultUtil.success(); return ResultUtil.success();
}catch (Exception e){ } catch (Exception e) {
log.error("一键校验异常:",e); log.error("一键校验异常:", e);
throw new CustomException("一键校验异常"); throw new CustomException("一键校验异常");
} }
} }
...@@ -747,17 +755,19 @@ public class InsureContorll { ...@@ -747,17 +755,19 @@ public class InsureContorll {
@PostMapping(value = "/policyTotalList") @PostMapping(value = "/policyTotalList")
@ApiOperation(value = "11.保单统计列表 -- 8小时端", httpMethod = "POST", notes = "保单统计列表") @ApiOperation(value = "11.保单统计列表 -- 8小时端", httpMethod = "POST", notes = "保单统计列表")
public Result<Object> policyTotal(@CurrentUser UserBean userBean,@RequestBody PolicyDto policyDto) { @Transactional(rollbackFor = Exception.class)
public Result<Object> policyTotal(@CurrentUser UserBean userBean, @RequestBody PolicyDto policyDto) {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
List<InsureUserDto> list = insurePolicyMapper.selectPolicyListByorgCode(userBean.getOrgCode(),policyDto); List<InsureUserDto> list = insurePolicyMapper.selectPolicyListByorgCode(userBean.getOrgCode(), policyDto);
map.put("list", list); map.put("list", list);
map.put("total",insurePolicyMapper.selectPolicyTotalByorgCode(userBean.getOrgCode(),policyDto)); map.put("total", insurePolicyMapper.selectPolicyTotalByorgCode(userBean.getOrgCode(), policyDto));
return ResultUtil.data(map); return ResultUtil.data(map);
} }
@PostMapping(value = "/importUser") @PostMapping(value = "/importUser")
@ApiOperation(value = "12.导入用户--运营后台", httpMethod = "POST", notes = "导入用户") @ApiOperation(value = "12.导入用户--运营后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class)
public Result<Object> importUser(@RequestParam("orgCode") String orgCode, @RequestParam("file") MultipartFile file) { public Result<Object> importUser(@RequestParam("orgCode") String orgCode, @RequestParam("file") MultipartFile file) {
SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd");
QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(orgCode)).build().selectById(); QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(orgCode)).build().selectById();
...@@ -814,7 +824,7 @@ public class InsureContorll { ...@@ -814,7 +824,7 @@ public class InsureContorll {
try { try {
y.setBirthday(dtf.parse(idNo.substring(6, 14))); y.setBirthday(dtf.parse(idNo.substring(6, 14)));
} catch (ParseException e) { } catch (ParseException e) {
log.error("一键校验异常:",e); log.error("一键校验异常:", e);
throw new CustomException("一键校验异常"); throw new CustomException("一键校验异常");
} }
y.setZjNum(idNo); y.setZjNum(idNo);
...@@ -850,7 +860,7 @@ public class InsureContorll { ...@@ -850,7 +860,7 @@ public class InsureContorll {
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, orgCode)); List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, orgCode));
} catch (IOException e) { } catch (IOException e) {
log.error("一键校验异常:",e); log.error("一键校验异常:", e);
throw new CustomException("一键校验异常"); throw new CustomException("一键校验异常");
} }
List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList()); List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList());
...@@ -862,6 +872,7 @@ public class InsureContorll { ...@@ -862,6 +872,7 @@ public class InsureContorll {
@PostMapping(value = "/importUserClient") @PostMapping(value = "/importUserClient")
@ApiOperation(value = "13.导入用户--8小时后台", httpMethod = "POST", notes = "导入用户") @ApiOperation(value = "13.导入用户--8小时后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class)
public Result<Object> importUserClient(@CurrentUser UserBean userBean, @RequestParam("file") MultipartFile file) { public Result<Object> importUserClient(@CurrentUser UserBean userBean, @RequestParam("file") MultipartFile file) {
SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd");
QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(userBean.getOrgCode())).build().selectById(); QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(userBean.getOrgCode())).build().selectById();
...@@ -918,7 +929,7 @@ public class InsureContorll { ...@@ -918,7 +929,7 @@ public class InsureContorll {
try { try {
y.setBirthday(dtf.parse(idNo.substring(6, 14))); y.setBirthday(dtf.parse(idNo.substring(6, 14)));
} catch (ParseException e) { } catch (ParseException e) {
log.error("导入用户:",e); log.error("导入用户:", e);
throw new CustomException("导入用户"); throw new CustomException("导入用户");
} }
y.setZjNum(idNo); y.setZjNum(idNo);
...@@ -954,7 +965,7 @@ public class InsureContorll { ...@@ -954,7 +965,7 @@ public class InsureContorll {
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, userBean.getOrgCode())); List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, userBean.getOrgCode()));
} catch (IOException e) { } catch (IOException e) {
log.error("导入用户:",e); log.error("导入用户:", e);
throw new CustomException("导入用户"); throw new CustomException("导入用户");
} }
List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList()); List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList());
...@@ -967,6 +978,7 @@ public class InsureContorll { ...@@ -967,6 +978,7 @@ public class InsureContorll {
@PostMapping(value = "/importPolicy") @PostMapping(value = "/importPolicy")
@ApiOperation(value = "14.导入保单--运营后台", httpMethod = "POST", notes = "导入用户") @ApiOperation(value = "14.导入保单--运营后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class)
public Result<Object> importPolicy(@RequestParam("file") MultipartFile file, @RequestParam("productId") String productId) { public Result<Object> importPolicy(@RequestParam("file") MultipartFile file, @RequestParam("productId") String productId) {
SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd");
...@@ -1094,8 +1106,8 @@ public class InsureContorll { ...@@ -1094,8 +1106,8 @@ public class InsureContorll {
Map returnMap = JSONObject.parseObject(data, Map.class); Map returnMap = JSONObject.parseObject(data, Map.class);
if (returnMap.get("errcode").toString().equals("suc")) { if (returnMap.get("errcode").toString().equals("suc")) {
Map dataMap = JSONObject.parseObject(JSONObject.toJSONString(returnMap.get("data")), Map.class); Map dataMap = JSONObject.parseObject(JSONObject.toJSONString(returnMap.get("data")), Map.class);
if(!dataMap.get("product_code").equals(insureProduct.getProductCodeId())){ if (!dataMap.get("product_code").equals(insureProduct.getProductCodeId())) {
return ResultUtil.error("产品选择错误,请检查保单号是否正确"); return ResultUtil.error("导入的保单产品和选择的保单产品不一致");
} }
policy.setProductId(insureProduct.getId()); policy.setProductId(insureProduct.getId());
policy.setPolicyFile(dataMap.get("policy_file").toString()); policy.setPolicyFile(dataMap.get("policy_file").toString());
...@@ -1116,7 +1128,7 @@ public class InsureContorll { ...@@ -1116,7 +1128,7 @@ public class InsureContorll {
policy.updateById(); policy.updateById();
} }
if (userList.size() <= 0) { if (userList.size() <= 0) {
return ResultUtil.error("导入错误,保单已存在"); throw new CustomException("导入错误,人员为空");
} }
for (InsureUser insureUser : userList) { for (InsureUser insureUser : userList) {
/*根据名字,身份,所属企业获取员工*/ /*根据名字,身份,所属企业获取员工*/
...@@ -1127,7 +1139,7 @@ public class InsureContorll { ...@@ -1127,7 +1139,7 @@ public class InsureContorll {
if (ygglMainEmp != null) { if (ygglMainEmp != null) {
/*如果导入的人已经投保*/ /*如果导入的人已经投保*/
if(ygglMainEmp.getIsInsure()==1){ if (ygglMainEmp.getIsInsure() == 1) {
continue; continue;
} }
insureUser.setInsuredMobile(ygglMainEmp.getPhone()); insureUser.setInsuredMobile(ygglMainEmp.getPhone());
...@@ -1152,7 +1164,7 @@ public class InsureContorll { ...@@ -1152,7 +1164,7 @@ public class InsureContorll {
InsureLog.builder().requestParam(JSONObject.toJSONString(map)).type(9).createTime(new Date()).requestType(2).returnBody(data).requestPath(policyDetailUrl) InsureLog.builder().requestParam(JSONObject.toJSONString(map)).type(9).createTime(new Date()).requestType(2).returnBody(data).requestPath(policyDetailUrl)
.returnCode(returnMap.get("errcode").toString()).returnMsg(returnMap.get("errmsg").toString()).policyId(policy.getId()).build().insert(); .returnCode(returnMap.get("errcode").toString()).returnMsg(returnMap.get("errmsg").toString()).policyId(policy.getId()).build().insert();
} catch (IOException e) { } catch (IOException e) {
log.error("导入保单:",e); log.error("导入保单:", e);
throw new CustomException("导入保单"); throw new CustomException("导入保单");
} }
return ResultUtil.data("成功导入"); return ResultUtil.data("成功导入");
...@@ -1160,6 +1172,7 @@ public class InsureContorll { ...@@ -1160,6 +1172,7 @@ public class InsureContorll {
@PostMapping(value = "/importUserPolicy") @PostMapping(value = "/importUserPolicy")
@ApiOperation(value = "15.导入被保人员--运营后台", httpMethod = "POST", notes = "导入用户") @ApiOperation(value = "15.导入被保人员--运营后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class)
public Result<Object> importUserPolicy(@RequestParam("file") MultipartFile file, @RequestParam("orgCode") Integer orgCode) { public Result<Object> importUserPolicy(@RequestParam("file") MultipartFile file, @RequestParam("orgCode") Integer orgCode) {
if (file.getSize() <= 0) { if (file.getSize() <= 0) {
return ResultUtil.error("未上传文件"); return ResultUtil.error("未上传文件");
...@@ -1259,23 +1272,24 @@ public class InsureContorll { ...@@ -1259,23 +1272,24 @@ public class InsureContorll {
} }
return ResultUtil.data(userList); return ResultUtil.data(userList);
} catch (IOException e) { } catch (IOException e) {
log.error("导入被保人异常:",e); log.error("导入被保人异常:", e);
} }
return ResultUtil.error("导入失败"); return ResultUtil.error("导入失败");
}catch (Exception e) { } catch (Exception e) {
log.error("导入被保人异常:",e); log.error("导入被保人异常:", e);
throw new CustomException("导入被保人异常"); throw new CustomException("导入被保人异常");
} }
} }
@GetMapping(value = "/rePay") @GetMapping(value = "/rePay")
@ApiOperation(value = "16.重新发起支付", httpMethod = "GET", notes = "重新发起支付") @ApiOperation(value = "16.重新发起支付", httpMethod = "GET", notes = "重新发起支付")
public Result<Object> rePay(@RequestParam("payId")Integer payId){ @Transactional(rollbackFor = Exception.class)
public Result<Object> rePay(@RequestParam("payId") Integer payId) {
InsurePay insurePay = InsurePay.builder().id(payId).build().selectById(); InsurePay insurePay = InsurePay.builder().id(payId).build().selectById();
if(insurePay==null){ if (insurePay == null) {
return ResultUtil.error("保单不存在"); return ResultUtil.error("保单不存在");
} }
if(insurePay.getPayStatus()!=1){ if (insurePay.getPayStatus() != 1) {
return ResultUtil.error("保单不是支付状态"); return ResultUtil.error("保单不是支付状态");
} }
try { try {
...@@ -1302,7 +1316,7 @@ public class InsureContorll { ...@@ -1302,7 +1316,7 @@ public class InsureContorll {
.returnMsg("请求投保支付").policyId(insurePolicy.getId()).build().insert(); .returnMsg("请求投保支付").policyId(insurePolicy.getId()).build().insert();
return ResultUtil.data(builder.build()); return ResultUtil.data(builder.build());
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
log.error("请求错误:",e); log.error("请求错误:", e);
return ResultUtil.error("请求错误"); return ResultUtil.error("请求错误");
} }
} else { } else {
...@@ -1320,22 +1334,25 @@ public class InsureContorll { ...@@ -1320,22 +1334,25 @@ public class InsureContorll {
.returnMsg("请求保全支付").policyId(insurePolicy.getId()).build().insert(); .returnMsg("请求保全支付").policyId(insurePolicy.getId()).build().insert();
return ResultUtil.data(importPayInfo.get("pay_url").toString() + "&jump_url=" + base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId() + "&notify_url=" + base_api_url + "/callBack/policy/batchPayCallback"); return ResultUtil.data(importPayInfo.get("pay_url").toString() + "&jump_url=" + base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId() + "&notify_url=" + base_api_url + "/callBack/policy/batchPayCallback");
} }
}catch (Exception e){ } catch (Exception e) {
log.error("重新发起支付异常:",e); log.error("重新发起支付异常:", e);
throw new CustomException("重新发起支付异常"); throw new CustomException("重新发起支付异常");
} }
// String data = HttpUtils.sendGet(setParams()) // String data = HttpUtils.sendGet(setParams())
}; }
;
@GetMapping(value = "/cePay") @GetMapping(value = "/cePay")
@ApiOperation(value = "17.取消支付", httpMethod = "GET", notes = "取消支付") @ApiOperation(value = "17.取消支付", httpMethod = "GET", notes = "取消支付")
public Result<Object> cancelPay(@RequestParam("payId")Integer payId){ @Transactional(rollbackFor = Exception.class)
public Result<Object> cancelPay(@RequestParam("payId") Integer payId) {
InsurePay insurePay = InsurePay.builder().id(payId).build().selectById(); InsurePay insurePay = InsurePay.builder().id(payId).build().selectById();
if(insurePay==null){ if (insurePay == null) {
return ResultUtil.error("保单不存在"); return ResultUtil.error("保单不存在");
} }
if(insurePay.getPayStatus()!=1){ if (insurePay.getPayStatus() != 1) {
return ResultUtil.error("保单不是支付状态"); return ResultUtil.error("保单不是支付状态");
} }
try { try {
...@@ -1378,8 +1395,8 @@ public class InsureContorll { ...@@ -1378,8 +1395,8 @@ public class InsureContorll {
/*生成一个支付链接返回到前台*/ /*生成一个支付链接返回到前台*/
return ResultUtil.error("取消失败,请重新再来"); return ResultUtil.error("取消失败,请重新再来");
}catch (Exception e){ } catch (Exception e) {
log.error("取消支付异常:",e); log.error("取消支付异常:", e);
throw new CustomException("取消支付异常"); throw new CustomException("取消支付异常");
} }
} }
...@@ -1390,7 +1407,7 @@ public class InsureContorll { ...@@ -1390,7 +1407,7 @@ public class InsureContorll {
* *
* @return * @return
*/ */
public String creaXSSFWorkbook(List<PlansDto> plansList, String createDate) { public String creaXSSFWorkbook(List<PlansDto> plansList, String createDate) throws Exception {
if (plansList.size() <= 0) { if (plansList.size() <= 0) {
return "error"; return "error";
} }
...@@ -1409,41 +1426,31 @@ public class InsureContorll { ...@@ -1409,41 +1426,31 @@ public class InsureContorll {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
String url = ""; String url = "";
try { xssfWorkbook.write(byteArrayOutputStream);
xssfWorkbook.write(byteArrayOutputStream); byte[] bytes = byteArrayOutputStream.toByteArray();
byte[] bytes = byteArrayOutputStream.toByteArray(); String fileBase64 = Base64.byteArrayToBase64(bytes);
String fileBase64 = Base64.byteArrayToBase64(bytes);
/*body参数 begin*/
/*body参数 begin*/ Map bodyMap = Maps.newHashMap();
Map bodyMap = Maps.newHashMap(); bodyMap.put("app", "mall");
bodyMap.put("app", "mall"); bodyMap.put("name", localDate + "_" + list.size() + "名人员清单.xlsx");
bodyMap.put("name", localDate + "_" + list.size() + "名人员清单.xlsx"); bodyMap.put("file", fileBase64);
bodyMap.put("file", fileBase64); /*end*/
/*end*/ String data = HttpUtils.sendPost(uploadUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap);
String data = HttpUtils.sendPost(uploadUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap); Map<String, Object> dataMap = JSONObject.parseObject(data);
Map<String, Object> dataMap = JSONObject.parseObject(data); /*创建日志*/
/*创建日志*/ if (dataMap.get("errcode").toString().equals("suc")) {
if (dataMap.get("errcode").toString().equals("suc")) { Object o = dataMap.get("data");
Object o = dataMap.get("data"); Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o)); url = map.get("url").toString();
url = map.get("url").toString();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(4)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
} catch (IOException e) {
log.error("生成投保文件异常:",e);
throw new CustomException("生成投保文件异常");
} finally {
try {
xssfWorkbook.close();
byteArrayOutputStream.close();
} catch (IOException e) {
log.error("生成投保文件异常:",e);
throw new CustomException("生成投保文件异常");
}
} }
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(4)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
xssfWorkbook.close();
byteArrayOutputStream.close();
return url; return url;
...@@ -1455,7 +1462,7 @@ public class InsureContorll { ...@@ -1455,7 +1462,7 @@ public class InsureContorll {
* @param ids * @param ids
* @return * @return
*/ */
public String creaXSSFWorkbook1(InsureDto insureDto) { public String creaXSSFWorkbook1(InsureDto insureDto) throws Exception {
if (insureDto.getUserIds().length <= 0) { if (insureDto.getUserIds().length <= 0) {
return "error"; return "error";
} }
...@@ -1472,38 +1479,28 @@ public class InsureContorll { ...@@ -1472,38 +1479,28 @@ public class InsureContorll {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
String url = ""; String url = "";
try { xssfWorkbook.write(byteArrayOutputStream);
xssfWorkbook.write(byteArrayOutputStream); byte[] bytes = byteArrayOutputStream.toByteArray();
byte[] bytes = byteArrayOutputStream.toByteArray(); String fileBase64 = Base64.byteArrayToBase64(bytes);
String fileBase64 = Base64.byteArrayToBase64(bytes);
/*body参数 begin*/
/*body参数 begin*/ Map bodyMap = Maps.newHashMap();
Map bodyMap = Maps.newHashMap(); bodyMap.put("media", fileBase64);
bodyMap.put("media", fileBase64); /*end*/
/*end*/ String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap);
String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap); Map<String, Object> dataMap = JSONObject.parseObject(data);
Map<String, Object> dataMap = JSONObject.parseObject(data); if (dataMap.get("errcode").toString().equals("suc")) {
if (dataMap.get("errcode").toString().equals("suc")) { Object o = dataMap.get("data");
Object o = dataMap.get("data"); Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o)); url = map.get("file_url").toString();
url = map.get("file_url").toString();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(5)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl2)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
} catch (IOException e) {
log.error("生成保全增员文件异常:",e);
throw new CustomException("生成保全增员文件异常");
} finally {
try {
xssfWorkbook.close();
byteArrayOutputStream.close();
} catch (IOException e) {
log.error("生成保全增员文件异常:",e);
throw new CustomException("生成保全增员文件异常");
}
} }
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(5)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl2)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
xssfWorkbook.close();
byteArrayOutputStream.close();
return url; return url;
} }
...@@ -1513,7 +1510,7 @@ public class InsureContorll { ...@@ -1513,7 +1510,7 @@ public class InsureContorll {
* @param ids * @param ids
* @return * @return
*/ */
public String creaXSSFWorkbook2(String[] ids, String date, String[] oldIds, String type, String tricycleFrameNumber) { public String creaXSSFWorkbook2(String[] ids, String date, String[] oldIds, String type, String tricycleFrameNumber) throws Exception {
if (ids.length <= 0 || oldIds.length <= 0) { if (ids.length <= 0 || oldIds.length <= 0) {
return "error"; return "error";
} }
...@@ -1544,39 +1541,29 @@ public class InsureContorll { ...@@ -1544,39 +1541,29 @@ public class InsureContorll {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
String url = ""; String url = "";
try { xssfWorkbook.write(byteArrayOutputStream);
xssfWorkbook.write(byteArrayOutputStream); byte[] bytes = byteArrayOutputStream.toByteArray();
byte[] bytes = byteArrayOutputStream.toByteArray(); String fileBase64 = Base64.byteArrayToBase64(bytes);
String fileBase64 = Base64.byteArrayToBase64(bytes);
/*body参数 begin*/
/*body参数 begin*/ Map bodyMap = Maps.newHashMap();
Map bodyMap = Maps.newHashMap(); bodyMap.put("media", fileBase64);
bodyMap.put("media", fileBase64); /*end*/
/*end*/ String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap);
String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap); Map<String, Object> dataMap = JSONObject.parseObject(data);
Map<String, Object> dataMap = JSONObject.parseObject(data);
if (dataMap.get("errcode").toString().equals("suc")) {
if (dataMap.get("errcode").toString().equals("suc")) { Object o = dataMap.get("data");
Object o = dataMap.get("data"); Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o)); url = map.get("file_url").toString();
url = map.get("file_url").toString();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(6)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl2)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
} catch (IOException e) {
log.error("生成保全替换文件异常:",e);
throw new CustomException("生成保全替换文件异常");
} finally {
try {
xssfWorkbook.close();
byteArrayOutputStream.close();
} catch (IOException e) {
log.error("生成保全替换文件异常:",e);
throw new CustomException("生成保全替换文件异常");
}
} }
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(6)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl2)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
xssfWorkbook.close();
byteArrayOutputStream.close();
return url; return url;
} }
......
...@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;
...@@ -37,6 +38,7 @@ public class InsureTaskTiming { ...@@ -37,6 +38,7 @@ public class InsureTaskTiming {
private YgglMainEmpMapper ygglMainEmpMapper; private YgglMainEmpMapper ygglMainEmpMapper;
@Scheduled(cron = "0 0 0 1 * ?")//每月第一天 @Scheduled(cron = "0 0 0 1 * ?")//每月第一天
@Transactional(rollbackFor = Exception.class)
public void updateInsureStatusTask(){ public void updateInsureStatusTask(){
try { try {
......
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
and qy.name like CONCAT('%',#{policy.companyName},'%') and qy.name like CONCAT('%',#{policy.companyName},'%')
</if> </if>
<if test="policy.policyNo!=null and policy.policyNo!=''"> <if test="policy.policyNo!=null and policy.policyNo!=''">
and qy.policy_no like CONCAT('%',#{policy.policyNo},'%') and ip.policy_no like CONCAT('%',#{policy.policyNo},'%')
</if> </if>
</where> </where>
GROUP BY ip.id GROUP BY ip.id
......
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