Commit cd56d289 authored by fangxinjiang's avatar fangxinjiang

fix(项目配置删除): 按状态清除续签待办并保留临期提醒

删除项目配置时仅清理口径内续签待办,不再删除提醒表;合同侧将同口径提醒 AUTO_FLAG 置 1 以退出续签待办列表。
Co-authored-by: 's avatarCursor <cursoragent@cursor.com>
parent 8ff34eaf
...@@ -73,14 +73,14 @@ public interface TEmpContractAlertMapper extends BaseMapper<TEmpContractAlert> { ...@@ -73,14 +73,14 @@ public interface TEmpContractAlertMapper extends BaseMapper<TEmpContractAlert> {
@Param("processStatusList") List<String> processStatusList); @Param("processStatusList") List<String> processStatusList);
/** /**
* 项目配置删除:清除口径内合同续签办理数据 * 项目配置删除:口径内提醒置为非自动化(保留 t_emp_contract_alert,不进续签待办列表)
*/ */
int deleteContractPreNewForProjectConfigRemove(@Param("deptNo") String deptNo, int disableAutoFlagForProjectConfigRemove(@Param("deptNo") String deptNo,
@Param("processStatusList") List<String> processStatusList); @Param("processStatusList") List<String> processStatusList);
/** /**
* 项目配置删除:清除口径内合同续签提醒 * 项目配置删除:清除口径内合同续签办理数据(pre_new,不删 t_emp_contract_alert)
*/ */
int deleteContractAlertForProjectConfigRemove(@Param("deptNo") String deptNo, int deleteContractPreNewForProjectConfigRemove(@Param("deptNo") String deptNo,
@Param("processStatusList") List<String> processStatusList); @Param("processStatusList") List<String> processStatusList);
} }
...@@ -2653,11 +2653,14 @@ private R<Boolean> checkItemRepeat(List<SysAutoDictItem> autoDictItems, Map<Stri ...@@ -2653,11 +2653,14 @@ private R<Boolean> checkItemRepeat(List<SysAutoDictItem> autoDictItems, Map<Stri
return R.failed("清除商险续签待办失败:" + (insuranceClearRes != null ? insuranceClearRes.getMsg() : "")); return R.failed("清除商险续签待办失败:" + (insuranceClearRes != null ? insuranceClearRes.getMsg() : ""));
} }
// 续签待办按状态清除:先删 pre_new,再将同口径提醒 AUTO_FLAG 置 1(保留提醒、不进续签待办列表)
List<String> contractClearStatus = AutoMainRelDeleteTodoStatus.CONTRACT_PROCESS_STATUS;
int contractPreDeleted = empContractAlertMapper.deleteContractPreNewForProjectConfigRemove( int contractPreDeleted = empContractAlertMapper.deleteContractPreNewForProjectConfigRemove(
deptNo, AutoMainRelDeleteTodoStatus.CONTRACT_PROCESS_STATUS); deptNo, contractClearStatus);
int contractAlertDeleted = empContractAlertMapper.deleteContractAlertForProjectConfigRemove( int contractAlertDisabled = empContractAlertMapper.disableAutoFlagForProjectConfigRemove(
deptNo, AutoMainRelDeleteTodoStatus.CONTRACT_PROCESS_STATUS); deptNo, contractClearStatus);
log.info("清除合同续签待办,deptNo={}, preNew={}, alert={}", deptNo, contractPreDeleted, contractAlertDeleted); log.info("清除合同续签待办,deptNo={}, preNew={}, alertAutoFlagDisabled={}",
deptNo, contractPreDeleted, contractAlertDisabled);
cascadeDeleteConfig(mainRel); cascadeDeleteConfig(mainRel);
return R.ok(true); return R.ok(true);
......
...@@ -483,23 +483,24 @@ ...@@ -483,23 +483,24 @@
</foreach> </foreach>
</select> </select>
<delete id="deleteContractPreNewForProjectConfigRemove"> <update id="disableAutoFlagForProjectConfigRemove">
DELETE b FROM t_employee_contract_pre_new b UPDATE t_emp_contract_alert a
INNER JOIN t_emp_contract_alert a ON a.CONTRACT_ID = b.contract_id LEFT JOIN t_employee_contract_pre_new b ON a.CONTRACT_ID = b.contract_id
SET a.AUTO_FLAG = '1'
WHERE a.PROJECT_NO = #{deptNo} WHERE a.PROJECT_NO = #{deptNo}
AND a.AUTO_FLAG = '0' AND a.AUTO_FLAG = '0'
AND b.PROCESS_STATUS IN AND IFNULL(b.PROCESS_STATUS, '0') IN
<foreach collection="processStatusList" item="item" open="(" separator="," close=")"> <foreach collection="processStatusList" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</delete> </update>
<delete id="deleteContractAlertForProjectConfigRemove"> <delete id="deleteContractPreNewForProjectConfigRemove">
DELETE a FROM t_emp_contract_alert a DELETE b FROM t_employee_contract_pre_new b
LEFT JOIN t_employee_contract_pre_new b ON a.CONTRACT_ID = b.contract_id INNER JOIN t_emp_contract_alert a ON a.CONTRACT_ID = b.contract_id
WHERE a.PROJECT_NO = #{deptNo} WHERE a.PROJECT_NO = #{deptNo}
AND a.AUTO_FLAG = '0' AND a.AUTO_FLAG = '0'
AND IFNULL(b.PROCESS_STATUS, '0') IN AND b.PROCESS_STATUS IN
<foreach collection="processStatusList" item="item" open="(" separator="," close=")"> <foreach collection="processStatusList" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
......
...@@ -66,10 +66,9 @@ public interface TInsuranceWarnMapper extends BaseMapper<TInsuranceAlert> { ...@@ -66,10 +66,9 @@ public interface TInsuranceWarnMapper extends BaseMapper<TInsuranceAlert> {
int countRenewTodoByDeptNo(@Param("deptNo") String deptNo, int countRenewTodoByDeptNo(@Param("deptNo") String deptNo,
@Param("processStatusList") List<String> processStatusList); @Param("processStatusList") List<String> processStatusList);
int deleteRenewDetailByDeptNo(@Param("deptNo") String deptNo, int clearRenewDetailLinkByDeptNo(@Param("deptNo") String deptNo);
@Param("processStatusList") List<String> processStatusList);
int deleteAlertForRenewTodoByDeptNo(@Param("deptNo") String deptNo, int deleteRenewDetailByDeptNo(@Param("deptNo") String deptNo,
@Param("processStatusList") List<String> processStatusList); @Param("processStatusList") List<String> processStatusList);
} }
...@@ -825,7 +825,8 @@ public class TInsuranceWarnServiceImpl extends ServiceImpl<TInsuranceWarnMapper, ...@@ -825,7 +825,8 @@ public class TInsuranceWarnServiceImpl extends ServiceImpl<TInsuranceWarnMapper,
if (Common.isEmpty(deptNo)) { if (Common.isEmpty(deptNo)) {
return; return;
} }
// 先删续签待办,再清空提醒表上的待办关联(保留 t_insurance_alert)
baseMapper.deleteRenewDetailByDeptNo(deptNo, AutoMainRelDeleteTodoStatus.INSURANCE_PROCESS_STATUS); baseMapper.deleteRenewDetailByDeptNo(deptNo, AutoMainRelDeleteTodoStatus.INSURANCE_PROCESS_STATUS);
baseMapper.deleteAlertForRenewTodoByDeptNo(deptNo, AutoMainRelDeleteTodoStatus.INSURANCE_PROCESS_STATUS); baseMapper.clearRenewDetailLinkByDeptNo(deptNo);
} }
} }
\ No newline at end of file
...@@ -796,17 +796,26 @@ ...@@ -796,17 +796,26 @@
<include refid="renewTodoByDeptNoWhere"/> <include refid="renewTodoByDeptNoWhere"/>
</select> </select>
<!-- 删除待办后,解除提醒表上已失效的待办关联(不删提醒行) -->
<update id="clearRenewDetailLinkByDeptNo">
UPDATE t_insurance_alert a
SET a.INSURANCES_PRE_RENEW_DETAIL_ID = NULL
WHERE a.DEPT_NO = #{deptNo}
AND a.EXPIRE_IGNORE_FLAG = '1'
AND a.DELETE_FLAG = 0
AND a.IS_OVERDUE = 0
AND (a.REPLACE_TAG IS NULL OR a.REPLACE_TAG != '可替换')
AND a.INSURANCES_PRE_RENEW_DETAIL_ID IS NOT NULL
AND NOT EXISTS (
SELECT 1 FROM t_insurance_pre_renew_detail b
WHERE b.ID = a.INSURANCES_PRE_RENEW_DETAIL_ID
)
</update>
<delete id="deleteRenewDetailByDeptNo"> <delete id="deleteRenewDetailByDeptNo">
DELETE b FROM t_insurance_pre_renew_detail b DELETE b FROM t_insurance_pre_renew_detail b
INNER JOIN t_insurance_alert a ON a.INSURANCES_PRE_RENEW_DETAIL_ID = b.ID INNER JOIN t_insurance_alert a ON a.INSURANCES_PRE_RENEW_DETAIL_ID = b.ID
WHERE WHERE
<include refid="renewTodoByDeptNoWhere"/> <include refid="renewTodoByDeptNoWhere"/>
</delete> </delete>
<delete id="deleteAlertForRenewTodoByDeptNo">
DELETE a FROM t_insurance_alert a
INNER JOIN t_insurance_pre_renew_detail b ON a.INSURANCES_PRE_RENEW_DETAIL_ID = b.ID
WHERE
<include refid="renewTodoByDeptNoWhere"/>
</delete>
</mapper> </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