This commit is contained in:
wuweihua
2026-10-10 09:40:54 +08:00
66 changed files with 6959 additions and 604 deletions
@@ -27,7 +27,9 @@ import com.bms.common.utils.MessageUtils;
import com.bms.price.domain.BmsProduct;
import com.bms.price.domain.BmsProductCountry;
import com.bms.price.domain.BmsProductImportTask;
import com.bms.price.domain.PrcPriceExcelFile;
import com.bms.price.service.IBmsProductService;
import com.bms.price.service.IPrcPriceExcelFileService;
/**
* Product list (async Excel import)
@@ -41,6 +43,9 @@ public class ProductController extends BaseController
@Autowired
private IBmsProductService productService;
@Autowired
private IPrcPriceExcelFileService priceExcelFileService;
@PreAuthorize("@ss.hasPermi('price:product:list')")
@GetMapping("/list")
public TableDataInfo list(BmsProduct product)
@@ -50,6 +55,15 @@ public class ProductController extends BaseController
return getDataTable(list);
}
/** Imported quote Excel attachments for this product_code (via product.pef_id). */
@PreAuthorize("@ss.hasPermi('price:product:query')")
@GetMapping("/{productCode}/excelFiles")
public AjaxResult excelFiles(@PathVariable String productCode)
{
List<PrcPriceExcelFile> list = priceExcelFileService.selectByProductCode(productCode);
return success(list);
}
/**
* 产品下拉选项(非分页)。
* 供计费列表、客户绑定等场景选择产品;不做权限控制(仍需登录)。
@@ -0,0 +1,173 @@
package com.bms.web.controller.price;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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;
import com.bms.common.core.controller.BaseController;
import com.bms.common.core.domain.AjaxResult;
import com.bms.common.core.page.TableDataInfo;
import com.bms.common.enums.BusinessType;
import com.bms.common.utils.MessageUtils;
import com.bms.price.domain.BmsRedlineProduct;
import com.bms.price.domain.BmsRedlineProductCountry;
import com.bms.price.domain.BmsRedlineProductImportTask;
import com.bms.price.domain.PrcPriceExcelFile;
import com.bms.price.service.IBmsRedlineProductService;
import com.bms.price.service.IPrcPriceExcelFileService;
/**
* redline product list (async Excel import)
*
* @author bms
*/
@RestController
@RequestMapping("/price/redline")
public class RedlineProductController extends BaseController
{
@Autowired
private IBmsRedlineProductService productService;
@Autowired
private IPrcPriceExcelFileService priceExcelFileService;
@PreAuthorize("@ss.hasPermi('price:redline:list')")
@GetMapping("/list")
public TableDataInfo list(BmsRedlineProduct product)
{
startPage();
List<BmsRedlineProduct> list = productService.selectBmsRedlineProductList(product);
return getDataTable(list);
}
/** Imported quote Excel attachments for this product_code (via product.pef_id). */
@PreAuthorize("@ss.hasPermi('price:redline:query')")
@GetMapping("/{productCode}/excelFiles")
public AjaxResult excelFiles(@PathVariable String productCode)
{
List<PrcPriceExcelFile> list = priceExcelFileService.selectByRedlineProductCode(productCode);
return success(list);
}
/**
* 产品下拉选项(非分页)。
* 供计费列表、客户绑定等场景选择产品;不做权限控制(仍需登录)。
*/
@GetMapping("/optionselect")
public AjaxResult optionselect(BmsRedlineProduct product)
{
List<BmsRedlineProduct> list = productService.selectBmsRedlineProductList(product);
return success(list);
}
@PreAuthorize("@ss.hasPermi('price:redline:import')")
@GetMapping("/import/task/{taskId}")
public AjaxResult getImportTask(@PathVariable String taskId)
{
BmsRedlineProductImportTask task = productService.getImportTask(taskId);
if (task == null)
{
return error(MessageUtils.message("price.product.import.task.notExists"));
}
return success(task);
}
@PreAuthorize("@ss.hasPermi('price:redline:query')")
@GetMapping("/{productCode}/countries")
public AjaxResult countries(@PathVariable String productCode,
@RequestParam(required = false) Date effectiveDate,
@RequestParam(required = false) Long productId)
{
List<BmsRedlineProductCountry> list = productService.selectCountryListByProductCode(productCode, effectiveDate, productId);
return success(list);
}
@PreAuthorize("@ss.hasPermi('price:redline:query')")
@GetMapping("/{productId}")
public AjaxResult getInfo(@PathVariable Long productId)
{
return success(productService.selectBmsRedlineProductById(productId));
}
@PreAuthorize("@ss.hasPermi('price:redline:add')")
@Log(title = "\u4ea7\u54c1\u5217\u8868", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody BmsRedlineProduct product)
{
product.setCreateBy(getUsername());
return toAjax(productService.insertBmsRedlineProduct(product));
}
@PreAuthorize("@ss.hasPermi('price:redline:edit')")
@Log(title = "\u4ea7\u54c1\u5217\u8868", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody BmsRedlineProduct product)
{
product.setUpdateBy(getUsername());
return toAjax(productService.updateBmsRedlineProduct(product));
}
@PreAuthorize("@ss.hasPermi('price:redline:edit')")
@Log(title = "\u4ea7\u54c1\u56fd\u5bb6\u660e\u7ec6", businessType = BusinessType.UPDATE)
@PutMapping("/country")
public AjaxResult editCountry(@RequestBody BmsRedlineProductCountry country)
{
return toAjax(productService.updateBmsRedlineProductCountry(country));
}
@PreAuthorize("@ss.hasPermi('price:redline:remove')")
@Log(title = "\u4ea7\u54c1\u5217\u8868", businessType = BusinessType.DELETE)
@DeleteMapping("/{productIds}")
public AjaxResult remove(@PathVariable Long[] productIds)
{
return toAjax(productService.deleteBmsRedlineProductByIds(productIds));
}
/**
* Async import Weishi B2C workbook. Returns taskId; poll /import/task/{taskId}.
* effectiveDate is required: written to product / product_country; previous open rows expire at this date.
*/
@Log(title = "\u4ea7\u54c1\u5217\u8868", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('price:redline:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date effectiveDate) throws Exception
{
String taskId = productService.submitImportProductExcelAsync(file, updateSupport, getUsername(), effectiveDate);
Map<String, Object> payload = new HashMap<String, Object>();
payload.put("taskId", taskId);
return success(payload);
}
/**
* Async single-country cost-sheet import. Returns taskId; poll /import/task/{taskId}.
* effectiveDate is required: written to product / product_country; previous open rows expire at this date.
*/
@Log(title = "\u4ea7\u54c1\u5217\u8868", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('price:redline:import')")
@PostMapping("/importCountryData")
public AjaxResult importCountryData(MultipartFile file, String countryCode,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date effectiveDate) throws Exception
{
String taskId = productService.submitImportCountryProductExcelAsync(file, countryCode, getUsername(),
effectiveDate);
Map<String, Object> payload = new HashMap<String, Object>();
payload.put("taskId", taskId);
return success(payload);
}
}
@@ -11,6 +11,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 com.bms.common.annotation.Log;
import com.bms.common.core.controller.BaseController;
@@ -58,9 +59,10 @@ public class SurchargeController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('price:surcharge:query') or @ss.hasPermi('price:set:query') or @ss.hasPermi('price:set:add')")
@GetMapping("/byProduct/{productCode}")
public AjaxResult listByProduct(@PathVariable String productCode)
public AjaxResult listByProduct(@PathVariable String productCode,
@RequestParam(required = false) String priceType)
{
return success(surchargeRelService.selectRelByProductCode(productCode));
return success(surchargeRelService.selectRelByProductCode(productCode, priceType));
}
/**
@@ -78,7 +80,7 @@ public class SurchargeController extends BaseController
}
/**
* 绑定附加费到产品/明细(body: scId, productId, productCode, detailId;detailId 空=产品级)
* 绑定附加费(body: scId, productId, productCode, detailId, priceType, countryCode;priceType 默认 PRODUCT;countryCode 空=全部)
*/
@PreAuthorize("@ss.hasPermi('price:surcharge:add')")
@Log(title = "附加费关联", businessType = BusinessType.INSERT)
@@ -47,6 +47,8 @@ price.surcharge.chargeValue.negative=计费数值不能为负数
price.surchargeRel.scId.empty=附加费ID不能为空
price.surchargeRel.productId.empty=产品ID不能为空
price.surchargeRel.productCode.empty=产品代码不能为空
price.surchargeRel.priceType.invalid=价格类型必须为 PRODUCT/SALES/REDLINE
price.surchargeRel.detailId.empty=销售价关联必须指定套餐明细ID
# 套餐 PrcPriceSet
price.set.notExists=套餐不存在
price.set.name.empty=套餐名称不能为空
@@ -128,6 +130,8 @@ price.product.import.success.detail2=范围:产品目录 + 重量段 + 运费/
price.product.import.noSheet=未找到产品明细sheet(需与产品名称一致):{0}
price.product.import.noCountry=产品明细sheet无有效国家/重量段数据:{0}
price.product.import.euEmpty=国家表无欧盟成员(is_eu=1),无法展开「欧盟」
price.product.import.dupCountry.item=产品{0}({1})重复国家+重量段:{2}
price.product.import.dupCountry=导入失败:以下产品明细中存在重复的国家+重量段,请合并后重试:{0}
price.product.import.success.unmatched=未匹配国家表(country_code 为空):{0}
price.product.import.countryRequired=请选择目的国家
price.product.import.countryNotFound=国家不存在或已停用:{0}