Browse Source

Merge remote-tracking branch 'origin/master'

zouxuan 4 years ago
parent
commit
a652c65e97

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderCourseSettingsDao.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettingsDetail;
 import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettingsDetail;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.dal.BaseDAO;
+
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
@@ -34,7 +35,7 @@ public interface MusicGroupPaymentCalenderCourseSettingsDao extends BaseDAO<Inte
 	List<MusicGroupPaymentCalenderCourseSettings> getWithPaymentCalendersAndCourseType(@Param("calenderIds") Set<Long> calenderIds,
 	List<MusicGroupPaymentCalenderCourseSettings> getWithPaymentCalendersAndCourseType(@Param("calenderIds") Set<Long> calenderIds,
 																				@Param("courseType") CourseSchedule.CourseScheduleType courseType);
 																				@Param("courseType") CourseSchedule.CourseScheduleType courseType);
 
 
-	int deleteByMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId);
+	int deleteByMusicGroupPaymentCalenderId(@Param("calenderIds") List<Long> calenderIds);
 
 
 	/**
 	/**
 	 * 获取乐团的缴费课程
 	 * 获取乐团的缴费课程

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java

@@ -89,6 +89,8 @@ public interface GoodsService extends BaseService<Integer, Goods> {
      */
      */
     void sellOrderBatchNoAllot();
     void sellOrderBatchNoAllot();
 
 
