Enhance surcharge management by adding support for price type filtering in SurchargeController and related services. Introduce new methods for handling redline product codes in mappers and services. Update front-end API to accommodate price type parameters in surcharge queries. Modify database schema to include redline product and country tables for improved surcharge calculations.

This commit is contained in:
wuweihua
2026-10-09 17:30:29 +08:00
parent 380577f691
commit f1f6ddd368
34 changed files with 5196 additions and 30 deletions
@@ -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));
}
/**