提交设置套餐
This commit is contained in:
@@ -25,6 +25,8 @@ public class PrcPriceSetDetail implements Serializable
|
||||
private Long zdId;
|
||||
private Long wsdId;
|
||||
private String weightLabel;
|
||||
/** 关联 bms_product_country.detail_id */
|
||||
private Long productCountryId;
|
||||
private BigDecimal fvValue;
|
||||
private BigDecimal fvRegistrationFee;
|
||||
private BigDecimal discountValue;
|
||||
@@ -52,6 +54,8 @@ public class PrcPriceSetDetail implements Serializable
|
||||
public void setWsdId(Long wsdId) { this.wsdId = wsdId; }
|
||||
public String getWeightLabel() { return weightLabel; }
|
||||
public void setWeightLabel(String weightLabel) { this.weightLabel = weightLabel; }
|
||||
public Long getProductCountryId() { return productCountryId; }
|
||||
public void setProductCountryId(Long productCountryId) { this.productCountryId = productCountryId; }
|
||||
public BigDecimal getFvValue() { return fvValue; }
|
||||
public void setFvValue(BigDecimal fvValue) { this.fvValue = fvValue; }
|
||||
public BigDecimal getFvRegistrationFee() { return fvRegistrationFee; }
|
||||
@@ -74,6 +78,7 @@ public class PrcPriceSetDetail implements Serializable
|
||||
.append("productCode", getProductCode())
|
||||
.append("countryCode", getCountryCode())
|
||||
.append("wsdId", getWsdId())
|
||||
.append("productCountryId", getProductCountryId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
+69
@@ -12,10 +12,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.price.domain.BmsProductCountry;
|
||||
import com.ruoyi.price.domain.PrcCustomerPriceSet;
|
||||
import com.ruoyi.price.domain.PrcPriceSet;
|
||||
import com.ruoyi.price.domain.PrcPriceSetCheckItem;
|
||||
import com.ruoyi.price.domain.PrcPriceSetDetail;
|
||||
import com.ruoyi.price.mapper.BmsProductCountryMapper;
|
||||
import com.ruoyi.price.mapper.PrcCustomerPriceSetMapper;
|
||||
import com.ruoyi.price.mapper.PrcPriceSetDetailMapper;
|
||||
import com.ruoyi.price.mapper.PrcPriceSetMapper;
|
||||
@@ -46,6 +48,9 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
@Autowired
|
||||
private PrcCustomerPriceSetMapper customerMapper;
|
||||
|
||||
@Autowired
|
||||
private BmsProductCountryMapper productCountryMapper;
|
||||
|
||||
@Override
|
||||
public PrcPriceSet selectPrcPriceSetById(Long priceSetId)
|
||||
{
|
||||
@@ -621,6 +626,7 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
{
|
||||
throw new ServiceException("固定价明细必须填写挂号费");
|
||||
}
|
||||
fillProductCountryId(detail);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(detail.getCountryCode()))
|
||||
{
|
||||
@@ -628,6 +634,69 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve / verify product_country_id from bms_product_country when missing.
|
||||
*/
|
||||
private void fillProductCountryId(PrcPriceSetDetail detail)
|
||||
{
|
||||
if (detail.getProductCountryId() != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isEmpty(detail.getProductCode()) || StringUtils.isEmpty(detail.getWeightLabel()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
BmsProductCountry query = new BmsProductCountry();
|
||||
query.setProductCode(detail.getProductCode());
|
||||
List<BmsProductCountry> rows = productCountryMapper.selectBmsProductCountryList(query);
|
||||
if (rows == null || rows.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (BmsProductCountry row : rows)
|
||||
{
|
||||
if (!matchDetailCountry(detail, row))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String label = formatWeightLabel(row.getWeightMin(), row.getWeightMax());
|
||||
if (detail.getWeightLabel().equals(label)
|
||||
|| (StringUtils.isNotEmpty(detail.getWeightLabel())
|
||||
&& row.getWeightMin() != null && row.getWeightMax() != null
|
||||
&& detail.getWeightLabel().contains(stripTrailingZeros(row.getWeightMin()))
|
||||
&& detail.getWeightLabel().contains(stripTrailingZeros(row.getWeightMax()))))
|
||||
{
|
||||
detail.setProductCountryId(row.getDetailId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean matchDetailCountry(PrcPriceSetDetail detail, BmsProductCountry row)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(detail.getCountryCode()) && StringUtils.isNotEmpty(row.getCountryCode()))
|
||||
{
|
||||
return detail.getCountryCode().equalsIgnoreCase(row.getCountryCode());
|
||||
}
|
||||
return StringUtils.isNotEmpty(detail.getCountryName())
|
||||
&& detail.getCountryName().equals(row.getCountryName());
|
||||
}
|
||||
|
||||
private static String formatWeightLabel(BigDecimal min, BigDecimal max)
|
||||
{
|
||||
return stripTrailingZeros(min) + "\u2264W\u2264" + stripTrailingZeros(max);
|
||||
}
|
||||
|
||||
private static String stripTrailingZeros(BigDecimal v)
|
||||
{
|
||||
if (v == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return v.stripTrailingZeros().toPlainString();
|
||||
}
|
||||
|
||||
private void validateCustomer(PrcCustomerPriceSet customer, PrcPriceSet set)
|
||||
{
|
||||
if (customer.getCustomerId() == null || customer.getCustomerId().longValue() <= 0)
|
||||
|
||||
@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="zdId" column="zd_id" />
|
||||
<result property="wsdId" column="wsd_id" />
|
||||
<result property="weightLabel" column="weight_label" />
|
||||
<result property="productCountryId" column="product_country_id" />
|
||||
<result property="fvValue" column="fv_value" />
|
||||
<result property="fvRegistrationFee" column="fv_registration_fee" />
|
||||
<result property="discountValue" column="discount_value" />
|
||||
@@ -24,8 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<sql id="selectPrcPriceSetDetailVo">
|
||||
select psd_id, price_set_id, product_code, product_name, country_code, country_name,
|
||||
zd_id, wsd_id, weight_label, fv_value, fv_registration_fee, discount_value,
|
||||
pr_id, created_at, updated_at
|
||||
zd_id, wsd_id, weight_label, product_country_id, fv_value, fv_registration_fee,
|
||||
discount_value, pr_id, created_at, updated_at
|
||||
from prc_price_set_detail
|
||||
</sql>
|
||||
|
||||
@@ -68,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="zdId != null">zd_id,</if>
|
||||
<if test="wsdId != null">wsd_id,</if>
|
||||
<if test="weightLabel != null">weight_label,</if>
|
||||
<if test="productCountryId != null">product_country_id,</if>
|
||||
<if test="fvValue != null">fv_value,</if>
|
||||
<if test="fvRegistrationFee != null">fv_registration_fee,</if>
|
||||
<if test="discountValue != null">discount_value,</if>
|
||||
@@ -82,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="zdId != null">#{zdId},</if>
|
||||
<if test="wsdId != null">#{wsdId},</if>
|
||||
<if test="weightLabel != null">#{weightLabel},</if>
|
||||
<if test="productCountryId != null">#{productCountryId},</if>
|
||||
<if test="fvValue != null">#{fvValue},</if>
|
||||
<if test="fvRegistrationFee != null">#{fvRegistrationFee},</if>
|
||||
<if test="discountValue != null">#{discountValue},</if>
|
||||
@@ -100,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
zd_id = #{zdId},
|
||||
wsd_id = #{wsdId},
|
||||
weight_label = #{weightLabel},
|
||||
product_country_id = #{productCountryId},
|
||||
fv_value = #{fvValue},
|
||||
fv_registration_fee = #{fvRegistrationFee},
|
||||
discount_value = #{discountValue},
|
||||
|
||||
Reference in New Issue
Block a user