记得上下班打卡 | git大法好,push需谨慎

Commit a2bc79f3 authored by GaoHu's avatar GaoHu

修改预约逻辑

parent b00b3ca1
......@@ -153,18 +153,18 @@ public class GoblinGoodsAnticipateMgServiceImpl implements IGoblinGoodsAnticipat
return ResponseDto.success(pageInfo);
}
private Integer setState(LocalDateTime StartDate, LocalDateTime EndDate) {
private Integer setState(LocalDateTime startDate, LocalDateTime endDate) {
LocalDateTime now = LocalDateTime.now();
if (StartDate.isAfter(now)) {
if (startDate.isAfter(now)) {
//未开始 0
return 0;
}
if (StartDate.isBefore(now) && EndDate.isAfter(now)) {
if (startDate.isBefore(now) && endDate.isAfter(now)) {
//预约中 1
return 1;
}
if (EndDate.isBefore(now)) {
if (endDate.isBefore(now)) {
//已结束 2
return 2;
}
......
......@@ -22,7 +22,9 @@ public class GoblinAnticipateUtils {
@Value("${liquidnet.service.adam.url}")
private String adamUrl;
public AdamUserProfileVo getUserInfo() {
private final String avatar = "";
public String getUserInfo() {
try {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Authorization", "Bearer " + CurrentUtil.getToken());
......@@ -31,11 +33,13 @@ public class GoblinAnticipateUtils {
String returnData = HttpUtil.post(adamUrl + " /adam/user/info", header);
ResponseDto<AdamUserProfileVo> innerReturnVo = JsonUtils.fromJson(returnData, new TypeReference<ResponseDto<AdamUserProfileVo>>() {
});
return innerReturnVo.getData();
if (innerReturnVo.getData()!=null){
return innerReturnVo.getData().getUserInfo().getAvatar();
}
return avatar;
} catch (Exception e) {
log.error("获取用户头像失败", e);
return AdamUserProfileVo.getNew();
return avatar;
}
}
}
......@@ -128,10 +128,8 @@ public class GoblinRedisUtils {
List<String> list = (List) redisUtil.get(GoblinRedisConst.ANTICIPATE_SKUID_AVATAR.concat(skuId));
List<String> urlList = list != null ? list : new ArrayList<String>();
if (urlList.size()<=2){
GoblinAnticipateUtils goblinOrderUtils = new GoblinAnticipateUtils();
AdamUserProfileVo userInfo = goblinOrderUtils.getUserInfo();
String avatar = userInfo.getUserInfo().getAvatar();
urlList.add(avatar);
GoblinAnticipateUtils goblinAnticipateUtils = new GoblinAnticipateUtils();
urlList.add(goblinAnticipateUtils.getUserInfo());
redisUtil.set(GoblinRedisConst.ANTICIPATE_SKUID_AVATAR.concat(skuId),urlList);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment