|
@@ -5,9 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
-import com.ym.mec.biz.dal.dto.GoodsSellDto;
|
|
|
-import com.ym.mec.biz.dal.dto.PageInfoOrder;
|
|
|
-import com.ym.mec.biz.dal.dto.StudentPaymentRouteOrderDto;
|
|
|
+import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
|
|
@@ -24,6 +22,7 @@ import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import com.ym.mec.util.excel.POIUtil;
|
|
|
import com.ym.mec.util.ini.IniFileUtil;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -68,6 +67,8 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
|
|
|
private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
|
|
|
@Resource
|
|
|
private MusicGroupCalenderRefundPeriodService musicGroupCalenderRefundPeriodService;
|
|
|
+ @Resource
|
|
|
+ private CooperationOrganDao cooperationOrganDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentPaymentRouteOrder> getDAO() {
|
|
@@ -511,4 +512,46 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
|
|
|
return httpResponseResult;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public OutOrderInfoDto getRouteOrder(Long orderId) {
|
|
|
+ OutOrderInfoDto outOrderInfoDto = new OutOrderInfoDto();
|
|
|
+ StudentPaymentOrder order = studentPaymentOrderService.get(orderId);
|
|
|
+ outOrderInfoDto.setStudentPaymentOrder(order);
|
|
|
+ StudentPaymentRouteOrder routeOrder = studentPaymentRouteOrderDao.getByOrderNo(order.getOrderNo());
|
|
|
+ String goodsJson = routeOrder.getGoodsJson();
|
|
|
+ if(StringUtils.isNotEmpty(goodsJson)){
|
|
|
+ JSONObject jsonObj = JSON.parseObject(goodsJson);
|
|
|
+ List<GoodsNameDto> goodsSellDtos = new ArrayList<>();
|
|
|
+ for (Map.Entry<String, Object> goodsMap : jsonObj.entrySet()) {
|
|
|
+ GoodsNameDto goodsSellDto = new GoodsNameDto();
|
|
|
+ goodsSellDto.setGoodsId(Integer.parseInt(goodsMap.getKey()));
|
|
|
+ goodsSellDto.setGoodsNum(Integer.parseInt(goodsMap.getValue().toString()));
|
|
|
+ goodsSellDtos.add(goodsSellDto);
|
|
|
+ }
|
|
|
+ List<Integer> goosIds = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
|
|
|
+ List<Goods> goodies = goodsDao.getGoodies(goosIds);
|
|
|
+ if(CollectionUtils.isNotEmpty(goodies)){
|
|
|
+ Map<Integer, String> goodsMap = goodies.stream().collect(Collectors.toMap(Goods::getId, Goods::getName));
|
|
|
+ goodsSellDtos.forEach(e -> e.setGoodsName(goodsMap.get(e.getGoodsId())));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ outOrderInfoDto.setCalenderId(routeOrder.getCalenderId());
|
|
|
+ if(order.getCooperationId() != null){
|
|
|
+ CooperationOrgan cooperationOrgan = cooperationOrganDao.get(order.getCooperationId());
|
|
|
+ if (cooperationOrgan != null) {
|
|
|
+ outOrderInfoDto.setCoopName(cooperationOrgan.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<SellOrder> sellOrders = sellOrderDao.getOrderSellOrder(orderId);
|
|
|
+ if(CollectionUtils.isNotEmpty(sellOrders)){
|
|
|
+ BigDecimal goodsAmount = sellOrders.stream().map(SellOrder::getActualAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ outOrderInfoDto.setSellOrders(sellOrders);
|
|
|
+ BigDecimal serviceAmount = outOrderInfoDto.getStudentPaymentOrder().getActualAmount().subtract(goodsAmount);
|
|
|
+ outOrderInfoDto.setServiceAmount(serviceAmount);
|
|
|
+ outOrderInfoDto.setGoodsAmount(goodsAmount);
|
|
|
+ }
|
|
|
+
|
|
|
+ return outOrderInfoDto;
|
|
|
+ }
|
|
|
+
|
|
|
}
|