Commit 8cdc2fb5 authored by 李灿灿's avatar 李灿灿

商险新增接口

parent 6cd41c41
...@@ -11,6 +11,10 @@ public class InsurancesConstants { ...@@ -11,6 +11,10 @@ public class InsurancesConstants {
* 新增投保成功 * 新增投保成功
*/ */
public static final String ADD_SUCCESS = "新增投保成功"; public static final String ADD_SUCCESS = "新增投保成功";
/**
* 投保信息已存在
*/
public static final String DATA_IS_EXIST = "投保信息已存在";
/** /**
* 订单编号不能为空 * 订单编号不能为空
*/ */
...@@ -23,6 +27,10 @@ public class InsurancesConstants { ...@@ -23,6 +27,10 @@ public class InsurancesConstants {
* 员工身份证号不能为空 * 员工身份证号不能为空
*/ */
public static final String EMP_IDCARD_NO_NOT_EMPTY = "员工身份证号不能为空"; public static final String EMP_IDCARD_NO_NOT_EMPTY = "员工身份证号不能为空";
/**
* 员工身份证号格式有误
*/
public static final String EMP_IDCARD_NO_NOT_LEGITIMATE = "员工身份证号格式有误";
/** /**
* 项目编码不能为空 * 项目编码不能为空
*/ */
...@@ -31,18 +39,46 @@ public class InsurancesConstants { ...@@ -31,18 +39,46 @@ public class InsurancesConstants {
* 保险公司名称不能为空 * 保险公司名称不能为空
*/ */
public static final String INSURANCE_COMPANY_NAME_NOT_EMPTY = "保险公司名称不能为空"; public static final String INSURANCE_COMPANY_NAME_NOT_EMPTY = "保险公司名称不能为空";
/**
* 保险公司不存在
*/
public static final String INSURANCE_COMPANY_NAME_NOT_EXIST = "保险公司不存在";
/** /**
* 险种名称不能为空 * 险种名称不能为空
*/ */
public static final String INSURANCE_TYPE_NAME_NOT_EMPTY = "险种名称不能为空"; public static final String INSURANCE_TYPE_NAME_NOT_EMPTY = "险种名称不能为空";
/**
* 险种不存在
*/
public static final String INSURANCE_TYPE_NAME_NOT_EXIST = "险种不存在";
/** /**
* 保单开始时间不能为空 * 保单开始时间不能为空
*/ */
public static final String POLICY_START_NOT_EMPTY = "保单开始时间不能为空"; public static final String POLICY_START_NOT_EMPTY = "保单开始时间不能为空";
/**
* 保单开始时间格式错误
*/
public static final String POLICY_START_PARSE_ERROR = "保单开始时间格式错误";
/**
* 保单开始时间不能小于派单时间
*/
public static final String POLICY_START_SHOULD_IS_FUTURE = "保单开始时间不能小于派单时间";
/** /**
* 保单结束时间不能为空 * 保单结束时间不能为空
*/ */
public static final String POLICY_END_NOT_EMPTY = "保单结束时间不能为空"; public static final String POLICY_END_NOT_EMPTY = "保单结束时间不能为空";
/**
* 保单结束时间格式错误
*/
public static final String POLICY_END_PARSE_ERROR = "保单结束时间格式错误";
/**
* 购买标准不能为空
*/
public static final String BUY_STANDARD_NOT_EMPTY = "购买标准不能为空";
/**
* 购买标准不存在
*/
public static final String BUY_STANDARD_NOT_EXIST = "购买标准不存在";
/** /**
* 商险购买地省名称不能为空 * 商险购买地省名称不能为空
*/ */
...@@ -63,6 +99,14 @@ public class InsurancesConstants { ...@@ -63,6 +99,14 @@ public class InsurancesConstants {
* 结算月不能为空 * 结算月不能为空
*/ */
public static final String SETTLE_MONTH_NOT_EMPTY = "结算月不能为空"; public static final String SETTLE_MONTH_NOT_EMPTY = "结算月不能为空";
/**
* 结算月格式错误
*/
public static final String SETTLE_MONTH_PARSE_ERROR = "结算月格式错误";
/**
* 结算月不能小于派单月
*/
public static final String SETTLE_MONTH_SHOULD_IS_FUTURE = "结算月不能小于派单月";
/** /**
* 岗位不能为空 * 岗位不能为空
*/ */
......
...@@ -73,10 +73,16 @@ public class TInsuranceDetail extends BaseEntity { ...@@ -73,10 +73,16 @@ public class TInsuranceDetail extends BaseEntity {
private String insuranceCompanyName; private String insuranceCompanyName;
/** /**
* 险种主键 * 险种名称
*/ */
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 险种主键
*/
@Schema(description = "险种主键") @Schema(description = "险种主键")
private String insuranceTypeId; private Long insuranceTypeId;
/** /**
* 购买标准 * 购买标准
...@@ -84,6 +90,18 @@ public class TInsuranceDetail extends BaseEntity { ...@@ -84,6 +90,18 @@ public class TInsuranceDetail extends BaseEntity {
@Schema(description = "购买标准") @Schema(description = "购买标准")
private String buyStandard; private String buyStandard;
/**
* 医疗额度
*/
@Schema(description = "医疗额度")
private String medicalQuota;
/**
* 身故或残疾额度
*/
@Schema(description = "身故或残疾额度")
private String dieDisableQuota;
/** /**
* 保单编号 * 保单编号
*/ */
...@@ -114,11 +132,11 @@ public class TInsuranceDetail extends BaseEntity { ...@@ -114,11 +132,11 @@ public class TInsuranceDetail extends BaseEntity {
@Schema(description = "办理时间") @Schema(description = "办理时间")
private LocalDateTime batchDate; private LocalDateTime batchDate;
/** /**
* 结算月 * 结算月
*/ */
@Schema(description = "结算月") @Schema(description = "结算月")
private String settleMonth; private String settleMonth;
/** /**
* 发票号 * 发票号
......
...@@ -25,7 +25,7 @@ public class TInsuranceTypeStandard extends BaseEntity { ...@@ -25,7 +25,7 @@ public class TInsuranceTypeStandard extends BaseEntity {
/** /**
* 险种主键ID * 险种主键ID
*/ */
private String insuranceTypeId; private Long insuranceTypeId;
/** /**
* 购买标准 * 购买标准
......
package com.yifu.cloud.plus.v1.yifu.insurances.util;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
/**
* @author licancan
* @description 日期工具类
* @date 2022-07-19 14:20:54
*/
public class LocalDateUtil {
/**
* 年格式:yyyy
*/
public static final String NORM_YEAR_PATTERN = "yyyy";
/**
* 年月格式:yyyy-MM
*/
public static final String NORM_MONTH_PATTERN = "yyyy-MM";
/**
* 标准日期格式:yyyy-MM-dd
*/
public static final String NORM_DATE_PATTERN = "yyyy-MM-dd";
/**
* 标准时间格式:HH:mm:ss
*/
public static final String NORM_TIME_PATTERN = "HH:mm:ss";
/**
* 标准日期时间格式,精确到分:yyyy-MM-dd HH:mm
*/
public static final String NORM_DATETIME_MINUTE_PATTERN = "yyyy-MM-dd HH:mm";
/**
* 标准日期时间格式,精确到秒:yyyy-MM-dd HH:mm:ss
*/
public static final String NORM_DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
/**
* 判断是否是日期
*
* @author licancan
* @param strDate
* @return {@link Boolean}
*/
public static Boolean isDate(String strDate,String pattern){
if (Common.isEmpty(strDate)){
return false;
}
try {
DateFormat dateFormat = new SimpleDateFormat(pattern);
Date date = dateFormat.parse(strDate);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return true;
}catch (ParseException pe){
System.out.println("日期解析异常,返回false");
return false;
}
}
/**
* 字符串格式的日期转LocalDate
*
* @author licancan
* @param strDate
* @return {@link LocalDate}
*/
public static LocalDate parseLocalDate(String strDate){
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(NORM_DATE_PATTERN, Locale.CHINA);
LocalDate localDate = LocalDate.parse(strDate, dateTimeFormatter);
return localDate;
}
/**
* 判断时间是否是将来时间(大于当天)
*
* @author licancan
* @param strDate
* @return {@link boolean}
*/
public static boolean isFutureDate(String strDate){
boolean flag = false;
//在日期字符串非空时执行
if (!Common.isEmpty(strDate)) {
//今日的开始时间
Date nowDate = new Date();
Date pastDate = null;
//格式化日期
SimpleDateFormat sdf = new SimpleDateFormat(NORM_DATE_PATTERN, Locale.CHINA);
try {
//将字符串转为日期格式,如果此处字符串为非合法日期就会抛出异常。
pastDate = sdf.parse(strDate);
//调用Date里面的after方法来做判断
flag = pastDate.after(nowDate);
if (flag) {
System.out.println("该日期晚于今日");
}else {
System.out.println("该日期早于今日");
}
} catch (ParseException e) {
e.printStackTrace();
}
}else {
System.out.println("日期参数不可为空");
}
return flag;
}
/**
* 判断传入的月份是否大于等于本月(结算月份 >= 派单月份)
*
* @author licancan
* @param strMonth 传入的月份
* @return {@link boolean}
*/
public static boolean isCurrentOrFutureMonth(String strMonth){
boolean flag = false;
//在日期字符串非空时执行
if (!Common.isEmpty(strMonth)) {
SimpleDateFormat sdf = new SimpleDateFormat(NORM_MONTH_PATTERN, Locale.CHINA);
try {
//当前时间
Calendar cal1 = Calendar.getInstance();
//传入的字符串解析时间
Calendar cal2 = Calendar.getInstance();
Date parseDate = sdf.parse(strMonth);
cal2.setTime(parseDate);
if (cal1 == null || cal2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
if (cal2.get(Calendar.YEAR) > cal1.get(Calendar.YEAR)){
flag = true;
}else if(cal2.get(Calendar.YEAR) == cal1.get(Calendar.YEAR) && cal2.get(Calendar.MONTH) >= cal1.get(Calendar.MONTH)){
flag = true;
}
} catch (ParseException e) {
e.printStackTrace();
}
}else {
System.out.println("年月参数不可为空");
}
return flag;
}
public static void main(String[] args) {
System.out.println(isCurrentOrFutureMonth("2023-1"));
}
}
...@@ -61,6 +61,12 @@ public class InsuranceAddParam implements Serializable { ...@@ -61,6 +61,12 @@ public class InsuranceAddParam implements Serializable {
@Schema(description = "保单结束时间") @Schema(description = "保单结束时间")
private String policyEnd; private String policyEnd;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/** /**
* 商险购买地省名称 * 商险购买地省名称
*/ */
...@@ -100,10 +106,51 @@ public class InsuranceAddParam implements Serializable { ...@@ -100,10 +106,51 @@ public class InsuranceAddParam implements Serializable {
/** /**
* 备注 * 备注
*/ */
@Schema(description = "备注")
private String remark; private String remark;
/** /**
* 错误信息 * 错误信息
*/ */
private String errorMessage; private String errorMessage;
/***********************************以下字段由系统算出,前端不用传,是为了方便入库***********************************/
/**
* 结算类型 (1、单独结算 2、合并结算-和工资一起结算)
*/
private Integer settleType;
/**
* 医疗额度
*/
private String medicalQuota;
/**
* 身故或残疾额度
*/
private String dieDisableQuota;
/**
* 险种主键
*/
private Long insuranceTypeId;
/**
* 商险购买地省code
*/
private Integer insuranceProvince;
/**
* 商险购买地市code
*/
private Integer insuranceCity;
/**
* 商险办理省code
*/
private Integer insuranceHandleProvince;
/**
* 商险办理城市code
*/
private Integer insuranceHandleCity;
} }
...@@ -38,6 +38,21 @@ public class TInsuranceDetailController { ...@@ -38,6 +38,21 @@ public class TInsuranceDetailController {
@Resource @Resource
private TInsuranceDetailService tInsuranceDetailService; private TInsuranceDetailService tInsuranceDetailService;
/***********************商险办理********************************/
/**
* 商险新增
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceAddParam>>}
*/
@PostMapping("/addInsurance")
public R<List<InsuranceAddParam>> addInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceAddParam> paramList){
return tInsuranceDetailService.addInsurance(paramList);
}
/***********************减员办理********************************/
/** /**
* 导入减员校验 * 导入减员校验
* @param insuranceRefundCheckList 导入减员校验 * @param insuranceRefundCheckList 导入减员校验
...@@ -50,17 +65,4 @@ public class TInsuranceDetailController { ...@@ -50,17 +65,4 @@ public class TInsuranceDetailController {
return tInsuranceDetailService.checkInsuranceRefundList(insuranceRefundCheckList); return tInsuranceDetailService.checkInsuranceRefundList(insuranceRefundCheckList);
} }
/**
* 商险新增
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceAddParam>>}
*/
@PostMapping("/addInsurance")
public R<List<InsuranceAddParam>> addInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceAddParam> paramList){
return tInsuranceDetailService.addInsurance(paramList);
}
} }
...@@ -18,15 +18,8 @@ import java.util.List; ...@@ -18,15 +18,8 @@ import java.util.List;
* @date 2022-07-18 16:20:16 * @date 2022-07-18 16:20:16
*/ */
public interface TInsuranceDetailService extends IService<TInsuranceDetail> { public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
/**
* 减员导入校验
*
* @author zhaji
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList);
/***********************商险办理********************************/
/** /**
* 商险新增 * 商险新增
* *
...@@ -35,4 +28,14 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> { ...@@ -35,4 +28,14 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @return {@link R<List<InsuranceAddParam>>} * @return {@link R<List<InsuranceAddParam>>}
*/ */
R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList); R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList);
/***********************减员办理********************************/
/**
* 减员导入校验
*
* @author zhaji
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList);
} }
package com.yifu.cloud.plus.v1.yifu.insurances.service.impl; package com.yifu.cloud.plus.v1.yifu.insurances.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Sets;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants; import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceCompany;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.InsuranceRefundCheck; import com.yifu.cloud.plus.v1.yifu.insurances.entity.InsuranceRefundCheck;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceType;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeStandard;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceDetailMapper; import com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceCompanyService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService; import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceTypeService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceTypeStandardService;
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.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAddParam; import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAddParam;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import javax.annotation.Resource;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -33,43 +41,14 @@ import java.util.List; ...@@ -33,43 +41,14 @@ import java.util.List;
*/ */
@Service @Service
public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMapper, TInsuranceDetail> implements TInsuranceDetailService { public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMapper, TInsuranceDetail> implements TInsuranceDetailService {
@Resource
private TInsuranceCompanyService tInsuranceCompanyService;
@Resource
private TInsuranceTypeService tInsuranceTypeService;
@Resource
private TInsuranceTypeStandardService tInsuranceTypeStandardService;
@Override /***********************商险办理********************************/
public R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList) {
if(!Common.isNotEmpty(insuranceRefundCheckList)){
return R.failed("当前导入的减员信息为空");
}
List<InsuranceRefundCheck> refundErrorList = new ArrayList(128);
for (InsuranceRefundCheck insuranceRefund : insuranceRefundCheckList) {
boolean b = true;
String empName = insuranceRefund.getEmpName();
String empIdCardNo = insuranceRefund.getEmpIdCardNo();
//保险公司名称
String insuranceCompanyName = insuranceRefund.getInsuranceCompanyName();
//险种名称
String insuranceTypeName = insuranceRefund.getInsuranceTypeName();
String refundMoney = insuranceRefund.getRefundMoney();
String policyStart = insuranceRefund.getPolicyStart();
String policyEnd = insuranceRefund.getPolicyEnd();
String remark = insuranceRefund.getRemark();
if (!b){
refundErrorList.add(insuranceRefund);
}
}
if (Common.isNotEmpty(refundErrorList)){
return null;
}
return null;
}
/** /**
* 商险新增 * 商险新增
* *
...@@ -78,6 +57,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -78,6 +57,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @author licancan * @author licancan
*/ */
@Override @Override
@Transactional(rollbackFor = {Exception.class})
public R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList) { public R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList) {
if (CollectionUtils.isEmpty(paramList)){ if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY); return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
...@@ -92,12 +72,23 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -92,12 +72,23 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//保存到数据库中的结果 //保存到数据库中的结果
List<InsuranceAddParam> listSuccess = map.get("listSuccess"); List<InsuranceAddParam> listSuccess = map.get("listSuccess");
if (CollectionUtils.isNotEmpty(listSuccess)){ if (CollectionUtils.isNotEmpty(listSuccess)){
//TODO 新增 List<TInsuranceDetail> detailList = new ArrayList<>();
//购买类型,默认为「新增」 for (InsuranceAddParam success : listSuccess) {
//结算类型,根据项目编码获取,并冗余到明细记录中 TInsuranceDetail detail = new TInsuranceDetail();
//"医疗额度" 和 "身故或残疾",由系统根据 保险公司+险种+ 购买标准 关联查询,并补全 BeanCopyUtils.copyProperties(success,detail);
//投保状态:待投保 //购买类型,默认为「新增」
detail.setBuyType(CommonConstants.ONE_INT);
//投保状态:待投保
detail.setBuyHandleStatus(CommonConstants.ONE_INT);
detail.setPolicyStart(LocalDateUtil.parseLocalDate(success.getPolicyStart()));
detail.setPolicyEnd(LocalDateUtil.parseLocalDate(success.getPolicyEnd()));
detail.setCreateBy(user.getId());
detail.setCreateName(user.getNickname());
detailList.add(detail);
}
this.saveBatch(detailList);
} }
//todo 操作记录
return R.ok(listResult,InsurancesConstants.ADD_SUCCESS); return R.ok(listResult,InsurancesConstants.ADD_SUCCESS);
} }
...@@ -113,7 +104,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -113,7 +104,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<InsuranceAddParam> listResult = new ArrayList<>(); List<InsuranceAddParam> listResult = new ArrayList<>();
List<InsuranceAddParam> listSuccess = new ArrayList<>(); List<InsuranceAddParam> listSuccess = new ArrayList<>();
for (InsuranceAddParam param : paramList) { for (InsuranceAddParam param : paramList) {
//必填校验 // 必填校验
if (StringUtils.isBlank(param.getOrderNo())){ if (StringUtils.isBlank(param.getOrderNo())){
param.setErrorMessage(InsurancesConstants.ORDER_NO_NOT_EMPTY); param.setErrorMessage(InsurancesConstants.ORDER_NO_NOT_EMPTY);
listResult.add(param); listResult.add(param);
...@@ -154,6 +145,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -154,6 +145,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
if (StringUtils.isBlank(param.getBuyStandard())){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getInsuranceProvinceName())){ if (StringUtils.isBlank(param.getInsuranceProvinceName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_PROVINCE_NAME_NOT_EMPTY); param.setErrorMessage(InsurancesConstants.INSURANCE_PROVINCE_NAME_NOT_EMPTY);
listResult.add(param); listResult.add(param);
...@@ -184,15 +180,148 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -184,15 +180,148 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
//TODO 身份证号位数校验(18 位合法) // 身份证号位数校验(18 位合法)
//TODO 保单开始日期 > 当前派单日期 if (ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
//TODO 保险公司-险种-购买标准 是否存在 param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
//TODO 记录查重校验:姓名 + 身份证号 + 保险公司 + 险种 + 保单开始日期~保单结束日期区间 是唯一(剔除退回、过期状态的记录) listResult.add(param);
//TODO 结算月份 >= 派单月份 continue;
}
//todo 实名校验合法
//todo 根据项目编码和订单编号查询项目是否存在
//todo 结算类型,根据项目编码获取,并冗余到明细记录中
//param.setSettleType(CommonConstants.ONE_INT);
//todo 省市校验是否正确并设置对应code
//param.setInsuranceProvince();
//param.setInsuranceCity();
//param.setInsuranceHandleProvince();
//param.setInsuranceHandleCity();
// 保单开始日期 > 当前派单日期
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isFutureDate(param.getPolicyStart())){
param.setErrorMessage(InsurancesConstants.POLICY_START_SHOULD_IS_FUTURE);
listResult.add(param);
continue;
}
// 保险公司-险种-购买标准 是否存在
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(Wrappers.<TInsuranceCompany>query().lambda()
.eq(TInsuranceCompany::getCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (!Optional.ofNullable(insuranceCompany).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST);
listResult.add(param);
continue;
}else {
TInsuranceType insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda()
.eq(TInsuranceType::getName, param.getInsuranceTypeName())
.eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId())
.eq(TInsuranceType::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (!Optional.ofNullable(insuranceType).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST);
listResult.add(param);
continue;
}else {
TInsuranceTypeStandard typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda()
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, insuranceType.getId())
.eq(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (!Optional.ofNullable(typeStandard).isPresent()){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EXIST);
listResult.add(param);
continue;
}else {
// "医疗额度" 和 "身故或残疾",由系统根据 保险公司+险种+ 购买标准 关联查询,并补全
// 这里计算好赋值,是为了方便入库
param.setMedicalQuota(typeStandard.getMedicalQuota());
param.setDieDisableQuota(typeStandard.getDieDisableQuota());
param.setInsuranceTypeId(typeStandard.getInsuranceTypeId());
}
}
}
//记录查重校验:姓名 + 身份证号 + 保险公司 + 险种 + 保单开始日期~保单结束日期区间 是唯一(剔除退回、过期状态的记录)
Set<Integer> setRStatus = Sets.newHashSet();
setRStatus.add(CommonConstants.FOUR_INT);
TInsuranceDetail insuranceDetail = 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, param.getPolicyStart())
.eq(TInsuranceDetail::getPolicyEnd, param.getPolicyEnd())
.notIn(TInsuranceDetail::getBuyHandleStatus, setRStatus)
.eq(TInsuranceDetail::getIsOverdue, CommonConstants.ZERO_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (Optional.ofNullable(insuranceDetail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_EXIST);
listResult.add(param);
continue;
}
// 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示)
if(!LocalDateUtil.isDate(param.getSettleMonth(),LocalDateUtil.NORM_MONTH_PATTERN)){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isCurrentOrFutureMonth(param.getSettleMonth())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_SHOULD_IS_FUTURE);
listResult.add(param);
continue;
}
listSuccess.add(param); listSuccess.add(param);
} }
map.put("listResult",listResult); map.put("listResult",listResult);
map.put("listSuccess",listSuccess); map.put("listSuccess",listSuccess);
return map; return map;
} }
/***********************减员办理********************************/
@Override
public R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList) {
if(!Common.isNotEmpty(insuranceRefundCheckList)){
return R.failed("当前导入的减员信息为空");
}
List<InsuranceRefundCheck> refundErrorList = new ArrayList(128);
for (InsuranceRefundCheck insuranceRefund : insuranceRefundCheckList) {
boolean b = true;
String empName = insuranceRefund.getEmpName();
String empIdCardNo = insuranceRefund.getEmpIdCardNo();
//保险公司名称
String insuranceCompanyName = insuranceRefund.getInsuranceCompanyName();
//险种名称
String insuranceTypeName = insuranceRefund.getInsuranceTypeName();
String refundMoney = insuranceRefund.getRefundMoney();
String policyStart = insuranceRefund.getPolicyStart();
String policyEnd = insuranceRefund.getPolicyEnd();
String remark = insuranceRefund.getRemark();
if (!b){
refundErrorList.add(insuranceRefund);
}
}
if (Common.isNotEmpty(refundErrorList)){
return null;
}
return null;
}
} }
...@@ -13,14 +13,17 @@ ...@@ -13,14 +13,17 @@
<result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/> <result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/>
<result property="post" column="POST" jdbcType="VARCHAR"/> <result property="post" column="POST" jdbcType="VARCHAR"/>
<result property="insuranceCompanyName" column="INSURANCE_COMPANY_NAME" jdbcType="VARCHAR"/> <result property="insuranceCompanyName" column="INSURANCE_COMPANY_NAME" jdbcType="VARCHAR"/>
<result property="insuranceTypeId" column="INSURANCE_TYPE_ID" jdbcType="VARCHAR"/> <result property="insuranceTypeName" column="INSURANCE_TYPE_NAME" jdbcType="VARCHAR"/>
<result property="insuranceTypeId" column="INSURANCE_TYPE_ID" jdbcType="BIGINT"/>
<result property="buyStandard" column="BUY_STANDARD" jdbcType="VARCHAR"/> <result property="buyStandard" column="BUY_STANDARD" jdbcType="VARCHAR"/>
<result property="medicalQuota" column="MEDICAL_QUOTA" jdbcType="VARCHAR"/>
<result property="dieDisableQuota" column="DIE_DISABLE_QUOTA" jdbcType="VARCHAR"/>
<result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/> <result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/>
<result property="policyStart" column="POLICY_START" jdbcType="DATE"/> <result property="policyStart" column="POLICY_START" jdbcType="DATE"/>
<result property="policyEnd" column="POLICY_END" jdbcType="DATE"/> <result property="policyEnd" column="POLICY_END" jdbcType="DATE"/>
<result property="policyEffect" column="POLICY_EFFECT" jdbcType="DATE"/> <result property="policyEffect" column="POLICY_EFFECT" jdbcType="DATE"/>
<result property="batchDate" column="BATCH_DATE" jdbcType="TIMESTAMP"/> <result property="batchDate" column="BATCH_DATE" jdbcType="TIMESTAMP"/>
<result property="settleMonth" column="SETTLE_MONTH" jdbcType="VARCHAR"/> <result property="settleMonth" column="SETTLE_MONTH" jdbcType="VARCHAR"/>
<result property="invoiceNo" column="INVOICE_NO" jdbcType="VARCHAR"/> <result property="invoiceNo" column="INVOICE_NO" jdbcType="VARCHAR"/>
<result property="buyType" column="BUY_TYPE" jdbcType="TINYINT"/> <result property="buyType" column="BUY_TYPE" jdbcType="TINYINT"/>
<result property="insuranceProvince" column="INSURANCE_PROVINCE" jdbcType="TINYINT"/> <result property="insuranceProvince" column="INSURANCE_PROVINCE" jdbcType="TINYINT"/>
...@@ -52,8 +55,8 @@ ...@@ -52,8 +55,8 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
ID,EMP_ID,EMP_NAME, ID,EMP_ID,EMP_NAME,
EMP_IDCARD_NO,ORDER_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME, EMP_IDCARD_NO,ORDER_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME,
INSURANCE_TYPE_ID,BUY_STANDARD,POLICY_NO, INSURANCE_TYPE_ID,BUY_STANDARD,MEDICAL_QUOTA,DIE_DISABLE_QUOTA,POLICY_NO,
POLICY_START,POLICY_END,POLICY_EFFECT, POLICY_START,POLICY_END,POLICY_EFFECT,
BATCH_DATE,SETTLE_MONTH,INVOICE_NO, BATCH_DATE,SETTLE_MONTH,INVOICE_NO,
BUY_TYPE,INSURANCE_PROVINCE,INSURANCE_PROVINCE_NAME,INSURANCE_CITY,INSURANCE_CITY_NAME, BUY_TYPE,INSURANCE_PROVINCE,INSURANCE_PROVINCE_NAME,INSURANCE_CITY,INSURANCE_CITY_NAME,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeStandard"> <resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeStandard">
<id property="id" column="ID" jdbcType="VARCHAR"/> <id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="insuranceTypeId" column="INSURANCE_TYPE_ID" jdbcType="VARCHAR"/> <result property="insuranceTypeId" column="INSURANCE_TYPE_ID" jdbcType="BIGINT"/>
<result property="buyStandard" column="BUY_STANDARD" jdbcType="VARCHAR"/> <result property="buyStandard" column="BUY_STANDARD" jdbcType="VARCHAR"/>
<result property="medicalQuota" column="MEDICAL_QUOTA" jdbcType="VARCHAR"/> <result property="medicalQuota" column="MEDICAL_QUOTA" jdbcType="VARCHAR"/>
<result property="dieDisableQuota" column="DIE_DISABLE_QUOTA" jdbcType="VARCHAR"/> <result property="dieDisableQuota" column="DIE_DISABLE_QUOTA" jdbcType="VARCHAR"/>
......
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