|
@ -9,6 +9,8 @@ import com.win.framework.excel.core.util.ExcelUtils; |
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
|
|
import com.win.module.wms.controller.purchasereceiptRequest.vo.PurchasereceiptRequestMainExcelVO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRequest.PurchasereceiptRequestMainDO; |
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
import com.win.module.wms.controller.itembasic.vo.*; |
|
|
import com.win.module.wms.controller.itembasic.vo.*; |
|
|
import com.win.module.wms.convert.itembasic.ItembasicConvert; |
|
|
import com.win.module.wms.convert.itembasic.ItembasicConvert; |
|
@ -20,6 +22,7 @@ import io.swagger.v3.oas.annotations.Parameter; |
|
|
import io.swagger.v3.oas.annotations.Parameters; |
|
|
import io.swagger.v3.oas.annotations.Parameters; |
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
@ -105,15 +108,6 @@ public class ItembasicController { |
|
|
return success(ItembasicConvert.INSTANCE.convert(itembasic)); |
|
|
return success(ItembasicConvert.INSTANCE.convert(itembasic)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/list") |
|
|
|
|
|
@Operation(summary = "获得物品基本信息列表") |
|
|
|
|
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:itembasic:query')") |
|
|
|
|
|
public CommonResult<List<ItembasicRespVO>> getItembasicList(@RequestParam("ids") Collection<Long> ids) { |
|
|
|
|
|
List<ItembasicDO> list = itembasicService.getItembasicList(ids); |
|
|
|
|
|
return success(ItembasicConvert.INSTANCE.convertList(list)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/page") |
|
|
@GetMapping("/page") |
|
|
@Operation(summary = "获得物品基本信息分页") |
|
|
@Operation(summary = "获得物品基本信息分页") |
|
|
@PreAuthorize("@ss.hasPermission('wms:itembasic:query')") |
|
|
@PreAuthorize("@ss.hasPermission('wms:itembasic:query')") |
|
@ -149,21 +143,28 @@ public class ItembasicController { |
|
|
public void exportItembasicExcel(@Valid ItembasicExportReqVO exportReqVO, |
|
|
public void exportItembasicExcel(@Valid ItembasicExportReqVO exportReqVO, |
|
|
HttpServletResponse response) throws IOException { |
|
|
HttpServletResponse response) throws IOException { |
|
|
List<ItembasicDO> list = itembasicService.getItembasicList(exportReqVO); |
|
|
List<ItembasicDO> list = itembasicService.getItembasicList(exportReqVO); |
|
|
// 导出 Excel
|
|
|
|
|
|
List<ItembasicExcelVO> datas = ItembasicConvert.INSTANCE.convertList02(list); |
|
|
|
|
|
for(ItembasicExcelVO vo : datas) { |
|
|
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
|
|
} |
|
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
|
|
List<ItembasicExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
|
|
ExcelUtils.write(response, "物品基本信息.xlsx", "数据", ItembasicExcelVO.class, resultList, mapDropDown); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
|
|
@Operation(summary = "导出物品基本信息 Excel") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:itembasic:export')") |
|
|
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
|
|
public void exportItembasicExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
|
|
List<ItembasicDO> list = itembasicService.getItembasicList(conditions); |
|
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
|
|
List<ItembasicExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
|
|
ExcelUtils.write(response, "物品基本信息.xlsx", "数据", ItembasicExcelVO.class, resultList, mapDropDown); |
|
|
|
|
|
} |
|
|
|
|
|
private List<ItembasicExcelVO> getExcelVo(List<ItembasicDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
String[] status = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.ITEM_STATUS); |
|
|
String[] status = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.ITEM_STATUS); |
|
|
mapDropDown.put(4, status); |
|
|
mapDropDown.put(4, status); |
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
mapDropDown.put(5, uom); |
|
|
mapDropDown.put(5, uom); |
|
|
String[] altUom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
String[] altUom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
mapDropDown.put(6, altUom); |
|
|
mapDropDown.put(6, altUom); |
|
|
mapDropDown.put(6, altUom); |
|
|
|
|
|
String[] isStdPack = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
String[] isStdPack = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
mapDropDown.put(7, isStdPack); |
|
|
mapDropDown.put(7, isStdPack); |
|
|
String[] enableBuy = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
String[] enableBuy = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
@ -192,8 +193,16 @@ public class ItembasicController { |
|
|
mapDropDown.put(20, eqLevel); |
|
|
mapDropDown.put(20, eqLevel); |
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
mapDropDown.put(22, available); |
|
|
mapDropDown.put(22, available); |
|
|
ExcelUtils.write(response, "物品基本信息.xlsx", "数据", ItembasicExcelVO.class, datas,mapDropDown); |
|
|
// 导出 Excel
|
|
|
|
|
|
List<ItembasicExcelVO> resultList = ItembasicConvert.INSTANCE.convertList02(list); |
|
|
|
|
|
for(ItembasicExcelVO vo : resultList) { |
|
|
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
|
|
} |
|
|
|
|
|
return resultList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/get-import-template") |
|
|
@GetMapping("/get-import-template") |
|
|
@Operation(summary = "获得导入物品基本信息模板") |
|
|
@Operation(summary = "获得导入物品基本信息模板") |
|
|
public void importTemplate(HttpServletResponse response) throws IOException { |
|
|
public void importTemplate(HttpServletResponse response) throws IOException { |
|
|