Commit c3118259 authored by libin's avatar libin

钱包后台

parent f696bdf1
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 {
* 转账状态
*/
private Integer state;
private String orderNo;
private Long startTime;
private Long endTime;
}
......@@ -17,4 +17,8 @@ public class WalletDetailFindDTO extends PageParam {
private String phone;
private Integer source;
private Long startTime;
private Long endTime;
}
......@@ -40,4 +40,6 @@ public class AppletWalletVo {
@ApiModelProperty(value = "未入账金额")
private BigDecimal unbooked;
@ApiModelProperty(value = "是否冻结")
private Integer isFrozen;
}
......@@ -50,8 +50,5 @@ public class WalletCathAdminVo {
@ApiModelProperty(value = "用户账号")
private String accountNumber;
@ApiModelProperty(value = "用户账号描述")
private String accountNumberDesc;
private String accountName;
}
......@@ -52,4 +52,7 @@ public class WalletPageVo {
@ApiModelProperty(value = "是否冻结:0-正常,1-冻结")
private Integer isFrozen;
@ApiModelProperty(value = "佣金比例")
private Integer commissionRate;
}
......@@ -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.dto.OrderGoodsDTO;
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.AppUserRelation;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.admin.vo.SellingWalletVo;
import com.github.wxiaoqi.security.admin.vo.SellingWalletPagVo;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
......@@ -380,17 +381,17 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWalletVo.setHeadUrl(appUserDetail == null ? "" : appUserDetail.getHeadimgurl());
}
//取消单
if (sellingWalletVo.getSellerStatus()==1) {
if (sellingWalletVo.getSellerStatus() == 1) {
sellingWalletVo.setSellerStatus(SellerWallterStatus.CANCEL.getCode());
sellingWalletVo.setStatusText(SellerWallterStatus.CANCEL.getText());
sellingWalletVo.setIsShow(true);
}else {
if (sellingWalletVo.getWaiting()==SellerWallterStatus.POST.getCode()){
} else {
if (sellingWalletVo.getWaiting() == SellerWallterStatus.POST.getCode()) {
sellingWalletVo.setSellerStatus(SellerWallterStatus.POST.getCode());
sellingWalletVo.setStatusText(SellerWallterStatus.POST.getText());
sellingWalletVo.setIsShow(false);
}
if (sellingWalletVo.getWaiting()==SellerWallterStatus.NO_POST.getCode()){
if (sellingWalletVo.getWaiting() == SellerWallterStatus.NO_POST.getCode()) {
sellingWalletVo.setSellerStatus(SellerWallterStatus.NO_POST.getCode());
sellingWalletVo.setStatusText(SellerWallterStatus.NO_POST.getText());
sellingWalletVo.setIsShow(false);
......@@ -405,6 +406,13 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
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 {
CANCEL(2, "取消订单"),
POST(1, "已入账"),
......
......@@ -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.mapper.MyWalletMapper;
import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService;
import com.github.wxiaoqi.security.admin.vo.AppletWalletVo;
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.admin.vo.*;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import com.github.wxiaoqi.security.common.constant.UserConstant;
......@@ -50,6 +47,7 @@ import java.time.Instant;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -87,6 +85,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
@Autowired
private AppUserAlipayBiz appUserAlipayBiz;
@Autowired
private AppUserPositionBiz appUserPositionBiz;
@Autowired
RabbitTemplate rabbitTemplate;
......@@ -114,6 +115,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
appletWalletVo.setTodayAmount(myWallet.getTodayAmount() == null ? new BigDecimal(0) : myWallet.getTodayAmount());
appletWalletVo.setTotalAmount(myWallet.getTotalAmount() == null ? new BigDecimal(0) : myWallet.getTotalAmount());
appletWalletVo.setUnbooked(myWallet.getUnbooked() == null ? new BigDecimal(0) : myWallet.getUnbooked());
appletWalletVo.setIsFrozen(myWallet.getIsFrozen());
appletWalletVo.setUserId(myWallet.getUserId());
return appletWalletVo;
}
......@@ -130,7 +132,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
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);
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<>();
WalletPageVo walletpg;
for (WalletListDTO wallet : wallets) {
......@@ -146,10 +150,18 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
walletpg.setUnbooked(walletpg.getUnbooked() == null ? new BigDecimal(0) : walletpg.getUnbooked());
walletpg.setTotalAmount(walletpg.getTodayAmount() == null ? new BigDecimal(0) : walletpg.getTotalAmount());
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.sort(Comparator.comparing(WalletPageVo::getTotalAmount).reversed());
walletPageVo.setPageNum(walletFindDTO.getPage());
walletPageVo.setPageSize(walletFindDTO.getLimit());
......@@ -317,29 +329,10 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
if ((realAmount.add(commission)).compareTo(balnece) > 0) {
realAmount = balnece.subtract(commission);
}
//提现单号
String orderNo = snowflake.nextIdStr();
orderNo = String.format("%s%s", dateTimeFormatter.format(LocalDate.now()), orderNo);
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.setOrderNo(orderNo);
walletCath.setStauts(WithDrawStatusEnum.AUDIT.getCode());
......@@ -363,6 +356,22 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
myWallet.setWithdrawals(withdrawals);
myWallet.setVersion(sumDto.getVersion());
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());
}
......@@ -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> {
PageDataVO<WalletCathListDTO> walletCathListDTOPage = PageDataVO.pageInfo(walletCathFindDTO.getPage(),
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();
if (CollectionUtils.isEmpty(walletCathListDTOList)) {
......
......@@ -71,7 +71,11 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
PageDataVO<WalletDetailListDTO> walletDetailPage = PageDataVO.pageInfo(walletDetailFindDTO.getPage(),
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();
if (CollectionUtils.isEmpty(detailListDTOS)){
return pageDataVO;
......
package com.github.wxiaoqi.security.admin.mapper;
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.vo.SellingWalletVo;
import org.apache.ibatis.annotations.Param;
......@@ -23,4 +25,6 @@ public interface AppUserSellingWaterMapper extends Mapper<AppUserSellingWater> {
BigDecimal selectTotalIncomeByUserId(@Param("userId") Integer userId);
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> {
List<WalletCathListDTO> selectByUserNameOrPhoneOrWithDrawSate(@Param("userName") String userName,
@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);
......
......@@ -17,7 +17,11 @@ import java.util.List;
*/
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);
}
......@@ -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.entity.MyWallet;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
......@@ -19,4 +20,13 @@ public interface MyWalletMapper extends Mapper<MyWallet> {
void updMyWater(MyWallet myWallet);
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;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @author libin
......@@ -30,4 +28,11 @@ public class MyWalletAdminController {
PageDataVO<WalletPageVo> walletPage = myWalletBiz.listWalletWithPage(walletFindDTO);
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
</if>
ORDER BY `crt_time`
</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>
\ No newline at end of file
......@@ -3,7 +3,8 @@
<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
wc.id,
aud.nickname,
......@@ -19,9 +20,28 @@
wc.account_number AS `accountNumber`,
wc.account_name AS `accountName`
FROM
(SELECT * FROM `my_wallet_cath` <if test="state != null">
WHERE `stauts`=#{state}
</if>) AS `wc`
(SELECT * FROM `my_wallet_cath` WHERE 1 = 1
<if test="state != null">
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 != ''">
WHERE `username`=#{phone}
</if> ) AS `aul` ON aul.id = wc.user_id
......@@ -32,7 +52,8 @@
</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
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>
......@@ -46,10 +67,10 @@
<choose>
<when test="type ==1 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
</when >
</when>
<when test="type==2 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m') = date_format(now(),'%Y-%m')
</when >
</when>
<otherwise>
</otherwise>
</choose>
......
......@@ -2,7 +2,8 @@
<!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">
<select id="findWalletDetailsByUserNameOrPhoneOrsourceType" resultType="com.github.wxiaoqi.security.admin.dto.WalletDetailListDTO">
<select id="findWalletDetailsByUserNameOrPhoneOrsourceType"
resultType="com.github.wxiaoqi.security.admin.dto.WalletDetailListDTO">
SELECT
wd.id,
wd.source,
......@@ -15,31 +16,52 @@
wd.crt_time AS `crtTime`,
aul.username AS `phone`,
aud.nickname,
aud.realname,
aud.realname<!--,
ausw.price,
ausw.extract,
ausw.waiting,
ausw.title
FROM
(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">
WHERE `source`=#{sourceType}
</if>) AS `wd`
ausw.title-->
FROM
(select id,user_id,source,amount,`with_draw_order_no`,cono,itype,activity_id,activity_name,`crt_time` FROM
`my_wallet_detail` WHERE 1=1
<if test="sourceType != null">
AND `source`=#{sourceType}
</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 != ''">
WHERE `username`=#{phone}
</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}
</if>) AS `aud` ON aud.userid = aul.id
LEFT JOIN (SELECT DISTINCT order_id,id,price,extract,waiting,title FROM `app_user_selling_water`) 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
</select>
<select id="findpersonalConsumptionsByUserIds" 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">
<select id="findpersonalConsumptionsByUserIds"
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
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>GROUP BY user_id;
</if>
GROUP BY user_id;
</select>
</mapper>
\ No newline at end of file
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