+    void getGoodsTest(List<Integer> goodsIds);
+
     /**
     /**
      * @describe 扣减商品库存
      * @describe 扣减商品库存
      * @author Joburgess
      * @author Joburgess

+ 36 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -466,6 +466,42 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 
 
 	@Override
 	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+	public void getGoodsTest(List<Integer> goodsIds) {
+		goodsDao.lockGoods(new ArrayList<>(goodsIds));
+		for (Integer goodsId : goodsIds) {
+			Goods tempGoods = goodsDao.get(goodsId);
+			List<Goods> childGoods = new ArrayList<>();
+			if(StringUtils.isBlank(tempGoods.getComplementGoodsIdList())){
+				childGoods.add(tempGoods);
+			}else{
+				List<Integer> complementGoodsIds = Arrays.stream(tempGoods.getComplementGoodsIdList().split(",")).map(s -> Integer.valueOf(s)).collect(Collectors.toList());
+				childGoods = goodsDao.getGoodies(complementGoodsIds);
+			}
+			for (Goods goods : childGoods) {
+				GoodsProcurement goodsProcurement;
+				if(StockType.INTERNAL.equals(goods.getStockType())||(StockType.ALL.equals(goods.getStockType())&&AccountType.INTERNAL.equals(AccountType.INTERNAL))){
+					goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
+					goods.setStockCount(new AtomicInteger(goods.getStockCount()).decrementAndGet());
+					if(Objects.nonNull(goodsProcurement)){
+						goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).incrementAndGet());
+					}
+				}else if(StockType.EXTERNAL.equals(goods.getStockType())||(StockType.ALL.equals(goods.getStockType())&&AccountType.EXTERNAL.equals(AccountType.EXTERNAL))){
+					goodsProcurement = goodsProcurementDao.getWithTaxStockSurplusProcurement(goods.getId());
+					goods.setTaxStockCount(new AtomicInteger(goods.getTaxStockCount()).decrementAndGet());
+					if(Objects.nonNull(goodsProcurement)){
+						goodsProcurement.setTaxStockSoldNum(new AtomicInteger(goodsProcurement.getTaxStockSoldNum()).incrementAndGet());
+					}
+				}
+
+				goods.setSellCount(new AtomicInteger(goods.getSellCount()).incrementAndGet());
+
+				goodsDao.update(goods);
+			}
+		}
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 	public List<SellOrder> subtractStock(List<Integer> goodsIds, AccountType accountType) {
 	public List<SellOrder> subtractStock(List<Integer> goodsIds, AccountType accountType) {
 		if(CollectionUtils.isEmpty(goodsIds)){
 		if(CollectionUtils.isEmpty(goodsIds)){
 			return Collections.emptyList();
 			return Collections.emptyList();

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -413,7 +413,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		}
 		}
 		
 		
 		PaymentCalenderStatusEnum status = musicGroupPaymentCalenderList.get(0).getStatus();
 		PaymentCalenderStatusEnum status = musicGroupPaymentCalenderList.get(0).getStatus();
-		
+		if(status != PaymentCalenderStatusEnum.REJECT){
+			throw new BizException("只有[拒绝]状态的缴费才能修改");
+		}
 
 
 		String musicGroupId = musicGroupPaymentCalenderDto.getMusicGroupId();
 		String musicGroupId = musicGroupPaymentCalenderDto.getMusicGroupId();
 
 
@@ -444,6 +446,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				throw new BizException("创建失败,已经存在缴费信息");
 				throw new BizException("创建失败,已经存在缴费信息");
 			}
 			}
 		}
 		}
+		
+		List<Long> calenderIds = musicGroupPaymentCalenderList.stream().map(MusicGroupPaymentCalender :: getId).collect(Collectors.toList());
+		//删除原来数据
+		musicGroupPaymentCalenderDao.delByIds(calenderIds);
+		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
 
 
 		status = PaymentCalenderStatusEnum.NO;
 		status = PaymentCalenderStatusEnum.NO;
 
 
@@ -1056,7 +1063,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 
 		musicGroupPaymentCalenderDao.delete(id);
 		musicGroupPaymentCalenderDao.delete(id);
 		musicGroupPaymentCalenderDetailDao.deleteByCalenderId(id);
 		musicGroupPaymentCalenderDetailDao.deleteByCalenderId(id);
-		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(id);
+		
+		List<Long> calenderIds = new ArrayList<Long>();
+		calenderIds.add(id);
+		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
 	}
 	}
 
 
 	@Override
 	@Override

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -2273,7 +2273,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
             MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
             if (regCalender != null) {
             if (regCalender != null) {
                 musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
                 musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
-                musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(regCalender.getId());
+                
+                List<Long> calenderIds = new ArrayList<Long>();
+        		calenderIds.add(regCalender.getId());
+                musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
             }
             }
         }
         }
 
 

+ 4 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderCourseSettingsMapper.xml

@@ -123,7 +123,10 @@
 	</select>
 	</select>
 
 
 	<delete id="deleteByMusicGroupPaymentCalenderId">
 	<delete id="deleteByMusicGroupPaymentCalenderId">
-		DELETE FROM music_group_payment_calender_course_settings WHERE music_group_payment_calender_id_ = #{musicGroupPaymentCalenderId}
+		DELETE FROM music_group_payment_calender_course_settings WHERE music_group_payment_calender_id_ in 
+        <foreach collection="calenderIds" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
 	</delete>
 	</delete>
 
 
 	<select id="getMusicGroupRegCalenderCourseSettings" resultMap="MusicGroupPaymentCalenderCourseSettings">
 	<select id="getMusicGroupRegCalenderCourseSettings" resultMap="MusicGroupPaymentCalenderCourseSettings">

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/controller/GoodsController.java

@@ -19,6 +19,7 @@ import java.util.Objects;
 
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.Goods;
@@ -121,4 +122,12 @@ public class GoodsController extends BaseController {
     public Object findGoodsBySubId(Integer subjectId,String type){
     public Object findGoodsBySubId(Integer subjectId,String type){
         return succeed(goodsService.findGoodsBySubId(subjectId,type));
         return succeed(goodsService.findGoodsBySubId(subjectId,type));
     }
     }
+
+    @GetMapping("getGoodsTest")
+    @Transactional(rollbackFor = Exception.class)
+    public HttpResponseResult getGoodsTest(Integer goodsId){
+        goodsService.getGoodsTest(Arrays.asList(goodsId));
+//        goodsService.subtractStock(Arrays.asList(goodsId), AccountType.INTERNAL);
+        return succeed();
+    }
 }
 }