From fa426b6948e38767752ffaf5e22b83b74b351119 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Mon, 19 Aug 2024 10:49:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E5=A2=9E=E5=8A=A0=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E7=A7=9F=E7=94=A8=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basicdata/dto/WarehouseLeasingDTO.java | 34 ++++ .../entity/BasicdataWarehouseEntity.java | 12 ++ .../entity/WarehouseLeasingEntity.java | 66 +++++++ .../feign/IBasicdataCategoryClient.java | 3 + .../controller/BasicdataClientController.java | 20 +- .../BasicdataDriverArteryController.java | 78 +++++--- .../BasicdataWarehouseController.java | 16 +- .../WarehouseLeasingController.java | 185 ++++++++++++++++++ .../excel/WarehouseLeasingExcel.java | 44 +++++ .../feign/BasicdataCategoryClient.java | 6 + .../mapper/WarehouseLeasingMapper.java | 54 +++++ .../mapper/WarehouseLeasingMapper.xml | 27 +++ .../service/IBasicdataClientService.java | 2 + .../service/IWarehouseLeasingService.java | 54 +++++ .../impl/BasicdataClientServiceImpl.java | 41 +++- .../impl/WarehouseLeasingServiceImpl.java | 130 ++++++++++++ .../logpm/basicdata/vo/ResidualAreaVO.java | 46 +++++ .../basicdata/vo/WarehouseLeasingVO.java | 65 ++++++ .../wrapper/WarehouseLeasingWrapper.java | 50 +++++ 19 files changed, 898 insertions(+), 35 deletions(-) create mode 100644 blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/dto/WarehouseLeasingDTO.java create mode 100644 blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/WarehouseLeasingEntity.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/WarehouseLeasingController.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/WarehouseLeasingExcel.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/WarehouseLeasingMapper.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/WarehouseLeasingMapper.xml create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IWarehouseLeasingService.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/WarehouseLeasingServiceImpl.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/ResidualAreaVO.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/WarehouseLeasingVO.java create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/wrapper/WarehouseLeasingWrapper.java diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/dto/WarehouseLeasingDTO.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/dto/WarehouseLeasingDTO.java new file mode 100644 index 000000000..0e364bdfc --- /dev/null +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/dto/WarehouseLeasingDTO.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.dto; + +import com.logpm.basicdata.entity.WarehouseLeasingEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 仓库租用管理 数据传输对象实体类 + * + * @author zqb + * @since 2024-08-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class WarehouseLeasingDTO extends WarehouseLeasingEntity { + private static final long serialVersionUID = 1L; + +} diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataWarehouseEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataWarehouseEntity.java index aba5e763b..d4c3ae1cf 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataWarehouseEntity.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataWarehouseEntity.java @@ -280,5 +280,17 @@ public class BasicdataWarehouseEntity extends TenantEntity { @ApiModelProperty(value = "老系统id") private Integer oldId; + @ApiModelProperty(value = "临时周转面积") + private BigDecimal temporaryTurnoverArea; + + @ApiModelProperty(value = "代作业入库费") + private BigDecimal handlingStorageEntranceFee; + + @ApiModelProperty(value = "代作业出库费") + private BigDecimal handlingStorageExitFee; + + @ApiModelProperty(value = "单库位面积") + private BigDecimal singleStorageLocationArea; + } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/WarehouseLeasingEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/WarehouseLeasingEntity.java new file mode 100644 index 000000000..f98f493e9 --- /dev/null +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/WarehouseLeasingEntity.java @@ -0,0 +1,66 @@ +package com.logpm.basicdata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 仓库租用管理 + * + * @author zqb + * @create 2024-08-14 + */ +@Data +@TableName("logpm_warehouse_leasing") +@ApiModel(value = "WarehouseLeasing对象", description = "仓库租用管理") +@EqualsAndHashCode(callSuper = true) +public class WarehouseLeasingEntity extends TenantEntity { + + /** + * 客户id + */ + @ApiModelProperty(value = "客户id") + private Long clientId; + /** + * 仓库id + */ + @ApiModelProperty(value = "仓库id") + private Long warehouseId; + /** + * 租用类型 + */ + @ApiModelProperty(value = "租用类型(1面积 2库位)") + private Integer type; + /** + * 租用库位数 + */ + @ApiModelProperty(value = "租用库位数") + private BigDecimal storageLocationCount; + /** + * 租用面积 + */ + @ApiModelProperty(value = "租用面积") + private BigDecimal leasedArea; + /** + * 月租金 + */ + @ApiModelProperty(value = "月租金") + private BigDecimal monthlyRent; + /** + * 租赁合同开始时间 + */ + @ApiModelProperty(value = "租赁合同开始时间") + private Date leaseCommencementDate; + /** + * 租赁合同结束时间 + */ + @ApiModelProperty(value = "租赁合同结束时间") + private Date leaseTerminationDate; + +} diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataCategoryClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataCategoryClient.java index d72785315..58768d23e 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataCategoryClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataCategoryClient.java @@ -63,4 +63,7 @@ public interface IBasicdataCategoryClient { @GetMapping(API_PREFIX+"/findEntityById") BasicdataCategoryEntity findEntityById(@RequestParam Long goodsId); + + @GetMapping(API_PREFIX+"/findEntityByIds") + List findEntityByIds(@RequestParam List goodsIds); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java index d60d48ee2..7ef3464e2 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java @@ -16,7 +16,6 @@ */ package com.logpm.basicdata.controller; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; @@ -45,17 +44,20 @@ import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.system.feign.IUserClient; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.security.NoSuchAlgorithmException; -import java.util.Comparator; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * 基础客户表 控制器 @@ -152,6 +154,16 @@ public class BasicdataClientController extends BladeController { List pages = basicdataClientService.listName(name); return R.data(pages); } + /** + * 基础客户表查询 + */ + @GetMapping("/listNameLike") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "根据名称模糊查询", notes = "传入basicdataClient") + public R> listNameLike(@RequestParam String name) { + List pages = basicdataClientService.listNameLike(name); + return R.data(pages); + } /** * 基础客户表查询 diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java index a8a2a1936..8f47ebf7e 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java @@ -16,13 +16,13 @@ */ package com.logpm.basicdata.controller; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.basicdata.dto.BasicdataDriverArteryDTO; import com.logpm.basicdata.entity.BasicdataDriverArteryEntity; import com.logpm.basicdata.entity.BasicdataDriverWarehouseEntity; -import com.logpm.basicdata.excel.BasicdataDriverArteryExcel; import com.logpm.basicdata.excel.BasicdataDriverArteryImporter; import com.logpm.basicdata.excel.BasicdataDriverArteryImproterExcel; import com.logpm.basicdata.excel.BasicdataExportDriverArteryExcel; @@ -35,11 +35,11 @@ import com.logpm.basicdata.vo.BasicdataDriverWarehouseVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import jodd.util.ArraysUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.BladeUser; @@ -50,13 +50,24 @@ import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.system.entity.User; import org.springblade.system.feign.IUserClient; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; /** * 司机信息表 控制器 @@ -93,16 +104,17 @@ public class BasicdataDriverArteryController extends BladeController { List vehicleIds = basicdataDrivermiddleService.findVehicleIdsByDriverId(driverId); List warehouseIds = basicdataDriverWarehouseService.findByDriverId(driverId); BasicdataDriverArteryVO basicdataDriverArteryVO = new BasicdataDriverArteryVO(); - BeanUtil.copy(detail,basicdataDriverArteryVO); + BeanUtil.copy(detail, basicdataDriverArteryVO); // 拆分 司机类型 String[] split = basicdataDriverArteryVO.getJobType().split(","); List list = Arrays.asList(split); basicdataDriverArteryVO.setJobTypeString(list); basicdataDriverArteryVO.setWarehouses(warehouseIds); - basicdataDriverArteryVO.setBindVehicles(String.join(",",vehicleIds)); + basicdataDriverArteryVO.setBindVehicles(String.join(",", vehicleIds)); return R.data(basicdataDriverArteryVO); } + /** * 司机信息表 分页 */ @@ -114,6 +126,25 @@ public class BasicdataDriverArteryController extends BladeController { return R.data(pages); } + /** + * 司机信息列表 + */ + @GetMapping("/selectList") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入basicdataDriverArtery") + public R> selectList(@ApiIgnore @RequestParam Map basicdataDriverArtery) { + if (!basicdataDriverArtery.containsKey("warehouseId")) { + throw new ServiceException("仓库id必传"); + } + List warehouseEntities = basicdataDriverWarehouseService.list(Wrappers.lambdaQuery().eq(BasicdataDriverWarehouseEntity::getWarehouseId, basicdataDriverArtery.get("warehouseId"))); + if (CollUtil.isNotEmpty(warehouseEntities)) { + Set collect = warehouseEntities.stream().map(BasicdataDriverWarehouseEntity::getDriverId).collect(Collectors.toSet()); + List list = basicdataDriverArteryService.list(Wrappers.lambdaQuery().in(BasicdataDriverArteryEntity::getId, collect)); + return R.data(list); + } + return R.data(null); + } + /** * 司机信息列表 */ @@ -126,7 +157,6 @@ public class BasicdataDriverArteryController extends BladeController { } - /** * 司机信息表 自定义分页 */ @@ -143,7 +173,7 @@ public class BasicdataDriverArteryController extends BladeController { */ @GetMapping("/dictionary") @ApiOperationSupport(order = 10) - @ApiOperation(value = "司机信息表",notes = "传入code") + @ApiOperation(value = "司机信息表", notes = "传入code") public R> dictionary() { List dictionary = basicdataDriverArteryService.selectBasicdataDriverArteryDictionary(); return R.data(dictionary); @@ -160,23 +190,23 @@ public class BasicdataDriverArteryController extends BladeController { .eq(BasicdataDriverArteryEntity::getUserId, basicdataDriverArtery.getUserId()) .eq(BasicdataDriverArteryEntity::getIsDeleted, 0) ); - if(list.size() > 0){ + if (list.size() > 0) { return R.fail("绑定的用户已存在!不要重复绑定!!!"); } String phone = basicdataDriverArtery.getPhone(); R userR = userClient .userInfoByPhone(AuthUtil.getUser().getTenantId(), phone); - if (Func.isNotEmpty(userR.getData())){ + if (Func.isNotEmpty(userR.getData())) { User user = userR.getData(); basicdataDriverArtery.setUserId(user.getId()); } boolean save = basicdataDriverArteryService.save(basicdataDriverArtery); - if(save){ + if (save) { Long driverId = basicdataDriverArtery.getId(); List warehouseIds = basicdataDriverArtery.getWarehouseIds(); List driverWarehouseList = new ArrayList<>(); - for (Long warehouseId:warehouseIds){ + for (Long warehouseId : warehouseIds) { BasicdataDriverWarehouseEntity basicdataDriverWarehouseEntity = new BasicdataDriverWarehouseEntity(); basicdataDriverWarehouseEntity.setWarehouseId(warehouseId); basicdataDriverWarehouseEntity.setDriverId(driverId); @@ -185,9 +215,9 @@ public class BasicdataDriverArteryController extends BladeController { basicdataDriverWarehouseService.saveBatch(driverWarehouseList); } - //加入关联表 - if (null !=basicdataDriverArtery.getBindVehicles()&& save){ - Integer b = basicdataDriverArteryService.updateVehicle(basicdataDriverArtery); + // 加入关联表 + if (null != basicdataDriverArtery.getBindVehicles() && save) { + Integer b = basicdataDriverArteryService.updateVehicle(basicdataDriverArtery); } return R.status(save); } @@ -200,15 +230,15 @@ public class BasicdataDriverArteryController extends BladeController { @ApiOperation(value = "修改", notes = "传入basicdataDriverArtery") public R update(@Valid @RequestBody BasicdataDriverArteryDTO basicdataDriverArtery) { - //加入关联表 - if (null !=basicdataDriverArtery.getBindVehicles()){ + // 加入关联表 + if (null != basicdataDriverArtery.getBindVehicles()) { basicdataDriverArteryService.updateVehicle(basicdataDriverArtery); } boolean b = basicdataDriverArteryService.updateById(basicdataDriverArtery); - if(b){ + if (b) { List warehouseIds = basicdataDriverArtery.getWarehouseIds(); Long driverId = basicdataDriverArtery.getId(); - basicdataDriverWarehouseService.deleteListByDriverIdAndSave(driverId,warehouseIds); + basicdataDriverWarehouseService.deleteListByDriverIdAndSave(driverId, warehouseIds); } return R.status(b); } @@ -256,22 +286,22 @@ public class BasicdataDriverArteryController extends BladeController { @ApiOperationSupport(order = 12) @ApiOperation(value = "导入司机信息", notes = "传入excel") public R importDriverArteryEntry(MultipartFile file) { - log.info("传入>>>>>>>{}",file); + log.info("传入>>>>>>>{}", file); BasicdataDriverArteryImporter basicdataDriverArteryImporter = new BasicdataDriverArteryImporter(basicdataDriverArteryService); - ExcelUtil.save(file,basicdataDriverArteryImporter, BasicdataDriverArteryImproterExcel.class); + ExcelUtil.save(file, basicdataDriverArteryImporter, BasicdataDriverArteryImproterExcel.class); return R.success("操作成功"); } /** - * 导出数据模板 - * http://localhost:8400/driverArtery/export-basicdataDriverArteryMb + * 导出数据模板 + * http://localhost:8400/driverArtery/export-basicdataDriverArteryMb */ @GetMapping("/export-basicdataDriverArteryMb") @ApiOperationSupport(order = 10) @ApiOperation(value = "导出数据模板", notes = "传入basicdataDriverArtery") public void exportBasicdataDriverArteryMb(@ApiIgnore @RequestParam Map basicdataDriverArtery, BladeUser bladeUser, HttpServletResponse response) { List list = new ArrayList<>(); - //存入模板 + // 存入模板 BasicdataDriverArteryImproterExcel excel = new BasicdataDriverArteryImproterExcel(); excel.setName("张三"); excel.setPhone("13812345678"); diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java index b3000cbe9..c9db23068 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java @@ -16,9 +16,9 @@ */ package com.logpm.basicdata.controller; +import cn.hutool.core.util.NumberUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.basicdata.dto.BasicdataWarehouseDTO; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; @@ -44,7 +44,13 @@ import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.DateUtil; -import org.springframework.web.bind.annotation.*; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; @@ -190,6 +196,9 @@ public class BasicdataWarehouseController extends BladeController { BladeUser user = AuthUtil.getUser(); CacheUtil.evict(CacheObjNames.basic_data_warehourse_list.getCacheName(), CacheObjNames.basic_data_warehourse_list.getKeyPrefix(),user.getUserId()); warehouseWarehouse.setEnableStatus("2"); + if(ObjectUtil.isNotEmpty(warehouseWarehouse.getAcreage()) && ObjectUtil.isNotEmpty(warehouseWarehouse.getSeating())){ + warehouseWarehouse.setSingleStorageLocationArea(NumberUtil.div(warehouseWarehouse.getAcreage(),warehouseWarehouse.getSeating())); + } return R.status(warehouseService.save(warehouseWarehouse)); } @@ -200,6 +209,9 @@ public class BasicdataWarehouseController extends BladeController { @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入warehouseWarehouse") public R update(@Valid @RequestBody BasicdataWarehouseEntity warehouseWarehouse) { + if(ObjectUtil.isNotEmpty(warehouseWarehouse.getAcreage()) && ObjectUtil.isNotEmpty(warehouseWarehouse.getSeating())){ + warehouseWarehouse.setSingleStorageLocationArea(NumberUtil.div(warehouseWarehouse.getAcreage(),warehouseWarehouse.getSeating())); + } return R.status(warehouseService.updateById(warehouseWarehouse)); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/WarehouseLeasingController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/WarehouseLeasingController.java new file mode 100644 index 000000000..6ab8e4b3c --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/WarehouseLeasingController.java @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.controller; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.logpm.basicdata.entity.BasicdataClientEntity; +import com.logpm.basicdata.entity.BasicdataWarehouseEntity; +import com.logpm.basicdata.entity.WarehouseLeasingEntity; +import com.logpm.basicdata.excel.WarehouseLeasingExcel; +import com.logpm.basicdata.feign.IBasicdataClientClient; +import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.basicdata.service.IWarehouseLeasingService; +import com.logpm.basicdata.vo.ResidualAreaVO; +import com.logpm.basicdata.vo.WarehouseLeasingVO; +import com.logpm.basicdata.wrapper.WarehouseLeasingWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.BladeUser; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.constant.BladeConstant; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; +import java.util.Map; + +/** + * 仓库租用管理 控制器 + * + * @author zqb + * @since 2024-08-14 + */ +@RestController +@AllArgsConstructor +@RequestMapping("logpm-basicdata/warehouseLeasing") +@Api(value = "仓库租用管理", tags = "仓库租用管理接口") +public class WarehouseLeasingController extends BladeController { + + private final IWarehouseLeasingService warehouseLeasingService; + + @Resource + private IBasicdataWarehouseClient warehouseClient; + @Resource + private IBasicdataClientClient clientClient; + + /** + * 仓库租用管理 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "详情", notes = "传入warehouseLeasing") + public R detail(WarehouseLeasingEntity warehouseLeasing) { + WarehouseLeasingEntity detail = warehouseLeasingService.getOne(Condition.getQueryWrapper(warehouseLeasing)); + WarehouseLeasingVO warehouseLeasingVO = WarehouseLeasingWrapper.build().entityVO(detail); + BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseLeasingVO.getWarehouseId()); + if (ObjectUtil.isNotEmpty(warehouseEntity)) { + warehouseLeasingVO.setWarehouseName(warehouseEntity.getName()); + } + BasicdataClientEntity basicdataClient = clientClient.findEntityById(warehouseLeasingVO.getClientId()); + if (ObjectUtil.isNotEmpty(basicdataClient)) { + warehouseLeasingVO.setClientName(basicdataClient.getClientName()); + } + return R.data(warehouseLeasingVO); + } + + /** + * 仓库租用管理 分页 + */ + @GetMapping("/list") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入warehouseLeasing") + public R> list(@ApiIgnore @RequestParam Map warehouseLeasing, Query query) { + IPage pages = warehouseLeasingService.page(Condition.getPage(query), Condition.getQueryWrapper(warehouseLeasing, WarehouseLeasingEntity.class)); + return R.data(WarehouseLeasingWrapper.build().pageVO(pages)); + } + + @GetMapping("/residualArea") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "查询剩余面积", notes = "传入warehouseLeasing") + public R residualArea(@RequestParam("warehouseId") Long warehouseId) { + return R.data(warehouseLeasingService.residualArea(warehouseId)); + } + + /** + * 仓库租用管理 自定义分页 + */ + @GetMapping("/page") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "分页", notes = "传入warehouseLeasing") + public R> page(WarehouseLeasingVO warehouseLeasing, Query query) { + IPage pages = warehouseLeasingService.selectWarehouseLeasingPage(Condition.getPage(query), warehouseLeasing); + return R.data(pages); + } + + /** + * 仓库租用管理 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "新增", notes = "传入warehouseLeasing") + public R save(@Valid @RequestBody WarehouseLeasingEntity warehouseLeasing) { + return R.status(warehouseLeasingService.save(warehouseLeasing)); + } + + /** + * 仓库租用管理 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 5) + @ApiOperation(value = "修改", notes = "传入warehouseLeasing") + public R update(@Valid @RequestBody WarehouseLeasingEntity warehouseLeasing) { + return R.status(warehouseLeasingService.updateById(warehouseLeasing)); + } + + /** + * 仓库租用管理 新增或修改 + */ + @PostMapping("/submit") + @ApiOperationSupport(order = 6) + @ApiOperation(value = "新增或修改", notes = "传入warehouseLeasing") + public R submit(@Valid @RequestBody WarehouseLeasingEntity warehouseLeasing) { + return R.status(warehouseLeasingService.saveOrUpdate(warehouseLeasing)); + } + + /** + * 仓库租用管理 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 7) + @ApiOperation(value = "逻辑删除", notes = "传入ids") + public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { + return R.status(warehouseLeasingService.deleteLogic(Func.toLongList(ids))); + } + + + /** + * 导出数据 + */ + @GetMapping("/export-warehouseLeasing") + @ApiOperationSupport(order = 9) + @ApiOperation(value = "导出数据", notes = "传入warehouseLeasing") + public void exportWarehouseLeasing(@ApiIgnore @RequestParam Map warehouseLeasing, BladeUser bladeUser, HttpServletResponse response) { + QueryWrapper queryWrapper = Condition.getQueryWrapper(warehouseLeasing, WarehouseLeasingEntity.class); + // if (!AuthUtil.isAdministrator()) { + // queryWrapper.lambda().eq(WarehouseLeasing::getTenantId, bladeUser.getTenantId()); + //} + queryWrapper.lambda().eq(WarehouseLeasingEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); + List list = warehouseLeasingService.exportWarehouseLeasing(queryWrapper); + ExcelUtil.export(response, "仓库租用管理数据" + DateUtil.time(), "仓库租用管理数据表", list, WarehouseLeasingExcel.class); + } + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/WarehouseLeasingExcel.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/WarehouseLeasingExcel.java new file mode 100644 index 000000000..d584e85f2 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/WarehouseLeasingExcel.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.excel; + + +import lombok.Data; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import java.io.Serializable; + + +/** + * 仓库租用管理 Excel实体类 + * + * @author zqb + * @since 2024-08-14 + */ +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class WarehouseLeasingExcel implements Serializable { + + private static final long serialVersionUID = 1L; + + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataCategoryClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataCategoryClient.java index fa6328a50..164356abb 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataCategoryClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataCategoryClient.java @@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; +import java.util.Collections; import java.util.List; /** @@ -83,4 +84,9 @@ public class BasicdataCategoryClient implements IBasicdataCategoryClient { return categoryEntity; } + @Override + public List findEntityByIds(List goodsIds) { + return basicdataCategoryService.listByIds(goodsIds); + } + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/WarehouseLeasingMapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/WarehouseLeasingMapper.java new file mode 100644 index 000000000..559261a33 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/WarehouseLeasingMapper.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.mapper; + +import com.logpm.basicdata.entity.WarehouseLeasingEntity; +import com.logpm.basicdata.vo.WarehouseLeasingVO; +import com.logpm.basicdata.excel.WarehouseLeasingExcel; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + * 仓库租用管理 Mapper 接口 + * + * @author zqb + * @since 2024-08-14 + */ +public interface WarehouseLeasingMapper extends BaseMapper { + + /** + * 自定义分页 + * + * @param page + * @param warehouseLeasing + * @return + */ + List selectWarehouseLeasingPage(IPage page, WarehouseLeasingVO warehouseLeasing); + + + /** + * 获取导出数据 + * + * @param queryWrapper + * @return + */ + List exportWarehouseLeasing(@Param("ew") Wrapper queryWrapper); + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/WarehouseLeasingMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/WarehouseLeasingMapper.xml new file mode 100644 index 000000000..755f70e48 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/WarehouseLeasingMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java index 38463a0bb..4d25f445e 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java @@ -132,4 +132,6 @@ public interface IBasicdataClientService extends BaseService listNameLike(String name); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IWarehouseLeasingService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IWarehouseLeasingService.java new file mode 100644 index 000000000..c33831d53 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IWarehouseLeasingService.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.service; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.logpm.basicdata.entity.WarehouseLeasingEntity; +import com.logpm.basicdata.vo.ResidualAreaVO; +import com.logpm.basicdata.vo.WarehouseLeasingVO; +import com.logpm.basicdata.excel.WarehouseLeasingExcel; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springblade.core.mp.base.BaseService; +import java.util.List; + +/** + * 仓库租用管理 服务类 + * + * @author zqb + * @since 2024-08-14 + */ +public interface IWarehouseLeasingService extends BaseService { + /** + * 自定义分页 + * + * @param page + * @param warehouseLeasing + * @return + */ + IPage selectWarehouseLeasingPage(IPage page, WarehouseLeasingVO warehouseLeasing); + + + /** + * 导出数据 + * + * @param queryWrapper + * @return + */ + List exportWarehouseLeasing(Wrapper queryWrapper); + + ResidualAreaVO residualArea(Long warehouseId); +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java index b917ece50..139021f08 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java @@ -28,10 +28,28 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basic.entity.BasicTenantCodeEntity; import com.logpm.basic.feign.IBasicTenantCodeClient; -import com.logpm.basicdata.entity.*; +import com.logpm.basicdata.entity.BasicdataBrandEntity; +import com.logpm.basicdata.entity.BasicdataClientEntity; +import com.logpm.basicdata.entity.BasicdataClientLogEntity; +import com.logpm.basicdata.entity.BasicdataHistoricalContractEntity; +import com.logpm.basicdata.entity.BasicdataStorageServicesEntity; +import com.logpm.basicdata.entity.BasicdataStoreBrandEntity; +import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity; +import com.logpm.basicdata.entity.BasicdataStoreContactEntity; +import com.logpm.basicdata.entity.BasicdataTripartiteMallEntity; +import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.excel.BasicdataClientExcel; import com.logpm.basicdata.mapper.BasicdataClientMapper; -import com.logpm.basicdata.service.*; +import com.logpm.basicdata.service.IBasicdataBrandService; +import com.logpm.basicdata.service.IBasicdataClientLogService; +import com.logpm.basicdata.service.IBasicdataClientService; +import com.logpm.basicdata.service.IBasicdataHistoricalContractService; +import com.logpm.basicdata.service.IBasicdataStorageServicesService; +import com.logpm.basicdata.service.IBasicdataStoreBrandService; +import com.logpm.basicdata.service.IBasicdataStoreBusinessService; +import com.logpm.basicdata.service.IBasicdataStoreContactService; +import com.logpm.basicdata.service.IBasicdataTripartiteMallService; +import com.logpm.basicdata.service.IBasicdataWarehouseService; import com.logpm.basicdata.vo.BasicdataClientVO; import com.logpm.basicdata.vo.ClientInfoVO; import lombok.extern.slf4j.Slf4j; @@ -56,15 +74,21 @@ import org.springblade.system.feign.IRegionFeign; import org.springblade.system.feign.IUserClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; -import org.springframework.core.io.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; -import java.io.File; import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -398,6 +422,13 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl listNameLike(String name) { + return baseMapper.selectList(Wrappers.query().lambda() + .like(StringUtils.isNotBlank(name), BasicdataClientEntity::getClientName, name) + ); + } + @Override @Transactional(rollbackFor = Exception.class) public Boolean ownDeleteLogic(List toLongList) { diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/WarehouseLeasingServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/WarehouseLeasingServiceImpl.java new file mode 100644 index 000000000..6b476b3d0 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/WarehouseLeasingServiceImpl.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.basicdata.entity.BasicdataWarehouseEntity; +import com.logpm.basicdata.entity.WarehouseLeasingEntity; +import com.logpm.basicdata.excel.WarehouseLeasingExcel; +import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.basicdata.mapper.WarehouseLeasingMapper; +import com.logpm.basicdata.service.IWarehouseLeasingService; +import com.logpm.basicdata.vo.ResidualAreaVO; +import com.logpm.basicdata.vo.WarehouseLeasingVO; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; +import org.springblade.system.entity.User; +import org.springblade.system.feign.IUserClient; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 仓库租用管理 服务实现类 + * + * @author zqb + * @since 2024-08-14 + */ +@Service +public class WarehouseLeasingServiceImpl extends BaseServiceImpl implements IWarehouseLeasingService { + + @Resource + private IUserClient userClient; + @Resource + private IBasicdataWarehouseClient warehouseClient; + + @Override + public IPage selectWarehouseLeasingPage(IPage page, WarehouseLeasingVO warehouseLeasing) { + List warehouseLeasingVOS = baseMapper.selectWarehouseLeasingPage(page, warehouseLeasing); + if (CollUtil.isNotEmpty(warehouseLeasingVOS)) { + // 获取修改用户id + Set collect = new HashSet<>(); + warehouseLeasingVOS.forEach(expenseDispatchPriceUnitVO -> { + collect.add(expenseDispatchPriceUnitVO.getCreateUser()); + collect.add(expenseDispatchPriceUnitVO.getUpdateUser()); + }); + if (CollUtil.isNotEmpty(collect)) { + R> listR = userClient.userInfoByIds(AuthUtil.getTenantId(), CollUtil.join(collect, StrUtil.COMMA)); + if (R.isSuccess(listR)) { + List userList = listR.getData(); + // 封装成map + Map userMap = userList.stream().collect(Collectors.toMap(User::getId, user -> user)); + warehouseLeasingVOS.forEach(expenseDispatchPriceUnitVO -> { + if (userMap.containsKey(expenseDispatchPriceUnitVO.getCreateUser())) { + expenseDispatchPriceUnitVO.setCreateUserName(userMap.get(expenseDispatchPriceUnitVO.getCreateUser()).getRealName()); + expenseDispatchPriceUnitVO.setUpdateUserName(userMap.get(expenseDispatchPriceUnitVO.getUpdateUser()).getRealName()); + } + }); + } + } + } + return page.setRecords(warehouseLeasingVOS); + } + + + @Override + public List exportWarehouseLeasing(Wrapper queryWrapper) { + List warehouseLeasingList = baseMapper.exportWarehouseLeasing(queryWrapper); + // warehouseLeasingList.forEach(warehouseLeasing -> { + // warehouseLeasing.setTypeName(DictCache.getValue(DictEnum.YES_NO, WarehouseLeasing.getType())); + //}); + return warehouseLeasingList; + } + + @Override + public ResidualAreaVO residualArea(Long warehouseId) { + BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseId); + ResidualAreaVO residualAreaVO = new ResidualAreaVO(); + if (warehouseEntity != null) { + BigDecimal acreage = warehouseEntity.getAcreage(); + BigDecimal divide = BigDecimal.ZERO; + if (ObjectUtil.isNotEmpty(acreage)) { + if(ObjectUtil.isNotEmpty(warehouseEntity.getTemporaryTurnoverArea())){ + divide = acreage.subtract(warehouseEntity.getTemporaryTurnoverArea()); + }else{ + divide = acreage; + } + if (ObjectUtil.isNotEmpty(warehouseEntity.getSeating())) { + BigDecimal singleStorageArea = divide.divide(new BigDecimal(warehouseEntity.getSeating()), 2, BigDecimal.ROUND_UP); + residualAreaVO.setSingleStorageArea(Convert.toStr(singleStorageArea)); + } + } + List list = this.list(Wrappers.lambdaQuery().eq(WarehouseLeasingEntity::getWarehouseId, warehouseId)); + if (CollUtil.isNotEmpty(list)) { + BigDecimal sum = list.stream().map(WarehouseLeasingEntity::getLeasedArea).reduce(BigDecimal.ZERO, BigDecimal::add); + residualAreaVO.setResidualArea(Convert.toStr(divide.subtract(sum))); + }else{ + residualAreaVO.setResidualArea(Convert.toStr(divide)); + } + } + return residualAreaVO; + } + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/ResidualAreaVO.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/ResidualAreaVO.java new file mode 100644 index 000000000..3b135d562 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/ResidualAreaVO.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 剩余面积 + * + * @author zqb + * @since 2024-08-14 + */ +@Data +public class ResidualAreaVO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 剩余可用面积 + */ + @ApiModelProperty(value = "剩余可用面积") + private String residualArea; + + /** + * 单库位面积 + */ + @ApiModelProperty(value = "单库位面积") + private String singleStorageArea; + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/WarehouseLeasingVO.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/WarehouseLeasingVO.java new file mode 100644 index 000000000..b5cee1a1f --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/WarehouseLeasingVO.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.vo; + +import com.logpm.basicdata.entity.WarehouseLeasingEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 仓库租用管理 视图实体类 + * + * @author zqb + * @since 2024-08-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class WarehouseLeasingVO extends WarehouseLeasingEntity { + private static final long serialVersionUID = 1L; + + /** + * 仓库名称 + */ + @ApiModelProperty(value = "仓库名称") + private String warehouseName; + + /** + * 是否过期 + */ + @ApiModelProperty(value = "是否过期") + private String expired; + + /** + * 客户名称 + */ + @ApiModelProperty(value = "客户名称") + private String clientName; + + /** + * 修改人名称 + */ + @ApiModelProperty(value = "修改人名称") + private String updateUserName; + + /** + * 创建人名称 + */ + @ApiModelProperty(value = "创建人名称") + private String createUserName; + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/wrapper/WarehouseLeasingWrapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/wrapper/WarehouseLeasingWrapper.java new file mode 100644 index 000000000..9dfc68e56 --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/wrapper/WarehouseLeasingWrapper.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.basicdata.wrapper; + +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; +import com.logpm.basicdata.entity.WarehouseLeasingEntity; +import com.logpm.basicdata.vo.WarehouseLeasingVO; +import java.util.Objects; + +/** + * 仓库租用管理 包装类,返回视图层所需的字段 + * + * @author zqb + * @since 2024-08-14 + */ +public class WarehouseLeasingWrapper extends BaseEntityWrapper { + + public static WarehouseLeasingWrapper build() { + return new WarehouseLeasingWrapper(); + } + + @Override + public WarehouseLeasingVO entityVO(WarehouseLeasingEntity warehouseLeasing) { + WarehouseLeasingVO warehouseLeasingVO = Objects.requireNonNull(BeanUtil.copy(warehouseLeasing, WarehouseLeasingVO.class)); + + //User createUser = UserCache.getUser(warehouseLeasing.getCreateUser()); + //User updateUser = UserCache.getUser(warehouseLeasing.getUpdateUser()); + //warehouseLeasingVO.setCreateUserName(createUser.getName()); + //warehouseLeasingVO.setUpdateUserName(updateUser.getName()); + + return warehouseLeasingVO; + } + + +}