Commit 2718f5f4 by jianan

新单跟进v2

parent b5eba8fc
...@@ -643,8 +643,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService { ...@@ -643,8 +643,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
// follow.setReconciliationCompanyBizId(); // follow.setReconciliationCompanyBizId();
//TODO 续保日期 //TODO 续保日期
// follow.setRenewalDate(); // follow.setRenewalDate();
// 用户业务员id
follow.setUserBizId(appointment.getCreatorId());
if (!Objects.isNull(apiInsurantInfoDto)) { if (!Objects.isNull(apiInsurantInfoDto)) {
// 受保人 // 受保人
follow.setInsured(apiInsurantInfoDto.getNameCn()); follow.setInsured(apiInsurantInfoDto.getNameCn());
...@@ -656,7 +655,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService { ...@@ -656,7 +655,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
if (!Objects.isNull(apiProductPlanMainInfoDto)) { if (!Objects.isNull(apiProductPlanMainInfoDto)) {
//币种 //币种
follow.setCurrency(apiProductPlanMainInfoDto.getPolicyCurrency()); follow.setPolicyCurrency(apiProductPlanMainInfoDto.getPolicyCurrency());
//生效日期 //生效日期
// if (!Objects.isNull(apiProductPlanMainInfoDto.getPolicyEffectiveDate())) { // if (!Objects.isNull(apiProductPlanMainInfoDto.getPolicyEffectiveDate())) {
// follow.setEffectiveDate(Date.from(apiProductPlanMainInfoDto.getPolicyEffectiveDate().atZone(ZoneId.systemDefault()).toInstant())); // follow.setEffectiveDate(Date.from(apiProductPlanMainInfoDto.getPolicyEffectiveDate().atZone(ZoneId.systemDefault()).toInstant()));
...@@ -665,19 +664,9 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService { ...@@ -665,19 +664,9 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
follow.setInitialPremium(apiProductPlanMainInfoDto.getEachIssuePremium()); follow.setInitialPremium(apiProductPlanMainInfoDto.getEachIssuePremium());
//保险公司 //保险公司
follow.setInsuranceCompany(apiProductPlanMainInfoDto.getCompanyName()); follow.setInsuranceCompany(apiProductPlanMainInfoDto.getCompanyName());
//是否预缴
follow.setIsPrepaid(apiProductPlanMainInfoDto.getIsPrepay());
//供款年期
if (StringUtils.isNotBlank(apiProductPlanMainInfoDto.getIssueNumber())) {
follow.setPaymentTerm(apiProductPlanMainInfoDto.getIssueNumber());
if (follow.getPaymentTerm() == null) {
follow.setPaymentTerm(productPlan.getIssueNumber());
}
}
//产品名称 //产品名称
follow.setProductName(apiProductPlanMainInfoDto.getProductLaunchMainName()); follow.setProductName(apiProductPlanMainInfoDto.getProductLaunchMainName());
//签单员列表
setSignerList(follow, appointment);
} }
policyFollowService.saveOrUpdate(follow); policyFollowService.saveOrUpdate(follow);
...@@ -720,7 +709,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService { ...@@ -720,7 +709,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
signer.setEmail(appointment.getBusinessRepresentEmail1()); signer.setEmail(appointment.getBusinessRepresentEmail1());
} }
signerList.add(signer); signerList.add(signer);
follow.setSignerList(GSONUtil.toJson(signerList));
} }
private void savePolicyQuestionnaire(String appointmentBizId, String policyBizId) { private void savePolicyQuestionnaire(String appointmentBizId, String policyBizId) {
......
...@@ -20,35 +20,53 @@ public class PolicyFollowUpdateDto implements Serializable { ...@@ -20,35 +20,53 @@ public class PolicyFollowUpdateDto implements Serializable {
private String policyBizId; private String policyBizId;
/** /**
* 客户名称
*/
@Schema(description = "客户名称")
private String customerName;
/**
* 客户编号 * 客户编号
*/ */
@Schema(description = "客户编号") @Schema(description = "客户编号")
private String customerBizId; private String customerBizId;
/** /**
* 签单日期
*/
@Schema(description = "签单日期", format = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date signDate;
/**
* 签单员
*/
@Schema(description = "签单员")
private PolicySigner signer;
/**
* 签单员执业编号
*/
@Schema(description = "签单员执业编号")
private String signerRegNo;
/**
* 签单地点
*/
@Schema(description = "签单地点")
private String signLocation;
/**
* 保单号 * 保单号
*/ */
@Schema(description = "保单号") @Schema(description = "保单号")
private String policyNo; private String policyNo;
/** /**
* 签单日期 * 产品计划业务id
*/ */
@Schema(description = "签单日期", format = "yyyy-MM-dd") @Schema(description = "产品计划业务id")
@JsonFormat(pattern = "yyyy-MM-dd") private String productLaunchBizId;
private Date signDate;
/** /**
* 签单员列表 * 产品名称
*/ */
@Schema(description = "签单员列表") @Schema(description = "产品名称")
private List<PolicySigner> signerList; private String productName;
/** /**
* 冷静期天数 * 冷静期天数
...@@ -77,41 +95,8 @@ public class PolicyFollowUpdateDto implements Serializable { ...@@ -77,41 +95,8 @@ public class PolicyFollowUpdateDto implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date renewalDate; private Date renewalDate;
/**
* 供款年期
*/
@Schema(description = "供款年期")
private Integer paymentTerm;
/**
* 期交保费
*/
@Schema(description = "期交保费")
private BigDecimal paymentPremium;
/**
* 是否预缴: 0-否, 1-是
*/
@Schema(description = "是否预缴: 0-否, 1-是")
private Integer isPrepaid;
/**
* 预缴年期
*/
@Schema(description = "预缴年期")
private Integer prepaidTerm;
/**
* 产品计划业务id
*/
@Schema(description = "产品计划业务id")
private String productLaunchBizId;
/**
* 产品名称
*/
@Schema(description = "产品名称")
private String productName;
/** /**
* 产品类别 * 产品类别
...@@ -156,45 +141,10 @@ public class PolicyFollowUpdateDto implements Serializable { ...@@ -156,45 +141,10 @@ public class PolicyFollowUpdateDto implements Serializable {
private String insured; private String insured;
/** /**
* 币种 * 保单币种
*/ */
@Schema(description = "币种") @Schema(description = "保单币种")
private String currency; private String policyCurrency;
/**
* 首期保费(不含徽费,预缴保费)
*/
@Schema(description = "首期保费(不含徽费,预缴保费)")
private Object initialPremium;
/**
* 保单征费
*/
@Schema(description = "保单征费")
private String policyLevy;
/**
* 首期已交保费
*/
@Schema(description = "首期已交保费")
private String initialPremiumPaid;
/**
* 首期待交保费
*/
@Schema(description = "首期待交保费")
private String initialPremiumDue;
/**
* 最晚缴费日期
*/
@Schema(description = "最晚缴费日期 格式: yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date latestPaymentDate;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
} }
package com.yd.csf.service.model; package com.yd.csf.service.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
/** /**
...@@ -45,14 +43,14 @@ public class PolicyFollow implements Serializable { ...@@ -45,14 +43,14 @@ public class PolicyFollow implements Serializable {
private String appointmentNo; private String appointmentNo;
/** /**
* 户业务id * 户业务id
*/ */
private String userBizId; private String customerBizId;
/** /**
* 客户业务id * 递交日期
*/ */
private String customerBizId; private Date submitDate;
/** /**
* 客户名称 * 客户名称
...@@ -60,64 +58,114 @@ public class PolicyFollow implements Serializable { ...@@ -60,64 +58,114 @@ public class PolicyFollow implements Serializable {
private String customerName; private String customerName;
/** /**
* 递交日期 * 签单日期
*/ */
private Date submitDate; private Date signDate;
/** /**
* 签单日期 * 签单
*/ */
private Date signDate; private String signer;
/** /**
* 签单员列表 * 签单人业务id
*/ */
private String signerList; private String signerBizId;
/** /**
* 缮发日期 * 签单人执业编号
*/ */
private Date issueDate; private String signerRegNo;
/** /**
* 生效日期 * 签单地点
*/ */
private Date effectiveDate; private String signLocation;
/** /**
* 核保日期 * 缮发日期
*/ */
private Date underwritingDate; private Date issueDate;
/** /**
* 冷期结束日期 * 冷期结束日期
*/ */
private Date coolingOffEndDate; private Date coolingOffEndDate;
/** /**
* 冷期天数 * 冷期天数
*/ */
private Integer coolingOffDays; private Integer coolingOffDays;
/** /**
* 核保日期
*/
private Date underwritingDate;
/**
* 生效日期
*/
private Date effectiveDate;
/**
* 续保日期 * 续保日期
*/ */
private Date renewalDate; private Date renewalDate;
/** /**
* 保单回执日期
*/
private Date receiptDate;
/**
* 回执状态
*/
private String receiptStatus;
/**
* 是否开通直接支付
*/
private Integer directPaymentEnabled;
/**
* 供款年期 * 供款年期
*/ */
private Object paymentTerm; private Integer issueNumber;
/**
* 保障期限
*/
private Integer guaranteePeriod;
/**
* 保额(重疾险)
*/
private BigDecimal sumInsured;
/** /**
* 期交保费 * 付款频率(字典)
*/ */
private BigDecimal paymentPremium; private String paymentFrequency;
/**
* 每期保费
*/
private BigDecimal eachIssuePremium;
/** /**
* 是否预缴: 0-否, 1-是 * 是否预缴: 0-否, 1-是
*/ */
private Integer isPrepaid; private Integer isPrepay;
/**
* 是否追溯: 0-否, 1-是
*/
private Integer isTraceable;
/**
* 回溯日期
*/
private Date retroactiveDate;
/** /**
* 预缴年期 * 预缴年期
...@@ -187,7 +235,7 @@ public class PolicyFollow implements Serializable { ...@@ -187,7 +235,7 @@ public class PolicyFollow implements Serializable {
/** /**
* 下一步跟进状态列表 * 下一步跟进状态列表
*/ */
private Object nextStatusList; private String nextStatusList;
/** /**
* 保單持有人 * 保單持有人
...@@ -200,74 +248,103 @@ public class PolicyFollow implements Serializable { ...@@ -200,74 +248,103 @@ public class PolicyFollow implements Serializable {
private String insured; private String insured;
/** /**
* 币种 * 受保人年龄
*/ */
private String currency; private Integer insuredAge;
/** /**
* 首期保费(不含徽费,预缴保费) * 宽限期
*/ */
private Object initialPremium; private Integer gracePeriod;
/** /**
* 保单征费 * 是否参加递增保障权益: 0-否, 1-是(字典)
*/ */
private String policyLevy; private Integer isJoin;
/** /**
* 首期已交保费 * 保单币种
*/ */
private String initialPremiumPaid; private String policyCurrency;
/** /**
* 首期待交保费 * 首期付款方式(字典)
*/ */
private String initialPremiumDue; private String initialPaymentMethod;
/** /**
* 最晚缴费日期 * 首期保费(不含徽费,预缴保费)
*/ */
private Date latestPaymentDate; private BigDecimal initialPremium;
/** /**
* 寄送方式 1-自提, 2-快递 * 寄送方式 字典值:1-自提 2-快递
*/ */
private String mailingMethod; private String mailingMethod;
/** /**
* 续期付款方式(字典)
*/
private String renewalPaymentMethod;
/**
* 红利付款方式(字典)
*/
private String dividendPaymentMethod;
/**
* 快递单号 * 快递单号
*/ */
private String deliveryNo; private String deliveryNo;
/** /**
* 保单征费
*/
private String policyLevy;
/**
*
*/
private String initialPremiumPaid;
/**
*
*/
private String initialPremiumDue;
/**
*
*/
private Date latestPaymentDate;
/**
* 经纪公司签收日期 * 经纪公司签收日期
*/ */
private String brokerSignDate; private Date brokerSignDate;
/** /**
* 保险公司寄出日期 * 保险公司寄出日期
*/ */
private String insurerMailingDate; private Date insurerMailingDate;
/** /**
* 客户签收日期 * 客户签收日期
*/ */
private String customerSignDate; private Date customerSignDate;
/** /**
* 附件列表 * 附件地址列表 逗号隔开
*/ */
private String attachments; private String attachments;
/** /**
* 备注 * 通用备注
*/ */
private String remark; private String remark;
/** /**
* 删除标识: 0-正常, 1-删除 * 删除标识: 0-正常, 1-删除
*/ */
@TableField()
private Integer isDeleted; private Integer isDeleted;
/** /**
......
...@@ -27,10 +27,20 @@ public interface PolicyFollowService extends IService<PolicyFollow> { ...@@ -27,10 +27,20 @@ public interface PolicyFollowService extends IService<PolicyFollow> {
Boolean updatePolicyFollow(PolicyFollowUpdateRequest policyFollowUpdateRequest); Boolean updatePolicyFollow(PolicyFollowUpdateRequest policyFollowUpdateRequest);
/**
* 使用统一DTO更新新单跟进
*/
Boolean updatePolicyFollowDto(PolicyFollowDto policyFollowDto);
PolicyFollowVO getPolicyFollowVO(PolicyFollow policyFollow); PolicyFollowVO getPolicyFollowVO(PolicyFollow policyFollow);
Map<String, Object> addPolicyFollow(PolicyFollowAddRequest policyFollowAddRequest); Map<String, Object> addPolicyFollow(PolicyFollowAddRequest policyFollowAddRequest);
/**
* 使用统一DTO新增新单跟进
*/
Map<String, Object> addPolicyFollowDto(PolicyFollowDto policyFollowDto);
Boolean addToPolicy(List<String> policyNoList); Boolean addToPolicy(List<String> policyNoList);
Boolean changePolicyFollowStatus(ChangePolicyFollowStatusRequest changePolicyFollowStatusRequest, PolicyFollow policyFollow); Boolean changePolicyFollowStatus(ChangePolicyFollowStatusRequest changePolicyFollowStatusRequest, PolicyFollow policyFollow);
......
...@@ -154,14 +154,13 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol ...@@ -154,14 +154,13 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
PolicyFollowUpdateDto policyFollowUpdateDto = policyFollowUpdateRequest.getPolicyFollowUpdateDto(); PolicyFollowUpdateDto policyFollowUpdateDto = policyFollowUpdateRequest.getPolicyFollowUpdateDto();
if (policyFollowUpdateDto != null) { if (policyFollowUpdateDto != null) {
BeanUtils.copyProperties(policyFollowUpdateDto, policyFollow, "id", "policyBizId"); BeanUtils.copyProperties(policyFollowUpdateDto, policyFollow, "id", "policyBizId");
// 签单员列表 => 字符串
policyFollow.setSignerList(GSONUtil.toJson(policyFollowUpdateDto.getSignerList()));
// 计算冷却期结束日期 // 计算冷却期结束日期
if (policyFollowUpdateDto.getCoolingOffDays() != null && policyFollowUpdateDto.getEffectiveDate() != null) { if (policyFollowUpdateDto.getCoolingOffDays() != null && policyFollowUpdateDto.getEffectiveDate() != null) {
policyFollow.setCoolingOffEndDate(DateUtil.offset(policyFollowUpdateDto.getEffectiveDate(), DateField.DAY_OF_MONTH, policyFollowUpdateDto.getCoolingOffDays())); policyFollow.setCoolingOffEndDate(DateUtil.offset(policyFollowUpdateDto.getEffectiveDate(), DateField.DAY_OF_MONTH, policyFollowUpdateDto.getCoolingOffDays()));
} }
// 获取币种字典值 // 获取币种字典值
policyFollow.setCurrency(this.getCurrencyValue(policyFollowUpdateDto.getCurrency())); policyFollow.setPolicyCurrency(this.getCurrencyValue(policyFollowUpdateDto.getPolicyCurrency()));
} }
// 设置核保信息 // 设置核保信息
setValidPolicyInfo(policyFollow, policyFollowUpdateRequest.getVerifyPolicyInfo()); setValidPolicyInfo(policyFollow, policyFollowUpdateRequest.getVerifyPolicyInfo());
...@@ -174,31 +173,40 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol ...@@ -174,31 +173,40 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
policyFollow.setUpdaterId(loginUserId); policyFollow.setUpdaterId(loginUserId);
policyFollow.setUpdateTime(new Date()); policyFollow.setUpdateTime(new Date());
// 修改转介人 return updateById(policyFollow);
List<PolicyBrokerDto> brokerList = policyFollowUpdateRequest.getBrokerList();
if (CollUtil.isNotEmpty(brokerList)) {
log.info("修改转介人,查看保单号: {}, 转介人数量: {}", policyFollow.getPolicyNo(), brokerList.size());
// 先删除原有的转介人
policyBrokerService.remove(new QueryWrapper<PolicyBroker>().eq("policy_biz_id", policyBizId));
List<PolicyBroker> policyBrokerList = new ArrayList<>();
for (PolicyBrokerDto policyBrokerDto : brokerList) {
PolicyBroker policyBroker = new PolicyBroker();
BeanUtils.copyProperties(policyBrokerDto, policyBroker);
policyBroker.setPolicyBizId(policyBizId);
policyBroker.setPolicyNo(policyFollow.getPolicyNo());
policyBroker.setCreatorId(loginUserId);
policyBroker.setCreateTime(new Date());
policyBroker.setUpdaterId(loginUserId);
policyBroker.setUpdateTime(new Date());
policyBrokerList.add(policyBroker);
} }
if (CollUtil.isNotEmpty(policyBrokerList)) { @Override
policyBrokerService.saveBatch(policyBrokerList); @Transactional(rollbackFor = Exception.class)
public Boolean updatePolicyFollowDto(PolicyFollowDto policyFollowDto) {
// 校验参数
if (StringUtils.isBlank(policyFollowDto.getPolicyBizId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), "policyBizId不能为空");
} }
String policyBizId = policyFollowDto.getPolicyBizId();
PolicyFollow policyFollow = getByPolicyBizId(policyBizId);
if (policyFollow == null) {
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR.getCode(), "新单跟进记录不存在");
} }
return updateById(policyFollow);
// 复制属性,排除系统字段
BeanUtils.copyProperties(policyFollowDto, policyFollow, "id", "policyBizId", "brokerList", "signerList");
// 计算冷却期结束日期
if (policyFollowDto.getCoolingOffDays() != null && policyFollowDto.getEffectiveDate() != null) {
policyFollow.setCoolingOffEndDate(DateUtil.offset(policyFollowDto.getEffectiveDate(), DateField.DAY_OF_MONTH, policyFollowDto.getCoolingOffDays()));
}
// 获取当前登录用户
AuthUserDto currentLoginUser = SecurityUtil.getCurrentLoginUser();
String loginUserId = currentLoginUser.getId().toString();
policyFollow.setUpdaterId(loginUserId);
policyFollow.setUpdateTime(new Date());
boolean result = updateById(policyFollow);
return result;
} }
private void setPolicyMailing(PolicyFollow policyFollow, PolicyMailing policyMailing) { private void setPolicyMailing(PolicyFollow policyFollow, PolicyMailing policyMailing) {
...@@ -206,9 +214,9 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol ...@@ -206,9 +214,9 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
return; return;
} }
policyFollow.setMailingMethod(policyMailing.getMailingMethod()); policyFollow.setMailingMethod(policyMailing.getMailingMethod());
policyFollow.setBrokerSignDate(policyMailing.getBrokerSignDate()); // policyFollow.setBrokerSignDate(policyMailing.getBrokerSignDate());
policyFollow.setInsurerMailingDate(policyMailing.getInsurerMailingDate()); // policyFollow.setInsurerMailingDate(policyMailing.getInsurerMailingDate());
policyFollow.setCustomerSignDate(policyMailing.getCustomerSignDate()); // policyFollow.setCustomerSignDate(policyMailing.getCustomerSignDate());
} }
private void setValidPolicyInfo(PolicyFollow policyFollow, VerifyPolicyInfo verifyPolicyInfo) { private void setValidPolicyInfo(PolicyFollow policyFollow, VerifyPolicyInfo verifyPolicyInfo) {
...@@ -219,7 +227,7 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol ...@@ -219,7 +227,7 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
policyFollow.setSignDate(verifyPolicyInfo.getSignDate()); policyFollow.setSignDate(verifyPolicyInfo.getSignDate());
policyFollow.setIssueDate(verifyPolicyInfo.getIssueDate()); policyFollow.setIssueDate(verifyPolicyInfo.getIssueDate());
policyFollow.setEffectiveDate(verifyPolicyInfo.getEffectiveDate()); policyFollow.setEffectiveDate(verifyPolicyInfo.getEffectiveDate());
policyFollow.setIsPrepaid(verifyPolicyInfo.getIsPrepaid()); // policyFollow.setIsPrepaid(verifyPolicyInfo.getIsPrepaid());
policyFollow.setPrepaidAmount(verifyPolicyInfo.getPrepaidAmount()); policyFollow.setPrepaidAmount(verifyPolicyInfo.getPrepaidAmount());
policyFollow.setPrepaidAmountAfterDiscount(verifyPolicyInfo.getPrepaidAmountAfterDiscount()); policyFollow.setPrepaidAmountAfterDiscount(verifyPolicyInfo.getPrepaidAmountAfterDiscount());
policyFollow.setPolicyExpirationDate(verifyPolicyInfo.getPolicyExpirationDate()); policyFollow.setPolicyExpirationDate(verifyPolicyInfo.getPolicyExpirationDate());
...@@ -248,19 +256,15 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol ...@@ -248,19 +256,15 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
// 生成新单编号 // 生成新单编号
String policyBizId = RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_POLICY.getCode()); String policyBizId = RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_POLICY.getCode());
policyFollow.setPolicyBizId(policyBizId); policyFollow.setPolicyBizId(policyBizId);
// 签单员列表 => 字符串
policyFollow.setSignerList(GSONUtil.toJson(policyFollowAddRequest.getSignerList()));
// 计算冷却期结束日期 // 计算冷却期结束日期
if (policyFollowAddRequest.getCoolingOffDays() != null) { if (policyFollowAddRequest.getCoolingOffDays() != null) {
policyFollow.setCoolingOffEndDate(DateUtil.offset(policyFollowAddRequest.getEffectiveDate(), DateField.DAY_OF_MONTH, policyFollowAddRequest.getCoolingOffDays())); policyFollow.setCoolingOffEndDate(DateUtil.offset(policyFollowAddRequest.getEffectiveDate(), DateField.DAY_OF_MONTH, policyFollowAddRequest.getCoolingOffDays()));
} }
// 获取币种字典值 // 获取币种字典值
policyFollow.setCurrency(this.getCurrencyValue(policyFollowAddRequest.getCurrency())); policyFollow.setPolicyCurrency(this.getCurrencyValue(policyFollowAddRequest.getCurrency()));
// 创建 Policy对象
Policy policy = new Policy();
BeanUtils.copyProperties(policyFollowAddRequest, policy);
policy.setPolicyBizId(policyBizId);
// 保存转介人 // 保存转介人
List<PolicyBroker> policyBrokerList = policyFollowAddRequest.getBrokerList(); List<PolicyBroker> policyBrokerList = policyFollowAddRequest.getBrokerList();
if (CollUtil.isNotEmpty(policyBrokerList)) { if (CollUtil.isNotEmpty(policyBrokerList)) {
...@@ -270,18 +274,49 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol ...@@ -270,18 +274,49 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
} }
this.save(policyFollow); this.save(policyFollow);
policyService.save(policy);
policyBrokerService.saveBatch(policyBrokerList); policyBrokerService.saveBatch(policyBrokerList);
// 保险产品相关字段不为空,则查询获取保单预计来佣 // 保险产品相关字段不为空,则查询获取保单预计来佣
String policyNo = policyFollowAddRequest.getPolicyNo(); // String policyNo = policyFollowAddRequest.getPolicyNo();
String productLaunchBizId = policyFollowAddRequest.getProductLaunchBizId(); // String productLaunchBizId = policyFollowAddRequest.getProductLaunchBizId();
String insuranceCompanyBizId = policyFollowAddRequest.getInsuranceCompanyBizId(); // String insuranceCompanyBizId = policyFollowAddRequest.getInsuranceCompanyBizId();
String reconciliationCompany = policyFollowAddRequest.getReconciliationCompany(); // String reconciliationCompany = policyFollowAddRequest.getReconciliationCompany();
String reconciliationCompanyCode = policyFollowAddRequest.getReconciliationCompanyCode(); // String reconciliationCompanyCode = policyFollowAddRequest.getReconciliationCompanyCode();
String reconciliationCompanyBizId = policyFollowAddRequest.getReconciliationCompanyBizId(); // String reconciliationCompanyBizId = policyFollowAddRequest.getReconciliationCompanyBizId();
// 保存保单预计来佣 // // 保存保单预计来佣
commissionExpectedService.getExpectedCommissionByProductlaunchId(policyNo, productLaunchBizId, insuranceCompanyBizId, reconciliationCompany, reconciliationCompanyCode, reconciliationCompanyBizId); // commissionExpectedService.getExpectedCommissionByProductlaunchId(policyNo, productLaunchBizId, insuranceCompanyBizId, reconciliationCompany, reconciliationCompanyCode, reconciliationCompanyBizId);
// 返回新单跟进唯一业务ID
return Collections.singletonMap("policyBizId", policyBizId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> addPolicyFollowDto(PolicyFollowDto policyFollowDto) {
PolicyFollow policyFollow = new PolicyFollow();
// 复制属性,排除系统字段
BeanUtils.copyProperties(policyFollowDto, policyFollow, "id", "policyBizId", "brokerList", "signerList");
// 生成新单编号
String policyBizId = RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_POLICY.getCode());
policyFollow.setPolicyBizId(policyBizId);
// 计算冷却期结束日期
if (policyFollowDto.getCoolingOffDays() != null && policyFollowDto.getEffectiveDate() != null) {
policyFollow.setCoolingOffEndDate(DateUtil.offset(policyFollowDto.getEffectiveDate(), DateField.DAY_OF_MONTH, policyFollowDto.getCoolingOffDays()));
}
// 获取当前登录用户
AuthUserDto currentLoginUser = SecurityUtil.getCurrentLoginUser();
String loginUserId = currentLoginUser.getId().toString();
policyFollow.setCreatorId(loginUserId);
policyFollow.setCreateTime(new Date());
policyFollow.setUpdaterId(loginUserId);
policyFollow.setUpdateTime(new Date());
this.save(policyFollow);
// 返回新单跟进唯一业务ID // 返回新单跟进唯一业务ID
return Collections.singletonMap("policyBizId", policyBizId); return Collections.singletonMap("policyBizId", policyBizId);
......
...@@ -82,11 +82,7 @@ public class PolicyFollowVO implements Serializable { ...@@ -82,11 +82,7 @@ public class PolicyFollowVO implements Serializable {
// 转换PolicyFollowUpdateDto // 转换PolicyFollowUpdateDto
PolicyFollowUpdateDto policyFollowUpdateDto = new PolicyFollowUpdateDto(); PolicyFollowUpdateDto policyFollowUpdateDto = new PolicyFollowUpdateDto();
BeanUtils.copyProperties(policyFollow, policyFollowUpdateDto); BeanUtils.copyProperties(policyFollow, policyFollowUpdateDto);
// 转换 signerList 字段
if (policyFollow.getSignerList() != null) {
policyFollowUpdateDto.setSignerList(GSONUtil.fromJson(policyFollow.getSignerList(), new TypeToken<List<PolicySigner>>() {
}.getType()));
}
policyFollowVO.setPolicyFollowUpdateDto(policyFollowUpdateDto); policyFollowVO.setPolicyFollowUpdateDto(policyFollowUpdateDto);
// 处理 nextStatusList 字段 // 处理 nextStatusList 字段
......
...@@ -10,20 +10,31 @@ ...@@ -10,20 +10,31 @@
<result property="policyNo" column="policy_no" /> <result property="policyNo" column="policy_no" />
<result property="appointmentBizId" column="appointment_biz_id" /> <result property="appointmentBizId" column="appointment_biz_id" />
<result property="appointmentNo" column="appointment_no" /> <result property="appointmentNo" column="appointment_no" />
<result property="userBizId" column="user_biz_id" />
<result property="customerBizId" column="customer_biz_id" /> <result property="customerBizId" column="customer_biz_id" />
<result property="submitDate" column="submit_date" /> <result property="submitDate" column="submit_date" />
<result property="customerName" column="customer_name" /> <result property="customerName" column="customer_name" />
<result property="signDate" column="sign_date" /> <result property="signDate" column="sign_date" />
<result property="signerList" column="signer_list" /> <result property="signer" column="signer" />
<result property="signerBizId" column="signer_biz_id" />
<result property="signerRegNo" column="signer_reg_no" />
<result property="signLocation" column="sign_location" />
<result property="issueDate" column="issue_date" /> <result property="issueDate" column="issue_date" />
<result property="effectiveDate" column="effective_date" />
<result property="coolingOffEndDate" column="cooling_off_end_date" /> <result property="coolingOffEndDate" column="cooling_off_end_date" />
<result property="coolingOffDays" column="cooling_off_days" /> <result property="coolingOffDays" column="cooling_off_days" />
<result property="underwritingDate" column="underwriting_date" />
<result property="effectiveDate" column="effective_date" />
<result property="renewalDate" column="renewal_date" /> <result property="renewalDate" column="renewal_date" />
<result property="paymentTerm" column="payment_term" /> <result property="receiptDate" column="receipt_date" />
<result property="paymentPremium" column="payment_premium" /> <result property="receiptStatus" column="receipt_status" />
<result property="isPrepaid" column="is_prepaid" /> <result property="directPaymentEnabled" column="direct_payment_enabled" />
<result property="issueNumber" column="issue_number" />
<result property="guaranteePeriod" column="guarantee_period" />
<result property="sumInsured" column="sum_insured" />
<result property="paymentFrequency" column="payment_frequency" />
<result property="eachIssuePremium" column="each_issue_premium" />
<result property="isPrepay" column="is_prepay" />
<result property="isTraceable" column="is_traceable" />
<result property="retroactiveDate" column="retroactive_date" />
<result property="prepaidTerm" column="prepaid_term" /> <result property="prepaidTerm" column="prepaid_term" />
<result property="prepaidAmount" column="prepaid_amount" /> <result property="prepaidAmount" column="prepaid_amount" />
<result property="prepaidAmountAfterDiscount" column="prepaid_amount_after_discount" /> <result property="prepaidAmountAfterDiscount" column="prepaid_amount_after_discount" />
...@@ -40,14 +51,20 @@ ...@@ -40,14 +51,20 @@
<result property="nextStatusList" column="next_status_list" /> <result property="nextStatusList" column="next_status_list" />
<result property="policyHolder" column="policy_holder" /> <result property="policyHolder" column="policy_holder" />
<result property="insured" column="insured" /> <result property="insured" column="insured" />
<result property="currency" column="currency" /> <result property="insuredAge" column="insured_age" />
<result property="gracePeriod" column="grace_period" />
<result property="isJoin" column="is_join" />
<result property="policyCurrency" column="policy_currency" />
<result property="initialPaymentMethod" column="initial_payment_method" />
<result property="initialPremium" column="initial_premium" /> <result property="initialPremium" column="initial_premium" />
<result property="mailingMethod" column="mailing_method" />
<result property="renewalPaymentMethod" column="renewal_payment_method" />
<result property="dividendPaymentMethod" column="dividend_payment_method" />
<result property="deliveryNo" column="delivery_no" />
<result property="policyLevy" column="policy_levy" />
<result property="initialPremiumPaid" column="initial_premium_paid" /> <result property="initialPremiumPaid" column="initial_premium_paid" />
<result property="initialPremiumDue" column="initial_premium_due" /> <result property="initialPremiumDue" column="initial_premium_due" />
<result property="latestPaymentDate" column="latest_payment_date" /> <result property="latestPaymentDate" column="latest_payment_date" />
<result property="policyLevy" column="policy_levy" />
<result property="mailingMethod" column="mailing_method" />
<result property="deliveryNo" column="delivery_no" />
<result property="brokerSignDate" column="broker_sign_date" /> <result property="brokerSignDate" column="broker_sign_date" />
<result property="insurerMailingDate" column="insurer_mailing_date" /> <result property="insurerMailingDate" column="insurer_mailing_date" />
<result property="customerSignDate" column="customer_sign_date" /> <result property="customerSignDate" column="customer_sign_date" />
...@@ -61,16 +78,20 @@ ...@@ -61,16 +78,20 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id,policy_biz_id,policy_no,appointment_biz_id,appointment_no,user_biz_id, id,policy_biz_id,policy_no,appointment_biz_id,appointment_no,customer_biz_id,
customer_biz_id,submit_date,customer_name,sign_date,signer_list, submit_date,customer_name,sign_date,signer,signer_biz_id,
issue_date,effective_date,cooling_off_end_date,cooling_off_days,renewal_date,payment_term,payment_premium, signer_reg_no,sign_location,issue_date,cooling_off_end_date,cooling_off_days,
is_prepaid,prepaid_term,prepaid_amount,prepaid_amount_after_discount,policy_expiration_date, underwriting_date,effective_date,renewal_date,receipt_date,receipt_status,
payment_number,product_launch_biz_id,product_name,product_cate,insurance_company, direct_payment_enabled,issue_number,guarantee_period,sum_insured,payment_frequency,
insurance_company_biz_id,reconciliation_company,reconciliation_company_biz_id,status,next_status_list, each_issue_premium,is_prepay,is_traceable,retroactive_date,prepaid_term,
policy_holder,insured,currency,initial_premium,initial_premium_paid,initial_premium_due,latest_payment_date,policy_levy,mailing_method, prepaid_amount,prepaid_amount_after_discount,policy_expiration_date,payment_number,product_launch_biz_id,
delivery_no,broker_sign_date,insurer_mailing_date,customer_sign_date,attachments, product_name,product_cate,insurance_company,insurance_company_biz_id,reconciliation_company,
remark,is_deleted,creator_id,updater_id,create_time, reconciliation_company_biz_id,status,next_status_list,policy_holder,insured,
update_time insured_age,grace_period,is_join,policy_currency,initial_payment_method,
initial_premium,mailing_method,renewal_payment_method,dividend_payment_method,delivery_no,
policy_levy,initial_premium_paid,initial_premium_due,latest_payment_date,broker_sign_date,
insurer_mailing_date,customer_sign_date,attachments,remark,is_deleted,
creator_id,updater_id,create_time,update_time
</sql> </sql>
<select id="queryPolicyReportData" resultType="com.yd.csf.service.dto.PolicyReportData"> <select id="queryPolicyReportData" resultType="com.yd.csf.service.dto.PolicyReportData">
......
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