Commit 5564258a authored by zhaji's avatar zhaji

"feature-zhaJi:优化导入时间格式,新增减员办理异常返回类"

parent ee3ae9e1
......@@ -61,4 +61,6 @@ public class ValidityConstants {
public static final String PATTERN_32 = "^.{1,32}$";
/** 最多50位 规则 */
public static final String PATTERN_50 = "^.{1,50}$";
/** 最多60位 规则 */
public static final String PATTERN_60 = "^.{1,60}$";
}
......@@ -258,6 +258,20 @@ public class ValidityUtil {
return str.matches(ValidityConstants.PATTERN_50) ;
}
/**
* 验证字符串 最多50位
*
* @author licancan
* @param str
* @return {@link boolean}
*/
public static boolean validate60(final String str){
if(Common.isEmpty(str)){
return Boolean.FALSE;
}
return str.matches(ValidityConstants.PATTERN_60) ;
}
/**
* 校验用户姓名是否是初始化的值
*
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
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 zhaji
* @description 减员办理错误返回类
* @date 2022-07-27 10:29:55
*/
@Data
@Tag(name = "减员办理错误返回类")
public class RefundErrorVo implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 主键
*/
private String id;
/**
* 项目名称
*/
@Schema(description = "项目名称")
private String projectName;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 投保类型, 1新增、3批增、4替换
*/
@Schema(description = " 投保类型, 1新增、3批增、4替换")
private Integer buyType;
/**
* 减员状态 1待减员 2减员中3减员退回
*/
@Schema(description = "减员状态 1待减员 2减员中3减员退回")
private Integer reduceHandleStatus;
/**
* 投保岗位
*/
@Schema(description = "投保岗位")
private String post;
/**
* 商险购买地省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;
/**
* 保单开始时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "保单开始时间")
private LocalDate policyStart;
/**
* 保单结束时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "保单结束时间")
private LocalDate policyEnd;
/**
* 保险公司名称(冗余字段)
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 医疗额度
*/
@Schema(description = "医疗额度")
private String medicalQuota;
/**
* 身故或残疾额度
*/
@Schema(description = "身故或残疾额度")
private String dieDisableQuota;
/**
* 结算月
*/
@Schema(description = "结算月")
private String settleMonth;
/**
* 结算类型 (0、与薪资合并结算 1、单独结算)
*/
@Schema(description = "结算类型 (0、预估 1、实缴)")
private Integer settleType;
/**
* 创建人姓名
*/
@Schema(description = "创建人(派单人)")
private String createName;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 错误原因
*/
@Schema(description = "错误原因")
private String errorMessage;
}
......@@ -54,6 +54,12 @@ public class RefundExportListVo implements Serializable {
@Schema(description = " 投保类型, 1新增、3批增、4替换")
private Integer buyType;
/**
* 减员状态 1待减员 2减员中3减员退回
*/
@Schema(description = "减员状态 1待减员 2减员中3减员退回")
private Integer reduceHandleStatus;
/**
* 投保岗位
*/
......
......@@ -16,6 +16,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceCompanyMapper;
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.util.ValidityUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
......@@ -53,8 +54,7 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
if (!CommonConstants.ZERO_STRING.equals(billingType) && !CommonConstants.ONE_STRING.equals(billingType)){
return R.failed("计费方式格式不正确");
}
String companyName = insuranceCompany.getCompanyName();
if (companyName.length()>CommonConstants.SIXTY_INT){
if (!ValidityUtil.validate60(insuranceCompany.getCompanyName())){
return R.failed("保险公司名称过长");
}
boolean b = companyIsExists(insuranceCompany.getCompanyName());
......
......@@ -1617,136 +1617,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
/***********************减员办理********************************/
/**
* 减员导入校验
*
* @author zhaji
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
public Map<String,List<InsuranceRefundCheck>> checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList){
List<InsuranceRefundCheck> errorList = new ArrayList<>(128);
List<InsuranceRefundCheck> successList = new ArrayList<>();
Map<String,List<InsuranceRefundCheck>> map = new HashMap<>();
for (InsuranceRefundCheck param : insuranceRefundCheckList) {
//员工姓名
String empName = param.getEmpName();
if(StringUtils.isBlank(empName)){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//员工身份证
String empIdCardNo = param.getEmpIdcardNo();
if(StringUtils.isBlank(empIdCardNo)){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
errorList.add(param);
continue;
}
//保险公司名称
String insuranceCompanyName = param.getInsuranceCompanyName();
if(StringUtils.isBlank(insuranceCompanyName)){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//险种名称
String insuranceTypeName = param.getInsuranceTypeName();
if(StringUtils.isBlank(insuranceTypeName)){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//保单开始日期
String policyStart = param.getPolicyStart();
if(StringUtils.isBlank(policyStart)){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
errorList.add(param);
continue;
}
//保单结束日期
String policyEnd = param.getPolicyEnd();
if(StringUtils.isBlank(policyEnd)){
param.setErrorMessage(InsurancesConstants.POLICY_END_NOT_EMPTY);
errorList.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
errorList.add(param);
continue;
}
// 保单开始日期格式校验
if(!LocalDateUtil.isDate(policyStart,LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
errorList.add(param);
continue;
}
// 保单结束日期格式校验
if(!LocalDateUtil.isDate(policyEnd,LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
errorList.add(param);
continue;
}
LambdaQueryWrapper<TInsuranceDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT).eq(TInsuranceDetail ::getEmpName,empName )
.eq(TInsuranceDetail ::getEmpIdcardNo,empIdCardNo ).eq(TInsuranceDetail :: getInsuranceTypeName,insuranceCompanyName )
.eq(TInsuranceDetail :: getPolicyStart,policyStart ).eq(TInsuranceDetail :: getPolicyEnd,policyEnd);
TInsuranceDetail one = getOne(queryWrapper);
if (Common.isEmpty(one)){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
errorList.add(param);
continue;
}
//当前保单信息的不是已投保状态不能导入
Integer buyHandleStatus = one.getBuyHandleStatus();
if (CommonConstants.THREE_INT != buyHandleStatus){
param.setErrorMessage(InsurancesConstants.REFUND_ERROR);
errorList.add(param);
continue;
}
Integer reduceHandleStatus = one.getReduceHandleStatus();
//当前保单信息的减员状态不为空时不能进行导入
if(reduceHandleStatus != null && CommonConstants.THREE_INT != reduceHandleStatus ){
param.setErrorMessage(InsurancesConstants.REFUND_ERROR);
errorList.add(param);
continue;
}
//出险状态
if(CommonConstants.ZERO_INT != one.getIsUse()){
param.setErrorMessage(InsurancesConstants.IS_USE_ERROR);
errorList.add(param);
continue;
}
//有效状态
if(CommonConstants.ZERO_INT != one.getIsEffect()){
param.setErrorMessage(InsurancesConstants.IS_EFFECT_ERROR);
errorList.add(param);
continue;
}
//过期状态
if (CommonConstants.ZERO_INT != one.getIsOverdue()){
param.setErrorMessage(InsurancesConstants.IS_OVERDUE_ERROR);
errorList.add(param);
continue;
}
param.setId(one.getId());
param.setReduceHandleStatus(one.getReduceHandleStatus());
successList.add(param);
}
map.put("successList",successList);
map.put("errorList",errorList);
return map;
};
/**
* 减员导入
*
......@@ -1763,7 +1633,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map<String, List<InsuranceRefundCheck>> refundMap = checkInsuranceRefundList(insuranceRefundCheckList);
List<InsuranceRefundCheck> successList = refundMap.get("successList");
if (CollectionUtils.isNotEmpty(successList)){
List<TInsuranceRefund> refundList= new ArrayList<>();
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now())
......@@ -1776,8 +1645,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceRefund.setCreateName(user.getNickname());
insuranceRefund.setCreateTime(LocalDateTime.now());
insuranceRefund.setRemark(refund.getRemark());
if(CommonConstants.THREE_INT == refund.getReduceHandleStatus()){
if(null == refund.getReduceHandleStatus() || CommonConstants.THREE_INT == refund.getReduceHandleStatus()){
tInsuranceRefundService.updateByInsDetailId(insuranceRefund);
}else{
tInsuranceRefundService.save(insuranceRefund);
......@@ -1785,10 +1653,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.eq(TInsuranceDetail :: getId,refund.getId());
update(updateWrapper);
}
}
List<InsuranceRefundCheck> errorList = refundMap.get("errorList");
return R.ok(errorList,"校验完成,成功:"+successList.size()+"条,失败:"+errorList.size()+"条");
return R.ok(errorList,"校验完成");
}
/**
......@@ -2007,272 +1874,120 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override
@Transactional(rollbackFor = Exception.class)
public R updateInsuranceRefund(InsuranceRefundListParam insuranceDetail) {
InsuranceRefundListParam param = new InsuranceRefundListParam();
Integer refundType = insuranceDetail.getRefundType();
if(CommonConstants.THREE_INT != refundType && CommonConstants.FOUR_INT != refundType){
return R.failed("当前的操作类型不正确");
}
YifuUser user = SecurityUtils.getUser();
List<String> insuranceDetailList = insuranceDetail.getInsuranceDetailList();
List<RefundErrorVo> errorList = new ArrayList<>();
List<TInsuranceDetail> successList = new ArrayList<>();
List<TInsuranceDetail> tInsuranceDetails = this.listByIds(insuranceDetailList);
List<TInsuranceRefund> refundList = new ArrayList<>();
for (TInsuranceDetail tInsuranceDetail : tInsuranceDetails) {
TInsuranceRefund refund = new TInsuranceRefund();
RefundErrorVo refundErrorVo = new RefundErrorVo();
BeanCopyUtils.copyProperties(tInsuranceDetail,refundErrorVo);
Integer deleteFlag = tInsuranceDetail.getDeleteFlag();
if (CommonConstants.ONE_INT == deleteFlag ){
if(refundType.equals(tInsuranceDetail.getReduceHandleStatus())){
if(CommonConstants.THREE_INT == refundType){
refundErrorVo.setErrorMessage("该保单信息已被更新为减员退回");
errorList.add(refundErrorVo);
}else{
refundErrorVo.setErrorMessage("该保单信息已被更新为减员成功");
errorList.add(refundErrorVo);
}
}else{
if (CommonConstants.ZERO_INT == deleteFlag ){
tInsuranceDetail.setUpdateTime(LocalDateTime.now());
tInsuranceDetail.setUpdateBy(user.getId());
tInsuranceDetail.setReduceHandleStatus(refundType);
successList.add(tInsuranceDetail);
refund.setInsDetailId(tInsuranceDetail.getId());
refund.setCreateBy(user.getId());
refund.setCreateTime(LocalDateTime.now());
refund.setReduceHandleStatus(refundType);
refundList.add(refund);
}else{
refundErrorVo.setErrorMessage("该保单信息已被删除");
errorList.add(refundErrorVo);
}
}
return R.ok(updateBatchById(tInsuranceDetails),"办理成功");
}
for (TInsuranceRefund refund : refundList) {
tInsuranceRefundService.updateByInsDetailId(refund);
}
updateBatchById(successList);
return R.ok(errorList,"操作成功");
}
/**
* 结算月份校验
* 变更结算月份
*
* @author zhaji
* @param settleMonthCheckList 变更列表
* @return {@link R}
* @param
* @return void
*/
private Map<String,List<SettleMonthChangeCheckParam>> settleMonthChangeCheck(List<SettleMonthChangeCheckParam> settleMonthCheckList) {
Map<String,List<SettleMonthChangeCheckParam>> map = new HashMap<>(16);
List<SettleMonthChangeCheckParam> errorList = new ArrayList();
List<SettleMonthChangeCheckParam> successList = new ArrayList<>();
for (SettleMonthChangeCheckParam param : settleMonthCheckList) {
//结算月
String settleMonth = param.getSettleMonth();
if(StringUtils.isBlank(settleMonth)){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_NOT_EMPTY);
errorList.add(param);
continue;
@Transactional(rollbackFor = Exception.class)
@Override
public R settleMonthChange(List<SettleMonthChangeCheckParam> settleMonthCheckList) {
YifuUser user = SecurityUtils.getUser();
if(!Common.isNotEmpty(settleMonthCheckList)){
return R.failed(InsurancesConstants.SETTLE_MONTH_CHANGE_LIST_IS_EMPTY);
}
//员工姓名
String empName = param.getEmpName();
if(StringUtils.isBlank(empName)){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
errorList.add(param);
continue;
Map<String, List<SettleMonthChangeCheckParam>> map = settleMonthChangeCheck(settleMonthCheckList);
//todo 生成EKP通知,通知ekp变更结算月份
List<SettleMonthChangeCheckParam> successList = map.get("successList");
for (SettleMonthChangeCheckParam success : successList) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT).eq(TInsuranceDetail ::getEmpName,success.getEmpName())
.eq(TInsuranceDetail ::getEmpIdcardNo,success.getEmpIdCardNo()).eq(TInsuranceDetail :: getInsuranceTypeName,success.getInsuranceTypeName() )
.eq(TInsuranceDetail :: getDeptNo,success.getDeptNo()).eq(TInsuranceDetail :: getBuyStandard,success.getBuyStandard())
.eq(TInsuranceDetail :: getInsuranceCompanyName,success.getInsuranceCompanyName())
.eq(TInsuranceDetail :: getPolicyStart,success.getPolicyStart() ).eq(TInsuranceDetail :: getPolicyEnd,success.getPolicyEnd())
.set(TInsuranceDetail :: getSettleMonth,success.getSettleMonth())
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
update(updateWrapper);
}
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
//判断当前变更是否全部成功
return R.ok(errorList);
//员工身份证
String empIdCardNo = param.getEmpIdCardNo();
if(StringUtils.isBlank(empIdCardNo)){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
errorList.add(param);
continue;
}
//保险公司名称
String insuranceCompanyName = param.getInsuranceCompanyName();
if(StringUtils.isBlank(insuranceCompanyName)){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EMPTY);
errorList.add(param);
continue;
/**
* 变更所属项目
*
* @author zhaji
* @param deptChangeCheckList 变更列表
* @return {@link R}
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R deptChange(List<DeptChangeCheckParam> deptChangeCheckList) {
YifuUser user = SecurityUtils.getUser();
if(!Common.isNotEmpty(deptChangeCheckList)){
return R.failed("当前变更所属项目列表为空");
}
//险种名称
String insuranceTypeName = param.getInsuranceTypeName();
if(StringUtils.isBlank(insuranceTypeName)){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EMPTY);
errorList.add(param);
continue;
Map<String, List<DeptChangeCheckParam>> stringListMap = deptChangeCheck(deptChangeCheckList);
//todo 生成EKP通知,通知ekp变更结算所属项目
List<DeptChangeCheckParam> successList = stringListMap.get("successList");
for (DeptChangeCheckParam success : successList) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT).eq(TInsuranceDetail ::getEmpName,success.getEmpName())
.eq(TInsuranceDetail ::getEmpIdcardNo,success.getEmpIdCardNo()).eq(TInsuranceDetail :: getInsuranceTypeName,success.getInsuranceTypeName() )
.eq(TInsuranceDetail :: getDeptNo,success.getOldDeptNo()).eq(TInsuranceDetail :: getBuyStandard,success.getBuyStandard())
.eq(TInsuranceDetail :: getInsuranceCompanyName,success.getInsuranceCompanyName())
.eq(TInsuranceDetail :: getPolicyStart,success.getPolicyStart() ).eq(TInsuranceDetail :: getPolicyEnd,success.getPolicyEnd())
.set(TInsuranceDetail :: getDeptNo,success.getNewDeptNo())
.set(TInsuranceDetail :: getSettleType,success.getSettleType())
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
update(updateWrapper);
}
//保单开始日期
String policyStart = param.getPolicyStart();
if(StringUtils.isBlank(policyStart)){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
errorList.add(param);
continue;
}
//保单结束日期
String policyEnd = param.getPolicyEnd();
if(StringUtils.isBlank(policyEnd)){
param.setErrorMessage(InsurancesConstants.POLICY_END_NOT_EMPTY);
errorList.add(param);
continue;
}
//所属项目
String deptNo = param.getDeptNo();
if(StringUtils.isBlank(deptNo)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_EMPTY);
errorList.add(param);
continue;
}
//购买标准
String buyStandard = param.getBuyStandard();
if(StringUtils.isBlank(buyStandard)){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EMPTY);
errorList.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (ValidityUtil.validateIDCard(param.getEmpIdCardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
errorList.add(param);
continue;
}
// 保单开始日期格式校验
if(!LocalDateUtil.isDate(policyStart,LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
errorList.add(param);
continue;
}
// 保单结束日期格式校验
if(!LocalDateUtil.isDate(policyEnd,LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
errorList.add(param);
continue;
}
// 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示)
if(!LocalDateUtil.isDate(param.getSettleMonth(),LocalDateUtil.NORM_MONTH_PATTERN)){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_PARSE_ERROR);
errorList.add(param);
continue;
}
if(!LocalDateUtil.isCurrentOrFutureMonth(param.getSettleMonth())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_SHOULD_IS_FUTURE);
errorList.add(param);
continue;
}
//必填格式校通过后查询对应的保单信息
LambdaQueryWrapper<TInsuranceDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT).eq(TInsuranceDetail ::getEmpName,empName )
.eq(TInsuranceDetail ::getEmpIdcardNo,empIdCardNo ).eq(TInsuranceDetail :: getInsuranceTypeName,insuranceCompanyName )
.eq(TInsuranceDetail :: getDeptNo,deptNo).eq(TInsuranceDetail :: getBuyStandard,buyStandard)
.eq(TInsuranceDetail :: getInsuranceCompanyName,insuranceCompanyName)
.eq(TInsuranceDetail :: getPolicyStart,policyStart ).eq(TInsuranceDetail :: getPolicyEnd,policyEnd);
TInsuranceDetail insuranceDetail = getOne(queryWrapper);
//如果保单信息为空
if (Common.isEmpty(insuranceDetail)){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
errorList.add(param);
continue;
}
Integer buyType = insuranceDetail.getBuyType();
if (CommonConstants.FOUR_INT == buyType){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_IS_EFFECT_ERROR);
errorList.add(param);
continue;
}
//如果结算月份相同
if (settleMonth.equals(insuranceDetail.getSettleMonth())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_IDENTICAL);
errorList.add(param);
continue;
}
//非已办理状态
Integer buyHandleStatus = insuranceDetail.getBuyHandleStatus();
if (CommonConstants.THREE_INT != buyHandleStatus){
param.setErrorMessage(InsurancesConstants.REFUND_ERROR);
errorList.add(param);
continue;
}
//查询结算状态
LambdaQueryWrapper<TInsuranceSettle> insuranceSettleQuery = new LambdaQueryWrapper<>();
insuranceSettleQuery.eq(TInsuranceSettle :: getInsDetailId,insuranceDetail.getId());
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getOne(insuranceSettleQuery);
//当前结算状态为已结算时,不能变更结算月
if (CommonConstants.FOUR_STRING.equals(insuranceSettle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_SETTLE_HANDLE_STATUS_ERROR);
errorList.add(param);
continue;
}
Integer reduceHandleStatus = insuranceDetail.getReduceHandleStatus();
//当前保单信息的减员状态不为空时不能进行导入
if(reduceHandleStatus != null && CommonConstants.THREE_INT != reduceHandleStatus ){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_REDUCE_HANDLE_STATUS_ERROR);
errorList.add(param);
continue;
}
//有效状态
if(CommonConstants.ZERO_INT != insuranceDetail.getIsEffect()){
param.setErrorMessage(InsurancesConstants.IS_EFFECT_ERROR);
errorList.add(param);
continue;
}
//判断当前数据中是否存在重复数据
boolean b = successList.stream().anyMatch(u -> u.getEmpName().equals(param.getEmpName())
&& u.getEmpIdCardNo().equals(param.getEmpIdCardNo())&& u.getDeptNo().equals(param.getDeptNo())
&& u.getInsuranceCompanyName().equals(param.getInsuranceCompanyName())&& u.getInsuranceTypeName().equals(param.getInsuranceTypeName())
&& u.getPolicyStart().equals(param.getPolicyStart())&& u.getPolicyEnd().equals(param.getPolicyEnd())
&& u.getSettleMonth().equals(param.getSettleMonth())&& u.getBuyStandard().equals(param.getBuyStandard()));
if(!b){
successList.add(param);
}else{
param.setErrorMessage(InsurancesConstants.DUPLICATE_DATA_ERROR);
errorList.add(param);
}
}
map.put("errorList",errorList);
map.put("successList",successList);
return map;
}
/**
* 变更结算月份
*
* @author zhaji
* @param
* @return void
*/
@Transactional(rollbackFor = Exception.class)
@Override
public R settleMonthChange(List<SettleMonthChangeCheckParam> settleMonthCheckList) {
YifuUser user = SecurityUtils.getUser();
if(!Common.isNotEmpty(settleMonthCheckList)){
return R.failed(InsurancesConstants.SETTLE_MONTH_CHANGE_LIST_IS_EMPTY);
}
Map<String, List<SettleMonthChangeCheckParam>> map = settleMonthChangeCheck(settleMonthCheckList);
//todo 生成EKP通知,通知ekp变更结算月份
List<SettleMonthChangeCheckParam> successList = map.get("successList");
for (SettleMonthChangeCheckParam success : successList) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT).eq(TInsuranceDetail ::getEmpName,success.getEmpName())
.eq(TInsuranceDetail ::getEmpIdcardNo,success.getEmpIdCardNo()).eq(TInsuranceDetail :: getInsuranceTypeName,success.getInsuranceTypeName() )
.eq(TInsuranceDetail :: getDeptNo,success.getDeptNo()).eq(TInsuranceDetail :: getBuyStandard,success.getBuyStandard())
.eq(TInsuranceDetail :: getInsuranceCompanyName,success.getInsuranceCompanyName())
.eq(TInsuranceDetail :: getPolicyStart,success.getPolicyStart() ).eq(TInsuranceDetail :: getPolicyEnd,success.getPolicyEnd())
.set(TInsuranceDetail :: getSettleMonth,success.getSettleMonth())
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
update(updateWrapper);
}
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
//判断当前变更是否全部成功
return R.ok(errorList);
}
/**
* 变更所属项目
*
* @author zhaji
* @param deptChangeCheckList 变更列表
* @return {@link R}
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R deptChange(List<DeptChangeCheckParam> deptChangeCheckList) {
YifuUser user = SecurityUtils.getUser();
if(!Common.isNotEmpty(deptChangeCheckList)){
return R.failed("当前变更所属项目列表为空");
}
Map<String, List<DeptChangeCheckParam>> stringListMap = deptChangeCheck(deptChangeCheckList);
//todo 生成EKP通知,通知ekp变更结算所属项目
List<DeptChangeCheckParam> successList = stringListMap.get("successList");
for (DeptChangeCheckParam success : successList) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT).eq(TInsuranceDetail ::getEmpName,success.getEmpName())
.eq(TInsuranceDetail ::getEmpIdcardNo,success.getEmpIdCardNo()).eq(TInsuranceDetail :: getInsuranceTypeName,success.getInsuranceTypeName() )
.eq(TInsuranceDetail :: getDeptNo,success.getOldDeptNo()).eq(TInsuranceDetail :: getBuyStandard,success.getBuyStandard())
.eq(TInsuranceDetail :: getInsuranceCompanyName,success.getInsuranceCompanyName())
.eq(TInsuranceDetail :: getPolicyStart,success.getPolicyStart() ).eq(TInsuranceDetail :: getPolicyEnd,success.getPolicyEnd())
.set(TInsuranceDetail :: getDeptNo,success.getNewDeptNo())
.set(TInsuranceDetail :: getSettleType,success.getSettleType())
.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
update(updateWrapper);
}
List<DeptChangeCheckParam> errorList = stringListMap.get("errorList");
return R.ok(errorList);
List<DeptChangeCheckParam> errorList = stringListMap.get("errorList");
return R.ok(errorList);
}
/**
......@@ -2303,6 +2018,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.ok(list(typeWrapper));
}
/**
* 出险
*
* @author zhaji
* @param id
* @return {@link R}
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R updateIsUse(String id) {
......@@ -2362,6 +2084,137 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
return R.ok(map.get("errorList"));
}
/**
* 减员导入校验
*
* @author zhaji
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
public Map<String,List<InsuranceRefundCheck>> checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList){
List<InsuranceRefundCheck> errorList = new ArrayList<>(128);
List<InsuranceRefundCheck> successList = new ArrayList<>();
Map<String,List<InsuranceRefundCheck>> map = new HashMap<>();
for (InsuranceRefundCheck param : insuranceRefundCheckList) {
//员工姓名
String empName = param.getEmpName();
if(StringUtils.isBlank(empName)){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//员工身份证
String empIdCardNo = param.getEmpIdcardNo();
if(StringUtils.isBlank(empIdCardNo)){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
errorList.add(param);
continue;
}
//保险公司名称
String insuranceCompanyName = param.getInsuranceCompanyName();
if(StringUtils.isBlank(insuranceCompanyName)){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//险种名称
String insuranceTypeName = param.getInsuranceTypeName();
if(StringUtils.isBlank(insuranceTypeName)){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//保单开始日期
String policyStart = param.getPolicyStart();
if(StringUtils.isBlank(policyStart)){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
errorList.add(param);
continue;
}
//保单结束日期
String policyEnd = param.getPolicyEnd();
if(StringUtils.isBlank(policyEnd)){
param.setErrorMessage(InsurancesConstants.POLICY_END_NOT_EMPTY);
errorList.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
errorList.add(param);
continue;
}
// 保单开始日期格式校验
if(!LocalDateUtil.isDate(policyStart,LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
errorList.add(param);
continue;
}
// 保单结束日期格式校验
if(!LocalDateUtil.isDate(policyEnd,LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
errorList.add(param);
continue;
}
LambdaQueryWrapper<TInsuranceDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT).eq(TInsuranceDetail ::getEmpName,empName )
.eq(TInsuranceDetail ::getEmpIdcardNo,empIdCardNo ).eq(TInsuranceDetail :: getInsuranceCompanyName,insuranceCompanyName )
.eq(TInsuranceDetail :: getInsuranceTypeName,insuranceTypeName)
.eq(TInsuranceDetail :: getPolicyStart,LocalDateUtil.parseLocalDate(policyStart)).eq(TInsuranceDetail :: getPolicyEnd,LocalDateUtil.parseLocalDate(policyEnd));
TInsuranceDetail one = getOne(queryWrapper);
if (Common.isEmpty(one)){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
errorList.add(param);
continue;
}
//当前保单信息的不是已投保状态不能导入
Integer buyHandleStatus = one.getBuyHandleStatus();
if (CommonConstants.THREE_INT != buyHandleStatus){
param.setErrorMessage(InsurancesConstants.REFUND_ERROR);
errorList.add(param);
continue;
}
Integer reduceHandleStatus = one.getReduceHandleStatus();
//当前保单信息的减员状态不为空时不能进行导入
if(reduceHandleStatus != null && CommonConstants.THREE_INT != reduceHandleStatus ){
param.setErrorMessage(InsurancesConstants.REFUND_ERROR);
errorList.add(param);
continue;
}
//出险状态
if(CommonConstants.ZERO_INT != one.getIsUse()){
param.setErrorMessage(InsurancesConstants.IS_USE_ERROR);
errorList.add(param);
continue;
}
//有效状态
if(CommonConstants.ZERO_INT != one.getIsEffect()){
param.setErrorMessage(InsurancesConstants.IS_EFFECT_ERROR);
errorList.add(param);
continue;
}
//过期状态
if (CommonConstants.ZERO_INT != one.getIsOverdue()){
param.setErrorMessage(InsurancesConstants.IS_OVERDUE_ERROR);
errorList.add(param);
continue;
}
param.setId(one.getId());
param.setReduceHandleStatus(one.getReduceHandleStatus());
successList.add(param);
}
map.put("successList",successList);
map.put("errorList",errorList);
return map;
};
/**
* 校验保单退费
*
......@@ -2454,7 +2307,189 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
map.put("successList",successList);
return map;
}
/**
* 结算月份校验
*
* @author zhaji
* @param settleMonthCheckList 变更列表
* @return {@link R}
*/
private Map<String,List<SettleMonthChangeCheckParam>> settleMonthChangeCheck(List<SettleMonthChangeCheckParam> settleMonthCheckList) {
Map<String,List<SettleMonthChangeCheckParam>> map = new HashMap<>(16);
List<SettleMonthChangeCheckParam> errorList = new ArrayList();
List<SettleMonthChangeCheckParam> successList = new ArrayList<>();
for (SettleMonthChangeCheckParam param : settleMonthCheckList) {
//结算月
String settleMonth = param.getSettleMonth();
if(StringUtils.isBlank(settleMonth)){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_NOT_EMPTY);
errorList.add(param);
continue;
}
//员工姓名
String empName = param.getEmpName();
if(StringUtils.isBlank(empName)){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//员工身份证
String empIdCardNo = param.getEmpIdCardNo();
if(StringUtils.isBlank(empIdCardNo)){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
errorList.add(param);
continue;
}
//保险公司名称
String insuranceCompanyName = param.getInsuranceCompanyName();
if(StringUtils.isBlank(insuranceCompanyName)){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//险种名称
String insuranceTypeName = param.getInsuranceTypeName();
if(StringUtils.isBlank(insuranceTypeName)){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//保单开始日期
String policyStart = param.getPolicyStart();
if(StringUtils.isBlank(policyStart)){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
errorList.add(param);
continue;
}
//保单结束日期
String policyEnd = param.getPolicyEnd();
if(StringUtils.isBlank(policyEnd)){
param.setErrorMessage(InsurancesConstants.POLICY_END_NOT_EMPTY);
errorList.add(param);
continue;
}
//所属项目
String deptNo = param.getDeptNo();
if(StringUtils.isBlank(deptNo)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_EMPTY);
errorList.add(param);
continue;
}
//购买标准
String buyStandard = param.getBuyStandard();
if(StringUtils.isBlank(buyStandard)){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EMPTY);
errorList.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(param.getEmpIdCardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
errorList.add(param);
continue;
}
// 保单开始日期格式校验
if(!LocalDateUtil.isDate(policyStart,LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
errorList.add(param);
continue;
}
// 保单结束日期格式校验
if(!LocalDateUtil.isDate(policyEnd,LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
errorList.add(param);
continue;
}
// 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示)
if(!LocalDateUtil.isDate(param.getSettleMonth(),LocalDateUtil.NORM_MONTH_PATTERN)){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_PARSE_ERROR);
errorList.add(param);
continue;
}
if(!LocalDateUtil.isCurrentOrFutureMonth(param.getSettleMonth())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_SHOULD_IS_FUTURE);
errorList.add(param);
continue;
}
//必填格式校通过后查询对应的保单信息
LambdaQueryWrapper<TInsuranceDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT).eq(TInsuranceDetail ::getEmpName,empName )
.eq(TInsuranceDetail ::getEmpIdcardNo,empIdCardNo ).eq(TInsuranceDetail :: getInsuranceTypeName,insuranceCompanyName )
.eq(TInsuranceDetail :: getDeptNo,deptNo).eq(TInsuranceDetail :: getBuyStandard,buyStandard)
.eq(TInsuranceDetail :: getInsuranceCompanyName,insuranceCompanyName)
.eq(TInsuranceDetail :: getPolicyStart,LocalDateUtil.parseLocalDate(policyStart) ).eq(TInsuranceDetail :: getPolicyEnd,LocalDateUtil.parseLocalDate(policyEnd));
TInsuranceDetail insuranceDetail = getOne(queryWrapper);
//如果保单信息为空
if (Common.isEmpty(insuranceDetail)){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
errorList.add(param);
continue;
}
Integer buyType = insuranceDetail.getBuyType();
if (CommonConstants.FOUR_INT == buyType){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_IS_EFFECT_ERROR);
errorList.add(param);
continue;
}
//如果结算月份相同
if (settleMonth.equals(insuranceDetail.getSettleMonth())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_IDENTICAL);
errorList.add(param);
continue;
}
//非已办理状态
Integer buyHandleStatus = insuranceDetail.getBuyHandleStatus();
if (CommonConstants.THREE_INT != buyHandleStatus){
param.setErrorMessage(InsurancesConstants.REFUND_ERROR);
errorList.add(param);
continue;
}
//查询结算状态
LambdaQueryWrapper<TInsuranceSettle> insuranceSettleQuery = new LambdaQueryWrapper<>();
insuranceSettleQuery.eq(TInsuranceSettle :: getInsDetailId,insuranceDetail.getId());
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getOne(insuranceSettleQuery);
//当前结算状态为已结算时,不能变更结算月
if (CommonConstants.FOUR_STRING.equals(insuranceSettle.getSettleHandleStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_SETTLE_HANDLE_STATUS_ERROR);
errorList.add(param);
continue;
}
Integer reduceHandleStatus = insuranceDetail.getReduceHandleStatus();
//当前保单信息的减员状态不为空时不能进行导入
if(reduceHandleStatus != null && CommonConstants.THREE_INT != reduceHandleStatus ){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_REDUCE_HANDLE_STATUS_ERROR);
errorList.add(param);
continue;
}
//有效状态
if(CommonConstants.ZERO_INT != insuranceDetail.getIsEffect()){
param.setErrorMessage(InsurancesConstants.IS_EFFECT_ERROR);
errorList.add(param);
continue;
}
//判断当前数据中是否存在重复数据
boolean b = successList.stream().anyMatch(u -> u.getEmpName().equals(param.getEmpName())
&& u.getEmpIdCardNo().equals(param.getEmpIdCardNo())&& u.getDeptNo().equals(param.getDeptNo())
&& u.getInsuranceCompanyName().equals(param.getInsuranceCompanyName())&& u.getInsuranceTypeName().equals(param.getInsuranceTypeName())
&& u.getPolicyStart().equals(param.getPolicyStart())&& u.getPolicyEnd().equals(param.getPolicyEnd())
&& u.getSettleMonth().equals(param.getSettleMonth())&& u.getBuyStandard().equals(param.getBuyStandard()));
if(!b){
successList.add(param);
}else{
param.setErrorMessage(InsurancesConstants.DUPLICATE_DATA_ERROR);
errorList.add(param);
}
}
map.put("errorList",errorList);
map.put("successList",successList);
return map;
}
/**
* 校验所属项目
*
......@@ -2537,7 +2572,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue;
}
// 身份证号位数校验(18 位合法)
if (ValidityUtil.validateIDCard(param.getEmpIdCardNo())){
if (!ValidityUtil.validateIDCard(param.getEmpIdCardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
errorList.add(param);
continue;
......@@ -2587,7 +2622,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceDetail ::getEmpIdcardNo,empIdCardNo ).eq(TInsuranceDetail :: getInsuranceTypeName,insuranceCompanyName )
.eq(TInsuranceDetail :: getBuyStandard,buyStandard)
.eq(TInsuranceDetail :: getInsuranceCompanyName,insuranceCompanyName)
.eq(TInsuranceDetail :: getPolicyStart,policyStart ).eq(TInsuranceDetail :: getPolicyEnd,policyEnd);
.eq(TInsuranceDetail :: getPolicyStart,LocalDateUtil.parseLocalDate(policyStart)).eq(TInsuranceDetail :: getPolicyEnd,LocalDateUtil.parseLocalDate(policyEnd));
TInsuranceDetail insuranceDetail = getOne(queryWrapper);
//替换类型的保单不能变更所属项目
Integer buyType = insuranceDetail.getBuyType();
......
......@@ -75,6 +75,9 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
if(Common.isEmpty(insuranceCompany)){
return R.failed("所属保险公司不存在或已被删除");
}
if (!ValidityUtil.validate50(insuranceType.getName())){
return R.failed("险种名称过长");
}
LambdaQueryWrapper<TInsuranceType> typeWrapper = new LambdaQueryWrapper<>();
typeWrapper.eq(TInsuranceType :: getInsuranceCompanyId ,companyId).eq(TInsuranceType::getName,insuranceType.getName()).eq(TInsuranceType::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceType type = getOne(typeWrapper);
......
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