|
|
@ -10,7 +10,6 @@ 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.inspectRequest.vo.*; |
|
|
|
import com.win.module.wms.convert.inspectRequest.InspectRequestDetailConvert; |
|
|
|
import com.win.module.wms.convert.inspectRequest.InspectRequestMainConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.inspectRequest.InspectRequestDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.inspectRequest.InspectRequestMainDO; |
|
|
@ -45,7 +44,6 @@ public class InspectRequestMainController { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private InspectRequestMainService inspectRequestMainService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private InspectRequestDetailService inspectRequestDetailService; |
|
|
|
@Resource |
|
|
@ -113,21 +111,57 @@ public class InspectRequestMainController { |
|
|
|
} |
|
|
|
return success(result); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel") |
|
|
|
@Operation(summary = "导出检验申请主 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-request-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportInspectRequestMainExcel(@Valid InspectRequestMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
public void exportInspectRequestMainExcel(@Valid InspectRequestMainExportReqVO exportReqVO, HttpServletResponse response) throws IOException { |
|
|
|
List<InspectRequestMainDO> list = inspectRequestMainService.getInspectRequestMainList(exportReqVO); |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<InspectRequestMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "到货检验申请主.xls", "检验申请信息列表", InspectRequestMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出检验申请主 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-request-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportInspectRequestMainSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<InspectRequestMainDO> list = inspectRequestMainService.getInspectRequestMainList(conditions); |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<InspectRequestMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "到货检验申请主.xls", "检验申请信息列表", InspectRequestMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
private List<InspectRequestMainExcelVO> getExcelVo(List<InspectRequestMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] locationType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
mapDropDown.put(6, locationType); |
|
|
|
String[] requestStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.REQUEST_STATUS); |
|
|
|
mapDropDown.put(11, requestStatus); |
|
|
|
String[] inspectType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INSPECT_TYPE); |
|
|
|
mapDropDown.put(15, inspectType); |
|
|
|
String[] nextAction = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.NEXT_ACTION); |
|
|
|
mapDropDown.put(16, nextAction); |
|
|
|
String[] sampleMethod = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.SAMPLE_METHOD); |
|
|
|
mapDropDown.put(17, sampleMethod); |
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
mapDropDown.put(18, uom); |
|
|
|
String[] inventoryStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INVENTORY_STATUS); |
|
|
|
mapDropDown.put(28, inventoryStatus); |
|
|
|
// 导出 Excel
|
|
|
|
List<InspectRequestMainExcelVO> datas = InspectRequestMainConvert.INSTANCE.convertList02(list); |
|
|
|
for(InspectRequestMainExcelVO vo : datas) { |
|
|
|
List<InspectRequestMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
for(InspectRequestMainDO mainDO : list) { |
|
|
|
List<InspectRequestDetailDO> subList = inspectRequestDetailService.selectList(mainDO.getId()); |
|
|
|
for(InspectRequestDetailDO detailDO : subList) { |
|
|
|
InspectRequestMainExcelVO vo = InspectRequestMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
resultList.add(vo); |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "检验申请主.xls", "数据", InspectRequestMainExcelVO.class, datas); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/get-import-template") |
|
|
@ -164,27 +198,55 @@ public class InspectRequestMainController { |
|
|
|
Map<String, Object> returnMap = new HashMap<>(); |
|
|
|
returnMap.put("errorCount", errorList.size()); |
|
|
|
if(!errorList.isEmpty()) { |
|
|
|
String url = ExcelUtils.writeLocalFile("检验申请基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); |
|
|
|
String url = ExcelUtils.writeLocalFile("到货检验申请基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); |
|
|
|
returnMap.put("errorFile", url); |
|
|
|
} |
|
|
|
return success(returnMap); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/getInspectRequestById") |
|
|
|
@Operation(summary = "APP获得检验申请主子表明细列表") |
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-request-main:query')") |
|
|
|
public CommonResult<InspectRequestMainRespVO> getInspectRequestById(@RequestParam("id") Long id) { |
|
|
|
InspectRequestMainDO inspectRequestMain = inspectRequestMainService.getInspectRequestMain(id); |
|
|
|
InspectRequestMainRespVO result = InspectRequestMainConvert.INSTANCE.convert(inspectRequestMain); |
|
|
|
if(result==null) { |
|
|
|
return success(result); |
|
|
|
}; |
|
|
|
InspectRequestDetailExportReqVO reqVO = new InspectRequestDetailExportReqVO(); |
|
|
|
reqVO.setMasterId(result.getId()); |
|
|
|
List<InspectRequestDetailDO> list = inspectRequestDetailService.getInspectRequestDetailList(reqVO); |
|
|
|
List<InspectRequestDetailExcelVO> vos = InspectRequestDetailConvert.INSTANCE.convertList02(list); |
|
|
|
result.setSubList(vos); |
|
|
|
return success(result); |
|
|
|
@PutMapping("/close") |
|
|
|
@Operation(summary = "关闭到货检验申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-request-main:close')") |
|
|
|
public CommonResult<Boolean> closeInspectRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = inspectRequestMainService.closeInspectRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/submit") |
|
|
|
@Operation(summary = "提交到货检验申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-request-main:submit')") |
|
|
|
public CommonResult<Boolean> submitInspectRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = inspectRequestMainService.submitInspectRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/agree") |
|
|
|
@Operation(summary = "审批通过到货检验申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-request-main:agree')") |
|
|
|
public CommonResult<Boolean> agreeInspectRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = inspectRequestMainService.agreeInspectRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/handle") |
|
|
|
@Operation(summary = "执行到货检验申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-request-main:handle')") |
|
|
|
public CommonResult<Boolean> handleInspectRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = inspectRequestMainService.handleInspectRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/abort") |
|
|
|
@Operation(summary = "审批拒绝到货检验申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-request-main:abort')") |
|
|
|
public CommonResult<Boolean> abortInspectRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = inspectRequestMainService.abortInspectRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|