Ver Fonte

Merge branch 'mj_func' into pre

# Conflicts:
#	netflix-web/src/main/resources/application-dev.yml
#	netflix-web/src/main/resources/application-prd.yml
#	netflix-web/src/main/resources/application-pre.yml
zoujiajian há 2 anos atrás
pai
commit
82166f2bd2

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/mapper/GroupsRelationMapper.java

@@ -31,7 +31,7 @@ public interface GroupsRelationMapper extends BaseMapper<GroupsRelation> {
 	@Update("update groups_relation set customer_service = null where id = #{id}")
 	void updateCustomerService(Long id);
 
-	Long selectSimilarExpiredRelation(@Param("skuId") Long skuId, @Param("minExpiryTime") DateTime minExpiryTime, @Param("maxNum") Integer maxNum);
+	Long selectSimilarExpiredRelation(@Param("skuId") Long skuId, @Param("minExpiryTime") DateTime minExpiryTime, @Param("maxNum") Integer maxNum, @Param("ip") String ip);
 
 	List<GroupsRelationView> selectRelationByGoodsId(@Param("goodsId") Long goodsId, @Param("userId") Long userId, @Param("yhsId") Long yhsId);
 

+ 22 - 11
netflix-dao/src/main/resources/mapper/GroupRelationMapper.xml

@@ -12,7 +12,6 @@
         user_id = #{entity.userId},
         account = null,
         customer_service = null,
-        verify_code = null,
         password = null,
         recharge_status = null,
         send_time = null,
@@ -49,17 +48,24 @@
     <select id="selectSimilarExpiredRelation" resultType="java.lang.Long">
         select s.id
         from (select gt.id, min(gr.expiry_time) minExpiryTime
-              from `groups_trips` gt
-                       left join `groups_relation` gr on gr.groups_id = gt.id
-              where gt.sku_id = #{skuId}
-                and (gt.available_parking_num = 0 or (select count(*) from groups_relation gr where gr.groups_id = gt.id and gr.user_id != 0 and gr.num &lt;= #{maxNum}) &lt; gt.available_parking_num)
-                and gt.available_num > 0
-                and gt.status = 'validity'
-                and gr.status = 'validity'
-                and gr.user_id != 0
-              and gr.expiry_time is not null
-              group by gr.groups_id) s
+        from `groups_trips` gt
+        left join `groups_relation` gr on gr.groups_id = gt.id
+        where gt.sku_id = #{skuId}
+        and (gt.available_parking_num = 0 or (select count(*)
+        from groups_relation gr
+        where gr.groups_id = gt.id and gr.user_id != 0 and gr.num &lt;=
+        #{maxNum}) &lt; gt.available_parking_num) and gt.available_num > 0
+        and gt.status = 'validity'
+        and gr.status = 'validity'
+        and gr.user_id != 0
+        and gr.expiry_time is not null
+        group by gr.groups_id) s
         where s.minExpiryTime >= #{minExpiryTime}
+        <if test="ip != null">
+            and not exists (select 1 from (select id, user_id from groups_relation gnr where gnr.groups_id = s.id and gnr.user_id != 0) gr inner join
+            order_don o on o.user_id = gr.user_id and o.relation_id = gr.id
+            inner join order_don_location_relate ocr on ocr.order_id = o.id where ocr.ip = #{ip} limit 1)
+        </if>
         order by minExpiryTime desc limit 1
     </select>
 
@@ -108,6 +114,11 @@
         where groups_id = #{groupsId}
           and user_id = 0
           and status = 'none'
+        <if test="ip != null">
+            and not exists (select 1 from (select id, user_id from groups_relation gnr where gnr.groups_id = groups_id and gnr.user_id != 0) gr inner join
+            order_don o on o.user_id = gr.user_id and o.relation_id = gr.id
+            inner join order_don_location_relate ocr on ocr.order_id = o.id where ocr.ip = #{ip} limit 1)
+        </if>
         order by rand() limit 1
     </select>
 

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/exchange/impl/ExchangeCodeServiceImpl.java

@@ -367,7 +367,7 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
 
 	public GroupsRelation getFinalRelation(GoodsDonSku sku, Long userId, Integer retryNum, Long yhsId, List<Long> errorsRelationIds) {
 		//获取车票车位
-		GroupsRelation relation = groupRelationFrontService.getRelation(null, userId, sku);
+		GroupsRelation relation = groupRelationFrontService.getRelation(null, userId, sku, null);
 
 		try {
 			//锁定座位

+ 6 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -2028,8 +2028,13 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 	public GroupsRelation getRelation(OrderPayRequest payRequest, GoodsDonSku sku, Long yhsId) {
 		Long payRelationId = payRequest.getRelationId();
 		Long userId = payRequest.getUserId();
+		String ip = null;
+		//MJ车票统一ip不允许上同一车次
+		if (sku.getGoodsId() == 26) {
+			ip = payRequest.getIp();
+		}
 		//获取车票车位
-		GroupsRelation relation = groupRelationFrontService.getRelation(payRelationId, userId, sku);
+		GroupsRelation relation = groupRelationFrontService.getRelation(payRelationId, userId, sku, ip);
 
 		//锁定座位
 		setRelation(relation);

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/relation/GroupRelationFrontService.java

@@ -21,7 +21,7 @@ public interface GroupRelationFrontService {
 
 	Boolean isJoinCorpWx(Long userId, Boolean isJoin, Boolean noCoupon);
 
-	GroupsRelation getSimilarExpiredGroupRelation(GoodsDonSku sku, List<Long> errorsRelationIds);
+	GroupsRelation getSimilarExpiredGroupRelation(GoodsDonSku sku, List<Long> errorsRelationIds, String ip);
 
 	Page<UserRecommendGoodsFrontView> getRecommendGoodsViews(Boolean isPayNf, List<Long> filter_goods_id, Integer start, Integer limit);
 
@@ -33,7 +33,7 @@ public interface GroupRelationFrontService {
 	/**
 	 * 获取车票座位
 	 */
-	GroupsRelation getRelation(Long payRelationId, Long userId, GoodsDonSku sku);
+	GroupsRelation getRelation(Long payRelationId, Long userId, GoodsDonSku sku, String ip);
 
 	/**
 	 * 获取车票账号登录 验证码

+ 4 - 4
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -270,7 +270,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 	}
 
 	@Override
-	public GroupsRelation getSimilarExpiredGroupRelation(GoodsDonSku sku, List<Long> errorsRelationIds) {
+	public GroupsRelation getSimilarExpiredGroupRelation(GoodsDonSku sku, List<Long> errorsRelationIds, String ip) {
 		Long skuId = sku.getId();
 		Integer days = sku.getDays();
 		Integer months = sku.getMonths();
@@ -287,7 +287,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		}
 		maxNum += extraNum;
 		DateTime minExpiryTime = DateUtil.offsetDay(expiryTime, -5);
-		Long groupsId = groupsRelationMapper.selectSimilarExpiredRelation(skuId, minExpiryTime, maxNum);
+		Long groupsId = groupsRelationMapper.selectSimilarExpiredRelation(skuId, minExpiryTime, maxNum, ip);
 		if (groupsId == null) {
 			log.info("暂无相似过期时间车队");
 			return null;
@@ -348,7 +348,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 	}
 
 	@Override
-	public GroupsRelation getRelation(Long payRelationId, Long userId, GoodsDonSku sku) {
+	public GroupsRelation getRelation(Long payRelationId, Long userId, GoodsDonSku sku, String ip) {
 		GroupsRelation relation = null;
 		Integer maxNum = sku.getNum();
 		if (payRelationId != null && payRelationId > 0) {
@@ -399,7 +399,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 			}
 			if (groups == null) {
 				//寻找差不多过期时间规格的车位
-				relation = getSimilarExpiredGroupRelation(sku,null);
+				relation = getSimilarExpiredGroupRelation(sku, null, ip);
 				if (relation == null) {
 					//TODO 如果没指定座位,等待逻辑确认
 					groups = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class)

+ 10 - 0
netflix-service/src/main/java/com/cyksj/service/shop/impl/YhShopDistributeServiceImpl.java

@@ -3,6 +3,7 @@ package com.cyksj.service.shop.impl;
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.mapper.GoodsDonMapper;
+import com.cyksj.mapper.manage.distribute.UserDistributeSharedMapper;
 import com.cyksj.mapper.shop.*;
 import com.cyksj.model.entity.*;
 import com.cyksj.service.distribute.UserBusinessFrontService;
@@ -38,6 +39,8 @@ public class YhShopDistributeServiceImpl implements YhShopDistributeService {
 	private final UserBenefitsService userBenefitsService;
 
 	private final GoodsDonMapper goodsDonMapper;
+
+	private final UserDistributeSharedMapper userDistributeSharedMapper;
 	@Override
 	public void distributeWaitingSendPointsRecord(OrderDon order) {
 		BigDecimal orderMoney = order.getMoney();
@@ -171,6 +174,13 @@ public class YhShopDistributeServiceImpl implements YhShopDistributeService {
 			yhShopUserDistributeShared.setShopUserId(shopUserId);
 			yhShopUserDistributeShared.setUserId(userId);
 			yhShopUserDistributeSharedMapper.insert(yhShopUserDistributeShared);
+
+			//同步用户邀请关联 待优化 TODO
+			UserDistributeShared userDistributeShared = new UserDistributeShared();
+			userDistributeShared.setUserId(userId);
+			userDistributeShared.setSharedId(shopUserId);
+			userDistributeShared.setRemark("小店同步");
+			userDistributeSharedMapper.insert(userDistributeShared);
 		} catch (DuplicateKeyException e) {
 		}
 	}

+ 0 - 2
netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderShopCartController.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.model.entity.ShoppingCartDon;
-import com.cyksj.model.request.OrderPayRequest;
 import com.cyksj.model.request.UnifiedOrderPayReq;
 import com.cyksj.model.views.ShoppingCartDonPayDetailView;
 import com.cyksj.model.views.ShoppingCartDonView;
@@ -18,7 +17,6 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.List;
 
 /**
  * 项目名: yhlxj

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
netflix-web/src/main/resources/application-dev.yml


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
netflix-web/src/main/resources/application-prd.yml


+ 1 - 1
netflix-web/src/main/resources/application-pre.yml

@@ -165,7 +165,7 @@ yhmini:
   appid: wx383c483d3bcf155a
   secret: bf6ca029a3102f390486a7a14b218b06
 
-#银河大学生认证小程序
+#银河录像局大学生认证小程序
 certmini:
   appid: wx16e441d61fa3fd8a
   secret: edc2e8ed29a45d6ba266a63bc7ffc2b5

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff