Commit 980b9047 authored by 查济's avatar 查济

Merge branch 'feature-zhaji' into 'develop'

"feature-zhaJi:新增保险公司,险种,购买标准,费率的增删改查"

See merge request fangxinjiang/yifu!8
parents f719fc50 c840938e
......@@ -2,6 +2,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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceCompany;
......@@ -15,6 +16,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhaji
......@@ -37,9 +39,9 @@ public class TInsuranceCompanyController {
* @param insuranceCompany 保险公司
* @return
*/
@Operation(summary = "分页查询", description = "分页查询")
//@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" )
public R<IPage<TInsuranceCompany>> getTCertRecordPage(Page page, TInsuranceCompany insuranceCompany) {
public R<IPage<TInsuranceCompany>> getInsuranceCompanyPage(Page page, TInsuranceCompany insuranceCompany) {
return R.ok(insuranceCompanyService.pageDiy(page, insuranceCompany));
}
......@@ -48,9 +50,7 @@ public class TInsuranceCompanyController {
* @param id id
* @return R
*/
@Operation(summary = "通过id查询保险公司详情", description = "通过id查询:hasPermission('demo_insuranceCompany_get')")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_insuranceCompany_get')" )
public R<TInsuranceCompany> getById(@PathVariable("id" ) String id) {
return R.ok(insuranceCompanyService.getById(id));
}
......@@ -61,13 +61,38 @@ public class TInsuranceCompanyController {
* @param insuranceCompany 保险公司明细
* @return R
*/
@Operation(summary = "新增保险公司", description = "新增证明开具记录表:hasPermission('demo_insuranceCompany_add')")
//@Operation(summary = "新增保险公司", description = "新增保险公司:hasPermission('demo_insuranceCompany_add')")
@SysLog("新增保险公司" )
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_insuranceCompany_add')" )
public R<Boolean> save(@RequestBody TInsuranceCompany insuranceCompany) {
return R.ok(insuranceCompanyService.save(insuranceCompany));
@PostMapping("/save")
//@PreAuthorize("@pms.hasPermission('demo_insuranceCompany_add')" )
public R save(@RequestBody TInsuranceCompany insuranceCompany) {
return insuranceCompanyService.saveInsuranceCompany(insuranceCompany);
}
/**
* 修改保险公司
* @param insuranceCompany 修改实体类
* @return R
*/
//@Operation(summary = "修改保险公司", description = "修改保险公司:hasPermission('demo_insuranceCompany_update')")
@SysLog("修改保险公司" )
@PostMapping("/update")
//@PreAuthorize("@pms.hasPermission('demo_insuranceCompany_update')" )
public R update(@RequestBody TInsuranceCompany insuranceCompany) {
return insuranceCompanyService.updateInsuranceCompany(insuranceCompany);
}
/**
* 查询保险公司列表(不分页)
* @return
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/list" )
public R<List<TInsuranceCompany>> getInsuranceCompanyList() {
return R.ok(insuranceCompanyService.getInsuranceCompanyList());
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.controller;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.InsuranceRefundCheck;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
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.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author licancan
......@@ -23,4 +28,18 @@ import javax.annotation.Resource;
public class TInsuranceDetailController {
@Resource
private TInsuranceDetailService tInsuranceDetailService;
/**
* 导入减员校验
* @param insuranceRefundCheckList 导入减员校验
* @author zhaji
* @date 2022-07-19
* @since v1.0
*/
@PostMapping("/checkPayRollList")
public R checkInsuranceRefundList(@RequestBody List<InsuranceRefundCheck> insuranceRefundCheckList){
return tInsuranceDetailService.checkInsuranceRefundList(insuranceRefundCheckList);
}
}
......@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
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.service.TInsuranceTypeService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceTypeVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -43,6 +44,19 @@ public class TInsuranceTypeController {
return R.ok(insuranceTypeService.pageDiy(page, insuranceType));
}
/**
* 新增险种
* @param insuranceType 险种明细
* @return R
*/
@Operation(summary = "新增险种", description = "新增险种:hasPermission('demo_insuranceType_add')")
@SysLog("新增险种")
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_insuranceType_add')" )
public R save(@RequestBody TInsuranceType insuranceType) {
return insuranceTypeService.saveInsuranceType(insuranceType);
}
/**
* 通过id查询险种详情
* @param id id
......@@ -51,21 +65,8 @@ public class TInsuranceTypeController {
@Operation(summary = "通过id查询险种详情", description = "通过id查询:hasPermission('demo_insuranceType_get')")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_insuranceType_get')" )
public R<TInsuranceType> getById(@PathVariable("id" ) String id) {
return R.ok(insuranceTypeService.getById(id));
public R getInsuranceTypeDetail(@PathVariable("id" ) String id) {
return insuranceTypeService.getInsuranceTypeDetail(id);
}
/**
* 新增险种
* @param insuranceType 险种明细
* @return R
*/
@Operation(summary = "新增保险公司", description = "新增险种:hasPermission('demo_insuranceType_add')")
@SysLog("新增险种")
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_insuranceType_add')" )
public R<Boolean> save(@RequestBody TInsuranceType insuranceType) {
return R.ok(insuranceTypeService.save(insuranceType));
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.controller;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceCompany;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceTypeRateService;
import io.swagger.v3.oas.annotations.Operation;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhaji
......@@ -24,4 +30,40 @@ public class TInsuranceTypeRateController {
@Resource
private TInsuranceTypeRateService insuranceTypeRateService;
/**
* 查询费率列表(不分页)
* @return
*/
@Operation(summary = "费率列表", description = "费率列表")
@GetMapping("/list" )
public R getInsuranceTypeRateList(String id) {
return insuranceTypeRateService.getInsuranceTypeRateList(id);
}
/**
* 删除购买费率信息
* @param id 费率id
* @return R
*/
@Operation(summary = "删除购买费率信息", description = "删除购买费率信息:hasPermission('demo_insuranceTypeRate_delete')")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_insuranceTypeRate_delete')" )
public R deleteById(@PathVariable("id" ) String id) {
return insuranceTypeRateService.deleteInsuranceTypeRate(id);
}
/**
* 新增费率
* @param insuranceTypeRate 费率明细
* @return R
*/
@Operation(summary = "新增费率", description = "新增费率:hasPermission('demo_insuranceTypeRate_add')")
@SysLog("新增费率" )
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_insuranceTypeRate_add')" )
public R save(@RequestBody TInsuranceTypeRate insuranceTypeRate) {
return insuranceTypeRateService.saveInsuranceTypeRate(insuranceTypeRate);
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.controller;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
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.service.TInsuranceTypeStandardService;
import io.swagger.v3.oas.annotations.Operation;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -24,4 +29,39 @@ public class TInsuranceTypeStandardController {
@Resource
private TInsuranceTypeStandardService insuranceTypeStandardService;
/**
* 查询购买标准列表(不分页)
* @return
*/
@Operation(summary = "费率列表", description = "费率列表")
@GetMapping("/list" )
public R getInsuranceTypeRateList(String id) {
return insuranceTypeStandardService.getInsuranceTypeStandard(id);
}
/**
* 删除购买标准信息
* @param id 购买标准id
* @return R
*/
@Operation(summary = "删除购买标准信息", description = "删除购买标准信息:hasPermission('demo_insuranceTypeStandard_delete')")
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_insuranceTypeStandard_delete')" )
public R deleteById(@PathVariable("id" ) String id) {
return insuranceTypeStandardService.deleteInsuranceTypeStandard(id);
}
/**
* 新增购买标准
* @param insuranceTypeStandard 购买标准
* @return R
*/
@Operation(summary = "新增购买标准", description = "新增购买标准:hasPermission('demo_insuranceTypeStandard_add')")
@SysLog("新增购买标准" )
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_insuranceTypeStandard_add')" )
public R save(@RequestBody TInsuranceTypeStandard insuranceTypeStandard) {
return insuranceTypeStandardService.saveInsuranceTypeStandard(insuranceTypeStandard);
}
}
......@@ -3,14 +3,59 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceCompany;
import java.util.List;
/**
* @author Administrator
* @description 针对表【t_insurance_company(保险公司表)】的数据库操作Service
* @createDate 2022-07-18 17:19:09
*/
public interface TInsuranceCompanyService extends IService<TInsuranceCompany> {
/**
* 分页查询保险公司
*
* @author zhaji
* @param page 分页参数
* @param insuranceCompany 查询类
* @return {@link IPage< TInsuranceCompany>}
*/
IPage<TInsuranceCompany> pageDiy(Page page, TInsuranceCompany insuranceCompany);
/**
* 新增保险公司
*
* @author zhaji
* @param insuranceCompany 新增类
* @return {@link R}
*/
R saveInsuranceCompany(TInsuranceCompany insuranceCompany);
/**
* 修改保险公司
*
* @author zhaji
* @param insuranceCompany 修改类
* @return {@link R}
*/
R updateInsuranceCompany(TInsuranceCompany insuranceCompany);
/**
* 删除保险公司信息
*
* @author zhaji
* @param id 保险公司id
* @return {@link R}
*/
R deleteById(String id);
/**
* 查询当前保险公司列表
*
* @author zhaji
* @return {@link List< TInsuranceCompany>}
*/
List<TInsuranceCompany> getInsuranceCompanyList();
}
......@@ -2,13 +2,25 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.InsuranceRefundCheck;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import java.util.List;
/**
* @author licancan
* @description 针对表【t_insurance_detail(商险明细表)】的数据库操作Service
* @date 2022-07-18 16:20:16
*/
public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
/**
* 减员导入校验
*
* @author zhaji
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList);
}
package com.yifu.cloud.plus.v1.yifu.insurances.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
import java.util.List;
/**
* @author Administrator
* @description 针对表【t_insurance_type_rate(费率表)】的数据库操作Service
......@@ -10,4 +13,30 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
*/
public interface TInsuranceTypeRateService extends IService<TInsuranceTypeRate> {
/**
* 根据险种id查询费率列表
*
* @author zhaji
* @param id
* @return {@link List< TInsuranceTypeRate>}
*/
R getInsuranceTypeRateList(String id);
/**
* 删除费率
*
* @author zhaji
* @param id 费率id
* @return {@link R}
*/
R deleteInsuranceTypeRate(String id);
/**
* 新增费率
*
* @author zhaji
* @param insuranceTypeRate
* @return {@link R}
*/
R saveInsuranceTypeRate(TInsuranceTypeRate insuranceTypeRate);
}
......@@ -4,8 +4,10 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceCompany;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceType;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceTypeVo;
/**
* @author Administrator
......@@ -13,6 +15,32 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceType;
* @createDate 2022-07-18 17:19:23
*/
public interface TInsuranceTypeService extends IService<TInsuranceType> {
/**
* 险种分页查询
*
* @author zhaji
* @param page 分页参数
* @param insuranceType 分页查询参数
* @return {@link IPage< TInsuranceType>}
*/
IPage<TInsuranceType> pageDiy(Page page, TInsuranceType insuranceType);
/**
* 新增险种信息
*
* @author zhaji
* @param insuranceType 新增参数
* @return {@link R}
*/
R saveInsuranceType(TInsuranceType insuranceType);
/**
* 查看险种详情
*
* @author zhaji
* @param id 险种id
* @return {@link InsuranceTypeVo}
*/
R getInsuranceTypeDetail(String id);
}
package com.yifu.cloud.plus.v1.yifu.insurances.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeStandard;
/**
......@@ -9,5 +10,30 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeStandard;
* @createDate 2022-07-18 17:19:41
*/
public interface TInsuranceTypeStandardService extends IService<TInsuranceTypeStandard> {
/**
* 查询购买标准列表
*
* @author zhaji
* @param id
* @return {@link R}
*/
R getInsuranceTypeStandard(String id);
/**
* 删除购买标准
*
* @author zhaji
* @param id
* @return {@link R}
*/
R deleteInsuranceTypeStandard(String id);
/**
* 新增购买标准
*
* @author zhaji
* @param insuranceTypeStandard
* @return {@link R}
*/
R saveInsuranceTypeStandard(TInsuranceTypeStandard insuranceTypeStandard);
}
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.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.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.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author Administrator
* @description 针对表【t_insurance_company(保险公司表)】的数据库操作Service实现
......@@ -17,10 +29,133 @@ import org.springframework.stereotype.Service;
@Service
public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyMapper, TInsuranceCompany> implements TInsuranceCompanyService {
@Resource
private TInsuranceDetailService insuranceDetailService;
@Override
public IPage<TInsuranceCompany> pageDiy(Page page, TInsuranceCompany insuranceCompany) {
LambdaQueryWrapper<TInsuranceCompany> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByDesc(TInsuranceCompany::getCreateTime);
return this.baseMapper.selectPage(page,wrapper);
}
@Override
public R saveInsuranceCompany(TInsuranceCompany insuranceCompany) {
if(Common.isEmpty(insuranceCompany)){
return R.failed("新增的信息为空");
}
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.setCreateTime(LocalDateTime.now());
return R.ok(this.save(insuranceCompany));
}else{
return R.failed("当前保险公司已存在");
}
}
/**
* 修改保险公司
*
* @author zhaji
* @param insuranceCompany 修改类
* @return {@link R}
*/
@Override
public R updateInsuranceCompany(TInsuranceCompany insuranceCompany) {
String id = insuranceCompany.getId();
if (Common.isEmpty(id)){
return R.failed("要修改的保险公司id为空");
}
String billingType = insuranceCompany.getBillingType();
if (!CommonConstants.ZERO_STRING.equals(billingType) && !CommonConstants.ONE_STRING.equals(billingType)){
return R.failed("计费方式格式不正确");
}
LambdaQueryWrapper<TInsuranceCompany> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceCompany::getId,id).eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceCompany one = this.getOne(queryWrapper);
if (Common.isEmpty(one)){
return R.failed("要修改的保险公司不存在或已被删除");
}
String companyName = one.getCompanyName();
//如果当前保险公司名称和修改后的名称不同
if (!companyName.equals(insuranceCompany.getCompanyName())){
//校验旧的保险公司名称是否已存在对应的商险信息
LambdaQueryWrapper<TInsuranceDetail> detailQueryWrapper = new LambdaQueryWrapper<>();
detailQueryWrapper.eq(TInsuranceDetail::getInsuranceCompanyName,companyName)
.eq(TInsuranceDetail::getDeleteFlag,CommonConstants.ZERO_INT);
List<TInsuranceDetail> list = insuranceDetailService.list(detailQueryWrapper);
if (Common.isNotEmpty(list)){
return R.failed("当前保险公司的名称已存在对应的商险信息,不能进行修改");
}else{
//校验新的保险公司名称在数据库中是否存在
boolean b = companyIsExists(insuranceCompany.getCompanyName());
if(b){
return R.failed("当前保险公司名称已存在");
}else {
return R.ok(updateById(insuranceCompany));
}
}
}else{
return R.ok(updateById(insuranceCompany));
}
}
/**
* 删除保险公司信息
*
* @author zhaji
* @param id 保险公司id
* @return {@link R}
*/
@Override
public R deleteById(String id) {
LambdaQueryWrapper<TInsuranceCompany> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceCompany::getId,id).eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceCompany one = this.getOne(queryWrapper);
if(Common.isEmpty(one)){
return R.failed("当前保险公司不存在");
}else {
LambdaUpdateWrapper<TInsuranceCompany> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceCompany::getId,id);
updateWrapper.set(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
return R.ok(update(updateWrapper));
}
}
/**
* 查询当前保险公司列表
*
* @author zhaji
* @return {@link List< TInsuranceCompany>}
*/
@Override
public List<TInsuranceCompany> getInsuranceCompanyList() {
LambdaQueryWrapper<TInsuranceCompany> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
return list(queryWrapper);
}
/**
* 校验保险公司是否存在
*
* @author zhaji
* @param companyName 保险公司名称
* @return {@link boolean}
*/
public boolean companyIsExists(String companyName){
LambdaQueryWrapper<TInsuranceCompany> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceCompany::getCompanyName,companyName).eq(TInsuranceCompany::getDeleteFlag, CommonConstants.ZERO_INT);
TInsuranceCompany one = this.getOne(queryWrapper);
if(Common.isEmpty(one)){
return false;
}else{
return true;
}
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
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.mapper.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author licancan
* @description 针对表【t_insurance_detail(商险明细表)】的数据库操作Service实现
......@@ -14,4 +20,40 @@ import org.springframework.stereotype.Service;
@Service
public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMapper, TInsuranceDetail> implements TInsuranceDetailService {
@Override
public R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList) {
if(!Common.isNotEmpty(insuranceRefundCheckList)){
return R.failed("当前导入的减员信息为空");
}
List<InsuranceRefundCheck> refundErrorList = new ArrayList(128);
for (InsuranceRefundCheck insuranceRefund : insuranceRefundCheckList) {
boolean b = true;
String empName = insuranceRefund.getEmpName();
String empIdCardNo = insuranceRefund.getEmpIdCardNo();
//保险公司名称
String insuranceCompanyName = insuranceRefund.getInsuranceCompanyName();
//险种名称
String insuranceTypeName = insuranceRefund.getInsuranceTypeName();
String refundMoney = insuranceRefund.getRefundMoney();
String policyStart = insuranceRefund.getPolicyStart();
String policyEnd = insuranceRefund.getPolicyEnd();
String remark = insuranceRefund.getRemark();
if (!b){
refundErrorList.add(insuranceRefund);
}
}
if (Common.isNotEmpty(refundErrorList)){
return null;
}
return null;
}
}
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.extension.conditions.update.UpdateChainWrapper;
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.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.mapper.TInsuranceTypeRateMapper;
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 javax.annotation.Resource;
import java.util.List;
/**
* @author Administrator
* @description 针对表【t_insurance_type_rate(费率表)】的数据库操作Service实现
......@@ -14,4 +27,78 @@ import org.springframework.stereotype.Service;
@Service
public class TInsuranceTypeRateServiceImpl extends ServiceImpl<TInsuranceTypeRateMapper, TInsuranceTypeRate> implements TInsuranceTypeRateService {
@Resource
private TInsuranceTypeService insuranceTypeService;
/**
* 根据险种id查询费率列表
*
* @author zhaji
* @param id
* @return {@link List< TInsuranceTypeRate>}
*/
@Override
public R getInsuranceTypeRateList(String id) {
if (Common.isEmpty(id)){
return R.failed("险种id为空");
}
TInsuranceType byId = insuranceTypeService.getById(id);
if ( Common.isEmpty(byId) || CommonConstants.ONE_INT == byId.getDeleteFlag()){
return R.failed("当前险种信息不存在或已被删除");
}
LambdaQueryWrapper<TInsuranceTypeRate> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT).eq(TInsuranceTypeRate::getInsuranceTypeId,id);
return R.ok(list(queryWrapper));
}
/**
* 删除费率
*
* @author zhaji
* @param id 费率id
* @return {@link R}
*/
@Override
public R deleteInsuranceTypeRate(String id) {
if(Common.isEmpty(id)){
return R.failed("费率id不能为空");
}
TInsuranceTypeRate byId = getById(id);
if (Common.isEmpty(byId) || CommonConstants.ONE_INT == byId.getDeleteFlag()){
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));
}
/**
* 新增费率
*
* @author zhaji
* @param insuranceTypeRate 费率信息
* @return {@link R}
*/
@Override
public R saveInsuranceTypeRate(TInsuranceTypeRate insuranceTypeRate) {
if (Common.isEmpty(insuranceTypeRate)){
return R.failed("新增的费率信息为空");
}
String insuranceTypeId = insuranceTypeRate.getInsuranceTypeId();
TInsuranceType byId = insuranceTypeService.getById(insuranceTypeId);
if ( Common.isEmpty(byId) || CommonConstants.ONE_INT == byId.getDeleteFlag()){
return R.failed("当前险种信息不存在或已被删除");
}
String month = insuranceTypeRate.getMonth();
if (!ValidityUtil.isMonth(month)){
return R.failed("当前月份格式不正确");
}
String rate = insuranceTypeRate.getRate();
if (!Common.isNumber(rate)){
return R.failed("当前费率格式不正确");
}
return R.ok(this.baseMapper.insert(insuranceTypeRate));
}
}
......@@ -5,11 +5,26 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.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.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.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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author Administrator
* @description 针对表【t_insurance_type(险种表)】的数据库操作Service实现
......@@ -18,10 +33,77 @@ import org.springframework.stereotype.Service;
@Service
public class TInsuranceTypeServiceImpl extends ServiceImpl<TInsuranceTypeMapper, TInsuranceType> implements TInsuranceTypeService {
@Resource
private TInsuranceCompanyService insuranceCompanyService;
/**
* 险种分页查询
*
* @author zhaji
* @param page 分页参数
* @param insuranceType 分页查询参数
* @return {@link IPage< TInsuranceType>}
*/
@Override
public IPage<TInsuranceType> pageDiy(Page page, TInsuranceType insuranceType) {
LambdaQueryWrapper<TInsuranceType> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByDesc(TInsuranceType::getCreateTime);
return this.baseMapper.selectPage(page,wrapper);
}
/**
* 新增险种信息
*
* @author zhaji
* @param insuranceType 新增参数
* @return {@link R}
*/
@Override
public R saveInsuranceType(TInsuranceType insuranceType) {
String companyId = insuranceType.getInsuranceCompanyId();
String bankNo = insuranceType.getBankNo();
if(Common.isNumber(bankNo)){
}
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("所属保险公司不存在或已被删除");
}
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("当前险种已存在");
}else{
return R.ok(save(insuranceType));
}
}
/**
* 查看险种详情
*
* @author zhaji
* @param id 险种id
* @return {@link InsuranceTypeVo}
*/
@Override
public R getInsuranceTypeDetail(String id) {
if (Common.isEmpty(id)){
return R.failed("险种ID不能为空");
}
InsuranceTypeVo insuranceTypeVo = new InsuranceTypeVo();
TInsuranceType byId = getById(id);
if(Common.isEmpty(byId) || byId.getDeleteFlag() == CommonConstants.ONE_INT){
return R.failed("当前险种信息不存在或已被删除");
}
BeanCopyUtils.copyProperties(byId,insuranceTypeVo);
List<TInsuranceTypeRate> tInsuranceTypeRates = this.baseMapper.selectInsuranceTypeRateList(id);
List<TInsuranceTypeStandard> tInsuranceTypeStandards = this.baseMapper.selectInsuranceTypeStandardList(id);
insuranceTypeVo.setInsuranceTypeRateList(tInsuranceTypeRates);
insuranceTypeVo.setInsuranceTypeStandardList(tInsuranceTypeStandards);
return R.ok(insuranceTypeVo);
}
}
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.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.insurances.entity.TInsuranceDetail;
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.mapper.TInsuranceTypeStandardMapper;
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 javax.annotation.Resource;
import java.util.List;
/**
* @author Administrator
* @description 针对表【t_insurance_type_standard(购买标准表)】的数据库操作Service实现
......@@ -13,5 +26,91 @@ import org.springframework.stereotype.Service;
*/
@Service
public class TInsuranceTypeStandardServiceImpl extends ServiceImpl<TInsuranceTypeStandardMapper, TInsuranceTypeStandard> implements TInsuranceTypeStandardService {
@Resource
private TInsuranceTypeService insuranceTypeService;
@Resource
private TInsuranceDetailService insuranceDetailService;
/**
* 查询购买标准列表
*
* @author zhaji
* @param id
* @return {@link R}
*/
@Override
public R getInsuranceTypeStandard(String id) {
if (Common.isEmpty(id)){
return R.failed("险种id为空");
}
TInsuranceType byId = insuranceTypeService.getById(id);
if ( Common.isEmpty(byId) || CommonConstants.ONE_INT == byId.getDeleteFlag()){
return R.failed("当前险种信息不存在或已被删除");
}
LambdaQueryWrapper<TInsuranceTypeStandard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT).eq(TInsuranceTypeStandard::getInsuranceTypeId,id);
return R.ok(list(queryWrapper));
}
/**
* 删除购买标准
*
* @author zhaji
* @param id
* @return {@link R}
*/
@Override
public R deleteInsuranceTypeStandard(String id) {
if(Common.isEmpty(id)){
return R.failed("购买标准id不能为空");
}
TInsuranceTypeStandard byId = getById(id);
if (Common.isEmpty(byId) || CommonConstants.ONE_INT == byId.getDeleteFlag()){
return R.failed("购买标准信息不存在或已被删除");
}
LambdaQueryWrapper<TInsuranceDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceDetail::getInsuranceTypeId,byId.getInsuranceTypeId())
.eq(TInsuranceDetail::getBuyStandard,byId.getBuyStandard())
.eq(TInsuranceDetail::getDeleteFlag,CommonConstants.ZERO_INT);
List<TInsuranceDetail> list = insuranceDetailService.list(queryWrapper);
if (Common.isNotEmpty(list)){
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));
}
/**
* 新增购买标准
*
* @author zhaji
* @param insuranceTypeStandard
* @return {@link R}
*/
@Override
public R saveInsuranceTypeStandard(TInsuranceTypeStandard insuranceTypeStandard) {
if (Common.isEmpty(insuranceTypeStandard)){
return R.failed("新增的购买标准信息为空");
}
String insuranceTypeId = insuranceTypeStandard.getInsuranceTypeId();
TInsuranceType byId = insuranceTypeService.getById(insuranceTypeId);
if ( Common.isEmpty(byId) || CommonConstants.ONE_INT == byId.getDeleteFlag()){
return R.failed("当前险种信息不存在或已被删除");
}
String buyStandard = insuranceTypeStandard.getBuyStandard();
String medicalQuota = insuranceTypeStandard.getMedicalQuota();
String dieDisableQuota = insuranceTypeStandard.getDieDisableQuota();
if (!Common.isNumber(buyStandard)){
return R.failed("当前购买标准格式不正确");
}
if (!Common.isNumber(medicalQuota)){
return R.failed("当前医疗额度格式不正确");
}
if (!Common.isNumber(dieDisableQuota)){
return R.failed("当前身故或残疾额度格式不正确");
}
return R.ok(this.baseMapper.insert(insuranceTypeStandard));
}
}
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