Sfoglia il codice sorgente

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 anni fa
parent
commit
95c07716dd

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderDetailService.java

@@ -39,7 +39,7 @@ public interface StudentPaymentOrderDetailService extends BaseService<Long, Stud
      * @param musicGroupId
      * @return
      */
-    List<Goods> verifyMusicalList(String musicGroupId);
+    Boolean verifyMusicalList(String musicGroupId);
 
     /**
      * 查询订单商品

+ 28 - 14
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -15,9 +15,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 +45,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 +63,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 +72,26 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
     }
 
     @Override
-    public List<Goods> verifyMusicalList(String musicGroupId) {
+    public Boolean verifyMusicalList(String musicGroupId) {
+        //乐器采购清单是否确认
+        Map<String, Object> param = new HashMap<>();
+        param.put("musicGroupId", musicGroupId);
+        int count = musicGroupPurchaseListDao.queryCount(param);
+        if (count > 0) {
+            return true;
+        }
+
         List<Goods> musicalList = getMusicalList(musicGroupId);
         Date date = new Date();
         List<MusicGroupPurchaseList> musicGroupPurchaseLists = new ArrayList<>();
+        //发放清单没有时确认特殊处理
+        if (musicalList.size() == 0) {
+            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 +102,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 +127,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 +137,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);
     }
 }