Commit 902d8608 by 翁国栋

8小时运营后台--

投保人信息验证
企业列表信息验证
导入信息验证
导入人员信息验证
保单搜索列表更据企业名称查找
parent 09698502
package cn.timer.api.bean.insure;
import lombok.Data;
/**
* @Description TODO
* @Author wgd
* @Date 2022/5/30 11:01
*/
@Data
public class BatchPayCallBack {
private String order_import_uuid;
private String pay_status;
private String transaction_id;
private String pay_time;
private String pay_money;
private String method;
}
...@@ -4,22 +4,21 @@ import cn.timer.api.bean.htzz.HtzzAssoZztx; ...@@ -4,22 +4,21 @@ import cn.timer.api.bean.htzz.HtzzAssoZztx;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.mysql.cj.util.StringUtils;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Builder; import org.springframework.beans.factory.annotation.Value;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 投保人 * 投保人
* *
...@@ -35,323 +34,383 @@ import java.util.Date; ...@@ -35,323 +34,383 @@ import java.util.Date;
@Table(name = "insure_applicant") @Table(name = "insure_applicant")
@ApiModel("投保人") @ApiModel("投保人")
public class InsureApplicant extends Model<InsureApplicant> { public class InsureApplicant extends Model<InsureApplicant> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* id * id
*/ */
@Id @Id
@GeneratedValue @GeneratedValue
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号") @ApiModelProperty(value = "编号")
private Integer id; private Integer id;
/** /**
* 企业/网点名称 * 企业/网点名称
*/ */
@ApiModelProperty(value = "企业/网点名称") @ApiModelProperty(value = "企业/网点名称")
private String applicantEName; @NotEmpty
/** private String applicantEName;
* 企业/网点地址 /**
*/ * 企业/网点地址
@ApiModelProperty(value = "企业/网点地址") */
private String applicantEAddress; @ApiModelProperty(value = "企业/网点地址")
/** private String applicantEAddress;
* 人员清单 /**
*/ * 人员清单
@ApiModelProperty(value = "人员清单") */
private String applicantEmployeeList; @ApiModelProperty(value = "人员清单")
/** private String applicantEmployeeList;
* 企业授权操作人姓名 /**
*/ * 企业授权操作人姓名
@ApiModelProperty(value = "企业授权操作人姓名") */
private String applicantEContacts; @ApiModelProperty(value = "企业授权操作人姓名")
/** private String applicantEContacts;
* 操作人的联系电话 /**
*/ * 操作人的联系电话
@ApiModelProperty(value = "操作人的联系电话") */
private String applicantEPhone; @ApiModelProperty(value = "操作人的联系电话")
/** private String applicantEPhone;
* 企业证件类型:3646、统一社会信用代码 3924、组织机构代码 /**
*/ * 企业证件类型:3646、统一社会信用代码 3924、组织机构代码
@ApiModelProperty(value = "企业证件类型") */
private String applicantENoType; @ApiModelProperty(value = "企业证件类型")
/** private String applicantENoType;
* 企业证件号码 /**
*/ * 企业证件号码
@ApiModelProperty(value = "企业证件号码") */
private String applicantENo; @ApiModelProperty(value = "企业证件号码")
/** private String applicantENo;
* 企业邮箱 /**
*/ * 企业邮箱
@ApiModelProperty(value = "企业邮箱") */
private String applicantEMail; @ApiModelProperty(value = "企业邮箱")
/** private String applicantEMail;
* 省市区 /**
*/ * 省市区
@ApiModelProperty(value = "省市区") */
private String applicantProvinceCity; @ApiModelProperty(value = "省市区")
/** private String applicantProvinceCity;
* 发票收件地址 /**
*/ * 发票收件地址
@ApiModelProperty(value = "发票收件地址") */
private String applicantInvoiceReceivingAddress; @ApiModelProperty(value = "发票收件地址")
/** private String applicantInvoiceReceivingAddress;
* 发票开票电话 /**
*/ * 发票开票电话
@ApiModelProperty(value = "发票开票电话") */
private String applicantInvoiceBillingPhone; @ApiModelProperty(value = "发票开票电话")
/** private String applicantInvoiceBillingPhone;
* 企业开户行名称 /**
*/ * 企业开户行名称
@ApiModelProperty(value = "企业开户行名称") */
private String applicantBusinessBankName; @ApiModelProperty(value = "企业开户行名称")
/** private String applicantBusinessBankName;
* 保单号 /**
*/ * 保单号
@ApiModelProperty(value = "保单号") */
private String policyNo; @ApiModelProperty(value = "保单号")
/** private String policyNo;
* 投保类型:1个人 2 企业 /**
*/ * 投保类型:1个人 2 企业
@ApiModelProperty(value = "投保类型") */
private String applicantType; @ApiModelProperty(value = "投保类型")
/** private String applicantType;
* 报价请求流水号 /**
*/ * 报价请求流水号
@ApiModelProperty(value = "报价请求流水号") */
private String transId; @ApiModelProperty(value = "报价请求流水号")
/** private String transId;
* 报价号 /**
*/ * 报价号
@ApiModelProperty(value = "报价号") */
private String currency; @ApiModelProperty(value = "报价号")
/** private String currency;
* 发票开票金额 /**
*/ * 发票开票金额
@ApiModelProperty(value = "发票开票金额") */
private String applicantInvoicedAmount; @ApiModelProperty(value = "发票开票金额")
@ApiModelProperty(value = "企业id", example = "") private String applicantInvoicedAmount;
private Integer orgCode; @ApiModelProperty(value = "企业id", example = "")
@ApiModelProperty(value="银行账号") private Integer orgCode;
private String applicantCorporateBankAccount; @ApiModelProperty(value = "银行账号")
private String applicantCorporateBankAccount;
/**
* 设置:id /**
*/ * 设置:id
public void setId(Integer id) { */
this.id = id; public void setId(Integer id) {
} this.id = id;
}
/**
* 设置:企业/网点名称 /**
*/ * 设置:企业/网点名称
public void setApplicantEName(String applicantEName) { */
this.applicantEName = applicantEName; public void setApplicantEName(String applicantEName) {
} this.applicantEName = applicantEName;
/** }
* 获取:企业/网点名称
*/ /**
public String getApplicantEName() { * 获取:企业/网点名称
return applicantEName; */
} public String getApplicantEName() {
/** return applicantEName;
* 设置:企业/网点地址 }
*/
public void setApplicantEAddress(String applicantEAddress) { /**
this.applicantEAddress = applicantEAddress; * 设置:企业/网点地址
} */
/** public void setApplicantEAddress(String applicantEAddress) {
* 获取:企业/网点地址 this.applicantEAddress = applicantEAddress;
*/ }
public String getApplicantEAddress() {
return applicantEAddress; /**
} * 获取:企业/网点地址
/** */
* 设置:人员清单 public String getApplicantEAddress() {
*/ return applicantEAddress;
public void setApplicantEmployeeList(String applicantEmployeeList) { }
this.applicantEmployeeList = applicantEmployeeList;
} /**
/** * 设置:人员清单
* 获取:人员清单 */
*/ public void setApplicantEmployeeList(String applicantEmployeeList) {
public String getApplicantEmployeeList() { this.applicantEmployeeList = applicantEmployeeList;
return applicantEmployeeList; }
}
/** /**
* 设置:企业授权操作人姓名 * 获取:人员清单
*/ */
public void setApplicantEContacts(String applicantEContacts) { public String getApplicantEmployeeList() {
this.applicantEContacts = applicantEContacts; return applicantEmployeeList;
} }
/**
* 获取:企业授权操作人姓名 /**
*/ * 设置:企业授权操作人姓名
public String getApplicantEContacts() { */
return applicantEContacts; public void setApplicantEContacts(String applicantEContacts) {
} this.applicantEContacts = applicantEContacts;
/** }
* 设置:操作人的联系电话
*/ /**
public void setApplicantEPhone(String applicantEPhone) { * 获取:企业授权操作人姓名
this.applicantEPhone = applicantEPhone; */
} public String getApplicantEContacts() {
/** return applicantEContacts;
* 获取:操作人的联系电话 }
*/
public String getApplicantEPhone() { /**
return applicantEPhone; * 设置:操作人的联系电话
} */
/** public void setApplicantEPhone(String applicantEPhone) {
* 设置:企业证件类型:3646、统一社会信用代码 3924、组织机构代码 this.applicantEPhone = applicantEPhone;
*/ }
public void setApplicantENoType(String applicantENoType) {
this.applicantENoType = applicantENoType; /**
} * 获取:操作人的联系电话
/** */
* 获取:企业证件类型:3646、统一社会信用代码 3924、组织机构代码 public String getApplicantEPhone() {
*/ return applicantEPhone;
public String getApplicantENoType() { }
return applicantENoType;
} /**
/** * 设置:企业证件类型:3646、统一社会信用代码 3924、组织机构代码
* 设置:企业证件号码 */
*/ public void setApplicantENoType(String applicantENoType) {
public void setApplicantENo(String applicantENo) { this.applicantENoType = applicantENoType;
this.applicantENo = applicantENo; }
}
/** /**
* 获取:企业证件号码 * 获取:企业证件类型:3646、统一社会信用代码 3924、组织机构代码
*/ */
public String getApplicantENo() { public String getApplicantENoType() {
return applicantENo; return applicantENoType;
} }
/**
* 设置:企业邮箱 /**
*/ * 设置:企业证件号码
public void setApplicantEMail(String applicantEMail) { */
this.applicantEMail = applicantEMail; public void setApplicantENo(String applicantENo) {
} this.applicantENo = applicantENo;
/** }
* 获取:企业邮箱
*/ /**
public String getApplicantEMail() { * 获取:企业证件号码
return applicantEMail; */
} public String getApplicantENo() {
/** return applicantENo;
* 设置:省市区 }
*/
public void setApplicantProvinceCity(String applicantProvinceCity) { /**
this.applicantProvinceCity = applicantProvinceCity; * 设置:企业邮箱
} */
/** public void setApplicantEMail(String applicantEMail) {
* 获取:省市区 this.applicantEMail = applicantEMail;
*/ }
public String getApplicantProvinceCity() {
return applicantProvinceCity; /**
} * 获取:企业邮箱
/** */
* 设置:发票收件地址 public String getApplicantEMail() {
*/ return applicantEMail;
public void setApplicantInvoiceReceivingAddress(String applicantInvoiceReceivingAddress) { }
this.applicantInvoiceReceivingAddress = applicantInvoiceReceivingAddress;
} /**
/** * 设置:省市区
* 获取:发票收件地址 */
*/ public void setApplicantProvinceCity(String applicantProvinceCity) {
public String getApplicantInvoiceReceivingAddress() { this.applicantProvinceCity = applicantProvinceCity;
return applicantInvoiceReceivingAddress; }
}
/** /**
* 设置:发票开票电话 * 获取:省市区
*/ */
public void setApplicantInvoiceBillingPhone(String applicantInvoiceBillingPhone) { public String getApplicantProvinceCity() {
this.applicantInvoiceBillingPhone = applicantInvoiceBillingPhone; return applicantProvinceCity;
} }
/**
* 获取:发票开票电话 /**
*/ * 设置:发票收件地址
public String getApplicantInvoiceBillingPhone() { */
return applicantInvoiceBillingPhone; public void setApplicantInvoiceReceivingAddress(String applicantInvoiceReceivingAddress) {
} this.applicantInvoiceReceivingAddress = applicantInvoiceReceivingAddress;
/** }
* 设置:企业开户行名称
*/ /**
public void setApplicantBusinessBankName(String applicantBusinessBankName) { * 获取:发票收件地址
this.applicantBusinessBankName = applicantBusinessBankName; */
} public String getApplicantInvoiceReceivingAddress() {
/** return applicantInvoiceReceivingAddress;
* 获取:企业开户行名称 }
*/
public String getApplicantBusinessBankName() { /**
return applicantBusinessBankName; * 设置:发票开票电话
} */
/** public void setApplicantInvoiceBillingPhone(String applicantInvoiceBillingPhone) {
* 设置:保单号 this.applicantInvoiceBillingPhone = applicantInvoiceBillingPhone;
*/ }
public void setPolicyNo(String policyNo) {
this.policyNo = policyNo; /**
} * 获取:发票开票电话
/** */
* 获取:保单号 public String getApplicantInvoiceBillingPhone() {
*/ return applicantInvoiceBillingPhone;
public String getPolicyNo() { }
return policyNo;
} /**
/** * 设置:企业开户行名称
* 设置:投保类型:1个人 2 企业 */
*/ public void setApplicantBusinessBankName(String applicantBusinessBankName) {
public void setApplicantType(String applicantType) { this.applicantBusinessBankName = applicantBusinessBankName;
this.applicantType = applicantType; }
}
/** /**
* 获取:投保类型:1个人 2 企业 * 获取:企业开户行名称
*/ */
public String getApplicantType() { public String getApplicantBusinessBankName() {
return applicantType; return applicantBusinessBankName;
} }
/**
* 设置:报价请求流水号 /**
*/ * 设置:保单号
public void setTransId(String transId) { */
this.transId = transId; public void setPolicyNo(String policyNo) {
} this.policyNo = policyNo;
/** }
* 获取:报价请求流水号
*/ /**
public String getTransId() { * 获取:保单号
return transId; */
} public String getPolicyNo() {
/** return policyNo;
* 设置:报价号 }
*/
public void setCurrency(String currency) { /**
this.currency = currency; * 设置:投保类型:1个人 2 企业
} */
/** public void setApplicantType(String applicantType) {
* 获取:报价号 this.applicantType = applicantType;
*/ }
public String getCurrency() {
return currency; /**
} * 获取:投保类型:1个人 2 企业
/** */
* 设置:发票开票金额 public String getApplicantType() {
*/ return applicantType;
public void setApplicantInvoicedAmount(String applicantInvoicedAmount) { }
this.applicantInvoicedAmount = applicantInvoicedAmount;
} /**
/** * 设置:报价请求流水号
* 获取:发票开票金额 */
*/ public void setTransId(String transId) {
public String getApplicantInvoicedAmount() { this.transId = transId;
return applicantInvoicedAmount; }
}
/**
public Integer getOrgCode() { * 获取:报价请求流水号
return orgCode; */
} public String getTransId() {
return transId;
public void setOrgCode(Integer orgCode) { }
this.orgCode = orgCode;
} /**
* 设置:报价号
*/
public void setCurrency(String currency) {
this.currency = currency;
}
/**
* 获取:报价号
*/
public String getCurrency() {
return currency;
}
/**
* 设置:发票开票金额
*/
public void setApplicantInvoicedAmount(String applicantInvoicedAmount) {
this.applicantInvoicedAmount = applicantInvoicedAmount;
}
/**
* 获取:发票开票金额
*/
public String getApplicantInvoicedAmount() {
return applicantInvoicedAmount;
}
public Integer getOrgCode() {
return orgCode;
}
public void setOrgCode(Integer orgCode) {
this.orgCode = orgCode;
}
/*验证必要字段*/
public String checkValiad() {
if (StringUtils.isNullOrEmpty(applicantEName)) {
return "企业/网点名称未设置";
}
if (StringUtils.isNullOrEmpty(applicantEAddress)) {
return "企业/网点地址未设置";
}
if (StringUtils.isNullOrEmpty(applicantEContacts)) {
return "企业授权操作人姓名未设置";
}
if (StringUtils.isNullOrEmpty(applicantEPhone)) {
return "操作人的联系电话未设置";
}
if (StringUtils.isNullOrEmpty(applicantENoType)) {
return "企业证件类型未设置";
}
if (StringUtils.isNullOrEmpty(applicantENo)) {
return "企业证件号码未设置";
}
if (StringUtils.isNullOrEmpty(applicantEMail)) {
return "企业邮箱未设置";
}
return "true";
}
} }
...@@ -41,6 +41,7 @@ public class WebSecurityConfig implements WebMvcConfigurer { ...@@ -41,6 +41,7 @@ public class WebSecurityConfig implements WebMvcConfigurer {
.excludePathPatterns("/callBack/policy/payCallBack") .excludePathPatterns("/callBack/policy/payCallBack")
.excludePathPatterns("/callBack/policy/issueCallback") .excludePathPatterns("/callBack/policy/issueCallback")
.excludePathPatterns("/callBack/policy/addpPayCallBack") .excludePathPatterns("/callBack/policy/addpPayCallBack")
.excludePathPatterns("/callBack/policy/batchPayCallback")
.excludePathPatterns("/superLogin/**") .excludePathPatterns("/superLogin/**")
.excludePathPatterns("/actuator/*") .excludePathPatterns("/actuator/*")
.excludePathPatterns("/doc*") .excludePathPatterns("/doc*")
......
...@@ -2,6 +2,7 @@ package cn.timer.api.controller.insure; ...@@ -2,6 +2,7 @@ package cn.timer.api.controller.insure;
import cn.timer.api.bean.insure.*; import cn.timer.api.bean.insure.*;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.utils.HttpUtils; import cn.timer.api.utils.HttpUtils;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -64,31 +65,8 @@ public class CallBackContorll { ...@@ -64,31 +65,8 @@ public class CallBackContorll {
@Value("${pay_page}") @Value("${pay_page}")
private String payPage; private String payPage;
private Map setParams(String sign, String appid, String secret) {
/*当前时间戳*/
long timestamp = System.currentTimeMillis() / 1000;
log.info("时间戳" + timestamp);
Map paramsMap = Maps.newHashMap();
paramsMap.put("pid", appid);
paramsMap.put("timestamp", String.valueOf(timestamp));
paramsMap.put("trace_id", appid + timestamp + new Random().nextInt((9999 - 100) + 1) + 10);
// paramsMap.put("sign",Md5.md5(appid+secret+timestamp+sign.trim()));
String value;
if (sign == null) {
value = appid + secret + timestamp;
} else {
value = appid + secret + timestamp + sign;
log.info("body参数======" + sign);
}
paramsMap.put("sign", DigestUtils.md5Hex(value));
log.info("params参数======" + JSONObject.toJSONString(paramsMap));
return paramsMap;
}
@PostMapping(value = "/insuredCallBack") @PostMapping(value = "/insuredCallBack")
@ApiOperation(value = "6.投保申请回调", httpMethod = "POST", notes = "投保申请回调") @ApiOperation(value = "6.投保核保回调-弃用", httpMethod = "POST", notes = "投保申请回调")
private Map insuredCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { private Map insuredCallBack(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");
...@@ -128,63 +106,67 @@ public class CallBackContorll { ...@@ -128,63 +106,67 @@ public class CallBackContorll {
if (!pid.equals(appidq)) { if (!pid.equals(appidq)) {
return map; return map;
} }
InputStream is = null; try {
is = request.getInputStream(); InputStream is = null;
StringBuilder sb = new StringBuilder(); is = request.getInputStream();
byte[] b = new byte[4096]; StringBuilder sb = new StringBuilder();
for (int n; (n = is.read(b)) != -1; ) { byte[] b = new byte[4096];
sb.append(new String(b, 0, n)); for (int n; (n = is.read(b)) != -1; ) {
} sb.append(new String(b, 0, n));
String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString()); }
if (!value.equals(sign)) { String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString());
return map; if (!value.equals(sign)) {
} throw new CustomException("增员核保回调验签失败");
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class); }
if(callBack.getCallback_type().equals("1")) { CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
List<InsureUser> insureUserList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getTransId, callBack.getOrder_import_info().getThird_uuid())); if (callBack.getCallback_type().equals("1")) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(insureUserList.get(0).getPolicyId()).build().selectById(); List<InsureUser> insureUserList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getTransId, callBack.getOrder_import_info().getThird_uuid()));
if(callBack.getStatus().equals("1")) { InsurePolicy insurePolicy = InsurePolicy.builder().id(insureUserList.get(0).getPolicyId()).build().selectById();
if (insureUserList.size() > 0) { if (callBack.getStatus().equals("1")) {
insurePolicy.setStatus("4");/*设置为支付状态*/ if (insureUserList.size() > 0) {
insurePolicy.setUpdateTime(new Date()); insurePolicy.setStatus("4");/*设置为支付状态*/
InsurePay insurePay= InsurePay.builder().payStatus(1). insurePolicy.setUpdateTime(new Date());
serialNumber(callBack.getOrder_import_info().getUuid()).policyId(insurePolicy.getId()).amount(Double.parseDouble(callBack.getOrder_import_info().getTotal_money())).build(); InsurePay insurePay = InsurePay.builder().payStatus(1).
insurePay.insert(); serialNumber(callBack.getOrder_import_info().getUuid()).policyId(insurePolicy.getId()).amount(Double.parseDouble(callBack.getOrder_import_info().getTotal_money())).build();
insurePolicy.setPayId(insurePay.getId()); insurePay.insert();
insurePolicy.updateById(); insurePolicy.setPayId(insurePay.getId());
insurePolicy.updateById();
}
InsureLog.builder().type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/addpPayCallBack")
.returnCode(callBack.getStatus()).returnMsg("核保通过").policyId(insurePolicy.getId()).build().insert();
}else{
insureUserList.stream().forEach(v->{
v.setStatus("2");
v.setInsureStatus(2);
v.updateById();
});
insurePolicy.setStatus("1");
insurePolicy.updateById();
List<Map> errMap = callBack.getOrder_import_info().getErr_list();
String errorMsg="";
if (errMap.size() > 0) {
for (int i = 0; i < errMap.size(); i++) {
errorMsg = errorMsg + ("姓名:" + errMap.get(i).get("name").toString() + ",错误:" + errMap.get(i).get("err_content").toString() + ',');
} }
InsureLog.builder().type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/addpPayCallBack")
.returnCode(callBack.getStatus()).returnMsg("核保通过").policyId(insurePolicy.getId()).build().insert();
} else { } else {
errorMsg = callBack.getErr_msg(); insureUserList.stream().forEach(v -> {
v.setStatus("2");
v.setInsureStatus(2);
v.updateById();
});
insurePolicy.setStatus("1");
insurePolicy.updateById();
List<Map> errMap = callBack.getOrder_import_info().getErr_list();
String errorMsg = "";
if (errMap.size() > 0) {
for (int i = 0; i < errMap.size(); i++) {
errorMsg = errorMsg + ("姓名:" + errMap.get(i).get("name").toString() + ",错误:" + errMap.get(i).get("err_content").toString() + ',');
}
} else {
errorMsg = callBack.getErr_msg();
}
//TODO 写入日志
InsureLog.builder().type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/addpPayCallBack")
.returnCode(callBack.getStatus()).returnMsg(errorMsg).policyId(insurePolicy.getId()).build().insert();
} }
//TODO 写入日志
InsureLog.builder().type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/addpPayCallBack")
.returnCode(callBack.getStatus()).returnMsg(errorMsg).policyId(insurePolicy.getId()).build().insert();
} }
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("增员核保回调异常");
} finally {
Map trueMap = Maps.newHashMap();
trueMap.put("status", "1");
return trueMap;
} }
Map trueMap = Maps.newHashMap();
trueMap.put("status", "1");
return trueMap;
} }
@PostMapping(value = "/CallBack") @PostMapping(value = "/CallBack")
...@@ -199,189 +181,246 @@ public class CallBackContorll { ...@@ -199,189 +181,246 @@ public class CallBackContorll {
if (!pid.equals(appidq)) { if (!pid.equals(appidq)) {
return map; return map;
} }
InputStream is = null; try {
is = request.getInputStream(); InputStream is = null;
StringBuilder sb = new StringBuilder(); is = request.getInputStream();
byte[] b = new byte[4096]; StringBuilder sb = new StringBuilder();
for (int n; (n = is.read(b)) != -1; ) { byte[] b = new byte[4096];
sb.append(new String(b, 0, n)); for (int n; (n = is.read(b)) != -1; ) {
} sb.append(new String(b, 0, n));
String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString()); }
if (!value.equals(sign)) { String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString());
return map; if (!value.equals(sign)) {
} throw new CustomException("保全增员申请回调验签失败");
Map paramsMap = Maps.newHashMap(); }
paramsMap.put("pid", pid); Map paramsMap = Maps.newHashMap();
paramsMap.put("timestamp", timestamp); paramsMap.put("pid", pid);
paramsMap.put("sign", sign); paramsMap.put("timestamp", timestamp);
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class); paramsMap.put("sign", sign);
log.info("callBack=====" + sb.toString()); CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
if (callBack.getStatus().equals("1")) {
List<InsureUser> list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()).eq(InsureUser::getInsureStatus, 3)); List<InsureUser> list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()).eq(InsureUser::getInsureStatus, 3));
list.forEach(i -> { InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, list.get(0).getPolicyNo()));
i.setInsureStatus(1); if (callBack.getStatus().equals("1")) {
i.updateById(); list.forEach(i -> {
YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); i.setInsureStatus(1);
}); i.setStatus("1");
List<InsureUser> oldlist = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getReplaceTransId, callBack.getOrder_import_info().getUuid()));
if (oldlist != null && oldlist.size() > 0) {
oldlist.forEach(i -> {
i.setInsureStatus(4);
i.setStatus("2");
i.updateById(); i.updateById();
YgglMainEmp.builder().isInsure(0).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
}); });
List<InsureUser> oldlist = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getReplaceTransId, callBack.getOrder_import_info().getUuid()));
if (oldlist != null && oldlist.size() > 0) {
oldlist.forEach(i -> {
i.setInsureStatus(4);
i.setStatus("2");
i.updateById();
YgglMainEmp.builder().isInsure(0).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
});
}
if (oldlist == null || oldlist.size() == 0) {
insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money())));
}
insurePolicy.setPolicyFile(callBack.getOrder_import_info().getEndorsement_file());
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/CallBack")
.returnCode(callBack.getStatus()).returnMsg("更新成功").policyId(insurePolicy.getId()).build().insert();
} else {
String errorMsg = "";
InsureLog insureLog = InsureLog.builder().build().selectOne(new QueryWrapper<InsureLog>().lambda().eq(InsureLog::getTransId, callBack.getOrder_import_info().getThird_uuid()));
if(callBack.getOrder_import_info().getErr_list()!=null) {
List<Map> errMap = callBack.getOrder_import_info().getErr_list();
if (errMap.size() > 0) {
for (int i = 0; i < errMap.size(); i++) {
errorMsg = errorMsg + ("姓名:" + errMap.get(i).get("name").toString() + ",错误:" + errMap.get(i).get("err_content").toString() + ',');
}
} else {
errorMsg = callBack.getErr_msg();
}
}
/*在保司系统点击取消申报时候会回调申报失败*/
if(StringUtils.isNullOrEmpty(callBack.getOrder_import_info().getSingle_serial_no())){
list.forEach(i -> {
i.setInsureStatus(2);
i.setStatus("2");
i.updateById();
YgglMainEmp.builder().isInsure(0).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
});
}
//TODO 写入日志
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/CallBack")
.returnCode(callBack.getStatus()).returnMsg(errorMsg).policyId(insurePolicy.getId()).build().insert();
} }
InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, list.get(0).getPolicyNo())); /*无论此次申请成功还是失败这笔单都需要重新申报*/
if (oldlist == null || oldlist.size() == 0) {
insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money())));
}
insurePolicy.setPolicyFile(callBack.getOrder_import_info().getEndorsement_file());
insurePolicy.setUpdateTime(new Date()); insurePolicy.setUpdateTime(new Date());
insurePolicy.setStatus("1"); insurePolicy.setStatus("1");
insurePolicy.updateById(); insurePolicy.updateById();
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/CallBack") } catch (Exception e) {
.returnCode(callBack.getStatus()).returnMsg("更新成功").policyId(insurePolicy.getId()).build().insert(); e.printStackTrace();
} else { throw new CustomException("保全增员申请回调异常");
String errorMsg = ""; } finally {
InsureLog insureLog = InsureLog.builder().build().selectOne(new QueryWrapper<InsureLog>().lambda().eq(InsureLog::getTransId, callBack.getOrder_import_info().getThird_uuid())); Map trueMap = Maps.newHashMap();
List<Map> errMap = callBack.getOrder_import_info().getErr_list(); trueMap.put("status", "1");
if (errMap.size() > 0) { return trueMap;
for (int i = 0; i < errMap.size(); i++) {
errorMsg = errorMsg + ("姓名:" + errMap.get(i).get("name").toString() + ",错误:" + errMap.get(i).get("err_content").toString() + ',');
}
} else {
errorMsg = callBack.getErr_msg();
}
//TODO 写入日志
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/CallBack")
.returnCode(callBack.getStatus()).returnMsg(errorMsg).policyId(insureLog.getPolicyId()).build().insert();
} }
Map trueMap = Maps.newHashMap();
trueMap.put("status", "1");
return trueMap;
} }
@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 { private ModelAndView callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException {
log.info("支付完成回调(仅代表用户点了已支付,无法确认是否真正支付)");
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());
insurePay.updateById(); insurePay.updateById();
InsureLog.builder().type(7).createTime(new Date()).requestType(2).requestPath(base_api_url + "/payStatus?policyId=" + policyId) InsureLog.builder().type(7).createTime(new Date()).requestType(2).requestPath(base_api_url + "/callBack/policy/payStatus?policyId=" + policyId)
.returnCode("suc").returnMsg("用户已支付"+insurePay.getAmount()+"元,等待更新保单状态").policyId(policyId).build().insert(); .returnCode("suc").returnMsg("用户已支付" + insurePay.getAmount() + "元,等待更新保单状态").policyId(policyId).build().insert();
ModelAndView mav = new ModelAndView(); ModelAndView mav = new ModelAndView();
mav.setViewName("redirect:"+payPage+"/#/payPage"); mav.setViewName("redirect:" + payPage + "/#/payPage?amount="+insurePay.getAmount());
return mav; return mav;
} }
@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 { private Map payCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
log.info("支付回调"); try {
Map map = Maps.newHashMap(); InputStream is = null;
InputStream is = null; is = request.getInputStream();
is = request.getInputStream(); StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(); byte[] b = new byte[4096];
byte[] b = new byte[4096]; for (int n; (n = is.read(b)) != -1; ) {
for (int n; (n = is.read(b)) != -1; ) { sb.append(new String(b, 0, n));
sb.append(new String(b, 0, n)); }
} String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString());
String value = DigestUtils.md5Hex(appid + secret + timestamp + sb.toString()); if (!value.equals(sign)) {
if (!value.equals(sign)) { throw new CustomException("投保支付收银台回调验签失败");
return map; }
} PayCallBack callBack = JSONObject.parseObject(sb.toString(), PayCallBack.class);
Map paramsMap = Maps.newHashMap(); InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
paramsMap.put("pid", pid); insurePay.setAmount(Double.valueOf(callBack.getAmount()));
paramsMap.put("timestamp", timestamp); insurePay.setPayStatus(Integer.parseInt(callBack.getPay_status()));
paramsMap.put("sign", sign); insurePay.setPaySerialNo(callBack.getPay_serial_no());
PayCallBack callBack = JSONObject.parseObject(sb.toString(), PayCallBack.class); insurePay.setSerialNumber(callBack.getSerial_number());
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number())); insurePay.setPayType(callBack.getPay_type());
insurePay.setAmount(Double.valueOf(callBack.getAmount())); insurePay.updateById();
insurePay.setPayStatus(Integer.parseInt(callBack.getPay_status())); InsureLog.builder().type(7).createTime(new Date()).requestType(1).requestPath(base_api_url + "/callBack/policy/payCallBack")
insurePay.setPaySerialNo(callBack.getPay_serial_no()); .returnCode("suc").returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + callBack.getAmount()).policyId(insurePay.getPolicyId()).build().insert();
insurePay.setSerialNumber(callBack.getSerial_number()); /*调用出单接口更新保单状态*/
insurePay.setPayType(callBack.getPay_type()); Map paramsMap = Maps.newHashMap();
insurePay.updateById(); paramsMap.put("pid", pid);
/*调用出单接口更新保单状态*/ paramsMap.put("timestamp", timestamp);
Map bodyMap = Maps.newHashMap(); paramsMap.put("sign", sign);
bodyMap.put("quotation_id", callBack.getSerial_number()); Map bodyMap = Maps.newHashMap();
String data = HttpUtils.sendPost(getPolicyUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap); bodyMap.put("quotation_id", callBack.getSerial_number());
Map dataMap = JSONObject.parseObject(data, Map.class); String data = HttpUtils.sendPost(getPolicyUrl, InsureContorll.setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap);
if (dataMap.size() > 0) { Map dataMap = JSONObject.parseObject(data, Map.class);
if (dataMap.get("errcode").toString().equals("e25")) { if (dataMap.size() > 0) {
//TODO 如果是E25则将保单设为出单中,更新交由保单出单回调做,设为出单状态是因为之后可以手动校验 if (dataMap.get("errcode").toString().equals("suc") || dataMap.get("errcode").toString().equals("e25")) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById(); //TODO 如果是E25则将保单设为出单中,更新交由保单出单回调做,设为出单状态是因为之后可以手动校验
insurePolicy.setStatus("2"); InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
insurePolicy.setUpdateTime(new Date()); insurePolicy.setStatus("2");
insurePolicy.updateById(); insurePolicy.setUpdateTime(new Date());
InsureLog.builder().type(7).createTime(new Date()).requestType(1).requestPath(base_api_url + "/payCallBack") insurePolicy.updateById();
.returnCode("suc").returnMsg(dataMap.get("errmsg").toString()).build().insert(); }
} else if (dataMap.get("errcode").toString().equals("suc")) { InsureLog.builder().requestParam(JSONObject.toJSONString(InsureContorll.setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(7)
InsureLog.builder().type(7).createTime(new Date()).requestType(1).requestPath(base_api_url + "/payCallBack")
.returnCode("suc").returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + callBack.getAmount()).policyId(insurePay.getPolicyId()).build().insert();
} else {
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(7)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(getPolicyUrl) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(getPolicyUrl)
.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) {
e.printStackTrace();
throw new CustomException("投保支付收银台回调异常");
} finally {
Map map = Maps.newHashMap();
map.put("status", "1");
return map;
} }
map.put("status", "1");
return map;
} }
@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 { private Map issueCallback(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
log.info("保单出单回调"); try {
Map map = Maps.newHashMap(); InputStream is = null;
map.put("status", "1"); is = request.getInputStream();
InputStream is = null; StringBuilder sb = new StringBuilder();
is = request.getInputStream(); byte[] b = new byte[4096];
StringBuilder sb = new StringBuilder(); for (int n; (n = is.read(b)) != -1; ) {
byte[] b = new byte[4096]; sb.append(new String(b, 0, n));
for (int n; (n = is.read(b)) != -1; ) { }
sb.append(new String(b, 0, n)); String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString());
} if (!value.equals(sign)) {
String value = DigestUtils.md5Hex(appid + secret + timestamp + sb.toString()); throw new CustomException("保单出单回调验签失败");
if (!value.equals(sign)) { }
PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
List<InsureUser> userList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getPolicyId, insurePolicy.getId()));
insurePolicy.setUpdateTime(new Date());
if (callBack.getStatus().equals("1")) {
insurePay.setPayStatus(2);
insurePolicy.setPolicyNo(callBack.getPolicy_no());
insurePolicy.setTotalPremium(callBack.getTotal_premium());
insurePolicy.setPolicyFile(callBack.getPolicy_file());
insurePolicy.setStatus("1");
insurePolicy.setKitUrl(callBack.getKit_url());
userList.forEach(u -> {
u.setStatus("1");
u.setInsureStatus(1);
u.updateById();
});
} else {
insurePay.setPayStatus(3);
insurePolicy.setStatus("3");
userList.forEach(u -> {
u.setStatus("2");
u.setInsureStatus(2);
u.updateById();
});
}
insurePolicy.updateById();
insurePay.updateById();
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();
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("保单出单回调");
} finally {
Map map = Maps.newHashMap();
map.put("status", "1");
return map; return map;
} }
PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class); }
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById(); @PostMapping(value = "/batchPayCallback")
List<InsureUser> userList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getPolicyId, insurePolicy.getId())); @ApiOperation(value = "增员支付回调-保司接口没启用", httpMethod = "POST", notes = "增员支付回调")
insurePolicy.setUpdateTime(new Date()); private Map batchPayCallback(HttpServletRequest request) throws IOException {
if (callBack.getStatus().equals("1")) {
insurePay.setPayStatus(2); try {
insurePolicy.setPolicyNo(callBack.getPolicy_no()); InputStream is = null;
insurePolicy.setTotalPremium(callBack.getTotal_premium()); is = request.getInputStream();
insurePolicy.setPolicyFile(callBack.getPolicy_file()); StringBuilder sb = new StringBuilder();
insurePolicy.setStatus("1"); byte[] b = new byte[4096];
insurePolicy.setKitUrl(callBack.getKit_url()); for (int n; (n = is.read(b)) != -1; ) {
userList.forEach(u -> { sb.append(new String(b, 0, n));
u.setStatus("1"); }
u.setInsureStatus(1); BatchPayCallBack callBack = JSONObject.parseObject(sb.toString(), BatchPayCallBack.class);
u.updateById(); InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getOrder_import_uuid()));
}); if (insurePay != null) {
} else { insurePay.setPayStatus(Integer.parseInt(callBack.getPay_status()));
insurePay.setPayStatus(3); insurePay.setAmount(Double.parseDouble(callBack.getPay_money()));
insurePolicy.setStatus("3"); insurePay.setPayType(callBack.getMethod());
userList.forEach(u -> { insurePay.updateById();
u.setStatus("2"); }
u.setInsureStatus(2); InsureLog.builder().type(7).createTime(new Date()).requestType(1).returnBody(sb.toString()).requestPath(base_api_url + "/callBack/policy/batchPayCallback")
u.updateById(); .returnCode(callBack.getPay_status()).policyId(insurePay.getPolicyId()).returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + insurePay.getAmount()).build().insert();
}); } catch (Exception e) {
e.printStackTrace();
throw new CustomException("增员支付回调异常");
} finally {
Map map = Maps.newHashMap();
map.put("status", "1");
return map;
} }
insurePolicy.updateById();
insurePay.updateById();
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();
return map;
} }
} }
...@@ -9,6 +9,7 @@ import cn.timer.api.bean.insure.InsureApplicant; ...@@ -9,6 +9,7 @@ import cn.timer.api.bean.insure.InsureApplicant;
import cn.timer.api.bean.qyzx.QyzxEntInfoM; import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dao.insure.InsureApplicantMapper; import cn.timer.api.dao.insure.InsureApplicantMapper;
import cn.timer.api.dto.insure.InsureDto; import cn.timer.api.dto.insure.InsureDto;
import cn.timer.api.utils.HttpUtils; import cn.timer.api.utils.HttpUtils;
...@@ -49,32 +50,42 @@ public class InsureApplicantController { ...@@ -49,32 +50,42 @@ public class InsureApplicantController {
@PostMapping("/insureApplicationSetting") @PostMapping("/insureApplicationSetting")
@ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请") @ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请")
private Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) { private Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,params.getOrgCode())); try {
params.setId(insureApplicant.getId()); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, params.getOrgCode()));
params.updateById(); params.setId(insureApplicant.getId());
return ResultUtil.data(params); params.updateById();
return ResultUtil.data(params);
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("设置投保人异常");
}
} }
@GetMapping("/getApplicantAdmin") @GetMapping("/getApplicantAdmin")
@ApiOperation(value = "获取投保人--运营后台", httpMethod = "GET", notes = "获取投保人") @ApiOperation(value = "获取投保人--运营后台", httpMethod = "GET", notes = "获取投保人")
private Result<Object> getApplicant(@RequestParam("orgCode") Integer orgCode) { private Result<Object> getApplicant(@RequestParam("orgCode") Integer orgCode) {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,orgCode)); try {
if(insureApplicant==null){ InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, orgCode));
QyzxEntInfoM qyzxEntInfoM=QyzxEntInfoM.builder().id(orgCode).build().selectById(); if (insureApplicant == null) {
insureApplicant = getInsureApplicant(qyzxEntInfoM); QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(orgCode).build().selectById();
insureApplicant.setOrgCode(orgCode); insureApplicant = getInsureApplicant(qyzxEntInfoM);
insureApplicant.insert(); insureApplicant.setOrgCode(orgCode);
insureApplicant.insert();
}
return ResultUtil.data(insureApplicant);
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("获取投保人异常");
} }
return ResultUtil.data(insureApplicant);
} }
private InsureApplicant getInsureApplicant(QyzxEntInfoM qyzxEntInfoM) { private InsureApplicant getInsureApplicant(QyzxEntInfoM qyzxEntInfoM) {
InsureApplicant insureApplicant; InsureApplicant insureApplicant;
insureApplicant=new InsureApplicant(); insureApplicant = new InsureApplicant();
insureApplicant.setApplicantEName(qyzxEntInfoM.getName()); insureApplicant.setApplicantEName(qyzxEntInfoM.getName());
insureApplicant.setApplicantEAddress(qyzxEntInfoM.getWorkAddress()); insureApplicant.setApplicantEAddress(qyzxEntInfoM.getWorkAddress());
insureApplicant.setApplicantEContacts(qyzxEntInfoM.getOperName());/*这里为避免联系人为空,默认使用法人*/ insureApplicant.setApplicantEContacts(qyzxEntInfoM.getLinkMan());
insureApplicant.setApplicantEPhone(qyzxEntInfoM.getPhone());/*这里为避免联系人为空,默认使用法人*/ insureApplicant.setApplicantEPhone(qyzxEntInfoM.getPhone());/*这里为避免联系人为空,默认使用法人*/
insureApplicant.setApplicantType("2"); insureApplicant.setApplicantType("2");
insureApplicant.setApplicantENoType("3646"); insureApplicant.setApplicantENoType("3646");
...@@ -86,14 +97,19 @@ public class InsureApplicantController { ...@@ -86,14 +97,19 @@ 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) { private Result<Object> getApplicant(@CurrentUser UserBean userBean) {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,userBean.getOrgCode())); try {
if(insureApplicant==null){ InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, userBean.getOrgCode()));
QyzxEntInfoM qyzxEntInfoM=QyzxEntInfoM.builder().id(userBean.getOrgCode()).build().selectById(); if (insureApplicant == null) {
insureApplicant = getInsureApplicant(qyzxEntInfoM); QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(userBean.getOrgCode()).build().selectById();
insureApplicant.setOrgCode(userBean.getOrgCode()); insureApplicant = getInsureApplicant(qyzxEntInfoM);
insureApplicant.insert(); insureApplicant.setOrgCode(userBean.getOrgCode());
insureApplicant.insert();
}
return ResultUtil.data(insureApplicant);
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("获取投保人异常");
} }
return ResultUtil.data(insureApplicant);
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -114,6 +114,7 @@ public class InsureUserController{ ...@@ -114,6 +114,7 @@ public class InsureUserController{
policyDto.setCategoryId(categoryId); policyDto.setCategoryId(categoryId);
List<PolicyDto> list = insureUserMapper.selectPolicyList(policyDto); List<PolicyDto> list = insureUserMapper.selectPolicyList(policyDto);
String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Scheme_name", "Date_start", "Branch", "Tricycle_frame_number", "benefit_occupation_category"}; String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Scheme_name", "Date_start", "Branch", "Tricycle_frame_number", "benefit_occupation_category"};
/*XSSFWorkbook xssfWorkbook = ExcelUtils.exportExcel("导出人员清单.xlsx", rowName, list);*/ // for ()
// XSSFWorkbook xssfWorkbook = ExcelUtils.exportExcel("导出人员清单.xlsx", rowName, list);
} }
} }
...@@ -5,6 +5,7 @@ import cn.timer.api.bean.insure.InsureLog; ...@@ -5,6 +5,7 @@ import cn.timer.api.bean.insure.InsureLog;
import cn.timer.api.bean.insure.InsurePolicy; import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser; import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dao.insure.InsurePolicyMapper; import cn.timer.api.dao.insure.InsurePolicyMapper;
import cn.timer.api.dao.insure.InsureUserMapper; import cn.timer.api.dao.insure.InsureUserMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper; import cn.timer.api.dao.yggl.YgglMainEmpMapper;
...@@ -36,10 +37,12 @@ public class InsureTaskTiming { ...@@ -36,10 +37,12 @@ public class InsureTaskTiming {
private YgglMainEmpMapper ygglMainEmpMapper; private YgglMainEmpMapper ygglMainEmpMapper;
@Scheduled(cron = "0 0 0 1 * ?")//每月第一天 @Scheduled(cron = "0 0 0 1 * ?")//每月第一天
public void updateInsureStatusTask() throws ParseException { public void updateInsureStatusTask(){
Date now = DateUtil.date(); try {
/*获取正常的保单*/
List<InsurePolicy> insurePolicyList = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus, "1").lt(InsurePolicy::getPolicyDateEnd,now)); Date now = DateUtil.date();
/*获取正常的保单*/
List<InsurePolicy> insurePolicyList = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus, "1").lt(InsurePolicy::getPolicyDateEnd, now));
if (insurePolicyList.size() > 0) { if (insurePolicyList.size() > 0) {
/*获取已经过期保单*/ /*获取已经过期保单*/
for (InsurePolicy insurePolicy : insurePolicyList) { for (InsurePolicy insurePolicy : insurePolicyList) {
...@@ -48,14 +51,20 @@ public class InsureTaskTiming { ...@@ -48,14 +51,20 @@ public class InsureTaskTiming {
.eq(InsureUser::getInsureStatus, 1)); .eq(InsureUser::getInsureStatus, 1));
if (insureUsersList.size() > 0) { if (insureUsersList.size() > 0) {
int count = ygglMainEmpMapper.updateInsure(insureUsersList.stream().map(InsureUser::getUserId).toArray(Integer[]::new)); int count = ygglMainEmpMapper.updateInsure(insureUsersList.stream().map(InsureUser::getUserId).toArray(Integer[]::new));
log.info("总共更新员工投保状态", count); log.info("总共更新员工投保状态:"+count);
int uCount = insureUserMapper.updateInsure(insurePolicyList.stream().map(InsurePolicy::getId).toArray(Integer[]::new)); int uCount = insureUserMapper.updateInsure(insurePolicyList.stream().map(InsurePolicy::getId).toArray(Integer[]::new));
log.info("总共更新投保人投保状态", uCount); log.info("总共更新投保人投保状态:"+uCount);
} }
insurePolicy.setStatus("3"); insurePolicy.setStatus("3");
insurePolicy.updateById(); insurePolicy.updateById();
InsureLog.builder().type(7)
.createTime(new Date()).requestType(1).returnMsg("保单已到期,自动失效").policyId(insurePolicy.getId()).build().insert();
} }
} }
log.error("暂无过期保单"); log.error("暂无过期保单");
}catch (Exception e){
e.printStackTrace();
throw new CustomException("保单失效定时器异常");
}
} }
} }
...@@ -46,4 +46,5 @@ public class PolicyDto { ...@@ -46,4 +46,5 @@ public class PolicyDto {
private Integer applyType; private Integer applyType;
private String monthD; private String monthD;
private String userName; private String userName;
private String companyName;
} }
...@@ -268,6 +268,9 @@ ...@@ -268,6 +268,9 @@
<if test="policy.policyDateStart!=null and policy.policyDateStart!=''"> <if test="policy.policyDateStart!=null and policy.policyDateStart!=''">
and ip.policy_date_start <![CDATA[ >= ]]> #{policy.policyDateStart} and ip.policy_date_start <![CDATA[ >= ]]> #{policy.policyDateStart}
</if> </if>
<if test="policy.companyName!=null and policy.companyName!=''">
and qy.name like CONCAT('%',#{policy.companyName},'%')
</if>
</where> </where>
GROUP BY ip.id GROUP BY ip.id
order by ip.create_time desc order by ip.create_time desc
...@@ -319,17 +322,17 @@ ...@@ -319,17 +322,17 @@
<select id="policyTotalList" resultType="cn.timer.api.dto.insure.PolicyDto"> <select id="policyTotalList" resultType="cn.timer.api.dto.insure.PolicyDto">
SELECT SELECT
ip.id as id, ip.id AS id,
ip.name AS schemeName, ip.NAME AS schemeName,
ip.type AS type, ip.type AS type,
count(ipp.id) AS totaPolicy, (select count(id) from insure_policy WHERE product_id=ip.id ) AS totaPolicy,
count(ipp.org_code) AS totalCompany, (select count(org_code) from insure_policy WHERE product_id=ip.id) as totalCompany,
count( iu.id ) AS totalUser, count( iu.id ) AS totalUser,
sum(iu.price) as totalPremium, sum( iu.price ) AS totalPremium,
ipp.update_time AS updateTime ipp.update_time AS updateTime
FROM FROM
insure_product ip insure_product ip
LEFT JOIN insure_policy ipp ON ipp.product_id = ip.id LEFT JOIN insure_policy ipp ON ipp.product_id = ip.id and ipp.`status`=1
LEFT JOIN insure_user iu ON iu.policy_id = ipp.id LEFT JOIN insure_user iu ON iu.policy_id = ipp.id
WHERE WHERE
ip.is_del = 0 ip.is_del = 0
......
...@@ -237,6 +237,17 @@ ...@@ -237,6 +237,17 @@
<select id="companyAdminCount" resultType="java.lang.Integer"> <select id="companyAdminCount" resultType="java.lang.Integer">
select count(qeim.id) from qyzx_ent_info_m qeim select count(qeim.id) from qyzx_ent_info_m qeim
<where>
<if test="param.name != null and param.name !=''">
and qeim.NAME like CONCAT('%',#{param.name},'%')
</if>
<if test="param.linkMan != null and param.linkMan !=''">
and qeim.link_man like CONCAT('%',#{param.linkMan},'%')
</if>
<if test="param.linkManPhone != null and param.linkManPhone !=''">
and qeim.phone like CONCAT('%',#{param.linkManPhone},'%')
</if>
</where>
</select> </select>
<select id ="getCompanyList" resultType="java.util.HashMap"> <select id ="getCompanyList" resultType="java.util.HashMap">
......
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