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` ...@@ -197,3 +197,4 @@ ALTER TABLE `insure_product`
ALTER TABLE `insure_policy` ALTER TABLE `insure_policy`
ADD COLUMN `policy_pay_type` int(11) NOT NULL DEFAULT 1 COMMENT '1在线支付 2预付款 3线下支付' AFTER `create_time`, 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`; 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; ...@@ -4,22 +4,21 @@ import cn.timer.api.bean.htzz.HtzzAssoZztx;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.mysql.cj.util.StringUtils;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Builder; import org.springframework.beans.factory.annotation.Value;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 投保人 * 投保人
* *
...@@ -35,323 +34,383 @@ import java.util.Date; ...@@ -35,323 +34,383 @@ import java.util.Date;
@Table(name = "insure_applicant") @Table(name = "insure_applicant")
@ApiModel("投保人") @ApiModel("投保人")
public class InsureApplicant extends Model<InsureApplicant> { public class InsureApplicant extends Model<InsureApplicant> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* id * id
*/ */
@Id @Id
@GeneratedValue @GeneratedValue
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号") @ApiModelProperty(value = "编号")
private Integer id; private Integer id;
/** /**
* 企业/网点名称 * 企业/网点名称
*/ */
@ApiModelProperty(value = "企业/网点名称") @ApiModelProperty(value = "企业/网点名称")
private String applicantEName; @NotEmpty
/** private String applicantEName;
* 企业/网点地址 /**
*/ * 企业/网点地址
@ApiModelProperty(value = "企业/网点地址") */
private String applicantEAddress; @ApiModelProperty(value = "企业/网点地址")
/** private String applicantEAddress;
* 人员清单 /**
*/ * 人员清单
@ApiModelProperty(value = "人员清单") */
private String applicantEmployeeList; @ApiModelProperty(value = "人员清单")
/** private String applicantEmployeeList;
* 企业授权操作人姓名 /**
*/ * 企业授权操作人姓名
@ApiModelProperty(value = "企业授权操作人姓名") */
private String applicantEContacts; @ApiModelProperty(value = "企业授权操作人姓名")
/** private String applicantEContacts;
* 操作人的联系电话 /**
*/ * 操作人的联系电话
@ApiModelProperty(value = "操作人的联系电话") */
private String applicantEPhone; @ApiModelProperty(value = "操作人的联系电话")
/** private String applicantEPhone;
* 企业证件类型:3646、统一社会信用代码 3924、组织机构代码 /**
*/ * 企业证件类型:3646、统一社会信用代码 3924、组织机构代码
@ApiModelProperty(value = "企业证件类型") */
private String applicantENoType; @ApiModelProperty(value = "企业证件类型")
/** private String applicantENoType;
* 企业证件号码 /**
*/ * 企业证件号码
@ApiModelProperty(value = "企业证件号码") */
private String applicantENo; @ApiModelProperty(value = "企业证件号码")
/** private String applicantENo;
* 企业邮箱 /**
*/ * 企业邮箱
@ApiModelProperty(value = "企业邮箱") */
private String applicantEMail; @ApiModelProperty(value = "企业邮箱")
/** private String applicantEMail;
* 省市区 /**
*/ * 省市区
@ApiModelProperty(value = "省市区") */
private String applicantProvinceCity; @ApiModelProperty(value = "省市区")
/** private String applicantProvinceCity;
* 发票收件地址 /**
*/ * 发票收件地址
@ApiModelProperty(value = "发票收件地址") */
private String applicantInvoiceReceivingAddress; @ApiModelProperty(value = "发票收件地址")
/** private String applicantInvoiceReceivingAddress;
* 发票开票电话 /**
*/ * 发票开票电话
@ApiModelProperty(value = "发票开票电话") */
private String applicantInvoiceBillingPhone; @ApiModelProperty(value = "发票开票电话")
/** private String applicantInvoiceBillingPhone;
* 企业开户行名称 /**
*/ * 企业开户行名称
@ApiModelProperty(value = "企业开户行名称") */
private String applicantBusinessBankName; @ApiModelProperty(value = "企业开户行名称")
/** private String applicantBusinessBankName;
* 保单号 /**
*/ * 保单号
@ApiModelProperty(value = "保单号") */
private String policyNo; @ApiModelProperty(value = "保单号")
/** private String policyNo;
* 投保类型:1个人 2 企业 /**
*/ * 投保类型:1个人 2 企业
@ApiModelProperty(value = "投保类型") */
private String applicantType; @ApiModelProperty(value = "投保类型")
/** private String applicantType;
* 报价请求流水号 /**
*/ * 报价请求流水号
@ApiModelProperty(value = "报价请求流水号") */
private String transId; @ApiModelProperty(value = "报价请求流水号")
/** private String transId;
* 报价号 /**
*/ * 报价号
@ApiModelProperty(value = "报价号") */
private String currency; @ApiModelProperty(value = "报价号")
/** private String currency;
* 发票开票金额 /**
*/ * 发票开票金额
@ApiModelProperty(value = "发票开票金额") */
private String applicantInvoicedAmount; @ApiModelProperty(value = "发票开票金额")
@ApiModelProperty(value = "企业id", example = "") private String applicantInvoicedAmount;
private Integer orgCode; @ApiModelProperty(value = "企业id", example = "")
@ApiModelProperty(value="银行账号") private Integer orgCode;
private String applicantCorporateBankAccount; @ApiModelProperty(value = "银行账号")
private String applicantCorporateBankAccount;
/**
* 设置:id /**
*/ * 设置:id
public void setId(Integer id) { */
this.id = id; public void setId(Integer id) {
} this.id = id;
}
/**
* 设置:企业/网点名称 /**
*/ * 设置:企业/网点名称
public void setApplicantEName(String applicantEName) { */
this.applicantEName = applicantEName; public void setApplicantEName(String applicantEName) {
} this.applicantEName = applicantEName;
/** }
* 获取:企业/网点名称
*/ /**
public String getApplicantEName() { * 获取:企业/网点名称
return applicantEName; */
} public String getApplicantEName() {
/** return applicantEName;
* 设置:企业/网点地址 }
*/
public void setApplicantEAddress(String applicantEAddress) { /**
this.applicantEAddress = applicantEAddress; * 设置:企业/网点地址
} */
/** public void setApplicantEAddress(String applicantEAddress) {
* 获取:企业/网点地址 this.applicantEAddress = applicantEAddress;
*/ }
public String getApplicantEAddress() {
return applicantEAddress; /**
} * 获取:企业/网点地址
/** */
* 设置:人员清单 public String getApplicantEAddress() {
*/ return applicantEAddress;
public void setApplicantEmployeeList(String applicantEmployeeList) { }
this.applicantEmployeeList = applicantEmployeeList;
} /**
/** * 设置:人员清单
* 获取:人员清单 */
*/ public void setApplicantEmployeeList(String applicantEmployeeList) {
public String getApplicantEmployeeList() { this.applicantEmployeeList = applicantEmployeeList;
return applicantEmployeeList; }
}
/** /**
* 设置:企业授权操作人姓名 * 获取:人员清单
*/ */
public void setApplicantEContacts(String applicantEContacts) { public String getApplicantEmployeeList() {
this.applicantEContacts = applicantEContacts; return applicantEmployeeList;
} }
/**
* 获取:企业授权操作人姓名 /**
*/ * 设置:企业授权操作人姓名
public String getApplicantEContacts() { */
return applicantEContacts; public void setApplicantEContacts(String applicantEContacts) {
} this.applicantEContacts = applicantEContacts;
/** }
* 设置:操作人的联系电话
*/ /**
public void setApplicantEPhone(String applicantEPhone) { * 获取:企业授权操作人姓名
this.applicantEPhone = applicantEPhone; */
} public String getApplicantEContacts() {
/** return applicantEContacts;
* 获取:操作人的联系电话 }
*/
public String getApplicantEPhone() { /**
return applicantEPhone; * 设置:操作人的联系电话
} */
/** public void setApplicantEPhone(String applicantEPhone) {
* 设置:企业证件类型:3646、统一社会信用代码 3924、组织机构代码 this.applicantEPhone = applicantEPhone;
*/ }
public void setApplicantENoType(String applicantENoType) {
this.applicantENoType = applicantENoType; /**
} * 获取:操作人的联系电话
/** */
* 获取:企业证件类型:3646、统一社会信用代码 3924、组织机构代码 public String getApplicantEPhone() {
*/ return applicantEPhone;
public String getApplicantENoType() { }
return applicantENoType;
} /**
/** * 设置:企业证件类型:3646、统一社会信用代码 3924、组织机构代码
* 设置:企业证件号码 */
*/ public void setApplicantENoType(String applicantENoType) {
public void setApplicantENo(String applicantENo) { this.applicantENoType = applicantENoType;
this.applicantENo = applicantENo; }
}
/** /**
* 获取:企业证件号码 * 获取:企业证件类型:3646、统一社会信用代码 3924、组织机构代码
*/ */
public String getApplicantENo() { public String getApplicantENoType() {
return applicantENo; return applicantENoType;
} }
/**
* 设置:企业邮箱 /**
*/ * 设置:企业证件号码
public void setApplicantEMail(String applicantEMail) { */
this.applicantEMail = applicantEMail; public void setApplicantENo(String applicantENo) {
} this.applicantENo = applicantENo;
/** }
* 获取:企业邮箱
*/ /**
public String getApplicantEMail() { * 获取:企业证件号码
return applicantEMail; */
} public String getApplicantENo() {
/** return applicantENo;
* 设置:省市区 }
*/
public void setApplicantProvinceCity(String applicantProvinceCity) { /**
this.applicantProvinceCity = applicantProvinceCity; * 设置:企业邮箱
} */
/** public void setApplicantEMail(String applicantEMail) {
* 获取:省市区 this.applicantEMail = applicantEMail;
*/ }
public String getApplicantProvinceCity() {
return applicantProvinceCity; /**
} * 获取:企业邮箱
/** */
* 设置:发票收件地址 public String getApplicantEMail() {
*/ return applicantEMail;
public void setApplicantInvoiceReceivingAddress(String applicantInvoiceReceivingAddress) { }
this.applicantInvoiceReceivingAddress = applicantInvoiceReceivingAddress;
} /**
/** * 设置:省市区
* 获取:发票收件地址 */
*/ public void setApplicantProvinceCity(String applicantProvinceCity) {
public String getApplicantInvoiceReceivingAddress() { this.applicantProvinceCity = applicantProvinceCity;
return applicantInvoiceReceivingAddress; }
}
/** /**
* 设置:发票开票电话 * 获取:省市区
*/ */
public void setApplicantInvoiceBillingPhone(String applicantInvoiceBillingPhone) { public String getApplicantProvinceCity() {
this.applicantInvoiceBillingPhone = applicantInvoiceBillingPhone; return applicantProvinceCity;
} }
/**
* 获取:发票开票电话 /**
*/ * 设置:发票收件地址
public String getApplicantInvoiceBillingPhone() { */
return applicantInvoiceBillingPhone; public void setApplicantInvoiceReceivingAddress(String applicantInvoiceReceivingAddress) {
} this.applicantInvoiceReceivingAddress = applicantInvoiceReceivingAddress;
/** }
* 设置:企业开户行名称
*/ /**
public void setApplicantBusinessBankName(String applicantBusinessBankName) { * 获取:发票收件地址
this.applicantBusinessBankName = applicantBusinessBankName; */
} public String getApplicantInvoiceReceivingAddress() {
/** return applicantInvoiceReceivingAddress;
* 获取:企业开户行名称 }
*/
public String getApplicantBusinessBankName() { /**
return applicantBusinessBankName; * 设置:发票开票电话
} */
/** public void setApplicantInvoiceBillingPhone(String applicantInvoiceBillingPhone) {
* 设置:保单号 this.applicantInvoiceBillingPhone = applicantInvoiceBillingPhone;
*/ }
public void setPolicyNo(String policyNo) {
this.policyNo = policyNo; /**
} * 获取:发票开票电话
/** */
* 获取:保单号 public String getApplicantInvoiceBillingPhone() {
*/ return applicantInvoiceBillingPhone;
public String getPolicyNo() { }
return policyNo;
} /**
/** * 设置:企业开户行名称
* 设置:投保类型:1个人 2 企业 */
*/ public void setApplicantBusinessBankName(String applicantBusinessBankName) {
public void setApplicantType(String applicantType) { this.applicantBusinessBankName = applicantBusinessBankName;
this.applicantType = applicantType; }
}
/** /**
* 获取:投保类型:1个人 2 企业 * 获取:企业开户行名称
*/ */
public String getApplicantType() { public String getApplicantBusinessBankName() {
return applicantType; return applicantBusinessBankName;
} }
/**
* 设置:报价请求流水号 /**
*/ * 设置:保单号
public void setTransId(String transId) { */
this.transId = transId; public void setPolicyNo(String policyNo) {
} this.policyNo = policyNo;
/** }
* 获取:报价请求流水号
*/ /**
public String getTransId() { * 获取:保单号
return transId; */
} public String getPolicyNo() {
/** return policyNo;
* 设置:报价号 }
*/
public void setCurrency(String currency) { /**
this.currency = currency; * 设置:投保类型:1个人 2 企业
} */
/** public void setApplicantType(String applicantType) {
* 获取:报价号 this.applicantType = applicantType;
*/ }
public String getCurrency() {
return currency; /**
} * 获取:投保类型:1个人 2 企业
/** */
* 设置:发票开票金额 public String getApplicantType() {
*/ return applicantType;
public void setApplicantInvoicedAmount(String applicantInvoicedAmount) { }
this.applicantInvoicedAmount = applicantInvoicedAmount;
} /**
/** * 设置:报价请求流水号
* 获取:发票开票金额 */
*/ public void setTransId(String transId) {
public String getApplicantInvoicedAmount() { this.transId = transId;
return applicantInvoicedAmount; }
}
/**
public Integer getOrgCode() { * 获取:报价请求流水号
return orgCode; */
} public String getTransId() {
return transId;
public void setOrgCode(Integer orgCode) { }
this.orgCode = orgCode;
} /**
* 设置:报价号
*/
public void setCurrency(String currency) {
this.currency = currency;
}
/**
* 获取:报价号
*/
public String getCurrency() {
return currency;
}
/**
* 设置:发票开票金额
*/
public void setApplicantInvoicedAmount(String applicantInvoicedAmount) {
this.applicantInvoicedAmount = applicantInvoicedAmount;
}
/**
* 获取:发票开票金额
*/
public String getApplicantInvoicedAmount() {
return applicantInvoicedAmount;
}
public Integer getOrgCode() {
return orgCode;
}
public void setOrgCode(Integer orgCode) {
this.orgCode = orgCode;
}
/*验证必要字段*/
public String checkValiad() {
if (StringUtils.isNullOrEmpty(applicantEName)) {
return "企业/网点名称未设置";
}
if (StringUtils.isNullOrEmpty(applicantEAddress)) {
return "企业/网点地址未设置";
}
if (StringUtils.isNullOrEmpty(applicantEContacts)) {
return "企业授权操作人姓名未设置";
}
if (StringUtils.isNullOrEmpty(applicantEPhone)) {
return "操作人的联系电话未设置";
}
if (StringUtils.isNullOrEmpty(applicantENoType)) {
return "企业证件类型未设置";
}
if (StringUtils.isNullOrEmpty(applicantENo)) {
return "企业证件号码未设置";
}
if (StringUtils.isNullOrEmpty(applicantEMail)) {
return "企业邮箱未设置";
}
return "true";
}
} }
...@@ -73,6 +73,8 @@ public class InsurePay extends Model<InsurePay> { ...@@ -73,6 +73,8 @@ public class InsurePay extends Model<InsurePay> {
private String serialNumber; private String serialNumber;
private String payUrl;
/** /**
* 设置:id * 设置:id
*/ */
......
...@@ -11,9 +11,9 @@ import lombok.NoArgsConstructor; ...@@ -11,9 +11,9 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class AttendanceAssistant implements Serializable{ public class AttendanceAssistant implements Serializable{
private static final long serialVersionUID = -3561517817976805144L; private static final long serialVersionUID = -3561517817976805144L;
String name;// 考勤组名称 * String name;// 考勤组名称 *
String remarks;// 备注 * String remarks;// 备注 *
String[] attmachines;// 考勤机 String[] attmachines;// 考勤机
...@@ -28,7 +28,7 @@ public class AttendanceAssistant implements Serializable{ ...@@ -28,7 +28,7 @@ public class AttendanceAssistant implements Serializable{
String[] attWeekdaysShifts;// 周工作日班次【固定排班】 String[] attWeekdaysShifts;// 周工作日班次【固定排班】
String[] attMustPunchData;// 必须打卡的日期【固定排班】 String[] attMustPunchData;// 必须打卡的日期【固定排班】
String[] attMustPunchShifid;// 必须打卡的班次id【固定排班】 String[] attMustPunchShifid;// 必须打卡的班次id【固定排班】
// String[] attNonPunchData;// 不用打卡的日期【固定排班】 // String[] attNonPunchData;// 不用打卡的日期【固定排班】
ResttryfixdayDto[] attNonPunchData; ResttryfixdayDto[] attNonPunchData;
...@@ -51,12 +51,12 @@ public class AttendanceAssistant implements Serializable{ ...@@ -51,12 +51,12 @@ public class AttendanceAssistant implements Serializable{
String maxOvertimeTime;// 加班最大时长【自由工时】 String maxOvertimeTime;// 加班最大时长【自由工时】
String attgroupid; String attgroupid;
int overtimeRulesId;//加班id int overtimeRulesId;//加班id
int fieldpersonnel;//外勤 int fieldpersonnel;//外勤
int restdayclock;//休息日打卡 int restdayclock;//休息日打卡
String PagetransferDate;//页面传输修改日期 String transferDate;//页面传输修改日期
} }
...@@ -40,6 +40,8 @@ public class WebSecurityConfig implements WebMvcConfigurer { ...@@ -40,6 +40,8 @@ public class WebSecurityConfig implements WebMvcConfigurer {
.excludePathPatterns("/callBack/policy/payStatus") .excludePathPatterns("/callBack/policy/payStatus")
.excludePathPatterns("/callBack/policy/payCallBack") .excludePathPatterns("/callBack/policy/payCallBack")
.excludePathPatterns("/callBack/policy/issueCallback") .excludePathPatterns("/callBack/policy/issueCallback")
.excludePathPatterns("/callBack/policy/addpPayCallBack")
.excludePathPatterns("/callBack/policy/batchPayCallback")
.excludePathPatterns("/superLogin/**") .excludePathPatterns("/superLogin/**")
.excludePathPatterns("/actuator/*") .excludePathPatterns("/actuator/*")
.excludePathPatterns("/doc*") .excludePathPatterns("/doc*")
......
...@@ -2,7 +2,9 @@ package cn.timer.api.controller.insure; ...@@ -2,7 +2,9 @@ package cn.timer.api.controller.insure;
import cn.timer.api.bean.insure.*; import cn.timer.api.bean.insure.*;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.utils.HttpUtils; import cn.timer.api.utils.HttpUtils;
import cn.timer.api.utils.ResultUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
...@@ -10,12 +12,14 @@ import com.google.common.collect.Maps; ...@@ -10,12 +12,14 @@ import com.google.common.collect.Maps;
import com.mysql.cj.util.StringUtils; import com.mysql.cj.util.StringUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
...@@ -52,31 +56,17 @@ public class CallBackContorll { ...@@ -52,31 +56,17 @@ public class CallBackContorll {
@Value("${BASE_API_URL}") @Value("${BASE_API_URL}")
private String 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") @PostMapping(value = "/insuredCallBack")
@ApiOperation(value = "6.投保申请回调", httpMethod = "POST", notes = "投保申请回调") @ApiOperation(value = "6.投保核保回调-弃用", httpMethod = "POST", notes = "投保申请回调")
private Map insuredCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { private Map insuredCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("status", "error"); map.put("status", "error");
...@@ -103,9 +93,12 @@ public class CallBackContorll { ...@@ -103,9 +93,12 @@ public class CallBackContorll {
return trueMap; return trueMap;
} }
@PostMapping(value = "/CallBack") @PostMapping(value = "/addpPayCallBack")
@ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调") @ApiOperation(value = "11.增员核保回调", 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 addpPayCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
/*核保*/
/*如果是在线支付的话*/
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("status", "error"); map.put("status", "error");
if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) { if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) {
...@@ -114,33 +107,104 @@ public class CallBackContorll { ...@@ -114,33 +107,104 @@ public class CallBackContorll {
if (!pid.equals(appidq)) { if (!pid.equals(appidq)) {
return map; return map;
} }
InputStream is = null; try {
is = request.getInputStream(); InputStream is = null;
StringBuilder sb = new StringBuilder(); is = request.getInputStream();
byte[] b = new byte[4096]; StringBuilder sb = new StringBuilder();
for (int n; (n = is.read(b)) != -1; ) { byte[] b = new byte[4096];
sb.append(new String(b, 0, n)); for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(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;
} }
String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString()); }
if (!value.equals(sign)) {
@PostMapping(value = "/CallBack")
@ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调")
@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)) {
return map; return map;
} }
Map paramsMap = Maps.newHashMap(); if (!pid.equals(appidq)) {
paramsMap.put("pid", pid); return map;
paramsMap.put("timestamp", timestamp); }
paramsMap.put("sign", sign); try {
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class); InputStream is = null;
/*1保全复核回调*/ is = request.getInputStream();
if (callBack.getCallback_type().equals("1")) { StringBuilder sb = new StringBuilder();
/*核保*/ byte[] b = new byte[4096];
} else { for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
/*到这就已经支付成功出单了*/ }
log.info("callBack=====" + sb.toString()); String value = DigestUtils.md5Hex(pid + secretq + timestamp + sb.toString());
if (!value.equals(sign)) {
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);
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")) { if (callBack.getStatus().equals("1")) {
List<InsureUser> list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()).eq(InsureUser::getInsureStatus, 3));
list.forEach(i -> { list.forEach(i -> {
i.setInsureStatus(1); i.setInsureStatus(1);
i.setStatus("1");
i.updateById(); i.updateById();
YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
}); });
...@@ -153,150 +217,215 @@ public class CallBackContorll { ...@@ -153,150 +217,215 @@ public class CallBackContorll {
YgglMainEmp.builder().isInsure(0).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); 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) { if (oldlist == null || oldlist.size() == 0) {
insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money()))); 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.setPolicyFile(callBack.getOrder_import_info().getEndorsement_file());
insurePolicy.setUpdateTime(new Date());
insurePolicy.updateById();
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7) 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") .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(); .returnCode(callBack.getStatus()).returnMsg("更新成功").policyId(insurePolicy.getId()).build().insert();
} else { } else {
String errorMsg = ""; String errorMsg = "";
InsureLog insureLog = InsureLog.builder().build().selectOne(new QueryWrapper<InsureLog>().lambda().eq(InsureLog::getTransId, callBack.getOrder_import_info().getThird_uuid())); InsureLog insureLog = InsureLog.builder().build().selectOne(new QueryWrapper<InsureLog>().lambda().eq(InsureLog::getTransId, callBack.getOrder_import_info().getThird_uuid()));
List<Map> errMap = callBack.getOrder_import_info().getErr_list(); if(callBack.getOrder_import_info().getErr_list()!=null) {
if (errMap.size() > 0) { List<Map> errMap = callBack.getOrder_import_info().getErr_list();
for (int i = 0; i < errMap.size(); i++) { if (errMap.size() > 0) {
errorMsg = errorMsg + ("姓名:" + errMap.get(i).get("name").toString() + ",错误:" + errMap.get(i).get("err_content").toString() + ','); 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();
} }
} 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 写入日志 //TODO 写入日志
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7) 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") .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;
} }
Map trueMap = Maps.newHashMap();
trueMap.put("status", "1");
return trueMap;
} }
@GetMapping(value = "/payStatus") @GetMapping(value = "/payStatus")
@ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态") @ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态")
private void callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException { @Transactional(rollbackFor = Exception.class)
log.info("支付完成回调(仅代表用户点了已支付,无法确认是否真正支付)"); public ModelAndView callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException {
InsureLog.builder().type(7).createTime(new Date()).requestType(2).requestPath(base_api_url + "/payStatus?policyId=" + policyId) InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById();
.returnCode("suc").returnMsg("用户已支付,等待更新保单状态").policyId(policyId).build().insert(); 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") @PostMapping(value = "/payCallBack")
@ApiOperation(value = "9.投保支付收银台回调", httpMethod = "POST", notes = "支付完成跳转") @ApiOperation(value = "9.投保支付收银台回调", httpMethod = "POST", notes = "支付完成跳转")
private Map payCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { @Transactional(rollbackFor = Exception.class)
log.info("支付回调"); public Map payCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap(); try {
InputStream is = null; InputStream is = null;
is = request.getInputStream(); is = request.getInputStream();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
byte[] b = new byte[4096]; byte[] b = new byte[4096];
for (int n; (n = is.read(b)) != -1; ) { for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n)); sb.append(new String(b, 0, n));
} }
String value = DigestUtils.md5Hex(appid + secret + timestamp + sb.toString()); String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString());
if (!value.equals(sign)) { if (!value.equals(sign)) {
return map; throw new CustomException("投保支付收银台回调验签失败");
} }
Map paramsMap = Maps.newHashMap(); PayCallBack callBack = JSONObject.parseObject(sb.toString(), PayCallBack.class);
paramsMap.put("pid", pid); InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
paramsMap.put("timestamp", timestamp); insurePay.setAmount(Double.valueOf(callBack.getAmount()));
paramsMap.put("sign", sign); insurePay.setPayStatus(Integer.parseInt(callBack.getPay_status()));
PayCallBack callBack = JSONObject.parseObject(sb.toString(), PayCallBack.class); insurePay.setPaySerialNo(callBack.getPay_serial_no());
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number())); insurePay.setSerialNumber(callBack.getSerial_number());
insurePay.setAmount(Double.valueOf(callBack.getAmount())); insurePay.setPayType(callBack.getPay_type());
insurePay.setPayStatus(Integer.parseInt(callBack.getPay_status())); insurePay.updateById();
insurePay.setPaySerialNo(callBack.getPay_serial_no()); InsureLog.builder().type(7).createTime(new Date()).requestType(1).requestPath(base_api_url + "/callBack/policy/payCallBack")
insurePay.setSerialNumber(callBack.getSerial_number()); .returnCode("suc").returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + callBack.getAmount()).policyId(insurePay.getPolicyId()).build().insert();
insurePay.setPayType(callBack.getPay_type()); /*调用出单接口更新保单状态*/
insurePay.updateById(); Map paramsMap = Maps.newHashMap();
/*调用出单接口更新保单状态*/ paramsMap.put("pid", pid);
Map bodyMap = Maps.newHashMap(); paramsMap.put("timestamp", timestamp);
bodyMap.put("quotation_id", callBack.getSerial_number()); paramsMap.put("sign", sign);
String data = HttpUtils.sendPost(getPolicyUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap); Map bodyMap = Maps.newHashMap();
Map dataMap = JSONObject.parseObject(data, Map.class); bodyMap.put("quotation_id", callBack.getSerial_number());
if (dataMap.size() > 0) { String data = HttpUtils.sendPost(getPolicyUrl, InsureContorll.setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap);
if (dataMap.get("errcode").toString().equals("e25")) { Map dataMap = JSONObject.parseObject(data, Map.class);
//TODO 如果是E25则将保单设为出单中,更新交由保单出单回调做,设为出单状态是因为之后可以手动校验 if (dataMap.size() > 0) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById(); if (dataMap.get("errcode").toString().equals("suc") || dataMap.get("errcode").toString().equals("e25")) {
insurePolicy.setStatus("2"); //TODO 如果是E25则将保单设为出单中,更新交由保单出单回调做,设为出单状态是因为之后可以手动校验
insurePolicy.setUpdateTime(new Date()); InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
insurePolicy.updateById(); insurePolicy.setStatus("2");
InsureLog.builder().type(7).createTime(new Date()).requestType(1).requestPath(base_api_url + "/payCallBack") insurePolicy.setUpdateTime(new Date());
.returnCode("suc").returnMsg(dataMap.get("errmsg").toString()).build().insert(); insurePolicy.updateById();
} else if (dataMap.get("errcode").toString().equals("suc")) { }
InsureLog.builder().type(7).createTime(new Date()).requestType(1).requestPath(base_api_url + "/payCallBack") InsureLog.builder().requestParam(JSONObject.toJSONString(InsureContorll.setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(7)
.returnCode("suc").returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + callBack.getAmount()).policyId(insurePay.getPolicyId()).build().insert();
} else {
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(7)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(getPolicyUrl) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(getPolicyUrl)
.returnCode(dataMap.get("errcode").toString()).policyId(insurePay.getPolicyId()).returnMsg(dataMap.get("errmsg").toString()).build().insert(); .returnCode(dataMap.get("errcode").toString()).policyId(insurePay.getPolicyId()).returnMsg(dataMap.get("errmsg").toString()).build().insert();
} }
} catch (Exception e) {
log.error("投保支付收银台回调异常:",e);
throw new CustomException("投保支付收银台回调异常");
} finally {
Map map = Maps.newHashMap();
map.put("status", "1");
return map;
} }
map.put("status", "1");
return map;
} }
@PostMapping(value = "/issueCallback") @PostMapping(value = "/issueCallback")
@ApiOperation(value = "10.保单出单回调", httpMethod = "POST", notes = "支付完成跳转") @ApiOperation(value = "10.保单出单回调", httpMethod = "POST", notes = "支付完成跳转")
private Map issueCallback(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { @Transactional(rollbackFor = Exception.class)
log.info("保单出单回调"); public Map issueCallback(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap(); try {
map.put("status", "1"); InputStream is = null;
InputStream is = null; is = request.getInputStream();
is = request.getInputStream(); StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(); byte[] b = new byte[4096];
byte[] b = new byte[4096]; for (int n; (n = is.read(b)) != -1; ) {
for (int n; (n = is.read(b)) != -1; ) { sb.append(new String(b, 0, n));
sb.append(new String(b, 0, n)); }
} String value = DigestUtils.md5Hex(pid + secret + timestamp + sb.toString());
String value = DigestUtils.md5Hex(appid + secret + timestamp + sb.toString()); if (!value.equals(sign)) {
if (!value.equals(sign)) { throw new CustomException("保单出单回调验签失败");
return map; }
} PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class);
PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class); InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number())); InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById(); List<InsureUser> userList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getPolicyId, insurePolicy.getId()));
List<InsureUser> userList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getPolicyId, insurePolicy.getId())); insurePolicy.setUpdateTime(new Date());
insurePolicy.setUpdateTime(new Date()); if (callBack.getStatus().equals("1")) {
if (callBack.getStatus().equals("1")) { insurePay.setPayStatus(2);
insurePay.setPayStatus(2); insurePolicy.setPolicyNo(callBack.getPolicy_no());
insurePolicy.setPolicyNo(callBack.getPolicy_no()); insurePolicy.setTotalPremium(callBack.getTotal_premium());
insurePolicy.setTotalPremium(callBack.getTotal_premium()); insurePolicy.setPolicyFile(callBack.getPolicy_file());
insurePolicy.setPolicyFile(callBack.getPolicy_file()); insurePolicy.setStatus("1");
insurePolicy.setStatus("1"); insurePolicy.setKitUrl(callBack.getKit_url());
insurePolicy.setKitUrl(callBack.getKit_url()); userList.forEach(u -> {
userList.forEach(u -> { u.setStatus("1");
u.setStatus("1"); u.setInsureStatus(1);
u.setInsureStatus(1); u.updateById();
u.updateById(); });
}); } else {
} else { insurePay.setPayStatus(3);
insurePay.setPayStatus(3); insurePolicy.setStatus("3");
insurePolicy.setStatus("3"); userList.forEach(u -> {
userList.forEach(u -> { u.setStatus("2");
u.setStatus("2"); u.setInsureStatus(2);
u.setInsureStatus(2); u.updateById();
u.updateById(); });
}); }
insurePolicy.updateById(); insurePolicy.updateById();
insurePay.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;
} }
InsureLog.builder().type(7).createTime(new Date()).requestType(1).returnBody(sb.toString()).requestPath(getPolicyUrl)
.returnCode(callBack.getStatus()).policyId(insurePay.getPolicyId()).returnMsg(callBack.getErr_msg()).build().insert();
return map;
} }
} }
...@@ -9,6 +9,7 @@ import cn.timer.api.bean.insure.InsureApplicant; ...@@ -9,6 +9,7 @@ import cn.timer.api.bean.insure.InsureApplicant;
import cn.timer.api.bean.qyzx.QyzxEntInfoM; import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dao.insure.InsureApplicantMapper; import cn.timer.api.dao.insure.InsureApplicantMapper;
import cn.timer.api.dto.insure.InsureDto; import cn.timer.api.dto.insure.InsureDto;
import cn.timer.api.utils.HttpUtils; import cn.timer.api.utils.HttpUtils;
...@@ -45,36 +46,49 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -45,36 +46,49 @@ import org.springframework.web.multipart.MultipartFile;
@Transactional @Transactional
@RequestMapping(value = "/insureApplicant", produces = {"application/json"}) @RequestMapping(value = "/insureApplicant", produces = {"application/json"})
public class InsureApplicantController { public class InsureApplicantController {
private static final Logger log = LoggerFactory.getLogger(InsureApplicantController.class);
@PostMapping("/insureApplicationSetting") @PostMapping("/insureApplicationSetting")
@ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请") @ApiOperation(value = "设置投保人", httpMethod = "POST", notes = "投保申请")
private Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) { @Transactional(rollbackFor = Exception.class)
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,params.getOrgCode())); public Result<Object> insureApplicationSetting(@RequestBody InsureApplicant params) {
params.setId(insureApplicant.getId()); try {
params.updateById(); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, params.getOrgCode()));
return ResultUtil.data(params); params.setId(insureApplicant.getId());
params.updateById();
return ResultUtil.data(params);
} catch (Exception e) {
log.error("设置投保人异常:",e);
throw new CustomException("设置投保人异常");
}
} }
@GetMapping("/getApplicantAdmin") @GetMapping("/getApplicantAdmin")
@ApiOperation(value = "获取投保人--运营后台", httpMethod = "GET", notes = "获取投保人") @ApiOperation(value = "获取投保人--运营后台", httpMethod = "GET", notes = "获取投保人")
private Result<Object> getApplicant(@RequestParam("orgCode") Integer orgCode) { @Transactional(rollbackFor = Exception.class)
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,orgCode)); public Result<Object> getApplicant(@RequestParam("orgCode") Integer orgCode) {
if(insureApplicant==null){ try {
QyzxEntInfoM qyzxEntInfoM=QyzxEntInfoM.builder().id(orgCode).build().selectById(); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, orgCode));
insureApplicant = getInsureApplicant(qyzxEntInfoM); if (insureApplicant == null) {
insureApplicant.setOrgCode(orgCode); QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(orgCode).build().selectById();
insureApplicant.insert(); insureApplicant = getInsureApplicant(qyzxEntInfoM);
insureApplicant.setOrgCode(orgCode);
insureApplicant.insert();
}
return ResultUtil.data(insureApplicant);
} catch (Exception e) {
log.error("获取投保人异常:",e);
throw new CustomException("获取投保人异常");
} }
return ResultUtil.data(insureApplicant);
} }
private InsureApplicant getInsureApplicant(QyzxEntInfoM qyzxEntInfoM) { private InsureApplicant getInsureApplicant(QyzxEntInfoM qyzxEntInfoM) {
InsureApplicant insureApplicant; InsureApplicant insureApplicant;
insureApplicant=new InsureApplicant(); insureApplicant = new InsureApplicant();
insureApplicant.setApplicantEName(qyzxEntInfoM.getName()); insureApplicant.setApplicantEName(qyzxEntInfoM.getName());
insureApplicant.setApplicantEAddress(qyzxEntInfoM.getWorkAddress()); insureApplicant.setApplicantEAddress(qyzxEntInfoM.getWorkAddress());
insureApplicant.setApplicantEContacts(qyzxEntInfoM.getOperName());/*这里为避免联系人为空,默认使用法人*/ insureApplicant.setApplicantEContacts(qyzxEntInfoM.getLinkMan());
insureApplicant.setApplicantEPhone(qyzxEntInfoM.getPhone());/*这里为避免联系人为空,默认使用法人*/ insureApplicant.setApplicantEPhone(qyzxEntInfoM.getPhone());/*这里为避免联系人为空,默认使用法人*/
insureApplicant.setApplicantType("2"); insureApplicant.setApplicantType("2");
insureApplicant.setApplicantENoType("3646"); insureApplicant.setApplicantENoType("3646");
...@@ -85,15 +99,21 @@ public class InsureApplicantController { ...@@ -85,15 +99,21 @@ public class InsureApplicantController {
@GetMapping("/getApplicant") @GetMapping("/getApplicant")
@ApiOperation(value = "获取投保人--8小时", httpMethod = "GET", notes = "获取投保人") @ApiOperation(value = "获取投保人--8小时", httpMethod = "GET", notes = "获取投保人")
private Result<Object> getApplicant(@CurrentUser UserBean userBean) { @Transactional(rollbackFor = Exception.class)
InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode,userBean.getOrgCode())); public Result<Object> getApplicant(@CurrentUser UserBean userBean) {
if(insureApplicant==null){ try {
QyzxEntInfoM qyzxEntInfoM=QyzxEntInfoM.builder().id(userBean.getOrgCode()).build().selectById(); InsureApplicant insureApplicant = InsureApplicant.builder().build().selectOne(new QueryWrapper<InsureApplicant>().lambda().eq(InsureApplicant::getOrgCode, userBean.getOrgCode()));
insureApplicant = getInsureApplicant(qyzxEntInfoM); if (insureApplicant == null) {
insureApplicant.setOrgCode(userBean.getOrgCode()); QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().id(userBean.getOrgCode()).build().selectById();
insureApplicant.insert(); insureApplicant = getInsureApplicant(qyzxEntInfoM);
insureApplicant.setOrgCode(userBean.getOrgCode());
insureApplicant.insert();
}
return ResultUtil.data(insureApplicant);
} catch (Exception e) {
log.error("获取投保人异常:",e);
throw new CustomException("获取投保人异常");
} }
return ResultUtil.data(insureApplicant);
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -114,6 +114,7 @@ public class InsureUserController{ ...@@ -114,6 +114,7 @@ public class InsureUserController{
policyDto.setCategoryId(categoryId); policyDto.setCategoryId(categoryId);
List<PolicyDto> list = insureUserMapper.selectPolicyList(policyDto); List<PolicyDto> list = insureUserMapper.selectPolicyList(policyDto);
String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Scheme_name", "Date_start", "Branch", "Tricycle_frame_number", "benefit_occupation_category"}; String[] rowName = new String[]{"ID", "name", "ID_type", "ID_number", "Scheme_name", "Date_start", "Branch", "Tricycle_frame_number", "benefit_occupation_category"};
/*XSSFWorkbook xssfWorkbook = ExcelUtils.exportExcel("导出人员清单.xlsx", rowName, list);*/ // for ()
// XSSFWorkbook xssfWorkbook = ExcelUtils.exportExcel("导出人员清单.xlsx", rowName, list);
} }
} }
...@@ -5,6 +5,7 @@ import cn.timer.api.bean.insure.InsureLog; ...@@ -5,6 +5,7 @@ import cn.timer.api.bean.insure.InsureLog;
import cn.timer.api.bean.insure.InsurePolicy; import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser; import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dao.insure.InsurePolicyMapper; import cn.timer.api.dao.insure.InsurePolicyMapper;
import cn.timer.api.dao.insure.InsureUserMapper; import cn.timer.api.dao.insure.InsureUserMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper; import cn.timer.api.dao.yggl.YgglMainEmpMapper;
...@@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;
...@@ -36,10 +38,13 @@ public class InsureTaskTiming { ...@@ -36,10 +38,13 @@ public class InsureTaskTiming {
private YgglMainEmpMapper ygglMainEmpMapper; private YgglMainEmpMapper ygglMainEmpMapper;
@Scheduled(cron = "0 0 0 1 * ?")//每月第一天 @Scheduled(cron = "0 0 0 1 * ?")//每月第一天
public void updateInsureStatusTask() throws ParseException { @Transactional(rollbackFor = Exception.class)
Date now = DateUtil.date(); public void updateInsureStatusTask(){
/*获取正常的保单*/ try {
List<InsurePolicy> insurePolicyList = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus, "1").lt(InsurePolicy::getPolicyDateEnd,now));
Date now = DateUtil.date();
/*获取正常的保单*/
List<InsurePolicy> insurePolicyList = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus, "1").lt(InsurePolicy::getPolicyDateEnd, now));
if (insurePolicyList.size() > 0) { if (insurePolicyList.size() > 0) {
/*获取已经过期保单*/ /*获取已经过期保单*/
for (InsurePolicy insurePolicy : insurePolicyList) { for (InsurePolicy insurePolicy : insurePolicyList) {
...@@ -48,14 +53,20 @@ public class InsureTaskTiming { ...@@ -48,14 +53,20 @@ public class InsureTaskTiming {
.eq(InsureUser::getInsureStatus, 1)); .eq(InsureUser::getInsureStatus, 1));
if (insureUsersList.size() > 0) { if (insureUsersList.size() > 0) {
int count = ygglMainEmpMapper.updateInsure(insureUsersList.stream().map(InsureUser::getUserId).toArray(Integer[]::new)); int count = ygglMainEmpMapper.updateInsure(insureUsersList.stream().map(InsureUser::getUserId).toArray(Integer[]::new));
log.info("总共更新员工投保状态", count); log.info("总共更新员工投保状态:"+count);
int uCount = insureUserMapper.updateInsure(insurePolicyList.stream().map(InsurePolicy::getId).toArray(Integer[]::new)); int uCount = insureUserMapper.updateInsure(insurePolicyList.stream().map(InsurePolicy::getId).toArray(Integer[]::new));
log.info("总共更新投保人投保状态", uCount); log.info("总共更新投保人投保状态:"+uCount);
} }
insurePolicy.setStatus("3"); insurePolicy.setStatus("3");
insurePolicy.updateById(); insurePolicy.updateById();
InsureLog.builder().type(7)
.createTime(new Date()).requestType(1).returnMsg("保单已到期,自动失效").policyId(insurePolicy.getId()).build().insert();
} }
} }
log.error("暂无过期保单"); log.error("暂无过期保单");
}catch (Exception e){
e.printStackTrace();
throw new CustomException("保单失效定时器异常");
}
} }
} }
...@@ -657,10 +657,10 @@ public class QyzxController { ...@@ -657,10 +657,10 @@ public class QyzxController {
*/ */
@PostMapping(value = "/companyAdminList") @PostMapping(value = "/companyAdminList")
@ApiOperation(value = "运营后台---企业信息列表", httpMethod = "POST", notes = "") @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(); Map map = Maps.newHashMap();
List<EntInfoDto> list = Optional.ofNullable(qyzxEntInfoMMapper.companyAdminList(page)).orElse(Lists.newArrayList()); List<EntInfoDto> list = Optional.ofNullable(qyzxEntInfoMMapper.companyAdminList(entInfoDto)).orElse(Lists.newArrayList());
Integer count = qyzxEntInfoMMapper.companyAdminCount(); Integer count = qyzxEntInfoMMapper.companyAdminCount(entInfoDto);
map.put("list",list); map.put("list",list);
map.put("count",count); map.put("count",count);
return ResultUtil.data(map); return ResultUtil.data(map);
......
...@@ -210,7 +210,7 @@ public class ZpglServiceImpl implements ZpglService { ...@@ -210,7 +210,7 @@ public class ZpglServiceImpl implements ZpglService {
messageTemplate = ZpglMessageTemplate.OFFER_ENTRYING; messageTemplate = ZpglMessageTemplate.OFFER_ENTRYING;
} }
detail = ZpglMessageTemplate.print(messageTemplate, new String[]{ 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; break;
case 10: case 10:
......
...@@ -25,9 +25,11 @@ public interface InsurePolicyMapper extends BaseMapper<InsurePolicy> { ...@@ -25,9 +25,11 @@ public interface InsurePolicyMapper extends BaseMapper<InsurePolicy> {
PolicyDto getPolicyDetail(@Param("id")Integer id); PolicyDto getPolicyDetail(@Param("id")Integer id);
Integer totalPolicy(@Param("policy")PolicyDto policyDto); Integer totalPolicy(@Param("policy")PolicyDto policyDto);
List<PolicyDto> policyTotalList(); 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); List<InsurePolicy> selectPolicyListByStatus(@Param("date") Date date);
Integer selectPlansTotalByorgCode(@Param("orgCode")Integer id); Integer selectPlansTotalByorgCode(@Param("orgCode")Integer id);
} }
...@@ -18,9 +18,9 @@ import java.util.Map; ...@@ -18,9 +18,9 @@ import java.util.Map;
*/ */
@Repository @Repository
public interface QyzxEntInfoMMapper extends BaseMapper<QyzxEntInfoM> { 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(); public List<Map<String,String>> getCompanyList();
......
...@@ -2,6 +2,8 @@ package cn.timer.api.dto.insure; ...@@ -2,6 +2,8 @@ package cn.timer.api.dto.insure;
import lombok.Data; import lombok.Data;
import java.util.Date;
/** /**
* @Description TODO * @Description TODO
* @Author wgd * @Author wgd
...@@ -9,10 +11,13 @@ import lombok.Data; ...@@ -9,10 +11,13 @@ import lombok.Data;
*/ */
@Data @Data
public class InsureUserDto { public class InsureUserDto {
private Integer id;
private Integer policyId; private Integer policyId;
private String benefitBasicPlan; private String benefitBasicPlan;
private String benefitOccupationCategory; private String benefitOccupationCategory;
private Integer totalUser; private Integer totalUser;
private String[] oldIds; private String[] oldIds;
private String policyNo; private String policyNo;
private String name;
private Date updateTime;
} }
...@@ -45,4 +45,6 @@ public class PolicyDto { ...@@ -45,4 +45,6 @@ public class PolicyDto {
private Integer policyId; private Integer policyId;
private Integer applyType; private Integer applyType;
private String monthD; private String monthD;
private String userName;
private String companyName;
} }
package cn.timer.api.dto.qyzx; package cn.timer.api.dto.qyzx;
import cn.timer.api.utils.Page;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -26,4 +27,5 @@ public class EntInfoDto { ...@@ -26,4 +27,5 @@ public class EntInfoDto {
private String endTime; private String endTime;
private Integer totlaSpmk; private Integer totlaSpmk;
private Integer totlaCc; private Integer totlaCc;
private Page page;
} }
...@@ -504,7 +504,7 @@ public class ExcelUtils { ...@@ -504,7 +504,7 @@ public class ExcelUtils {
} else if (xssfCell.getCellTypeEnum() == CellType.BOOLEAN) { } else if (xssfCell.getCellTypeEnum() == CellType.BOOLEAN) {
return String.valueOf(xssfCell.getBooleanCellValue()); return String.valueOf(xssfCell.getBooleanCellValue());
} else { } else {
return xssfCell.getStringCellValue(); return xssfCell.getStringCellValue().trim();
} }
} }
} }
......
...@@ -8,11 +8,15 @@ import java.util.*; ...@@ -8,11 +8,15 @@ import java.util.*;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import cn.timer.api.config.sftp.SftpConfiguration;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; 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.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.bouncycastle.jce.exception.ExtIOException; import org.bouncycastle.jce.exception.ExtIOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -77,6 +81,11 @@ public class OSSUtil { ...@@ -77,6 +81,11 @@ public class OSSUtil {
@Value("${zip.path}") @Value("${zip.path}")
private String zipPath; private String zipPath;
@Autowired
private SftpConfiguration config;
/** /**
* 1.创建储存空间 sout控制台輸出 储存空间名 * 1.创建储存空间 sout控制台輸出 储存空间名
* *
...@@ -594,10 +603,10 @@ public class OSSUtil { ...@@ -594,10 +603,10 @@ public class OSSUtil {
String Suffix; String Suffix;
try { try {
File folder = new File(zipPath); File folder = new File(zipPath);
if(!folder.exists()&& !folder .isDirectory()){ if (!folder.exists() && !folder.isDirectory()) {
folder.mkdirs(); folder.mkdirs();
} }
fos = new FileOutputStream(zipPath+fileName); fos = new FileOutputStream(zipPath + fileName);
zos = new ZipOutputStream(fos); zos = new ZipOutputStream(fos);
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
for (String m : urlMap.keySet()) { for (String m : urlMap.keySet()) {
...@@ -641,4 +650,68 @@ public class OSSUtil { ...@@ -641,4 +650,68 @@ public class OSSUtil {
} }
return fileName; 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;
}
} }
...@@ -107,4 +107,4 @@ public class RemindUtil implements SchedulingConfigurer { ...@@ -107,4 +107,4 @@ public class RemindUtil implements SchedulingConfigurer {
return new Exception().getStackTrace()[0].getMethodName(); return new Exception().getStackTrace()[0].getMethodName();
} }
} }
\ No newline at end of file
...@@ -282,25 +282,39 @@ youling: ...@@ -282,25 +282,39 @@ youling:
h5: h5:
url: 'http://javays.com' url: 'http://javays.com'
insure: insure:
#投保 #投保 appid
appid: '1002303100602312445' appid: '1002303100602312445'
#投保 secret
secret: 'acb329868c31d5b3ba03de40dac13dd9' secret: 'acb329868c31d5b3ba03de40dac13dd9'
#投保上传文件
uploadUrl: 'http://sandbox.portal.unistar-ins.com/service/Home/Index/fileUpload' uploadUrl: 'http://sandbox.portal.unistar-ins.com/service/Home/Index/fileUpload'
#投保立即出单
insuredUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuotePolicy' insuredUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuotePolicy'
#投保请求出单
getPolicyUrl: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/index' getPolicyUrl: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/index'
#查询保单信息 #查询保单信息
policyDetail: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/policy' policyDetail: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/policy'
#申请保单
createQuote: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuote' createQuote: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuote'
#投保支付
toPayUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Pay/toPay' toPayUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Pay/toPay'
#保全支付
batchToPayUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/ImportPay/set_import_pay' batchToPayUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/ImportPay/set_import_pay'
#保全 #保全appid
appidq: '1000115041006006938' appidq: '1000115041006006938'
#保全 secret
secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b' secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b'
#保全上传文件
uploadUrlq: 'http://sandbox.portal.unistar-ins.com/fuli/Home/Index/file_upload' uploadUrlq: 'http://sandbox.portal.unistar-ins.com/fuli/Home/Index/file_upload'
#保全申请
batchUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/WelfareProduct/batch_declare' 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' cancelPayment: 'http://sandbox.portal.unistar-ins.com/fuli/Home/OrderImport/order_import_set'
# base_api_url # base_api_url
BASE_API_URL: 'http://o49t563035.qicp.vip' BASE_API_URL: 'http://o49t563035.qicp.vip'
#支付回调
pay_page: 'http://localhost:9527'
...@@ -261,21 +261,42 @@ wxgzh: ...@@ -261,21 +261,42 @@ wxgzh:
encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX' encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX'
insure: insure:
#投保 #投保 appid
appid: '1002209110212305335' appid: '1002209110212305335'
#投保 secret
secret: '1ef7b79471be7f6b5489832c65109f81' secret: '1ef7b79471be7f6b5489832c65109f81'
#投保上传文件
uploadUrl: 'https://portal.unistar-ins.com/service/Home/Index/fileUpload' uploadUrl: 'https://portal.unistar-ins.com/service/Home/Index/fileUpload'
#投保立即出单
insuredUrl: 'https://portal.unistar-ins.com/mall/Home/Index/createQuotePolicy' 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' policyDetail: 'https://portal.unistar-ins.com/issuing/Home/Index/policy'
#保全 #保全appid
appidq: '1000711000604326196' appidq: '1000711000604326196'
#保全 secret
secretq: 'a2da17a2797c63dff9172df50af9da65' secretq: 'a2da17a2797c63dff9172df50af9da65'
#保全上传文件
uploadUrlq: 'https://portal.unistar-ins.com/fuli/Home/Index/file_upload' uploadUrlq: 'https://portal.unistar-ins.com/fuli/Home/Index/file_upload'
#保全申请
batchUrl: 'https://portal.unistar-ins.com/fuli/Home/WelfareProduct/batch_declare' batchUrl: 'https://portal.unistar-ins.com/fuli/Home/WelfareProduct/batch_declare'
#保全取消支付
cancelPayment: 'https://portal.unistar-ins.com/fuli/Home/OrderImport/order_import_set'
youling: youling:
serverUrl: 'https://www.youlingrc.com' serverUrl: 'https://www.youlingrc.com'
#h5服务地址 #h5服务地址
h5: h5:
url: 'http://h5.8timer.cn' url: 'http://h5.8timer.cn'
\ No newline at end of file #支付回调
pay_page: 'http://oss.8timer.cn'
...@@ -254,32 +254,43 @@ wxgzh: ...@@ -254,32 +254,43 @@ wxgzh:
encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX' encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX'
insure: insure:
#投保 #投保 appid
appid: '1002303100602312445' appid: '1002303100602312445'
#投保 secret
secret: 'acb329868c31d5b3ba03de40dac13dd9' secret: 'acb329868c31d5b3ba03de40dac13dd9'
#投保上传文件
uploadUrl: 'http://sandbox.portal.unistar-ins.com/service/Home/Index/fileUpload' uploadUrl: 'http://sandbox.portal.unistar-ins.com/service/Home/Index/fileUpload'
#投保立即出单
insuredUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuotePolicy' insuredUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuotePolicy'
#投保请求出单
getPolicyUrl: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/index' getPolicyUrl: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/index'
#查询保单信息 #查询保单信息
policyDetail: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/policy' policyDetail: 'http://sandbox.portal.unistar-ins.com/issuing/Home/Index/policy'
#申请保单
createQuote: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuote' createQuote: 'http://sandbox.portal.unistar-ins.com/mall/Home/Index/createQuote'
#投保支付
toPayUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Pay/toPay' toPayUrl: 'http://sandbox.portal.unistar-ins.com/mall/Home/Pay/toPay'
#保全支付
batchToPayUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/ImportPay/set_import_pay' batchToPayUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/ImportPay/set_import_pay'
#保全 #保全appid
appidq: '1000115041006006938' appidq: '1000115041006006938'
#保全 secret
secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b' secretq: '6ba1bf4aa0bd14368c95ff0b9934a17b'
#保全上传文件
uploadUrlq: 'http://sandbox.portal.unistar-ins.com/fuli/Home/Index/file_upload' uploadUrlq: 'http://sandbox.portal.unistar-ins.com/fuli/Home/Index/file_upload'
#保全申请
batchUrl: 'http://sandbox.portal.unistar-ins.com/fuli/Home/WelfareProduct/batch_declare' 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' cancelPayment: 'http://sandbox.portal.unistar-ins.com/fuli/Home/OrderImport/order_import_set'
youling:
serverUrl: 'http://227387db45.51vip.biz'
#h5服务地址 #h5服务地址
h5: h5:
url: 'http://javays.com' url: 'http://javays.com'
#支付回调
pay_page: 'http://test-insurance-api.youlingrc.com'
spring: spring:
profiles: profiles:
active: test active: dev
#active: '@environment@' #active: '@environment@'
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<result property="payType" column="pay_type"/> <result property="payType" column="pay_type"/>
<result property="policyId" column="policy_id"/> <result property="policyId" column="policy_id"/>
<result property="serialNumber" column="serial_number"/> <result property="serialNumber" column="serial_number"/>
<result property="payUrl" column="pay_url"/>
</resultMap> </resultMap>
......
...@@ -268,6 +268,12 @@ ...@@ -268,6 +268,12 @@
<if test="policy.policyDateStart!=null and policy.policyDateStart!=''"> <if test="policy.policyDateStart!=null and policy.policyDateStart!=''">
and ip.policy_date_start <![CDATA[ >= ]]> #{policy.policyDateStart} and ip.policy_date_start <![CDATA[ >= ]]> #{policy.policyDateStart}
</if> </if>
<if test="policy.companyName!=null and policy.companyName!=''">
and qy.name like CONCAT('%',#{policy.companyName},'%')
</if>
<if test="policy.policyNo!=null and policy.policyNo!=''">
and ip.policy_no like CONCAT('%',#{policy.policyNo},'%')
</if>
</where> </where>
GROUP BY ip.id GROUP BY ip.id
order by ip.create_time desc order by ip.create_time desc
...@@ -319,17 +325,17 @@ ...@@ -319,17 +325,17 @@
<select id="policyTotalList" resultType="cn.timer.api.dto.insure.PolicyDto"> <select id="policyTotalList" resultType="cn.timer.api.dto.insure.PolicyDto">
SELECT SELECT
ip.id as id, ip.id AS id,
ip.name AS schemeName, ip.NAME AS schemeName,
ip.type AS type, ip.type AS type,
count(ipp.id) AS totaPolicy, (select count(id) from insure_policy WHERE product_id=ip.id ) AS totaPolicy,
count(ipp.org_code) AS totalCompany, (select count(org_code) from insure_policy WHERE product_id=ip.id) as totalCompany,
count( iu.id ) AS totalUser, count( iu.id ) AS totalUser,
sum(iu.price) as totalPremium, sum( iu.price ) AS totalPremium,
ipp.update_time AS updateTime ipp.update_time AS updateTime
FROM FROM
insure_product ip insure_product ip
LEFT JOIN insure_policy ipp ON ipp.product_id = ip.id LEFT JOIN insure_policy ipp ON ipp.product_id = ip.id and ipp.`status`=1
LEFT JOIN insure_user iu ON iu.policy_id = ipp.id LEFT JOIN insure_user iu ON iu.policy_id = ipp.id
WHERE WHERE
ip.is_del = 0 ip.is_del = 0
...@@ -337,22 +343,38 @@ ...@@ -337,22 +343,38 @@
ip.id ip.id
</select> </select>
<select id="selectPlansListByorgCode" resultType="cn.timer.api.dto.insure.InsureUserDto"> <select id="selectPolicyListByorgCode" resultType="cn.timer.api.dto.insure.InsureUserDto">
SELECT SELECT
ip.id as policyId, ip.id as id,
ip.policy_no as policyNo, ip.policy_no as policyNo,
iu.benefit_basic_plan as benefitBasicPlan, ir.name,
iu.benefit_occupation_category as benefitOccupationCategory, ip.update_time as updateTime
count(iu.id) as totalUser
FROM FROM
insure_policy ip 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} WHERE ip.org_code=#{orgCode}
GROUP BY <if test="policy.policyNo !=null and policy.policyNo!=''">
ip.id, and ip.policy_no = #{policy.policyNo}
iu.benefit_basic_plan, </if>
iu.benefit_occupation_category 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>
<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 id="selectPlansTotalByorgCode" resultType="java.lang.Integer">
SELECT SELECT
count(ip.id) count(ip.id)
......
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
<select id="selectPolicyList" resultType="cn.timer.api.dto.insure.PolicyDto"> <select id="selectPolicyList" resultType="cn.timer.api.dto.insure.PolicyDto">
select 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.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.user_id as userId,iu.batch_no as batchNo,iu.benefit_occupation_category as benefitOccupationCategory,
iu.policy_id as policyId, iu.policy_id as policyId,
...@@ -329,6 +329,12 @@ ...@@ -329,6 +329,12 @@
<if test="policyDto.policyDateStart !=null and policyDto.policyDateStart !='' and policyDto.policyDateEnd !=null and policyDto.policyDateEnd !=''"> <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} and iu.create_time BETWEEN #{policyDto.policyDateStart} and #{policyDto.policyDateEnd}
</if> </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> </where>
order by iu.create_time desc order by iu.create_time desc
......
...@@ -217,15 +217,37 @@ ...@@ -217,15 +217,37 @@
LEFT JOIN yggl_main_emp yme ON yme.org_code = qeim.id 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 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 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 GROUP BY
qeim.id qeim.id
<if test="page.offset != null and page.totalPage !=null"> <if test="param.page.currentPage != null and param.page.totalPage !=null">
limit #{page.offset},#{page.totalPage} limit #{param.page.offset},#{param.page.totalPage}
</if> </if>
</select> </select>
<select id="companyAdminCount" resultType="java.lang.Integer"> <select id="companyAdminCount" resultType="java.lang.Integer">
select count(qeim.id) from qyzx_ent_info_m qeim select count(qeim.id) from qyzx_ent_info_m qeim
<where>
<if test="param.name != null and param.name !=''">
and qeim.NAME like CONCAT('%',#{param.name},'%')
</if>
<if test="param.linkMan != null and param.linkMan !=''">
and qeim.link_man like CONCAT('%',#{param.linkMan},'%')
</if>
<if test="param.linkManPhone != null and param.linkManPhone !=''">
and qeim.phone like CONCAT('%',#{param.linkManPhone},'%')
</if>
</where>
</select> </select>
<select id ="getCompanyList" resultType="java.util.HashMap"> <select id ="getCompanyList" resultType="java.util.HashMap">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment