|
@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.entity.MusicGroupPurchaseList;
|
|
|
import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
import com.ym.mec.biz.service.GoodsService;
|
|
|
import com.ym.mec.biz.service.MusicGroupPurchaseListService;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -15,9 +16,7 @@ import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long, StudentPaymentOrderDetail> implements StudentPaymentOrderDetailService {
|
|
@@ -47,13 +46,13 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
|
|
|
@Override
|
|
|
public List<Goods> getMusicalList(String musicGroupId) {
|
|
|
List<StudentPaymentOrderDetail> applyOrder = findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS);
|
|
|
- if(applyOrder == null || applyOrder.size()==0){
|
|
|
+ if (applyOrder == null || applyOrder.size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
String goodsIdsStr = "";
|
|
|
for (StudentPaymentOrderDetail studentPaymentOrderDetail : applyOrder) {
|
|
|
if (studentPaymentOrderDetail.getGoodsIdList() != null && !studentPaymentOrderDetail.getGoodsIdList().isEmpty()) {
|
|
|
- goodsIdsStr += studentPaymentOrderDetail.getGoodsIdList()+",";
|
|
|
+ goodsIdsStr += studentPaymentOrderDetail.getGoodsIdList() + ",";
|
|
|
}
|
|
|
}
|
|
|
goodsIdsStr = goodsIdsStr.substring(0, goodsIdsStr.length() - 1);
|
|
@@ -65,8 +64,8 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
|
|
|
for (Goods goods : goodies) {
|
|
|
goods.setSellCount(0);
|
|
|
for (String goodsIdStr : goodSIdArr) {
|
|
|
- if(goods.getId().equals(Integer.parseInt(goodsIdStr))){
|
|
|
- goods.setSellCount(goods.getSellCount()+1);
|
|
|
+ if (goods.getId().equals(Integer.parseInt(goodsIdStr))) {
|
|
|
+ goods.setSellCount(goods.getSellCount() + 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -74,10 +73,27 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Goods> verifyMusicalList(String musicGroupId) {
|
|
|
+ public Boolean verifyMusicalList(String musicGroupId) throws BizException {
|
|
|
+ //乐器采购清单是否确认
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("musicGroupId", musicGroupId);
|
|
|
+ int count = musicGroupPurchaseListDao.queryCount(param);
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BizException("采购清单已经确认");
|
|
|
+ }
|
|
|
+
|
|
|
List<Goods> musicalList = getMusicalList(musicGroupId);
|
|
|
Date date = new Date();
|
|
|
List<MusicGroupPurchaseList> musicGroupPurchaseLists = new ArrayList<>();
|
|
|
+ //发放清单没有时确认特殊处理
|
|
|
+ if (musicalList == null || musicalList.size() == 0) {
|
|
|
+ musicalList = new ArrayList<>();
|
|
|
+ Goods goods = new Goods();
|
|
|
+ goods.setId(0);
|
|
|
+ goods.setSellCount(0);
|
|
|
+ musicalList.add(goods);
|
|
|
+ }
|
|
|
+
|
|
|
for (Goods goods : musicalList) {
|
|
|
MusicGroupPurchaseList musicGroupPurchaseList = new MusicGroupPurchaseList();
|
|
|
musicGroupPurchaseList.setGoodsId(goods.getId());
|
|
@@ -88,20 +104,20 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
|
|
|
musicGroupPurchaseLists.add(musicGroupPurchaseList);
|
|
|
}
|
|
|
musicGroupPurchaseListDao.batchInsert(musicGroupPurchaseLists);
|
|
|
- return musicalList;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<Goods> findApplyOrderGoods(Long orderId) {
|
|
|
List<StudentPaymentOrderDetail> applyOrderGoods = studentPaymentOrderDetailDao.findApplyOrderGoods(orderId);
|
|
|
|
|
|
- if(applyOrderGoods == null || applyOrderGoods.size()==0){
|
|
|
+ if (applyOrderGoods == null || applyOrderGoods.size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
String goodsIdsStr = "";
|
|
|
for (StudentPaymentOrderDetail studentPaymentOrderDetail : applyOrderGoods) {
|
|
|
if (studentPaymentOrderDetail.getGoodsIdList() != null && !studentPaymentOrderDetail.getGoodsIdList().isEmpty()) {
|
|
|
- goodsIdsStr += studentPaymentOrderDetail.getGoodsIdList()+",";
|
|
|
+ goodsIdsStr += studentPaymentOrderDetail.getGoodsIdList() + ",";
|
|
|
}
|
|
|
}
|
|
|
goodsIdsStr = goodsIdsStr.substring(0, goodsIdsStr.length() - 1);
|
|
@@ -113,8 +129,8 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
|
|
|
for (Goods goods : goodies) {
|
|
|
goods.setSellCount(0);
|
|
|
for (String goodsIdStr : goodSIdArr) {
|
|
|
- if(goods.getId().equals(Integer.parseInt(goodsIdStr))){
|
|
|
- goods.setSellCount(goods.getSellCount()+1);
|
|
|
+ if (goods.getId().equals(Integer.parseInt(goodsIdStr))) {
|
|
|
+ goods.setSellCount(goods.getSellCount() + 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -123,6 +139,6 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
@Override
|
|
|
public List<StudentPaymentOrderDetail> findUserApplyOrder(Integer userId, DealStatusEnum status) {
|
|
|
- return studentPaymentOrderDetailDao.findUserApplyOrder(userId,status);
|
|
|
+ return studentPaymentOrderDetailDao.findUserApplyOrder(userId, status);
|
|
|
}
|
|
|
}
|