Sfoglia il codice sorgente

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

zouxuan 4 anni fa
parent
commit
663a859f9d

+ 15 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java

@@ -1,13 +1,16 @@
 package com.ym.mec.biz.dal.entity;
 
-import com.ym.mec.common.enums.BaseEnum;
 import io.swagger.annotations.ApiModelProperty;
-import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import com.ym.mec.common.enums.BaseEnum;
+
 /**
  * 对应数据库表(music_group_payment_calender):
  */
@@ -99,6 +102,8 @@ public class MusicGroupPaymentCalender {
 
 	@ApiModelProperty(value = "缴费类型", required = false)
 	private PaymentType paymentType;
+	
+	private BigDecimal paymentAmount = new BigDecimal(0);
 
 	@ApiModelProperty(value = "状态", required = false)
 	private PaymentCalenderStatusEnum status;
@@ -315,6 +320,14 @@ public class MusicGroupPaymentCalender {
 		this.batchNo = batchNo;
 	}
 
+	public BigDecimal getPaymentAmount() {
+		return paymentAmount;
+	}
+
+	public void setPaymentAmount(BigDecimal paymentAmount) {
+		this.paymentAmount = paymentAmount;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

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

@@ -29,6 +29,4 @@ public interface GoodsCategoryService extends BaseService<Integer, GoodsCategory
      * @param goodsIds
      */
     void updateSubjectGoods(Long subjectGoodsMapperId, String goodsIds);
-
-    void goodsTest(List<Integer> goodsIds);
 }

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

@@ -118,6 +118,4 @@ public interface GoodsService extends BaseService<Integer, Goods> {
      * @return java.util.List<com.ym.mec.biz.dal.dto.GoodsSellDto>
      */
     List<GoodsSellDto> queryGoodsSellDtos(String goodsId);
-
-    void getGoodsTest(List<Integer> goodsIds);
 }

+ 0 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsCategoryServiceImpl.java

@@ -85,17 +85,4 @@ public class GoodsCategoryServiceImpl extends BaseServiceImpl<Integer, GoodsCate
 		subjectGoodsMapper.setUpdateTime(new Date());
 		subjectGoodsMapperDao.update(subjectGoodsMapper);
 	}
-
-	@Autowired
-	private GoodsService goodsService;
-
-	@Override
-	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-	public void goodsTest(List<Integer> goodsIds) {
-		goodsTest1(goodsIds);
-	}
-
-	public void goodsTest1(List<Integer> goodsIds) {
-		goodsService.subtractStock(goodsIds, AccountType.INTERNAL);
-	}
 }

+ 3 - 50
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
@@ -464,55 +465,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	}
 
 	@Override
