Commit 02fe0d79 by 陶湘宇

Merge branch 'develop' of develop-gitlab.youlingrc.com:8timerv2/8timerapiv200 into develop

* 'develop' of develop-gitlab.youlingrc.com:8timerv2/8timerapiv200:
  8小时后台-- 导入保单时,产品id对应返回 添加失败回滚事务
  8小时后台-- 导入保单时,产品id对应返回
  8小时后台-- 保单列表模糊查询、分页
  8小时后台-- 保单列表模糊查询、分页
  8小时后台-- 异常输出记录到日志
  8小时运营后台-- 投保人信息验证 企业列表信息验证 导入信息验证 导入人员信息验证 保单搜索列表更据企业名称查找
  修改空指针BUG
  8小时后台-- 更新配置文件路径
  8小时后台-- 更新配置文件路径
  8小时后台-- 更新配置文件路径
  8小时后台-- 更新的sql
  8小时后台-- 更新查询条件
  8小时后台-- 保单列表按操作时间倒序
  8小时运营后台-- 支付完成页面
  8小时后台-- 快速替换不显示bug
  8小时后台-- 支付完成跳转页面
  8小时后台-- 微信支付路径跳转bug
  8小时后台-- 新增一个保单列表
  8小时后台-- 正式环境的地址
  8小时后台-- 保单增员支付
