|
|
@@ -27,6 +27,7 @@ import org.dromara.customer.api.*;
|
|
|
import org.dromara.customer.api.domain.dto.CustomerInfoDTO;
|
|
|
import org.dromara.customer.api.domain.vo.RemoteCustomerContactVo;
|
|
|
import org.dromara.customer.api.domain.vo.RemoteCustomerSalesVo;
|
|
|
+import org.dromara.external.api.service.RemoteExternalItemService;
|
|
|
import org.dromara.external.api.tongji.RemoteTongJiPullService;
|
|
|
import org.dromara.external.api.zhongche.RemoteZhongChePullService;
|
|
|
import org.dromara.external.api.zhongche.domain.bo.OrderConfirmBo;
|
|
|
@@ -115,6 +116,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
|
|
|
@DubboReference
|
|
|
private RemoteProductService remoteProductService;
|
|
|
|
|
|
+ @DubboReference
|
|
|
+ private RemoteExternalItemService remoteExternalItemService;
|
|
|
+
|
|
|
private final IOrderCustomerFlowLinkService orderCustomerFlowLinkService;
|
|
|
|
|
|
private final IOrderCustomerFlowNodeLinkService orderCustomerFlowNodeLinkService;
|
|
|
@@ -161,7 +165,10 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
|
|
|
if (orderMainVo == null) {
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
+ if (StringUtils.isNotBlank(orderMainVo.getDataSource())) {
|
|
|
+ Map<String, String> dataSourceMap = remoteExternalItemService.selectItemNameByItemKeys(Set.of(orderMainVo.getDataSource()));
|
|
|
+ orderMainVo.setDataSourceStr(dataSourceMap.get(orderMainVo.getDataSource()));
|
|
|
+ }
|
|
|
// 2. 查询关联的商品列表--并且查询商品已发货数量与未发货数量
|
|
|
List<OrderProductVo> orderProductVoList = orderProductMapper.selectProductsWithDelivered(orderMainVo.getId());
|
|
|
if (orderProductVoList != null && !orderProductVoList.isEmpty()) {
|
|
|
@@ -321,16 +328,18 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
|
|
|
Set<Long> createUserIds = records.stream().map(OrderMainVo::getCreateBy).collect(Collectors.toSet());
|
|
|
Set<Long> createDeptIds = records.stream().map(OrderMainVo::getCreateDept).collect(Collectors.toSet());
|
|
|
Set<Long> orderIds = records.stream().map(OrderMainVo::getParentOrderId).filter(Objects::nonNull).collect(Collectors.toSet());
|
|
|
-
|
|
|
+ Set<String> dataSources = records.stream().map(OrderMainVo::getDataSource).filter(Objects::nonNull).collect(Collectors.toSet());
|
|
|
Map<Long, String> UserMap = remoteUserService.selectUserNamesByIds(createUserIds.stream().toList());
|
|
|
Map<Long, String> deptMap = remoteDeptService.selectDeptNameByIds(createDeptIds);
|
|
|
Map<Long, String> customerMap = remoteCustomerService.selectCustomerNameByIds(customerIds);
|
|
|
+ Map<String, String> dataSourceMap = remoteExternalItemService.selectItemNameByItemKeys(dataSources);
|
|
|
Map<Long, String> orderNoMap = selectOrderNoByIds(orderIds);
|
|
|
records.forEach(orderMainVo -> {
|
|
|
orderMainVo.setProjectOrderNo(orderNoMap.get(orderMainVo.getParentOrderId()));
|
|
|
orderMainVo.setCreateName(UserMap.get(orderMainVo.getCreateBy()));
|
|
|
orderMainVo.setCreateDeptName(deptMap.get(orderMainVo.getCreateDept()));
|
|
|
orderMainVo.setCustomerName(customerMap.get(orderMainVo.getCustomerId()));
|
|
|
+ orderMainVo.setDataSourceStr(dataSourceMap.get(orderMainVo.getDataSource()));
|
|
|
});
|
|
|
}
|
|
|
return TableDataInfo.build(result);
|
|
|
@@ -1111,11 +1120,12 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
|
|
|
*/
|
|
|
@Override
|
|
|
public int updateStatus(OrderMainBo bo) {
|
|
|
+ OrderMainVo orderMainVo = baseMapper.selectVoById(bo.getId());
|
|
|
OrderMain order = new OrderMain();
|
|
|
order.setId(bo.getId());
|
|
|
order.setOrderStatus(bo.getOrderStatus());
|
|
|
//如果是项目订单取消则要调用拒单
|
|
|
- if (Objects.equals("7", bo.getOrderStatus())) {
|
|
|
+ if (ObjectUtils.isNotEmpty(orderMainVo.getDataSource()) && Objects.equals("7", bo.getOrderStatus())) {
|
|
|
this.reject(bo.getId(), "取消订单");
|
|
|
}
|
|
|
return baseMapper.updateById(order);
|
|
|
@@ -1300,12 +1310,12 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
|
|
|
}
|
|
|
String crrcOrderNo = ext.getCrrcOrderNo();
|
|
|
OrderConfirmBo bo = new OrderConfirmBo(crrcOrderNo, orderNo);
|
|
|
- if ("zhongche".equals(orderMain.getDataSource()) ) {
|
|
|
+ if ("zhongche".equals(orderMain.getDataSource())) {
|
|
|
GoodsUpdateVo goodsUpdateVo = zhongChePullService.mallOrderConfirm(bo);
|
|
|
if (goodsUpdateVo.getResult() != 1) {
|
|
|
throw new ZhongcheException("中车订单扩展信息不存在");
|
|
|
}
|
|
|
- }else if ("tongji".equals(orderMain.getDataSource()) ) {
|
|
|
+ } else if ("tongji".equals(orderMain.getDataSource())) {
|
|
|
GoodsUpdateVo goodsUpdateVo = tongJiPullService.mallOrderConfirm(bo);
|
|
|
if (goodsUpdateVo.getResult() != 1) {
|
|
|
throw new ZhongcheException("同济订单扩展信息不存在");
|
|
|
@@ -1343,13 +1353,13 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
|
|
|
throw new ZhongcheException("订单扩展信息不存在");
|
|
|
}
|
|
|
String crrcOrderNo = ext.getCrrcOrderNo();
|
|
|
- if ("zhongche".equals(orderMain.getDataSource()) ) {
|
|
|
+ if ("zhongche".equals(orderMain.getDataSource())) {
|
|
|
OrderRejectBo bo = new OrderRejectBo(crrcOrderNo, orderNo, reason);
|
|
|
GoodsUpdateVo goodsUpdateVo = zhongChePullService.mallOrderReject(bo);
|
|
|
if (goodsUpdateVo.getResult() != 1) {
|
|
|
throw new ZhongcheException("拒绝失败");
|
|
|
}
|
|
|
- }else if ("tongji".equals(orderMain.getDataSource()) ) {
|
|
|
+ } else if ("tongji".equals(orderMain.getDataSource())) {
|
|
|
OrderRejectBo bo = new OrderRejectBo(crrcOrderNo, orderNo, reason);
|
|
|
GoodsUpdateVo goodsUpdateVo = tongJiPullService.mallOrderReject(bo);
|
|
|
if (goodsUpdateVo.getResult() != 1) {
|
|
|
@@ -2474,7 +2484,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
|
|
|
}
|
|
|
|
|
|
private List<PurchaseDetailVo.StatItem> buildStatData(String orderCount, String productCount,
|
|
|
- String brandCount, String categoryCount) {
|
|
|
+ String brandCount, String categoryCount) {
|
|
|
List<PurchaseDetailVo.StatItem> list = new ArrayList<>();
|
|
|
list.add(new PurchaseDetailVo.StatItem().setValue(orderCount).setLabel("购买数量(件)"));
|
|
|
list.add(new PurchaseDetailVo.StatItem().setValue(productCount).setLabel("商品数量(件)"));
|
|
|
@@ -2484,8 +2494,8 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
|
|
|
}
|
|
|
|
|
|
private List<PurchaseDetailVo.AfterSaleItem> buildAfterSaleData(String afterSaleCount, String avgDays,
|
|
|
- String ratio, List<Integer> data1,
|
|
|
- List<Integer> data2, List<Integer> data3) {
|
|
|
+ String ratio, List<Integer> data1,
|
|
|
+ List<Integer> data2, List<Integer> data3) {
|
|
|
List<PurchaseDetailVo.AfterSaleItem> list = new ArrayList<>();
|
|
|
list.add(new PurchaseDetailVo.AfterSaleItem()
|
|
|
.setLabel("售后商品数量(件)").setValue(afterSaleCount)
|