Merge branch 'dev_qinhongzhanWMS' into wms_dev
# Conflicts: # mhd-modules/mhd-system/src/main/resources/mapper/basic/lease/LeaseMapper.xml
This commit is contained in:
+12
@@ -67,4 +67,16 @@ public class LeaseDO extends BaseVOEntity{
|
||||
@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;
|
||||
}
|
||||
|
||||
+55
@@ -1,16 +1,23 @@
|
||||
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;
|
||||
@@ -22,6 +29,9 @@ import java.util.Date;
|
||||
@Component
|
||||
public class LeaseAssembler {
|
||||
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
@@ -29,6 +39,11 @@ public class LeaseAssembler {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -54,8 +69,48 @@ public class LeaseAssembler {
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
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;
|
||||
@@ -52,11 +54,27 @@ public class LeaseDTO extends BaseVOEntity{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
and organization_name like concat('%', #{organizationName}, '%')
|
||||
</if>
|
||||
<if test="warehouseId != null and warehouseId != ''">
|
||||
<if test="warehouseId != null ">
|
||||
and warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
@@ -76,13 +76,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="leaseType != null and leaseType != ''">
|
||||
and lease_type = #{leaseType}
|
||||
</if>
|
||||
<if test="createTime != null ">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="leaseArea != null ">
|
||||
and lease_area = #{leaseArea}
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and remark like concat('%', #{remark}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 创建和更新相关条件 -->
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
@@ -90,6 +92,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
<if test="createTimeStart != null and createTimeStart != ''">
|
||||
and date_format(create_time,'%Y-%m-%d') >= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null and createTimeEnd != ''">
|
||||
and date_format(create_time,'%Y-%m-%d') <= #{createTimeEnd}
|
||||
</if>
|
||||
<if test="updateTimeStart != null and updateTimeStart != ''">
|
||||
and date_format(update_time,'%Y-%m-%d') >= #{updateTimeStart}
|
||||
</if>
|
||||
<if test="updateTimeEnd != null and updateTimeEnd != ''">
|
||||
and date_format(update_time,'%Y-%m-%d') <= #{updateTimeEnd}
|
||||
</if>
|
||||
<!-- 时间范围查询(如果需要) -->
|
||||
<if test="startDate != null and endDate != null">
|
||||
and start_date >= #{startDate} and start_date <= #{endDate}
|
||||
|
||||
Reference in New Issue
Block a user