[fix]删除多余的代码
This commit is contained in:
parent
1369cf324b
commit
593fac4044
@ -1,54 +0,0 @@
|
||||
package com.wzj.soopin.member.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wzj.soopin.member.domain.bo.AccountDetailQueryBO;
|
||||
import com.wzj.soopin.member.domain.vo.AccountDetailVO;
|
||||
import com.wzj.soopin.member.service.IAccountDetailService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
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.RestController;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 账户明细查询控制器
|
||||
*/
|
||||
@Tag(name = "账户明细查询")
|
||||
@RestController
|
||||
@RequestMapping("/account/detail")
|
||||
@RequiredArgsConstructor
|
||||
public class AccountDetailController {
|
||||
|
||||
private final IAccountDetailService accountDetailService;
|
||||
|
||||
/**
|
||||
* 分页查询账户明细
|
||||
*/
|
||||
@Operation(summary = "根据account_id分页查询账户明细")
|
||||
@PostMapping("/page")
|
||||
public R<IPage<AccountDetailVO>> queryAccountDetailPage(@RequestBody AccountDetailQueryBO queryBO,
|
||||
@RequestBody Page<?> page) {
|
||||
if (page != null) {
|
||||
queryBO.setPageNum(page.getCurrent());
|
||||
queryBO.setPageSize(page.getSize());
|
||||
}
|
||||
IPage<AccountDetailVO> result = accountDetailService.queryAccountDetailPage(queryBO);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前登录用户的账户明细
|
||||
*/
|
||||
@Operation(summary = "查询当前登录用户的账户明细")
|
||||
@PostMapping("/current")
|
||||
public R<IPage<AccountDetailVO>> queryCurrentUserAccountDetailPage(@Validated @RequestBody AccountDetailQueryBO queryBO) {
|
||||
IPage<AccountDetailVO> result = accountDetailService.queryCurrentUserAccountDetailPage(queryBO);
|
||||
return R.ok(result);
|
||||
}
|
||||
}
|
@ -46,8 +46,9 @@ public class AccountBillBO extends BaseBO<AccountBill> {
|
||||
|
||||
@Override
|
||||
public LambdaQueryWrapper<AccountBill> toWrapper() {
|
||||
return new LambdaQueryWrapper<AccountBill>()
|
||||
return super.toWrapper()
|
||||
.eq(getChangeType() != null, AccountBill::getChangeType,changeType)
|
||||
.eq(getAccountId() != null, AccountBill::getAccountId,accountId)
|
||||
.eq(getSource() != null, AccountBill::getSource,source);
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,6 @@ public class AccountBillVO extends BaseAudit {
|
||||
|
||||
private Long accountId;
|
||||
|
||||
@Schema(description ="MEMBER_ID")
|
||||
@TableId(value="member_id", type = IdType.ASSIGN_ID)
|
||||
private Long memberId;
|
||||
|
||||
|
||||
@Schema(description ="余额")
|
||||
@Excel(name = "余额")
|
||||
|
@ -1,91 +0,0 @@
|
||||
package com.wzj.soopin.member.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wzj.soopin.member.domain.bo.AccountDetailQueryBO;
|
||||
import com.wzj.soopin.member.domain.vo.AccountDetailVO;
|
||||
import com.wzj.soopin.member.enums.AccountTypeEnum;
|
||||
import com.wzj.soopin.member.enums.UserTypeEnum;
|
||||
import com.wzj.soopin.member.mapper.AccountBillMapper;
|
||||
import com.wzj.soopin.member.service.IAccountDetailService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 账户明细查询服务实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AccountDetailServiceImpl implements IAccountDetailService {
|
||||
|
||||
private final AccountBillMapper accountChangeRecordMapper;
|
||||
|
||||
@Override
|
||||
public IPage<AccountDetailVO> queryAccountDetailPage(AccountDetailQueryBO queryBO) {
|
||||
// 构建分页对象
|
||||
Page<AccountDetailVO> page = new Page<>(queryBO.getPageNum(), queryBO.getPageSize());
|
||||
|
||||
// 处理时间格式
|
||||
String startTime = null;
|
||||
String endTime = null;
|
||||
if (queryBO.getStartTime() != null) {
|
||||
startTime = queryBO.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
if (queryBO.getEndTime() != null) {
|
||||
endTime = queryBO.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
|
||||
// 记录查询参数日志
|
||||
log.info("查询账户明细,参数:memberId={}, accountId={}, changeType={}, source={}, startTime={}, endTime={}",
|
||||
queryBO.getMemberId(), queryBO.getAccountId(), queryBO.getChangeType(),
|
||||
queryBO.getSource(), startTime, endTime);
|
||||
|
||||
// 查询数据
|
||||
IPage<AccountDetailVO> result = accountChangeRecordMapper.selectAccountDetailPage(
|
||||
page, queryBO.getMemberId(), queryBO.getAccountId(),
|
||||
queryBO.getChangeType(), queryBO.getSource(), startTime, endTime
|
||||
);
|
||||
|
||||
// 补充账户类型和用户类型描述
|
||||
List<AccountDetailVO> records = result.getRecords();
|
||||
for (AccountDetailVO record : records) {
|
||||
// 设置账户类型描述
|
||||
record.setAccountTypeDesc(AccountTypeEnum.getDesc(record.getAccountType()));
|
||||
|
||||
// 根据账户类型判断用户类型
|
||||
Integer userType = getUserTypeByAccountType(record.getAccountType());
|
||||
record.setUserType(userType);
|
||||
record.setUserTypeDesc(UserTypeEnum.getDesc(userType));
|
||||
}
|
||||
|
||||
log.info("查询账户明细完成,共查询到{}条记录", result.getTotal());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getUserTypeByAccountType(Integer accountType) {
|
||||
return UserTypeEnum.getUserTypeByAccountType(accountType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<AccountDetailVO> queryCurrentUserAccountDetailPage(AccountDetailQueryBO queryBO) {
|
||||
// 获取当前登录用户信息
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if (loginUser == null) {
|
||||
throw new RuntimeException("用户未登录");
|
||||
}
|
||||
|
||||
// 设置当前登录用户的会员ID
|
||||
queryBO.setMemberId(loginUser.getUserId());
|
||||
|
||||
// 调用原有的分页查询方法
|
||||
return queryAccountDetailPage(queryBO);
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<?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.wzj.soopin.member.mapper.AccountBillMapper">
|
||||
</mapper>
|
@ -1,52 +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.wzj.soopin.member.mapper.AccountBillMapper">
|
||||
|
||||
<!-- 分页查询账户明细(关联会员账户表和租户账户表获取账户类型) -->
|
||||
<select id="selectAccountDetailPage" resultType="com.wzj.soopin.member.domain.vo.AccountDetailVO">
|
||||
SELECT
|
||||
r.id,
|
||||
r.member_id as memberId,
|
||||
r.account_id as accountId,
|
||||
COALESCE(ma.type, ta.type) as accountType,
|
||||
CASE
|
||||
WHEN ma.id IS NOT NULL THEN 2 -- 会员
|
||||
WHEN ta.id IS NOT NULL THEN 1 -- 租户
|
||||
ELSE 2 -- 默认会员
|
||||
END as userType,
|
||||
r.money_balance as moneyBalance,
|
||||
r.before_balance as beforeBalance,
|
||||
r.after_balance as afterBalance,
|
||||
r.change_amount as changeAmount,
|
||||
r.change_type as changeType,
|
||||
r.change_desc as changeDesc,
|
||||
r.source,
|
||||
r.create_time as createTime
|
||||
FROM ums_account_change_record r
|
||||
LEFT JOIN ums_account ma ON r.account_id = ma.member_id
|
||||
LEFT JOIN sys_tenant_account ta ON r.account_id = ta.tenant_id
|
||||
<where>
|
||||
<if test="memberId != null">
|
||||
AND r.member_id = #{memberId}
|
||||
</if>
|
||||
<if test="accountId != null">
|
||||
AND r.account_id = #{accountId}
|
||||
</if>
|
||||
<if test="changeType != null">
|
||||
AND r.change_type = #{changeType}
|
||||
</if>
|
||||
<if test="source != null">
|
||||
AND r.source = #{source}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND r.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND r.create_time <= #{endTime}
|
||||
</if>
|
||||
AND (ma.id IS NOT NULL OR ta.id IS NOT NULL)
|
||||
</where>
|
||||
ORDER BY r.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user