|
@@ -1,68 +1,52 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
-import static com.ym.mec.biz.dal.enums.CouponDetailTypeEnum.ACCESSORIES;
|
|
|
-import static com.ym.mec.biz.dal.enums.CouponDetailTypeEnum.MUSICAL;
|
|
|
-import static com.ym.mec.biz.dal.enums.DealStatusEnum.CLOSE;
|
|
|
-import static com.ym.mec.biz.dal.enums.DealStatusEnum.ING;
|
|
|
-import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
|
|
|
-
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.math.RoundingMode;
|
|
|
-import java.util.*;
|
|
|
-import java.util.concurrent.atomic.AtomicInteger;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import com.ym.mec.biz.dal.entity.*;
|
|
|
-import com.ym.mec.biz.service.*;
|
|
|
-import com.ym.mec.common.dto.BrandDto;
|
|
|
-import com.ym.mec.mall.MallFeignService;
|
|
|
-import org.apache.commons.collections.CollectionUtils;
|
|
|
-import org.apache.commons.lang.math.NumberUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.context.annotation.Lazy;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Isolation;
|
|
|
-import org.springframework.transaction.annotation.Propagation;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
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.GoodsProcurementDao;
|
|
|
import com.ym.mec.biz.dal.dao.MusicGroupDao;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentDao;
|
|
|
import com.ym.mec.biz.dal.dao.StudentGoodsSellDao;
|
|
|
import com.ym.mec.biz.dal.dao.StudentRepairDao;
|
|
|
import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
import com.ym.mec.biz.dal.dto.BasicUserDto;
|
|
|
import com.ym.mec.biz.dal.dto.GoodsSellDto;
|
|
|
import com.ym.mec.biz.dal.dto.RepairGoodsDto;
|
|
|
-import com.ym.mec.biz.dal.enums.AccountType;
|
|
|
-import com.ym.mec.biz.dal.enums.CouponDetailTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.GoodsType;
|
|
|
-import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.PayStatus;
|
|
|
-import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.SellTypeEnum;
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
+import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
+import com.ym.mec.common.dto.BrandDto;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
+import com.ym.mec.mall.MallFeignService;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang.math.NumberUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Isolation;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import static com.ym.mec.biz.dal.enums.CouponDetailTypeEnum.ACCESSORIES;
|
|
|
+import static com.ym.mec.biz.dal.enums.CouponDetailTypeEnum.MUSICAL;
|
|
|
+import static com.ym.mec.biz.dal.enums.DealStatusEnum.*;
|
|
|
|
|
|
@Service
|
|
|
public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRepair> implements StudentRepairService {
|
|
@@ -82,8 +66,6 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
@Autowired
|
|
|
private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
|
@Autowired
|
|
|
- private SysPaymentConfigService sysPaymentConfigService;
|
|
|
- @Autowired
|
|
|
private MusicGroupDao musicGroupDao;
|
|
|
@Autowired
|
|
|
private SysUserCashAccountService sysUserCashAccountService;
|
|
@@ -100,9 +82,6 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
@Autowired
|
|
|
private StudentGoodsSellDao studentGoodsSellDao;
|
|
|
@Autowired
|
|
|
- private GoodsProcurementDao goodsProcurementDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private StudentPaymentOrderAddressService studentPaymentOrderAddressService;
|
|
|
|
|
|
@Lazy
|
|
@@ -223,12 +202,12 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(orderByOrderNo.getId());
|
|
|
String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
|
|
|
if (StringUtils.isNotBlank(goodsIds)) {
|
|
|
- GoodsProcurement goodsProcurement = null;
|
|
|
+// GoodsProcurement goodsProcurement = null;
|
|
|
List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
|
|
|
Map<Integer, Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, t -> t));
|
|
|
Goods goods = null;
|
|
|
Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
|
|
|
- Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
|
|
|
+// Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
|
|
|
|
|
|
for (String goodsIdStr : goodsIds.split(",")) {
|
|
|
if (StringUtils.isBlank(goodsIdStr)) {
|
|
@@ -238,14 +217,14 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
if (batchUpdateGoodsMap.get(goods.getId()) != null) {
|
|
|
goods = batchUpdateGoodsMap.get(goods.getId());
|
|
|
}
|
|
|
- goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
|
|
|
+// goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
|
|
|
goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
|
|
|
goods.setUpdateTime(nowDate);
|
|
|
|
|
|
batchUpdateGoodsMap.put(goods.getId(), goods);
|
|
|
|
|
|
// 进货清单
|
|
|
- goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
|
|
|
+ /*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
|
|
|
if (goodsProcurement != null) {
|
|
|
if (goodsProcurementMap.get(goodsProcurement.getId()) != null) {
|
|
|
goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
|
|
@@ -253,13 +232,13 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
|
|
|
goodsProcurement.setUpdateTime(nowDate);
|
|
|
goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
|
|
|
|
- if (goodsProcurementMap.size() > 0) {
|
|
|
+ /*if (goodsProcurementMap.size() > 0) {
|
|
|
goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
if (batchUpdateGoodsMap.size() > 0) {
|
|
|
goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
|
|
@@ -1174,12 +1153,12 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
|
|
|
String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
|
|
|
if (StringUtils.isNotBlank(goodsIds)) {
|
|
|
- GoodsProcurement goodsProcurement = null;
|
|
|
+// GoodsProcurement goodsProcurement = null;
|
|
|
List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
|
|
|
Map<Integer, Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, t -> t));
|
|
|
Goods goods = null;
|
|
|
Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
|
|
|
- Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
|
|
|
+// Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
|
|
|
|
|
|
for (String goodsIdStr : goodsIds.split(",")) {
|
|
|
if (StringUtils.isBlank(goodsIdStr)) {
|
|
@@ -1189,14 +1168,14 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
if (batchUpdateGoodsMap.get(goods.getId()) != null) {
|
|
|
goods = batchUpdateGoodsMap.get(goods.getId());
|
|
|
}
|
|
|
- goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
|
|
|
+// goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
|
|
|
goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
|
|
|
goods.setUpdateTime(nowDate);
|
|
|
|
|
|
batchUpdateGoodsMap.put(goods.getId(), goods);
|
|
|
|
|
|
// 进货清单
|
|
|
- goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
|
|
|
+/* goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
|
|
|
if (goodsProcurement != null) {
|
|
|
if (goodsProcurementMap.get(goodsProcurement.getId()) != null) {
|
|
|
goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
|
|
@@ -1204,13 +1183,13 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
|
|
|
goodsProcurement.setUpdateTime(nowDate);
|
|
|
goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
|
|
|
|
- if (goodsProcurementMap.size() > 0) {
|
|
|
+ /*if (goodsProcurementMap.size() > 0) {
|
|
|
goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
if (batchUpdateGoodsMap.size() > 0) {
|
|
|
goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
|
|
@@ -1606,12 +1585,12 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
|
|
|
String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
|
|
|
if (StringUtils.isNotBlank(goodsIds)) {
|
|
|
- GoodsProcurement goodsProcurement = null;
|
|
|
+// GoodsProcurement goodsProcurement = null;
|
|
|
List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
|
|
|
Map<Integer, Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, t -> t));
|
|
|
Goods goods = null;
|
|
|
Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
|
|
|
- Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
|
|
|
+// Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
|
|
|
|
|
|
for (String goodsIdStr : goodsIds.split(",")) {
|
|
|
if (StringUtils.isBlank(goodsIdStr)) {
|
|
@@ -1621,14 +1600,14 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
if (batchUpdateGoodsMap.get(goods.getId()) != null) {
|
|
|
goods = batchUpdateGoodsMap.get(goods.getId());
|
|
|
}
|
|
|
- goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
|
|
|
+// goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
|
|
|
goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
|
|
|
goods.setUpdateTime(nowDate);
|
|
|
|
|
|
batchUpdateGoodsMap.put(goods.getId(), goods);
|
|
|
|
|
|
// 进货清单
|
|
|
- goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
|
|
|
+ /*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
|
|
|
if (goodsProcurement != null) {
|
|
|
if (goodsProcurementMap.get(goodsProcurement.getId()) != null) {
|
|
|
goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
|
|
@@ -1636,13 +1615,13 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
|
|
|
goodsProcurement.setUpdateTime(nowDate);
|
|
|
goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
|
|
|
|
- if (goodsProcurementMap.size() > 0) {
|
|
|
+ /*if (goodsProcurementMap.size() > 0) {
|
|
|
goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
if (batchUpdateGoodsMap.size() > 0) {
|
|
|
goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
|