|
|
@ -1,9 +1,18 @@ |
|
|
|
package com.win.module.wms.controller.customerreceiptRecord; |
|
|
|
|
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.framework.dict.core.util.DictFrameworkUtils; |
|
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
import com.win.module.wms.controller.customerreceiptRecord.vo.*; |
|
|
|
import com.win.module.wms.controller.customerreturnJob.vo.CustomerreturnJobMainExcelVO; |
|
|
|
import com.win.module.wms.controller.customerreturnJob.vo.CustomerreturnJobMainExportReqVO; |
|
|
|
import com.win.module.wms.convert.customerreturnJob.CustomerreturnJobMainConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.customerreceiptRecord.CustomerreceiptRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.customerreturnJob.CustomerreturnJobDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.customerreturnJob.CustomerreturnJobMainDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.customerreceiptRecord.CustomerreceiptRecordDetailService; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
@ -39,6 +48,8 @@ public class CustomerreceiptRecordMainController { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private CustomerreceiptRecordMainService customerreceiptRecordMainService; |
|
|
|
@Resource |
|
|
|
private CustomerreceiptRecordDetailService customerreceiptRecordDetailService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private AdminUserApi userApi; |
|
|
@ -112,13 +123,51 @@ public class CustomerreceiptRecordMainController { |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<CustomerreceiptRecordMainDO> list = customerreceiptRecordMainService.getCustomerreceiptRecordMainList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
List<CustomerreceiptRecordMainExcelVO> datas = CustomerreceiptRecordMainConvert.INSTANCE.convertList02(list); |
|
|
|
for(CustomerreceiptRecordMainExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<CustomerreceiptRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "发货任务.xls", "数据", CustomerreceiptRecordMainExcelVO.class, resultList,mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出客户退货任务 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:customerreturn-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportCustomerreceiptRecordMainSeniorExcel(@Valid CustomerreceiptRecordMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<CustomerreceiptRecordMainDO> list = customerreceiptRecordMainService.getCustomerreceiptRecordMainList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<CustomerreceiptRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "发货任务.xls", "数据", CustomerreceiptRecordMainExcelVO.class, resultList,mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
private List<CustomerreceiptRecordMainExcelVO> getExcelVo(List<CustomerreceiptRecordMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] transferMode = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRANSFER_MODE); |
|
|
|
mapDropDown.put(7, transferMode); |
|
|
|
String[] interfaceType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INTERFACE_TYPE); |
|
|
|
mapDropDown.put(18, interfaceType); |
|
|
|
mapDropDown.put(54, interfaceType); |
|
|
|
String[] locationType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
mapDropDown.put(24, locationType); |
|
|
|
mapDropDown.put(25, locationType); |
|
|
|
String[] trueFalse = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
mapDropDown.put(28, trueFalse); |
|
|
|
String[] inventoryStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INVENTORY_STATUS); |
|
|
|
mapDropDown.put(30, inventoryStatus); |
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
mapDropDown.put(52, uom); |
|
|
|
List<CustomerreceiptRecordMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
// 导出
|
|
|
|
for(CustomerreceiptRecordMainDO mainDO : list) { |
|
|
|
List<CustomerreceiptRecordDetailDO> subList = customerreceiptRecordDetailService.selectList(mainDO.getId()); |
|
|
|
for(CustomerreceiptRecordDetailDO detailDO : subList) { |
|
|
|
CustomerreceiptRecordMainExcelVO vo = CustomerreceiptRecordMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
vo.setCreator(userApi.getUser(Long.valueOf(vo.getCreator())).getNickname()); |
|
|
|
vo.setCreatorDetail(userApi.getUser(Long.valueOf(vo.getCreatorDetail())).getNickname()); |
|
|
|
resultList.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "客户收货记录主.xls", "数据", CustomerreceiptRecordMainExcelVO.class, datas); |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|