|
@@ -1,6 +1,7 @@
|
|
|
package com.caimei365.user.service.impl;
|
|
|
|
|
|
import com.caimei365.user.components.CommonService;
|
|
|
+import com.caimei365.user.feign.VipProductFeign;
|
|
|
import com.caimei365.user.mapper.BaseMapper;
|
|
|
import com.caimei365.user.mapper.LoginMapper;
|
|
|
import com.caimei365.user.mapper.SuperVipMapper;
|
|
@@ -12,10 +13,7 @@ import com.caimei365.user.model.dto.SuperVipDto;
|
|
|
import com.caimei365.user.model.po.ShopPo;
|
|
|
import com.caimei365.user.model.po.SuperVipPo;
|
|
|
import com.caimei365.user.model.po.VipPayHistoryPo;
|
|
|
-import com.caimei365.user.model.vo.ClubTemporaryVo;
|
|
|
-import com.caimei365.user.model.vo.ShopVo;
|
|
|
-import com.caimei365.user.model.vo.UserLoginVo;
|
|
|
-import com.caimei365.user.model.vo.UserVo;
|
|
|
+import com.caimei365.user.model.vo.*;
|
|
|
import com.caimei365.user.service.BaseService;
|
|
|
import com.caimei365.user.utils.*;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
@@ -26,10 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -53,6 +48,8 @@ public class BaseServiceImpl implements BaseService {
|
|
|
private LoginMapper loginMapper;
|
|
|
@Value("${spring.cloud.config.profile}")
|
|
|
private String profile;
|
|
|
+ @Resource
|
|
|
+ private VipProductFeign vipFeign;
|
|
|
|
|
|
/**
|
|
|
* 获取图片验证码
|
|
@@ -468,19 +465,28 @@ public class BaseServiceImpl implements BaseService {
|
|
|
map.put("history", historyPageInfo);
|
|
|
//查过期时间
|
|
|
SuperVipDto vipEnd = findEnd(userId);
|
|
|
- map.put("vip",vipEnd);
|
|
|
+ map.put("vip", vipEnd);
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
- public ResponseJson<Map<String, Object>> superCenter(Integer userId) {
|
|
|
+ public ResponseJson<Map<String, Object>> superCenter(Integer userId, Integer source) {
|
|
|
//1.封装vipDto看超级会员是否过期,0未开通,-1过期,1未过期
|
|
|
SuperVipDto vipEnd = findEnd(userId);
|
|
|
Map<String, Object> map = new HashMap(3);
|
|
|
map.put("vip", vipEnd);
|
|
|
- //todo 2.查专属优惠卷
|
|
|
-
|
|
|
- //todo 3.查优惠商品
|
|
|
+ //2.查当月vip优惠卷
|
|
|
+ Integer useTime = Calendar.getInstance().get(Calendar.MONTH);
|
|
|
+ List<CouponVo> vipCoupon = vipMapper.findVipCoupon(userId, useTime + 1);
|
|
|
+ List<Integer> couponGet = vipMapper.findCouponGet(userId, useTime + 1);
|
|
|
+ vipCoupon.forEach(couponVo -> couponVo.setGetFlag(couponGet.contains(couponVo.getCouponId()) ? 1 : 0));
|
|
|
+ map.put("coupon", vipCoupon);
|
|
|
+ //3.查优惠商品
|
|
|
+ ResponseJson<Map<String, Object>> svipProductPage = vipFeign.getSvipProductPage(userId, source, 1, 10);
|
|
|
+ PaginationVo<ProductItemVo> page = (PaginationVo<ProductItemVo>) svipProductPage.getData().get("svipProductPage");
|
|
|
+ map.put("product",page);
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
|
|
|
@@ -497,7 +503,7 @@ public class BaseServiceImpl implements BaseService {
|
|
|
if (endTime == null) {
|
|
|
superVipDto.setVipFlag(-1);
|
|
|
superVipDto.setEndTime(superVip.getEndTime());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
superVipDto.setVipFlag(1);
|
|
|
superVipDto.setEndTime(superVip.getEndTime());
|
|
|
}
|