From fac10dcb68a892be100960e267d0a1501f34e984 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期三, 19 三月 2025 10:28:06 +0800 Subject: [PATCH] #修改 基础数据添加空管字段 --- rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Loc.java | 22 +++++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java | 20 +++++- rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/WarehouseAreas.java | 9 +++ rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseAreasController.java | 11 +++ rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrController.java | 2 rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/ContainerController.java | 21 ++++++- rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseController.java | 40 ++++++++++++- rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Container.java | 10 +- 8 files changed, 117 insertions(+), 18 deletions(-) diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java index e8d9a19..9e69bb6 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.vincent.rsf.framework.common.Cools; import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.framework.exception.CoolException; import com.vincent.rsf.server.common.utils.ExcelUtil; import com.vincent.rsf.server.common.annotation.OperationLog; import com.vincent.rsf.server.common.domain.BaseParam; @@ -57,10 +58,17 @@ @OperationLog("Create 瀛楀吀鏁版嵁闆�") @PostMapping("/companys/save") public R save(@RequestBody Companys companys) { + if (Objects.isNull(companys.getName())) { + throw new CoolException("浼佷笟鍚嶇О涓嶈兘涓虹┖锛侊紒"); + } + if (Objects.isNull(companys.getBreifCode())) { + throw new CoolException("浼佷笟鍔╄鐮佷笉鑳戒负绌�!!"); + } + if (Objects.isNull(companys.getType())) { + throw new CoolException("浼佷笟绫诲瀷涓嶈兘涓虹┖锛侊紒"); + } companys.setCreateBy(getLoginUserId()); - companys.setCreateTime(new Date()); companys.setUpdateBy(getLoginUserId()); - companys.setUpdateTime(new Date()); if (!companysService.save(companys)) { return R.error("Save Fail"); } @@ -106,7 +114,13 @@ @PreAuthorize("hasAuthority('manager:companys:list')") @PostMapping("/companys/export") public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { - ExcelUtil.build(ExcelUtil.create(companysService.list(), Companys.class), response); + List<Companys> companies = new ArrayList<>(); + if (!Objects.isNull(map.get("ids"))) { + companies = companysService.list(new LambdaQueryWrapper<Companys>().in(Companys::getId, map.get("ids"))); + } else { + companies = companysService.list(); + } + ExcelUtil.build(ExcelUtil.create(companies, Companys.class), response); } } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/ContainerController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/ContainerController.java index 4c3aff9..d8ccf27 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/ContainerController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/ContainerController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.vincent.rsf.framework.common.Cools; import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.framework.exception.CoolException; import com.vincent.rsf.server.common.utils.ExcelUtil; import com.vincent.rsf.server.common.annotation.OperationLog; import com.vincent.rsf.server.common.domain.BaseParam; @@ -56,9 +57,13 @@ @PostMapping("/container/save") public R save(@RequestBody Container container) { container.setCreateBy(getLoginUserId()); - container.setCreateTime(new Date()); container.setUpdateBy(getLoginUserId()); - container.setUpdateTime(new Date()); + if (Objects.isNull(container.getType())) { + throw new CoolException("瀹瑰櫒绫诲瀷涓嶈兘涓虹┖锛侊紒"); + } + if (Objects.isNull(container.getUsed())) { + throw new CoolException("瀹瑰櫒浣跨敤娆℃暟涓嶈兘涓虹┖锛侊紒"); + } if (!containerService.save(container)) { return R.error("Save Fail"); } @@ -81,6 +86,10 @@ @OperationLog("Delete 搴撲綅淇℃伅琛�") @PostMapping("/container/remove/{ids}") public R remove(@PathVariable Long[] ids) { + List<Container> containers = containerService.list(new LambdaQueryWrapper<Container>().in(Container::getPanrentId, ids)); + if (containers.isEmpty()) { + throw new CoolException("褰撳墠瀹瑰櫒鏈夊瓙瀹瑰櫒缁戝畾锛屼笉鑳芥墽琛屽垹闄ゆ搷浣滐紒锛�"); + } if (!containerService.removeByIds(Arrays.asList(ids))) { return R.error("Delete Fail"); } @@ -104,7 +113,13 @@ @PreAuthorize("hasAuthority('manager:container:list')") @PostMapping("/container/export") public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { - ExcelUtil.build(ExcelUtil.create(containerService.list(), Container.class), response); + List<Container> containers = new ArrayList<>(); + if (!Objects.isNull(map.get("ids"))) { + containers = containerService.list(new LambdaQueryWrapper<Container>().in(Container::getId, map.get("ids"))); + } else { + containers = containerService.list(); + } + ExcelUtil.build(ExcelUtil.create(containers, Container.class), response); } } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrController.java index 3dda955..3a6d4e2 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrController.java @@ -140,7 +140,7 @@ } else { matnrs = matnrService.list(new LambdaQueryWrapper<Matnr>().last("limit 1")); } - ExcelUtil.build(ExcelUtil.create(null, MatnrsTemplate.class, true), response); + ExcelUtil.build(ExcelUtil.create(matnrs, Matnr.class, true), response); } @PreAuthorize("hasAuthority('manager:matnr:list')") diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseAreasController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseAreasController.java index 817e9a6..e23db73 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseAreasController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseAreasController.java @@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.vincent.rsf.framework.common.Cools; import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.framework.exception.CoolException; import com.vincent.rsf.server.common.utils.ExcelUtil; import com.vincent.rsf.server.common.annotation.OperationLog; import com.vincent.rsf.server.common.domain.BaseParam; import com.vincent.rsf.server.common.domain.KeyValVo; import com.vincent.rsf.server.common.domain.PageParam; +import com.vincent.rsf.server.manager.entity.Loc; import com.vincent.rsf.server.manager.entity.WarehouseAreas; +import com.vincent.rsf.server.manager.service.LocService; import com.vincent.rsf.server.manager.service.WarehouseAreasService; import com.vincent.rsf.server.system.controller.BaseController; import org.springframework.beans.factory.annotation.Autowired; @@ -24,6 +27,8 @@ @Autowired private WarehouseAreasService warehouseAreasService; + + private LocService locService; @PreAuthorize("hasAuthority('manager:warehouseAreas:list')") @PostMapping("/warehouseAreas/page") @@ -56,9 +61,7 @@ @PostMapping("/warehouseAreas/save") public R save(@RequestBody WarehouseAreas warehouseAreas) { warehouseAreas.setCreateBy(getLoginUserId()); - warehouseAreas.setCreateTime(new Date()); warehouseAreas.setUpdateBy(getLoginUserId()); - warehouseAreas.setUpdateTime(new Date()); if (!warehouseAreasService.save(warehouseAreas)) { return R.error("Save Fail"); } @@ -81,6 +84,10 @@ @OperationLog("Delete 搴撳尯淇℃伅琛�") @PostMapping("/warehouseAreas/remove/{ids}") public R remove(@PathVariable Long[] ids) { + List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().in(Loc::getAreaId, ids)); + if (!locs.isEmpty()) { + throw new CoolException("褰撳墠搴撴湁搴撲綅缁戝畾锛屼笉鑳芥墽琛屽垹闄ゆ搷浣滐紒锛�"); + } if (!warehouseAreasService.removeByIds(Arrays.asList(ids))) { return R.error("Delete Fail"); } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseController.java index ae1e46c..7c3c51f 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseController.java @@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.vincent.rsf.framework.common.Cools; import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.framework.exception.CoolException; import com.vincent.rsf.server.common.utils.ExcelUtil; import com.vincent.rsf.server.common.annotation.OperationLog; import com.vincent.rsf.server.common.domain.BaseParam; import com.vincent.rsf.server.common.domain.KeyValVo; import com.vincent.rsf.server.common.domain.PageParam; import com.vincent.rsf.server.manager.entity.Warehouse; +import com.vincent.rsf.server.manager.entity.WarehouseAreas; +import com.vincent.rsf.server.manager.service.WarehouseAreasItemService; +import com.vincent.rsf.server.manager.service.WarehouseAreasService; import com.vincent.rsf.server.manager.service.WarehouseService; import com.vincent.rsf.server.system.controller.BaseController; import io.swagger.annotations.Api; @@ -26,6 +30,12 @@ @Autowired private WarehouseService warehouseService; + + @Autowired + private WarehouseAreasService warehouseAreasService; + + @Autowired + private WarehouseAreasItemService warehouseAreasItemService; @PreAuthorize("hasAuthority('manager:warehouse:list')") @PostMapping("/warehouse/page") @@ -57,10 +67,14 @@ @OperationLog("Create 浠撳簱淇℃伅琛�") @PostMapping("/warehouse/save") public R save(@RequestBody Warehouse warehouse) { + if (Objects.isNull(warehouse)) { + throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒"); + } + if (Objects.isNull(warehouse.getName())) { + throw new CoolException("浠撳簱鍚嶇О涓嶈兘涓虹┖锛侊紒"); + } warehouse.setCreateBy(getLoginUserId()); - warehouse.setCreateTime(new Date()); warehouse.setUpdateBy(getLoginUserId()); - warehouse.setUpdateTime(new Date()); if (!warehouseService.save(warehouse)) { return R.error("Save Fail"); } @@ -71,8 +85,13 @@ @OperationLog("Update 浠撳簱淇℃伅琛�") @PostMapping("/warehouse/update") public R update(@RequestBody Warehouse warehouse) { + if (Objects.isNull(warehouse)) { + throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒"); + } + if (Objects.isNull(warehouse.getName())) { + throw new CoolException("浠撳簱鍚嶇О涓嶈兘涓虹┖锛侊紒"); + } warehouse.setUpdateBy(getLoginUserId()); - warehouse.setUpdateTime(new Date()); if (!warehouseService.updateById(warehouse)) { return R.error("Update Fail"); } @@ -83,6 +102,13 @@ @OperationLog("Delete 浠撳簱淇℃伅琛�") @PostMapping("/warehouse/remove/{ids}") public R remove(@PathVariable Long[] ids) { + if (ids.length < 1) { + throw new CoolException("鏌ヨid涓嶈兘涓虹┖锛侊紒"); + } + List<WarehouseAreas> warehouseAreas = warehouseAreasService.list(new LambdaQueryWrapper<WarehouseAreas>().in(WarehouseAreas::getWareId, ids)); + if (!warehouseAreas.isEmpty()) { + throw new CoolException("褰撳墠浠撳簱涓嬫湁鏈垹闄ゅ簱鍖猴紝 涓嶅彲鎿嶄綔鍒犻櫎锛侊紒"); + } if (!warehouseService.removeByIds(Arrays.asList(ids))) { return R.error("Delete Fail"); } @@ -106,7 +132,13 @@ @PreAuthorize("hasAuthority('manager:warehouse:list')") @PostMapping("/warehouse/export") public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { - ExcelUtil.build(ExcelUtil.create(warehouseService.list(), Warehouse.class), response); + List<Warehouse> list = new ArrayList<>(); + if (!Objects.isNull(map.get("ids"))) { + list = warehouseService.list(new LambdaQueryWrapper<Warehouse>().in(Warehouse::getId, map.get("ids"))); + } else { + list = warehouseService.list(); + } + ExcelUtil.build(ExcelUtil.create(list, Warehouse.class), response); } } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Container.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Container.java index 118af79..dc78784 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Container.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Container.java @@ -51,14 +51,14 @@ /** * 瀹瑰櫒绫诲瀷鏍囪瘑 */ - @ApiModelProperty(value= "瀹瑰櫒绫诲瀷鏍囪瘑") - private Long typeId; + @ApiModelProperty(value= "瀹瑰櫒绫诲瀷") + private Long type; /** * 浣跨敤娆℃暟 */ @ApiModelProperty(value= "浣跨敤娆℃暟") - private Double used; + private Integer used; /** * 闀垮害 @@ -180,10 +180,10 @@ public Container() {} - public Container(String code,String name,Long typeId,Double used,Double lenght,Double width,Double height,Double rstLen,Double rstWid,Double rstWei,Double rstHei,Long panrentId,Date vaildTime,Short flagRycle,Short flagLogic,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { + public Container(String code,String name,Long typeId,Integer used,Double lenght,Double width,Double height,Double rstLen,Double rstWid,Double rstWei,Double rstHei,Long panrentId,Date vaildTime,Short flagRycle,Short flagLogic,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { this.code = code; this.name = name; - this.typeId = typeId; + this.type = typeId; this.used = used; this.lenght = lenght; this.width = width; diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Loc.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Loc.java index 8781760..6c4a9ad 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Loc.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Loc.java @@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.annotation.*; import com.vincent.rsf.framework.common.Cools; import com.vincent.rsf.framework.common.SpringUtils; +import com.vincent.rsf.server.manager.service.WarehouseAreasService; +import com.vincent.rsf.server.manager.service.WarehouseService; import com.vincent.rsf.server.system.entity.User; import com.vincent.rsf.server.system.service.UserService; import io.swagger.annotations.ApiModelProperty; @@ -302,6 +304,26 @@ } } + public String getWarehouseId$(){ + if (null == this.warehouseId){ return null; } + WarehouseService service = SpringUtils.getBean(WarehouseService.class); + Warehouse warehouse = service.getById(this.warehouseId); + if (!Cools.isEmpty(warehouse)){ + return String.valueOf(warehouse.getName()); + } + return null; + } + + public String getAreaId$(){ + if (null == this.areaId){ return null; } + WarehouseAreasService service = SpringUtils.getBean(WarehouseAreasService.class); + WarehouseAreas warehouseAreas = service.getById(this.areaId); + if (!Cools.isEmpty(warehouseAreas)){ + return String.valueOf(warehouseAreas.getName()); + } + return null; + } + public String getStatus$(){ if (null == this.status){ return null; } switch (this.status){ diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/WarehouseAreas.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/WarehouseAreas.java index 4010a81..8e5386f 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/WarehouseAreas.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/WarehouseAreas.java @@ -191,6 +191,15 @@ return null; } + public String getSupplier$() { + CompanysService service = SpringUtils.getBean(CompanysService.class); + Companys supplier = service.getById(this.supplierId); + if (!Cools.isEmpty(supplier)){ + return String.valueOf(supplier.getName()); + } + return null; + } + public String getFlagMinus$(){ if (null == this.flagMinus){ return null; } switch (this.flagMinus){ -- Gitblit v1.9.1