Commit fef8914b authored by fangxinjiang's avatar fangxinjiang

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

parents d09686bb 4b19b4eb
......@@ -6,16 +6,6 @@ public class EmployeeContractConstants {
public static final String NOT_CREATE_USER = "不是创建人,无法删除";
public static final String NOT_AUDIT_STATUS = "不是待审核或审核不通过,无法删除";
public static final String NOT_AUDIT_STATUS = "不是待提交或审核不通过,无法删除";
public static final String searchEmpContractInfo = " 查询对应的员工合同信息!";
public static final String sameEmpOnlyOneStandContract= "同一员工只允许一个在用标准合同,请按员工编码:";
public static final String exportTip = "数据导入解析!数据行数:";
public final static String ContractUpdateFailInfo="合同更新失败:合同更新同步更新派单数据更新失败!";
public final static String UTF8 ="UTF-8";
}
......@@ -316,6 +316,27 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
baseMapper.insert(tEmployeeContractInfo);
if (Common.isNotNull(tEmployeeContractInfo.getAttaList()) && Common.isNotNull(tEmployeeContractInfo.getId())) {
this.updateFileMainId(tEmployeeContractInfo);
}
} else {
baseMapper.updateById(tEmployeeContractInfo);
}
// 不是待提交,记录审核记录
this.setAuditInfo(tEmployeeContractInfo);
// 更新档案合同状态
this.updateEmployeeContractStatus(tEmployeeContractInfo.getEmpId());
return R.ok(null, CommonConstants.SAVE_SUCCESS);
}
/**
* @param tEmployeeContractInfo
* @Description: 更新附件的合同id
* @Author: hgw
* @Date: 2022/7/20 10:07
* @return: void
**/
private void updateFileMainId(TEmployeeContractInfo tEmployeeContractInfo) {
List<String> attaList = tEmployeeContractInfo.getAttaList();
if (null != attaList && !attaList.isEmpty()) {
TAttaInfo contractAtta;
......@@ -328,16 +349,6 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
}
} else {
baseMapper.updateById(tEmployeeContractInfo);
}
// 不是待提交,记录审核记录
this.setAuditInfo(tEmployeeContractInfo);
// 更新档案合同状态
this.updateEmployeeContractStatus(tEmployeeContractInfo.getEmpId());
return R.ok(null, CommonConstants.SAVE_SUCCESS);
}
/**
* @param tEmployeeContractInfo
......@@ -434,11 +445,11 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return R.failed("未找到记录");
} else {
if (!user.getId().equals(contractInfo.getCreateBy())) {
return R.failed("不是合同创建人,无法删除");
return R.failed(EmployeeContractConstants.NOT_CREATE_USER);
}
if (contractInfo.getAuditStatus() != CommonConstants.ZERO_INT
&& contractInfo.getAuditStatus() != CommonConstants.dingleDigitIntArray[3]) {
return R.failed("不是待提交或审核不通过,无法删除");
return R.failed(EmployeeContractConstants.NOT_AUDIT_STATUS);
}
contractInfo.setDeleteFlag(CommonConstants.ONE_INT);
this.updateById(contractInfo);
......@@ -498,6 +509,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
//档案柜存在就自动归档
if (Common.isNotNull(tEmployeeContractInfo.getAttaList())) {
this.updateFileMainId(tEmployeeContractInfo);
this.setFileInfo(tEmployeeContractInfo.getId(), "添加附件");
tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING);
} else {
......
......@@ -16,6 +16,7 @@
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
......@@ -146,6 +147,11 @@ public interface CommonConstants {
*/
String THREE_STRING = "3";
/**
* 数字int 3
*/
int THREE_INT = 3;
/**
* 下划线
* hgw 2022-6-9 17:36:35
......@@ -354,4 +360,11 @@ public interface CommonConstants {
public static final int SIXTEEN_INT = 16;
public static final String FIFTEEN = "15";
public static final String NINETEEN = "19";
//百分之一 1/100
public static final BigDecimal ONE_OF_PERCENT = new BigDecimal("0.01");
// 1/2
public static final BigDecimal HALF_OF_ONE = new BigDecimal("0.5");
public static final BigDecimal TWO_BIG = new BigDecimal("2");
}
......@@ -111,5 +111,13 @@ public class InsurancesConstants {
* 岗位不能为空
*/
public static final String POST_NOT_EMPTY = "岗位不能为空";
/**
* 保单号不能为空
*/
public static final String POLICY_NO_EMPTY = "保单号不能为空";
/**
* 保单号不存在
*/
public static final String POLICY_NO_EXIST= "保单号不存在";
}
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 java.io.Serializable;
import java.time.LocalDate;
/**
* @author licancan
* @description 商险办理批增入参
* @date 2022-07-20 08:43:31
*/
@Data
@Tag(name = "商险办理批增入参")
public class InsuranceBatchParam implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 订单编号
*/
@Schema(description = "订单编号")
private String orderNo;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 岗位
*/
@Schema(description = "岗位")
private String post;
/**
* 保单号
*/
@Schema(description = "保单号")
private String policyNo;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 购买标准
*/
@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 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;
/**
* 保单开始时间
*/
private LocalDate policyStart;
/**
* 保单结束时间
*/
private LocalDate policyEnd;
}
......@@ -5,6 +5,7 @@ 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 com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceBatchParam;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -51,6 +52,18 @@ public class TInsuranceDetailController {
return tInsuranceDetailService.addInsurance(paramList);
}
/**
* 商险批增
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceBatchParam>>}
*/
@PostMapping("/batchInsurance")
public R<List<InsuranceBatchParam>> batchInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceBatchParam> paramList){
return tInsuranceDetailService.batchInsurance(paramList);
}
/***********************减员办理********************************/
/**
......
......@@ -7,6 +7,7 @@ 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 com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceBatchParam;
import java.util.List;
......@@ -29,6 +30,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*/
R<List<InsuranceAddParam>> addInsurance(List<InsuranceAddParam> paramList);
/**
* 商险批增
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceBatchParam>>}
*/
R<List<InsuranceBatchParam>> batchInsurance(List<InsuranceBatchParam> paramList);
/***********************减员办理********************************/
/**
* 减员导入校验
......
......@@ -23,6 +23,7 @@ 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.InsuranceBatchParam;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
......@@ -92,6 +93,47 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.ok(listResult,InsurancesConstants.ADD_SUCCESS);
}
/**
* 商险批增
*
* @param paramList
* @return {@link R<List<InsuranceBatchParam>>}
* @author licancan
*/
@Override
@Transactional(rollbackFor = {Exception.class})
public R<List<InsuranceBatchParam>> batchInsurance(List<InsuranceBatchParam> 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<InsuranceBatchParam>> map = batchInsuranceCheck(paramList);
//返回给前端的结果
List<InsuranceBatchParam> listResult = map.get("listResult");
//保存到数据库中的结果
List<InsuranceBatchParam> listSuccess = map.get("listSuccess");
if (CollectionUtils.isNotEmpty(listSuccess)){
List<TInsuranceDetail> detailList = new ArrayList<>();
for (InsuranceBatchParam success : listSuccess) {
TInsuranceDetail detail = new TInsuranceDetail();
BeanCopyUtils.copyProperties(success,detail);
//购买类型,默认为「批增」
detail.setBuyType(CommonConstants.THREE_INT);
//投保状态:待投保???
detail.setBuyHandleStatus(CommonConstants.ONE_INT);
detail.setCreateBy(user.getId());
detail.setCreateName(user.getNickname());
detailList.add(detail);
}
this.saveBatch(detailList);
}
//todo 操作记录
return R.ok(listResult,InsurancesConstants.ADD_SUCCESS);
}
/**
* 商险新增校验
*
......@@ -287,6 +329,191 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return map;
}
/**
* 商险批增校验
*
* @author licancan
* @param paramList
* @return {@link Map< String, List< InsuranceBatchParam>>}
*/
private Map<String,List<InsuranceBatchParam>> batchInsuranceCheck(List<InsuranceBatchParam> paramList){
Map<String,List<InsuranceBatchParam>> map = new HashMap<>();
List<InsuranceBatchParam> listResult = new ArrayList<>();
List<InsuranceBatchParam> listSuccess = new ArrayList<>();
for (InsuranceBatchParam param : paramList) {
// 必填校验
if (StringUtils.isBlank(param.getOrderNo())){
param.setErrorMessage(InsurancesConstants.ORDER_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.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.getPost())){
param.setErrorMessage(InsurancesConstants.POST_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getPolicyNo())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_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.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;
}
// 身份证号位数校验(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();
// 保险公司-险种-购买标准 是否存在
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());
}
}
}
//记录查重校验:姓名 + 身份证号 + 保险公司 + 险种
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::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (Optional.ofNullable(insuranceDetail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_EXIST);
listResult.add(param);
continue;
}
//保单开始日期、结束日期,由系统根据保单号关联查询投保状态为 "已投保" 的商险记录的任意一条
TInsuranceDetail limitOne = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getBuyHandleStatus, CommonConstants.THREE_INT)
.eq(TInsuranceDetail::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 {
param.setPolicyStart(limitOne.getPolicyStart());
param.setPolicyEnd(limitOne.getPolicyEnd());
}
// 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示)
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) {
......
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