Преглед на файлове

用户车票条件筛选;展示用户所购买车票平台

zoujiajian преди 2 години
родител
ревизия
3ca82faf69

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

@@ -8,6 +8,7 @@ import com.cyksj.model.entity.PhoneCode;
 import com.cyksj.model.manage.views.GroupsRelationBackView;
 import com.cyksj.model.manage.views.GroupsRelationView;
 import com.cyksj.model.views.GroupsRelationUserView;
+import com.cyksj.model.views.RenewalView;
 import com.cyksj.model.views.UserRecommendGoodsFrontView;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
@@ -67,4 +68,6 @@ public interface GroupsRelationMapper extends BaseMapper<GroupsRelation> {
 	GroupsRelationBackView getGroupRelationAccountView(Long relationId);
 
 	PhoneCode getAreaPhoneByUserId(Long userId);
+
+	List<RenewalView> getUserHasPayGoods(@Param("list") List<Long> userIds, @Param("now") DateTime now);
 }

+ 13 - 0
netflix-dao/src/main/resources/mapper/GroupRelationMapper.xml

@@ -321,4 +321,17 @@
               where id = #{userId} limit 1) s
                  left join phone_code pc on pc.phone = s.phone
     </select>
+
+    <select id="getUserHasPayGoods" resultType="com.cyksj.model.views.RenewalView">
+        select g.id as goods_id,g.title,g.logo from (select distinct groups_id from groups_relation where status in
+        ('validity', 'outside') and (expiry_time is null
+        or
+        expiry_time > #{now}) and user_id != 0 and user_id in <foreach
+            collection="list" item="item" open="(" separator="," close=")">
+        #{item}
+    </foreach> ) gr inner join groups_trips gt on gt.id = gr.groups_id
+        inner join goods_don_sku sku on sku.id = gt.sku_id inner join goods_don g on g.id = sku.goods_id
+        group by g.id,g.title,g.logo
+        order by goods_id
+    </select>
 </mapper>

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

@@ -6,6 +6,7 @@ import com.cyksj.model.entity.GroupsRelation;
 import com.cyksj.model.request.SpecialGoodsTicketReq;
 import com.cyksj.model.views.RenewalView;
 import com.cyksj.model.views.UserRecommendGoodsFrontView;
+import com.ejlchina.searcher.SearchResult;
 
 import java.util.List;
 
@@ -16,7 +17,7 @@ import java.util.List;
  *创建时间:2022/12/29 15:42
  */
 public interface GroupRelationFrontService {
-	List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId);
+	SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account);
 
 	Boolean isJoinCorpWx(Long userId, Boolean isJoin, Boolean noCoupon);
 
@@ -50,4 +51,6 @@ public interface GroupRelationFrontService {
 	void setGroupsTripsParkingTimeEmpty(GoodsDonSku sku, Long relationId);
 
 	Integer getUserCodeNumBySkuId(Long userId, Long skuId, Boolean isHasVerifyCode);
+
+	List<RenewalView>  getHasPayGoods(long userId);
 }

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

@@ -31,6 +31,7 @@ import com.cyksj.service.shop.YhShopFrontService;
 import com.cyksj.service.user.UserBindRelationService;
 import com.cyksj.service.user.UserLoginRecordService;
 import com.ejlchina.searcher.BeanSearcher;
+import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.param.Operator;
 import com.ejlchina.searcher.util.MapBuilder;
 import com.ejlchina.searcher.util.MapUtils;
@@ -43,7 +44,6 @@ import javax.servlet.http.HttpServletRequest;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 
 import static com.cyksj.enums.GatewayApiCode.GROUP_INDEX_ALREADY_BE_USER;
 import static com.cyksj.enums.GatewayApiCode.GROUP_INDEX_NOT_FIND;
@@ -101,33 +101,31 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 	private final static String VERIFY_CODE_SECRET = "q1w2e3";
 
 	@Override
-	public List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId) {
+	public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account) {
 		User u = userMapper.selectById(userId);
 		if (u == null) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
 		if (u.getIsBlack()) {
-			return new ArrayList<>();
+			return new SearchResult<>();
 		}
 		List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, u);
 		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
 		//Long yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
