资金明细优化
This commit is contained in:
@@ -122,7 +122,7 @@ export function userActivity(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 资金明细(types|0=全部,1=消费,2=充值,3=返佣,4=提现)
|
* 余额明细(types|2=全部,1=支出,2=收入)
|
||||||
* */
|
* */
|
||||||
export function getCommissionInfo(q, types) {
|
export function getCommissionInfo(q, types) {
|
||||||
return request.get("spread/commission/" + types, q);
|
return request.get("spread/commission/" + types, q);
|
||||||
|
|||||||
@@ -26,4 +26,4 @@ module.exports = {
|
|||||||
TOKENNAME: 'Authori-zation',
|
TOKENNAME: 'Authori-zation',
|
||||||
// 缓存时间 0 永久
|
// 缓存时间 0 永久
|
||||||
EXPIRE:0,
|
EXPIRE:0,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -55,4 +55,4 @@ const app = new Vue({
|
|||||||
store,
|
store,
|
||||||
Cache
|
Cache
|
||||||
})
|
})
|
||||||
app.$mount();
|
app.$mount();
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<view class='bill-details'>
|
<view class='bill-details'>
|
||||||
<view class='nav acea-row'>
|
<view class='nav acea-row'>
|
||||||
<view class='item' :class='type==0 ? "on":""' @click='changeType(0)'>全部</view>
|
<view class='item' :class='type==0 ? "on":""' @click='changeType(0)'>全部</view>
|
||||||
<view class='item' :class='type==1 ? "on":""' @click='changeType(1)'>消费</view>
|
<view class='item' :class='type==1 ? "on":""' @click='changeType(1)'>支出</view>
|
||||||
<view class='item' :class='type==2 ? "on":""' @click='changeType(2)'>充值</view>
|
<view class='item' :class='type==2 ? "on":""' @click='changeType(2)'>收入</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='sign-record'>
|
<view class='sign-record'>
|
||||||
<view class='list' v-for="(item,index) in userBillList" :key="index">
|
<view class='list' v-for="(item,index) in userBillList" :key="index">
|
||||||
|
|||||||
@@ -18,11 +18,11 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class='cumulative acea-row row-top'>
|
<view class='cumulative acea-row row-top'>
|
||||||
<view class='item'>
|
<view class='item'>
|
||||||
<view>累计充值(元)</view>
|
<view>累计收入(元)</view>
|
||||||
<view class='money'>{{statistics.recharge || 0}}</view>
|
<view class='money'>{{statistics.recharge || 0}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='item'>
|
<view class='item'>
|
||||||
<view>累计消费(元)</view>
|
<view>累计支出(元)</view>
|
||||||
<view class='money'>{{statistics.orderStatusSum || 0}}</view>
|
<view class='money'>{{statistics.orderStatusSum || 0}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<view class='pictrue'>
|
<view class='pictrue'>
|
||||||
<image src='../../../static/images/record2.png'></image>
|
<image src='../../../static/images/record2.png'></image>
|
||||||
</view>
|
</view>
|
||||||
<view>消费记录</view>
|
<view>支出记录</view>
|
||||||
</navigator>
|
</navigator>
|
||||||
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=2' v-if="recharge_switch">
|
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=2' v-if="recharge_switch">
|
||||||
<view class='pictrue'>
|
<view class='pictrue'>
|
||||||
|
|||||||
@@ -27,4 +27,6 @@ public interface UserRechargeService extends IService<UserRecharge> {
|
|||||||
UserRecharge create(UserRechargeRequest request);
|
UserRecharge create(UserRechargeRequest request);
|
||||||
|
|
||||||
Boolean complete(UserRecharge userRecharge);
|
Boolean complete(UserRecharge userRecharge);
|
||||||
|
|
||||||
|
BigDecimal getSumBigDecimal(Integer uid);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zbkj.crmeb.finance.service.impl;
|
package com.zbkj.crmeb.finance.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.common.PageParamRequest;
|
import com.common.PageParamRequest;
|
||||||
import com.constants.Constants;
|
import com.constants.Constants;
|
||||||
@@ -146,5 +147,26 @@ public class UserRechargeServiceImpl extends ServiceImpl<UserRechargeDao, UserRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值总金额
|
||||||
|
* @param userId Integer 用户uid
|
||||||
|
* @author Mr.Zhang
|
||||||
|
* @since 2020-05-29
|
||||||
|
* @return UserBill
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BigDecimal getSumBigDecimal(Integer userId) {
|
||||||
|
QueryWrapper<UserRecharge> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
|
||||||
|
queryWrapper.select("sum(price) as price").
|
||||||
|
eq("uid", userId).
|
||||||
|
eq("paid", 1);
|
||||||
|
UserRecharge userRecharge = dao.selectOne(queryWrapper);
|
||||||
|
if(null == userRecharge || null == userRecharge.getPrice()){
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
return userRecharge.getPrice();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public class UserController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation(value = "推广佣金明细")
|
@ApiOperation(value = "推广佣金明细")
|
||||||
@RequestMapping(value = "/spread/commission/{type}", method = RequestMethod.GET)
|
@RequestMapping(value = "/spread/commission/{type}", method = RequestMethod.GET)
|
||||||
@ApiImplicitParam(name = "type", value = "类型 佣金类型|0=全部,1=消费,2=充值,3=返佣,4=提现", allowableValues = "range[0,1,2,3,4]", dataType = "int")
|
@ApiImplicitParam(name = "type", value = "类型 佣金类型|0=全部,1=支出,2=收入,3=佣金明细", allowableValues = "range[0,1,2,3]", dataType = "int")
|
||||||
public CommonResult<CommonPage<UserSpreadCommissionResponse>> getSpreadCommissionByType(@PathVariable int type, @Validated PageParamRequest pageParamRequest){
|
public CommonResult<CommonPage<UserSpreadCommissionResponse>> getSpreadCommissionByType(@PathVariable int type, @Validated PageParamRequest pageParamRequest){
|
||||||
return CommonResult.success(CommonPage.restPage(userCenterService.getSpreadCommissionByType(type, pageParamRequest)));
|
return CommonResult.success(CommonPage.restPage(userCenterService.getSpreadCommissionByType(type, pageParamRequest)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import com.zbkj.crmeb.user.model.UserBill;
|
|||||||
import com.zbkj.crmeb.user.model.UserToken;
|
import com.zbkj.crmeb.user.model.UserToken;
|
||||||
import com.zbkj.crmeb.user.request.RegisterThirdUserRequest;
|
import com.zbkj.crmeb.user.request.RegisterThirdUserRequest;
|
||||||
import com.zbkj.crmeb.user.request.UserOperateFundsRequest;
|
import com.zbkj.crmeb.user.request.UserOperateFundsRequest;
|
||||||
import com.zbkj.crmeb.user.service.UserAddressService;
|
|
||||||
import com.zbkj.crmeb.user.service.UserBillService;
|
import com.zbkj.crmeb.user.service.UserBillService;
|
||||||
import com.zbkj.crmeb.user.service.UserService;
|
import com.zbkj.crmeb.user.service.UserService;
|
||||||
import com.zbkj.crmeb.user.service.UserTokenService;
|
import com.zbkj.crmeb.user.service.UserTokenService;
|
||||||
@@ -99,8 +98,6 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WeChatService weChatService;
|
private WeChatService weChatService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserAddressService userAddressService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,8 +109,10 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
|||||||
public UserCommissionResponse getCommission() {
|
public UserCommissionResponse getCommission() {
|
||||||
UserCommissionResponse userCommissionResponse = new UserCommissionResponse();
|
UserCommissionResponse userCommissionResponse = new UserCommissionResponse();
|
||||||
//昨天的佣金
|
//昨天的佣金
|
||||||
userCommissionResponse.setLastDayCount(userBillService.getSumBigDecimal(0, userService.getUserIdException(), Constants.USER_BILL_CATEGORY_MONEY, Constants.SEARCH_DATE_YESTERDAY, null));
|
userCommissionResponse.setLastDayCount(userBillService.getSumBigDecimal(0, userService.getUserIdException(), Constants.USER_BILL_CATEGORY_BROKERAGE_PRICE, Constants.SEARCH_DATE_YESTERDAY, null));
|
||||||
userCommissionResponse.setExtractCount(userBillService.getSumBigDecimal(0, userService.getUserIdException(), Constants.USER_BILL_CATEGORY_MONEY, null, Constants.USER_BILL_TYPE_EXTRACT));
|
|
||||||
|
userCommissionResponse.setExtractCount(userBillService.getSumBigDecimal(0, userService.getUserIdException(), Constants.USER_BILL_CATEGORY_BROKERAGE_PRICE, null, Constants.USER_BILL_TYPE_EXTRACT));
|
||||||
|
|
||||||
userCommissionResponse.setCommissionCount(userService.getInfo().getBrokeragePrice());
|
userCommissionResponse.setCommissionCount(userService.getInfo().getBrokeragePrice());
|
||||||
return userCommissionResponse;
|
return userCommissionResponse;
|
||||||
}
|
}
|
||||||
@@ -126,7 +125,25 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<UserSpreadCommissionResponse> getSpreadCommissionByType(int type, PageParamRequest pageParamRequest) {
|
public PageInfo<UserSpreadCommissionResponse> getSpreadCommissionByType(int type, PageParamRequest pageParamRequest) {
|
||||||
return userBillService.getListGroupByMonth(userService.getUserIdException(), type, pageParamRequest);
|
Integer pm = null;
|
||||||
|
String category = Constants.USER_BILL_CATEGORY_MONEY;
|
||||||
|
switch (type){
|
||||||
|
case 1:
|
||||||
|
pm = 0;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
pm = 1;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
category = Constants.USER_BILL_CATEGORY_BROKERAGE_PRICE;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
return null;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return userBillService.getListGroupByMonth(userService.getUserIdException(), pm, pageParamRequest, category);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -275,7 +292,7 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
|||||||
@Override
|
@Override
|
||||||
public UserBalanceResponse getUserBalance() {
|
public UserBalanceResponse getUserBalance() {
|
||||||
User info = userService.getInfo();
|
User info = userService.getInfo();
|
||||||
BigDecimal recharge = userBillService.getSumBigDecimal(1, info.getUid(), Constants.USER_BILL_CATEGORY_MONEY, null, Constants.USER_BILL_TYPE_RECHARGE);
|
BigDecimal recharge = userBillService.getSumBigDecimal(1, info.getUid(), Constants.USER_BILL_CATEGORY_MONEY, null, null);
|
||||||
BigDecimal orderStatusSum = storeOrderService.getSumBigDecimal(info.getUid(), null);
|
BigDecimal orderStatusSum = storeOrderService.getSumBigDecimal(info.getUid(), null);
|
||||||
return new UserBalanceResponse(info.getBrokeragePrice(), recharge, orderStatusSum);
|
return new UserBalanceResponse(info.getBrokeragePrice(), recharge, orderStatusSum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class RechargePayServiceImpl extends PayService implements RechargePaySer
|
|||||||
//余额变动
|
//余额变动
|
||||||
UserOperateFundsRequest userOperateFundsRequest = new UserOperateFundsRequest();
|
UserOperateFundsRequest userOperateFundsRequest = new UserOperateFundsRequest();
|
||||||
userOperateFundsRequest.setValue(getUserRecharge().getPrice().add(getUserRecharge().getGivePrice()));
|
userOperateFundsRequest.setValue(getUserRecharge().getPrice().add(getUserRecharge().getGivePrice()));
|
||||||
userOperateFundsRequest.setFoundsType(Constants.ORDER_LOG_PAY_SUCCESS);
|
userOperateFundsRequest.setFoundsType(Constants.USER_BILL_TYPE_PAY_RECHARGE);
|
||||||
userOperateFundsRequest.setUid(getUserRecharge().getUid());
|
userOperateFundsRequest.setUid(getUserRecharge().getUid());
|
||||||
userOperateFundsRequest.setTitle("充值支付");
|
userOperateFundsRequest.setTitle("充值支付");
|
||||||
userOperateFundsRequest.setFoundsCategory(Constants.USER_BILL_CATEGORY_MONEY);
|
userOperateFundsRequest.setFoundsCategory(Constants.USER_BILL_CATEGORY_MONEY);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public interface UserBillService extends IService<UserBill> {
|
|||||||
|
|
||||||
BigDecimal getSumBigDecimal(Integer pm, Integer userId, String category, String date, String type);
|
BigDecimal getSumBigDecimal(Integer pm, Integer userId, String category, String date, String type);
|
||||||
|
|
||||||
PageInfo<UserSpreadCommissionResponse> getListGroupByMonth(Integer userId, int type, PageParamRequest pageParamRequest);
|
PageInfo<UserSpreadCommissionResponse> getListGroupByMonth(Integer userId, Integer type, PageParamRequest pageParamRequest, String category);
|
||||||
|
|
||||||
boolean saveRefundBill(StoreOrderRefundRequest request, User user);
|
boolean saveRefundBill(StoreOrderRefundRequest request, User user);
|
||||||
|
|
||||||
|
|||||||
@@ -299,21 +299,20 @@ public class UserBillServiceImpl extends ServiceImpl<UserBillDao, UserBill> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按照月份分组
|
* 按照月份分组, 余额
|
||||||
* @author Mr.Zhang
|
* @author Mr.Zhang
|
||||||
* @since 2020-06-08
|
* @since 2020-06-08
|
||||||
* @return CommonPage<UserBill>
|
* @return CommonPage<UserBill>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<UserSpreadCommissionResponse> getListGroupByMonth(Integer userId, int type, PageParamRequest pageParamRequest) {
|
public PageInfo<UserSpreadCommissionResponse> getListGroupByMonth(Integer userId, Integer pm, PageParamRequest pageParamRequest, String category) {
|
||||||
Page<UserBill> userBillPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
Page<UserBill> userBillPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||||
ArrayList<UserSpreadCommissionResponse> userSpreadCommissionResponseList = new ArrayList<>();
|
ArrayList<UserSpreadCommissionResponse> userSpreadCommissionResponseList = new ArrayList<>();
|
||||||
|
|
||||||
QueryWrapper<UserBill> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<UserBill> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("uid", userId).eq("status", 1);
|
queryWrapper.eq("uid", userId).eq("status", 1).eq("category", category);
|
||||||
ArrayList<String> typeList = getTypeList(type);
|
if(null != pm){
|
||||||
if(typeList.size() > 0){
|
queryWrapper.eq("pm", pm);
|
||||||
queryWrapper.in("type", typeList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
queryWrapper.groupBy("left(create_time, 7)");
|
queryWrapper.groupBy("left(create_time, 7)");
|
||||||
@@ -325,7 +324,7 @@ public class UserBillServiceImpl extends ServiceImpl<UserBillDao, UserBill> impl
|
|||||||
|
|
||||||
for (UserBill userBill : list) {
|
for (UserBill userBill : list) {
|
||||||
String date = DateUtil.dateToStr(userBill.getCreateTime(), Constants.DATE_FORMAT_MONTH);
|
String date = DateUtil.dateToStr(userBill.getCreateTime(), Constants.DATE_FORMAT_MONTH);
|
||||||
userSpreadCommissionResponseList.add(new UserSpreadCommissionResponse(date, getListByMonth(userId, type, date)));
|
userSpreadCommissionResponseList.add(new UserSpreadCommissionResponse(date, getListByMonth(userId, pm, date, category)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommonPage.copyPageInfo(userBillPage, userSpreadCommissionResponseList);
|
return CommonPage.copyPageInfo(userBillPage, userSpreadCommissionResponseList);
|
||||||
@@ -409,13 +408,13 @@ public class UserBillServiceImpl extends ServiceImpl<UserBillDao, UserBill> impl
|
|||||||
* @since 2020-06-08
|
* @since 2020-06-08
|
||||||
* @return List<UserBill>
|
* @return List<UserBill>
|
||||||
*/
|
*/
|
||||||
private List<UserBill> getListByMonth(Integer userId, int type, String month) {
|
private List<UserBill> getListByMonth(Integer userId, Integer pm, String month, String category) {
|
||||||
QueryWrapper<UserBill> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<UserBill> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.select("pm,title,number,create_time").eq("uid", userId). eq("status", 1).eq("left(create_time, 7)", month);
|
queryWrapper.select("pm,title,number,create_time").eq("uid", userId). eq("status", 1).eq("left(create_time, 7)", month).eq("category", category);
|
||||||
ArrayList<String> typeList = getTypeList(type);
|
if(null != pm){
|
||||||
if(typeList.size() > 0){
|
queryWrapper.eq("pm", pm);
|
||||||
queryWrapper.in("type", typeList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
queryWrapper.orderByDesc("create_time");
|
queryWrapper.orderByDesc("create_time");
|
||||||
return dao.selectList(queryWrapper);
|
return dao.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user