Commit 91d0e935 by 翁国栋

8小时后台--

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