修改套餐状态

This commit is contained in:
wuweihua
2026-09-20 10:29:10 +08:00
parent 24435e4113
commit cc5f1cf5de
15 changed files with 96 additions and 61 deletions
@@ -59,7 +59,7 @@ public class BmsCustomerPriceSet extends BaseEntity
/** 计价类型 FIXED=固定价 DISCOUNT=折扣 */
private String setType;
/** 套餐状态 D草稿 A审核中 E生效 R驳回 S停用 */
/** Package status D=pending-enable A=audit E=effective R=reject S=stopped */
private String priceSetStatus;
/** 套餐生效日期 */
@@ -26,7 +26,7 @@ public class BmsPriceSetOption
/** 计价类型 FIXED=固定价 DISCOUNT=折扣 */
private String setType;
/** 套餐状态 D草稿 A审核中 E生效 R驳回 S停用 */
/** Package status D=pending-enable A=audit E=effective R=reject S=stopped */
private String status;
/** 生效日期 */
@@ -34,6 +34,9 @@ public interface IPrcPriceSetService
public int disable(Long priceSetId, String updateBy);
/** Re-enable a stopped package (S -> E). */
public int enable(Long priceSetId, String updateBy);
/**
* Activate a draft or reschedule a pending version with user-specified effectiveTime.
* effectiveTime <= now -> EFFECT; future -> PENDING(3). Then refresh 0/3/1/2.
@@ -49,6 +49,7 @@ import com.ruoyi.price.task.PrcPriceSetSaveAsyncRunner;
@Service
public class PrcPriceSetServiceImpl implements IPrcPriceSetService
{
/** Package status: D pending-enable / A audit / E effective / R reject / S stopped */
private static final String STATUS_DRAFT = "D";
private static final String STATUS_AUDIT = "A";
private static final String STATUS_EFFECT = "E";
@@ -271,6 +272,23 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
return setMapper.updatePrcPriceSetStatus(upd);
}
@Override
public int enable(Long priceSetId, String updateBy)
{
PrcPriceSet db = requireSet(priceSetId);
if (STATUS_EFFECT.equals(db.getStatus()))
{
throw new ServiceException(MessageUtils.message("price.set.enable.statusNotAllowed"));
}
PrcPriceSet upd = new PrcPriceSet();
upd.setPriceSetId(priceSetId);
upd.setStatus(STATUS_EFFECT);
upd.setUpdateBy(updateBy);
int rows = setMapper.updatePrcPriceSetStatus(upd);
refreshVersionStatus(priceSetId);
return rows;
}
@Override
@Transactional
public int activateVersion(Long psvId, Date effectiveTime, String updateBy)
@@ -272,7 +272,7 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
for (PrcCustomerPriceSet bind : binds)
{
PrcPriceSet set = priceSetMapper.selectPrcPriceSetById(bind.getPriceSetId());
if (set == null || "S".equals(set.getStatus()))
if (set == null || !"E".equals(set.getStatus()))
{
continue;
}