|
|
@ -1,33 +1,41 @@ |
|
|
|
package com.win.module.wms.controller.purchasereceiptJob; |
|
|
|
|
|
|
|
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.purchasereceiptJob.vo.*; |
|
|
|
import com.win.module.wms.convert.purchasereceiptJob.PurchasereceiptJobDetailConvert; |
|
|
|
import com.win.module.wms.convert.purchasereceiptJob.PurchasereceiptJobMainConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptJob.PurchasereceiptJobDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptJob.PurchasereceiptJobMainDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.enums.job.JobStatusEnum; |
|
|
|
import com.win.module.wms.service.purchasereceiptJob.PurchasereceiptJobDetailService; |
|
|
|
import com.win.module.wms.service.purchasereceiptJob.PurchasereceiptJobMainService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
import jodd.util.StringUtil; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import javax.validation.*; |
|
|
|
import javax.servlet.http.*; |
|
|
|
import java.util.*; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.validation.Valid; |
|
|
|
import java.io.IOException; |
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
import com.win.framework.common.pojo.CommonResult; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import static com.win.framework.common.pojo.CommonResult.success; |
|
|
|
import com.win.framework.excel.core.util.ExcelUtils; |
|
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*; |
|
|
|
import com.win.module.wms.controller.purchasereceiptJob.vo.*; |
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptJob.PurchasereceiptJobMainDO; |
|
|
|
import com.win.module.wms.convert.purchasereceiptJob.PurchasereceiptJobMainConvert; |
|
|
|
import com.win.module.wms.service.purchasereceiptJob.PurchasereceiptJobMainService; |
|
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
|
|
|
|
|
|
|
@Tag(name = "管理后台 - 采购收货任务主") |
|
|
|
@RestController |
|
|
@ -44,55 +52,20 @@ public class PurchasereceiptJobMainController { |
|
|
|
@Resource |
|
|
|
private AdminUserApi userApi; |
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
|
@Operation(summary = "创建采购收货任务主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:purchasereceipt-job-main:create')") |
|
|
|
public CommonResult<Long> createPurchasereceiptJobMain(@Valid @RequestBody PurchasereceiptJobMainCreateReqVO createReqVO) { |
|
|
|
return success(purchasereceiptJobMainService.createPurchasereceiptJobMain(createReqVO)); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/update") |
|
|
|
@Operation(summary = "更新采购收货任务主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:purchasereceipt-job-main:update')") |
|
|
|
public CommonResult<Boolean> updatePurchasereceiptJobMain(@Valid @RequestBody PurchasereceiptJobMainUpdateReqVO updateReqVO) { |
|
|
|
purchasereceiptJobMainService.updatePurchasereceiptJobMain(updateReqVO); |
|
|
|
return success(true); |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping("/delete") |
|
|
|
@Operation(summary = "删除采购收货任务主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:purchasereceipt-job-main:delete')") |
|
|
|
public CommonResult<Boolean> deletePurchasereceiptJobMain(@RequestParam("id") Long id) { |
|
|
|
purchasereceiptJobMainService.deletePurchasereceiptJobMain(id); |
|
|
|
return success(true); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/get") |
|
|
|
@Operation(summary = "获得采购收货任务主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:purchasereceipt-job-main:query')") |
|
|
|
public CommonResult<PurchasereceiptJobMainRespVO> getPurchasereceiptJobMain(@RequestParam("id") Long id) { |
|
|
|
PurchasereceiptJobMainDO purchasereceiptJobMain = purchasereceiptJobMainService.getPurchasereceiptJobMain(id); |
|
|
|
return success(PurchasereceiptJobMainConvert.INSTANCE.convert(purchasereceiptJobMain)); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/list") |
|
|
|
@Operation(summary = "获得采购收货任务主列表") |
|
|
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:purchasereceipt-job-main:query')") |
|
|
|
public CommonResult<List<PurchasereceiptJobMainRespVO>> getPurchasereceiptJobMainList(@RequestParam("ids") Collection<Long> ids) { |
|
|
|
List<PurchasereceiptJobMainDO> list = purchasereceiptJobMainService.getPurchasereceiptJobMainList(ids); |
|
|
|
return success(PurchasereceiptJobMainConvert.INSTANCE.convertList(list)); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/page") |
|
|
|
@Operation(summary = "获得采购收货任务主分页") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:purchasereceipt-job-main:query')") |
|
|
|
public CommonResult<PageResult<PurchasereceiptJobMainRespVO>> getPurchasereceiptJobMainPage(@Valid PurchasereceiptJobMainPageReqVO pageVO) { |
|
|
|
PageResult<PurchasereceiptJobMainDO> pageResult = purchasereceiptJobMainService.getPurchasereceiptJobMainPage(pageVO); |
|
|
|
return success(PurchasereceiptJobMainConvert.INSTANCE.convertPage(pageResult)); |
|
|
|
PageResult<PurchasereceiptJobMainRespVO> pageResult1 = PurchasereceiptJobMainConvert.INSTANCE.convertPage(pageResult); |
|
|
|
for(PurchasereceiptJobMainRespVO vo : pageResult1.getList()) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
} |
|
|
|
return success(pageResult1); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/senior") |
|
|
|
@Operation(summary = "高级搜索获得采购收货任务主信息分页") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:purchasereceipt-job-main:query')") |
|
|
@ -106,6 +79,7 @@ public class PurchasereceiptJobMainController { |
|
|
|
} |
|
|
|
return success(result); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel") |
|
|
|
@Operation(summary = "导出采购收货任务主 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:purchasereceipt-job-main:export')") |
|
|
@ -113,14 +87,43 @@ public class PurchasereceiptJobMainController { |
|
|
|
public void exportPurchasereceiptJobMainExcel(@Valid PurchasereceiptJobMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<PurchasereceiptJobMainDO> list = purchasereceiptJobMainService.getPurchasereceiptJobMainList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
List<PurchasereceiptJobMainExcelVO> datas = PurchasereceiptJobMainConvert.INSTANCE.convertList02(list); |
|
|
|
for(PurchasereceiptJobMainExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
String[] transferMode = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRANSFER_MODE); |
|
|
|
mapDropDown.put(6, transferMode); |
|
|
|
String[] status = JobStatusEnum.getStatusNameArray(); |
|
|
|
mapDropDown.put(12, status); |
|
|
|
String[] locationType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
mapDropDown.put(22, locationType); |
|
|
|
mapDropDown.put(23, locationType); |
|
|
|
String[] trueFalse = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
mapDropDown.put(27, trueFalse); |
|
|
|
mapDropDown.put(30, trueFalse); |
|
|
|
mapDropDown.put(31, trueFalse); |
|
|
|
mapDropDown.put(32, trueFalse); |
|
|
|
mapDropDown.put(33, trueFalse); |
|
|
|
mapDropDown.put(34, trueFalse); |
|
|
|
mapDropDown.put(35, trueFalse); |
|
|
|
mapDropDown.put(36, trueFalse); |
|
|
|
mapDropDown.put(37, trueFalse); |
|
|
|
mapDropDown.put(38, trueFalse); |
|
|
|
String[] inventoryStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INVENTORY_STATUS); |
|
|
|
mapDropDown.put(46, inventoryStatus); |
|
|
|
String[] packUnit = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.PACK_UNIT); |
|
|
|
mapDropDown.put(52, packUnit); |
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
mapDropDown.put(54, uom); |
|
|
|
mapDropDown.put(62, uom); |
|
|
|
List<PurchasereceiptJobMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
// 导出
|
|
|
|
for(PurchasereceiptJobMainDO mainDO : list) { |
|
|
|
List<PurchasereceiptJobDetailDO> subList = purchasereceiptJobDetailService.selectList(mainDO.getId()); |
|
|
|
for(PurchasereceiptJobDetailDO detailDO : subList) { |
|
|
|
PurchasereceiptJobMainExcelVO vo = PurchasereceiptJobMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
resultList.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "采购收货任务主.xls", "数据", PurchasereceiptJobMainExcelVO.class, datas); |
|
|
|
ExcelUtils.write(response, "采购收货任务主.xlsx", "数据", PurchasereceiptJobMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/getPurchasereceiptJobyId") |
|
|
@ -156,6 +159,4 @@ public class PurchasereceiptJobMainController { |
|
|
|
return success(countByStatus); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|