Commit 068395e4 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/MVP1.7.19' into MVP1.7.19

parents 4cc19266 7b41b49d
......@@ -1639,7 +1639,8 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
if (Common.isNotNull(oldInsurance.getProcessStatus())
&& (CommonConstants.THREE_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.FOUR_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.SIX_STRING.equals(oldInsurance.getProcessStatus()))) {
|| CommonConstants.SIX_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.SEVEN_STRING.equals(oldInsurance.getProcessStatus()))) {
oldInsurance.setModelType(CommonConstants.FOUR_STRING);
}
}
......
......@@ -658,7 +658,7 @@ public interface CommonConstants {
List<String> processInsurancesStatus = Stream.of("1","2","5").collect(Collectors.toList());
List<String> processListPreArchivesStatus = Stream.of("0","1","2","3","4","5").collect(Collectors.toList());
List<String> processListPreArchivesStatus = Stream.of("0","1","2","3","4","5","7").collect(Collectors.toList());
String[] INSURANCE_ALERT_STATUS = {"0","1","2","3","4","5"};
List<String> deptList = Stream.of("安徽一册档案管理有限公司","安徽顾合企业管理咨询有限公司","安徽赤道线数字传媒科技有限公司","劳务业务中心","易服智享&研究院").collect(Collectors.toList());
......
......@@ -121,6 +121,12 @@ public class InsurancesConstants {
* 投保记录不存在
*/
public static final String DATA_IS_NOT_EXIST = "投保记录不存在";
/**
* 投保记录为提前缴费不可删除
*/
public static final String NOT_JFCD_ERROR = "投保记录为提前缴费不可删除";
/**
* 未找到符合条件的参保记录
*/
......@@ -221,6 +227,11 @@ public class InsurancesConstants {
* 商险减员中,无法退回
*/
public static final String REDUCE_ROLLBACK_REDUCE_IS_NOT_ALLOW = "商险减员中,无法退回";
/**
* 实缴数据支出中或已支出,若要退回,请撤回支出结算后尝试!
*/
public static final String REDUCE_ROLLBACK_PAY_IS_NOT_ALLOW = "实缴数据支出中或已支出,若要退回,请撤回支出结算后尝试!";
/**
* 员工姓名不能为空
*/
......@@ -1176,6 +1187,11 @@ public class InsurancesConstants {
*/
public static final String ACTUAL_SETTLE_BILL = "实缴";
/**
* 差额
*/
public static final String BALANCE_SETTLE_BILL = "差额";
/**
* 新增结算单
*/
......
......@@ -181,4 +181,8 @@ public class EkpInsurancesInfo {
@Schema(description = "创建时间")
private Date createTime;
@Schema(description = "是否见费出单")
private String fd_jfcd;
}
......@@ -54,7 +54,7 @@ public class TEmployeeInsurancePre extends BaseEntity {
@Schema(description = "登记人")
private String registUser;
@Schema(description = "状态,0待确认,1待派单,2派单失败,3待投保,4投保中,5投保退回,6已完成")
@Schema(description = "状态,0待确认,1待派单,2派单失败,3待投保,4投保中,5投保退回,6已完成,7待缴费")
private String processStatus;
@Schema(description = "前端客服")
......
......@@ -11,6 +11,7 @@ import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
/**
......@@ -207,9 +208,9 @@ public class TInsuranceDetail extends BaseEntity {
private String insuranceHandleCityName;
/**
* 结算类型 (0、与薪资合并结算 1、单独结算)
* 结算类型 (0、与薪资合并结算 1、单独结算 2、差额结算--只做结算用)
*/
@Schema(description = "结算类型 (0、与薪资合并结算 1、单独结算)")
@Schema(description = "结算类型 (0、与薪资合并结算 1、单独结算 2、差额结算)")
private Integer settleType;
/**
......@@ -231,9 +232,9 @@ public class TInsuranceDetail extends BaseEntity {
private Integer signFlag;
/**
* 投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
* 投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员 6待缴费
*/
@Schema(description = "投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员")
@Schema(description = "投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员 6待缴费")
private Integer buyHandleStatus;
/**
......@@ -406,5 +407,38 @@ public class TInsuranceDetail extends BaseEntity {
@Schema(description = "是否地市自购")
private String isAdress;
/**
* 预估缴费状态 0待缴费、1已缴费
*/
@Schema(description = "预估缴费状态 0待缴费、1已缴费")
private String paymentStatus;
/**
* 缴费时间: EKP已收/已垫付 更新时间, 退单或撤销匹配 清空时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "缴费时间")
private String paymentTime;
/**
* 是否见费出单 0是 1 否 (新增或批增且启用‘是否启用BPO结算模式’且险种配置‘是否见费出单’为是时 此字段为是,否则为否)
*/
@Schema(description = "是否见费出单")
private String isJfcd;
/**
* 购买周期 (格式:4个月/117天)
*/
@Schema(description = "购买周期")
private String purchaseCycle;
/**
* 预计办理日期
*/
@Schema(description = "预计办理日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDate preHandleTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -39,9 +39,9 @@ public class TInsuranceSettle implements Serializable {
private String settleHandleStatus;
/**
* 结算类型 (0、与薪资合并结算 1、单独结算)
* 结算类型 (0、与薪资合并结算 1、单独结算 2、差额)
*/
@Schema(description = "结算类型 (0、与薪资合并结算 1、单独结算)")
@Schema(description = "结算类型 (0、与薪资合并结算 1、单独结算 2、差额)")
private Integer settleType;
/**
......
......@@ -8,6 +8,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.chrono.ChronoLocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
......@@ -311,7 +312,50 @@ public class LocalDateUtil {
}*/
return dif;
}
/**
* @Author fxj
* @Description
* 计算相差月份, 如果开始时间晚于结束时间会对调--纯享版,不+1
* 公式:(endYear - starYear) * 12 + endMonth - startMonth
* @Date 17:05 2026/1/20
* @Param
* @return
**/
public static long betweenMonthTwo(String startDate,String endDate){
long dif = 0;
//在日期字符串非空时执行
if (!Common.isEmpty(startDate) && !Common.isEmpty(endDate)) {
Date parseStartDate = null;
Date parseEndDate = null;
//格式化日期
SimpleDateFormat sdf = new SimpleDateFormat(NORM_DATE_PATTERN, Locale.CHINA);
try {
//将字符串转为日期格式,如果此处字符串为非合法日期就会抛出异常。
parseStartDate = sdf.parse(startDate);
parseEndDate = sdf.parse(endDate);
//如果开始时间晚于结束时间对调
if (parseStartDate.after(parseEndDate)) {
Date t = parseStartDate;
parseStartDate = parseEndDate;
parseEndDate = t;
}
Calendar starCalendar = Calendar.getInstance();
starCalendar.setTime(parseStartDate);
Calendar endCalendar = Calendar.getInstance();
endCalendar.setTime(parseEndDate);
int starYear = starCalendar.get(Calendar.YEAR);
int startMonth = starCalendar.get(Calendar.MONTH);
int endYear = endCalendar.get(Calendar.YEAR);
int endMonth = endCalendar.get(Calendar.MONTH);
dif = (endYear - starYear) * 12 + endMonth - startMonth;
} catch (ParseException e) {
e.printStackTrace();
}
}
return dif;
}
/**
* 判断两个时间段是否有交集
*
......
......@@ -43,7 +43,7 @@ public class EkpInteractiveParam implements Serializable {
/**
* 单据类型 (0、与薪资合并结算 1、单独结算)
*/
@Schema(description = "单据类型 (1、预估单 2、实缴单)")
@Schema(description = "单据类型 (1、预估单 2、实缴单 3、差额)")
private String settleType;
/**
......@@ -190,4 +190,10 @@ public class EkpInteractiveParam implements Serializable {
@Schema(description = "是否BPO", name = "bpoFlag")
@ExcelIgnore
private String bpoFlag;
/**
* 是否见费出单 0是 1 否 (新增或批增且启用‘是否启用BPO结算模式’且险种配置‘是否见费出单’为是时 此字段为是,否则为否)
*/
@Schema(description = "是否见费出单")
private String isJfcd;
}
......@@ -14,12 +14,28 @@ import java.io.Serializable;
public class EkpSettleStatusVo implements Serializable {
/**
* 结算状态
* 结算状态: 已结算 结算中 未结算 无需结算
**/
private String settleStatus;
/**
* 支出状态
* 支出状态: 已结算 结算中 未结算 无需结算
**/
private String payStatus;
/**
* 收款状态: 已收 垫付 未收
**/
private String paymentStatus;
/**
* 商险ID
**/
private String detailId;
/**
* 应收
**/
private Double paymentBalance;
}
......@@ -27,4 +27,10 @@ public class EkpStatusParamVo implements Serializable {
* 结算单类型 0 社保/管理费 1公积金/风险金
*/
private String typeFlag;
/**
* 收款结算单退单或款项撤销表示 0 表示要退单&撤销款项
*/
private String callBackFlag;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -8,6 +9,8 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
/**
......@@ -232,4 +235,43 @@ public class InsuranceAddParam implements Serializable {
private String isExit;
private List<TInsurancePreDetail> inProgressList;
/**
* 预估缴费状态 0待缴费、1已缴费
*/
@Schema(description = "预估缴费状态 0待缴费、1已缴费")
private String paymentStatus;
/**
* 缴费时间: EKP已收/已垫付 更新时间, 退单或撤销匹配 清空时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "缴费时间")
private String paymentTime;
/**
* 是否见费出单 0是 1 否 (新增或批增且启用‘是否启用BPO结算模式’且险种配置‘是否见费出单’为是时 此字段为是,否则为否)
*/
@Schema(description = "是否见费出单")
private String isJfcd;
/**
* 购买周期 (格式:4个月/117天)
*/
@Schema(description = "购买周期")
private String purchaseCycle;
/**
* 预计办理日期
*/
@Schema(description = "预计办理日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDate preHandleTime;
/**
* 预估保费
*/
@Schema(description = "预估保费")
private BigDecimal estimatePremium;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsurancePreDetail;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -9,6 +10,7 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
/**
......@@ -237,4 +239,42 @@ public class InsuranceBatchParam implements Serializable {
private String isExit;
private List<TInsurancePreDetail> inProgressList;
/**
* 预估缴费状态 0待缴费、1已缴费
*/
@Schema(description = "预估缴费状态 0待缴费、1已缴费")
private String paymentStatus;
/**
* 缴费时间: EKP已收/已垫付 更新时间, 退单或撤销匹配 清空时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "缴费时间")
private String paymentTime;
/**
* 是否见费出单 0是 1 否 (新增或批增且启用‘是否启用BPO结算模式’且险种配置‘是否见费出单’为是时 此字段为是,否则为否)
*/
@Schema(description = "是否见费出单")
private String isJfcd;
/**
* 购买周期 (格式:4个月/117天)
*/
@Schema(description = "购买周期")
private String purchaseCycle;
/**
* 预计办理日期
*/
@Schema(description = "预计办理日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDate preHandleTime;
/**
* 预估保费
*/
@Schema(description = "预估保费")
private BigDecimal estimatePremium;
}
......@@ -412,4 +412,36 @@ public class InsuranceDetailVO implements Serializable {
*/
@Schema(description = "是否地市自购")
private String isAdress;
/**
* 预估缴费状态 0待缴费、1已缴费
*/
@Schema(description = "预估缴费状态 0待缴费、1已缴费")
private String paymentStatus;
/**
* 缴费时间: EKP已收/已垫付 更新时间, 退单或撤销匹配 清空时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "缴费时间")
private String paymentTime;
/**
* 是否见费出单 0是 1 否 (新增或批增且启用‘是否启用BPO结算模式’且险种配置‘是否见费出单’为是时 此字段为是,否则为否)
*/
@Schema(description = "是否见费出单")
private String isJfcd;
/**
* 购买周期 (格式:4个月/117天)
*/
@Schema(description = "购买周期")
private String purchaseCycle;
/**
* 预计办理日期
*/
@Schema(description = "预计办理日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDate preHandleTime;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
......@@ -16,6 +18,11 @@ import java.util.List;
@Schema(description = "投保列表请求参数")
public class InsuranceListParam extends BaseEntity {
/**
* 派单ID
*/
@Schema(description = "派单ID")
private String id;
/**
* 项目编码
*/
......@@ -123,5 +130,43 @@ public class InsuranceListParam extends BaseEntity {
*/
@Schema(description = "是否地市自购")
private String isAdress;
//2026-01-20 v1.7.19 fxj 新增
/**
* 预估缴费状态 0待缴费、1已缴费
*/
@Schema(description = "预估缴费状态 0待缴费、1已缴费")
private String paymentStatus;
/**
* 缴费时间--开始
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "缴费时间--开始")
private String paymentTimeStart;
/**
* 缴费时间--结束
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "缴费时间--结束")
private String paymentTimeEnd;
/**
* 是否见费出单 0是 1 否 (新增或批增且启用‘是否启用BPO结算模式’且险种配置‘是否见费出单’为是时 此字段为是,否则为否)
*/
@Schema(description = "是否见费出单")
private String isJfcd;
/**
* 预估保费--开始
*/
@Schema(description = "预估保费--开始")
private BigDecimal estimatePremiumStart;
/**
* 预估保费--截止
*/
@Schema(description = "预估保费--截止")
private BigDecimal estimatePremiumEnd;
}
......@@ -8,8 +8,10 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @author licancan
......@@ -175,4 +177,48 @@ public class InsuranceListVO implements Serializable {
*/
@Schema(description = "是否地市自购")
private String isAdress;
/**
* 预估缴费状态 0待缴费、1已缴费
*/
@Schema(description = "预估缴费状态 0待缴费、1已缴费")
private String paymentStatus;
/**
* 缴费时间: EKP已收/已垫付 更新时间, 退单或撤销匹配 清空时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "缴费时间")
private String paymentTime;
/**
* 是否见费出单 0是 1 否 (新增或批增且启用‘是否启用BPO结算模式’且险种配置‘是否见费出单’为是时 此字段为是,否则为否)
*/
@Schema(description = "是否见费出单")
private String isJfcd;
/**
* 购买周期 (格式:4个月/117天)
*/
@Schema(description = "购买周期")
private String purchaseCycle;
/**
* 预计办理日期
*/
@Schema(description = "预计办理日期")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
private LocalDate preHandleTime;
/**
* 预估保费
*/
@Schema(description = "预估保费")
private BigDecimal estimatePremium;
/**
* 计费方式
*/
@Schema(description = "计费方式(0:按天,1:按月)")
private Integer billingType;
}
......@@ -15,6 +15,7 @@ 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.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
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.entity.TInsurancePreDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceDetailService;
......@@ -788,7 +789,12 @@ public class TInsuranceDetailController {
@SysLog("更新商险收款状态--EKP调用接口")
@PostMapping("/updateInsuranceSettleStatus")
public R updateInsuranceSettleStatus(@RequestBody EkpStatusParamVo vo) {
return tInsuranceDetailService.updateInsuranceSettleStatus(vo);
if (null != vo && "0".equals(vo.getCallBackFlag())){
//收款结算单退单或款项撤销处理逻辑
return tInsuranceDetailService.callBackInsuranceBuyHandleStatus(vo);
}else {
return tInsuranceDetailService.updateInsuranceSettleStatus(vo);
}
}
/**
......@@ -955,4 +961,72 @@ public class TInsuranceDetailController {
return tInsuranceDetailService.getInsurancesStatusByClose(paramVo);
}
/**
* @Author fxj
* @Description 查询提前缴费的预估结算状态
* @Date 10:27 2026/1/21
* @Param
* @return
**/
@Operation(summary = "查询提前缴费的预估结算状态", description = "查询提前缴费的预估结算状态")
@GetMapping("/getSettleStatusFromEkp")
public R getSettleStatusFromEkp(@RequestParam String id) {
TInsuranceDetail detail = tInsuranceDetailService.getById(id);
if (detail == null) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
return tInsuranceDetailService.getSettleStatusFromEkpInsuranceDetailAsso(detail.getId(),detail.getDefaultSettleId());
}
/**
* @Author fxj
* @Description 查询实缴的结算&支出状态
* @Date 10:27 2026/1/21
* @Param
* @return
**/
@Operation(summary = "查询实缴的结算&支出状态", description = "查询实缴的结算&支出状态")
@GetMapping("/getPaymentSettleStatusFromEkp")
public R getPaymentSettleStatusFromEkp(@RequestParam String id) {
TInsuranceDetail detail = tInsuranceDetailService.getById(id);
if (detail == null) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
EkpSettleStatusVo vo = tInsuranceDetailService.getSettleStatusFromEkpInsuranceDetail(detail.getId(),detail.getDefaultSettleId());
if (null != vo){
return R.ok(vo);
}
return R.failed();
}
/**
* @Author fxj
* @Description 撤回 --待缴费状态的投保记录 可撤回
* @Date 10:33 2026/1/21
* @Param
* @return
**/
@Operation(summary = "撤回", description = "撤回")
@PostMapping("/callBack")
public R callBack(@RequestParam String id) {
TInsuranceDetail detail = tInsuranceDetailService.getById(id);
if (detail == null) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
if (null != detail.getBuyHandleStatus() && CommonConstants.SIX_INT != detail.getBuyHandleStatus().intValue()){
return R.failed("请选择待缴费状态的投保记录!");
}
return tInsuranceDetailService.callBack(detail);
}
/**
* @Author fxj
* @Description 手动拉取缴费状态
* @Date 10:52 2026/1/21
* @Param
* @return
**/
@Operation(summary = "手动拉取缴费状态", description = "手动拉取缴费状态")
@PostMapping("/pullPaymentStatus")
public R pullPaymentStatus(@RequestParam String idStr) {
return tInsuranceDetailService.pullPaymentStatus(idStr);
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.mapper.ekp;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.EkpInsurancesInfo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -49,6 +50,24 @@ public interface EkpSettleMapper {
*/
EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetail(String id);
/**
* @Author fxj
* @Description 从商险订单明细中获取当前保单的结算状态--提前缴费专用
* @Date 10:17 2026/1/21
* @Param
* @return
**/
EkpSettleStatusVo getSettleStatusFromEkpAsso(@Param("id")String id);
/**
* @Author fxj
* @Description 从商险订单明细中获取当前保单的结算状态--提前缴费专用
* @Date 10:17 2026/1/21
* @Param
* @return
**/
List<EkpSettleStatusVo> getSettleStatusFromEkpAssoByIds(@Param("ids")List<String> ids);
List<EkpInsuranceViewVo> selectSettleStatusBySettleNo(@Param("settleNo") String settleNo, @Param("payFlag") String payFlag);
List<EkpSocialViewVo> selectSocialViewStatusBySettleNo(@Param("settleNo") String settleNo,@Param("payFlag") String payFlag);
......@@ -63,4 +82,11 @@ public interface EkpSettleMapper {
EkpInsuranceDeptInfoVo getInsuranceEkpDeptInfo(@Param("deptNo") String deptNo);
void deleteEkpInsuranceDetail(@Param("id")String id);
List<EkpSettleStatusVo> getBalanceByInsuranceId(@Param("id")String id);
void deleteEkpInsuranceDetailAsso(@Param("id")String id);
void callBackBalance(@Param("id")String id);
}
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.ekp;
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.EkpInsurancesInfo;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
......@@ -70,4 +71,15 @@ public interface EkpSettleService extends IService<TInsuranceTypeRate> {
*/
List<EkpSocialViewVo> selectSalarylViewBySettleNo(String settleNo,String payFlag);
EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetailAsso(String id);
List<EkpSettleStatusVo> getSettleStatusFromEkpAssoByIds(List<String> ids);
void deleteEkpInsuranceDetail(String id);
List<EkpSettleStatusVo> getBalanceByInsuranceId(String id);
void deleteEkpInsuranceDetailAsso(String id);
void callBackBalance(String id);
}
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.EkpInsurancesInfo;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.ekp.EkpSettleMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.EkpSettleService;
......@@ -123,4 +124,47 @@ public class EkpSettleServiceImpl implements EkpSettleService {
public Class<TInsuranceTypeRate> getEntityClass() {
return null;
}
@Override
public EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetailAsso(String id) {
return ekpSettleMapper.getSettleStatusFromEkpAsso(id);
}
@Override
public List<EkpSettleStatusVo> getSettleStatusFromEkpAssoByIds(List<String> ids) {
return ekpSettleMapper.getSettleStatusFromEkpAssoByIds(ids);
}
@Override
public void deleteEkpInsuranceDetail(String id) {
ekpSettleMapper.deleteEkpInsuranceDetail(id);
}
@Override
public List<EkpSettleStatusVo> getBalanceByInsuranceId(String id) {
return ekpSettleMapper.getBalanceByInsuranceId(id);
}
/**
* @Author fxj
* @Description 见费出单直接删除实缴及实缴与预估的差额
* @Date 17:28 2026/1/21
* @Param
* @return
**/
@Override
public void deleteEkpInsuranceDetailAsso(String id) {
ekpSettleMapper.deleteEkpInsuranceDetailAsso(id);
}
/**
* @Author fxj
* @Description 见费出单直接删除实缴与预估的差额
* @Date 15:45 2026/1/22
* @Param
* @return
**/
@Override
public void callBackBalance(String id) {
ekpSettleMapper.callBackBalance(id);
}
}
......@@ -489,6 +489,8 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
DeptSettleVo deptYgGetSettleStatusFromEkpInsuranceDetail(String detailId, String defaultSettleId);
EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetail(String detailId, String settleId);
/**
* @param changeDeptVo
* @Description: ekp费用划转,商险划转项目
......@@ -600,4 +602,11 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
BaseSearchVO getInsurancesStatusByClose(BaseSearchVO paramVo);
R getSettleStatusFromEkpInsuranceDetailAsso(String id,String settleId);
R callBack(TInsuranceDetail detail);
R pullPaymentStatus(String idStr);
R callBackInsuranceBuyHandleStatus(EkpStatusParamVo vo);
}
......@@ -53,6 +53,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryRiskVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.vo.ChangeDeptDetailVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.ChangeDeptVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TEmployeeInsuranceWorkDayVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeDetailReturnVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
......@@ -63,6 +64,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service;
......@@ -80,6 +82,7 @@ import java.math.RoundingMode;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
......@@ -379,7 +382,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
YifuUser user = SecurityUtils.getUser();
Map<String, List<InsuranceAddParam>> map = addInsuranceCheck(paramList,user,autoFlag);
Map<String,TSettleDomainSelectVo> mapSelectVo = new HashMap<>();
Map<String, List<InsuranceAddParam>> map = addInsuranceCheck(paramList,user,autoFlag,mapSelectVo);
//返回给前端的结果
List<InsuranceAddParam> listResult = map.get("listResult");
//保存到数据库中的结果
......@@ -387,7 +391,31 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<TInsuranceDetail> detailList = new ArrayList<>();
boolean isAuto = false;
List<TInsuranceOperate> operateList = new ArrayList<>();
//先获取必要的数据避免过程异常不好处理
Date preDispatchDate = DateUtil.formatDateByPatten(new Date(), DateUtil.ISO_EXPANDED_DATE_FORMAT);
TEmployeeInsuranceWorkDayVo dayVo = null;
LocalTime currentTime = LocalTime.now();
R<TEmployeeInsuranceWorkDayVo> dataR;
if (!currentTime.isBefore(LocalTime.of(15, 20)) && !currentTime.equals(LocalTime.of(15, 20))) {
//日期赋值
dayVo = new TEmployeeInsuranceWorkDayVo();
dayVo.setType(CommonConstants.TWO_STRING);
dayVo.setRegistDate(preDispatchDate);
try {
dataR = socialDaprUtils.getBeforeOrAfterWorkDay(dayVo);
if (Common.isNotNull(dataR)
&& Common.isNotNull(dataR.getData())
&& Common.isNotNull(dataR.getData().getRegistDate())) {
preDispatchDate = dataR.getData().getRegistDate();
} else {
return R.failed("获取最近工作日失败!");
}
}catch (Exception e){
return R.failed("获取最近工作日异常:"+e.getMessage());
}
}
if (CollectionUtils.isNotEmpty(listSuccess)){
List<TInsuranceSettle> settleList = new ArrayList<>();
List<String> sourceIdCardList = new ArrayList<>();
for (InsuranceAddParam success : listSuccess) {
TInsuranceDetail detail = new TInsuranceDetail();
......@@ -408,10 +436,23 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setEstimatePremium(new BigDecimal("0.00"));
detail.setCreateBy(null == user ? "1" : user.getId());
detail.setCreateName(null == user ? "自动化派单" + "-" + success.getCustomerUserName() : user.getNickname());
detail.setId(RandomStringUtils.randomNumeric(19));
//是否见费出单逻辑处理:预估保费结算、购买周期计算、保单结束日期结算、参保开始日期计算、预计办理日期计算
initJfcdInfo(preDispatchDate, detail,settleList);
//生成收入数据
createInsuranceInfo(detail,mapSelectVo.get(detail.getDeptNo()));
detailList.add(detail);
sourceIdCardList.add(detail.getEmpIdcardNo());
baseMapper.insert(detail);
updateEmployeeInsurancePre(success.getInsurancePreId(),detail,CommonConstants.THREE_STRING);
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())){
updateEmployeeInsurancePre(success.getInsurancePreId(),detail,CommonConstants.SEVEN_STRING);
//异步任务推送
List<TInsuranceDetail> successList = new ArrayList<>();
successList.add(detail);
doJointInsuranceTask.pushEstime(successList);
}else {
updateEmployeeInsurancePre(success.getInsurancePreId(),detail,CommonConstants.THREE_STRING);
}
updateEmployeeInsurancePreRenew(success.getInsurancePreRenewId(),detail,CommonConstants.THREE_STRING);
if (isAuto || Common.isNotNull(success.getCustomerUserName())) {
......@@ -426,6 +467,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
// 同步操作档案的 商险状态为:2正常(0无2正常3失效4处理中)
this.doFailInfo(detailList, sourceIdCardList, replaceIdList, CommonConstants.FOUR_STRING);
//插入结算数据
if (!settleList.isEmpty()) {
tInsuranceSettleService.saveBatch(settleList);
settleList.clear();
}
}
//操作记录
if (!isAuto) {
......@@ -463,6 +510,61 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
private void initJfcdInfo(Date preDispatchDate, TInsuranceDetail detail,List<TInsuranceSettle> settleList) {
//购买周期
String purchaseCycle = "0";
LocalDate buyStartDate;
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())){
//计算预计办理日期:若派单当日为工作日3点20之前,则预计办理日期为派单日期,若为3点20之后或派单日为非工作日,则预计办理日期为派单日后最近的一个工作日
detail.setPreHandleTime(LocalDateUtil.parseLocalDate(DateUtil.formatDate(preDispatchDate)));
//计算参保开始日期:新增\批增\替换的参保开始日期=MAX("保单开始时间"、"预计办理日期+1日");
if (detail.getPolicyStart().isAfter(detail.getPreHandleTime().plusDays(1))){
buyStartDate = detail.getPolicyStart();
}else {
buyStartDate = detail.getPreHandleTime().plusDays(1);
}
//计算购买周期:购买周期=保单结束日期-参保开始日期+1(天数);购买周期=保单结束日期-参保开始日期+1(天数)推算出月数;
//按天计费方式
if (null != detail.getBillingType() && CommonConstants.ZERO_INT == detail.getBillingType().intValue()){
purchaseCycle = String.valueOf(LocalDateUtil.betweenDay(buyStartDate.toString(), detail.getPolicyEnd().toString())+1);
//计算预计保费:根据计费方式、购买标准、购买天数/月数等计算:
//“计费方式”为“按天”的,预估保费=购买周期天数/365*购买标准+5元;
//“计费方式”为“按月”的,预估保费=购买周期月数对应的费率*购买标准+5元
//按天计费方式
detail.setEstimatePremium(new BigDecimal(detail.getBuyStandard())
.multiply(new BigDecimal(purchaseCycle))
.divide(new BigDecimal("365"), 2, RoundingMode.HALF_UP)
.add(new BigDecimal("5.00")));
//按月计费方式
}else if (null != detail.getBillingType() && CommonConstants.ONE_INT == detail.getBillingType().intValue()){
purchaseCycle = String.valueOf(LocalDateUtil.betweenMonthTwo(buyStartDate.toString(), detail.getPolicyEnd().toString())+1);
detail.setEstimatePremium(new BigDecimal(detail.getBuyStandard())
.multiply(new BigDecimal(purchaseCycle))
.multiply(null== detail.getRate()?BigDecimal.ZERO: detail.getRate())
.add(new BigDecimal("5.00")));
}
//购买周期
detail.setPurchaseCycle(purchaseCycle);
//预估缴费状态 0待缴费、1已缴费
detail.setPaymentStatus(CommonConstants.ZERO_STRING);
detail.setBuyHandleStatus(CommonConstants.SIX_INT);
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setCreateTime(LocalDateTime.now());
settle.setEstimatePushTime(LocalDateTime.now());
settle.setEstimatePremium(detail.getEstimatePremium());
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ZERO_INT);
settle.setId(RandomStringUtils.randomNumeric(19));
settleList.add(settle);
detail.setDefaultSettleId(settle.getId());
}
}
/**
* 商险批增
*
......@@ -480,8 +582,32 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if(paramList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
//先获取必要的数据避免过程异常不好处理
Date preDispatchDate = DateUtil.formatDateByPatten(new Date(), DateUtil.ISO_EXPANDED_DATE_FORMAT);
TEmployeeInsuranceWorkDayVo dayVo = null;
LocalTime currentTime = LocalTime.now();
R<TEmployeeInsuranceWorkDayVo> dataR;
if (!currentTime.isBefore(LocalTime.of(15, 20)) && !currentTime.equals(LocalTime.of(15, 20))) {
//日期赋值
dayVo = new TEmployeeInsuranceWorkDayVo();
dayVo.setType(CommonConstants.TWO_STRING);
dayVo.setRegistDate(preDispatchDate);
try {
dataR = socialDaprUtils.getBeforeOrAfterWorkDay(dayVo);
if (Common.isNotNull(dataR)
&& Common.isNotNull(dataR.getData())
&& Common.isNotNull(dataR.getData().getRegistDate())) {
preDispatchDate = dataR.getData().getRegistDate();
} else {
return R.failed("获取最近工作日失败!");
}
}catch (Exception e){
return R.failed("获取最近工作日异常:"+e.getMessage());
}
}
YifuUser user = SecurityUtils.getUser();
Map<String, List<InsuranceBatchParam>> map = batchInsuranceCheck(paramList,user,autoFlag);
Map<String,TSettleDomainSelectVo> mapSelectVo = new HashMap<>();
Map<String, List<InsuranceBatchParam>> map = batchInsuranceCheck(paramList,user,autoFlag,mapSelectVo);
//返回给前端的结果
List<InsuranceBatchParam> listResult = map.get("listResult");
//保存到数据库中的结果
......@@ -493,6 +619,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceDetail detail;
List<String> sourceIdCardList = new ArrayList<>();
List<String> replaceIdList = new ArrayList<>();
List<TInsuranceSettle> settleList = new ArrayList<>();
for (InsuranceBatchParam success : listSuccess) {
detail = new TInsuranceDetail();
BeanCopyUtils.copyProperties(success,detail);
......@@ -513,8 +640,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detailList.add(detail);
sourceIdCardList.add(detail.getEmpIdcardNo());
replaceIdList.add(detail.getId());
//是否见费出单逻辑处理:预估保费结算、购买周期计算、保单结束日期结算、参保开始日期计算、预计办理日期计算
initJfcdInfo(preDispatchDate, detail,settleList);
//生成收入数据
createInsuranceInfo(detail,mapSelectVo.get(detail.getDeptNo()));
baseMapper.insert(detail);
updateEmployeeInsurancePre(success.getInsurancePreId(),detail,CommonConstants.THREE_STRING);
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())){
updateEmployeeInsurancePre(success.getInsurancePreId(),detail,CommonConstants.SEVEN_STRING);
//异步任务推送
List<TInsuranceDetail> successList = new ArrayList<>();
successList.add(detail);
doJointInsuranceTask.pushEstime(successList);
}else {
updateEmployeeInsurancePre(success.getInsurancePreId(),detail,CommonConstants.THREE_STRING);
}
updateEmployeeInsurancePreRenew(success.getInsurancePreRenewId(),detail,CommonConstants.THREE_STRING);
if (isAuto || Common.isNotNull(success.getCustomerUserName())) {
......@@ -525,6 +664,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
// 同步操作档案的 商险状态为:2正常(0无2正常3失效4处理中)
this.doFailInfo(detailList, sourceIdCardList, replaceIdList, CommonConstants.FOUR_STRING);
//插入结算数据
if (!settleList.isEmpty()) {
tInsuranceSettleService.saveBatch(settleList);
settleList.clear();
}
}
//操作记录
if (!isAuto) {
......@@ -745,6 +889,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (null == byId){
return R.failed(InsurancesConstants.DATA_IS_NOT_EXIST);
}
if (CommonConstants.ZERO_STRING.equals(byId.getIsJfcd())){
return R.failed(InsurancesConstants.NOT_JFCD_ERROR);
}
//校验当前保单信息是否由当前登录人创建
String createBy = byId.getCreateBy();
if(!createBy.equals(user.getId())){
......@@ -1029,10 +1176,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
//购买周期
String buyCycle = month + "个月/" + day + "天";
insuranceDetailVO.setBuyCycle(buyCycle);
//计费方式(0:按天,1:按月)
if (null != insuranceDetailVO.getBillingType()){
if (CommonConstants.ZERO_INT == insuranceDetailVO.getBillingType().intValue()){
insuranceDetailVO.setPurchaseCycle(insuranceDetailVO.getPurchaseCycle() + "天");
}else if (CommonConstants.ONE_INT == insuranceDetailVO.getBillingType().intValue()){
insuranceDetailVO.setPurchaseCycle(insuranceDetailVO.getPurchaseCycle() + "个月");
}
}
//如果是批增需要重新处理购买周期,按生效日期和保单结束时间计算
if (CommonConstants.THREE_INT == insuranceDetailVO.getBuyType()){
/*if (CommonConstants.THREE_INT == insuranceDetailVO.getBuyType()){
if (Objects.isNull(insuranceDetailVO.getPolicyEffect())){
insuranceDetailVO.setBuyCycle(null);
}else {
......@@ -1041,7 +1196,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
buyCycle = month + "个月/" + day + "天";
insuranceDetailVO.setBuyCycle(buyCycle);
}
}
}*/
//派单类型
insuranceDetailVO.setDistributeType(insuranceDetailVO.getReduceHandleStatus() == null?insuranceDetailVO.getBuyType():CommonConstants.FIVE_INT);
//派单状态
......@@ -1575,6 +1730,15 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
sourceIdCardList.add(detail.getEmpIdcardNo());
replaceIdList.add(detail.getId());
}
//判断是否已支出或支出中
EkpSettleStatusVo vo = ekpSettleService.getSettleStatusFromEkpInsuranceDetail(detail.getId());
if (vo != null && (vo.getPayStatus().equals("已结算")
|| vo.getPayStatus().equals("结算中"))) {
InsuranceListVO listVO = new InsuranceListVO();
BeanCopyUtils.copyProperties(detail,listVO);
listVO.setProjectName(detail.getDeptName());
listVO.setErrorMessage(InsurancesConstants.REDUCE_ROLLBACK_PAY_IS_NOT_ALLOW);
}
}
//批量更新商险和替换表
if (!updList.isEmpty()) {
......@@ -1638,35 +1802,46 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//实缴结算状态
String actualStatus = settleVo.getActualStatus();
String pushResult = null;
//预估已推送,实缴未推送
if(isEstimatePush == CommonConstants.ONE_INT && isActualPush == CommonConstants.ZERO_INT){
//预估未结算,推送作废
if(InsurancesConstants.SETTLE_ZERO.equals(estimateStatus)){
pushResult= pushEstimate(detail, CommonConstants.FIVE_INT);
}else {
//预估结算中已结算,推送预估红冲
detail.setDefaultSettleId(burden.getId());
pushResult = pushEstimate(detail, CommonConstants.THREE_INT);
//如果是见费出单,投保中,推送作废 2026-01-22 v1.7.19
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())){
//红冲预估推送
pushResult = pushEstimate(detail, CommonConstants.THREE_INT);
//已投保 需要处理实缴和差额数据 (已支出或支出中禁止退保)
if (CommonConstants.THREE_STRING.equals(detail.getBuyHandleStatus())){
//直接删除实缴及实缴与预估的差额
ekpSettleService.deleteEkpInsuranceDetailAsso(detail.getId());
}
//预估已推送,实缴已推送
} else if(isEstimatePush == CommonConstants.ONE_INT && isActualPush == CommonConstants.ONE_INT){
//预估未结算,实缴未结算推送作废
if(InsurancesConstants.SETTLE_ZERO.equals(estimateStatus) && InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
pushResult= pushEstimate(detail, CommonConstants.FIVE_INT);
}else{
//预估结算中,已结算,实缴已推送,推送实缴红冲信息
detail.setDefaultSettleId(burden.getId());
pushResult= pushEstimate(detail, CommonConstants.SIX_INT);
}
//预估未推送,实缴已推送
} else if(isEstimatePush == CommonConstants.ZERO_INT && isActualPush == CommonConstants.ONE_INT){
//实缴未结算推送作废
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
pushResult= pushEstimate(detail, CommonConstants.FIVE_INT);
}else{
//实缴结算中,已结算,推送实缴红冲信息
detail.setDefaultSettleId(burden.getId());
pushResult= pushEstimate(detail, CommonConstants.SIX_INT);
} else {
//预估已推送,实缴未推送
if(isEstimatePush == CommonConstants.ONE_INT && isActualPush == CommonConstants.ZERO_INT){
//预估未结算,推送作废
if(InsurancesConstants.SETTLE_ZERO.equals(estimateStatus)){
pushResult= pushEstimate(detail, CommonConstants.FIVE_INT);
}else {
//预估结算中已结算,推送预估红冲
detail.setDefaultSettleId(burden.getId());
pushResult = pushEstimate(detail, CommonConstants.THREE_INT);
}
//预估已推送,实缴已推送
} else if(isEstimatePush == CommonConstants.ONE_INT && isActualPush == CommonConstants.ONE_INT){
//预估未结算,实缴未结算推送作废
if(InsurancesConstants.SETTLE_ZERO.equals(estimateStatus) && InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
pushResult= pushEstimate(detail, CommonConstants.FIVE_INT);
}else{
//预估结算中,已结算,实缴已推送,推送实缴红冲信息
detail.setDefaultSettleId(burden.getId());
pushResult= pushEstimate(detail, CommonConstants.SIX_INT);
}
//预估未推送,实缴已推送
} else if(isEstimatePush == CommonConstants.ZERO_INT && isActualPush == CommonConstants.ONE_INT){
//实缴未结算推送作废
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
pushResult= pushEstimate(detail, CommonConstants.FIVE_INT);
}else{
//实缴结算中,已结算,推送实缴红冲信息
detail.setDefaultSettleId(burden.getId());
pushResult= pushEstimate(detail, CommonConstants.SIX_INT);
}
}
}
if(StringUtils.isNotBlank(pushResult)){
......@@ -1690,7 +1865,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}catch (Exception e){
log.error("收入数据同步处理失败:"+e);
}
}
}
}
......@@ -1700,7 +1874,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
operateList.add(e);
}
});
updateEmployeeInsurancePreById(detail,Stream.of("3","4","6").collect(Collectors.toList()),CommonConstants.FIVE_STRING);
//如果是见费出单,投保中,推送作废 2026-01-22 v1.7.19
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())){
updateEmployeeInsurancePreById(detail,Stream.of("3","4","6").collect(Collectors.toList()),CommonConstants.SEVEN_STRING);
}else {
updateEmployeeInsurancePreById(detail,Stream.of("3","4","6").collect(Collectors.toList()),CommonConstants.FIVE_STRING);
}
updateEmployeeInsurancePreRenewById(detail,Stream.of("3","4","6").collect(Collectors.toList()),CommonConstants.FIVE_STRING, true);
}
//更新状态
......@@ -1793,6 +1972,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<TInsuranceDetail> successList = new ArrayList<>();
List<TInsuranceDetail> successOne = new ArrayList<>();
List<TInsuranceDetail> successTwo = new ArrayList<>();
List<TInsuranceDetail> successBanlance = new ArrayList<>();
//被替换人标记被替换成功
List<TInsuranceDetail> sourceList = new ArrayList<>();
//被替换人的档案要处理状态
......@@ -1854,12 +2034,15 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settleDomain = null;
}
//根据结算类型判断是否需要计算预估保费
//预估
if (detail.getSettleType() == CommonConstants.ZERO_INT){
//预估 (是否见费出单为的不用生成预估,因为之前已经生成了)
if (detail.getSettleType() == CommonConstants.ZERO_INT && CommonConstants.ONE_STRING.equals(detail.getIsJfcd())){
if (CommonConstants.ONE_INT == detail.getBillingType()){
// 按月查费率
// 预估保费 = 费率 * 购买标准
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).multiply(detail.getRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
// 预估保费 = 费率 * 购买标准 + 5元
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard())
.multiply(detail.getRate())
.add(BigDecimal.valueOf(5.00))
.setScale(2,BigDecimal.ROUND_HALF_UP);
detail.setEstimatePremium(estimatePremium);
if (detail.getBuyType() == CommonConstants.THREE_INT){
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
......@@ -1899,8 +2082,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
day = LocalDateUtil.betweenDay(detail.getPolicyEffect().toString(), detail.getPolicyEnd().toString());
}
//预估保费 = (购买标准 / 365) * 天数
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard()).multiply(new BigDecimal(day)).divide(new BigDecimal("365"),CommonConstants.TWO_INT,BigDecimal.ROUND_HALF_UP);
//预估保费 = (购买标准 / 365) * 天数 + 5元
BigDecimal estimatePremium = new BigDecimal(detail.getBuyStandard())
.multiply(new BigDecimal(day))
.divide(new BigDecimal("365"),CommonConstants.TWO_INT,BigDecimal.ROUND_HALF_UP)
.add(BigDecimal.valueOf(5.00));
detail.setEstimatePremium(estimatePremium);
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
......@@ -1948,6 +2134,30 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
successOne.add(detail);
updateEmployeeInsurancePreById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING, false);
//如果是见费出单,生成差额数据
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())){
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(CommonConstants.TWO_INT);
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(BigDecimalUtils.safeAdd(detail.getActualPremium(),detail.getEstimatePremium()));
settle.setActualPremium(BigDecimal.ZERO);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
settle.setId(RandomStringUtils.randomNumeric(19));
settleList.add(settle);
TInsuranceDetail detailTemp = new TInsuranceDetail();
BeanCopyUtils.copyProperties(detail,detailTemp);
detailTemp.setDefaultSettleId(settle.getId());
detailTemp.setEstimatePremium(BigDecimalUtils.safeAdd(detail.getActualPremium(),detail.getEstimatePremium()));
detailTemp.setActualPremium(BigDecimal.ZERO);
//差额结算 TODO 需要解决已退回和删除时的数据处理
detailTemp.setSettleType(CommonConstants.TWO_INT);
successBanlance.add(detailTemp);
}
}
}
}
......@@ -1958,6 +2168,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateBatchById(successTwo);
successList.addAll(successOne);
successList.addAll(successTwo);
//把差额也算进去
if (!successBanlance.isEmpty()){
successList.addAll(successBanlance);
}
successOne.clear();
successTwo.clear();
//插入结算数据
......@@ -2305,6 +2519,28 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
doJointInsuranceTask.asynchronousEkpInfo(detail,settleNew,CommonConstants.TWO_INT);
}
}
//实缴导入时根据条件取生成差额数据,其他情况会在推送数据时去规整 对应的应收和应支
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())) {
//登记保单保费时为已投保,已投保无法退回,故直接删除差额重新生成即可
ekpSettleService.callBackBalance(detail.getId());
tInsuranceSettleService.remove(Wrappers.<TInsuranceSettle>query().lambda()
.eq(TInsuranceSettle::getInsDetailId, detail.getId())
.eq(TInsuranceSettle::getSettleType, CommonConstants.TWO_INT));
TInsuranceSettle settleNew = new TInsuranceSettle();
settleNew.setInsDetailId(detail.getId());
settleNew.setSettleType(CommonConstants.TWO_INT);
settleNew.setSettleHandleStatus(CommonConstants.ONE_STRING);
settleNew.setActualPremium(bigDecimalAct);
settleNew.setIsEstimatePush(CommonConstants.ZERO_INT);
settleNew.setEstimatePremium(detail.getEstimatePremium());
//调完ekp接口才会是1
settleNew.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settleNew);
//调EKP新增实际保费
detail.setActualPremium(bigDecimalAct);
doJointInsuranceTask.asynchronousEkpInfo(detail,settleNew,CommonConstants.SEVEN_INT);
}
}
//如果当前保费为空,且保单号或发票号不一样
if ((Common.isEmpty(success.getActualPremium()) || (Common.isNotNull(detail.getActualPremium())
......@@ -2780,11 +3016,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param paramList
* @return {@link Map<String, List<InsuranceAddParam>>}
*/
private Map<String,List<InsuranceAddParam>> addInsuranceCheck(List<InsuranceAddParam> paramList,YifuUser user,boolean autoFlag){
private Map<String,List<InsuranceAddParam>> addInsuranceCheck(List<InsuranceAddParam> paramList,
YifuUser user,boolean autoFlag,
Map<String,TSettleDomainSelectVo> mapSelectVo){
//1.9.11超管无需校验项目权限
List<String> deptNoList = new ArrayList<>();
if (Common.isNotNull(user) && !CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
deptNoList = getDeptNoList(user.getId());
//deptNoList = getDeptNoList(user.getId());
deptNoList = getDeptNoMapAndDeptNo(user.getId());
}
Map<String,List<InsuranceAddParam>> map = new HashMap<>();
List<InsuranceAddParam> listResult = new ArrayList<>();
......@@ -2794,10 +3033,25 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map<String, String> insurAutoMap = getInsurAutoMap(paramList);
//派单前系统已有在途/在保数据的人员明细
// List<InsuredListVo> listInProgress = new ArrayList<>();
TInsuranceType insuranceType = null;
TSettleDomainSelectVo settleDomainSelectVo = null;
TSettleDomainSelectVo settleResult = null;
//定义外层循环标识,方便去重的时候跳出
outer:
for (int i = 0; i < distinctList.size(); i++) {
InsuranceAddParam param = distinctList.get(i);
if (!mapSelectVo.containsKey(param.getDeptNo())){
// 1. 查询项目信息获取客户信息
settleResult = archivesDaprUtil.selectDeptByNo(param.getDeptNo());
if (settleResult == null) {
param.setErrorMessage("项目编码[" + param.getDeptNo() + "]信息不存在");
listResult.add(param);
continue;
}else {
mapSelectVo.put(param.getDeptNo(),settleResult);
}
}
param.setBuyType(CommonConstants.ONE_INT);
// 必填校验
if (StringUtils.isBlank(param.getEmpName())) {
......@@ -3062,7 +3316,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setInsuranceHandleCity(insuranceCompany.getInsuranceHandleCity());
param.setInsuranceHandleCityName(insuranceCompany.getInsuranceHandleCityName());
TInsuranceType insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda()
insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda()
.eq(TInsuranceType::getName, param.getInsuranceTypeName())
.eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId())
.eq(TInsuranceType::getDeleteFlag, CommonConstants.ZERO_INT)
......@@ -3178,12 +3432,45 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue;
}
}
//获取项目信息
if (null != mapSelectVo && mapSelectVo.size() > 0){
settleDomainSelectVo = mapSelectVo.get(param.getDeptNo());
}
//初始化是否见费出单字段值
initJfcd(insuranceType, settleDomainSelectVo, param);
listSuccess.add(param);
}
map.put("listResult",listResult);
map.put("listSuccess",listSuccess);
return map;
}
private void initJfcd(TInsuranceType insuranceType, TSettleDomainSelectVo settleDomainSelectVo, InsuranceAddParam param) {
// 默认设置为"1",只有在满足特定条件时才设置为"0"
param.setIsJfcd(CommonConstants.ONE_STRING);
// 检查必要对象不为空,且满足见费出单条件
if (Common.isNotNull(insuranceType) &&
Common.isNotNull(settleDomainSelectVo) &&
CommonConstants.ZERO_STRING.equals(insuranceType.getIsJfcd()) &&
CommonConstants.IS_FALSE.equals(settleDomainSelectVo.getBpoEnable())) {
param.setIsJfcd(CommonConstants.ZERO_STRING);
}
}
private void initJfcdBatch(TInsuranceType insuranceType, TSettleDomainSelectVo settleDomainSelectVo, InsuranceBatchParam param) {
// 默认设置为"1",只有在满足特定条件时才设置为"0"
param.setIsJfcd(CommonConstants.ONE_STRING);
// 检查必要对象不为空,且满足见费出单条件
if (Common.isNotNull(insuranceType) &&
Common.isNotNull(settleDomainSelectVo) &&
CommonConstants.ZERO_STRING.equals(insuranceType.getIsJfcd()) &&
CommonConstants.IS_FALSE.equals(settleDomainSelectVo.getBpoEnable())) {
param.setIsJfcd(CommonConstants.ZERO_STRING);
}
}
/**
* @Author fxj
* @Description 判断商险 待投保、投保中、已投保(有效,未过期) 如果保单生效时间为空直接提示存在在途或在保数据
......@@ -3338,11 +3625,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param paramList
* @return {@link Map< String, List< InsuranceBatchParam>>}
*/
private Map<String,List<InsuranceBatchParam>> batchInsuranceCheck(List<InsuranceBatchParam> paramList,YifuUser user,boolean autoFlag){
private Map<String,List<InsuranceBatchParam>> batchInsuranceCheck(List<InsuranceBatchParam> paramList,YifuUser user,boolean autoFlag,
Map<String,TSettleDomainSelectVo> mapSelectVo){
//1.9.11超管无需校验项目权限
List<String> deptNoList = new ArrayList<>();
if (Common.isNotNull(user) && !CommonConstants.ZERO_STRING.equals(user.getSystemFlag())) {
deptNoList = getDeptNoList(user.getId());
deptNoList = getDeptNoMapAndDeptNo(user.getId());
}
Map<String,List<InsuranceBatchParam>> map = new HashMap<>();
List<InsuranceBatchParam> listResult = new ArrayList<>();
......@@ -3350,10 +3638,25 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<InsuranceBatchParam> distinctList = paramList.stream().distinct().collect(Collectors.toList());
// 查询是否配置了自动化配置,如果有项目权限 有自动化配置就限制提交
Map<String, String> insurAutoMap = getBatchInsurAutoMap(paramList);
TInsuranceType insuranceType = null;
TSettleDomainSelectVo settleDomainSelectVo = null;
TSettleDomainSelectVo settleResult = null;
//定义外层循环标识,方便去重的时候跳出
outer:
for (int i = 0; i < distinctList.size(); i++) {
InsuranceBatchParam param = distinctList.get(i);
if (!mapSelectVo.containsKey(param.getDeptNo())){
// 1. 查询项目信息获取客户信息
settleResult = archivesDaprUtil.selectDeptByNo(param.getDeptNo());
if (settleResult == null) {
param.setErrorMessage("项目编码[" + param.getDeptNo() + "]信息不存在");
listResult.add(param);
continue;
}else {
mapSelectVo.put(param.getDeptNo(),settleResult);
}
}
param.setBuyType(CommonConstants.THREE_INT);
// 必填校验
if (StringUtils.isBlank(param.getDeptNo())){
......@@ -3622,7 +3925,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setInsuranceHandleCity(insuranceCompany.getInsuranceHandleCity());
param.setInsuranceHandleCityName(insuranceCompany.getInsuranceHandleCityName());
TInsuranceType insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda()
insuranceType = tInsuranceTypeService.getOne(Wrappers.<TInsuranceType>query().lambda()
.eq(TInsuranceType::getName, param.getInsuranceTypeName())
.eq(TInsuranceType::getInsuranceCompanyId, insuranceCompany.getId())
.eq(TInsuranceType::getDeleteFlag, CommonConstants.ZERO_INT)
......@@ -3738,6 +4041,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue;
}
}
if (null != mapSelectVo && mapSelectVo.size() > 0){
settleDomainSelectVo = mapSelectVo.get(param.getDeptNo());
}
//初始化是否见费出单字段值
initJfcdBatch(insuranceType, settleDomainSelectVo, param);
listSuccess.add(param);
}
map.put("listResult",listResult);
......@@ -7951,7 +8259,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* 获取项目权限
*
* @author zhaji
* @param userId
* @param userId mapSelectVo
* @return {@link List< String>}
*/
public List<String> getDeptNoList(String userId){
......@@ -7969,6 +8277,28 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
return deptList;
}
/**
* 获取项目权限
*
* @author zhaji
* @param userId
* @return {@link List< String>}
*/
public List<String> getDeptNoMapAndDeptNo(String userId){
List<String> deptList = new ArrayList<>(16);
try{
R<TSettleDomainListVo> settleDomainList = archivesDaprUtil.getSettleDomainIdsByUserId(userId);
if(Common.isNotNull(settleDomainList) && settleDomainList.getCode() == CommonConstants.SUCCESS){
TSettleDomainListVo data = settleDomainList.getData();
if (Optional.ofNullable(data).isPresent()){
deptList = data.getDeptNos();
}
}
}catch (Exception e){
log.error("查询项目信息出错:"+e);
}
return deptList;
}
/**
* 获取项目名称,客户编码,客户名称
......@@ -8134,7 +8464,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param
* @return {@link String}
*/
public EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetail(String detailId,String settleId){
@Override
public EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetail(String detailId, String settleId){
String id = detailId+CommonConstants.DOWN_LINE_STRING+settleId;
//获取ekp结算信息
return ekpSettleService.getSettleStatusFromEkpInsuranceDetail(id);
......@@ -9314,5 +9645,173 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
cspDaprUtil.reduceHandleToLeave(updateVo);
}
/**
* @Author fxj
* @Description 获取见费出单的结算及支出状态
* @Date 10:26 2026/1/21
* @Param
* @return
**/
@Override
public R getSettleStatusFromEkpInsuranceDetailAsso(String detailId,String settleId) {
String id = detailId+CommonConstants.DOWN_LINE_STRING+settleId;
EkpSettleStatusVo vo = ekpSettleService.getSettleStatusFromEkpInsuranceDetailAsso(id);
if (null == vo){
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
return R.ok(vo);
}
/**
* @Author fxj
* @Description 撤回 --待缴费状态的投保记录 可撤回
* @Date 10:34 2026/1/21
* @Param
* @return
**/
@Override
public R callBack(TInsuranceDetail detail) {
String id = detail.getId()+CommonConstants.DOWN_LINE_STRING+detail.getDefaultSettleId();
EkpSettleStatusVo vo = ekpSettleService.getSettleStatusFromEkpInsuranceDetailAsso(id);
if (null != vo && "已结算".equals(vo.getSettleStatus()) || "结算中".equals(vo.getSettleStatus())){
return R.failed("已结算或结算中的投保记录不可撤回");
}
try {
//未结算删除 EKP 的预估数据
ekpSettleService.deleteEkpInsuranceDetail(id);
//未结算删除 HRO的投保数据
baseMapper.deleteById(detail.getId());
//未结算删除 HRO的预估结算数据
tInsuranceSettleService.removeById(detail.getDefaultSettleId());
//查询并删除收入信息
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if(Common.isNotNull(detailList) && detailList.getCode() == CommonConstants.SUCCESS
&& !detailList.getData().getDetailList().isEmpty()){
List<TIncomeDetail> incomeDetailList = detailList.getData().getDetailList();
BigDecimal sumMoney = BigDecimal.ZERO;
for (TIncomeDetail income : incomeDetailList) {
socialDaprUtils.deleteById(income);
}
}
//未结算更新自动化测的状态为待派单 temployeeinsurancepre
employeeInsurancePreMapper.delete(Wrappers.<TEmployeeInsurancePre>query().lambda().eq(TEmployeeInsurancePre::getInsurancesId,detail.getId()));
} catch (Exception e) {
return R.failed("撤回异常:"+e.getMessage());
}
return R.ok();
}
/**
* @Author fxj
* @Description 手动拉取缴费状态
* @Date 10:52 2026/1/21
* @Param
* @return
**/
@Override
public R pullPaymentStatus(String idStr) {
List<TInsuranceDetail> list = null;
if (Common.isNotNull(idStr)){
list = baseMapper.selectBatchIds(Arrays.asList(idStr.split(CommonConstants.COMMA_STRING)));
}else {
list = baseMapper.selectList(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getBuyHandleStatus,CommonConstants.SIX_INT)
.eq(TInsuranceDetail::getIsJfcd,CommonConstants.ZERO_STRING));
}
if (Common.isNotNull(list)){
//list转为MAP id 为 key
Map<String,TInsuranceDetail> map = list.stream().collect(Collectors.toMap(TInsuranceDetail::getId, v -> v));
List<EkpSettleStatusVo> voList = ekpSettleService.getSettleStatusFromEkpAssoByIds(list.stream()
.map(TInsuranceDetail::getId).distinct().collect(Collectors.toList()));
if (Common.isNotNull(voList)){
//如果EKP对应提前缴费的预估数据已结算或已垫付则HRO商险派单状态同步为待投保
List<TInsuranceDetail> updateList = new ArrayList<>();
// 自动化测需要同步更新为待投保
List<String> ids = new ArrayList<>();
TInsuranceDetail detail = null;
for (EkpSettleStatusVo vo : voList){
if (("已收".equals(vo.getPaymentStatus())
|| "垫付".equals(vo.getPaymentStatus()))
&& map.containsKey(vo.getDetailId())){
detail = map.get(vo.getDetailId());
detail.setPaymentTime(DateUtil.formatDatePatten(new Date(),DateUtil.DATETIME_PATTERN_SECOND));
detail.setPaymentStatus(CommonConstants.ONE_STRING);
updateList.add(detail);
ids.add(vo.getDetailId());
}
}
if (Common.isNotNull(updateList)){
this.updateBatchById(updateList);
}
if (Common.isNotNull(ids)){
//通过ids 更新自动化测状态processStatus为待投保
LambdaUpdateWrapper<TEmployeeInsurancePre> updateDiyInfoWrapper = new LambdaUpdateWrapper<>();
updateDiyInfoWrapper.in(TEmployeeInsurancePre::getInsurancesId, ids)
.set(TEmployeeInsurancePre::getProcessStatus,CommonConstants.SEVEN_STRING);
employeeInsurancePreMapper.update(null, updateDiyInfoWrapper);
}
}
}
return R.ok();
}
@Override
public R callBackInsuranceBuyHandleStatus(EkpStatusParamVo vo) {
try {
callBackInsuranceBuyHandleStatusSub(vo);
}catch (Exception e) {
log.error("商险结算状态更新异常", e);
return R.failed("商险结算状态更新异常");
}
return R.ok();
}
@Async
public void callBackInsuranceBuyHandleStatusSub(EkpStatusParamVo vo) {
try {
//根据结算单号获取明细id和结算状态
List<EkpInsuranceViewVo> viewVoList;
TInsuranceDetail detail;
viewVoList = ekpSettleService.selectViewBySettleNo(vo.getSettleNo(), vo.getPayFlag());
if (viewVoList != null && !viewVoList.isEmpty()) {
String insuranceId;
List<String> insuranceIds = new ArrayList<>();
for (EkpInsuranceViewVo viewVo : viewVoList) {
//获取所有的明细id
if (Common.isNotNull(viewVo.getId())) {
insuranceId = viewVo.getId().substring(0, 19);
detail = baseMapper.selectById(insuranceId);
//见费出单且是待投保状态 直接回退到 待缴费 并清空缴费时间和缴费状态
if (Common.isNotNull(detail)
&& CommonConstants.ONE_STRING.equals(detail.getBuyHandleStatus())
&& CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())) {
detail.setPaymentTime(CommonConstants.EMPTY_STRING);
detail.setPaymentStatus(CommonConstants.ZERO_STRING);
detail.setBuyHandleStatus(CommonConstants.SIX_INT);
baseMapper.updateById(detail);
insuranceIds.add(insuranceId);
}
}
}
if (!insuranceIds.isEmpty()){
//通过ids 更新自动化测状态processStatus为待投保
LambdaUpdateWrapper<TEmployeeInsurancePre> updateDiyInfoWrapper = new LambdaUpdateWrapper<>();
updateDiyInfoWrapper.in(TEmployeeInsurancePre::getInsurancesId, insuranceIds)
.set(TEmployeeInsurancePre::getProcessStatus,CommonConstants.ONE_STRING);
employeeInsurancePreMapper.update(null, updateDiyInfoWrapper);
}
}
} catch (Exception e) {
TUpdateStatusError error = new TUpdateStatusError();
error.setSettleNo(vo.getSettleNo());
error.setStatus(CommonConstants.ZERO_INT);
error.setTitle(e.getMessage());
error.setTypeFlag(CommonConstants.FOUR_STRING);
error.setCreateTime(DateUtil.getCurrentDateTime());
error.setSettleType(vo.getPayFlag());
updateStatusErrorMapper.insert(error);
log.error("收款结算单退单或撤销匹配更新是否见费出单的商险状态为待缴费", e);
}
}
}
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.util;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.icbc.api.request.JftApiCommonOpenCardRequestV1;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpIdCardAndDeptVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpStatusVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -30,9 +31,11 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -90,6 +93,9 @@ public class DoJointInsuranceTask {
if (type == CommonConstants.ONE_INT) {
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
}else if (type == CommonConstants.SEVEN_INT) {
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
} else {
settle.setIsActualPush(CommonConstants.ONE_INT);
settle.setActualPushTime(LocalDateTime.now());
......@@ -189,6 +195,12 @@ public class DoJointInsuranceTask {
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.THREE_INT;
}
//7生成差额数据
if(CommonConstants.SEVEN_INT == type){
param.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
param.setSettleType(InsurancesConstants.BALANCE_SETTLE_BILL);
pushType = CommonConstants.SEVEN_INT;
}
//作废
if(CommonConstants.FIVE_INT == type){
cancel.setDeptNo(tInsuranceDetail.getDeptNo());
......@@ -226,6 +238,7 @@ public class DoJointInsuranceTask {
if (Common.isNotNull(viewVo.getId())) {
insuranceId = viewVo.getId().substring(0, 19);
detail = insuranceDetailMapper.selectById(insuranceId);
log.error("更新状态商险ID:"+detail.getId() +"|"+insuranceId);
if (Common.isNotNull(detail)) {
//判断订单类型是预估还是实缴
if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(viewVo.getOrderType())) {
......@@ -241,6 +254,21 @@ public class DoJointInsuranceTask {
if (CommonConstants.ZERO_STRING.equals(vo.getPayFlag())) {
detail.setIncomeSettleFlag(viewVo.getIncomeSettleFlag());
detail.setIncomeCollectFlag(viewVo.getIncomeCollectFlag());
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())){
if (CommonConstants.ZERO_STRING.equals(detail.getPaymentStatus())
&&("0".equals(viewVo.getIncomeCollectFlag())
|| "2".equals(viewVo.getIncomeCollectFlag()))){
detail.setBuyHandleStatus(CommonConstants.ONE_INT);
detail.setPaymentStatus(CommonConstants.ONE_STRING);
detail.setPaymentTime(DateUtil.formatDatePatten(new Date(),DateUtil.DATETIME_PATTERN_SECOND));
}
if (CommonConstants.ONE_STRING.equals(detail.getPaymentStatus())
&& "1".equals(viewVo.getIncomeCollectFlag())){
detail.setBuyHandleStatus(CommonConstants.SIX_INT);
detail.setPaymentStatus(CommonConstants.ZERO_STRING);
detail.setPaymentTime(CommonConstants.EMPTY_STRING);
}
}
} else {
detail.setPaySettleFlag(viewVo.getPaySettleFlag());
detail.setPayCollectFlag(viewVo.getPayCollectFlag());
......@@ -575,11 +603,70 @@ public class DoJointInsuranceTask {
code = "1";
} else if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(param.getSettleType())) {
code = "2";
} else if (InsurancesConstants.BALANCE_SETTLE_BILL.equals(param.getSettleType())) {
code = "3";
}
initValues(pushParam, deptInfoVo, param,code);
//商险费用明细生成规则调整:
//1、针对非提前缴费也非预估模式也未启用BPO结算模式的项目下,商险只存在实缴费用,实缴费用中应收等于应支——此类费用“实缴费用”需已收才能支出;
//2、针对启用BPO结算模式的,无论是否为预估模式是否需提前缴费,都不会产生商险的预估数据,商险只存在实缴费用,实缴费用中,应收为0,应支等于导入的实缴金额——此类费用无需收可正常支出,支出计成本;
//3、针对提前缴费的项目,无论是否为预估模式,商险存在预估费用,预估费用中应收有值为按照规则计算得出的,应支为0;存在实缴费用,实缴费用应收为0,应支等于导入的实缴金额;存在差额费用,差额费用应收有值,等于“实缴的应支金额-预估的应收金额——此类实缴支出会判断是否存在提前缴费的标识,若存在,则支出可以选择的到,选择后即可支出(差额明细逻辑:导入后根据预估明细和实缴明细,生成“单据类型”为“差额”的商险明细数据(只有应收金额没有应支,应收金额=实缴的应支-预估的应收,若>0,则说明少收了,差额下期要结算回来,若<0,则说明多收了,为负数,下期结算的时候,会结算负数,相当于在下一期的结算中可以少收这部分钱;若=0,则不生成差额数据),派单id前缀,同之前的预估和实缴明细的id一致,“是否全部结算”为“是”,收款结算单拉取商险明细数据的时候,默认带出,必须跟着一起结算)。
//4、针对非提前缴费的预估模式的未启用BPO结算模式的项目,商险存在预估费用,预估费用中应收有值为按照规则计算得出的,应支为0;存在实缴费用,实缴费用应收为“实缴费用的应支-预估数据的应收”的差值,应支等于导入的实缴金额;不存在差额费用——检查了系统中所有的项目维度,商险都是全量未结算,结算月份为空,因此不会存在实缴结算了应收差额,预估未收的情况——按照现有的模式执行
//应收
double ys = 0L;
if (!"是".equals(deptInfoVo.getIsBpo())) {
//2、针对启用BPO结算模式的,无论是否为预估模式是否需提前缴费,都不会产生商险的预估数据,商险只存在实缴费用,实缴费用中,应收为0,应支等于导入的实缴金额——此类费用无需收可正常支出,支出计成本;
if ("是".equals(deptInfoVo.getBpoSettle())) {
if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(param.getSettleType())){
ys = 0L;
}
}else {
if (!"是".equals(param.getIsJfcd())){
//1、针对非提前缴费也非预估模式也未启用BPO结算模式的项目下,商险只存在实缴费用,实缴费用中应收等于应支——此类费用“实缴费用”需已收才能支出
if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(param.getSettleType())
&& "无".equals(pushParam.getFd_3af9d1441ef7b6())){
ys = param.getActualPremium().doubleValue();
}
//4、针对非提前缴费的预估模式的未启用BPO结算模式的项目,商险存在预估费用,预估费用中应收有值为按照规则计算得出的,应支为0;
// 存在实缴费用,实缴费用应收为“实缴费用的应支-预估数据的应收”的差值,应支等于导入的实缴金额;
// 不存在差额费用——检查了系统中所有的项目维度,商险都是全量未结算,结算月份为空,因此不会存在实缴结算了应收差额,预估未收的情况——按照现有的模式执行
if ("有".equals(pushParam.getFd_3af9d1441ef7b6())){
if (InsurancesConstants.ESTIMATE_SETTLE_BILL.equals(param.getSettleType())){
//应支=0
pushParam.setFd_3adfe6e3911ffe(0.00);
ys = null==param.getEstimatePremium()? 0.00:param.getEstimatePremium().doubleValue();
}
if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(param.getSettleType())){
//应收=实缴的应支-预估的应收
ys = BigDecimalUtils.safeSubtract(param.getActualPremium(),param.getEstimatePremium()).doubleValue();
}
}
} else if ("是".equals(param.getIsJfcd())){
//3、针对提前缴费的项目,无论是否为预估模式,商险存在预估费用,预估费用中应收有值为按照规则计算得出的,应支为0;存在实缴费用,实缴费用应收为0,应支等于导入的实缴金额;
// 存在差额费用,差额费用应收有值,等于“实缴的应支金额-预估的应收金额——此类实缴支出会判断是否存在提前缴费的标识,若存在,则支出可以选择的到,
// 选择后即可支出(差额明细逻辑:导入后根据预估明细和实缴明细,生成“单据类型”为“差额”的商险明细数据(只有应收金额没有应支,应收金额=实缴的应支-预估的应收,若>0,
// 则说明少收了,差额下期要结算回来,若<0,则说明多收了,为负数,下期结算的时候,会结算负数,相当于在下一期的结算中可以少收这部分钱;若=0,则不生成差额数据),
// 派单id前缀,同之前的预估和实缴明细的id一致,“是否全部结算”为“是”,收款结算单拉取商险明细数据的时候,默认带出,必须跟着一起结算)。
if (InsurancesConstants.ESTIMATE_SETTLE_BILL.equals(param.getSettleType())){
ys = null==param.getEstimatePremium()? 0.00:param.getEstimatePremium().doubleValue();
//应支=0
pushParam.setFd_3adfe6e3911ffe(0.00);
}
if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(param.getSettleType())){
ys = 0L;
}
//差额
if (InsurancesConstants.BALANCE_SETTLE_BILL.equals(param.getSettleType())){
//应收=实缴的应支-预估的应收
ys = BigDecimalUtils.safeSubtract(param.getActualPremium(),param.getEstimatePremium()).doubleValue();
//应支=0
pushParam.setFd_3adfe6e3911ffe(0.00);
//是否全部结算
pushParam.setFd_3b13b2ecc164aa("是");
}
}
}
/*if (!"是".equals(deptInfoVo.getIsBpo())) {
if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(param.getSettleType()) && "有".equals(pushParam.getFd_3af9d1441ef7b6())) {
ys = BigDecimalUtils.safeSubtract(false, param.getActualPremium(), param.getEstimatePremium()).doubleValue();
} else if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(param.getSettleType()) && "无".equals(pushParam.getFd_3af9d1441ef7b6())) {
......@@ -587,7 +674,7 @@ public class DoJointInsuranceTask {
} else {
ys = param.getEstimatePremium().doubleValue();
}
}
}*/
pushParam.setFd_3adfe6e30f2a3c(ys);
//付款状态
pushParam.setFd_3adfe6f05531ec("未付");
......@@ -900,6 +987,12 @@ public class DoJointInsuranceTask {
pushParam.setCreateTime(DateUtil.getCurrentDateTime());
//应支出
pushParam.setFd_3adfe6e3911ffe(InsurancesConstants.ACTUAL_SETTLE_BILL.equals(param.getSettleType()) ? pushParam.getFd_3adfe6610c0d2c() : 0);
//是否见费出单
if (CommonConstants.ZERO_STRING.equals(param.getIsJfcd())){
pushParam.setFd_jfcd("是");
}else {
pushParam.setFd_jfcd("否");
}
}
//商险更新赋值
......@@ -941,6 +1034,7 @@ public class DoJointInsuranceTask {
info.setFd_3adfe6609aa810(Common.isNotNull(param.getDieDisableQuota()) ? param.getDieDisableQuota() : CommonConstants.EMPTY_STRING);
//hro结算月
info.setFd_3b13b3076af5a0(null != param.getSettleMonth() ? DateUtil.parseDate(param.getSettleMonth(), DateUtil.DATETIME_YYYY_MM) : null);
insurancesInfoMapper.updateById(info);
}
}
......@@ -63,13 +63,56 @@
<select id="getSettleStatusFromEkpInsuranceDetail" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSettleStatusVo">
select
fd_3adfe6ec6a8cbe settleStatus,fd_3adfe6eda67236 payStatus
fd_3adfe6ec6a8cbe settleStatus,fd_3adfe6eda67236 payStatus,fd_3adfe6ef5dfaac paymentStatus
from
ekp_insurances_info
where
fd_3b0a5743acab7e = #{id} and fd_3adfe6af71a1cc = '实缴' limit 1
</select>
<select id="getSettleStatusFromEkpAsso" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSettleStatusVo">
select
fd_3adfe6ec6a8cbe settleStatus,fd_3adfe6eda67236 payStatus,fd_3adfe6ef5dfaac paymentStatus,fd_3b0a5743acab7e detailId
from
ekp_insurances_info
where
fd_3b0a5743acab7e = #{id} and fd_3adfe6af71a1cc = '预估' and fd_jfcd='是' limit 1
</select>
<select id="getSettleStatusFromEkpAssoByIds" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSettleStatusVo">
select
fd_3adfe6ec6a8cbe settleStatus,fd_3adfe6eda67236 payStatus,fd_3adfe6ef5dfaac paymentStatus,fd_3b0a5743acab7e detailId
from
ekp_insurances_info
where
fd_3adfe6af71a1cc = '预估' and fd_jfcd='是'
<if test="ids != null and ids.size() > 0">
and fd_3b0a5743acab7e in
<foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="getBalanceByInsuranceId" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSettleStatusVo">
select
fd_3adfe6ec6a8cbe settleStatus,fd_3adfe6eda67236 payStatus,fd_3adfe6ef5dfaac paymentStatus,fd_3b0a5743acab7e detailId,fd_3adfe6e30f2a3c paymentBalance
from
ekp_insurances_info
where
fd_3adfe6af71a1cc = '差额' and fd_jfcd='是' and
fd_3b0a5743acab7e like concact(#{id},'%')
</select>
<delete id="deleteEkpInsuranceDetail">
delete from ekp_insurances_info where fd_3b0a5743acab7e=#{id} and fd_jfcd='是' and fd_3adfe6af71a1cc = '预估'
</delete>
<delete id="deleteEkpInsuranceDetailAsso">
delete from ekp_insurances_info where fd_3b0a5743acab7e like concat(#{id},'%') and fd_jfcd='是' and (fd_3adfe6af71a1cc = '差额' or fd_3adfe6af71a1cc = '实缴')
</delete>
<delete id="callBackBalance">
delete from ekp_insurances_info where fd_3b0a5743acab7e like concat(#{id},'%') and fd_jfcd='是' and fd_3adfe6af71a1cc = '差额'
</delete>
<select id="getDeptSettle" resultMap="BaseDeptResultMap">
select
<include refid="Base_Column_Dept"></include>
......
......@@ -71,6 +71,14 @@
<result property="spaySettleFlag" column="SPAY_COLLECT_FLAG"/>
<result property="spayCollectFlag" column="SPAY_SETTLE_FLAG"/>
<result property="isAdress" column="IS_ADRESS" jdbcType="VARCHAR"/>
<result property="paymentStatus" column="PAYMENT_STATUS" jdbcType="VARCHAR"/>
<result property="paymentTime" column="PAYMENT_TIME" jdbcType="VARCHAR"/>
<result property="isJfcd" column="IS_JFCD" jdbcType="VARCHAR"/>
<result property="purchaseCycle" column="PURCHASE_CYCLE" jdbcType="VARCHAR"/>
<result property="preHandleTime" column="PRE_HANDLE_TIME" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="UpdateMap" type="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceUpdateVO">
<id property="id" column="ID" jdbcType="VARCHAR"/>
......@@ -90,7 +98,7 @@
IS_USE,IS_EFFECT,IS_OVERDUE,REMARK,
CREATE_BY,CREATE_NAME,CREATE_TIME,BPO_FLAG,
UPDATE_BY,UPDATE_TIME,DELETE_FLAG,DEFAULT_SETTLE_ID,HANDLED_BY,HANDLED_TIME,ORDER_NO,CREATE_USER_DEPT_ID,CREATE_USER_DEPT_NAME,
DEPT_NAME,UNIT_ID,UNIT_NAME,UNIT_NO,IS_ADRESS
DEPT_NAME,UNIT_ID,UNIT_NAME,UNIT_NO,IS_ADRESS,PAYMENT_STATUS,PAYMENT_TIME,IS_JFCD,PURCHASE_CYCLE,PRE_HANDLE_TIME
</sql>
......@@ -119,12 +127,22 @@
a.UNIT_NAME as unitName,
a.UNIT_NO as unitNo,
a.IS_EFFECT as isEffect,
a.IS_ADRESS as isAdress
a.IS_ADRESS as isAdress,
a.PAYMENT_STATUS as paymentStatus,
a.PAYMENT_TIME as paymentTime,
a.IS_JFCD as isJfcd,
a.PURCHASE_CYCLE as purchaseCycle,
a.BILLING_TYPE as billingType,
a.PRE_HANDLE_TIME as preHandleTime,
a.ESTIMATE_PREMIUM as estimatePremium
from t_insurance_detail a
where a.DELETE_FLAG = 0
<if test="param.isEffect != null">
and a.IS_EFFECT = #{param.isEffect}
</if>
<if test="param.id != null">
and a.id = #{param.id}
</if>
<if test="param.unitName != null and param.unitName.trim() != ''">
and a.UNIT_NAME like concat(replace(replace(#{param.unitName},'_','\_'),'%','\%'),'%')
</if>
......@@ -173,6 +191,24 @@
<if test="param.isAdress != null and param.isAdress.trim() != ''">
and a.IS_ADRESS = #{param.isAdress}
</if>
<if test="param.paymentStatus != null and param.paymentStatus.trim() != ''">
and a.PAYMENT_STATUS = #{param.paymentStatus}
</if>
<if test="param.paymentTimeStart != null and param.paymentTimeStart.trim() != '' ">
and a.PAYMENT_TIME <![CDATA[ >= ]]> #{param.paymentTimeStart}
</if>
<if test="param.paymentTimeEnd != null and param.paymentTimeEnd.trim() != ''">
and a.PAYMENT_TIME <![CDATA[ <= ]]> #{param.paymentTimeEnd}
</if>
<if test="param.isJfcd != null and param.isJfcd.trim() != ''">
and a.IS_JFCD = #{param.isJfcd}
</if>
<if test="param.estimatePremiumStart != null">
and a.ESTIMATE_PREMIUM <![CDATA[ >= ]]> #{param.estimatePremiumStart}
</if>
<if test="param.estimatePremiumEnd != null">
and a.ESTIMATE_PREMIUM <![CDATA[ <= ]]> #{param.estimatePremiumEnd}
</if>
<if test="param.authSql != null and param.authSql.trim() != ''">
${param.authSql}
</if>
......@@ -201,12 +237,22 @@
if(a.BUY_HANDLE_STATUS=4,a.BACK_REMARK,'') as backRemark,
a.CREATE_TIME as createTime,
a.IS_EFFECT as isEffect,
a.IS_ADRESS as isAdress
a.IS_ADRESS as isAdress,
a.PAYMENT_STATUS as paymentStatus,
a.PAYMENT_TIME as paymentTime,
a.IS_JFCD as isJfcd,
a.PURCHASE_CYCLE as purchaseCycle,
a.PRE_HANDLE_TIME as preHandleTime,
a.ESTIMATE_PREMIUM as estimatePremium,
a.BILLING_TYPE as billingType
from t_insurance_detail a
where a.DELETE_FLAG = 0
<if test="param.isEffect != null">
and a.IS_EFFECT = #{param.isEffect}
</if>
<if test="param.id != null">
and a.id = #{param.id}
</if>
<if test="param.deptNo != null and param.deptNo.trim() != ''">
and a.DEPT_NO = #{param.deptNo}
</if>
......@@ -246,6 +292,24 @@
<if test="param.isAdress != null and param.isAdress.trim() != ''">
and a.IS_ADRESS = #{param.isAdress}
</if>
<if test="param.paymentStatus != null and param.paymentStatus.trim() != ''">
and a.PAYMENT_STATUS = #{param.paymentStatus}
</if>
<if test="param.paymentTimeStart != null and param.paymentTimeStart.trim() != '' ">
and a.PAYMENT_TIME <![CDATA[ >= ]]> #{param.paymentTimeStart}
</if>
<if test="param.paymentTimeEnd != null and param.paymentTimeEnd.trim() != ''">
and a.PAYMENT_TIME <![CDATA[ <= ]]> #{param.paymentTimeEnd}
</if>
<if test="param.isJfcd != null and param.isJfcd.trim() != ''">
and a.IS_JFCD = #{param.isJfcd}
</if>
<if test="param.estimatePremiumStart != null">
and a.ESTIMATE_PREMIUM <![CDATA[ >= ]]> #{param.estimatePremiumStart}
</if>
<if test="param.estimatePremiumEnd != null">
and a.ESTIMATE_PREMIUM <![CDATA[ <= ]]> #{param.estimatePremiumEnd}
</if>
<if test="param.authSql != null and param.authSql.trim() != ''">
${param.authSql}
</if>
......@@ -371,7 +435,7 @@
a.REFUND_ID as refundId,
a.EXPIRE_REMARK,
a.EXPIRE_IGNORE_FLAG,
a.IS_ADRESS as isAdress
a.IS_ADRESS as isAdress,PAYMENT_STATUS,PAYMENT_TIME,IS_JFCD,PURCHASE_CYCLE,PRE_HANDLE_TIME
from t_insurance_detail a
left join t_insurance_settle tis on a.DEFAULT_SETTLE_ID = tis.ID
where a.ID = #{id}
......@@ -1539,7 +1603,7 @@
EMP_IDCARD_NO
FROM t_insurance_detail d
where DELETE_FLAG = 0
and (d.BUY_HANDLE_STATUS in (1,2) or (d.BUY_HANDLE_STATUS = 3 and d.IS_EFFECT = 0
and (d.BUY_HANDLE_STATUS in (1,2,6) or (d.BUY_HANDLE_STATUS = 3 and d.IS_EFFECT = 0
and d.POLICY_EFFECT <![CDATA[ <= ]]> DATE_FORMAT(DATE_ADD(NOW(),INTERVAL 1 DAY),'%Y-%m-%d') and d.POLICY_END >= DATE_FORMAT(NOW(),'%Y-%m-%d')
))
......
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