|
@@ -4,17 +4,16 @@ import com.alibaba.fastjson.JSON;
|
|
|
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.GoodsDao;
|
|
|
-import com.ym.mec.biz.dal.dao.GoodsProcurementDao;
|
|
|
-import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
-import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.BasicUserDto;
|
|
|
import com.ym.mec.biz.dal.dto.GoodsBatchNoDto;
|
|
|
import com.ym.mec.biz.dal.dto.GoodsSellDto;
|
|
|
import com.ym.mec.biz.dal.entity.Goods;
|
|
|
import com.ym.mec.biz.dal.entity.GoodsProcurement;
|
|
|
+import com.ym.mec.biz.dal.entity.SellOrder;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.service.GoodsService;
|
|
|
+import com.ym.mec.biz.service.SellOrderService;
|
|
|
import com.ym.mec.biz.service.SysMessageService;
|
|
|
import com.ym.mec.biz.service.UploadFileService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
@@ -41,7 +40,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
import java.io.InputStream;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -63,6 +61,8 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
private SysMessageService sysMessageService;
|
|
|
@Autowired
|
|
|
private TeacherDao teacherDao;
|
|
|
+ @Autowired
|
|
|
+ private SellOrderDao sellOrderDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, Goods> getDAO() {
|
|
@@ -304,8 +304,13 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<SellOrder> goodsBatchNoAllot(Goods goods) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public List<GoodsProcurement> subtractStock(List<Integer> goodsIds, AccountType accountType) {
|
|
|
+ public List<SellOrder> subtractStock(List<Integer> goodsIds, AccountType accountType) {
|
|
|
if(CollectionUtils.isEmpty(goodsIds)){
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
@@ -364,6 +369,23 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods> implement
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
public void increaseStock(List<Integer> sellOrderIds, AccountType accountType) {
|
|
|
+ if(CollectionUtils.isEmpty(sellOrderIds)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SellOrder> sellOrders = sellOrderDao.getSellOrders(sellOrderIds);
|
|
|
+ Set<Integer> goodsIdList = new HashSet<>();
|
|
|
+ sellOrders.forEach(so -> {
|
|
|
+ if(Objects.nonNull(so.getParentGoodsId())){
|
|
|
+ goodsIdList.add(so.getParentGoodsId());
|
|
|
+ }else{
|
|
|
+ goodsIdList.add(so.getGoodsId());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ List<Goods> goods = goodsDao.lockGoods(new ArrayList<>(goodsIdList));
|
|
|
+
|
|
|
+
|
|
|
// Set<Integer> goodsIds = goodsBatchNoDtos.stream().map(GoodsBatchNoDto::getGoodsId).collect(Collectors.toSet());
|
|
|
// List<Goods> goodsList = goodsDao.lockGoods(new ArrayList<>(goodsIds));
|
|
|
// Map<Integer, Goods> idGoodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, g -> g));
|