From a0d55bcc8bfebd408d16166b27b7e05b3e4c9f4a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 02 十一月 2026 16:51:50 +0800
Subject: [PATCH] feat(erp): 采购/销售明细按含税单价口径拆税,供应商合同补供应商名称与附件
---
yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java | 39 +++++++++++++++++++++++++++++++++++----
1 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java
index 4495e23..00e33da 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java
@@ -14,6 +14,7 @@
import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemSaveReqVO;
import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemStatusUpdateReqVO;
import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemSyncUpdateReqVO;
+import cn.iocoder.yudao.module.mdm.dal.dataobject.brand.MdmBrandDO;
import cn.iocoder.yudao.module.mdm.dal.dataobject.category.MdmItemCategoryDO;
import cn.iocoder.yudao.module.mdm.dal.dataobject.item.MdmItemBatchConfigDO;
import cn.iocoder.yudao.module.mdm.dal.dataobject.item.MdmItemDO;
@@ -122,7 +123,6 @@
@GetMapping("/get")
@Operation(summary = "鑾峰緱鐗╂枡")
@Parameter(name = "id", description = "缂栧彿", required = true, example = "1")
- @PreAuthorize("@ss.hasPermission('mdm:item:query')")
public CommonResult<MdmItemRespVO> getItem(@RequestParam("id") Long id) {
MdmItemDO item = itemService.getItem(id);
MdmItemRespVO resp = BeanUtils.toBean(item, MdmItemRespVO.class);
@@ -138,7 +138,6 @@
@GetMapping("/page")
@Operation(summary = "鑾峰緱鐗╂枡鍒嗛〉")
- @PreAuthorize("@ss.hasPermission('mdm:item:query')")
public CommonResult<PageResult<MdmItemRespVO>> getItemPage(@Valid MdmItemPageReqVO pageReqVO) {
PageResult<MdmItemDO> pageResult = itemService.getItemPage(pageReqVO);
// 杞崲骞惰ˉ榻愬叧鑱斿悕绉�
@@ -181,6 +180,9 @@
// 鍏宠仈鏌ヨ璁¢噺鍗曚綅鍚嶇О
Map<Long, MdmUnitMeasureDO> unitMap = unitMeasureService.getUnitMeasureMap(
convertSet(itemList, MdmItemDO::getUnitMeasureId));
+ // 鍏宠仈鏌ヨ鍝佺墝鍚嶇О锛堥噰璐笅鍗曢渶瑕佺‘璁ゅ搧鐗岋級
+ Map<Long, MdmBrandDO> brandMap = brandService.getBrandMap(
+ convertSet(itemList, MdmItemDO::getBrandId));
// 杞崲
List<MdmItemRespVO> respList = BeanUtils.toBean(itemList, MdmItemRespVO.class);
// 鎵归噺鏌ヨ鍚屾鐘舵��
@@ -213,6 +215,11 @@
if (unit != null) {
resp.setUnitMeasureName(unit.getName());
}
+ // 鍝佺墝鍚嶇О
+ MdmBrandDO brand = brandMap.get(resp.getBrandId());
+ if (brand != null) {
+ resp.setBrandName(brand.getName());
+ }
MdmUnitMeasureDO auxUnit1 = auxUnitMap.get(resp.getUnitMeasureId2());
if (auxUnit1 != null) {
resp.setUnitMeasureName2(auxUnit1.getName());
@@ -234,7 +241,6 @@
@GetMapping("/list-by-ids")
@Operation(summary = "鑾峰緱鐗╂枡鍒楄〃")
@Parameter(name = "ids", description = "缂栧彿鍒楄〃", required = true, example = "1,2,3")
- @PreAuthorize("@ss.hasPermission('mdm:item:query')")
public CommonResult<List<MdmItemRespVO>> getItemList(@RequestParam("ids") List<Long> ids) {
List<MdmItemDO> list = itemService.getItemList(ids);
return success(BeanUtils.toBean(list, MdmItemRespVO.class));
@@ -248,10 +254,16 @@
// 濉厖鍗曚綅鍚嶇О绛夊叧鑱斿瓧娈碉紝纭繚涓嬫媺閫夋嫨鍚庡彲甯﹀嚭鍗曚綅绛変俊鎭�
Map<Long, MdmUnitMeasureDO> unitMap = unitMeasureService.getUnitMeasureMap(
convertSet(respList, MdmItemRespVO::getUnitMeasureId));
+ Map<Long, MdmBrandDO> brandMap = brandService.getBrandMap(
+ convertSet(respList, MdmItemRespVO::getBrandId));
respList.forEach(resp -> {
MdmUnitMeasureDO unit = unitMap.get(resp.getUnitMeasureId());
if (unit != null) {
resp.setUnitMeasureName(unit.getName());
+ }
+ MdmBrandDO brand = brandMap.get(resp.getBrandId());
+ if (brand != null) {
+ resp.setBrandName(brand.getName());
}
});
return success(respList);
@@ -266,6 +278,13 @@
MdmItemCategoryDO category = itemCategoryService.getItemCategory(resp.getCategoryId());
if (category != null) {
resp.setCategoryName(category.getName());
+ }
+ }
+ // 鍝佺墝鍚嶇О
+ if (resp.getBrandId() != null) {
+ MdmBrandDO brand = brandService.getBrand(resp.getBrandId());
+ if (brand != null) {
+ resp.setBrandName(brand.getName());
}
}
// 涓诲崟浣嶅悕绉�
@@ -333,7 +352,19 @@
@PreAuthorize("@ss.hasPermission('mdm:item:import')")
public CommonResult<MdmItemImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
- List<MdmItemImportExcelVO> list = ExcelUtils.read(file, MdmItemImportExcelVO.class);
+ List<MdmItemImportExcelVO> list;
+ try {
+ list = ExcelUtils.read(file, MdmItemImportExcelVO.class);
+ } catch (cn.idev.excel.exception.ExcelDataConvertException e) {
+ int row = e.getRowIndex() == null ? 0 : e.getRowIndex() + 1;
+ int col = e.getColumnIndex() == null ? 0 : e.getColumnIndex() + 1;
+ String cellVal = e.getCellData() == null ? "" : String.valueOf(e.getCellData().getStringValue());
+ throw new cn.iocoder.yudao.framework.common.exception.ServiceException(400,
+ "Excel 绗� " + row + " 琛岀 " + col + " 鍒楁暟鎹��" + cellVal + "銆忔牸寮忎笉姝g‘锛岃妫�鏌ヨ鍒楀唴瀹癸紙渚嬪鈥滅姸鎬佲�濊濉� 0/1 鎴� 鍚敤/鍋滅敤锛�");
+ } catch (Exception e) {
+ throw new cn.iocoder.yudao.framework.common.exception.ServiceException(400,
+ "Excel 瑙f瀽澶辫触锛�" + e.getMessage() + "锛岃浣跨敤绯荤粺鈥滀笅杞藉鍏ユā鏉库�濆苟鎸夋ā鏉垮~鍐欍��");
+ }
return success(itemService.importItemList(list, updateSupport));
}
--
Gitblit v1.9.3