Commit 9f702dca authored by liuzeheng's avatar liuzeheng

空数据判断、查询修改

parent f1954200
...@@ -392,4 +392,6 @@ public interface ErrorCodeConstants { ...@@ -392,4 +392,6 @@ public interface ErrorCodeConstants {
ErrorCode NO_WAREHOUSE_IN_CAN_NOT_PACKED = new ErrorCode(1004001152, "no.warehouse.in.can.not.packed"); ErrorCode NO_WAREHOUSE_IN_CAN_NOT_PACKED = new ErrorCode(1004001152, "no.warehouse.in.can.not.packed");
ErrorCode ORDER_IS_PRE_INSTALLED = new ErrorCode(1004001153, "order.is.pre.installed"); ErrorCode ORDER_IS_PRE_INSTALLED = new ErrorCode(1004001153, "order.is.pre.installed");
ErrorCode ORDER_IS_NOT_PRE_INSTALLED = new ErrorCode(1004001154, "order.is.not.pre.installed");
} }
...@@ -91,8 +91,10 @@ import com.alibaba.excel.write.metadata.WriteSheet; ...@@ -91,8 +91,10 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -880,6 +882,7 @@ public class OrderQueryServiceImpl implements OrderQueryService { ...@@ -880,6 +882,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
if (Objects.isNull(query.getLang())) { if (Objects.isNull(query.getLang())) {
query.setLang(I18nMessage.getLang()); query.setLang(I18nMessage.getLang());
} }
caseStatus(query.getStatus(),query);
IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page); IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString()); log.warn(I18nMessage.getLang().toString());
...@@ -890,6 +893,163 @@ public class OrderQueryServiceImpl implements OrderQueryService { ...@@ -890,6 +893,163 @@ public class OrderQueryServiceImpl implements OrderQueryService {
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize()); return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
public void caseStatus(List<Integer> status,OrderQueryDTO query){
if (CollectionUtils.isNotEmpty(status) ) {
List<Integer> statusList =new ArrayList<>() ;
status.forEach(statu->{
if(statu>10000){
combinedState(statu, query,statusList);
}
});
statusList.stream().distinct();
List<Integer> list= new ArrayList<>() ;
list.addAll(status.stream().filter(s->s <10000).collect(Collectors.toList())) ;
list.addAll(statusList.stream().distinct().collect(Collectors.toList()));
query.setStatusList(list) ;
}
}
private void combinedState(Integer asStatus, OrderQueryDTO query,List<Integer> statusList) {
switch (asStatus) {
case 12325:
//this.status = 12;
statusList.add(12);
query.setShipmentState(325);
break;
case 10501:
// 空运待出
//this.status = 5;
statusList.add(5);
//query.setTransportId(3); // 空运待出查询,只查空运的订单
if(Objects.nonNull(query.getTransportId())){
query.setTransportId(3);
}
query.setAirShipment(1);
//this.auditType = 0;
if(CollectionUtils.isEmpty(query.getAuditType())){
List<Integer> audits= new ArrayList<>();
query.setAuditType(audits) ;
query.getAuditType().add(0) ;
}else {
query.getAuditType().add(0) ;
}
//this.abnormalState = 0;
if(CollectionUtils.isEmpty(query.getAbnormalState())){
List<Integer> audits= new ArrayList<>();
query.setAbnormalState(audits);
query.getAbnormalState().add(0) ;
}else {
query.getAbnormalState().add(0) ;
}
break;
case 10502:
// 空运可出
//this.status = 5;
statusList.add(5);
//query.setTransportId(3); // 空运待出查询,只查空运的订单
if(Objects.nonNull(query.getTransportId())){
query.setTransportId(3);
}
query.setAirShipment(12) ; // 可出、备货中
break;
case 10503:
// 空运已备货
//this.status = 5;
statusList.add(5);
//query.setTransportId(3); // 空运待出查询,只查空运的订单
if(Objects.nonNull(query.getTransportId())){
query.setTransportId(3);
}
query.setAirShipment(4) ; // 已备货
break;
case 10504:
// 待排单
//this.status = 5;
statusList.add(5);
if (Objects.nonNull(query.getTransportId()) && query.getTransportId() == 3) {
// 空运无需判断备货状态 可出、备货中、已备货
query.setAirShipment(10) ;
}else {
// 兼容空运已入仓的可出、备货中、已备货,且无异常无审批,海运的已入仓无异常无审批
query.setAirShipment(20) ;
}
//this.auditType = 0;
if(CollectionUtils.isEmpty(query.getAuditType())){
List<Integer> audits= new ArrayList<>();
query.setAuditType(audits) ;
query.getAuditType().add(0);
}else {
query.getAuditType().add(0) ;
}
//this.abnormalState = 0;
if(CollectionUtils.isEmpty(query.getAbnormalState())){
List<Integer> audits= new ArrayList<>();
query.setAbnormalState(audits);
query.getAbnormalState().add(0) ;
}else {
query.getAbnormalState().add(0) ;
}
break;
case 132411:
// 空运已出货
//this.status = 32;
statusList.add(32);
//query.setTransportId(3); // 空运待出查询,只查空运的订单
if(Objects.nonNull(query.getTransportId())){
query.setTransportId(3);
}
query.setShipmentState(411);
break;
case 132412:
// 空运已出仓
//this.status = 32;
statusList.add(32);
//query.setTransportId(3); // 空运待出查询,只查空运的订单
if(Objects.nonNull(query.getTransportId())){
query.setTransportId(3);
}
query.setShipmentState(412);
break;
case 132409:
// 空运已理货
//this.status = 32;
statusList.add(32);
// 空运待出查询,只查空运的订单
if(Objects.nonNull(query.getTransportId())){
query.setTransportId(3);
}
query.setShipmentState( 409);
break;
case 118428:
// 空运已到港
//this.status = 18;
statusList.add(18);
//query.setTransportId(3); // 空运待出查询,只查空运的订单
if(Objects.nonNull(query.getTransportId())){
query.setTransportId(3);
}
query.setShipmentState( 428);
break;
}
}
@Override @Override
public long orderCount(OrderQueryVO query) { public long orderCount(OrderQueryVO query) {
return orderMapper.orderCount(query); return orderMapper.orderCount(query);
...@@ -910,6 +1070,7 @@ public class OrderQueryServiceImpl implements OrderQueryService { ...@@ -910,6 +1070,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
@Override @Override
public PageResult<OrderBackPageVO> deptOrderPage1(OrderQueryDTO query, PageVO page) { public PageResult<OrderBackPageVO> deptOrderPage1(OrderQueryDTO query, PageVO page) {
query.setLang(I18nMessage.getLang()); query.setLang(I18nMessage.getLang());
caseStatus(query.getStatus(),query);
IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page); IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page);
long total = orderMapper.deptOrderCount1(query); long total = orderMapper.deptOrderCount1(query);
log.warn(I18nMessage.getLang().toString()); log.warn(I18nMessage.getLang().toString());
...@@ -1509,6 +1670,7 @@ public class OrderQueryServiceImpl implements OrderQueryService { ...@@ -1509,6 +1670,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
@Override @Override
public StatisticsOrderVO statisticsMyOrder(OrderQueryDTO query) { public StatisticsOrderVO statisticsMyOrder(OrderQueryDTO query) {
caseStatus(query.getStatus(),query);
StatisticsOrderVO vo = orderMapper.statisticsMyOrder(query); StatisticsOrderVO vo = orderMapper.statisticsMyOrder(query);
if (Objects.nonNull(vo)) { if (Objects.nonNull(vo)) {
vo.setTotalVolume(new BigDecimal(vo.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString()); vo.setTotalVolume(new BigDecimal(vo.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
......
...@@ -1003,26 +1003,26 @@ ...@@ -1003,26 +1003,26 @@
</if> </if>
</if> </if>
<!-- <if test="query.status != null and query.status.size()>0">--> <if test="query.statusList != null and query.statusList.size()>0">
<!-- <if test="query.status != null and query.status != '' and query.status.size()==1 ">--> <if test="query.statusList != null and query.statusList != '' and query.statusList.size()==1 ">
<!-- AND o.`status` =--> AND o.`status` =
<!-- <foreach item='status' index="index" collection='query.status' >--> <foreach item='status' index="index" collection='query.statusList' >
<!-- #{status}--> #{status}
<!-- </foreach>--> </foreach>
<!-- </if>--> </if>
<!-- <if test="query.status != null and query.status != '' and query.status.size()>1 ">--> <if test="query.statusList != null and query.statusList != '' and query.statusList.size()>1 ">
<!-- AND o.`status` in--> AND o.`status` in
<!-- <foreach item='status' index="index" collection='query.status' open='(' separator=',' close=')'>--> <foreach item='status' index="index" collection='query.statusList' open='(' separator=',' close=')'>
<!-- #{status}--> #{status}
<!-- </foreach>--> </foreach>
<!-- </if>--> </if>
<!-- </if>-->
<if test="query.status != null">
AND o.`status` = #{query.status}
</if> </if>
<!-- <if test="query.status != null">-->
<!-- AND o.`status` = #{query.status}-->
<!-- </if>-->
<!-- <if test="query.abnormalState != null">--> <!-- <if test="query.abnormalState != null">-->
<!-- <choose>--> <!-- <choose>-->
<!-- <when test="query.abnormalState != 0">--> <!-- <when test="query.abnormalState != 0">-->
......
...@@ -181,6 +181,9 @@ public class BoxOrderCheckInfoServiceImpl extends AbstractService<BoxOrderCheckI ...@@ -181,6 +181,9 @@ public class BoxOrderCheckInfoServiceImpl extends AbstractService<BoxOrderCheckI
} else if (createReqVO.getType() == 1) {//合包 } else if (createReqVO.getType() == 1) {//合包
List<BoxPkgOrderDO> boxPkgOrderDOS = boxPkgOrderService.selectList(BoxPkgOrderDO::getPkgId, createReqVO.getPkgId()); List<BoxPkgOrderDO> boxPkgOrderDOS = boxPkgOrderService.selectList(BoxPkgOrderDO::getPkgId, createReqVO.getPkgId());
orderIdList = boxPkgOrderDOS.stream().map(BoxPkgOrderDO::getOrderId).collect(Collectors.toSet()); orderIdList = boxPkgOrderDOS.stream().map(BoxPkgOrderDO::getOrderId).collect(Collectors.toSet());
if(orderIdList.isEmpty() || CollectionUtil.isEmpty(orderIdList)){
throw exception(ErrorCodeConstants.ORDER_IS_NOT_PRE_INSTALLED);
}
orderDOList = orderQueryService.getOrderList(orderIdList); orderDOList = orderQueryService.getOrderList(orderIdList);
boolean isParentOrder = false; boolean isParentOrder = false;
if(!orderIdList.contains(orderId)) { if(!orderIdList.contains(orderId)) {
......
...@@ -83,14 +83,30 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B ...@@ -83,14 +83,30 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String scanOrderNoCreate(BoxPkgOrderScanCodeVO createReqVO){ public String scanOrderNoCreate(BoxPkgOrderScanCodeVO createReqVO){
BoxPkgOrderCreateReqVO vo = new BoxPkgOrderCreateReqVO(); BoxPkgOrderCreateReqVO vo = new BoxPkgOrderCreateReqVO();
Long orderId = orderService.getOrderIdByOrderNo(createReqVO.getOrderNo());
vo.setOrderId(orderId);
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getPkgNum,createReqVO.getPkgNum()));
vo.setPkgId(boxMergePkgDO.getId()) ;
if(vo.getOrderId()!=null && vo.getPkgId()!=null){//订单和包裹id 不为空,调用装箱方法 String orderNumCode = createReqVO.getOrderNo();
this.create(vo); int position = orderNumCode.lastIndexOf("-");
if(position >= 0) {
String orderNumber = orderNumCode.substring(0, position);
Long orderId = orderService.getOrderIdByOrderNo(orderNumber);
vo.setOrderId(orderId);
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getPkgNum,createReqVO.getPkgNum()));
vo.setPkgId(boxMergePkgDO.getId()) ;
if(vo.getOrderId()!=null && vo.getPkgId()!=null){//订单和包裹id 不为空,调用装箱方法
this.create(vo);
}
}else if(!createReqVO.getOrderNo().contains("-")){
Long orderId = orderService.getOrderIdByOrderNo(createReqVO.getOrderNo());
vo.setOrderId(orderId);
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getPkgNum,createReqVO.getPkgNum()));
vo.setPkgId(boxMergePkgDO.getId()) ;
if(vo.getOrderId()!=null && vo.getPkgId()!=null){//订单和包裹id 不为空,调用装箱方法
this.create(vo);
}
} }
// 返回 // 返回
return "success"; return "success";
} }
......
...@@ -260,3 +260,4 @@ case.num.in.merge.pkg= ...@@ -260,3 +260,4 @@ case.num.in.merge.pkg=
order.already.in.merge.pkg= order.already.in.merge.pkg=
customer.is.new.or.old.no.change= customer.is.new.or.old.no.change=
order.is.pre.installed= order.is.pre.installed=
order.is.not.pre.installed=
...@@ -1000,3 +1000,4 @@ case.num.in.merge.pkg=\u6B64\u7BB1\u5DF2\u88AB\u5408\u5305\uFF0C\u8BF7\u626B\u63 ...@@ -1000,3 +1000,4 @@ case.num.in.merge.pkg=\u6B64\u7BB1\u5DF2\u88AB\u5408\u5305\uFF0C\u8BF7\u626B\u63
order.already.in.merge.pkg=\u8BA2\u5355\u5DF2\u5728\u5408\u5305\u7BB1\u4E0B order.already.in.merge.pkg=\u8BA2\u5355\u5DF2\u5728\u5408\u5305\u7BB1\u4E0B
customer.is.new.or.old.no.change=\u5BA2\u6237\u5F53\u524D\u4E1A\u7EE9\u7C7B\u578B\u662F{}\u5BA2\u6237\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0 customer.is.new.or.old.no.change=\u5BA2\u6237\u5F53\u524D\u4E1A\u7EE9\u7C7B\u578B\u662F{}\u5BA2\u6237\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0
order.is.pre.installed=\u8BA2\u5355\u5DF2\u9884\u88C5 order.is.pre.installed=\u8BA2\u5355\u5DF2\u9884\u88C5
order.is.not.pre.installed =\u8BA2\u5355\u672A\u88C5\u7BB1\uFF0C\u4E0D\u80FD\u5408\u5305
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