|
|
@@ -5,6 +5,7 @@ import java.sql.Timestamp;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
@@ -12,6 +13,7 @@ import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
@@ -56,10 +58,7 @@ import com.fs.live.param.*;
|
|
|
import com.fs.live.service.ILiveOrderItemService;
|
|
|
import com.fs.live.service.ILiveOrderLogsService;
|
|
|
import com.fs.live.service.ILiveOrderService;
|
|
|
-import com.fs.live.vo.LiveAfterSalesListUVO;
|
|
|
-import com.fs.live.vo.LiveAfterSalesQueryVO;
|
|
|
-import com.fs.live.vo.LiveAfterSalesVo;
|
|
|
-import com.fs.live.vo.LiveOrderItemVO1;
|
|
|
+import com.fs.live.vo.*;
|
|
|
import com.fs.store.config.StoreConfig;
|
|
|
import com.fs.store.domain.*;
|
|
|
import com.fs.store.service.cache.IFsUserCacheService;
|
|
|
@@ -201,6 +200,17 @@ public class LiveAfterSalesServiceImpl implements ILiveAfterSalesService {
|
|
|
public List<LiveAfterSalesVo> selectLiveAfterSalesVoList(LiveAfterSalesVo liveAfterSales)
|
|
|
{
|
|
|
List<LiveAfterSalesVo> liveAfterSalesVos = baseMapper.selectLiveAfterSalesVoList(liveAfterSales);
|
|
|
+ List<Long> orderIds = new ArrayList<>();
|
|
|
+ Map<Long, List<LiveOrderItemListUVO>> orderItemMap = new HashMap<>();
|
|
|
+ if(null != liveAfterSalesVos && !liveAfterSalesVos.isEmpty()){
|
|
|
+ orderIds = liveAfterSalesVos.stream().map(e -> e.getOrderId()).collect(Collectors.toList());
|
|
|
+ if(null != orderIds && !orderIds.isEmpty()){
|
|
|
+ List<LiveOrderItemListUVO> liveOrderItemListUVOS = liveOrderItemMapper.selectLiveOrderItemListUVOByOrderIds(orderIds);
|
|
|
+ orderItemMap = liveOrderItemListUVOS.stream()
|
|
|
+ .collect(Collectors.groupingBy(LiveOrderItemListUVO::getOrderId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boolean mapEmpty = orderItemMap.isEmpty();
|
|
|
for (LiveAfterSalesVo item : liveAfterSalesVos) {
|
|
|
if(ObjectUtil.isNotNull(item.getUserId())) {
|
|
|
FsUser fsUser = fsUserCacheService.selectFsUserById(item.getUserId());
|
|
|
@@ -217,6 +227,41 @@ public class LiveAfterSalesServiceImpl implements ILiveAfterSalesService {
|
|
|
item.setCompanyName("-");
|
|
|
}
|
|
|
|
|
|
+ if(!mapEmpty && orderItemMap.containsKey(item.getOrderId())){
|
|
|
+ List<LiveOrderItemListUVO> liveOrderItemListUVOS = orderItemMap.get(item.getOrderId());
|
|
|
+ for (LiveOrderItemListUVO liveOrderItemListUVO : liveOrderItemListUVOS) {
|
|
|
+ try {
|
|
|
+ JSONObject jsO = JSONObject.parseObject(liveOrderItemListUVO.getJsonInfo());
|
|
|
+ item.setProductName(StringUtils.isNotBlank(item.getProductName()) ? item.getProductName() + "," + jsO.getString("productName") : jsO.getString("productName"));
|
|
|
+ item.setProductBarCode(StringUtils.isNotBlank(item.getProductBarCode()) ? item.getProductBarCode() + "," + jsO.getString("barCode") : jsO.getString("barCode"));
|
|
|
+ item.setSku(StringUtils.isNotBlank(item.getSku()) ? item.getSku() + "," + jsO.getString("sku") : jsO.getString("sku"));
|
|
|
+ item.setNum(StringUtils.isNotBlank(item.getNum()) ? item.getNum() + "," + jsO.getString("num") : jsO.getString("num"));
|
|
|
+ item.setPrice(StringUtils.isNotBlank(item.getPrice()) ? item.getPrice() + "," + jsO.getString("price") : jsO.getString("price"));
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error("售后订单商品信息转换异常",ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// if (StringUtils.isNotBlank(item.getItemJson())) {
|
|
|
+// try {
|
|
|
+// JSONArray array = JSONObject.parseArray(item.getItemJson());
|
|
|
+// if(null != array && !array.isEmpty()){
|
|
|
+// for (Object o : array) {
|
|
|
+// JSONObject jsO = (JSONObject) o;
|
|
|
+// item.setProductName(StringUtils.isNotBlank(item.getProductName())?item.getProductName()+","+jsO.getString("productName"):jsO.getString("productName"));
|
|
|
+// item.setProductBarCode(StringUtils.isNotBlank(item.getProductBarCode())?item.getProductBarCode()+","+jsO.getString("barCode"):jsO.getString("barCode"));
|
|
|
+// item.setSku(StringUtils.isNotBlank(item.getSku())?item.getSku()+","+jsO.getString("sku"):jsO.getString("sku"));
|
|
|
+// item.setNum(null != item.getNum()?item.getNum() +jsO.getInteger("num"):jsO.getInteger("num"));
|
|
|
+// item.setPrice(null != item.getPrice()?item.getPrice().add(jsO.getBigDecimal("price")):jsO.getBigDecimal("price"));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } catch (Exception ex) {
|
|
|
+// log.error("售后订单商品信息转换异常",ex);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
// if(ObjectUtil.isNotNull(item.getOrderId())){
|
|
|
// List<FsStoreDelivers> byOrderIdWithType = fsStoreDeliversService.findByOrderIdWithType(item.getOrderId(), 1);
|
|
|
// if(CollectionUtils.isNotEmpty(byOrderIdWithType)) {
|