|
|
@@ -1,18 +1,34 @@
|
|
|
package com.sckw.transport.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.model.page.PageHelperUtil;
|
|
|
import com.sckw.core.model.page.PageResult;
|
|
|
+import com.sckw.core.utils.StringUtils;
|
|
|
+import com.sckw.core.web.constant.HttpStatus;
|
|
|
+import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
+import com.sckw.transport.common.enums.LogisticsOrderEnum;
|
|
|
+import com.sckw.transport.dao.KwtLogisticsOrderMapper;
|
|
|
+import com.sckw.transport.dao.KwtLogisticsOrderTrackMapper;
|
|
|
+import com.sckw.transport.model.KwtLogisticsOrder;
|
|
|
+import com.sckw.transport.model.KwtLogisticsOrderTrack;
|
|
|
+import com.sckw.transport.model.dto.OrderDTO;
|
|
|
+import com.sckw.transport.model.dto.OrderTakingDTO;
|
|
|
import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
|
|
|
import com.sckw.transport.model.vo.AcceptCarriageOrderVO;
|
|
|
import com.sckw.transport.model.vo.CarWaybillVO;
|
|
|
import com.sckw.transport.model.vo.ConsignmentVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+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;
|
|
|
|
|
|
/**
|
|
|
@@ -24,6 +40,12 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class AcceptCarriageOrderService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private KwtLogisticsOrderMapper logisticsOrderMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private KwtLogisticsOrderTrackMapper logisticsOrderTrackMapper;
|
|
|
+
|
|
|
public HttpResult list(AcceptCarriageOrderQuery query) {
|
|
|
List<AcceptCarriageOrderVO> list = new ArrayList<>();
|
|
|
AcceptCarriageOrderVO acceptCarriageOrderVo = new AcceptCarriageOrderVO();
|
|
|
@@ -52,4 +74,49 @@ public class AcceptCarriageOrderService {
|
|
|
public List export(AcceptCarriageOrderQuery query) {
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ public List acceptOrder(OrderDTO orderDTO) {
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否接单
|
|
|
+ *
|
|
|
+ * @param orderDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public HttpResult orderTaking(OrderTakingDTO orderDTO) {
|
|
|
+ log.info("接单操作接收数据:{}", JSONObject.toJSONString(orderDTO));
|
|
|
+ HttpResult result = new HttpResult();
|
|
|
+ result.setCode(HttpStatus.SUCCESS_CODE);
|
|
|
+ KwtLogisticsOrder logisticsOrder = logisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
|
|
|
+ .eq(StringUtils.isNotBlank(orderDTO.getLOrderId()), KwtLogisticsOrder::getId, orderDTO.getLOrderId())
|
|
|
+ .eq(StringUtils.isNotBlank(orderDTO.getLOrderNo()), KwtLogisticsOrder::getLOrderNo, orderDTO.getLOrderNo())
|
|
|
+ .eq(KwtLogisticsOrder::getEntId, LoginUserHolder.getEntId()));
|
|
|
+ if (logisticsOrder == null) {
|
|
|
+ result.setMsg("单据不存在!");
|
|
|
+ }
|
|
|
+ if (orderDTO.getType()) {
|
|
|
+ logisticsOrderTrackMapper.update(null, new LambdaUpdateWrapper<KwtLogisticsOrderTrack>()
|
|
|
+ .eq(StringUtils.isNotBlank(orderDTO.getLOrderId()), KwtLogisticsOrderTrack::getLOrderId, orderDTO.getLOrderId())
|
|
|
+ .set(KwtLogisticsOrderTrack::getStatus, LogisticsOrderEnum.WAIT_DELIVERY.getCode())
|
|
|
+ .set(KwtLogisticsOrderTrack::getUpdateBy, LoginUserHolder.getUserId())
|
|
|
+ .set(KwtLogisticsOrderTrack::getUpdateTime, new Date()));
|
|
|
+ } else {
|
|
|
+ logisticsOrderTrackMapper.update(null, new LambdaUpdateWrapper<KwtLogisticsOrderTrack>()
|
|
|
+ .eq(StringUtils.isNotBlank(orderDTO.getLOrderId()), KwtLogisticsOrderTrack::getLOrderId, orderDTO.getLOrderId())
|
|
|
+ .set(KwtLogisticsOrderTrack::getStatus, LogisticsOrderEnum.SEND_BACK.getCode())
|
|
|
+ .set(KwtLogisticsOrderTrack::getUpdateBy, LoginUserHolder.getUserId())
|
|
|
+ .set(StringUtils.isNotBlank(orderDTO.getRemark()), KwtLogisticsOrderTrack::getRemark, orderDTO.getRemark())
|
|
|
+ .set(KwtLogisticsOrderTrack::getUpdateTime, new Date()));
|
|
|
+ }
|
|
|
+ logisticsOrderMapper.update(null, new LambdaUpdateWrapper<KwtLogisticsOrder>()
|
|
|
+ .eq(StringUtils.isNotBlank(orderDTO.getLOrderId()), KwtLogisticsOrder::getId, orderDTO.getLOrderId())
|
|
|
+ .eq(StringUtils.isNotBlank(orderDTO.getLOrderNo()), KwtLogisticsOrder::getLOrderNo, orderDTO.getLOrderNo())
|
|
|
+ .set(KwtLogisticsOrder::getUpdateTime, new Date())
|
|
|
+ .set(KwtLogisticsOrder::getUpdateBy, LoginUserHolder.getUserId()));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|