Commit 5c2708f9 authored by 查济's avatar 查济

Merge branch 'feature-zhaji' into 'develop'

Feature zhaji

See merge request fangxinjiang/yifu!41
parents 33608364 fe4bcc57
......@@ -406,9 +406,21 @@ public interface CommonConstants {
String SIX_STRING = "6";
String SEVEN_STRING = "7";
public static final BigDecimal MONEY_MAX = new BigDecimal("999999.99");
/**
* 工资最小不能小于零
*/
public static final String MONEY_MAX = "9999999.99";
/**
* 工资最小不能小于零
*/
public static final String MONEY_MIN = "0";
public static final int TWENTY_INT = 20;
public static final String ERROR_MSG_PRFIX = "error=";
public static final String SUCCESS_MSG_PREFIX = "success=";
public static final int SIXTY_INT = 60;
}
......@@ -308,4 +308,40 @@ public class InsurancesConstants {
*/
public static final String DEPT_NO_CHANGE_SETTLE_HANDLE_STATUS_ERROR = "当前保单已结算,无法变更所属项目";
/**
* 退费金额不能为空
*/
public static final String REFUND_MONEY_NOT_EMPTY = "退费金额不能为空";
/**
* 退费金额格式不正确
*/
public static final String REFUND_MONEY_PARSE_ERROR = "退费金额格式不正确";
/**
* 退费金额不能小于零
*/
public static final String REFUND_MONEY_MIN_ERROR= "退费金额不能小于零";
/**
* 退费金额不能大于999999.99
*/
public static final String REFUND_MONEY_MAX_ERROR = "退费金额不能大于999999.99";
/**
* 姓名不能超过20个字符
*/
public static final String EMP_NAME_MAX_LENGTH_ERROR = "姓名不能超过20个字符";
/**
* 员工减员记录不存在
*/
public static final String REFUND_IS_NULL = "员工减员记录不存在";
/**
* 已更新保单减员退费,不能再次更新
*/
public static final String REFUND_MONEY_IS_NOT_NULL = "已更新保单减员退费,不能再次更新";
}
......@@ -15,7 +15,6 @@ import java.util.Date;
* @date 2022-07-25 14:20:16
*/
@Data
@TableName("t_insurance_operate")
@Schema(description = "商险操作表")
public class TInsuranceOperate implements Serializable {
/**
......
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;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 减员信息表
* @TableName t_insurance_refund
*/
@Data
@Tag(name = "减员信息表")
public class TInsuranceRefund implements Serializable {
/**
* 主键id
*/
private String id;
/**
* 保单信息主键
*/
private String insDetailId;
/**
* 减员状态
*/
private Integer reduceHandleStatus;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 退费金额
*/
private BigDecimal refundMoney;
/**
* 备注
*/
private String remark;
/**
* 减员创建时间
*/
private LocalDateTime createTime;
/**
* 减员创建人
*/
private String createBy;
/**
* 减员创建人姓名
*/
private String createName;
/**
* 是否删除 0未删除/1删除
*/
@Schema(description = "是否删除 0否/1是")
private Integer deleteFlag;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @author zhaji
* @description TODO
* @date 2022-07-26 15:28:49
*/
@Data
public class TInsuranceRefundDetail implements Serializable {
/**
* 主键id
*/
private String id;
/**
* 保单信息主键
*/
private String insDetailId;
/**
* 减员状态
*/
private Integer reduceHandleStatus;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 退费金额
*/
private BigDecimal refundMoney;
/**
* 备注
*/
private String remark;
/**
* 减员创建时间
*/
private LocalDateTime createTime;
/**
* 减员创建人
*/
private String createBy;
/**
* 减员创建人姓名
*/
private String createName;
/**
* 是否删除 0未删除/1删除
*/
@Schema(description = "是否删除 0否/1是")
private Integer deleteFlag;
private static final long serialVersionUID = 1L;
}
package com.yifu.cloud.plus.v1.yifu.insurances.util;
import com.google.common.base.Optional;
import java.math.BigDecimal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* BigDecimal 工具类
* @Author fxj
* @Date 2019-09-25
* @Description 提供精确的浮点数运算(包括加、减、乘、除、四舍五入)工具类
**/
public class BigDecimalUtils {
static Pattern p= Pattern.compile("^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$");
/**
* BigDecimal的加法运算封装
* @author : shijing
* 2017年3月23日下午4:53:21
* @param b1
* @param bn
* @return
*/
public static BigDecimal safeAdd(BigDecimal b1, BigDecimal... bn) {
if (null == b1) {
b1 = BigDecimal.ZERO;
}
if (null != bn) {
for (BigDecimal b : bn) {
b1 = b1.add(null == b ? BigDecimal.ZERO : b);
}
}
return b1;
}
/**
* Integer加法运算的封装
* @author : shijing
* 2017年3月23日下午4:54:08
* @param b1 第一个数
* @param bn 需要加的加法数组
* @注 : Optional 是属于com.google.common.base.Optional<T> 下面的class
* @return
*/
public static Integer safeAdd(Integer b1, Integer... bn) {
if (null == b1) {
b1 = 0;
}
Integer r = b1;
if (null != bn) {
for (Integer b : bn) {
r += Optional.fromNullable(b).or(0);
}
}
return r > 0 ? r : 0;
}
/**
* 计算金额方法
* @author : shijing
* 2017年3月23日下午4:53:00
* @param b1
* @param bn
* @return
*/
public static BigDecimal safeSubtract(BigDecimal b1, BigDecimal... bn) {
return safeSubtract(true, b1, bn);
}
/**
* BigDecimal的安全减法运算
* @author : shijing
* 2017年3月23日下午4:50:45
* @param isZero 减法结果为负数时是否返回0,true是返回0(金额计算时使用),false是返回负数结果
* @param b1 被减数
* @param bn 需要减的减数数组
* @return
*/
public static BigDecimal safeSubtract(Boolean isZero, BigDecimal b1, BigDecimal... bn) {
if (null == b1) {
b1 = BigDecimal.ZERO;
}
BigDecimal r = b1;
if (null != bn) {
for (BigDecimal b : bn) {
r = r.subtract((null == b ? BigDecimal.ZERO : b));
}
}
return isZero ? (r.compareTo(BigDecimal.ZERO) == -1 ? BigDecimal.ZERO : r) : r;
}
/**
* 整型的减法运算,小于0时返回0
* @author : shijing
* 2017年3月23日下午4:58:16
* @param b1
* @param bn
* @return
*/
public static Integer safeSubtract(Integer b1, Integer... bn) {
if (null == b1) {
b1 = 0;
}
Integer r = b1;
if (null != bn) {
for (Integer b : bn) {
r -= Optional.fromNullable(b).or(0);
}
}
return null != r && r > 0 ? r : 0;
}
/**
* 金额除法计算,返回2位小数(具体的返回多少位大家自己看着改吧)
* @author : shijing
* 2017年3月23日下午5:02:17
* @param b1
* @param b2
* @return
*/
public static <T extends Number> BigDecimal safeDivide(T b1, T b2){
return safeDivide(b1, b2, BigDecimal.ZERO);
}
/**
* @description:
* @param b1
* @param b2
* @return: java.math.BigDecimal
* @author: wangweiguo
* @date: 2021/8/5
*/
public static <T extends Number> BigDecimal safeDivide(T b1, T b2, int scale){
return safeDivide(b1, b2, BigDecimal.ZERO, scale);
}
/**
* BigDecimal的除法运算封装,如果除数或者被除数为0,返回默认值
* 默认返回小数位后2位,用于金额计算
* @author : shijing
* 2017年3月23日下午4:59:29
* @param b1
* @param b2
* @param defaultValue
* @return
*/
public static <T extends Number> BigDecimal safeDivide(T b1, T b2, BigDecimal defaultValue) {
if (null == b1 || null == b2) {
return defaultValue;
}
try {
return BigDecimal.valueOf(b1.doubleValue()).divide(BigDecimal.valueOf(b2.doubleValue()), 2, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
return defaultValue;
}
}
/**
* @description:
* @param b1
* @param b2
* @param defaultValue
* @param scale
* @return: java.math.BigDecimal
* @author: wangweiguo
* @date: 2021/8/5
*/
public static <T extends Number> BigDecimal safeDivide(T b1, T b2, BigDecimal defaultValue, int scale) {
if (null == b1 || null == b2) {
return defaultValue;
}
try {
return BigDecimal.valueOf(b1.doubleValue()).divide(BigDecimal.valueOf(b2.doubleValue()), scale, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
return defaultValue;
}
}
/**
* BigDecimal的乘法运算封装
* @author : shijing
* 2017年3月23日下午5:01:57
* @param b1
* @param b2
* @return
*/
public static <T extends Number> BigDecimal safeMultiply(T b1, T b2) {
if (null == b1 || null == b2) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).multiply(BigDecimal.valueOf(b2.doubleValue())).setScale(2, BigDecimal.ROUND_HALF_UP);
}
public static <T extends Number> BigDecimal safeMultiply(T b1, T b2, T b3) {
if (null == b1 || null == b2 || null == b3) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).multiply(BigDecimal.valueOf(b2.doubleValue())).multiply(BigDecimal.valueOf(b3.doubleValue())).setScale(2, BigDecimal.ROUND_HALF_UP);
}
/**
* BigDecimal的乘法运算封装
* @author : shijing
* 2017年3月23日下午5:01:57
* @param b1
* @param b2
* @return
*/
public static <T extends Number> BigDecimal safeMultiply(T b1, T b2,int scale) {
if (null == b1 || null == b2) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).multiply(BigDecimal.valueOf(b2.doubleValue())).setScale(scale, BigDecimal.ROUND_HALF_UP);
}
public static <T extends Number> BigDecimal safeMultiply(T b1, T b2, T b3,int scale) {
if (null == b1 || null == b2 || null == b3) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).multiply(BigDecimal.valueOf(b2.doubleValue())).multiply(BigDecimal.valueOf(b3.doubleValue())).setScale(scale, BigDecimal.ROUND_HALF_UP);
}
public static <T extends Number> BigDecimal safeMultiply(T b1, T b2, T b3,T b4,int scale) {
if (null == b1 || null == b2 || null == b3) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).multiply(BigDecimal.valueOf(b2.doubleValue())).multiply(BigDecimal.valueOf(b3.doubleValue())).multiply(BigDecimal.valueOf(b4.doubleValue())).setScale(scale, BigDecimal.ROUND_HALF_UP);
}
/**
* null 默认 为 0
* @Author fxj
* @Date 2019-09-25
* @param bigDecimal
* @return
**/
public static BigDecimal isNullToZero(BigDecimal bigDecimal){
if (null == bigDecimal){
return BigDecimal.ZERO;
}
return bigDecimal;
}
/**
* 对象转为BigDecimal 数据 并四舍五入保留两位小数
* @Author fxj
* @Date 2019-10-14
* @param b1
* @return
**/
public static BigDecimal objectToBigDecimal(Double b1) {
if (null == b1) {
return BigDecimal.ZERO;
}
return BigDecimal.valueOf(b1.doubleValue()).setScale(2, BigDecimal.ROUND_HALF_UP);
}
/**
* 判断字符串是否是BigDecimal
* @param str
* @return
*/
public static boolean isBigDecimal(String str){
if(str==null || str.trim().length() == 0){
return false;
}
char[] chars = str.toCharArray();
int sz = chars.length;
int i = (chars[0] == '-') ? 1 : 0;
if(i == sz){
return false;
}
if(chars[i] == '.'){
//除了负号,第一位不能为'小数点'
return false;
}
boolean radixPoint = false;
for(; i < sz; i++){
if(chars[i] == '.'){
if(radixPoint){
return false;
}
radixPoint = true;
}else if(!(chars[i] >= '0' && chars[i] <= '9')){
return false;
}
}
return true;
}
/**
* 舍去BigDecimal小数点后三位
* @param v
* @param point
* @return
*/
public static BigDecimal formatByRoundDown(BigDecimal v, int point){
return v.setScale(point, BigDecimal.ROUND_DOWN);
}
/**
* 格式化精度
*
* @param v
* @param point
* 小数位数
* @return double
*/
public static BigDecimal formatByRoundHalfUp(BigDecimal v, int point) {
return v.setScale(point, BigDecimal.ROUND_HALF_UP);
}
/**
* 格式化精度
*
* @param str
* @param point
* 小数位数
* @return double
*/
public static BigDecimal getNumberOfDecimalPlace(String str, int point) {
Matcher m=p.matcher(str);
boolean b=m.matches();
if(b){
//获取小数点的位置
int bitPos=str.indexOf(".");
//字符串总长度减去小数点位置,再减去1,就是小数位数
int numOfBits=str.length()-bitPos-1;
if(numOfBits>point){
BigDecimal big = new BigDecimal(str);
return big.setScale(point, BigDecimal.ROUND_HALF_UP);
}
}
return new BigDecimal(str);
}
}
......@@ -17,6 +17,12 @@ public class InsuranceRefundCheck implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* 员工姓名
*/
......@@ -26,7 +32,14 @@ public class InsuranceRefundCheck implements Serializable {
* 员工身份证号码
*/
@Schema(description = "员工身份证号码")
private String empIdCardNo;
private String empIdcardNo;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 保险公司名称
*/
......@@ -48,12 +61,6 @@ public class InsuranceRefundCheck implements Serializable {
@Schema(description = "保单结束日期")
private String policyEnd;
/**
* 退款金额
*/
@Schema(description = "退款金额")
private String refundMoney;
/**
* 备注
*/
......
......@@ -60,6 +60,12 @@ public class InsuranceRefundListVo implements Serializable {
@Schema(description = "投保岗位")
private String post;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 商险购买地省code
*/
......
......@@ -89,6 +89,6 @@ public class InsuranceRefundResultVo implements Serializable {
/**
* 错误原因
*/
@Schema(description = "减员状态 1待减员 2减员中3减员退回")
@Schema(description = "错误原因")
private String errorMessage;
}
......@@ -42,6 +42,12 @@ public class InsuredListVo implements Serializable {
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 减员状态 1待减员 2减员中3减员退回
*/
@Schema(description = "减员状态 1待减员 2减员中3减员退回")
private Integer reduceHandleStatus;
/**
* 投保类型, 1新增、3批增、4替换
*/
......
......@@ -102,9 +102,7 @@ public class InsuredParam implements Serializable {
/**
* 派单日期
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "派单日期")
@ExcelProperty("派单日期")
private LocalDateTime createTime;
private String createTime;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaji
* @description 减员退费导入表
* @date 2022-07-25 17:06:31
*/
@Data
@Tag(name = "减员退费导入表")
public class RefundMoneyParam implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 保单号
*/
@Schema(description = "保单号")
private String policyNo;
/**
* 退费金额
*/
@Schema(description = "退费金额")
private String refundMoney;
/**
* 错误原因
*/
@Schema(description = "错误原因")
private String errorMessage;
}
......@@ -201,9 +201,9 @@ public class TInsuranceDetailController {
* @date 2022-07-19
* @since v1.0
*/
@PostMapping("/checkInsuranceRefundList")
public R checkInsuranceRefundList(@RequestBody List<InsuranceRefundCheck> insuranceRefundCheckList){
return tInsuranceDetailService.checkInsuranceRefundList(insuranceRefundCheckList);
@PostMapping("/saveInsuranceRefund")
public R saveInsuranceRefund(@RequestBody @Valid @Size(min = 1,message = "导入减员列表不能为空") List<InsuranceRefundCheck> insuranceRefundCheckList){
return tInsuranceDetailService.saveInsuranceRefund(insuranceRefundCheckList);
}
/**
......@@ -215,7 +215,7 @@ public class TInsuranceDetailController {
*/
@PostMapping("/settleMonthChange")
@Operation(summary = "变更结算月", description = "变更结算月")
public R settleMonthChange(@RequestBody List<SettleMonthChangeCheckParam> settleMonthCheckList){
public R settleMonthChange(@RequestBody @Valid @Size(min = 1,message = "变更结算月不能为空") List<SettleMonthChangeCheckParam> settleMonthCheckList){
return tInsuranceDetailService.settleMonthChange(settleMonthCheckList);
}
......@@ -228,7 +228,7 @@ public class TInsuranceDetailController {
*/
@PostMapping("/deptChange")
@Operation(summary = "变更所属项目", description = "变更所属项目")
public R deptChange(@RequestBody List<DeptChangeCheckParam> deptChangeCheckList){
public R deptChange(@RequestBody @Valid @Size(min = 1,message = "变更所属项目不能为空")List<DeptChangeCheckParam> deptChangeCheckList){
return tInsuranceDetailService.deptChange(deptChangeCheckList);
}
......@@ -351,7 +351,6 @@ public class TInsuranceDetailController {
return tInsuranceDetailService.selectByTypeId(id);
}
/**
* 出险
*
......@@ -365,4 +364,19 @@ public class TInsuranceDetailController {
return tInsuranceDetailService.updateIsUse(id);
}
/**
* 更新减员退费
*
* @author zhaji
* @param paramList 退费列表
* @return {@link R<List< RefundMoneyParam >>}
*/
@Operation(summary = "更新减员退费", description = "更新减员退费")
@PostMapping("/updateRefundMoney")
public R updateRefundMoney(@RequestBody @Valid @Size(min = 1,message = "更新减员退费不能为空") List<RefundMoneyParam> paramList) {
return tInsuranceDetailService.updateRefundMoney(paramList);
}
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceRefundDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -140,4 +141,13 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
* @return {@link List< TInsuranceDetail>}
*/
List<TInsuranceDetail> selectDetailListByIds(@Param("idList") String [] idList);
/**
* 查询保单减员退费信息
*
* @author zhaji
* @param refundDetail
* @return {@link TInsuranceRefundDetail}
*/
TInsuranceRefundDetail selectRefundDetail(@Param("param") TInsuranceRefundDetail refundDetail);
}
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.TInsuranceRefund;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;
/**
* @author Administrator
* @description 针对表【t_insurance_refund(减员信息表)】的数据库操作Mapper
* @createDate 2022-07-25 21:06:36
* @Entity generator.domain.TInsuranceRefund
*/
@Mapper
public interface TInsuranceRefundMapper extends BaseMapper<TInsuranceRefund> {
}
......@@ -129,13 +129,13 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
/***********************减员办理********************************/
/**
* 减员导入校验
* 减员导入
*
* @author zhaji
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList);
R saveInsuranceRefund(List<InsuranceRefundCheck> insuranceRefundCheckList);
/**
* 已投保列表分页查询
......@@ -247,4 +247,14 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @return {@link R}
*/
R updateIsUse(String id);
/**
* 更新减员退费
*
* @author zhaji
* @param paramList
* @return {@link R}
*/
R updateRefundMoney(List<RefundMoneyParam> paramList);
}
package com.yifu.cloud.plus.v1.yifu.insurances.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceRefund;
import org.springframework.stereotype.Service;
/**
* @author Administrator
* @description 针对表【t_insurance_refund(减员信息表)】的数据库操作Service
* @createDate 2022-07-25 21:06:36
*/
public interface TInsuranceRefundService extends IService<TInsuranceRefund> {
}
......@@ -53,6 +53,10 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
if (!CommonConstants.ZERO_STRING.equals(billingType) && !CommonConstants.ONE_STRING.equals(billingType)){
return R.failed("计费方式格式不正确");
}
String companyName = insuranceCompany.getCompanyName();
if (companyName.length()>CommonConstants.SIXTY_INT){
return R.failed("保险公司名称过长");
}
boolean b = companyIsExists(insuranceCompany.getCompanyName());
if (!b){
insuranceCompany.setCreateBy(user.getId());
......@@ -90,6 +94,10 @@ public class TInsuranceCompanyServiceImpl extends ServiceImpl<TInsuranceCompanyM
return R.failed("要修改的保险公司不存在或已被删除");
}
String companyName = one.getCompanyName();
String newCompanyName = insuranceCompany.getCompanyName();
if (newCompanyName.length()>CommonConstants.SIXTY_INT){
return R.failed("要修改的保险公司名称过长");
}
//如果当前保险公司名称和修改后的名称不同
if (!companyName.equals(insuranceCompany.getCompanyName())){
//校验旧的保险公司名称是否已存在对应的商险信息
......
package com.yifu.cloud.plus.v1.yifu.insurances.service.impl;
import cn.hutool.core.bean.BeanUtil;
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.core.toolkit.BeanUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -24,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.*;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.*;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
......@@ -35,6 +38,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
......@@ -69,6 +73,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private TInsuranceOperateService tInsuranceOperateService;
@Resource
private CheckDaprUtil checkDaprUtil;
@Resource
private TInsuranceRefundService tInsuranceRefundService;
/***********************商险办理********************************/
......@@ -1419,6 +1425,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
/***********************减员办理********************************/
/**
* 减员导入校验
*
......@@ -1426,14 +1434,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
@Override
public R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList) {
YifuUser user = SecurityUtils.getUser();
if(!Common.isNotEmpty(insuranceRefundCheckList)){
return R.failed("当前导入的减员信息为空");
}
List<InsuranceRefundCheck> errorList = new ArrayList(128);
List<TInsuranceDetail> successList = new ArrayList<>();
public Map<String,List<InsuranceRefundCheck>> checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList){
List<InsuranceRefundCheck> errorList = new ArrayList<>(128);
List<InsuranceRefundCheck> successList = new ArrayList<>();
Map<String,List<InsuranceRefundCheck>> map = new HashMap<>();
for (InsuranceRefundCheck param : insuranceRefundCheckList) {
//员工姓名
String empName = param.getEmpName();
......@@ -1444,7 +1448,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//员工身份证
String empIdCardNo = param.getEmpIdCardNo();
String empIdCardNo = param.getEmpIdcardNo();
if(StringUtils.isBlank(empIdCardNo)){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
errorList.add(param);
......@@ -1484,7 +1488,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
// 身份证号位数校验(18 位合法)
if (ValidityUtil.validateIDCard(param.getEmpIdCardNo())){
if (ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
errorList.add(param);
continue;
......@@ -1511,6 +1515,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
//当前保单信息的不是已投保状态不能导入
Integer buyHandleStatus = one.getBuyHandleStatus();
if (CommonConstants.THREE_INT != buyHandleStatus){
param.setErrorMessage(InsurancesConstants.REFUND_ERROR);
......@@ -1542,16 +1547,55 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
one.setReduceHandleStatus(CommonConstants.ONE_INT);
one.setUpdateTime(LocalDateTime.now());
one.setUpdateBy(user.getId());
successList.add(one);
param.setId(one.getId());
successList.add(param);
}
map.put("successList",successList);
map.put("errorList",errorList);
return map;
};
/**
* 减员导入
*
* @author zhaji
* @param insuranceRefundCheckList 减员表
* @return {@link R}
*/
@Override
public R saveInsuranceRefund(List<InsuranceRefundCheck> insuranceRefundCheckList) {
YifuUser user = SecurityUtils.getUser();
if(!Common.isNotEmpty(insuranceRefundCheckList)){
return R.failed("当前导入的减员信息为空");
}
//批量更新减员状态
Map<String, List<InsuranceRefundCheck>> refundMap = checkInsuranceRefundList(insuranceRefundCheckList);
List<InsuranceRefundCheck> successList = refundMap.get("successList");
if (CollectionUtils.isNotEmpty(successList)){
this.updateBatchById(successList);
List<TInsuranceRefund> refundList= new ArrayList<>();
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(TInsuranceDetail :: getUpdateBy,user.getId())
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now())
.set(TInsuranceDetail :: getReduceHandleStatus,CommonConstants.ONE_INT);
for (InsuranceRefundCheck refund : successList) {
TInsuranceRefund insuranceRefund = new TInsuranceRefund();
insuranceRefund.setInsDetailId(refund.getId());
insuranceRefund.setEmpName(refund.getEmpName());
insuranceRefund.setEmpIdcardNo(refund.getEmpIdcardNo());
insuranceRefund.setEmpName(refund.getEmpName());
insuranceRefund.setPolicyNo(refund.getPolicyNo());
insuranceRefund.setReduceHandleStatus(CommonConstants.ONE_INT);
insuranceRefund.setCreateBy(user.getId());
insuranceRefund.setCreateName(user.getNickname());
insuranceRefund.setCreateTime(LocalDateTime.now());
insuranceRefund.setRemark(refund.getRemark());
refundList.add(insuranceRefund);
updateWrapper.eq(TInsuranceDetail :: getId,refund.getId());
update(updateWrapper);
}
tInsuranceRefundService.saveBatch(refundList);
}
return R.ok(errorList);
List<InsuranceRefundCheck> errorList = refundMap.get("errorList");
return R.ok(errorList,"校验完成,成功:"+successList.size()+"条,失败:"+errorList.size()+"条");
}
/**
......@@ -1569,7 +1613,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称
List<String> collect = insuranceList.getRecords().stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuredListVo record : insuranceList.getRecords()) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
......@@ -1596,7 +1640,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称
List<String> collect = insuredList.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuredListVo record : insuredList) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
......@@ -1624,7 +1668,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称
List<String> collect = insuranceRefundPageList.getRecords().stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuranceRefundListVo record : insuranceRefundPageList.getRecords()) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
......@@ -1651,7 +1695,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称
List<String> collect = insuranceRefundList.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuranceRefundListVo record : insuranceRefundList) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
......@@ -1680,7 +1724,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称
List<String> collect = insuranceRefundHandlingPageList.getRecords().stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuranceRefundHandlingListVo record : insuranceRefundHandlingPageList.getRecords()) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
......@@ -1715,7 +1759,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称
List<String> collect = insuranceRefundHandlingList.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() != CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
for (InsuranceRefundHandlingListVo record : insuranceRefundHandlingList) {
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
......@@ -2073,8 +2117,128 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceDetail.setIsUse(CommonConstants.ONE_INT);
insuranceDetail.setUpdateBy(user.getId());
insuranceDetail.setUpdateTime(LocalDateTime.now());
updateById(insuranceDetail);
return null;
return R.ok(updateById(insuranceDetail),"出险成功");
}
/**
* 更新减员退费
*
* @author zhaji
* @param paramList
* @return {@link R}
*/
@Override
public R updateRefundMoney(List<RefundMoneyParam> paramList) {
YifuUser user = SecurityUtils.getUser();
List<TInsuranceRefund> insuranceRefundList = new ArrayList<>();
Map<String, List<RefundMoneyParam>> map = refundMoneyCheck(paramList);
List<RefundMoneyParam> successList = map.get("successList");
if (CollectionUtils.isNotEmpty(successList)){
for (RefundMoneyParam param : successList) {
TInsuranceRefund insuranceRefund = new TInsuranceRefund();
insuranceRefund.setInsDetailId(param.getId());
insuranceRefund.setRefundMoney(new BigDecimal(param.getRefundMoney()));
insuranceRefund.setReduceHandleStatus(CommonConstants.FOUR_INT);
insuranceRefund.setCreateBy(user.getId());
insuranceRefund.setCreateName(user.getNickname());
insuranceRefund.setCreateTime(LocalDateTime.now());
insuranceRefundList.add(insuranceRefund);
}
tInsuranceRefundService.saveBatch(insuranceRefundList);
}
return R.ok(map.get("errorList"));
}
/**
* 校验保单退费
*
* @author zhaji
* @param paramList 变更列表
* @return {@link R}
*/
public Map<String,List<RefundMoneyParam>> refundMoneyCheck(List<RefundMoneyParam> paramList){
Map<String,List<RefundMoneyParam>> map = new HashMap<>(16);
List<RefundMoneyParam> errorList = new ArrayList<>();
List<RefundMoneyParam> successList = new ArrayList<>();
for (RefundMoneyParam param : paramList) {
String refundMoney = param.getRefundMoney();
String policyNo = param.getPolicyNo();
String empName = param.getEmpName();
String empIdcardNo = param.getEmpIdcardNo();
//退费金额
if(StringUtils.isBlank(refundMoney)){
param.setErrorMessage(InsurancesConstants.REFUND_MONEY_NOT_EMPTY);
errorList.add(param);
continue;
}
//保单号
if(StringUtils.isBlank(policyNo)){
param.setErrorMessage(InsurancesConstants.POLICY_NO_EMPTY);
errorList.add(param);
continue;
}
//姓名
if(StringUtils.isBlank(empName)){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
errorList.add(param);
continue;
}
//身份证号
if(StringUtils.isBlank(empIdcardNo)){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
errorList.add(param);
continue;
}
if(empName.length()>CommonConstants.TWENTY_INT){
param.setErrorMessage(InsurancesConstants.EMP_NAME_MAX_LENGTH_ERROR);
errorList.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(empIdcardNo)){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
errorList.add(param);
continue;
}
if(BigDecimalUtils.isBigDecimal(refundMoney)){
param.setErrorMessage(InsurancesConstants.REFUND_MONEY_PARSE_ERROR);
errorList.add(param);
continue;
}
boolean max = refundMoney.compareTo(CommonConstants.MONEY_MAX) < 0;
boolean min = refundMoney.compareTo(CommonConstants.MONEY_MIN) > 0;
if (max){
param.setErrorMessage(InsurancesConstants.REFUND_MONEY_MAX_ERROR);
errorList.add(param);
continue;
}
if (min){
param.setErrorMessage(InsurancesConstants.REFUND_MONEY_MIN_ERROR);
errorList.add(param);
continue;
}
//必填格式校通过后查询对应的保单信息
TInsuranceRefundDetail refundDetail = new TInsuranceRefundDetail();
refundDetail.setEmpName(empName);
refundDetail.setEmpIdcardNo(empIdcardNo);
refundDetail.setPolicyNo(policyNo);
TInsuranceRefundDetail tInsuranceRefundDetail = this.baseMapper.selectRefundDetail(refundDetail);
if(Common.isEmpty(tInsuranceRefundDetail)){
param.setErrorMessage(InsurancesConstants.REFUND_IS_NULL);
errorList.add(param);
continue;
}
if ( null != tInsuranceRefundDetail.getRefundMoney()){
param.setErrorMessage(InsurancesConstants.REFUND_MONEY_IS_NOT_NULL);
errorList.add(param);
continue;
}
param.setId(tInsuranceRefundDetail.getInsDetailId());
successList.add(param);
}
map.put("errorList",errorList);
map.put("successList",successList);
return map;
}
/**
......@@ -2245,4 +2409,5 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
map.put("successList",successList);
return map;
}
}
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.insurances.entity.TInsuranceRefund;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceRefundMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceRefundService;
import org.springframework.stereotype.Service;
/**
* @author Administrator
* @description 针对表【t_insurance_refund(减员信息表)】的数据库操作Service实现
* @createDate 2022-07-25 21:06:36
*/
@Service
public class TInsuranceRefundServiceImpl extends ServiceImpl<TInsuranceRefundMapper, TInsuranceRefund>
implements TInsuranceRefundService {
}
......@@ -263,6 +263,7 @@
detail.POLICY_END as policyEnd,
detail.POLICY_EFFECT as policyEffect,
detail.IS_USE as isUse,
detail.INVOICE_NO as isOverdue,
detail.INSURANCE_COMPANY_NAME as insuranceCompanyName,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.BUY_STANDARD as buyStandard
......@@ -287,11 +288,18 @@
<if test="param.policyNo != null and param.policyNo.trim() != ''">
and detail.POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != ''">
AND detail.POLICY_START >= concat(#{param.policyStart}, ' 00:00:00')
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
AND detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00')
</if>
<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
AND detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd != null and param.policyEnd.trim() != ''">
and (
(detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(detail.POLICY_START <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59'))
)
</if>
<if test="param.invoiceNo != null and param.invoiceNo.trim() != ''">
and detail.INVOICE_NO like concat('%',replace(replace(#{param.invoiceNo},'_','\_'),'%','\%'),'%')
......@@ -299,7 +307,7 @@
<if test="param.isUse != null">
and detail.IS_USE = #{param.isUse}
</if>
<if test="param.isOverdue != null and param.isOverdue.trim() != ''">
<if test="param.isOverdue != null">
and detail.IS_OVERDUE = #{param.isOverdue}
</if>
<if test="param.createTime != null and param.createTime.trim() != ''">
......@@ -358,11 +366,18 @@
<if test="param.policyNo != null and param.policyNo.trim() != ''">
and detail.POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != ''">
AND detail.POLICY_START >= concat(#{param.policyStart}, ' 00:00:00')
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
AND detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00')
</if>
<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
AND detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
</if>
<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd != null and param.policyEnd.trim() != ''">
and (
(detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(detail.POLICY_START <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59'))
)
</if>
<if test="param.invoiceNo != null and param.invoiceNo.trim() != ''">
and detail.INVOICE_NO like concat('%',replace(replace(#{param.invoiceNo},'_','\_'),'%','\%'),'%')
......@@ -370,7 +385,7 @@
<if test="param.isUse != null">
and detail.IS_USE = #{param.isUse}
</if>
<if test="param.isOverdue != null and param.isOverdue.trim() != ''">
<if test="param.isOverdue != null ">
and detail.IS_OVERDUE = #{param.isOverdue}
</if>
<if test="param.createTime != null and param.createTime.trim() != ''">
......@@ -414,11 +429,18 @@
<if test="param.policyNo != null and param.policyNo.trim() != ''">
and detail.POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != ''">
AND detail.POLICY_START >= concat(#{param.policyStart}, ' 00:00:00')
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
AND detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00')
</if>
<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
AND detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd != null and param.policyEnd.trim() != ''">
and (
(detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(detail.POLICY_START <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59'))
)
</if>
ORDER BY refund.CREATE_TIME DESC
</select>
......@@ -466,11 +488,18 @@
<if test="param.policyNo != null and param.policyNo.trim() != ''">
and detail.POLICY_NO like concat('%',replace(replace(#{param.policyNo},'_','\_'),'%','\%'),'%')
</if>
<if test="param.policyStart != null and param.policyStart.trim() != ''">
AND detail.POLICY_START >= concat(#{param.policyStart}, ' 00:00:00')
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd == null and param.policyEnd.trim() == ''">
AND detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00')
</if>
<if test="param.policyEnd != null and param.policyEnd.trim() != '' and param.policyStart == null and param.policyStart.trim() == ''">
AND detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
</if>
<if test="param.policyEnd != null and param.policyEnd.trim() != ''">
AND detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')
<if test="param.policyStart != null and param.policyStart.trim() != '' and param.policyEnd != null and param.policyEnd.trim() != ''">
and (
(detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(detail.POLICY_START <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_START <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59')) OR
(detail.POLICY_END <![CDATA[ >= ]]> concat(#{param.policyStart}, ' 00:00:00') and detail.POLICY_END <![CDATA[ <= ]]> concat(#{param.policyEnd}, ' 23:59:59'))
)
</if>
ORDER BY refund.CREATE_TIME DESC
</select>
......@@ -514,10 +543,10 @@
<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() != ''">
<if test="param.isOverdue != null">
and detail.IS_OVERDUE like concat('%',replace(replace(#{param.isOverdue},'_','\_'),'%','\%'),'%')
</if>
<if test="param.isUse != null and param.isUse.trim() != ''">
<if test="param.isUse != null">
and detail.IS_USE like concat('%',replace(replace(#{param.isUse},'_','\_'),'%','\%'),'%')
</if>
ORDER BY refund.CREATE_TIME DESC
......@@ -563,15 +592,14 @@
<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() != ''">
<if test="param.isOverdue != null ">
and detail.IS_OVERDUE like concat('%',replace(replace(#{param.isOverdue},'_','\_'),'%','\%'),'%')
</if>
<if test="param.isUse != null and param.isUse.trim() != ''">
<if test="param.isUse != null">
and detail.IS_USE like concat('%',replace(replace(#{param.isUse},'_','\_'),'%','\%'),'%')
</if>
ORDER BY detail.REFUND_CREATE_TIME DESC
</select>
<select id="selectDetailListByIds"
resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail">
select
......@@ -584,7 +612,35 @@
#{item}
</foreach>
</select>
<select id="selectRefundDetail" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceRefundDetail">
select
detail.DEPT_NO as deptNo,
detail.EMP_NAME as empName,
detail.EMP_IDCARD_NO as empIdcardNo,
refund.ID as id,
refund.INS_DETAIL_ID as insDetailId,
refund.REFUND_MONEY as refundMoney
from
t_insurance_detail detail,
t_insurance_refund refund
where
detail.DELETE_FLAG = 0
and
detail.ID = refund.INS_DETAIL_ID
and
detail.BUY_HANDLE_STATUS = 5
and
detail.REDUCE_HANDLE_STATUS = 4
<if test="param.empName != null and param.empName.trim() != ''">
and detail.EMP_NAME = #{param.empName}
</if>
<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
and detail.EMP_IDCARD_NO = #{param.empIdcardNo}
</if>
<if test="param.policyNo!= null and param.policyNo.trim() != ''">
and detail.POLICY_NO = #{param.policyNo}
</if>
</select>
<update id="updateInsuranceRefund">
update
t_insurance_detail detail
......
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceOperateMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate">
<id property="id" column="ID" jdbcType="VARCHAR"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.mapper.TInsuranceRefundMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceRefund">
<id property="id" column="ID" jdbcType="BIGINT"/>
<result property="insDetailId" column="INS_DETAIL_ID" jdbcType="BIGINT"/>
<result property="reduceHandleStatus" column="REDUCE_HANDLE_STATUS" jdbcType="TINYINT"/>
<result property="empName" column="EMP_NAME" jdbcType="VARCHAR"/>
<result property="empIdcardNo" column="EMP_IDCARD_NO" jdbcType="VARCHAR"/>
<result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/>
<result property="refundMoney" column="REFUND_MONEY" jdbcType="DECIMAL"/>
<result property="remark" column="REMARK" jdbcType="VARCHAR"/>
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
<result property="createName" column="CREATE_NAME" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID,INS_DETAIL_ID,REDUCE_HANDLE_STATUS,
REFUND_MONEY,REMARK,CREATE_TIME,
CREATE_BY,CREATE_NAME,EMP_NAME,EMP_IDCARD_NO,POLICY_NO
</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