|
|
@ -6,10 +6,16 @@ import com.win.framework.common.pojo.PageResult; |
|
|
|
import com.win.framework.dict.core.util.DictFrameworkUtils; |
|
|
|
import com.win.framework.excel.core.util.ExcelUtils; |
|
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
|
import com.win.module.wms.controller.containerBind.vo.ContainerBindRecordMainExcelVO; |
|
|
|
import com.win.module.wms.controller.containerinit.vo.*; |
|
|
|
import com.win.module.wms.convert.containerBind.ContainerBindRecordMainConvert; |
|
|
|
import com.win.module.wms.convert.containerinit.ContainerInitRecordMainConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.containerBind.ContainerBindRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.containerBind.ContainerBindRecordMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.containerinit.ContainerInitRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.containerinit.ContainerInitRecordMainDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.containerinit.ContainerInitRecordDetailService; |
|
|
|
import com.win.module.wms.service.containerinit.ContainerInitRecordMainService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
@ -40,6 +46,9 @@ public class ContainerInitRecordMainController { |
|
|
|
@Resource |
|
|
|
private ContainerInitRecordMainService containerInitRecordMainService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private ContainerInitRecordDetailService containerInitRecordDetailService; |
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
|
@Operation(summary = "创建器具初始化记录主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:container-init-record-main:create')") |
|
|
@ -96,32 +105,42 @@ public class ContainerInitRecordMainController { |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportContainerInitRecordMainExcel(@Valid ContainerInitRecordMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<ContainerInitRecordMainDO> list = containerInitRecordMainService.getContainerInitRecordMainList(exportReqVO); |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<ContainerInitRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "器具初始化记录.xls", "数据", ContainerInitRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出器具初始化记录主子 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:container-init-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportContainerInitRecordMainExcel(@Valid @RequestBody CustomConditions conditions, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<ContainerInitRecordMainDO> list = containerInitRecordMainService.getContainerInitRecordMainList(conditions); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "器具初始化记录.xls", "数据", ContainerInitRecordMainDO.class, list, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<ContainerInitRecordMainExcelVO> getExcelVo(List<ContainerInitRecordMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] componentContainerType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.CONTAINER_TYPE); |
|
|
|
mapDropDown.put(3, componentContainerType); |
|
|
|
String[] componentContainerStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.CONTAINER_STATUS); |
|
|
|
mapDropDown.put(5, componentContainerStatus); |
|
|
|
List<ContainerInitRecordMainExcelVO> list = containerInitRecordMainService.getContainerInitRecordMainList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "器具初始化记录.xls", "数据", ContainerInitRecordMainExcelVO.class, list,mapDropDown); |
|
|
|
List<ContainerInitRecordMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
// 导出
|
|
|
|
for (ContainerInitRecordMainDO mainDO : list) { |
|
|
|
List<ContainerInitRecordDetailDO> subList = containerInitRecordDetailService.selectListByID(mainDO.getId()); |
|
|
|
for (ContainerInitRecordDetailDO detailDO : subList) { |
|
|
|
ContainerInitRecordMainExcelVO vo = ContainerInitRecordMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
resultList.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
// @GetMapping("/export-excel-senior")
|
|
|
|
// @Operation(summary = "导出器具初始化记录主子 Excel")
|
|
|
|
// @PreAuthorize("@ss.hasPermission('wms:container-init-record-main:export')")
|
|
|
|
// @OperateLog(type = EXPORT)
|
|
|
|
// public void exportContainerInitRecordMainExcel(@Valid @RequestBody CustomConditions conditions,
|
|
|
|
// HttpServletResponse response) throws IOException {
|
|
|
|
// Map<Integer, String[]> mapDropDown = new HashMap<>();
|
|
|
|
// String[] componentContainerType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.CONTAINER_TYPE);
|
|
|
|
// mapDropDown.put(3, componentContainerType);
|
|
|
|
// String[] componentContainerStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.CONTAINER_STATUS);
|
|
|
|
// mapDropDown.put(5, componentContainerStatus);
|
|
|
|
// List<ContainerInitRecordMainExcelVO> list = containerInitRecordMainService.getContainerInitRecordMainList(conditions);
|
|
|
|
// // 导出 Excel
|
|
|
|
// ExcelUtils.write(response, "器具初始化记录.xls", "数据", ContainerInitRecordMainExcelVO.class, list,mapDropDown);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
|
|
|
|
@GetMapping("/get-import-template") |
|
|
|
@Operation(summary = "获得导入器具初始化记录主模板") |
|
|
@ -149,7 +168,7 @@ public class ContainerInitRecordMainController { |
|
|
|
|
|
|
|
Map<String, Object> returnMap = new HashMap<>(); |
|
|
|
returnMap.put("errorCount", errorList.size()); |
|
|
|
if(!errorList.isEmpty()) { |
|
|
|
if (!errorList.isEmpty()) { |
|
|
|
String url = ExcelUtils.writeLocalFile("器具初始化记录主基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); |
|
|
|
returnMap.put("errorFile", url); |
|
|
|
} |
|
|
|