Commit c4485f32 authored by fangxinjiang's avatar fangxinjiang

商险 提醒

parent 34902cf2
......@@ -72,14 +72,14 @@ public class TInsuranceAreaRes extends BaseEntity {
@NotBlank(message = "档案-省不能为空")
@ExcelProperty("档案-省")
@Schema(description = "档案-省")
private Integer province;
private String province;
/**
* 档案-市
*/
@ExcelAttribute(name = "档案-市",isArea = true,parentField = "province")
@ExcelProperty("档案-市")
@Schema(description = "档案-市")
private Integer city;
private String city;
/**
......
......@@ -52,7 +52,7 @@ public class TInsurancesWarnController {
@Operation(description = "商险到期提醒分页查询")
@GetMapping("/getExpireWarn/Vopage")
public R<IPage<TBusinessInsuranceVo>> getTBusinessInsuranceExpireWarnVoPage(Page<TBusinessInsuranceVo> page, TBusinessInsuranceVo tBusinessInsurance) {
return insuranceDetailService.getInsuranceExpireWarnVoPage(page, tBusinessInsurance);
return R.ok(insuranceDetailService.getInsuranceExpireWarnVoPage(page, tBusinessInsurance));
}
/**
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceRefund;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
......@@ -276,4 +277,12 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
**/
List<InsuranceUpdateVO> selectByIds(@Param("ids") List<String> ids);
/**
* @Author fxj
* @Description 商险提醒分页查询
* @Date 16:33 2023/2/20
**/
IPage<TBusinessInsuranceVo> getInsuranceExpireWarnVoPage(Page<TBusinessInsuranceVo> page,
@Param("param")TBusinessInsuranceVo param,
@Param("domains")List<TSettleDomainSelectVo> domains);
}
......@@ -510,7 +510,7 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
**/
void updateSettleStatus();
R<IPage<TBusinessInsuranceVo>> getInsuranceExpireWarnVoPage(Page<TBusinessInsuranceVo> page, TBusinessInsuranceVo tBusinessInsurance);
IPage<TBusinessInsuranceVo> getInsuranceExpireWarnVoPage(Page<TBusinessInsuranceVo> page, TBusinessInsuranceVo tBusinessInsurance);
R<List<WorkBanchWarnVo>> getExpireInsuranceWarn(Integer expireInsuranceWarnNameUrlFlag, Integer noBuyInsuranceWarnNameUrlFlag, Integer noSettleInsuranceWarnNameUrlFlag, Boolean haveAllOrg, Integer userId);
......
......@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.*;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceAreaResMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TUpdateStatusErrorMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceAreaResService;
......@@ -127,6 +128,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private TInsuranceAreaResService tInsuranceAreaResService;
@Resource
private TUpdateStatusErrorMapper updateStatusErrorMapper;
@Resource
private TInsuranceAreaResMapper insuranceAreaResMapper;
/***********************商险办理********************************/
/**
* 每日定时刷新商险到期数据
......@@ -7393,8 +7396,31 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @Date 16:51 2023/2/16
**/
@Override
public R<IPage<TBusinessInsuranceVo>> getInsuranceExpireWarnVoPage(Page<TBusinessInsuranceVo> page, TBusinessInsuranceVo tBusinessInsurance) {
return null;
public IPage<TBusinessInsuranceVo> getInsuranceExpireWarnVoPage(Page<TBusinessInsuranceVo> page, TBusinessInsuranceVo condition) {
YifuUser user = SecurityUtils.getUser();
if (!SecurityUtils.isHaveAllOrg(null, user)) {
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.setBusinessInsuranceProvId(provinces);
condition.setBusinessInsuranceAddrId(citys);
}
condition.setCreateUserId(SecurityUtils.getUser().getId());
if (Common.isNotNull(sdRes) && Common.isNotNull(sdRes.getData())){
return baseMapper.getInsuranceExpireWarnVoPage(page, condition, sdRes.getData().getListSelectVO());
}
}
return baseMapper.getInsuranceExpireWarnVoPage(page, condition, null);
}
@Override
......
......@@ -1467,4 +1467,127 @@
</if>
ORDER BY refund.CREATE_TIME DESC,a.ID ASC
</select>
<sql id="selectParamsVo">
t.ID id,
t.EMP_ID empId,
t.EMP_NO empNo,
t.EMP_NAME empName,
t.EMP_IDCARD_NO empIdcardNo,
t.INSURANCE_COMPANY insuranceCompany,
t.INSURANCE_TYPE insuranceType,
t.POLICY_START policyStart,
t.POLICY_END policyEnd,
t.BUY_PAY buyPay,
t.IS_AT_SALARY isAtSalary,
t.REMARK,
t.CREATE_USER createUser,
t.CREATE_TIME createTime,
t.STATUS,
t.POLICY_NO policyNo,
t.MEDICAL_MONEY medicalMoney,
t.DEATH_DISABILITY_MONEY deathDisabilityMoney,
t.SETTLEMENT_DEPART settlementDepart,
t.SETTLEMENT_ORGAN settlementOrgan,
t.REPLACE_DATE replaceDate,
t.REPLACE_STATUS replaceStatus,
t.BUSINESS_INSURANCE_ADDR businessInsuranceAddr,
t.SETTLE_TYPE settleType,
t.BUY_STANDARD buyStandard,
t.BATCH_DATE batchDate,
t.IS_NOTICE isNotice,
t.SETTLE_MONTH settleMonth,
t.INVOICE_NO invoiceNo,
t.BUY_TYPE buyType,
t.LAST_UPDATE_USER lastUpdateUser,
t.LAST_UPDATE_TIME lastUpdateTime,
t.OLD_ID oldId,
t.SETTLEMENT_FORM_ID settlementFormId,
t.IS_SUBMIT,
t.CUSTOMER_NAME customerName,
t.CUSTOMER_ID customerId,
t.SETTLEMENT_ORGAN_NAME settlementOrganName,
t.SETTLEMENT_ORGAN_NO settlementOrganNo,
t.SETTLE_FORM_TYPE settleFormType,
t.POLICY_EFFECT policyEffect,
t.SETTLE_FORM_ID settleFormId,
p.NAME insuranceTypeName,
tic.COMPANY_NAME insuranceCompanyName,
t.BUSINESS_INSURANCE_PROV_ID businessInsuranceProvId,
t.BUSINESS_INSURANCE_ADDR_ID businessInsuranceAddrId,
t.BUSINESS_INSURANCE_PROV businessInsuranceProv,t.VALID_FLAG validFlag,
t.FORECAST_BUY_PAY,
t.SETTLE_BUY_PAY_TYPE
,case when t.POLICY_END &lt; date(now()) then '1' else 0 end 'expireFlag',
t.post,
t.BUY_MONTH,
t.REFUND_RECORD_ID,
t.REFUND_MONEY,
t.REFUND_CREATE_TIME,
t.REFUND_CREATE_USER,
t.USER_DEPT_NAME
</sql>
<sql id="expire_sql_param">
SELECT
re.TO_EMP_NAME 'toEmpName',tir.FROM_EMP_NAME 'fromEmpName' ,tir.CREATE_TIME 'fromReplaceTime',re.CREATE_TIME 'toReplaceTime',
<include refid="selectParamsVo"/>
,EXPIRE_REMARK expireRemark,EXPIRE_IGNORE_FLAG expireIgnoreFlag
FROM t_insurance_detail t
JOIN (SELECT max(POLICY_END) POLICY_END, EMP_IDCARD_NO,BUY_STANDARD, INSURANCE_TYPE
FROM t_business_insurance
WHERE INVALID_FLAG = '0'
<!-- 状态 3.已办理 5:待结算(已输入保单号)6:已结算 7: 结算中(工资、社保)8:扫描出账中 9 -->
AND STATUS in('3','5','6','7','8','9')
GROUP BY EMP_IDCARD_NO,BUY_STANDARD, INSURANCE_TYPE) cig
ON t.EMP_IDCARD_NO = cig.EMP_IDCARD_NO AND t.POLICY_END = cig.POLICY_END AND t.BUY_STANDARD = cig.BUY_STANDARD and
t.INSURANCE_TYPE = cig.INSURANCE_TYPE
join t_insurance_company tic on t.INSURANCE_COMPANY = tic.ID
join t_insurance_type p on t.INSURANCE_TYPE=p.ID
left join t_insurance_replace tir on t.ID = tir.INSURANCE_ID
LEFT JOIN (select l.* from t_insurance_replace l left join t_business_insurance tbi on l.TO_INSURANCE_ID = tbi.ID where tbi.invalid_Flag='0' and STATUS!=4 ) re ON t.id= re.INSURANCE_ID
</sql>
<sql id="expire_sql_where">
<where>
<!-- info.AUDIT_STATUS='0' and t.STATUS = 5 状态 0.待提交 1.待办理 2.已提交保险公司 3.已办理 4.办理失败 5:待结算(已输入保单号)-->
AND t.INVALID_FLAG='0' <!--未作废-->
<!--一个月内的,没有再续买商险的数据-->
and t.STATUS in('3','5','6','7','8','9')
and EXPIRE_IGNORE_FLAG='1'
and (
date_add(curdate() - day(curdate()) + 1, interval 3 month) >
t.POLICY_END
)
and t.VALID_FLAG='0'
<if test="param.empName != null and param.empName.trim() != ''">
AND t.EMP_NAME like CONCAT('%' , #{param.empName},'%')
</if>
<if test="param.empIdcardNo != null and param.empIdcardNo.trim() != ''">
AND t.EMP_IDCARD_NO like CONCAT('%' ,#{param.empIdcardNo},'%')
</if>
<!--数据权限判断-->
AND (t.CREATE_USER_ID = #{param.createUserId}
<if test="domains != null">
<if test="domains.size() > 0">
or t.SETTLEMENT_ORGAN in
<foreach collection="domains" item="param" index="index" open="(" close=")" separator=",">
#{param.id}
</foreach>
</if>
</if>
<if test="domains == null">
or 1=1
</if>
)
</where>
order by t.CREATE_TIME desc
</sql>
<select id="getInsuranceExpireWarnVoPage"
resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.TBusinessInsuranceVo">
<include refid="expire_sql_param"/>
<include refid="expire_sql_where"/>
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment