Compare commits
No commits in common. "b78cd5ea59bec05b3a0871825aac29e30e3011bd" and "63d4951a3ba4e8c9e7a65812e559b213521570ec" have entirely different histories.
b78cd5ea59
...
63d4951a3b
|
|
@ -2,10 +2,20 @@ package com.bonus.canteen.core.account.constants;
|
||||||
|
|
||||||
public enum AccTradeTypeEnum {
|
public enum AccTradeTypeEnum {
|
||||||
RECHARGE(10, "充值"),
|
RECHARGE(10, "充值"),
|
||||||
|
RECHARGE_GIFT(11, "赠送"),
|
||||||
|
REVOKE_RECHARGE_GIFT(12, "撤销赠送"),
|
||||||
|
REVOKE_RECHARGE(40, "撤销充值"),
|
||||||
SUBSIDY(20, "补贴"),
|
SUBSIDY(20, "补贴"),
|
||||||
|
REVOKE_SUBSIDY(50, "撤销补贴"),
|
||||||
CLEAR(100, "清空"),
|
CLEAR(100, "清空"),
|
||||||
|
LUCK_MONEY(140, "红包发放"),
|
||||||
WITHDRAW(30, "提现"),
|
WITHDRAW(30, "提现"),
|
||||||
|
TRANSFER_OUT(60, "转出"),
|
||||||
|
TRANSFER_IN(70, "转入"),
|
||||||
|
FREEZE(80, "冻结"),
|
||||||
|
UN_FREEZE(90, "解冻"),
|
||||||
CONSUME(110, "消费"),
|
CONSUME(110, "消费"),
|
||||||
|
CONSUME_REPAIR(120, "消费补扣"),
|
||||||
CONSUME_REFUND(130, "消费退款");
|
CONSUME_REFUND(130, "消费退款");
|
||||||
|
|
||||||
private final Integer key;
|
private final Integer key;
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,4 @@ public class WalletUpdateDTO {
|
||||||
private PayChannelEnum payChannelEnum;
|
private PayChannelEnum payChannelEnum;
|
||||||
private PayTypeEnum payTypeEnum;
|
private PayTypeEnum payTypeEnum;
|
||||||
private Long orderNo;
|
private Long orderNo;
|
||||||
private String deviceSn;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,4 @@ public class WalletBalanceOperation {
|
||||||
private Integer payChannel;
|
private Integer payChannel;
|
||||||
private Integer payType;
|
private Integer payType;
|
||||||
private Long orderNo;
|
private Long orderNo;
|
||||||
private String deviceSn;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,4 @@ public class AccInfoDetailsVO {
|
||||||
private BigDecimal frozenWallet;
|
private BigDecimal frozenWallet;
|
||||||
@ApiModelProperty("补贴冻结金额")
|
@ApiModelProperty("补贴冻结金额")
|
||||||
private BigDecimal frozenSub;
|
private BigDecimal frozenSub;
|
||||||
@ApiModelProperty("物理卡号")
|
|
||||||
private String serialNum;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.bonus.canteen.core.account.service.impl;
|
package com.bonus.canteen.core.account.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
@ -30,11 +29,9 @@ public class AccOperationHistoryServiceImpl extends ServiceImpl<AccOperationHist
|
||||||
public List<AccOperationHistory> selectAccOperationHistory(AccOperationQueryParam param) {
|
public List<AccOperationHistory> selectAccOperationHistory(AccOperationQueryParam param) {
|
||||||
String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(param.getSearchValue());
|
String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(param.getSearchValue());
|
||||||
List<AccOperationHistory> operationRecordList = this.baseMapper.queryPageAccOperationRecord(param, encryptedSearchValue);
|
List<AccOperationHistory> operationRecordList = this.baseMapper.queryPageAccOperationRecord(param, encryptedSearchValue);
|
||||||
if(CollUtil.isNotEmpty(operationRecordList)) {
|
operationRecordList = operationRecordList.stream().peek(accOperationRecord -> {
|
||||||
operationRecordList = operationRecordList.stream().peek(accOperationRecord -> {
|
accOperationRecord.setPhone(SM4EncryptUtils.sm4Decrypt(accOperationRecord.getPhone()));
|
||||||
accOperationRecord.setPhone(SM4EncryptUtils.sm4Decrypt(accOperationRecord.getPhone()));
|
}).collect(Collectors.toList());
|
||||||
}).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
return operationRecordList;
|
return operationRecordList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.bonus.canteen.core.account.service.impl;
|
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.constants.AccTradeTypeEnum;
|
||||||
import com.bonus.canteen.core.account.domain.AccTrade;
|
import com.bonus.canteen.core.account.domain.AccTrade;
|
||||||
import com.bonus.canteen.core.account.domain.bo.TradeAndWallerInfo;
|
import com.bonus.canteen.core.account.domain.bo.TradeAndWallerInfo;
|
||||||
|
|
@ -20,7 +19,6 @@ import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户交易记录Service业务层处理
|
* 账户交易记录Service业务层处理
|
||||||
|
|
@ -138,13 +136,7 @@ public class AccTradeServiceImpl implements IAccTradeService {
|
||||||
@Override
|
@Override
|
||||||
public List<AccOperationListVO> queryAccOperationList(AccWalletOperationQueryParam param) {
|
public List<AccOperationListVO> queryAccOperationList(AccWalletOperationQueryParam param) {
|
||||||
String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(param.getSearchValue());
|
String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(param.getSearchValue());
|
||||||
List<AccOperationListVO> list = accTradeMapper.queryAccOperationList(param, encryptedSearchValue);
|
return 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
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -193,8 +193,7 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
|
||||||
walletUpdateDTO.getAccWalletIdEnum().getKey(),
|
walletUpdateDTO.getAccWalletIdEnum().getKey(),
|
||||||
walletUpdateDTO.getAccTradeTypeEnum().getKey(),
|
walletUpdateDTO.getAccTradeTypeEnum().getKey(),
|
||||||
walletUpdateDTO.getPayChannelEnum().getKey(),
|
walletUpdateDTO.getPayChannelEnum().getKey(),
|
||||||
walletUpdateDTO.getPayTypeEnum().getKey(),
|
walletUpdateDTO.getPayTypeEnum().getKey());
|
||||||
walletUpdateDTO.getDeviceSn());
|
|
||||||
operation.setOperationType(WalletBalanceOperationEnum.ADD_BAL.getKey());
|
operation.setOperationType(WalletBalanceOperationEnum.ADD_BAL.getKey());
|
||||||
operation.setOrderNo(walletUpdateDTO.getOrderNo());
|
operation.setOrderNo(walletUpdateDTO.getOrderNo());
|
||||||
acWalletBalanceOperation(operation);
|
acWalletBalanceOperation(operation);
|
||||||
|
|
@ -220,8 +219,7 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
|
||||||
walletUpdateDTO.getAccWalletIdEnum().getKey(),
|
walletUpdateDTO.getAccWalletIdEnum().getKey(),
|
||||||
walletUpdateDTO.getAccTradeTypeEnum().getKey(),
|
walletUpdateDTO.getAccTradeTypeEnum().getKey(),
|
||||||
walletUpdateDTO.getPayChannelEnum().getKey(),
|
walletUpdateDTO.getPayChannelEnum().getKey(),
|
||||||
walletUpdateDTO.getPayTypeEnum().getKey(),
|
walletUpdateDTO.getPayTypeEnum().getKey());
|
||||||
walletUpdateDTO.getDeviceSn());
|
|
||||||
operation.setOperationType(WalletBalanceOperationEnum.REDUCE_BAL.getKey());
|
operation.setOperationType(WalletBalanceOperationEnum.REDUCE_BAL.getKey());
|
||||||
operation.setOrderNo(walletUpdateDTO.getOrderNo());
|
operation.setOrderNo(walletUpdateDTO.getOrderNo());
|
||||||
acWalletBalanceOperation(operation);
|
acWalletBalanceOperation(operation);
|
||||||
|
|
@ -232,7 +230,7 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private WalletBalanceOperation operationBuilder(BigDecimal amount, Long userId, Integer walletId,
|
private WalletBalanceOperation operationBuilder(BigDecimal amount, Long userId, Integer walletId,
|
||||||
Integer tradeType, Integer payChannel, Integer payType, String deviceSn) {
|
Integer tradeType, Integer payChannel, Integer payType) {
|
||||||
WalletBalanceOperation operation = new WalletBalanceOperation();
|
WalletBalanceOperation operation = new WalletBalanceOperation();
|
||||||
operation.setUserId(userId);
|
operation.setUserId(userId);
|
||||||
operation.setAmount(amount);
|
operation.setAmount(amount);
|
||||||
|
|
@ -240,7 +238,6 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
|
||||||
operation.setTradeType(tradeType);
|
operation.setTradeType(tradeType);
|
||||||
operation.setPayChannel(payChannel);
|
operation.setPayChannel(payChannel);
|
||||||
operation.setPayType(payType);
|
operation.setPayType(payType);
|
||||||
operation.setDeviceSn(deviceSn);
|
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -285,9 +282,6 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
|
||||||
accTrade.setPayState(PayStateEnum.PAY_SUCC.getKey());
|
accTrade.setPayState(PayStateEnum.PAY_SUCC.getKey());
|
||||||
accTrade.setTradeState(AccTradeStateEnum.TAKE_EFFECT.getKey());
|
accTrade.setTradeState(AccTradeStateEnum.TAKE_EFFECT.getKey());
|
||||||
accTrade.setUpdateBy(SecurityUtils.getUsername());
|
accTrade.setUpdateBy(SecurityUtils.getUsername());
|
||||||
accTrade.setWalletBalTotal(walletBalByWalletId);
|
|
||||||
accTrade.setAccAllBal(walletBalByWalletId);
|
|
||||||
accTrade.setMachineSn(operation.getDeviceSn());
|
|
||||||
this.accTradeService.updateAccTrade(accTrade);
|
this.accTradeService.updateAccTrade(accTrade);
|
||||||
}catch (Exception ex) {
|
}catch (Exception ex) {
|
||||||
if(Objects.nonNull(tradeId)) {
|
if(Objects.nonNull(tradeId)) {
|
||||||
|
|
@ -342,7 +336,6 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
|
||||||
if(Objects.nonNull(operation.getOrderNo())) {
|
if(Objects.nonNull(operation.getOrderNo())) {
|
||||||
accTrade.setOrderNo(operation.getOrderNo().toString());
|
accTrade.setOrderNo(operation.getOrderNo().toString());
|
||||||
}
|
}
|
||||||
accTrade.setMachineSn(operation.getDeviceSn());
|
|
||||||
this.accTradeService.insertAccTrade(accTrade);
|
this.accTradeService.insertAccTrade(accTrade);
|
||||||
return tradeId;
|
return tradeId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -251,23 +251,18 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
|
|
||||||
private void deductFromWallets(OrderInfo orderInfo, BigDecimal subsidyWalletBal) {
|
private void deductFromWallets(OrderInfo orderInfo, BigDecimal subsidyWalletBal) {
|
||||||
Long orderNo = orderInfo.getOrderId();
|
Long orderNo = orderInfo.getOrderId();
|
||||||
String deviceSn = orderInfo.getDeviceSn();
|
|
||||||
if (orderInfo.getRealAmount().compareTo(subsidyWalletBal) <= 0) {
|
if (orderInfo.getRealAmount().compareTo(subsidyWalletBal) <= 0) {
|
||||||
deductWalletBalance(orderInfo.getRealAmount(), orderInfo.getUserId(), AccWalletIdEnum.SUBSIDY, orderNo, deviceSn);
|
deductWalletBalance(orderInfo.getRealAmount(), orderInfo.getUserId(), AccWalletIdEnum.SUBSIDY, orderNo);
|
||||||
} else if (subsidyWalletBal.compareTo(BigDecimal.ZERO) > 0) {
|
} else if (subsidyWalletBal.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
deductWalletBalance(subsidyWalletBal, orderInfo.getUserId(), AccWalletIdEnum.SUBSIDY, orderNo, deviceSn);
|
deductWalletBalance(subsidyWalletBal, orderInfo.getUserId(), AccWalletIdEnum.SUBSIDY, orderNo);
|
||||||
BigDecimal remainAmount = orderInfo.getRealAmount().subtract(subsidyWalletBal);
|
BigDecimal remainAmount = orderInfo.getRealAmount().subtract(subsidyWalletBal);
|
||||||
deductWalletBalance(remainAmount, orderInfo.getUserId(), AccWalletIdEnum.WALLET, orderNo, deviceSn);
|
deductWalletBalance(remainAmount, orderInfo.getUserId(), AccWalletIdEnum.WALLET, orderNo);
|
||||||
} else {
|
} else {
|
||||||
deductWalletBalance(orderInfo.getRealAmount(), orderInfo.getUserId(), AccWalletIdEnum.WALLET, orderNo, deviceSn);
|
deductWalletBalance(orderInfo.getRealAmount(), orderInfo.getUserId(), AccWalletIdEnum.WALLET, orderNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deductWalletBalance(BigDecimal amount,
|
private void deductWalletBalance(BigDecimal amount, Long userId, AccWalletIdEnum walletIdEnum, Long orderNo) {
|
||||||
Long userId,
|
|
||||||
AccWalletIdEnum walletIdEnum,
|
|
||||||
Long orderNo,
|
|
||||||
String deviceSn) {
|
|
||||||
WalletUpdateDTO walletUpdateDTO = new WalletUpdateDTO();
|
WalletUpdateDTO walletUpdateDTO = new WalletUpdateDTO();
|
||||||
walletUpdateDTO.setAmount(amount);
|
walletUpdateDTO.setAmount(amount);
|
||||||
walletUpdateDTO.setUserId(userId);
|
walletUpdateDTO.setUserId(userId);
|
||||||
|
|
@ -276,7 +271,6 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
walletUpdateDTO.setPayChannelEnum(PayChannelEnum.ACC);
|
walletUpdateDTO.setPayChannelEnum(PayChannelEnum.ACC);
|
||||||
walletUpdateDTO.setPayTypeEnum(PayTypeEnum.MEAL_CARD);
|
walletUpdateDTO.setPayTypeEnum(PayTypeEnum.MEAL_CARD);
|
||||||
walletUpdateDTO.setOrderNo(orderNo);
|
walletUpdateDTO.setOrderNo(orderNo);
|
||||||
walletUpdateDTO.setDeviceSn(deviceSn);
|
|
||||||
accWalletInfoService.clearAccWalletBalance(walletUpdateDTO);
|
accWalletInfoService.clearAccWalletBalance(walletUpdateDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -364,7 +358,6 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
walletUpdateDTO.setPayChannelEnum(PayChannelEnum.ACC);
|
walletUpdateDTO.setPayChannelEnum(PayChannelEnum.ACC);
|
||||||
walletUpdateDTO.setPayTypeEnum(PayTypeEnum.MEAL_CARD);
|
walletUpdateDTO.setPayTypeEnum(PayTypeEnum.MEAL_CARD);
|
||||||
walletUpdateDTO.setOrderNo(orderId);
|
walletUpdateDTO.setOrderNo(orderId);
|
||||||
walletUpdateDTO.setDeviceSn(orderInfo.getDeviceSn());
|
|
||||||
accWalletInfoService.addAccWalletBalance(walletUpdateDTO);
|
accWalletInfoService.addAccWalletBalance(walletUpdateDTO);
|
||||||
refundAmount = refundAmount.add(accTrade.getActualAmount());
|
refundAmount = refundAmount.add(accTrade.getActualAmount());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
package com.bonus.canteen.core.report.controller;
|
|
||||||
|
|
||||||
import com.bonus.canteen.core.order.domain.OrderDetail;
|
|
||||||
import com.bonus.canteen.core.order.service.IOrderDetailService;
|
|
||||||
import com.bonus.canteen.core.report.domain.TradeFlowParam;
|
|
||||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
|
||||||
import com.bonus.canteen.core.report.service.TradeReportService;
|
|
||||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
|
||||||
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 com.bonus.common.log.annotation.SysLog;
|
|
||||||
import com.bonus.common.log.enums.OperaType;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交易报表
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-04-14
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/report/trade")
|
|
||||||
public class TradeReportController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private TradeReportService tradeReportService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交易流水
|
|
||||||
*/
|
|
||||||
@PostMapping("/flow")
|
|
||||||
@ResponseBody
|
|
||||||
public TableDataInfo list(TradeFlowParam param)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<TradeFlowVO> list = tradeReportService.selectTradeFlow(param);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
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.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class TradeFlowParam implements Serializable {
|
|
||||||
private Long userId;
|
|
||||||
private String userName;
|
|
||||||
private String phonenumber;
|
|
||||||
private List<Long> deptIdList;
|
|
||||||
@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 TradeFlowParam() {
|
|
||||||
this.endDateTime = LocalDateTime.now().plusDays(7);
|
|
||||||
this.startDateTime = LocalDateTime.now().minusDays(7);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
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 TradeFlowVO implements Serializable {
|
|
||||||
private Long userId;
|
|
||||||
private String userName;
|
|
||||||
private Integer userType;
|
|
||||||
private String phonenumber;
|
|
||||||
private Long deptId;
|
|
||||||
private String deptName;
|
|
||||||
private BigDecimal accAllBal;
|
|
||||||
private LocalDateTime tradeTime;
|
|
||||||
private Integer tradeType;
|
|
||||||
private Integer payType;
|
|
||||||
private String machineSn;
|
|
||||||
private String deviceName;
|
|
||||||
private String createBy;
|
|
||||||
private BigDecimal income;
|
|
||||||
private BigDecimal outcome;
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
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(@Param("param")TradeFlowParam param);
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
package com.bonus.canteen.core.report.service;
|
|
||||||
|
|
||||||
import com.bonus.canteen.core.report.domain.TradeFlowParam;
|
|
||||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface TradeReportService {
|
|
||||||
List<TradeFlowVO> selectTradeFlow(TradeFlowParam param);
|
|
||||||
}
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
package com.bonus.canteen.core.report.service.impl;
|
|
||||||
|
|
||||||
import com.bonus.canteen.core.report.domain.TradeFlowParam;
|
|
||||||
import com.bonus.canteen.core.report.domain.TradeFlowVO;
|
|
||||||
import com.bonus.canteen.core.report.mapper.TradeReportMapper;
|
|
||||||
import com.bonus.canteen.core.report.service.TradeReportService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class TradeReportServiceImpl implements TradeReportService {
|
|
||||||
@Resource
|
|
||||||
TradeReportMapper tradeReportMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TradeFlowVO> selectTradeFlow(TradeFlowParam param) {
|
|
||||||
return tradeReportMapper.selectTradeFlow(param);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -390,11 +390,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
t2.user_type as userType,
|
t2.user_type as userType,
|
||||||
t1.scope,
|
t1.scope,
|
||||||
t1.acc_status,
|
t1.acc_status,
|
||||||
t1.end_date,
|
t1.end_date
|
||||||
ac.serial_num
|
|
||||||
FROM acc_info t1
|
FROM acc_info t1
|
||||||
INNER JOIN sys_user t2 ON t1.user_id = t2.user_id
|
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
|
LEFT JOIN sys_dept t6 on t6.dept_id = t2.dept_id
|
||||||
<include refid="queryAccountInfo_ref"/>
|
<include refid="queryAccountInfo_ref"/>
|
||||||
order by t1.acc_id desc
|
order by t1.acc_id desc
|
||||||
|
|
|
||||||
|
|
@ -1,210 +0,0 @@
|
||||||
<?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>
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
<?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.TradeReportMapper">
|
|
||||||
<select id="selectTradeFlow" resultType="com.bonus.canteen.core.report.domain.TradeFlowVO">
|
|
||||||
select
|
|
||||||
su.user_id,
|
|
||||||
su.user_name,
|
|
||||||
su.user_type,
|
|
||||||
su.phonenumber,
|
|
||||||
sd.dept_id,
|
|
||||||
sd.dept_name,
|
|
||||||
at2.acc_all_bal,
|
|
||||||
at2.trade_time,
|
|
||||||
at2.trade_type,
|
|
||||||
at2.pay_type,
|
|
||||||
at2.machine_sn,
|
|
||||||
di.device_name,
|
|
||||||
at2.create_by,
|
|
||||||
IFNULL(CASE
|
|
||||||
WHEN at2.trade_type in (10, 20, 130) then
|
|
||||||
at2.actual_amount
|
|
||||||
end, 0)as income,
|
|
||||||
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
|
|
||||||
left join device_info di on
|
|
||||||
at2.machine_sn = di.device_sn
|
|
||||||
where
|
|
||||||
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
|
|
||||||
<foreach collection="param.deptIdList" item="deptId" separator="," open="(" close=")">
|
|
||||||
#{deptId}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
<if test="param.searchValue != null and param.searchValue != ''">
|
|
||||||
and (
|
|
||||||
su.nick_name = #{param.searchValue}
|
|
||||||
or su.phonenumber = #{param.encryptedSearchValue}
|
|
||||||
or su.user_id like concat('%', #{param.searchValue}, '%')
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
Loading…
Reference in New Issue