提交 61c45339 作者: zhenjie

采购订单优化、修改

上级 aec5b71c
......@@ -45,7 +45,7 @@ public class UavPOController extends BaseController {
@ApiOperation(value = "订单详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UavPurchaseOrderDTO.class)})
@GetMapping("getPurchaseOrder")
private ResultBody getPurchaseOrder(@RequestParam Integer id, HttpServletRequest request){
private ResultBody getPurchaseOrder(@RequestParam Integer id, HttpServletRequest request) throws Exception {
return uavPOService.getPurchaseOrder(id, this.getCurrentAccount(request));
}
......
......@@ -2,6 +2,7 @@ package com.mmc.oms.model.dto.uav;
import com.mmc.oms.entity.uav.UavPurchaseOrderPayDO;
import com.mmc.oms.model.dto.ContractInfoDTO;
import com.mmc.oms.model.dto.kdn.KdnExpDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -60,5 +61,7 @@ public class UavPurchaseOrderDTO implements Serializable {
private ContractInfoDTO contractInfoDTO;
@ApiModelProperty("支付凭证列表")
private List<UavOrderPayDTO> payDTOS;
@ApiModelProperty("支付凭证列表")
private KdnExpDTO kdnExpDTO;
}
......@@ -16,7 +16,7 @@ public interface UavPOService {
ResultBody listPurchase(UavPOrderQO uavPOrderQO, BaseAccountDTO currentAccount);
ResultBody getPurchaseOrder(Integer id, BaseAccountDTO currentAccount);
ResultBody getPurchaseOrder(Integer id, BaseAccountDTO currentAccount) throws Exception;
ResultBody upLoadPay(UavOrderPayVO uavOrderPayVO);
......@@ -25,4 +25,6 @@ public interface UavPOService {
ResultBody send(UavOrderExpressVO param);
ResultBody uavPOFinishSign(String orderNo);
ResultBody receive(Integer id);
}
......@@ -447,6 +447,8 @@ public class UavOrderServiceImpl implements UavOrderService {
uavOrderDao.updateUavOrderProportion(uavOrderDO.getId(), UavOrderProportion.PROPORTION.intValue());
}
this.updateUavOrderStatus(id, UavOrderStatus.WAITING_RECEIVE_GOODS);
// 修改采购订单状态
uavPOService.receive(id);
return ResultBody.success();
}
......
package com.mmc.oms.service.uav.impl;
import com.mmc.oms.common.ResultEnum;
import com.mmc.oms.common.json.JsonUtil;
import com.mmc.oms.common.result.PageResult;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.common.util.KdnExpressUtil;
import com.mmc.oms.dao.uav.UavOrderDao;
import com.mmc.oms.dao.uav.UavOrderExpressDao;
import com.mmc.oms.dao.uav.UavPODao;
......@@ -13,6 +15,8 @@ import com.mmc.oms.entity.uav.UavPurchaseOrderPayDO;
import com.mmc.oms.enums.UavOrderStatus;
import com.mmc.oms.feign.UserAppApi;
import com.mmc.oms.model.dto.ContractInfoDTO;
import com.mmc.oms.model.dto.kdn.KdnExpDTO;
import com.mmc.oms.model.dto.order.ExpStationsDTO;
import com.mmc.oms.model.dto.uav.UavOrderPayDTO;
import com.mmc.oms.model.dto.uav.UavPurchaseOrderDTO;
import com.mmc.oms.model.dto.user.BaseAccountDTO;
......@@ -30,9 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -122,7 +124,7 @@ public class UavPOServiceImpl implements UavPOService {
}
@Override
public ResultBody getPurchaseOrder(Integer id, BaseAccountDTO currentAccount) {
public ResultBody getPurchaseOrder(Integer id, BaseAccountDTO currentAccount) throws Exception {
UavPurchaseOrderDO uavPOrder = uavPODao.getUavPOrder(id);
if(uavPOrder == null) {
return ResultBody.error("订单不存在!");
......@@ -131,6 +133,11 @@ public class UavPOServiceImpl implements UavPOService {
// 收货信息
UavOrderExpressDO uavOrderExpressDO = uavOrderExpressDao.getUavOrderExpressDO(uavPOrder.getUavOrderId());
uavPurchaseOrderDTO.setUavOrderExpressDTO(uavOrderExpressDO == null ? null : uavOrderExpressDO.buildUavOrderExpressDTO());
// 快递信息
KdnExpDTO kdnExpDTO = this.getOrderExpInfo(uavOrderExpressDO);
if (kdnExpDTO != null) {
uavPurchaseOrderDTO.setKdnExpDTO(kdnExpDTO);
}
// 付款凭证信息
List<UavPurchaseOrderPayDO> purchaseOrderPayDOS = uavPODao.listUavPOrderPay(id);
List<UavOrderPayDTO> uavOrderPayDTOS = purchaseOrderPayDOS.stream().map(UavPurchaseOrderPayDO::buildUavOrderPayDTO).collect(Collectors.toList());
......@@ -153,6 +160,23 @@ public class UavPOServiceImpl implements UavPOService {
return ResultBody.success(uavPurchaseOrderDTO);
}
private KdnExpDTO getOrderExpInfo(UavOrderExpressDO exp) throws Exception {
String json = "";
if ("SF".equals(exp.getSendExpCode())) {
json = KdnExpressUtil.SF(exp.getTakePhone(), exp.getSendExpNo());
} else if ("JD".equals(exp.getSendExpCode())) {
json = KdnExpressUtil.JD("", exp.getSendExpNo());
} else {
json = KdnExpressUtil.others(exp.getSendExpCode(), exp.getSendExpNo());
}
KdnExpDTO kdn = JsonUtil.parseJsonToObj(json, KdnExpDTO.class);
kdn.setLogisticCode(exp.getSendExpNo());
if (!org.springframework.util.CollectionUtils.isEmpty(kdn.getTraces())) {
Collections.sort(kdn.getTraces(), Comparator.comparing(ExpStationsDTO::getAcceptTime).reversed());// 升序
}
return kdn;
}
@Override
public ResultBody upLoadPay(UavOrderPayVO uavOrderPayVO) {
UavPurchaseOrderDO uavPOrder = uavPODao.getUavPOrder(uavOrderPayVO.getUavOrderId());
......@@ -183,6 +207,7 @@ public class UavPOServiceImpl implements UavPOService {
}
@Override
@Transactional
public ResultBody send(UavOrderExpressVO param) {
UavPurchaseOrderDO uavPOrder = uavPODao.getUavPOrderByUavOId(param.getUavOrderId());
if (!uavPOrder.getStatusCode().equals(UavOrderStatus.WAITING_DELIVER_GOODS.getCode())) {
......@@ -207,4 +232,12 @@ public class UavPOServiceImpl implements UavPOService {
this.updateUavPOrderStatus(uavPOrder.getId(), UavOrderStatus.SIGN);
return ResultBody.success();
}
@Override
public ResultBody receive(Integer uavOrderId) {
// 修改订单状态
UavPurchaseOrderDO uavPurchaseOrderDO = uavPODao.getUavPOrderByUavOId(uavOrderId);
this.updateUavPOrderStatus(uavPurchaseOrderDO.getId(), UavOrderStatus.WAITING_REMARK);
return ResultBody.success();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论