Commit 4f892ed7 authored by zhaji's avatar zhaji

"feature-zhaJi:新增紧急出险接口,优化部分提示语句"

parent 5e125b03
......@@ -565,6 +565,12 @@ public class InsurancesConstants {
* 修改保险公司
*/
public static final String UPDATE_INSURANCE_COMPANY = "修改保险公司";
/**
* 删除保险公司
*/
public static final String DELETE_INSURANCE_COMPANY = "删除保险公司";
/**
* 新增险种
*/
......@@ -623,4 +629,6 @@ public class InsurancesConstants {
public static final String MONTH_CHANGE = "变更结算月";
}
package com.yifu.cloud.plus.v1.yifu.insurances.entity;
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;
......@@ -8,7 +8,7 @@ import java.io.Serializable;
/**
* @author zhaji
* @description 项目
* @description 项目信息
* @date 2022-07-29 09:35:31
*/
@Data
......
......@@ -3,7 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.Dept;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import io.swagger.v3.oas.annotations.Operation;
......@@ -11,6 +11,7 @@ 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.security.core.userdetails.User;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -390,4 +391,18 @@ public class TInsuranceDetailController {
return tInsuranceDetailService.getDeptList();
}
/**
* 出险
*
* @author zhaji
* @param userName 姓名
* @param empIdcardNo 身份证
* @return {@link R<List< RefundExportListVo >>}
*/
@Operation(summary = "紧急出险", description = "紧急出险")
@GetMapping("/urgentUpdateIsUse")
public R urgentUpdateIsUse(String userName,String empIdcardNo) {
return tInsuranceDetailService.urgentUpdateIsUse(userName,empIdcardNo);
}
}
......@@ -266,4 +266,14 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*/
R getDeptList();
/**
* EKP紧急出险
*
* @author zhaji
* @param userName
* @param empIdcardNo
* @return {@link R}
*/
R urgentUpdateIsUse(String userName, String empIdcardNo);
}
......@@ -5,23 +5,24 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
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.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
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.service.TInsuranceOperateService;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
......@@ -35,8 +36,19 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
@Resource
private TInsuranceDetailService insuranceDetailService;
private TInsuranceDetailService tInsuranceDetailService;
@Resource
private TInsuranceOperateService tInsuranceOperateService;
/**
* 分页查询保险公司
*
* @author zhaji
* @param page 分页参数
* @param insuranceCompany 查询类
* @return {@link IPage< TInsuranceCompany>}
*/
@Override
public IPage<TInsuranceCompany> pageDiy(Page page, TInsuranceCompany insuranceCompany) {
LambdaQueryWrapper<TInsuranceCompany> wrapper = new LambdaQueryWrapper<>();
......@@ -45,6 +57,13 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
return list;
}
/**
* 新增保险公司
*
* @author zhaji
* @param insuranceCompany 新增类
* @return {@link R}
*/
@Override
public R saveInsuranceCompany(TInsuranceCompany insuranceCompany) {
if(Common.isEmpty(insuranceCompany)){
......@@ -64,9 +83,11 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
insuranceCompany.setCreateName(user.getNickname());
insuranceCompany.setCreateTime(LocalDateTime.now());
insuranceCompany.setDeleteFlag(CommonConstants.ZERO_INT);
return R.ok(save(insuranceCompany),"新增成功");
save(insuranceCompany);
addOperate(insuranceCompany,user, InsurancesConstants.DELETE_INSURANCE_COMPANY);
return R.ok("新增成功");
}else{
return R.failed("当前保险公司已存在");
return R.failed("保险公司名称不能重复添加");
}
}
......@@ -105,7 +126,7 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
LambdaQueryWrapper<TInsuranceDetail> detailQueryWrapper = new LambdaQueryWrapper<>();
detailQueryWrapper.eq(TInsuranceDetail::getInsuranceCompanyName,companyName)
.eq(TInsuranceDetail::getDeleteFlag,CommonConstants.ZERO_INT);
List<TInsuranceDetail> list = insuranceDetailService.list(detailQueryWrapper);
List<TInsuranceDetail> list = tInsuranceDetailService.list(detailQueryWrapper);
if (Common.isNotEmpty(list)){
return R.failed("当前保险公司的名称已存在对应的商险信息,不能进行修改");
}else{
......@@ -120,7 +141,9 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
}else{
insuranceCompany.setUpdateBy(user.getId());
insuranceCompany.setUpdateTime(LocalDateTime.now());
return R.ok(updateById(insuranceCompany));
updateById(insuranceCompany);
addOperate(one,user, InsurancesConstants.UPDATE_INSURANCE_COMPANY);
return R.ok("修改保险信息公司成功");
}
}
/**
......@@ -144,10 +167,36 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
.set(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT)
.set(TInsuranceCompany :: getUpdateBy,user.getId())
.set(TInsuranceCompany :: getUpdateTime,LocalDateTime.now());
return R.ok(update(updateWrapper));
update(updateWrapper);
addOperate(one,user, InsurancesConstants.DELETE_INSURANCE_COMPANY);
return R.ok("删除成功");
}
}
/**
* 操作记录
*
* @author zhaji
* @param insuranceCompany 保险公司
* @param user 登录用户
* @param operateDesc 操作描述
* @return void
*/
private void addOperate(TInsuranceCompany insuranceCompany,YifuUser user,String operateDesc){
try {
TInsuranceOperate operate = new TInsuranceOperate();
operate.setInsuranceDetailId(insuranceCompany.getId());
operate.setOperateDesc(operateDesc);
operate.setCreateBy(user.getId());
operate.setCreateName(user.getNickname());
operate.setCreateTime(LocalDateTime.now());
tInsuranceOperateService.save(operate);
}catch (Exception e){
e.getStackTrace();
}
}
/**
* 查询当前保险公司列表
*
......
package com.yifu.cloud.plus.v1.yifu.insurances.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -2604,7 +2605,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if(CommonConstants.FIVE_INT == buyHandleStatus){
return R.failed("当前员工已减员,不能进行出险操作");
}
if(null != reduceHandleStatus){
if(null != reduceHandleStatus && CommonConstants.THREE_INT != reduceHandleStatus){
return R.failed("当前员工在减员中,不能进行出险操作");
}
Integer isEffect = insuranceDetail.getIsEffect();
......@@ -3321,6 +3322,52 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
return R.ok(deptList);
};
}
/**
* EKP紧急出险
*
* @author zhaji
* @param userName
* @param empIdcardNo
* @return {@link R}
*/
@Override
public R urgentUpdateIsUse(String userName, String empIdcardNo) {
//员工姓名
if(StringUtils.isBlank(userName)){
}
//员工身份证
if(StringUtils.isBlank(empIdcardNo)){
return R.failed("身份证号为空");
}
//员工身份证
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(empIdcardNo)){
return R.failed("身份证格式不正确");
}
LambdaQueryWrapper<TInsuranceDetail> queryWrapper = new LambdaQueryWrapper<>();
//查询所有在保,未出险,未过期,未失效,未减员的保单信息
queryWrapper.eq(TInsuranceDetail :: getEmpIdcardNo,empIdcardNo).eq(TInsuranceDetail :: getBuyHandleStatus ,CommonConstants.THREE_INT)
.eq(TInsuranceDetail :: getIsEffect,CommonConstants.ZERO_INT).eq(TInsuranceDetail :: getIsUse,CommonConstants.ZERO_INT)
.eq(TInsuranceDetail :: getIsOverdue,CommonConstants.ZERO_INT)
.ne(TInsuranceDetail :: getReduceHandleStatus,CommonConstants.ONE_INT)
.ne(TInsuranceDetail :: getReduceHandleStatus,CommonConstants.TWO_INT);
List<TInsuranceDetail> list = list(queryWrapper);
if (CollectionUtils.isEmpty(list)){
return R.failed("无可出险的保单");
}
for (TInsuranceDetail tInsuranceDetail : list) {
tInsuranceDetail.setIsUse(CommonConstants.ONE_INT);
//tInsuranceDetail.setUpdateBy();
tInsuranceDetail.setUpdateTime(LocalDateTime.now());
}
boolean b = updateBatchById(list);
if(b){
return R.ok("EKP紧急出险成功");
}else{
return R.ok("EKP紧急出险失败");
}
}
}
......@@ -2,7 +2,6 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -11,19 +10,15 @@ 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.entity.TInsuranceCompany;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceType;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeStandard;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.*;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceTypeMapper;
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.TInsuranceOperateService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceTypeService;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceTypeVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -39,7 +34,10 @@ import java.util.List;
public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper, TInsuranceType> implements TInsuranceTypeService {
@Resource
private TInsuranceCompanyService insuranceCompanyService;
private TInsuranceCompanyService tInsuranceCompanyService;
@Resource
private TInsuranceOperateService tInsuranceOperateService;
/**
* 险种分页查询
......@@ -51,7 +49,6 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
*/
@Override
public IPage<InsuranceTypeVo> pageDiy(Page<TInsuranceType> page, TInsuranceType insuranceType) {
return this.baseMapper.selectInsuranceTypePage(page,insuranceType);
}
......@@ -86,22 +83,23 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
}
LambdaQueryWrapper<TInsuranceCompany> companyWrapper = new LambdaQueryWrapper<>();
companyWrapper.eq(TInsuranceCompany::getId,companyId).eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceCompany insuranceCompany = insuranceCompanyService.getOne(companyWrapper);
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(companyWrapper);
if(Common.isEmpty(insuranceCompany)){
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);
if (!Common.isEmpty(type)){
return R.failed("当前险种已存在");
return R.failed("当前保险公司已存在该险种");
}else{
insuranceType.setDeleteFlag(CommonConstants.ZERO_INT);
insuranceType.setCreateBy(user.getId());
insuranceType.setCreateName(user.getNickname());
insuranceType.setCreateTime(LocalDateTime.now());
return R.ok(save(insuranceType));
save(insuranceType);
addOperate(insuranceType,user, InsurancesConstants.NEW_INSURANCE_TYPE);
return R.ok("新增险种信息成功");
}
}
......@@ -137,6 +135,7 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
*/
@Override
public R updateInsuranceType(TInsuranceType insuranceType) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(insuranceType.getId())){
return R.failed("险种ID不能为空");
}
......@@ -145,7 +144,11 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
return R.failed("当前险种信息不存在或已被删除");
}
if(byId.getName().equals(insuranceType.getName())){
return R.ok(this.updateById(insuranceType),"修改险种信息成功");
insuranceType.setUpdateBy(user.getId());
insuranceType.setUpdateTime(LocalDateTime.now());
updateById(insuranceType);
addOperate(insuranceType,user, InsurancesConstants.UPDATE_INSURANCE_TYPE);
return R.ok("修改险种信息成功");
}else{
LambdaQueryWrapper<TInsuranceType> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceType::getName,insuranceType.getName())
......@@ -153,13 +156,40 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
.eq(TInsuranceType::getDeleteFlag,CommonConstants.ZERO_INT);
TInsuranceType one = this.getOne(queryWrapper);
if (Common.isEmpty(one)){
return R.ok(this.updateById(insuranceType),"修改险种信息成功");
insuranceType.setUpdateBy(user.getId());
insuranceType.setUpdateTime(LocalDateTime.now());
updateById(insuranceType);
addOperate(insuranceType,user, InsurancesConstants.UPDATE_INSURANCE_TYPE);
return R.ok("修改险种信息成功");
}else{
return R.failed("当前险种名称已存在");
}
}
}
/**
* 操作记录
*
* @author zhaji
* @param insuranceType 险种信息
* @param user 登录用户
* @param operateDesc 操作描述
* @return void
*/
private void addOperate(TInsuranceType insuranceType,YifuUser user,String operateDesc){
try {
TInsuranceOperate operate = new TInsuranceOperate();
operate.setInsuranceDetailId(insuranceType.getId());
operate.setOperateDesc(operateDesc);
operate.setCreateBy(user.getId());
operate.setCreateName(user.getNickname());
operate.setCreateTime(LocalDateTime.now());
tInsuranceOperateService.save(operate);
}catch (Exception e){
e.getStackTrace();
}
}
/**
* 查询险种列表
*
......@@ -179,7 +209,7 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
}else{
LambdaQueryWrapper<TInsuranceCompany> companyWrapper = new LambdaQueryWrapper<>();
companyWrapper.eq(TInsuranceCompany::getId,companyId).eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceCompany insuranceCompany = insuranceCompanyService.getOne(companyWrapper);
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(companyWrapper);
if(Common.isEmpty(insuranceCompany)){
return R.failed("所属保险公司不存在或已被删除");
}else{
......
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