|
@@ -1,11 +1,24 @@
|
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
+import com.baomidou.mybatisplus.plugins.Page;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.CarrierInfo;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.FreightInfo;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.OrderInfo;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.OrderInfoMapper;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.ICarrierInfoService;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.IFreightInfoService;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.IOrderInfoService;
|
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 记录订单详情信息 服务实现类
|
|
@@ -17,4 +30,88 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo> implements IOrderInfoService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IFreightInfoService freightInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ICarrierInfoService carrierInfoService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 订单列表
|
|
|
+ *
|
|
|
+ * @param orderInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<OrderInfo> selectOrderInfo(OrderInfo orderInfo) {
|
|
|
+ Map<String, Object> pageView = new HashMap<>();
|
|
|
+ pageView.put("startRecord", (orderInfo.getCurrentPage() - 1)
|
|
|
+ * orderInfo.getPageSize());
|
|
|
+ //用户id
|
|
|
+ pageView.put("commonId", orderInfo.getCommonId());
|
|
|
+ pageView.put("searchKeyWord", orderInfo.getSearchKeyWord());
|
|
|
+ pageView.put("searchType", orderInfo.getSearchType());
|
|
|
+ pageView.put("pageSize", orderInfo.getPageSize());
|
|
|
+ pageView.put("currentPage", orderInfo.getCurrentPage());
|
|
|
+ // 查询采购订单总数
|
|
|
+ Integer dataCount = baseMapper.getCountByCondition(pageView);
|
|
|
+ List<OrderInfo> dataList = baseMapper.getListByCondition(pageView);
|
|
|
+ Page<OrderInfo> page = new Page<>();
|
|
|
+ page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
|
|
|
+ page.setTotal(dataCount == null ? 0 : dataCount);
|
|
|
+ page.setCurrent(orderInfo.getCurrentPage());
|
|
|
+ page.setSize(orderInfo.getPageSize());
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 订单详情
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public OrderInfo getOrderInfo (String id){
|
|
|
+ //基本信息
|
|
|
+ OrderInfo orderInfo = this.selectById(id);
|
|
|
+ //承运信息
|
|
|
+ CarrierInfo carrierInfo = carrierInfoService.selectOne(new EntityWrapper<CarrierInfo>().eq(CarrierInfo.QueryFiles.ORDER_ID,id));
|
|
|
+ orderInfo.setCarrierInfo(carrierInfo);
|
|
|
+ //运费信息
|
|
|
+ FreightInfo freightInfo = freightInfoService.selectOne(new EntityWrapper<FreightInfo>().eq(FreightInfo.QueryFiles.ORDER_ID,id));
|
|
|
+ orderInfo.setFreightInfo(freightInfo);
|
|
|
+ return orderInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 终止
|
|
|
+ * @param orderInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String end (OrderInfo orderInfo){
|
|
|
+ //查询订单
|
|
|
+ OrderInfo orderInfo1 = this.selectById(orderInfo.getId());
|
|
|
+ if(orderInfo1 != null){
|
|
|
+ orderInfo1.setOrderStatusKey(StatusEnum.DRIVER_ORDER_END.getFlag());
|
|
|
+ orderInfo1.setOrderStatus(StatusEnum.DRIVER_ORDER_END.getName());
|
|
|
+ this.updateById(orderInfo1);
|
|
|
+ }
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 签约
|
|
|
+ * @param orderInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String signContract (OrderInfo orderInfo){
|
|
|
+ //查询订单
|
|
|
+ OrderInfo orderInfo1 = this.selectById(orderInfo.getId());
|
|
|
+ if(orderInfo1 != null){
|
|
|
+ orderInfo1.setOrderStatusKey(StatusEnum.DRIVER_ORDER_SHIPPING.getFlag());
|
|
|
+ orderInfo1.setOrderStatus(StatusEnum.DRIVER_ORDER_SHIPPING.getName());
|
|
|
+ this.updateById(orderInfo1);
|
|
|
+ }
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
}
|