Forráskód Böngészése

正常奈飞车队

zoujiajian 1 éve
szülő
commit
0abcd8dc80

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

@@ -28,4 +28,6 @@ public interface AccountMapper extends BaseMapper<Account> {
 	List<AccountView> getExpiredAllAccount();
 
 	Account selectNetflixTempAccount();
+
+	Integer isNormal(String account);
 }

+ 4 - 0
netflix-dao/src/main/resources/mapper/AccountMapper.xml

@@ -199,4 +199,8 @@
                where ntu.account_id = a.id) &lt; 20
             limit 1
     </select>
+
+    <select id="isNormal" resultType="java.lang.Integer">
+        select `state` from account_netflix_state where account = #{account} limit 1
+    </select>
 </mapper>

+ 29 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/AccountTempController.java

@@ -41,6 +41,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.util.Date;
 import java.util.List;
 import java.util.Optional;
 
@@ -500,6 +501,34 @@ public class AccountTempController {
 
 	private final UserMapper userMapper;
 
+	/**
+	 * 正常奈飞账号 车队被下架 上车
+	 */
+	@GetMapping("/normal")
+	public Result<String> normal() {
+		List<GroupsTrips> groupsTrips = groupsMapper.selectList(Wrappers.lambdaQuery(GroupsTrips.class)
+				.in(GroupsTrips::getSkuId, List.of(4, 5, 6))
+				.eq(GroupsTrips::getStatus, GroupsTrips.Status.down));
+		DateTime now = DateTime.now();
+		groupsTrips.forEach(groups->{
+
+			Account account = accountMapper.selectOne(Wrappers.lambdaQuery(Account.class)
+					.eq(Account::getId, groups.getGroupId()));
+			if (account != null) {
+				Date expiryTime = account.getExpiryTime();
+				if (expiryTime.compareTo(now) > 0) {
+					Integer state = accountMapper.isNormal(account.getAccount());
+					if (state == null || state == 1) {
+						log.info("正常奈飞账号:{}", account.getAccount());
+						groups.setStatus(GroupsTrips.Status.validity);
+						groupsMapper.updateById(groups);
+					}
+				}
+			}
+		});
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
 	/**
 	 * 拉黑用户 车票
 	 */