Commit 9b2c7c04 authored by hezhen's avatar hezhen

Merge branch 'base-modify' of http://113.105.137.151:22280/youjj/cloud-platform into base-modify

parents 34751e3f 01ca486a
......@@ -49,4 +49,6 @@ public class WalletDetailAdminVo {
@ApiModelProperty(value = "操作时间", hidden = true )
private Long crtTime;
private String sourceName;
}
......@@ -30,6 +30,9 @@ public class WalletPageVo {
@ApiModelProperty(value = "已提现金额")
private BigDecimal withdrawals;
@ApiModelProperty("提现中的金额")
private BigDecimal withdrawaling;
@ApiModelProperty(value = "总消费")
private BigDecimal totalConsumption;
......
......@@ -33,6 +33,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
@Autowired
private MyWalletDetailBiz myWalletDetailBiz;
@Autowired
private MyWalletCathBiz myWalletCathBiz;
public AppletWalletVo findMyWallet(Integer userId) {
AppletWalletVo appletWalletVo = new AppletWalletVo();
......@@ -56,6 +59,10 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
return walletPageVo;
}
List<Integer> userIds = wallets.stream().map(WalletListDTO::getUserId).collect(Collectors.toList());
Map<Integer, BigDecimal> userIdAndTotalConsumptionMap = myWalletDetailBiz.finduserIdAndPersonalTotalConsumptionMapByUserIds(userIds);
Map<Integer,BigDecimal> userIdAndWithdrawalingMap = myWalletCathBiz.findUserIdAndWithdrawalingMapByUserIds(userIds);
List<WalletPageVo> walletPageVos = new ArrayList<>();
WalletPageVo walletpg ;
for (WalletListDTO wallet : wallets) {
......@@ -63,16 +70,16 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
BeanUtils.copyProperties(wallet,walletpg);
walletpg.setUsername(StringUtils.isEmpty(wallet.getRealname())?wallet.getNickname():wallet.getRealname());
walletpg.setPhone(wallet.getUsername());
BigDecimal totalConsumpution = userIdAndTotalConsumptionMap==null?new BigDecimal(0):userIdAndTotalConsumptionMap.get(wallet.getUserId())==null?new BigDecimal(0):userIdAndTotalConsumptionMap.get(wallet.getUserId());
BigDecimal withDrawaling = userIdAndWithdrawalingMap==null?new BigDecimal(0):userIdAndWithdrawalingMap.get(wallet.getUserId())==null?new BigDecimal(0):userIdAndWithdrawalingMap.get(wallet.getUserId());
walletpg.setWithdrawaling(withDrawaling);
walletpg.setTotalConsumption(totalConsumpution);
walletPageVos.add(walletpg);
}
List<Integer> userIds = wallets.stream().map(WalletListDTO::getUserId).collect(Collectors.toList());
Map<Integer, BigDecimal> userIdAndTotalConsumptionMap = myWalletDetailBiz.finduserIdAndPersonalTotalConsumptionMapByUserIds(userIds);
Optional.ofNullable(userIdAndTotalConsumptionMap).ifPresent(x->{
for (WalletPageVo wtpg : walletPageVos) {
wtpg.setTotalConsumption(x.get(wtpg.getUserId()));
}
});
walletPageVos.sort(Comparator.comparing(WalletPageVo::getTotalAmount).reversed());
walletPageVo.setPageNum(walletFindDTO.getPage());
walletPageVo.setPageSize(walletFindDTO.getLimit());
......
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathFindDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO;
import com.github.wxiaoqi.security.admin.entity.MyWalletCath;
......@@ -10,6 +11,7 @@ import com.github.wxiaoqi.security.admin.vo.WalletCathPageVo;
import com.github.wxiaoqi.security.admin.vo.WalletCathVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Maps;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -19,6 +21,7 @@ import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author libin
......@@ -84,7 +87,6 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
PageDataVO<WalletCathAdminVo> walletCathAdminVoPage = new PageDataVO<>();
// List<WalletCathListDTO> walletCathListDTOS = mapper.selectByUserNameOrPhoneOrWithDrawSate(walletCathFindDTO.getUserName(), walletCathFindDTO.getPhone(), walletCathFindDTO.getState());
PageDataVO<WalletCathListDTO> walletCathListDTOPage = PageDataVO.pageInfo(walletCathFindDTO.getPage(),
walletCathFindDTO.getLimit(),
() -> mapper.selectByUserNameOrPhoneOrWithDrawSate(walletCathFindDTO.getUsername(), walletCathFindDTO.getPhone(), walletCathFindDTO.getState()));
......@@ -112,4 +114,9 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
return walletCathAdminVoPage;
}
public Map<Integer, BigDecimal> findUserIdAndWithdrawalingMapByUserIds(List<Integer> userIds) {
List<PersonalConsumptionDTO> personalConsumptions = mapper.findUserWithDrawingByUserIds(userIds);
Map<Integer, BigDecimal> userIdAndPersonalConsumptionMap = personalConsumptions.stream().collect(Collectors.toMap(PersonalConsumptionDTO::getUserId, PersonalConsumptionDTO::getTotalConsumption));
return userIdAndPersonalConsumptionMap;
}
}
......@@ -14,6 +14,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
......@@ -73,13 +74,15 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
return pageDataVO;
}
List<WalletDetailAdminVo> walletDetailAdminVos = new ArrayList<>();
WalletDetailAdminVo walletDetailAdminVo;
for (WalletDetailListDTO detailListDTO : detailListDTOS) {
walletDetailAdminVo = new WalletDetailAdminVo();
BeanUtils.copyProperties(detailListDTO,walletDetailAdminVo);
walletDetailAdminVo.setUsername(StringUtils.isEmpty(detailListDTO.getRealname())?detailListDTO.getNickname():detailListDTO.getRealname());
walletDetailAdminVos.add(walletDetailAdminVo);
walletDetailAdminVo.setSourceName(StringUtils.isEmpty(detailListDTO.getTitle())?detailListDTO.getActivityName():detailListDTO.getTitle());
}
pageDataVO.setPageNum(walletDetailFindDTO.getPage());
pageDataVO.setPageSize(walletDetailFindDTO.getLimit());
......
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO;
import com.github.wxiaoqi.security.admin.entity.MyWalletCath;
import org.apache.ibatis.annotations.Param;
......@@ -20,4 +21,5 @@ public interface MyWalletCathMapper extends Mapper<MyWalletCath> {
@Param("phone") String phone,
@Param("state") Integer state);
List<PersonalConsumptionDTO> findUserWithDrawingByUserIds(@Param("userIds") List<Integer> userIds);
}
......@@ -26,4 +26,12 @@
WHERE nickname =#{userName} OR realname =#{userName}
</if> ) AS `aud` ON aud.userid = aul.id
</select>
<select id="findUserWithDrawingByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO">
select `user_id` AS `userId`,SUM(amount) AS `totalConsumption` from `my_wallet_cath` where `stauts`=0 AND `user_id` in
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
GROUP BY `user_id`
</select>
</mapper>
\ No newline at end of file
......@@ -11,7 +11,8 @@
wd.itype,
wd.activity_id AS `activityId`,
wd.activity_name AS `activityName`,
aul.username,
wd.crt_time AS `crtTime`,
aul.username AS `phone`,
aud.nickname,
aud.realname,
ausw.price,
......@@ -19,7 +20,7 @@
ausw.waiting,
ausw.title
FROM
(select id,user_id,source,amount,cono,itype,activity_id,activity_name FROM `my_wallet_detail` <if test="sourceType != null">
(select id,user_id,source,amount,cono,itype,activity_id,activity_name,`crt_time` FROM `my_wallet_detail` <if test="sourceType != null">
WHERE `source`=#{sourceType}
</if>) AS `wd`
LEFT JOIN (SELECT id,username FROM `app_user_login`<if test="phone != null and phone != ''">
......
......@@ -38,7 +38,7 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
banners.forEach(banner -> {
BannerVo bannerVo = new BannerVo();
bannerVo.setCover(banner.getCover());
banner.setUrl(banner.getUrl());
bannerVo.setUrl(banner.getUrl());
bannerVos.add(bannerVo);
});
return bannerVos;
......
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