新建应付配置的附加费开关配置

This commit is contained in:
liuminghui
2026-11-05 16:05:01 +08:00
parent 116b3b74e4
commit fde53681d1
15 changed files with 1002 additions and 21 deletions
@@ -1,5 +1,6 @@
package com.bms.web.controller.price;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,6 +25,7 @@ import com.bms.common.exception.ServiceException;
import com.bms.common.utils.file.FileUtils;
import com.bms.common.utils.poi.ExcelUtil;
import com.bms.price.domain.ChannelProductMap;
import com.bms.price.domain.PayFeeRuleGroup;
import com.bms.price.domain.PayProduct;
import com.bms.price.domain.PayProductTerm;
import com.bms.price.domain.PaySaveCommand;
@@ -70,6 +72,35 @@ public class PayProductController extends BaseController
return toAjax(payProductService.updateTerm(term));
}
/** 勾选的应付产品各自带出附加费开关。productIds 用逗号分隔 */
@PreAuthorize("@ss.hasPermi('price:pay:query')")
@GetMapping("/feeRule/list")
public AjaxResult feeRuleList(@RequestParam String productIds)
{
List<Long> ids = new ArrayList<>();
if (productIds != null)
{
for (String part : productIds.split(","))
{
if (part != null && !part.isBlank())
{
ids.add(Long.valueOf(part.trim()));
}
}
}
return success(payProductService.listFeeRules(ids));
}
/** 按产品保存附加费开关。多个产品各写一份 */
@PreAuthorize("@ss.hasPermi('price:pay:edit')")
@Log(title = "应付附加费开关", businessType = BusinessType.UPDATE)
@PutMapping("/feeRule")
public AjaxResult saveFeeRule(@RequestBody List<PayFeeRuleGroup> products)
{
payProductService.saveFeeRules(products);
return success();
}
@PreAuthorize("@ss.hasPermi('price:pay:edit')")
@Log(title = "应付有效期", businessType = BusinessType.UPDATE)
@PutMapping("/term/status")
@@ -91,14 +91,36 @@ class PayWorkbookParserTest
{
PayPreview preview = parse("32、");
PayProduct ups = product(preview, "德国UPS");
assertEquals("Zone 1", ups.getWeightBands().get(0).getZoneName());
assertEquals("DE", ups.getWeightBands().get(0).getCountryCode());
assertTrue(decimal(ups.getWeightBands().get(0), "3.9"));
assertEquals("Zone 2", ups.getWeightBands().get(1).getZoneName());
assertTrue(ups.getWeightBands().get(1).getCountryCode().startsWith("BE,LU"));
assertTrue(decimal(ups.getWeightBands().get(1), "7.58"));
assertTrue(ups.getWeightBands().get(4).getZoneName().contains("Zone 5"));
assertTrue(decimal(ups.getWeightBands().get(4), "9.45"));
String[] codes = {
"DE",
"BE", "LU", "NL", "AT", "SI",
"CZ", "PL", "SK",
"DK", "FI", "FR", "SE", "ES", "IT", "PT", "HU",
"GR", "IE", "BG", "HR", "EE", "LT", "LV", "RO"
};
String[] zones = {
"Zone 1",
"Zone 2", "Zone 2", "Zone 2", "Zone 2", "Zone 2",
"Zone 3", "Zone 3", "Zone 3",
"Zone 4", "Zone 4", "Zone 4", "Zone 4", "Zone 4", "Zone 4", "Zone 4", "Zone 4",
"Zone 5", "Zone 5", "Zone 5", "Zone 5", "Zone 5", "Zone 5", "Zone 5", "Zone 5"
};
String[] prices = {
"3.9",
"7.58", "7.58", "7.58", "7.58", "7.58",
"7.72", "7.72", "7.72",
"8.41", "8.41", "8.41", "8.41", "8.41", "8.41", "8.41", "8.41",
"9.45", "9.45", "9.45", "9.45", "9.45", "9.45", "9.45", "9.45"
};
assertEquals(codes.length, ups.getWeightBands().size());
for (int i = 0; i < codes.length; i++)
{
PayWeightBand band = ups.getWeightBands().get(i);
assertEquals(zones[i], band.getZoneName(), codes[i]);
assertEquals(codes[i], band.getCountryCode());
assertEquals(codes[i], band.getCountryName());
assertTrue(decimal(band, prices[i]), codes[i] + " " + prices[i]);
}
assertTrue(ups.getSurcharges().stream().anyMatch(fee -> "报价说明".equals(fee.getFeeName())
&& fee.getChargeText().contains("不含管理费") && fee.getChargeText().contains("不含燃油")));
PaySurcharge handling = ups.getSurcharges().stream()