Commit e469f7b5 authored by huyuchen's avatar huyuchen

huych-商险到期提醒修改

parent a157af80
package com.yifu.cloud.plus.v1.ekp.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
/**
* @author huyc
* @description 入账明细推送接口配置
* @date 2024-08-26 08:57:02
*/
@RefreshScope
@ConfigurationProperties(prefix = "entry")
@Data
public class EkpEntryProperties {
String entryUrl;
String entryFdModelId;
String entryDocStatus;
String entryLoginName;
String entryDocSubject;
}
......@@ -36,7 +36,9 @@ import java.util.stream.Collectors;
@Log4j2
@Service
@RequiredArgsConstructor
public class EkpSalaryInfoServiceImpl extends ServiceImpl<EkpSalaryInfoMapper, EkpSalaryInfo> implements EkpSalaryInfoService {
public class
EkpSalaryInfoServiceImpl extends ServiceImpl<EkpSalaryInfoMapper, EkpSalaryInfo> implements EkpSalaryInfoService {
/**
//@Description: 工资明细推送至ekp
......
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.ekp.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.icbc.api.DefaultIcbcClient;
import com.icbc.api.IcbcApiException;
import com.icbc.api.IcbcConstants;
......@@ -15,6 +16,7 @@ import com.icbc.api.response.JftApiPayB2bpayGenpreorderResponseV1;
import com.icbc.api.response.MybankEnterpriseAccountQuerybankinfoResponseV1;
import com.icbc.api.response.MybankEnterpriseTradeQhisdResponseV1;
import com.icbc.api.utils.IcbcSignature;
import com.yifu.cloud.plus.v1.ekp.config.EkpEntryProperties;
import com.yifu.cloud.plus.v1.ekp.config.IcbcConfigProperties;
import com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo;
import com.yifu.cloud.plus.v1.ekp.mapper.EkpSocialInfoMapper;
......@@ -22,12 +24,18 @@ import com.yifu.cloud.plus.v1.ekp.service.IcbcTransactionFlowQueryService;
import com.yifu.cloud.plus.v1.ekp.vo.EKPEntryPushParam;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.net.URL;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
......@@ -43,12 +51,15 @@ import java.util.stream.Collectors;
@Log4j2
@Service
@RequiredArgsConstructor
@EnableConfigurationProperties(IcbcConfigProperties.class)
@EnableConfigurationProperties({IcbcConfigProperties.class, EkpEntryProperties.class})
public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialInfoMapper, EkpSocialInfo> implements IcbcTransactionFlowQueryService {
@Autowired
private IcbcConfigProperties icbcConfigProperties;
@Autowired
private EkpEntryProperties ekpEntryProperties;
public R getIcbcTransactionFlow() {
// //应用id 应用方私钥 网关公钥 应用方加密串
// String APP_ID = "11000000000000028685";
......@@ -119,20 +130,22 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
// String ca_sm_path = "D:/icbcFile/ahwx.y.1302.cer";
// String ca_sm_icbc_path = "D:/icbcFile/API_GATEWAY_ICBC_SM_REAL.cer";
String ca_sm_path = "/file/ahwx.y.1302.cer";
String ca_sm_icbc_path = "/file/API_GATEWAY_ICBC_SM_REAL.cer";
String ca_sm = IcbcSignature.getCAInfoStr(ca_sm_path);
String ca_sm_icbc = IcbcSignature.getCAInfoStr(ca_sm_icbc_path);
URL resource = IcbcTransactionFlowQueryServiceImpl.class.getClassLoader().getResource("ahwx.y.1302.cer");
URL resource1 = IcbcTransactionFlowQueryServiceImpl.class.getClassLoader().getResource("API_GATEWAY_ICBC_SM_REAL.cer");
// String ca_sm_path = "/file/ahwx.y.1302.cer";
// String ca_sm_icbc_path = "/file/API_GATEWAY_ICBC_SM_REAL.cer";
String ca_sm = IcbcSignature.getCAInfoStr(resource.getPath());
String ca_sm_icbc = IcbcSignature.getCAInfoStr(resource1.getPath());
log.error("文件地址:" + resource.getPath() + "转化后的编码" + ca_sm);
// DefaultIcbcClient(appid, 签名类型, SM2企业私钥, 编码格式, 数据格式, null, null, null, SM2 cer公钥串, null)
DefaultIcbcClient client = new DefaultIcbcClient(icbcConfigProperties.getAppId(), IcbcConstants.SIGN_TYPE_CA_SM_ICBC,
icbcConfigProperties.getAppPrivateKey(), IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, null,
null, null, ca_sm, null);
client.setIcbc_ca(ca_sm_icbc);
MybankEnterpriseTradeQhisdRequestV1.MybankEnterpriseTradeQhisdRequestBizV1 bizContent = new MybankEnterpriseTradeQhisdRequestV1.MybankEnterpriseTradeQhisdRequestBizV1();
MybankEnterpriseTradeQhisdRequestV1.MybankEnterpriseTradeQhisdRequestBizV1 bizContent =
new MybankEnterpriseTradeQhisdRequestV1.MybankEnterpriseTradeQhisdRequestBizV1();
MybankEnterpriseTradeQhisdRequestV1 request = new MybankEnterpriseTradeQhisdRequestV1();
// 获取当前时间
LocalTime currentTime = LocalTime.now();
......@@ -141,6 +154,7 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
String formattedTime = currentTime.format(formatter);
bizContent.setTranDate(DateUtil.getThisDay());
bizContent.setTranTime(formattedTime);
log.error("formattedTime:" + formattedTime);
bizContent.setTransCode("QHISD");
bizContent.setLanguage("zh_CN");
String fSeqNo = "AHWX" + System.currentTimeMillis();
......@@ -150,9 +164,8 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
bizContent.setDrcrf("2");
request.setServiceUrl(icbcConfigProperties.getServerUrl());
request.setBizContent(bizContent);
System.out.println("request: " + JSON.toJSONString(request));
MybankEnterpriseTradeQhisdResponseV1 response = client.execute(request);
System.out.println("response: " + JSON.toJSONString(response));
log.error("response:" + JSON.toJSONString(response));
if(!response.isSuccess()) {
//查询当天的所有入账记录数据
List<String> serioList = baseMapper.getAllserioNo();
......@@ -168,52 +181,48 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
for (MybankEnterpriseTradeQhisdResponseV1.MybankEnterpriseTradeQhisdResponseRdV1 entry : insertList) {
EKPEntryPushParam pushParam = new EKPEntryPushParam();
initValue(entry,pushParam,bankName,bankNo);
sendToEkp(pushParam);
}
}
}
}
return R.ok();
}
// //推送数据
// public String sendToEkp(EKPEntryPushParam pushParam){
// RestTemplate yourRestTemplate = new RestTemplate();
// try{
// String formValues = new ObjectMapper().writeValueAsString(pushParam);
// //指向EKP的接口url
// //把ModelingAppModelParameterAddForm转换成MultiValueMap
// MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
// wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceDocSubject());
// wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
// wholeForm.add("docStatus", ekpInsuranceProperties.getInsuranceDocStatus());
// wholeForm.add("fdModelId", ekpInsuranceProperties.getInsuranceFdModelId());
// wholeForm.add("fdFlowId", ekpInsuranceProperties.getInsuranceFdFlowId());
// wholeForm.add("formValues", formValues);
// HttpHeaders headers = new HttpHeaders();
// //如果EKP对该接口启用了Basic认证,那么客户端需要加入
// //addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
// headers.setContentType(MediaType.MULTIPART_FORM_DATA);
// //必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
// HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers);
// //有返回值的情况 VO可以替换成具体的JavaBean
// log.info("推送EKP开始,formValues:"+formValues);
// ResponseEntity<String> obj = yourRestTemplate.exchange(ekpInsuranceProperties.getInsuranceUrl(), HttpMethod.POST, entity, String.class);
// String body = obj.getBody();
// if (StringUtils.isBlank(body)){
// log.error("交易失败:"+obj);
// return null;
// }else{
// log.info("交易成功:"+obj);
// return body;
// }
// }catch (Exception e){
// log.error("交易失败:", e);
// return null;
// }
// }
//推送数据
public String sendToEkp(EKPEntryPushParam pushParam){
RestTemplate yourRestTemplate = new RestTemplate();
try{
String formValues = new ObjectMapper().writeValueAsString(pushParam);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject",ekpEntryProperties.getEntryDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("fdModelId", ekpEntryProperties.getEntryFdModelId());
wholeForm.add("formValues", formValues);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<>(wholeForm,headers);
//有返回值的情况 VO可以替换成具体的JavaBean
log.info("入账明细推送EKP开始,formValues:"+formValues);
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpEntryProperties.getEntryUrl(), HttpMethod.POST, entity, String.class);
String body = obj.getBody();
if (StringUtils.isBlank(body)){
log.error("入账明细交易失败:"+obj);
return null;
}else{
log.info("入账明细交易成功:"+obj);
return body;
}
}catch (Exception e){
log.error("入账明细交易失败:", e);
return null;
}
}
public R querybankinfo() {
String ca_sm_path = "D:/icbcFile/ahwx.y.1302.cer";
......
......@@ -61,4 +61,10 @@ security:
urls:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
\ No newline at end of file
- /swagger-ui/**
entry:
entryUrl: http://36.7.147.29:27007/api/hro/modelingWebservice/addModel
entryFdModelId: 18050b5cee8b79c234bf64d412294f23
entryLoginName: admin
entryDocSubject: 入账明细推送ekp接口
\ No newline at end of file
......@@ -103,4 +103,10 @@ security:
urls:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
\ No newline at end of file
- /swagger-ui/**
entry:
entryUrl: http://36.7.147.29:27007/api/sys-modeling/appModelRestService/addModel
entryFdModelId: 18050b5cee8b79c234bf64d412294f23
entryLoginName: admin
entryDocSubject: 入账明细推送ekp接口
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* @author licancan
* @description 商险明细表 t_insurance_detail
* @date 2022-07-18 16:20:16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_insurance_alert")
@Schema(description = "商险到期提醒表")
public class TInsuranceAlert extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 投保岗位
*/
@Schema(description = "投保岗位")
private String post;
/**
* 保险公司名称(冗余字段)
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 医疗额度
*/
@Schema(description = "医疗额度")
private String medicalQuota;
/**
* 身故或残疾额度
*/
@Schema(description = "身故或残疾额度")
private String dieDisableQuota;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
private LocalDate policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
private LocalDate policyEnd;
/**
* 保单生效日期
*/
@Schema(description = "保单生效日期")
private LocalDate policyEffect;
/**
* 结算月
*/
@Schema(description = "结算月")
private String settleMonth;
/**
* 发票号
*/
@Schema(description = "发票号")
private String invoiceNo;
/**
* 商险购买地省
*/
@Schema(description = "商险购买地省")
private String insuranceProvinceName;
/**
* 商险购买地市
*/
@Schema(description = "商险购买地市")
private String insuranceCityName;
/**
* 商险办理省
*/
@Schema(description = "商险办理省")
private String insuranceHandleProvinceName;
/**
* 商险办理城市
*/
@Schema(description = "商险办理城市")
private String insuranceHandleCityName;
/**
* 结算类型 (0、与薪资合并结算 1、单独结算)
*/
@Schema(description = "结算类型 (0、与薪资合并结算 1、单独结算)")
private Integer settleType;
/**
* 实际保费
*/
@Schema(description = "实际保费")
private BigDecimal actualPremium;
/**
* 预估保费
*/
@Schema(description = "预估保费")
private BigDecimal estimatePremium;
/**
* 是否过期 0未过期 1已过期
*/
@Schema(description = "是否过期 0未过期 1已过期")
private Integer isOverdue;
@Schema(description = "是否有效 0有效 1无效")
private Integer isEffect;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 是否删除 0未删除/1删除
*/
@Schema(description = "是否删除 0否/1是")
private Integer deleteFlag;
/**
* 创建人所在部门名称
*/
@Schema(description = "创建人所在部门名称")
private String createUserDeptName;
@Schema(description = "项目名称")
private String deptName;
@Schema(description ="客户名称")
private String unitName;
@Schema(description ="客户编码")
private String unitNo;
/**
* 忽略提醒 0:忽略 1:不忽略
*/
@Schema(description = "有忽略提醒 0:忽略 1:不忽略")
private String expireIgnoreFlag;
/**
* 消息提醒备注
*/
@Schema(description = "消息提醒备注")
private String expireRemark;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -101,11 +101,11 @@ public class InsuranceWarnExportVo implements Serializable {
@Schema(name = "实际保费")
private BigDecimal actualPremium;
/**
* 创建
* 派单申请
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "创建人")
@Schema(name = "创建人")
@ExcelProperty(value = "派单申请人")
@Schema(name = "派单申请人")
private String createName;
/**
......@@ -250,8 +250,8 @@ public class InsuranceWarnExportVo implements Serializable {
* 是否过期状态 0 未过期 1已过期。主要用于页面查询展示
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "是否过期")
@Schema(name = "是否过期")
@ExcelProperty(value = "到期状态")
@Schema(name = "到期状态")
private String isOverdue;
/**
......@@ -311,4 +311,8 @@ public class InsuranceWarnExportVo implements Serializable {
@ExcelProperty(value = "消息提醒备注")
private String expireRemark;
@HeadFontStyle(fontHeightInPoints = 11)
@Schema(description = "是否忽略 0:忽略 1:不忽略")
@ExcelProperty(value = "是否忽略")
private String expireIgnoreFlag;
}
......@@ -358,7 +358,6 @@ public class TBusinessInsuranceVo implements Serializable {
@Schema(name = "创建人ID")
private String createBy;
/**
* 忽略提醒 0:忽略 1:不忽略
*/
......
......@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceDetailService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceWarnService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceSearchVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TBusinessInsuranceVo;
import io.swagger.v3.oas.annotations.Operation;
......@@ -34,6 +36,10 @@ import java.util.List;
public class TInsurancesWarnController {
@Resource
private TInsuranceDetailService insuranceDetailService;
@Resource
private TInsuranceWarnService insuranceWarnService;
/**
* @Author fxj
* @Description 商险到期提醒分页查询
......@@ -120,4 +126,11 @@ public class TInsurancesWarnController {
public R<Integer> getExpireInsuranceWarn() {
return insuranceDetailService.getExpireInsuranceWarn();
}
@Operation(description = "每天刷新商险到期提醒信息")
@PostMapping("/innner/createInsuranceAlert")
@Inner
public void createInsuranceAlert() {
insuranceWarnService.createInsuranceAlert();
}
}
......@@ -303,13 +303,15 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
IPage<TBusinessInsuranceVo> getInsuranceExpireWarnVoPage(Page<TBusinessInsuranceVo> page,
@Param("param")InsuranceSearchVo param,
@Param("domains")List<String> domains);
List<TBusinessInsuranceVo> pageDiy(@Param("param")InsuranceSearchVo searchVo,
@Param("domains")List<String> idList);
List<TBusinessInsuranceVo> pageDiy(@Param("param")InsuranceSearchVo searchVo);
List<InsuranceWarnExportVo> noPageDiy(@Param("param")InsuranceSearchVo searchVo,
@Param("domains")List<String> idList);
List<InsuranceWarnExportVo> noPageDiy(@Param("param")InsuranceSearchVo searchVo);
int noPageCountDiy(@Param("param")InsuranceSearchVo searchVo, @Param("domains")List<String> idList);
int noPageCountDiy(@Param("param")InsuranceSearchVo searchVo);
void batchexpireIgnore(@Param("idList")List<String> idList);
void batchexpireAlertIgnore(@Param("idList")List<String> idList);
void updateExpireAlert(@Param("id") String id,@Param("expireFlag") String expireFlag,@Param("remark") String remark);
}
package com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceAlert;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author huych
* @description 针对表【t_insurance_alert(商险到期提醒表)】的数据库操作Mapper
* @date 2024-08-26 14:20:16
*/
@Mapper
public interface TInsuranceWarnMapper extends BaseMapper<TInsuranceAlert> {
/**
* 查询商险到期提醒信息
*
* @author huych
* @return {@link List < TInsuranceAlert >}
*/
List<TInsuranceAlert> selectInsuranceAlert();
}
package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceAlert;
/**
* @author huych
* @description 针对表【t_insurance_alert(商险到期提醒表)】的数据库操作Service
* @date 2024-08-26 14:20:16
*/
public interface TInsuranceWarnService extends IService<TInsuranceAlert> {
void createInsuranceAlert();
}
......@@ -7684,23 +7684,27 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override
public IPage<TBusinessInsuranceVo> getInsuranceExpireWarnVoPage(Page<TBusinessInsuranceVo> page, InsuranceSearchVo condition) {
YifuUser user = SecurityUtils.getUser();
condition.setCreateBy(SecurityUtils.getUser().getId());
R<TSettleDomainListVo> sdRes = archivesDaprUtil.getPermissionByUserId(user.getId());
List<TInsuranceAreaRes> areaRes = insuranceAreaResMapper.selectList(Wrappers.<TInsuranceAreaRes>query().lambda()
.eq(TInsuranceAreaRes::getUserId, user.getId()).eq(TInsuranceAreaRes::getStatus, CommonConstants.ZERO_STRING));
if (Common.isNotNull(areaRes)) {
List<String> provinces = new ArrayList<>();
List<String> citys = new ArrayList<>();
for (TInsuranceAreaRes res : areaRes) {
if (Common.isEmpty(res.getCity())) {
provinces.add(res.getProvince());
} else {
citys.add(res.getCity());
}
}
condition.setInsuranceProvinces(provinces);
condition.setInsuranceCitys(citys);
}
if ("许瑞玲".equals(user.getNickname()) || "1".equals(user.getId())) {
condition.setCreateBy(null);
} else {
condition.setCreateBy(user.getId());
}
// R<TSettleDomainListVo> sdRes = archivesDaprUtil.getPermissionByUserId(user.getId());
// List<TInsuranceAreaRes> areaRes = insuranceAreaResMapper.selectList(Wrappers.<TInsuranceAreaRes>query().lambda()
// .eq(TInsuranceAreaRes::getUserId, user.getId()).eq(TInsuranceAreaRes::getStatus, CommonConstants.ZERO_STRING));
// if (Common.isNotNull(areaRes)) {
// List<String> provinces = new ArrayList<>();
// List<String> citys = new ArrayList<>();
// for (TInsuranceAreaRes res : areaRes) {
// if (Common.isEmpty(res.getCity())) {
// provinces.add(res.getProvince());
// } else {
// citys.add(res.getCity());
// }
// }
// condition.setInsuranceProvinces(provinces);
// condition.setInsuranceCitys(citys);
// }
IPage<TBusinessInsuranceVo> recordsPage = new Page<>();
int limitStart = (int)(page.getCurrent()-1)*(int)page.getSize();
int limitEnd = (int)page.getSize();
......@@ -7710,13 +7714,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
recordsPage.setPages(page.getPages());
recordsPage.setSize(page.getSize());
recordsPage.setCurrent(page.getCurrent());
if (Common.isNotNull(sdRes) && Common.isNotNull(sdRes.getData()) && Common.isNotNull(sdRes.getData().getDeptIds())) {
recordsPage.setTotal(baseMapper.noPageCountDiy(condition,sdRes.getData().getDeptIds()));
recordsPage.setRecords(baseMapper.pageDiy(condition, sdRes.getData().getDeptIds()));
}else {
recordsPage.setTotal(baseMapper.noPageCountDiy(condition,null));
recordsPage.setRecords(baseMapper.pageDiy(condition, null));
}
recordsPage.setTotal(baseMapper.noPageCountDiy(condition));
recordsPage.setRecords(baseMapper.pageDiy(condition));
return recordsPage;
}
......@@ -7726,6 +7725,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
baseMapper.batchexpireIgnore(ids);
//更新商险到期提醒表
baseMapper.batchexpireAlertIgnore(ids);
return R.ok();
}
......@@ -7814,6 +7815,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
entity.setExpireIgnoreFlag(CommonConstants.ZERO_STRING);
baseMapper.updateById(entity);
baseMapper.updateExpireAlert(entity.getId(),CommonConstants.ZERO_STRING,null);
return R.ok();
}
private void remarkBatchAdd(List<InsurancesWarnUpdateVo> businessInsuranceVoList,List<ErrorMessage> errorMessages) {
......@@ -7908,6 +7910,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setExpireIgnoreFlag(expireIgnoreFlag);
detail.setExpireRemark(vo.getExpireRemark());
this.updateById(detail);
baseMapper.updateExpireAlert(detail.getId(),expireIgnoreFlag,vo.getExpireRemark());
errorMessages.add(new ErrorMessage(line + 2, CommonConstants.UPDATE_SUCCESS));
} catch (Exception e) {
log.error("商险批量备注执行异常", e);
......@@ -7989,17 +7992,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
entity.setExpireRemark(vo.getExpireRemark());
baseMapper.updateById(entity);
baseMapper.updateExpireAlert(vo.getId(),null,vo.getExpireRemark());
return R.ok();
}
private List<InsuranceWarnExportVo> noPageDiy(InsuranceSearchVo searchVo) {
List<String> domainIds = getExportCondition(searchVo);
return baseMapper.noPageDiy(searchVo,domainIds);
// List<String> domainIds = getExportCondition(searchVo);
return baseMapper.noPageDiy(searchVo);
}
private int noPageCountDiy(InsuranceSearchVo searchVo) {
List<String> domainIds = getExportCondition(searchVo);
return baseMapper.noPageCountDiy(searchVo,domainIds);
// List<String> domainIds = getExportCondition(searchVo);
return baseMapper.noPageCountDiy(searchVo);
}
private List<String> getExportCondition(InsuranceSearchVo searchVo) {
......@@ -8029,7 +8033,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override
public R<Integer> getExpireInsuranceWarn() {
InsuranceSearchVo searchVo = new InsuranceSearchVo();
List<String> domainIds = getExportCondition(searchVo);
return R.ok(baseMapper.noPageCountDiy(searchVo,domainIds));
// List<String> domainIds = getExportCondition(searchVo);
return R.ok(baseMapper.noPageCountDiy(searchVo));
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceAlert;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceWarnMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceWarnService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author huych
* @description 针对表【t_insurance_alert(商险到期提醒表)】的数据库操作Service实现
* @date 2024-08-26 14:20:16
*/
@Service
public class TInsuranceWarnServiceImpl extends ServiceImpl<TInsuranceWarnMapper, TInsuranceAlert> implements TInsuranceWarnService {
@Override
public void createInsuranceAlert() {
//批量生成或者更新商险到期提醒数据
List<TInsuranceAlert> list = baseMapper.selectInsuranceAlert();
this.saveOrUpdateBatch(list);
}
}
......@@ -1695,7 +1695,8 @@
rf.CREATE_TIME as "refundCreateTime",
rf.CREATE_NAME as "refundCreateUser",
a.CREATE_USER_DEPT_NAME,
a.EXPIRE_REMARK
a.EXPIRE_REMARK,
a.EXPIRE_IGNORE_FLAG
</sql>
<sql id="expire_export_sql_param">
select
......@@ -1734,19 +1735,21 @@
r.fromEmpName,
r.toEmpName,
r.REPLACE_TIME as "toReplaceTime",
case when a.IS_OVERDUE = 0 then "未过期"
when a.IS_OVERDUE = 1 then "过期"
case when a.IS_OVERDUE = 0 then "期"
when a.IS_OVERDUE = 1 then "过期"
else null end as "IS_OVERDUE" ,
a.ESTIMATE_PREMIUM,
rf.REFUND_MONEY,
rf.CREATE_TIME as "refundCreateTime",
rf.CREATE_NAME as "refundCreateUser",
a.CREATE_USER_DEPT_NAME,
a.EXPIRE_REMARK
a.EXPIRE_REMARK,
case when a.EXPIRE_IGNORE_FLAG = 0 then "是"
when a.EXPIRE_IGNORE_FLAG = 1 then "否"
else null end as "EXPIRE_IGNORE_FLAG"
</sql>
<sql id="expire_sql_where">
<where>
<if test="param != null">
<if test="param.empName != null and param.empName.trim() != ''">
AND a.EMP_NAME like CONCAT('%' , #{param.empName},'%')
......@@ -1760,6 +1763,18 @@
<if test="param.insuranceHandleCityName != null and param.insuranceHandleCityName.trim() != ''">
AND a.INSURANCE_HANDLE_CITY_NAME like CONCAT(#{param.insuranceHandleCityName},'%')
</if>
<if test="param.createName != null and param.createName.trim() != ''">
AND a.CREATE_NAME = #{param.createName}
</if>
<if test="param.expireIgnoreFlag != null and param.expireIgnoreFlag.trim() != ''">
AND a.EXPIRE_IGNORE_FLAG = #{param.expireIgnoreFlag}
</if>
<if test="param.isOverdue != null and param.isOverdue.trim() != ''">
AND a.IS_OVERDUE = #{param.isOverdue}
</if>
<if test="param.createBy != null and param.createBy.trim() != ''">
and a.CREATE_BY = #{param.createBy}
</if>
<if test="param.idList != null and param.idList.size() > 0">
and a.id in
<foreach collection="param.idList" item="param" index="index" open="(" close=")"
......@@ -1771,7 +1786,7 @@
</where>
</sql>
<select id="getInsuranceExpireWarnVoPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.TBusinessInsuranceVo">
<select id="getInsuranceExpireWarnVoPageHistory" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.TBusinessInsuranceVo">
<include refid="expire_sql_param"/>,a.INSURANCE_HANDLE_CITY_NAME
from
(select * from
......@@ -1830,7 +1845,20 @@
<include refid="expire_sql_where"/>
order by a.CREATE_TIME desc
</select>
<select id="pageDiy" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.TBusinessInsuranceVo">
<select id="getInsuranceExpireWarnVoPage" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.TBusinessInsuranceVo">
<include refid="expire_sql_param"/>
,a.INSURANCE_HANDLE_CITY_NAME
from
t_insurance_alert a
LEFT JOIN view_insurance_replace r on a.id=r.TO_INSURANCE_DETAIL_ID
LEFT JOIN view_insurance_replace r2 on a.id=r2.FROM_INSURANCE_DETAIL_ID
LEFT JOIN t_insurance_refund rf on rf.INS_DETAIL_ID=a.id
<include refid="expire_sql_where"/>
order by a.CREATE_TIME desc
</select>
<select id="pageDiyHistory" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.TBusinessInsuranceVo">
<include refid="expire_sql_param"/>,a.INSURANCE_HANDLE_CITY_NAME
from
(select * from (select * from t_insurance_detail a
......@@ -1890,126 +1918,49 @@
LEFT JOIN view_insurance_replace r2 on a.id=r2.FROM_INSURANCE_DETAIL_ID
LEFT JOIN t_insurance_refund rf on rf.INS_DETAIL_ID=a.id
</select>
<select id="noPageDiy" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceWarnExportVo">
<include refid="expire_export_sql_param"/>,a.INSURANCE_HANDLE_CITY_NAME
from
(select * from (select * from t_insurance_detail a
where
<!-- info.AUDIT_STATUS='0' and t.STATUS = 5 状态 0.待提交 1.待办理 2.已提交保险公司 3.已办理 4.办理失败 5:待结算(已输入保单号)-->
<!--一个月内的,没有再续买商险的数据-->
a.BUY_HANDLE_STATUS ='3'
and a.EXPIRE_IGNORE_FLAG='1'
and (
date_add(curdate() - day(curdate()) + 1, interval 3 month) >
a.POLICY_END
)
<if test="param != null">
<if test="param.insuranceProvinces == null and param.insuranceCitys == null and domains == null">
and a.CREATE_BY = #{param.createBy}
</if>
and (1 = 2
<if test="param.insuranceProvinces != null">
<if test="param.insuranceProvinces.size() > 0">
or a.INSURANCE_HANDLE_PROVINCE in
<foreach collection="param.insuranceProvinces" item="param" index="index" open="(" close=")"
separator=",">
#{param}
</foreach>
</if>
</if>
<if test="param.insuranceCitys != null">
<if test="param.insuranceCitys.size() > 0">
or a.INSURANCE_HANDLE_CITY in
<foreach collection="param.insuranceCitys" item="param" index="index" open="(" close=")"
separator=",">
#{param}
</foreach>
</if>
</if>
<!--数据权限判断-->
or a.CREATE_BY = #{param.createBy}
<if test="domains != null">
<if test="domains.size() > 0">
or a.DEPT_ID in
<foreach collection="domains" item="param" index="index" open="(" close=")" separator=",">
#{param}
</foreach>
</if>
</if>
)
</if>
) a
<select id="pageDiy" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.TBusinessInsuranceVo">
<include refid="expire_sql_param"/>
,a.INSURANCE_HANDLE_CITY_NAME
from
t_insurance_alert a
LEFT JOIN view_insurance_replace r on a.id=r.TO_INSURANCE_DETAIL_ID
LEFT JOIN view_insurance_replace r2 on a.id=r2.FROM_INSURANCE_DETAIL_ID
LEFT JOIN t_insurance_refund rf on rf.INS_DETAIL_ID=a.id
<include refid="expire_sql_where"/>
order by a.CREATE_TIME desc
<if test="param != null and param.limitStart != null">
limit #{param.limitStart},#{param.limitEnd}
</if>
)a
</select>
<select id="noPageDiy" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceWarnExportVo">
<include refid="expire_export_sql_param"/>
,a.INSURANCE_HANDLE_CITY_NAME
from
t_insurance_alert a
<include refid="expire_sql_where"/>
LEFT JOIN view_insurance_replace r on a.id=r.TO_INSURANCE_DETAIL_ID
LEFT JOIN view_insurance_replace r2 on a.id=r2.FROM_INSURANCE_DETAIL_ID
LEFT JOIN t_insurance_refund rf on rf.INS_DETAIL_ID=a.id
group by a.id
order by a.CREATE_TIME desc
<if test="param != null and param.limitStart != null">
limit #{param.limitStart},#{param.limitEnd}
</if>
</select>
<select id="noPageCountDiy" resultType="java.lang.Integer">
select
count(1)
from (select * from t_insurance_detail a
where
<!-- info.AUDIT_STATUS='0' and t.STATUS = 5 状态 0.待提交 1.待办理 2.已提交保险公司 3.已办理 4.办理失败 5:待结算(已输入保单号)-->
<!--一个月内的,没有再续买商险的数据-->
a.BUY_HANDLE_STATUS ='3'
and a.EXPIRE_IGNORE_FLAG='1'
and (
date_add(curdate() - day(curdate()) + 1, interval 3 month) >
a.POLICY_END
)
<if test="param != null">
<if test="param.insuranceProvinces == null and param.insuranceCitys == null and domains == null">
and a.CREATE_BY = #{param.createBy}
</if>
and (1 = 2
<if test="param.insuranceProvinces != null">
<if test="param.insuranceProvinces.size() > 0">
or a.INSURANCE_HANDLE_PROVINCE in
<foreach collection="param.insuranceProvinces" item="param" index="index" open="(" close=")"
separator=",">
#{param}
</foreach>
</if>
</if>
<if test="param.insuranceCitys != null">
<if test="param.insuranceCitys.size() > 0">
or a.INSURANCE_HANDLE_CITY in
<foreach collection="param.insuranceCitys" item="param" index="index" open="(" close=")"
separator=",">
#{param}
</foreach>
</if>
</if>
<!--数据权限判断-->
or a.CREATE_BY = #{param.createBy}
<if test="domains != null">
<if test="domains.size() > 0">
or a.DEPT_ID in
<foreach collection="domains" item="param" index="index" open="(" close=")" separator=",">
#{param}
</foreach>
</if>
</if>
)
</if>
) a
<!--LEFT JOIN view_insurance_replace r on a.id=r.TO_INSURANCE_DETAIL_ID
LEFT JOIN view_insurance_replace r2 on a.id=r2.FROM_INSURANCE_DETAIL_ID
LEFT JOIN t_insurance_refund rf on rf.INS_DETAIL_ID=a.id-->
from
t_insurance_alert a
<include refid="expire_sql_where"/>
</select>
<update id="batchexpireIgnore">
<if test="idList != null and idList.size() > 0">
update t_insurance_detail a
update t_insurance_detail a
set a.EXPIRE_IGNORE_FLAG = '0'
where
a.id in
......@@ -2019,6 +1970,27 @@
</if>
</update>
<update id="batchexpireAlertIgnore">
<if test="idList != null and idList.size() > 0">
update t_insurance_alert a
set a.EXPIRE_IGNORE_FLAG = '0'
where
a.id in
<foreach collection="idList" item="param" index="index" open="(" close=")" separator=",">
#{param}
</foreach>
</if>
</update>
<update id="updateExpireAlert">
update t_insurance_alert
<trim prefix="set" suffixOverrides=",">
<if test="expireFlag != null">EXPIRE_IGNORE_FLAG=#{expireFlag},</if>
<if test="remark != null">EXPIRE_REMARK=#{remark},</if>
</trim>
where id = #{id}
</update>
<select id="selectPushList" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail">
SELECT
*
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceWarnMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceAlert">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="empName" column="EMP_NAME" jdbcType="VARCHAR"/>
<result property="empIdcardNo" column="EMP_IDCARD_NO" jdbcType="VARCHAR"/>
<result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/>
<result property="post" column="POST" jdbcType="VARCHAR"/>
<result property="insuranceCompanyName" column="INSURANCE_COMPANY_NAME" jdbcType="VARCHAR"/>
<result property="insuranceTypeName" column="INSURANCE_TYPE_NAME" jdbcType="VARCHAR"/>
<result property="buyStandard" column="BUY_STANDARD" jdbcType="VARCHAR"/>
<result property="medicalQuota" column="MEDICAL_QUOTA" jdbcType="VARCHAR"/>
<result property="dieDisableQuota" column="DIE_DISABLE_QUOTA" jdbcType="VARCHAR"/>
<result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/>
<result property="policyStart" column="POLICY_START" jdbcType="DATE"/>
<result property="policyEnd" column="POLICY_END" jdbcType="DATE"/>
<result property="policyEffect" column="POLICY_EFFECT" jdbcType="DATE"/>
<result property="settleMonth" column="SETTLE_MONTH" jdbcType="VARCHAR"/>
<result property="invoiceNo" column="INVOICE_NO" jdbcType="VARCHAR"/>
<result property="insuranceProvinceName" column="INSURANCE_PROVINCE_NAME" jdbcType="VARCHAR"/>
<result property="insuranceCityName" column="INSURANCE_CITY_NAME" jdbcType="VARCHAR"/>
<result property="insuranceHandleProvinceName" column="INSURANCE_HANDLE_PROVINCE_NAME" jdbcType="VARCHAR"/>
<result property="insuranceHandleCityName" column="INSURANCE_HANDLE_CITY_NAME" jdbcType="VARCHAR"/>
<result property="settleType" column="SETTLE_TYPE" jdbcType="TINYINT"/>
<result property="actualPremium" column="ACTUAL_PREMIUM" jdbcType="DECIMAL"/>
<result property="estimatePremium" column="ESTIMATE_PREMIUM" jdbcType="DECIMAL"/>
<result property="isEffect" column="IS_EFFECT" jdbcType="TINYINT"/>
<result property="isOverdue" column="IS_OVERDUE" jdbcType="TINYINT"/>
<result property="remark" column="REMARK" jdbcType="VARCHAR"/>
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
<result property="createName" column="CREATE_NAME" jdbcType="VARCHAR"/>
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
<result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
<result property="deleteFlag" column="DELETE_FLAG" jdbcType="TINYINT"/>
<result property="createUserDeptName" column="CREATE_USER_DEPT_NAME" jdbcType="VARCHAR"/>
<result property="deptName" column="DEPT_NAME" jdbcType="VARCHAR"/>
<result property="unitName" column="UNIT_NAME" jdbcType="VARCHAR"/>
<result property="unitNo" column="UNIT_NO" jdbcType="VARCHAR"/>
<result property="expireIgnoreFlag" column="EXPIRE_IGNORE_FLAG" jdbcType="VARCHAR"/>
<result property="expireRemark" column="EXPIRE_REMARK" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectInsuranceAlert" resultMap="BaseResultMap">
SELECT
a.ID,
a.EMP_NAME,
a.EMP_IDCARD_NO,
a.DEPT_NO,
a.POST,
a.INSURANCE_COMPANY_NAME,
a.INSURANCE_TYPE_NAME,
a.INSURANCE_CITY_NAME,
a.INSURANCE_HANDLE_CITY_NAME,
a.INSURANCE_HANDLE_PROVINCE_NAME,
a.INSURANCE_PROVINCE_NAME,
a.BUY_STANDARD,
a.UNIT_NAME,
a.UNIT_NO,
a.SETTLE_TYPE,
a.POLICY_EFFECT,
a.EXPIRE_REMARK,
a.EXPIRE_IGNORE_FLAG,
a.SETTLE_MONTH,
a.POLICY_START,
a.POLICY_END,
a.ACTUAL_PREMIUM,
a.ESTIMATE_PREMIUM,
a.INVOICE_NO,
a.MEDICAL_QUOTA,
a.DIE_DISABLE_QUOTA,
a.DEPT_ID,
a.POLICY_NO,
if(a.POLICY_END >= curdate(),0,1) IS_OVERDUE,
a.REMARK,
a.CREATE_BY,
a.DELETE_FLAG,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME,
a.IS_EFFECT,
a.CREATE_USER_DEPT_NAME
FROM
t_insurance_detail a
WHERE
a.id IN (
SELECT
h.id
FROM
(
SELECT
b.ID,
max( b.POLICY_END ) endTime
FROM
t_insurance_detail b
WHERE
b.POLICY_START >= date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND b.IS_EFFECT = 0
AND NOT EXISTS (
SELECT
1
FROM
t_insurance_detail ea
WHERE
ea.POLICY_START >= date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND ea.IS_EFFECT = 0
AND ea.POLICY_END >= date_add( curdate(), INTERVAL 1 MONTH )
AND ea.EMP_IDCARD_NO = b.EMP_IDCARD_NO
)
GROUP BY
b.EMP_IDCARD_NO,
b.INSURANCE_COMPANY_NAME,
b.INSURANCE_TYPE_NAME
) h
INNER JOIN t_insurance_detail l ON h.id = l.id
AND h.endTime = l.POLICY_END
WHERE
l.EXPIRE_IGNORE_FLAG = '1'
)
</select>
</mapper>
......@@ -59,4 +59,17 @@ public class UpdateOverdueTask {
HttpDaprUtil.invokeMethodPost(daprInsurancesProperties.getAppUrl(),daprInsurancesProperties.getAppId(),"/insuranceDetail/inner/pushActualPremium","", Void.class, SecurityConstants.FROM_IN);
log.info("------------推送商险待结算数据-定时任务结束------------");
}
/**
* 每天刷新商险到期提醒信息
* @author huych
* @param
* @return void
*/
public void everyDayCreateInsuranceAlert() {
log.info("-------------每天刷新商险到期提醒信息------------");
HttpDaprUtil.invokeMethodPost(daprInsurancesProperties.getAppUrl(), daprInsurancesProperties.getAppId(),
"/insuranceWarn/inner/createInsuranceAlert","", Void.class, SecurityConstants.FROM_IN);
log.info("-------------每天刷新商险到期提醒信息-定时任务开始------------");
}
}
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