Commit 3d0ef50a authored by zhaji's avatar zhaji

"feature-zhaJi:新增查询保险公司保单信息,险种保单信息列表接口"

parent b08bd8c2
......@@ -387,4 +387,6 @@ public interface CommonConstants {
String SIX_STRING = "6";
String SEVEN_STRING = "7";
public static final BigDecimal MONEY_MAX = new BigDecimal("999999.99");
}
......@@ -232,4 +232,19 @@ public class InsurancesConstants {
*/
public static final String DUPLICATE_DATA_ERROR = "重复数据";
/**
* 当前变更结算月列表为空
*/
public static final String SETTLE_MONTH_CHANGE_LIST_IS_EMPTY ="当前变更结算月列表为空";
/**
* 替换人员不允许变更结算月
*/
public static final String SETTLE_MONTH_CHANGE_IS_EFFECT_ERROR ="替换人员不允许变更结算月";
/**
* 替换人员不允许变更所属项目
*/
public static final String DEPT_CHANGE_IS_EFFECT_ERROR ="替换人员不允许变更所属项目";
}
......@@ -58,7 +58,7 @@ public class TInsuranceCompany extends BaseEntity {
*/
@NotBlank(message = "计费方式不能为空")
@StringVal({"0","1"})
@Schema(description = "计费方式")
@Schema(description = "计费方式(0:按天,1:按月)")
private String billingType;
/**
......
......@@ -175,7 +175,7 @@ public class InsuranceRefundHandlingListVo implements Serializable {
* 创建人姓名
*/
@Schema(description = "创建人(派单人)")
private String createName;
private String refundCreateName;
/**
* 备注
......
......@@ -323,4 +323,31 @@ public class TInsuranceDetailController {
public R updateInsuranceRefund(@RequestBody InsuranceRefundListParam insuranceDetail) {
return tInsuranceDetailService.updateInsuranceRefund(insuranceDetail);
}
/**
* 根据保险公司名称查询保单明细
*
* @author zhaji
* @param CompanyName 保险公司id
* @return {@link R<List< InsuranceRefundHandlingListVo >>}
*/
@Operation(summary = "根据保险公司名称查询保单明细", description = "根据保险公司名称查询保单明细")
@GetMapping("/selectByCompanyName")
public R selectByCompanyName(String CompanyName) {
return tInsuranceDetailService.selectByCompanyName(CompanyName);
}
/**
* 根据险种名称查询保单明细
*
* @author zhaji
* @param id 险种id
* @return {@link R<List< InsuranceRefundHandlingListVo >>}
*/
@Operation(summary = "根据险种名称查询保单明细", description = "根据险种名称查询保单明细")
@GetMapping("/selectByTypeId")
public R selectByTypeName(String id) {
return tInsuranceDetailService.selectByTypeId(id);
}
}
......@@ -17,6 +17,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhaji
......@@ -40,7 +41,7 @@ public class TInsuranceTypeController {
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" )
public R<IPage<InsuranceTypeVo>> getInsuranceTypePage(Page page, @RequestBody TInsuranceType insuranceType) {
public R<IPage<InsuranceTypeVo>> getInsuranceTypePage(Page page,TInsuranceType insuranceType) {
return R.ok(insuranceTypeService.pageDiy(page, insuranceType));
}
......@@ -51,8 +52,8 @@ public class TInsuranceTypeController {
*/
@Operation(summary = "新增险种", description = "新增险种:hasPermission('demo_insuranceType_add')")
@SysLog("新增险种")
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_insuranceType_add')" )
@PostMapping("/save")
//@PreAuthorize("@pms.hasPermission('demo_insuranceType_add')" )
public R save(@RequestBody TInsuranceType insuranceType) {
return insuranceTypeService.saveInsuranceType(insuranceType);
}
......@@ -64,9 +65,33 @@ public class TInsuranceTypeController {
*/
@Operation(summary = "通过id查询险种详情", description = "通过id查询:hasPermission('demo_insuranceType_get')")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_insuranceType_get')" )
//@PreAuthorize("@pms.hasPermission('demo_insuranceType_get')" )
public R getInsuranceTypeDetail(@PathVariable("id" ) String id) {
return insuranceTypeService.getInsuranceTypeDetail(id);
}
/**
* 修改险种
* @param insuranceType 险种明细
* @return R
*/
@Operation(summary = "修改险种", description = "新增险种:hasPermission('demo_insuranceType_add')")
@SysLog("修改险种")
@PostMapping("/update")
//@PreAuthorize("@pms.hasPermission('demo_insuranceType_add')" )
public R update(@RequestBody TInsuranceType insuranceType) {
return insuranceTypeService.updateInsuranceType(insuranceType);
}
/**
* 查询险种列表
* @param insuranceType 险种信息
* @return
*/
@Operation(summary = "查询险种列表", description = "查询险种列表")
@GetMapping("/list" )
public R getInsuranceTypeList(TInsuranceType insuranceType) {
return insuranceTypeService.getInsuranceTypeList(insuranceType);
}
}
......@@ -47,8 +47,8 @@ public class TInsuranceTypeRateController {
* @return R
*/
@Operation(summary = "删除购买费率信息", description = "删除购买费率信息:hasPermission('demo_insuranceTypeRate_delete')")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_insuranceTypeRate_delete')" )
@DeleteMapping("/{id}" )
//@PreAuthorize("@pms.hasPermission('demo_insuranceTypeRate_delete')" )
public R deleteById(@PathVariable("id" ) String id) {
return insuranceTypeRateService.deleteInsuranceTypeRate(id);
}
......@@ -60,8 +60,8 @@ public class TInsuranceTypeRateController {
*/
@Operation(summary = "新增费率", description = "新增费率:hasPermission('demo_insuranceTypeRate_add')")
@SysLog("新增费率" )
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_insuranceTypeRate_add')" )
@PostMapping("/save")
//@PreAuthorize("@pms.hasPermission('demo_insuranceTypeRate_add')" )
public R save(@RequestBody TInsuranceTypeRate insuranceTypeRate) {
return insuranceTypeRateService.saveInsuranceTypeRate(insuranceTypeRate);
}
......
......@@ -34,7 +34,7 @@ public class TInsuranceTypeStandardController {
* 查询购买标准列表(不分页)
* @return
*/
@Operation(summary = "费率列表", description = "费率列表")
@Operation(summary = "购买标准列表", description = "购买标准列表")
@GetMapping("/list" )
public R getInsuranceTypeRateList(String id) {
return insuranceTypeStandardService.getInsuranceTypeStandard(id);
......@@ -46,8 +46,8 @@ public class TInsuranceTypeStandardController {
* @return R
*/
@Operation(summary = "删除购买标准信息", description = "删除购买标准信息:hasPermission('demo_insuranceTypeStandard_delete')")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_insuranceTypeStandard_delete')" )
@DeleteMapping("/{id}" )
//@PreAuthorize("@pms.hasPermission('demo_insuranceTypeStandard_delete')" )
public R deleteById(@PathVariable("id" ) String id) {
return insuranceTypeStandardService.deleteInsuranceTypeStandard(id);
}
......@@ -59,8 +59,8 @@ public class TInsuranceTypeStandardController {
*/
@Operation(summary = "新增购买标准", description = "新增购买标准:hasPermission('demo_insuranceTypeStandard_add')")
@SysLog("新增购买标准" )
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_insuranceTypeStandard_add')" )
@PostMapping("/save")
//@PreAuthorize("@pms.hasPermission('demo_insuranceTypeStandard_add')" )
public R save(@RequestBody TInsuranceTypeStandard insuranceTypeStandard) {
return insuranceTypeStandardService.saveInsuranceTypeStandard(insuranceTypeStandard);
}
......
......@@ -221,4 +221,21 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*/
R deptChange(List<DeptChangeCheckParam> deptChangeCheckList);
/**
* 根据保险公司名称查询保单明细
*
* @author zhaji
* @param companyName 保险公司名称
* @return {@link R}
*/
R selectByCompanyName(String companyName);
/**
* 根据险种id查询保单明细
*
* @author zhaji
* @param id
* @return {@link R}
*/
R selectByTypeId(String id);
}
......@@ -9,6 +9,8 @@ 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.vo.InsuranceTypeVo;
import java.util.List;
/**
* @author Administrator
* @description 针对表【t_insurance_type(险种表)】的数据库操作Service
......@@ -43,4 +45,21 @@ public interface TInsuranceTypeService extends IService<TInsuranceType> {
*/
R getInsuranceTypeDetail(String id);
/**
* 修改险种信息
*
* @author zhaji
* @param insuranceType
* @return {@link R}
*/
R updateInsuranceType(TInsuranceType insuranceType);
/**
* 查询险种列表
*
* @author zhaji
* @param insuranceType
* @return {@link List< TInsuranceType>}
*/
R getInsuranceTypeList(TInsuranceType insuranceType);
}
......@@ -9,11 +9,14 @@ 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.entity.TInsuranceCompany;
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 org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -45,16 +48,18 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
if(Common.isEmpty(insuranceCompany)){
return R.failed("新增的信息为空");
}
YifuUser user = SecurityUtils.getUser();
String billingType = insuranceCompany.getBillingType();
if (!CommonConstants.ZERO_STRING.equals(billingType) && !CommonConstants.ONE_STRING.equals(billingType)){
return R.failed("计费方式格式不正确");
}
boolean b = companyIsExists(insuranceCompany.getCompanyName());
if (!b){
insuranceCompany.setCreateBy("");
insuranceCompany.setCreateName("");
insuranceCompany.setCreateBy(user.getId());
insuranceCompany.setCreateName(user.getNickname());
insuranceCompany.setCreateTime(LocalDateTime.now());
return R.ok(this.save(insuranceCompany));
insuranceCompany.setDeleteFlag(CommonConstants.ZERO_INT);
return R.ok(save(insuranceCompany),"新增成功");
}else{
return R.failed("当前保险公司已存在");
}
......@@ -69,8 +74,9 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
*/
@Override
public R updateInsuranceCompany(TInsuranceCompany insuranceCompany) {
YifuUser user = SecurityUtils.getUser();
String id = insuranceCompany.getId();
if (Common.isEmpty(id)){
if (StringUtils.isEmpty(id)){
return R.failed("要修改的保险公司id为空");
}
String billingType = insuranceCompany.getBillingType();
......@@ -103,6 +109,8 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
}
}
}else{
insuranceCompany.setUpdateBy(user.getId());
insuranceCompany.setUpdateTime(LocalDateTime.now());
return R.ok(updateById(insuranceCompany));
}
}
......@@ -115,6 +123,7 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
*/
@Override
public R deleteById(String id) {
YifuUser user = SecurityUtils.getUser();
LambdaQueryWrapper<TInsuranceCompany> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceCompany::getId,id).eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceCompany one = this.getOne(queryWrapper);
......@@ -122,8 +131,10 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
return R.failed("当前保险公司不存在");
}else {
LambdaUpdateWrapper<TInsuranceCompany> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceCompany::getId,id);
updateWrapper.set(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
updateWrapper.eq(TInsuranceCompany::getId,id)
.set(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT)
.set(TInsuranceCompany :: getUpdateBy,user.getId())
.set(TInsuranceCompany :: getUpdateTime,LocalDateTime.now());
return R.ok(update(updateWrapper));
}
}
......
......@@ -1587,7 +1587,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @return {@link R}
*/
private Map<String,List<SettleMonthChangeCheckParam>> settleMonthChangeCheck(List<SettleMonthChangeCheckParam> settleMonthCheckList) {
Map<String,List<SettleMonthChangeCheckParam>> map = new HashMap<>();
Map<String,List<SettleMonthChangeCheckParam>> map = new HashMap<>(16);
List<SettleMonthChangeCheckParam> errorList = new ArrayList();
List<SettleMonthChangeCheckParam> successList = new ArrayList<>();
for (SettleMonthChangeCheckParam param : settleMonthCheckList) {
......@@ -1703,6 +1703,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
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);
......@@ -1741,7 +1747,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//判断当前数据中是否存在重复数据
boolean b = successList.stream().anyMatch(u -> u.getEmpName().equals(param.getEmpName())
&& u.getEmpIdCardNo().equals(param.getEmpIdCardNo())&& u.getDeptNo().equals(param.getDeptNo())
&& 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()));
......@@ -1768,7 +1774,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R settleMonthChange(List<SettleMonthChangeCheckParam> settleMonthCheckList) {
YifuUser user = SecurityUtils.getUser();
if(!Common.isNotEmpty(settleMonthCheckList)){
return R.failed("当前变更结算月列表为空");
return R.failed(InsurancesConstants.SETTLE_MONTH_CHANGE_LIST_IS_EMPTY);
}
Map<String, List<SettleMonthChangeCheckParam>> map = settleMonthChangeCheck(settleMonthCheckList);
//todo 生成EKP通知,通知ekp变更结算月份
......@@ -1786,6 +1792,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
update(updateWrapper);
}
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
//判断当前变更是否全部成功
return R.ok(errorList);
}
......@@ -1823,6 +1830,34 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<DeptChangeCheckParam> errorList = stringListMap.get("errorList");
return R.ok(errorList);
}
/**
* 根据保险公司名称查询保单明细
*
* @author zhaji
* @param companyName 保险公司名称
* @return {@link R}
*/
@Override
public R selectByCompanyName(String companyName) {
LambdaQueryWrapper<TInsuranceDetail> typeWrapper = new LambdaQueryWrapper<>();
typeWrapper.eq(TInsuranceDetail :: getInsuranceCompanyName ,companyName).eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT);
return R.ok(list(typeWrapper));
}
/**
* 根据险种id查询保单明细
*
* @author zhaji
* @param id
* @return {@link R}
*/
@Override
public R selectByTypeId(String id) {
LambdaQueryWrapper<TInsuranceDetail> typeWrapper = new LambdaQueryWrapper<>();
typeWrapper.eq(TInsuranceDetail :: getInsuranceTypeId ,id).eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT);
return R.ok(list(typeWrapper));
}
/**
* 校验所属项目
......@@ -1832,7 +1867,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @return {@link R}
*/
public Map<String,List<DeptChangeCheckParam>> deptChangeCheck(List<DeptChangeCheckParam> deptChangeCheckList) {
Map<String,List<DeptChangeCheckParam>> map = new HashMap<>();
Map<String,List<DeptChangeCheckParam>> map = new HashMap<>(16);
List<DeptChangeCheckParam> errorList = new ArrayList();
List<DeptChangeCheckParam> successList = new ArrayList<>();
for (DeptChangeCheckParam param : deptChangeCheckList) {
......@@ -1849,7 +1884,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
//员工身份证
String empIdCardNo = param.getEmpIdCardNo();
if(StringUtils.isBlank(empIdCardNo)){
......@@ -1857,7 +1891,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
//保险公司名称
String insuranceCompanyName = param.getInsuranceCompanyName();
if(StringUtils.isBlank(insuranceCompanyName)){
......@@ -1865,7 +1898,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
//险种名称
String insuranceTypeName = param.getInsuranceTypeName();
if(StringUtils.isBlank(insuranceTypeName)){
......@@ -1881,7 +1913,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
//保单结束日期
String policyEnd = param.getPolicyEnd();
if(StringUtils.isBlank(policyEnd)){
......@@ -1927,6 +1958,21 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
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 :: getBuyStandard,buyStandard)
.eq(TInsuranceDetail :: getInsuranceCompanyName,insuranceCompanyName)
.eq(TInsuranceDetail :: getPolicyStart,policyStart ).eq(TInsuranceDetail :: getPolicyEnd,policyEnd);
TInsuranceDetail insuranceDetail = getOne(queryWrapper);
Integer buyType = insuranceDetail.getBuyType();
if (CommonConstants.FOUR_INT == buyType){
param.setErrorMessage(InsurancesConstants.DEPT_CHANGE_IS_EFFECT_ERROR);
errorList.add(param);
continue;
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(newDeptNo));
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS) {
......
......@@ -7,6 +7,8 @@ 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.entity.TInsuranceCompany;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceType;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
......@@ -15,8 +17,10 @@ import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceTypeRateService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceTypeService;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -59,7 +63,9 @@ public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRat
* @return {@link R}
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R deleteInsuranceTypeRate(String id) {
YifuUser user = SecurityUtils.getUser();
if(Common.isEmpty(id)){
return R.failed("费率id不能为空");
}
......@@ -68,9 +74,11 @@ public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRat
return R.failed("费率信息不存在或已被删除");
}
LambdaUpdateWrapper<TInsuranceTypeRate> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceTypeRate::getId,id);
updateWrapper.set(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT);
return R.ok(update(updateWrapper));
updateWrapper.eq(TInsuranceTypeRate::getId,id)
.set(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ONE_INT)
.set(TInsuranceTypeRate :: getUpdateBy,user.getId())
.set(TInsuranceTypeRate :: getUpdateTime, LocalDateTime.now());
return R.ok(update(updateWrapper),"删除费率信息成功");
}
/**
......@@ -81,7 +89,9 @@ public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRat
* @return {@link R}
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R saveInsuranceTypeRate(TInsuranceTypeRate insuranceTypeRate) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(insuranceTypeRate)){
return R.failed("新增的费率信息为空");
}
......@@ -103,6 +113,10 @@ public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRat
.eq(TInsuranceTypeRate :: getRate,insuranceTypeRate.getRate()).eq(TInsuranceTypeRate:: getMonth ,insuranceTypeRate.getMonth());
List<TInsuranceTypeRate> list = this.list(queryWrapper);
if (list.isEmpty()){
insuranceTypeRate.setDeleteFlag(CommonConstants.ZERO_INT);
insuranceTypeRate.setCreateBy(user.getId());
insuranceTypeRate.setCreateName(user.getNickname());
insuranceTypeRate.setCreateTime(LocalDateTime.now());
return R.ok(this.baseMapper.insert(insuranceTypeRate));
}else{
return R.failed("当前险种已存在相同的费率");
......
......@@ -2,12 +2,15 @@ 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;
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.entity.TInsuranceCompany;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceType;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
......@@ -19,10 +22,12 @@ 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;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -58,10 +63,11 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
*/
@Override
public R saveInsuranceType(TInsuranceType insuranceType) {
YifuUser user = SecurityUtils.getUser();
String companyId = insuranceType.getInsuranceCompanyId();
String bankNo = insuranceType.getBankNo();
if(Common.isNumber(bankNo)){
if(!Common.isNumber(bankNo)){
return R.failed("银行账号格式不正确");
}
LambdaQueryWrapper<TInsuranceCompany> companyWrapper = new LambdaQueryWrapper<>();
companyWrapper.eq(TInsuranceCompany::getId,companyId).eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
......@@ -75,6 +81,10 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
if (!Common.isEmpty(type)){
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));
}
}
......@@ -104,4 +114,66 @@ public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper,
return R.ok(insuranceTypeVo);
}
/**
* 修改险种信息
*
* @author zhaji
* @param insuranceType 险种信息
* @return {@link R}
*/
@Override
public R updateInsuranceType(TInsuranceType insuranceType) {
if (Common.isEmpty(insuranceType.getId())){
return R.failed("险种ID不能为空");
}
TInsuranceType byId = getById(insuranceType.getId());
if(Common.isEmpty(byId) || byId.getDeleteFlag() == CommonConstants.ONE_INT){
return R.failed("当前险种信息不存在或已被删除");
}
if(byId.getName().equals(insuranceType.getName())){
return R.ok(this.updateById(insuranceType));
}else{
LambdaQueryWrapper<TInsuranceType> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceType::getName,insuranceType.getName())
.eq(TInsuranceType::getInsuranceCompanyId,insuranceType.getInsuranceCompanyId())
.eq(TInsuranceType::getDeleteFlag,CommonConstants.ZERO_INT);
TInsuranceType one = this.getOne(queryWrapper);
if (Common.isEmpty(one)){
return R.ok(this.updateById(insuranceType));
}else{
return R.failed("当前险种名称已存在");
}
}
}
/**
* 查询险种列表
*
* @author zhaji
* @param insuranceType 险种信息
* @return {@link List< TInsuranceType>}
*/
@Override
public R getInsuranceTypeList(TInsuranceType insuranceType) {
String companyId = insuranceType.getInsuranceCompanyId();
LambdaQueryWrapper<TInsuranceType> query = new LambdaQueryWrapper<>();
query.eq(TInsuranceType::getDeleteFlag,CommonConstants.ZERO_INT);
if(StringUtils.isBlank(companyId)){
List<TInsuranceType> list = this.list(query);
return R.ok(list,"查询险种列表成功");
}else{
LambdaQueryWrapper<TInsuranceCompany> companyWrapper = new LambdaQueryWrapper<>();
companyWrapper.eq(TInsuranceCompany::getId,companyId).eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceCompany insuranceCompany = insuranceCompanyService.getOne(companyWrapper);
if(Common.isEmpty(insuranceCompany)){
return R.failed("所属保险公司不存在或已被删除");
}else{
query.eq(TInsuranceType::getInsuranceCompanyId,companyId);
List<TInsuranceType> list = this.list(query);
return R.ok(list,"查询险种列表成功");
}
}
}
}
......@@ -6,6 +6,8 @@ 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.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceType;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
......@@ -15,8 +17,10 @@ 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 org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -61,7 +65,9 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
* @return {@link R}
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R deleteInsuranceTypeStandard(String id) {
YifuUser user = SecurityUtils.getUser();
if(Common.isEmpty(id)){
return R.failed("购买标准id不能为空");
}
......@@ -78,9 +84,11 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
return R.failed("当前险种的购买标准已存在对应的商险信息,不能删除");
}
LambdaUpdateWrapper<TInsuranceTypeStandard> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceTypeStandard::getId,id);
updateWrapper.set(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT);
return R.ok(update(updateWrapper));
updateWrapper.eq(TInsuranceTypeStandard::getId,id)
.set(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ONE_INT)
.set(TInsuranceTypeStandard :: getUpdateBy,user.getId())
.set(TInsuranceTypeStandard :: getUpdateTime,LocalDateTime.now());
return R.ok(update(updateWrapper),"删除购买标准成功");
}
/**
* 新增购买标准
......@@ -90,7 +98,9 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
* @return {@link R}
*/
@Override
@Transactional(rollbackFor = Exception.class)
public R saveInsuranceTypeStandard(TInsuranceTypeStandard insuranceTypeStandard) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(insuranceTypeStandard)){
return R.failed("新增的购买标准信息为空");
}
......@@ -117,7 +127,11 @@ public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTyp
.eq(TInsuranceTypeStandard::getDeleteFlag,CommonConstants.ZERO_INT);
List<TInsuranceTypeStandard> list = list(queryWrapper);
if(list.isEmpty()){
return R.ok(this.baseMapper.insert(insuranceTypeStandard));
insuranceTypeStandard.setDeleteFlag(CommonConstants.ZERO_INT);
insuranceTypeStandard.setCreateBy(user.getId());
insuranceTypeStandard.setCreateName(user.getNickname());
insuranceTypeStandard.setCreateTime(LocalDateTime.now());
return R.ok(this.baseMapper.insert(insuranceTypeStandard),"新增购买标准成功");
}else{
return R.failed("当前险种下的购买标准已存在");
}
......
......@@ -395,13 +395,16 @@
detail.POLICY_START as policyStart,
detail.POLICY_END as policyEnd,
detail.POLICY_NO as policyNo,
detail.REFUND_CREATE_TIME as refundCreateTime
refund.CREATE_TIME as refundCreateTime
from
t_insurance_detail detail
t_insurance_detail detail,
t_insurance_refund refund
where
detail.DELETE_FLAG = 0
and
detail.REDUCE_HANDLE_STATUS = 4
and
detail.ID = refund.INS_DETAIL_ID
<if test="param.empName != null and param.empName.trim() != ''">
and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
</if>
......@@ -423,7 +426,7 @@
<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
</if>
ORDER BY detail.REFUND_CREATE_TIME DESC
ORDER BY detail.CREATE_TIME DESC
</select>
<select id="getInsuranceRefundList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceRefundListVo">
select
......@@ -445,13 +448,16 @@
detail.BUY_STANDARD as buyStandard,
detail.MEDICAL_QUOTA as medicalQuota,
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
detail.REFUND_CREATE_TIME as refundCreateTime
refund.CREATE_TIME as refundCreateTime
from
t_insurance_detail detail
t_insurance_detail detail,
t_insurance_refund refund
where
detail.DELETE_FLAG = 0
and
detail.REDUCE_HANDLE_STATUS = 4
and
detail.ID = refund.INS_DETAIL_ID
<if test="param.empName != null and param.empName.trim() != ''">
and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
</if>
......@@ -473,36 +479,37 @@
<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
</if>
ORDER BY detail.REFUND_CREATE_TIME DESC
ORDER BY detail.CREATE_TIME DESC
</select>
<select id="getInsuranceRefundHandlingPageList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceRefundHandlingListVo">
select
detail.id as id,
detail.ORDER_NO as orderNo,
detail.EMP_NAME as empName,
detail.EMP_IDCARD_NO as empIdcardNo,
detail.BUY_TYPE as buyType,
detail.DEPT_NO as deptNo,
detail.POST as post,
detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
detail.INSURANCE_CITY_NAME as insuranceCityName,
detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
detail.POLICY_START as policyStart,
detail.POLICY_END as policyEnd,
detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.BUY_STANDARD as buyStandard,
detail.MEDICAL_QUOTA as medicalQuota,
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
detail.CREATE_NAME as createName,
detail.REDUCE_HANDLE_STATUS as reduceHandleStatus
detail.ID as id,
detail.ORDER_NO as orderNo,
detail.EMP_NAME as empName,
detail.EMP_IDCARD_NO as empIdcardNo,
detail.BUY_TYPE as buyType,
detail.DEPT_NO as deptNo,
detail.POST as post,
detail.INSURANCE_PROVINCE_NAME as insuranceProvinceName,
detail.INSURANCE_CITY_NAME as insuranceCityName,
detail.INSURANCE_HANDLE_PROVINCE_NAME as insuranceHandleProvinceName,
detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
detail.POLICY_START as policyStart,
detail.POLICY_END as policyEnd,
detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.BUY_STANDARD as buyStandard,
detail.MEDICAL_QUOTA as medicalQuota,
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
refund.CREATE_NAME as refundCreateName,
detail.REDUCE_HANDLE_STATUS as reduceHandleStatus
from
t_insurance_detail detail
t_insurance_detail detail,
t_insurance_refund refund
where
detail.DELETE_FLAG = 0
and
(detail.REDUCE_HANDLE_STATUS is not null and detail.REDUCE_HANDLE_STATUS != 3)
detail.ID = refund.INS_DETAIL_ID
<if test="param.empName != null and param.empName.trim() != ''">
and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
</if>
......@@ -513,15 +520,18 @@
and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.reduceHandleStatus != null and param.reduceHandleStatus.trim() != ''">
and detail.REDUCE_HANDLE_STATUS like concat('%',replace(replace(#{param.reduceHandleStatus},'_','\_'),'%','\%'),'%')
and detail.REDUCE_HANDLE_STATUS = #{param.reduceHandleStatus}
</if>
<if test="param.reduceHandleStatus = null and param.reduceHandleStatus.trim() = ''">
and detail.REDUCE_HANDLE_STATUS in (1,2,4)
</if>
<if test="param.isOverdue != null and param.isOverdue.trim() != ''">
and detail.IS_OVERDUE like concat('%',replace(replace(#{param.isOverdue},'_','\_'),'%','\%'),'%')
and detail.IS_OVERDUE = #{param.isOverdue}
</if>
<if test="param.isUse != null and param.isUse.trim() != ''">
and detail.IS_USE like concat('%',replace(replace(#{param.isUse},'_','\_'),'%','\%'),'%')
and detail.IS_USE = #{param.isUse}
</if>
ORDER BY detail.REFUND_CREATE_TIME DESC
ORDER BY detail.CREATE_TIME DESC
</select>
<select id="getInsuranceRefundHandlingList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceRefundHandlingListVo">
select
......@@ -545,14 +555,17 @@
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
detail.SETTLE_TYPE as settleType,
detail.SETTLE_MONTH as settleMonth,
detail.CREATE_NAME as createName,
refund.CREATE_NAME as refundCreateName,
detail.REMARK as remark
from
t_insurance_detail detail
t_insurance_detail detail,
t_insurance_refund refund
where
detail.DELETE_FLAG = 0
detail.DELETE_FLAG = 0
and
detail.ID = refund.INS_DETAIL_ID
and
detail.REDUCE_HANDLE_STATUS = 1
detail.REDUCE_HANDLE_STATUS = 1
<if test="param.empName != null and param.empName.trim() != ''">
and detail.EMP_NAME like concat('%',replace(replace(#{param.empName},'_','\_'),'%','\%'),'%')
</if>
......@@ -562,16 +575,13 @@
<if test="param.deptNo != null and param.deptNo.trim() != ''">
and detail.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.reduceHandleStatus != null and param.reduceHandleStatus.trim() != ''">
and detail.REDUCE_HANDLE_STATUS like concat('%',replace(replace(#{param.reduceHandleStatus},'_','\_'),'%','\%'),'%')
</if>
<if test="param.isOverdue != null and param.isOverdue.trim() != ''">
and detail.IS_OVERDUE like concat('%',replace(replace(#{param.isOverdue},'_','\_'),'%','\%'),'%')
and detail.IS_OVERDUE = #{param.isOverdue}
</if>
<if test="param.isUse != null and param.isUse.trim() != ''">
and detail.IS_USE like concat('%',replace(replace(#{param.isUse},'_','\_'),'%','\%'),'%')
and detail.IS_USE = #{param.isUse
</if>
ORDER BY detail.REFUND_CREATE_TIME DESC
ORDER BY detail.CREATE_TIME DESC
</select>
<update id="updateInsuranceRefund">
......
......@@ -44,7 +44,6 @@
ID as id,
INSURANCE_TYPE_ID as insuranceTypeId,
BUY_STANDARD as buyStandard,
TYPE as type,
MEDICAL_QUOTA as medicalQuota,
DIE_DISABLE_QUOTA as dieDisableQuota
from
......
......@@ -13,6 +13,6 @@
</resultMap>
<sql id="Base_Column_List">
ID,INSURANCE_TYPE_ID,BUY_STANDARD,MEDICAL_QUOTA,DIE_DISABLE_QUOTA
ID,INSURANCE_TYPE_ID,BUY_STANDARD,MEDICAL_QUOTA,DIE_DISABLE_QUOTA,
</sql>
</mapper>
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