|
|
@ -8,12 +8,15 @@ 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.itembasic.vo.ItembasicExcelVO; |
|
|
|
import com.win.module.wms.controller.location.vo.LocationRespVO; |
|
|
|
import com.win.module.wms.controller.workshop.vo.WorkshopRespVO; |
|
|
|
import com.win.module.wms.controller.workshop.vo.*; |
|
|
|
import com.win.module.wms.convert.itembasic.ItembasicConvert; |
|
|
|
import com.win.module.wms.convert.location.LocationConvert; |
|
|
|
import com.win.module.wms.convert.workshop.WorkshopConvert; |
|
|
|
import com.win.module.wms.convert.workshop.WorkshopConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
import com.win.module.wms.dal.dataobject.workshop.WorkshopDO; |
|
|
|
import com.win.module.wms.dal.dataobject.workshop.WorkshopDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
@ -83,15 +86,6 @@ public class WorkshopController { |
|
|
|
return success(WorkshopConvert.INSTANCE.convert(workshop)); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/list") |
|
|
|
@Operation(summary = "获得车间列表") |
|
|
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:workshop:query')") |
|
|
|
public CommonResult<List<WorkshopRespVO>> getWorkshopList(@RequestParam("ids") Collection<Long> ids) { |
|
|
|
List<WorkshopDO> list = workshopService.getWorkshopList(ids); |
|
|
|
return success(WorkshopConvert.INSTANCE.convertList(list)); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/page") |
|
|
|
@Operation(summary = "获得车间分页") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:workshop:query')") |
|
|
@ -113,19 +107,33 @@ public class WorkshopController { |
|
|
|
public void exportWorkshopExcel(@Valid WorkshopExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<WorkshopDO> list = workshopService.getWorkshopList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
List<WorkshopExcelVO> datas = WorkshopConvert.INSTANCE.convertList02(list); |
|
|
|
for(WorkshopExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
} |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<WorkshopExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "车间.xlsx", "数据", WorkshopExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出车间 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:workshop:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportWorkshopExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<WorkshopDO> list = workshopService.getWorkshopList(conditions); |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<WorkshopExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "车间.xlsx", "数据", WorkshopExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
private List<WorkshopExcelVO> getExcelVo(List<WorkshopDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
mapDropDown.put(4, available); |
|
|
|
String[] type = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.WORKSHOP_TYPE); |
|
|
|
mapDropDown.put(3, type); |
|
|
|
ExcelUtils.write(response, "车间.xls", "数据", WorkshopExcelVO.class, datas,mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
List<WorkshopExcelVO> resultList = WorkshopConvert.INSTANCE.convertList02(list); |
|
|
|
for(WorkshopExcelVO vo : resultList) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/senior") |
|
|
|