Merge branch 'wms_dev' into wms_dev_hbbf
# Conflicts: # mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/UserServiceFeign.java # mhd_oms/pom.xml
This commit is contained in:
@@ -275,6 +275,12 @@ public interface SystemServiceFeign {
|
||||
@GetMapping("/associationWarehouseApi/setWarehouseInfo")
|
||||
public AjaxResult setWarehouseInfo(@RequestBody AssociationWarehouseFeign associationWarehouseFeign);
|
||||
|
||||
/**
|
||||
* 查询仓库关联的用户ID集合
|
||||
*/
|
||||
@GetMapping("/associationWarehouseApi/queryListCorrelationId")
|
||||
public AjaxResult queryListCorrelationId(@RequestParam(value = "warehouseId", required = false) Long warehouseId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据code编码查询费用科目
|
||||
|
||||
@@ -109,6 +109,13 @@ public interface UserServiceFeign {
|
||||
@GetMapping("/userApi/getInfo/{userId}")
|
||||
public AjaxResult getInfo(@PathVariable("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户详细信息
|
||||
*/
|
||||
@ApiOperation("根据用户ID查询用户详细信息")
|
||||
@GetMapping("/userApi/getInfoByName/{userName}")
|
||||
public AjaxResult getInfoByName(@PathVariable("userName") String userName);
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆绑定的承运人列表
|
||||
@@ -184,4 +191,4 @@ public interface UserServiceFeign {
|
||||
@ApiOperation("根据用户ID查询货主信息")
|
||||
@GetMapping("/userShipperApi/getShipperByUserId/{userId}")
|
||||
public AjaxResult<?> getShipperByUserId(@PathVariable("userId") Long userId);
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,15 @@ package com.mhd.system.api;
|
||||
import com.mhd.common.core.constant.ServiceNameConstants;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
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.factory.RemoteTicketFeignFallbackFactory;
|
||||
import com.mhd.system.api.feign.FeignAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ZhouGY
|
||||
* @title WmsServiceFeign
|
||||
@@ -57,4 +60,9 @@ public interface WmsServiceFeign {
|
||||
@PostMapping("/noticeOrderApi/insert")
|
||||
public AjaxResult stockOutOrInInsert(@RequestBody NoticeOrderDTO noticeOrderDTO);
|
||||
|
||||
/**
|
||||
* 查询物料库存列表不分页
|
||||
*/
|
||||
@GetMapping("/materialInventoryApi/listAll")
|
||||
public AjaxResult materialInventoryApiListAll(MaterialInventoryDTO materialInventoryDTO);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,10 @@ public class BatchDetailFeignPO extends BaseVOEntity{
|
||||
@Excel(name = "批次标签")
|
||||
private String batchLabels;
|
||||
|
||||
@ApiModelProperty("字段名称")
|
||||
@Excel(name = "字段名称")
|
||||
private String fieldName;
|
||||
|
||||
@ApiModelProperty("输入控制: 1-必填 2-可选")
|
||||
@Excel(name = "输入控制: 1-必填 2-可选")
|
||||
private String inputControl;
|
||||
@@ -56,6 +60,10 @@ public class BatchDetailFeignPO extends BaseVOEntity{
|
||||
@Excel(name = "属性选项")
|
||||
private String attributeOption;
|
||||
|
||||
@ApiModelProperty("是否显示: 0-不显示 1-显示")
|
||||
@Excel(name = "是否显示: 0-不显示 1-显示")
|
||||
private Integer isDisplay;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
+30
@@ -181,5 +181,35 @@ public class MaterialBaseInfoFeign extends BaseVOEntity{
|
||||
@ApiModelProperty("是否公用: 1-是 2-否")
|
||||
@Excel(name = "是否公用: 1-是 2-否")
|
||||
private Integer common;
|
||||
|
||||
@ApiModelProperty("SKU码")
|
||||
private String skuCode;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("原产国")
|
||||
private String originCountry;
|
||||
|
||||
@ApiModelProperty("HS码")
|
||||
private String hsCode;
|
||||
|
||||
@ApiModelProperty("申报单位")
|
||||
private String declarationUnit;
|
||||
|
||||
@ApiModelProperty("法定单位")
|
||||
private String statutoryUnit;
|
||||
|
||||
@ApiModelProperty("法定第二单位")
|
||||
private String statutorySecondUnit;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
|
||||
@ApiModelProperty("币制")
|
||||
private String currency;
|
||||
}
|
||||
|
||||
|
||||
+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;
|
||||
}
|
||||
+5
@@ -219,6 +219,11 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
|
||||
return AjaxResult.error("查询关联仓库列表根据关联id查询失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult queryListCorrelationId(Long warehouseId) {
|
||||
return AjaxResult.error("查询仓库关联的用户ID集合失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getSubInfoByCode(String subjectCode) {
|
||||
return AjaxResult.error("获取科目信息失败" + throwable.getMessage());
|
||||
|
||||
+8
-1
@@ -14,6 +14,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -78,11 +79,17 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
|
||||
return AjaxResult.error("根据车辆id查询司机失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@GetMapping("/userApi/getInfo/{userId}")
|
||||
@Override
|
||||
public AjaxResult getInfo(Long userId) {
|
||||
return AjaxResult.error("根据用户ID查询用户详细信息失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getInfoByName(String userName) {
|
||||
return AjaxResult.error("根据用户userName查询用户详细信息失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult bindDriverShipList(Long vehicleId) {
|
||||
return AjaxResult.error("查询车辆绑定的承运人列表信息失败:" + throwable.getMessage());
|
||||
@@ -176,4 +183,4 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -5,6 +5,7 @@ import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.system.api.WlhyServiceFeign;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.MaterialBaseInfoFeign;
|
||||
import com.mhd.system.api.domain.MaterialInventoryDTO;
|
||||
import com.mhd.system.api.domain.NoticeOrderDTO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -12,6 +13,8 @@ import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ZhouGY
|
||||
* @title RemoteWmsFallbackFactory
|
||||
@@ -46,6 +49,11 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
|
||||
public AjaxResult stockOutOrInInsert(NoticeOrderDTO noticeOrderDTO) {
|
||||
return AjaxResult.error(cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult materialInventoryApiListAll(MaterialInventoryDTO materialInventoryDTO) {
|
||||
return AjaxResult.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
@@ -22,9 +22,9 @@ spring:
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
@@ -220,4 +220,34 @@ public class UserPo {
|
||||
|
||||
@ApiModelProperty(name = "制单员nc编码")
|
||||
private String documentPreparerNcCode;
|
||||
|
||||
@ApiModelProperty("法人代表")
|
||||
private String legalRepresentative;
|
||||
|
||||
@ApiModelProperty("统一编码")
|
||||
private String unifiedCode;
|
||||
|
||||
@ApiModelProperty("注册电话")
|
||||
private String registeredPhone;
|
||||
|
||||
@ApiModelProperty("注册地址")
|
||||
private String registeredAddress;
|
||||
|
||||
@ApiModelProperty("传真")
|
||||
private String fax;
|
||||
|
||||
@ApiModelProperty("付款银行")
|
||||
private String paymentBank;
|
||||
|
||||
@ApiModelProperty("付款账户")
|
||||
private String paymentAccount;
|
||||
|
||||
@ApiModelProperty("发票抬头")
|
||||
private String invoiceTitle;
|
||||
|
||||
@ApiModelProperty("税号")
|
||||
private String taxNumber;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ spring:
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
#线上正式环境
|
||||
server-addr: 10.102.192.5:6848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
@@ -26,7 +27,8 @@ spring:
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
#线上正式环境
|
||||
server-addr: 10.102.192.5:6848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
|
||||
@@ -14,10 +14,14 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
#server-addr: mhd-nacos:8848
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
#server-addr: mhd-nacos:8848
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mhd.common.security.annotation.EnableCustomConfig;
|
||||
import com.mhd.common.security.annotation.EnableRyFeignClients;
|
||||
import com.mhd.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
@@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
public class MhdSystemApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
|
||||
+318
@@ -0,0 +1,318 @@
|
||||
package com.mhd.basic.application.service.Lease;
|
||||
|
||||
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.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.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.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.MaterialInventoryDTO;
|
||||
import com.mhd.system.api.domain.WarehouseFeignPO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.system.service.ISysDictTypeService;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 租赁管理ApplicationService
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LeaseApplicationService {
|
||||
|
||||
@Autowired
|
||||
private LeaseDomainService leaseDomainService;
|
||||
|
||||
@Autowired
|
||||
private ILeaseService leaseService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@Autowired
|
||||
private WmsServiceFeign wmsServiceFeign;
|
||||
|
||||
@Autowired
|
||||
private StorageSectionApplicationService storageSectionApplicationService;
|
||||
|
||||
@Autowired
|
||||
private IShipperLeaseDetailsService shipperLeaseDetailsService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询租赁管理列表
|
||||
*/
|
||||
|
||||
public List<LeasePO> queryList(LeaseDO leaseDO) {
|
||||
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 (leaseDO.getOrganizationId() == null) {
|
||||
leaseDO.setOrganizationId(null);
|
||||
leaseDO.setTopOrganizationId(null);
|
||||
}
|
||||
} else {
|
||||
// 其他组织:设置organizationId,只查询当前组织的数据
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
leaseDO.setTopOrganizationId(topOrganizationId);
|
||||
}
|
||||
// 如果前端传递了organizationId,验证是否与当前登录用户的组织ID一致
|
||||
if (leaseDO.getOrganizationId() != null && !leaseDO.getOrganizationId().equals(loginUserOrganizationId)) {
|
||||
// 前端传递了其他组织的organizationId,强制使用当前登录用户的组织ID,防止越权查询
|
||||
leaseDO.setOrganizationId(loginUserOrganizationId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return leaseDomainService.queryList(leaseDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增租赁管理
|
||||
*/
|
||||
public Boolean insert(LeaseDO leaseDO) {
|
||||
// 设置当前登录用户的组织信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||
leaseDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
leaseDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
leaseDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
List<Lease> timeOverlapSimple = isTimeOverlapSimple(leaseDO.getCargoOwnerName(), leaseDO.getStartDate(), leaseDO.getEndDate(), null);
|
||||
if (ObjectUtil.isNotEmpty(timeOverlapSimple)) {
|
||||
throw new ServiceException("同一货主租赁信息时间不能重叠");
|
||||
}
|
||||
setWarehouseInfo(leaseDO);
|
||||
return leaseDomainService.insert(leaseDO);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
private void setWarehouseInfo(LeaseDO leaseDO) {
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(leaseDO.getWarehouseId());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
}
|
||||
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
|
||||
leaseDO.setWarehouseName(warehouseFeignPO.getWarehouseName());
|
||||
}
|
||||
|
||||
private List<Lease> isTimeOverlapSimple(String cargoOwnerName, Date startDate, Date endDate, Long excludeId) {
|
||||
LambdaQueryWrapper<Lease> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Lease::getCargoOwnerName, cargoOwnerName)
|
||||
.eq(Lease::getDelFlag, 1) // 只查询正常状态
|
||||
.le(Lease::getStartDate, endDate)
|
||||
.ge(Lease::getEndDate, startDate);
|
||||
if (excludeId != null) {
|
||||
wrapper.ne(Lease::getId, excludeId);
|
||||
}
|
||||
return leaseService.list(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租赁管理
|
||||
*/
|
||||
public Boolean update(LeaseDO leaseDO) {
|
||||
List<Lease> timeOverlapSimple = isTimeOverlapSimple(leaseDO.getCargoOwnerName(), leaseDO.getStartDate(), leaseDO.getEndDate(), leaseDO.getId());
|
||||
if (ObjectUtil.isNotEmpty(timeOverlapSimple)) {
|
||||
throw new ServiceException("同一货主租赁信息时间不能重叠");
|
||||
}
|
||||
return leaseDomainService.update(leaseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除租赁管理
|
||||
*/
|
||||
public boolean delete(Long[] leaseIds) {
|
||||
return leaseDomainService.delete(leaseIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租赁管理详细信息
|
||||
*/
|
||||
public LeasePO getInfo(Long leaseId)
|
||||
{
|
||||
return leaseDomainService.getInfo(leaseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 批量作废租赁
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/13 9:46
|
||||
* @param leaseIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(List<Long> 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 设置数据字典键值
|
||||
// * @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());
|
||||
// }
|
||||
}
|
||||
+24
-1
@@ -1,15 +1,22 @@
|
||||
package com.mhd.basic.application.service.batch;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.basic.domain.batch.repository.po.BatchPO;
|
||||
import com.mhd.basic.domain.batch.repository.todo.BatchDO;
|
||||
import com.mhd.basic.domain.batch.service.BatchDomainService;
|
||||
import com.mhd.basic.domain.batchDetail.entity.BatchDetail;
|
||||
import com.mhd.basic.domain.batchDetail.repository.facade.IBatchDetailService;
|
||||
import com.mhd.basic.domain.batchDetail.repository.po.BatchDetailPO;
|
||||
import com.mhd.basic.domain.pack.repository.todo.PackDO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 批次管理ApplicationService
|
||||
@@ -22,6 +29,8 @@ import java.util.List;
|
||||
public class BatchApplicationService {
|
||||
@Autowired
|
||||
private BatchDomainService batchDomainService;
|
||||
@Autowired
|
||||
private IBatchDetailService batchDetailService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,7 +45,21 @@ public class BatchApplicationService {
|
||||
batchDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return batchDomainService.queryList(batchDO);
|
||||
List<BatchPO> batchPOS = batchDomainService.queryList(batchDO);
|
||||
for (BatchPO batchPO : batchPOS) {
|
||||
List<BatchDetail> batchDetailList = batchDetailService.list(new LambdaQueryWrapper<BatchDetail>()
|
||||
.eq(BatchDetail::getBatchId, batchPO.getBatchId())
|
||||
.eq(BatchDetail::getDelFlag, "1"));
|
||||
List<BatchDetailPO> batchDetailPOS = new ArrayList<>();
|
||||
// 逐个对象拷贝
|
||||
for (BatchDetail detail : batchDetailList) {
|
||||
BatchDetailPO detailPO = new BatchDetailPO();
|
||||
BeanUtils.copyProperties(detail, detailPO);
|
||||
batchDetailPOS.add(detailPO);
|
||||
}
|
||||
batchPO.setBatchDetailList(batchDetailPOS);
|
||||
}
|
||||
return batchPOS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
@@ -45,6 +45,10 @@ public class BatchDetailApplicationService {
|
||||
batchDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
// 如果未指定isDisplay,默认只查询显示的数据(isDisplay=1)
|
||||
if (batchDetailDO.getIsDisplay() == null) {
|
||||
batchDetailDO.setIsDisplay(1);
|
||||
}
|
||||
return batchDetailDomainService.queryList(batchDetailDO);
|
||||
}
|
||||
|
||||
|
||||
-20
@@ -79,8 +79,6 @@ public class ContainerApplicationService {
|
||||
containerDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
containerDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
//翻译库区类型
|
||||
setDataDict(containerDO);
|
||||
return containerDomainService.insert(containerDO);
|
||||
}
|
||||
|
||||
@@ -117,22 +115,4 @@ public class ContainerApplicationService {
|
||||
return containerDomainService.nullifyByIds(containerIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 设置数据字典键值
|
||||
* @author ZhouGY
|
||||
* @date 2024/4/7 14:33
|
||||
* @param containerDO
|
||||
*/
|
||||
private void setDataDict(ContainerDO containerDO){
|
||||
//翻译容器类型
|
||||
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("容器类型【" + containerDO.getContainerType() + "】数据字典不存在 请联系管理员");
|
||||
}
|
||||
containerDO.setContainerTypeName(storageTypeDictData.getDictLabel());
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -120,7 +120,11 @@ public class MaterialBaseInfoApplicationService {
|
||||
throw new ServiceException("获取货主信息失败");
|
||||
}
|
||||
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
|
||||
materialBaseInfoDO.setShipperName(userPo.getUserName());
|
||||
// 如果原始shipperName不为空,保留原始值(导入或手动输入时应该保留完整名称)
|
||||
// 只有在原始shipperName为空时,才使用查询到的userName
|
||||
if (materialBaseInfoDO.getShipperName() == null || materialBaseInfoDO.getShipperName().trim().isEmpty()) {
|
||||
materialBaseInfoDO.setShipperName(userPo.getUserName());
|
||||
}
|
||||
}
|
||||
|
||||
public List<MaterialStockInfoVo> getMaterialStockList(String shipperName, String materialName,
|
||||
|
||||
+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());
|
||||
// }
|
||||
}
|
||||
+24
-2
@@ -49,8 +49,30 @@ public class StorageLocationApplicationService {
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
storageLocationDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
storageLocationDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
// 只有当前端没有明确传仓库条件时,才使用用户关联仓库缓存进行过滤;
|
||||
// 避免出现“单据仓库=常温仓,但库位列表仍显示保税仓”的错配问题。
|
||||
boolean hasWarehouseFilter = storageLocationDO.getWarehouseId() != null
|
||||
|| (storageLocationDO.getWarehouseCode() != null && !storageLocationDO.getWarehouseCode().trim().isEmpty())
|
||||
|| (storageLocationDO.getWarehouseName() != null && !storageLocationDO.getWarehouseName().trim().isEmpty());
|
||||
if (!hasWarehouseFilter) {
|
||||
try {
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (associationWarehouseCacheDO != null) {
|
||||
if (associationWarehouseCacheDO.getWarehouseId() != null) {
|
||||
storageLocationDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
if (associationWarehouseCacheDO.getWarehouseCode() != null && !associationWarehouseCacheDO.getWarehouseCode().trim().isEmpty()) {
|
||||
storageLocationDO.setWarehouseCode(associationWarehouseCacheDO.getWarehouseCode());
|
||||
}
|
||||
if (associationWarehouseCacheDO.getWarehouseName() != null && !associationWarehouseCacheDO.getWarehouseName().trim().isEmpty()) {
|
||||
storageLocationDO.setWarehouseName(associationWarehouseCacheDO.getWarehouseName());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 获取失败不影响查询(允许查询所有仓库,或由前端传参控制)
|
||||
log.warn("获取用户关联仓库信息失败,将按前端条件查询库位数据,用户ID:{},错误:{}", loginUser.getUserid(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return storageLocationDomainService.queryList(storageLocationDO);
|
||||
}
|
||||
|
||||
+3
-3
@@ -43,9 +43,9 @@ public class WarehouseApplicationService {
|
||||
public List<WarehousePO> queryList(WarehouseDO warehouseDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
warehouseDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
if (organizationId != null && organizationId != 1){
|
||||
warehouseDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
}
|
||||
}
|
||||
return warehouseDomainService.queryList(warehouseDO);
|
||||
|
||||
+8
@@ -46,6 +46,10 @@ public class BatchDetail extends BaseVOEntity{
|
||||
@Excel(name = "批次标签")
|
||||
private String batchLabels;
|
||||
|
||||
@ApiModelProperty("字段名称")
|
||||
@Excel(name = "字段名称")
|
||||
private String fieldName;
|
||||
|
||||
@ApiModelProperty("输入控制: 1-必填 2-可选")
|
||||
@Excel(name = "输入控制: 1-必填 2-可选")
|
||||
private String inputControl;
|
||||
@@ -58,6 +62,10 @@ public class BatchDetail extends BaseVOEntity{
|
||||
@Excel(name = "属性选项")
|
||||
private String attributeOption;
|
||||
|
||||
@ApiModelProperty("是否显示: 0-不显示 1-显示")
|
||||
@Excel(name = "是否显示: 0-不显示 1-显示")
|
||||
private Integer isDisplay;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
+35
-3
@@ -62,24 +62,40 @@ public class BatchDetailImpl extends ServiceImpl<BatchDetailMapper, BatchDetail>
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
List<BatchDetailDO> batchDetailDOList = batchDO.getBatchDetailList();
|
||||
//验证提交的数据是否存在重复
|
||||
// 验证本次提交的数据是否存在重复(同一批次内不允许重复标签)
|
||||
long count = batchDetailDOList.stream().map(BatchDetailDO::getBatchLabels).distinct().count();
|
||||
if (batchDetailDOList.size() != count){
|
||||
throw new ServiceException("批次标签不允许重复,请检查提交的数据");
|
||||
}
|
||||
|
||||
// 查询当前批次原有的标签明细
|
||||
List<BatchDetail> batchDetailDbList = batchDetailMapper.selectList(new QueryWrapper<BatchDetail>().lambda()
|
||||
.eq(BatchDetail::getBatchId, batchDO.getBatchId()));
|
||||
|
||||
// 如果数据库里已经有明细,并且这次前端传过来的所有明细都没有明细ID,
|
||||
// 说明前端没有带回原来的主键,这种情况我们视为“完全替换”:
|
||||
// 先物理删除当前批次下所有旧的明细,再按本次数据重新插入,避免命中数据库唯一索引冲突。
|
||||
boolean allNewWithoutId = CollectionUtil.isNotEmpty(batchDetailDOList)
|
||||
&& batchDetailDOList.stream().allMatch(detail -> detail.getBatchDetailId() == null);
|
||||
if (CollectionUtil.isNotEmpty(batchDetailDbList) && allNewWithoutId) {
|
||||
batchDetailMapper.delete(new QueryWrapper<BatchDetail>().lambda()
|
||||
.eq(BatchDetail::getBatchId, batchDO.getBatchId()));
|
||||
batchDetailDbList = new ArrayList<>();
|
||||
}
|
||||
List<BatchDetail> batchDetailListSave = new ArrayList<>();
|
||||
List<BatchDetail> batchDetailListSave2 = new ArrayList<>();
|
||||
List<BatchDetail> batchDetailListUpdates = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(batchDetailDbList)){
|
||||
Map<String, BatchDetail> batchDetailMap = batchDetailDbList.stream().collect(Collectors.toMap(BatchDetail::getBatchLabels, Function.identity()));
|
||||
Map<Long, BatchDetail> batchDetailMap = batchDetailDbList.stream().collect(Collectors.toMap(BatchDetail::getBatchDetailId, Function.identity()));
|
||||
for (BatchDetailDO batchDetailDO : batchDetailDOList){
|
||||
BatchDetail batchDetailDb = batchDetailMap.get(batchDetailDO.getBatchLabels());
|
||||
BatchDetail batchDetailDb = batchDetailMap.get(batchDetailDO.getBatchDetailId());
|
||||
if (batchDetailDb != null){
|
||||
batchDetailDb.setBatchLabels(batchDetailDO.getBatchLabels());
|
||||
batchDetailDb.setFieldName(batchDetailDO.getFieldName());
|
||||
batchDetailDb.setInputControl(batchDetailDO.getInputControl());
|
||||
batchDetailDb.setAttributeFormat(batchDetailDO.getAttributeFormat());
|
||||
batchDetailDb.setAttributeOption(batchDetailDO.getAttributeOption());
|
||||
batchDetailDb.setIsDisplay(batchDetailDO.getIsDisplay());
|
||||
batchDetailDb.setRemark(batchDetailDO.getRemark());
|
||||
batchDetailDb.setDelFlag(1);
|
||||
batchDetailListUpdates.add(batchDetailDb);
|
||||
@@ -96,6 +112,20 @@ public class BatchDetailImpl extends ServiceImpl<BatchDetailMapper, BatchDetail>
|
||||
batchDetailListSave.add(batchDetail);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
//是空没有详情 新增
|
||||
for (BatchDetailDO batchDetailDO : batchDetailDOList) {
|
||||
BatchDetail batchDetail = new BatchDetail();
|
||||
BeanUtils.copyProperties(batchDetailDO, batchDetail);
|
||||
batchDetail.setBatchId(batchDO.getBatchId());
|
||||
batchDetail.setOrganizationId(batchDO.getOrganizationId());
|
||||
batchDetail.setOrganizationName(batchDO.getOrganizationName());
|
||||
batchDetail.setTopOrganizationId(batchDO.getTopOrganizationId());
|
||||
batchDetail.setCreateBy(userPo.getUserId());
|
||||
batchDetail.setCreateByName(userPo.getUserName());
|
||||
batchDetail.setCreateTime(new Date());
|
||||
batchDetailListSave2.add(batchDetail);
|
||||
}
|
||||
}
|
||||
//删除 之前存在 现在没有的
|
||||
List<Long> batchDetailIds = batchDetailDbList.stream().map(BatchDetail::getBatchDetailId).collect(Collectors.toList());
|
||||
@@ -113,6 +143,8 @@ public class BatchDetailImpl extends ServiceImpl<BatchDetailMapper, BatchDetail>
|
||||
//新增
|
||||
if (CollectionUtil.isNotEmpty(batchDetailListSave)){
|
||||
saveBatch(batchDetailListSave);
|
||||
}else if (CollectionUtil.isNotEmpty(batchDetailListSave2)){
|
||||
saveBatch(batchDetailListSave2);
|
||||
}
|
||||
//修改
|
||||
if (CollectionUtil.isNotEmpty(batchDetailListUpdates)){
|
||||
|
||||
+8
@@ -45,6 +45,10 @@ public class BatchDetailPO extends BaseVOEntity{
|
||||
@Excel(name = "批次标签")
|
||||
private String batchLabels;
|
||||
|
||||
@ApiModelProperty("字段名称")
|
||||
@Excel(name = "字段名称")
|
||||
private String fieldName;
|
||||
|
||||
@ApiModelProperty("输入控制: 1-必填 2-可选")
|
||||
@Excel(name = "输入控制: 1-必填 2-可选")
|
||||
private String inputControl;
|
||||
@@ -57,6 +61,10 @@ public class BatchDetailPO extends BaseVOEntity{
|
||||
@Excel(name = "属性选项")
|
||||
private String attributeOption;
|
||||
|
||||
@ApiModelProperty("是否显示: 0-不显示 1-显示")
|
||||
@Excel(name = "是否显示: 0-不显示 1-显示")
|
||||
private Integer isDisplay;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
+13
@@ -1,5 +1,7 @@
|
||||
package com.mhd.basic.domain.batchDetail.repository.todo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
@@ -23,6 +25,7 @@ public class BatchDetailDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("批次管理详情id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long batchDetailId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@@ -45,6 +48,14 @@ public class BatchDetailDO extends BaseVOEntity{
|
||||
@Excel(name = "批次标签")
|
||||
private String batchLabels;
|
||||
|
||||
@ApiModelProperty("字段名称")
|
||||
@Excel(name = "字段名称")
|
||||
private String fieldName;
|
||||
|
||||
@ApiModelProperty("是否显示: 0-不显示 1-显示")
|
||||
@Excel(name = "是否显示: 0-不显示 1-显示")
|
||||
private Integer isDisplay;
|
||||
|
||||
@ApiModelProperty("输入控制: 1-必填 2-可选")
|
||||
@Excel(name = "输入控制: 1-必填 2-可选")
|
||||
private String inputControl;
|
||||
@@ -57,6 +68,8 @@ public class BatchDetailDO extends BaseVOEntity{
|
||||
@Excel(name = "属性选项")
|
||||
private String attributeOption;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.mhd.basic.domain.lease.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 租赁管理对象 container
|
||||
*
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class Lease 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("开始日期")
|
||||
private Date startDate;
|
||||
|
||||
@ApiModelProperty("结束日期")
|
||||
private Date endDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.mhd.basic.domain.lease.repository.facade;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.basic.domain.lease.entity.Lease;
|
||||
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁管理Service接口
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-07
|
||||
*/
|
||||
public interface ILeaseService extends IService<Lease>
|
||||
{
|
||||
/**
|
||||
* 分页查询租赁管理列表
|
||||
*/
|
||||
public List<LeasePO> queryList(LeaseDO leaseDO);
|
||||
|
||||
/**
|
||||
* 新增租赁管理
|
||||
*/
|
||||
public Boolean insert(LeaseDO leaseDO);
|
||||
|
||||
/**
|
||||
* 修改租赁管理
|
||||
*/
|
||||
public Boolean update(LeaseDO leaseDO);
|
||||
|
||||
/**
|
||||
* 批量删除租赁管理
|
||||
*/
|
||||
public Boolean delete(Long[] leaseIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询租赁管理
|
||||
*/
|
||||
public LeasePO getInfo(Long leaseId);
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.mhd.basic.domain.lease.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.basic.domain.lease.entity.Lease;
|
||||
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁管理Mapper接口
|
||||
*
|
||||
*/
|
||||
public interface LeaseMapper extends BaseMapper<Lease>
|
||||
{
|
||||
/**
|
||||
* 查询租赁管理列表
|
||||
*/
|
||||
public List<LeasePO> queryList(LeaseDO leaseDO);
|
||||
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package com.mhd.basic.domain.lease.repository.persistence;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.basic.domain.lease.entity.Lease;
|
||||
import com.mhd.basic.domain.lease.repository.facade.ILeaseService;
|
||||
import com.mhd.basic.domain.lease.repository.mapper.LeaseMapper;
|
||||
import com.mhd.basic.domain.lease.repository.po.LeasePO;
|
||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||
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 LeaseImpl extends ServiceImpl<LeaseMapper, Lease> implements ILeaseService {
|
||||
@Autowired
|
||||
private LeaseMapper leaseMapper;
|
||||
|
||||
/**
|
||||
* 查询容器管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<LeasePO> queryList(LeaseDO leaseDO)
|
||||
{
|
||||
return leaseMapper.queryList(leaseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增容器管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(LeaseDO leaseDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Lease lease = new Lease();
|
||||
BeanUtils.copyProperties(leaseDO,lease);
|
||||
return this.save(lease);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改容器管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(LeaseDO leaseDO) {
|
||||
Lease lease = new Lease();
|
||||
BeanUtils.copyProperties(leaseDO,lease);
|
||||
return this.updateById(lease);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除容器管理
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delete(Long[] leaseIds ) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
List<Lease> list = new ArrayList<>();
|
||||
for (Long id : leaseIds) {
|
||||
Lease lease = new Lease();
|
||||
lease.setId(id);
|
||||
lease.setDelFlag(2);
|
||||
lease.setUpdateBy(loginUser.getUserid());
|
||||
lease.setUpdateByName(loginUser.getUsername());
|
||||
lease.setUpdateTime(new Date());
|
||||
list.add(lease);
|
||||
}
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改容器管理
|
||||
*/
|
||||
@Override
|
||||
public LeasePO getInfo(Long leaseId) {
|
||||
Lease lease = this.getById(leaseId);
|
||||
LeasePO leasePO = new LeasePO();
|
||||
BeanUtils.copyProperties(lease,leasePO);
|
||||
return leasePO;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @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() + "】已存在");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.mhd.basic.domain.lease.repository.po;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 租赁管理对象 container
|
||||
*
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class LeasePO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
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 startDate;
|
||||
|
||||
@ApiModelProperty("结束日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.mhd.basic.domain.lease.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 java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 租赁管理对象 container
|
||||
*
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class LeaseDO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
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(pattern = "yyyy-MM-dd")
|
||||
private Date startDate;
|
||||
|
||||
@ApiModelProperty("结束日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("当前时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date time;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件开始日期")
|
||||
private String createTimeStart;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件结束日期")
|
||||
private String createTimeEnd;
|
||||
|
||||
@ApiModelProperty(name = "修改时间查询条件开始日期")
|
||||
private String updateTimeStart;
|
||||
|
||||
@ApiModelProperty(name = "修改时间查询条件结束日期")
|
||||
private String updateTimeEnd;
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
package com.mhd.basic.domain.lease.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.mhd.basic.domain.container.entity.Container;
|
||||
import com.mhd.basic.domain.container.repository.facade.IContainerService;
|
||||
import com.mhd.basic.domain.container.repository.po.ContainerPO;
|
||||
import com.mhd.basic.domain.container.repository.todo.ContainerDO;
|
||||
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.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 LeaseDomainService {
|
||||
|
||||
@Autowired
|
||||
private ILeaseService leaseService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询租赁管理列表
|
||||
*/
|
||||
public List<LeasePO> queryList(LeaseDO leaseDO) {
|
||||
return leaseService.queryList(leaseDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增租赁管理
|
||||
*/
|
||||
public Boolean insert(LeaseDO leaseDO) {
|
||||
|
||||
return leaseService.insert(leaseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租赁管理
|
||||
*/
|
||||
public Boolean update(LeaseDO leaseDO) {
|
||||
return leaseService.update(leaseDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除租赁管理
|
||||
*/
|
||||
public Boolean delete(Long[] leaseIds) {
|
||||
return leaseService.delete(leaseIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租赁管理详细信息
|
||||
*/
|
||||
public LeasePO getInfo(Long leaseId)
|
||||
{
|
||||
return leaseService.getInfo(leaseId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 批量作废租赁
|
||||
* @author ZhouGY
|
||||
* @date 2024/5/13 9:46
|
||||
* @param leaseIds
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean nullifyByIds(List<Long> leaseIds) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
return leaseService.update(new UpdateWrapper<Lease>().lambda()
|
||||
.set(Lease::getUpdateBy, loginUser.getUserid())
|
||||
.set(Lease::getUpdateTime, new Date())
|
||||
.in(Lease::getId, leaseIds)
|
||||
.eq(Lease::getDelFlag, 1));
|
||||
}
|
||||
}
|
||||
+202
-1
@@ -158,6 +158,7 @@ public class MaterialBaseInfo extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("单位数量")
|
||||
@Excel(name = "单位数量")
|
||||
@TableField(exist = false)
|
||||
private BigDecimal unitNumber;
|
||||
|
||||
@ApiModelProperty("是否公用: 1-是 2-否")
|
||||
@@ -184,4 +185,204 @@ public class MaterialBaseInfo extends BaseVOEntity{
|
||||
@ApiModelProperty("整机编码")
|
||||
@Excel(name = "整机编号")
|
||||
private String machineCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
@TableField(exist = false)
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
@TableField(exist = false)
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
@TableField(exist = false)
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
@TableField(exist = false)
|
||||
private String specificationModel;
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
@TableField(exist = false)
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
@TableField(exist = false)
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
@TableField(exist = false)
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
@TableField(exist = false)
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO's
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO's")
|
||||
@Excel(name = "Batch Ref NO's")
|
||||
@TableField(exist = false)
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO's
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO's")
|
||||
@Excel(name = "Sheet Ref NO's")
|
||||
@TableField(exist = false)
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
@TableField(exist = false)
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
@TableField(exist = false)
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
@TableField(exist = false)
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
@TableField(exist = false)
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
@TableField(exist = false)
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
@TableField(exist = false)
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
@TableField(exist = false)
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
@TableField(exist = false)
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
@TableField(exist = false)
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
@TableField(exist = false)
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
@TableField(exist = false)
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
@TableField(exist = false)
|
||||
private String unit;
|
||||
|
||||
|
||||
@ApiModelProperty("SKU码")
|
||||
private String skuCode;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
|
||||
@ApiModelProperty("原产国")
|
||||
private String originCountry;
|
||||
|
||||
@ApiModelProperty("HS码")
|
||||
private String hsCode;
|
||||
|
||||
@ApiModelProperty("申报单位")
|
||||
private String declarationUnit;
|
||||
|
||||
@ApiModelProperty("法定单位")
|
||||
private String statutoryUnit;
|
||||
|
||||
@ApiModelProperty("法定第二单位")
|
||||
private String statutorySecondUnit;
|
||||
}
|
||||
+195
-1
@@ -5,6 +5,7 @@ import com.mhd.basic.domain.batch.repository.po.BatchPO;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.handler.ListTypeHandler;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import com.mhd.system.api.domain.*;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -182,4 +183,197 @@ public class MaterialBaseInfoPO extends BaseVOEntity{
|
||||
@Excel(name = "整机编号")
|
||||
private String machineCode;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO’s")
|
||||
@Excel(name = "Batch Ref NO’s")
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO’s")
|
||||
@Excel(name = "Sheet Ref NO’s")
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
|
||||
@ApiModelProperty("SKU码")
|
||||
private String skuCode;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("原产国")
|
||||
private String originCountry;
|
||||
|
||||
@ApiModelProperty("HS码")
|
||||
private String hsCode;
|
||||
|
||||
@ApiModelProperty("申报单位")
|
||||
private String declarationUnit;
|
||||
|
||||
@ApiModelProperty("法定单位")
|
||||
private String statutoryUnit;
|
||||
|
||||
@ApiModelProperty("法定第二单位")
|
||||
private String statutorySecondUnit;
|
||||
|
||||
@ApiModelProperty("商品规则")
|
||||
private MaterialGoodsRuleFeign materialGoodsRule;
|
||||
|
||||
@ApiModelProperty("公共信息")
|
||||
private MaterialCommonFeign materialCommon;
|
||||
|
||||
@ApiModelProperty("仓库控制信息")
|
||||
private MaterialWarehouseControlFeign materialWarehouseControl;
|
||||
|
||||
@ApiModelProperty("库存预警信息")
|
||||
private List<MaterialInventoryWarningFeign> materialInventoryWarningList;
|
||||
|
||||
@ApiModelProperty("条码信息")
|
||||
private List<MaterialBarCodeFeign> materialBarCodeList;
|
||||
|
||||
}
|
||||
+179
-1
@@ -203,4 +203,182 @@ public class MaterialBaseInfoDO extends BaseVOEntity{
|
||||
@ApiModelProperty("整机编码")
|
||||
@Excel(name = "整机编号")
|
||||
private String machineCode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO’s")
|
||||
@Excel(name = "Batch Ref NO’s")
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO’s")
|
||||
@Excel(name = "Sheet Ref NO’s")
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
|
||||
@ApiModelProperty("SKU码")
|
||||
private String skuCode;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("原产国")
|
||||
private String originCountry;
|
||||
|
||||
@ApiModelProperty("HS码")
|
||||
private String hsCode;
|
||||
|
||||
@ApiModelProperty("申报单位")
|
||||
private String declarationUnit;
|
||||
|
||||
@ApiModelProperty("法定单位")
|
||||
private String statutoryUnit;
|
||||
|
||||
@ApiModelProperty("法定第二单位")
|
||||
private String statutorySecondUnit;
|
||||
}
|
||||
+4
@@ -68,6 +68,10 @@ public class PackPO extends BaseVOEntity{
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
|
||||
@ApiModelProperty("包装单位(取第一条包装详情的单位名称)")
|
||||
@Excel(name = "包装单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty("包装明细")
|
||||
private List<PackDetailPO> packDetailList;
|
||||
|
||||
|
||||
+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));
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package com.mhd.basic.interfaces.assember.lease;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.mhd.basic.domain.container.repository.todo.ContainerDO;
|
||||
import com.mhd.basic.domain.lease.repository.todo.LeaseDO;
|
||||
import com.mhd.basic.interfaces.dto.container.ContainerDTO;
|
||||
import com.mhd.basic.interfaces.dto.lease.LeaseDTO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
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.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.WarehouseFeignPO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 容器管理Assembler
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class LeaseAssembler {
|
||||
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public LeaseDO toDO(LeaseDTO leaseDTO) {
|
||||
LeaseDO leaseDO = new LeaseDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(leaseDTO, leaseDO, IgnoreNullUtil.getNullPropertyNames(leaseDTO));
|
||||
// 确保查询条件字段被正确传递(查询条件字段需要明确传递,避免被IgnoreNullUtil忽略)
|
||||
leaseDO.setCreateTimeStart(leaseDTO.getCreateTimeStart());
|
||||
leaseDO.setCreateTimeEnd(leaseDTO.getCreateTimeEnd());
|
||||
leaseDO.setUpdateTimeStart(leaseDTO.getUpdateTimeStart());
|
||||
leaseDO.setUpdateTimeEnd(leaseDTO.getUpdateTimeEnd());
|
||||
return leaseDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public LeaseDO toDOByEdit(LeaseDTO leaseDTO) {
|
||||
LeaseDO leaseDO = new LeaseDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(leaseDTO, leaseDO, IgnoreNullUtil.getNullPropertyNames(leaseDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if(leaseDTO.getId() != null){
|
||||
leaseDO.setUpdateBy(loginUser.getUserid());
|
||||
leaseDO.setUpdateByName(loginUser.getUsername());
|
||||
leaseDO.setUpdateTime(new Date());
|
||||
}else {
|
||||
leaseDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
leaseDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
leaseDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
leaseDO.setCreateBy(loginUser.getUserid());
|
||||
leaseDO.setCreateByName(loginUser.getUsername());
|
||||
leaseDO.setCreateTime(new Date());
|
||||
// 新增时根据仓库ID查询仓库名字
|
||||
if (leaseDO.getWarehouseId() != null) {
|
||||
setWarehouseInfo(leaseDO);
|
||||
}
|
||||
}
|
||||
return leaseDO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置仓库信息
|
||||
*/
|
||||
private void setWarehouseInfo(LeaseDO leaseDO) {
|
||||
if (leaseDO.getWarehouseId() == null) {
|
||||
return;
|
||||
}
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(leaseDO.getWarehouseId());
|
||||
if (ajaxResult == null) {
|
||||
throw new ServiceException("获取仓库信息失败:返回结果为空,仓库ID:" + leaseDO.getWarehouseId());
|
||||
}
|
||||
Object codeObj = ajaxResult.get("code");
|
||||
if (codeObj == null || !"200".equals(String.valueOf(codeObj))) {
|
||||
String errorMsg = ajaxResult.get("msg") != null ? String.valueOf(ajaxResult.get("msg")) : "未知错误";
|
||||
throw new ServiceException("获取仓库信息失败,仓库ID:" + leaseDO.getWarehouseId() + ",错误信息:" + errorMsg);
|
||||
}
|
||||
Object dataObj = ajaxResult.get("data");
|
||||
if (dataObj == null) {
|
||||
throw new ServiceException("获取仓库信息失败:返回数据为空,仓库ID:" + leaseDO.getWarehouseId());
|
||||
}
|
||||
String dataJsonString = JSONObject.toJSONString(dataObj);
|
||||
if (dataJsonString == null || dataJsonString.isEmpty() || "null".equals(dataJsonString)) {
|
||||
throw new ServiceException("获取仓库信息失败:返回数据为空或格式不正确,仓库ID:" + leaseDO.getWarehouseId());
|
||||
}
|
||||
WarehouseFeignPO warehouseFeignPO;
|
||||
try {
|
||||
warehouseFeignPO = JSON.parseObject(dataJsonString, WarehouseFeignPO.class);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("获取仓库信息失败:数据解析异常,仓库ID:" + leaseDO.getWarehouseId() + ",错误信息:" + e.getMessage());
|
||||
}
|
||||
if (warehouseFeignPO == null) {
|
||||
throw new ServiceException("获取仓库信息失败:数据解析失败,仓库ID:" + leaseDO.getWarehouseId());
|
||||
}
|
||||
leaseDO.setWarehouseName(warehouseFeignPO.getWarehouseName());
|
||||
}
|
||||
|
||||
}
|
||||
+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;
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -44,6 +44,10 @@ public class BatchDetailDTO extends BaseVOEntity{
|
||||
@Excel(name = "批次标签")
|
||||
private String batchLabels;
|
||||
|
||||
@ApiModelProperty("字段名称")
|
||||
@Excel(name = "字段名称")
|
||||
private String fieldName;
|
||||
|
||||
@ApiModelProperty("输入控制: 1-必填 2-可选")
|
||||
@Excel(name = "输入控制: 1-必填 2-可选")
|
||||
private String inputControl;
|
||||
@@ -56,6 +60,10 @@ public class BatchDetailDTO extends BaseVOEntity{
|
||||
@Excel(name = "属性选项")
|
||||
private String attributeOption;
|
||||
|
||||
@ApiModelProperty("是否显示: 0-不显示 1-显示")
|
||||
@Excel(name = "是否显示: 0-不显示 1-显示")
|
||||
private Integer isDisplay;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.mhd.basic.interfaces.dto.lease;
|
||||
|
||||
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;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租赁管理对象 container
|
||||
*
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class LeaseDTO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
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 startDate;
|
||||
|
||||
@ApiModelProperty("结束日期")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件开始日期")
|
||||
private String createTimeStart;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件结束日期")
|
||||
private String createTimeEnd;
|
||||
|
||||
@ApiModelProperty(name = "修改时间查询条件开始日期")
|
||||
private String updateTimeStart;
|
||||
|
||||
@ApiModelProperty(name = "修改时间查询条件结束日期")
|
||||
private String updateTimeEnd;
|
||||
}
|
||||
+180
-1
@@ -181,4 +181,183 @@ public class MaterialBaseInfoDTO extends BaseVOEntity{
|
||||
@ApiModelProperty("是否公用: 1-是 2-否")
|
||||
@Excel(name = "是否公用: 1-是 2-否")
|
||||
private Integer common;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@ApiModelProperty("商品名称")
|
||||
@Excel(name = "商品名称")
|
||||
private String commodityName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
@ApiModelProperty("商品编码")
|
||||
@Excel(name = "商品编码")
|
||||
private String commodityNo;
|
||||
/**
|
||||
* 料号
|
||||
*/
|
||||
@ApiModelProperty("料号")
|
||||
@Excel(name = "料号")
|
||||
private String materialNo;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty("规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String specificationModel;
|
||||
|
||||
/**
|
||||
* Invoice No
|
||||
*/
|
||||
@ApiModelProperty("Invoice No")
|
||||
@Excel(name = "Invoice No")
|
||||
private String invoiceNo;
|
||||
/**
|
||||
* 升
|
||||
*/
|
||||
@ApiModelProperty("升")
|
||||
@Excel(name = "升")
|
||||
private String liter;
|
||||
|
||||
/**
|
||||
* 尺寸
|
||||
*/
|
||||
@ApiModelProperty("尺寸")
|
||||
@Excel(name = "尺寸")
|
||||
private String size;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@ApiModelProperty("申报单位")
|
||||
@Excel(name = "申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* Batch Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Batch Ref NO’s")
|
||||
@Excel(name = "Batch Ref NO’s")
|
||||
private String batchRefNo;
|
||||
|
||||
/**
|
||||
* Sheet Ref NO’s
|
||||
*/
|
||||
@ApiModelProperty("Sheet Ref NO’s")
|
||||
@Excel(name = "Sheet Ref NO’s")
|
||||
private String sheetRefNo;
|
||||
|
||||
/**
|
||||
* 原产国
|
||||
*/
|
||||
@ApiModelProperty("原产国")
|
||||
@Excel(name = "原产国")
|
||||
private String countryOfOrigin;
|
||||
|
||||
/**
|
||||
* 箱号/卡板号
|
||||
*/
|
||||
@ApiModelProperty("箱号/卡板号")
|
||||
@Excel(name = "箱号/卡板号")
|
||||
private String casePalletNo;
|
||||
|
||||
/**
|
||||
* 币制
|
||||
*/
|
||||
@ApiModelProperty("币制")
|
||||
@Excel(name = "币制")
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 申报数量
|
||||
*/
|
||||
@ApiModelProperty("申报数量")
|
||||
@Excel(name = "申报数量")
|
||||
private Double declareQuantity;
|
||||
|
||||
/**
|
||||
* 箱数
|
||||
*/
|
||||
@ApiModelProperty("箱数")
|
||||
@Excel(name = "箱数")
|
||||
private Double caseCount;
|
||||
|
||||
/**
|
||||
* 件数
|
||||
*/
|
||||
@ApiModelProperty("件数")
|
||||
@Excel(name = "件数")
|
||||
private Double pieceCount;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
@ApiModelProperty("出库数量")
|
||||
@Excel(name = "出库数量")
|
||||
private Double outboundQuantity;
|
||||
|
||||
/**
|
||||
* 总净重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总净重(KG)")
|
||||
@Excel(name = "总净重(KG)")
|
||||
private Double totalNetWeight;
|
||||
|
||||
/**
|
||||
* 总毛重(KG)
|
||||
*/
|
||||
@ApiModelProperty("总毛重(KG)")
|
||||
@Excel(name = "总毛重(KG)")
|
||||
private Double totalGrossWeight;
|
||||
|
||||
/**
|
||||
* 总体积(CBM)
|
||||
*/
|
||||
@ApiModelProperty("总体积(CBM)")
|
||||
@Excel(name = "总体积(CBM)")
|
||||
private Double totalVolume;
|
||||
|
||||
/**
|
||||
* 总面积(SQM)
|
||||
*/
|
||||
@ApiModelProperty("总面积(SQM)")
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private Double totalArea;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
@ApiModelProperty("总价")
|
||||
@Excel(name = "总价")
|
||||
private Double totalAmount;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty("单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
|
||||
@ApiModelProperty("SKU码")
|
||||
private String skuCode;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("原产国")
|
||||
private String originCountry;
|
||||
|
||||
@ApiModelProperty("HS码")
|
||||
private String hsCode;
|
||||
|
||||
@ApiModelProperty("申报单位")
|
||||
private String declarationUnit;
|
||||
|
||||
@ApiModelProperty("法定单位")
|
||||
private String statutoryUnit;
|
||||
|
||||
@ApiModelProperty("法定第二单位")
|
||||
private String statutorySecondUnit;
|
||||
}
|
||||
+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;
|
||||
|
||||
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package com.mhd.basic.interfaces.facadeApi.lease;
|
||||
|
||||
import com.mhd.basic.application.service.Lease.LeaseApplicationService;
|
||||
import com.mhd.basic.application.service.container.ContainerApplicationService;
|
||||
import com.mhd.basic.domain.container.repository.po.ContainerPO;
|
||||
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.todo.LeaseDO;
|
||||
import com.mhd.basic.domain.shipperLeaseDetails.entity.WarehouseOccupancyRate;
|
||||
import com.mhd.basic.interfaces.assember.container.ContainerAssembler;
|
||||
import com.mhd.basic.interfaces.assember.lease.LeaseAssembler;
|
||||
import com.mhd.basic.interfaces.dto.container.ContainerDTO;
|
||||
import com.mhd.basic.interfaces.dto.lease.LeaseDTO;
|
||||
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("/LeaseApi")
|
||||
public class LeaseApi extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private LeaseApplicationService leaseApplicationService;
|
||||
|
||||
@Resource
|
||||
private LeaseAssembler leaseAssembler;
|
||||
|
||||
/**
|
||||
* 分页查询租赁管理列表
|
||||
*/
|
||||
@ApiOperation("查询租赁管理列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(LeaseDTO leaseDTO)
|
||||
{
|
||||
//转换实体
|
||||
LeaseDO leaseDO = leaseAssembler.toDO(leaseDTO);
|
||||
startPage();
|
||||
List<LeasePO> list = leaseApplicationService.queryList(leaseDO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询租赁管理列表
|
||||
*/
|
||||
@ApiOperation("查询租赁管理列表")
|
||||
@GetMapping("/listByApp")
|
||||
public AjaxResult listByApp(LeaseDTO leaseDTO)
|
||||
{
|
||||
//转换实体
|
||||
LeaseDO leaseDO = leaseAssembler.toDO(leaseDTO);
|
||||
List<LeasePO> list = leaseApplicationService.queryList(leaseDO);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑租赁管理
|
||||
*/
|
||||
@ApiOperation("编辑租赁管理")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody LeaseDTO leaseDTO)
|
||||
{
|
||||
//转换实体
|
||||
LeaseDO leaseDO = leaseAssembler.toDOByEdit(leaseDTO);
|
||||
if(leaseDTO.getId() != null){
|
||||
return toAjax(leaseApplicationService.update(leaseDO));
|
||||
}else {
|
||||
return toAjax(leaseApplicationService.insert(leaseDO));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除租赁管理
|
||||
*/
|
||||
@ApiOperation("批量删除租赁管理")
|
||||
@DeleteMapping("/deleteByIds/{leaseIds}")
|
||||
public AjaxResult delete(@PathVariable Long[] leaseIds)
|
||||
{
|
||||
return toAjax(leaseApplicationService.delete(leaseIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租赁管理详细信息
|
||||
*/
|
||||
@ApiOperation("获取租赁管理")
|
||||
@GetMapping(value = "/getInfo/{leaseId}")
|
||||
public AjaxResult getInfo(@PathVariable("leaseId") Long leaseId)
|
||||
{
|
||||
return AjaxResult.success(leaseApplicationService.getInfo(leaseId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量作废租赁
|
||||
*/
|
||||
@ApiOperation("批量作废租赁")
|
||||
@GetMapping("/nullifyByIds/{leaseIds}")
|
||||
public AjaxResult nullifyByIds(@PathVariable("leaseIds") List<Long> leaseIds)
|
||||
{
|
||||
return toAjax(leaseApplicationService.nullifyByIds(leaseIds));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
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.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 货主租赁明细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("编辑货主租赁明细")
|
||||
@PostMapping("/editList")
|
||||
public AjaxResult edit(@RequestBody List<ShipperLeaseDetailsDTO> shipperLeaseDetailsDTO)
|
||||
{
|
||||
for (ShipperLeaseDetailsDTO leaseDetailsDTO : shipperLeaseDetailsDTO) {
|
||||
//转换实体
|
||||
ShipperLeaseDetailsDO shipperLeaseDetailsDO = shipperLeaseDetailsAssembler.toDOByEdit(leaseDetailsDTO);
|
||||
shipperLeaseDetailsApplicationService.update(shipperLeaseDetailsDO);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除货主租赁明细
|
||||
*/
|
||||
@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);
|
||||
// 按照businessDate倒序排序
|
||||
warehouseOccupancyRates = warehouseOccupancyRates.stream()
|
||||
.sorted(Comparator.comparing(WarehouseOccupancyRate::getBusinessDate, Comparator.nullsLast(Comparator.reverseOrder())))
|
||||
.collect(Collectors.toList());
|
||||
return getDataTable(warehouseOccupancyRates);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,10 +13,10 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
@@ -25,7 +25,7 @@ spring:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
+9
-1
@@ -11,9 +11,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="topOrganizationId" column="top_organization_id" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="batchLabels" column="batch_labels" />
|
||||
<result property="fieldName" column="field_name" />
|
||||
<result property="inputControl" column="input_control" />
|
||||
<result property="attributeFormat" column="attribute_format" />
|
||||
<result property="attributeOption" column="attribute_option" />
|
||||
<result property="isDisplay" column="is_display" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@@ -26,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<sql id="selectBatchDetailPo">
|
||||
select batch_detail_id, organization_id, organization_name, top_organization_id, batch_id, batch_labels, input_control, attribute_format, attribute_option, remark, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from batch_detail
|
||||
select batch_detail_id, organization_id, organization_name, top_organization_id, batch_id, batch_labels, field_name, input_control, attribute_format, attribute_option, is_display, remark, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from batch_detail
|
||||
</sql>
|
||||
|
||||
<sql id="selectBatchDetailPo1">
|
||||
@@ -46,6 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="batchLabels != null and batchLabels != ''">
|
||||
and batch_labels = #{batchLabels}
|
||||
</if>
|
||||
<if test="fieldName != null and fieldName != ''">
|
||||
and field_name = #{fieldName}
|
||||
</if>
|
||||
<if test="inputControl != null ">
|
||||
and input_control = #{inputControl}
|
||||
</if>
|
||||
@@ -55,6 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="attributeOption != null and attributeOption != ''">
|
||||
and attribute_option = #{attributeOption}
|
||||
</if>
|
||||
<if test="isDisplay != null ">
|
||||
and is_display = #{isDisplay}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
<?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.lease.repository.mapper.LeaseMapper">
|
||||
|
||||
<resultMap type="com.mhd.basic.domain.lease.repository.po.LeasePO" id="LeaseResult">
|
||||
<!-- 租赁相关字段 -->
|
||||
<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="cargoOwnerName" column="cargo_owner_name" />
|
||||
<result property="leaseType" column="lease_type" />
|
||||
<result property="leaseArea" column="lease_area" />
|
||||
<result property="startDate" column="start_date" />
|
||||
<result property="endDate" column="end_date" />
|
||||
<result property="remark" column="remark" />
|
||||
<!-- 继承自BaseVOEntity的字段 -->
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectLeasePo">
|
||||
select
|
||||
a.id,
|
||||
a.organization_id,
|
||||
a.organization_name,
|
||||
a.top_organization_id,
|
||||
a.warehouse_id,
|
||||
COALESCE(w.warehouse_name, a.warehouse_name) as warehouse_name,
|
||||
a.shipper_id,
|
||||
a.cargo_owner_name,
|
||||
a.lease_type,
|
||||
a.lease_area,
|
||||
a.start_date,
|
||||
a.end_date,
|
||||
a.remark,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name,
|
||||
a.del_flag
|
||||
from lease a
|
||||
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectLeasePo1">
|
||||
<where>
|
||||
<!-- 租赁查询条件 -->
|
||||
<if test="organizationId != null ">
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="topOrganizationId != null ">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and a.organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="warehouseId != null ">
|
||||
and a.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and (w.warehouse_name like concat('%', #{warehouseName}, '%') or a.warehouse_name like concat('%', #{warehouseName}, '%'))
|
||||
</if>
|
||||
<if test="cargoOwnerName != null and cargoOwnerName != ''">
|
||||
and a.cargo_owner_name like concat('%', #{cargoOwnerName}, '%')
|
||||
</if>
|
||||
<if test="leaseType != null and leaseType != ''">
|
||||
and a.lease_type = #{leaseType}
|
||||
</if>
|
||||
<if test="createTime != null ">
|
||||
and a.create_time = #{createTime}
|
||||
</if>
|
||||
<if test="leaseArea != null ">
|
||||
and a.lease_area = #{leaseArea}
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and a.remark like concat('%', #{remark}, '%')
|
||||
</if>
|
||||
<!-- 创建和更新相关条件 -->
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and a.create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and a.update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="createTimeStart != null and createTimeStart != ''">
|
||||
and date_format(a.create_time,'%Y-%m-%d') >= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null and createTimeEnd != ''">
|
||||
and date_format(a.create_time,'%Y-%m-%d') <= #{createTimeEnd}
|
||||
</if>
|
||||
<if test="updateTimeStart != null and updateTimeStart != ''">
|
||||
and date_format(a.update_time,'%Y-%m-%d') >= #{updateTimeStart}
|
||||
</if>
|
||||
<if test="updateTimeEnd != null and updateTimeEnd != ''">
|
||||
and date_format(a.update_time,'%Y-%m-%d') <= #{updateTimeEnd}
|
||||
</if>
|
||||
<!-- 时间范围查询(如果需要) -->
|
||||
<if test="startDate != null and endDate != null">
|
||||
and a.start_date >= #{startDate} and a.start_date <= #{endDate}
|
||||
</if>
|
||||
<if test="time != null">
|
||||
AND a.start_date <= #{time}
|
||||
AND a.end_date >= #{time}
|
||||
</if>
|
||||
<!-- 删除标记 -->
|
||||
<choose>
|
||||
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
|
||||
<otherwise> and a.del_flag = 1 </otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.basic.domain.lease.repository.po.LeasePO" resultMap="LeaseResult">
|
||||
<include refid="selectLeasePo"/>
|
||||
<include refid="selectLeasePo1"/>
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
+116
-4
@@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select material_base_info_id, organization_id, organization_name, top_organization_id, shipper_id, shipper_name, material_code, material_name, bar_code, material_classify_code,
|
||||
material_classify_name, material_type, material_type_name, pack_id, pack_code, pack_name, unit_code, unit_name, brand_id, brand_code, brand_name, shelf_life, weight_limit,
|
||||
volume_limit, material_shape, material_shape_name, material_size, material_length, material_width, material_height, remark, nullify, create_time, create_by, create_by_name,
|
||||
update_time, update_by, update_by_name, del_flag, common,material_model,material_unit,machine_code
|
||||
update_time, update_by, update_by_name, del_flag, common,material_model,material_unit,machine_code,sku_code, unit_price, currency, origin_country, hs_code, declaration_unit, statutory_unit, statutory_second_unit
|
||||
from material_base_info
|
||||
</sql>
|
||||
|
||||
@@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and material_name like concat('%', #{materialName}, '%')
|
||||
</if>
|
||||
<if test="barCode != null and barCode != ''">
|
||||
and bar_code = #{barCode}
|
||||
and bar_code like concat('%',#{barCode},'%')
|
||||
</if>
|
||||
<if test="materialClassifyCode != null and materialClassifyCode != ''">
|
||||
and material_classify_code = #{materialClassifyCode}
|
||||
@@ -170,7 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
and material_base_info_id in (SELECT
|
||||
DISTINCT material_base_info_id
|
||||
FROM test_szwl_wms.material_inventory
|
||||
FROM ngwl_test_wms.material_inventory
|
||||
WHERE
|
||||
allocation_quantity > 0
|
||||
AND del_flag = 1)
|
||||
@@ -178,6 +178,118 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.basic.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO" resultMap="MaterialBaseInfoResult">
|
||||
<include refid="selectMaterialBaseInfoPo"/>
|
||||
<include refid="selectMaterialBaseInfoPo1"/>
|
||||
<include refid="selectMaterialBaseInfoPo2"/>
|
||||
</select>
|
||||
|
||||
<sql id="selectMaterialBaseInfoPo2">
|
||||
<where>
|
||||
<if test="organizationId != null ">
|
||||
and organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="topOrganizationId != null ">
|
||||
and top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="shipperId != null ">
|
||||
and shipper_id = #{shipperId}
|
||||
</if>
|
||||
<if test="shipperName != null and shipperName != ''">
|
||||
and shipper_name like concat('%', #{shipperName}, '%')
|
||||
</if>
|
||||
<if test="materialCode != null and materialCode != ''">
|
||||
and material_code = #{materialCode}
|
||||
</if>
|
||||
<if test="materialName != null and materialName != ''">
|
||||
and material_name like concat('%', #{materialName}, '%')
|
||||
</if>
|
||||
<if test="barCode != null and barCode != ''">
|
||||
and bar_code like concat('%',#{barCode},'%')
|
||||
</if>
|
||||
<if test="materialClassifyCode != null and materialClassifyCode != ''">
|
||||
and material_classify_code = #{materialClassifyCode}
|
||||
</if>
|
||||
<if test="materialClassifyName != null and materialClassifyName != ''">
|
||||
and material_classify_name like concat('%', #{materialClassifyName}, '%')
|
||||
</if>
|
||||
<if test="materialType != null and materialType != ''">
|
||||
and material_type = #{materialType}
|
||||
</if>
|
||||
<if test="materialTypeName != null and materialTypeName != ''">
|
||||
and material_type_name like concat('%', #{materialTypeName}, '%')
|
||||
</if>
|
||||
<if test="unitCode != null and unitCode != ''">
|
||||
and unit_code = #{unitCode}
|
||||
</if>
|
||||
<if test="unitName != null and unitName != ''">
|
||||
and unit_name like concat('%', #{unitName}, '%')
|
||||
</if>
|
||||
<if test="packId != null ">
|
||||
and pack_id = #{packId}
|
||||
</if>
|
||||
<if test="packCode != null and packCode != ''">
|
||||
and pack_code = #{packCode}
|
||||
</if>
|
||||
<if test="packName != null and packName != ''">
|
||||
and pack_name like concat('%', #{packName}, '%')
|
||||
</if>
|
||||
<if test="brandId != null ">
|
||||
and brand_id = #{brandId}
|
||||
</if>
|
||||
<if test="brandCode != null and brandCode != ''">
|
||||
and brand_code = #{brandCode}
|
||||
</if>
|
||||
<if test="brandName != null and brandName != ''">
|
||||
and brand_name like concat('%', #{brandName}, '%')
|
||||
</if>
|
||||
<if test="shelfLife != null ">
|
||||
and shelf_life = #{shelfLife}
|
||||
</if>
|
||||
<if test="weightLimit != null ">
|
||||
and weight_limit = #{weightLimit}
|
||||
</if>
|
||||
<if test="volumeLimit != null ">
|
||||
and volume_limit = #{volumeLimit}
|
||||
</if>
|
||||
<if test="materialShape != null and materialShape != ''">
|
||||
and material_shape = #{materialShape}
|
||||
</if>
|
||||
<if test="materialShapeName != null and materialShapeName != ''">
|
||||
and material_shape_name like concat('%', #{materialShapeName}, '%')
|
||||
</if>
|
||||
<if test="materialSize != null and materialSize != ''">
|
||||
and material_size = #{materialSize}
|
||||
</if>
|
||||
<if test="materialLength != null ">
|
||||
and material_length = #{materialLength}
|
||||
</if>
|
||||
<if test="materialWidth != null ">
|
||||
and material_width = #{materialWidth}
|
||||
</if>
|
||||
<if test="materialHeight != null ">
|
||||
and material_height = #{materialHeight}
|
||||
</if>
|
||||
<if test="nullify != null ">
|
||||
and nullify = #{nullify}
|
||||
</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>
|
||||
<!-- 传 1:只查公共 , 2:只查自己的 ,3:公共的和自己的 -->
|
||||
<choose>
|
||||
<when test="common != null and (common == 1 or common == 2) "> and common = #{common} </when>
|
||||
<otherwise> and (
|
||||
1 = 1
|
||||
or common = 1 )</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="delFlag != null"> and del_flag = #{delFlag} </when>
|
||||
<otherwise> and del_flag = 1 </otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</sql>
|
||||
</mapper>
|
||||
|
||||
@@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="remark" column="remark" />
|
||||
<result property="openingUp" column="opening_up" />
|
||||
<result property="nullify" column="nullify" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
@@ -27,7 +28,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<sql id="selectPackPo">
|
||||
select pack_id, organization_id, organization_name, top_organization_id, shipper_id, shipper_name, pack_code, pack_name, remark, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from pack
|
||||
select a.pack_id, a.organization_id, a.organization_name, a.top_organization_id, a.shipper_id, a.shipper_name, a.pack_code, a.pack_name, a.remark, a.opening_up, a.nullify, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag,
|
||||
(SELECT b.name FROM (SELECT name, pack_id FROM pack_detail WHERE pack_id = a.pack_id AND del_flag = 1 ORDER BY pack_detail_id) b WHERE ROWNUM = 1) as unit_name
|
||||
from pack a
|
||||
</sql>
|
||||
|
||||
<sql id="selectPackPo1">
|
||||
|
||||
+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>
|
||||
+56
-39
@@ -51,130 +51,147 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<sql id="selectStorageLocationPo">
|
||||
select storage_location_id, organization_id, organization_name, top_organization_id, warehouse_id, warehouse_code, warehouse_name, storage_section_id, storage_code, storage_name, storage_location_code, storage_location_name, storage_location_classify, storage_location_classify_name, storage_location_type, storage_location_type_name, mixing_strategy, mixing_strategy_name, storage_location_group_id, storage_location_group_code, storage_location_group_name, weight_limit, volume_limit, location_size, location_length, location_width, location_height, coordinate, coordinate_area, coordinate_column, coordinate_row, coordinate_layer, remark, opening_up, nullify, status, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from storage_location
|
||||
select a.storage_location_id, a.organization_id, a.organization_name, a.top_organization_id, a.warehouse_id,
|
||||
COALESCE(w.warehouse_code, a.warehouse_code) as warehouse_code,
|
||||
COALESCE(w.warehouse_name, a.warehouse_name) as warehouse_name,
|
||||
a.storage_section_id, a.storage_code, a.storage_name, a.storage_location_code, a.storage_location_name,
|
||||
a.storage_location_classify, a.storage_location_classify_name, a.storage_location_type, a.storage_location_type_name,
|
||||
a.mixing_strategy, a.mixing_strategy_name, a.storage_location_group_id, a.storage_location_group_code, a.storage_location_group_name,
|
||||
a.weight_limit, a.volume_limit, a.location_size, a.location_length, a.location_width, a.location_height,
|
||||
a.coordinate, a.coordinate_area, a.coordinate_column, a.coordinate_row, a.coordinate_layer, a.remark,
|
||||
a.opening_up, a.nullify, a.status, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
|
||||
from storage_location a
|
||||
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectStorageLocationPo1">
|
||||
<where>
|
||||
<if test="organizationId != null ">
|
||||
and organization_id = #{organizationId}
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and organization_name like concat('%', #{organizationName}, '%')
|
||||
and a.organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="topOrganizationId != null ">
|
||||
and top_organization_id = #{topOrganizationId}
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="warehouseId != null ">
|
||||
and warehouse_id = #{warehouseId}
|
||||
and a.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
and warehouse_code = #{warehouseCode}
|
||||
and (w.warehouse_code like concat('%', #{warehouseCode}, '%') or a.warehouse_code like concat('%', #{warehouseCode}, '%'))
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
and (w.warehouse_name like concat('%', #{warehouseName}, '%') or a.warehouse_name like concat('%', #{warehouseName}, '%'))
|
||||
</if>
|
||||
<if test="storageSectionId != null ">
|
||||
and storage_section_id = #{storageSectionId}
|
||||
and a.storage_section_id = #{storageSectionId}
|
||||
</if>
|
||||
<if test="storageCode != null and storageCode != ''">
|
||||
and storage_code = #{storageCode}
|
||||
and a.storage_code = #{storageCode}
|
||||
</if>
|
||||
<if test="storageName != null and storageName != ''">
|
||||
and storage_name like concat('%', #{storageName}, '%')
|
||||
and a.storage_name like concat('%', #{storageName}, '%')
|
||||
</if>
|
||||
<if test="storageLocationCode != null and storageLocationCode != ''">
|
||||
and storage_location_code = #{storageLocationCode}
|
||||
and a.storage_location_code = #{storageLocationCode}
|
||||
</if>
|
||||
<if test="storageLocationName != null and storageLocationName != ''">
|
||||
and storage_location_name like concat('%', #{storageLocationName}, '%')
|
||||
and a.storage_location_name like concat('%', #{storageLocationName}, '%')
|
||||
</if>
|
||||
<if test="storageLocationClassify != null and storageLocationClassify != ''">
|
||||
and storage_location_classify = #{storageLocationClassify}
|
||||
and a.storage_location_classify = #{storageLocationClassify}
|
||||
</if>
|
||||
<if test="storageLocationClassifyName != null and storageLocationClassifyName != ''">
|
||||
and storage_location_classify_name like concat('%', #{storageLocationClassifyName}, '%')
|
||||
and a.storage_location_classify_name like concat('%', #{storageLocationClassifyName}, '%')
|
||||
</if>
|
||||
<if test="storageLocationType != null and storageLocationType != ''">
|
||||
and storage_location_type = #{storageLocationType}
|
||||
and a.storage_location_type = #{storageLocationType}
|
||||
</if>
|
||||
<if test="storageLocationTypeName != null and storageLocationTypeName != ''">
|
||||
and storage_location_type_name like concat('%', #{storageLocationTypeName}, '%')
|
||||
and a.storage_location_type_name like concat('%', #{storageLocationTypeName}, '%')
|
||||
</if>
|
||||
<if test="mixingStrategy != null and mixingStrategy != ''">
|
||||
and mixing_strategy = #{mixingStrategy}
|
||||
and a.mixing_strategy = #{mixingStrategy}
|
||||
</if>
|
||||
<if test="mixingStrategyName != null and mixingStrategyName != ''">
|
||||
and mixing_strategy_name like concat('%', #{mixingStrategyName}, '%')
|
||||
and a.mixing_strategy_name like concat('%', #{mixingStrategyName}, '%')
|
||||
</if>
|
||||
<if test="storageLocationGroupId != null ">
|
||||
and storage_location_group_id = #{storageLocationGroupId}
|
||||
and a.storage_location_group_id = #{storageLocationGroupId}
|
||||
</if>
|
||||
<if test="storageLocationGroupCode != null and storageLocationGroupCode != ''">
|
||||
and storage_location_group_code = #{storageLocationGroupCode}
|
||||
and a.storage_location_group_code = #{storageLocationGroupCode}
|
||||
</if>
|
||||
<if test="storageLocationGroupName != null and storageLocationGroupName != ''">
|
||||
and storage_location_group_name like concat('%', #{storageLocationGroupName}, '%')
|
||||
and a.storage_location_group_name like concat('%', #{storageLocationGroupName}, '%')
|
||||
</if>
|
||||
<if test="weightLimit != null ">
|
||||
and weight_limit = #{weightLimit}
|
||||
and a.weight_limit = #{weightLimit}
|
||||
</if>
|
||||
<if test="volumeLimit != null ">
|
||||
and volume_limit = #{volumeLimit}
|
||||
and a.volume_limit = #{volumeLimit}
|
||||
</if>
|
||||
<if test="locationSize != null and locationSize != ''">
|
||||
and location_size = #{locationSize}
|
||||
and a.location_size = #{locationSize}
|
||||
</if>
|
||||
<if test="locationLength != null ">
|
||||
and location_length = #{locationLength}
|
||||
and a.location_length = #{locationLength}
|
||||
</if>
|
||||
<if test="locationWidth != null ">
|
||||
and location_width = #{locationWidth}
|
||||
and a.location_width = #{locationWidth}
|
||||
</if>
|
||||
<if test="locationHeight != null ">
|
||||
and location_height = #{locationHeight}
|
||||
and a.location_height = #{locationHeight}
|
||||
</if>
|
||||
<if test="coordinate != null and coordinate != ''">
|
||||
and coordinate = #{coordinate}
|
||||
and a.coordinate = #{coordinate}
|
||||
</if>
|
||||
<if test="coordinateArea != null and coordinateArea != ''">
|
||||
and coordinate_area = #{coordinateArea}
|
||||
and a.coordinate_area = #{coordinateArea}
|
||||
</if>
|
||||
<if test="coordinateColumn != null and coordinateColumn != ''">
|
||||
and coordinate_column = #{coordinateColumn}
|
||||
and a.coordinate_column = #{coordinateColumn}
|
||||
</if>
|
||||
<if test="coordinateRow != null and coordinateRow != ''">
|
||||
and coordinate_row = #{coordinateRow}
|
||||
and a.coordinate_row = #{coordinateRow}
|
||||
</if>
|
||||
<if test="coordinateLayer != null and coordinateLayer != ''">
|
||||
and coordinate_layer = #{coordinateLayer}
|
||||
and a.coordinate_layer = #{coordinateLayer}
|
||||
</if>
|
||||
<if test="openingUp != null ">
|
||||
and opening_up = #{openingUp}
|
||||
and a.opening_up = #{openingUp}
|
||||
</if>
|
||||
<if test="nullify != null ">
|
||||
and nullify = #{nullify}
|
||||
and a.nullify = #{nullify}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
and a.create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
and a.update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and remark like concat('%',#{remark},'%')
|
||||
and a.remark like concat('%',#{remark},'%')
|
||||
</if>
|
||||
<choose>
|
||||
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
|
||||
<otherwise> and a.del_flag = 1 </otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO" resultMap="StorageLocationResult">
|
||||
<include refid="selectStorageLocationPo"/>
|
||||
<include refid="selectStorageLocationPo1"/>
|
||||
-- 按照创建时间倒序排序
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getStorageLocationCount" parameterType="com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO" resultMap="StorageLocationResult">
|
||||
<select id="getStorageLocationCount" parameterType="com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO" resultType="java.lang.Long">
|
||||
SELECT count(1)
|
||||
from storage_locationfrom
|
||||
from storage_location a
|
||||
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
|
||||
<include refid="selectStorageLocationPo1"/>
|
||||
</select>
|
||||
</mapper>
|
||||
+29
-18
@@ -31,67 +31,78 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<sql id="selectStorageLocationGroupPo">
|
||||
select storage_location_group_id, organization_id, organization_name, top_organization_id, warehouse_id, warehouse_code, warehouse_name, storage_section_id, storage_code, storage_name, storage_location_group_code, storage_location_group_name, remark, number, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from storage_location_group
|
||||
select a.storage_location_group_id, a.organization_id, a.organization_name, a.top_organization_id, a.warehouse_id,
|
||||
COALESCE(w.warehouse_code, a.warehouse_code) as warehouse_code,
|
||||
COALESCE(w.warehouse_name, a.warehouse_name) as warehouse_name,
|
||||
a.storage_section_id, a.storage_code, a.storage_name, a.storage_location_group_code, a.storage_location_group_name,
|
||||
a.remark, a.number, a.opening_up, a.nullify, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
|
||||
from storage_location_group a
|
||||
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectStorageLocationGroupPo1">
|
||||
<where>
|
||||
<if test="organizationId != null ">
|
||||
and organization_id = #{organizationId}
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and organization_name like concat('%', #{organizationName}, '%')
|
||||
and a.organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="topOrganizationId != null ">
|
||||
and top_organization_id = #{topOrganizationId}
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="warehouseId != null ">
|
||||
and warehouse_id = #{warehouseId}
|
||||
and a.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
and warehouse_code = #{warehouseCode}
|
||||
and (w.warehouse_code like concat('%', #{warehouseCode}, '%') or a.warehouse_code like concat('%', #{warehouseCode}, '%'))
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
and (w.warehouse_name like concat('%', #{warehouseName}, '%') or a.warehouse_name like concat('%', #{warehouseName}, '%'))
|
||||
</if>
|
||||
<if test="storageSectionId != null ">
|
||||
and storage_section_id = #{storageSectionId}
|
||||
and a.storage_section_id = #{storageSectionId}
|
||||
</if>
|
||||
<if test="storageCode != null and storageCode != ''">
|
||||
and storage_code = #{storageCode}
|
||||
and a.storage_code = #{storageCode}
|
||||
</if>
|
||||
<if test="storageName != null and storageName != ''">
|
||||
and storage_name like concat('%', #{storageName}, '%')
|
||||
and a.storage_name like concat('%', #{storageName}, '%')
|
||||
</if>
|
||||
<if test="storageLocationGroupCode != null and storageLocationGroupCode != ''">
|
||||
and storage_location_group_code = #{storageLocationGroupCode}
|
||||
and a.storage_location_group_code = #{storageLocationGroupCode}
|
||||
</if>
|
||||
<if test="storageLocationGroupName != null and storageLocationGroupName != ''">
|
||||
and storage_location_group_name like concat('%', #{storageLocationGroupName}, '%')
|
||||
and a.storage_location_group_name like concat('%', #{storageLocationGroupName}, '%')
|
||||
</if>
|
||||
<if test="openingUp != null ">
|
||||
and opening_up = #{openingUp}
|
||||
and a.opening_up = #{openingUp}
|
||||
</if>
|
||||
<if test="nullify != null ">
|
||||
and nullify = #{nullify}
|
||||
and a.nullify = #{nullify}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
and a.create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
and a.update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="number != null">
|
||||
and number = #{number}
|
||||
and a.number = #{number}
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and remark like concat('%',#{remark},'%')
|
||||
and a.remark like concat('%',#{remark},'%')
|
||||
</if>
|
||||
<choose>
|
||||
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
|
||||
<otherwise> and a.del_flag = 1 </otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.basic.domain.storageLocationGroup.repository.todo.StorageLocationGroupDO" resultMap="StorageLocationGroupResult">
|
||||
<include refid="selectStorageLocationGroupPo"/>
|
||||
<include refid="selectStorageLocationGroupPo1"/>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
+28
-17
@@ -31,64 +31,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<sql id="selectStorageSectionPo">
|
||||
select storage_section_id, organization_id, organization_name, top_organization_id, warehouse_id, warehouse_code, warehouse_name, storage_code, storage_name, storage_type, storage_type_name, storage_region, remark, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from storage_section
|
||||
select a.storage_section_id, a.organization_id, a.organization_name, a.top_organization_id, a.warehouse_id,
|
||||
COALESCE(w.warehouse_code, a.warehouse_code) as warehouse_code,
|
||||
COALESCE(w.warehouse_name, a.warehouse_name) as warehouse_name,
|
||||
a.storage_code, a.storage_name, a.storage_type, a.storage_type_name, a.storage_region, a.remark, a.opening_up, a.nullify,
|
||||
a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
|
||||
from storage_section a
|
||||
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectStorageSectionPo1">
|
||||
<where>
|
||||
<if test="organizationId != null ">
|
||||
and organization_id = #{organizationId}
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and organization_name like concat('%', #{organizationName}, '%')
|
||||
and a.organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="topOrganizationId != null ">
|
||||
and top_organization_id = #{topOrganizationId}
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="warehouseId != null ">
|
||||
and warehouse_id = #{warehouseId}
|
||||
and a.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
and warehouse_code = #{warehouseCode}
|
||||
and (w.warehouse_code like concat('%', #{warehouseCode}, '%') or a.warehouse_code like concat('%', #{warehouseCode}, '%'))
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
and (w.warehouse_name like concat('%', #{warehouseName}, '%') or a.warehouse_name like concat('%', #{warehouseName}, '%'))
|
||||
</if>
|
||||
<if test="storageCode != null and storageCode != ''">
|
||||
and storage_code = #{storageCode}
|
||||
and a.storage_code = #{storageCode}
|
||||
</if>
|
||||
<if test="storageName != null and storageName != ''">
|
||||
and storage_name like concat('%', #{storageName}, '%')
|
||||
and a.storage_name like concat('%', #{storageName}, '%')
|
||||
</if>
|
||||
<if test="storageType != null and storageType != ''">
|
||||
and storage_type = #{storageType}
|
||||
and a.storage_type = #{storageType}
|
||||
</if>
|
||||
<if test="storageTypeName != null and storageTypeName != ''">
|
||||
and storage_type_name like concat('%', #{storageTypeName}, '%')
|
||||
and a.storage_type_name like concat('%', #{storageTypeName}, '%')
|
||||
</if>
|
||||
<if test="storageRegion != null ">
|
||||
and storage_region = #{storageRegion}
|
||||
and a.storage_region = #{storageRegion}
|
||||
</if>
|
||||
<if test="openingUp != null ">
|
||||
and opening_up = #{openingUp}
|
||||
and a.opening_up = #{openingUp}
|
||||
</if>
|
||||
<if test="nullify != null ">
|
||||
and nullify = #{nullify}
|
||||
and a.nullify = #{nullify}
|
||||
</if>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
and a.create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
and a.update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and remark like concat('%',#{remark},'%')
|
||||
and a.remark like concat('%',#{remark},'%')
|
||||
</if>
|
||||
<choose>
|
||||
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
|
||||
<otherwise> and a.del_flag = 1 </otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO" resultMap="StorageSectionResult">
|
||||
<include refid="selectStorageSectionPo"/>
|
||||
<include refid="selectStorageSectionPo1"/>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
+2
-1
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
and warehouse_code = #{warehouseCode}
|
||||
and warehouse_code like concat('%', #{warehouseCode}, '%')
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
@@ -139,5 +139,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="queryList" parameterType="com.mhd.basic.domain.warehouse.repository.todo.WarehouseDO" resultMap="WarehouseResult">
|
||||
<include refid="selectWarehousePo"/>
|
||||
<include refid="selectWarehousePo1"/>
|
||||
order by create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
+8
@@ -157,6 +157,10 @@ public class CommonApplicationService {
|
||||
UserDO queryAccount = new UserDO();
|
||||
queryAccount.setTopOrganizationId(topOrganizationId);
|
||||
queryAccount.setUserAccount(userDO.getUserAccount());
|
||||
// 如果指定了角色,只检查相同角色的用户
|
||||
if (StrUtil.isNotEmpty(userDO.getRoleCode())) {
|
||||
queryAccount.setRoleCode(userDO.getRoleCode());
|
||||
}
|
||||
userPo = userDomainService.findByTopOrganizationIdAndUserAccount(queryAccount);
|
||||
}
|
||||
//根据手机号查询
|
||||
@@ -165,6 +169,10 @@ public class CommonApplicationService {
|
||||
UserDO queryPhone = new UserDO();
|
||||
queryPhone.setTopOrganizationId(topOrganizationId);
|
||||
queryPhone.setUserPhone(userDO.getUserPhone());
|
||||
// 如果指定了角色,只检查相同角色的用户
|
||||
if (StrUtil.isNotEmpty(userDO.getRoleCode())) {
|
||||
queryPhone.setRoleCode(userDO.getRoleCode());
|
||||
}
|
||||
userPoTwo = userDomainService.findByTopOrganizationIdAndUserPhone(queryPhone);
|
||||
}
|
||||
//根据身份证号查询
|
||||
|
||||
+31
-5
@@ -441,6 +441,32 @@ public class UserApplicationService {
|
||||
return userPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 根据用户ID获取用户信息
|
||||
* @Author Alex
|
||||
* @Date 2022/12/20 17:12
|
||||
*/
|
||||
public UserPo selectByUserName(String userName) {
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
userName = loginUser.getUsername();
|
||||
}
|
||||
UserPo userPo = userDomainService.selectByUserName(userName);
|
||||
if (userPo != null){
|
||||
userPo.setPrincipalAccount(userPo.getUserAccount());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(userPo.getRoleCode())){
|
||||
String[] split = userPo.getRoleCode().split(";");
|
||||
List<String> list = CollectionUtil.toList(split);
|
||||
userPo.setRoleCodeList(list);
|
||||
}
|
||||
UserShipperPo userShipperPo = userShipperDomainService.selectByUserId(userPo.getUserId());
|
||||
if(null != userShipperPo){
|
||||
userPo.setEsignEnterpriseStatus(userShipperPo.getEsignEnterpriseStatus());
|
||||
}
|
||||
return userPo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 分配用户默认普通用户角色
|
||||
* @Author Alex
|
||||
@@ -1196,7 +1222,7 @@ public class UserApplicationService {
|
||||
(userDO.getUserAccountType() == null || userDO.getUserAccountType() < 4)) {
|
||||
//给用户分配默认普通角色权限
|
||||
RoleDo roleDo = new RoleDo();
|
||||
roleDo.setRoleCode(RoleEnum.MUST.getCode());
|
||||
roleDo.setRoleCode(RoleEnum.OWNER_CARGO.getCode());
|
||||
roleDo.setOrganizationId(userEntity.getOrganizationId());
|
||||
RoleEntity roleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(roleDo);
|
||||
if (roleEntity != null) {
|
||||
@@ -1206,8 +1232,8 @@ public class UserApplicationService {
|
||||
userDO.setRoleId(roleEntity.getRoleId());
|
||||
userRoleDomainService.addUserRole(userRoleDo);
|
||||
}
|
||||
userDO.setRoleCode(RoleEnum.MUST.getCode());
|
||||
userDO.setRoleName(RoleEnum.MUST.getName());
|
||||
userDO.setRoleCode(RoleEnum.OWNER_CARGO.getCode());
|
||||
userDO.setRoleName(RoleEnum.OWNER_CARGO.getName());
|
||||
userDO.setUserId(userEntity.getUserId());
|
||||
userDomainService.updateUser(userDO);
|
||||
}else{
|
||||
@@ -4913,7 +4939,7 @@ public class UserApplicationService {
|
||||
Map<String, SysDepartInterfaceInfoPo> sysDepartInterfaceInfoPoMap = sysDepartInterfaceInfoPos.stream().collect(Collectors.toMap(SysDepartInterfaceInfoPo::getInterfaceTypeKey, Function.identity()));
|
||||
SysDepartInterfaceInfoPo sysDepartInterfaceInfoPo = sysDepartInterfaceInfoPoMap.get("isWT");
|
||||
//是否开启
|
||||
if ("1".equals(sysDepartInterfaceInfoPo.getInterfaceTypeValue())) {
|
||||
if (sysDepartInterfaceInfoPo != null && "1".equals(sysDepartInterfaceInfoPo.getInterfaceTypeValue())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -4969,4 +4995,4 @@ public class UserApplicationService {
|
||||
public UserPo selectUserTableByUserId(Long userId){
|
||||
return userDomainService.selectByUserId(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
@@ -165,4 +165,31 @@ public class UserEntity extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "制单员nc编码")
|
||||
private String documentPreparerNcCode;
|
||||
|
||||
@ApiModelProperty("法人代表")
|
||||
private String legalRepresentative;
|
||||
|
||||
@ApiModelProperty("统一编码")
|
||||
private String unifiedCode;
|
||||
|
||||
@ApiModelProperty("注册电话")
|
||||
private String registeredPhone;
|
||||
|
||||
@ApiModelProperty("注册地址")
|
||||
private String registeredAddress;
|
||||
|
||||
@ApiModelProperty("传真")
|
||||
private String fax;
|
||||
|
||||
@ApiModelProperty("付款银行")
|
||||
private String paymentBank;
|
||||
|
||||
@ApiModelProperty("付款账户")
|
||||
private String paymentAccount;
|
||||
|
||||
@ApiModelProperty("发票抬头")
|
||||
private String invoiceTitle;
|
||||
|
||||
@ApiModelProperty("税号")
|
||||
private String taxNumber;
|
||||
}
|
||||
|
||||
+3
-2
@@ -27,6 +27,8 @@ public interface UserRepositoryInterface extends IService<UserEntity> {
|
||||
UserPo findAdminUserByOrganizationId(UserDO userDO);
|
||||
|
||||
UserPo findByUserId(Long userId);
|
||||
UserPo selectByUserName(String userName);
|
||||
|
||||
|
||||
UserPo findByTopOrganizationIdAndUserAccount(UserDO userDO);
|
||||
UserPo getUserByDingUserId(String dingUserId);
|
||||
@@ -73,5 +75,4 @@ public interface UserRepositoryInterface extends IService<UserEntity> {
|
||||
|
||||
|
||||
String finShipperEnterpriseNamedByUserId(Long userId);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -60,4 +60,4 @@ public interface UserShipperRepositoryInterface extends IService<UserShipperEnti
|
||||
SettlementInfoQueryVo getSettlementInfoByUserId(Long userId);
|
||||
|
||||
public com.mhd.common.core.domain.po.UserShipperPo getShipperSummaryData(Long userId);
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -24,6 +24,8 @@ public interface UserMapper extends BaseMapper<UserEntity> {
|
||||
|
||||
UserPo selectByUserId(Long userId);
|
||||
|
||||
UserPo selectByUserName(String userName);
|
||||
|
||||
UserPo selectUserShipperList(UserPo userPo);
|
||||
|
||||
List<UserPo> selectUserShipperListWaybill(UserPo userPo);
|
||||
@@ -72,4 +74,4 @@ public interface UserMapper extends BaseMapper<UserEntity> {
|
||||
|
||||
|
||||
String finShipperEnterpriseNamedByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -28,4 +28,4 @@ public interface UserShipperMapper extends BaseMapper<UserShipperEntity> {
|
||||
List<UserShipperEntity> selectBySealId(@Param("userShipperEntity") UserShipperEntity userShipperEntity);
|
||||
|
||||
public com.mhd.common.core.domain.po.UserShipperPo getShipperSummaryData(Long userId);
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -64,6 +64,11 @@ public class UserRepositoryImpl extends ServiceImpl<UserMapper,UserEntity> imple
|
||||
return userMapper.selectByUserId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserPo selectByUserName(String userName) {
|
||||
return userMapper.selectByUserName(userName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserEntity selectById(Long userId) {
|
||||
return userMapper.selectById(userId);
|
||||
@@ -168,4 +173,4 @@ public class UserRepositoryImpl extends ServiceImpl<UserMapper,UserEntity> imple
|
||||
public String finShipperEnterpriseNamedByUserId(Long userId) {
|
||||
return userMapper.finShipperEnterpriseNamedByUserId(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -166,4 +166,4 @@ public class UserShipperRepositoryImpl extends ServiceImpl<UserShipperMapper, Us
|
||||
public com.mhd.common.core.domain.po.UserShipperPo getShipperSummaryData(Long userId) {
|
||||
return shipperMapper.getShipperSummaryData(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
+33
@@ -45,4 +45,37 @@ public class CustomerDO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "用户ID集合")
|
||||
private List<Long> userIds;
|
||||
|
||||
@ApiModelProperty("法人代表")
|
||||
private String legalRepresentative;
|
||||
|
||||
@ApiModelProperty("统一编码")
|
||||
private String unifiedCode;
|
||||
|
||||
@ApiModelProperty("注册电话")
|
||||
private String registeredPhone;
|
||||
|
||||
@ApiModelProperty("注册地址")
|
||||
private String registeredAddress;
|
||||
|
||||
@ApiModelProperty("传真")
|
||||
private String fax;
|
||||
|
||||
@ApiModelProperty("付款银行")
|
||||
private String paymentBank;
|
||||
|
||||
@ApiModelProperty("付款账户")
|
||||
private String paymentAccount;
|
||||
|
||||
@ApiModelProperty("发票抬头")
|
||||
private String invoiceTitle;
|
||||
|
||||
@ApiModelProperty("税号")
|
||||
private String taxNumber;
|
||||
|
||||
@ApiModelProperty(name = "邮箱")
|
||||
private String userEmail;
|
||||
|
||||
@ApiModelProperty(name = "备注")
|
||||
private String userRemark;
|
||||
}
|
||||
|
||||
+27
@@ -254,4 +254,31 @@ public class UserDO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty(name = "制单员nc编码")
|
||||
private String documentPreparerNcCode;
|
||||
|
||||
@ApiModelProperty("法人代表")
|
||||
private String legalRepresentative;
|
||||
|
||||
@ApiModelProperty("统一编码")
|
||||
private String unifiedCode;
|
||||
|
||||
@ApiModelProperty("注册电话")
|
||||
private String registeredPhone;
|
||||
|
||||
@ApiModelProperty("注册地址")
|
||||
private String registeredAddress;
|
||||
|
||||
@ApiModelProperty("传真")
|
||||
private String fax;
|
||||
|
||||
@ApiModelProperty("付款银行")
|
||||
private String paymentBank;
|
||||
|
||||
@ApiModelProperty("付款账户")
|
||||
private String paymentAccount;
|
||||
|
||||
@ApiModelProperty("发票抬头")
|
||||
private String invoiceTitle;
|
||||
|
||||
@ApiModelProperty("税号")
|
||||
private String taxNumber;
|
||||
}
|
||||
|
||||
+5
-1
@@ -125,6 +125,10 @@ public class UserDomainService {
|
||||
return userRepositoryInterface.findByUserId(userId);
|
||||
}
|
||||
|
||||
public UserPo selectByUserName(String userName) {
|
||||
return userRepositoryInterface.selectByUserName(userName);
|
||||
}
|
||||
|
||||
public void updateWhenLogin(UserDO userDO) {
|
||||
userRepositoryInterface.update(new UpdateWrapper<UserEntity>().lambda()
|
||||
.set(UserEntity::getLastLoginIp,userDO.getLastLoginIp()).set(UserEntity::getLastLoginTime,userDO.getLastLoginTime())
|
||||
@@ -259,4 +263,4 @@ public class UserDomainService {
|
||||
.set(UserEntity::getHasDefaultAddress, dto.getHasDefaultAddress())
|
||||
.eq(UserEntity::getUserId, dto.getUserId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -236,4 +236,4 @@ public class UserShipperDomainService {
|
||||
public com.mhd.common.core.domain.po.UserShipperPo getShipperSummaryData(Long userId) {
|
||||
return userShipperRepositoryInterface.getShipperSummaryData(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,4 +47,36 @@ public class CustomerDTO extends BaseVOEntity {
|
||||
@ApiModelProperty("详细地址")
|
||||
private String userAreaAddress;
|
||||
|
||||
@ApiModelProperty("法人代表")
|
||||
private String legalRepresentative;
|
||||
|
||||
@ApiModelProperty("统一编码")
|
||||
private String unifiedCode;
|
||||
|
||||
@ApiModelProperty("注册电话")
|
||||
private String registeredPhone;
|
||||
|
||||
@ApiModelProperty("注册地址")
|
||||
private String registeredAddress;
|
||||
|
||||
@ApiModelProperty("传真")
|
||||
private String fax;
|
||||
|
||||
@ApiModelProperty("付款银行")
|
||||
private String paymentBank;
|
||||
|
||||
@ApiModelProperty("付款账户")
|
||||
private String paymentAccount;
|
||||
|
||||
@ApiModelProperty("发票抬头")
|
||||
private String invoiceTitle;
|
||||
|
||||
@ApiModelProperty("税号")
|
||||
private String taxNumber;
|
||||
|
||||
@ApiModelProperty(name = "邮箱")
|
||||
private String userEmail;
|
||||
|
||||
@ApiModelProperty(name = "备注")
|
||||
private String userRemark;
|
||||
}
|
||||
|
||||
@@ -241,4 +241,10 @@ public class UserDTO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty( "制单员nc编码")
|
||||
private String documentPreparerNcCode;
|
||||
|
||||
@ApiModelProperty(value = "紧急联系人姓名")
|
||||
private String emergencyContactName;
|
||||
|
||||
@ApiModelProperty(value = "紧急联系电话")
|
||||
private String emergencyContactPhone;
|
||||
}
|
||||
|
||||
@@ -201,6 +201,14 @@ public class UserAPI extends BaseController {
|
||||
return AjaxResult.success(userPo);
|
||||
}
|
||||
|
||||
@Log(title = "用户中台管理-查询", description ="根据用户ID查询用户详细信息",businessType = BusinessType.INQUIRE)
|
||||
@ApiOperation("根据用户ID查询用户详细信息")
|
||||
@GetMapping("/getInfoByName/{userName}")
|
||||
public AjaxResult getInfoByName(@PathVariable("userName") String userName) {
|
||||
UserPo userPo = userApplicationService.selectByUserName(userName);
|
||||
return AjaxResult.success(userPo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 新增租户,新增货主,新增司机,新增员工,用户注册等
|
||||
* @Author Alex
|
||||
@@ -946,4 +954,4 @@ public class UserAPI extends BaseController {
|
||||
public R<String> finShipperEnterpriseNamedByUserId(@PathVariable("userId") Long userId) {
|
||||
return R.ok(userApplicationService.finShipperEnterpriseNamedByUserId(userId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,17 +18,17 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
|
||||
@@ -70,7 +70,16 @@
|
||||
a.department_id,
|
||||
a.ding_user_id,
|
||||
a.ding_dept_id,
|
||||
a.validity_period_management,a.salesperson_nc_code,a.document_preparer_nc_code
|
||||
a.validity_period_management,a.salesperson_nc_code,a.document_preparer_nc_code,
|
||||
a.legal_representative,
|
||||
a.unified_code,
|
||||
a.registered_phone,
|
||||
a.registered_address,
|
||||
a.fax,
|
||||
a.payment_bank,
|
||||
a.payment_account,
|
||||
a.invoice_title,
|
||||
a.tax_number
|
||||
FROM "USER" a
|
||||
where a.del_flag = 1
|
||||
</sql>
|
||||
@@ -131,6 +140,9 @@
|
||||
<include refid="selectUserVo"/>
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
and a.user_account = #{userAccount}
|
||||
<if test="roleCode != null and roleCode != ''">
|
||||
and a.role_code = #{roleCode}
|
||||
</if>
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id != #{userId}
|
||||
</if>
|
||||
@@ -159,6 +171,10 @@
|
||||
and a.user_id = #{value}
|
||||
</select>
|
||||
|
||||
<select id="selectByUserName" parameterType="java.lang.String" resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
and a.user_name = #{value}</select>
|
||||
|
||||
|
||||
<!-- 根据用户手机号查询自己以外的用户 -->
|
||||
<select id="findByTopOrganizationIdAndUserPhone"
|
||||
@@ -170,6 +186,9 @@
|
||||
</if>
|
||||
and a.user_phone = #{userPhone}
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
<if test="roleCode != null and roleCode != ''">
|
||||
and a.role_code = #{roleCode}
|
||||
</if>
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id != #{userId}
|
||||
</if>
|
||||
@@ -213,6 +232,13 @@
|
||||
OR a.create_by = #{createBy})
|
||||
</if>
|
||||
|
||||
<if test="userIds !=null and userIds.size() > 0 ">
|
||||
and a.user_id in
|
||||
<foreach item="id" collection="userIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id = #{userId}
|
||||
</if>
|
||||
@@ -386,14 +412,6 @@
|
||||
<if test="userMemberCode != null and userMemberCode != ''">
|
||||
and a.user_member_code = #{userMemberCode}
|
||||
</if>
|
||||
/*联系人*/
|
||||
<if test="emergencyContactName != null and emergencyContactName != ''">
|
||||
and a.emergency_contact_name = #{emergencyContactName}
|
||||
</if>
|
||||
/*联系电话*/
|
||||
<if test="emergencyContactPhone != null and emergencyContactPhone != ''">
|
||||
and a.emergency_contact_phone = #{emergencyContactPhone}
|
||||
</if>
|
||||
/*详细地址*/
|
||||
<if test="userAreaAddress != null and userAreaAddress != ''">
|
||||
and a.user_area_address like concat('%' , #{userAreaAddress} , '%')
|
||||
@@ -406,6 +424,9 @@
|
||||
<if test="emergencyContactPhone != null and emergencyContactPhone != ''">
|
||||
and a.emergency_contact_phone like concat('%' , #{emergencyContactPhone} , '%')
|
||||
</if>
|
||||
<if test="userAreaCountyId != null and userAreaCountyId != ''">
|
||||
and a.user_area_county_id = #{userAreaCountyId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectAppUserList" resultType="com.mhd.common.core.domain.po.app.UserAppPo" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserDO">
|
||||
|
||||
@@ -381,4 +381,4 @@
|
||||
and esign_enterprise_status = #{userShipperEntity.esignEnterpriseStatus}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
@@ -25,7 +25,8 @@ spring:
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
#线上正式环境
|
||||
server-addr: 10.102.192.5:6848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
@@ -39,7 +40,8 @@ spring:
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
#线上正式环境
|
||||
server-addr: 10.102.192.5:6848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
+2
-15
@@ -90,7 +90,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.38</version>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--链路追踪-->
|
||||
@@ -127,19 +127,6 @@
|
||||
<groupId>com.mhd</groupId>
|
||||
<artifactId>mhd-common-log</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.mhd</groupId>-->
|
||||
<!-- <artifactId>mhd-modules-system</artifactId>-->
|
||||
<!-- <version>3.6.0</version>-->
|
||||
<!-- <scope>compile</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.mhd</groupId>
|
||||
<artifactId>mhd-user-center</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -179,4 +166,4 @@
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
</project>
|
||||
@@ -17,6 +17,8 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
# 演示环境
|
||||
# server-addr: 47.92.229.169:8848
|
||||
# 测试开发环境
|
||||
@@ -31,6 +33,8 @@ spring:
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
# 演示环境
|
||||
# server-addr: 47.92.229.169:8848
|
||||
# 测试开发环境
|
||||
|
||||
@@ -18,9 +18,9 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
@@ -30,9 +30,9 @@ spring:
|
||||
#线上正式环境
|
||||
# server-addr: 10.102.192.105:6848
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
@@ -18,9 +18,9 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
@@ -30,9 +30,9 @@ spring:
|
||||
#线上正式环境
|
||||
# server-addr: 10.102.192.105:6848
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
@@ -18,10 +18,10 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置使用ip+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
@@ -31,9 +31,9 @@ spring:
|
||||
#线上正式环境
|
||||
# server-addr: 10.102.192.105:6848
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置使用ip+端口号
|
||||
server-addr: 10.102.192.5:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
@@ -131,6 +131,13 @@
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- EasyExcel 解析Excel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mhd Api System-->
|
||||
<dependency>
|
||||
<groupId>com.mhd</groupId>
|
||||
|
||||
+3
@@ -109,4 +109,7 @@ public class DeliveTaskApplicationService {
|
||||
return deliveTaskDomainService.querySum(deliveTaskDO);
|
||||
}
|
||||
|
||||
public Boolean forward(DeliveTaskDO deliveTaskDO) {
|
||||
return deliveTaskDomainService.updateById(deliveTaskDO);
|
||||
}
|
||||
}
|
||||
|
||||
+52
@@ -2,20 +2,31 @@ package com.mhd.wms.application.service.handoverTaskOrder;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.DateUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.domain.PlatformFeignPO;
|
||||
import com.mhd.system.api.domain.PlatformUseTimeFeignPO;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.handoverTaskOrder.entity.HandoverTaskOrder;
|
||||
import com.mhd.wms.domain.handoverTaskOrder.repository.facade.IHandoverTaskOrderService;
|
||||
import com.mhd.wms.domain.handoverTaskOrder.repository.po.HandoverTaskOrderPO;
|
||||
import com.mhd.wms.domain.handoverTaskOrder.repository.todo.HandoverTaskOrderDO;
|
||||
import com.mhd.wms.domain.handoverTaskOrder.service.HandoverTaskOrderDomainService;
|
||||
import com.mhd.wms.domain.shiftManage.repository.todo.ShiftManageDO;
|
||||
import com.mhd.wms.domain.stockOutOrder.entity.StockOutOrder;
|
||||
import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -36,6 +47,15 @@ public class HandoverTaskOrderApplicationService {
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
@Autowired
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
@Autowired
|
||||
private IHandoverTaskOrderService handoverTaskOrderService;
|
||||
|
||||
@Autowired
|
||||
private IStockOutOrderService stockOutOrderService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询交接作业单列表
|
||||
@@ -148,4 +168,36 @@ public class HandoverTaskOrderApplicationService {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean taskDistribution(HandoverTaskOrderDO handoverTaskOrderDO) {
|
||||
// 设置作业员信息
|
||||
operatorsParam(handoverTaskOrderDO);
|
||||
return handoverTaskOrderDomainService.taskDistribution(handoverTaskOrderDO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 封装作业人员信息
|
||||
* @param handoverTaskOrderDO
|
||||
*/
|
||||
private void operatorsParam(HandoverTaskOrderDO handoverTaskOrderDO){
|
||||
AjaxResult ajaxResult = userServiceFeign.getInfo(handoverTaskOrderDO.getOperatorsBy());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取作业人员信息失败");
|
||||
}
|
||||
UserPo userPo = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
|
||||
handoverTaskOrderDO.setOperatorsName(userPo.getUserName());
|
||||
}
|
||||
|
||||
public void pictureApp(HandoverTaskOrderDO handoverTaskOrderDO) {
|
||||
//pda上传图片插入交接作业单
|
||||
handoverTaskOrderService.update(new LambdaUpdateWrapper<HandoverTaskOrder>()
|
||||
.eq(HandoverTaskOrder::getOrderNumber,handoverTaskOrderDO.getOrderNumber())
|
||||
.set(HandoverTaskOrder::getPictureApp,handoverTaskOrderDO.getPictureApp()));
|
||||
//pda上传图片插入出库管理
|
||||
stockOutOrderService.update(new LambdaUpdateWrapper<StockOutOrder>()
|
||||
.eq(StockOutOrder::getOutOrderNumber,handoverTaskOrderDO.getOrderNumber())
|
||||
.set(StockOutOrder::getStatus,"9")//设置为出库
|
||||
.set(StockOutOrder::getPictureApp,handoverTaskOrderDO.getPictureApp())//多张图片以,逗号隔开
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+276
-3
@@ -1,17 +1,31 @@
|
||||
package com.mhd.wms.application.service.inventoryAdjustmentRecord;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.po.InventoryAdjustmentRecordPO;
|
||||
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.todo.InventoryAdjustmentRecordDO;
|
||||
import com.mhd.wms.domain.inventoryAdjustmentRecord.service.InventoryAdjustmentRecordDomainService;
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
|
||||
import com.mhd.wms.domain.statementStatistics.po.ImmediateInventoryPO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 库存调整记录ApplicationService
|
||||
@@ -24,6 +38,10 @@ import java.util.List;
|
||||
public class InventoryAdjustmentRecordApplicationService {
|
||||
@Autowired
|
||||
private InventoryAdjustmentRecordDomainService inventoryAdjustmentRecordDomainService;
|
||||
@Autowired
|
||||
private MaterialInventoryMapper materialInventoryMapper;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
|
||||
/**
|
||||
@@ -40,7 +58,262 @@ public class InventoryAdjustmentRecordApplicationService {
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
inventoryAdjustmentRecordDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
return inventoryAdjustmentRecordDomainService.queryList(inventoryAdjustmentRecordDO);
|
||||
List<InventoryAdjustmentRecordPO> inventoryAdjustmentRecordPOS = inventoryAdjustmentRecordDomainService.queryList(inventoryAdjustmentRecordDO);
|
||||
|
||||
// 性能优化:批量获取批次属性,避免N+1查询问题
|
||||
// 1. 收集所有唯一的materialBaseInfoId
|
||||
Set<Long> materialBaseInfoIdSet = inventoryAdjustmentRecordPOS.stream()
|
||||
.map(InventoryAdjustmentRecordPO::getMaterialBaseInfoId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId)
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
|
||||
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
|
||||
try {
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
// 过滤isDisplay=1的属性
|
||||
List<BatchDetailFeignPO> filteredList = batchDetailFeignPOList.stream()
|
||||
.filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1)
|
||||
.collect(Collectors.toList());
|
||||
batchDetailMap.put(materialBaseInfoId, filteredList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 为每个物料明细设置更多属性(从库存表中获取值)
|
||||
setMaterialMoreDetailListFromInventory(inventoryAdjustmentRecordPOS, batchDetailMap);
|
||||
return inventoryAdjustmentRecordPOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为物料库存设置更多属性(从库存表中获取值)
|
||||
* @param materialInventoryPOList 物料库存列表
|
||||
* @param batchDetailMap 批次属性Map
|
||||
*/
|
||||
private void setMaterialMoreDetailListFromInventory(List<InventoryAdjustmentRecordPO> materialInventoryPOList,
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap) {
|
||||
if (CollectionUtils.isEmpty(materialInventoryPOList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
materialInventoryPOList.forEach(materialInventoryPO -> {
|
||||
Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId();
|
||||
Long materialInventoryId = materialInventoryPO.getMaterialInventoryId();
|
||||
|
||||
// 创建新的materialMoreDetailList,只包含isDisplay=1的属性
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList = new ArrayList<>();
|
||||
|
||||
// 从库存表获取数据(包含批次属性字段)
|
||||
MaterialInventoryPO inventoryPO = null;
|
||||
if (materialInventoryId != null) {
|
||||
inventoryPO = materialInventoryMapper.selectByIdWithBatchAttributes(materialInventoryId);
|
||||
}
|
||||
|
||||
if (materialBaseInfoId != null && batchDetailMap.containsKey(materialBaseInfoId)) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = batchDetailMap.get(materialBaseInfoId);
|
||||
// 用于跟踪已添加到列表中的batchDetailId
|
||||
Set<Long> addedBatchDetailIds = new HashSet<>();
|
||||
|
||||
for (BatchDetailFeignPO batchDetailFeignPO : batchDetailFeignPOList) {
|
||||
MaterialMoreDetailPO materialMoreDetailPO = new MaterialMoreDetailPO();
|
||||
materialMoreDetailPO.setBatchId(batchDetailFeignPO.getBatchId());
|
||||
materialMoreDetailPO.setBatchDetailId(batchDetailFeignPO.getBatchDetailId());
|
||||
materialMoreDetailPO.setBatchLabels(batchDetailFeignPO.getBatchLabels());
|
||||
materialMoreDetailPO.setInputControl(batchDetailFeignPO.getInputControl());
|
||||
materialMoreDetailPO.setAttributeFormat(batchDetailFeignPO.getAttributeFormat());
|
||||
materialMoreDetailPO.setAttributeOption(batchDetailFeignPO.getAttributeOption());
|
||||
materialMoreDetailPO.setRemark(batchDetailFeignPO.getRemark());
|
||||
|
||||
// 确保添加到列表中(使用batchDetailId来避免重复)
|
||||
Long batchDetailId = batchDetailFeignPO.getBatchDetailId();
|
||||
if (batchDetailId != null && !addedBatchDetailIds.contains(batchDetailId)) {
|
||||
materialMoreDetailList.add(materialMoreDetailPO);
|
||||
addedBatchDetailIds.add(batchDetailId);
|
||||
}
|
||||
|
||||
// 根据fieldName或batchLabels从库存表中获取对应的字段值
|
||||
if (inventoryPO != null) {
|
||||
String fieldValue = null;
|
||||
String usedFieldName = null;
|
||||
// 优先使用fieldName(如果存在)
|
||||
if (StringUtils.isNotBlank(batchDetailFeignPO.getFieldName())) {
|
||||
usedFieldName = batchDetailFeignPO.getFieldName();
|
||||
fieldValue = getFieldValueByFieldName(inventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, fieldName={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), usedFieldName, fieldValue);
|
||||
}
|
||||
// 如果fieldName为空,尝试根据batchLabels映射到字段名
|
||||
else if (StringUtils.isNotBlank(batchDetailFeignPO.getBatchLabels())) {
|
||||
String fieldNameByLabel = getFieldNameByBatchLabel(batchDetailFeignPO.getBatchLabels());
|
||||
if (StringUtils.isNotBlank(fieldNameByLabel)) {
|
||||
usedFieldName = fieldNameByLabel;
|
||||
fieldValue = getFieldValueByFieldName(inventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, batchLabels={}, 映射字段名={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), batchDetailFeignPO.getBatchLabels(),
|
||||
usedFieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
// 只有当获取到值时才更新attributeValue
|
||||
if (fieldValue != null) {
|
||||
materialMoreDetailPO.setAttributeValue(fieldValue);
|
||||
log.info("设置更多属性:batchDetailId={}, batchLabels={}, attributeValue={}",
|
||||
materialMoreDetailPO.getBatchDetailId(), materialMoreDetailPO.getBatchLabels(),
|
||||
materialMoreDetailPO.getAttributeValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
materialInventoryPO.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
log.info("物料库存 materialInventoryId={}, materialBaseInfoId={}, materialMoreDetailList大小={}",
|
||||
materialInventoryPO.getMaterialInventoryId(), materialInventoryPO.getMaterialBaseInfoId(),
|
||||
materialMoreDetailList != null ? materialMoreDetailList.size() : 0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字段名从对象中获取字段值(使用反射)
|
||||
* @param obj 对象
|
||||
* @param fieldName 字段名
|
||||
* @return 字段值(转换为字符串)
|
||||
*/
|
||||
private String getFieldValueByFieldName(Object obj, String fieldName) {
|
||||
if (obj == null || StringUtils.isBlank(fieldName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 兼容:如果传的是下划线命名(数据库列名风格),先转成驼峰字段名再取
|
||||
String normalizedFieldName = fieldName;
|
||||
if (normalizedFieldName.contains("_")) {
|
||||
normalizedFieldName = snakeToCamel(normalizedFieldName);
|
||||
}
|
||||
|
||||
// 获取对象的Class
|
||||
Class<?> clazz = obj.getClass();
|
||||
|
||||
// 尝试获取字段(包括父类字段)
|
||||
Field field = null;
|
||||
Class<?> currentClass = clazz;
|
||||
while (currentClass != null && field == null) {
|
||||
try {
|
||||
field = currentClass.getDeclaredField(normalizedFieldName);
|
||||
} catch (NoSuchFieldException e) {
|
||||
currentClass = currentClass.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
if (field == null) {
|
||||
log.warn("字段不存在:{}(normalized:{}),对象类型:{}", fieldName, normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
// 设置可访问
|
||||
field.setAccessible(true);
|
||||
|
||||
// 获取字段值
|
||||
Object value = field.get(obj);
|
||||
|
||||
// 转换为字符串
|
||||
if (value == null) {
|
||||
log.info("字段 {} 的值为 null,对象类型:{}", normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
String result;
|
||||
// 处理日期类型字段
|
||||
if (value instanceof Date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
result = sdf.format((Date) value);
|
||||
} else {
|
||||
result = value.toString();
|
||||
}
|
||||
|
||||
log.info("通过反射获取字段值成功,字段名:{}(原始:{}),值:{},对象类型:{}",
|
||||
normalizedFieldName, fieldName, result, clazz.getName());
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.warn("通过反射获取字段值失败,字段名:{},对象类型:{},错误:{}", fieldName, obj.getClass().getName(), e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String snakeToCamel(String snake) {
|
||||
if (StringUtils.isBlank(snake)) {
|
||||
return null;
|
||||
}
|
||||
String s = snake.trim().toLowerCase();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean upperNext = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == '_') {
|
||||
upperNext = true;
|
||||
continue;
|
||||
}
|
||||
if (upperNext) {
|
||||
sb.append(Character.toUpperCase(c));
|
||||
upperNext = false;
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据批次标签(batchLabels)映射到字段名
|
||||
* @param batchLabel 批次标签
|
||||
* @return 字段名,如果找不到映射则返回null
|
||||
*/
|
||||
private String getFieldNameByBatchLabel(String batchLabel) {
|
||||
if (StringUtils.isBlank(batchLabel)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 批次标签到字段名的映射关系
|
||||
Map<String, String> labelToFieldNameMap = new HashMap<>();
|
||||
labelToFieldNameMap.put("Invoice No.", "invoiceNo");
|
||||
labelToFieldNameMap.put("Invoice No", "invoiceNo");
|
||||
labelToFieldNameMap.put("发票号", "invoiceNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO's", "batchRefNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO", "batchRefNo");
|
||||
labelToFieldNameMap.put("批次参考号", "batchRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO's", "sheetRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO", "sheetRefNo");
|
||||
labelToFieldNameMap.put("单据参考号", "sheetRefNo");
|
||||
labelToFieldNameMap.put("箱号/卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("箱号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("生产日期", "productionDate");
|
||||
labelToFieldNameMap.put("过期日期", "expiryDate");
|
||||
labelToFieldNameMap.put("存货日期", "inventoryDate");
|
||||
labelToFieldNameMap.put("扩展字段1", "extAttr1");
|
||||
labelToFieldNameMap.put("扩展字段2", "extAttr2");
|
||||
labelToFieldNameMap.put("扩展字段3", "extAttr3");
|
||||
labelToFieldNameMap.put("扩展字段4", "extAttr4");
|
||||
|
||||
// 精确匹配
|
||||
String fieldName = labelToFieldNameMap.get(batchLabel.trim());
|
||||
if (StringUtils.isNotBlank(fieldName)) {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
// 模糊匹配(包含关系)
|
||||
for (Map.Entry<String, String> entry : labelToFieldNameMap.entrySet()) {
|
||||
if (batchLabel.contains(entry.getKey()) || entry.getKey().contains(batchLabel)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,4 +372,4 @@ public class InventoryAdjustmentRecordApplicationService {
|
||||
public Boolean inventoryFrozenForAll(InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) {
|
||||
return inventoryAdjustmentRecordDomainService.inventoryFrozenForAll(inventoryAdjustmentRecordDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
+276
-5
@@ -5,11 +5,13 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.system.api.domain.WarehouseFeignPO;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
|
||||
@@ -20,14 +22,18 @@ import com.mhd.wms.domain.investigationManage.service.InvestigationManageDomainS
|
||||
import com.mhd.wms.domain.investigetionManageDetail.repository.po.InvestigetionManageDetailPO;
|
||||
import com.mhd.wms.domain.investigetionManageDetail.repository.todo.InvestigetionManageDetailDO;
|
||||
import com.mhd.wms.domain.investigetionManageDetail.service.InvestigetionManageDetailDomainService;
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -48,6 +54,8 @@ public class InvestigationManageApplicationService {
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@Autowired
|
||||
private MaterialInventoryMapper materialInventoryMapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -94,10 +102,273 @@ public class InvestigationManageApplicationService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取盘点管理详细信息
|
||||
* 获取盘点管理详细信息(带批次属性)
|
||||
*/
|
||||
public InvestigationManagePO getInfo(Long investigationManageId) {
|
||||
return investigationManageDomainService.getInfo(investigationManageId);
|
||||
InvestigationManagePO investigationManagePO = investigationManageDomainService.getInfo(investigationManageId);
|
||||
|
||||
if (investigationManagePO == null || CollectionUtils.isEmpty(investigationManagePO.getInvestigetionManageDetailList())) {
|
||||
return investigationManagePO;
|
||||
}
|
||||
|
||||
List<InvestigetionManageDetailPO> detailList = investigationManagePO.getInvestigetionManageDetailList();
|
||||
|
||||
// 性能优化:批量获取批次属性,避免N+1查询问题
|
||||
// 1. 收集所有唯一的materialBaseInfoId
|
||||
Set<Long> materialBaseInfoIdSet = detailList.stream()
|
||||
.map(InvestigetionManageDetailPO::getMaterialBaseInfoId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId)
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
|
||||
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
|
||||
try {
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
// 过滤isDisplay=1的属性
|
||||
List<BatchDetailFeignPO> filteredList = batchDetailFeignPOList.stream()
|
||||
.filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1)
|
||||
.collect(Collectors.toList());
|
||||
batchDetailMap.put(materialBaseInfoId, filteredList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 为每个物料明细设置更多属性(从库存表中获取值)
|
||||
setMaterialMoreDetailListFromInventory(detailList, batchDetailMap);
|
||||
|
||||
return investigationManagePO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为盘点物料明细设置更多属性(从库存表中获取值)
|
||||
* @param investigetionManageDetailPOList 盘点物料明细列表
|
||||
* @param batchDetailMap 批次属性Map
|
||||
*/
|
||||
private void setMaterialMoreDetailListFromInventory(List<InvestigetionManageDetailPO> investigetionManageDetailPOList,
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap) {
|
||||
if (CollectionUtils.isEmpty(investigetionManageDetailPOList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
investigetionManageDetailPOList.forEach(investigetionManageDetailPO -> {
|
||||
Long materialBaseInfoId = investigetionManageDetailPO.getMaterialBaseInfoId();
|
||||
Long materialInventoryId = investigetionManageDetailPO.getMaterialInventoryId();
|
||||
|
||||
// 创建新的materialMoreDetailList,只包含isDisplay=1的属性
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList = new ArrayList<>();
|
||||
|
||||
// 从库存表获取数据(包含批次属性字段)
|
||||
MaterialInventoryPO materialInventoryPO = null;
|
||||
if (materialInventoryId != null) {
|
||||
materialInventoryPO = materialInventoryMapper.selectByIdWithBatchAttributes(materialInventoryId);
|
||||
}
|
||||
|
||||
if (materialBaseInfoId != null && batchDetailMap.containsKey(materialBaseInfoId)) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = batchDetailMap.get(materialBaseInfoId);
|
||||
// 用于跟踪已添加到列表中的batchDetailId
|
||||
Set<Long> addedBatchDetailIds = new HashSet<>();
|
||||
|
||||
for (BatchDetailFeignPO batchDetailFeignPO : batchDetailFeignPOList) {
|
||||
MaterialMoreDetailPO materialMoreDetailPO = new MaterialMoreDetailPO();
|
||||
materialMoreDetailPO.setBatchId(batchDetailFeignPO.getBatchId());
|
||||
materialMoreDetailPO.setBatchDetailId(batchDetailFeignPO.getBatchDetailId());
|
||||
materialMoreDetailPO.setBatchLabels(batchDetailFeignPO.getBatchLabels());
|
||||
materialMoreDetailPO.setInputControl(batchDetailFeignPO.getInputControl());
|
||||
materialMoreDetailPO.setAttributeFormat(batchDetailFeignPO.getAttributeFormat());
|
||||
materialMoreDetailPO.setAttributeOption(batchDetailFeignPO.getAttributeOption());
|
||||
materialMoreDetailPO.setRemark(batchDetailFeignPO.getRemark());
|
||||
|
||||
// 确保添加到列表中(使用batchDetailId来避免重复)
|
||||
Long batchDetailId = batchDetailFeignPO.getBatchDetailId();
|
||||
if (batchDetailId != null && !addedBatchDetailIds.contains(batchDetailId)) {
|
||||
materialMoreDetailList.add(materialMoreDetailPO);
|
||||
addedBatchDetailIds.add(batchDetailId);
|
||||
}
|
||||
|
||||
// 根据fieldName或batchLabels从库存表中获取对应的字段值
|
||||
if (materialInventoryPO != null) {
|
||||
String fieldValue = null;
|
||||
String usedFieldName = null;
|
||||
// 优先使用fieldName(如果存在)
|
||||
if (StringUtils.isNotBlank(batchDetailFeignPO.getFieldName())) {
|
||||
usedFieldName = batchDetailFeignPO.getFieldName();
|
||||
fieldValue = getFieldValueByFieldName(materialInventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, fieldName={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), usedFieldName, fieldValue);
|
||||
}
|
||||
// 如果fieldName为空,尝试根据batchLabels映射到字段名
|
||||
else if (StringUtils.isNotBlank(batchDetailFeignPO.getBatchLabels())) {
|
||||
String fieldNameByLabel = getFieldNameByBatchLabel(batchDetailFeignPO.getBatchLabels());
|
||||
if (StringUtils.isNotBlank(fieldNameByLabel)) {
|
||||
usedFieldName = fieldNameByLabel;
|
||||
fieldValue = getFieldValueByFieldName(materialInventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, batchLabels={}, 映射字段名={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), batchDetailFeignPO.getBatchLabels(),
|
||||
usedFieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
// 只有当获取到值时才更新attributeValue
|
||||
if (fieldValue != null) {
|
||||
materialMoreDetailPO.setAttributeValue(fieldValue);
|
||||
log.info("设置更多属性:batchDetailId={}, batchLabels={}, attributeValue={}",
|
||||
materialMoreDetailPO.getBatchDetailId(), materialMoreDetailPO.getBatchLabels(),
|
||||
materialMoreDetailPO.getAttributeValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
investigetionManageDetailPO.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
log.info("盘点物料明细 investigationManageDetailId={}, materialBaseInfoId={}, materialInventoryId={}, materialMoreDetailList大小={}",
|
||||
investigetionManageDetailPO.getInvestigationManageDetailId(), investigetionManageDetailPO.getMaterialBaseInfoId(),
|
||||
investigetionManageDetailPO.getMaterialInventoryId(),
|
||||
materialMoreDetailList != null ? materialMoreDetailList.size() : 0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据批次标签(batchLabels)映射到字段名
|
||||
* @param batchLabel 批次标签
|
||||
* @return 字段名,如果找不到映射则返回null
|
||||
*/
|
||||
private String getFieldNameByBatchLabel(String batchLabel) {
|
||||
if (StringUtils.isBlank(batchLabel)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 批次标签到字段名的映射关系
|
||||
Map<String, String> labelToFieldNameMap = new HashMap<>();
|
||||
labelToFieldNameMap.put("Invoice No.", "invoiceNo");
|
||||
labelToFieldNameMap.put("Invoice No", "invoiceNo");
|
||||
labelToFieldNameMap.put("发票号", "invoiceNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO's", "batchRefNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO", "batchRefNo");
|
||||
labelToFieldNameMap.put("批次参考号", "batchRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO's", "sheetRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO", "sheetRefNo");
|
||||
labelToFieldNameMap.put("单据参考号", "sheetRefNo");
|
||||
labelToFieldNameMap.put("箱号/卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("箱号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("生产日期", "productionDate");
|
||||
labelToFieldNameMap.put("过期日期", "expiryDate");
|
||||
labelToFieldNameMap.put("存货日期", "inventoryDate");
|
||||
labelToFieldNameMap.put("扩展字段1", "extAttr1");
|
||||
labelToFieldNameMap.put("扩展字段2", "extAttr2");
|
||||
labelToFieldNameMap.put("扩展字段3", "extAttr3");
|
||||
labelToFieldNameMap.put("扩展字段4", "extAttr4");
|
||||
|
||||
// 精确匹配
|
||||
String fieldName = labelToFieldNameMap.get(batchLabel.trim());
|
||||
if (StringUtils.isNotBlank(fieldName)) {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
// 模糊匹配(包含关系)
|
||||
for (Map.Entry<String, String> entry : labelToFieldNameMap.entrySet()) {
|
||||
if (batchLabel.contains(entry.getKey()) || entry.getKey().contains(batchLabel)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字段名从对象中获取字段值(使用反射)
|
||||
* @param obj 对象
|
||||
* @param fieldName 字段名
|
||||
* @return 字段值(转换为字符串)
|
||||
*/
|
||||
private String getFieldValueByFieldName(Object obj, String fieldName) {
|
||||
if (obj == null || StringUtils.isBlank(fieldName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 兼容:如果传的是下划线命名(数据库列名风格),先转成驼峰字段名再取
|
||||
String normalizedFieldName = fieldName;
|
||||
if (normalizedFieldName.contains("_")) {
|
||||
normalizedFieldName = snakeToCamel(normalizedFieldName);
|
||||
}
|
||||
|
||||
// 获取对象的Class
|
||||
Class<?> clazz = obj.getClass();
|
||||
|
||||
// 尝试获取字段(包括父类字段)
|
||||
Field field = null;
|
||||
Class<?> currentClass = clazz;
|
||||
while (currentClass != null && field == null) {
|
||||
try {
|
||||
field = currentClass.getDeclaredField(normalizedFieldName);
|
||||
} catch (NoSuchFieldException e) {
|
||||
currentClass = currentClass.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
if (field == null) {
|
||||
log.warn("字段不存在:{}(normalized:{}),对象类型:{}", fieldName, normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
// 设置可访问
|
||||
field.setAccessible(true);
|
||||
|
||||
// 获取字段值
|
||||
Object value = field.get(obj);
|
||||
|
||||
// 转换为字符串
|
||||
if (value == null) {
|
||||
log.info("字段 {} 的值为 null,对象类型:{}", normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
String result;
|
||||
// 处理日期类型字段
|
||||
if (value instanceof Date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
result = sdf.format((Date) value);
|
||||
} else {
|
||||
result = value.toString();
|
||||
}
|
||||
|
||||
log.info("通过反射获取字段值成功,字段名:{}(原始:{}),值:{},对象类型:{}",
|
||||
normalizedFieldName, fieldName, result, clazz.getName());
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.warn("通过反射获取字段值失败,字段名:{},对象类型:{},错误:{}", fieldName, obj.getClass().getName(), e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String snakeToCamel(String snake) {
|
||||
if (StringUtils.isBlank(snake)) {
|
||||
return null;
|
||||
}
|
||||
String s = snake.trim().toLowerCase();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean upperNext = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == '_') {
|
||||
upperNext = true;
|
||||
continue;
|
||||
}
|
||||
if (upperNext) {
|
||||
sb.append(Character.toUpperCase(c));
|
||||
upperNext = false;
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+38
-1
@@ -1,5 +1,6 @@
|
||||
package com.mhd.wms.application.service.materialBaseInfo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.materialBarCode.service.MaterialBarCodeDomainService;
|
||||
@@ -8,17 +9,24 @@ import com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.service.MaterialBaseInfoDomainService;
|
||||
import com.mhd.wms.domain.materialCommon.repository.todo.MaterialCommonDO;
|
||||
import com.mhd.wms.domain.materialCommon.service.MaterialCommonDomainService;
|
||||
import com.mhd.wms.domain.materialGoodsRule.entity.MaterialGoodsRule;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.mapper.MaterialGoodsRuleMapper;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.po.MaterialGoodsRulePO;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.todo.MaterialGoodsRuleDO;
|
||||
import com.mhd.wms.domain.materialGoodsRule.service.MaterialGoodsRuleDomainService;
|
||||
import com.mhd.wms.domain.materialInventoryWarning.service.MaterialInventoryWarningDomainService;
|
||||
import com.mhd.wms.domain.materialWarehouseControl.repository.todo.MaterialWarehouseControlDO;
|
||||
import com.mhd.wms.domain.materialWarehouseControl.service.MaterialWarehouseControlDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 物料基础信息ApplicationService
|
||||
@@ -42,6 +50,8 @@ public class MaterialBaseInfoApplicationService {
|
||||
@Autowired
|
||||
private MaterialBarCodeDomainService materialBarCodeDomainService;
|
||||
|
||||
@Autowired
|
||||
private MaterialGoodsRuleMapper materialGoodsRuleMapper;
|
||||
|
||||
/**
|
||||
* 分页查询物料基础信息列表
|
||||
@@ -55,7 +65,34 @@ public class MaterialBaseInfoApplicationService {
|
||||
materialBaseInfoDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
return materialBaseInfoDomainService.queryList(materialBaseInfoDO);
|
||||
List<MaterialBaseInfoPO> materialBaseInfoPOS = materialBaseInfoDomainService.queryList(materialBaseInfoDO);
|
||||
for (MaterialBaseInfoPO materialBaseInfoPO : materialBaseInfoPOS) {
|
||||
//物料商品规则
|
||||
MaterialGoodsRule materialGoodsRules = materialGoodsRuleMapper.selectOne(new LambdaQueryWrapper<MaterialGoodsRule>()
|
||||
.eq(MaterialGoodsRule::getMaterialBaseInfoId, materialBaseInfoPO.getMaterialBaseInfoId())
|
||||
.eq(MaterialGoodsRule::getDelFlag, 1));
|
||||
if (materialGoodsRules != null){
|
||||
MaterialGoodsRulePO materialGoodsRulePO = new MaterialGoodsRulePO();
|
||||
BeanUtils.copyProperties(materialGoodsRules,materialGoodsRulePO);
|
||||
materialBaseInfoPO.setMaterialGoodsRule(materialGoodsRulePO);
|
||||
}
|
||||
// 将物料分类的List转换为逗号分隔的字符串,用于导出
|
||||
if (!CollectionUtils.isEmpty(materialBaseInfoPO.getMaterialClassifyCode())) {
|
||||
materialBaseInfoPO.setMaterialClassifyCodeStr(
|
||||
materialBaseInfoPO.getMaterialClassifyCode().stream()
|
||||
.filter(code -> !StringUtils.isEmpty(code))
|
||||
.collect(Collectors.joining(","))
|
||||
);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(materialBaseInfoPO.getMaterialClassifyName())) {
|
||||
materialBaseInfoPO.setMaterialClassifyNameStr(
|
||||
materialBaseInfoPO.getMaterialClassifyName().stream()
|
||||
.filter(name -> !StringUtils.isEmpty(name))
|
||||
.collect(Collectors.joining(","))
|
||||
);
|
||||
}
|
||||
}
|
||||
return materialBaseInfoPOS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+284
-1
@@ -1,21 +1,32 @@
|
||||
package com.mhd.wms.application.service.materialInventory;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryQueryListDO;
|
||||
import com.mhd.wms.domain.materialInventory.service.MaterialInventoryDomainService;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 物料库存ApplicationService
|
||||
@@ -28,6 +39,10 @@ import java.util.List;
|
||||
public class MaterialInventoryApplicationService {
|
||||
@Autowired
|
||||
private MaterialInventoryDomainService materialInventoryDomainService;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@Autowired
|
||||
private MaterialInventoryMapper materialInventoryMapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,6 +62,274 @@ public class MaterialInventoryApplicationService {
|
||||
return materialInventoryDomainService.queryList(materialInventoryDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物料库存列表(带批次属性)
|
||||
* 批次属性值从库存表中获取
|
||||
*/
|
||||
public List<MaterialInventoryPO> queryListWithBatchAttributes(MaterialInventoryDO materialInventoryDO) {
|
||||
List<MaterialInventoryPO> list = queryList(materialInventoryDO);
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
// 性能优化:批量获取批次属性,避免N+1查询问题
|
||||
// 1. 收集所有唯一的materialBaseInfoId
|
||||
Set<Long> materialBaseInfoIdSet = list.stream()
|
||||
.map(MaterialInventoryPO::getMaterialBaseInfoId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId)
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
|
||||
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
|
||||
try {
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
// 过滤isDisplay=1的属性
|
||||
List<BatchDetailFeignPO> filteredList = batchDetailFeignPOList.stream()
|
||||
.filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1)
|
||||
.collect(Collectors.toList());
|
||||
batchDetailMap.put(materialBaseInfoId, filteredList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 为每个物料库存设置更多属性(从库存表中获取值)
|
||||
setMaterialMoreDetailListFromInventory(list, batchDetailMap);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为物料库存设置更多属性(从库存表中获取值)
|
||||
* @param materialInventoryPOList 物料库存列表
|
||||
* @param batchDetailMap 批次属性Map
|
||||
*/
|
||||
private void setMaterialMoreDetailListFromInventory(List<MaterialInventoryPO> materialInventoryPOList,
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap) {
|
||||
if (CollectionUtils.isEmpty(materialInventoryPOList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
materialInventoryPOList.forEach(materialInventoryPO -> {
|
||||
Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId();
|
||||
Long materialInventoryId = materialInventoryPO.getMaterialInventoryId();
|
||||
|
||||
// 创建新的materialMoreDetailList,只包含isDisplay=1的属性
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList = new ArrayList<>();
|
||||
|
||||
// 从库存表获取数据(包含批次属性字段)
|
||||
MaterialInventoryPO inventoryPO = null;
|
||||
if (materialInventoryId != null) {
|
||||
inventoryPO = materialInventoryMapper.selectByIdWithBatchAttributes(materialInventoryId);
|
||||
}
|
||||
|
||||
if (materialBaseInfoId != null && batchDetailMap.containsKey(materialBaseInfoId)) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = batchDetailMap.get(materialBaseInfoId);
|
||||
// 用于跟踪已添加到列表中的batchDetailId
|
||||
Set<Long> addedBatchDetailIds = new HashSet<>();
|
||||
|
||||
for (BatchDetailFeignPO batchDetailFeignPO : batchDetailFeignPOList) {
|
||||
MaterialMoreDetailPO materialMoreDetailPO = new MaterialMoreDetailPO();
|
||||
materialMoreDetailPO.setBatchId(batchDetailFeignPO.getBatchId());
|
||||
materialMoreDetailPO.setBatchDetailId(batchDetailFeignPO.getBatchDetailId());
|
||||
materialMoreDetailPO.setBatchLabels(batchDetailFeignPO.getBatchLabels());
|
||||
materialMoreDetailPO.setInputControl(batchDetailFeignPO.getInputControl());
|
||||
materialMoreDetailPO.setAttributeFormat(batchDetailFeignPO.getAttributeFormat());
|
||||
materialMoreDetailPO.setAttributeOption(batchDetailFeignPO.getAttributeOption());
|
||||
materialMoreDetailPO.setRemark(batchDetailFeignPO.getRemark());
|
||||
|
||||
// 确保添加到列表中(使用batchDetailId来避免重复)
|
||||
Long batchDetailId = batchDetailFeignPO.getBatchDetailId();
|
||||
if (batchDetailId != null && !addedBatchDetailIds.contains(batchDetailId)) {
|
||||
materialMoreDetailList.add(materialMoreDetailPO);
|
||||
addedBatchDetailIds.add(batchDetailId);
|
||||
}
|
||||
|
||||
// 根据fieldName或batchLabels从库存表中获取对应的字段值
|
||||
if (inventoryPO != null) {
|
||||
String fieldValue = null;
|
||||
String usedFieldName = null;
|
||||
// 优先使用fieldName(如果存在)
|
||||
if (StringUtils.isNotBlank(batchDetailFeignPO.getFieldName())) {
|
||||
usedFieldName = batchDetailFeignPO.getFieldName();
|
||||
fieldValue = getFieldValueByFieldName(inventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, fieldName={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), usedFieldName, fieldValue);
|
||||
}
|
||||
// 如果fieldName为空,尝试根据batchLabels映射到字段名
|
||||
else if (StringUtils.isNotBlank(batchDetailFeignPO.getBatchLabels())) {
|
||||
String fieldNameByLabel = getFieldNameByBatchLabel(batchDetailFeignPO.getBatchLabels());
|
||||
if (StringUtils.isNotBlank(fieldNameByLabel)) {
|
||||
usedFieldName = fieldNameByLabel;
|
||||
fieldValue = getFieldValueByFieldName(inventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, batchLabels={}, 映射字段名={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), batchDetailFeignPO.getBatchLabels(),
|
||||
usedFieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
// 只有当获取到值时才更新attributeValue
|
||||
if (fieldValue != null) {
|
||||
materialMoreDetailPO.setAttributeValue(fieldValue);
|
||||
log.info("设置更多属性:batchDetailId={}, batchLabels={}, attributeValue={}",
|
||||
materialMoreDetailPO.getBatchDetailId(), materialMoreDetailPO.getBatchLabels(),
|
||||
materialMoreDetailPO.getAttributeValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
materialInventoryPO.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
log.info("物料库存 materialInventoryId={}, materialBaseInfoId={}, materialMoreDetailList大小={}",
|
||||
materialInventoryPO.getMaterialInventoryId(), materialInventoryPO.getMaterialBaseInfoId(),
|
||||
materialMoreDetailList != null ? materialMoreDetailList.size() : 0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据批次标签(batchLabels)映射到字段名
|
||||
* @param batchLabel 批次标签
|
||||
* @return 字段名,如果找不到映射则返回null
|
||||
*/
|
||||
private String getFieldNameByBatchLabel(String batchLabel) {
|
||||
if (StringUtils.isBlank(batchLabel)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 批次标签到字段名的映射关系
|
||||
Map<String, String> labelToFieldNameMap = new HashMap<>();
|
||||
labelToFieldNameMap.put("Invoice No.", "invoiceNo");
|
||||
labelToFieldNameMap.put("Invoice No", "invoiceNo");
|
||||
labelToFieldNameMap.put("发票号", "invoiceNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO's", "batchRefNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO", "batchRefNo");
|
||||
labelToFieldNameMap.put("批次参考号", "batchRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO's", "sheetRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO", "sheetRefNo");
|
||||
labelToFieldNameMap.put("单据参考号", "sheetRefNo");
|
||||
labelToFieldNameMap.put("箱号/卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("箱号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("生产日期", "productionDate");
|
||||
labelToFieldNameMap.put("过期日期", "expiryDate");
|
||||
labelToFieldNameMap.put("存货日期", "inventoryDate");
|
||||
labelToFieldNameMap.put("扩展字段1", "extAttr1");
|
||||
labelToFieldNameMap.put("扩展字段2", "extAttr2");
|
||||
labelToFieldNameMap.put("扩展字段3", "extAttr3");
|
||||
labelToFieldNameMap.put("扩展字段4", "extAttr4");
|
||||
|
||||
// 精确匹配
|
||||
String fieldName = labelToFieldNameMap.get(batchLabel.trim());
|
||||
if (StringUtils.isNotBlank(fieldName)) {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
// 模糊匹配(包含关系)
|
||||
for (Map.Entry<String, String> entry : labelToFieldNameMap.entrySet()) {
|
||||
if (batchLabel.contains(entry.getKey()) || entry.getKey().contains(batchLabel)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字段名从对象中获取字段值(使用反射)
|
||||
* @param obj 对象
|
||||
* @param fieldName 字段名
|
||||
* @return 字段值(转换为字符串)
|
||||
*/
|
||||
private String getFieldValueByFieldName(Object obj, String fieldName) {
|
||||
if (obj == null || StringUtils.isBlank(fieldName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 兼容:如果传的是下划线命名(数据库列名风格),先转成驼峰字段名再取
|
||||
String normalizedFieldName = fieldName;
|
||||
if (normalizedFieldName.contains("_")) {
|
||||
normalizedFieldName = snakeToCamel(normalizedFieldName);
|
||||
}
|
||||
|
||||
// 获取对象的Class
|
||||
Class<?> clazz = obj.getClass();
|
||||
|
||||
// 尝试获取字段(包括父类字段)
|
||||
Field field = null;
|
||||
Class<?> currentClass = clazz;
|
||||
while (currentClass != null && field == null) {
|
||||
try {
|
||||
field = currentClass.getDeclaredField(normalizedFieldName);
|
||||
} catch (NoSuchFieldException e) {
|
||||
currentClass = currentClass.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
if (field == null) {
|
||||
log.warn("字段不存在:{}(normalized:{}),对象类型:{}", fieldName, normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
// 设置可访问
|
||||
field.setAccessible(true);
|
||||
|
||||
// 获取字段值
|
||||
Object value = field.get(obj);
|
||||
|
||||
// 转换为字符串
|
||||
if (value == null) {
|
||||
log.info("字段 {} 的值为 null,对象类型:{}", normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
String result;
|
||||
// 处理日期类型字段
|
||||
if (value instanceof Date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
result = sdf.format((Date) value);
|
||||
} else {
|
||||
result = value.toString();
|
||||
}
|
||||
|
||||
log.info("通过反射获取字段值成功,字段名:{}(原始:{}),值:{},对象类型:{}",
|
||||
normalizedFieldName, fieldName, result, clazz.getName());
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.warn("通过反射获取字段值失败,字段名:{},对象类型:{},错误:{}", fieldName, obj.getClass().getName(), e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String snakeToCamel(String snake) {
|
||||
if (StringUtils.isBlank(snake)) {
|
||||
return null;
|
||||
}
|
||||
String s = snake.trim().toLowerCase();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean upperNext = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == '_') {
|
||||
upperNext = true;
|
||||
continue;
|
||||
}
|
||||
if (upperNext) {
|
||||
sb.append(Character.toUpperCase(c));
|
||||
upperNext = false;
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public BigDecimal sumInventoryQuantity(MaterialInventoryDO materialInventoryDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
|
||||
+3
@@ -139,6 +139,9 @@ public class NoticeOrderApplicationService {
|
||||
* @param noticeOrderDO
|
||||
*/
|
||||
private void setWarehouseInfo(NoticeOrderDO noticeOrderDO) {
|
||||
if (noticeOrderDO.getWarehouseId() == null) {
|
||||
throw new ServiceException("仓库ID不能为空");
|
||||
}
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(noticeOrderDO.getWarehouseId());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
|
||||
+341
-5
@@ -6,15 +6,18 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.system.api.domain.StorageLocationFeignPO;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
|
||||
import com.mhd.wms.domain.pickingMaterialDetail.repository.po.PickingMaterialDetailPO;
|
||||
import com.mhd.wms.domain.pickingMaterialDetail.repository.todo.PickingMaterialDetailDO;
|
||||
import com.mhd.wms.domain.pickingMaterialDetail.service.PickingMaterialDetailDomainService;
|
||||
@@ -26,10 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -66,7 +69,52 @@ public class PickingOrderApplicationService {
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
pickingOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
return pickingOrderDomainService.queryList(pickingOrderDO);
|
||||
List<PickingOrderPO> pickingOrderPOList = pickingOrderDomainService.queryList(pickingOrderDO);
|
||||
|
||||
// 重新计算物料种类数:按料号去重,一个料号算一种物料
|
||||
if (!CollectionUtils.isEmpty(pickingOrderPOList)) {
|
||||
// 收集所有拣货单号
|
||||
List<String> pickingOrderNumbers = pickingOrderPOList.stream()
|
||||
.map(PickingOrderPO::getPickingOrderNumber)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(number -> !number.trim().isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!pickingOrderNumbers.isEmpty()) {
|
||||
// 批量查询所有拣货单的物料明细(循环查询每个拣货单的物料明细)
|
||||
Map<String, List<PickingMaterialDetailPO>> materialDetailsByOrderNumber = new HashMap<>();
|
||||
for (String pickingOrderNumber : pickingOrderNumbers) {
|
||||
PickingMaterialDetailDO pickingMaterialDetailDO = new PickingMaterialDetailDO();
|
||||
pickingMaterialDetailDO.setPickingOrderNumber(pickingOrderNumber);
|
||||
List<PickingMaterialDetailPO> materialDetails = pickingMaterialDetailDomainService.queryList(pickingMaterialDetailDO);
|
||||
if (!CollectionUtils.isEmpty(materialDetails)) {
|
||||
materialDetailsByOrderNumber.put(pickingOrderNumber, materialDetails);
|
||||
}
|
||||
}
|
||||
|
||||
// 为每个拣货单计算物料种类数(按料号去重)
|
||||
for (PickingOrderPO pickingOrderPO : pickingOrderPOList) {
|
||||
String pickingOrderNumber = pickingOrderPO.getPickingOrderNumber();
|
||||
if (pickingOrderNumber != null && materialDetailsByOrderNumber.containsKey(pickingOrderNumber)) {
|
||||
List<PickingMaterialDetailPO> materialDetails = materialDetailsByOrderNumber.get(pickingOrderNumber);
|
||||
// 按料号去重,计算物料种类数
|
||||
long materialQuantity = materialDetails.stream()
|
||||
.map(PickingMaterialDetailPO::getMaterialCode)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(code -> !code.trim().isEmpty())
|
||||
.distinct()
|
||||
.count();
|
||||
pickingOrderPO.setMaterialQuantity((int) materialQuantity);
|
||||
log.debug("重新计算物料种类数 - 拣货单号: {}, 物料种类数: {}", pickingOrderNumber, materialQuantity);
|
||||
} else {
|
||||
// 如果没有物料明细,物料种类数为0
|
||||
pickingOrderPO.setMaterialQuantity(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pickingOrderPOList;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +144,295 @@ public class PickingOrderApplicationService {
|
||||
* 获取拣货单详细信息
|
||||
*/
|
||||
public PickingOrderPO getInfoByIdAndType(Long pickingOrderId, Integer type) {
|
||||
return pickingOrderDomainService.getInfoByIdAndType(pickingOrderId, type);
|
||||
PickingOrderPO pickingOrderPO = pickingOrderDomainService.getInfoByIdAndType(pickingOrderId, type);
|
||||
List<PickingMaterialDetailPO> pickingMaterialDetailPOList = pickingOrderPO.getMaterialDetailList();
|
||||
|
||||
if (CollectionUtils.isEmpty(pickingMaterialDetailPOList)) {
|
||||
return pickingOrderPO;
|
||||
}
|
||||
|
||||
// 性能优化:批量获取批次属性,避免N+1查询问题
|
||||
// 1. 收集所有唯一的materialBaseInfoId
|
||||
Set<Long> materialBaseInfoIdSet = pickingMaterialDetailPOList.stream()
|
||||
.map(PickingMaterialDetailPO::getMaterialBaseInfoId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId)
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
|
||||
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
|
||||
try {
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
// 过滤isDisplay=1的属性
|
||||
List<BatchDetailFeignPO> filteredList = batchDetailFeignPOList.stream()
|
||||
.filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1)
|
||||
.collect(Collectors.toList());
|
||||
batchDetailMap.put(materialBaseInfoId, filteredList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 为每个物料明细设置更多属性(从物料明细中获取值),递归处理所有层级
|
||||
setMaterialMoreDetailListRecursively(pickingMaterialDetailPOList, batchDetailMap);
|
||||
|
||||
pickingOrderPO.setMaterialDetailList(pickingMaterialDetailPOList);
|
||||
log.info("返回拣货单信息,pickingOrderId={}, materialDetailList大小={}",
|
||||
pickingOrderPO.getPickingOrderId(),
|
||||
pickingMaterialDetailPOList != null ? pickingMaterialDetailPOList.size() : 0);
|
||||
return pickingOrderPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归为物料明细设置更多属性
|
||||
* @param pickingMaterialDetailPOList 物料明细列表
|
||||
* @param batchDetailMap 批次属性Map
|
||||
*/
|
||||
private void setMaterialMoreDetailListRecursively(List<PickingMaterialDetailPO> pickingMaterialDetailPOList,
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap) {
|
||||
if (CollectionUtils.isEmpty(pickingMaterialDetailPOList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
pickingMaterialDetailPOList.forEach(pickingMaterialDetailPO -> {
|
||||
Long materialBaseInfoId = pickingMaterialDetailPO.getMaterialBaseInfoId();
|
||||
|
||||
// 只保留isDisplay=1的批次属性(从batchDetailMap中获取,已经过滤过了)
|
||||
// 创建新的materialMoreDetailList,只包含isDisplay=1的属性
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList = new ArrayList<>();
|
||||
|
||||
// 创建batchDetailId到MaterialMoreDetailPO的映射,用于快速查找已有的属性值
|
||||
Map<Long, MaterialMoreDetailPO> batchDetailIdToMaterialMoreDetailMap = new HashMap<>();
|
||||
List<MaterialMoreDetailPO> existingList = pickingMaterialDetailPO.getMaterialMoreDetailList();
|
||||
if (!CollectionUtils.isEmpty(existingList)) {
|
||||
for (MaterialMoreDetailPO existing : existingList) {
|
||||
if (existing.getBatchDetailId() != null) {
|
||||
batchDetailIdToMaterialMoreDetailMap.put(existing.getBatchDetailId(), existing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (materialBaseInfoId != null && batchDetailMap.containsKey(materialBaseInfoId)) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = batchDetailMap.get(materialBaseInfoId);
|
||||
// 用于跟踪已添加到列表中的batchDetailId
|
||||
Set<Long> addedBatchDetailIds = new HashSet<>();
|
||||
|
||||
for (BatchDetailFeignPO batchDetailFeignPO : batchDetailFeignPOList) {
|
||||
MaterialMoreDetailPO materialMoreDetailPO = batchDetailIdToMaterialMoreDetailMap.get(batchDetailFeignPO.getBatchDetailId());
|
||||
|
||||
// 如果不存在,创建新的
|
||||
if (materialMoreDetailPO == null) {
|
||||
materialMoreDetailPO = new MaterialMoreDetailPO();
|
||||
materialMoreDetailPO.setBatchId(batchDetailFeignPO.getBatchId());
|
||||
materialMoreDetailPO.setBatchDetailId(batchDetailFeignPO.getBatchDetailId());
|
||||
materialMoreDetailPO.setBatchLabels(batchDetailFeignPO.getBatchLabels());
|
||||
materialMoreDetailPO.setInputControl(batchDetailFeignPO.getInputControl());
|
||||
materialMoreDetailPO.setAttributeFormat(batchDetailFeignPO.getAttributeFormat());
|
||||
materialMoreDetailPO.setAttributeOption(batchDetailFeignPO.getAttributeOption());
|
||||
materialMoreDetailPO.setRemark(batchDetailFeignPO.getRemark());
|
||||
} else {
|
||||
// 如果已存在,更新属性(保留已有的attributeValue)
|
||||
materialMoreDetailPO.setBatchId(batchDetailFeignPO.getBatchId());
|
||||
materialMoreDetailPO.setBatchLabels(batchDetailFeignPO.getBatchLabels());
|
||||
materialMoreDetailPO.setInputControl(batchDetailFeignPO.getInputControl());
|
||||
materialMoreDetailPO.setAttributeFormat(batchDetailFeignPO.getAttributeFormat());
|
||||
materialMoreDetailPO.setAttributeOption(batchDetailFeignPO.getAttributeOption());
|
||||
materialMoreDetailPO.setRemark(batchDetailFeignPO.getRemark());
|
||||
}
|
||||
|
||||
// 确保添加到列表中(使用batchDetailId来避免重复)
|
||||
Long batchDetailId = batchDetailFeignPO.getBatchDetailId();
|
||||
if (batchDetailId != null && !addedBatchDetailIds.contains(batchDetailId)) {
|
||||
materialMoreDetailList.add(materialMoreDetailPO);
|
||||
addedBatchDetailIds.add(batchDetailId);
|
||||
}
|
||||
|
||||
// 根据fieldName或batchLabels从物料明细中获取对应的字段值
|
||||
if (pickingMaterialDetailPO != null) {
|
||||
String fieldValue = null;
|
||||
String usedFieldName = null;
|
||||
// 优先使用fieldName(如果存在)
|
||||
if (StringUtils.isNotBlank(batchDetailFeignPO.getFieldName())) {
|
||||
usedFieldName = batchDetailFeignPO.getFieldName();
|
||||
fieldValue = getFieldValueByFieldName(pickingMaterialDetailPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, fieldName={}, 获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), usedFieldName, fieldValue);
|
||||
}
|
||||
// 如果fieldName为空,尝试根据batchLabels映射到字段名
|
||||
else if (StringUtils.isNotBlank(batchDetailFeignPO.getBatchLabels())) {
|
||||
String fieldNameByLabel = getFieldNameByBatchLabel(batchDetailFeignPO.getBatchLabels());
|
||||
if (StringUtils.isNotBlank(fieldNameByLabel)) {
|
||||
usedFieldName = fieldNameByLabel;
|
||||
fieldValue = getFieldValueByFieldName(pickingMaterialDetailPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, batchLabels={}, 映射字段名={}, 获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), batchDetailFeignPO.getBatchLabels(),
|
||||
usedFieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
// 只有当获取到值时才更新attributeValue(避免覆盖已有的值)
|
||||
if (fieldValue != null) {
|
||||
materialMoreDetailPO.setAttributeValue(fieldValue);
|
||||
log.info("设置更多属性:batchDetailId={}, batchLabels={}, attributeValue={}",
|
||||
materialMoreDetailPO.getBatchDetailId(), materialMoreDetailPO.getBatchLabels(),
|
||||
materialMoreDetailPO.getAttributeValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pickingMaterialDetailPO.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
log.info("物料明细 uniqueId={}, materialBaseInfoId={}, materialMoreDetailList大小={}",
|
||||
pickingMaterialDetailPO.getUniqueId(), pickingMaterialDetailPO.getMaterialBaseInfoId(),
|
||||
materialMoreDetailList != null ? materialMoreDetailList.size() : 0);
|
||||
|
||||
// 递归处理子级
|
||||
if (!CollectionUtils.isEmpty(pickingMaterialDetailPO.getChildren())) {
|
||||
setMaterialMoreDetailListRecursively(pickingMaterialDetailPO.getChildren(), batchDetailMap);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据批次标签(batchLabels)映射到字段名
|
||||
* @param batchLabel 批次标签
|
||||
* @return 字段名,如果找不到映射则返回null
|
||||
*/
|
||||
private String getFieldNameByBatchLabel(String batchLabel) {
|
||||
if (StringUtils.isBlank(batchLabel)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 批次标签到字段名的映射关系
|
||||
Map<String, String> labelToFieldNameMap = new HashMap<>();
|
||||
labelToFieldNameMap.put("Invoice No.", "invoiceNo");
|
||||
labelToFieldNameMap.put("Invoice No", "invoiceNo");
|
||||
labelToFieldNameMap.put("发票号", "invoiceNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO's", "batchRefNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO", "batchRefNo");
|
||||
labelToFieldNameMap.put("批次参考号", "batchRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO's", "sheetRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO", "sheetRefNo");
|
||||
labelToFieldNameMap.put("单据参考号", "sheetRefNo");
|
||||
labelToFieldNameMap.put("箱号/卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("箱号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("生产日期", "productionDate");
|
||||
labelToFieldNameMap.put("过期日期", "expiryDate");
|
||||
labelToFieldNameMap.put("存货日期", "inventoryDate");
|
||||
labelToFieldNameMap.put("扩展字段1", "extAttr1");
|
||||
labelToFieldNameMap.put("扩展字段2", "extAttr2");
|
||||
labelToFieldNameMap.put("扩展字段3", "extAttr3");
|
||||
labelToFieldNameMap.put("扩展字段4", "extAttr4");
|
||||
|
||||
// 精确匹配
|
||||
String fieldName = labelToFieldNameMap.get(batchLabel.trim());
|
||||
if (StringUtils.isNotBlank(fieldName)) {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
// 模糊匹配(包含关系)
|
||||
for (Map.Entry<String, String> entry : labelToFieldNameMap.entrySet()) {
|
||||
if (batchLabel.contains(entry.getKey()) || entry.getKey().contains(batchLabel)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字段名从对象中获取字段值(使用反射)
|
||||
* @param obj 对象
|
||||
* @param fieldName 字段名
|
||||
* @return 字段值(转换为字符串)
|
||||
*/
|
||||
private String getFieldValueByFieldName(Object obj, String fieldName) {
|
||||
if (obj == null || StringUtils.isBlank(fieldName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 兼容:如果传的是下划线命名(数据库列名风格),先转成驼峰字段名再取
|
||||
String normalizedFieldName = fieldName;
|
||||
if (normalizedFieldName.contains("_")) {
|
||||
normalizedFieldName = snakeToCamel(normalizedFieldName);
|
||||
}
|
||||
|
||||
// 获取对象的Class
|
||||
Class<?> clazz = obj.getClass();
|
||||
|
||||
// 尝试获取字段(包括父类字段)
|
||||
Field field = null;
|
||||
Class<?> currentClass = clazz;
|
||||
while (currentClass != null && field == null) {
|
||||
try {
|
||||
field = currentClass.getDeclaredField(normalizedFieldName);
|
||||
} catch (NoSuchFieldException e) {
|
||||
currentClass = currentClass.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
if (field == null) {
|
||||
log.warn("字段不存在:{}(normalized:{}),对象类型:{}", fieldName, normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
// 设置可访问
|
||||
field.setAccessible(true);
|
||||
|
||||
// 获取字段值
|
||||
Object value = field.get(obj);
|
||||
|
||||
// 转换为字符串
|
||||
if (value == null) {
|
||||
log.info("字段 {} 的值为 null,对象类型:{}", normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
String result;
|
||||
// 处理日期类型字段
|
||||
if (value instanceof Date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
result = sdf.format((Date) value);
|
||||
} else {
|
||||
result = value.toString();
|
||||
}
|
||||
|
||||
log.info("通过反射获取字段值成功,字段名:{}(原始:{}),值:{},对象类型:{}",
|
||||
normalizedFieldName, fieldName, result, clazz.getName());
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.warn("通过反射获取字段值失败,字段名:{},对象类型:{},错误:{}", fieldName, obj.getClass().getName(), e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String snakeToCamel(String snake) {
|
||||
if (StringUtils.isBlank(snake)) {
|
||||
return null;
|
||||
}
|
||||
String s = snake.trim().toLowerCase();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean upperNext = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == '_') {
|
||||
upperNext = true;
|
||||
continue;
|
||||
}
|
||||
if (upperNext) {
|
||||
sb.append(Character.toUpperCase(c));
|
||||
upperNext = false;
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+13
-8
@@ -242,6 +242,8 @@ public class ShiftManageApplicationService {
|
||||
if (shiftMaterialDetailPO == null){
|
||||
throw new ServiceException("物料明细不存在");
|
||||
}
|
||||
//ShiftQuantity前端传过来是0 他那边不好赋值 和Quantity参数统一
|
||||
shiftMaterialDetailDO.setShiftQuantity(shiftMaterialDetailDO.getQuantity());
|
||||
if (shiftMaterialDetailDO.getShiftQuantity().compareTo(BigDecimal.ZERO) == 0){
|
||||
//未进行移位直接跳过
|
||||
continue;
|
||||
@@ -339,6 +341,9 @@ public class ShiftManageApplicationService {
|
||||
* @param shiftManageDO
|
||||
*/
|
||||
private void setWarehouseInfo(ShiftManageDO shiftManageDO) {
|
||||
if (shiftManageDO.getWarehouseId() == null) {
|
||||
throw new ServiceException("仓库ID不能为空");
|
||||
}
|
||||
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(shiftManageDO.getWarehouseId());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取仓库信息失败");
|
||||
@@ -368,14 +373,14 @@ public class ShiftManageApplicationService {
|
||||
shiftMaterialDetailDO.setNewStorageLocationName(storageLocationFeignPO.getStorageLocationName());
|
||||
|
||||
//获取容器详情
|
||||
AjaxResult ajaxResult = systemServiceFeign.getContainerInfoByContainerId(shiftMaterialDetailDO.getContainerId());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
throw new ServiceException("获取容器信息失败");
|
||||
}
|
||||
ContainerFeignPO containerFeignPO = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), ContainerFeignPO.class);
|
||||
shiftMaterialDetailDO.setContainerCode(containerFeignPO.getContainerCode());
|
||||
shiftMaterialDetailDO.setContainerType(containerFeignPO.getContainerType());
|
||||
shiftMaterialDetailDO.setContainerTypeName(containerFeignPO.getContainerTypeName());
|
||||
// AjaxResult ajaxResult = systemServiceFeign.getContainerInfoByContainerId(shiftMaterialDetailDO.getContainerId());
|
||||
// if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
// throw new ServiceException("获取容器信息失败");
|
||||
// }
|
||||
// ContainerFeignPO containerFeignPO = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), ContainerFeignPO.class);
|
||||
// shiftMaterialDetailDO.setContainerCode(containerFeignPO.getContainerCode());
|
||||
// shiftMaterialDetailDO.setContainerType(containerFeignPO.getContainerType());
|
||||
// shiftMaterialDetailDO.setContainerTypeName(containerFeignPO.getContainerTypeName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+285
-1
@@ -1,16 +1,29 @@
|
||||
package com.mhd.wms.application.service.shiftMaterialDetail;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
|
||||
import com.mhd.wms.domain.shiftMaterialDetail.repository.po.ShiftMaterialDetailPO;
|
||||
import com.mhd.wms.domain.shiftMaterialDetail.repository.todo.ShiftMaterialDetailDO;
|
||||
import com.mhd.wms.domain.shiftMaterialDetail.service.ShiftMaterialDetailDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 移位物料明细ApplicationService
|
||||
@@ -25,6 +38,8 @@ public class ShiftMaterialDetailApplicationService {
|
||||
private ShiftMaterialDetailDomainService shiftMaterialDetailDomainService;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@Autowired
|
||||
private MaterialInventoryMapper materialInventoryMapper;
|
||||
|
||||
/**
|
||||
* 分页查询移位物料明细列表
|
||||
@@ -92,4 +107,273 @@ public class ShiftMaterialDetailApplicationService {
|
||||
return shiftMaterialDetailDomainService.getShiftMaterialDetail(shiftMaterialDetailDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询移位物料明细列表(带批次属性)
|
||||
* 批次属性值从库存表中获取
|
||||
*/
|
||||
public List<ShiftMaterialDetailPO> queryListWithBatchAttributes(ShiftMaterialDetailDO shiftMaterialDetailDO) {
|
||||
List<ShiftMaterialDetailPO> list = queryList(shiftMaterialDetailDO);
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
// 性能优化:批量获取批次属性,避免N+1查询问题
|
||||
// 1. 收集所有唯一的materialBaseInfoId
|
||||
Set<Long> materialBaseInfoIdSet = list.stream()
|
||||
.map(ShiftMaterialDetailPO::getMaterialBaseInfoId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId)
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
|
||||
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
|
||||
try {
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
// 过滤isDisplay=1的属性
|
||||
List<BatchDetailFeignPO> filteredList = batchDetailFeignPOList.stream()
|
||||
.filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1)
|
||||
.collect(Collectors.toList());
|
||||
batchDetailMap.put(materialBaseInfoId, filteredList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 为每个物料明细设置更多属性(从库存表中获取值)
|
||||
setMaterialMoreDetailListFromInventory(list, batchDetailMap);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为移位物料明细设置更多属性(从库存表中获取值)
|
||||
* @param shiftMaterialDetailPOList 移位物料明细列表
|
||||
* @param batchDetailMap 批次属性Map
|
||||
*/
|
||||
private void setMaterialMoreDetailListFromInventory(List<ShiftMaterialDetailPO> shiftMaterialDetailPOList,
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap) {
|
||||
if (CollectionUtils.isEmpty(shiftMaterialDetailPOList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
shiftMaterialDetailPOList.forEach(shiftMaterialDetailPO -> {
|
||||
Long materialBaseInfoId = shiftMaterialDetailPO.getMaterialBaseInfoId();
|
||||
Long materialInventoryId = shiftMaterialDetailPO.getMaterialInventoryId();
|
||||
|
||||
// 创建新的materialMoreDetailList,只包含isDisplay=1的属性
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList = new ArrayList<>();
|
||||
|
||||
// 从库存表获取数据(包含批次属性字段)
|
||||
MaterialInventoryPO materialInventoryPO = null;
|
||||
if (materialInventoryId != null) {
|
||||
materialInventoryPO = materialInventoryMapper.selectByIdWithBatchAttributes(materialInventoryId);
|
||||
}
|
||||
|
||||
if (materialBaseInfoId != null && batchDetailMap.containsKey(materialBaseInfoId)) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = batchDetailMap.get(materialBaseInfoId);
|
||||
// 用于跟踪已添加到列表中的batchDetailId
|
||||
Set<Long> addedBatchDetailIds = new HashSet<>();
|
||||
|
||||
for (BatchDetailFeignPO batchDetailFeignPO : batchDetailFeignPOList) {
|
||||
MaterialMoreDetailPO materialMoreDetailPO = new MaterialMoreDetailPO();
|
||||
materialMoreDetailPO.setBatchId(batchDetailFeignPO.getBatchId());
|
||||
materialMoreDetailPO.setBatchDetailId(batchDetailFeignPO.getBatchDetailId());
|
||||
materialMoreDetailPO.setBatchLabels(batchDetailFeignPO.getBatchLabels());
|
||||
materialMoreDetailPO.setInputControl(batchDetailFeignPO.getInputControl());
|
||||
materialMoreDetailPO.setAttributeFormat(batchDetailFeignPO.getAttributeFormat());
|
||||
materialMoreDetailPO.setAttributeOption(batchDetailFeignPO.getAttributeOption());
|
||||
materialMoreDetailPO.setRemark(batchDetailFeignPO.getRemark());
|
||||
|
||||
// 确保添加到列表中(使用batchDetailId来避免重复)
|
||||
Long batchDetailId = batchDetailFeignPO.getBatchDetailId();
|
||||
if (batchDetailId != null && !addedBatchDetailIds.contains(batchDetailId)) {
|
||||
materialMoreDetailList.add(materialMoreDetailPO);
|
||||
addedBatchDetailIds.add(batchDetailId);
|
||||
}
|
||||
|
||||
// 根据fieldName或batchLabels从库存表中获取对应的字段值
|
||||
if (materialInventoryPO != null) {
|
||||
String fieldValue = null;
|
||||
String usedFieldName = null;
|
||||
// 优先使用fieldName(如果存在)
|
||||
if (StringUtils.isNotBlank(batchDetailFeignPO.getFieldName())) {
|
||||
usedFieldName = batchDetailFeignPO.getFieldName();
|
||||
fieldValue = getFieldValueByFieldName(materialInventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, fieldName={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), usedFieldName, fieldValue);
|
||||
}
|
||||
// 如果fieldName为空,尝试根据batchLabels映射到字段名
|
||||
else if (StringUtils.isNotBlank(batchDetailFeignPO.getBatchLabels())) {
|
||||
String fieldNameByLabel = getFieldNameByBatchLabel(batchDetailFeignPO.getBatchLabels());
|
||||
if (StringUtils.isNotBlank(fieldNameByLabel)) {
|
||||
usedFieldName = fieldNameByLabel;
|
||||
fieldValue = getFieldValueByFieldName(materialInventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, batchLabels={}, 映射字段名={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), batchDetailFeignPO.getBatchLabels(),
|
||||
usedFieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
// 只有当获取到值时才更新attributeValue
|
||||
if (fieldValue != null) {
|
||||
materialMoreDetailPO.setAttributeValue(fieldValue);
|
||||
log.info("设置更多属性:batchDetailId={}, batchLabels={}, attributeValue={}",
|
||||
materialMoreDetailPO.getBatchDetailId(), materialMoreDetailPO.getBatchLabels(),
|
||||
materialMoreDetailPO.getAttributeValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
shiftMaterialDetailPO.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
log.info("移位物料明细 uniqueId={}, materialBaseInfoId={}, materialInventoryId={}, materialMoreDetailList大小={}",
|
||||
shiftMaterialDetailPO.getUniqueId(), shiftMaterialDetailPO.getMaterialBaseInfoId(),
|
||||
shiftMaterialDetailPO.getMaterialInventoryId(),
|
||||
materialMoreDetailList != null ? materialMoreDetailList.size() : 0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据批次标签(batchLabels)映射到字段名
|
||||
* @param batchLabel 批次标签
|
||||
* @return 字段名,如果找不到映射则返回null
|
||||
*/
|
||||
private String getFieldNameByBatchLabel(String batchLabel) {
|
||||
if (StringUtils.isBlank(batchLabel)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 批次标签到字段名的映射关系
|
||||
Map<String, String> labelToFieldNameMap = new HashMap<>();
|
||||
labelToFieldNameMap.put("Invoice No.", "invoiceNo");
|
||||
labelToFieldNameMap.put("Invoice No", "invoiceNo");
|
||||
labelToFieldNameMap.put("发票号", "invoiceNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO's", "batchRefNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO", "batchRefNo");
|
||||
labelToFieldNameMap.put("批次参考号", "batchRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO's", "sheetRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO", "sheetRefNo");
|
||||
labelToFieldNameMap.put("单据参考号", "sheetRefNo");
|
||||
labelToFieldNameMap.put("箱号/卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("箱号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("生产日期", "productionDate");
|
||||
labelToFieldNameMap.put("过期日期", "expiryDate");
|
||||
labelToFieldNameMap.put("存货日期", "inventoryDate");
|
||||
labelToFieldNameMap.put("扩展字段1", "extAttr1");
|
||||
labelToFieldNameMap.put("扩展字段2", "extAttr2");
|
||||
labelToFieldNameMap.put("扩展字段3", "extAttr3");
|
||||
labelToFieldNameMap.put("扩展字段4", "extAttr4");
|
||||
|
||||
// 精确匹配
|
||||
String fieldName = labelToFieldNameMap.get(batchLabel.trim());
|
||||
if (StringUtils.isNotBlank(fieldName)) {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
// 模糊匹配(包含关系)
|
||||
for (Map.Entry<String, String> entry : labelToFieldNameMap.entrySet()) {
|
||||
if (batchLabel.contains(entry.getKey()) || entry.getKey().contains(batchLabel)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字段名从对象中获取字段值(使用反射)
|
||||
* @param obj 对象
|
||||
* @param fieldName 字段名
|
||||
* @return 字段值(转换为字符串)
|
||||
*/
|
||||
private String getFieldValueByFieldName(Object obj, String fieldName) {
|
||||
if (obj == null || StringUtils.isBlank(fieldName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 兼容:如果传的是下划线命名(数据库列名风格),先转成驼峰字段名再取
|
||||
String normalizedFieldName = fieldName;
|
||||
if (normalizedFieldName.contains("_")) {
|
||||
normalizedFieldName = snakeToCamel(normalizedFieldName);
|
||||
}
|
||||
|
||||
// 获取对象的Class
|
||||
Class<?> clazz = obj.getClass();
|
||||
|
||||
// 尝试获取字段(包括父类字段)
|
||||
Field field = null;
|
||||
Class<?> currentClass = clazz;
|
||||
while (currentClass != null && field == null) {
|
||||
try {
|
||||
field = currentClass.getDeclaredField(normalizedFieldName);
|
||||
} catch (NoSuchFieldException e) {
|
||||
currentClass = currentClass.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
if (field == null) {
|
||||
log.warn("字段不存在:{}(normalized:{}),对象类型:{}", fieldName, normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
// 设置可访问
|
||||
field.setAccessible(true);
|
||||
|
||||
// 获取字段值
|
||||
Object value = field.get(obj);
|
||||
|
||||
// 转换为字符串
|
||||
if (value == null) {
|
||||
log.info("字段 {} 的值为 null,对象类型:{}", normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
String result;
|
||||
// 处理日期类型字段
|
||||
if (value instanceof Date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
result = sdf.format((Date) value);
|
||||
} else {
|
||||
result = value.toString();
|
||||
}
|
||||
|
||||
log.info("通过反射获取字段值成功,字段名:{}(原始:{}),值:{},对象类型:{}",
|
||||
normalizedFieldName, fieldName, result, clazz.getName());
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.warn("通过反射获取字段值失败,字段名:{},对象类型:{},错误:{}", fieldName, obj.getClass().getName(), e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String snakeToCamel(String snake) {
|
||||
if (StringUtils.isBlank(snake)) {
|
||||
return null;
|
||||
}
|
||||
String s = snake.trim().toLowerCase();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean upperNext = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == '_') {
|
||||
upperNext = true;
|
||||
continue;
|
||||
}
|
||||
if (upperNext) {
|
||||
sb.append(Character.toUpperCase(c));
|
||||
upperNext = false;
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+300
-5
@@ -1,11 +1,20 @@
|
||||
package com.mhd.wms.application.service.statementStatistics;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
|
||||
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.inventoryStandingDetail.service.InventoryStandingDetailDomainService;
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialInventory.service.MaterialInventoryDomainService;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
|
||||
import com.mhd.wms.domain.statementStatistics.po.ImmediateInventoryPO;
|
||||
import com.mhd.wms.domain.statementStatistics.po.WarehousingReportPO;
|
||||
import com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO;
|
||||
@@ -13,8 +22,12 @@ import com.mhd.wms.domain.statementStatistics.todo.WarehousingReportDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 报表管理ApplicationService
|
||||
@@ -29,6 +42,10 @@ public class StatementStatisticsService {
|
||||
private MaterialInventoryDomainService materialInventoryDomainService;
|
||||
@Autowired
|
||||
private InventoryStandingDetailDomainService inventoryStandingDetailDomainService;
|
||||
@Autowired
|
||||
private MaterialInventoryMapper materialInventoryMapper;
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
/**
|
||||
* 分页查询即时库存列表
|
||||
@@ -41,10 +58,288 @@ public class StatementStatisticsService {
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
immediateInventoryDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
immediateInventoryDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
// 只有在用户没有明确指定仓库参数时,才使用缓存中的仓库信息
|
||||
// 如果用户已经传递了 warehouseId、warehouseCode 或 warehouseName,优先使用这些值
|
||||
boolean hasWarehouseFilter = (immediateInventoryDO.getWarehouseId() != null)
|
||||
|| (immediateInventoryDO.getWarehouseCode() != null && !immediateInventoryDO.getWarehouseCode().trim().isEmpty())
|
||||
|| (immediateInventoryDO.getWarehouseName() != null && !immediateInventoryDO.getWarehouseName().trim().isEmpty());
|
||||
|
||||
if (!hasWarehouseFilter) {
|
||||
try {
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (associationWarehouseCacheDO != null) {
|
||||
if (associationWarehouseCacheDO.getWarehouseId() != null) {
|
||||
immediateInventoryDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
if (associationWarehouseCacheDO.getWarehouseCode() != null && !associationWarehouseCacheDO.getWarehouseCode().trim().isEmpty()) {
|
||||
immediateInventoryDO.setWarehouseCode(associationWarehouseCacheDO.getWarehouseCode());
|
||||
}
|
||||
if (associationWarehouseCacheDO.getWarehouseName() != null && !associationWarehouseCacheDO.getWarehouseName().trim().isEmpty()) {
|
||||
immediateInventoryDO.setWarehouseName(associationWarehouseCacheDO.getWarehouseName());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果获取仓库信息失败,记录日志但不影响查询(允许查询所有仓库)
|
||||
log.warn("获取用户关联仓库信息失败,将查询所有仓库数据,用户ID:{},错误:{}", loginUser.getUserid(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return materialInventoryDomainService.queryImmediateInventoryList(immediateInventoryDO);
|
||||
List<ImmediateInventoryPO> immediateInventoryPOS = materialInventoryDomainService.queryImmediateInventoryList(immediateInventoryDO);
|
||||
// 性能优化:批量获取批次属性,避免N+1查询问题
|
||||
// 1. 收集所有唯一的materialBaseInfoId
|
||||
Set<Long> materialBaseInfoIdSet = immediateInventoryPOS.stream()
|
||||
.map(ImmediateInventoryPO::getMaterialBaseInfoId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 2. 批量查询批次属性(使用Map缓存,避免重复查询相同的materialBaseInfoId)
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
|
||||
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
|
||||
try {
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
// 过滤isDisplay=1的属性
|
||||
List<BatchDetailFeignPO> filteredList = batchDetailFeignPOList.stream()
|
||||
.filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1)
|
||||
.collect(Collectors.toList());
|
||||
batchDetailMap.put(materialBaseInfoId, filteredList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 为每个物料明细设置更多属性(从库存表中获取值)
|
||||
setMaterialMoreDetailListFromInventory(immediateInventoryPOS, batchDetailMap);
|
||||
|
||||
return immediateInventoryPOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为物料库存设置更多属性(从库存表中获取值)
|
||||
* @param materialInventoryPOList 物料库存列表
|
||||
* @param batchDetailMap 批次属性Map
|
||||
*/
|
||||
private void setMaterialMoreDetailListFromInventory(List<ImmediateInventoryPO> materialInventoryPOList,
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap) {
|
||||
if (CollectionUtils.isEmpty(materialInventoryPOList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
materialInventoryPOList.forEach(materialInventoryPO -> {
|
||||
Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId();
|
||||
Long materialInventoryId = materialInventoryPO.getMaterialInventoryId();
|
||||
|
||||
// 创建新的materialMoreDetailList,只包含isDisplay=1的属性
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList = new ArrayList<>();
|
||||
|
||||
// 从库存表获取数据(包含批次属性字段)
|
||||
MaterialInventoryPO inventoryPO = null;
|
||||
if (materialInventoryId != null) {
|
||||
inventoryPO = materialInventoryMapper.selectByIdWithBatchAttributes(materialInventoryId);
|
||||
}
|
||||
|
||||
if (materialBaseInfoId != null && batchDetailMap.containsKey(materialBaseInfoId)) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = batchDetailMap.get(materialBaseInfoId);
|
||||
// 用于跟踪已添加到列表中的batchDetailId
|
||||
Set<Long> addedBatchDetailIds = new HashSet<>();
|
||||
|
||||
for (BatchDetailFeignPO batchDetailFeignPO : batchDetailFeignPOList) {
|
||||
MaterialMoreDetailPO materialMoreDetailPO = new MaterialMoreDetailPO();
|
||||
materialMoreDetailPO.setBatchId(batchDetailFeignPO.getBatchId());
|
||||
materialMoreDetailPO.setBatchDetailId(batchDetailFeignPO.getBatchDetailId());
|
||||
materialMoreDetailPO.setBatchLabels(batchDetailFeignPO.getBatchLabels());
|
||||
materialMoreDetailPO.setInputControl(batchDetailFeignPO.getInputControl());
|
||||
materialMoreDetailPO.setAttributeFormat(batchDetailFeignPO.getAttributeFormat());
|
||||
materialMoreDetailPO.setAttributeOption(batchDetailFeignPO.getAttributeOption());
|
||||
materialMoreDetailPO.setRemark(batchDetailFeignPO.getRemark());
|
||||
|
||||
// 确保添加到列表中(使用batchDetailId来避免重复)
|
||||
Long batchDetailId = batchDetailFeignPO.getBatchDetailId();
|
||||
if (batchDetailId != null && !addedBatchDetailIds.contains(batchDetailId)) {
|
||||
materialMoreDetailList.add(materialMoreDetailPO);
|
||||
addedBatchDetailIds.add(batchDetailId);
|
||||
}
|
||||
|
||||
// 根据fieldName或batchLabels从库存表中获取对应的字段值
|
||||
if (inventoryPO != null) {
|
||||
String fieldValue = null;
|
||||
String usedFieldName = null;
|
||||
// 优先使用fieldName(如果存在)
|
||||
if (StringUtils.isNotBlank(batchDetailFeignPO.getFieldName())) {
|
||||
usedFieldName = batchDetailFeignPO.getFieldName();
|
||||
fieldValue = getFieldValueByFieldName(inventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, fieldName={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), usedFieldName, fieldValue);
|
||||
}
|
||||
// 如果fieldName为空,尝试根据batchLabels映射到字段名
|
||||
else if (StringUtils.isNotBlank(batchDetailFeignPO.getBatchLabels())) {
|
||||
String fieldNameByLabel = getFieldNameByBatchLabel(batchDetailFeignPO.getBatchLabels());
|
||||
if (StringUtils.isNotBlank(fieldNameByLabel)) {
|
||||
usedFieldName = fieldNameByLabel;
|
||||
fieldValue = getFieldValueByFieldName(inventoryPO, usedFieldName);
|
||||
log.info("批次属性 batchDetailId={}, batchLabels={}, 映射字段名={}, 从库存表获取到的值={}",
|
||||
batchDetailFeignPO.getBatchDetailId(), batchDetailFeignPO.getBatchLabels(),
|
||||
usedFieldName, fieldValue);
|
||||
}
|
||||
}
|
||||
// 只有当获取到值时才更新attributeValue
|
||||
if (fieldValue != null) {
|
||||
materialMoreDetailPO.setAttributeValue(fieldValue);
|
||||
log.info("设置更多属性:batchDetailId={}, batchLabels={}, attributeValue={}",
|
||||
materialMoreDetailPO.getBatchDetailId(), materialMoreDetailPO.getBatchLabels(),
|
||||
materialMoreDetailPO.getAttributeValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
materialInventoryPO.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
log.info("物料库存 materialInventoryId={}, materialBaseInfoId={}, materialMoreDetailList大小={}",
|
||||
materialInventoryPO.getMaterialInventoryId(), materialInventoryPO.getMaterialBaseInfoId(),
|
||||
materialMoreDetailList != null ? materialMoreDetailList.size() : 0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字段名从对象中获取字段值(使用反射)
|
||||
* @param obj 对象
|
||||
* @param fieldName 字段名
|
||||
* @return 字段值(转换为字符串)
|
||||
*/
|
||||
private String getFieldValueByFieldName(Object obj, String fieldName) {
|
||||
if (obj == null || StringUtils.isBlank(fieldName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 兼容:如果传的是下划线命名(数据库列名风格),先转成驼峰字段名再取
|
||||
String normalizedFieldName = fieldName;
|
||||
if (normalizedFieldName.contains("_")) {
|
||||
normalizedFieldName = snakeToCamel(normalizedFieldName);
|
||||
}
|
||||
|
||||
// 获取对象的Class
|
||||
Class<?> clazz = obj.getClass();
|
||||
|
||||
// 尝试获取字段(包括父类字段)
|
||||
Field field = null;
|
||||
Class<?> currentClass = clazz;
|
||||
while (currentClass != null && field == null) {
|
||||
try {
|
||||
field = currentClass.getDeclaredField(normalizedFieldName);
|
||||
} catch (NoSuchFieldException e) {
|
||||
currentClass = currentClass.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
if (field == null) {
|
||||
log.warn("字段不存在:{}(normalized:{}),对象类型:{}", fieldName, normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
// 设置可访问
|
||||
field.setAccessible(true);
|
||||
|
||||
// 获取字段值
|
||||
Object value = field.get(obj);
|
||||
|
||||
// 转换为字符串
|
||||
if (value == null) {
|
||||
log.info("字段 {} 的值为 null,对象类型:{}", normalizedFieldName, clazz.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
String result;
|
||||
// 处理日期类型字段
|
||||
if (value instanceof Date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
result = sdf.format((Date) value);
|
||||
} else {
|
||||
result = value.toString();
|
||||
}
|
||||
|
||||
log.info("通过反射获取字段值成功,字段名:{}(原始:{}),值:{},对象类型:{}",
|
||||
normalizedFieldName, fieldName, result, clazz.getName());
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.warn("通过反射获取字段值失败,字段名:{},对象类型:{},错误:{}", fieldName, obj.getClass().getName(), e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String snakeToCamel(String snake) {
|
||||
if (StringUtils.isBlank(snake)) {
|
||||
return null;
|
||||
}
|
||||
String s = snake.trim().toLowerCase();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean upperNext = false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c == '_') {
|
||||
upperNext = true;
|
||||
continue;
|
||||
}
|
||||
if (upperNext) {
|
||||
sb.append(Character.toUpperCase(c));
|
||||
upperNext = false;
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据批次标签(batchLabels)映射到字段名
|
||||
* @param batchLabel 批次标签
|
||||
* @return 字段名,如果找不到映射则返回null
|
||||
*/
|
||||
private String getFieldNameByBatchLabel(String batchLabel) {
|
||||
if (StringUtils.isBlank(batchLabel)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 批次标签到字段名的映射关系
|
||||
Map<String, String> labelToFieldNameMap = new HashMap<>();
|
||||
labelToFieldNameMap.put("Invoice No.", "invoiceNo");
|
||||
labelToFieldNameMap.put("Invoice No", "invoiceNo");
|
||||
labelToFieldNameMap.put("发票号", "invoiceNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO's", "batchRefNo");
|
||||
labelToFieldNameMap.put("Batch Ref NO", "batchRefNo");
|
||||
labelToFieldNameMap.put("批次参考号", "batchRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO's", "sheetRefNo");
|
||||
labelToFieldNameMap.put("Sheet Ref NO", "sheetRefNo");
|
||||
labelToFieldNameMap.put("单据参考号", "sheetRefNo");
|
||||
labelToFieldNameMap.put("箱号/卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("箱号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("卡板号", "boxPalletNo");
|
||||
labelToFieldNameMap.put("生产日期", "productionDate");
|
||||
labelToFieldNameMap.put("过期日期", "expiryDate");
|
||||
labelToFieldNameMap.put("存货日期", "inventoryDate");
|
||||
labelToFieldNameMap.put("扩展字段1", "extAttr1");
|
||||
labelToFieldNameMap.put("扩展字段2", "extAttr2");
|
||||
labelToFieldNameMap.put("扩展字段3", "extAttr3");
|
||||
labelToFieldNameMap.put("扩展字段4", "extAttr4");
|
||||
|
||||
// 精确匹配
|
||||
String fieldName = labelToFieldNameMap.get(batchLabel.trim());
|
||||
if (StringUtils.isNotBlank(fieldName)) {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
// 模糊匹配(包含关系)
|
||||
for (Map.Entry<String, String> entry : labelToFieldNameMap.entrySet()) {
|
||||
if (batchLabel.contains(entry.getKey()) || entry.getKey().contains(batchLabel)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,4 +393,4 @@ public class StatementStatisticsService {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user