修改产品功能

This commit is contained in:
wuweihua
2026-09-28 16:26:55 +08:00
parent 32ab61b51c
commit 623df69d4b
12 changed files with 217 additions and 93 deletions
@@ -39,4 +39,6 @@ public class BmsProduct extends BaseEntity
private List<BmsProductCountry> countries;
/** query alias of status (0/1/2) */
private String effectStatus;
/** query: active = status in (0,1); expired = status 2 */
private String statusGroup;
}
@@ -24,11 +24,6 @@ public class PrcPriceSet extends BaseEntity
private BigDecimal defaultDiscount;
private String defaultType;
private String calculateSign;
/**
* Pull-only: product base price version_no (V1/V2 from bms_product_price_version).
* Not a DB column — used when pullFromLibrary=Y to choose library rows.
*/
private String baseVersionNo;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date effectiveDate;
@JsonFormat(pattern = "yyyy-MM-dd")
@@ -1830,21 +1830,22 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
detailMapper.deletePrcPriceSetDetailByPsvId(version.getPsvId());
// clean legacy rows without psv_id under this set (would look like duplicates in UI)
detailMapper.deleteOrphanDetailsByPriceSetId(set.getPriceSetId());
String baseVersionNo = set.getBaseVersionNo();
if (StringUtils.isEmpty(baseVersionNo))
{
throw new ServiceException(MessageUtils.message("price.set.baseVersionNo.empty"));
}
int inserted;
if (TYPE_DISCOUNT.equals(set.getSetType()))
{
inserted = detailMapper.insertDiscountDetailsFromLibrary(
set.getPriceSetId(), version.getPsvId(), baseVersionNo);
set.getPriceSetId(), version.getPsvId(), null);
}
else
{
// Prefer currently effective open country rows; fallback asOf window if needed
inserted = detailMapper.insertFixedDetailsFromLibrary(
set.getPriceSetId(), version.getPsvId(), null, false, baseVersionNo);
set.getPriceSetId(), version.getPsvId(), null, true, null);
if (inserted <= 0)
{
inserted = detailMapper.insertFixedDetailsFromLibrary(
set.getPriceSetId(), version.getPsvId(), new Date(), false, null);
}
}
if (inserted <= 0)
{
@@ -96,6 +96,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="effectStatus != null and effectStatus != ''">
AND p.status = #{effectStatus}
</if>
<if test="statusGroup != null and statusGroup == 'active'">
AND p.status in ('0', '1')
</if>
<if test="statusGroup != null and statusGroup == 'expired'">
AND p.status = '2'
<if test="params != null and params.beginTime != null and params.beginTime != ''">
AND p.expire_date &gt;= #{params.beginTime}
</if>
<if test="params != null and params.endTime != null and params.endTime != ''">
AND p.expire_date &lt;= #{params.endTime}
</if>
</if>
<if test="cargoAttr != null and cargoAttr != ''">
AND p.cargo_attr like concat('%', #{cargoAttr}, '%')
</if>
@@ -104,7 +116,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
OR p.product_name like concat('%', #{params.keyword}, '%'))
</if>
</where>
order by p.product_code asc, p.effective_date desc, p.product_id desc
<choose>
<when test="statusGroup != null and statusGroup == 'expired'">
order by p.expire_date desc, p.product_code asc, p.product_id desc
</when>
<otherwise>
order by p.product_code asc, p.effective_date desc, p.product_id desc
</otherwise>
</choose>
</select>
<insert id="insertBmsProduct" parameterType="BmsProduct" useGeneratedKeys="true" keyProperty="productId">
@@ -171,6 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ifnull(c.status, '1') &lt;&gt; '2'
<choose>
<when test="openOnly">
and (c.effective_date is null or date(c.effective_date) &lt;= curdate())
and (c.expire_date is null or date(c.expire_date) &gt; curdate())
</when>
<otherwise>