Commit 6dc4fb70 authored by hongguangwu's avatar hongguangwu

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

parents 3f3aefcc 2b349193
......@@ -189,8 +189,8 @@ public interface CommonConstants {
/**
* 月份(阿里编码规约不允许直接使用‘魔法值’)
* @Author pwang
* @Date 2019-08-02 16:39
* @Author zhaji
* @Date 2022-07-28 16:39
**/
String[] MonthStrArray = {"0","1","2","3","4","5","6","7","8","9","10","11","12"};
......@@ -409,14 +409,14 @@ public interface CommonConstants {
String SEVEN_STRING = "7";
/**
* 工资最小不能小于零
* 工资最大不能超过9999999.99
*/
public static final String MONEY_MAX = "9999999.99";
public static final BigDecimal MONEY_MAX = new BigDecimal("9999999.99");
/**
* 工资最小不能小于零
*/
public static final String MONEY_MIN = "0";
public static final BigDecimal MONEY_MIN = new BigDecimal(0);
public static final int TWENTY_INT = 20;
......
......@@ -100,6 +100,10 @@ public class InsurancesConstants {
* 当前记录是投保中,无法替换
*/
public static final String TWO_REPLACE_IS_NOT_ALLOW = "当前记录是投保中,无法替换";
/**
* 当前记录是投保退回,无法替换
*/
public static final String FOUR_REPLACE_IS_NOT_ALLOW = "当前记录是投保退回,无法替换";
/**
* 当前记录已出险,无法替换
*/
......@@ -121,9 +125,9 @@ public class InsurancesConstants {
*/
public static final String REDUCE_REPLACE_IS_NOT_ALLOW = "当前记录在减员流程中,无法替换";
/**
* 已减员,无法退回
* 投保状态不是投保中或已投保,无法退回
*/
public static final String REDUCE_ROLLBACK_IS_NOT_ALLOW = "已减员,无法退回";
public static final String REDUCE_ROLLBACK_IS_NOT_ALLOW = "投保状态不是投保中或已投保,无法退回";
/**
* 员工姓名不能为空
*/
......@@ -160,6 +164,10 @@ public class InsurancesConstants {
* 替换员工未通过实名认证
*/
public static final String REPLACE_EMP_ID_CARD_NO_NOT_FIT = "替换员工未通过实名认证";
/**
* 替换信息和被替换信息一致,无法替换
*/
public static final String REPLACE_EMP_INFO_SAME = "替换信息和被替换信息一致,无法替换";
/**
* 替换员工身份证号格式有误
*/
......@@ -312,10 +320,34 @@ public class InsurancesConstants {
* 商险投保中,无法登记保单保费
*/
public static final String BUY_HANDLE_TWO_NOT_REGISTERED = "商险投保中,无法登记保单保费";
/**
* 非投保中状态,无法标记投保成功
*/
public static final String INSURANCE_BUY_STATUS_NOT_TWO = "非投保中状态,无法标记投保成功";
/**
* 商险投保退回,无法登记保单保费
*/
public static final String BUY_HANDLE_FOUR_NOT_REGISTERED = "商险投保退回,无法登记保单保费";
/**
* 商险结算中,无法登记保单保费
*/
public static final String SETTLE_HANDLE_TWO_NOT_REGISTERED = "商险结算中,无法登记保单保费";
/**
* 商险已结算,无法登记保单保费
*/
public static final String SETTLE_HANDLE_THREE_NOT_REGISTERED = "商险已结算,无法登记保单保费";
/**
* 保单号不存在或已过期
*/
public static final String POLICY_NO_EXIST = "保单号不存在或已过期";
/**
* 保单号不存
*/
public static final String POLICY_NO_NOT_EXIST = "保单号不存";
/**
* 保单号信息错误
*/
public static final String POLICY_NO_ERROR = "保单号信息错误";
/**
* 保险公司错误
*/
......
......@@ -10,6 +10,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.checkerframework.common.value.qual.StringVal;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
......@@ -37,6 +38,7 @@ public class TInsuranceCompany extends BaseEntity {
*/
@NotBlank(message = "保险公司名称不能为空")
@Schema(description = "保险公司名称")
@Length(max =60,message = "保险公司名称必须小于等于60")
private String companyName;
/**
......@@ -44,6 +46,7 @@ public class TInsuranceCompany extends BaseEntity {
*/
@NotBlank(message = "保险公司地址不能为空")
@Schema(description = "保险公司地址")
@Length(max =50,message = "保险公司地址必须小于等于50")
private String companyAddress;
/**
......@@ -51,6 +54,7 @@ public class TInsuranceCompany extends BaseEntity {
*/
@NotBlank(message = "对接人不能为空")
@Schema(description = "对接人")
@Length(max =20,message = "险种名称必须小于等于20")
private String companyDocking;
/**
......
......@@ -203,6 +203,12 @@ public class TInsuranceDetail extends BaseEntity {
@Schema(description = "预估保费")
private BigDecimal estimatePremium;
/**
* 是否标记投保成功标识 0 未标记过 1标记过
*/
@Schema(description = "是否标记投保成功标识 0 未标记过 1标记过")
private Integer signFlag;
/**
* 投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
*/
......
......@@ -33,7 +33,7 @@ public class TInsuranceSettle implements Serializable {
private String insDetailId;
/**
* 结算状态
* 结算状态 1、待结算,2、结算中,3、已结算
*/
@Schema(description = "结算状态 1、待结算,2、结算中,3、已结算")
private String settleHandleStatus;
......
......@@ -8,10 +8,10 @@ import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* 险种表
......@@ -34,6 +34,7 @@ public class TInsuranceType extends BaseEntity {
*/
@NotBlank(message = "险种名称不能为空")
@Schema(description = "险种名称")
@Length(max =50,message = "险种名称必须小于等于50")
private String name;
/**
......@@ -48,6 +49,7 @@ public class TInsuranceType extends BaseEntity {
*/
@NotBlank(message = "收款单位名称不能为空")
@Schema(description = "收款单位名称")
@Length(max =50,message = "收款单位名称必须小于等于50")
private String receiptUnitName;
/**
......@@ -55,6 +57,7 @@ public class TInsuranceType extends BaseEntity {
*/
@NotBlank(message = "收款银行名称不能为空")
@Schema(description = "收款银行名称")
@Length(max =50,message = "收款银行名称必须小于等于50")
private String bankName;
/**
......@@ -62,6 +65,7 @@ public class TInsuranceType extends BaseEntity {
*/
@NotBlank(message = "收款银行账号不能为空")
@Schema(description = "收款银行账号")
@Length(max =50,message = "收款银行账号必须小于等于50")
private String bankNo;
/**
......
......@@ -34,7 +34,7 @@ public class TInsuranceTypeStandard extends BaseEntity {
*/
@Schema(description = "险种主键ID")
@NotBlank(message = "险种主键ID不能为空")
private Long insuranceTypeId;
private String insuranceTypeId;
/**
* 购买标准
......
......@@ -4,6 +4,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import java.math.BigDecimal;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
......@@ -154,22 +155,22 @@ public class ValidityUtil {
/**
* 判断是否是整数或者是携带一位或者两位的小数
* @param refundMoney 金额
* @param money 金额
* @return boolean
*/
public static boolean validateMoney(final String refundMoney) {
if(Common.isEmpty(refundMoney)){
public static boolean validateMoney(final String money) {
if(Common.isEmpty(money)){
return Boolean.FALSE ;
}
if(!BigDecimalUtils.isBigDecimal(refundMoney)){
if(!BigDecimalUtils.isBigDecimal(money)){
return Boolean.FALSE ;
}
if(!refundMoney.matches(ValidityConstants.POSITIVE_INTEGER_PATTERN_TWO_FLOAT)){
if(!money.matches(ValidityConstants.POSITIVE_INTEGER_PATTERN_TWO_FLOAT)){
return Boolean.FALSE ;
}
boolean max = refundMoney.compareTo(CommonConstants.MONEY_MAX) < 0;
boolean min = refundMoney.compareTo(CommonConstants.MONEY_MIN) > 0;
if (!max || !min){
BigDecimal bigDecimalMoney= new BigDecimal(money);
boolean max = bigDecimalMoney.compareTo(CommonConstants.MONEY_MAX) >0;
if(max){
return Boolean.FALSE ;
}
return Boolean.TRUE;
......
......@@ -132,7 +132,7 @@ public class InsuranceAddParam implements Serializable {
* 险种主键
*/
@JsonIgnore
private Long insuranceTypeId;
private String insuranceTypeId;
/**
* 商险购买地省code
......
......@@ -128,7 +128,7 @@ public class InsuranceBatchParam implements Serializable {
* 险种主键
*/
@JsonIgnore
private Long insuranceTypeId;
private String insuranceTypeId;
/**
* 商险购买地省code
......
......@@ -155,5 +155,5 @@ public class InsuranceEditParam implements Serializable {
* 险种主键
*/
@JsonIgnore
private Long insuranceTypeId;
private String insuranceTypeId;
}
......@@ -48,4 +48,7 @@ public interface TInsuranceTypeMapper extends BaseMapper<TInsuranceType> {
* @return {@link IPage< InsuranceTypeVo>}
*/
IPage<InsuranceTypeVo> selectInsuranceTypePage(Page page, @Param("insuranceType") TInsuranceType insuranceType);
InsuranceTypeVo getInsuranceTypeDetailById(String id);
}
......@@ -356,15 +356,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.EMP_ID_CARD_NO_NOT_FIT);
}
}
// 保单开始日期 > 当前派单日期
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
return R.failed(InsurancesConstants.POLICY_START_PARSE_ERROR);
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
return R.failed(InsurancesConstants.POLICY_END_PARSE_ERROR);
}
if(!LocalDateUtil.isFutureDate(param.getPolicyStart())){
return R.failed(InsurancesConstants.POLICY_START_SHOULD_IS_FUTURE);
//如果不是补单的,需要校验:保单开始日期 > 当前派单日期
if (byId.getSignFlag() == CommonConstants.ZERO_INT){
if(!LocalDateUtil.isFutureDate(param.getPolicyStart())){
return R.failed(InsurancesConstants.POLICY_START_SHOULD_IS_FUTURE);
}
}
// 保险公司-险种-购买标准 是否存在
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(Wrappers.<TInsuranceCompany>query().lambda()
......@@ -560,7 +563,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<TInsuranceDetail> successList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(detailList)){
for (TInsuranceDetail detail : detailList) {
if (detail.getBuyHandleStatus() == CommonConstants.FIVE_INT){
if (detail.getBuyHandleStatus() != CommonConstants.TWO_INT
&& detail.getBuyHandleStatus() != CommonConstants.THREE_INT){
InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.REDUCE_ROLLBACK_IS_NOT_ALLOW);
......@@ -575,6 +579,34 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
if (CollectionUtils.isNotEmpty(successList)){
//todo 判断是否推送过保费到ekp,如果推送过就新增一条负的,将结算表中的数据求和放到明细表中
for (TInsuranceDetail detail : successList) {
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
TInsuranceSettle burden = new TInsuranceSettle();
BeanCopyUtils.copyProperties(settle,burden);
burden.setId(null);
burden.setCreateTime(LocalDateTime.now());
burden.setUpdateTime(LocalDateTime.now());
if (burden.getActualPremium() != null){
burden.setActualPremium(burden.getActualPremium().negate());
burden.setActualPushTime(LocalDateTime.now());
detail.setActualPremium(new BigDecimal("0.00"));
}
if (burden.getEstimatePremium() != null){
burden.setEstimatePremium(burden.getEstimatePremium().negate());
burden.setEstimatePushTime(LocalDateTime.now());
detail.setEstimatePremium(new BigDecimal("0.00"));
}
tInsuranceSettleService.save(burden);
//推送负的给ekp
detail.setDefaultSettleId(burden.getId());
}
}
}
//更新状态
this.saveOrUpdateBatch(successList);
}
......@@ -608,50 +640,90 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<TInsuranceDetail> successList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(detailList)){
for (TInsuranceDetail detail : detailList) {
//根据结算类型判断是否需要计算预估保费
//预估
if (detail.getSettleType() == CommonConstants.ZERO_INT){
//根据险种获取费率,没费率返回错误
TInsuranceType insuranceType = tInsuranceTypeService.getById(detail.getInsuranceTypeId());
//险种存不存在
if (!Optional.ofNullable(insuranceType).isPresent()){
InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST);
errorList.add(listVO);
}else {
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getById(insuranceType.getInsuranceCompanyId());
//保险公司存不存在
if (!Optional.ofNullable(insuranceCompany).isPresent()){
//先判断投保状态是不是投保中,如果不是不给标记办理成功,防止重复推数据
if(detail.getBuyHandleStatus() != CommonConstants.TWO_INT){
InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_BUY_STATUS_NOT_TWO);
errorList.add(listVO);
}else {
//根据结算类型判断是否需要计算预估保费
//预估
if (detail.getSettleType() == CommonConstants.ZERO_INT){
//根据险种获取费率,没费率返回错误
TInsuranceType insuranceType = tInsuranceTypeService.getById(detail.getInsuranceTypeId());
//险种存不存在
if (!Optional.ofNullable(insuranceType).isPresent()){
InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST);
errorList.add(listVO);
}else {
if (CommonConstants.ONE_STRING.equals(insuranceCompany.getBillingType())){
//按月查费率
//计算起止时间的月数
long month = LocalDateUtil.betweenMonth(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString());
TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda()
.eq(TInsuranceTypeRate::getInsuranceTypeId, detail.getInsuranceTypeId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_RATE_NOT_EXIST);
errorList.add(listVO);
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getById(insuranceType.getInsuranceCompanyId());
//保险公司存不存在
if (!Optional.ofNullable(insuranceCompany).isPresent()){
InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST);
errorList.add(listVO);
}else {
if (CommonConstants.ONE_STRING.equals(insuranceCompany.getBillingType())){
//按月查费率
//计算起止时间的月数
long month = LocalDateUtil.betweenMonth(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString());
TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda()
.eq(TInsuranceTypeRate::getInsuranceTypeId, detail.getInsuranceTypeId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO);
listVO.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_RATE_NOT_EXIST);
errorList.add(listVO);
}else {
// 预估保费 = 费率 * 购买标准
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).multiply(new BigDecimal(typeRate.getRate())).setScale(2,BigDecimal.ROUND_HALF_UP);
detail.setEstimatePremium(estimatePremium);
if (detail.getBuyType() == CommonConstants.THREE_INT){
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
}
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
detail.setSignFlag(CommonConstants.ONE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
}
}else {
// 预估保费 = 费率 * 购买标准
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).multiply(new BigDecimal(typeRate.getRate())).setScale(2,BigDecimal.ROUND_HALF_UP);
//按天
//计算起止时间的天数
long day = LocalDateUtil.betweenDay(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString());
//预估保费 = (购买标准 / 365) * 天数
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).divide(new BigDecimal("365")).multiply(new BigDecimal(day)).setScale(2,BigDecimal.ROUND_HALF_UP);
detail.setEstimatePremium(estimatePremium);
if (detail.getBuyType() == CommonConstants.THREE_INT){
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
}
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
detail.setSignFlag(CommonConstants.ONE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
......@@ -662,56 +734,31 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
settle.setIsEstimatePush(CommonConstants.ZERO_INT);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
}
}else {
//按天
//计算起止时间的天数
long day = LocalDateUtil.betweenDay(detail.getPolicyStart().toString(), detail.getPolicyEnd().toString());
//预估保费 = (购买标准 / 365) * 天数
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).divide(new BigDecimal("365")).multiply(new BigDecimal(day)).setScale(2,BigDecimal.ROUND_HALF_UP);
detail.setEstimatePremium(estimatePremium);
if (detail.getBuyType() == CommonConstants.THREE_INT){
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
}
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
settle.setIsEstimatePush(CommonConstants.ZERO_INT);
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
}
}
}
}
//实缴
if(detail.getSettleType() == CommonConstants.ONE_INT){
if (detail.getBuyType() == CommonConstants.THREE_INT){
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
//实缴
if(detail.getSettleType() == CommonConstants.ONE_INT){
if (detail.getBuyType() == CommonConstants.THREE_INT){
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
}
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
detail.setSignFlag(CommonConstants.ONE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
successList.add(detail);
}
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
successList.add(detail);
}
}
}
......@@ -719,7 +766,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//更新
this.saveOrUpdateBatch(successList);
//todo 根据结算类型推送预估保费到ekp
//todo 根据结算类型是合并结算,推送预估保费到ekp(上面已经算好,这里直接判断有预估保费的就推送)
//结算状态是待结算,结算中、已结算是ekp反馈的,如果结算失败,反馈到我们这边的状态是待结算
}
//根据项目编码获取项目名称
setProjectNameByDeptNo(errorList);
......@@ -763,16 +811,50 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(success.getPolicyEnd()))
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (detail.getActualPremium() != null){
// 已推送过,只更新发票号
if (StringUtils.isNotBlank(success.getInvoiceNo())){
detail.setInvoiceNo(success.getInvoiceNo());
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
this.updateById(detail);
}else {
// todo 根据结算类型判断推送ekp
}
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
if (StringUtils.isNotBlank(success.getPolicyNo())){
detail.setPolicyNo(success.getPolicyNo());
}
if (StringUtils.isNotBlank(success.getActualPremium())){
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
// todo 判断是否推送过ekp,没推送过调新增接口,推送过调更新接口
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
settle.setActualPremium(detail.getActualPremium());
settle.setIsActualPush(CommonConstants.ONE_INT);
settle.setActualPushTime(LocalDateTime.now());
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调更新接口
}
}else {
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setActualPremium(detail.getActualPremium());
//调完ekp接口才会是1
settle.setIsActualPush(CommonConstants.ONE_INT);
settle.setActualPushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
//调新增接口
}
}
//可以改成批量更新
this.updateById(detail);
detailList.add(detail);
}
}
......@@ -1478,6 +1560,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
if (param.getEmpName().equals(param.getReplaceEmpName()) && param.getEmpIdcardNo().equals(param.getReplaceEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.REPLACE_EMP_INFO_SAME);
listResult.add(param);
continue;
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
......@@ -1535,6 +1623,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
// 投保状态 投保退回 不能替换
if (detail.getBuyHandleStatus() == CommonConstants.FOUR_INT){
param.setErrorMessage(InsurancesConstants.FOUR_REPLACE_IS_NOT_ALLOW);
listResult.add(param);
continue;
}
// 投保状态 已投保 已出险 不能替换
if (detail.getBuyHandleStatus() == CommonConstants.THREE_INT
&& detail.getIsUse() == CommonConstants.ONE_INT){
......@@ -1723,6 +1817,46 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
//批增类型,保单号不存在
if (detail.getBuyType() == CommonConstants.THREE_INT){
TInsuranceDetail batchPolicyNo = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(batchPolicyNo).isPresent()){
param.setErrorMessage(InsurancesConstants.POLICY_NO_NOT_EXIST);
listResult.add(param);
continue;
}else {
//批增类型,保单号已存在但是和派单时填写的不一致
if (!detail.getPolicyNo().equals(param.getPolicyNo())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_ERROR);
listResult.add(param);
continue;
}
}
}
//新增类型,保单号已存在但是和填写的保险公司不一致
if (detail.getBuyType() == CommonConstants.ONE_INT){
TInsuranceDetail addPolicyNo = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(addPolicyNo).isPresent()){
if (!addPolicyNo.getInsuranceCompanyName().equals(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_COMPANY_NAME_NOT_SAME);
listResult.add(param);
continue;
}
if (!addPolicyNo.getInsuranceTypeName().equals(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_TYPE_NAME_NOT_SAME);
listResult.add(param);
continue;
}
}
}
}
if (detail.getBuyType() == CommonConstants.FOUR_INT){
param.setErrorMessage(InsurancesConstants.BUY_TYPE_FOUR_NOT_REGISTERED);
......@@ -1739,6 +1873,26 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if (detail.getBuyHandleStatus() == CommonConstants.FOUR_INT){
param.setErrorMessage(InsurancesConstants.BUY_HANDLE_FOUR_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
if (CommonConstants.TWO_STRING.equals(settle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (CommonConstants.THREE_STRING.equals(settle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
}
}
}
}
listSuccess.add(param);
}
......
......@@ -58,26 +58,38 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
* 新增险种信息
*
* @author zhaji
* @param insuranceType 新增参数
* @param insuranceType 新增险种信息
* @return {@link R}
*/
@Override
public R saveInsuranceType(TInsuranceType insuranceType) {
if(Common.isEmpty(insuranceType)){
return R.failed("新增的险种信息为空");
}
YifuUser user = SecurityUtils.getUser();
String companyId = insuranceType.getInsuranceCompanyId();
String bankNo = insuranceType.getBankNo();
if(!Common.isNumber(bankNo)){
String bankName = insuranceType.getBankName();
String receiptUnitName = insuranceType.getReceiptUnitName();
if (!ValidityUtil.validate50(insuranceType.getName())){
return R.failed("险种格式不正确");
}
if(!ValidityUtil.validatePositiveInt(bankNo) || !ValidityUtil.validate50(bankNo)){
return R.failed("银行账号格式不正确");
}
if(!ValidityUtil.validate50(bankName)){
return R.failed("收款银行格式不正确");
}
if(!ValidityUtil.validate50(receiptUnitName)){
return R.failed("收款单位名称格式不正确");
}
LambdaQueryWrapper<TInsuranceCompany> companyWrapper = new LambdaQueryWrapper<>();
companyWrapper.eq(TInsuranceCompany::getId,companyId).eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceCompany insuranceCompany = insuranceCompanyService.getOne(companyWrapper);
if(Common.isEmpty(insuranceCompany)){
return R.failed("所属保险公司不存在或已被删除");
}
if (!ValidityUtil.validate50(insuranceType.getName())){
return R.failed("险种名称过长");
}
LambdaQueryWrapper<TInsuranceType> typeWrapper = new LambdaQueryWrapper<>();
typeWrapper.eq(TInsuranceType :: getInsuranceCompanyId ,companyId).eq(TInsuranceType::getName,insuranceType.getName()).eq(TInsuranceType::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceType type = getOne(typeWrapper);
......@@ -104,12 +116,10 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
if (Common.isEmpty(id)){
return R.failed("险种ID不能为空");
}
InsuranceTypeVo insuranceTypeVo = new InsuranceTypeVo();
TInsuranceType byId = getById(id);
if(Common.isEmpty(byId) || byId.getDeleteFlag() == CommonConstants.ONE_INT){
InsuranceTypeVo insuranceTypeVo = this.baseMapper.getInsuranceTypeDetailById(id);
if(Common.isEmpty(insuranceTypeVo)){
return R.failed("当前险种信息不存在或已被删除");
}
BeanCopyUtils.copyProperties(byId,insuranceTypeVo);
List<TInsuranceTypeRate> tInsuranceTypeRates = this.baseMapper.selectInsuranceTypeRateList(id);
List<TInsuranceTypeStandard> tInsuranceTypeStandards = this.baseMapper.selectInsuranceTypeStandardList(id);
insuranceTypeVo.setInsuranceTypeRateList(tInsuranceTypeRates);
......
......@@ -46,7 +46,7 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
* 查询购买标准列表
*
* @author zhaji
* @param id
* @param id 购买标准id
* @return {@link R}
*/
@Override
......@@ -67,7 +67,7 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
* 删除购买标准
*
* @author zhaji
* @param id
* @param id 购买标准id
* @return {@link R}
*/
@Override
......@@ -100,7 +100,7 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
* 新增购买标准
*
* @author zhaji
* @param insuranceTypeStandard
* @param insuranceTypeStandard 购买标准
* @return {@link R}
*/
@Override
......@@ -110,22 +110,22 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
if (Common.isEmpty(insuranceTypeStandard)){
return R.failed("新增的购买标准信息为空");
}
Long insuranceTypeId = insuranceTypeStandard.getInsuranceTypeId();
String insuranceTypeId = insuranceTypeStandard.getInsuranceTypeId();
TInsuranceType byId = tInsuranceTypeService.getById(insuranceTypeId);
if ( Common.isEmpty(byId) || CommonConstants.ONE_INT == byId.getDeleteFlag()){
return R.failed("当前险种信息不存在或已被删除");
return R.failed("险种信息不存在或已被删除");
}
String buyStandard = insuranceTypeStandard.getBuyStandard();
String medicalQuota = insuranceTypeStandard.getMedicalQuota();
String dieDisableQuota = insuranceTypeStandard.getDieDisableQuota();
if (!ValidityUtil.validateMoney(buyStandard)){
return R.failed("当前购买标准格式不正确");
return R.failed("购买标准格式不正确");
}
if (!ValidityUtil.validateMoney(medicalQuota)){
return R.failed("当前医疗额度格式不正确");
return R.failed("医疗额度格式不正确");
}
if (!ValidityUtil.validateMoney(dieDisableQuota)){
return R.failed("当前身故或残疾额度格式不正确");
return R.failed("身故或残疾额度格式不正确");
}
LambdaQueryWrapper<TInsuranceTypeStandard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceTypeStandard::getInsuranceTypeId,insuranceTypeStandard.getInsuranceTypeId())
......@@ -137,7 +137,6 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
insuranceTypeStandard.setCreateBy(user.getId());
insuranceTypeStandard.setCreateName(user.getNickname());
insuranceTypeStandard.setCreateTime(LocalDateTime.now());
return R.ok(this.baseMapper.insert(insuranceTypeStandard),"新增购买标准成功");
}else{
return R.failed("当前险种下的购买标准已存在");
......
......@@ -35,6 +35,7 @@
<result property="settleType" column="SETTLE_TYPE" jdbcType="TINYINT"/>
<result property="actualPremium" column="ACTUAL_PREMIUM" jdbcType="DECIMAL"/>
<result property="estimatePremium" column="ESTIMATE_PREMIUM" jdbcType="DECIMAL"/>
<result property="signFlag" column="SIGN_FLAG" jdbcType="TINYINT"/>
<result property="buyHandleStatus" column="BUY_HANDLE_STATUS" jdbcType="TINYINT"/>
<result property="defaultSettleId" column="DEFAULT_SETTLE_ID" jdbcType="VARCHAR"/>
<result property="reduceHandleStatus" column="REDUCE_HANDLE_STATUS" jdbcType="TINYINT"/>
......@@ -58,7 +59,7 @@
BATCH_DATE,SETTLE_MONTH,INVOICE_NO,
BUY_TYPE,INSURANCE_PROVINCE,INSURANCE_PROVINCE_NAME,INSURANCE_CITY,INSURANCE_CITY_NAME,
INSURANCE_HANDLE_PROVINCE,INSURANCE_HANDLE_PROVINCE_NAME,INSURANCE_HANDLE_CITY,INSURANCE_HANDLE_CITY_NAME,SETTLE_TYPE,
ACTUAL_PREMIUM,ESTIMATE_PREMIUM,
ACTUAL_PREMIUM,ESTIMATE_PREMIUM,SIGN_FLAG,
BUY_HANDLE_STATUS,DEFAULT_SETTLE_ID,REDUCE_HANDLE_STATUS,
IS_USE,IS_EFFECT,IS_OVERDUE,REMARK,
CREATE_BY,CREATE_NAME,CREATE_TIME,
......
......@@ -71,5 +71,24 @@
a.DELETE_FLAG = 0
</select>
<select id="getInsuranceTypeDetailById" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceTypeVo">
select
a.ID as id,
a.NAME as name ,
b.COMPANY_NAME as insuranceCompanyName,
a.INSURANCE_COMPANY_ID as insuranceCompanyId,
a.RECEIPT_UNIT_NAME as receiptUnitName,
a.BANK_NAME as bankName,
a.BANK_NO as bankNo
from
t_insurance_type a,
t_insurance_company b
where
a.INSURANCE_COMPANY_ID = b.ID
and
a.ID = #{id}
and
a.DELETE_FLAG = 0
</select>
</mapper>
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