Commit ab398d79 authored by libin's avatar libin

Merge branch 'master-auto-pay' into dev

# Conflicts:
#	ace-modules/ace-admin/src/main/resources/mapper/MyWalletDetailMapper.xml
parents 2788c35e c3118259
package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/21 10:23
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserSellingWaterAdminDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String userName;
private String sourceName;
private String phone;
@ApiModelProperty(value = "订单id")
private Integer orderId;
@ApiModelProperty(value = "订单号")
private String orderNo;
@ApiModelProperty(value = "1-租车;2-旅游;3-会员;4-营地")
private Integer orderType;
@ApiModelProperty(value = "商品数量")
private Integer goodNumber;
@ApiModelProperty(value = "类型 1=>一级上线提成")
private Integer type;
@ApiModelProperty(value = "类别:0-正;1-负")
private Integer status;
@ApiModelProperty(value = "商品标题")
private String title;
@ApiModelProperty(value = "售价")
private BigDecimal price;
@ApiModelProperty(value = "提成百分比")
private Integer extract;
@ApiModelProperty(value = "是否入账:0-未入账;1-已入账")
private Integer waiting;
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
private BigDecimal commission;
}
package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/21 10:21
*/
@Data
public class UserSellingWaterFindDTO extends PageParam {
private String userName;
private String phone;
private Integer waiting;
private Integer status;
private Long startTime;
private Long endTime;
}
...@@ -20,4 +20,10 @@ public class WalletCathFindDTO extends PageParam { ...@@ -20,4 +20,10 @@ public class WalletCathFindDTO extends PageParam {
* 转账状态 * 转账状态
*/ */
private Integer state; private Integer state;
private String orderNo;
private Long startTime;
private Long endTime;
} }
...@@ -17,4 +17,8 @@ public class WalletDetailFindDTO extends PageParam { ...@@ -17,4 +17,8 @@ public class WalletDetailFindDTO extends PageParam {
private String phone; private String phone;
private Integer source; private Integer source;
private Long startTime;
private Long endTime;
} }
...@@ -40,4 +40,6 @@ public class AppletWalletVo { ...@@ -40,4 +40,6 @@ public class AppletWalletVo {
@ApiModelProperty(value = "未入账金额") @ApiModelProperty(value = "未入账金额")
private BigDecimal unbooked; private BigDecimal unbooked;
@ApiModelProperty(value = "是否冻结")
private Integer isFrozen;
} }
package com.github.wxiaoqi.security.admin.vo; package com.github.wxiaoqi.security.admin.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -12,6 +14,8 @@ import java.math.BigDecimal; ...@@ -12,6 +14,8 @@ import java.math.BigDecimal;
* @data 2019/7/12 9:20 * @data 2019/7/12 9:20
*/ */
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
public class ApplyCathVo { public class ApplyCathVo {
/** /**
* 用户ID * 用户ID
......
...@@ -50,8 +50,5 @@ public class WalletCathAdminVo { ...@@ -50,8 +50,5 @@ public class WalletCathAdminVo {
@ApiModelProperty(value = "用户账号") @ApiModelProperty(value = "用户账号")
private String accountNumber; private String accountNumber;
@ApiModelProperty(value = "用户账号描述")
private String accountNumberDesc;
private String accountName; private String accountName;
} }
...@@ -52,4 +52,7 @@ public class WalletPageVo { ...@@ -52,4 +52,7 @@ public class WalletPageVo {
@ApiModelProperty(value = "是否冻结:0-正常,1-冻结") @ApiModelProperty(value = "是否冻结:0-正常,1-冻结")
private Integer isFrozen; private Integer isFrozen;
@ApiModelProperty(value = "佣金比例")
private Integer commissionRate;
} }
...@@ -3,9 +3,10 @@ package com.github.wxiaoqi.security.admin.biz; ...@@ -3,9 +3,10 @@ package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.bo.UserIncomeBo; import com.github.wxiaoqi.security.admin.bo.UserIncomeBo;
import com.github.wxiaoqi.security.admin.dto.OrderGoodsDTO; import com.github.wxiaoqi.security.admin.dto.OrderGoodsDTO;
import com.github.wxiaoqi.security.admin.dto.OrderWaterDTO; import com.github.wxiaoqi.security.admin.dto.OrderWaterDTO;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterAdminDTO;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterFindDTO;
import com.github.wxiaoqi.security.admin.entity.*; import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.entity.AppUserRelation; import com.github.wxiaoqi.security.admin.entity.AppUserRelation;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.admin.vo.SellingWalletVo; import com.github.wxiaoqi.security.admin.vo.SellingWalletVo;
import com.github.wxiaoqi.security.admin.vo.SellingWalletPagVo; import com.github.wxiaoqi.security.admin.vo.SellingWalletPagVo;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
...@@ -380,17 +381,17 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -380,17 +381,17 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWalletVo.setHeadUrl(appUserDetail == null ? "" : appUserDetail.getHeadimgurl()); sellingWalletVo.setHeadUrl(appUserDetail == null ? "" : appUserDetail.getHeadimgurl());
} }
//取消单 //取消单
if (sellingWalletVo.getSellerStatus()==1) { if (sellingWalletVo.getSellerStatus() == 1) {
sellingWalletVo.setSellerStatus(SellerWallterStatus.CANCEL.getCode()); sellingWalletVo.setSellerStatus(SellerWallterStatus.CANCEL.getCode());
sellingWalletVo.setStatusText(SellerWallterStatus.CANCEL.getText()); sellingWalletVo.setStatusText(SellerWallterStatus.CANCEL.getText());
sellingWalletVo.setIsShow(true); sellingWalletVo.setIsShow(true);
}else { } else {
if (sellingWalletVo.getWaiting()==SellerWallterStatus.POST.getCode()){ if (sellingWalletVo.getWaiting() == SellerWallterStatus.POST.getCode()) {
sellingWalletVo.setSellerStatus(SellerWallterStatus.POST.getCode()); sellingWalletVo.setSellerStatus(SellerWallterStatus.POST.getCode());
sellingWalletVo.setStatusText(SellerWallterStatus.POST.getText()); sellingWalletVo.setStatusText(SellerWallterStatus.POST.getText());
sellingWalletVo.setIsShow(false); sellingWalletVo.setIsShow(false);
} }
if (sellingWalletVo.getWaiting()==SellerWallterStatus.NO_POST.getCode()){ if (sellingWalletVo.getWaiting() == SellerWallterStatus.NO_POST.getCode()) {
sellingWalletVo.setSellerStatus(SellerWallterStatus.NO_POST.getCode()); sellingWalletVo.setSellerStatus(SellerWallterStatus.NO_POST.getCode());
sellingWalletVo.setStatusText(SellerWallterStatus.NO_POST.getText()); sellingWalletVo.setStatusText(SellerWallterStatus.NO_POST.getText());
sellingWalletVo.setIsShow(false); sellingWalletVo.setIsShow(false);
...@@ -405,6 +406,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -405,6 +406,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
return sellingWalletPagVo; return sellingWalletPagVo;
} }
public PageDataVO<UserSellingWaterAdminDTO> findSellingWaterWithPage(UserSellingWaterFindDTO userSellingWaterFindDTO) {
PageDataVO<UserSellingWaterAdminDTO> pageDataVO = PageDataVO.pageInfo(userSellingWaterFindDTO.getPage(),
userSellingWaterFindDTO.getLimit(),
() -> mapper.selectSellingWaterPage(userSellingWaterFindDTO));
return pageDataVO;
}
private enum SellerWallterStatus { private enum SellerWallterStatus {
CANCEL(2, "取消订单"), CANCEL(2, "取消订单"),
POST(1, "已入账"), POST(1, "已入账"),
......
...@@ -11,10 +11,7 @@ import com.github.wxiaoqi.security.admin.dto.WalletListDTO; ...@@ -11,10 +11,7 @@ import com.github.wxiaoqi.security.admin.dto.WalletListDTO;
import com.github.wxiaoqi.security.admin.entity.*; import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.mapper.MyWalletMapper; import com.github.wxiaoqi.security.admin.mapper.MyWalletMapper;
import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService; import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService;
import com.github.wxiaoqi.security.admin.vo.AppletWalletVo; import com.github.wxiaoqi.security.admin.vo.*;
import com.github.wxiaoqi.security.admin.vo.ApplyCathVo;
import com.github.wxiaoqi.security.admin.vo.PayAccountVo;
import com.github.wxiaoqi.security.admin.vo.WalletPageVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant; import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import com.github.wxiaoqi.security.common.constant.UserConstant; import com.github.wxiaoqi.security.common.constant.UserConstant;
...@@ -50,6 +47,7 @@ import java.time.Instant; ...@@ -50,6 +47,7 @@ import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -87,6 +85,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In ...@@ -87,6 +85,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
@Autowired @Autowired
private AppUserAlipayBiz appUserAlipayBiz; private AppUserAlipayBiz appUserAlipayBiz;
@Autowired
private AppUserPositionBiz appUserPositionBiz;
@Autowired @Autowired
RabbitTemplate rabbitTemplate; RabbitTemplate rabbitTemplate;
...@@ -114,6 +115,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In ...@@ -114,6 +115,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
appletWalletVo.setTodayAmount(myWallet.getTodayAmount() == null ? new BigDecimal(0) : myWallet.getTodayAmount()); appletWalletVo.setTodayAmount(myWallet.getTodayAmount() == null ? new BigDecimal(0) : myWallet.getTodayAmount());
appletWalletVo.setTotalAmount(myWallet.getTotalAmount() == null ? new BigDecimal(0) : myWallet.getTotalAmount()); appletWalletVo.setTotalAmount(myWallet.getTotalAmount() == null ? new BigDecimal(0) : myWallet.getTotalAmount());
appletWalletVo.setUnbooked(myWallet.getUnbooked() == null ? new BigDecimal(0) : myWallet.getUnbooked()); appletWalletVo.setUnbooked(myWallet.getUnbooked() == null ? new BigDecimal(0) : myWallet.getUnbooked());
appletWalletVo.setIsFrozen(myWallet.getIsFrozen());
appletWalletVo.setUserId(myWallet.getUserId()); appletWalletVo.setUserId(myWallet.getUserId());
return appletWalletVo; return appletWalletVo;
} }
...@@ -130,7 +132,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In ...@@ -130,7 +132,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
List<Integer> userIds = wallets.stream().map(WalletListDTO::getUserId).collect(Collectors.toList()); List<Integer> userIds = wallets.stream().map(WalletListDTO::getUserId).collect(Collectors.toList());
Map<Integer, BigDecimal> userIdAndTotalConsumptionMap = myWalletDetailBiz.finduserIdAndPersonalTotalConsumptionMapByUserIds(userIds); Map<Integer, BigDecimal> userIdAndTotalConsumptionMap = myWalletDetailBiz.finduserIdAndPersonalTotalConsumptionMapByUserIds(userIds);
Map<Integer, BigDecimal> userIdAndWithdrawalingMap = myWalletCathBiz.findUserIdAndWithdrawalingMapByUserIds(userIds); Map<Integer, BigDecimal> userIdAndWithdrawalingMap = myWalletCathBiz.findUserIdAndWithdrawalingMapByUserIds(userIds);
Map<Integer, AppUserDetail> userdetailMap = appUserDetailBiz.findUserIdAndUserDetailMapByMemberIds(userIds);
List<WalletPostionVo> allPostions = appUserPositionBiz.findAllPostions();
Map<Integer, WalletPostionVo> postionMap = allPostions.stream().collect(Collectors.toMap(WalletPostionVo::getId, Function.identity()));
List<WalletPageVo> walletPageVos = new ArrayList<>(); List<WalletPageVo> walletPageVos = new ArrayList<>();
WalletPageVo walletpg; WalletPageVo walletpg;
for (WalletListDTO wallet : wallets) { for (WalletListDTO wallet : wallets) {
...@@ -146,10 +150,18 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In ...@@ -146,10 +150,18 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
walletpg.setUnbooked(walletpg.getUnbooked() == null ? new BigDecimal(0) : walletpg.getUnbooked()); walletpg.setUnbooked(walletpg.getUnbooked() == null ? new BigDecimal(0) : walletpg.getUnbooked());
walletpg.setTotalAmount(walletpg.getTodayAmount() == null ? new BigDecimal(0) : walletpg.getTotalAmount()); walletpg.setTotalAmount(walletpg.getTodayAmount() == null ? new BigDecimal(0) : walletpg.getTotalAmount());
walletpg.setTotalConsumption(totalConsumpution); walletpg.setTotalConsumption(totalConsumpution);
AppUserDetail appUserDetail = userdetailMap.get(wallet.getUserId());
if (Objects.nonNull(appUserDetail)){
WalletPostionVo walletPostionVo = postionMap.get(appUserDetail.getPositionId());
if (Objects.nonNull(walletPostionVo)){
walletpg.setCommissionRate(walletPostionVo.getExtract());
}
}
walletPageVos.add(walletpg); walletPageVos.add(walletpg);
} }
walletPageVos.sort(Comparator.comparing(WalletPageVo::getTotalAmount).reversed()); walletPageVos.sort(Comparator.comparing(WalletPageVo::getTotalAmount).reversed());
walletPageVo.setPageNum(walletFindDTO.getPage()); walletPageVo.setPageNum(walletFindDTO.getPage());
walletPageVo.setPageSize(walletFindDTO.getLimit()); walletPageVo.setPageSize(walletFindDTO.getLimit());
...@@ -317,29 +329,10 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In ...@@ -317,29 +329,10 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
if ((realAmount.add(commission)).compareTo(balnece) > 0) { if ((realAmount.add(commission)).compareTo(balnece) > 0) {
realAmount = balnece.subtract(commission); realAmount = balnece.subtract(commission);
} }
//提现单号 //提现单号
String orderNo = snowflake.nextIdStr(); String orderNo = snowflake.nextIdStr();
orderNo = String.format("%s%s", dateTimeFormatter.format(LocalDate.now()), orderNo); orderNo = String.format("%s%s", dateTimeFormatter.format(LocalDate.now()), orderNo);
log.info("-----提现申请-----proceduReates===" + sumDto.getProceduReates() + "----commission====" + commission + "---realAmount===" + realAmount); log.info("-----提现申请-----proceduReates===" + sumDto.getProceduReates() + "----commission====" + commission + "---realAmount===" + realAmount);
//线上自动提现
if (WITHDRAW_ONLINE_WAY.equals(withdrawWay)) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String host = StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request));
FundPayVo fundPayVo = FundPayVo.builder()
.amount(applyCathVo.getCathType() == 0 ? String.valueOf(realAmount.multiply(new BigDecimal(100)).doubleValue()) : String.format("%.2f", realAmount.doubleValue()))
.orderNo(orderNo)
.payeeAccount(applyCathVo.getAccountNumber())
.payerShowName("欣新房车网络科技(广东)股份有限公司")
.remark("提现转账")
.type(applyCathVo.getCathType())
.creatIp(host)
.build();
//发送提现申请
sendPayMessage(fundPayVo);
}
walletCath.setCrtTime(Instant.now().toEpochMilli()); walletCath.setCrtTime(Instant.now().toEpochMilli());
walletCath.setOrderNo(orderNo); walletCath.setOrderNo(orderNo);
walletCath.setStauts(WithDrawStatusEnum.AUDIT.getCode()); walletCath.setStauts(WithDrawStatusEnum.AUDIT.getCode());
...@@ -363,6 +356,22 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In ...@@ -363,6 +356,22 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
myWallet.setWithdrawals(withdrawals); myWallet.setWithdrawals(withdrawals);
myWallet.setVersion(sumDto.getVersion()); myWallet.setVersion(sumDto.getVersion());
mapper.updMyWater(myWallet); mapper.updMyWater(myWallet);
//线上自动提现
if (WITHDRAW_ONLINE_WAY.equals(withdrawWay)) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String host = StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request));
FundPayVo fundPayVo = FundPayVo.builder()
.amount(applyCathVo.getCathType() == 0 ? String.valueOf(realAmount.multiply(new BigDecimal(100)).doubleValue()) : String.format("%.2f", realAmount.doubleValue()))
.orderNo(orderNo)
.payeeAccount(applyCathVo.getAccountNumber())
.payerShowName("欣新房车网络科技(广东)股份有限公司")
.remark("提现转账")
.type(applyCathVo.getCathType())
.creatIp(host)
.build();
//发送提现申请
sendPayMessage(fundPayVo);
}
return ObjectRestResponse.succ(walletCath.getId()); return ObjectRestResponse.succ(walletCath.getId());
} }
...@@ -511,4 +520,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In ...@@ -511,4 +520,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
} }
public void forbiddenWalletById(Integer id, Integer state) {
mapper.forbiddenWalletById(id,state);
}
} }
...@@ -101,7 +101,12 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> { ...@@ -101,7 +101,12 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
PageDataVO<WalletCathListDTO> walletCathListDTOPage = PageDataVO.pageInfo(walletCathFindDTO.getPage(), PageDataVO<WalletCathListDTO> walletCathListDTOPage = PageDataVO.pageInfo(walletCathFindDTO.getPage(),
walletCathFindDTO.getLimit(), walletCathFindDTO.getLimit(),
() -> mapper.selectByUserNameOrPhoneOrWithDrawSate(walletCathFindDTO.getUsername(), walletCathFindDTO.getPhone(), walletCathFindDTO.getState())); () -> mapper.selectByUserNameOrPhoneOrWithDrawSate(walletCathFindDTO.getUsername(),
walletCathFindDTO.getPhone(),
walletCathFindDTO.getState(),
walletCathFindDTO.getOrderNo(),
walletCathFindDTO.getStartTime(),
walletCathFindDTO.getEndTime()));
List<WalletCathListDTO> walletCathListDTOList = walletCathListDTOPage.getData(); List<WalletCathListDTO> walletCathListDTOList = walletCathListDTOPage.getData();
if (CollectionUtils.isEmpty(walletCathListDTOList)) { if (CollectionUtils.isEmpty(walletCathListDTOList)) {
......
...@@ -73,7 +73,11 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet ...@@ -73,7 +73,11 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
PageDataVO<WalletDetailListDTO> walletDetailPage = PageDataVO.pageInfo(walletDetailFindDTO.getPage(), PageDataVO<WalletDetailListDTO> walletDetailPage = PageDataVO.pageInfo(walletDetailFindDTO.getPage(),
walletDetailFindDTO.getLimit(), walletDetailFindDTO.getLimit(),
()->mapper.findWalletDetailsByUserNameOrPhoneOrsourceType(walletDetailFindDTO.getUsername(),walletDetailFindDTO.getPhone(),walletDetailFindDTO.getSource())); ()->mapper.findWalletDetailsByUserNameOrPhoneOrsourceType(walletDetailFindDTO.getUsername(),
walletDetailFindDTO.getPhone(),
walletDetailFindDTO.getSource(),
walletDetailFindDTO.getStartTime(),
walletDetailFindDTO.getEndTime()));
List<WalletDetailListDTO> detailListDTOS = walletDetailPage.getData(); List<WalletDetailListDTO> detailListDTOS = walletDetailPage.getData();
if (CollectionUtils.isEmpty(detailListDTOS)){ if (CollectionUtils.isEmpty(detailListDTOS)){
return pageDataVO; return pageDataVO;
......
package com.github.wxiaoqi.security.admin.mapper; package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.bo.UserIncomeBo; import com.github.wxiaoqi.security.admin.bo.UserIncomeBo;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterAdminDTO;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterFindDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserSellingWater; import com.github.wxiaoqi.security.admin.entity.AppUserSellingWater;
import com.github.wxiaoqi.security.admin.vo.SellingWalletVo; import com.github.wxiaoqi.security.admin.vo.SellingWalletVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -23,4 +25,6 @@ public interface AppUserSellingWaterMapper extends Mapper<AppUserSellingWater> { ...@@ -23,4 +25,6 @@ public interface AppUserSellingWaterMapper extends Mapper<AppUserSellingWater> {
BigDecimal selectTotalIncomeByUserId(@Param("userId") Integer userId); BigDecimal selectTotalIncomeByUserId(@Param("userId") Integer userId);
List<SellingWalletVo> selectSellerWalterByUserIdAndWating(@Param("userId") Integer userId, @Param("wating") Integer wating); List<SellingWalletVo> selectSellerWalterByUserIdAndWating(@Param("userId") Integer userId, @Param("wating") Integer wating);
List<UserSellingWaterAdminDTO> selectSellingWaterPage(UserSellingWaterFindDTO userSellingWaterFindDTO);
} }
...@@ -19,7 +19,10 @@ public interface MyWalletCathMapper extends Mapper<MyWalletCath> { ...@@ -19,7 +19,10 @@ public interface MyWalletCathMapper extends Mapper<MyWalletCath> {
List<WalletCathListDTO> selectByUserNameOrPhoneOrWithDrawSate(@Param("userName") String userName, List<WalletCathListDTO> selectByUserNameOrPhoneOrWithDrawSate(@Param("userName") String userName,
@Param("phone") String phone, @Param("phone") String phone,
@Param("state") Integer state); @Param("state") Integer state,
@Param("orderNo") String orderNo,
@Param("startTime") Long startTime,
@Param("endTime") Long endTime);
List<PersonalConsumptionDTO> findUserWithDrawingByUserIds(@Param("userIds") List<Integer> userIds); List<PersonalConsumptionDTO> findUserWithDrawingByUserIds(@Param("userIds") List<Integer> userIds);
......
...@@ -17,7 +17,11 @@ import java.util.List; ...@@ -17,7 +17,11 @@ import java.util.List;
*/ */
public interface MyWalletDetailMapper extends Mapper<MyWalletDetail> { public interface MyWalletDetailMapper extends Mapper<MyWalletDetail> {
List<WalletDetailListDTO> findWalletDetailsByUserNameOrPhoneOrsourceType(@Param("userName") String userName, @Param("phone") String phone, @Param("sourceType") Integer sourceType); List<WalletDetailListDTO> findWalletDetailsByUserNameOrPhoneOrsourceType(@Param("userName") String userName,
@Param("phone") String phone,
@Param("sourceType") Integer sourceType,
@Param("startTime") Long starTime,
@Param("endTime") Long endTime);
List<PersonalConsumptionDTO> findpersonalConsumptionsByUserIds(@Param("userIds") List<Integer> userIds); List<PersonalConsumptionDTO> findpersonalConsumptionsByUserIds(@Param("userIds") List<Integer> userIds);
} }
...@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.mapper; ...@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.WalletListDTO; import com.github.wxiaoqi.security.admin.dto.WalletListDTO;
import com.github.wxiaoqi.security.admin.entity.MyWallet; import com.github.wxiaoqi.security.admin.entity.MyWallet;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
...@@ -19,4 +20,13 @@ public interface MyWalletMapper extends Mapper<MyWallet> { ...@@ -19,4 +20,13 @@ public interface MyWalletMapper extends Mapper<MyWallet> {
void updMyWater(MyWallet myWallet); void updMyWater(MyWallet myWallet);
List<WalletListDTO> selectByPhoneOrUserName(@Param("phone") String phone, @Param("username") String username); List<WalletListDTO> selectByPhoneOrUserName(@Param("phone") String phone, @Param("username") String username);
/**
* 禁用或解除 状态
* @param id
* @param state
*/
@Update("UPDATE `my_wallet` SET `is_frozen`=#{state} WHERE `id`=#{id}" )
void forbiddenWalletById(@Param("id") Integer id,
@Param("state") Integer state);
} }
...@@ -7,9 +7,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -7,9 +7,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author libin * @author libin
...@@ -30,4 +28,11 @@ public class MyWalletAdminController { ...@@ -30,4 +28,11 @@ public class MyWalletAdminController {
PageDataVO<WalletPageVo> walletPage = myWalletBiz.listWalletWithPage(walletFindDTO); PageDataVO<WalletPageVo> walletPage = myWalletBiz.listWalletWithPage(walletFindDTO);
return ObjectRestResponse.succ(walletPage); return ObjectRestResponse.succ(walletPage);
} }
@PutMapping("/forbidden")
public ObjectRestResponse<Void> forbiddenWallet(@RequestParam(value = "id") Integer id,
@RequestParam(value = "state") Integer state){
myWalletBiz.forbiddenWalletById(id,state);
return ObjectRestResponse.succ();
}
} }
package com.github.wxiaoqi.security.admin.rest.admin;
import com.github.wxiaoqi.security.admin.biz.AppUserSellingWaterBiz;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterAdminDTO;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterFindDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/10/21 10:10
*/
@RestController
@RequestMapping("/sellingwater/admin")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserSellingWaterAdminController {
private final AppUserSellingWaterBiz appUserSellingWaterBiz;
@PostMapping("/page")
public ObjectRestResponse<PageDataVO<UserSellingWaterAdminDTO>> findSellingWaterWithPage(@RequestBody UserSellingWaterFindDTO userSellingWaterFindDTO){
PageDataVO<UserSellingWaterAdminDTO> pageDataVO = appUserSellingWaterBiz.findSellingWaterWithPage(userSellingWaterFindDTO);
return ObjectRestResponse.succ(pageDataVO);
}
}
...@@ -84,4 +84,43 @@ FROM ...@@ -84,4 +84,43 @@ FROM
</if> </if>
ORDER BY `crt_time` ORDER BY `crt_time`
</select> </select>
<select id="selectSellingWaterPage"
resultType="com.github.wxiaoqi.security.admin.dto.UserSellingWaterAdminDTO">
SELECT
ausw.*,
aul.username AS `phone`,
IFNULL(aud.realname,aud.nickname) AS `sourceName`,
IFNULL(audd.realname,audd.nickname) AS `userName`
FROM
( SELECT * FROM `app_user_selling_water` WHERE 1 = 1
<if test="status !=null">
AND `status`=#{status}
</if>
<if test="waiting !=null">
AND `waiting`=#{waiting}
</if>
<if test="startTime !=null and endTime !=null">
AND `crt_time` BETWEEN #{startTime} AND #{endTime}
</if>
<if test="startTime !=null and endTime ==null">
AND <![CDATA[
`crt_time` >= #{startTime}
]]>
</if>
<if test="endTime !=null and startTime ==null ">
AND <![CDATA[
`crt_time` <= #{endTime}
]]>
</if>) AS `ausw`
INNER JOIN ( SELECT * FROM `app_user_login`
<if test="phone!=null and phone!=' '">
WHERE `username` = #{phone}
</if>
) AS aul ON aul.id = ausw.user_id
INNER JOIN `app_user_detail` AS aud ON aud.userid = ausw.source_id
INNER JOIN ( SELECT * FROM `app_user_detail`
<if test="userName!=null and userName!=' '">
WHERE `realname` LIKE CONCAT('%',#{userName},'%') OR `nickname` LIKE CONCAT('%',#{userName},'%')
</if>) AS audd ON audd.userid = ausw.user_id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<mapper namespace="com.github.wxiaoqi.security.admin.mapper.MyWalletCathMapper"> <mapper namespace="com.github.wxiaoqi.security.admin.mapper.MyWalletCathMapper">
<select id="selectByUserNameOrPhoneOrWithDrawSate" resultType="com.github.wxiaoqi.security.admin.dto.WalletCathListDTO"> <select id="selectByUserNameOrPhoneOrWithDrawSate"
resultType="com.github.wxiaoqi.security.admin.dto.WalletCathListDTO">
SELECT SELECT
wc.id, wc.id,
aud.nickname, aud.nickname,
...@@ -19,9 +20,28 @@ ...@@ -19,9 +20,28 @@
wc.account_number AS `accountNumber`, wc.account_number AS `accountNumber`,
wc.account_name AS `accountName` wc.account_name AS `accountName`
FROM FROM
(SELECT * FROM `my_wallet_cath` <if test="state != null"> (SELECT * FROM `my_wallet_cath` WHERE 1 = 1
WHERE `stauts`=#{state} <if test="state != null">
</if>) AS `wc` AND `stauts`=#{state}
i
</if>
<if test="orderNo">
AND `order_no` = #{orderNo}
</if>
<if test="startTime !=null and endTime !=null">
AND `crt_time` BETWEEN #{startTime} AND #{endTime}
</if>
<if test="startTime !=null and endTime ==null">
AND <![CDATA[
`crt_time` >= #{startTime}
]]>
</if>
<if test="endTime !=null and startTime ==null ">
AND <![CDATA[
`crt_time` <= #{endTime}
]]>
</if>
) AS `wc`
INNER JOIN ( SELECT `id`, `username` FROM `app_user_login` <if test="phone != null and phone != ''"> INNER JOIN ( SELECT `id`, `username` FROM `app_user_login` <if test="phone != null and phone != ''">
WHERE `username`=#{phone} WHERE `username`=#{phone}
</if> ) AS `aul` ON aul.id = wc.user_id </if> ) AS `aul` ON aul.id = wc.user_id
...@@ -32,7 +52,8 @@ ...@@ -32,7 +52,8 @@
</select> </select>
<select id="findUserWithDrawingByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO"> <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 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=","> <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId} #{userId}
</foreach> </foreach>
...@@ -46,10 +67,10 @@ ...@@ -46,10 +67,10 @@
<choose> <choose>
<when test="type ==1 "> <when test="type ==1 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') AND date_format(from_unixtime(crt_time/1000),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
</when > </when>
<when test="type==2 "> <when test="type==2 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m') = date_format(now(),'%Y-%m') AND date_format(from_unixtime(crt_time/1000),'%Y-%m') = date_format(now(),'%Y-%m')
</when > </when>
<otherwise> <otherwise>
</otherwise> </otherwise>
</choose> </choose>
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.github.wxiaoqi.security.admin.mapper.MyWalletDetailMapper"> <mapper namespace="com.github.wxiaoqi.security.admin.mapper.MyWalletDetailMapper">
<select id="findWalletDetailsByUserNameOrPhoneOrsourceType" resultType="com.github.wxiaoqi.security.admin.dto.WalletDetailListDTO"> <select id="findWalletDetailsByUserNameOrPhoneOrsourceType"
resultType="com.github.wxiaoqi.security.admin.dto.WalletDetailListDTO">
SELECT SELECT
wd.id, wd.id,
wd.source, wd.source,
...@@ -15,33 +16,52 @@ ...@@ -15,33 +16,52 @@
wd.crt_time AS `crtTime`, wd.crt_time AS `crtTime`,
aul.username AS `phone`, aul.username AS `phone`,
aud.nickname, aud.nickname,
aud.realname, aud.realname<!--,
ausw.price, ausw.price,
ausw.extract, ausw.extract,
ausw.waiting, ausw.waiting,
ausw.title, ausw.title-->
ausw.order_no, FROM
ausw.sourceUserName (select id,user_id,source,amount,`with_draw_order_no`,cono,itype,activity_id,activity_name,`crt_time` FROM
FROM `my_wallet_detail` WHERE 1=1
(select id,user_id,source,amount,`with_draw_order_no`,cono,itype,activity_id,activity_name,`crt_time` FROM `my_wallet_detail` <if test="sourceType != null"> <if test="sourceType != null">
WHERE `source`=#{sourceType} AND `source`=#{sourceType}
</if>) AS `wd` </if>
<if test="startTime !=null and endTime !=null">
AND `crt_time` BETWEEN #{startTime} AND #{endTime}
</if>
<if test="startTime !=null and endTime ==null">
AND <![CDATA[
`crt_time` >= #{startTime}
]]>
</if>
<if test="endTime !=null and startTime ==null ">
AND <![CDATA[
`crt_time` <= #{endTime}
]]>
</if>
) AS `wd`
INNER JOIN (SELECT id,username FROM `app_user_login`<if test="phone != null and phone != ''"> INNER JOIN (SELECT id,username FROM `app_user_login`<if test="phone != null and phone != ''">
WHERE `username`=#{phone} WHERE `username`=#{phone}
</if>) AS `aul` ON aul.id = wd.user_id </if>) AS `aul` ON aul.id = wd.user_id
INNER JOIN (SELECT userid,nickname,realname FROM `app_user_detail`<if test="userName != null and userName != ''"> INNER JOIN (SELECT userid,nickname,realname FROM `app_user_detail`<if
test="userName != null and userName != ''">
WHERE `nickname`=#{userName} OR `realname`=#{userName} WHERE `nickname`=#{userName} OR `realname`=#{userName}
</if>) AS `aud` ON aud.userid = aul.id </if>) AS `aud` ON aud.userid = aul.id
LEFT JOIN (SELECT DISTINCT order_id,au.id,order_no,IFNULL(d.realname,d.nickname) AS `sourceUserName`,price,extract,waiting,title FROM `app_user_selling_water` AS `au` INNER JOIN `app_user_detail` AS `d` ON d.userid=au.source_id) AS `ausw` ON ausw.order_id = wd.cono <!-- LEFT JOIN (SELECT DISTINCT order_id,id,price,extract,waiting,title FROM `app_user_selling_water`) AS `ausw` ON
ausw.order_id = wd.cono-->
ORDER BY `crtTime` DESC ORDER BY `crtTime` DESC
</select> </select>
<select id="findpersonalConsumptionsByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO"> <select id="findpersonalConsumptionsByUserIds"
select `user_id` AS `userId`,SUM(amount) AS `totalConsumption` FROM my_wallet_cath <if test="userIds != null and userIds.size() != 0"> resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO">
select `user_id` AS `userId`,SUM(amount) AS `totalConsumption` FROM my_wallet_cath
<if test="userIds != null and userIds.size() != 0">
WHERE `user_id` IN WHERE `user_id` IN
<foreach collection="userIds" item="userId" open="(" close=")" separator=","> <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId} #{userId}
</foreach> </foreach>
</if>GROUP BY user_id; </if>
GROUP BY user_id;
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -84,8 +84,8 @@ public class WithDrawMqHandler implements InitializingBean { ...@@ -84,8 +84,8 @@ public class WithDrawMqHandler implements InitializingBean {
basicAck(channel, deliveryTag, false, pay_way); basicAck(channel, deliveryTag, false, pay_way);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, false, pay_way); basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, false, pay_way);
userFeign.withDrawprocess(fundPayVo.getOrderNo(), "",DEFAULT_ERROR_MSG, false);
String reason = String.format("%s%s%s", pay_way, "转账失败", "[不支持的编码:UTF-8]"); String reason = String.format("%s%s%s", pay_way, "转账失败", "[不支持的编码:UTF-8]");
userFeign.withDrawprocess(fundPayVo.getOrderNo(), "", reason, false);
log.info("{}:【{}】", reason, e); log.info("{}:【{}】", reason, e);
} catch (BaseException e) { } catch (BaseException e) {
//错误码 //错误码
......
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