Commit 1faadba1 authored by shiyu's avatar shiyu

藏家主页

parent 171686e4
...@@ -121,7 +121,7 @@ public class CacheUtil { ...@@ -121,7 +121,7 @@ public class CacheUtil {
*/ */
public AsyncLoadingCache<Long, User> appletUserInfoCache = Caffeine.newBuilder() public AsyncLoadingCache<Long, User> appletUserInfoCache = Caffeine.newBuilder()
.maximumSize(5000) .maximumSize(5000)
.expireAfterAccess(30, TimeUnit.SECONDS) .expireAfterAccess(8, TimeUnit.SECONDS)
.buildAsync(k -> getAppletUsers(k)); .buildAsync(k -> getAppletUsers(k));
......
...@@ -40,6 +40,16 @@ public class SelfPageInfoVo implements Entity { ...@@ -40,6 +40,16 @@ public class SelfPageInfoVo implements Entity {
*/ */
private String avatarUrl; private String avatarUrl;
/**
* 简介
*/
private String profile;
/**
* 背景图片
*/
private String background;
/** /**
* 各状态订单数量 * 各状态订单数量
*/ */
...@@ -51,4 +61,10 @@ public class SelfPageInfoVo implements Entity { ...@@ -51,4 +61,10 @@ public class SelfPageInfoVo implements Entity {
private List<DistributionOrderNum> orderNumForDistributor; private List<DistributionOrderNum> orderNumForDistributor;
/**
* 藏家卖出去的商品订单
*/
private List<DistributionOrderNum> orderNumForCollector;
} }
...@@ -9,6 +9,7 @@ import com.wwdz.ch.core.util.RedisUtils; ...@@ -9,6 +9,7 @@ import com.wwdz.ch.core.util.RedisUtils;
import com.wwdz.ch.db.bean.DistributionOrderNum; import com.wwdz.ch.db.bean.DistributionOrderNum;
import com.wwdz.ch.db.dao.FollowFansRecordDao; import com.wwdz.ch.db.dao.FollowFansRecordDao;
import com.wwdz.ch.db.dao.SwitchDao; import com.wwdz.ch.db.dao.SwitchDao;
import com.wwdz.ch.db.dao.UserDao;
import com.wwdz.ch.db.dao.distribution.*; import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.domain.User; import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.domain.distribution.AuctionConfig; import com.wwdz.ch.db.domain.distribution.AuctionConfig;
...@@ -72,6 +73,9 @@ public class SelfPageServiceImpl implements SelfPageService { ...@@ -72,6 +73,9 @@ public class SelfPageServiceImpl implements SelfPageService {
@Autowired @Autowired
FollowFansRecordDao followFansRecordDao; FollowFansRecordDao followFansRecordDao;
@Autowired
UserDao userDao;
@Override @Override
...@@ -82,8 +86,8 @@ public class SelfPageServiceImpl implements SelfPageService { ...@@ -82,8 +86,8 @@ public class SelfPageServiceImpl implements SelfPageService {
long totalProfit = distributorProfitDao.countProfit(dto.getUserId()); long totalProfit = distributorProfitDao.countProfit(dto.getUserId());
SelfPageInfoVo selfPageInfoVo = new SelfPageInfoVo(); SelfPageInfoVo selfPageInfoVo = new SelfPageInfoVo();
selfPageInfoVo.setUserId(dto.getUserId()); selfPageInfoVo.setUserId(dto.getUserId());
selfPageInfoVo.setUserName(cacheUtil.getAppletUserNameById(dto.getUserId())); selfPageInfoVo.setUserName(cacheUtil.appletUserInfoCache.get(dto.getUserId()).get().getNickname());
selfPageInfoVo.setAvatarUrl(cacheUtil.getAppletUsers(dto.getUserId()).getAvatar()); selfPageInfoVo.setAvatarUrl(cacheUtil.appletUserInfoCache.get(dto.getUserId()).get().getAvatar());
selfPageInfoVo.setTotalSellItemNum((int) sellItemNum); selfPageInfoVo.setTotalSellItemNum((int) sellItemNum);
selfPageInfoVo.setTotalSellAmount(PriceUtil.convertPriceFenToYuan(sellAmount)); selfPageInfoVo.setTotalSellAmount(PriceUtil.convertPriceFenToYuan(sellAmount));
selfPageInfoVo.setTotalProfit(PriceUtil.convertPriceFenToYuan(totalProfit)); selfPageInfoVo.setTotalProfit(PriceUtil.convertPriceFenToYuan(totalProfit));
...@@ -111,8 +115,8 @@ public class SelfPageServiceImpl implements SelfPageService { ...@@ -111,8 +115,8 @@ public class SelfPageServiceImpl implements SelfPageService {
try { try {
SelfPageInfoVo selfPageInfoVo = new SelfPageInfoVo(); SelfPageInfoVo selfPageInfoVo = new SelfPageInfoVo();
selfPageInfoVo.setUserId(dto.getUserId()); selfPageInfoVo.setUserId(dto.getUserId());
selfPageInfoVo.setUserName(cacheUtil.getAppletUserNameById(dto.getUserId())); selfPageInfoVo.setUserName(cacheUtil.appletUserInfoCache.get(dto.getUserId()).get().getNickname());
selfPageInfoVo.setAvatarUrl(cacheUtil.getAppletUsers(dto.getUserId()).getAvatar()); selfPageInfoVo.setAvatarUrl(cacheUtil.appletUserInfoCache.get(dto.getUserId()).get().getAvatar());
List<DistributionOrderNum> distributionOrderNumList = distributionOrderDao.countGroupByStateForUser(dto.getUserId()); List<DistributionOrderNum> distributionOrderNumList = distributionOrderDao.countGroupByStateForUser(dto.getUserId());
distributionOrderNumList.forEach(distributionOrderNum -> { distributionOrderNumList.forEach(distributionOrderNum -> {
distributionOrderNum.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrderNum.getState())); distributionOrderNum.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrderNum.getState()));
...@@ -146,31 +150,27 @@ public class SelfPageServiceImpl implements SelfPageService { ...@@ -146,31 +150,27 @@ public class SelfPageServiceImpl implements SelfPageService {
@Override @Override
public Result getCollectorPageInfo(SelfPageRequestDto dto) { public Result getCollectorPageInfo(SelfPageRequestDto dto) {
try { try {
long sellItemNum = distributorProfitDao.countSellItemNum(dto.getUserId());
long sellAmount = distributorProfitDao.countSellAmount(dto.getUserId());
long totalProfit = distributorProfitDao.countProfit(dto.getUserId());
SelfPageInfoVo selfPageInfoVo = new SelfPageInfoVo(); SelfPageInfoVo selfPageInfoVo = new SelfPageInfoVo();
selfPageInfoVo.setUserId(dto.getUserId()); selfPageInfoVo.setUserId(dto.getUserId());
selfPageInfoVo.setUserName(cacheUtil.getAppletUserNameById(dto.getUserId())); selfPageInfoVo.setUserName(cacheUtil.appletUserInfoCache.get(dto.getUserId()).get().getNickname());
selfPageInfoVo.setAvatarUrl(cacheUtil.getAppletUsers(dto.getUserId()).getAvatar()); selfPageInfoVo.setAvatarUrl(cacheUtil.appletUserInfoCache.get(dto.getUserId()).get().getAvatar());
selfPageInfoVo.setTotalSellItemNum((int) sellItemNum); selfPageInfoVo.setProfile(cacheUtil.appletUserInfoCache.get(dto.getUserId()).get().getProfile());
selfPageInfoVo.setTotalSellAmount(PriceUtil.convertPriceFenToYuan(sellAmount)); selfPageInfoVo.setBackground(cacheUtil.appletUserInfoCache.get(dto.getUserId()).get().getBackground());
selfPageInfoVo.setTotalProfit(PriceUtil.convertPriceFenToYuan(totalProfit));
List<DistributionOrderNum> distributionOrderNumList = distributionOrderDao.countGroupByStateForDistributor(dto.getUserId()); List<DistributionOrderNum> distributionOrderNumList = distributionOrderDao.countGroupByStateForDistributor(dto.getUserId());
distributionOrderNumList.forEach(distributionOrderNum -> { distributionOrderNumList.forEach(distributionOrderNum -> {
distributionOrderNum.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrderNum.getState())); distributionOrderNum.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrderNum.getState()));
}); });
//分销商卖出去的商品订单 //藏家卖出去的商品订单
selfPageInfoVo.setOrderNumForDistributor(distributionOrderNumList); selfPageInfoVo.setOrderNumForCollector(distributionOrderNumList);
/* //分销商自己购买的订单 //藏家自己购买的订单
List<DistributionOrderNum> selfBuyNumList = distributionOrderDao.countGroupByStateForUser(dto.getUserId()); List<DistributionOrderNum> selfBuyNumList = distributionOrderDao.countGroupByStateForUser(dto.getUserId());
selfBuyNumList.forEach(s -> { selfBuyNumList.forEach(s -> {
s.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(s.getState())); s.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(s.getState()));
}); });
selfPageInfoVo.setOrderNum(selfBuyNumList);*/ selfPageInfoVo.setOrderNum(selfBuyNumList);
return Result.success(selfPageInfoVo); return Result.success(selfPageInfoVo);
} catch (Exception e) { } catch (Exception e) {
logger.error("查询分销商个人主页失败 error : {}", e); logger.error("查询藏家个人主页失败 error : {}", e);
} }
return Result.failed(); return Result.failed();
} }
......
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