重构打单套餐相关逻辑,更新服务接口,优化保存和查询功能
This commit is contained in:
+59
-27
@@ -8,6 +8,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -24,16 +25,19 @@ import com.bms.common.core.domain.AjaxResult;
|
||||
import com.bms.common.core.page.TableDataInfo;
|
||||
import com.bms.common.enums.BusinessType;
|
||||
import com.bms.common.exception.ServiceException;
|
||||
import com.bms.price.domain.PayProduct;
|
||||
import com.bms.price.domain.PaySaveCommand;
|
||||
import com.bms.price.domain.LblProduct;
|
||||
import com.bms.price.domain.LblSurcharge;
|
||||
import com.bms.price.domain.LblWeightBand;
|
||||
import com.bms.price.domain.LblSaveCommand;
|
||||
|
||||
import com.bms.price.domain.PrcCustomerPriceSet;
|
||||
import com.bms.price.domain.PrcCustomerPriceSetBatch;
|
||||
import com.bms.price.domain.PrcPriceSet;
|
||||
import com.bms.price.service.IPayProductService;
|
||||
import com.bms.price.service.ILblProductService;
|
||||
import com.bms.price.service.IPrcPriceSetService;
|
||||
|
||||
/**
|
||||
* 打单套餐:套餐壳 + 应收价卡(pay_*)。
|
||||
* 打单套餐:套餐壳 + 独立打单价卡(prc_label_*)。
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/price/label")
|
||||
@@ -43,7 +47,7 @@ public class LabelPackageController extends BaseController
|
||||
private IPrcPriceSetService priceSetService;
|
||||
|
||||
@Autowired
|
||||
private IPayProductService payProductService;
|
||||
private ILblProductService lblProductService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:label:list')")
|
||||
@GetMapping("/list")
|
||||
@@ -127,30 +131,37 @@ public class LabelPackageController extends BaseController
|
||||
priceSetService.assertSetCategory(priceSetId, PrcPriceSet.CATEGORY_LABEL);
|
||||
}
|
||||
// 打单独立预览:已存在按本套餐判断,不与应付公共模板互挡
|
||||
return success(payProductService.previewLabel(file.getBytes(), name, dictValue, progressId, priceSetId));
|
||||
return success(lblProductService.preview(file.getBytes(), name, dictValue, progressId, priceSetId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:label:import')")
|
||||
@GetMapping("/preview/progress")
|
||||
public AjaxResult parseProgress(@RequestParam("progressId") String progressId)
|
||||
{
|
||||
return success(payProductService.parseProgress(progressId));
|
||||
return success(lblProductService.parseProgress(progressId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:label:import')")
|
||||
@Log(title = "打单套餐导入", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importSave")
|
||||
public AjaxResult importSave(@RequestBody PaySaveCommand command)
|
||||
public AjaxResult importSave(@RequestBody LblSaveCommand command)
|
||||
{
|
||||
if (command == null)
|
||||
{
|
||||
throw new ServiceException("保存参数不能为空");
|
||||
}
|
||||
String message = payProductService.saveLabel(command);
|
||||
String taskId = lblProductService.submitSave(command);
|
||||
Map<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put("message", message);
|
||||
payload.put("priceSetId", command.getPriceSetId());
|
||||
return success(payload);
|
||||
payload.put("taskId", taskId);
|
||||
// data.taskId + 顶层 taskId,兼容前端不同取值方式
|
||||
return success(payload).put("taskId", taskId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:label:import')")
|
||||
@GetMapping("/importSave/task/{taskId}")
|
||||
public AjaxResult importSaveTask(@PathVariable String taskId)
|
||||
{
|
||||
return success(lblProductService.getSaveTask(taskId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:label:list')")
|
||||
@@ -158,7 +169,7 @@ public class LabelPackageController extends BaseController
|
||||
public AjaxResult versions(@PathVariable Long priceSetId)
|
||||
{
|
||||
priceSetService.assertSetCategory(priceSetId, PrcPriceSet.CATEGORY_LABEL);
|
||||
return success(payProductService.selectLabelVersions(priceSetId));
|
||||
return success(lblProductService.selectVersions(priceSetId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:label:edit')")
|
||||
@@ -169,7 +180,7 @@ public class LabelPackageController extends BaseController
|
||||
{
|
||||
priceSetService.assertSetCategory(priceSetId, PrcPriceSet.CATEGORY_LABEL);
|
||||
Date effectiveTime = parseEffectiveTime(body == null ? null : body.get("effectiveTime"));
|
||||
String message = payProductService.activateLabelVersion(priceSetId, versionNo, effectiveTime);
|
||||
String message = lblProductService.activateVersion(priceSetId, versionNo, effectiveTime);
|
||||
Map<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put("message", message);
|
||||
return success(payload);
|
||||
@@ -181,7 +192,7 @@ public class LabelPackageController extends BaseController
|
||||
public AjaxResult deleteVersion(@PathVariable Long priceSetId, @PathVariable Integer versionNo)
|
||||
{
|
||||
priceSetService.assertSetCategory(priceSetId, PrcPriceSet.CATEGORY_LABEL);
|
||||
return toAjax(payProductService.deleteLabelVersion(priceSetId, versionNo));
|
||||
return toAjax(lblProductService.deleteVersion(priceSetId, versionNo));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:label:list')")
|
||||
@@ -192,32 +203,53 @@ public class LabelPackageController extends BaseController
|
||||
priceSetService.assertSetCategory(priceSetId, PrcPriceSet.CATEGORY_LABEL);
|
||||
if (versionNo != null)
|
||||
{
|
||||
return success(payProductService.selectLabelProductsByVersion(priceSetId, versionNo));
|
||||
return success(lblProductService.selectProductsByVersion(priceSetId, versionNo));
|
||||
}
|
||||
return success(payProductService.selectLabelProducts(priceSetId));
|
||||
return success(lblProductService.selectProducts(priceSetId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:label:query')")
|
||||
@GetMapping("/product/{productId}")
|
||||
public AjaxResult productDetail(@PathVariable Long productId,
|
||||
@RequestParam(value = "termId", required = false) Long termId)
|
||||
@RequestParam(value = "termId", required = false) Long termId,
|
||||
@RequestParam(value = "versionId", required = false) Long versionId)
|
||||
{
|
||||
if (termId != null)
|
||||
Long vid = versionId != null ? versionId : termId;
|
||||
if (vid != null)
|
||||
{
|
||||
return success(payProductService.selectPayProductDetailByTerm(termId));
|
||||
return success(lblProductService.selectDetailByVersionId(vid));
|
||||
}
|
||||
return success(payProductService.selectPayProductDetail(productId));
|
||||
throw new ServiceException("请传入 versionId");
|
||||
}
|
||||
|
||||
/** 保存打单产品明细(重量段/附加费等),按当前 term 覆盖子表 */
|
||||
/** 保存打单产品明细(重量段/附加费等),按当前 version 覆盖子表 */
|
||||
@PreAuthorize("@ss.hasPermi('price:label:edit')")
|
||||
@Log(title = "打单产品明细", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/product")
|
||||
public AjaxResult updateProduct(@RequestBody PayProduct product)
|
||||
public AjaxResult updateProduct(@RequestBody LblProduct product)
|
||||
{
|
||||
return toAjax(payProductService.updateDetail(product));
|
||||
return toAjax(lblProductService.updateDetail(product));
|
||||
}
|
||||
|
||||
/** 仅保存当前重量段行 */
|
||||
@PreAuthorize("@ss.hasPermi('price:label:edit')")
|
||||
@Log(title = "打单重量段", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/product/band")
|
||||
public AjaxResult updateWeightBand(@RequestBody LblWeightBand band)
|
||||
{
|
||||
return toAjax(lblProductService.updateWeightBand(band));
|
||||
}
|
||||
|
||||
/** 仅保存当前附加费行 */
|
||||
@PreAuthorize("@ss.hasPermi('price:label:edit')")
|
||||
@Log(title = "打单附加费", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/product/surcharge")
|
||||
public AjaxResult updateSurcharge(@RequestBody LblSurcharge surcharge)
|
||||
{
|
||||
return toAjax(lblProductService.updateSurcharge(surcharge));
|
||||
}
|
||||
|
||||
|
||||
/** 查询打单产品已绑定渠道(默认应收 AR) */
|
||||
@PreAuthorize("@ss.hasPermi('price:label:query')")
|
||||
@GetMapping("/product/{productId}/channels")
|
||||
@@ -225,7 +257,7 @@ public class LabelPackageController extends BaseController
|
||||
@RequestParam(value = "payType", required = false) String payType)
|
||||
{
|
||||
String type = (payType == null || payType.trim().isEmpty()) ? "AR" : payType.trim();
|
||||
return success(payProductService.listProductChannelBinds(productId, type));
|
||||
return success(lblProductService.listProductChannelBinds(productId, type));
|
||||
}
|
||||
|
||||
/** 覆盖保存打单产品渠道绑定,写入 srv_channel_product_map */
|
||||
@@ -247,7 +279,7 @@ public class LabelPackageController extends BaseController
|
||||
}
|
||||
}
|
||||
}
|
||||
String msg = payProductService.replaceProductChannelBinds(productId, payType, channelIds);
|
||||
String msg = lblProductService.replaceProductChannelBinds(productId, payType, channelIds);
|
||||
return AjaxResult.success(msg);
|
||||
}
|
||||
|
||||
@@ -257,7 +289,7 @@ public class LabelPackageController extends BaseController
|
||||
public AjaxResult removeProducts(@PathVariable Long priceSetId, @PathVariable Long[] productIds)
|
||||
{
|
||||
priceSetService.assertSetCategory(priceSetId, PrcPriceSet.CATEGORY_LABEL);
|
||||
return toAjax(payProductService.removeLabelProducts(priceSetId, productIds));
|
||||
return toAjax(lblProductService.removeProducts(priceSetId, productIds));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user