This commit is contained in:
parent
7ec208c6d9
commit
21ac614166
|
|
@ -2,20 +2,10 @@ package com.bonus.canteen.core.account.constants;
|
|||
|
||||
public enum AccTradeTypeEnum {
|
||||
RECHARGE(10, "充值"),
|
||||
RECHARGE_GIFT(11, "赠送"),
|
||||
REVOKE_RECHARGE_GIFT(12, "撤销赠送"),
|
||||
REVOKE_RECHARGE(40, "撤销充值"),
|
||||
SUBSIDY(20, "补贴"),
|
||||
REVOKE_SUBSIDY(50, "撤销补贴"),
|
||||
CLEAR(100, "清空"),
|
||||
LUCK_MONEY(140, "红包发放"),
|
||||
WITHDRAW(30, "提现"),
|
||||
TRANSFER_OUT(60, "转出"),
|
||||
TRANSFER_IN(70, "转入"),
|
||||
FREEZE(80, "冻结"),
|
||||
UN_FREEZE(90, "解冻"),
|
||||
CONSUME(110, "消费"),
|
||||
CONSUME_REPAIR(120, "消费补扣"),
|
||||
CONSUME_REFUND(130, "消费退款");
|
||||
|
||||
private final Integer key;
|
||||
|
|
|
|||
|
|
@ -68,4 +68,6 @@ public class AccInfoDetailsVO {
|
|||
private BigDecimal frozenWallet;
|
||||
@ApiModelProperty("补贴冻结金额")
|
||||
private BigDecimal frozenSub;
|
||||
@ApiModelProperty("物理卡号")
|
||||
private String serialNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.canteen.core.account.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -29,9 +30,11 @@ public class AccOperationHistoryServiceImpl extends ServiceImpl<AccOperationHist
|
|||
public List<AccOperationHistory> selectAccOperationHistory(AccOperationQueryParam param) {
|
||||
String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(param.getSearchValue());
|
||||
List<AccOperationHistory> operationRecordList = this.baseMapper.queryPageAccOperationRecord(param, encryptedSearchValue);
|
||||
if(CollUtil.isNotEmpty(operationRecordList)) {
|
||||
operationRecordList = operationRecordList.stream().peek(accOperationRecord -> {
|
||||
accOperationRecord.setPhone(SM4EncryptUtils.sm4Decrypt(accOperationRecord.getPhone()));
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
return operationRecordList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.canteen.core.account.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bonus.canteen.core.account.constants.AccTradeTypeEnum;
|
||||
import com.bonus.canteen.core.account.domain.AccTrade;
|
||||
import com.bonus.canteen.core.account.domain.bo.TradeAndWallerInfo;
|
||||
|
|
@ -19,6 +20,7 @@ import org.springframework.transaction.annotation.Propagation;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 账户交易记录Service业务层处理
|
||||
|
|
@ -136,7 +138,13 @@ public class AccTradeServiceImpl implements IAccTradeService {
|
|||
@Override
|
||||
public List<AccOperationListVO> queryAccOperationList(AccWalletOperationQueryParam param) {
|
||||
String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(param.getSearchValue());
|
||||
return accTradeMapper.queryAccOperationList(param, encryptedSearchValue);
|
||||
List<AccOperationListVO> list = accTradeMapper.queryAccOperationList(param, encryptedSearchValue);
|
||||
if(CollUtil.isNotEmpty(list)) {
|
||||
list = list.stream().peek(operation -> {
|
||||
operation.setPhoneNumber(SM4EncryptUtils.sm4Decrypt(operation.getPhoneNumber()));
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,88 @@
|
|||
package com.bonus.canteen.core.report.controller;
|
||||
|
||||
import com.bonus.canteen.core.account.domain.param.AccountInfoQueryParam;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO;
|
||||
import com.bonus.canteen.core.report.domain.*;
|
||||
import com.bonus.canteen.core.report.service.AccReportService;
|
||||
import com.bonus.canteen.core.report.service.TradeReportService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交易报表
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/report/acc")
|
||||
public class AccReportController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private AccReportService accReportService;
|
||||
|
||||
@ApiOperation("查询交易流水")
|
||||
@PostMapping("/balance")
|
||||
@ResponseBody
|
||||
public TableDataInfo balanceList(@RequestBody AccountInfoQueryParam accountInfoQueryParam)
|
||||
{
|
||||
startPage();
|
||||
List<AccInfoDetailsVO> list = accReportService.balanceList(accountInfoQueryParam);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询账户余额统计")
|
||||
@PostMapping({"/balance/sum"})
|
||||
public AjaxResult queryAccInfoBalanceSum(@RequestBody AccountInfoQueryParam accountInfoQueryParam) {
|
||||
return AjaxResult.success(this.accReportService.balanceListSum(accountInfoQueryParam));
|
||||
}
|
||||
@ApiOperation("充值方式汇总")
|
||||
@PostMapping("/recharge")
|
||||
@ResponseBody
|
||||
public TableDataInfo rechargeCount(@RequestBody RechargeRecordParam param)
|
||||
{
|
||||
startPage();
|
||||
List<RechargeRecordVO> list = accReportService.rechargeCount(param);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("取款汇总")
|
||||
@PostMapping("/withdraw")
|
||||
@ResponseBody
|
||||
public TableDataInfo withdrawCount(@RequestBody WithdrawRecordParam param)
|
||||
{
|
||||
startPage();
|
||||
List<WithdrawRecordVO> list = accReportService.selectWithdrawRecord(param);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("组织收支汇总")
|
||||
@PostMapping("/dept/income-outcome")
|
||||
@ResponseBody
|
||||
public TableDataInfo deptIncomeOutcome(@RequestBody DeptIncomeOutcomeParam param)
|
||||
{
|
||||
startPage();
|
||||
List<DeptIncomeOutcomeVO> list = accReportService.selectDeptIncomeOutcome(param);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("个人收支汇总")
|
||||
@PostMapping("/user/income-outcome")
|
||||
@ResponseBody
|
||||
public TableDataInfo userIncomeOutcome(@RequestBody UserIncomeOutcomeParam param)
|
||||
{
|
||||
startPage();
|
||||
List<UserIncomeOutcomeVO> list = accReportService.selectUserIncomeOutcome(param);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.canteen.core.report.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DeptIncomeOutcomeParam implements Serializable {
|
||||
@ApiModelProperty("开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startDateTime;
|
||||
@ApiModelProperty("结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endDateTime;
|
||||
private List<Long> deptIdList;
|
||||
|
||||
public DeptIncomeOutcomeParam() {
|
||||
this.endDateTime = LocalDateTime.now().plusDays(7).with(LocalTime.MAX);
|
||||
this.startDateTime = LocalDateTime.now().minusDays(7).with(LocalTime.MIN);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.canteen.core.report.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class DeptIncomeOutcomeVO implements Serializable {
|
||||
private Long deptId;
|
||||
private String deptName;
|
||||
private BigDecimal walletBal;
|
||||
private BigDecimal income;
|
||||
private BigDecimal outcome;
|
||||
private BigDecimal lastWalletBal;
|
||||
private BigDecimal otherIncome;
|
||||
private BigDecimal otherOutcome;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.canteen.core.report.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RechargeRecordParam implements Serializable {
|
||||
@ApiModelProperty("开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startDateTime;
|
||||
@ApiModelProperty("结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endDateTime;
|
||||
|
||||
public RechargeRecordParam() {
|
||||
this.endDateTime = LocalDateTime.now().plusDays(7).with(LocalTime.MAX);
|
||||
this.startDateTime = LocalDateTime.now().minusDays(7).with(LocalTime.MIN);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.bonus.canteen.core.report.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class RechargeRecordVO implements Serializable {
|
||||
private String statisticDate;
|
||||
@JsonIgnore
|
||||
private Long rechargeNum;
|
||||
@JsonIgnore
|
||||
private Long subNum;
|
||||
private BigDecimal cashRechargeAmount;
|
||||
private BigDecimal aliRechargeAmount;
|
||||
private BigDecimal subRechargeAmount;
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.bonus.canteen.core.report.domain;
|
|||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
|
|
@ -13,13 +14,13 @@ public class TradeFlowVO implements Serializable {
|
|||
private String phonenumber;
|
||||
private Long deptId;
|
||||
private String deptName;
|
||||
private Double accAllBal;
|
||||
private BigDecimal accAllBal;
|
||||
private LocalDateTime tradeTime;
|
||||
private Integer tradeType;
|
||||
private Integer payType;
|
||||
private String machineSn;
|
||||
private String deviceName;
|
||||
private String createBy;
|
||||
private Double income;
|
||||
private Double outcome;
|
||||
private BigDecimal income;
|
||||
private BigDecimal outcome;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.canteen.core.report.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UserIncomeOutcomeParam implements Serializable {
|
||||
@ApiModelProperty("开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startDateTime;
|
||||
@ApiModelProperty("结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endDateTime;
|
||||
private List<Long> deptIdList;
|
||||
private String searchValue;
|
||||
|
||||
public UserIncomeOutcomeParam() {
|
||||
this.endDateTime = LocalDateTime.now().plusDays(7).with(LocalTime.MAX);
|
||||
this.startDateTime = LocalDateTime.now().minusDays(7).with(LocalTime.MIN);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.bonus.canteen.core.report.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class UserIncomeOutcomeVO implements Serializable {
|
||||
private Long userId;
|
||||
private String phonenumber;
|
||||
private Long deptId;
|
||||
private String deptName;
|
||||
private String nickName;
|
||||
private BigDecimal walletBal;
|
||||
private BigDecimal walletBalNow;
|
||||
private BigDecimal income;
|
||||
private BigDecimal outcome;
|
||||
private BigDecimal lastWalletBal;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.canteen.core.report.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Data
|
||||
public class WithdrawRecordParam implements Serializable {
|
||||
@ApiModelProperty("开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startDateTime;
|
||||
@ApiModelProperty("结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endDateTime;
|
||||
private String searchValue;
|
||||
|
||||
public WithdrawRecordParam() {
|
||||
this.endDateTime = LocalDateTime.now().plusDays(7).with(LocalTime.MAX);
|
||||
this.startDateTime = LocalDateTime.now().minusDays(7).with(LocalTime.MIN);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.canteen.core.report.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class WithdrawRecordVO implements Serializable {
|
||||
private Long userId;
|
||||
private String nickName;
|
||||
private Long deptId;
|
||||
private String deptName;
|
||||
private int withdrawNum;
|
||||
private double withdrawAmount;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.canteen.core.report.mapper;
|
||||
|
||||
import com.bonus.canteen.core.report.domain.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AccReportMapper {
|
||||
public List<RechargeRecordVO> selectRechargeRecord(@Param("param") RechargeRecordParam param);
|
||||
public List<WithdrawRecordVO> selectWithdrawRecord(@Param("param") WithdrawRecordParam param);
|
||||
public List<DeptIncomeOutcomeVO> selectDeptIncomeOutcome(@Param("param") DeptIncomeOutcomeParam param);
|
||||
public List<UserIncomeOutcomeVO> selectUserIncomeOutcome(@Param("param") UserIncomeOutcomeParam param,
|
||||
@Param("encryptedSearchValue") String encryptedSearchValue);
|
||||
}
|
||||
|
|
@ -2,9 +2,10 @@ package com.bonus.canteen.core.report.mapper;
|
|||
|
||||
import com.bonus.canteen.core.report.domain.TradeFlowParam;
|
||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TradeReportMapper {
|
||||
public List<TradeFlowVO> selectTradeFlow(TradeFlowParam param);
|
||||
public List<TradeFlowVO> selectTradeFlow(@Param("param")TradeFlowParam param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.canteen.core.report.service;
|
||||
|
||||
import com.bonus.canteen.core.account.domain.param.AccountInfoQueryParam;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO;
|
||||
import com.bonus.canteen.core.report.domain.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AccReportService {
|
||||
List<AccInfoDetailsVO> balanceList(AccountInfoQueryParam accountInfoQueryParam);
|
||||
AccInfoDetailsVO balanceListSum(AccountInfoQueryParam accountInfoQueryParam);
|
||||
List<RechargeRecordVO> rechargeCount(RechargeRecordParam param);
|
||||
List<WithdrawRecordVO> selectWithdrawRecord(WithdrawRecordParam param);
|
||||
List<DeptIncomeOutcomeVO> selectDeptIncomeOutcome(DeptIncomeOutcomeParam param);
|
||||
List<UserIncomeOutcomeVO> selectUserIncomeOutcome(UserIncomeOutcomeParam param);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.bonus.canteen.core.report.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bonus.canteen.core.account.domain.param.AccountInfoQueryParam;
|
||||
import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO;
|
||||
import com.bonus.canteen.core.account.service.IAccInfoService;
|
||||
import com.bonus.canteen.core.report.domain.*;
|
||||
import com.bonus.canteen.core.report.mapper.AccReportMapper;
|
||||
import com.bonus.canteen.core.report.mapper.TradeReportMapper;
|
||||
import com.bonus.canteen.core.report.service.AccReportService;
|
||||
import com.bonus.canteen.core.report.service.TradeReportService;
|
||||
import com.bonus.common.houqin.utils.SM4EncryptUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AccReportServiceImpl implements AccReportService {
|
||||
@Resource
|
||||
AccReportMapper accReportMapper;
|
||||
@Autowired
|
||||
IAccInfoService accInfoService;
|
||||
|
||||
@Override
|
||||
public List<AccInfoDetailsVO> balanceList(AccountInfoQueryParam accountInfoQueryParam) {
|
||||
return accInfoService.selectAccInfoList(accountInfoQueryParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccInfoDetailsVO balanceListSum(AccountInfoQueryParam accountInfoQueryParam) {
|
||||
return accInfoService.queryAccInfoBalanceSum(accountInfoQueryParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeRecordVO> rechargeCount(RechargeRecordParam param) {
|
||||
return accReportMapper.selectRechargeRecord(param);
|
||||
}
|
||||
@Override
|
||||
public List<WithdrawRecordVO> selectWithdrawRecord(WithdrawRecordParam param) {
|
||||
return accReportMapper.selectWithdrawRecord(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptIncomeOutcomeVO> selectDeptIncomeOutcome(DeptIncomeOutcomeParam param) {
|
||||
return accReportMapper.selectDeptIncomeOutcome(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserIncomeOutcomeVO> selectUserIncomeOutcome(UserIncomeOutcomeParam param) {
|
||||
String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(param.getSearchValue());
|
||||
List<UserIncomeOutcomeVO> list = accReportMapper.selectUserIncomeOutcome(param, encryptedSearchValue);
|
||||
if(CollUtil.isNotEmpty(list)) {
|
||||
for (UserIncomeOutcomeVO userIncomeOutcomeVO : list) {
|
||||
userIncomeOutcomeVO.setPhonenumber(SM4EncryptUtils.sm4Decrypt(userIncomeOutcomeVO.getPhonenumber()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
@ -390,9 +390,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
t2.user_type as userType,
|
||||
t1.scope,
|
||||
t1.acc_status,
|
||||
t1.end_date
|
||||
t1.end_date,
|
||||
ac.serial_num
|
||||
FROM acc_info t1
|
||||
INNER JOIN sys_user t2 ON t1.user_id = t2.user_id
|
||||
LEFT JOIN acc_card ac on t2.user_id = ac.user_id
|
||||
LEFT JOIN sys_dept t6 on t6.dept_id = t2.dept_id
|
||||
<include refid="queryAccountInfo_ref"/>
|
||||
order by t1.acc_id desc
|
||||
|
|
|
|||
|
|
@ -0,0 +1,210 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.canteen.core.report.mapper.AccReportMapper">
|
||||
<select id="selectRechargeRecord" resultType="com.bonus.canteen.core.report.domain.RechargeRecordVO">
|
||||
select
|
||||
DATE_FORMAT(atwd.trade_time , '%Y-%m-%d') AS statistic_date,
|
||||
count(IF(atwd.trade_type = 10, 1, NULL)) AS recharge_num,
|
||||
count(IF(atwd.trade_type = 20, 1, NULL)) AS sub_num,
|
||||
SUM(IF(atwd.trade_type = 10 and at2.pay_type = 2, atwd.amount, 0)) AS cash_recharge_amount,
|
||||
SUM(IF(atwd.trade_type = 10 and at2.pay_type = 18, atwd.amount, 0)) AS ali_recharge_amount,
|
||||
SUM(IF(atwd.trade_type = 20, atwd.amount, 0)) AS sub_recharge_amount
|
||||
from
|
||||
acc_trade_wallet_detail atwd
|
||||
Left join acc_trade at2 on
|
||||
atwd.trade_id = at2.trade_id
|
||||
where
|
||||
atwd.trade_type in (10, 20)
|
||||
and atwd.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
||||
and atwd.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
||||
group by
|
||||
statistic_date
|
||||
order by
|
||||
statistic_date desc
|
||||
</select>
|
||||
|
||||
<select id="selectWithdrawRecord" resultType="com.bonus.canteen.core.report.domain.WithdrawRecordVO">
|
||||
select
|
||||
atwd.user_id,
|
||||
su.nick_name,
|
||||
sd.dept_id,
|
||||
sd.dept_name,
|
||||
count(1) AS withdraw_num,
|
||||
SUM(IFNULL( atwd.amount, 0)) AS withdraw_amount
|
||||
from acc_trade_wallet_detail atwd
|
||||
LEFT JOIN sys_user su on atwd.user_id = su.user_id
|
||||
LEFT JOIN sys_dept sd on su.dept_id = sd.dept_id
|
||||
where atwd.trade_type in (30)
|
||||
and atwd.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
||||
and atwd.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
||||
<if test="param.searchValue != null and param.searchValue != ''">
|
||||
and (su.nick_name = #{param.searchValue}
|
||||
or su.user_id like CONCAT('%',#{param.searchValue},'%')
|
||||
)
|
||||
</if>
|
||||
group by user_id
|
||||
order by user_id
|
||||
</select>
|
||||
|
||||
<select id="selectDeptIncomeOutcome" resultType="com.bonus.canteen.core.report.domain.DeptIncomeOutcomeVO">
|
||||
SELECT
|
||||
c.dept_id,
|
||||
c.dept_name,
|
||||
c.wallet_bal_dept as wallet_bal,
|
||||
b.income,
|
||||
b.outcome,
|
||||
(c.wallet_bal_dept + b.outcome - b.income) as last_wallet_bal,
|
||||
0 as other_income,
|
||||
0 as other_outcome
|
||||
from
|
||||
(
|
||||
select
|
||||
sd.dept_id,
|
||||
SUM(IFNULL(CASE
|
||||
WHEN at2.trade_type in (10, 20, 130) then
|
||||
at2.actual_amount
|
||||
end, 0)) as income,
|
||||
SUM(IFNULL(CASE
|
||||
WHEN at2.trade_type in (30, 100, 110) then
|
||||
at2.actual_amount
|
||||
end, 0)) as outcome
|
||||
from
|
||||
acc_trade at2
|
||||
left join sys_user su on
|
||||
at2.user_id = su.user_id
|
||||
left join sys_dept sd on
|
||||
su.dept_id = sd.dept_id
|
||||
where
|
||||
at2.pay_state = 3
|
||||
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
|
||||
and su.dept_id in
|
||||
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
and at2.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
||||
and at2.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
||||
GROUP BY
|
||||
sd.dept_id
|
||||
) b
|
||||
left join
|
||||
(
|
||||
select
|
||||
IFNULL(sum(a.wallet_bal), 0) as wallet_bal_dept ,
|
||||
su.dept_id,
|
||||
sd.dept_name
|
||||
from
|
||||
(
|
||||
select
|
||||
awi.user_id,
|
||||
IFNULL(sum(awi.wallet_bal), 0) as wallet_bal
|
||||
from
|
||||
acc_wallet_info awi
|
||||
group by
|
||||
awi.user_id ) a
|
||||
left join sys_user su on
|
||||
a.user_id = su.user_id
|
||||
left join sys_dept sd on
|
||||
su.dept_id = sd.dept_id
|
||||
where
|
||||
1 = 1
|
||||
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
|
||||
and su.dept_id in
|
||||
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by
|
||||
su.dept_id ) c
|
||||
on
|
||||
c.dept_id = b.dept_id
|
||||
order by c.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectUserIncomeOutcome" resultType="com.bonus.canteen.core.report.domain.UserIncomeOutcomeVO">
|
||||
SELECT
|
||||
c.user_id,
|
||||
b.phonenumber,
|
||||
b.dept_id,
|
||||
b.dept_name,
|
||||
b.nick_name,
|
||||
c.wallet_bal_user as wallet_bal,
|
||||
c.wallet_bal_user as wallet_bal_now,
|
||||
b.income,
|
||||
b.outcome,
|
||||
(c.wallet_bal_user + b.outcome - b.income) as last_wallet_bal
|
||||
from
|
||||
(
|
||||
select
|
||||
at2.user_id,
|
||||
su.nick_name,
|
||||
su.phonenumber,
|
||||
sd.dept_id,
|
||||
sd.dept_name,
|
||||
SUM(IFNULL(CASE
|
||||
WHEN at2.trade_type in (10, 20, 130) then
|
||||
at2.actual_amount
|
||||
end, 0)) as income,
|
||||
SUM(IFNULL(CASE
|
||||
WHEN at2.trade_type in (30, 100, 110) then
|
||||
at2.actual_amount
|
||||
end, 0)) as outcome
|
||||
from
|
||||
acc_trade at2
|
||||
left join sys_user su on
|
||||
at2.user_id = su.user_id
|
||||
left join sys_dept sd on
|
||||
su.dept_id = sd.dept_id
|
||||
where
|
||||
at2.pay_state = 3
|
||||
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
|
||||
and su.dept_id in
|
||||
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
and at2.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
||||
and at2.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
||||
GROUP BY
|
||||
at2.user_id
|
||||
) b
|
||||
left join
|
||||
(
|
||||
select
|
||||
IFNULL(sum(a.wallet_bal), 0) as wallet_bal_user ,
|
||||
su.user_id
|
||||
from
|
||||
(
|
||||
select
|
||||
awi.user_id,
|
||||
IFNULL(sum(awi.wallet_bal), 0) as wallet_bal
|
||||
from
|
||||
acc_wallet_info awi
|
||||
group by
|
||||
awi.user_id ) a
|
||||
left join sys_user su on
|
||||
a.user_id = su.user_id
|
||||
where
|
||||
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
|
||||
and su.dept_id in
|
||||
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by
|
||||
a.user_id) c
|
||||
on
|
||||
c.user_id = b.user_id
|
||||
where
|
||||
1 = 1
|
||||
<if test="param.searchValue != null and param.searchValue != ''">
|
||||
and (b.nick_name = #{param.searchValue}
|
||||
or b.phonenumber = #{encryptedSearchValue}
|
||||
or c.user_id like CONCAT('%',#{param.searchValue},'%')
|
||||
)
|
||||
</if>
|
||||
order by c.user_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -18,14 +18,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
at2.machine_sn,
|
||||
di.device_name,
|
||||
at2.create_by,
|
||||
CASE
|
||||
WHEN at2.trade_type in (10, 20) then
|
||||
IFNULL(CASE
|
||||
WHEN at2.trade_type in (10, 20, 130) then
|
||||
at2.actual_amount
|
||||
end as income,
|
||||
CASE
|
||||
WHEN at2.trade_type not in (10, 20) then
|
||||
end, 0)as income,
|
||||
IFNULL(CASE
|
||||
WHEN at2.trade_type in (30, 100, 110) then
|
||||
at2.actual_amount
|
||||
end as outcome
|
||||
end, 0) as outcome
|
||||
from
|
||||
acc_trade at2
|
||||
left join sys_user su on
|
||||
|
|
@ -35,7 +35,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join device_info di on
|
||||
at2.machine_sn = di.device_sn
|
||||
where
|
||||
at2.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
||||
at2.pay_state = 3
|
||||
and at2.trade_time <![CDATA[ >= ]]> #{param.startDateTime}
|
||||
and at2.trade_time <![CDATA[ <= ]]> #{param.endDateTime}
|
||||
<if test="param.deptIdList != null and param.deptIdList.size() > 0">
|
||||
and su.dept_id IN
|
||||
|
|
|
|||
Loading…
Reference in New Issue