Commit c7e3e08c authored by 李灿灿's avatar 李灿灿

Merge branch 'feature-licancan' into 'feature/insurance-1.1.0'

Feature licancan

See merge request !278
parents 3b32a37b 05e9bb28
......@@ -15,6 +15,10 @@ public class InsurancesConstants {
* 替换导出新增
*/
public static final String INSERT = "新增";
/**
* 批增
*/
public static final String BATCH_INSERT = "批增";
/**
* 离职
*/
......@@ -59,6 +63,14 @@ public class InsurancesConstants {
* 登记保单保费
*/
public static final String REGISTERED = "登记保单保费";
/**
* 登记发票号
*/
public static final String REGISTERED_INVOICE = "登记发票号";
/**
* 已投保信息修改
*/
public static final String UPDATE_INSURED = "已投保信息修改";
/**
* 新增投保成功
*/
......@@ -253,6 +265,14 @@ public class InsurancesConstants {
* 保单开始时间格式错误
*/
public static final String POLICY_START_PARSE_ERROR = "保单开始时间格式错误";
/**
* 变更后保单开始时间格式错误
*/
public static final String POLICY_START_NEW_PARSE_ERROR = "变更后保单开始时间格式错误";
/**
* 变更后保单结束时间格式错误
*/
public static final String POLICY_END_NEW_PARSE_ERROR = "变更后保单结束时间格式错误";
/**
* 保单开始时间需要大于派单日期
*/
......@@ -261,6 +281,10 @@ public class InsurancesConstants {
* 保单结束时间需要大于保单开始时间
*/
public static final String POLICY_START_SHOULD_LESS_THAN_POLICY_END = "保单结束时间需要大于保单开始时间";
/**
* 保单开始时间需早于保单结束时间
*/
public static final String POLICY_START_NEW_SHOULD_LESS_THAN_POLICY_END_NEW = "保单开始时间需早于保单结束时间";
/**
* 保单起止时间不能超过365天
*/
......@@ -273,10 +297,18 @@ public class InsurancesConstants {
* 保单结束时间格式错误
*/
public static final String POLICY_END_PARSE_ERROR = "保单结束时间格式错误";
/**
* 保单结束时间需要大于派单日期
*/
public static final String POLICY_END_SHOULD_IS_FUTURE = "保单结束时间需要大于派单日期";
/**
* 购买标准不能为空
*/
public static final String BUY_STANDARD_NOT_EMPTY = "购买标准不能为空";
/**
* 变更后保单开始时间、变更后保单结束时间、变更后投保类型三个字段至少填写一个
*/
public static final String CHOOSE_ONE_OF_THREE = "变更后保单开始时间、变更后保单结束时间、变更后投保类型三个字段至少填写一个";
/**
* 购买标准不存在
*/
......@@ -345,6 +377,14 @@ public class InsurancesConstants {
* 保单号长度超过50字符限制
*/
public static final String POLICY_NO_MORE_THAN_50 = "保单号长度超过50字符限制";
/**
* 发票号不能为空
*/
public static final String INVOICE_NO_EMPTY = "发票号不能为空";
/**
* 变更原因不能为空
*/
public static final String REASON_EMPTY = "变更原因不能为空";
/**
* 发票号长度超过50字符限制
*/
......@@ -361,6 +401,10 @@ public class InsurancesConstants {
* 替换类型无法登记保单保费
*/
public static final String BUY_TYPE_FOUR_NOT_REGISTERED= "替换类型无法登记保单保费";
/**
* 变更后投保类型错误
*/
public static final String BUY_TYPE_ERROR_NEW = "变更后投保类型错误";
/**
* 商险待投保,无法登记保单保费
*/
......@@ -389,6 +433,10 @@ public class InsurancesConstants {
* 保单号不存在或已过期
*/
public static final String POLICY_NO_EXIST = "保单号不存在或已过期";
/**
* 保单号被禁用
*/
public static final String POLICY_NO_FORBIDDEN = "保单号被禁用";
/**
* 保单号不存在
*/
......
......@@ -3,12 +3,12 @@ package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDate;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDate;
/**
* @author licancan
* @description 保单号对应起止时间表 t_insurance_policy
......@@ -66,6 +66,13 @@ public class TInsurancePolicy extends BaseEntity {
@Schema(description = "是否删除 0未删除 1删除")
private Integer deleteFlag;
/**
* 购买月数
*/
@TableField(exist = false)
@Schema(description = "购买月数")
private Long buyMonth;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
......
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TBusinessOperate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -10,6 +11,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author licancan
......@@ -380,4 +382,10 @@ public class InsuranceDetailVO implements Serializable {
@Schema(description = "默认结算信息id")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String defaultSettleId;
/**
* 操作记录列表
*/
@Schema(description = "操作记录列表")
List<TBusinessOperate> operateList;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @author licancan
* @description 商险已投保修改请求参数
* @date 2022-12-08 20:16:34
*/
@Data
@Schema(description = "商险已投保修改请求参数")
public class InsuranceInsuredDetailParam implements Serializable {
private static final long serialVersionUID = 1445608325251914773L;
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* 变更后保单开始时间
*/
@Schema(description = "变更后保单开始时间")
private String policyStart;
/**
* 变更后保单结束时间
*/
@Schema(description = "变更后保单结束时间")
private String policyEnd;
/**
* 变更后投保类型
*/
@Schema(description = "变更后投保类型 1新增 3批增")
private Integer buyType;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @author licancan
* @description 商险已投保修改请求参数
* @date 2022-12-08 18:32:11
*/
@Data
@Schema(description = "商险已投保修改请求参数")
public class InsuranceInsuredParam implements Serializable {
private static final long serialVersionUID = -6131541135370797891L;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
private String policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
private String policyEnd;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 变更后保单开始时间
*/
@Schema(description = "变更后保单开始时间")
private String policyStartNew;
/**
* 变更后保单结束时间
*/
@Schema(description = "变更后保单结束时间")
private String policyEndNew;
/**
* 变更后投保类型
*/
@Schema(description = "变更后投保类型, 新增、批增")
private String buyTypeStr;
/**
* 变更后投保类型
*/
@JsonIgnore
private Integer buyType;
/**
* 变更原因
*/
@Schema(description = "变更原因")
private String reason;
/**
* 错误信息
*/
@Schema(description = "错误信息")
private String errorMessage;
}
......@@ -108,5 +108,17 @@ public class InsuranceRefundHandlingParam extends BaseEntity implements Serializ
@Schema(description = "派单结束时间")
private String endDate;
/**
* 购买标准开始
*/
@Schema(description = "购买标准开始")
private String buyStandardStart;
/**
* 购买标准结束
*/
@Schema(description = "购买标准结束")
private String buyStandardEnd;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @author licancan
* @description 登记发票号入参
* @date 2022-12-08 16:33:57
*/
@Data
@Schema(description = "登记发票号入参")
public class InsuranceRegisterInvoiceNoParam implements Serializable {
private static final long serialVersionUID = 7450858109465027195L;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
private String policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
private String policyEnd;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 发票号
*/
@Schema(description = "发票号")
private String invoiceNo;
/**
* 错误信息
*/
@Schema(description = "错误信息")
private String errorMessage;
}
......@@ -4,7 +4,6 @@ import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.checkerframework.common.value.qual.IntVal;
import org.checkerframework.common.value.qual.StringVal;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
......@@ -64,4 +63,16 @@ public class RefundExportListParam extends BaseEntity implements Serializable {
@Schema(description = "商险id集合")
private List<String> idList;
/**
* 购买标准开始
*/
@Schema(description = "购买标准开始")
private String buyStandardStart;
/**
* 购买标准结束
*/
@Schema(description = "购买标准结束")
private String buyStandardEnd;
}
......@@ -297,6 +297,41 @@ public class TInsuranceDetailController {
public R<List<InsuranceRegisterParam>> registeredPolicyPremium(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceRegisterParam> paramList){
return tInsuranceDetailService.registeredPolicyPremium(paramList);
}
/**
* 登记发票号
*
* @author licancan
* @param paramList
* @return {@link R< List<InsuranceRegisterInvoiceNoParam>>}
*/
@Operation(summary = "登记发票号", description = "登记发票号")
@PostMapping("/registeredInvoiceNo")
//@PreAuthorize("@pms.hasPermission('handle_insure_invoice')")
public R<List<InsuranceRegisterInvoiceNoParam>> registeredInvoiceNo(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceRegisterInvoiceNoParam> paramList){
return tInsuranceDetailService.registeredInvoiceNo(paramList);
}
/**
* 已投保信息修改
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceInsuredParam>>}
*/
@Operation(summary = "已投保信息修改", description = "已投保信息修改")
@PostMapping("/updateInsuranceInsured")
//@PreAuthorize("@pms.hasPermission('handle_insured')")
public R<List<InsuranceInsuredParam>> updateInsuranceInsured(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceInsuredParam> paramList){
return tInsuranceDetailService.updateInsuranceInsured(paramList);
}
@PostMapping("/updateInsuranceInsuredById")
@Operation(summary = "已投保信息修改", description = "已投保信息修改")
//@PreAuthorize("@pms.hasPermission('handle_insured_by_id')")
public R<String> updateInsuranceInsuredById(@RequestBody InsuranceInsuredDetailParam param) {
return tInsuranceDetailService.updateInsuranceInsuredById(param);
}
/***********************减员办理********************************/
/**
* 导入减员校验
......
......@@ -180,6 +180,33 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*/
R<List<InsuranceRegisterParam>> registeredPolicyPremium(List<InsuranceRegisterParam> paramList);
/**
* 登记发票号
*
* @author licancan
* @param paramList
* @return {@link R< List<InsuranceRegisterInvoiceNoParam>>}
*/
R<List<InsuranceRegisterInvoiceNoParam>> registeredInvoiceNo(List<InsuranceRegisterInvoiceNoParam> paramList);
/**
* 已投保信息修改
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceInsuredParam>>}
*/
R<List<InsuranceInsuredParam>> updateInsuranceInsured(List<InsuranceInsuredParam> paramList);
/**
* 已投保信息修改
*
* @author licancan
* @param param
* @return {@link R< String>}
*/
R<String> updateInsuranceInsuredById(InsuranceInsuredDetailParam param);
/***********************减员办理********************************/
/**
......
......@@ -113,6 +113,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Resource
@Lazy
private DoJointInsuranceTask doJointInsuranceTask;
@Resource
private TInsurancePolicyService tInsurancePolicyService;
@Resource
private TBusinessOperateService tBusinessOperateService;
/***********************商险办理********************************/
/**
......@@ -935,6 +939,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
List<TBusinessOperate> list = tBusinessOperateService.getOperateListByBusinessId(id);
if (CollectionUtils.isNotEmpty(list)){
insuranceDetailVO.setOperateList(list);
}
}
return insuranceDetailVO;
}
......@@ -1778,6 +1788,15 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
if (StringUtils.isNotBlank(success.getPolicyNo())){
detail.setPolicyNo(success.getPolicyNo());
//保单号不为空,维护到保单表中
TInsurancePolicy policy = new TInsurancePolicy();
policy.setPolicyNo(success.getPolicyNo());
policy.setPolicyStart(detail.getPolicyStart());
policy.setPolicyEnd(detail.getPolicyEnd());
policy.setInsuranceCompanyName(detail.getInsuranceCompanyName());
policy.setInsuranceTypeName(detail.getInsuranceTypeName());
tInsurancePolicyService.saveTInsurancePolicy(policy);
//如果保单号不为空,将替换类型的保单号也全部更新
List<TInsuranceReplace> list = tInsuranceReplaceService.list(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getOriginInsuranceDetailId, detail.getId()));
......@@ -1984,6 +2003,144 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.ok(operatList,InsurancesConstants.OPERATE_SUCCESS);
}
/**
* 登记发票号
*
* @param paramList
* @return {@link R< List<InsuranceRegisterInvoiceNoParam>>}
* @author licancan
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceRegisterInvoiceNoParam>> registeredInvoiceNo(List<InsuranceRegisterInvoiceNoParam> paramList) {
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
if(paramList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
List<InsuranceRegisterInvoiceNoParam> operateList = registeredInvoiceNoCheck(paramList);
//需要修改的结果
List<InsuranceRegisterInvoiceNoParam> listSuccess = operateList.stream().filter(e-> e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS)).collect(Collectors.toList());
List<TInsuranceDetail> detailList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(listSuccess)){
for (InsuranceRegisterInvoiceNoParam success : listSuccess) {
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, success.getEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, success.getEmpIdcardNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, success.getInsuranceCompanyName())
.eq(TInsuranceDetail::getInsuranceTypeName, success.getInsuranceTypeName())
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(success.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(success.getPolicyEnd()))
.eq(TInsuranceDetail::getBuyStandard,success.getBuyStandard())
//排除替换类型
.ne(TInsuranceDetail::getBuyType,CommonConstants.FOUR_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
//当两次发票号不一致时才更新
if (!success.getInvoiceNo().equals(detail.getInvoiceNo())){
//设置发票号
detail.setInvoiceNo(success.getInvoiceNo());
detailList.add(detail);
}
}
}
if (CollectionUtils.isNotEmpty(detailList)){
this.updateBatchById(detailList);
//todo 推给EKP
}
//操作记录
addOperate(detailList,user,InsurancesConstants.REGISTERED_INVOICE,null,CommonConstants.ONE_INT);
if (operateList.stream().allMatch(e->e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS))) {
operateList = null;
}
return R.ok(operateList,InsurancesConstants.OPERATE_SUCCESS);
}
/**
* 已投保信息修改
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceInsuredParam>>}
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceInsuredParam>> updateInsuranceInsured(List<InsuranceInsuredParam> paramList) {
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
if(paramList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
List<InsuranceInsuredParam> operateList = updateInsuranceInsuredCheck(paramList);
//需要修改的结果
List<InsuranceInsuredParam> listSuccess = operateList.stream().filter(e-> e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS)).collect(Collectors.toList());
List<TInsuranceDetail> detailList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(listSuccess)){
for (InsuranceInsuredParam success : listSuccess) {
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, success.getEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, success.getEmpIdcardNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, success.getInsuranceCompanyName())
.eq(TInsuranceDetail::getInsuranceTypeName, success.getInsuranceTypeName())
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(success.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(success.getPolicyEnd()))
.eq(TInsuranceDetail::getBuyStandard,success.getBuyStandard())
//排除替换类型
.ne(TInsuranceDetail::getBuyType,CommonConstants.FOUR_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
TInsuranceDetail oldDetail = detail;
detail.setPolicyStart(LocalDateUtil.parseLocalDate(success.getPolicyStartNew()));
detail.setPolicyEnd(LocalDateUtil.parseLocalDate(success.getPolicyEndNew()));
detail.setBuyType(success.getBuyType());
detailList.add(detail);
//变更记录
tBusinessOperateService.saveModificationRecord(detail.getId(),oldDetail,detail,success.getReason());
}
}
if (CollectionUtils.isNotEmpty(detailList)){
this.updateBatchById(detailList);
}
//操作记录
addOperate(detailList,user,InsurancesConstants.UPDATE_INSURED,null,CommonConstants.ONE_INT);
if (operateList.stream().allMatch(e->e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS))) {
operateList = null;
}
return R.ok(operateList,InsurancesConstants.OPERATE_SUCCESS);
}
/**
* 已投保信息修改
*
* @param param
* @return {@link R< String>}
* @author licancan
*/
@Override
public R<String> updateInsuranceInsuredById(InsuranceInsuredDetailParam param) {
return null;
}
/**
* 商险新增校验
*
......@@ -2538,29 +2695,41 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}else {
param.setInsuranceCity(Integer.parseInt(redisCityName));
}
//保单开始日期、结束日期,由系统根据保单号关联查询投保状态为 "已投保" 的商险记录的任意一条
TInsuranceDetail limitOne = getOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getBuyHandleStatus, CommonConstants.THREE_INT)
//有效
/*.and(
wrapper -> wrapper.eq(TInsuranceDetail::getIsEffect,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsEffect)
)*/
//未过期
.and(
wrapper -> wrapper.eq(TInsuranceDetail::getIsOverdue,CommonConstants.ZERO_INT)
.or().isNull(TInsuranceDetail::getIsOverdue)
)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
//保单开始日期、结束日期,根据保单号到t_insurance_policy表查询的 1128需求调整改造
TInsurancePolicy limitOne = tInsurancePolicyService.getOne(Wrappers.<TInsurancePolicy>query().lambda()
.eq(TInsurancePolicy::getPolicyNo, param.getPolicyNo())
.eq(TInsurancePolicy::getDeleteFlag,CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (!Optional.ofNullable(limitOne).isPresent()){
param.setErrorMessage(InsurancesConstants.POLICY_NO_EXIST);
listResult.add(param);
continue;
}else {
if(limitOne.getEnableFlag() == CommonConstants.ONE_INT){
param.setErrorMessage(InsurancesConstants.POLICY_NO_FORBIDDEN);
listResult.add(param);
continue;
}
if(!limitOne.getInsuranceCompanyName().equals(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_COMPANY_NAME_NOT_SAME);
listResult.add(param);
continue;
}
if (!limitOne.getInsuranceTypeName().equals(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_TYPE_NAME_NOT_SAME);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isFutureDate(limitOne.getPolicyEnd().toString())){
param.setErrorMessage(InsurancesConstants.POLICY_END_SHOULD_IS_FUTURE);
listResult.add(param);
continue;
}
if (!LocalDateUtil.compareDate(limitOne.getPolicyStart().toString(),limitOne.getPolicyEnd().toString())){
param.setErrorMessage(InsurancesConstants.POLICY_START_SHOULD_LESS_THAN_POLICY_END);
listResult.add(param);
continue;
}
param.setPolicyStart(limitOne.getPolicyStart());
param.setPolicyEnd(limitOne.getPolicyEnd());
}
......@@ -2636,18 +2805,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
if(!limitOne.getInsuranceCompanyName().equals(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_COMPANY_NAME_NOT_SAME);
listResult.add(param);
continue;
}
if (!limitOne.getInsuranceTypeName().equals(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_TYPE_NAME_NOT_SAME);
listResult.add(param);
continue;
}
// 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示)
if(!LocalDateUtil.isDate(param.getSettleMonth(),LocalDateUtil.NORM_MONTH_PATTERN)){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_PARSE_ERROR);
......@@ -3264,6 +3421,191 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return paramList;
}
/**
* 登记发票号校验
*
* @author licancan
* @param paramList
* @return {@link List<InsuranceRegisterInvoiceNoParam>}
*/
private List<InsuranceRegisterInvoiceNoParam> registeredInvoiceNoCheck(List<InsuranceRegisterInvoiceNoParam> paramList){
for (InsuranceRegisterInvoiceNoParam param : paramList.stream().distinct().collect(Collectors.toList())) {
// 必填校验
if (StringUtils.isBlank(param.getEmpName())){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getPolicyStart())){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getPolicyEnd())){
param.setErrorMessage(InsurancesConstants.POLICY_END_NOT_EMPTY);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
continue;
}
if (StringUtils.isBlank(param.getBuyStandard())){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getInvoiceNo())){
param.setErrorMessage(InsurancesConstants.INVOICE_NO_EMPTY);
continue;
}
//查数据是否存在:姓名 + 身份证号 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间 + 购买标准
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, param.getEmpIdcardNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceDetail::getInsuranceTypeName, param.getInsuranceTypeName())
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(param.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(param.getPolicyEnd()))
.eq(TInsuranceDetail::getBuyStandard,param.getBuyStandard())
//排除替换类型
.ne(TInsuranceDetail::getBuyType,CommonConstants.FOUR_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(detail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
continue;
}
param.setErrorMessage(CommonConstants.RESULT_DATA_SUCESS);
}
return paramList;
}
public static final List<String> BUY_TYPE = Arrays.asList(InsurancesConstants.INSERT,InsurancesConstants.BATCH_INSERT);
/**
* 已投保信息修改校验
*
* @author licancan
* @param paramList
* @return {@link List<InsuranceInsuredParam>}
*/
private List<InsuranceInsuredParam> updateInsuranceInsuredCheck(List<InsuranceInsuredParam> paramList){
for (InsuranceInsuredParam param : paramList.stream().distinct().collect(Collectors.toList())) {
// 必填校验
if (StringUtils.isBlank(param.getEmpName())){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getPolicyStart())){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getPolicyEnd())){
param.setErrorMessage(InsurancesConstants.POLICY_END_NOT_EMPTY);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
continue;
}
if (StringUtils.isBlank(param.getBuyStandard())){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getPolicyStartNew()) && StringUtils.isBlank(param.getPolicyEndNew()) && StringUtils.isBlank(param.getBuyTypeStr())){
param.setErrorMessage(InsurancesConstants.CHOOSE_ONE_OF_THREE);
continue;
}
if (StringUtils.isNotBlank(param.getPolicyStartNew())){
if(!LocalDateUtil.isDate(param.getPolicyStartNew(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_NEW_PARSE_ERROR);
continue;
}
}
if (StringUtils.isNotBlank(param.getPolicyEndNew())){
if(!LocalDateUtil.isDate(param.getPolicyEndNew(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_NEW_PARSE_ERROR);
continue;
}
}
if (StringUtils.isNotBlank(param.getPolicyStartNew()) && StringUtils.isNotBlank(param.getPolicyEndNew())){
if (!LocalDateUtil.compareDate(param.getPolicyStartNew(),param.getPolicyEndNew())){
param.setErrorMessage(InsurancesConstants.POLICY_START_NEW_SHOULD_LESS_THAN_POLICY_END_NEW);
continue;
}
}
if (StringUtils.isNotBlank(param.getBuyTypeStr())){
if (!BUY_TYPE.contains(param.getBuyTypeStr())){
param.setErrorMessage(InsurancesConstants.BUY_TYPE_ERROR_NEW);
continue;
}else {
if (InsurancesConstants.INSERT.equals(param.getBuyTypeStr())){
param.setBuyType(CommonConstants.ONE_INT);
}
if (InsurancesConstants.BATCH_INSERT.equals(param.getBuyTypeStr())){
param.setBuyType(CommonConstants.THREE_INT);
}
}
}
if (StringUtils.isBlank(param.getReason())){
param.setErrorMessage(InsurancesConstants.REASON_EMPTY);
continue;
}
//查数据是否存在:姓名 + 身份证号 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间 + 购买标准
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, param.getEmpIdcardNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceDetail::getInsuranceTypeName, param.getInsuranceTypeName())
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(param.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(param.getPolicyEnd()))
.eq(TInsuranceDetail::getBuyStandard,param.getBuyStandard())
//排除替换类型
.ne(TInsuranceDetail::getBuyType,CommonConstants.FOUR_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(detail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
continue;
}
param.setErrorMessage(CommonConstants.RESULT_DATA_SUCESS);
}
return paramList;
}
/**
* 根据区域名称获取区域id
*
......
......@@ -16,11 +16,13 @@ import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TBusinessOperate
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsurancePolicyService;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListEditParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsurancePolicyListParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsurancePolicyDetailVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -39,6 +41,7 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
@Resource
private TBusinessOperateService tBusinessOperateService;
@Resource
@Lazy
private TInsuranceDetailService tInsuranceDetailService;
/**
......@@ -52,6 +55,12 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
@Override
public IPage<TInsurancePolicy> pageDiy(Page page, InsurancePolicyListParam param) {
IPage<TInsurancePolicy> list = this.baseMapper.getInsurancePolicyListPage(page, param);
// 购买月数
if (CollectionUtils.isNotEmpty(list.getRecords())){
list.getRecords().stream().forEach(e ->{
e.setBuyMonth(LocalDateUtil.betweenMonth(e.getPolicyStart().toString(),e.getPolicyEnd().toString()));
});
}
return list;
}
......@@ -128,6 +137,9 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
if (!Optional.ofNullable(tInsurancePolicy).isPresent()){
return R.failed("数据不存在");
}
if (!param.getPolicyNo().equals(tInsurancePolicy.getPolicyNo())){
return R.failed("保单号不能修改");
}
//操作日志
tBusinessOperateService.saveModificationRecord(param.getId(),tInsurancePolicy,param,null);
BeanCopyUtils.copyProperties(param,tInsurancePolicy);
......
......@@ -892,6 +892,12 @@
<if test="param.endDate != null and param.endDate.trim() != ''">
AND refund.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
<if test="param.buyStandardStart != null and param.buyStandardStart.trim() != ''">
AND a.BUY_STANDARD <![CDATA[ >= ]]> #{param.buyStandardStart}
</if>
<if test="param.buyStandardEnd != null and param.buyStandardEnd.trim() != ''">
AND a.BUY_STANDARD <![CDATA[ <= ]]> #{param.buyStandardEnd}
</if>
<if test="param.authSql != null and param.authSql.trim() != ''">
${param.authSql}
</if>
......@@ -1025,6 +1031,12 @@
<if test="param.insuranceCompanyName != null and param.insuranceCompanyName.trim() != ''">
and a.INSURANCE_COMPANY_NAME = #{param.insuranceCompanyName}
</if>
<if test="param.buyStandardStart != null and param.buyStandardStart.trim() != ''">
AND a.BUY_STANDARD <![CDATA[ >= ]]> #{param.buyStandardStart}
</if>
<if test="param.buyStandardEnd != null and param.buyStandardEnd.trim() != ''">
AND a.BUY_STANDARD <![CDATA[ <= ]]> #{param.buyStandardEnd}
</if>
<if test="param.updateBy != null and param.updateBy.trim() != ''">
and refund.UPDATE_BY = #{param.updateBy}
</if>
......
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