Merge branch 'dev_lzh_wms_20260120' into wms_dev
This commit is contained in:
@@ -3,12 +3,15 @@ package com.mhd.system.api;
|
|||||||
import com.mhd.common.core.constant.ServiceNameConstants;
|
import com.mhd.common.core.constant.ServiceNameConstants;
|
||||||
import com.mhd.common.core.web.domain.AjaxResult;
|
import com.mhd.common.core.web.domain.AjaxResult;
|
||||||
import com.mhd.system.api.domain.MaterialBaseInfoFeign;
|
import com.mhd.system.api.domain.MaterialBaseInfoFeign;
|
||||||
|
import com.mhd.system.api.domain.MaterialInventoryDTO;
|
||||||
import com.mhd.system.api.domain.NoticeOrderDTO;
|
import com.mhd.system.api.domain.NoticeOrderDTO;
|
||||||
import com.mhd.system.api.factory.RemoteTicketFeignFallbackFactory;
|
import com.mhd.system.api.factory.RemoteTicketFeignFallbackFactory;
|
||||||
import com.mhd.system.api.feign.FeignAutoConfiguration;
|
import com.mhd.system.api.feign.FeignAutoConfiguration;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ZhouGY
|
* @author ZhouGY
|
||||||
* @title WmsServiceFeign
|
* @title WmsServiceFeign
|
||||||
@@ -57,4 +60,9 @@ public interface WmsServiceFeign {
|
|||||||
@PostMapping("/noticeOrderApi/insert")
|
@PostMapping("/noticeOrderApi/insert")
|
||||||
public AjaxResult stockOutOrInInsert(@RequestBody NoticeOrderDTO noticeOrderDTO);
|
public AjaxResult stockOutOrInInsert(@RequestBody NoticeOrderDTO noticeOrderDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询物料库存列表不分页
|
||||||
|
*/
|
||||||
|
@GetMapping("/materialInventoryApi/listAll")
|
||||||
|
public AjaxResult materialInventoryApiListAll(MaterialInventoryDTO materialInventoryDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
+149
@@ -0,0 +1,149 @@
|
|||||||
|
package com.mhd.system.api.domain;
|
||||||
|
|
||||||
|
import com.mhd.common.core.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料库存对象 material_inventory
|
||||||
|
*
|
||||||
|
* @author gen
|
||||||
|
* @date 2024-05-29
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MaterialInventoryDTO {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("物料库存id")
|
||||||
|
private Long materialInventoryId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织表ID")
|
||||||
|
@Excel(name = "组织表ID")
|
||||||
|
private Long organizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织名称")
|
||||||
|
@Excel(name = "组织名称")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("一级组织表ID")
|
||||||
|
@Excel(name = "一级组织表ID")
|
||||||
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("物料基础信息id")
|
||||||
|
@Excel(name = "物料基础信息id")
|
||||||
|
private Long materialBaseInfoId;
|
||||||
|
|
||||||
|
@ApiModelProperty("上架单物料明细id")
|
||||||
|
@Excel(name = "上架单物料明细id")
|
||||||
|
private Long materialDetailId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库id")
|
||||||
|
@Excel(name = "仓库id")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库编码")
|
||||||
|
@Excel(name = "仓库编码")
|
||||||
|
private String warehouseCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名称")
|
||||||
|
@Excel(name = "仓库名称")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("库区id")
|
||||||
|
@Excel(name = "库区id")
|
||||||
|
private Long storageSectionId;
|
||||||
|
|
||||||
|
@ApiModelProperty("库区编码")
|
||||||
|
@Excel(name = "库区编码")
|
||||||
|
private String storageCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("库区名称")
|
||||||
|
@Excel(name = "库区名称")
|
||||||
|
private String storageName;
|
||||||
|
|
||||||
|
@ApiModelProperty("库位id")
|
||||||
|
@Excel(name = "库位id")
|
||||||
|
private Long storageLocationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("库位编码")
|
||||||
|
@Excel(name = "库位编码")
|
||||||
|
private String storageLocationCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("库位名称")
|
||||||
|
@Excel(name = "库位名称")
|
||||||
|
private String storageLocationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("批次号")
|
||||||
|
@Excel(name = "批次号")
|
||||||
|
private String batchNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("物料状态编码")
|
||||||
|
@Excel(name = "物料状态编码")
|
||||||
|
private String materialStatusCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("物料状态名称")
|
||||||
|
@Excel(name = "物料状态名称")
|
||||||
|
private String materialStatusName;
|
||||||
|
|
||||||
|
@ApiModelProperty("容器id")
|
||||||
|
@Excel(name = "容器id")
|
||||||
|
private Long containerId;
|
||||||
|
|
||||||
|
@ApiModelProperty("容器编码")
|
||||||
|
@Excel(name = "容器编码")
|
||||||
|
private String containerCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("容器类型 数据字典")
|
||||||
|
@Excel(name = "容器类型 数据字典")
|
||||||
|
private String containerType;
|
||||||
|
|
||||||
|
@ApiModelProperty("容器类型名称 数据字典")
|
||||||
|
@Excel(name = "容器类型名称 数据字典")
|
||||||
|
private String containerTypeName;
|
||||||
|
|
||||||
|
@ApiModelProperty("库存数量")
|
||||||
|
@Excel(name = "库存数量")
|
||||||
|
private BigDecimal inventoryQuantity;
|
||||||
|
|
||||||
|
@ApiModelProperty("可用数量")
|
||||||
|
@Excel(name = "可用数量")
|
||||||
|
private BigDecimal allocationQuantity;
|
||||||
|
|
||||||
|
@ApiModelProperty("冻结数量")
|
||||||
|
@Excel(name = "冻结数量")
|
||||||
|
private BigDecimal freezeQuantity;
|
||||||
|
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "组织ID集合")
|
||||||
|
private List<Long> organizationIdList;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "权限菜单ID")
|
||||||
|
private Long permissionMenuId;
|
||||||
|
|
||||||
|
@ApiModelProperty("盘点是否可用:0-禁用 1-可用")
|
||||||
|
@Excel(name = "盘点是否可用:0-禁用 1-可用")
|
||||||
|
private Integer isAble;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主信息")
|
||||||
|
@Excel(name = "货主信息")
|
||||||
|
private String shipperInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty("物料信息")
|
||||||
|
@Excel(name = "物料信息")
|
||||||
|
private String materialInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty("物料/库位信息")
|
||||||
|
@Excel(name = "物料/库位信息")
|
||||||
|
private String storageInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
|
}
|
||||||
+8
@@ -5,6 +5,7 @@ import com.mhd.common.core.web.domain.AjaxResult;
|
|||||||
import com.mhd.system.api.WlhyServiceFeign;
|
import com.mhd.system.api.WlhyServiceFeign;
|
||||||
import com.mhd.system.api.WmsServiceFeign;
|
import com.mhd.system.api.WmsServiceFeign;
|
||||||
import com.mhd.system.api.domain.MaterialBaseInfoFeign;
|
import com.mhd.system.api.domain.MaterialBaseInfoFeign;
|
||||||
|
import com.mhd.system.api.domain.MaterialInventoryDTO;
|
||||||
import com.mhd.system.api.domain.NoticeOrderDTO;
|
import com.mhd.system.api.domain.NoticeOrderDTO;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -12,6 +13,8 @@ import org.springframework.cloud.openfeign.FallbackFactory;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ZhouGY
|
* @author ZhouGY
|
||||||
* @title RemoteWmsFallbackFactory
|
* @title RemoteWmsFallbackFactory
|
||||||
@@ -46,6 +49,11 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
|
|||||||
public AjaxResult stockOutOrInInsert(NoticeOrderDTO noticeOrderDTO) {
|
public AjaxResult stockOutOrInInsert(NoticeOrderDTO noticeOrderDTO) {
|
||||||
return AjaxResult.error(cause.getMessage());
|
return AjaxResult.error(cause.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult materialInventoryApiListAll(MaterialInventoryDTO materialInventoryDTO) {
|
||||||
|
return AjaxResult.error(cause.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.mhd.common.security.annotation.EnableCustomConfig;
|
|||||||
import com.mhd.common.security.annotation.EnableRyFeignClients;
|
import com.mhd.common.security.annotation.EnableRyFeignClients;
|
||||||
import com.mhd.common.swagger.annotation.EnableCustomSwagger2;
|
import com.mhd.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统模块
|
* 系统模块
|
||||||
@@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
|
@EnableScheduling
|
||||||
public class MhdSystemApplication
|
public class MhdSystemApplication
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
|||||||
+143
-7
@@ -1,27 +1,42 @@
|
|||||||
package com.mhd.basic.application.service.Lease;
|
package com.mhd.basic.application.service.Lease;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.mhd.basic.domain.container.repository.po.ContainerPO;
|
import com.mhd.basic.application.service.storageSection.StorageSectionApplicationService;
|
||||||
import com.mhd.basic.domain.container.repository.todo.ContainerDO;
|
|
||||||
import com.mhd.basic.domain.container.service.ContainerDomainService;
|
|
||||||
import com.mhd.basic.domain.lease.entity.Lease;
|
import com.mhd.basic.domain.lease.entity.Lease;
|
||||||
import com.mhd.basic.domain.lease.repository.facade.ILeaseService;
|
import com.mhd.basic.domain.lease.repository.facade.ILeaseService;
|
||||||
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||||
import com.mhd.basic.domain.lease.service.LeaseDomainService;
|
import com.mhd.basic.domain.lease.service.LeaseDomainService;
|
||||||
import com.mhd.common.core.enums.DictCode;
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.ShipperLeaseDetails;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.WarehouseOccupancyRate;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.facade.IShipperLeaseDetailsService;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.po.ShipperLeaseDetailsPO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.todo.ShipperLeaseDetailsDO;
|
||||||
|
import com.mhd.basic.domain.storageSection.repository.po.StorageSectionPO;
|
||||||
|
import com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO;
|
||||||
|
import com.mhd.basic.interfaces.dto.lease.LeaseDTO;
|
||||||
|
import com.mhd.basic.interfaces.dto.shipperLeaseDetailsApi.ShipperLeaseDetailsDTO;
|
||||||
import com.mhd.common.core.exception.ServiceException;
|
import com.mhd.common.core.exception.ServiceException;
|
||||||
|
import com.mhd.common.core.web.domain.AjaxResult;
|
||||||
import com.mhd.common.security.utils.SecurityUtils;
|
import com.mhd.common.security.utils.SecurityUtils;
|
||||||
import com.mhd.system.api.domain.SysDictData;
|
import com.mhd.system.api.WmsServiceFeign;
|
||||||
|
import com.mhd.system.api.domain.MaterialInventoryDTO;
|
||||||
import com.mhd.system.api.model.LoginUser;
|
import com.mhd.system.api.model.LoginUser;
|
||||||
import com.mhd.system.service.ISysDictTypeService;
|
import com.mhd.system.service.ISysDictTypeService;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租赁管理ApplicationService
|
* 租赁管理ApplicationService
|
||||||
@@ -42,6 +57,15 @@ public class LeaseApplicationService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysDictTypeService dictTypeService;
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WmsServiceFeign wmsServiceFeign;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StorageSectionApplicationService storageSectionApplicationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IShipperLeaseDetailsService shipperLeaseDetailsService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询租赁管理列表
|
* 分页查询租赁管理列表
|
||||||
@@ -146,6 +170,118 @@ public class LeaseApplicationService {
|
|||||||
return leaseDomainService.nullifyByIds(leaseIds);
|
return leaseDomainService.nullifyByIds(leaseIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
|
public void shipperLeaseDetails() {
|
||||||
|
LeaseDO leaseDO = new LeaseDO();
|
||||||
|
leaseDO.setTime(new Date());
|
||||||
|
//查询租赁
|
||||||
|
List<LeasePO> leasePOS = queryList(leaseDO);
|
||||||
|
// List<LeasePO> leasePOS = leaseDomainService.queryList(leaseDO);
|
||||||
|
List<LeasePO> entireUnit = leasePOS.stream()
|
||||||
|
.filter(lease -> lease.getLeaseType().equals("整租"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<LeasePO> casualRental = leasePOS.stream()
|
||||||
|
.filter(lease -> lease.getLeaseType().equals("散租"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<ShipperLeaseDetails> shipperLeaseDetailsList = new ArrayList<>(); //建表后保存
|
||||||
|
for (LeasePO en : entireUnit) {//整租
|
||||||
|
ShipperLeaseDetails shipperLeaseDetails = new ShipperLeaseDetails();
|
||||||
|
BeanUtils.copyProperties(en, shipperLeaseDetails);
|
||||||
|
shipperLeaseDetails.setBusinessDate(new Date());
|
||||||
|
shipperLeaseDetailsList.add(shipperLeaseDetails);
|
||||||
|
}
|
||||||
|
//当前货主当前仓库,库存查询页面所有面积加起来就是散租面积
|
||||||
|
for (LeasePO ca : casualRental) {//散租
|
||||||
|
ShipperLeaseDetails shipperLeaseDetails = new ShipperLeaseDetails();
|
||||||
|
BeanUtils.copyProperties(ca, shipperLeaseDetails);
|
||||||
|
shipperLeaseDetails.setBusinessDate(new Date());
|
||||||
|
//物料库存
|
||||||
|
MaterialInventoryDTO materialInventoryDTO = new MaterialInventoryDTO();
|
||||||
|
materialInventoryDTO.setShipperId(ca.getShipperId());
|
||||||
|
materialInventoryDTO.setWarehouseId(ca.getWarehouseId());
|
||||||
|
AjaxResult ajaxResult = wmsServiceFeign.materialInventoryApiListAll(materialInventoryDTO);
|
||||||
|
BigDecimal area = BigDecimal.ZERO;
|
||||||
|
if(String.valueOf(ajaxResult.get("code")).equals("200")) {
|
||||||
|
JSONArray data = JSONObject.parseArray(JSON.toJSONString(ajaxResult.get("data")));
|
||||||
|
for (Object datum : data) {
|
||||||
|
JSONObject json = (JSONObject) datum;
|
||||||
|
BigDecimal area1 = json.getBigDecimal("area");
|
||||||
|
if (area1 == null) {
|
||||||
|
area1 = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
area = area.add(area1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
shipperLeaseDetails.setLeaseArea(area);
|
||||||
|
shipperLeaseDetailsList.add(shipperLeaseDetails);
|
||||||
|
}
|
||||||
|
// 保存货主租赁明细(新建表)
|
||||||
|
if (shipperLeaseDetailsList.size() > 0) {
|
||||||
|
shipperLeaseDetailsService.saveBatch(shipperLeaseDetailsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算仓库出租率
|
||||||
|
* warehouseId 仓库id
|
||||||
|
* businessDateStart 业务开始时间
|
||||||
|
* businessDateEnd 业务结束时间
|
||||||
|
*/
|
||||||
|
public List<WarehouseOccupancyRate> warehouseOccupancyRate(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
|
||||||
|
//仓库id 和 开始结束时间作为查询条件 查数据库 差出来当前仓库所有的
|
||||||
|
List<ShipperLeaseDetailsPO> shipperLeaseDetailsList = shipperLeaseDetailsService.queryList(shipperLeaseDetailsDO);
|
||||||
|
ShipperLeaseDetailsPO shipperLeaseDetailsPO = shipperLeaseDetailsList.get(0);
|
||||||
|
//按业务日期分组,并按日期排序
|
||||||
|
TreeMap<Date, List<ShipperLeaseDetailsPO>> groupedByDate = shipperLeaseDetailsList.stream().collect(
|
||||||
|
Collectors.groupingBy(
|
||||||
|
ShipperLeaseDetailsPO::getBusinessDate,
|
||||||
|
TreeMap::new,
|
||||||
|
Collectors.toList()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
//获取总面积
|
||||||
|
BigDecimal totalArea = BigDecimal.ZERO;
|
||||||
|
StorageSectionDO storageSectionDO = new StorageSectionDO();
|
||||||
|
storageSectionDO.setWarehouseId(shipperLeaseDetailsDO.getWarehouseId());
|
||||||
|
storageSectionDO.setOpeningUp(1);
|
||||||
|
List<StorageSectionPO> storageSectionPOS = storageSectionApplicationService.queryList(storageSectionDO);
|
||||||
|
for (StorageSectionPO storageSectionPO : storageSectionPOS) {
|
||||||
|
totalArea = totalArea.add(storageSectionPO.getStorageRegion());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<WarehouseOccupancyRate> warehouseOccupancyRatesList = new ArrayList<>();
|
||||||
|
//组装仓库返回数据
|
||||||
|
BigDecimal finalTotalArea = totalArea;
|
||||||
|
groupedByDate.forEach((date, shipperLeaseDetails) -> {
|
||||||
|
WarehouseOccupancyRate warehouseOccupancyRate = new WarehouseOccupancyRate();
|
||||||
|
warehouseOccupancyRate.setBusinessDate(date);
|
||||||
|
BigDecimal entireLeaseArea = BigDecimal.ZERO;
|
||||||
|
BigDecimal fractionalLeaseArea = BigDecimal.ZERO;
|
||||||
|
//计算整租和散租
|
||||||
|
for (ShipperLeaseDetailsPO shipperLeaseDetail : shipperLeaseDetails) {
|
||||||
|
if (shipperLeaseDetail.getLeaseType().equals("整租")){
|
||||||
|
entireLeaseArea = entireLeaseArea.add(shipperLeaseDetail.getLeaseArea());
|
||||||
|
}else {
|
||||||
|
fractionalLeaseArea = fractionalLeaseArea.add(shipperLeaseDetail.getLeaseArea());
|
||||||
|
}
|
||||||
|
warehouseOccupancyRate.setWarehouseName(shipperLeaseDetail.getWarehouseName());
|
||||||
|
warehouseOccupancyRate.setBusinessDate(date);
|
||||||
|
warehouseOccupancyRate.setWarehouseId(shipperLeaseDetail.getWarehouseId());
|
||||||
|
}
|
||||||
|
warehouseOccupancyRate.setEntireLeaseArea(entireLeaseArea);
|
||||||
|
warehouseOccupancyRate.setFractionalLeaseArea(fractionalLeaseArea);
|
||||||
|
warehouseOccupancyRate.setTotalArea(finalTotalArea);
|
||||||
|
BigDecimal dailyRentalRate = entireLeaseArea.add(fractionalLeaseArea).divide(finalTotalArea, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
warehouseOccupancyRate.setDailyRentalRate(dailyRentalRate);
|
||||||
|
warehouseOccupancyRatesList.add(warehouseOccupancyRate);
|
||||||
|
});
|
||||||
|
return warehouseOccupancyRatesList;
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * @description 设置数据字典键值
|
// * @description 设置数据字典键值
|
||||||
// * @author ZhouGY
|
// * @author ZhouGY
|
||||||
|
|||||||
+160
@@ -0,0 +1,160 @@
|
|||||||
|
package com.mhd.basic.application.service.shipperLeaseDetails;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.mhd.basic.application.service.storageSection.StorageSectionApplicationService;
|
||||||
|
import com.mhd.basic.domain.lease.entity.Lease;
|
||||||
|
import com.mhd.basic.domain.lease.repository.facade.ILeaseService;
|
||||||
|
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||||
|
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||||
|
import com.mhd.basic.domain.lease.service.LeaseDomainService;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.ShipperLeaseDetails;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.WarehouseOccupancyRate;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.facade.IShipperLeaseDetailsService;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.po.ShipperLeaseDetailsPO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.todo.ShipperLeaseDetailsDO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.service.ShipperLeaseDetailsDomainService;
|
||||||
|
import com.mhd.basic.domain.storageSection.repository.po.StorageSectionPO;
|
||||||
|
import com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO;
|
||||||
|
import com.mhd.basic.interfaces.dto.lease.LeaseDTO;
|
||||||
|
import com.mhd.common.core.exception.ServiceException;
|
||||||
|
import com.mhd.common.core.web.domain.AjaxResult;
|
||||||
|
import com.mhd.common.security.utils.SecurityUtils;
|
||||||
|
import com.mhd.system.api.WmsServiceFeign;
|
||||||
|
import com.mhd.system.api.domain.MaterialInventoryDTO;
|
||||||
|
import com.mhd.system.api.model.LoginUser;
|
||||||
|
import com.mhd.system.service.ISysDictTypeService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细ApplicationService
|
||||||
|
*
|
||||||
|
* @author gen
|
||||||
|
* @date 2024-05-07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class ShipperLeaseDetailsApplicationService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ShipperLeaseDetailsDomainService shipperLeaseDetailsDomainService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询货主租赁明细列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
public List<ShipperLeaseDetailsPO> queryList(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
if (loginUser != null && loginUser.getUserPo() != null){
|
||||||
|
Long loginUserOrganizationId = loginUser.getUserPo().getOrganizationId();
|
||||||
|
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||||
|
|
||||||
|
// 数据权限:根据organizationId来设置查询权限
|
||||||
|
// organizationId等于2827时查询全部,其他仅查询各自组织的信息
|
||||||
|
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
|
||||||
|
// 南光组织(organizationId=2827):可以查询所有组织的数据
|
||||||
|
// 如果前端传递了 organizationId,使用前端传递的值进行过滤
|
||||||
|
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
|
||||||
|
if (shipperLeaseDetailsDO.getOrganizationId() == null) {
|
||||||
|
shipperLeaseDetailsDO.setOrganizationId(null);
|
||||||
|
shipperLeaseDetailsDO.setTopOrganizationId(null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 其他组织:设置organizationId,只查询当前组织的数据
|
||||||
|
if (topOrganizationId != null && topOrganizationId != 1){
|
||||||
|
shipperLeaseDetailsDO.setTopOrganizationId(topOrganizationId);
|
||||||
|
}
|
||||||
|
// 如果前端传递了organizationId,验证是否与当前登录用户的组织ID一致
|
||||||
|
if (shipperLeaseDetailsDO.getOrganizationId() != null && !shipperLeaseDetailsDO.getOrganizationId().equals(loginUserOrganizationId)) {
|
||||||
|
// 前端传递了其他组织的organizationId,强制使用当前登录用户的组织ID,防止越权查询
|
||||||
|
shipperLeaseDetailsDO.setOrganizationId(loginUserOrganizationId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return shipperLeaseDetailsDomainService.queryList(shipperLeaseDetailsDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增货主租赁明细
|
||||||
|
*/
|
||||||
|
public Boolean insert(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
|
||||||
|
// 设置当前登录用户的组织信息
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||||
|
shipperLeaseDetailsDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||||
|
shipperLeaseDetailsDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||||
|
shipperLeaseDetailsDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||||
|
}
|
||||||
|
return shipperLeaseDetailsDomainService.insert(shipperLeaseDetailsDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改货主租赁明细
|
||||||
|
*/
|
||||||
|
public Boolean update(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
|
||||||
|
return shipperLeaseDetailsDomainService.update(shipperLeaseDetailsDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除货主租赁明细
|
||||||
|
*/
|
||||||
|
public boolean delete(Long[] shipperLeaseDetailsIds) {
|
||||||
|
return shipperLeaseDetailsDomainService.delete(shipperLeaseDetailsIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取货主租赁明细详细信息
|
||||||
|
*/
|
||||||
|
public ShipperLeaseDetailsPO getInfo(Long shipperLeaseDetailsId)
|
||||||
|
{
|
||||||
|
return shipperLeaseDetailsDomainService.getInfo(shipperLeaseDetailsId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 批量作废租赁
|
||||||
|
* @author ZhouGY
|
||||||
|
* @date 2024/5/13 9:46
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
public Boolean nullifyByIds(List<Long> shipperLeaseDetailsIds){
|
||||||
|
return shipperLeaseDetailsDomainService.nullifyByIds(shipperLeaseDetailsIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @description 设置数据字典键值
|
||||||
|
// * @author ZhouGY
|
||||||
|
// * @date 2024/4/7 14:33
|
||||||
|
// * @param containerDO
|
||||||
|
// */
|
||||||
|
// private void setDataDict(LeaseDO leaseDO){
|
||||||
|
// //翻译租赁类型
|
||||||
|
// List<SysDictData> storageTypeDictDataList = dictTypeService.selectDictDataByType(DictCode.CONTAINER_TYPE.getCode());
|
||||||
|
// if (null == storageTypeDictDataList) {
|
||||||
|
// throw new ServiceException("租赁类型数据字典不存在 请联系管理员");
|
||||||
|
// }
|
||||||
|
// SysDictData storageTypeDictData = storageTypeDictDataList.stream().filter(info -> ObjectUtil.equal(info.getDictValue(), containerDO.getContainerType())).findAny().orElse(null);
|
||||||
|
// if (null == storageTypeDictData) {
|
||||||
|
// throw new ServiceException("租赁类型【" + leaseDO.getContainerType() + "】数据字典不存在 请联系管理员");
|
||||||
|
// }
|
||||||
|
// leaseDO.setContainerTypeName(storageTypeDictData.getDictLabel());
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -35,6 +35,15 @@ public class Lease extends BaseVOEntity{
|
|||||||
@Excel(name = "一级组织表ID")
|
@Excel(name = "一级组织表ID")
|
||||||
private Long topOrganizationId;
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名字")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
|
|
||||||
@ApiModelProperty("货主名称")
|
@ApiModelProperty("货主名称")
|
||||||
private String cargoOwnerName;
|
private String cargoOwnerName;
|
||||||
|
|
||||||
|
|||||||
+9
@@ -34,6 +34,15 @@ public class LeasePO extends BaseVOEntity{
|
|||||||
@Excel(name = "一级组织表ID")
|
@Excel(name = "一级组织表ID")
|
||||||
private Long topOrganizationId;
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名字")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
|
|
||||||
@ApiModelProperty("货主名称")
|
@ApiModelProperty("货主名称")
|
||||||
private String cargoOwnerName;
|
private String cargoOwnerName;
|
||||||
|
|
||||||
|
|||||||
+13
@@ -35,6 +35,15 @@ public class LeaseDO extends BaseVOEntity{
|
|||||||
@Excel(name = "一级组织表ID")
|
@Excel(name = "一级组织表ID")
|
||||||
private Long topOrganizationId;
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名字")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
|
|
||||||
@ApiModelProperty("货主名称")
|
@ApiModelProperty("货主名称")
|
||||||
private String cargoOwnerName;
|
private String cargoOwnerName;
|
||||||
|
|
||||||
@@ -54,4 +63,8 @@ public class LeaseDO extends BaseVOEntity{
|
|||||||
|
|
||||||
@ApiModelProperty("备注")
|
@ApiModelProperty("备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("当前时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date time;
|
||||||
}
|
}
|
||||||
|
|||||||
+65
@@ -0,0 +1,65 @@
|
|||||||
|
package com.mhd.basic.domain.shipperLeaseDetails.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.mhd.common.core.annotation.Excel;
|
||||||
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ShipperLeaseDetails extends BaseVOEntity{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织表ID")
|
||||||
|
@Excel(name = "组织表ID")
|
||||||
|
private Long organizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织名称")
|
||||||
|
@Excel(name = "组织名称")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("一级组织表ID")
|
||||||
|
@Excel(name = "一级组织表ID")
|
||||||
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名字")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主名称")
|
||||||
|
private String cargoOwnerName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁方式(整租/散租)")
|
||||||
|
private String leaseType;
|
||||||
|
|
||||||
|
@ApiModelProperty("租赁面积(m²)")
|
||||||
|
private BigDecimal leaseArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期")
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date businessDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
package com.mhd.basic.domain.shipperLeaseDetails.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.mhd.common.core.annotation.Excel;
|
||||||
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库出租率返回类 没有表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WarehouseOccupancyRate extends BaseVOEntity{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("组织表ID")
|
||||||
|
@Excel(name = "组织表ID")
|
||||||
|
private Long organizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织名称")
|
||||||
|
@Excel(name = "组织名称")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("一级组织表ID")
|
||||||
|
@Excel(name = "一级组织表ID")
|
||||||
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名字")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期")
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date businessDate;
|
||||||
|
|
||||||
|
@ApiModelProperty("整租面积(m²)")
|
||||||
|
private BigDecimal entireLeaseArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("散租面积(m²)")
|
||||||
|
private BigDecimal fractionalLeaseArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("总面积(m²)")
|
||||||
|
private BigDecimal totalArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("日租率(%)")
|
||||||
|
private BigDecimal dailyRentalRate;
|
||||||
|
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.mhd.basic.domain.shipperLeaseDetails.repository.facade;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.ShipperLeaseDetails;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.po.ShipperLeaseDetailsPO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.todo.ShipperLeaseDetailsDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细Service接口
|
||||||
|
*
|
||||||
|
* @author gen
|
||||||
|
* @date 2024-05-07
|
||||||
|
*/
|
||||||
|
public interface IShipperLeaseDetailsService extends IService<ShipperLeaseDetails>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 分页查询货主租赁明细列表
|
||||||
|
*/
|
||||||
|
public List<ShipperLeaseDetailsPO> queryList(ShipperLeaseDetailsDO shipperLeaseDetailsDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增货主租赁明细
|
||||||
|
*/
|
||||||
|
public Boolean insert(ShipperLeaseDetailsDO shipperLeaseDetailsDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改货主租赁明细
|
||||||
|
*/
|
||||||
|
public Boolean update(ShipperLeaseDetailsDO shipperLeaseDetailsDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除货主租赁明细
|
||||||
|
*/
|
||||||
|
public Boolean delete(Long[] leaseIds);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询货主租赁明细
|
||||||
|
*/
|
||||||
|
public ShipperLeaseDetailsPO getInfo(Long leaseId);
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package com.mhd.basic.domain.shipperLeaseDetails.repository.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.ShipperLeaseDetails;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.po.ShipperLeaseDetailsPO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.todo.ShipperLeaseDetailsDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细Mapper接口
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ShipperLeaseDetailsMapper extends BaseMapper<ShipperLeaseDetails>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询货主租赁明细列表
|
||||||
|
*/
|
||||||
|
public List<ShipperLeaseDetailsPO> queryList(ShipperLeaseDetailsDO shipperLeaseDetailsDO);
|
||||||
|
|
||||||
|
}
|
||||||
+114
@@ -0,0 +1,114 @@
|
|||||||
|
package com.mhd.basic.domain.shipperLeaseDetails.repository.persistence;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.ShipperLeaseDetails;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.facade.IShipperLeaseDetailsService;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.mapper.ShipperLeaseDetailsMapper;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.po.ShipperLeaseDetailsPO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.todo.ShipperLeaseDetailsDO;
|
||||||
|
import com.mhd.common.security.utils.SecurityUtils;
|
||||||
|
import com.mhd.system.api.model.LoginUser;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细Service业务层处理
|
||||||
|
*
|
||||||
|
* @author gen
|
||||||
|
* @date 2024-05-07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ShipperLeaseDetailsImpl extends ServiceImpl<ShipperLeaseDetailsMapper, ShipperLeaseDetails> implements IShipperLeaseDetailsService {
|
||||||
|
@Autowired
|
||||||
|
private ShipperLeaseDetailsMapper shipperLeaseDetailsMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询货主租赁明细列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ShipperLeaseDetailsPO> queryList(ShipperLeaseDetailsDO shipperLeaseDetailsDO)
|
||||||
|
{
|
||||||
|
return shipperLeaseDetailsMapper.queryList(shipperLeaseDetailsDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增货主租赁明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insert(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
ShipperLeaseDetails shipperLeaseDetails = new ShipperLeaseDetails();
|
||||||
|
BeanUtils.copyProperties(shipperLeaseDetailsDO,shipperLeaseDetails);
|
||||||
|
return this.save(shipperLeaseDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改货主租赁明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean update(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
|
||||||
|
ShipperLeaseDetails shipperLeaseDetails = new ShipperLeaseDetails();
|
||||||
|
BeanUtils.copyProperties(shipperLeaseDetailsDO,shipperLeaseDetails);
|
||||||
|
return this.updateById(shipperLeaseDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除货主租赁明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean delete(Long[] leaseIds ) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
List<ShipperLeaseDetails> list = new ArrayList<>();
|
||||||
|
for (Long id : leaseIds) {
|
||||||
|
ShipperLeaseDetails shipperLeaseDetails = new ShipperLeaseDetails();
|
||||||
|
shipperLeaseDetails.setId(id);
|
||||||
|
shipperLeaseDetails.setDelFlag(2);
|
||||||
|
shipperLeaseDetails.setUpdateBy(loginUser.getUserid());
|
||||||
|
shipperLeaseDetails.setUpdateByName(loginUser.getUsername());
|
||||||
|
shipperLeaseDetails.setUpdateTime(new Date());
|
||||||
|
list.add(shipperLeaseDetails);
|
||||||
|
}
|
||||||
|
return this.updateBatchById(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改货主租赁明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ShipperLeaseDetailsPO getInfo(Long ShipperLeaseDetailsId) {
|
||||||
|
ShipperLeaseDetails shipperLeaseDetails = this.getById(ShipperLeaseDetailsId);
|
||||||
|
ShipperLeaseDetailsPO shipperLeaseDetailsPO = new ShipperLeaseDetailsPO();
|
||||||
|
BeanUtils.copyProperties(shipperLeaseDetails,shipperLeaseDetailsPO);
|
||||||
|
return shipperLeaseDetailsPO;
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @description 校验唯一
|
||||||
|
// * @author ZhouGY
|
||||||
|
// * @date 2024/5/9 21:10
|
||||||
|
// * @param containerDO
|
||||||
|
// */
|
||||||
|
// private void verifyUniqueness(ContainerDO containerDO){
|
||||||
|
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
// Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||||
|
// if (topOrganizationId == null || topOrganizationId == 0 ){
|
||||||
|
// throw new ServiceException("获取当前登陆人组织失败!");
|
||||||
|
// }
|
||||||
|
// int count = leaseMapper.selectCount(new QueryWrapper<Container>().lambda()
|
||||||
|
// .eq(Container::getTopOrganizationId, topOrganizationId)
|
||||||
|
// .eq(Container::getContainerCode,containerDO.getContainerCode())
|
||||||
|
// .eq(Container::getOrganizationId, containerDO.getOrganizationId())
|
||||||
|
// .ne(containerDO.getContainerId() != null, Container::getContainerId, containerDO.getContainerId() )
|
||||||
|
// .eq(Container::getDelFlag,1));
|
||||||
|
// if (count > 0){
|
||||||
|
// throw new ServiceException("容器编码【" + containerDO.getContainerCode() + "】已存在");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
+65
@@ -0,0 +1,65 @@
|
|||||||
|
package com.mhd.basic.domain.shipperLeaseDetails.repository.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.mhd.common.core.annotation.Excel;
|
||||||
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ShipperLeaseDetailsPO extends BaseVOEntity{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织表ID")
|
||||||
|
@Excel(name = "组织表ID")
|
||||||
|
private Long organizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织名称")
|
||||||
|
@Excel(name = "组织名称")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("一级组织表ID")
|
||||||
|
@Excel(name = "一级组织表ID")
|
||||||
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名字")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主名称")
|
||||||
|
private String cargoOwnerName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁方式(整租/散租)")
|
||||||
|
private String leaseType;
|
||||||
|
|
||||||
|
@ApiModelProperty("租赁面积(m²)")
|
||||||
|
private BigDecimal leaseArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期")
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date businessDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+73
@@ -0,0 +1,73 @@
|
|||||||
|
package com.mhd.basic.domain.shipperLeaseDetails.repository.todo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.mhd.common.core.annotation.Excel;
|
||||||
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ShipperLeaseDetailsDO extends BaseVOEntity{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织表ID")
|
||||||
|
@Excel(name = "组织表ID")
|
||||||
|
private Long organizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织名称")
|
||||||
|
@Excel(name = "组织名称")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("一级组织表ID")
|
||||||
|
@Excel(name = "一级组织表ID")
|
||||||
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名字")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主名称")
|
||||||
|
private String cargoOwnerName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁方式(整租/散租)")
|
||||||
|
private String leaseType;
|
||||||
|
|
||||||
|
@ApiModelProperty("租赁面积(m²)")
|
||||||
|
private BigDecimal leaseArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期")
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date businessDate;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期开始时间")
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date businessDateStart;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期结束时间")
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date businessDateEnd;
|
||||||
|
|
||||||
|
}
|
||||||
+87
@@ -0,0 +1,87 @@
|
|||||||
|
package com.mhd.basic.domain.shipperLeaseDetails.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.mhd.basic.domain.lease.entity.Lease;
|
||||||
|
import com.mhd.basic.domain.lease.repository.facade.ILeaseService;
|
||||||
|
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||||
|
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.ShipperLeaseDetails;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.facade.IShipperLeaseDetailsService;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.po.ShipperLeaseDetailsPO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.todo.ShipperLeaseDetailsDO;
|
||||||
|
import com.mhd.common.security.utils.SecurityUtils;
|
||||||
|
import com.mhd.system.api.model.LoginUser;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租赁管理
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class ShipperLeaseDetailsDomainService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IShipperLeaseDetailsService shipperLeaseDetailsService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询租赁管理列表
|
||||||
|
*/
|
||||||
|
public List<ShipperLeaseDetailsPO> queryList(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
|
||||||
|
return shipperLeaseDetailsService.queryList(shipperLeaseDetailsDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增租赁管理
|
||||||
|
*/
|
||||||
|
public Boolean insert(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
|
||||||
|
|
||||||
|
return shipperLeaseDetailsService.insert(shipperLeaseDetailsDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改租赁管理
|
||||||
|
*/
|
||||||
|
public Boolean update(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
|
||||||
|
return shipperLeaseDetailsService.update(shipperLeaseDetailsDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除租赁管理
|
||||||
|
*/
|
||||||
|
public Boolean delete(Long[] shipperLeaseDetailsIds) {
|
||||||
|
return shipperLeaseDetailsService.delete(shipperLeaseDetailsIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取租赁管理详细信息
|
||||||
|
*/
|
||||||
|
public ShipperLeaseDetailsPO getInfo(Long shipperLeaseDetailsId)
|
||||||
|
{
|
||||||
|
return shipperLeaseDetailsService.getInfo(shipperLeaseDetailsId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 批量作废租赁
|
||||||
|
* @author ZhouGY
|
||||||
|
* @date 2024/5/13 9:46
|
||||||
|
* @param leaseIds
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
public Boolean nullifyByIds(List<Long> leaseIds) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
return shipperLeaseDetailsService.update(new UpdateWrapper<ShipperLeaseDetails>().lambda()
|
||||||
|
.set(ShipperLeaseDetails::getUpdateBy, loginUser.getUserid())
|
||||||
|
.set(ShipperLeaseDetails::getUpdateTime, new Date())
|
||||||
|
.in(ShipperLeaseDetails::getId, leaseIds)
|
||||||
|
.eq(ShipperLeaseDetails::getDelFlag, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
package com.mhd.basic.interfaces.assember.shipperLeaseDetails;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.todo.ShipperLeaseDetailsDO;
|
||||||
|
import com.mhd.basic.interfaces.dto.lease.LeaseDTO;
|
||||||
|
import com.mhd.basic.interfaces.dto.shipperLeaseDetailsApi.ShipperLeaseDetailsDTO;
|
||||||
|
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||||
|
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||||
|
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||||
|
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||||
|
import com.mhd.common.security.utils.SecurityUtils;
|
||||||
|
import com.mhd.system.api.model.LoginUser;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细Assembler
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ShipperLeaseDetailsAssembler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换实体
|
||||||
|
*/
|
||||||
|
public ShipperLeaseDetailsDO toDO(ShipperLeaseDetailsDTO shipperLeaseDetailsDTO) {
|
||||||
|
ShipperLeaseDetailsDO shipperLeaseDetailsDO = new ShipperLeaseDetailsDO();
|
||||||
|
// 拷贝
|
||||||
|
BeanUtils.copyProperties(shipperLeaseDetailsDTO, shipperLeaseDetailsDO, IgnoreNullUtil.getNullPropertyNames(shipperLeaseDetailsDTO));
|
||||||
|
return shipperLeaseDetailsDO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换实体
|
||||||
|
*/
|
||||||
|
public ShipperLeaseDetailsDO toDOByEdit(ShipperLeaseDetailsDTO shipperLeaseDetailsDTO) {
|
||||||
|
ShipperLeaseDetailsDO shipperLeaseDetailsDO = new ShipperLeaseDetailsDO();
|
||||||
|
// 拷贝
|
||||||
|
BeanUtils.copyProperties(shipperLeaseDetailsDTO, shipperLeaseDetailsDO, IgnoreNullUtil.getNullPropertyNames(shipperLeaseDetailsDTO));
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
if (ObjectUtil.isNull(loginUser)) {
|
||||||
|
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||||
|
}
|
||||||
|
if(shipperLeaseDetailsDTO.getId() != null){
|
||||||
|
shipperLeaseDetailsDO.setUpdateBy(loginUser.getUserid());
|
||||||
|
shipperLeaseDetailsDO.setUpdateByName(loginUser.getUsername());
|
||||||
|
shipperLeaseDetailsDO.setUpdateTime(new Date());
|
||||||
|
}else {
|
||||||
|
shipperLeaseDetailsDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||||
|
shipperLeaseDetailsDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||||
|
shipperLeaseDetailsDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||||
|
shipperLeaseDetailsDO.setCreateBy(loginUser.getUserid());
|
||||||
|
shipperLeaseDetailsDO.setCreateByName(loginUser.getUsername());
|
||||||
|
shipperLeaseDetailsDO.setCreateTime(new Date());
|
||||||
|
}
|
||||||
|
return shipperLeaseDetailsDO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,6 +33,15 @@ public class LeaseDTO extends BaseVOEntity{
|
|||||||
@Excel(name = "一级组织表ID")
|
@Excel(name = "一级组织表ID")
|
||||||
private Long topOrganizationId;
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名字")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
|
|
||||||
@ApiModelProperty("货主名称")
|
@ApiModelProperty("货主名称")
|
||||||
private String cargoOwnerName;
|
private String cargoOwnerName;
|
||||||
|
|
||||||
|
|||||||
+74
@@ -0,0 +1,74 @@
|
|||||||
|
package com.mhd.basic.interfaces.dto.shipperLeaseDetailsApi;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.mhd.common.core.annotation.Excel;
|
||||||
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ShipperLeaseDetailsDTO extends BaseVOEntity{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织表ID")
|
||||||
|
@Excel(name = "组织表ID")
|
||||||
|
private Long organizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织名称")
|
||||||
|
@Excel(name = "组织名称")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("一级组织表ID")
|
||||||
|
@Excel(name = "一级组织表ID")
|
||||||
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
@ApiModelProperty("仓库名字")
|
||||||
|
private String warehouseName;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主名称")
|
||||||
|
private String cargoOwnerName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁方式(整租/散租)")
|
||||||
|
private String leaseType;
|
||||||
|
|
||||||
|
@ApiModelProperty("租赁面积(m²)")
|
||||||
|
private BigDecimal leaseArea;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期")
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date businessDate;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期开始时间")
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date businessDateStart;
|
||||||
|
|
||||||
|
@ApiModelProperty("业务日期结束时间")
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date businessDateEnd;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+1
@@ -6,6 +6,7 @@ import com.mhd.basic.domain.container.repository.po.ContainerPO;
|
|||||||
import com.mhd.basic.domain.container.repository.todo.ContainerDO;
|
import com.mhd.basic.domain.container.repository.todo.ContainerDO;
|
||||||
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.WarehouseOccupancyRate;
|
||||||
import com.mhd.basic.interfaces.assember.container.ContainerAssembler;
|
import com.mhd.basic.interfaces.assember.container.ContainerAssembler;
|
||||||
import com.mhd.basic.interfaces.assember.lease.LeaseAssembler;
|
import com.mhd.basic.interfaces.assember.lease.LeaseAssembler;
|
||||||
import com.mhd.basic.interfaces.dto.container.ContainerDTO;
|
import com.mhd.basic.interfaces.dto.container.ContainerDTO;
|
||||||
|
|||||||
+140
@@ -0,0 +1,140 @@
|
|||||||
|
package com.mhd.basic.interfaces.facadeApi.shipperLeaseDetails;
|
||||||
|
|
||||||
|
import com.mhd.basic.application.service.Lease.LeaseApplicationService;
|
||||||
|
import com.mhd.basic.application.service.shipperLeaseDetails.ShipperLeaseDetailsApplicationService;
|
||||||
|
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||||
|
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.ShipperLeaseDetails;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.entity.WarehouseOccupancyRate;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.po.ShipperLeaseDetailsPO;
|
||||||
|
import com.mhd.basic.domain.shipperLeaseDetails.repository.todo.ShipperLeaseDetailsDO;
|
||||||
|
import com.mhd.basic.interfaces.assember.lease.LeaseAssembler;
|
||||||
|
import com.mhd.basic.interfaces.assember.shipperLeaseDetails.ShipperLeaseDetailsAssembler;
|
||||||
|
import com.mhd.basic.interfaces.dto.lease.LeaseDTO;
|
||||||
|
import com.mhd.basic.interfaces.dto.shipperLeaseDetailsApi.ShipperLeaseDetailsDTO;
|
||||||
|
import com.mhd.common.core.web.controller.BaseController;
|
||||||
|
import com.mhd.common.core.web.domain.AjaxResult;
|
||||||
|
import com.mhd.common.core.web.page.TableDataInfo;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货主租赁明细Api
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ShipperLeaseDetailsApi")
|
||||||
|
public class ShipperLeaseDetailsApi extends BaseController{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LeaseApplicationService leaseApplicationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ShipperLeaseDetailsApplicationService shipperLeaseDetailsApplicationService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShipperLeaseDetailsAssembler shipperLeaseDetailsAssembler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询货主租赁明细列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询货主租赁明细列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ShipperLeaseDetailsDTO shipperLeaseDetailsDTO)
|
||||||
|
{
|
||||||
|
//转换实体
|
||||||
|
ShipperLeaseDetailsDO shipperLeaseDetailsDO = shipperLeaseDetailsAssembler.toDO(shipperLeaseDetailsDTO);
|
||||||
|
startPage();
|
||||||
|
List<ShipperLeaseDetailsPO> list = shipperLeaseDetailsApplicationService.queryList(shipperLeaseDetailsDO);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询货主租赁明细列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询货主租赁明细列表")
|
||||||
|
@GetMapping("/listByApp")
|
||||||
|
public AjaxResult listByApp(ShipperLeaseDetailsDTO shipperLeaseDetailsDTO)
|
||||||
|
{
|
||||||
|
//转换实体
|
||||||
|
ShipperLeaseDetailsDO shipperLeaseDetailsDO = shipperLeaseDetailsAssembler.toDO(shipperLeaseDetailsDTO);
|
||||||
|
List<ShipperLeaseDetailsPO> list = shipperLeaseDetailsApplicationService.queryList(shipperLeaseDetailsDO);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑货主租赁明细
|
||||||
|
*/
|
||||||
|
@ApiOperation("编辑货主租赁明细")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
public AjaxResult edit(@RequestBody ShipperLeaseDetailsDTO shipperLeaseDetailsDTO)
|
||||||
|
{
|
||||||
|
//转换实体
|
||||||
|
ShipperLeaseDetailsDO shipperLeaseDetailsDO = shipperLeaseDetailsAssembler.toDOByEdit(shipperLeaseDetailsDTO);
|
||||||
|
if(shipperLeaseDetailsDTO.getId() != null){
|
||||||
|
return toAjax(shipperLeaseDetailsApplicationService.update(shipperLeaseDetailsDO));
|
||||||
|
}else {
|
||||||
|
return toAjax(shipperLeaseDetailsApplicationService.insert(shipperLeaseDetailsDO));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除货主租赁明细
|
||||||
|
*/
|
||||||
|
@ApiOperation("批量删除货主租赁明细")
|
||||||
|
@DeleteMapping("/deleteByIds/{shipperLeaseDetailsIds}")
|
||||||
|
public AjaxResult delete(@PathVariable Long[] shipperLeaseDetailsIds)
|
||||||
|
{
|
||||||
|
return toAjax(shipperLeaseDetailsApplicationService.delete(shipperLeaseDetailsIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取货主租赁明细详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取货主租赁明细")
|
||||||
|
@GetMapping(value = "/getInfo/{shipperLeaseDetailsId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("shipperLeaseDetailsId") Long shipperLeaseDetailsId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(shipperLeaseDetailsApplicationService.getInfo(shipperLeaseDetailsId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量作废租赁
|
||||||
|
*/
|
||||||
|
@ApiOperation("批量作废租赁")
|
||||||
|
@GetMapping("/nullifyByIds/{shipperLeaseDetailsIds}")
|
||||||
|
public AjaxResult nullifyByIds(@PathVariable("shipperLeaseDetailsIds") List<Long> shipperLeaseDetailsIds)
|
||||||
|
{
|
||||||
|
return toAjax(shipperLeaseDetailsApplicationService.nullifyByIds(shipperLeaseDetailsIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算货主租赁明细
|
||||||
|
*/
|
||||||
|
@ApiOperation("货主租赁明细")
|
||||||
|
@PostMapping("/shipperLeaseDetails")
|
||||||
|
public AjaxResult shipperLeaseDetails()
|
||||||
|
{
|
||||||
|
leaseApplicationService.shipperLeaseDetails();
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算仓库出租率
|
||||||
|
* warehouseId 仓库id
|
||||||
|
*/
|
||||||
|
@ApiOperation("仓库出租率")
|
||||||
|
@PostMapping("/warehouseOccupancyRate")
|
||||||
|
public TableDataInfo warehouseOccupancyRate(@RequestBody ShipperLeaseDetailsDTO shipperLeaseDetailsDTO)
|
||||||
|
{
|
||||||
|
ShipperLeaseDetailsDO shipperLeaseDetailsDO = shipperLeaseDetailsAssembler.toDO(shipperLeaseDetailsDTO);
|
||||||
|
List<WarehouseOccupancyRate> warehouseOccupancyRates = leaseApplicationService.warehouseOccupancyRate(shipperLeaseDetailsDO);
|
||||||
|
return getDataTable(warehouseOccupancyRates);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,6 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
organization_id,
|
organization_id,
|
||||||
organization_name,
|
organization_name,
|
||||||
top_organization_id,
|
top_organization_id,
|
||||||
|
warehouse_id,
|
||||||
|
warehouse_name,
|
||||||
|
shipper_id,
|
||||||
cargo_owner_name,
|
cargo_owner_name,
|
||||||
lease_type,
|
lease_type,
|
||||||
lease_area,
|
lease_area,
|
||||||
@@ -61,6 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="organizationName != null and organizationName != ''">
|
<if test="organizationName != null and organizationName != ''">
|
||||||
and organization_name like concat('%', #{organizationName}, '%')
|
and organization_name like concat('%', #{organizationName}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="warehouseName != null and warehouseName != ''">
|
||||||
|
and warehouse_name like concat('%', #{warehouseName}, '%')
|
||||||
|
</if>
|
||||||
<if test="cargoOwnerName != null and cargoOwnerName != ''">
|
<if test="cargoOwnerName != null and cargoOwnerName != ''">
|
||||||
and cargo_owner_name like concat('%', #{cargoOwnerName}, '%')
|
and cargo_owner_name like concat('%', #{cargoOwnerName}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -85,7 +91,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="startDate != null and endDate != null">
|
<if test="startDate != null and endDate != null">
|
||||||
and start_date >= #{startDate} and start_date <= #{endDate}
|
and start_date >= #{startDate} and start_date <= #{endDate}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="time != null">
|
||||||
|
AND start_date <= #{time}
|
||||||
|
AND end_date >= #{time}
|
||||||
|
</if>
|
||||||
<!-- 删除标记 -->
|
<!-- 删除标记 -->
|
||||||
<choose>
|
<choose>
|
||||||
<when test="delFlag != null"> and del_flag = #{delFlag} </when>
|
<when test="delFlag != null"> and del_flag = #{delFlag} </when>
|
||||||
|
|||||||
+127
@@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.mhd.basic.domain.shipperLeaseDetails.repository.mapper.ShipperLeaseDetailsMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.mhd.basic.domain.shipperLeaseDetails.repository.po.ShipperLeaseDetailsPO" id="ShipperLeaseDetailsResult">
|
||||||
|
<!-- 货主租赁明细字段 -->
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="organizationId" column="organization_id" />
|
||||||
|
<result property="organizationName" column="organization_name" />
|
||||||
|
<result property="topOrganizationId" column="top_organization_id" />
|
||||||
|
<result property="warehouseId" column="warehouse_id" />
|
||||||
|
<result property="warehouseName" column="warehouse_name" />
|
||||||
|
<result property="shipperId" column="shipper_id" />
|
||||||
|
<result property="cargoOwnerName" column="cargo_owner_name" />
|
||||||
|
<result property="leaseType" column="lease_type" />
|
||||||
|
<result property="leaseArea" column="lease_area" />
|
||||||
|
<result property="businessDate" column="business_date" />
|
||||||
|
|
||||||
|
<!-- 继承自BaseVOEntity的字段 -->
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createByName" column="create_by_name" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateByName" column="update_by_name" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<sql id="selectShipperLeaseDetailsVo">
|
||||||
|
select
|
||||||
|
id,
|
||||||
|
organization_id,
|
||||||
|
organization_name,
|
||||||
|
top_organization_id,
|
||||||
|
warehouse_id,
|
||||||
|
warehouse_name,
|
||||||
|
shipper_id,
|
||||||
|
cargo_owner_name,
|
||||||
|
lease_type,
|
||||||
|
lease_area,
|
||||||
|
business_date,
|
||||||
|
create_by,
|
||||||
|
create_by_name,
|
||||||
|
create_time,
|
||||||
|
update_by,
|
||||||
|
update_by_name,
|
||||||
|
update_time,
|
||||||
|
del_flag
|
||||||
|
from shipper_lease_details
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="selectShipperLeaseDetailsWhere">
|
||||||
|
<where>
|
||||||
|
<!-- 组织相关条件 -->
|
||||||
|
<if test="organizationId != null">
|
||||||
|
and organization_id = #{organizationId}
|
||||||
|
</if>
|
||||||
|
<if test="topOrganizationId != null">
|
||||||
|
and top_organization_id = #{topOrganizationId}
|
||||||
|
</if>
|
||||||
|
<if test="organizationName != null and organizationName != ''">
|
||||||
|
and organization_name like concat('%', #{organizationName}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 仓库相关条件 -->
|
||||||
|
<if test="warehouseId != null">
|
||||||
|
and warehouse_id = #{warehouseId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 业务日期时间范围 -->
|
||||||
|
<if test="businessDateStart != null">
|
||||||
|
and business_date >= #{businessDateStart}
|
||||||
|
</if>
|
||||||
|
<if test="businessDateEnd != null">
|
||||||
|
and business_date <= #{businessDateEnd}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="warehouseName != null and warehouseName != ''">
|
||||||
|
and warehouse_name like concat('%', #{warehouseName}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 货主相关条件 -->
|
||||||
|
<if test="shipperId != null">
|
||||||
|
and shipper_id = #{shipperId}
|
||||||
|
</if>
|
||||||
|
<if test="cargoOwnerName != null and cargoOwnerName != ''">
|
||||||
|
and cargo_owner_name like concat('%', #{cargoOwnerName}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 租赁相关条件 -->
|
||||||
|
<if test="leaseType != null and leaseType != ''">
|
||||||
|
and lease_type = #{leaseType}
|
||||||
|
</if>
|
||||||
|
<if test="leaseArea != null">
|
||||||
|
and lease_area = #{leaseArea}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 业务日期条件 -->
|
||||||
|
<if test="businessDate != null">
|
||||||
|
and business_date = #{businessDate}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 创建和更新相关条件 -->
|
||||||
|
<if test="createByName != null and createByName != ''">
|
||||||
|
and create_by_name like concat('%', #{createByName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="updateByName != null and updateByName != ''">
|
||||||
|
and update_by_name like concat('%', #{updateByName}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 删除标记 -->
|
||||||
|
<choose>
|
||||||
|
<when test="delFlag != null"> and del_flag = #{delFlag} </when>
|
||||||
|
<otherwise> and del_flag = 1 </otherwise>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="queryList" parameterType="com.mhd.basic.domain.shipperLeaseDetails.repository.po.ShipperLeaseDetailsPO" resultMap="ShipperLeaseDetailsResult">
|
||||||
|
<include refid="selectShipperLeaseDetailsVo"/>
|
||||||
|
<include refid="selectShipperLeaseDetailsWhere"/>
|
||||||
|
ORDER BY create_time DESC
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
+3
@@ -165,4 +165,7 @@ public class MaterialInventoryDO extends MaterialBaseDO {
|
|||||||
@ApiModelProperty("面积")
|
@ApiModelProperty("面积")
|
||||||
@Excel(name = "面积")
|
@Excel(name = "面积")
|
||||||
private BigDecimal area;
|
private BigDecimal area;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
}
|
}
|
||||||
+3
@@ -144,4 +144,7 @@ public class MaterialInventoryDTO extends MaterialBaseDTO {
|
|||||||
@ApiModelProperty("物料/库位信息")
|
@ApiModelProperty("物料/库位信息")
|
||||||
@Excel(name = "物料/库位信息")
|
@Excel(name = "物料/库位信息")
|
||||||
private String storageInfo;
|
private String storageInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty("货主id")
|
||||||
|
private Long shipperId;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -47,6 +47,16 @@ public class MaterialInventoryApi extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询物料库存列表不分页")
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public TableDataInfo listAll(MaterialInventoryDTO materialInventoryDTO)
|
||||||
|
{
|
||||||
|
//转换实体
|
||||||
|
MaterialInventoryDO materialInventoryDO = materialInventoryAssembler.toDO(materialInventoryDTO);
|
||||||
|
List<MaterialInventoryPO> list = materialInventoryApplicationService.queryList(materialInventoryDO);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑物料库存
|
* 编辑物料库存
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -70,6 +70,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="warehouseId != null ">
|
<if test="warehouseId != null ">
|
||||||
and a.warehouse_id = #{warehouseId}
|
and a.warehouse_id = #{warehouseId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="shipperId != null ">
|
||||||
|
and a.shipper_id = #{shipperId}
|
||||||
|
</if>
|
||||||
<if test="warehouseCode != null and warehouseCode != ''">
|
<if test="warehouseCode != null and warehouseCode != ''">
|
||||||
and a.warehouse_code = #{warehouseCode}
|
and a.warehouse_code = #{warehouseCode}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user