-	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-	public void getGoodsTest(List<Integer> goodsIds) {
-		List<Goods> tempGoodsList = goodsDao.lockGoods(new ArrayList<>(goodsIds));
-		Map<Integer, Goods> idTempGoodsMap = tempGoodsList.stream().collect(Collectors.toMap(Goods::getId, g -> g));
-		List<GoodsProcurement> goodsProcurements = new ArrayList<>();
-		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.lockGoods(complementGoodsIds);
-			}
-			for (Goods goods : childGoods) {
-				GoodsProcurement goodsProcurement = null;
-				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);
-				if(Objects.nonNull(goodsProcurement)){
-					goodsProcurementDao.update(goodsProcurement);
-				}else{
-					goodsProcurement = new GoodsProcurement(goods.getId());
-				}
-				if(StringUtils.isNotBlank(tempGoods.getComplementGoodsIdList())){
-					goodsProcurement.setParentGoodsId(tempGoods.getId());
-				}
-
-				goodsProcurements.add(goodsProcurement);
-			}
-		}
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
 	public List<SellOrder> subtractStock(List<Integer> goodsIds, AccountType accountType) {
 		if(CollectionUtils.isEmpty(goodsIds)){
 			return Collections.emptyList();
@@ -522,7 +475,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		Map<Integer, Goods> idTempGoodsMap = tempGoodsList.stream().collect(Collectors.toMap(Goods::getId, g -> g));
 		List<GoodsProcurement> goodsProcurements = new ArrayList<>();
 		for (Integer goodsId : goodsIds) {
-			Goods tempGoods = idTempGoodsMap.get(goodsId);
+			Goods tempGoods = goodsDao.get(goodsId);
 			List<Goods> childGoods = new ArrayList<>();
 			if(StringUtils.isBlank(tempGoods.getComplementGoodsIdList())){
 				childGoods.add(tempGoods);

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

@@ -693,14 +693,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 });
             }
             StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
-            studentPaymentOrderDetail.setPrice(studentAddDto.getTemporaryCourseFee());
+            studentPaymentOrderDetail.setPrice(studentAddDto.getTemporaryCourseFee() == null ? BigDecimal.ZERO : studentAddDto.getTemporaryCourseFee());
             studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
             studentPaymentOrderDetails.add(studentPaymentOrderDetail);
             //汇总金额
 
-            BigDecimal reduce = studentPaymentOrderDetails.stream().map(e -> e.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal reduce = studentPaymentOrderDetails.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
             MusicGroupStudentFee.PaymentStatus paymentStatus = MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
-            if (reduce == BigDecimal.ZERO) {
+            if (reduce.compareTo(BigDecimal.ZERO) == 0) {
                 paymentStatus = MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
                 studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
                 studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
@@ -737,7 +737,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
                 Map<Integer, String> receivers = new HashMap<>(1);
                 receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
-                if (reduce == BigDecimal.ZERO) {
+                if (reduce.compareTo(BigDecimal.ZERO) == 0) {
                     sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT_FREE,
                             receivers, null, 0, null, "", studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName());
                 } else {

+ 11 - 4
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -27,6 +27,7 @@
         <result column="payment_pattern_" property="paymentPattern"/>
         <result column="payment_type_" property="paymentType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="batch_no_" property="batchNo"/>
+        <result column="payment_amount_" property="paymentAmount"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -44,24 +45,24 @@
             keyColumn="id_" keyProperty="id">
         INSERT INTO music_group_payment_calender
         (music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
-        actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,payment_type_,batch_no_,audit_memo_)
+        actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,payment_type_,payment_amount_,batch_no_,audit_memo_)
         VALUES(#{musicGroupId},#{musicGroupOrganizationCourseSettingId},#{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{rejectReason},#{startPaymentDate},#{deadlinePaymentDate},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{expectNum},#{actualNum},#{memo},#{isGiveMusicNetwork},now(),now(),
-        #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{batchNo},#{auditMemo})
+        #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{paymentAmount},#{batchNo},#{auditMemo})
     </insert>
 
     <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender" useGeneratedKeys="true"
             keyColumn="id_" keyProperty="id">
         INSERT INTO music_group_payment_calender
         (music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
-        actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,
+        actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,payment_amount_,
         payment_type_,batch_no_,audit_memo_)
         VALUES
         <foreach collection="list" item="item" index="index" separator=",">
         (#{item.musicGroupId},#{item.musicGroupOrganizationCourseSettingId},#{item.payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.rejectReason},#{item.startPaymentDate},#{item.deadlinePaymentDate},#{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{item.expectNum},#{item.actualNum},#{item.memo},#{item.isGiveMusicNetwork},now(),now(),
-        #{item.paymentValidStartDate},#{item.paymentValidEndDate},#{item.paymentPattern},#{item.paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        #{item.paymentValidStartDate},#{item.paymentValidEndDate},#{item.paymentPattern},#{item.paymentAmount},#{item.paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{item.batchNo},#{item.auditMemo})
         </foreach>
     </insert>
@@ -122,6 +123,9 @@
             <if test="batchNo != null">
                 batch_no_ = #{batchNo},
             </if>
+            <if test="paymentAmount != null">
+                payment_amount_ = #{paymentAmount},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>
@@ -175,6 +179,9 @@
                 <if test="item.batchNo != null">
                     batch_no_ = #{item.batchNo},
                 </if>
+	            <if test="item.paymentAmount != null">
+	                payment_amount_ = #{item.paymentAmount},
+	            </if>
 	        </set>
 	        WHERE id_ = #{item.id}
 		</foreach>

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

@@ -95,7 +95,7 @@
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(ups.*) FROM organization_course_unit_price_settings ups
+		SELECT COUNT(ups.id_) FROM organization_course_unit_price_settings ups
 		<where>
 			<if test="organId != null">
 				and ups.organ_id_ = #{organId}

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

@@ -121,12 +121,4 @@ public class GoodsController extends BaseController {
     public Object findGoodsBySubId(Integer subjectId,String type){
         return succeed(goodsService.findGoodsBySubId(subjectId,type));
     }
-
-    @GetMapping("getGoodsTest")
-    public HttpResponseResult getGoodsTest(Integer goodsId){
-//        goodsService.getGoodsTest(Arrays.asList(goodsId));
-//        goodsService.subtractStock(Arrays.asList(goodsId), AccountType.INTERNAL);
-        goodsCategoryService.goodsTest(Arrays.asList(goodsId));
-        return succeed();
-    }
 }