修改套餐状态

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;
}
@@ -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>