Commit e9e45892 authored by 李灿灿's avatar 李灿灿

Merge branch 'feature-licancan' into 'develop'

Feature licancan

See merge request fangxinjiang/yifu!176
parents 36c81675 fc7d6668
...@@ -36,6 +36,12 @@ public class ProjectSetInfoVo implements Serializable { ...@@ -36,6 +36,12 @@ public class ProjectSetInfoVo implements Serializable {
@Schema(description = "项目名称") @Schema(description = "项目名称")
private String departName; private String departName;
/**
* 封面抬头
*/
@Schema(description = "封面抬头")
private String invoiceTitle;
/** /**
* 所属客户 * 所属客户
*/ */
...@@ -58,7 +64,7 @@ public class ProjectSetInfoVo implements Serializable { ...@@ -58,7 +64,7 @@ public class ProjectSetInfoVo implements Serializable {
* 商险结算类型:0预估 1 实缴 * 商险结算类型:0预估 1 实缴
*/ */
@Schema(description = "商险结算类型") @Schema(description = "商险结算类型")
private String insuranceSettleType = CommonConstants.ONE_STRING; private String insuranceSettleType;
/** /**
* 业务类型一级分类 * 业务类型一级分类
......
...@@ -234,7 +234,8 @@ ...@@ -234,7 +234,8 @@
a.BUSINESS_PRIMARY_TYPE, a.BUSINESS_PRIMARY_TYPE,
a.BUSINESS_SECOND_TYPE, a.BUSINESS_SECOND_TYPE,
a.BUSINESS_THIRD_TYPE, a.BUSINESS_THIRD_TYPE,
a.STOP_FLAG a.STOP_FLAG,
a.INVOICE_TITLE
FROM t_settle_domain a FROM t_settle_domain a
LEFT JOIN t_customer_info c ON a.CUSTOMER_ID = c.ID LEFT JOIN t_customer_info c ON a.CUSTOMER_ID = c.ID
where 1=1 where 1=1
......
...@@ -378,6 +378,16 @@ public interface CommonConstants { ...@@ -378,6 +378,16 @@ public interface CommonConstants {
// 日 // 日
String DAY = "日"; String DAY = "日";
/**
* 一年365天
*/
int ONE_YEAR = 365;
/**
* 数字70
*/
int SEVENTY = 70;
/** /**
* 省市 * 省市
* @Author fxj * @Author fxj
......
...@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -30,6 +31,42 @@ public class IdCardUtil { ...@@ -30,6 +31,42 @@ public class IdCardUtil {
} }
/**
* 根据身份证号计算周岁
* 例如:当前时间是2022-08-22,那么2007-08-22算15周岁,2007-08-23才算16周岁
*
* @author licancan
* @param idNO
* @return {@link int}
*/
public static int getFullAge(String idNO){
Date birthday = getBirthdate(idNO);
// 从Calendar对象中获得一个Date对象
Calendar cal = Calendar.getInstance();
// 把出生日期放入Calendar类型的bir对象中,进行Calendar和Date类型进行转换
Calendar bir = Calendar.getInstance();
bir.setTime(birthday);
// 如果生日大于当前日期,则抛出异常:出生日期不能大于当前日期
if (cal.before(birthday)) {
throw new IllegalArgumentException("The birthday is after Now,It's unbelievable");
}
// 取出当前年月日
int yearNow = cal.get(Calendar.YEAR);
int monthNow = cal.get(Calendar.MONTH);
int dayNow = cal.get(Calendar.DAY_OF_MONTH);
// 取出出生年月日
int yearBirth = bir.get(Calendar.YEAR);
int monthBirth = bir.get(Calendar.MONTH);
int dayBirth = bir.get(Calendar.DAY_OF_MONTH);
// 大概年龄是当前年减去出生年
int age = yearNow - yearBirth;
// 如果出当前月大于出生月,或者当前月等于出生月但是当前日大于出生日,那么年龄age就加一岁
if (monthNow > monthBirth || (monthNow == monthBirth && dayNow > dayBirth)) {
age++;
}
return age;
}
/** /**
* 提取身份证中的出生日期,身份证非法则返回空 * 提取身份证中的出生日期,身份证非法则返回空
* @param idNum * @param idNum
......
...@@ -185,6 +185,14 @@ public class InsurancesConstants { ...@@ -185,6 +185,14 @@ public class InsurancesConstants {
* 员工身份证号格式错误 * 员工身份证号格式错误
*/ */
public static final String EMP_IDCARD_NO_NOT_LEGITIMATE = "员工身份证号格式错误"; public static final String EMP_IDCARD_NO_NOT_LEGITIMATE = "员工身份证号格式错误";
/**
* 员工年龄需在16岁-70岁之间
*/
public static final String EMP_AGE_NOT_LEGITIMATE = "员工年龄需在16岁-70岁之间";
/**
* 替换员工年龄需在16岁-70岁之间
*/
public static final String REPLACE_EMP_AGE_NOT_LEGITIMATE = "替换员工年龄需在16岁-70岁之间";
/** /**
* 员工未通过实名认证 * 员工未通过实名认证
*/ */
...@@ -245,6 +253,10 @@ public class InsurancesConstants { ...@@ -245,6 +253,10 @@ public class InsurancesConstants {
* 保单结束时间需要大于保单开始时间 * 保单结束时间需要大于保单开始时间
*/ */
public static final String POLICY_START_SHOULD_LESS_THAN_POLICY_END = "保单结束时间需要大于保单开始时间"; public static final String POLICY_START_SHOULD_LESS_THAN_POLICY_END = "保单结束时间需要大于保单开始时间";
/**
* 保单起止时间不能超过365天
*/
public static final String POLICY_DATE_NOT_MORE_THAN_365 = "保单起止时间不能超过365天";
/** /**
* 保单结束时间不能为空 * 保单结束时间不能为空
*/ */
......
...@@ -52,9 +52,15 @@ public class InsuranceDetailVO implements Serializable { ...@@ -52,9 +52,15 @@ public class InsuranceDetailVO implements Serializable {
/** /**
* 项目编码 * 项目编码
*/ */
@JsonIgnore @Schema(description = "项目编码")
private String deptNo; private String deptNo;
/**
* 封面抬头
*/
@Schema(description = "封面抬头")
private String invoiceTitle;
/** /**
* 投保岗位 * 投保岗位
*/ */
...@@ -167,9 +173,9 @@ public class InsuranceDetailVO implements Serializable { ...@@ -167,9 +173,9 @@ public class InsuranceDetailVO implements Serializable {
private Integer buyHandleStatus; private Integer buyHandleStatus;
/** /**
* 减员状态 1待减员 2减员中3减员退回 * 减员状态 1待减员 2减员中 3减员退回 4减员成功
*/ */
@Schema(description = "减员状态 1待减员 2减员中3减员退回") @Schema(description = "减员状态 1待减员 2减员中 3减员退回 4减员成功")
private Integer reduceHandleStatus; private Integer reduceHandleStatus;
/** /**
...@@ -256,4 +262,78 @@ public class InsuranceDetailVO implements Serializable { ...@@ -256,4 +262,78 @@ public class InsuranceDetailVO implements Serializable {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间") @Schema(description = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
/**
* 附件 todo 数据库暂时未关联附件,这个字段没值
*/
@Schema(description = "附件:预留字段,暂时都是空")
private String enclosure;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 计费方式(0:按天,1:按月)
*/
@Schema(description = "计费方式(0:按天,1:按月)")
private Integer billingType;
/**
* 购买周期
*/
@Schema(description = "购买周期")
private String buyCycle;
/**
* 费率
*/
@Schema(description = "费率")
private String rate;
/**
* 派单类型 1新增、3批增、4替换、5减员
*/
@Schema(description = "派单类型:1新增、3批增、4替换、5减员")
private Integer distributeType;
/**
* 派单状态
* 减员状态 1待减员 2减员中 3减员退回 4减员成功
* 办理状态 1待投保 2投保中 3已投保 4投保退回
*/
@Schema(description = "派单状态:派单类型是1、3、4时:1待投保 2投保中 3已投保 4投保退回,派单类型是5时:1待减员 2减员中 3减员退回 4减员成功")
private Integer distributeStatus;
/**
* 被替换人姓名
*/
@Schema(description = "被替换人姓名(替换类型专用字段)")
private String coverEmpName;
/**
* 被替换人身份证号
*/
@Schema(description = "被替换人身份证号(替换类型专用字段)")
private String coverEmpIdcardNo;
/**
* 被替换人项目名称
*/
@Schema(description = "被替换人项目名称(替换类型专用字段)")
private String coverProjectName;
/**
* 退保金额 todo 数据库暂时没有
*/
@Schema(description = "退保金额 :预留字段,暂时都是空(减员类型专用)")
private String surrender;
/**
* 退保结算状态 todo 数据库暂时没有
*/
@Schema(description = "退保结算状态 :预留字段,暂时都是空(减员类型专用)")
private String surrenderSettleStatus;
} }
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author licancan
* @description 商险操作(加审批意见)请求参数
* @date 2022-08-22 13:58:58
*/
@Data
@Schema(description = "商险操作(加审批意见)请求参数")
public class InsuranceHandleParam implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 商险明细id
*/
@Schema(description = "商险明细id")
@NotBlank(message = "商险明细id不能为空")
private String id;
/**
* 审批意见
*/
@Schema(description = "审批意见")
private String remark;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo; package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate;
import java.util.List; import java.util.List;
/** /**
...@@ -75,4 +77,30 @@ public class InsuranceListParam implements Serializable { ...@@ -75,4 +77,30 @@ public class InsuranceListParam implements Serializable {
*/ */
@Schema(description = "保单办理人") @Schema(description = "保单办理人")
private String updateBy; private String updateBy;
/**
* 购买类型, 1新增、3批增、4替换
*/
@Schema(description = " 购买类型(派单类型), 1新增、3批增、4替换")
private Integer buyType;
/**
* 创建者-姓名
*/
@Schema(description = "派单人")
private String createName;
/**
* 派单开始时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "派单开始时间")
private LocalDate startDate;
/**
* 派单结束时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "派单结束时间")
private LocalDate endDate;
} }
...@@ -2,9 +2,14 @@ package com.yifu.cloud.plus.v1.yifu.insurances.controller; ...@@ -2,9 +2,14 @@ package com.yifu.cloud.plus.v1.yifu.insurances.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept; import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService; import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*; import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
...@@ -116,8 +121,6 @@ public class TInsuranceDetailController { ...@@ -116,8 +121,6 @@ public class TInsuranceDetailController {
return R.ok(tInsuranceDetailService.getInsuranceList(param)); return R.ok(tInsuranceDetailService.getInsuranceList(param));
} }
/** /**
* 商险新增 * 商险新增
* *
...@@ -198,6 +201,19 @@ public class TInsuranceDetailController { ...@@ -198,6 +201,19 @@ public class TInsuranceDetailController {
return R.ok(tInsuranceDetailService.getInsuranceDetailById(id)); return R.ok(tInsuranceDetailService.getInsuranceDetailById(id));
} }
/**
* 通过商险id查询操作记录
*
* @author licancan
* @param id
* @return {@link R< List<TInsuranceOperate>>}
*/
@Operation(summary = "通过商险id查询操作记录", description = "通过商险id查询操作记录")
@GetMapping("/operate/{id}")
public R<List<TInsuranceOperate>> getInsuranceOperateList(@PathVariable("id") String id) {
return R.ok(tInsuranceDetailService.getInsuranceOperateList(id));
}
/** /**
* 导出办理 * 导出办理
* *
...@@ -215,26 +231,34 @@ public class TInsuranceDetailController { ...@@ -215,26 +231,34 @@ public class TInsuranceDetailController {
* 投保退回 * 投保退回
* *
* @author licancan * @author licancan
* @param idList * @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
*/ */
@Operation(summary = "投保退回", description = "投保退回") @Operation(summary = "投保退回", description = "投保退回")
@PostMapping("/rollBackInsurance") @PostMapping("/rollBackInsurance")
public R<List<InsuranceListVO>> rollBackInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<String> idList){ public R<List<InsuranceListVO>> rollBackInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceHandleParam> paramList){
return tInsuranceDetailService.rollBackInsurance(idList); YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
return tInsuranceDetailService.rollBackInsurance(user,paramList);
} }
/** /**
* 办理成功 * 办理成功
* *
* @author licancan * @author licancan
* @param idList * @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
*/ */
@Operation(summary = "办理成功", description = "办理成功") @Operation(summary = "办理成功", description = "办理成功")
@PostMapping("/successfulInsurance") @PostMapping("/successfulInsurance")
public R<List<InsuranceListVO>> successfulInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<String> idList){ public R<List<InsuranceListVO>> successfulInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceHandleParam> paramList){
return tInsuranceDetailService.successfulInsurance(idList); YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
return tInsuranceDetailService.successfulInsurance(user,paramList);
} }
/** /**
......
...@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; 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.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*; import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import java.util.List; import java.util.List;
...@@ -129,6 +131,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> { ...@@ -129,6 +131,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*/ */
InsuranceDetailVO getInsuranceDetailById(String id); InsuranceDetailVO getInsuranceDetailById(String id);
/**
* 通过商险id查询操作记录
*
* @author licancan
* @param id
* @return {@link List<TInsuranceOperate>}
*/
List<TInsuranceOperate> getInsuranceOperateList(String id);
/** /**
* 导出办理 * 导出办理
* *
...@@ -142,19 +153,21 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> { ...@@ -142,19 +153,21 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* 投保退回 * 投保退回
* *
* @author licancan * @author licancan
* @param idList * @param user
* @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
*/ */
R<List<InsuranceListVO>> rollBackInsurance(List<String> idList); R<List<InsuranceListVO>> rollBackInsurance(YifuUser user, List<InsuranceHandleParam> paramList);
/** /**
* 办理成功 * 办理成功
* *
* @author licancan * @author licancan
* @param idList * @param user
* @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
*/ */
R<List<InsuranceListVO>> successfulInsurance(List<String> idList); R<List<InsuranceListVO>> successfulInsurance(YifuUser user, List<InsuranceHandleParam> paramList);
/** /**
* 登记保单保费 * 登记保单保费
...@@ -341,5 +354,4 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> { ...@@ -341,5 +354,4 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @return {@link R} * @return {@link R}
*/ */
IPage<InsuranceListByIdCardVo> getInsuranceListByIdCard(Page<TInsuranceDetail> page, String idCard,String deptNo); IPage<InsuranceListByIdCardVo> getInsuranceListByIdCard(Page<TInsuranceDetail> page, String idCard,String deptNo);
} }
...@@ -15,6 +15,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo; ...@@ -15,6 +15,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; 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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.IdCardUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
...@@ -555,6 +556,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -555,6 +556,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (!LocalDateUtil.compareDate(param.getPolicyStart(),param.getPolicyEnd())){ if (!LocalDateUtil.compareDate(param.getPolicyStart(),param.getPolicyEnd())){
return R.failed(InsurancesConstants.POLICY_START_SHOULD_LESS_THAN_POLICY_END); return R.failed(InsurancesConstants.POLICY_START_SHOULD_LESS_THAN_POLICY_END);
} }
if (LocalDateUtil.betweenDay(param.getPolicyStart(),param.getPolicyEnd()) > CommonConstants.ONE_YEAR){
return R.failed(InsurancesConstants.POLICY_DATE_NOT_MORE_THAN_365);
}
//如果不是补单的,需要校验:保单开始日期 > 当前派单日期 //如果不是补单的,需要校验:保单开始日期 > 当前派单日期
if (byId.getSignFlag() == CommonConstants.ZERO_INT){ if (byId.getSignFlag() == CommonConstants.ZERO_INT){
...@@ -771,18 +775,66 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -771,18 +775,66 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public InsuranceDetailVO getInsuranceDetailById(String id) { public InsuranceDetailVO getInsuranceDetailById(String id) {
InsuranceDetailVO insuranceDetailVO = this.baseMapper.getInsuranceDetailById(id); InsuranceDetailVO insuranceDetailVO = this.baseMapper.getInsuranceDetailById(id);
if (null != insuranceDetailVO){ if (null != insuranceDetailVO){
long day = LocalDateUtil.betweenDay(insuranceDetailVO.getPolicyStart().toString(),insuranceDetailVO.getPolicyEnd().toString());
long month = LocalDateUtil.betweenMonth(insuranceDetailVO.getPolicyStart().toString(),insuranceDetailVO.getPolicyEnd().toString());
//购买周期
String buyCycle = month + "个月/" + day + "天";
insuranceDetailVO.setBuyCycle(buyCycle);
//派单类型
insuranceDetailVO.setDistributeType(insuranceDetailVO.getReduceHandleStatus() == null?insuranceDetailVO.getBuyType():CommonConstants.FIVE_INT);
//派单状态
insuranceDetailVO.setDistributeStatus(insuranceDetailVO.getDistributeType() == CommonConstants.FIVE_INT?insuranceDetailVO.getReduceHandleStatus():insuranceDetailVO.getBuyHandleStatus());
//替换类型
if (insuranceDetailVO.getBuyType() == CommonConstants.FOUR_INT){
TInsuranceReplace one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getToInsuranceDetailId, insuranceDetailVO.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Optional.ofNullable(one).isPresent()) {
TInsuranceDetail byId = this.getById(one.getFromInsuranceDetailId());
if (Optional.ofNullable(byId).isPresent()) {
insuranceDetailVO.setCoverEmpName(byId.getEmpName());
insuranceDetailVO.setCoverEmpIdcardNo(byId.getEmpIdcardNo());
R<SetInfoVo> infoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(byId.getDeptNo()));
if (null != infoByCodes && infoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(infoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = infoByCodes.getData().getProjectSetInfoVoMap();
ProjectSetInfoVo setInfoVo = data.get(byId.getDeptNo());
if (null != setInfoVo){
insuranceDetailVO.setCoverProjectName(Optional.ofNullable(setInfoVo.getDepartName()).orElse(""));
}
}
}
}
}
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(insuranceDetailVO.getDeptNo())); R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(insuranceDetailVO.getDeptNo()));
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(); Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
ProjectSetInfoVo jsonObject = data.get(insuranceDetailVO.getDeptNo()); ProjectSetInfoVo jsonObject = data.get(insuranceDetailVO.getDeptNo());
if (null != jsonObject){ if (null != jsonObject){
insuranceDetailVO.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse("")); insuranceDetailVO.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
insuranceDetailVO.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitle()).orElse(""));
} }
} }
} }
return insuranceDetailVO; return insuranceDetailVO;
} }
/**
* 通过商险id查询操作记录
*
* @param id
* @return {@link List<TInsuranceOperate>}
* @author licancan
*/
@Override
public List<TInsuranceOperate> getInsuranceOperateList(String id) {
List<TInsuranceOperate> list = tInsuranceOperateService.list(Wrappers.<TInsuranceOperate>query().lambda()
.eq(TInsuranceOperate::getInsuranceDetailId,id)
.orderByDesc(TInsuranceOperate::getCreateTime)
);
return list;
}
/** /**
* 导出办理 * 导出办理
* *
...@@ -866,6 +918,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -866,6 +918,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Optional.ofNullable(byId).isPresent()){ if (Optional.ofNullable(byId).isPresent()){
InsuranceExportListVO vo = new InsuranceExportListVO(); InsuranceExportListVO vo = new InsuranceExportListVO();
BeanCopyUtils.copyProperties(byId,vo); BeanCopyUtils.copyProperties(byId,vo);
if (StringUtils.isNotBlank(byId.getPolicyNo())){
listVO.setPolicyNo(byId.getPolicyNo());
}
//购买月数 //购买月数
vo.setBuyMonth(LocalDateUtil.betweenMonth(vo.getPolicyStart().toString(),vo.getPolicyEnd().toString())); vo.setBuyMonth(LocalDateUtil.betweenMonth(vo.getPolicyStart().toString(),vo.getPolicyEnd().toString()));
//购买天数 //购买天数
...@@ -901,19 +956,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -901,19 +956,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
/** /**
* 投保退回 * 投保退回
* *
* @param idList * @param user
* @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
* @author licancan * @author licancan
*/ */
@Override @Override
public R<List<InsuranceListVO>> rollBackInsurance(List<String> idList) { public R<List<InsuranceListVO>> rollBackInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
YifuUser user = SecurityUtils.getUser(); //解析参数里的商险id
if (user == null || Common.isEmpty(user.getId())) { List<String> idList = paramList.stream().map(e -> e.getId()).distinct().collect(Collectors.toList());
return R.failed(CommonConstants.PLEASE_LOG_IN); //操作日志对象
} List<InsuranceHandleParam> operateList = new ArrayList<>();
if (CollectionUtils.isEmpty(idList)){
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
}
List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList); List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList);
//返回给前端的数据 //返回给前端的数据
List<InsuranceListVO> errorList = new ArrayList<>(); List<InsuranceListVO> errorList = new ArrayList<>();
...@@ -1001,6 +1055,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1001,6 +1055,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
} }
//获取成功数据的remark
paramList.stream().forEach(e ->{
if (detail.getId().equals(e.getId())){
operateList.add(e);
}
});
} }
//更新状态 //更新状态
this.saveOrUpdateBatch(successList); this.saveOrUpdateBatch(successList);
...@@ -1008,27 +1069,27 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1008,27 +1069,27 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称 //根据项目编码获取项目名称
setProjectNameByDeptNo(errorList); setProjectNameByDeptNo(errorList);
//操作记录 //操作记录
addOperate(successList,user,InsurancesConstants.ROLLBACK,null); addOperate(operateList,user,InsurancesConstants.ROLLBACK);
return R.ok(errorList,InsurancesConstants.OPERATE_SUCCESS); return R.ok(errorList,InsurancesConstants.OPERATE_SUCCESS);
} }
/** /**
* 办理成功 * 办理成功
* *
* @param idList * @param user
* @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
* @author licancan * @author licancan
*/ */
@Override @Override
public R<List<InsuranceListVO>> successfulInsurance(List<String> idList) { public R<List<InsuranceListVO>> successfulInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10)); ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) { //解析参数里的商险id
return R.failed(CommonConstants.PLEASE_LOG_IN); List<String> idList = paramList.stream().map(e -> e.getId()).distinct().collect(Collectors.toList());
} //操作日志对象
if (CollectionUtils.isEmpty(idList)){ List<InsuranceHandleParam> operateList = new ArrayList<>();
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
}
List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList); List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList);
//返回给前端的数据 //返回给前端的数据
List<InsuranceListVO> errorList = new ArrayList<>(); List<InsuranceListVO> errorList = new ArrayList<>();
...@@ -1168,7 +1229,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1168,7 +1229,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称 //根据项目编码获取项目名称
setProjectNameByDeptNo(errorList); setProjectNameByDeptNo(errorList);
//操作记录 //操作记录
addOperate(successList,user,InsurancesConstants.SUCCESSFUL,null); if (CollectionUtils.isNotEmpty(successList)){
for (TInsuranceDetail detail : successList) {
//获取成功数据的remark
paramList.stream().forEach(e ->{
if (detail.getId().equals(e.getId())){
operateList.add(e);
}
});
}
}
addOperate(operateList,user,InsurancesConstants.SUCCESSFUL);
return R.ok(errorList, InsurancesConstants.OPERATE_SUCCESS); return R.ok(errorList, InsurancesConstants.OPERATE_SUCCESS);
} }
...@@ -1389,6 +1460,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1389,6 +1460,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
//年龄是否在16-70之间
if (IdCardUtil.getFullAge(param.getEmpIdcardNo()) < CommonConstants.SIXTEEN_INT || IdCardUtil.getFullAge(param.getEmpIdcardNo()) > CommonConstants.SEVENTY){
param.setErrorMessage(InsurancesConstants.EMP_AGE_NOT_LEGITIMATE);
listResult.add(param);
continue;
}
// 保单开始日期 > 当前派单日期 // 保单开始日期 > 当前派单日期
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){ if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
...@@ -1411,6 +1488,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1411,6 +1488,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
if (LocalDateUtil.betweenDay(param.getPolicyStart(),param.getPolicyEnd()) > CommonConstants.ONE_YEAR){
param.setErrorMessage(InsurancesConstants.POLICY_DATE_NOT_MORE_THAN_365);
listResult.add(param);
continue;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉) //表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉)
for (int j = 0; j < distinctList.size(); j++) { for (int j = 0; j < distinctList.size(); j++) {
...@@ -1771,6 +1853,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1771,6 +1853,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
//年龄是否在16-70之间
if (IdCardUtil.getFullAge(param.getEmpIdcardNo()) < CommonConstants.SIXTEEN_INT || IdCardUtil.getFullAge(param.getEmpIdcardNo()) > CommonConstants.SEVENTY){
param.setErrorMessage(InsurancesConstants.EMP_AGE_NOT_LEGITIMATE);
listResult.add(param);
continue;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种 //表内数据重复 员工姓名、员工身份证号码、保险公司、险种
for (int j = 0; j < distinctList.size(); j++) { for (int j = 0; j < distinctList.size(); j++) {
InsuranceBatchParam repeat = distinctList.get(j); InsuranceBatchParam repeat = distinctList.get(j);
...@@ -2112,6 +2200,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2112,6 +2200,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
//年龄是否在16-70之间
if (IdCardUtil.getFullAge(param.getReplaceEmpIdcardNo()) < CommonConstants.SIXTEEN_INT || IdCardUtil.getFullAge(param.getReplaceEmpIdcardNo()) > CommonConstants.SEVENTY){
param.setErrorMessage(InsurancesConstants.REPLACE_EMP_AGE_NOT_LEGITIMATE);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){ if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR); param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
...@@ -2128,6 +2222,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2128,6 +2222,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
if (LocalDateUtil.betweenDay(param.getPolicyStart(),param.getPolicyEnd()) > CommonConstants.ONE_YEAR){
param.setErrorMessage(InsurancesConstants.POLICY_DATE_NOT_MORE_THAN_365);
listResult.add(param);
continue;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉) //表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉)
for (int j = 0; j < distinctList.size(); j++) { for (int j = 0; j < distinctList.size(); j++) {
InsuranceReplaceParam repeat = distinctList.get(j); InsuranceReplaceParam repeat = distinctList.get(j);
...@@ -2593,7 +2693,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2593,7 +2693,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
/** /**
* 操作记录 * 操作记录(无审批remark)
* *
* @author licancan * @author licancan
* @param detailList 商险明细集合 * @param detailList 商险明细集合
...@@ -2622,6 +2722,36 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2622,6 +2722,36 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
/**
* 操作记录(有审批remark)
*
* @author licancan
* @param paramList 操作集合
* @param user 登录用户
* @param operateDesc 操作描述
* @return void
*/
private void addOperate(List<InsuranceHandleParam> paramList,YifuUser user,String operateDesc){
if (CollectionUtils.isNotEmpty(paramList)){
try {
List<TInsuranceOperate> operateList = new ArrayList<>();
for (InsuranceHandleParam param : paramList) {
TInsuranceOperate operate = new TInsuranceOperate();
operate.setRemark(param.getRemark());
operate.setInsuranceDetailId(param.getId());
operate.setOperateDesc(operateDesc);
operate.setCreateBy(user.getId());
operate.setCreateName(user.getNickname());
operate.setCreateTime(LocalDateTime.now());
operateList.add(operate);
}
tInsuranceOperateService.saveBatch(operateList);
}catch (Exception e){
e.getStackTrace();
}
}
}
/** /**
* 将集合交叉合并,list1 是第一个顺序 list2 是第二个顺序 * 将集合交叉合并,list1 是第一个顺序 list2 是第二个顺序
* *
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
CREATE_BY,CREATE_NAME,CREATE_TIME, CREATE_BY,CREATE_NAME,CREATE_TIME,
UPDATE_BY,UPDATE_TIME,DELETE_FLAG,DEFAULT_SETTLE_ID,HANDLED_BY,HANDLED_TIME UPDATE_BY,UPDATE_TIME,DELETE_FLAG,DEFAULT_SETTLE_ID,HANDLED_BY,HANDLED_TIME
</sql> </sql>
<!--投保办理分页查询--> <!--投保分页查询-->
<select id="getInsuranceListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO"> <select id="getInsuranceListPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO">
select detail.id as id, select detail.id as id,
detail.EMP_NAME as empName, detail.EMP_NAME as empName,
...@@ -119,6 +119,15 @@ ...@@ -119,6 +119,15 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="param.buyType != null">
and detail.BUY_TYPE = #{param.buyType}
</if>
<if test="param.createName != null and param.createName.trim() != ''">
and detail.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
and detail.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, ' 00:00:00') and detail.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
</select> </select>
...@@ -171,10 +180,19 @@ ...@@ -171,10 +180,19 @@
<if test="param.updateBy != null and param.updateBy.trim() != ''"> <if test="param.updateBy != null and param.updateBy.trim() != ''">
and detail.HANDLED_BY = #{param.updateBy} and detail.HANDLED_BY = #{param.updateBy}
</if> </if>
<if test="param.buyType != null">
and detail.BUY_TYPE = #{param.buyType}
</if>
<if test="param.createName != null and param.createName.trim() != ''">
and detail.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
and detail.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, ' 00:00:00') and detail.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
</select> </select>
<!--投保办理不分页查询--> <!--投保不分页查询-->
<select id="getInsuranceList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO"> <select id="getInsuranceList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceListVO">
select detail.id as id, select detail.id as id,
detail.EMP_NAME as empName, detail.EMP_NAME as empName,
...@@ -224,6 +242,15 @@ ...@@ -224,6 +242,15 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="param.buyType != null">
and detail.BUY_TYPE = #{param.buyType}
</if>
<if test="param.createName != null and param.createName.trim() != ''">
and detail.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
and detail.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, ' 00:00:00') and detail.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
</select> </select>
...@@ -276,7 +303,15 @@ ...@@ -276,7 +303,15 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="param.buyType != null">
and detail.BUY_TYPE = #{param.buyType}
</if>
<if test="param.createName != null and param.createName.trim() != ''">
and detail.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
</if>
<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
and detail.CREATE_TIME <![CDATA[ >= ]]> concat(#{param.startDate}, ' 00:00:00') and detail.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
</if>
ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
</select> </select>
<select id="getInsuranceDetailById" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceDetailVO"> <select id="getInsuranceDetailById" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceDetailVO">
...@@ -318,7 +353,10 @@ ...@@ -318,7 +353,10 @@
detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName, detail.INSURANCE_HANDLE_CITY_NAME as insuranceHandleCityName,
detail.INSURANCE_HANDLE_CITY as insuranceHandleCity, detail.INSURANCE_HANDLE_CITY as insuranceHandleCity,
detail.CREATE_NAME as createName, detail.CREATE_NAME as createName,
detail.CREATE_TIME as createTime detail.CREATE_TIME as createTime,
detail.REMARK as remark,
detail.BILLING_TYPE as billingType,
detail.RATE as rate
from t_insurance_detail detail from t_insurance_detail detail
left join t_insurance_settle tis on detail.DEFAULT_SETTLE_ID = tis.ID left join t_insurance_settle tis on detail.DEFAULT_SETTLE_ID = tis.ID
where detail.ID = #{id} where detail.ID = #{id}
......
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