Commit be11dd5e authored by hongguangwu's avatar hongguangwu

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

parents 0fcaa995 980b9047
......@@ -176,6 +176,14 @@ public interface CommonConstants {
**/
String[] dingleDigitStrArray = {"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"};
/**
* 月份(阿里编码规约不允许直接使用‘魔法值’)
* @Author pwang
* @Date 2019-08-02 16:39
**/
String[] MonthStrArray = {"0","1","2","3","4","5","6","7","8","9","10","11","12"};
/**
* 逗号
* @Author fxj
......
package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaji
* @description 减员校验类
* @date 2022-07-19 09:09:41
*/
@Data
@Tag(name = "减员校验类")
public class InsuranceRefundCheck implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号码
*/
@Schema(description = "员工身份证号码")
private String empIdCardNo;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 保单开始日期
*/
@Schema(description = "保单开始日期")
private String policyStart;
/**
* 保单结束日期
*/
@Schema(description = "保单结束日期")
private String policyEnd;
/**
* 退款金额
*/
@Schema(description = "退款金额")
private String refundMoney;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 错误信息
*/
@Schema(description = "错误信息")
private String errorMessage;
}
......@@ -2,11 +2,15 @@ package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.checkerframework.common.value.qual.StringVal;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 保险公司表
......@@ -22,26 +26,37 @@ public class TInsuranceCompany extends BaseEntity {
/**
* 保险公司id
*/
private Long id;
private String id;
/**
* 保险公司名称
*/
@NotBlank(message = "保险公司名称不能为空")
private String companyName;
/**
* 保险公司地址
*/
@NotBlank(message = "保险公司地址不能为空")
private String companyAddress;
/**
* 对接人
*/
@NotBlank(message = "对接人不能为空")
private String companyDocking;
/**
* 计费方式
*/
@NotBlank(message = "计费方式不能为空")
@StringVal({"0","1"})
private String billingType;
/**
* 删除标志(0:未删除,1:删除)
*/
@Schema(description = "是否删除 0否/1是")
private Integer deleteFlag;
}
\ No newline at end of file
......@@ -2,10 +2,12 @@ package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
......@@ -24,33 +26,39 @@ public class TInsuranceType extends BaseEntity {
private Long id;
/**
* 保险名称
* 险种名称
*/
@NotBlank(message = "险种名称不能为空")
private String name;
/**
* 保险公司主键ID
*/
private Long insuranceCompanyId;
@NotBlank(message = "所属保险公司不能为空")
private String insuranceCompanyId;
/**
* 收款单位名称
*/
@NotBlank(message = "收款单位名称不能为空")
private String receiptUnitName;
/**
* 收款银行名称
*/
@NotBlank(message = "收款银行名称不能为空")
private String bankName;
/**
* 收款银行账号
*/
@NotBlank(message = "收款银行账号不能为空")
private String bankNo;
/**
* 删除标志(0:未删除,1:删除)
*/
@Schema(description = "是否删除 0否/1是")
private Integer deleteFlag;
}
\ No newline at end of file
......@@ -2,10 +2,12 @@ package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
/**
......@@ -25,16 +27,27 @@ public class TInsuranceTypeRate extends BaseEntity {
/**
* 险种ID
*/
@NotBlank(message = "所属险种不能为空")
private String insuranceTypeId;
/**
* 月数
*/
private Integer month;
@NotBlank(message = "月不能为空")
private String month;
/**
* 费率
*/
private BigDecimal rate;
@NotBlank(message = "费率不能为空")
private String rate;
/**
* 删除标志(0:未删除,1:删除)
*/
@Schema(description = "是否删除 0否/1是")
private Integer deleteFlag;
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.EqualsAndHashCode;
......@@ -14,7 +15,7 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_insurance_type_standard")
@Tag(name = "保险公司表")
@Tag(name = "购买标准表")
public class TInsuranceTypeStandard extends BaseEntity {
/**
*
......@@ -31,11 +32,6 @@ public class TInsuranceTypeStandard extends BaseEntity {
*/
private String buyStandard;
/**
*
*/
private Integer type;
/**
* 医疗额度
*/
......@@ -45,4 +41,10 @@ public class TInsuranceTypeStandard extends BaseEntity {
* 身故或残疾额度
*/
private String dieDisableQuota;
/**
* 删除标志(0:未删除,1:删除)
*/
@Schema(description = "是否删除 0否/1是")
private Integer deleteFlag;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.insurances.util;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.util.HashSet;
import java.util.Set;
/**
* @auther wangan
* @date 2019/12/3
* bean复制,忽视空串
*/
public class BeanCopyUtils {
public static String[] getNullPropertyNames(Object source) {
final BeanWrapper src = new BeanWrapperImpl(source);
java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors();
Set<String> emptyNames = new HashSet<>();
for (java.beans.PropertyDescriptor pd : pds) {
Object srcValue = src.getPropertyValue(pd.getName());
if (srcValue == null) {
emptyNames.add(pd.getName());
}
}
String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result);
}
public static void copyProperties(Object src, Object target) {
BeanUtils.copyProperties(src, target, getNullPropertyNames(src));
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.util;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -299,6 +300,15 @@ public class ValidityUtil {
}
return true;
}
public static boolean isMonth(String month){
for(String s : CommonConstants.MonthStrArray){
if (s.equals(month)){
return true;
}
}
return false;
}
public static boolean isInt(String numStr) {
if(numStr==null){
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
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 lombok.Data;
import java.util.List;
/**
* @author zhaji
* @description 险种信息返回类
* @date 2022-07-19 10:26:33
*/
@Data
public class InsuranceTypeVo extends TInsuranceType {
/**
* 费率信息
*/
private List<TInsuranceTypeRate> insuranceTypeRateList;
/**
* 购买标准
*/
private List<TInsuranceTypeStandard> insuranceTypeStandardList;
}
......@@ -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);
}
}
......@@ -2,7 +2,12 @@ package com.yifu.cloud.plus.v1.yifu.insurances.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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 org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Administrator
......@@ -13,5 +18,20 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TInsuranceTypeMapper extends BaseMapper<TInsuranceType> {
/**
* 根据险种id查询费率
*
* @author zhaji
* @param id 险种id
* @return {@link List< TInsuranceTypeRate>}
*/
List<TInsuranceTypeRate> selectInsuranceTypeRateList(@Param("id") String id);
/**
* 根据险种id查询购买标准
*
* @author zhaji
* @param id 险种id
* @return {@link List< TInsuranceTypeStandard>}
*/
List<TInsuranceTypeStandard> selectInsuranceTypeStandardList(String id);
}
......@@ -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));
}
}
......@@ -25,4 +25,34 @@
DELETE_FLAG,CREATE_BY,CREATE_NAME,
CREATE_TIME,UPDATE_BY,UPDATE_TIME
</sql>
<select id="selectInsuranceTypeRateList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate">
select
ID as id,
INSURANCE_TYPE_ID as insuranceTypeId,
MONTH as month,
RATE as rate
from
t_insurance_type_rate
where
INSURANCE_TYPE_ID = #{id}
and
DELETE_FLAG = 0
</select>
<select id="selectInsuranceTypeStandardList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeStandard">
select
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
t_insurance_type_standard
where
INSURANCE_TYPE_ID = #{id}
and
DELETE_FLAG = 0
</select>
</mapper>
......@@ -8,13 +8,11 @@
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="insuranceTypeId" column="INSURANCE_TYPE_ID" jdbcType="VARCHAR"/>
<result property="buyStandard" column="BUY_STANDARD" jdbcType="VARCHAR"/>
<result property="type" column="TYPE" jdbcType="TINYINT"/>
<result property="medicalQuota" column="MEDICAL_QUOTA" jdbcType="VARCHAR"/>
<result property="dieDisableQuota" column="DIE_DISABLE_QUOTA" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID,INSURANCE_TYPE_ID,BUY_STANDARD,
TYPE,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