Commit 2fe500cc by zhangxingmin

Merge remote-tracking branch 'origin/test' into test

parents 6b7ac539 c7e53c8e
......@@ -490,50 +490,17 @@ public class ApiPolicyFollowController {
*/
@GetMapping("/get/vo")
@Operation(summary = "根据 policyBizId 获取新单跟进详情")
public Result<PolicyFollowVO> getPolicyFollowByPolicyBizId(@RequestParam("policyBizId") String policyBizId, HttpServletRequest request) {
public Result<PolicyFollowDetailVO> getPolicyFollowByPolicyBizId(@RequestParam("policyBizId") String policyBizId, HttpServletRequest request) {
if (StringUtils.isBlank(policyBizId)) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), "policyBizId不能为空");
}
// 查询数据库
PolicyFollow policyFollow = policyFollowService.getByPolicyBizId(policyBizId);
if (policyFollow == null) {
// 查询数据库并组装详情数据(包含附加险和介绍人)
PolicyFollowDetailVO detailVO = policyFollowService.getPolicyFollowDetailVO(policyBizId);
if (detailVO == null) {
return Result.fail(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
}
// 异步查询产品上架信息表
if (StringUtils.isNotBlank(policyFollow.getPolicyNo()) && StringUtils.isBlank(policyFollow.getProductLaunchBizId())) {
// 异步查询产品上架信息表
// ApiExpectedCommissionRatioPageRequest apiExpectedCommissionRatioPageRequest = new ApiExpectedCommissionRatioPageRequest();
// apiExpectedCommissionRatioPageRequest.setPageNo(1);
// apiExpectedCommissionRatioPageRequest.setPageSize(100);
// apiExpectedCommissionRatioPageRequest.setWarrantyPeriod(String.valueOf(policyFollow.getPaymentTerm()));
// Result<Page<ApiExpectedCommissionRatioPageResponse>> result = apiExpectedCommissionRatioFeignClient.page(apiExpectedCommissionRatioPageRequest);
// if (result != null && result.getData() != null) {
// List<ApiExpectedCommissionRatioPageResponse> records = (List<ApiExpectedCommissionRatioPageResponse>) result.getData();
// if (CollectionUtils.isNotEmpty(records)) {
// policyFollow.setProductLaunchBizId(records.get(0).getProductLaunchBizId());
// }
// }
PolicyFollow updatePolicyFollow = new PolicyFollow();
updatePolicyFollow.setId(policyFollow.getId());
updatePolicyFollow.setProductLaunchBizId("product_launch_kudwRqXsz1");
policyFollowService.updateById(updatePolicyFollow);
}
// 获取封装类
return Result.success(policyFollowService.getPolicyFollowVO(policyFollow));
}
@GetMapping("/detail/{policyBizId}")
@Operation(summary = "根据 policyBizId 获取新单跟进聚合详情")
public Result<PolicyFollowAggregateDto> getPolicyFollowAggregate(@PathVariable String policyBizId) {
try {
PolicyFollowAggregateDto result = policyFollowService.getPolicyFollowAggregate(policyBizId);
return Result.success(result);
} catch (Exception e) {
log.error("获取新单跟进聚合详情失败, policyBizId: {}", policyBizId, e);
return Result.fail("查询失败: " + e.getMessage());
}
return Result.success(detailVO);
}
/**
......@@ -679,4 +646,28 @@ public class ApiPolicyFollowController {
}
}
@PostMapping("/save_initial_payment")
@Operation(summary = "保存首期缴费信息")
public Result<Boolean> saveInitialPayment(@RequestBody InitialPaymentSaveRequest initialPaymentSaveRequest) {
log.info("保存首期缴费信息, policyBizId: {}", initialPaymentSaveRequest.getPolicyBizId());
Boolean result = policyFollowService.saveInitialPayment(initialPaymentSaveRequest);
return Result.success(result);
}
@PostMapping("/save_mailing_info")
@Operation(summary = "保存邮寄信息")
public Result<Boolean> saveMailingInfo(@RequestBody MailingInfoSaveRequest mailingInfoSaveRequest) {
log.info("保存邮寄信息, policyBizId: {}", mailingInfoSaveRequest.getPolicyBizId());
Boolean result = policyFollowService.saveMailingInfo(mailingInfoSaveRequest);
return Result.success(result);
}
@PostMapping("/batch_save_brokers")
@Operation(summary = "批量保存介绍人信息")
public Result<Boolean> batchSaveBrokers(@RequestBody BrokerBatchSaveRequest brokerBatchSaveRequest) {
log.info("批量保存介绍人信息, policyBizId: {}", brokerBatchSaveRequest.getPolicyBizId());
Boolean result = policyFollowService.batchSaveBrokers(brokerBatchSaveRequest);
return Result.success(result);
}
}
\ No newline at end of file
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 介绍人批量保存请求
*/
@Data
public class BrokerBatchSaveRequest implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "新单跟进唯一业务ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String policyBizId;
@Schema(description = "介绍人列表")
private List<BrokerInfo> brokerList;
@Data
public static class BrokerInfo implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "介绍人姓名")
private String brokerName;
@Schema(description = "介绍人业务id")
private String brokerBizId;
@Schema(description = "性别")
private String gender;
@Schema(description = "内部编号")
private String internalCode;
@Schema(description = "所属团队")
private String team;
@Schema(description = "团队业务id")
private String teamBizId;
@Schema(description = "分配比例")
private String brokerRatio;
@Schema(description = "备注")
private String remark;
}
}
package com.yd.csf.service.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 首期缴费保存请求
*/
@Data
public class InitialPaymentSaveRequest implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "新单跟进唯一业务ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String policyBizId;
@Schema(description = "首期保费(不含徽费,预缴保费)")
private BigDecimal initialPremium;
@Schema(description = "保单征费")
private String policyLevy;
@Schema(description = "首期付款方式(字典)")
private String initialPaymentMethod;
@Schema(description = "首期已缴保费")
private BigDecimal initialPremiumPaid;
@Schema(description = "首期待缴保费")
private BigDecimal initialPremiumDue;
@Schema(description = "首期缴费总额")
private BigDecimal initialPremiumTotal;
@Schema(description = "缴费状态")
private String initialPaymentStatus;
@Schema(description = "最晚缴费日期", format = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date latestPaymentDate;
@Schema(description = "首期保费优惠金额")
private BigDecimal initialPremiumDiscount;
}
package com.yd.csf.service.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 邮寄信息保存请求
*/
@Data
public class MailingInfoSaveRequest implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "新单跟进唯一业务ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String policyBizId;
@Schema(description = "寄送方式(字典值:1-自提 2-快递)")
private String mailingMethod;
@Schema(description = "快递单号")
private String deliveryNo;
@Schema(description = "经纪公司签收日期", format = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date brokerSignDate;
@Schema(description = "客户签收日期", format = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date customerSignDate;
}
......@@ -20,6 +20,18 @@ public class PolicyBrokerDto implements Serializable {
private String brokerBizId;
/**
* 性别
*/
@Schema(description = "性别")
private String gender;
/**
* 内部编号
*/
@Schema(description = "内部编号")
private String internalCode;
/**
* 所属团队
*/
@Schema(description = "所属团队")
......
......@@ -179,6 +179,22 @@ public class PolicyFollowDto implements Serializable {
@Schema(description = "首期保费(不含徽费,预缴保费)")
private BigDecimal initialPremium;
@Schema(description = "首期已缴保费")
private BigDecimal initialPremiumPaid;
@Schema(description = "首期待缴保费")
private BigDecimal initialPremiumDue;
@Schema(description = "首期缴费总额")
private BigDecimal initialPremiumTotal;
@Schema(description = "最晚缴费日期", format = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date latestPaymentDate;
@Schema(description = "首期保费优惠金额")
private BigDecimal initialPremiumDiscount;
@Schema(description = "寄送方式(字典): 1-自提 2-快递")
private String mailingMethod;
......@@ -194,16 +210,6 @@ public class PolicyFollowDto implements Serializable {
@Schema(description = "保单征费")
private String policyLevy;
@Schema(description = "首期保费已付")
private String initialPremiumPaid;
@Schema(description = "首期保费应付")
private String initialPremiumDue;
@Schema(description = "最近付款日期", format = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date latestPaymentDate;
@Schema(description = "经纪公司签收日期", format = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date brokerSignDate;
......
......@@ -6,17 +6,17 @@ import org.apache.commons.lang3.ObjectUtils;
* 新单跟进状态枚举
*/
public enum PolicyFollowStatusEnum {
PENDING_SIGN("待签单", "PENDING_SIGN"),
SIGNED("已签单", "SIGNED"),
WAITING_PAYMENT("等待汇款", "WAITING_PAYMENT"),
PREMIUM_RECONCILING("首期保费对账中", "PREMIUM_RECONCILING"),
PREMIUM_RECONCILED_UNDERWRITING("保费对账成功,核保中", "PREMIUM_RECONCILED_UNDERWRITING"),
EFFECTIVE("生效", "EFFECTIVE"),
CANCELLED("取消投保", "CANCELLED"),
DECLINED("拒保", "DECLINED"),
DELAYED_UNDERWRITING("延缓承保", "DELAYED_UNDERWRITING"),
LAPSED("失效", "LAPSED"),
CLOSED("关闭", "CLOSED"),
PENDING_SIGN("待签单", "PENDING_SIGNATURE"),
SIGNED("已签单", "SIGNED_ORDER"),
WAITING_PAYMENT("等待汇款", "WAITING_REMITTANCE"),
PREMIUM_RECONCILING("首期保费对账中", "IN_RECONCILIATION"),
PREMIUM_RECONCILED_UNDERWRITING("保费对账成功,核保中", "UNDERWRITING_PROGRESS"),
EFFECTIVE("生效", "TAKE_EFFECT"),
CANCELLED("取消投保", "CANCEL_COVERAGE"),
DECLINED("拒保", "REJECTION_INSURANCE"),
DELAYED_UNDERWRITING("延缓承保", "DELAY_UNDERWRITING"),
LAPSED("失效", "FAILURE"),
CLOSED("关闭", "CLOSE"),
;
//字典项标签(名称)
......
......@@ -42,6 +42,16 @@ public class PolicyBroker implements Serializable {
private String brokerBizId;
/**
* 性别
*/
private String gender;
/**
* 内部编号
*/
private String internalCode;
/**
* 所属团队
*/
private String team;
......
......@@ -4,16 +4,19 @@ 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.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* 新单跟进表
*
* @TableName policy_follow
*/
@TableName(value ="policy_follow")
@TableName(value = "policy_follow")
@Data
public class PolicyFollow implements Serializable {
/**
......@@ -278,6 +281,31 @@ public class PolicyFollow implements Serializable {
private BigDecimal initialPremium;
/**
* 首期已缴保费
*/
private BigDecimal initialPremiumPaid;
/**
* 首期待缴保费
*/
private BigDecimal initialPremiumDue;
/**
* 首期缴费总额
*/
private BigDecimal initialPremiumTotal;
/**
* 首期缴费状态
*/
private String initialPaymentStatus;
/**
* 首期保费优惠金额
*/
private BigDecimal initialPremiumDiscount;
/**
* 寄送方式 字典值:1-自提 2-快递
*/
private String mailingMethod;
......@@ -303,17 +331,7 @@ public class PolicyFollow implements Serializable {
private String policyLevy;
/**
*
*/
private String initialPremiumPaid;
/**
*
*/
private String initialPremiumDue;
/**
*
* 最晚缴费日期
*/
private Date latestPaymentDate;
......
......@@ -41,6 +41,11 @@ public interface PolicyFollowService extends IService<PolicyFollow> {
*/
Map<String, Object> addPolicyFollowDto(PolicyFollowDto policyFollowDto);
/**
* 获取新单跟进详情(包含附加险和介绍人)
*/
PolicyFollowDetailVO getPolicyFollowDetailVO(String policyBizId);
Boolean addToPolicy(List<String> policyNoList);
Boolean changePolicyFollowStatus(ChangePolicyFollowStatusRequest changePolicyFollowStatusRequest, PolicyFollow policyFollow);
......@@ -49,13 +54,24 @@ public interface PolicyFollowService extends IService<PolicyFollow> {
String getNextStatus(PolicyFollowStatusEnum policyFollowStatusEnum);
PolicyFollowAggregateDto getPolicyFollowAggregate(String policyBizId);
Page<PolicyFollowDetailVO> getPolicyFollowDetailVOList(Page<PolicyFollow> policyFollowPage);
String getCurrencyValue(String currency);
PolicyReportData queryPolicyReportData(String policyBizId);
PolicyFollow queryOneByPolicyNo(String policyNo);
/**
* 保存首期缴费信息
*/
Boolean saveInitialPayment(InitialPaymentSaveRequest initialPaymentSaveRequest);
/**
* 保存邮寄信息
*/
Boolean saveMailingInfo(MailingInfoSaveRequest mailingInfoSaveRequest);
/**
* 批量保存介绍人信息
*/
Boolean batchSaveBrokers(BrokerBatchSaveRequest brokerBatchSaveRequest);
}
package com.yd.csf.service.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -15,12 +13,9 @@ import com.yd.auth.core.utils.SecurityUtil;
import com.yd.common.enums.CommonEnum;
import com.yd.common.enums.ResultCode;
import com.yd.common.exception.BusinessException;
import com.yd.common.result.Result;
import com.yd.common.utils.RandomStringGenerator;
import com.yd.csf.service.common.ErrorCode;
import com.yd.csf.service.component.ReceivableService;
import com.yd.csf.service.dto.*;
import com.yd.csf.service.enums.CommissionExpectedStatusEnum;
import com.yd.csf.service.enums.PolicyFollowStatusEnum;
import com.yd.csf.service.model.*;
import com.yd.csf.service.service.*;
......@@ -29,11 +24,6 @@ import com.yd.csf.service.utils.AsyncQueryUtil;
import com.yd.csf.service.utils.GSONUtil;
import com.yd.csf.service.vo.PolicyFollowDetailVO;
import com.yd.csf.service.vo.PolicyFollowVO;
import com.yd.product.feign.client.expectedcommissionratio.ApiExpectedCommissionRatioFeignClient;
import com.yd.product.feign.client.expectedspecies.ApiExpectedSpeciesFeignClient;
import com.yd.product.feign.client.product.ApiProductFeignClient;
import com.yd.product.feign.request.expectedspecies.ApiExpectedSpeciesListRequest;
import com.yd.product.feign.response.expectedspecies.ApiExpectedSpeciesListResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
......@@ -44,11 +34,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
......@@ -325,6 +311,39 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
return Collections.singletonMap("policyBizId", policyBizId);
}
@Override
public PolicyFollowDetailVO getPolicyFollowDetailVO(String policyBizId) {
if (StringUtils.isBlank(policyBizId)) {
return null;
}
// 查询主表
PolicyFollow policyFollow = getByPolicyBizId(policyBizId);
if (policyFollow == null) {
return null;
}
// 转换为 DetailVO
PolicyFollowDetailVO detailVO = PolicyFollowDetailVO.objToVo(policyFollow);
// 查询介绍人列表
List<PolicyBroker> brokerList = policyBrokerService.list(
new QueryWrapper<PolicyBroker>()
.eq("policy_biz_id", policyBizId)
.eq("is_deleted", 0)
);
detailVO.setBrokerList(brokerList);
// 查询附加险列表
List<PolicyAdditional> additionalList = policyAdditionalService.list(
new QueryWrapper<PolicyAdditional>()
.eq("policy_biz_id", policyBizId)
.eq("is_deleted", 0)
);
detailVO.setAdditionalList(additionalList);
return detailVO;
}
@Override
public Boolean addToPolicy(List<String> policyNoList) {
......@@ -459,126 +478,6 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
}
}
/**
* 异步聚合查询新单跟进详情
*/
@Override
public PolicyFollowAggregateDto getPolicyFollowAggregate(String policyBizId) {
long startTime = System.currentTimeMillis();
try {
// 1. 异步查询保单信息
CompletableFuture<Policy> policyFuture = asyncQueryUtil.asyncQuery(
() -> policyService.getOne(new QueryWrapper<Policy>().eq("policy_biz_id", policyBizId)),
"查询保单信息"
);
// 1.1 异步查询附加险列表
CompletableFuture<List<PolicyAdditional>> additionalListFuture = asyncQueryUtil.asyncQuery(
() -> policyAdditionalService.list(new QueryWrapper<PolicyAdditional>().eq("policy_biz_id", policyBizId)),
"查询附加险列表"
);
// 1.2 异步查询保单投保人
CompletableFuture<PolicyPolicyholder> policyholderFuture = asyncQueryUtil.asyncQuery(
() -> {
QueryWrapper<PolicyPolicyholder> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("policy_biz_id", policyBizId);
return policyPolicyholderService.getOne(queryWrapper);
},
"查询保单投保人"
);
// 1.3 异步查询保单受保人
CompletableFuture<PolicyInsurant> insurantListFuture = asyncQueryUtil.asyncQuery(
() -> {
QueryWrapper<PolicyInsurant> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("policy_biz_id", policyBizId);
return policyInsurantService.getOne(queryWrapper);
},
"查询保单受保人"
);
// 1.4 异步查询保单受益人
CompletableFuture<List<PolicyBeneficiary>> beneficiaryListFuture = asyncQueryUtil.asyncQuery(
() -> {
QueryWrapper<PolicyBeneficiary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("policy_biz_id", policyBizId);
return policyBeneficiaryService.list(queryWrapper);
},
"查询保单受益人"
);
// 1.5 异步查询保单第二持有人
CompletableFuture<PolicySecondHolder> policySecondHolderFuture = asyncQueryUtil.asyncQuery(
() -> {
QueryWrapper<PolicySecondHolder> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("policy_biz_id", policyBizId);
return policySecondHolderService.getOne(queryWrapper);
},
"查询保单第二持有人"
);
// 1.6 异步查询客户业务ID
CompletableFuture<String> customerBizIdFuture = asyncQueryUtil.asyncQuery(
() -> {
QueryWrapper<PolicyFollow> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("policy_biz_id", policyBizId);
PolicyFollow policyFollow = policyFollowService.getOne(queryWrapper);
return policyFollow != null ? policyFollow.getCustomerBizId() : null;
},
"查询客户业务ID"
);
// 2. 等待所有异步任务完成(设置超时时间)
CompletableFuture.allOf(
policyFuture,
additionalListFuture,
policyholderFuture,
insurantListFuture,
beneficiaryListFuture,
policySecondHolderFuture,
customerBizIdFuture)
.get(5, TimeUnit.SECONDS); // 5秒超时
// 3. 构建聚合结果
PolicyFollowAggregateDto aggregateDto = PolicyFollowAggregateDto.convertToDto(
policyFuture.get(),
additionalListFuture.get(),
policyholderFuture.get(),
insurantListFuture.get(),
beneficiaryListFuture.get(),
policySecondHolderFuture.get(),
customerBizIdFuture.get()
);
long costTime = System.currentTimeMillis() - startTime;
log.info("新单跟进聚合查询完成, policyBizId: {}, 总耗时: {}ms", policyBizId, costTime);
return aggregateDto;
} catch (Exception e) {
log.error("新单跟进聚合查询失败, policyBizId: {}, 错误: {}", policyBizId, e.getMessage(), e);
PolicyFollowAggregateDto errorDto = new PolicyFollowAggregateDto();
errorDto.setErrorMessage("查询失败: " + e.getMessage());
return errorDto;
}
}
@Override
public Page<PolicyFollowDetailVO> getPolicyFollowDetailVOList(Page<PolicyFollow> policyFollowPage) {
List<PolicyFollow> policyFollowList = policyFollowPage.getRecords();
Page<PolicyFollowDetailVO> policyFollowDetailVOPage = new Page<>(policyFollowPage.getCurrent(), policyFollowPage.getSize(), policyFollowPage.getTotal());
if (CollUtil.isEmpty(policyFollowList)) {
return policyFollowDetailVOPage;
}
// 对象列表 => 封装对象列表
List<PolicyFollowDetailVO> policyFollowDetailVOList = policyFollowList.stream().map(PolicyFollowDetailVO::objToVo).collect(Collectors.toList());
policyFollowDetailVOPage.setRecords(policyFollowDetailVOList);
return policyFollowDetailVOPage;
}
@Override
public String getCurrencyValue(String currency) {
if (StringUtils.isBlank(currency)) {
......@@ -686,5 +585,126 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
return policyFollowFileService.save(policyFollowFile);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean saveInitialPayment(InitialPaymentSaveRequest initialPaymentSaveRequest) {
// 校验参数
if (StringUtils.isBlank(initialPaymentSaveRequest.getPolicyBizId())) {
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "policyBizId不能为空");
}
String policyBizId = initialPaymentSaveRequest.getPolicyBizId();
PolicyFollow policyFollow = getByPolicyBizId(policyBizId);
if (policyFollow == null) {
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "新单跟进记录不存在");
}
// 获取当前登录用户
AuthUserDto currentLoginUser = SecurityUtil.getCurrentLoginUser();
String loginUserId = currentLoginUser.getId().toString();
// 更新相关字段
boolean result = this.lambdaUpdate()
.eq(PolicyFollow::getPolicyBizId, policyBizId)
.set(initialPaymentSaveRequest.getInitialPremium() != null, PolicyFollow::getInitialPremium, initialPaymentSaveRequest.getInitialPremium())
.set(initialPaymentSaveRequest.getPolicyLevy() != null, PolicyFollow::getPolicyLevy, initialPaymentSaveRequest.getPolicyLevy())
.set(initialPaymentSaveRequest.getInitialPaymentMethod() != null, PolicyFollow::getInitialPaymentMethod, initialPaymentSaveRequest.getInitialPaymentMethod())
.set(initialPaymentSaveRequest.getInitialPremiumPaid() != null, PolicyFollow::getInitialPremiumPaid, initialPaymentSaveRequest.getInitialPremiumPaid())
.set(initialPaymentSaveRequest.getInitialPremiumDue() != null, PolicyFollow::getInitialPremiumDue, initialPaymentSaveRequest.getInitialPremiumDue())
.set(initialPaymentSaveRequest.getInitialPremiumTotal() != null, PolicyFollow::getInitialPremiumTotal, initialPaymentSaveRequest.getInitialPremiumTotal())
.set(initialPaymentSaveRequest.getLatestPaymentDate() != null, PolicyFollow::getLatestPaymentDate, initialPaymentSaveRequest.getLatestPaymentDate())
.set(initialPaymentSaveRequest.getInitialPremiumDiscount() != null, PolicyFollow::getInitialPremiumDiscount, initialPaymentSaveRequest.getInitialPremiumDiscount())
.set(initialPaymentSaveRequest.getInitialPaymentStatus() != null, PolicyFollow::getInitialPaymentStatus, initialPaymentSaveRequest.getInitialPaymentStatus())
.set(PolicyFollow::getUpdaterId, loginUserId)
.set(PolicyFollow::getUpdateTime, new Date())
.update();
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean saveMailingInfo(MailingInfoSaveRequest mailingInfoSaveRequest) {
// 校验参数
if (StringUtils.isBlank(mailingInfoSaveRequest.getPolicyBizId())) {
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "policyBizId不能为空");
}
String policyBizId = mailingInfoSaveRequest.getPolicyBizId();
PolicyFollow policyFollow = getByPolicyBizId(policyBizId);
if (policyFollow == null) {
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "新单跟进记录不存在");
}
// 获取当前登录用户
AuthUserDto currentLoginUser = SecurityUtil.getCurrentLoginUser();
String loginUserId = currentLoginUser.getId().toString();
// 更新邮寄信息相关字段
boolean result = this.lambdaUpdate()
.eq(PolicyFollow::getPolicyBizId, policyBizId)
.set(mailingInfoSaveRequest.getMailingMethod() != null, PolicyFollow::getMailingMethod, mailingInfoSaveRequest.getMailingMethod())
.set(mailingInfoSaveRequest.getDeliveryNo() != null, PolicyFollow::getDeliveryNo, mailingInfoSaveRequest.getDeliveryNo())
.set(mailingInfoSaveRequest.getBrokerSignDate() != null, PolicyFollow::getBrokerSignDate, mailingInfoSaveRequest.getBrokerSignDate())
.set(mailingInfoSaveRequest.getCustomerSignDate() != null, PolicyFollow::getCustomerSignDate, mailingInfoSaveRequest.getCustomerSignDate())
.set(PolicyFollow::getUpdaterId, loginUserId)
.set(PolicyFollow::getUpdateTime, new Date())
.update();
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean batchSaveBrokers(BrokerBatchSaveRequest brokerBatchSaveRequest) {
// 校验参数
if (StringUtils.isBlank(brokerBatchSaveRequest.getPolicyBizId())) {
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "policyBizId不能为空");
}
String policyBizId = brokerBatchSaveRequest.getPolicyBizId();
PolicyFollow policyFollow = getByPolicyBizId(policyBizId);
if (policyFollow == null) {
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "新单跟进记录不存在");
}
if (CollectionUtils.isEmpty(brokerBatchSaveRequest.getBrokerList())) {
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "介绍人列表不能为空");
}
// 获取当前登录用户
AuthUserDto currentLoginUser = SecurityUtil.getCurrentLoginUser();
String loginUserId = currentLoginUser.getId().toString();
// 删除该 policyBizId 下的所有现有介绍人
policyBrokerService.lambdaUpdate()
.eq(PolicyBroker::getPolicyBizId, policyBizId)
.remove();
// 批量插入新的介绍人记录
List<PolicyBroker> brokerList = new ArrayList<>();
for (BrokerBatchSaveRequest.BrokerInfo brokerInfo : brokerBatchSaveRequest.getBrokerList()) {
PolicyBroker policyBroker = new PolicyBroker();
policyBroker.setPolicyBizId(policyBizId);
policyBroker.setPolicyNo(policyFollow.getPolicyNo());
policyBroker.setBrokerName(brokerInfo.getBrokerName());
policyBroker.setBrokerBizId(brokerInfo.getBrokerBizId());
policyBroker.setGender(brokerInfo.getGender());
policyBroker.setInternalCode(brokerInfo.getInternalCode());
policyBroker.setTeam(brokerInfo.getTeam());
policyBroker.setTeamBizId(brokerInfo.getTeamBizId());
policyBroker.setBrokerRatio(brokerInfo.getBrokerRatio());
policyBroker.setRemark(brokerInfo.getRemark());
policyBroker.setIsDeleted(0);
policyBroker.setCreatorId(loginUserId);
policyBroker.setCreateTime(new Date());
policyBroker.setUpdaterId(loginUserId);
policyBroker.setUpdateTime(new Date());
brokerList.add(policyBroker);
}
return policyBrokerService.saveBatch(brokerList);
}
}
......@@ -2,6 +2,7 @@ package com.yd.csf.service.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yd.csf.service.enums.PolicyFollowStatusEnum;
import com.yd.csf.service.model.PolicyAdditional;
import com.yd.csf.service.model.PolicyBroker;
import com.yd.csf.service.model.PolicyFollow;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -13,250 +14,459 @@ import java.math.BigDecimal;
import java.util.*;
/**
* 新单跟进 DetailVO
* 新单跟进详情VO
*/
@Data
@Schema(description = "新单跟进详情")
public class PolicyFollowDetailVO implements Serializable {
/**
* id
*/
@Schema(description = "policy follow id")
private Long id;
/**
* 新单跟进唯一业务ID
*/
@Schema(description = "新单跟进唯一业务ID")
private String policyBizId;
/**
* 保单号
*/
@Schema(description = "保单号")
private String policyNo;
/**
* 预约信息主表唯一业务ID
*/
@Schema(description = "预约信息主表唯一业务ID")
private String appointmentBizId;
/**
* 预约编号
*/
@Schema(description = "预约编号")
private String appointmentNo;
/**
* 用户业务id
*/
private String userBizId;
/**
* 客户业务id
*/
@Schema(description = "客户业务ID")
private String customerBizId;
/**
* 客户名称
* 递交日期
*/
private String customerName;
@Schema(description = "递交日期")
private Date submitDate;
/**
* 递交日期
* 客户名称
*/
private Date submitDate;
@Schema(description = "客户名称")
private String customerName;
/**
* 签单日期
*/
@Schema(description = "签单日期")
private Date signDate;
/**
* 签单人
*/
@Schema(description = "签单人")
private String signer;
/**
* 签单人业务id
*/
@Schema(description = "签单人业务ID")
private String signerBizId;
/**
* 签单人执业编号
*/
@Schema(description = "签单人执业编号")
private String signerRegNo;
/**
* 签单地点
*/
@Schema(description = "签单地点")
private String signLocation;
/**
* 缮发日期
*/
@Schema(description = "缮发日期")
private Date issueDate;
/**
* 冷静期结束日期
*/
@Schema(description = "冷静期结束日期")
private Date coolingOffEndDate;
/**
* 冷静期天数
*/
@Schema(description = "冷静期天数")
private Integer coolingOffDays;
/**
* 核保日期
*/
@Schema(description = "核保日期")
private Date underwritingDate;
/**
* 生效日期
*/
@Schema(description = "生效日期")
private Date effectiveDate;
/**
* 续保日期
*/
@Schema(description = "续保日期")
private Date renewalDate;
/**
* 保单回执日期
*/
@Schema(description = "保单回执日期")
private Date receiptDate;
/**
* 回执状态
*/
@Schema(description = "回执状态")
private String receiptStatus;
/**
* 是否开通直接支付
*/
@Schema(description = "是否开通直接支付")
private Integer directPaymentEnabled;
/**
* 供款年期
*/
private Object paymentTerm;
@Schema(description = "供款年期")
private Integer issueNumber;
/**
* 保障期限
*/
@Schema(description = "保障期限")
private Integer guaranteePeriod;
/**
* 保额(重疾险)
*/
@Schema(description = "保额(重疾险)")
private BigDecimal sumInsured;
/**
* 付款频率(字典)
*/
@Schema(description = "付款频率")
private String paymentFrequency;
/**
* 期交保费
* 每期保费
*/
private BigDecimal paymentPremium;
@Schema(description = "每期保费")
private BigDecimal eachIssuePremium;
/**
* 是否预缴: 0-否, 1-是
*/
private Integer isPrepaid;
@Schema(description = "是否预缴: 0-否, 1-是")
private Integer isPrepay;
/**
* 是否追溯: 0-否, 1-是
*/
@Schema(description = "是否追溯: 0-否, 1-是")
private Integer isTraceable;
/**
* 回溯日期
*/
@Schema(description = "回溯日期")
private Date retroactiveDate;
/**
* 预缴年期
*/
@Schema(description = "预缴年期")
private Integer prepaidTerm;
/**
* 预付额
*/
@Schema(description = "预付额")
private String prepaidAmount;
/**
* 折扣后预付额
*/
@Schema(description = "折扣后预付额")
private String prepaidAmountAfterDiscount;
/**
* 保单截止日期
*/
@Schema(description = "保单截止日期")
private Date policyExpirationDate;
/**
* 缴费编号
*/
@Schema(description = "缴费编号")
private String paymentNumber;
/**
* 产品上架信息表唯一业务ID
*/
@Schema(description = "产品上架信息表唯一业务ID")
private String productLaunchBizId;
/**
* 产品名称
*/
@Schema(description = "产品名称")
private String productName;
/**
* 产品类别
*/
@Schema(description = "产品类别")
private String productCate;
/**
* 保险公司
*/
@Schema(description = "保险公司")
private String insuranceCompany;
/**
* 保险公司业务id
*/
@Schema(description = "保险公司业务ID")
private String insuranceCompanyBizId;
/**
* 对账公司
*/
@Schema(description = "对账公司")
private String reconciliationCompany;
/**
* 对账公司业务id
*/
@Schema(description = "对账公司业务ID")
private String reconciliationCompanyBizId;
/**
* 新单跟进状态
*/
@Schema(description = "新单跟进状态")
private String status;
/**
* 下一步跟进状态列表
*/
@Schema(description = "下一步跟进状态列表")
private Object nextStatusList;
/**
* 保單持有人
*/
@Schema(description = "保单持有人")
private String policyHolder;
/**
* 受保人
*/
@Schema(description = "受保人")
private String insured;
/**
* 币种
* 受保人年龄
*/
@Schema(description = "受保人年龄")
private Integer insuredAge;
/**
* 宽限期
*/
@Schema(description = "宽限期")
private Integer gracePeriod;
/**
* 是否参加递增保障权益: 0-否, 1-是(字典)
*/
@Schema(description = "是否参加递增保障权益: 0-否, 1-是")
private Integer isJoin;
/**
* 保单币种
*/
@Schema(description = "保单币种")
private String policyCurrency;
/**
* 首期付款方式(字典)
*/
private String currency;
@Schema(description = "首期付款方式")
private String initialPaymentMethod;
/**
* 首期保费(不含徽费,预缴保费)
*/
private Object initialPremium;
@Schema(description = "首期保费(不含徽费,预缴保费)")
private BigDecimal initialPremium;
/**
* 首期已缴保费
*/
@Schema(description = "首期已缴保费")
private BigDecimal initialPremiumPaid;
/**
* 首期待缴保费
*/
@Schema(description = "首期待缴保费")
private BigDecimal initialPremiumDue;
/**
* 首期缴费总额
*/
@Schema(description = "首期缴费总额")
private BigDecimal initialPremiumTotal;
/**
* 首期缴费状态
*/
@Schema(description = "首期缴费状态")
private String initialPaymentStatus;
/**
* 首期保费优惠金额
*/
@Schema(description = "首期保费优惠金额")
private BigDecimal initialPremiumDiscount;
/**
* 寄送方式 1-自提, 2-快递
* 寄送方式 字典值:1-自提 2-快递
*/
@Schema(description = "寄送方式 1-自提 2-快递")
private String mailingMethod;
/**
* 续期付款方式(字典)
*/
@Schema(description = "续期付款方式")
private String renewalPaymentMethod;
/**
* 红利付款方式(字典)
*/
@Schema(description = "红利付款方式")
private String dividendPaymentMethod;
/**
* 快递单号
*/
@Schema(description = "快递单号")
private String deliveryNo;
/**
* 保单征费
*/
@Schema(description = "保单征费")
private String policyLevy;
/**
* 最晚缴费日期
*/
@Schema(description = "最晚缴费日期")
private Date latestPaymentDate;
/**
* 经纪公司签收日期
*/
private String brokerSignDate;
@Schema(description = "经纪公司签收日期")
private Date brokerSignDate;
/**
* 保险公司寄出日期
*/
private String insurerMailingDate;
@Schema(description = "保险公司寄出日期")
private Date insurerMailingDate;
/**
* 客户签收日期
*/
private String customerSignDate;
@Schema(description = "客户签收日期")
private Date customerSignDate;
/**
* 附件列表
* 附件地址列表 逗号隔开
*/
@Schema(description = "附件地址列表")
private String attachments;
/**
* 转介人
* 转介人列表
*/
@Schema(description = "转介人")
@Schema(description = "转介人列表")
private List<PolicyBroker> brokerList;
/**
* 备注
* 附加险列表
*/
@Schema(description = "附加险列表")
private List<PolicyAdditional> additionalList;
/**
* 通用备注
*/
@Schema(description = "通用备注")
private String remark;
/**
* 删除标识: 0-正常, 1-删除
*/
@TableField()
@Schema(description = "删除标识: 0-正常, 1-删除")
private Integer isDeleted;
/**
* 创建人ID
*/
@Schema(description = "创建人ID")
private String creatorId;
/**
* 更新人ID
*/
@Schema(description = "更新人ID")
private String updaterId;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@Schema(description = "更新时间")
private Date updateTime;
@TableField(exist = false)
......@@ -265,17 +475,17 @@ public class PolicyFollowDetailVO implements Serializable {
/**
* 对象转封装类
*
* @param policyFollow
* @return
* @param policyFollow 新单跟进实体
* @return PolicyFollowDetailVO
*/
public static PolicyFollowDetailVO objToVo(PolicyFollow policyFollow) {
if (policyFollow == null) {
return null;
}
PolicyFollowDetailVO PolicyFollowDetailVO = new PolicyFollowDetailVO();
PolicyFollowDetailVO.setPolicyBizId(policyFollow.getPolicyBizId());
PolicyFollowDetailVO detailVO = new PolicyFollowDetailVO();
detailVO.setPolicyBizId(policyFollow.getPolicyBizId());
// 转换PolicyFollow
BeanUtils.copyProperties(policyFollow, PolicyFollowDetailVO);
BeanUtils.copyProperties(policyFollow, detailVO);
// 处理 nextStatusList 字段
Object nextStatusList = policyFollow.getNextStatusList();
if (nextStatusList != null && !nextStatusList.toString().isEmpty()) {
......@@ -283,13 +493,16 @@ public class PolicyFollowDetailVO implements Serializable {
List<Map<String, String>> statusMapList = new ArrayList<>();
for (String status : statusArr) {
Map<String, String> map = new HashMap<>();
map.put("itemLabel", PolicyFollowStatusEnum.getEnumByValue(status).getItemLabel());
PolicyFollowStatusEnum statusEnum = PolicyFollowStatusEnum.getEnumByValue(status);
if (statusEnum != null) {
map.put("itemLabel", statusEnum.getItemLabel());
map.put("itemValue", status);
}
statusMapList.add(map);
}
PolicyFollowDetailVO.setNextStatusList(statusMapList);
detailVO.setNextStatusList(statusMapList);
}
return PolicyFollowDetailVO;
return detailVO;
}
}
......@@ -10,6 +10,8 @@
<result property="policyNo" column="policy_no" />
<result property="brokerName" column="broker_name" />
<result property="brokerBizId" column="broker_biz_id" />
<result property="gender" column="gender" />
<result property="internalCode" column="internal_code" />
<result property="team" column="team" />
<result property="teamBizId" column="team_biz_id" />
<result property="brokerRatio" column="broker_ratio" />
......@@ -22,8 +24,8 @@
</resultMap>
<sql id="Base_Column_List">
id,policy_biz_id,policy_no,broker_name,broker_biz_id,team,broker_ratio,
team_biz_id,remark,is_deleted,creator_id,updater_id,
id,policy_biz_id,policy_no,broker_name,broker_biz_id,gender,internal_code,
team,broker_ratio,team_biz_id,remark,is_deleted,creator_id,updater_id,
create_time,update_time
</sql>
</mapper>
......@@ -57,6 +57,9 @@
<result property="policyCurrency" column="policy_currency" />
<result property="initialPaymentMethod" column="initial_payment_method" />
<result property="initialPremium" column="initial_premium" />
<result property="initialPremiumTotal" column="initial_premium_total" />
<result property="initialPaymentStatus" column="initial_payment_status" />
<result property="initialPremiumDiscount" column="initial_premium_discount" />
<result property="mailingMethod" column="mailing_method" />
<result property="renewalPaymentMethod" column="renewal_payment_method" />
<result property="dividendPaymentMethod" column="dividend_payment_method" />
......@@ -88,7 +91,8 @@
product_name,product_cate,insurance_company,insurance_company_biz_id,reconciliation_company,
reconciliation_company_biz_id,status,next_status_list,policy_holder,insured,
insured_age,grace_period,is_join,policy_currency,initial_payment_method,
initial_premium,mailing_method,renewal_payment_method,dividend_payment_method,delivery_no,
initial_premium,initial_premium_total,initial_payment_status,initial_premium_discount,
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
......
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