修改删除逻辑

This commit is contained in:
wuweihua
2026-11-09 13:39:14 +08:00
parent 92cb19fbea
commit b8bbf36767
5 changed files with 22 additions and 7 deletions
@@ -134,4 +134,7 @@ public interface PrcOrderBillMapper
@Param("surchargeAmount") BigDecimal surchargeAmount,
@Param("incomeTotal") BigDecimal incomeTotal,
@Param("payTotal") BigDecimal payTotal);
/** Count order bills that reference this sales package version. */
int countByPsvId(@Param("psvId") Long psvId);
}
@@ -40,6 +40,7 @@ import com.bms.price.domain.PrcSurchargeRel;
import com.bms.price.mapper.BmsProductCountryMapper;
import com.bms.price.mapper.BmsProductMapper;
import com.bms.price.mapper.PrcCustomerPriceSetMapper;
import com.bms.price.mapper.PrcOrderBillMapper;
import com.bms.price.mapper.PrcPriceSetDetailMapper;
import com.bms.price.mapper.PrcPriceSetMapper;
import com.bms.price.mapper.PrcPriceSetProductMapper;
@@ -141,6 +142,9 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
@Autowired
private IBmsCustomerService bmsCustomerService;
@Autowired
private PrcOrderBillMapper orderBillMapper;
@Override
public PrcPriceSet selectPrcPriceSetById(Long priceSetId)
{
@@ -626,7 +630,7 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
{
throw new ServiceException(MessageUtils.message("price.set.version.notExists"));
}
// Draft / pending: hard delete; EFFECT: soft delete then reopen previous via refreshVersionStatus
// Draft / pending / effect may be deleted; expired stays view-only.
if (!VER_DRAFT.equals(version.getStatus())
&& !VER_PENDING.equals(version.getStatus())
&& !VER_EFFECT.equals(version.getStatus()))
@@ -634,9 +638,13 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
throw new ServiceException(MessageUtils.message("price.set.version.delete.statusNotAllowed"));
}
requireSet(version.getPriceSetId());
wipeVersionChildren(psvId, version.getStatus());
// Products / details / surcharge always physical delete.
surchargeRelMapper.physicalDeleteByPsvId(psvId);
detailMapper.physicalDeleteByPsvId(psvId);
setProductMapper.physicalDeleteByPsvId(psvId);
// Version: soft-delete when any order bill references psv_id; otherwise hard-delete.
int rows;
if (VER_EFFECT.equals(version.getStatus()))
if (orderBillMapper.countByPsvId(psvId) > 0)
{
rows = versionMapper.softDeleteById(psvId, updateBy);
}
@@ -1070,4 +1070,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_time = sysdate()
where bill_id = #{billId}
</update>
<select id="countByPsvId" resultType="int">
select count(1) from prc_order_bill where psv_id = #{psvId}
</select>
</mapper>
@@ -448,8 +448,8 @@ function onCreateVersion() {
function onRemoveVersion(row) {
if (!row || row.psvId == null) return
const msg = isEffectVersion(row)
? "确认软删除已生效版本(生效时间:" + (row.effectiveTime || '未设置') + ")?版本及产品、明细将标记为已删除,上一版将自动恢复生效并清空失效时间。"
: "确认删除" + (isPendingVersion(row) ? "待生效" : "草稿") + "版本(生效时间:" + (row.effectiveTime || '未设置') + ")?其明细与附加费将一并删除。"
? "确认删除该版本(生效时间:" + (row.effectiveTime || '未设置') + ")?若订单已引用该版本则仅软删版本记录;若无订单引用则整版本硬删。产品与明细均会物理删除,且上一版将自动恢复生效。"
: "确认删除" + (isPendingVersion(row) ? "待生效" : "草稿") + "版本(生效时间:" + (row.effectiveTime || '未设置') + ")?若订单已引用该版本则仅软删版本记录;若无订单引用则整版本硬删。产品与明细均会物理删除。"
proxy.$modal.confirm(msg).then(() => {
removingPsvId.value = row.psvId
proxy.$modal.loading("正在删除,请稍候...")
+2 -2
View File
@@ -465,8 +465,8 @@ function onCreateVersion() {
function onRemoveVersion(row) {
if (!row || row.psvId == null) return
const msg = isEffectVersion(row)
? "确认软删除已生效版本(生效时间:" + (row.effectiveTime || '未设置') + ")?版本及产品、明细将标记为已删除,上一版将自动恢复生效并清空失效时间。"
: "确认删除" + (isPendingVersion(row) ? "待生效" : "草稿") + "版本(生效时间:" + (row.effectiveTime || '未设置') + ")?其明细与附加费将一并删除。"
? "确认删除该版本(生效时间:" + (row.effectiveTime || '未设置') + ")?若订单已引用该版本则仅软删版本记录;若无订单引用则整版本硬删。产品与明细均会物理删除,且上一版将自动恢复生效。"
: "确认删除" + (isPendingVersion(row) ? "待生效" : "草稿") + "版本(生效时间:" + (row.effectiveTime || '未设置') + ")?若订单已引用该版本则仅软删版本记录;若无订单引用则整版本硬删。产品与明细均会物理删除。"
proxy.$modal.confirm(msg).then(() => {
removingPsvId.value = row.psvId
proxy.$modal.loading("正在删除,请稍候...")