Commit cc03f5c8 authored by huyf's avatar huyf

提货bug&出货查询

parent d9f1e3f3
......@@ -623,7 +623,7 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
OrderDO order = orderService.selectOne(OrderDO::getOrderNo, createReqVO.getOrderId());
OrderBackInfoDto orderDO = orderQueryService.info(order.getOrderId());
if (orderDO.getConsigneeVO().getHarvestMethod() == 2) {
if (orderDO.getConsigneeVO() == null || orderDO.getConsigneeVO().getHarvestMethod() == 2) {
if (StringUtils.isNotBlank(orderDO.getTidanNo())) {
errorOrderNo.add(orderDO.getOrderNo() + "(" + orderDO.getTidanNo() + ")");
} else {
......
......@@ -203,6 +203,14 @@ public interface BoxMapper extends AbstractMapper<BoxDO> {
boolean air = vo.getTransportType() != null
&& vo.getTransportType().equals(TransportTypeEnum.AIR.getType());
String bookSeaSql = buildBookSeaSql(vo);
String customsSql = buildCustomsSql(vo);
String shippingSql = buildShippingSql(vo);
String clearanceDocSql = buildClearanceDocSql(vo);
String clearanceSql = buildClearanceSql(vo);
String buildBookAirSql = buildBookAirString(vo);
String buildAgentSql = buildAgentSql(vo);
LambdaQueryWrapper<BoxDO> queryWrapper = new LambdaQueryWrapper<BoxDO>()
.eq(vo.getId() != null, BoxDO::getId, vo.getId())
.eq(BoxDO::getDeleted, 0)
......@@ -210,6 +218,23 @@ public interface BoxMapper extends AbstractMapper<BoxDO> {
.like(vo.getCubNo() != null, BoxDO::getCubNo, vo.getCubNo())
.eq(vo.getCabinetId() != null, BoxDO::getCabinetId, vo.getCabinetId())
.eq(vo.getStartWarehouseId() != null, BoxDO::getStartWarehouseId, vo.getStartWarehouseId())
.in(CollectionUtil.isNotEmpty(vo.getStartWarehouseIdList()),BoxDO::getStartWarehouseId,vo.getStartWarehouseIdList())
.in(CollectionUtil.isNotEmpty(vo.getDestWarehouseIdList()),BoxDO::getDestWarehouseId,vo.getDestWarehouseIdList())
.in(CollectionUtil.isNotEmpty(vo.getBoxStatusList()),BoxDO::getStatus,vo.getBoxStatusList())
.in(CollectionUtil.isNotEmpty(vo.getDestinationClearanceList()),BoxDO::getDestinationClearance,vo.getDestinationClearanceList())
.in(CollectionUtil.isNotEmpty(vo.getDeliveryTypeList()), BoxDO::getDeliveryType, vo.getDeliveryTypeList())
.in(CollectionUtil.isNotEmpty(vo.getShippingChannelIdList()), BoxDO::getShippingChannelId, vo.getShippingChannelIdList())
// .apply(CollectionUtil.isNotEmpty(vo.getBigPortIdList()),"exists (select 1 from ecw_box_book_sea a where a.shipment_id={0} and a.deleted=0 and a.big_port_id in ({1}))",vo.getId(),vo.getBigPortIdList())
// .apply(CollectionUtil.isNotEmpty(vo.getDestPortIdList()),"exists (select 1 from ecw_box_book_sea a where a.shipment_id={0} and a.deleted=0 and a.dest_port_id in ({1}))",vo.getId(),vo.getDestPortIdList())
// .apply(CollectionUtil.isNotEmpty(vo.getBargePortIdList()),"exists (select 1 from ecw_box_book_sea a where a.shipment_id={0} and a.deleted=0 and a.barge_port_id in ({1}))",vo.getId(),vo.getBargePortIdList())
// .apply(CollectionUtil.isNotEmpty(vo.getSpaceCompanyIdList()),"exists (select 1 from ecw_box_book_sea a where a.shipment_id={0} and a.deleted=0 and a.space_company_id in ({1}))",vo.getId(),vo.getSpaceCompanyIdList())
.apply(StringUtils.isNotBlank(bookSeaSql),bookSeaSql,vo.getId())
.apply(StringUtils.isNotBlank(customsSql),customsSql,vo.getId())
.apply(StringUtils.isNotBlank(shippingSql),shippingSql,vo.getId())
.apply(StringUtils.isNotBlank(clearanceDocSql),clearanceDocSql,vo.getId())
.apply(StringUtils.isNotBlank(clearanceSql),clearanceSql,vo.getId())
.apply(StringUtils.isNotBlank(buildBookAirSql),buildBookAirSql,vo.getId())
.apply(StringUtils.isNotBlank(buildAgentSql),buildAgentSql,vo.getId())
.eq(vo.getBoxStatus() != null, BoxDO::getShipmentStatus, vo.getBoxStatus())
.eq(vo.getShipmentStatusAir() != null, BoxDO::getShipmentStatusAir, vo.getShipmentStatusAir())
.eq(vo.getDestWarehouseId() != null, BoxDO::getDestWarehouseId, vo.getDestWarehouseId())
......@@ -329,6 +354,190 @@ public interface BoxMapper extends AbstractMapper<BoxDO> {
return null;
}
//拼装海运订舱sql
default String buildBookSeaSql(BoxQueryVO vo) {
boolean flag = false;
StringBuffer stringBuffer = new StringBuffer("exists (select 1 from ecw_box_book_sea a where a.shipment_id={0} and a.deleted=0 ");
if (CollectionUtil.isNotEmpty(vo.getBigPortIdList())) {
flag = true;
String collect = vo.getBigPortIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.big_port_id in (").append(collect).append(")");
}
if (CollectionUtil.isNotEmpty(vo.getDestPortIdList())) {
flag = true;
String collect = vo.getDestPortIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.dest_port_id in (").append(collect).append(")");
}
if (CollectionUtil.isNotEmpty(vo.getBargePortIdList())) {
flag = true;
String collect = vo.getBargePortIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.barge_port_id in (").append(collect).append(")");
}
if (CollectionUtil.isNotEmpty(vo.getSpaceCompanyIdList())) {
flag = true;
String collect = vo.getSpaceCompanyIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.space_company_id in (").append(collect).append(")");
}
if (vo.getBargeBeginTime() !=null && vo.getBargeEndTime() != null) {
flag = true;
stringBuffer.append(" and a.barge_time between '").append(vo.getBargeBeginTime()).append("' and '").append(vo.getBargeEndTime()).append("'");
}
if (vo.getSailBeginTime() !=null && vo.getSailEndTime() != null) {
flag = true;
stringBuffer.append(" and a.sail_time between '").append(vo.getSailBeginTime()).append("' and '").append(vo.getSailEndTime()).append("'");
}
if (vo.getLadingBillBeginTime() !=null && vo.getLadingBillEndTime() != null) {
flag = true;
stringBuffer.append(" and a.lading_bill_time between '").append(vo.getLadingBillBeginTime()).append("' and '").append(vo.getLadingBillEndTime()).append("'");
}
if (vo.getCustomsBeginTime() !=null && vo.getCustomsEndTime() != null) {
flag = true;
stringBuffer.append(" and a.customs_time between '").append(vo.getCustomsBeginTime()).append("' and '").append(vo.getCustomsEndTime()).append("'");
}
if (vo.getCutOffBeginTime() !=null && vo.getCutOffEndTime() != null) {
flag = true;
stringBuffer.append(" and a.cut_off_time between '").append(vo.getCutOffBeginTime()).append("' and '").append(vo.getCutOffEndTime()).append("'");
}
if (flag) {
stringBuffer.append(")");
return stringBuffer.toString();
}
return null;
}
//拼装报关查询sql
default String buildCustomsSql(BoxQueryVO vo) {
boolean flag = false;
StringBuffer stringBuffer = new StringBuffer("exists (select 1 from ecw_box_customs a where a.shipment_id={0} and a.deleted=0 ");
if (CollectionUtil.isNotEmpty(vo.getDcCustomsTypeList())) {
flag = true;
String collect = vo.getDcCustomsTypeList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.dc_customs_type in (").append(collect).append(")");
}
if (CollectionUtil.isNotEmpty(vo.getDcCompanyIdList())) {
flag = true;
String collect = vo.getDcCompanyIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.dc_company_id in (").append(collect).append(")");
}
if (vo.getDcPassBeginTime() !=null && vo.getDcPassEndTime() != null) {
flag = true;
stringBuffer.append(" and a.dc_pass_time between '").append(vo.getDcPassBeginTime()).append("' and '").append(vo.getDcPassEndTime()).append("'");
}
if (flag) {
stringBuffer.append(")");
return stringBuffer.toString();
}
return null;
}
default String buildShippingSql(BoxQueryVO vo) {
boolean flag = false;
StringBuffer stringBuffer = new StringBuffer("exists (select 1 from ecw_box_shipping a where a.shipment_id={0} and a.deleted=0 ");
if (vo.getDtRealShipBeginTime() !=null && vo.getDtRealShipEndTime() != null) {
flag = true;
stringBuffer.append(" and a.dt_real_ship_time between '").append(vo.getDtRealShipBeginTime()).append("' and '").append(vo.getDtRealShipEndTime()).append("'");
}
if (vo.getDtEstArrivalBeginTime() !=null && vo.getDtEstArrivalEndTime() != null) {
flag = true;
stringBuffer.append(" and a.dt_est_arrival_time between '").append(vo.getDtEstArrivalBeginTime()).append("' and '").append(vo.getDtEstArrivalEndTime()).append("'");
}
if (flag) {
stringBuffer.append(")");
return stringBuffer.toString();
}
return null;
}
default String buildClearanceDocSql(BoxQueryVO vo) {
boolean flag = false;
StringBuffer stringBuffer = new StringBuffer("exists (select 1 from ecw_box_clearance_doc a where a.shipment_id={0} and a.deleted=0 ");
if (CollectionUtil.isNotEmpty(vo.getCdOutBillTypeList())) {
flag = true;
String collect = vo.getCdOutBillTypeList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.cd_out_bill_type in (").append(collect).append(")");
}
if (vo.getCdAgentlistType() !=null && vo.getCdAgentlistType() >0) {
flag = true;
stringBuffer.append(" and a.cd_agentlist_type=").append(vo.getCdAgentlistType());
}
if (vo.getCdSoncapType() !=null && vo.getCdSoncapType() != null) {
flag = true;
stringBuffer.append(" and a.cd_soncap_type=").append(vo.getCdSoncapType());
}
if (flag) {
stringBuffer.append(")");
return stringBuffer.toString();
}
return null;
}
default String buildClearanceSql(BoxQueryVO vo) {
boolean flag = false;
StringBuffer stringBuffer = new StringBuffer("exists (select 1 from ecw_box_clearance a where a.shipment_id={0} and a.deleted=0 ");
if (vo.getClEstBeginTime() !=null && vo.getClEstEndTime() != null) {
flag = true;
stringBuffer.append(" and a.cl_est_time between '").append(vo.getClEstBeginTime()).append("' and '").append(vo.getClEstEndTime()).append("'");
}
if (flag) {
stringBuffer.append(")");
return stringBuffer.toString();
}
return null;
}
default String buildBookAirString(BoxQueryVO vo) {
boolean flag = false;
StringBuffer stringBuffer = new StringBuffer("exists (select 1 from ecw_box_book_air a where a.shipment_id={0} and a.deleted=0 ");
if (CollectionUtil.isNotEmpty(vo.getDeparturePortIdList())) {
flag = true;
String collect = vo.getDeparturePortIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.departure_port_id in (").append(collect).append(")");
}
if (CollectionUtil.isNotEmpty(vo.getAirDestPortIdList())) {
flag = true;
String collect = vo.getAirDestPortIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.dest_port_id in (").append(collect).append(")");
}
if (vo.getVoyage() !=null && vo.getVoyage() >0) {
flag = true;
stringBuffer.append(" and a.voyage=").append(vo.getVoyage());
}
if (CollectionUtil.isNotEmpty(vo.getShipperIdList())) {
flag = true;
String collect = vo.getShipperIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.shipper_id in (").append(collect).append(")");
}
if (CollectionUtil.isNotEmpty(vo.getAirlineCompanyIdList())) {
flag = true;
String collect = vo.getAirlineCompanyIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.airline_company_id in (").append(collect).append(")");
}
if (vo.getFlyBeginTime() !=null && vo.getFlyEndTime() != null) {
flag = true;
stringBuffer.append(" and a.fly_time between '").append(vo.getFlyBeginTime()).append("' and '").append(vo.getFlyEndTime()).append("'");
}
if (flag) {
stringBuffer.append(")");
return stringBuffer.toString();
}
return null;
}
default String buildAgentSql(BoxQueryVO vo) {
boolean flag = false;
StringBuffer stringBuffer = new StringBuffer("exists (select 1 from ecw_box_agent a where a.shipment_id={0} and a.deleted=0 ");
if (CollectionUtil.isNotEmpty(vo.getAgentIdList())) {
flag = true;
String collect = vo.getAgentIdList().stream().map(item -> item.toString()).collect(Collectors.joining(","));
stringBuffer.append(" and a.agent_id in (").append(collect).append(")");
}
if (flag) {
stringBuffer.append(")");
return stringBuffer.toString();
}
return null;
}
@Override
default List<BoxDO> selectList(Object object) {
......
......@@ -1575,12 +1575,12 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
warehouseIdList = warehouseList.stream().map(WarehouseDO::getId).collect(Collectors.toList());
query.setWarehouseIdList(warehouseIdList);
}
// if (CollectionUtil.isNotEmpty(query.getCountryIdList())) {
// List<WarehouseDO> warehouseList =
// warehouseService.findByCountryIdList(query.getCountryIdList());
// warehouseIdList = warehouseList.stream().map(WarehouseDO::getId).collect(Collectors.toList());
// query.setWarehouseIdList(warehouseIdList);
// }
if (CollectionUtil.isNotEmpty(query.getCountryIdList())) {
List<WarehouseDO> warehouseList =
warehouseService.findByCountryIdList(query.getCountryIdList());
warehouseIdList = warehouseList.stream().map(WarehouseDO::getId).collect(Collectors.toList());
query.setWarehouseIdList(warehouseIdList);
}
//上面都是处理查询条件相关逻辑
return boxInfoQuery1(boxMapper.selectPage2(page, query), false);
}
......
......@@ -131,4 +131,168 @@ public class BoxQueryVO {
@ApiModelProperty(value = "发货方式:1、多票,2、单票")
private Integer deliveryType;
@ApiModelProperty(value = "始发仓多选")
private List<Long> startWarehouseIdList;
@ApiModelProperty(value = "目的国多选")
private List<Long> countryIdList;
@ApiModelProperty(value = "目的城市多选")
private List<Long> destCityIdList;
@ApiModelProperty(value = "目的仓多选")
private List<Long> destWarehouseIdList;
@ApiModelProperty(value = "状态多选")
private List<Integer> boxStatusList;
@ApiModelProperty(value = "起运港多选")
private List<Long> bigPortIdList;
@ApiModelProperty(value = "目的港多选")
private List<Long> destPortIdList;
@ApiModelProperty(value = "订舱公司多选")
private List<Long> spaceCompanyIdList;
@ApiModelProperty(value = "驳船港多选")
private List<Long> bargePortIdList;
/**
* 预计驳船时间
*/
@ApiModelProperty(value = "预计驳船开始时间")
// @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String bargeBeginTime;
@ApiModelProperty(value = "预计驳船结束时间")
// //@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String bargeEndTime;
/**
* 预计开船时间
*/
@ApiModelProperty(value = "预计开船开始时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String sailBeginTime;
@ApiModelProperty(value = "预计开船结束时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String sailEndTime;
/**
* 截补料时间
*/
@ApiModelProperty(value = "截补料开始时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String ladingBillBeginTime;
@ApiModelProperty(value = "截补料结束时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String ladingBillEndTime;
/**
* VGM提交时间
*/
@ApiModelProperty(value = "VGM提交开始时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String customsBeginTime;
@ApiModelProperty(value = "VGM提交结束时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String customsEndTime;
/**
* 截关时间
*/
@ApiModelProperty(value = "截关开始时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String cutOffBeginTime;
@ApiModelProperty(value = "截关结束时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String cutOffEndTime;
@ApiModelProperty(value = "报关方式多选-海运空运共用")
private List<Integer> dcCustomsTypeList;
@ApiModelProperty(value = "报关公司多选-海运空运共用")
private List<Integer> dcCompanyIdList;
@ApiModelProperty(value = "放行开始时间-海运空运共用")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String dcPassBeginTime;
@ApiModelProperty(value = "放行结束时间-海运空运共用")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String dcPassEndTime;
/**
* 实际开船时间
*/
@ApiModelProperty(value = "实际开船开始时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String dtRealShipBeginTime;
@ApiModelProperty(value = "实际开船结束时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String dtRealShipEndTime;
/**
* 预计到港时间
*/
@ApiModelProperty(value = "预计到港开始时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String dtEstArrivalBeginTime;
@ApiModelProperty(value = "预计到港结束时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String dtEstArrivalEndTime;
@ApiModelProperty(value = "出单方式多选")
private List<Integer> cdOutBillTypeList;
@ApiModelProperty(value = "Agent list状态")
private Integer cdAgentlistType;
@ApiModelProperty(value = "Soncap状态")
private Integer cdSoncapType;
/**
* 预计清关时间
*/
@ApiModelProperty(value = "预计清关开始时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String clEstBeginTime;
/**
* 预计清关时间
*/
@ApiModelProperty(value = "预计清关结束时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String clEstEndTime;
//---------------------------空运--------------------------
@ApiModelProperty(value = "目的港清关多选")
private List<Integer> destinationClearanceList;
@ApiModelProperty(value = "发货方式多选")
private List<Integer> deliveryTypeList;
@ApiModelProperty(value = "出货渠道多选")
private List<Long> shippingChannelIdList;
@ApiModelProperty(value = "空运起运港多选")
private List<Long> departurePortIdList;
@ApiModelProperty(value = "空运目的港多选")
private List<Long> airDestPortIdList;
@ApiModelProperty(value = "航程")
private Integer voyage;
@ApiModelProperty(value = "订舱代理多选")
private List<Long> shipperIdList;
@ApiModelProperty(value = "航空公司多选")
private List<Long> airlineCompanyIdList;
@ApiModelProperty(value = "预计起飞开始时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String flyBeginTime;
@ApiModelProperty(value = "预计起飞结束时间")
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String flyEndTime;
@ApiModelProperty(value = "代理公司Agent多选")
private List<Long> agentIdList;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment