Enhance price set import functionality with preview options and update handling. Added new endpoints for previewing product library pulls and Excel imports, along with support for update-only imports. Updated internationalization messages for import success and error scenarios.
This commit is contained in:
+36
-2
@@ -24,6 +24,7 @@ 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.common.utils.StringUtils;
|
||||
import com.bms.price.domain.PrcCustomerPriceSet;
|
||||
import com.bms.price.domain.PrcPriceSet;
|
||||
import com.bms.price.domain.PrcPriceSetDetail;
|
||||
@@ -233,14 +234,47 @@ public class PriceSetController extends BaseController
|
||||
@PostMapping("/detail/importPrices")
|
||||
public AjaxResult importDetailPrices(MultipartFile file,
|
||||
@RequestParam("priceSetId") Long priceSetId,
|
||||
@RequestParam(value = "psvId", required = false) Long psvId) throws Exception
|
||||
@RequestParam(value = "psvId", required = false) Long psvId,
|
||||
@RequestParam(value = "updateOnly", required = false, defaultValue = "false") boolean updateOnly) throws Exception
|
||||
{
|
||||
String taskId = priceSetService.submitImportDetailPricesAsync(priceSetId, psvId, file, getUsername());
|
||||
String taskId = priceSetService.submitImportDetailPricesAsync(priceSetId, psvId, file, getUsername(), updateOnly);
|
||||
Map<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put("taskId", taskId);
|
||||
return success(payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preview pull product library (no DB write). For create wizard before finish.
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit') or @ss.hasPermi('price:set:add')")
|
||||
@PostMapping("/detail/previewPullFromLibrary")
|
||||
public AjaxResult previewPullFromLibrary()
|
||||
{
|
||||
return success(priceSetService.previewPullFromLibrary());
|
||||
}
|
||||
|
||||
/**
|
||||
* Preview Excel import (no DB write). Optional detailsJson for updateOnly merge.
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('price:set:edit') or @ss.hasPermi('price:set:forceEdit') or @ss.hasPermi('price:set:add')")
|
||||
@PostMapping("/detail/previewImportPrices")
|
||||
public AjaxResult previewImportPrices(MultipartFile file,
|
||||
@RequestParam(value = "updateOnly", required = false, defaultValue = "false") boolean updateOnly,
|
||||
@RequestParam(value = "detailsJson", required = false) String detailsJson) throws Exception
|
||||
{
|
||||
if (file == null || file.isEmpty())
|
||||
{
|
||||
return error("file required");
|
||||
}
|
||||
List<PrcPriceSetDetail> existing = null;
|
||||
if (StringUtils.isNotEmpty(detailsJson))
|
||||
{
|
||||
existing = com.alibaba.fastjson2.JSON.parseArray(detailsJson, PrcPriceSetDetail.class);
|
||||
}
|
||||
return success(priceSetService.previewImportDetailPrices(
|
||||
file.getBytes(), file.getOriginalFilename(), updateOnly, existing));
|
||||
}
|
||||
|
||||
/**
|
||||
* Async pull product library into version details. Returns taskId; poll /save/task/{taskId}.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user