Refactor billing options retrieval to include data permissions and add effective date handling for product imports
This commit is contained in:
+14
-3
@@ -111,21 +111,32 @@ public class BillingController extends BaseController
|
||||
@GetMapping("/bill/orderNos")
|
||||
public AjaxResult orderNoOptions(@RequestParam(value = "keyword", required = false) String keyword)
|
||||
{
|
||||
return success(prcOrderBillService.listOrderNoOptions(keyword));
|
||||
return success(prcOrderBillService.listOrderNoOptions(buildBillOptionQuery(keyword)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
@GetMapping("/bill/trackingNos")
|
||||
public AjaxResult trackingNoOptions(@RequestParam(value = "keyword", required = false) String keyword)
|
||||
{
|
||||
return success(prcOrderBillService.listTrackingNoOptions(keyword));
|
||||
return success(prcOrderBillService.listTrackingNoOptions(buildBillOptionQuery(keyword)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
@GetMapping("/bill/transferNos")
|
||||
public AjaxResult transferNoOptions(@RequestParam(value = "keyword", required = false) String keyword)
|
||||
{
|
||||
return success(prcOrderBillService.listTransferNoOptions(keyword));
|
||||
return success(prcOrderBillService.listTransferNoOptions(buildBillOptionQuery(keyword)));
|
||||
}
|
||||
|
||||
/** 下拉搜索:keyword 放入 params,供 @DataScope 与 Mapper 使用 */
|
||||
private PrcOrderBill buildBillOptionQuery(String keyword)
|
||||
{
|
||||
PrcOrderBill query = new PrcOrderBill();
|
||||
if (StringUtils.isNotEmpty(keyword))
|
||||
{
|
||||
query.getParams().put("optionKeyword", keyword.trim());
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:billing:bill')")
|
||||
|
||||
@@ -145,6 +145,15 @@ public class PriceSetController extends BaseController
|
||||
return success(newPsvId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:set:add')")
|
||||
@Log(title = "Price set version create", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/version/create/{priceSetId}")
|
||||
public AjaxResult createVersion(@PathVariable Long priceSetId)
|
||||
{
|
||||
Long newPsvId = priceSetService.createVersion(priceSetId, getUsername());
|
||||
return success(newPsvId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:set:edit')")
|
||||
@Log(title = "Price set version delete", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/version/{psvId}")
|
||||
|
||||
+21
-4
@@ -5,6 +5,7 @@ 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;
|
||||
@@ -49,6 +50,17 @@ public class ProductController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品下拉选项(非分页)。
|
||||
* 供计费列表、客户绑定等场景选择产品;不做权限控制(仍需登录)。
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect(BmsProduct product)
|
||||
{
|
||||
List<BmsProduct> list = productService.selectBmsProductList(product);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:product:import')")
|
||||
@GetMapping("/import/task/{taskId}")
|
||||
public AjaxResult getImportTask(@PathVariable String taskId)
|
||||
@@ -114,13 +126,15 @@ public class ProductController extends BaseController
|
||||
|
||||
/**
|
||||
* 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:product:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
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());
|
||||
String taskId = productService.submitImportProductExcelAsync(file, updateSupport, getUsername(), effectiveDate);
|
||||
Map<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put("taskId", taskId);
|
||||
return success(payload);
|
||||
@@ -128,13 +142,16 @@ public class ProductController extends BaseController
|
||||
|
||||
/**
|
||||
* 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:product:import')")
|
||||
@PostMapping("/importCountryData")
|
||||
public AjaxResult importCountryData(MultipartFile file, String countryCode) throws Exception
|
||||
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());
|
||||
String taskId = productService.submitImportCountryProductExcelAsync(file, countryCode, getUsername(),
|
||||
effectiveDate);
|
||||
Map<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put("taskId", taskId);
|
||||
return success(payload);
|
||||
|
||||
@@ -111,13 +111,14 @@ price.zone.countryCode.empty=国家编码不能为空,请检查 region.country
|
||||
price.product.codeDate.exists=同一产品代码与生效日期已存在,不能覆盖历史数据
|
||||
price.product.effectiveDate.empty=生效日期不能为空
|
||||
price.product.import.effEmpty=缺少生效日期,已跳过
|
||||
price.product.import.effRequired=请选择生效时间
|
||||
price.product.import.fileEmpty=上传文件不能为空
|
||||
price.product.import.fileType=仅支持 xls / xlsx 文件
|
||||
price.product.import.sheetNotFound=未找到「产品目录」sheet,请上传威狮B2C小包价表格格式文件
|
||||
price.product.import.noData=产品目录无有效数据行
|
||||
price.product.import.regionEmpty=region 无可用国家数据,请先同步/维护国家表后再导入
|
||||
price.product.import.partialFail=导入完成但存在失败项:新增 {0},跳过 {1};失败明细:{2}
|
||||
price.product.import.effTooEarly=生效日期 {0} 早于当前开放版 {1},请使用更晚的生效日期导入
|
||||
price.product.import.effTooEarly=产品{0}({1})导入生效时间{2}早于该产品上一版生效时间{3},不允许导入
|
||||
price.product.import.needFeeAlter=请先执行 SQL:bms-back/sql/price/product_country_fee_alter.sql(缺少运费/挂号费字段)
|
||||
price.product.import.needExpireAlter=请先执行 SQL:bms-back/sql/price/product_country_expire_alter.sql(缺少失效日期/版本唯一键)
|
||||
price.product.import.needCodeEffUnique=无法新增「同代码、不同生效日」的产品。请先执行 SQL:bms-back/sql/price/product_code_eff_unique_alter.sql(去掉 product_code 单列唯一,改为代码+生效日唯一)
|
||||
@@ -181,10 +182,12 @@ price.bill.fee.alreadyBilled=费用已生成账单,不可编辑或删除
|
||||
price.bill.fee.idRequired=费用ID不能为空
|
||||
|
||||
price.set.version.effectiveTime.empty=版本生效时间不能为空
|
||||
price.set.version.effectiveTime.beforePrev=生效时间不能早于上一版本的生效时间
|
||||
price.set.version.notExists=套餐版本不存在
|
||||
price.set.version.activate.statusNotAllowed=仅草稿或待生效版本可设置生效时间
|
||||
price.set.version.delete.statusNotAllowed=仅草稿版本可删除
|
||||
price.set.version.copy.draftExists=已有草稿版本,请先启动或删除后再复制
|
||||
price.set.version.create.draftExists=已有草稿版本,请先启动或删除后再新建
|
||||
price.set.save.task.notExists=保存任务不存在或已过期
|
||||
price.set.library.empty=产品库无可用价格明细,请检查产品国家配置
|
||||
price.set.detail.duplicate.fixed=产品{0} 国家{1} 重量段{2} {3}(共{4}条)
|
||||
|
||||
Reference in New Issue
Block a user