parents ca8fc9f9 91d0e935
......@@ -197,3 +197,4 @@ ALTER TABLE `insure_product`
ALTER TABLE `insure_policy`
ADD COLUMN `policy_pay_type` int(11) NOT NULL DEFAULT 1 COMMENT '1在线支付 2预付款 3线下支付' AFTER `create_time`,
ADD COLUMN `pay_id` int(11) NULL DEFAULT NULL COMMENT 'insure_pay表的id' AFTER `policy_pay_type`;
This source diff could not be displayed because it is too large. You can view the blob instead.
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";
}
}
......@@ -73,6 +73,8 @@ public class InsurePay extends Model<InsurePay> {
private String serialNumber;
private String payUrl;
/**
* 设置:id
*/
......
......@@ -58,5 +58,5 @@ public class AttendanceAssistant implements Serializable{
int restdayclock;//休息日打卡
String PagetransferDate;//页面传输修改日期
String transferDate;//页面传输修改日期
}
......@@ -40,6 +40,8 @@ public class WebSecurityConfig implements WebMvcConfigurer {
.excludePathPatterns("/callBack/policy/payStatus")
.excludePathPatterns("/callBack/policy/payCallBack")
.excludePathPatterns("/callBack/policy/issueCallback")
.excludePathPatterns("/callBack/policy/addpPayCallBack")
.excludePathPatterns("/callBack/policy/batchPayCallback")
.excludePathPatterns("/superLogin/**")
.excludePathPatterns("/actuator/*")
.excludePathPatterns("/doc*")
......
......@@ -2,7 +2,9 @@ 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;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
......@@ -10,12 +12,14 @@ import com.google.common.collect.Maps;
import com.mysql.cj.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
......@@ -52,31 +56,17 @@ public class CallBackContorll {
@Value("${BASE_API_URL}")
private String base_api_url;
/*保全支付*/
@Value("${insure.batchToPayUrl}")
private String batchToPayUrl;
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;
}
/*支付回调*/
@Value("${pay_page}")
private String payPage;
@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");
......@@ -103,9 +93,87 @@ public class CallBackContorll {
return trueMap;
}
@PostMapping(value = "/addpPayCallBack")
@ApiOperation(value = "11.增员核保回调", httpMethod = "POST", notes = "增员核保回调")
@Transactional(rollbackFor = Exception.class)
public Map addpPayCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
/*核保*/
/*如果是在线支付的话*/
Map map = Maps.newHashMap();
map.put("status", "error");
if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) {
return map;
}
if (!pid.equals(appidq)) {
return map;
}
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));
}
String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString());
if (!value.equals(sign)) {
throw new CustomException("增员核保回调验签失败");
}
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
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 (insureUserList.size() > 0) {
insurePolicy.setStatus("4");/*设置为支付状态*/
insurePolicy.setUpdateTime(new Date());
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());
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() + ',');
}
} 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();
}
}
} catch (Exception e) {
log.error("增员核保回调异常:",e);
throw new CustomException("增员核保回调异常");
} finally {
Map trueMap = Maps.newHashMap();
trueMap.put("status", "1");
return trueMap;
}
}
@PostMapping(value = "/CallBack")
@ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调")
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)) {
......@@ -114,6 +182,7 @@ public class CallBackContorll {
if (!pid.equals(appidq)) {
return map;
}
try {
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
......@@ -121,26 +190,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);
/*1保全复核回调*/
if (callBack.getCallback_type().equals("1")) {
/*核保*/
} else {
/*到这就已经支付成功出单了*/
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()));
});
......@@ -153,19 +217,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.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++) {
......@@ -174,32 +236,58 @@ 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) {
log.error("保全增员申请回调异常:",e);
throw new CustomException("保全增员申请回调异常");
} finally {
Map trueMap = Maps.newHashMap();
trueMap.put("status", "1");
return trueMap;
}
}
@GetMapping(value = "/payStatus")
@ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态")
private void callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException {
log.info("支付完成回调(仅代表用户点了已支付,无法确认是否真正支付)");
InsureLog.builder().type(7).createTime(new Date()).requestType(2).requestPath(base_api_url + "/payStatus?policyId=" + policyId)
.returnCode("suc").returnMsg("用户已支付,等待更新保单状态").policyId(policyId).build().insert();
@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());
insurePay.updateById();
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?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();
@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();
StringBuilder sb = new StringBuilder();
......@@ -207,14 +295,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()));
......@@ -223,39 +307,44 @@ 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) {
log.error("投保支付收银台回调异常:",e);
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");
@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();
StringBuilder sb = new StringBuilder();
......@@ -263,9 +352,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()));
......@@ -292,11 +381,51 @@ public class CallBackContorll {
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) {
log.error("保单出单回调:",e);
throw new CustomException("保单出单回调");
} finally {
Map map = Maps.newHashMap();
map.put("status", "1");
return map;
}
}
@PostMapping(value = "/batchPayCallback")
@ApiOperation(value = "增员支付回调-保司接口没启用", httpMethod = "POST", notes = "增员支付回调")
@Transactional(rollbackFor = Exception.class)
public 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) {
log.error("增员支付回调异常:",e);
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;
......@@ -45,36 +46,49 @@ import org.springframework.web.multipart.MultipartFile;
@Transactional
@RequestMapping(value = "/insureApplicant", produces = {"application/json"})
public class InsureApplicantController {
private static final Logger log = LoggerFactory.getLogger(InsureApplicantController.class);
@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()));
@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());
params.updateById();
return ResultUtil.data(params);
} catch (Exception e) {
log.error("设置投保人异常:",e);
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();
@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) {
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(orgCode).build().selectById();
insureApplicant = getInsureApplicant(qyzxEntInfoM);
insureApplicant.setOrgCode(orgCode);
insureApplicant.insert();
}
return ResultUtil.data(insureApplicant);
} catch (Exception e) {
log.error("获取投保人异常:",e);
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");
......@@ -85,15 +99,21 @@ 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();
@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) {
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) {
log.error("获取投保人异常:",e);
throw new CustomException("获取投保人异常");
}
}
}
......@@ -6,6 +6,8 @@ import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enums.Regular;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.controller.insure.enums.PlanEnum;
import cn.timer.api.dao.insure.InsureLogMapper;
import cn.timer.api.dao.insure.InsurePolicyMapper;
......@@ -18,12 +20,12 @@ import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.dto.spmk.User;
import cn.timer.api.utils.*;
import com.alibaba.druid.util.Base64;
import com.aliyun.oss.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.beust.jcommander.internal.Lists;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import com.google.gson.JsonObject;
import com.mysql.cj.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
......@@ -44,6 +46,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.lang.reflect.Field;
import java.net.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -124,14 +127,13 @@ public class InsureContorll {
private InsurePolicyMapper insurePolicyMapper;
/**
* 设置请求参数
*
* @param sign
* @return
*/
private Map setParams(String sign, String appid, String secret) {
protected static Map setParams(String sign, String appid, String secret) {
/*当前时间戳*/
long timestamp = System.currentTimeMillis() / 1000;
log.info("时间戳" + timestamp);
......@@ -154,12 +156,17 @@ public class InsureContorll {
@PostMapping(value = "/insured_add")
@ApiOperation(value = "1.投保申请", httpMethod = "POST", notes = "投保申请")
public Result<Object> insured_add(@RequestBody InsureDto insureDto) throws ParseException, URISyntaxException {
@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("产品不存在");
}
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(Integer.parseInt(insureDto.getOrgCode())).build().selectById(); // 企业信息
if (qyzxEntInfoM == null) {
return ResultUtil.error("企业不存在");
}
try {
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
LocalDateTime now = LocalDateTime.now();
Date date = Date.from(now.atZone(ZoneId.systemDefault()).toInstant());
......@@ -168,6 +175,9 @@ public class InsureContorll {
bodyMap.put("is_ss", 0);
bodyMap.put("quotations_method", "1");
Map quotations = Maps.newHashMap();
if (insureDto.getPlans().size() <= 0) {
return ResultUtil.error("请选择计划和职业类别");
}
insureDto.getPlans().forEach(i -> {
i.setPrice(getPrice(i.getBenefitBasicPlan(), i.getBenefitOccupationCategory()));
insureDto.setTotalPrice(i.getPrice() * i.getUserIds().length + (insureDto.getTotalPrice() == null ? 0 : insureDto.getTotalPrice()));
......@@ -185,7 +195,7 @@ public class InsureContorll {
quotations.put("operator_name", "");//*币种:5人民币
if (insureProduct.getPayType() == 1) {
quotations.put("required_pay", 1);
quotations.put("callback_policy",base_api_url+"/callBack/policy/issueCallback");
quotations.put("callback_policy", base_api_url + "/callBack/policy/issueCallback");
}
/*企业信息*/
......@@ -194,6 +204,10 @@ public class InsureContorll {
return ResultUtil.error("未设置投保人");
}
Map companyApplicantMap = Maps.newHashMap();
if (!insureApplicant.checkValiad().equals("true")) {
return ResultUtil.error(insureApplicant.checkValiad());
}
/*必要字段,空值影响到投保的成功*/
companyApplicantMap.put("applicant_e_name", insureApplicant.getApplicantEName());/*企业/网点名称*/
companyApplicantMap.put("applicant_e_address", insureApplicant.getApplicantEAddress());/*企业/网点地址*/
companyApplicantMap.put("applicant_e_contacts", insureApplicant.getApplicantEContacts());/*企业授权操作人姓名*/
......@@ -202,6 +216,16 @@ public class InsureContorll {
companyApplicantMap.put("applicant_e_no", insureApplicant.getApplicantENo());/*企业证件号码*/
companyApplicantMap.put("applicant_e_mail", insureApplicant.getApplicantEMail());/*企业邮箱*/
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());
/*人员清单填被保人员*/
String url = creaXSSFWorkbook(insureDto.getPlans(), insureDto.getPolicyDateStart());
if (!StringUtil.isNotBlank(url)) {
......@@ -240,11 +264,11 @@ 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", qyzxEntInfoM.getName());
insured.put("insured_name", StringUtils.isNullOrEmpty(qyzxEntInfoM.getAttestName()) ? qyzxEntInfoM.getName() : qyzxEntInfoM.getAttestName());
insured.put("insured_no_type", "3306");
insured.put("insured_no", 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_basic_plan", p.getBenefitBasicPlan());
insured.put("benefit_occupation_category", p.getBenefitOccupationCategory());
insured.put("benefit_EL_employee_number_t", p.getUserIds().length);
insuredArray.add(insured);
......@@ -269,7 +293,7 @@ public class InsureContorll {
insurePolicy.setType(2);/*年单或者月单*/
insurePolicy.setCurrency("5");
if (dataMap.get("errcode").toString().equals("suc")) {
if(insureProduct.getPayType()!=1) {
if (insureProduct.getPayType() != 1) {
Object o = dataMap.get("data");
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
policyMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("policy")), Map.class);
......@@ -278,7 +302,7 @@ public class InsureContorll {
insurePolicy.setPolicyFile(policyMap.get("policy_file").toString());
insurePolicy.setKitUrl(policyMap.get("kit_url").toString());
insurePolicy.setStatus("1");
}else{
} else {
insurePolicy.setStatus("4");
}
} else {
......@@ -305,12 +329,12 @@ public class InsureContorll {
insureUser.setTransId("P_" + qyzxEntInfoM.getId() + "_" + dtf2.format(now));
insureUser.setPremium(String.valueOf(insureDto.getTotalPrice()));
if (dataMap.get("errcode").toString().equals("suc")) {
if(insureProduct.getPayType()!=1) {
if (insureProduct.getPayType() != 1) {
insureUser.setBatchNo(batchMap.get(0).get("batch_no").toString());
insureUser.setPolicyNo(policyMap.get("policy_no").toString());
insureUser.setInsureStatus(1);
insureUser.setStatus("1");
}else{
} else {
insureUser.setInsureStatus(3);
insureUser.setStatus("2");
}
......@@ -340,7 +364,7 @@ public class InsureContorll {
}
}
/*进入在线支付*/
if (insureProduct.getPayType()==1) {
if (insureProduct.getPayType() == 1) {
Object o = dataMap.get("data");
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
List<Map> quotationsMap = JSONObject.parseObject(JSONObject.toJSONString(map.get("quotations")), List.class);
......@@ -348,7 +372,7 @@ public class InsureContorll {
/*请求收银台*/
Map<String, String> toPayParamsMap = setParams(null, appid, secret);
toPayParamsMap.put("serial_number", quotationsMap.get(0).get("serial_number").toString());
toPayParamsMap.put("jump_url", base_api_url +"/callBack/policy/payStatus?policyId="+insurePolicy.getId());
toPayParamsMap.put("jump_url", base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId());
toPayParamsMap.put("pay_type", "1");
toPayParamsMap.put("notify_url", base_api_url + "/callBack/policy/payCallBack");
/*生成一个支付链接返回到前台*/
......@@ -358,14 +382,14 @@ public class InsureContorll {
builder.addParameter(key, toPayParamsMap.get(key));
}
}
InsurePay insurePay= InsurePay.builder().payStatus(1).
InsurePay insurePay = InsurePay.builder().payStatus(1).
serialNumber(quotationsMap.get(0).get("serial_number").toString()).policyId(insurePolicy.getId()).build();
insurePay.insert();
insurePolicy.setPayId(insurePay.getId());
insurePolicy.updateById();
Map returnMap = Maps.newHashMap();
returnMap.put("url",builder.build());
returnMap.put("id",insurePay.getId());
returnMap.put("url", builder.build());
returnMap.put("id", insurePay.getId());
return ResultUtil.data(returnMap);
}
}
......@@ -373,110 +397,24 @@ public class InsureContorll {
}
return ResultUtil.error(dataMap.get("errmsg").toString());
}
return ResultUtil.error("网络异常");
return ResultUtil.error("投保错误");
} catch (Exception e) {
log.error("投保异常:", e);
throw new CustomException("投保异常");
}
/**
* 生成投保文件
*
* @param ids
* @return
*/
public String creaXSSFWorkbook(List<PlansDto> plansList, String createDate) {
if (plansList.size() <= 0) {
return "error";
}
LocalDate localDate = LocalDate.now();
Date date = new Date();
List list = Lists.newArrayList();
plansList.forEach(p -> {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(p.getUserIds());
for (YgglMainEmp y : ygglMainEmpList) {
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), PlanEnum.getEnum(p.getBenefitBasicPlan(), p.getBenefitOccupationCategory()).getName(), createDate, "", StringUtils.isNullOrEmpty(p.getTricycleFrameNumber()) ? "无" : p.getTricycleFrameNumber(), PlanEnum.getEnum(p.getBenefitBasicPlan(), p.getBenefitOccupationCategory()).getType()};
list.add(arr);
}
});
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(localDate + "_投保" + list.size() + "名人员清单.xlsx", rowName, list);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
String url = "";
try {
xssfWorkbook.write(byteArrayOutputStream);
byte[] bytes = byteArrayOutputStream.toByteArray();
String fileBase64 = Base64.byteArrayToBase64(bytes);
/*body参数 begin*/
Map bodyMap = Maps.newHashMap();
bodyMap.put("app", "mall");
bodyMap.put("name", localDate + "_" + list.size() + "名人员清单.xlsx");
bodyMap.put("file", fileBase64);
/*end*/
String data = HttpUtils.sendPost(uploadUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(data);
/*创建日志*/
if (dataMap.get("errcode").toString().equals("suc")) {
Object o = dataMap.get("data");
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
url = map.get("url").toString();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(4)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
xssfWorkbook.close();
byteArrayOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return url;
}
@PostMapping(value = "/policyListAdmin")
@ApiOperation(value = "4.保单列表--运营后台端", httpMethod = "POST", notes = "保单列表--运营后台端")
public Result<Object> policyListAdmin(@RequestBody PolicyDto policyDto) {
Map map = Maps.newHashMap();
List<PolicyDto> list = insurePolicyMapper.policyList(policyDto);
map.put("list", list);
map.put("total", insurePolicyMapper.totalPolicy(policyDto));
return ResultUtil.data(map);
}
@GetMapping(value = "/policyDetail")
@ApiOperation(value = "5.保单信息", httpMethod = "GET", notes = "保单信息")
public Result<Object> policyDetail(@RequestParam("policyId") Integer policyId) {
// Map map = Maps.newHashMap();
PolicyDto policyDto = insurePolicyMapper.getPolicyDetail(policyId);
/*获取可选计划*/
// List<InsureUser> plansList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getApplyType,2).eq(InsureUser::getPolicyId,policyId).groupBy(InsureUser::getBenefitBasicPlan));
/*获取可选类型*/
// List<InsureUser> categoryList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getApplyType,2).eq(InsureUser::getPolicyId,policyId).groupBy(InsureUser::getBenefitOccupationCategory));
if (policyDto == null) {
return ResultUtil.error("保单不存在");
}
// map.put("policy",policyDto);
// map.put("plans",plansList.stream().map(InsureUser::getBenefitBasicPlan).toArray());
// map.put("category",categoryList.stream().map(InsureUser::getBenefitOccupationCategory).toArray());
return ResultUtil.data(policyDto);
}
@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();
if (insurePolicy == null) {
return ResultUtil.error("保单不存在");
}
try {
LocalDateTime now = LocalDateTime.now();
String url = creaXSSFWorkbook1(insureDto);
log.info("保全增员文件地址", url);
......@@ -489,6 +427,9 @@ public class InsureContorll {
bodyMap.put("from_source", "API");
bodyMap.put("import_review_callback", "");
bodyMap.put("import_callback", base_api_url + "/callBack/policy/CallBack");
if (insureProduct.getPayType() == 1) {
bodyMap.put("import_review_callback", base_api_url + "/callBack/policy/addpPayCallBack");
}
bodyMap.put("third_uuid", "IS_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now));
String responData = HttpUtils.sendPost(batchUrl, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(responData);
......@@ -528,7 +469,8 @@ public class InsureContorll {
.createTime(new Date())
.insureStatus(3).policyId(insurePolicy.getId()).build().insert();
} catch (ParseException e) {
e.printStackTrace();
log.info("增员异常:policyDateStart:" + insureDto.getPolicyDateStart() + "policyDateEnd:" + insureDto.getPolicyDateEnd());
throw new CustomException("增员异常");
}
y.setIsInsure(1);
y.insertOrUpdate();
......@@ -536,147 +478,68 @@ public class InsureContorll {
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(2)
.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()).fileUrl(url).build().insert();
/*如果是在线支付的话*/
InsureProduct insureProduct = InsureProduct.builder().id(insurePolicy.getProductId()).build().selectById();
if(insureProduct.getPayType()==1){
log.info("当前订单为见费出单---进入支付页面");
Map payMap = Maps.newHashMap();
payMap.put("order_import_uuid",orderImportInfo.get("uuid"));
String returnPay = HttpUtils.sendPost(batchToPayUrl, setParams(JSONObject.toJSONString(payMap), appidq, secretq), payMap);
Map<String, Object> payDataMap = JSONObject.parseObject(returnPay);
Map<String, Object> payData = JSONObject.parseObject(JSONObject.toJSONString(payDataMap.get("data")));
Map<String, Object> importPayInfo = JSONObject.parseObject(JSONObject.toJSONString(payData.get("import_pay_info")));
InsurePay insurePay= InsurePay.builder()
.payStatus(Integer.parseInt(importPayInfo.get("pay_status").toString())).policyId(insurePolicy.getId())
.amount(Double.parseDouble(importPayInfo.get("pay_money").toString()))
.payType(importPayInfo.get("pay_type").toString())
.serialNumber(importPayInfo.get("order_import_uuid").toString())
.paySerialNo(importPayInfo.get("pay_serial_no").toString()).build();
insurePay.insert();
insurePolicy.setPayId(insurePay.getId());
insurePolicy.setStatus("4");/*支付中状态*/
insurePolicy.updateById();
Map returnMap = Maps.newHashMap();
returnMap.put("url",importPayInfo.get("pay_url").toString()+"&jump_url="+base_api_url +"/callBack/policy/payStatus?policyId="+insurePolicy.getId());
returnMap.put("payId",insurePay.getId());
return ResultUtil.data(returnMap);
}else {
return ResultUtil.data("核保成功,等待系统更新");
}
return ResultUtil.success("核保中,等待系统更新");
}
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(2)
.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);
throw new CustomException("增员异常");
}
/**
* 生成保全增员文件
*
* @param ids
* @return
*/
public String creaXSSFWorkbook1(InsureDto insureDto) {
if (insureDto.getUserIds().length <= 0) {
return "error";
}
LocalDate localDate = LocalDate.now();
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds());
List list = Lists.newArrayList();
for (YgglMainEmp y : ygglMainEmpList) {
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), PlanEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getName(), insureDto.getPolicyDateStart(), "", StringUtils.isNullOrEmpty(insureDto.getTricycleFrameNumber()) ? "无" : insureDto.getTricycleFrameNumber(), PlanEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getType()};
list.add(arr);
}
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(localDate + "_补充" + list.size() + "名人员清单.xlsx", rowName, list);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
String url = "";
try {
xssfWorkbook.write(byteArrayOutputStream);
byte[] bytes = byteArrayOutputStream.toByteArray();
String fileBase64 = Base64.byteArrayToBase64(bytes);
/*body参数 begin*/
Map bodyMap = Maps.newHashMap();
bodyMap.put("media", fileBase64);
/*end*/
String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(data);
if (dataMap.get("errcode").toString().equals("suc")) {
Object o = dataMap.get("data");
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
url = map.get("file_url").toString();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(5)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl2)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
} catch (IOException e) {
e.printStackTrace();
} finally {
@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 {
xssfWorkbook.close();
byteArrayOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
List<PolicyDto> list = insurePolicyMapper.policyList(policyDto);
map.put("list", list);
map.put("total", insurePolicyMapper.totalPolicy(policyDto));
return ResultUtil.data(map);
} catch (Exception e) {
log.error("获取保单列表异常:", e);
throw new CustomException("获取保单列表异常");
}
return url;
}
@GetMapping(value = "/downPolicyFile")
@ApiOperation(value = "7.下载电子保单", httpMethod = "GET", notes = "下载电子保单")
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())) {
return;
}
OutputStream sos = null;
BufferedInputStream bis = null;
try {
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment; filename=" + new String((insurePolicy.getPolicyNo() + ".pdf").getBytes("UTF8"), "ISO-8859-1"));
response.setCharacterEncoding("UTF-8");
sos = response.getOutputStream();
String destUrl = insurePolicy.getPolicyFile();
URL url = new URL(destUrl);
HttpURLConnection httpUrl = (HttpURLConnection) url.openConnection();
//连接指定的网络资源
httpUrl.connect();
//获取网络输入流
bis = new BufferedInputStream(httpUrl.getInputStream());
int b;
while ((b = bis.read()) != -1) {
sos.write(b);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
sos.close();
} catch (IOException e) {
e.printStackTrace();
}
@GetMapping(value = "/policyDetail")
@ApiOperation(value = "5.保单信息", httpMethod = "GET", notes = "保单信息")
@Transactional(rollbackFor = Exception.class)
public Result<Object> policyDetail(@RequestParam("policyId") Integer policyId) {
try {
bis.close();
} catch (IOException e) {
e.printStackTrace();
// Map map = Maps.newHashMap();
PolicyDto policyDto = insurePolicyMapper.getPolicyDetail(policyId);
/*获取可选计划*/
// List<InsureUser> plansList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getApplyType,2).eq(InsureUser::getPolicyId,policyId).groupBy(InsureUser::getBenefitBasicPlan));
/*获取可选类型*/
// List<InsureUser> categoryList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getApplyType,2).eq(InsureUser::getPolicyId,policyId).groupBy(InsureUser::getBenefitOccupationCategory));
if (policyDto == null) {
return ResultUtil.error("保单不存在");
}
// map.put("policy",policyDto);
// 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);
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) {
return ResultUtil.error("保单不存在");
}
try {
/*单个替换*/
if (insureDto.getLimit() == 1) {
if (!StringUtils.isNullOrEmpty(insureDto.getUserName()) && !StringUtils.isNullOrEmpty(insureDto.getIdCardNo())) {
......@@ -755,7 +618,7 @@ public class InsureContorll {
.createTime(new Date())
.status("1").insureStatus(3).policyId(insurePolicy.getId()).build().insert();
} catch (ParseException e) {
e.printStackTrace();
log.error("获取保单信息异常:", e);
}
y.setIsInsure(1);
y.insertOrUpdate();
......@@ -769,147 +632,68 @@ public class InsureContorll {
}
}
return ResultUtil.data("成功");
} catch (Exception e) {
log.error("保全替换异常:", e);
throw new CustomException("保全替换异常");
}
/**
* 生成保全替换文件
*
* @param ids
* @return
*/
public String creaXSSFWorkbook2(String[] ids, String date, String[] oldIds, String type, String tricycleFrameNumber) {
if (ids.length <= 0 || oldIds.length <= 0) {
return "error";
}
LocalDate localDate = LocalDate.now();
List<YgglMainEmp> newList = ygglMainEmpMapper.selectListByIds(ids);
List<YgglMainEmp> oldList = ygglMainEmpMapper.selectListByIds(oldIds);
if (newList.size() != oldList.size()) {
return "error";
}
List list = Lists.newArrayList();
for (int i = 0; i < newList.size(); i++) {
String[] arr = new String[]{String.valueOf(oldList.get(i).getId()),
oldList.get(i).getName(),
"身份证",
oldList.get(i).getZjNum(),
date.substring(0, 10),
newList.get(i).getName(),
"身份证",
newList.get(i).getZjNum(),
"", "", "", "", "", "", StringUtils.isNullOrEmpty(tricycleFrameNumber) ? "无" : tricycleFrameNumber, "1", type.equals("63119") ? "A类" : type.equals("63120") ? "B类" : "C类"};
list.add(arr);
}
String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Update_date", "replace_name", "replace_ID_type",
"replace_ID_number", "Date_of_birth", "insured_type", "insured_relationship", "cert_type_related_insured", "insured_relationship_id", "Branch",
"Tricycle_frame_number", "insured_number", "benefit_occupation_category"};
XSSFWorkbook xssfWorkbook = ExcelUtils.exportExcel(localDate + "_替换" + list.size() + "名人员清单.xlsx", rowName, list);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
String url = "";
try {
xssfWorkbook.write(byteArrayOutputStream);
byte[] bytes = byteArrayOutputStream.toByteArray();
String fileBase64 = Base64.byteArrayToBase64(bytes);
/*body参数 begin*/
Map bodyMap = Maps.newHashMap();
bodyMap.put("media", fileBase64);
/*end*/
String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(data);
if (dataMap.get("errcode").toString().equals("suc")) {
Object o = dataMap.get("data");
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
url = map.get("file_url").toString();
@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())) {
return;
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(6)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl2)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
} catch (IOException e) {
e.printStackTrace();
} finally {
OutputStream sos = null;
BufferedInputStream bis = null;
try {
xssfWorkbook.close();
byteArrayOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return url;
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment; filename=" + new String((insurePolicy.getPolicyNo() + ".pdf").getBytes("UTF8"), "ISO-8859-1"));
response.setCharacterEncoding("UTF-8");
sos = response.getOutputStream();
String destUrl = insurePolicy.getPolicyFile();
URL url = new URL(destUrl);
HttpURLConnection httpUrl = (HttpURLConnection) url.openConnection();
//连接指定的网络资源
httpUrl.connect();
//获取网络输入流
bis = new BufferedInputStream(httpUrl.getInputStream());
int b;
while ((b = bis.read()) != -1) {
sos.write(b);
}
} catch (MalformedURLException e) {
log.error("下载电子保单:", e);
/*获取基础计划的价格*/
private Integer getPrice(String plan, String type) {
/*
基础计划
30万雇主/3万医疗 36968,
50万雇主/5万医疗 36969,
80万雇主/10万医疗 36970,
80万雇主/20万医疗 36971,
100万雇主/10万医疗 36972
*/
/*行业类型
* A类 63119
* B类 63120
* C类 63121\
* */
switch (plan) {
case "36968":
if (type.equals("63119")) {
return PlanEnum.A_30.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_30.getPrice();
}
break;
case "36969":
if (type.equals("63119")) {
return PlanEnum.A_50.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_50.getPrice();
} else if (type.equals("63121")) {
return PlanEnum.C_50.getPrice();
}
break;
case "36970":
if (type.equals("63119")) {
return PlanEnum.A_80.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_80.getPrice();
} else if (type.equals("63121")) {
return PlanEnum.C_80.getPrice();
}
break;
case "36971":
if (type.equals("63119")) {
return PlanEnum.A_80_20.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_80_20.getPrice();
} catch (IOException e) {
log.error("下载电子保单:", e);
} finally {
try {
sos.close();
} catch (IOException e) {
log.error("下载电子保单:", e);
}
break;
case "36972":
if (type.equals("63119")) {
return PlanEnum.A_100.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_100.getPrice();
try {
bis.close();
} catch (IOException e) {
log.error("下载电子保单:", e);
}
break;
}
return 0;
}
@PostMapping(value = "/policyTotal")
@ApiOperation(value = "11.保单统计列表", httpMethod = "POST", notes = "保单统计列表")
@ApiOperation(value = "8.保单统计列表", httpMethod = "POST", notes = "保单统计列表")
@Transactional(rollbackFor = Exception.class)
public Result<Object> policyTotal() {
List<PolicyDto> list = insurePolicyMapper.policyTotalList();
return ResultUtil.data(list);
}
@GetMapping(value = "/isInsured")
@ApiOperation(value = "10.企业是否已投保", httpMethod = "POST", notes = "企业是否已投保")
@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) {
......@@ -919,8 +703,10 @@ public class InsureContorll {
}
@GetMapping(value = "/verification")
@ApiOperation(value = "一键校验", httpMethod = "POST", notes = "一键校验")
@ApiOperation(value = "10.一键校验", httpMethod = "POST", notes = "一键校验")
@Transactional(rollbackFor = Exception.class)
public Result<Object> verification() {
try {
/*校验投保*/
List<InsurePolicy> insurePolicies = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus, 2));
insurePolicies.forEach(i -> {
......@@ -960,21 +746,28 @@ public class InsureContorll {
/*校验人员*/
return ResultUtil.success();
} catch (Exception e) {
log.error("一键校验异常:", e);
throw new CustomException("一键校验异常");
}
}
@PostMapping(value = "/policyTotalList")
@ApiOperation(value = "11.保单统计列表 -- 8小时端", httpMethod = "POST", notes = "保单统计列表")
public Result<Object> policyTotal(@CurrentUser UserBean userBean) {
@Transactional(rollbackFor = Exception.class)
public Result<Object> policyTotal(@CurrentUser UserBean userBean, @RequestBody PolicyDto policyDto) {
Map map = Maps.newHashMap();
List<InsureUserDto> list = insurePolicyMapper.selectPlansListByorgCode(userBean.getOrgCode());
List<InsureUserDto> list = insurePolicyMapper.selectPolicyListByorgCode(userBean.getOrgCode(), policyDto);
map.put("list", list);
map.put("total", insurePolicyMapper.selectPolicyTotalByorgCode(userBean.getOrgCode(), policyDto));
return ResultUtil.data(map);
}
@PostMapping(value = "/importUser")
@ApiOperation(value = "导入用户--运营后台", httpMethod = "POST", notes = "导入用户")
@ApiOperation(value = "12.导入用户--运营后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class)
public Result<Object> importUser(@RequestParam("orgCode") String orgCode, @RequestParam("file") MultipartFile file) {
SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd");
QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(orgCode)).build().selectById();
......@@ -1031,7 +824,8 @@ public class InsureContorll {
try {
y.setBirthday(dtf.parse(idNo.substring(6, 14)));
} catch (ParseException e) {
e.printStackTrace();
log.error("一键校验异常:", e);
throw new CustomException("一键校验异常");
}
y.setZjNum(idNo);
break;
......@@ -1066,7 +860,8 @@ public class InsureContorll {
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, orgCode));
} catch (IOException e) {
e.printStackTrace();
log.error("一键校验异常:", e);
throw new CustomException("一键校验异常");
}
List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList());
if (message.size() > 0) {
......@@ -1076,7 +871,8 @@ public class InsureContorll {
}
@PostMapping(value = "/importUserClient")
@ApiOperation(value = "导入用户--8小时后台", httpMethod = "POST", notes = "导入用户")
@ApiOperation(value = "13.导入用户--8小时后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class)
public Result<Object> importUserClient(@CurrentUser UserBean userBean, @RequestParam("file") MultipartFile file) {
SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd");
QyzxEntInfoM company = QyzxEntInfoM.builder().id(Integer.valueOf(userBean.getOrgCode())).build().selectById();
......@@ -1133,7 +929,8 @@ public class InsureContorll {
try {
y.setBirthday(dtf.parse(idNo.substring(6, 14)));
} catch (ParseException e) {
e.printStackTrace();
log.error("导入用户:", e);
throw new CustomException("导入用户");
}
y.setZjNum(idNo);
break;
......@@ -1168,7 +965,8 @@ public class InsureContorll {
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, userBean.getOrgCode()));
} catch (IOException e) {
e.printStackTrace();
log.error("导入用户:", e);
throw new CustomException("导入用户");
}
List<String> message = allList.stream().filter(s -> s.getIsInsure() == 1).map(YgglMainEmp::getName).collect(Collectors.toList());
if (message.size() > 0) {
......@@ -1179,7 +977,8 @@ public class InsureContorll {
@PostMapping(value = "/importPolicy")
@ApiOperation(value = "导入保单--运营后台", httpMethod = "POST", notes = "导入用户")
@ApiOperation(value = "14.导入保单--运营后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class)
public Result<Object> importPolicy(@RequestParam("file") MultipartFile file, @RequestParam("productId") String productId) {
SimpleDateFormat dtf = new SimpleDateFormat("yyyyMMdd");
......@@ -1307,6 +1106,9 @@ 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("导入的保单产品和选择的保单产品不一致");
}
policy.setProductId(insureProduct.getId());
policy.setPolicyFile(dataMap.get("policy_file").toString());
policy.setStatus("1");
......@@ -1326,7 +1128,7 @@ public class InsureContorll {
policy.updateById();
}
if (userList.size() <= 0) {
return ResultUtil.error("导入错误,保单已存在");
throw new CustomException("导入错误,人员为空");
}
for (InsureUser insureUser : userList) {
/*根据名字,身份,所属企业获取员工*/
......@@ -1337,7 +1139,7 @@ public class InsureContorll {
if (ygglMainEmp != null) {
/*如果导入的人已经投保*/
if(ygglMainEmp.getIsInsure()==1){
if (ygglMainEmp.getIsInsure() == 1) {
continue;
}
insureUser.setInsuredMobile(ygglMainEmp.getPhone());
......@@ -1362,13 +1164,15 @@ 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) {
e.printStackTrace();
log.error("导入保单:", e);
throw new CustomException("导入保单");
}
return ResultUtil.data("成功导入");
}
@PostMapping(value = "/importUserPolicy")
@ApiOperation(value = "导入被保人员--运营后台", httpMethod = "POST", notes = "导入用户")
@ApiOperation(value = "15.导入被保人员--运营后台", httpMethod = "POST", notes = "导入用户")
@Transactional(rollbackFor = Exception.class)
public Result<Object> importUserPolicy(@RequestParam("file") MultipartFile file, @RequestParam("orgCode") Integer orgCode) {
if (file.getSize() <= 0) {
return ResultUtil.error("未上传文件");
......@@ -1380,6 +1184,7 @@ public class InsureContorll {
if (qyzxEntInfoM == null) {
return ResultUtil.error("企业不存在");
}
try {
XSSFWorkbook xw = null;
Map<String, String> map = Maps.newHashMap();
try {
......@@ -1409,6 +1214,9 @@ public class InsureContorll {
if (StringUtils.isNullOrEmpty(ExcelUtils.getString(cell))) {
return ResultUtil.error("第" + i + "行第" + index + "列被保人身份证不能为空");
}
if (!Regular.match(ExcelUtils.getString(cell), Regular.IDCARD)) {
return ResultUtil.error("第" + i + "行第" + index + "身份证格式错误");
}
user.setInsuredNo(ExcelUtils.getString(cell));
break;
case "基础计划":
......@@ -1464,25 +1272,31 @@ public class InsureContorll {
}
return ResultUtil.data(userList);
} catch (IOException e) {
e.printStackTrace();
log.error("导入被保人异常:", e);
}
return ResultUtil.error("导入失败");
} catch (Exception e) {
log.error("导入被保人异常:", e);
throw new CustomException("导入被保人异常");
}
}
@GetMapping(value = "/rePay")
@ApiOperation(value = "重新发起支付", httpMethod = "GET", notes = "重新发起支付")
public Result<Object> rePay(@RequestParam("payId")Integer payId){
@ApiOperation(value = "16.重新发起支付", httpMethod = "GET", notes = "重新发起支付")
@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 {
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
Map<String, String> toPayParamsMap=Maps.newHashMap();
Map<String, String> toPayParamsMap = Maps.newHashMap();
/*判断是投保还是保全,投保支付前是没有保单号的*/
if(StringUtils.isNullOrEmpty(insurePolicy.getPolicyNo())) {
if (StringUtils.isNullOrEmpty(insurePolicy.getPolicyNo())) {
/*投保支付*/
toPayParamsMap = setParams(null, appid, secret);
toPayParamsMap.put("serial_number", insurePay.getSerialNumber());
......@@ -1498,12 +1312,14 @@ public class InsureContorll {
builder.addParameter(key, toPayParamsMap.get(key));
}
}
InsureLog.builder().requestParam(JSONObject.toJSONString(toPayParamsMap)).type(7).createTime(new Date()).requestType(2).requestPath(toPayUrl)
.returnMsg("请求投保支付").policyId(insurePolicy.getId()).build().insert();
return ResultUtil.data(builder.build());
} catch (URISyntaxException e) {
e.printStackTrace();
log.error("请求错误:", e);
return ResultUtil.error("请求错误");
}
}else{
} else {
/*保全支付*/
toPayParamsMap = setParams(batchToPayUrl, appidq, secretq);
toPayParamsMap.put("order_import_uuid", insurePay.getSerialNumber());
......@@ -1511,27 +1327,36 @@ public class InsureContorll {
Map<String, Object> payDataMap = JSONObject.parseObject(returnPay);
Map<String, Object> payData = JSONObject.parseObject(JSONObject.toJSONString(payDataMap.get("data")));
Map<String, Object> importPayInfo = JSONObject.parseObject(JSONObject.toJSONString(payData.get("import_pay_info")));
if(!insurePay.getPaySerialNo().equals(importPayInfo.get("pay_serial_no").toString())&&!insurePay.getSerialNumber().equals(importPayInfo.get("order_import_uuid").toString())){
insurePay.setPaySerialNo(importPayInfo.get("pay_serial_no").toString());
insurePay.setSerialNumber(importPayInfo.get("order_import_uuid").toString());
insurePay.setAmount(Double.parseDouble(importPayInfo.get("pay_money").toString()));
insurePay.updateById();
InsureLog.builder().requestParam(JSONObject.toJSONString(toPayParamsMap)).returnBody(returnPay).type(7).createTime(new Date()).requestType(2).requestPath(batchToPayUrl)
.returnMsg("请求保全支付").policyId(insurePolicy.getId()).build().insert();
return ResultUtil.data(importPayInfo.get("pay_url").toString() + "&jump_url=" + base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId() + "&notify_url=" + base_api_url + "/callBack/policy/batchPayCallback");
}
return ResultUtil.data(importPayInfo.get("pay_url").toString());
} catch (Exception e) {
log.error("重新发起支付异常:", e);
throw new CustomException("重新发起支付异常");
}
// String data = HttpUtils.sendGet(setParams())
};
}
;
@GetMapping(value = "/cePay")
@ApiOperation(value = "取消支付", httpMethod = "GET", notes = "取消支付")
public Result<Object> cancelPay(@RequestParam("payId")Integer payId){
@ApiOperation(value = "17.取消支付", httpMethod = "GET", notes = "取消支付")
@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 {
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
//TODO 验证保单的状态
long timestamp = System.currentTimeMillis() / 1000;
......@@ -1542,21 +1367,21 @@ public class InsureContorll {
map.put("sign", DigestUtils.md5Hex(appidq + secretq + timestamp));
map.put("timestamp", String.valueOf(timestamp));
map.put("set_status", "2");
map.put("import_uuid",insurePay.getSerialNumber());
map.put("import_uuid", insurePay.getSerialNumber());
String data = HttpUtils.sendGet(cancelPayment, map);
if(StringUtils.isNullOrEmpty(data)){
if (StringUtils.isNullOrEmpty(data)) {
return ResultUtil.error("取消失败,请重新再来");
}
Map returnMap = JSONObject.parseObject(data, Map.class);
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(map), appid, secret))).type(7)
.requestData(JSONObject.toJSONString(map)).createTime(new Date()).requestType(2).returnBody(data).requestPath(uploadUrl)
.returnCode(returnMap.get("errcode").toString()).returnMsg(returnMap.get("errmsg").toString()).build().insert();
if (returnMap.get("errcode").equals("suc")){
if (returnMap.get("errcode").equals("suc")) {
Map dataMap = JSONObject.parseObject(JSONObject.toJSONString(returnMap.get("data")), Map.class);
if(dataMap.get("status").equals("1")){
List<InsureUser> userList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo,insurePay.getSerialNumber()));
if (dataMap.get("status").equals("1")) {
List<InsureUser> userList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, insurePay.getSerialNumber()));
/*取消成功*/
InsureUser.builder().status("2").insureStatus(2).build().update(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo,insurePay.getSerialNumber()));
InsureUser.builder().status("2").insureStatus(2).build().update(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, insurePay.getSerialNumber()));
insurePay.setPayStatus(3);
insurePay.updateById();
insurePolicy.setStatus("1");
......@@ -1570,5 +1395,234 @@ public class InsureContorll {
/*生成一个支付链接返回到前台*/
return ResultUtil.error("取消失败,请重新再来");
} catch (Exception e) {
log.error("取消支付异常:", e);
throw new CustomException("取消支付异常");
}
}
/**
* 生成投保文件
*
* @return
*/
public String creaXSSFWorkbook(List<PlansDto> plansList, String createDate) throws Exception {
if (plansList.size() <= 0) {
return "error";
}
LocalDate localDate = LocalDate.now();
Date date = new Date();
List list = Lists.newArrayList();
plansList.forEach(p -> {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(p.getUserIds());
for (YgglMainEmp y : ygglMainEmpList) {
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), PlanEnum.getEnum(p.getBenefitBasicPlan(), p.getBenefitOccupationCategory()).getName(), createDate, "", StringUtils.isNullOrEmpty(p.getTricycleFrameNumber()) ? "无" : p.getTricycleFrameNumber(), PlanEnum.getEnum(p.getBenefitBasicPlan(), p.getBenefitOccupationCategory()).getType()};
list.add(arr);
}
});
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(localDate + "_投保" + list.size() + "名人员清单.xlsx", rowName, list);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
String url = "";
xssfWorkbook.write(byteArrayOutputStream);
byte[] bytes = byteArrayOutputStream.toByteArray();
String fileBase64 = Base64.byteArrayToBase64(bytes);
/*body参数 begin*/
Map bodyMap = Maps.newHashMap();
bodyMap.put("app", "mall");
bodyMap.put("name", localDate + "_" + list.size() + "名人员清单.xlsx");
bodyMap.put("file", fileBase64);
/*end*/
String data = HttpUtils.sendPost(uploadUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(data);
/*创建日志*/
if (dataMap.get("errcode").toString().equals("suc")) {
Object o = dataMap.get("data");
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
url = map.get("url").toString();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(4)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
xssfWorkbook.close();
byteArrayOutputStream.close();
return url;
}
/**
* 生成保全增员文件
*
* @param ids
* @return
*/
public String creaXSSFWorkbook1(InsureDto insureDto) throws Exception {
if (insureDto.getUserIds().length <= 0) {
return "error";
}
LocalDate localDate = LocalDate.now();
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds());
List list = Lists.newArrayList();
for (YgglMainEmp y : ygglMainEmpList) {
String[] arr = new String[]{String.valueOf(y.getId()), y.getName(), "身份证", y.getZjNum(), PlanEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getName(), insureDto.getPolicyDateStart(), "", StringUtils.isNullOrEmpty(insureDto.getTricycleFrameNumber()) ? "无" : insureDto.getTricycleFrameNumber(), PlanEnum.getEnum(insureDto.getBenefitBasicPlan(), insureDto.getBenefitOccupationCategory()).getType()};
list.add(arr);
}
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(localDate + "_补充" + list.size() + "名人员清单.xlsx", rowName, list);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
String url = "";
xssfWorkbook.write(byteArrayOutputStream);
byte[] bytes = byteArrayOutputStream.toByteArray();
String fileBase64 = Base64.byteArrayToBase64(bytes);
/*body参数 begin*/
Map bodyMap = Maps.newHashMap();
bodyMap.put("media", fileBase64);
/*end*/
String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(data);
if (dataMap.get("errcode").toString().equals("suc")) {
Object o = dataMap.get("data");
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
url = map.get("file_url").toString();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(5)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl2)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
xssfWorkbook.close();
byteArrayOutputStream.close();
return url;
}
/**
* 生成保全替换文件
*
* @param ids
* @return
*/
public String creaXSSFWorkbook2(String[] ids, String date, String[] oldIds, String type, String tricycleFrameNumber) throws Exception {
if (ids.length <= 0 || oldIds.length <= 0) {
return "error";
}
LocalDate localDate = LocalDate.now();
List<YgglMainEmp> newList = ygglMainEmpMapper.selectListByIds(ids);
List<YgglMainEmp> oldList = ygglMainEmpMapper.selectListByIds(oldIds);
if (newList.size() != oldList.size()) {
return "error";
}
List list = Lists.newArrayList();
for (int i = 0; i < newList.size(); i++) {
String[] arr = new String[]{String.valueOf(oldList.get(i).getId()),
oldList.get(i).getName(),
"身份证",
oldList.get(i).getZjNum(),
date.substring(0, 10),
newList.get(i).getName(),
"身份证",
newList.get(i).getZjNum(),
"", "", "", "", "", "", StringUtils.isNullOrEmpty(tricycleFrameNumber) ? "无" : tricycleFrameNumber, "1", type.equals("63119") ? "A类" : type.equals("63120") ? "B类" : "C类"};
list.add(arr);
}
String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Update_date", "replace_name", "replace_ID_type",
"replace_ID_number", "Date_of_birth", "insured_type", "insured_relationship", "cert_type_related_insured", "insured_relationship_id", "Branch",
"Tricycle_frame_number", "insured_number", "benefit_occupation_category"};
XSSFWorkbook xssfWorkbook = ExcelUtils.exportExcel(localDate + "_替换" + list.size() + "名人员清单.xlsx", rowName, list);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
String url = "";
xssfWorkbook.write(byteArrayOutputStream);
byte[] bytes = byteArrayOutputStream.toByteArray();
String fileBase64 = Base64.byteArrayToBase64(bytes);
/*body参数 begin*/
Map bodyMap = Maps.newHashMap();
bodyMap.put("media", fileBase64);
/*end*/
String data = HttpUtils.sendPost(uploadUrl2, setParams(JSONObject.toJSONString(bodyMap), appidq, secretq), bodyMap);
Map<String, Object> dataMap = JSONObject.parseObject(data);
if (dataMap.get("errcode").toString().equals("suc")) {
Object o = dataMap.get("data");
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(o));
url = map.get("file_url").toString();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(6)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(uploadUrl2)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).fileUrl(url).build().insert();
/*文件流base64*/
xssfWorkbook.close();
byteArrayOutputStream.close();
return url;
}
/*获取基础计划的价格*/
private Integer getPrice(String plan, String type) {
/*
基础计划
30万雇主/3万医疗 36968,
50万雇主/5万医疗 36969,
80万雇主/10万医疗 36970,
80万雇主/20万医疗 36971,
100万雇主/10万医疗 36972
*/
/*行业类型
* A类 63119
* B类 63120
* C类 63121\
* */
switch (plan) {
case "36968":
if (type.equals("63119")) {
return PlanEnum.A_30.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_30.getPrice();
}
break;
case "36969":
if (type.equals("63119")) {
return PlanEnum.A_50.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_50.getPrice();
} else if (type.equals("63121")) {
return PlanEnum.C_50.getPrice();
}
break;
case "36970":
if (type.equals("63119")) {
return PlanEnum.A_80.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_80.getPrice();
} else if (type.equals("63121")) {
return PlanEnum.C_80.getPrice();
}
break;
case "36971":
if (type.equals("63119")) {
return PlanEnum.A_80_20.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_80_20.getPrice();
}
break;
case "36972":
if (type.equals("63119")) {
return PlanEnum.A_100.getPrice();
} else if (type.equals("63120")) {
return PlanEnum.B_100.getPrice();
}
break;
}
return 0;
}
}
......@@ -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;
......@@ -15,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;
......@@ -36,10 +38,13 @@ public class InsureTaskTiming {
private YgglMainEmpMapper ygglMainEmpMapper;
@Scheduled(cron = "0 0 0 1 * ?")//每月第一天
public void updateInsureStatusTask() throws ParseException {
@Transactional(rollbackFor = Exception.class)
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 +53,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("保单失效定时器异常");
}
}
}
......@@ -657,10 +657,10 @@ public class QyzxController {
*/
@PostMapping(value = "/companyAdminList")
@ApiOperation(value = "运营后台---企业信息列表", httpMethod = "POST", notes = "")
public Result<Object> companyAdminList(@RequestBody cn.timer.api.utils.Page page) {
public Result<Object> companyAdminList(@RequestBody EntInfoDto entInfoDto) {
Map map = Maps.newHashMap();
List<EntInfoDto> list = Optional.ofNullable(qyzxEntInfoMMapper.companyAdminList(page)).orElse(Lists.newArrayList());
Integer count = qyzxEntInfoMMapper.companyAdminCount();
List<EntInfoDto> list = Optional.ofNullable(qyzxEntInfoMMapper.companyAdminList(entInfoDto)).orElse(Lists.newArrayList());
Integer count = qyzxEntInfoMMapper.companyAdminCount(entInfoDto);
map.put("list",list);
map.put("count",count);
return ResultUtil.data(map);
......
......@@ -210,7 +210,7 @@ public class ZpglServiceImpl implements ZpglService {
messageTemplate = ZpglMessageTemplate.OFFER_ENTRYING;
}
detail = ZpglMessageTemplate.print(messageTemplate, new String[]{
userBean.getQyzxEmpLogin().getUsername(), zpglFail.getFailCause(), zpglRcxxDto.getRemarks(), titleLabel});
userBean.getUserInfo().getName(), zpglFail.getFailCause(), StringUtils.isEmpty(zpglRcxxDto.getRemarks())?"":zpglRcxxDto.getRemarks(), titleLabel});
}
break;
case 10:
......
......@@ -25,9 +25,11 @@ public interface InsurePolicyMapper extends BaseMapper<InsurePolicy> {
PolicyDto getPolicyDetail(@Param("id")Integer id);
Integer totalPolicy(@Param("policy")PolicyDto policyDto);
List<PolicyDto> policyTotalList();
List<InsureUserDto> selectPlansListByorgCode(@Param("orgCode")Integer id);
List<InsureUserDto> selectPolicyListByorgCode(@Param("orgCode")Integer id,@Param("policy")PolicyDto policyDto);
Integer selectPolicyTotalByorgCode(@Param("orgCode")Integer id,@Param("policy")PolicyDto policyDto);
List<InsurePolicy> selectPolicyListByStatus(@Param("date") Date date);
Integer selectPlansTotalByorgCode(@Param("orgCode")Integer id);
}
......@@ -18,9 +18,9 @@ import java.util.Map;
*/
@Repository
public interface QyzxEntInfoMMapper extends BaseMapper<QyzxEntInfoM> {
public List<EntInfoDto> companyAdminList(@Param("page")Page page);
public List<EntInfoDto> companyAdminList(@Param("param")EntInfoDto entInfoDto);
public Integer companyAdminCount();
public Integer companyAdminCount(@Param("param")EntInfoDto entInfoDto);
public List<Map<String,String>> getCompanyList();
......
......@@ -2,6 +2,8 @@ package cn.timer.api.dto.insure;
import lombok.Data;
import java.util.Date;
/**
* @Description TODO
* @Author wgd
......@@ -9,10 +11,13 @@ import lombok.Data;
*/
@Data
public class InsureUserDto {
private Integer id;
private Integer policyId;
private String benefitBasicPlan;
private String benefitOccupationCategory;
private Integer totalUser;
private String[] oldIds;
private String policyNo;
private String name;
private Date updateTime;
}
......@@ -45,4 +45,6 @@ public class PolicyDto {
private Integer policyId;
private Integer applyType;
private String monthD;
private String userName;
private String companyName;
}
package cn.timer.api.dto.qyzx;
import cn.timer.api.utils.Page;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
......@@ -26,4 +27,5 @@ public class EntInfoDto {
private String endTime;
private Integer totlaSpmk;
private Integer totlaCc;
private Page page;
}
......@@ -504,7 +504,7 @@ public class ExcelUtils {
} else if (xssfCell.getCellTypeEnum() == CellType.BOOLEAN) {
return String.valueOf(xssfCell.getBooleanCellValue());
} else {
return xssfCell.getStringCellValue();
return xssfCell.getStringCellValue().trim();
}
}
}
......
......@@ -8,11 +8,15 @@ import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import cn.timer.api.config.sftp.SftpConfiguration;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.jcraft.jsch.ChannelSftp;
import io.swagger.models.auth.In;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.bouncycastle.jce.exception.ExtIOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
......@@ -77,6 +81,11 @@ public class OSSUtil {
@Value("${zip.path}")
private String zipPath;
@Autowired
private SftpConfiguration config;
/**
* 1.创建储存空间 sout控制台輸出 储存空间名
*
......@@ -594,10 +603,10 @@ public class OSSUtil {
String Suffix;
try {
File folder = new File(zipPath);
if(!folder.exists()&& !folder .isDirectory()){
if (!folder.exists() && !folder.isDirectory()) {
folder.mkdirs();
}
fos = new FileOutputStream(zipPath+fileName);
fos = new FileOutputStream(zipPath + fileName);
zos = new ZipOutputStream(fos);
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
for (String m : urlMap.keySet()) {
......@@ -641,4 +650,68 @@ public class OSSUtil {
}
return fileName;
}
/**
* @Author wgd
* @Description 获取OSS文件字符流
* @Date 2021/12/2 18:06
**/
private Map getOssFileList(Map<String, String> urlMap) throws IOException {
Map<String, InputStream> map = Maps.newHashMap();
BufferedInputStream inputStream;
OSSObject ossObject;
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
for (String m : urlMap.keySet()) {
ossObject = ossClient.getObject(bucketName, urlMap.get(m));
inputStream = new BufferedInputStream(ossObject.getObjectContent());
String suffix = urlMap.get(m).substring(urlMap.get(m).lastIndexOf("."));
map.put(m + urlMap.get(m), inputStream);
}
ossClient.shutdown();
return map;
}
private Map getFtpFileList(Map<String, String> urlMap) throws IOException {
Map<String, InputStream> map = Maps.newHashMap();
InputStream inputStream;
for (String m : urlMap.keySet()) {
File file = new File(urlMap.get(m));
inputStream = new FileInputStream(file);
map.put(m, inputStream);
}
return map;
}
public String newZip(Map<String, String> ossMap, Map<String, String> ftpMap) throws IOException {
Map<String, InputStream> ossNewMap = getOssFileList(ossMap);
Map<String, InputStream> ftpNewMap = getFtpFileList(ftpMap);
ossNewMap.putAll(ftpNewMap);
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = dateFormat.format(new Date()) + ".zip";
FileOutputStream fos = null;
ZipOutputStream zos = null;
InputStream inputStream = null;
for (String m : ossNewMap.keySet()) {
ZipEntry entry = new ZipEntry(m);
try {
zos.putNextEntry(entry);
int nNumber;
byte[] buffer = new byte[4096];
while ((nNumber = ossNewMap.get(m).read(buffer)) > 0) {
zos.write(buffer, 0, nNumber);
}
} catch (IOException e) {
throw new IOException("写入失败");//TODO 应作为自定义异常
} finally {
try {
inputStream.close();
} catch (IOException e) {
throw new IOException("关闭失败");//TODO 应作为自定义异常
}
}
}
return fileName;
}
}
......@@ -282,25 +282,39 @@ youling:
h5:
url: 'http://javays.com'
insure:
#投保
#投保 appid
appid: '1002303100602312445'
#投保 secret
secret: 'acb329868c31d5b3ba03de40dac13dd9'
#投保上传文件
uploadUrl: 'http://sandbox.portal.unistar-ins.com/service/Home/Index/fileUpload'
#投保立即出单
insuredUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuotePolicy'
#投保请求出单
getPolicyUrl: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/index'
#查询保单信息
policyDetail: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/policy'
#申请保单
createQuote: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuote'
#投保支付
toPayUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Pay/toPay'
#保全支付
batchToPayUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/ImportPay/set_import_pay'
#保全
#保全appid
appidq: '1000115041006006938'
#保全 secret
secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b'
#保全上传文件
uploadUrlq: 'http://sandbox.portal.unistar-ins.com/fuli/Home/Index/file_upload'
#保全申请
batchUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/WelfareProduct/batch_declare'
#保全取消支付
cancelPayment: 'http://sandbox.portal.unistar-ins.com/fuli/Home/OrderImport/order_import_set'
# base_api_url
BASE_API_URL: 'http://o49t563035.qicp.vip'
#支付回调
pay_page: 'http://localhost:9527'
......@@ -261,21 +261,42 @@ wxgzh:
encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX'
insure:
#投保
#投保 appid
appid: '1002209110212305335'
#投保 secret
secret: '1ef7b79471be7f6b5489832c65109f81'
#投保上传文件
uploadUrl: 'https://portal.unistar-ins.com/service/Home/Index/fileUpload'
#投保立即出单
insuredUrl: 'https://portal.unistar-ins.com/mall/Home/Index/createQuotePolicy'
#投保请求出单
getPolicyUrl: 'https://portal.unistar-ins.com/issuing/Home/Index/index'
#申请保单
createQuote: 'https://portal.unistar-ins.com/mall/Home/Index/createQuote'
#投保支付
toPayUrl: 'https://portal.unistar-ins.com/mall/Home/Pay/toPay'
#保全支付
batchToPayUrl: 'https://portal.unistar-ins.com/fuli/Home/ImportPay/set_import_pay'
#查询保单信息
policyDetail: 'https://portal.unistar-ins.com/issuing/Home/Index/policy'
#保全
#保全appid
appidq: '1000711000604326196'
#保全 secret
secretq: 'a2da17a2797c63dff9172df50af9da65'
#保全上传文件
uploadUrlq: 'https://portal.unistar-ins.com/fuli/Home/Index/file_upload'
#保全申请
batchUrl: 'https://portal.unistar-ins.com/fuli/Home/WelfareProduct/batch_declare'
#保全取消支付
cancelPayment: 'https://portal.unistar-ins.com/fuli/Home/OrderImport/order_import_set'
youling:
serverUrl: 'https://www.youlingrc.com'
#h5服务地址
h5:
url: 'http://h5.8timer.cn'
#支付回调
pay_page: 'http://oss.8timer.cn'
......@@ -254,32 +254,43 @@ wxgzh:
encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX'
insure:
#投保
#投保 appid
appid: '1002303100602312445'
#投保 secret
secret: 'acb329868c31d5b3ba03de40dac13dd9'
#投保上传文件
uploadUrl: 'http://sandbox.portal.unistar-ins.com/service/Home/Index/fileUpload'
#投保立即出单
insuredUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuotePolicy'
#投保请求出单
getPolicyUrl: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/index'
#查询保单信息
policyDetail: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/policy'
#申请保单
createQuote: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuote'
#投保支付
toPayUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Pay/toPay'
#保全支付
batchToPayUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/ImportPay/set_import_pay'
#保全
#保全appid
appidq: '1000115041006006938'
#保全 secret
secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b'
#保全上传文件
uploadUrlq: 'http://sandbox.portal.unistar-ins.com/fuli/Home/Index/file_upload'
#保全申请
batchUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/WelfareProduct/batch_declare'
#保全取消支付
cancelPayment: 'http://sandbox.portal.unistar-ins.com/fuli/Home/OrderImport/order_import_set'
youling:
serverUrl: 'http://227387db45.51vip.biz'
#h5服务地址
h5:
url: 'http://javays.com'
#支付回调
pay_page: 'http://test-insurance-api.youlingrc.com'
spring:
profiles:
active: test
active: dev
#active: '@environment@'
......@@ -14,6 +14,7 @@
<result property="payType" column="pay_type"/>
<result property="policyId" column="policy_id"/>
<result property="serialNumber" column="serial_number"/>
<result property="payUrl" column="pay_url"/>
</resultMap>
......
......@@ -268,6 +268,12 @@
<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>
<if test="policy.policyNo!=null and policy.policyNo!=''">
and ip.policy_no like CONCAT('%',#{policy.policyNo},'%')
</if>
</where>
GROUP BY ip.id
order by ip.create_time desc
......@@ -319,17 +325,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
......@@ -337,22 +343,38 @@
ip.id
</select>
<select id="selectPlansListByorgCode" resultType="cn.timer.api.dto.insure.InsureUserDto">
<select id="selectPolicyListByorgCode" resultType="cn.timer.api.dto.insure.InsureUserDto">
SELECT
ip.id as policyId,
ip.id as id,
ip.policy_no as policyNo,
iu.benefit_basic_plan as benefitBasicPlan,
iu.benefit_occupation_category as benefitOccupationCategory,
count(iu.id) as totalUser
ir.name,
ip.update_time as updateTime
FROM
insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id
LEFT JOIN insure_product ir on ir.id=ip.product_id
WHERE ip.org_code=#{orgCode}
GROUP BY
ip.id,
iu.benefit_basic_plan,
iu.benefit_occupation_category
<if test="policy.policyNo !=null and policy.policyNo!=''">
and ip.policy_no = #{policy.policyNo}
</if>
order by ip.update_time desc
<if test="policy.page.offset != null and policy.page.totalPage != null">
limit #{policy.page.offset}, #{policy.page.totalPage}
</if>
</select>
<select id="selectPolicyTotalByorgCode" resultType="java.lang.Integer">
SELECT
count(ip.id)
FROM
insure_policy ip
LEFT JOIN insure_product ir on ir.id=ip.product_id
WHERE ip.org_code=#{orgCode}
<if test="policy.policyNo !=null and policy.policyNo!=''">
and ip.policy_no = #{policy.policyNo}
</if>
</select>
<select id="selectPlansTotalByorgCode" resultType="java.lang.Integer">
SELECT
count(ip.id)
......
......@@ -280,7 +280,7 @@
<select id="selectPolicyList" resultType="cn.timer.api.dto.insure.PolicyDto">
select
iu.id,yme.`name`,yme.zj_type,yme.zj_num,iu.policy_no,iu.`status`,io.name as schemeName,iu.policy_date_start,iu.insure_status,
iu.id,yme.`name`,yme.zj_type,yme.zj_num,ip.policy_no,iu.`status`,io.name as schemeName,iu.policy_date_start,iu.insure_status,
iu.policy_date_end,iu.create_time,iu.insured_name,iu.benefit_basic_plan AS benefitBasicPlan,iu.price AS price,
iu.user_id as userId,iu.batch_no as batchNo,iu.benefit_occupation_category as benefitOccupationCategory,
iu.policy_id as policyId,
......@@ -329,6 +329,12 @@
<if test="policyDto.policyDateStart !=null and policyDto.policyDateStart !='' and policyDto.policyDateEnd !=null and policyDto.policyDateEnd !=''">
and iu.create_time BETWEEN #{policyDto.policyDateStart} and #{policyDto.policyDateEnd}
</if>
<if test="policyDto.userName !=null and policyDto.userName !='' ">
and yme.`name` like CONCAT('%',#{policyDto.userName},'%')
</if>
<if test="policyDto.zjNum !=null and policyDto.zjNum !='' ">
and yme.zj_num like CONCAT('%',#{policyDto.zjNum},'%')
</if>
</where>
order by iu.create_time desc
......
......@@ -217,15 +217,37 @@
LEFT JOIN yggl_main_emp yme ON yme.org_code = qeim.id
LEFT JOIN ( SELECT sas.org_code AS oid, count( sas.id ) AS totlaSpmk FROM spmk_approve_summary sas GROUP BY sas.org_code ) AS a ON a.oid = qeim.id
LEFT JOIN ( SELECT cc.organization_id AS oid, count( cc.id ) AS totlaCc FROM cms_content cc GROUP BY cc.organization_id ) AS b ON b.oid = qeim.id
<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>
GROUP BY
qeim.id
<if test="page.offset != null and page.totalPage !=null">
limit #{page.offset},#{page.totalPage}
<if test="param.page.currentPage != null and param.page.totalPage !=null">
limit #{param.page.offset},#{param.page.totalPage}
</if>
</select>
<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