Commit 8e8d251a by 翁国栋 Committed by 284718418@qq.com

8小时运营后台--

投保人信息验证
企业列表信息验证
导入信息验证
导入人员信息验证
保单搜索列表更据企业名称查找
parent 92aff9ea
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;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.mysql.cj.util.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.*;
import org.springframework.beans.factory.annotation.Value;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
/**
* 投保人
*
......@@ -49,6 +48,7 @@ public class InsureApplicant extends Model<InsureApplicant> {
* 企业/网点名称
*/
@ApiModelProperty(value = "企业/网点名称")
@NotEmpty
private String applicantEName;
/**
* 企业/网点地址
......@@ -132,7 +132,7 @@ public class InsureApplicant extends Model<InsureApplicant> {
private String applicantInvoicedAmount;
@ApiModelProperty(value = "企业id", example = "")
private Integer orgCode;
@ApiModelProperty(value="银行账号")
@ApiModelProperty(value = "银行账号")
private String applicantCorporateBankAccount;
/**
......@@ -148,198 +148,231 @@ public class InsureApplicant extends Model<InsureApplicant> {
public void setApplicantEName(String applicantEName) {
this.applicantEName = applicantEName;
}
/**
* 获取:企业/网点名称
*/
public String getApplicantEName() {
return applicantEName;
}
/**
* 设置:企业/网点地址
*/
public void setApplicantEAddress(String applicantEAddress) {
this.applicantEAddress = applicantEAddress;
}
/**
* 获取:企业/网点地址
*/
public String getApplicantEAddress() {
return applicantEAddress;
}
/**
* 设置:人员清单
*/
public void setApplicantEmployeeList(String applicantEmployeeList) {
this.applicantEmployeeList = applicantEmployeeList;
}
/**
* 获取:人员清单
*/
public String getApplicantEmployeeList() {
return applicantEmployeeList;
}
/**
* 设置:企业授权操作人姓名
*/
public void setApplicantEContacts(String applicantEContacts) {
this.applicantEContacts = applicantEContacts;
}
/**
* 获取:企业授权操作人姓名
*/
public String getApplicantEContacts() {
return applicantEContacts;
}
/**
* 设置:操作人的联系电话
*/
public void setApplicantEPhone(String applicantEPhone) {
this.applicantEPhone = applicantEPhone;
}
/**
* 获取:操作人的联系电话
*/
public String getApplicantEPhone() {
return applicantEPhone;
}
/**
* 设置:企业证件类型:3646、统一社会信用代码 3924、组织机构代码
*/
public void setApplicantENoType(String applicantENoType) {
this.applicantENoType = applicantENoType;
}
/**
* 获取:企业证件类型:3646、统一社会信用代码 3924、组织机构代码
*/
public String getApplicantENoType() {
return applicantENoType;
}
/**
* 设置:企业证件号码
*/
public void setApplicantENo(String applicantENo) {
this.applicantENo = applicantENo;
}
/**
* 获取:企业证件号码
*/
public String getApplicantENo() {
return applicantENo;
}
/**
* 设置:企业邮箱
*/
public void setApplicantEMail(String applicantEMail) {
this.applicantEMail = applicantEMail;
}
/**
* 获取:企业邮箱
*/
public String getApplicantEMail() {
return applicantEMail;
}
/**
* 设置:省市区
*/
public void setApplicantProvinceCity(String applicantProvinceCity) {
this.applicantProvinceCity = applicantProvinceCity;
}
/**
* 获取:省市区
*/
public String getApplicantProvinceCity() {
return applicantProvinceCity;
}
/**
* 设置:发票收件地址
*/
public void setApplicantInvoiceReceivingAddress(String applicantInvoiceReceivingAddress) {
this.applicantInvoiceReceivingAddress = applicantInvoiceReceivingAddress;
}
/**
* 获取:发票收件地址
*/
public String getApplicantInvoiceReceivingAddress() {
return applicantInvoiceReceivingAddress;
}
/**
* 设置:发票开票电话
*/
public void setApplicantInvoiceBillingPhone(String applicantInvoiceBillingPhone) {
this.applicantInvoiceBillingPhone = applicantInvoiceBillingPhone;
}
/**
* 获取:发票开票电话
*/
public String getApplicantInvoiceBillingPhone() {
return applicantInvoiceBillingPhone;
}
/**
* 设置:企业开户行名称
*/
public void setApplicantBusinessBankName(String applicantBusinessBankName) {
this.applicantBusinessBankName = applicantBusinessBankName;
}
/**
* 获取:企业开户行名称
*/
public String getApplicantBusinessBankName() {
return applicantBusinessBankName;
}
/**
* 设置:保单号
*/
public void setPolicyNo(String policyNo) {
this.policyNo = policyNo;
}
/**
* 获取:保单号
*/
public String getPolicyNo() {
return policyNo;
}
/**
* 设置:投保类型:1个人 2 企业
*/
public void setApplicantType(String applicantType) {
this.applicantType = applicantType;
}
/**
* 获取:投保类型:1个人 2 企业
*/
public String getApplicantType() {
return applicantType;
}
/**
* 设置:报价请求流水号
*/
public void setTransId(String transId) {
this.transId = transId;
}
/**
* 获取:报价请求流水号
*/
public String getTransId() {
return transId;
}
/**
* 设置:报价号
*/
public void setCurrency(String currency) {
this.currency = currency;
}
/**
* 获取:报价号
*/
public String getCurrency() {
return currency;
}
/**
* 设置:发票开票金额
*/
public void setApplicantInvoicedAmount(String applicantInvoicedAmount) {
this.applicantInvoicedAmount = applicantInvoicedAmount;
}
/**
* 获取:发票开票金额
*/
......@@ -354,4 +387,30 @@ public class InsureApplicant extends Model<InsureApplicant> {
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";
}
}
......@@ -2,6 +2,7 @@ package cn.timer.api.controller.insure;
import cn.timer.api.bean.insure.*;
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.ResultUtil;
import com.alibaba.fastjson.JSONObject;
......@@ -64,31 +65,8 @@ public class CallBackContorll {
@Value("${pay_page}")
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")
@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 {
Map map = Maps.newHashMap();
map.put("status", "error");
......@@ -128,6 +106,7 @@ public class CallBackContorll {
if (!pid.equals(appidq)) {
return map;
}
try {
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
......@@ -135,19 +114,19 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString());
String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString());
if (!value.equals(sign)) {
return map;
throw new CustomException("增员核保回调验签失败");
}
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
if(callBack.getCallback_type().equals("1")) {
if (callBack.getCallback_type().equals("1")) {
List<InsureUser> insureUserList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getTransId, callBack.getOrder_import_info().getThird_uuid()));
InsurePolicy insurePolicy = InsurePolicy.builder().id(insureUserList.get(0).getPolicyId()).build().selectById();
if(callBack.getStatus().equals("1")) {
if (callBack.getStatus().equals("1")) {
if (insureUserList.size() > 0) {
insurePolicy.setStatus("4");/*设置为支付状态*/
insurePolicy.setUpdateTime(new Date());
InsurePay insurePay= InsurePay.builder().payStatus(1).
InsurePay insurePay = InsurePay.builder().payStatus(1).
serialNumber(callBack.getOrder_import_info().getUuid()).policyId(insurePolicy.getId()).amount(Double.parseDouble(callBack.getOrder_import_info().getTotal_money())).build();
insurePay.insert();
insurePolicy.setPayId(insurePay.getId());
......@@ -157,10 +136,8 @@ public class CallBackContorll {
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->{
} else {
insureUserList.stream().forEach(v -> {
v.setStatus("2");
v.setInsureStatus(2);
v.updateById();
......@@ -168,7 +145,7 @@ public class CallBackContorll {
insurePolicy.setStatus("1");
insurePolicy.updateById();
List<Map> errMap = callBack.getOrder_import_info().getErr_list();
String errorMsg="";
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() + ',');
......@@ -182,10 +159,15 @@ public class CallBackContorll {
.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;
}
}
@PostMapping(value = "/CallBack")
@ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调")
......@@ -199,6 +181,7 @@ public class CallBackContorll {
if (!pid.equals(appidq)) {
return map;
}
try {
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
......@@ -206,20 +189,21 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString());
String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString());
if (!value.equals(sign)) {
return map;
throw new CustomException("保全增员申请回调验签失败");
}
Map paramsMap = Maps.newHashMap();
paramsMap.put("pid", pid);
paramsMap.put("timestamp", timestamp);
paramsMap.put("sign", sign);
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
log.info("callBack=====" + sb.toString());
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));
InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, list.get(0).getPolicyNo()));
if (callBack.getStatus().equals("1")) {
list.forEach(i -> {
i.setInsureStatus(1);
i.setStatus("1");
i.updateById();
YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
});
......@@ -232,20 +216,17 @@ public class CallBackContorll {
YgglMainEmp.builder().isInsure(0).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
});
}
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.setStatus("1");
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")
.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++) {
......@@ -254,37 +235,56 @@ public class CallBackContorll {
} 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(insureLog.getPolicyId()).build().insert();
.returnCode(callBack.getStatus()).returnMsg(errorMsg).policyId(insurePolicy.getId()).build().insert();
}
/*无论此次申请成功还是失败这笔单都需要重新申报*/
insurePolicy.setUpdateTime(new Date());
insurePolicy.setStatus("1");
insurePolicy.updateById();
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("保全增员申请回调异常");
} finally {
Map trueMap = Maps.newHashMap();
trueMap.put("status", "1");
return trueMap;
}
}
@GetMapping(value = "/payStatus")
@ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态")
private ModelAndView callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException {
log.info("支付完成回调(仅代表用户点了已支付,无法确认是否真正支付)");
InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById();
InsurePay insurePay = InsurePay.builder().id(insurePolicy.getPayId()).build().selectById();
insurePay.setPayTime(new Date());
insurePay.updateById();
InsureLog.builder().type(7).createTime(new Date()).requestType(2).requestPath(base_api_url + "/payStatus?policyId=" + policyId)
.returnCode("suc").returnMsg("用户已支付"+insurePay.getAmount()+"元,等待更新保单状态").policyId(policyId).build().insert();
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();
ModelAndView mav = new ModelAndView();
mav.setViewName("redirect:"+payPage+"/#/payPage");
mav.setViewName("redirect:" + payPage + "/#/payPage?amount="+insurePay.getAmount());
return mav;
}
@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 {
log.info("支付回调");
Map map = Maps.newHashMap();
try {
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
......@@ -292,14 +292,10 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(appid + secret + timestamp + sb.toString());
String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString());
if (!value.equals(sign)) {
return map;
throw new CustomException("投保支付收银台回调验签失败");
}
Map paramsMap = Maps.newHashMap();
paramsMap.put("pid", pid);
paramsMap.put("timestamp", timestamp);
paramsMap.put("sign", sign);
PayCallBack callBack = JSONObject.parseObject(sb.toString(), PayCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
insurePay.setAmount(Double.valueOf(callBack.getAmount()));
......@@ -308,39 +304,43 @@ public class CallBackContorll {
insurePay.setSerialNumber(callBack.getSerial_number());
insurePay.setPayType(callBack.getPay_type());
insurePay.updateById();
InsureLog.builder().type(7).createTime(new Date()).requestType(1).requestPath(base_api_url + "/callBack/policy/payCallBack")
.returnCode("suc").returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + callBack.getAmount()).policyId(insurePay.getPolicyId()).build().insert();
/*调用出单接口更新保单状态*/
Map paramsMap = Maps.newHashMap();
paramsMap.put("pid", pid);
paramsMap.put("timestamp", timestamp);
paramsMap.put("sign", sign);
Map bodyMap = Maps.newHashMap();
bodyMap.put("quotation_id", callBack.getSerial_number());
String data = HttpUtils.sendPost(getPolicyUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap);
String data = HttpUtils.sendPost(getPolicyUrl, InsureContorll.setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap);
Map dataMap = JSONObject.parseObject(data, Map.class);
if (dataMap.size() > 0) {
if (dataMap.get("errcode").toString().equals("e25")) {
if (dataMap.get("errcode").toString().equals("suc") || dataMap.get("errcode").toString().equals("e25")) {
//TODO 如果是E25则将保单设为出单中,更新交由保单出单回调做,设为出单状态是因为之后可以手动校验
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
insurePolicy.setStatus("2");
insurePolicy.setUpdateTime(new Date());
insurePolicy.updateById();
InsureLog.builder().type(7).createTime(new Date()).requestType(1).requestPath(base_api_url + "/payCallBack")
.returnCode("suc").returnMsg(dataMap.get("errmsg").toString()).build().insert();
} else if (dataMap.get("errcode").toString().equals("suc")) {
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)
}
InsureLog.builder().requestParam(JSONObject.toJSONString(InsureContorll.setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(7)
.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();
}
}
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("投保支付收银台回调异常");
} finally {
Map map = Maps.newHashMap();
map.put("status", "1");
return map;
}
}
@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 {
log.info("保单出单回调");
Map map = Maps.newHashMap();
map.put("status", "1");
try {
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
......@@ -348,9 +348,9 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(appid + secret + timestamp + sb.toString());
String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString());
if (!value.equals(sign)) {
return map;
throw new CustomException("保单出单回调验签失败");
}
PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
......@@ -382,6 +382,45 @@ public class CallBackContorll {
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;
}
}
@PostMapping(value = "/batchPayCallback")
@ApiOperation(value = "增员支付回调-保司接口没启用", httpMethod = "POST", notes = "增员支付回调")
private Map batchPayCallback(HttpServletRequest request) throws IOException {
try {
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
byte[] b = new byte[4096];
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
BatchPayCallBack callBack = JSONObject.parseObject(sb.toString(), BatchPayCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getOrder_import_uuid()));
if (insurePay != null) {
insurePay.setPayStatus(Integer.parseInt(callBack.getPay_status()));
insurePay.setAmount(Double.parseDouble(callBack.getPay_money()));
insurePay.setPayType(callBack.getMethod());
insurePay.updateById();
}
InsureLog.builder().type(7).createTime(new Date()).requestType(1).returnBody(sb.toString()).requestPath(base_api_url + "/callBack/policy/batchPayCallback")
.returnCode(callBack.getPay_status()).policyId(insurePay.getPolicyId()).returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + insurePay.getAmount()).build().insert();
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("增员支付回调异常");
} finally {
Map map = Maps.newHashMap();
map.put("status", "1");
return map;
}
}
}
......@@ -9,6 +9,7 @@ import cn.timer.api.bean.insure.InsureApplicant;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.config.annotation.CurrentUser;
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.dto.insure.InsureDto;
import cn.timer.api.utils.HttpUtils;
......@@ -49,32 +50,42 @@ public class InsureApplicantController {
@PostMapping("/insureApplicationSetting")
@ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请")
private Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,params.getOrgCode()));
try {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, params.getOrgCode()));
params.setId(insureApplicant.getId());
params.updateById();
return ResultUtil.data(params);
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("设置投保人异常");
}
}
@GetMapping("/getApplicantAdmin")
@ApiOperation(value = "获取投保人--运营后台", httpMethod = "GET", notes = "获取投保人")
private Result<Object> getApplicant(@RequestParam("orgCode") Integer orgCode) {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,orgCode));
if(insureApplicant==null){
QyzxEntInfoM qyzxEntInfoM=QyzxEntInfoM.builder().id(orgCode).build().selectById();
try {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, orgCode));
if (insureApplicant == null) {
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(orgCode).build().selectById();
insureApplicant = getInsureApplicant(qyzxEntInfoM);
insureApplicant.setOrgCode(orgCode);
insureApplicant.insert();
}
return ResultUtil.data(insureApplicant);
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("获取投保人异常");
}
}
private InsureApplicant getInsureApplicant(QyzxEntInfoM qyzxEntInfoM) {
InsureApplicant insureApplicant;
insureApplicant=new InsureApplicant();
insureApplicant = new InsureApplicant();
insureApplicant.setApplicantEName(qyzxEntInfoM.getName());
insureApplicant.setApplicantEAddress(qyzxEntInfoM.getWorkAddress());
insureApplicant.setApplicantEContacts(qyzxEntInfoM.getOperName());/*这里为避免联系人为空,默认使用法人*/
insureApplicant.setApplicantEContacts(qyzxEntInfoM.getLinkMan());
insureApplicant.setApplicantEPhone(qyzxEntInfoM.getPhone());/*这里为避免联系人为空,默认使用法人*/
insureApplicant.setApplicantType("2");
insureApplicant.setApplicantENoType("3646");
......@@ -86,14 +97,19 @@ public class InsureApplicantController {
@GetMapping("/getApplicant")
@ApiOperation(value = "获取投保人--8小时", httpMethod = "GET", notes = "获取投保人")
private Result<Object> getApplicant(@CurrentUser UserBean userBean) {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,userBean.getOrgCode()));
if(insureApplicant==null){
QyzxEntInfoM qyzxEntInfoM=QyzxEntInfoM.builder().id(userBean.getOrgCode()).build().selectById();
try {
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, userBean.getOrgCode()));
if (insureApplicant == null) {
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(userBean.getOrgCode()).build().selectById();
insureApplicant = getInsureApplicant(qyzxEntInfoM);
insureApplicant.setOrgCode(userBean.getOrgCode());
insureApplicant.insert();
}
return ResultUtil.data(insureApplicant);
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("获取投保人异常");
}
}
}
......@@ -114,6 +114,7 @@ public class InsureUserController{
policyDto.setCategoryId(categoryId);
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"};
/*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;
import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser;
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.InsureUserMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
......@@ -36,10 +37,12 @@ public class InsureTaskTiming {
private YgglMainEmpMapper ygglMainEmpMapper;
@Scheduled(cron = "0 0 0 1 * ?")//每月第一天
public void updateInsureStatusTask() throws ParseException {
public void updateInsureStatusTask(){
try {
Date now = DateUtil.date();
/*获取正常的保单*/
List<InsurePolicy> insurePolicyList = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus, "1").lt(InsurePolicy::getPolicyDateEnd,now));
List<InsurePolicy> insurePolicyList = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus, "1").lt(InsurePolicy::getPolicyDateEnd, now));
if (insurePolicyList.size() > 0) {
/*获取已经过期保单*/
for (InsurePolicy insurePolicy : insurePolicyList) {
......@@ -48,14 +51,20 @@ public class InsureTaskTiming {
.eq(InsureUser::getInsureStatus, 1));
if (insureUsersList.size() > 0) {
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));
log.info("总共更新投保人投保状态", uCount);
log.info("总共更新投保人投保状态:"+uCount);
}
insurePolicy.setStatus("3");
insurePolicy.updateById();
InsureLog.builder().type(7)
.createTime(new Date()).requestType(1).returnMsg("保单已到期,自动失效").policyId(insurePolicy.getId()).build().insert();
}
}
log.error("暂无过期保单");
}catch (Exception e){
e.printStackTrace();
throw new CustomException("保单失效定时器异常");
}
}
}
......@@ -46,4 +46,5 @@ public class PolicyDto {
private Integer applyType;
private String monthD;
private String userName;
private String companyName;
}
......@@ -268,6 +268,9 @@
<if test="policy.policyDateStart!=null and policy.policyDateStart!=''">
and ip.policy_date_start <![CDATA[ >= ]]> #{policy.policyDateStart}
</if>
<if test="policy.companyName!=null and policy.companyName!=''">
and qy.name like CONCAT('%',#{policy.companyName},'%')
</if>
</where>
GROUP BY ip.id
order by ip.create_time desc
......@@ -319,17 +322,17 @@
<select id="policyTotalList" resultType="cn.timer.api.dto.insure.PolicyDto">
SELECT
ip.id as id,
ip.name AS schemeName,
ip.id AS id,
ip.NAME AS schemeName,
ip.type AS type,
count(ipp.id) AS totaPolicy,
count(ipp.org_code) AS totalCompany,
(select count(id) from insure_policy WHERE product_id=ip.id ) AS totaPolicy,
(select count(org_code) from insure_policy WHERE product_id=ip.id) as totalCompany,
count( iu.id ) AS totalUser,
sum(iu.price) as totalPremium,
sum( iu.price ) AS totalPremium,
ipp.update_time AS updateTime
FROM
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
WHERE
ip.is_del = 0
......
......@@ -237,6 +237,17 @@
<select id="companyAdminCount" resultType="java.lang.Integer">
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 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