Skip to content

Commit

Permalink
update: 删除接口中没用注释
Browse files Browse the repository at this point in the history
  • Loading branch information
oddfar committed May 25, 2024
1 parent 1094c29 commit bdc1aea
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import com.oddfar.campus.business.entity.IUser;

/**
* i茅台接口请求服务
*/
public interface IMTService {

/**
* 获取i茅台app版本号
*
* @return
*/
String getMTVersion();

Expand All @@ -29,7 +31,6 @@ public interface IMTService {
* @param mobile 手机号
* @param code 验证码
* @param deviceId 设备id
* @return
*/
boolean login(String mobile, String code, String deviceId);

Expand All @@ -47,15 +48,8 @@ public interface IMTService {
* 获得旅行奖励
*
* @param iUser
* @return
*/
void getTravelReward(IUser iUser);
//
// /**
// * 获取累计申购奖励
// * @param iUser
// */
// void getCumulatively(IUser iUser);

/**
* 批量预约
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public interface IShopService extends IService<IShop> {
List<IMTItemInfo> getShopsByProvince(String province, String itemId);

/**
* 获取合适的shopId
*
* @param shopType 1:预约本市出货量最大的门店,2:预约你的位置附近门店
* @param itemId 项目id即预约项目code
* @param province 省份,例如:河北省,北京市
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
import com.oddfar.campus.common.core.RedisCache;
import com.oddfar.campus.common.exception.ServiceException;
import com.oddfar.campus.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
Expand All @@ -33,21 +32,18 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Random;

/**
* i茅台接口请求服务 实现类
*/
@Service
@Slf4j
public class IMTServiceImpl implements IMTService {

private static final Logger logger = LoggerFactory.getLogger(IMTServiceImpl.class);

@Autowired
private IUserMapper iUserMapper;

Expand Down Expand Up @@ -127,11 +123,11 @@ public Boolean sendCode(String mobile, String deviceId) {
HttpResponse execute = request.body(JSONObject.toJSONString(data)).execute();
JSONObject jsonObject = JSONObject.parseObject(execute.body());
//成功返回 {"code":2000}
logger.info("「发送验证码返回」:" + jsonObject.toJSONString());
log.info("「发送验证码返回」:" + jsonObject.toJSONString());
if (jsonObject.getString("code").equals("2000")) {
return Boolean.TRUE;
} else {
logger.error("「发送验证码-失败」:" + jsonObject.toJSONString());
log.error("「发送验证码-失败」:" + jsonObject.toJSONString());
throw new ServiceException("发送验证码错误");
// return false;
}
Expand Down Expand Up @@ -166,11 +162,11 @@ public boolean login(String mobile, String code, String deviceId) {
JSONObject body = JSONObject.parseObject(execute.body());

if (body.getString("code").equals("2000")) {
// logger.info("「登录请求-成功」" + body.toJSONString());
// log.info("「登录请求-成功」" + body.toJSONString());
iUserService.insertIUser(Long.parseLong(mobile), deviceId, body);
return true;
} else {
logger.error("「登录请求-失败」" + body.toJSONString());
log.error("「登录请求-失败」" + body.toJSONString());
throw new ServiceException("登录失败,本地错误日志已记录");
// return false;
}
Expand Down Expand Up @@ -265,7 +261,7 @@ public void receiveReward(IUser iUser) {
}

public void shareReward(IUser iUser) {
logger.info("「领取每日首次分享获取耐力」:" + iUser.getMobile());
log.info("「领取每日首次分享获取耐力」:" + iUser.getMobile());
String url = "https://h5.moutai519.com.cn/game/xmTravel/shareReward";
HttpRequest request = HttpUtil.createRequest(Method.POST, url);

Expand Down Expand Up @@ -505,7 +501,7 @@ public void reservationBatch() {
List<IUser> iUsers = iUserService.selectReservationUserByMinute(minute);

for (IUser iUser : iUsers) {
logger.info("「开始预约用户」" + iUser.getMobile());
log.info("「开始预约用户」" + iUser.getMobile());
//预约
reservation(iUser);
//延时3秒
Expand All @@ -527,7 +523,7 @@ public void getTravelRewardBatch() {
// List<IUser> iUsers = iUserService.selectReservationUser();

for (IUser iUser : iUsers) {
logger.info("「开始获得旅行奖励」" + iUser.getMobile());
log.info("「开始获得旅行奖励」" + iUser.getMobile());
getTravelReward(iUser);
//延时3秒
TimeUnit.SECONDS.sleep(3);
Expand All @@ -546,7 +542,7 @@ public void refreshAll() {

@Override
public void appointmentResults() {
logger.info("申购结果查询开始=========================");
log.info("申购结果查询开始=========================");
List<IUser> iUsers = iUserService.selectReservationUser();
for (IUser iUser : iUsers) {
try {
Expand All @@ -557,14 +553,14 @@ public void appointmentResults() {
.header("MT-Token", iUser.getToken())
.header("User-Agent", "iOS;16.3;Apple;?unrecognized?").execute().body();
JSONObject jsonObject = JSONObject.parseObject(body);
logger.info("查询申购结果回调: user->{},response->{}", iUser.getMobile(), body);
log.info("查询申购结果回调: user->{},response->{}", iUser.getMobile(), body);
if (jsonObject.getInteger("code") != 2000) {
String message = jsonObject.getString("message");
throw new ServiceException(message);
}
JSONArray itemVOs = jsonObject.getJSONObject("data").getJSONArray("reservationItemVOS");
if (Objects.isNull(itemVOs) || itemVOs.isEmpty()) {
logger.info("申购记录为空: user->{}", iUser.getMobile());
log.info("申购记录为空: user->{}", iUser.getMobile());
continue;
}
for (Object itemVO : itemVOs) {
Expand All @@ -576,11 +572,11 @@ public void appointmentResults() {
}
}
} catch (Exception e) {
logger.error("查询申购结果失败:失败原因->{}", e.getMessage(), e);
log.error("查询申购结果失败:失败原因->{}", e.getMessage(), e);
}

}
logger.info("申购结果查询结束=========================");
log.info("申购结果查询结束=========================");
}

public JSONObject reservation(IUser iUser, String itemId, String shopId) {
Expand Down Expand Up @@ -621,7 +617,7 @@ public JSONObject reservation(IUser iUser, String itemId, String shopId) {
String message = body.getString("message");
throw new ServiceException(message);
}
// logger.info(body.toJSONString());
// log.info(body.toJSONString());
return body;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import com.oddfar.campus.business.service.IMTService;
import com.oddfar.campus.business.service.IUserService;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
Expand All @@ -17,8 +15,8 @@
@Configuration
@EnableScheduling
@RequiredArgsConstructor
@Slf4j
public class CampusIMTTask {
private static final Logger logger = LoggerFactory.getLogger(CampusIMTTask.class);

private final IMTService imtService;

Expand Down Expand Up @@ -59,11 +57,11 @@ public void reservationBatchTask() {
@Async
@Scheduled(cron = "0 10,55 7,8 ? * * ")
public void refresh() {
logger.info("「刷新数据」开始刷新版本号,预约item,门店shop列表 ");
log.info("「刷新数据」开始刷新版本号,预约item,门店shop列表 ");
try {
imtService.refreshAll();
} catch (Exception e) {
logger.info("「刷新数据执行报错」%s", e.getMessage());
log.info("「刷新数据执行报错」%s", e.getMessage());
}

}
Expand Down

0 comments on commit bdc1aea

Please sign in to comment.