Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0fedb2a3ff
16 files changed
+130
-53
No files matched your search
+1
-1
@@ -166,7 +166,7 @@ public class HardOrderController {
|
||||
// 判断是否为合作超市管理员工
|
||||
if (!hardManagerService.isSuperMarketAdmin(user)) return R.ok(new Page());
|
||||
// 查询用户属于的商户
|
||||
MchManageVo mch = mchService.getFirstMchByDeptId(userInfo.getSysUser().getDeptId(), MerchantTypeEnum.SUPERMARKET).getData();
|
||||
MchManageVo mch = mchService.getFirstMchByDeptId(userInfo.getSysUser().getDeptId(), List.of(MerchantTypeEnum.SUPERMARKET, MerchantTypeEnum.FARMER)).getData();
|
||||
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("该用户下不存在商户");
|
||||
// 查询商户和下面的子商户
|
||||
List<Long> mchDtoIds = new java.util.ArrayList<>(List.of(mch.getId()));
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ public class HardOrderTotalController {
|
||||
// 判断是否为合作超市管理员工
|
||||
if (!hardManagerService.isSuperMarketAdmin(user)) return R.ok(new Page());
|
||||
// 查询用户属于的商户
|
||||
MchManageVo mch = mchService.getFirstMchByDeptId(userInfo.getSysUser().getDeptId(), MerchantTypeEnum.SUPERMARKET).getData();
|
||||
MchManageVo mch = mchService.getFirstMchByDeptId(userInfo.getSysUser().getDeptId(), List.of(MerchantTypeEnum.SUPERMARKET, MerchantTypeEnum.FARMER)).getData();
|
||||
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("该用户下不存在商户");
|
||||
List<Long> mchDtoIds = new ArrayList<>(List.of(mch.getId()));
|
||||
// 查询商户和下面的子商户
|
||||
@@ -103,7 +103,7 @@ public class HardOrderTotalController {
|
||||
// 判断是否为合作超市管理员工
|
||||
if (!hardManagerService.isSuperMarketAdmin(user)) return R.ok(new Page());
|
||||
// 查询用户属于的商户
|
||||
MchManageVo mch = mchService.getFirstMchByDeptId(userInfo.getSysUser().getDeptId(), MerchantTypeEnum.SUPERMARKET).getData();
|
||||
MchManageVo mch = mchService.getFirstMchByDeptId(userInfo.getSysUser().getDeptId(), List.of(MerchantTypeEnum.SUPERMARKET, MerchantTypeEnum.FARMER)).getData();
|
||||
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("该用户下不存在商户");
|
||||
List<Long> mchDtoIds = new ArrayList<>(List.of(mch.getId()));
|
||||
// 查询商户和下面的子商户
|
||||
|
||||
+4
-2
@@ -19,6 +19,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@@ -51,7 +53,7 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
result.setWalletBalance(wallet.getBalance());
|
||||
result.setWalletIsFreeze(wallet.getIsFreeze());
|
||||
// 查询用户食堂信息
|
||||
MchManageVo mchDetail = remoteMchService.getFirstMchByDeptId(user.getSysUser().getDeptId(), MerchantTypeEnum.CANTEEN).getData();
|
||||
MchManageVo mchDetail = remoteMchService.getFirstMchByDeptId(user.getSysUser().getDeptId(), List.of(MerchantTypeEnum.CANTEEN)).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchDetail)) {
|
||||
result.setCanteenId(mchDetail.getId());
|
||||
}
|
||||
@@ -84,7 +86,7 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
result.setWalletBalance(wallet.getBalance());
|
||||
result.setWalletIsFreeze(wallet.getIsFreeze());
|
||||
// 查询用户食堂信息
|
||||
MchManageVo mchDetail = remoteMchService.getFirstMchByDeptId(user.getSysUser().getDeptId(), MerchantTypeEnum.CANTEEN).getData();
|
||||
MchManageVo mchDetail = remoteMchService.getFirstMchByDeptId(user.getSysUser().getDeptId(), List.of(MerchantTypeEnum.CANTEEN)).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchDetail)) {
|
||||
result.setCanteenId(mchDetail.getId());
|
||||
}
|
||||
|
||||
+1
-1
@@ -1103,7 +1103,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
List<MchRuleJoinDtoVo> list = mchRuleJoinService.innerMchRoleList(mch.getId()).getData();
|
||||
if (ObjectUtil.isEmpty(list)) return extraPrice;
|
||||
// 查询用户食堂
|
||||
MchManageVo userMch = remoteMchService.getFirstMchByDeptId(sysUser.getDeptId(), MerchantTypeEnum.CANTEEN).getData();
|
||||
MchManageVo userMch = remoteMchService.getFirstMchByDeptId(sysUser.getDeptId(), List.of(MerchantTypeEnum.CANTEEN)).getData();
|
||||
for (MchRuleJoinDtoVo v : list) {
|
||||
Long basePrice = v.getBasePrice();
|
||||
Long multiple = v.getMultiple();
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@ public class HardSyncServiceImpl implements HardSyncService {
|
||||
if (ObjectUtil.isEmpty(user)) throw new RuntimeException("当前登录用户错误");
|
||||
Long deptId = user.getDeptId();
|
||||
// 查询该用户属于的超市
|
||||
MchManageVo targetMch = remoteMchService.getFirstMchByDeptId(deptId, MerchantTypeEnum.SELF_SUPERMARKET).getData();
|
||||
if (ObjectUtil.isEmpty(targetMch) || ObjectUtil.notEqual(targetMch.getTypes(), MerchantTypeEnum.SELF_SUPERMARKET.getType())) {
|
||||
MchManageVo targetMch = remoteMchService.getFirstMchByDeptId(deptId, List.of(MerchantTypeEnum.SELF_SUPERMARKET)).getData();
|
||||
if (ObjectUtil.isEmpty(targetMch)) {
|
||||
throw new RuntimeException("您不是超市用户,无法操作");
|
||||
}
|
||||
mqttEventService.sendSupermarket(List.of(deptId));
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@ public enum ActUserReceiveEnum {
|
||||
ACT_EXPIRED("1", "活动不在进行中"),
|
||||
ACT_NOT_EXIST("2", "活动不存在"),
|
||||
ACT_NOT_STARTED("3", "活动未开启"),
|
||||
USER_LIMIT_REACHED("4", "用户参加活动已达上限"),
|
||||
// 用户参加活动已达上限
|
||||
USER_LIMIT_REACHED("4", "已领取,核销码在我的礼券中"),
|
||||
USER_CANNOT_PARTICIPATE("5", "用户不能参加此活动"),
|
||||
OTHER_ERROR("6", "其他错误"),
|
||||
USER_CAN_JOIN_ACT("99", "用户可以参加活动"),
|
||||
|
||||
+1
-1
@@ -51,5 +51,5 @@ public interface RemoteMchService {
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/mch-manage/get-first-mch-by-dept-id")
|
||||
R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId, @RequestParam MerchantTypeEnum mchType);
|
||||
R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId, @RequestParam List<MerchantTypeEnum> mchType);
|
||||
}
|
||||
+12
-16
@@ -1,6 +1,7 @@
|
||||
package com.bsd.pjcloud.wallet.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
@@ -32,6 +33,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 会员钱包流水表
|
||||
@@ -252,10 +254,8 @@ public class WalletTransactionController {
|
||||
|
||||
DataScope dataScope = null;
|
||||
Long count = walletTransactionMapper.count(dto, dataScope);
|
||||
if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围");
|
||||
|
||||
List<WalletTransactionVo> list = walletTransactionService.scopeList(dto, dataScope);
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/个人充值明细.xlsx", list);
|
||||
if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围");
|
||||
walletTransactionService.exportByTemplate(response, dto, count, "file/个人充值明细.xlsx", dataScope);
|
||||
}
|
||||
|
||||
@Operation(summary = "充值统计", description = "充值统计")
|
||||
@@ -276,10 +276,9 @@ public class WalletTransactionController {
|
||||
|
||||
DataScope dataScope = null;
|
||||
Long count = walletTransactionMapper.count(dto, dataScope);
|
||||
if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围");
|
||||
if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围");
|
||||
|
||||
List<WalletTransactionVo> list = walletTransactionService.scopeList(dto, dataScope);
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/个人记账扣款明细.xlsx", list);
|
||||
walletTransactionService.exportByTemplate(response, dto, count, "file/个人记账扣款明细.xlsx", dataScope);
|
||||
}
|
||||
|
||||
@Operation(summary = "记账扣款统计", description = "记账扣款统计")
|
||||
@@ -300,10 +299,9 @@ public class WalletTransactionController {
|
||||
|
||||
DataScope dataScope = null;
|
||||
Long count = walletTransactionMapper.count(dto, dataScope);
|
||||
if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围");
|
||||
if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围");
|
||||
|
||||
List<WalletTransactionVo> list = walletTransactionService.scopeList(dto, dataScope);
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/个人消费明细.xlsx", list);
|
||||
walletTransactionService.exportByTemplate(response, dto, count, "file/个人消费明细.xlsx", dataScope);
|
||||
}
|
||||
|
||||
@Operation(summary = "消费统计", description = "消费统计")
|
||||
@@ -323,10 +321,9 @@ public class WalletTransactionController {
|
||||
|
||||
DataScope dataScope = null;
|
||||
Long count = walletTransactionMapper.count(dto, dataScope);
|
||||
if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围");
|
||||
if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围");
|
||||
|
||||
List<WalletTransactionVo> list = walletTransactionService.scopeList(dto, dataScope);
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/个人退款明细.xlsx", list);
|
||||
walletTransactionService.exportByTemplate(response, dto, count, "file/个人退款明细.xlsx", dataScope);
|
||||
}
|
||||
|
||||
@Operation(summary = "退款统计", description = "退款统计")
|
||||
@@ -347,10 +344,9 @@ public class WalletTransactionController {
|
||||
|
||||
DataScope dataScope = null;
|
||||
Long count = walletTransactionMapper.count(dto, dataScope);
|
||||
if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围");
|
||||
if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围");
|
||||
|
||||
List<WalletTransactionVo> list = walletTransactionService.scopeList(dto, dataScope);
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/退还各自食堂明细.xlsx", list);
|
||||
walletTransactionService.exportByTemplate(response, dto, count, "file/退还各自食堂明细.xlsx", dataScope);
|
||||
}
|
||||
|
||||
@Operation(summary = "退还各自食堂统计", description = "退还各自食堂统计")
|
||||
|
||||
+5
-1
@@ -61,7 +61,11 @@ public class ActCancelItemController {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
ActCancelItemDto dto = new ActCancelItemDto();
|
||||
dto.setReceiverUserId(user.getId());
|
||||
dto.setActStatusList(List.of(ActCancelStatusEnum.CANCEL_AWAIT.getCode()));
|
||||
dto.setActStatusList(List.of(
|
||||
ActCancelStatusEnum.CANCEL_AWAIT.getCode(),
|
||||
ActCancelStatusEnum.CANCEL_SUCCESS.getCode(),
|
||||
ActCancelStatusEnum.CANCEL_EXPIRE.getCode()
|
||||
));
|
||||
dto.setIsFindNoExpire(true);
|
||||
return R.ok(actCancelItemService.pageList(page, dto));
|
||||
}
|
||||
|
||||
+5
-1
@@ -61,7 +61,11 @@ public class ActCouponRecordController {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
ActCouponRecordDto dto = new ActCouponRecordDto();
|
||||
dto.setUserId(user.getId());
|
||||
dto.setStatusCodeList(List.of(ActCouponRecordStatusEnum.UNUSED.getCode()));
|
||||
dto.setStatusCodeList(List.of(
|
||||
ActCouponRecordStatusEnum.UNUSED.getCode(),
|
||||
ActCouponRecordStatusEnum.USED.getCode(),
|
||||
ActCouponRecordStatusEnum.EXPIRED.getCode()
|
||||
));
|
||||
dto.setIsFindNoExpire(true);
|
||||
return R.ok(actCouponRecordService.pageList(page, dto));
|
||||
}
|
||||
|
||||
+2
-2
@@ -121,8 +121,8 @@ public class MchManageController {
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-first-mch-by-dept-id")
|
||||
public R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId, @RequestParam MerchantTypeEnum mchType) {
|
||||
MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId, List.of(mchType));
|
||||
public R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId, @RequestParam List<MerchantTypeEnum> mchType) {
|
||||
MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId, mchType);
|
||||
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
|
||||
return R.ok(mchManage);
|
||||
}
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ public interface WalletTransactionService extends IService<WalletTransactionEnti
|
||||
*/
|
||||
Boolean updateWalletBalance(WalletTransactionDto dto);
|
||||
|
||||
void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, String fileName, List<WalletTransactionVo> list);
|
||||
void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, Long total, String fileName, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 后台充值统计(导出)
|
||||
|
||||
+70
-15
@@ -52,6 +52,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
@@ -60,8 +62,14 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
/**
|
||||
* 会员钱包流水表
|
||||
*
|
||||
@@ -315,8 +323,10 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, String fileName, List<WalletTransactionVo> list) {
|
||||
public void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, Long total, String fileName, DataScope dataScope) {
|
||||
ExecutorService executor = Executors.newFixedThreadPool(10);
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream(fileName)).build()) {
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
||||
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
||||
@@ -326,27 +336,72 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
map.put("startTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN));
|
||||
map.put("endTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[1], DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
BigDecimal priceTotal = BigDecimal.ZERO;
|
||||
Long lineNumber = 1L;
|
||||
for (WalletTransactionVo v : list) {
|
||||
v.setLineNumber(lineNumber);
|
||||
lineNumber++;
|
||||
if (ObjectUtil.isNotEmpty(v.getPrice())) {
|
||||
priceTotal = priceTotal.add(BigDecimal.valueOf(v.getPrice()));
|
||||
v.setPriceStr(BigDecimal.valueOf(v.getPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
long pageSize = 2000;
|
||||
long finalTotal = (total == null || total == 0) ? 0 : total;
|
||||
int pages = (int) ((finalTotal + pageSize - 1) / pageSize);
|
||||
if (pages == 0) pages = 1;
|
||||
|
||||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||
List<CompletableFuture<List<WalletTransactionVo>>> futures = new ArrayList<>();
|
||||
for (int i = 1; i <= pages; i++) {
|
||||
long currentPage = i;
|
||||
futures.add(CompletableFuture.supplyAsync(() -> {
|
||||
if (requestAttributes != null) {
|
||||
RequestContextHolder.setRequestAttributes(requestAttributes);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getBizType())) {
|
||||
v.setBizType(WalletBizEnum.valueOfByType(v.getBizType()).getDesc());
|
||||
try {
|
||||
Page<Object> page = new Page<>(currentPage, pageSize);
|
||||
page.setMaxLimit(pageSize);
|
||||
Page<WalletTransactionVo> pageList = scopePageList(page, dto, dataScope);
|
||||
if (ObjectUtil.isEmpty(pageList) || ObjectUtil.isEmpty(pageList.getRecords())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<WalletTransactionVo> list = pageList.getRecords();
|
||||
for (WalletTransactionVo v : list) {
|
||||
if (ObjectUtil.isNotEmpty(v.getPrice())) {
|
||||
v.setPriceStr(BigDecimal.valueOf(v.getPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getBizType())) {
|
||||
v.setBizType(WalletBizEnum.valueOfByType(v.getBizType()).getDesc());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}|分页查询异常, currentPage:{}", TAG, currentPage, e);
|
||||
throw e;
|
||||
} finally {
|
||||
RequestContextHolder.resetRequestAttributes();
|
||||
}
|
||||
}
|
||||
map.put("computeTotalPayPrice", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
}, executor));
|
||||
}
|
||||
|
||||
BigDecimal priceTotal = BigDecimal.ZERO;
|
||||
Long lineNumber = 1L;
|
||||
|
||||
for (CompletableFuture<List<WalletTransactionVo>> future : futures) {
|
||||
try {
|
||||
List<WalletTransactionVo> list = future.get();
|
||||
if (ObjectUtil.isEmpty(list)) continue;
|
||||
for (WalletTransactionVo v : list) {
|
||||
v.setLineNumber(lineNumber++);
|
||||
if (ObjectUtil.isNotEmpty(v.getPrice())) {
|
||||
priceTotal = priceTotal.add(BigDecimal.valueOf(v.getPrice()));
|
||||
}
|
||||
}
|
||||
excelWriter.fill(list, fillConfig, writeSheet);
|
||||
} catch (Exception e) {
|
||||
log.error("|{}|多线程导出获取数据异常,任务中断", TAG, e);
|
||||
// 抛出异常以终止导出,避免数据不完整
|
||||
throw new RuntimeException("导出数据异常,请重试", e);
|
||||
}
|
||||
}
|
||||
map.put("computeTotalPayPrice", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
excelWriter.fill(map, writeSheet);
|
||||
excelWriter.fill(list, fillConfig, writeSheet);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("|{}|导入错误,dto:|{}|,fileName:|{}|,error:|{}|", TAG, JSON.toJSONString(dto), fileName, e.getMessage());
|
||||
} finally {
|
||||
executor.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -368,7 +368,11 @@ public class ActCancelItemServiceImpl extends ServiceImpl<ActCancelItemMapper, A
|
||||
*/
|
||||
@Override
|
||||
public Long userTotal(Long userId) {
|
||||
return baseMapper.userTotal(userId, List.of(ActCancelStatusEnum.CANCEL_AWAIT.getCode()));
|
||||
return baseMapper.userTotal(userId, List.of(
|
||||
ActCancelStatusEnum.CANCEL_AWAIT.getCode(),
|
||||
ActCancelStatusEnum.CANCEL_SUCCESS.getCode(),
|
||||
ActCancelStatusEnum.CANCEL_EXPIRE.getCode()
|
||||
));
|
||||
}
|
||||
|
||||
// 判断用户是否已领取
|
||||
|
||||
+5
-1
@@ -266,7 +266,11 @@ public class ActCouponRecordServiceImpl extends ServiceImpl<ActCouponRecordMappe
|
||||
*/
|
||||
@Override
|
||||
public Long userTotal(Long userId) {
|
||||
return baseMapper.userTotal(userId, List.of(ActCouponRecordStatusEnum.UNUSED.getCode()));
|
||||
return baseMapper.userTotal(userId, List.of(
|
||||
ActCouponRecordStatusEnum.UNUSED.getCode(),
|
||||
ActCouponRecordStatusEnum.USED.getCode(),
|
||||
ActCouponRecordStatusEnum.EXPIRED.getCode()
|
||||
));
|
||||
}
|
||||
|
||||
private void disposePageList(List<ActCouponRecordVo> list) {
|
||||
|
||||
@@ -193,14 +193,21 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- FROM (-->
|
||||
<!-- SELECT DISTINCT a.user_id,-->
|
||||
<!-- m.wallet_type_id,-->
|
||||
<!-- FIRST_VALUE(a.balance) OVER (-->
|
||||
<!-- PARTITION BY a.user_id, m.wallet_type_id-->
|
||||
<!-- ORDER BY a.create_time DESC-->
|
||||
<!-- ) as balance-->
|
||||
<select id="selectTotalBalance" resultType="java.lang.Long">
|
||||
SELECT SUM(latest_balance.balance)
|
||||
FROM (
|
||||
SELECT DISTINCT a.user_id,
|
||||
from (select distinct a.user_id,
|
||||
m.wallet_type_id,
|
||||
FIRST_VALUE(a.balance) OVER (
|
||||
PARTITION BY a.user_id, m.wallet_type_id
|
||||
ORDER BY a.create_time DESC
|
||||
first_value(a.balance) over (
|
||||
partition by a.user_id, m.wallet_type_id
|
||||
order by a.create_time desc, a.id desc
|
||||
) as balance
|
||||
FROM wallet_transaction a
|
||||
INNER JOIN wallet_manage m
|
||||
|
||||
Reference in new issue
Block a user