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

商险新增部分接口

parent 6d6f200a
......@@ -6,4 +6,66 @@ 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 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 DEPT_NO_NOT_EMPTY = "项目编码不能为空";
/**
* 保险公司名称不能为空
*/
public static final String INSURANCE_COMPANY_NAME_NOT_EMPTY = "保险公司名称不能为空";
/**
* 险种名称不能为空
*/
public static final String INSURANCE_TYPE_NAME_NOT_EMPTY = "险种名称不能为空";
/**
* 保单开始时间不能为空
*/
public static final String POLICY_START_NOT_EMPTY = "保单开始时间不能为空";
/**
* 保单结束时间不能为空
*/
public static final String POLICY_END_NOT_EMPTY = "保单结束时间不能为空";
/**
* 商险购买地省名称不能为空
*/
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 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,154 +33,205 @@ 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 insuranceTypeId;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 保单编号
*/
@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;
/**
......@@ -195,6 +243,7 @@ public class TInsuranceDetail extends BaseEntity {
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
......
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,99 @@ 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 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;
/**
* 备注
*/
private String remark;
/**
* 错误信息
*/
private String errorMessage;
}
......@@ -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.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.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;
/**
* @author licancan
......@@ -19,8 +27,21 @@ import javax.annotation.Resource;
@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);
}
}
......@@ -2,7 +2,11 @@ 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.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAddParam;
import java.util.List;
/**
* @author licancan
......@@ -11,4 +15,12 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
*/
public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
/**
* 商险新增
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceAddParam>>}
*/
R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList);
}
package com.yifu.cloud.plus.v1.yifu.insurances.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
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 java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author licancan
* @description 针对表【t_insurance_detail(商险明细表)】的数据库操作Service实现
......@@ -14,4 +28,129 @@ import org.springframework.stereotype.Service;
@Service
public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMapper, TInsuranceDetail> implements TInsuranceDetailService {
/**
* 商险新增
*
* @param paramList
* @return {@link R <List<InsuranceAddParam>>}
* @author licancan
*/
@Override
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)){
//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.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;
}
//TODO 身份证号位数校验(18 位合法)
//TODO 保单开始日期 > 当前派单日期
//TODO 保险公司-险种-购买标准 是否存在
//TODO 记录查重校验:姓名 + 身份证号 + 保险公司 + 险种 + 保单开始日期~保单结束日期区间 是唯一(剔除退回、过期状态的记录)
//TODO 结算月份 >= 派单月份
listSuccess.add(param);
}
map.put("listResult",listResult);
map.put("listSuccess",listSuccess);
return map;
}
}
......@@ -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
......
......@@ -24,10 +24,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"/>
......@@ -52,8 +56,8 @@
INSURANCE_TYPE_ID,BUY_STANDARD,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,
......
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