|
|
@ -3,14 +3,17 @@ package com.win.module.wms.controller.packageMassage; |
|
|
|
import com.win.framework.common.pojo.CommonResult; |
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
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.system.api.user.AdminUserApi; |
|
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
import com.win.module.wms.controller.packageMassage.vo.*; |
|
|
|
import com.win.module.wms.convert.packageMassage.PackageConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.deliverRequest.DeliverRequestDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.packageMassage.PackageDO; |
|
|
|
import com.win.module.wms.dal.mysql.packageMassage.PackageMapper; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.packageMassage.PackageService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
@ -23,8 +26,7 @@ import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.validation.Valid; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import static com.win.framework.common.pojo.CommonResult.success; |
|
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
|
|
@ -104,17 +106,39 @@ public class PackageController { |
|
|
|
public void exportPackageExcel(@Valid PackageExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<PackageDO> list = packageService.getPackageList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<PackageExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "发货申请.xlsx", "数据", PackageExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出包装 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:deliver-request-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportPackageSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<PackageDO> list = packageService.getPackageList(conditions); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<PackageExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
List<PackageExcelVO> datas = PackageConvert.INSTANCE.convertList02(list); |
|
|
|
for(PackageExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "包装.xls", "数据", PackageExcelVO.class, datas); |
|
|
|
ExcelUtils.write(response, "发货申请.xlsx", "数据", PackageExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
private List<PackageExcelVO> getExcelVo(List<PackageDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
mapDropDown.put(10, uom); |
|
|
|
mapDropDown.put(12, uom); |
|
|
|
String[] packUnit = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.PACK_UNIT); |
|
|
|
mapDropDown.put(16, packUnit); |
|
|
|
List<PackageExcelVO> resultList = PackageConvert.INSTANCE.convertList02(list); |
|
|
|
// 导出
|
|
|
|
for (PackageExcelVO vo : resultList) { |
|
|
|
vo.setCreator(userApi.getUser(Long.valueOf(vo.getCreator())).getNickname()); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
@PostMapping("/senior") |
|
|
|
@Operation(summary = "高级搜索获得包装分页") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:package:query')") |
|
|
|