|
|
@ -1,10 +1,18 @@ |
|
|
|
package com.win.module.wms.controller.customersettleRequest; |
|
|
|
|
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.framework.dict.core.util.DictFrameworkUtils; |
|
|
|
import com.win.framework.excel.core.util.ConvertUtil; |
|
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
import com.win.module.wms.controller.customerreturnRequest.vo.CustomerreturnRequestMainExcelVO; |
|
|
|
import com.win.module.wms.controller.customersettleRequest.vo.CustomersettleRequestMainCreateReqVO; |
|
|
|
import com.win.module.wms.convert.customerreturnRequest.CustomerreturnRequestMainConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.customerreturnRequest.CustomerreturnRequestDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.customerreturnRequest.CustomerreturnRequestMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.customersettleRequest.CustomersettleRequestDetailDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.customersettleRequest.CustomersettleRequestDetailService; |
|
|
|
import io.swagger.v3.oas.annotations.Parameters; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import javax.annotation.Resource; |
|
|
@ -45,6 +53,8 @@ public class CustomersettleRequestMainController { |
|
|
|
@Resource |
|
|
|
private CustomersettleRequestMainService customersettleRequestMainService; |
|
|
|
@Resource |
|
|
|
private CustomersettleRequestDetailService customersettleRequestDetailService; |
|
|
|
@Resource |
|
|
|
private AdminUserApi userApi; |
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
@ -117,34 +127,64 @@ public class CustomersettleRequestMainController { |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<CustomersettleRequestMainDO> list = customersettleRequestMainService.getCustomersettleRequestMainList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
List<CustomersettleRequestMainExcelVO> datas = CustomersettleRequestMainConvert.INSTANCE.convertList02(list); |
|
|
|
for(CustomersettleRequestMainExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<CustomersettleRequestMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "客户结算申请.xls", "数据", CustomersettleRequestMainExcelVO.class, resultList,mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出客户结算申请主 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:customersettle-request-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportCustomersettleRequestMainSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<CustomersettleRequestMainDO> list = customersettleRequestMainService.getCustomersettleRequestMainList(conditions); |
|
|
|
// 导出 Excel
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<CustomersettleRequestMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "客户结算申请.xls", "数据", CustomersettleRequestMainExcelVO.class, resultList,mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
private List<CustomersettleRequestMainExcelVO> getExcelVo(List<CustomersettleRequestMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] locationType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
mapDropDown.put(5, locationType); |
|
|
|
String[] requestStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.REQUEST_STATUS); |
|
|
|
mapDropDown.put(14, requestStatus); |
|
|
|
String[] inventoryStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INVENTORY_STATUS); |
|
|
|
mapDropDown.put(35, inventoryStatus); |
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
mapDropDown.put(46, uom); |
|
|
|
List<CustomersettleRequestMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
// 导出
|
|
|
|
for(CustomersettleRequestMainDO mainDO : list) { |
|
|
|
List<CustomersettleRequestDetailDO> subList = customersettleRequestDetailService.selectList(mainDO.getId()); |
|
|
|
for(CustomersettleRequestDetailDO detailDO : subList) { |
|
|
|
CustomersettleRequestMainExcelVO vo = CustomersettleRequestMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
vo.setCreator(userApi.getUser(Long.valueOf(vo.getCreator())).getNickname()); |
|
|
|
vo.setUpdater(userApi.getUser(Long.valueOf(vo.getUpdater())).getNickname()); |
|
|
|
vo.setUpdaterDetail(userApi.getUser(Long.valueOf(vo.getUpdaterDetail())).getNickname()); |
|
|
|
vo.setCreatorDetail(userApi.getUser(Long.valueOf(vo.getCreatorDetail())).getNickname()); |
|
|
|
resultList.add(vo); |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "客户结算申请主.xls", "数据", CustomersettleRequestMainExcelVO.class, datas); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/get-import-template") |
|
|
|
@Operation(summary = "获得导入制客户结算申请信息模板") |
|
|
|
@Operation(summary = "获得导入客户结算申请信息模板") |
|
|
|
public void importTemplate(HttpServletResponse response) throws IOException { |
|
|
|
// 手动创建导出 demo
|
|
|
|
List<CustomersettleRequestMainImportVO> list = Arrays.asList( |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
List<CustomersettleRequestMainImportVO> list = Arrays.asList(); |
|
|
|
// 输出
|
|
|
|
ExcelUtils.write(response, "客户退货申请信息导入模板.xls", "客户退货申请信息列表", CustomersettleRequestMainImportVO.class, list); |
|
|
|
ExcelUtils.write(response, "客户结算申请信息导入模板.xls", "客户结算申请信息列表", CustomersettleRequestMainImportVO.class, list); |
|
|
|
} |
|
|
|
@PostMapping("/import") |
|
|
|
@Operation(summary = "导入发料申请基本信息") |
|
|
|
@Operation(summary = "导入客户结算申请基本信息") |
|
|
|
@Parameters({ |
|
|
|
@Parameter(name = "file", description = "Excel 文件", required = true), |
|
|
|
@Parameter(name = "mode", description = "导入模式1更新2追加3覆盖", example = "1"), |
|
|
|
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true") |
|
|
|
}) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-request-main:import')") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:customersettle-request-main:import')") |
|
|
|
public CommonResult<Map<String, Object>> importExcel(HttpServletResponse response, |
|
|
|
@RequestParam("file") MultipartFile file, |
|
|
|
@RequestParam(value = "mode") Integer mode, |
|
|
@ -152,14 +192,67 @@ public class CustomersettleRequestMainController { |
|
|
|
List<CustomersettleRequestMainImportVO> list = ExcelUtils.read(file, CustomersettleRequestMainImportVO.class); |
|
|
|
ConvertUtil<CustomersettleRequestMainCreateReqVO> convertUtil = new ConvertUtil<>(CustomersettleRequestMainCreateReqVO.class); |
|
|
|
List<CustomersettleRequestMainCreateReqVO> createReqVOList = convertUtil.invoke(list).getDataList(); |
|
|
|
List<CustomersettleRequestImportErrorVO> errorList = customersettleRequestMainService.customersettleRequestMainService(createReqVOList, mode, updatePart); |
|
|
|
List<CustomersettleRequestImportErrorVO> errorList = customersettleRequestMainService.customersettleRequestMainImport(createReqVOList, mode, updatePart); |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/close") |
|
|
|
@Operation(summary = "关闭客户结算申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:customersettle-request-main:close')") |
|
|
|
public CommonResult<Boolean> closeCustomersettleRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = customersettleRequestMainService.closeCustomersettleRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/reAdd") |
|
|
|
@Operation(summary = "重新添加客户结算申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:customersettle-request-main:reAdd')") |
|
|
|
public CommonResult<Boolean> reAddCustomersettleRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = customersettleRequestMainService.reAddCustomersettleRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/submit") |
|
|
|
@Operation(summary = "提交客户结算申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:customersettle-request-main:submit')") |
|
|
|
public CommonResult<Boolean> submitCustomersettleRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = customersettleRequestMainService.submitCustomersettleRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/agree") |
|
|
|
@Operation(summary = "审批通过客户结算申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:customersettle-request-main:agree')") |
|
|
|
public CommonResult<Boolean> agreeCustomersettleRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = customersettleRequestMainService.agreeCustomersettleRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/handle") |
|
|
|
@Operation(summary = "处理客户结算申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:customersettle-request-main:handle')") |
|
|
|
public CommonResult<Boolean> handleCustomersettleRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = customersettleRequestMainService.handleCustomersettleRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/refused") |
|
|
|
@Operation(summary = "审批拒绝客户结算申请主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:customersettle-request-main:refused')") |
|
|
|
public CommonResult<Boolean> abortCustomersettleRequestMain(@RequestParam("id") Long id) { |
|
|
|
Integer count = customersettleRequestMainService.abortCustomersettleRequestMain(id); |
|
|
|
return success(count > 0); |
|
|
|
} |
|
|
|
} |
|
|
|