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

Merge branch 'feature-licancan' into 'develop'

Feature licancan

See merge request fangxinjiang/yifu!9
parents be11dd5e 8cdc2fb5
......@@ -6,4 +6,110 @@ package com.yifu.cloud.plus.v1.yifu.insurances.constants;
* @date 2022-07-18 17:52:59
*/
public class InsurancesConstants {
/**
* 新增投保成功
*/
public static final String ADD_SUCCESS = "新增投保成功";
/**
* 投保信息已存在
*/
public static final String DATA_IS_EXIST = "投保信息已存在";
/**
* 订单编号不能为空
*/
public static final String ORDER_NO_NOT_EMPTY = "订单编号不能为空";
/**
* 员工姓名不能为空
*/
public static final String EMP_NAME_NOT_EMPTY = "员工姓名不能为空";
/**
* 员工身份证号不能为空
*/
public static final String EMP_IDCARD_NO_NOT_EMPTY = "员工身份证号不能为空";
/**
* 员工身份证号格式有误
*/
public static final String EMP_IDCARD_NO_NOT_LEGITIMATE = "员工身份证号格式有误";
/**
* 项目编码不能为空
*/
public static final String DEPT_NO_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_EXIST = "险种不存在";
/**
* 保单开始时间不能为空
*/
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_PARSE_ERROR = "保单结束时间格式错误";
/**
* 购买标准不能为空
*/
public static final String BUY_STANDARD_NOT_EMPTY = "购买标准不能为空";
/**
* 购买标准不存在
*/
public static final String BUY_STANDARD_NOT_EXIST = "购买标准不存在";
/**
* 商险购买地省名称不能为空
*/
public static final String INSURANCE_PROVINCE_NAME_NOT_EMPTY = "商险购买地省名称不能为空";
/**
* 商险购买地市名称
*/
public static final String INSURANCE_CITY_NAME_NOT_EMPTY = "商险购买地市名称不能为空";
/**
* 商险办理省名称不能为空
*/
public static final String INSURANCE_HANDLE_PROVINCE_NAME_NOT_EMPTY = "商险办理省名称不能为空";
/**
* 商险办理城市名称不能为空
*/
public static final String INSURANCE_HANDLE_CITY_NAME_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 = "结算月不能小于派单月";
/**
* 岗位不能为空
*/
public static final String POST_NOT_EMPTY = "岗位不能为空";
}
......@@ -8,9 +8,6 @@ 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.NotBlank;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
......@@ -36,149 +33,223 @@ public class TInsuranceDetail extends BaseEntity {
/**
* 员工档案id
*/
@Schema(description = "员工档案id")
private String empId;
/**
* 员工姓名
*/
@NotBlank(message = "员工姓名不能为空")
@Length(max = 32, message = "员工姓名不能超过32个字符")
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 投保岗位
*/
@Schema(description = "投保岗位")
private String post;
/**
* 保险公司名称(冗余字段)
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 险种主键
*/
private String insuranceTypeId;
@Schema(description = "险种主键")
private Long insuranceTypeId;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 医疗额度
*/
@Schema(description = "医疗额度")
private String medicalQuota;
/**
* 身故或残疾额度
*/
@Schema(description = "身故或残疾额度")
private String dieDisableQuota;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
private LocalDate policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
private LocalDate policyEnd;
/**
* 保单生效日期
*/
@Schema(description = "保单生效日期")
private LocalDate policyEffect;
/**
* 办理时间
*/
@Schema(description = "办理时间")
private LocalDateTime batchDate;
/**
* 结算月
*/
@Schema(description = "结算月")
private String settleMonth;
/**
* 发票号
*/
@Schema(description = "发票号")
private String invoiceNo;
/**
* 购买类型, 1新增、3批增、4替换
*/
@Schema(description = " 购买类型, 1新增、3批增、4替换")
private Integer buyType;
/**
* 商险购买地省code
*/
@Schema(description = "商险购买地省code")
private Integer insuranceProvince;
/**
* 商险购买地省
*/
@Schema(description = "商险购买地省")
private String insuranceProvinceName;
/**
* 商险购买地市code
*/
@Schema(description = "商险购买地市code")
private Integer insuranceCity;
/**
* 商险购买地市
*/
@Schema(description = "商险购买地市")
private String insuranceCityName;
/**
* 商险办理省code
*/
@Schema(description = "商险办理省code")
private Integer insuranceHandleProvince;
/**
* 商险办理省
*/
@Schema(description = "商险办理省")
private String insuranceHandleProvinceName;
/**
* 商险办理城市code
*/
@Schema(description = "商险办理城市code")
private Integer insuranceHandleCity;
/**
* 商险办理城市
*/
@Schema(description = "商险办理城市")
private String insuranceHandleCityName;
/**
* 结算类型 (1、单独结算 2、合并结算-和工资一起结算)
*/
private String settleType;
@Schema(description = "结算类型 (1、单独结算 2、合并结算-和工资一起结算)")
private Integer settleType;
/**
* 实际保费
*/
@Schema(description = "实际保费")
private BigDecimal actualPremium;
/**
* 预估保费
*/
@Schema(description = "预估保费")
private BigDecimal estimatePremium;
/**
* 差额(实缴-预估)
*/
@Schema(description = "差额(实缴-预估)")
private BigDecimal settleBalance;
/**
* 投保办理状态 1待办理 2办理中 3已办理 4投保退回 5 已减员
* 投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
*/
@Schema(description = "投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员")
private Integer buyHandleStatus;
/**
* 结算办理状态 1待结算 2结算中 3已结算
*/
@Schema(description = "结算办理状态 1待结算 2结算中 3已结算")
private Integer settleHandleStatus;
/**
* 减员状态 1待减员 2减员中3减员退回
*/
@Schema(description = "减员状态 1待减员 2减员中3减员退回")
private Integer reduceHandleStatus;
/**
* 是否出险 0未出险 1已出险
*/
@Schema(description = "是否出险 0未出险 1已出险")
private Integer isUse;
/**
* 是否有效 0有效 1无效
*/
@Schema(description = "是否有效 0有效 1无效")
private Integer isEffect;
/**
......@@ -190,6 +261,7 @@ public class TInsuranceDetail extends BaseEntity {
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
......
......@@ -25,7 +25,7 @@ public class TInsuranceTypeStandard extends BaseEntity {
/**
* 险种主键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"));
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @author licancan
......@@ -14,97 +11,146 @@ import java.time.LocalDate;
* @date 2022-07-18 17:03:31
*/
@Data
@Tag(name = "商险办理新增入参")
public class InsuranceAddParam implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 订单编号
*/
@NotBlank(message = "订单编号不能为空")
@Length(max = 32, message = "订单编号不能超过32个字符")
@Schema(description = "订单编号")
private String orderNo;
/**
* 员工姓名
*/
@NotBlank(message = "员工姓名不能为空")
@Length(max = 32, message = "员工姓名不能超过32个字符")
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@NotBlank(message = "员工身份证号不能为空")
@Length(max = 32, message = "员工身份证号不能超过32个字符")
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 项目编码
*/
@NotBlank(message = "项目编码不能为空")
@Length(max = 32, message = "项目编码不能超过32个字符")
@Schema(description = "项目编码")
private String deptNo;
/**
* 保险公司名称
*/
@NotBlank(message = "保险公司名称不能为空")
@Length(max = 32, message = "保险公司名称不能超过32个字符")
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@NotBlank(message = "险种名称不能为空")
@Length(max = 32, message = "险种名称不能超过32个字符")
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 保单开始时间
*/
private LocalDate policyStart;
@Schema(description = "保单开始时间")
private String policyStart;
/**
* 保单结束时间
*/
private LocalDate policyEnd;
@Schema(description = "保单结束时间")
private String policyEnd;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 商险购买地省名称
*/
@Schema(description = "商险购买地省名称")
private String insuranceProvinceName;
/**
* 商险购买地市名称
*/
@Schema(description = "商险购买地市名称")
private String insuranceCityName;
/**
* 商险办理省名称
*/
@Schema(description = "商险办理省名称")
private String insuranceHandleProvinceName;
/**
* 商险办理城市名称
*/
@Schema(description = "商险办理城市名称")
private String insuranceHandleCityName;
/**
* 结算月
*/
@Schema(description = "结算月")
private String settleMonth;
/**
* 岗位
*/
@Schema(description = "岗位")
private String post;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 错误信息
*/
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;
}
......@@ -59,6 +59,12 @@
<version>5.8.0</version>
<artifactId>hutool-all</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-collections/commons-collections -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
</dependencies>
<build>
......
package com.yifu.cloud.plus.v1.yifu.insurances.controller;
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.insurances.entity.InsuranceRefundCheck;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAddParam;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.Size;
import java.util.List;
import java.util.List;
/**
......@@ -24,11 +32,27 @@ import java.util.List;
@RequiredArgsConstructor
@RequestMapping("/insuranceDetail")
@Tag(name = "商险相关")
@Validated
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class TInsuranceDetailController {
@Resource
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 导入减员校验
......@@ -41,5 +65,4 @@ public class TInsuranceDetailController {
return tInsuranceDetailService.checkInsuranceRefundList(insuranceRefundCheckList);
}
}
......@@ -3,8 +3,12 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service;
import com.baomidou.mybatisplus.extension.service.IService;
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.insurances.entity.InsuranceRefundCheck;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAddParam;
import java.util.List;
import java.util.List;
......@@ -14,6 +18,18 @@ import java.util.List;
* @date 2022-07-18 16:20:16
*/
public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
/***********************商险办理********************************/
/**
* 商险新增
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceAddParam>>}
*/
R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList);
/***********************减员办理********************************/
/**
* 减员导入校验
*
......@@ -22,5 +38,4 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @return {@link R}
*/
R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList);
}
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.google.common.collect.Sets;
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.R;
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.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceCompany;
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.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.service.TInsuranceCompanyService;
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 org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
......@@ -19,7 +41,253 @@ import java.util.List;
*/
@Service
public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMapper, TInsuranceDetail> implements TInsuranceDetailService {
@Resource
private TInsuranceCompanyService tInsuranceCompanyService;
@Resource
private TInsuranceTypeService tInsuranceTypeService;
@Resource
private TInsuranceTypeStandardService tInsuranceTypeStandardService;
/***********************商险办理********************************/
/**
* 商险新增
*
* @param paramList
* @return {@link R <List<InsuranceAddParam>>}
* @author licancan
*/
@Override
@Transactional(rollbackFor = {Exception.class})
public R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList) {
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
Map<String, List<InsuranceAddParam>> map = addInsuranceCheck(paramList);
//返回给前端的结果
List<InsuranceAddParam> listResult = map.get("listResult");
//保存到数据库中的结果
List<InsuranceAddParam> listSuccess = map.get("listSuccess");
if (CollectionUtils.isNotEmpty(listSuccess)){
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);
}
/**
* 商险新增校验
*
* @author licancan
* @param paramList
* @return {@link Map<String, List<InsuranceAddParam>>}
*/
private Map<String,List<InsuranceAddParam>> addInsuranceCheck(List<InsuranceAddParam> paramList){
Map<String,List<InsuranceAddParam>> map = new HashMap<>();
List<InsuranceAddParam> listResult = new ArrayList<>();
List<InsuranceAddParam> listSuccess = new ArrayList<>();
for (InsuranceAddParam param : paramList) {
// 必填校验
if (StringUtils.isBlank(param.getOrderNo())){
param.setErrorMessage(InsurancesConstants.ORDER_NO_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getEmpName())){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getDeptNo())){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getPolicyStart())){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getPolicyEnd())){
param.setErrorMessage(InsurancesConstants.POLICY_END_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getBuyStandard())){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getInsuranceProvinceName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_PROVINCE_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getInsuranceCityName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_CITY_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getInsuranceHandleProvinceName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_HANDLE_PROVINCE_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getInsuranceHandleCityName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_HANDLE_CITY_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getSettleMonth())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getPost())){
param.setErrorMessage(InsurancesConstants.POST_NOT_EMPTY);
listResult.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
listResult.add(param);
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);
}
map.put("listResult",listResult);
map.put("listSuccess",listSuccess);
return map;
}
/***********************减员办理********************************/
@Override
public R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList) {
if(!Common.isNotEmpty(insuranceRefundCheckList)){
......@@ -53,7 +321,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Common.isNotEmpty(refundErrorList)){
return null;
}
return null;
}
}
......@@ -8,7 +8,7 @@ spring:
redis:
host: 127.0.0.1
port: 6379
password: '@yf_2017'
password:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
......
......@@ -11,9 +11,13 @@
<result property="empIdcardNo" column="EMP_IDCARD_NO" jdbcType="VARCHAR"/>
<result property="orderNo" column="ORDER_NO" jdbcType="VARCHAR"/>
<result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/>
<result property="post" column="POST" 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="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="policyStart" column="POLICY_START" jdbcType="DATE"/>
<result property="policyEnd" column="POLICY_END" jdbcType="DATE"/>
......@@ -23,10 +27,14 @@
<result property="invoiceNo" column="INVOICE_NO" jdbcType="VARCHAR"/>
<result property="buyType" column="BUY_TYPE" jdbcType="TINYINT"/>
<result property="insuranceProvince" column="INSURANCE_PROVINCE" jdbcType="TINYINT"/>
<result property="insuranceProvinceName" column="INSURANCE_PROVINCE_NAME" jdbcType="VARCHAR"/>
<result property="insuranceCity" column="INSURANCE_CITY" jdbcType="TINYINT"/>
<result property="insuranceCityName" column="INSURANCE_CITY_NAME" jdbcType="VARCHAR"/>
<result property="insuranceHandleProvince" column="INSURANCE_HANDLE_PROVINCE" jdbcType="TINYINT"/>
<result property="insuranceHandleProvinceName" column="INSURANCE_HANDLE_PROVINCE_NAME" jdbcType="VARCHAR"/>
<result property="insuranceHandleCity" column="INSURANCE_HANDLE_CITY" jdbcType="TINYINT"/>
<result property="settleType" column="SETTLE_TYPE" jdbcType="VARCHAR"/>
<result property="insuranceHandleCityName" column="INSURANCE_HANDLE_CITY_NAME" jdbcType="VARCHAR"/>
<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="settleBalance" column="SETTLE_BALANCE" jdbcType="DECIMAL"/>
......@@ -47,12 +55,12 @@
<sql id="Base_Column_List">
ID,EMP_ID,EMP_NAME,
EMP_IDCARD_NO,ORDER_NO,DEPT_NO,INSURANCE_COMPANY_NAME,
INSURANCE_TYPE_ID,BUY_STANDARD,POLICY_NO,
EMP_IDCARD_NO,ORDER_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME,
INSURANCE_TYPE_ID,BUY_STANDARD,MEDICAL_QUOTA,DIE_DISABLE_QUOTA,POLICY_NO,
POLICY_START,POLICY_END,POLICY_EFFECT,
BATCH_DATE,SETTLE_MONTH,INVOICE_NO,
BUY_TYPE,INSURANCE_PROVINCE,INSURANCE_CITY,
INSURANCE_HANDLE_PROVINCE,INSURANCE_HANDLE_CITY,SETTLE_TYPE,
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,SETTLE_BALANCE,
BUY_HANDLE_STATUS,SETTLE_HANDLE_STATUS,REDUCE_HANDLE_STATUS,
IS_USE,IS_EFFECT,IS_OVERDUE,REMARK,
......
......@@ -6,7 +6,7 @@
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeStandard">
<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="medicalQuota" column="MEDICAL_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