修改套餐状态

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
@@ -152,15 +152,23 @@ public class PriceSetController extends BaseController
}
@PreAuthorize("@ss.hasPermi('price:set:audit')")
@Log(title = "价格套餐停用", businessType = BusinessType.UPDATE)
@Log(title = "Price set disable", businessType = BusinessType.UPDATE)
@PutMapping("/disable/{priceSetId}")
public AjaxResult disable(@PathVariable Long priceSetId)
{
return toAjax(priceSetService.disable(priceSetId, getUsername()));
}
@PreAuthorize("@ss.hasPermi('price:set:audit')")
@Log(title = "Price set enable", businessType = BusinessType.UPDATE)
@PutMapping("/enable/{priceSetId}")
public AjaxResult enable(@PathVariable Long priceSetId)
{
return toAjax(priceSetService.enable(priceSetId, getUsername()));
}
@PreAuthorize("@ss.hasPermi('price:set:add')")
@Log(title = "价格套餐复用", businessType = BusinessType.INSERT)
@Log(title = "Price set copy", businessType = BusinessType.INSERT)
@PostMapping("/copy/{priceSetId}")
public AjaxResult copy(@PathVariable Long priceSetId)
{
@@ -54,12 +54,13 @@ price.set.name.exists=套餐名称已存在
price.set.effectiveDate.empty=生效日期不能为空
price.set.date.invalid=生效日期不能晚于失效日期
price.set.discount.range=折扣模式默认折扣需在 1~99
price.set.delete.statusNotAllowed=仅草稿或驳回状态的套餐允许删除:{0}
price.set.delete.statusNotAllowed=仅待启用或驳回状态的套餐允许删除:{0}
price.set.delete.boundCustomer=套餐【{0}】已绑定客户,请先解绑后再删除
price.set.submit.statusNotAllowed=当前状态不允许提交审核
price.set.approve.statusNotAllowed=仅审核中的套餐可以生效
price.set.reject.statusNotAllowed=仅审核中的套餐可以驳回
price.set.disable.statusNotAllowed=仅生效中的套餐可以停用
price.set.disable.statusNotAllowed=仅生效中的套餐可停用
price.set.enable.statusNotAllowed=套餐已是生效状态
price.set.edit.audit=审核中的套餐不允许修改
price.set.edit.stopped=已停用的套餐不允许修改,请使用复用新建
price.set.childEdit.audit=审核中的套餐不允许改明细或客户
@@ -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;
}
@@ -13,8 +13,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="defaultDiscount" column="default_discount" />
<result property="defaultType" column="default_type" />
<result property="calculateSign" column="calculate_sign" />
<result property="effectiveDate" column="effective_date" />
<result property="expireDate" column="expire_date" />
<result property="status" column="status" />
<result property="tmsId" column="tms_id" />
<result property="createBy" column="created_by" />
@@ -28,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPrcPriceSetVo">
select s.price_set_id, s.price_set_code, s.price_set_name, s.price_set_note,
s.set_type, s.default_discount, s.default_type, s.calculate_sign,
s.effective_date, s.expire_date, s.status, s.tms_id,
s.status, s.tms_id,
s.created_by, s.create_time, s.updated_by, s.update_time,
(select count(distinct d.product_code) from prc_price_set_detail d where d.price_set_id = s.price_set_id) as product_count,
(select count(1) from prc_customer_price_set c where c.price_set_id = s.price_set_id) as customer_count
@@ -93,8 +91,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="defaultDiscount != null">default_discount,</if>
<if test="defaultType != null">default_type,</if>
<if test="calculateSign != null">calculate_sign,</if>
<if test="effectiveDate != null">effective_date,</if>
<if test="expireDate != null">expire_date,</if>
<if test="status != null and status != ''">status,</if>
<if test="tmsId != null">tms_id,</if>
<if test="createBy != null and createBy != ''">created_by,</if>
@@ -107,8 +103,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="defaultDiscount != null">#{defaultDiscount},</if>
<if test="defaultType != null">#{defaultType},</if>
<if test="calculateSign != null">#{calculateSign},</if>
<if test="effectiveDate != null">#{effectiveDate},</if>
<if test="expireDate != null">#{expireDate},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="tmsId != null">#{tmsId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
@@ -126,8 +120,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
default_discount = #{defaultDiscount},
<if test="defaultType != null">default_type = #{defaultType},</if>
<if test="calculateSign != null">calculate_sign = #{calculateSign},</if>
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
expire_date = #{expireDate},
<if test="status != null and status != ''">status = #{status},</if>
<if test="tmsId != null">tms_id = #{tmsId},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
@@ -140,7 +132,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update prc_price_set
<set>
status = #{status},
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
update_time = sysdate()
</set>