新增按国家去重区块标题接口,优化计费列表请求方式
This commit is contained in:
+10
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.bms.common.annotation.Log;
|
||||
@@ -43,6 +44,15 @@ public class PayPostcodeController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/** 按国家去重区块,供附加费编辑分区下拉 */
|
||||
@PreAuthorize("@ss.hasPermi('data:payPostcode:list')")
|
||||
@GetMapping("/blockOptions")
|
||||
public AjaxResult blockOptions(@RequestParam(required = false) String countryCode,
|
||||
@RequestParam(required = false) String countryName)
|
||||
{
|
||||
return success(payPostcodeService.selectBlockTitlesByCountry(countryCode, countryName));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('data:payPostcode:query')")
|
||||
@GetMapping("/{groupId}")
|
||||
public AjaxResult getInfo(@PathVariable Long groupId)
|
||||
|
||||
@@ -147,6 +147,22 @@ public class BillingController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
@GetMapping("/bill/list")
|
||||
public TableDataInfo billList(PrcOrderBill query)
|
||||
{
|
||||
return doBillList(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST 计费列表:大批单号等筛选放请求体,避免 GET URL 过长触发 HTTP 431。
|
||||
* pageNum/pageSize 仍走 URL 查询参数,供 PageHelper 读取。
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
@PostMapping("/bill/list")
|
||||
public TableDataInfo billListPost(@RequestBody(required = false) PrcOrderBill query)
|
||||
{
|
||||
return doBillList(query);
|
||||
}
|
||||
|
||||
private TableDataInfo doBillList(PrcOrderBill query)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
@@ -220,6 +236,19 @@ public class BillingController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST 列表:筛选(尤其是大批量单号)放请求体,避免 GET URL 过长触发 HTTP 431。
|
||||
* pageNum/pageSize 仍走 URL 查询参数,供 TableSupport/PageHelper 读取。
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('price:orderBill:list')")
|
||||
@PostMapping("/orderBill/list")
|
||||
public TableDataInfo orderBillListPost(@RequestBody(required = false) PrcOrderBill query)
|
||||
{
|
||||
startPage();
|
||||
List<PrcOrderBill> list = prcOrderBillService.selectBillList(query == null ? new PrcOrderBill() : query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/** 订单列表弹窗:按 billId 查询计费失败原因(受数据权限控制)。 */
|
||||
@PreAuthorize("@ss.hasPermi('price:orderBill:list')")
|
||||
|
||||
+13
@@ -20,6 +20,7 @@ import com.bms.common.core.page.TableDataInfo;
|
||||
import com.bms.common.enums.BusinessType;
|
||||
import com.bms.price.domain.PrcSurcharge;
|
||||
import com.bms.price.domain.PrcSurchargeRel;
|
||||
import com.bms.price.service.IPayPostcodeService;
|
||||
import com.bms.price.service.IPrcSurchargeRelService;
|
||||
import com.bms.price.service.IPrcSurchargeService;
|
||||
|
||||
@@ -38,6 +39,9 @@ public class SurchargeController extends BaseController
|
||||
@Autowired
|
||||
private IPrcSurchargeRelService surchargeRelService;
|
||||
|
||||
@Autowired
|
||||
private IPayPostcodeService payPostcodeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:surcharge:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PrcSurcharge surcharge)
|
||||
@@ -47,6 +51,15 @@ public class SurchargeController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/** 按国家从应付邮编配置拉取区块/分区选项 */
|
||||
@PreAuthorize("@ss.hasPermi('price:surcharge:list') or @ss.hasPermi('price:surcharge:query') or @ss.hasPermi('price:surcharge:add') or @ss.hasPermi('price:surcharge:edit')")
|
||||
@GetMapping("/blockOptions")
|
||||
public AjaxResult blockOptions(@RequestParam(required = false) String countryCode,
|
||||
@RequestParam(required = false) String countryName)
|
||||
{
|
||||
return success(payPostcodeService.selectBlockTitlesByCountry(countryCode, countryName));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:surcharge:query')")
|
||||
@GetMapping("/{scId}")
|
||||
public AjaxResult getInfo(@PathVariable Long scId)
|
||||
|
||||
@@ -16,8 +16,10 @@ public class PrcSurcharge extends BaseEntity
|
||||
private String scName;
|
||||
/** 字典 bms_fee_type */
|
||||
private String feeType;
|
||||
/** FIXED / WEIGHT / RATE */
|
||||
/** 计费方式:ALWAYS/每票都收、POSTCODE/命中邮编、ZONE/命中分区、EXTRA_KG/超重续收、WEIGHT/超重、SIZE/超尺寸、RETURN/退件、MANUAL/暂不计费 */
|
||||
private String chargeType;
|
||||
/** 渠道产品(字典 payment_product_type.dict_value) */
|
||||
private String dictValue;
|
||||
private BigDecimal chargeValue;
|
||||
private String currency;
|
||||
/** 字典 bms_round_mode:UP / DOWN / HALF_UP */
|
||||
@@ -29,6 +31,8 @@ public class PrcSurcharge extends BaseEntity
|
||||
public static final String IS_DEL_YES = "1";
|
||||
private String isDel;
|
||||
private String countryCode;
|
||||
/** 分区/区块(对应 pay_postcode_group.block_title) */
|
||||
private String blockTitle;
|
||||
private String scNote;
|
||||
private Long tmsId;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ public interface PayPostcodeMapper
|
||||
{
|
||||
List<PayPostcodeGroup> selectGroupList(PayPostcodeGroup query);
|
||||
|
||||
/** 按国家去重区块标题 */
|
||||
List<String> selectBlockTitlesByCountry(@Param("countryCode") String countryCode,
|
||||
@Param("countryName") String countryName);
|
||||
|
||||
PayPostcodeGroup selectGroupById(Long groupId);
|
||||
|
||||
int updateGroup(PayPostcodeGroup group);
|
||||
|
||||
@@ -10,6 +10,9 @@ public interface IPayPostcodeService
|
||||
{
|
||||
List<PayPostcodeGroup> selectGroupList(PayPostcodeGroup query);
|
||||
|
||||
/** 附加费分区下拉:按国家去重区块标题 */
|
||||
List<String> selectBlockTitlesByCountry(String countryCode, String countryName);
|
||||
|
||||
PayPostcodeGroup selectGroupById(Long groupId);
|
||||
|
||||
int updateGroup(PayPostcodeGroup group);
|
||||
|
||||
+6
@@ -34,6 +34,12 @@ public class PayPostcodeServiceImpl implements IPayPostcodeService
|
||||
return payPostcodeMapper.selectGroupList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> selectBlockTitlesByCountry(String countryCode, String countryName)
|
||||
{
|
||||
return payPostcodeMapper.selectBlockTitlesByCountry(countryCode, countryName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayPostcodeGroup selectGroupById(Long groupId)
|
||||
{
|
||||
|
||||
+5
-13
@@ -1716,21 +1716,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
RoundingMode rm = resolveFeeRoundingMode(surcharge.getRoundMode());
|
||||
String chargeType = surcharge.getChargeType() == null ? "FIXED" : surcharge.getChargeType().toUpperCase();
|
||||
BigDecimal amount;
|
||||
if ("WEIGHT".equals(chargeType))
|
||||
String chargeType = surcharge.getChargeType() == null ? "MANUAL" : surcharge.getChargeType().toUpperCase();
|
||||
// MANUAL=暂不计费;其他计费方式暂按固定金额 charge_value
|
||||
if ("MANUAL".equals(chargeType))
|
||||
{
|
||||
amount = surcharge.getChargeValue().multiply(nz(weight));
|
||||
return BigDecimal.ZERO.setScale(4, rm);
|
||||
}
|
||||
else if ("RATE".equals(chargeType))
|
||||
{
|
||||
amount = nz(freightAmount).multiply(surcharge.getChargeValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
amount = surcharge.getChargeValue();
|
||||
}
|
||||
return amount.setScale(4, rm);
|
||||
return surcharge.getChargeValue().setScale(4, rm);
|
||||
}
|
||||
|
||||
private RoundingMode resolveFeeRoundingMode(String roundMode)
|
||||
|
||||
+8
@@ -79,11 +79,13 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
|
||||
fresh.setScName(surcharge.getScName());
|
||||
fresh.setFeeType(StringUtils.isNotEmpty(surcharge.getFeeType()) ? surcharge.getFeeType() : old.getFeeType());
|
||||
fresh.setChargeType(surcharge.getChargeType());
|
||||
fresh.setDictValue(surcharge.getDictValue());
|
||||
fresh.setChargeValue(surcharge.getChargeValue());
|
||||
fresh.setCurrency(surcharge.getCurrency());
|
||||
fresh.setRoundMode(surcharge.getRoundMode());
|
||||
fresh.setSsCode(old.getSsCode());
|
||||
fresh.setCountryCode(surcharge.getCountryCode());
|
||||
fresh.setBlockTitle(surcharge.getBlockTitle());
|
||||
fresh.setScNote(surcharge.getScNote());
|
||||
applyInsertDefaults(fresh);
|
||||
fresh.setCreateBy(operator);
|
||||
@@ -99,10 +101,12 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
|
||||
return eq(old.getScName(), updated.getScName())
|
||||
&& eq(old.getFeeType(), updated.getFeeType())
|
||||
&& eq(old.getChargeType(), updated.getChargeType())
|
||||
&& eq(old.getDictValue(), updated.getDictValue())
|
||||
&& eqDecimal(old.getChargeValue(), updated.getChargeValue())
|
||||
&& eq(old.getCurrency(), updated.getCurrency())
|
||||
&& eq(old.getRoundMode(), updated.getRoundMode())
|
||||
&& eq(old.getCountryCode(), updated.getCountryCode())
|
||||
&& eq(old.getBlockTitle(), updated.getBlockTitle())
|
||||
&& eq(old.getScNote(), updated.getScNote());
|
||||
}
|
||||
|
||||
@@ -161,6 +165,10 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
|
||||
{
|
||||
surcharge.setRoundMode("HALF_UP");
|
||||
}
|
||||
if (StringUtils.isEmpty(surcharge.getChargeType()))
|
||||
{
|
||||
surcharge.setChargeType("MANUAL");
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(PrcSurcharge surcharge)
|
||||
|
||||
+5
-13
@@ -1841,21 +1841,13 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
RoundingMode rm = resolveRoundingMode(rel.getRoundMode());
|
||||
String chargeType = rel.getChargeType() == null ? "FIXED" : rel.getChargeType().toUpperCase();
|
||||
BigDecimal amount;
|
||||
if ("WEIGHT".equals(chargeType))
|
||||
String chargeType = rel.getChargeType() == null ? "MANUAL" : rel.getChargeType().toUpperCase();
|
||||
// MANUAL=暂不计费;其他计费方式暂按固定金额 charge_value
|
||||
if ("MANUAL".equals(chargeType))
|
||||
{
|
||||
amount = rel.getChargeValue().multiply(nvl(weight));
|
||||
return BigDecimal.ZERO.setScale(2, rm);
|
||||
}
|
||||
else if ("RATE".equals(chargeType))
|
||||
{
|
||||
amount = nvl(freightAmount).multiply(rel.getChargeValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
amount = rel.getChargeValue();
|
||||
}
|
||||
return amount.setScale(2, rm);
|
||||
return rel.getChargeValue().setScale(2, rm);
|
||||
}
|
||||
|
||||
private void persistQuote(String quoteKey, TmsPriceQuoteRequest request, BigDecimal weight,
|
||||
|
||||
@@ -30,6 +30,26 @@
|
||||
order by group_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectBlockTitlesByCountry" resultType="string">
|
||||
select distinct block_title
|
||||
from pay_postcode_group
|
||||
where block_title is not null
|
||||
and block_title <> ''
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
and (
|
||||
upper(ifnull(country_code, '')) = upper(#{countryCode})
|
||||
or upper(ifnull(catalog_country, '')) = upper(#{countryCode})
|
||||
)
|
||||
</if>
|
||||
<if test="countryName != null and countryName != ''">
|
||||
and (
|
||||
country_name like concat('%', #{countryName}, '%')
|
||||
or catalog_country like concat('%', #{countryName}, '%')
|
||||
)
|
||||
</if>
|
||||
order by block_title asc
|
||||
</select>
|
||||
|
||||
<select id="selectLineList" parameterType="com.bms.price.domain.PayPostcodeLine" resultType="com.bms.price.domain.PayPostcodeLine">
|
||||
select line_id as lineId, group_id as groupId, country_name as countryName, country_code as countryCode,
|
||||
region_name as regionName, region_name_cn as regionNameCn, city_name as cityName, region_code as regionCode,
|
||||
|
||||
@@ -9,12 +9,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="scName" column="sc_name" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="chargeType" column="charge_type" />
|
||||
<result property="dictValue" column="dict_value" />
|
||||
<result property="chargeValue" column="charge_value" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="ssCode" column="ss_code" />
|
||||
<result property="isDel" column="is_del" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="blockTitle" column="block_title" />
|
||||
<result property="scNote" column="sc_note" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="createBy" column="created_by" />
|
||||
@@ -24,8 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcSurchargeVo">
|
||||
select sc_id, sc_name, fee_type, charge_type, charge_value, currency, round_mode, ss_code, is_del,
|
||||
country_code, sc_note, tms_id, created_by, create_time, updated_by, update_time
|
||||
select sc_id, sc_name, fee_type, charge_type, dict_value, charge_value, currency, round_mode,
|
||||
ss_code, is_del, country_code, block_title, sc_note, tms_id, created_by, create_time, updated_by, update_time
|
||||
from prc_surcharge
|
||||
</sql>
|
||||
|
||||
@@ -55,6 +57,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="chargeType != null and chargeType != ''">
|
||||
AND charge_type = #{chargeType}
|
||||
</if>
|
||||
<if test="dictValue != null and dictValue != ''">
|
||||
AND dict_value = #{dictValue}
|
||||
</if>
|
||||
<if test="blockTitle != null and blockTitle != ''">
|
||||
AND block_title like concat('%', #{blockTitle}, '%')
|
||||
</if>
|
||||
<if test="roundMode != null and roundMode != ''">
|
||||
AND round_mode = #{roundMode}
|
||||
</if>
|
||||
@@ -82,12 +90,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="scName != null and scName != ''">sc_name,</if>
|
||||
<if test="feeType != null and feeType != ''">fee_type,</if>
|
||||
<if test="chargeType != null and chargeType != ''">charge_type,</if>
|
||||
<if test="dictValue != null">dict_value,</if>
|
||||
<if test="chargeValue != null">charge_value,</if>
|
||||
<if test="currency != null and currency != ''">currency,</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode,</if>
|
||||
<if test="ssCode != null and ssCode != ''">ss_code,</if>
|
||||
is_del,
|
||||
<if test="countryCode != null">country_code,</if>
|
||||
<if test="blockTitle != null">block_title,</if>
|
||||
<if test="scNote != null">sc_note,</if>
|
||||
<if test="tmsId != null">tms_id,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
@@ -96,12 +106,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="scName != null and scName != ''">#{scName},</if>
|
||||
<if test="feeType != null and feeType != ''">#{feeType},</if>
|
||||
<if test="chargeType != null and chargeType != ''">#{chargeType},</if>
|
||||
<if test="dictValue != null">#{dictValue},</if>
|
||||
<if test="chargeValue != null">#{chargeValue},</if>
|
||||
<if test="currency != null and currency != ''">#{currency},</if>
|
||||
<if test="roundMode != null and roundMode != ''">#{roundMode},</if>
|
||||
<if test="ssCode != null and ssCode != ''">#{ssCode},</if>
|
||||
ifnull(#{isDel}, '0'),
|
||||
<if test="countryCode != null">#{countryCode},</if>
|
||||
<if test="blockTitle != null">#{blockTitle},</if>
|
||||
<if test="scNote != null">#{scNote},</if>
|
||||
<if test="tmsId != null">#{tmsId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
-- prc_surcharge: drop calc_rule; keep dict_value / block_title; charge_type stores billing mode
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- If calc_rule exists, copy into charge_type then drop
|
||||
SET @col := (
|
||||
SELECT COLUMN_NAME FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'prc_surcharge'
|
||||
AND COLUMN_NAME = 'calc_rule'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @sql := IF(@col IS NULL,
|
||||
'SELECT 1',
|
||||
'UPDATE prc_surcharge SET charge_type = calc_rule WHERE calc_rule IS NOT NULL AND calc_rule <> ''''');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @col := (
|
||||
SELECT COLUMN_NAME FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'prc_surcharge'
|
||||
AND COLUMN_NAME = 'calc_rule'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @sql := IF(@col IS NULL,
|
||||
'SELECT 1',
|
||||
'ALTER TABLE prc_surcharge DROP COLUMN calc_rule');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @col := (
|
||||
SELECT COLUMN_NAME FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'prc_surcharge'
|
||||
AND COLUMN_NAME = 'dict_value'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @sql := IF(@col IS NULL,
|
||||
'ALTER TABLE prc_surcharge ADD COLUMN dict_value varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ''渠道产品 payment_product_type.dict_value'' AFTER charge_type',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @col := (
|
||||
SELECT COLUMN_NAME FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'prc_surcharge'
|
||||
AND COLUMN_NAME = 'block_title'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @sql := IF(@col IS NULL,
|
||||
'ALTER TABLE prc_surcharge ADD COLUMN block_title varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ''分区/区块(pay_postcode_group.block_title)'' AFTER country_code',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- legacy amount modes: FIXED -> ALWAYS; RATE no longer used as amount mode -> MANUAL
|
||||
UPDATE prc_surcharge SET charge_type = 'ALWAYS' WHERE charge_type IS NULL OR charge_type = '' OR upper(charge_type) = 'FIXED';
|
||||
UPDATE prc_surcharge SET charge_type = 'MANUAL' WHERE upper(charge_type) = 'RATE';
|
||||
Reference in New Issue
Block a user