zoujiajian 2 năm trước cách đây
mục cha
commit
62d11b8a98

+ 5 - 0
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -317,4 +317,9 @@ public interface Constant {
 	 * 设备意向标签组
 	 */
 	String EP_INTENTION_GROUP_NAME= "设备群发标签";
+
+	/**
+	 * 大学生快递站 体验车票规格
+	 */
+	Long GPT_MIRROR_SKU_ID = 429l;
 }

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

@@ -70,4 +70,6 @@ public interface GroupsRelationMapper extends BaseMapper<GroupsRelation> {
 	PhoneCode getAreaPhoneByUserId(Long userId);
 
 	List<RenewalView> getUserHasPayGoods(@Param("list") List<Long> userIds, @Param("now") DateTime now);
+
+	Long getExperienceTicket(@Param("userId") Long userId, @Param("skuId") Long skuId);
 }

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

@@ -340,4 +340,11 @@
         group by g.id,g.title,g.logo
         order by goods_id
     </select>
+
+    <select id="getExperienceTicket" resultType="java.lang.Long">
+        select gr.id
+        from (select id, groups_id from groups_relation where user_id = #{userId}) gr
+                 inner join groups_trips gt on gt.id = gr.groups_id
+        where gt.sku_id = #{skuId} limit 1
+    </select>
 </mapper>

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

@@ -749,7 +749,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				.withStopStrategy(StopStrategies.stopAfterAttempt(3)).build();
 		try {
 			build.call(() -> {
-				Long gptMirrorSkuId = 429l;
+				//体验规格
+				Long gptMirrorSkuId = Constant.GPT_MIRROR_SKU_ID;
 				GroupsTrips groups = groupsMapper.selectCollegeStudentUserGptTicket(gptMirrorSkuId);
 				GroupsRelation relation = null;
 				if (groups != null) {
@@ -768,7 +769,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 						.set(GroupsRelation::getExpiryTime, expiryTime)
 						.set(GroupsRelation::getStatus, GroupsRelation.Status.validity)
 						.eq(GroupsRelation::getId, relation.getId())
-						.ne(GroupsRelation::getUserId, 0));
+						.eq(GroupsRelation::getUserId, 0));
 				if (update > 0) {
 					groupsMapper.decrAvailableNum(groups.getId());
 					return true;

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/station/CollegeStudentStationFService.java

@@ -8,4 +8,6 @@ package com.cyksj.service.station;
  */
 public interface CollegeStudentStationFService {
 	void saveCollegeStudent(long userId, Integer type);
+
+	Long getExperienceTicket(Long userId);
 }

+ 10 - 0
netflix-service/src/main/java/com/cyksj/service/station/impl/CollegeStudentStationFServiceImpl.java

@@ -1,5 +1,7 @@
 package com.cyksj.service.station.impl;
 
+import com.cyksj.common.constant.Constant;
+import com.cyksj.mapper.GroupsRelationMapper;
 import com.cyksj.mapper.station.CollegeStudentStationClickRecordMapper;
 import com.cyksj.model.entity.CollegeStudentStationClickRecord;
 import com.cyksj.service.station.CollegeStudentStationFService;
@@ -17,6 +19,8 @@ import org.springframework.stereotype.Service;
 public class CollegeStudentStationFServiceImpl implements CollegeStudentStationFService {
 	private final CollegeStudentStationClickRecordMapper collegeStudentStationClickRecordMapper;
 
+	private final GroupsRelationMapper groupsRelationMapper;
+
 	@Override
 	public void saveCollegeStudent(long userId, Integer type) {
 		CollegeStudentStationClickRecord collegeStudentStationClickRecord = new CollegeStudentStationClickRecord();
@@ -24,4 +28,10 @@ public class CollegeStudentStationFServiceImpl implements CollegeStudentStationF
 		collegeStudentStationClickRecord.setType(type);
 		collegeStudentStationClickRecordMapper.insert(collegeStudentStationClickRecord);
 	}
+
+	@Override
+	public Long getExperienceTicket(Long userId) {
+		Long relationId = groupsRelationMapper.getExperienceTicket(userId, Constant.GPT_MIRROR_SKU_ID);
+		return relationId;
+	}
 }

+ 11 - 0
netflix-web/src/main/java/com/cyksj/web/controller/user/CollegeStudentStationController.java

@@ -33,4 +33,15 @@ public class CollegeStudentStationController {
 		collegeStudentStationService.saveCollegeStudent(userId, type);
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
+
+
+	/**
+	 * 体验车票id
+	 */
+	@PostMapping("/get")
+	public Result<Long> getExperienceTicket() {
+		long userId = StpUserUtil.getLoginIdAsLong();
+		Long relationId = collegeStudentStationService.getExperienceTicket(userId);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(relationId);
+	}
 }