-		List<RenewalView> list = beanSearcher.searchAll(RenewalView.class, builder
+		DateTime now = DateTime.now();
+		if (StrUtil.isNotBlank(account)) {
+			builder.field(RenewalView::getAccount, account).op(Operator.Contain);
+		}
+		SearchResult<RenewalView> list = beanSearcher.search(RenewalView.class, builder
 				.field(RenewalView::getUserId, 0).op(Operator.GreaterThan)
 				.field(RenewalView::getUserId, userIds).op(Operator.InList)
 				//.field(RenewalView::getYhsId, yhsId)
+				.field("condition", String.format("(gr.expiry_time is null or gr.expiry_time > '%s')", now))
 				.field(RenewalView::getStatus, List.of("validity", "overdue", "outside")).op(Operator.InList)
 				.orderBy(RenewalView::getExpiryTime).asc()
 				.build());
 		//过滤邀请制、已失效的车位
-		DateTime now = DateTime.now();
-		list = list.stream().filter(e -> {
-			if (e.getExpiryTime() != null && e.getExpiryTime().before(now)) {
-				return false;
-			}
-			return true;
-		}).collect(Collectors.toList());
-		Integer size = list.size();
+		Integer size = list.getTotalCount().intValue();
 
-		list.forEach(ticket -> {
+		list.getDataList().forEach(ticket -> {
 			if (ticket.getSkuId() == null || ticket.getGoodsId() == null) {
 				return;
 			}
@@ -604,6 +602,15 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		return num;
 	}
 
+	@Override
+	public List<RenewalView> getHasPayGoods(long userId) {
+		User user = userMapper.selectById(userId);
+		List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, user);
+		DateTime now = DateTime.now();
+		List<RenewalView> list = groupsRelationMapper.getUserHasPayGoods(userIds, now);
+		return list;
+	}
+
 	public String getDifferentGoodsCode(Long goodsId, String body, Integer type) {
 		String code = null;
 		//奈飞

+ 10 - 3
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -19,7 +19,6 @@ import com.cyksj.common.snowflake.Sequence;
 import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
 import com.cyksj.common.util.GoogleGenerator;
 import com.cyksj.common.util.Jsons;
-import com.cyksj.common.util.StringUtil;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.*;
@@ -45,6 +44,7 @@ import com.cyksj.service.user.UserBindRelationService;
 import com.cyksj.service.user.UserService;
 import com.cyksj.web.util.StpUserUtil;
 import com.ejlchina.searcher.BeanSearcher;
+import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.param.Operator;
 import com.ejlchina.searcher.util.MapUtils;
 import lombok.RequiredArgsConstructor;
@@ -121,12 +121,19 @@ public class GroupRelationController {
     private final static Sequence SEQUENCE = new Sequence(0);
 
     @RequestMapping("/get/renewal")
-    public Result<List<RenewalView>> get(Boolean isLoginPopularize, String customId) {
+    public Result<SearchResult<RenewalView>> get(Boolean isLoginPopularize, String customId, String account) {
         long userId = StpUserUtil.getLoginIdAsLong();
-        List<RenewalView> list = groupRelationFrontService.getMyTicket(userId, isLoginPopularize, customId);
+        SearchResult<RenewalView> list = groupRelationFrontService.getMyTicket(userId, isLoginPopularize, customId, account);
         return GatewayResponse.SUCCESS.newBuilder().toResult(list);
     }
 
+    @GetMapping("/get/pay/goods")
+    public Result<List<RenewalView>> getHasPayGoods() {
+        long userId = StpUserUtil.getLoginIdAsLong();
+        List<RenewalView> hasPayGoods = groupRelationFrontService.getHasPayGoods(userId);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(hasPayGoods);
+    }
+
     @PostMapping("/post/renewal")
     public Result<OrderDon> renewal(@RequestBody OrderPayRequest payRequest) throws Exception {
         long userId = StpUserUtil.getLoginIdAsLong();

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

@@ -127,7 +127,7 @@ wechat:
   oldAppid: wxd58016eee53b6558
   appid: wx6cbc2de2a55e5579
   secret: 2ab6340e7787ab24de9f29094dee9d24
-  domain: https://nf.video/8081/api/
+  domain: https://nf.video/8082/api/
   #默认微信商户
   shopid: 1634772026
   shopKey: p2B8BAKi2V3PgMDSSez82V67aIvMKBt5
@@ -149,7 +149,7 @@ wx-login:
 wx-shop-login:
   appid: wx7c5494c38c6a78bd #todo
   secret: 95c7c542a583b42840765d758ec49bf5 #todo
-  redirectUri: https://shop.liuliangbang.vip/8081/api/auth/wx/authLogin/baseRedirect
+  redirectUri: https://shop.liuliangbang.vip/8082/api/auth/wx/authLogin/baseRedirect
   loginUrl: https://shop.liuliangbang.vip/
   remark: 小店店铺网页微信授权
 
@@ -158,7 +158,7 @@ yhlx:
   corpSecret: Ov0mlArSItBrs9EuOMt5Ou_faGdplDDIvPgIhgup51E
   encodingAESKey: bqoACJutQEgW7KOgBoezuQkk7y2HQSyRp1sQ8qnAi6C
   token: 2e0aWIfBewWNN5BNMq9cBeLf9x
-  domain: https://nf.video/8081/api/
+  domain: https://nf.video/8082/api/
 
 #银河录像局小程序
 yhmini:
@@ -171,7 +171,7 @@ advertisement:
   secret: 19b5f5121bc7cc1bc010ee7c4ac509e9
   shopId: 1644299849
   shopKey: 5y5ZScTJGm0q0umHQOD4r3EfjRvCioUx
-  notify: https://nf.video/8081/api/
+  notify: https://nf.video/8082/api/
 
 #广告投放公众号
 advertisementwxapp:
@@ -179,7 +179,7 @@ advertisementwxapp:
   secret: 44c1e7431099fc0bd21dc320822b0108
   shopId: 1644299849
   shopKey: 5y5ZScTJGm0q0umHQOD4r3EfjRvCioUx
-  notify: https://xue.niupian.com.cn/8081/api/
+  notify: https://xue.niupian.com.cn/8082/api/
 
 chatgpt:
   domain: "https://gpt.galaxydvd.com"