From 1b342869d3ec91bc1abbd0c76e565b60a0d1aef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E5=A4=A7=E5=8F=94?= <494979559@qq.com> Date: Mon, 6 May 2024 15:07:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95=E3=80=81?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/domain/entity/SmUser.java | 1 + .../service/SmBalancePeriodServiceImpl.java | 12 +- .../service/SmBusinessRecordServiceImpl.java | 9 +- .../ruoyi/ss/store/domain/StoreCountVO.java | 18 ++ .../com/ruoyi/ss/store/domain/StoreQuery.java | 13 ++ .../ss/store/domain/enums/StoreGroupBy.java | 11 + .../ruoyi/ss/store/mapper/StoreMapper.java | 8 + .../com/ruoyi/ss/store/mapper/StoreMapper.xml | 16 ++ .../ruoyi/ss/store/service/IStoreService.java | 11 + .../store/service/impl/StoreServiceImpl.java | 33 +++ ...nsactionBill.java => TransactionBill.java} | 4 +- ...llQuery.java => TransactionBillQuery.java} | 8 +- ...tionBillVo.java => TransactionBillVo.java} | 3 +- ...tionBillBO.java => TransactionBillBO.java} | 4 +- ...Mapper.java => TransactionBillMapper.java} | 24 +- ...llMapper.xml => TransactionBillMapper.xml} | 24 +- .../service/TransactionAssembler.java | 4 +- ...rvice.java => TransactionBillService.java} | 45 ++-- .../service/TransactionBillValidator.java | 4 +- .../impl/TransactionAssemblerImpl.java | 9 +- ...l.java => TransactionBillServiceImpl.java} | 209 ++++++++++++------ .../impl/TransactionBillValidatorImpl.java | 10 +- .../com/ruoyi/ss/user/domain/SmUserVo.java | 6 + .../ruoyi/ss/user/service/UserAssembler.java | 18 ++ .../user/service/impl/UserAssemblerImpl.java | 44 ++++ .../ruoyi/ss/wxPay/service/WxPayService.java | 28 ++- .../java/com/ruoyi/task/bill/BillDelayed.java | 4 +- .../ruoyi/task/bill/BillDelayedManager.java | 4 +- .../com/ruoyi/task/bill/BillStartTask.java | 14 +- .../java/com/ruoyi/task/bill/PayTask.java | 44 +++- .../web/controller/app/AppPayController.java | 4 +- .../app/AppTransactionBillController.java | 32 +-- .../web/controller/app/AppUserController.java | 9 +- .../controller/ss/SmDashboardController.java | 8 +- .../ss/SmTransactionBillController.java | 36 +-- .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-test.yml | 2 +- 37 files changed, 527 insertions(+), 208 deletions(-) create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/StoreCountVO.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/enums/StoreGroupBy.java rename smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/{SmTransactionBill.java => TransactionBill.java} (96%) rename smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/{SmTransactionBillQuery.java => TransactionBillQuery.java} (86%) rename smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/{SmTransactionBillVo.java => TransactionBillVo.java} (85%) rename smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/{SmTransactionBillBO.java => TransactionBillBO.java} (65%) rename smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/{SmTransactionBillMapper.java => TransactionBillMapper.java} (79%) rename smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/{SmTransactionBillMapper.xml => TransactionBillMapper.xml} (93%) rename smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/{ISmTransactionBillService.java => TransactionBillService.java} (72%) rename smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/{SmTransactionBillServiceImpl.java => TransactionBillServiceImpl.java} (74%) create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserAssembler.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java index 25df8fbb..c627fe50 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java @@ -53,6 +53,7 @@ public class SmUser extends BaseEntity @Excel(name = "手机号码") @ApiModelProperty("手机号码") @Sensitive(desensitizedType = DesensitizedType.PHONE) + @JsonView(JsonViewProfile.App.class) private String phonenumber; /** 出生日期 */ diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/balancePeriod/service/SmBalancePeriodServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/balancePeriod/service/SmBalancePeriodServiceImpl.java index cded9865..0370dd91 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/balancePeriod/service/SmBalancePeriodServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/balancePeriod/service/SmBalancePeriodServiceImpl.java @@ -5,10 +5,10 @@ import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriod; import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriodQuery; import com.ruoyi.ss.balancePeriod.mapper.SmBalancePeriodMapper; import com.ruoyi.ss.dashboard.BillCountVo; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillQuery; +import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillGroupBy; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; -import com.ruoyi.ss.transactionBill.mapper.SmTransactionBillMapper; +import com.ruoyi.ss.transactionBill.mapper.TransactionBillMapper; import com.ruoyi.ss.user.domain.SmUserQuery; import com.ruoyi.ss.user.mapper.SmUserMapper; import org.springframework.beans.factory.annotation.Autowired; @@ -36,7 +36,7 @@ public class SmBalancePeriodServiceImpl implements ISmBalancePeriodService private SmUserMapper smUserMapper; @Autowired - private SmTransactionBillMapper smTransactionBillMapper; + private TransactionBillMapper transactionBillMapper; /** * 查询余额时段记录 @@ -123,16 +123,16 @@ public class SmBalancePeriodServiceImpl implements ISmBalancePeriodService data.setUserBalance(smUserMapper.selectBalanceCount(new SmUserQuery())); // 平台总余额 - List platFormBillCount = smTransactionBillMapper.selectCount(new SmTransactionBillQuery()); + List platFormBillCount = transactionBillMapper.selectCount(new TransactionBillQuery()); data.setPlatformBalance(CollectionUtils.isEmpty(platFormBillCount) ? BigDecimal.ZERO : platFormBillCount.get(0).getServiceCharge()); // 充值 - SmTransactionBillQuery dto = new SmTransactionBillQuery(); + TransactionBillQuery dto = new TransactionBillQuery(); dto.setCreateDate(now); dto.setHour(now.getHours()); dto.setGroupBy(TransactionBillGroupBy.create_hour.name()); dto.setStatus(TransactionBillStatus.SUCCESS.getStatus()); - List billCount = smTransactionBillMapper.selectCount(dto); + List billCount = transactionBillMapper.selectCount(dto); data.setRecharge(CollectionUtils.isEmpty(billCount) ? BigDecimal.ZERO : billCount.get(0).getRecharge()); data.setCreateTime(now); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/SmBusinessRecordServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/SmBusinessRecordServiceImpl.java index 463dc5d2..3141e185 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/SmBusinessRecordServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/businessRecord/service/SmBusinessRecordServiceImpl.java @@ -1,7 +1,6 @@ package com.ruoyi.ss.businessRecord.service; import com.ruoyi.common.enums.UserStatus; -import com.ruoyi.common.enums.UserType; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecord; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordQuery; @@ -14,9 +13,9 @@ import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus; import com.ruoyi.ss.device.service.ISmDeviceService; import com.ruoyi.ss.model.domain.SmModelQuery; import com.ruoyi.ss.model.service.ISmModelService; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillQuery; +import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.user.domain.SmUserQuery; import com.ruoyi.ss.user.service.ISmUserService; import org.springframework.beans.factory.annotation.Autowired; @@ -48,7 +47,7 @@ public class SmBusinessRecordServiceImpl implements ISmBusinessRecordService private ISmModelService modelService; @Autowired - private ISmTransactionBillService transactionBillService; + private TransactionBillService transactionBillService; /** * 查询经营记录 @@ -174,7 +173,7 @@ public class SmBusinessRecordServiceImpl implements ISmBusinessRecordService brief.setTenantCount(userService.selectCount(tenantDto)); // 充值金额总数 - SmTransactionBillQuery rechargeDto = new SmTransactionBillQuery(); + TransactionBillQuery rechargeDto = new TransactionBillQuery(); rechargeDto.setStatus(TransactionBillStatus.SUCCESS.getStatus()); List billCount = transactionBillService.selectCount(rechargeDto); if (!CollectionUtils.isEmpty(billCount)) { diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/StoreCountVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/StoreCountVO.java new file mode 100644 index 00000000..40c97c7d --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/StoreCountVO.java @@ -0,0 +1,18 @@ +package com.ruoyi.ss.store.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author wjh + * 2024/5/6 + */ +@Data +public class StoreCountVO { + + @ApiModelProperty("用户ID") + private Long userId; + + @ApiModelProperty("数量") + private Integer count; +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/StoreQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/StoreQuery.java index 3188a9bc..94754d92 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/StoreQuery.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/StoreQuery.java @@ -1,6 +1,8 @@ package com.ruoyi.ss.store.domain; import com.ruoyi.common.core.domain.ValidGroup; +import com.ruoyi.common.valid.EnumValid; +import com.ruoyi.ss.store.domain.enums.StoreGroupBy; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -30,4 +32,15 @@ public class StoreQuery extends Store { @ApiModelProperty("店铺id列表") private List storeIds; + + @ApiModelProperty("用户id列表") + private List userIds; + + @ApiModelProperty("分组字段") + @EnumValid( + clazz = StoreGroupBy.class, + message = "非法的分组字段", + method = "name" + ) + private String groupBy; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/enums/StoreGroupBy.java b/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/enums/StoreGroupBy.java new file mode 100644 index 00000000..f49ef512 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/domain/enums/StoreGroupBy.java @@ -0,0 +1,11 @@ +package com.ruoyi.ss.store.domain.enums; + +/** + * @author wjh + * 2024/5/6 + */ +public enum StoreGroupBy { + + user_id; + +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.java index f4b12059..d08230b0 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.java @@ -1,6 +1,7 @@ package com.ruoyi.ss.store.mapper; import com.ruoyi.ss.store.domain.Store; +import com.ruoyi.ss.store.domain.StoreCountVO; import com.ruoyi.ss.store.domain.StoreQuery; import com.ruoyi.ss.store.domain.StoreVo; import org.apache.ibatis.annotations.Param; @@ -112,4 +113,11 @@ public interface StoreMapper * @return */ StoreVo selectOne(StoreQuery query); + + /** + * 通用查询数量方法 + * @param query + * @return + */ + List selectCommonCount(StoreQuery query); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml index 0f2c94d2..1f516fe2 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/mapper/StoreMapper.xml @@ -95,6 +95,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" limit 1 + + SELECT LAST_INSERT_ID(); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/IStoreService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/IStoreService.java index 31197a00..061a21aa 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/IStoreService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/IStoreService.java @@ -1,10 +1,13 @@ package com.ruoyi.ss.store.service; import com.ruoyi.ss.store.domain.Store; +import com.ruoyi.ss.store.domain.StoreCountVO; import com.ruoyi.ss.store.domain.StoreQuery; import com.ruoyi.ss.store.domain.StoreVo; import java.util.List; +import java.util.Map; +import java.util.function.Function; /** * 商户Service接口 @@ -90,4 +93,12 @@ public interface IStoreService * @param query 查询条件 */ int selectCount(StoreQuery query); + + /** + * 查询用户ID列表 + * @param userIds + * @return + */ + Map selectCountMapByUserIds(List userIds); + } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java index 3476e8bd..f433c481 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/store/service/impl/StoreServiceImpl.java @@ -6,8 +6,10 @@ import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.ss.device.domain.SmDeviceQuery; import com.ruoyi.ss.device.service.ISmDeviceService; import com.ruoyi.ss.store.domain.Store; +import com.ruoyi.ss.store.domain.StoreCountVO; import com.ruoyi.ss.store.domain.StoreQuery; import com.ruoyi.ss.store.domain.StoreVo; +import com.ruoyi.ss.store.domain.enums.StoreGroupBy; import com.ruoyi.ss.store.mapper.StoreMapper; import com.ruoyi.ss.store.service.IStoreService; import com.ruoyi.ss.store.service.StoreAssembler; @@ -19,6 +21,8 @@ import com.ruoyi.common.utils.CollectionUtils; import org.springframework.transaction.support.TransactionTemplate; import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; /** * 店铺Service业务层处理 @@ -236,4 +240,33 @@ public class StoreServiceImpl implements IStoreService return storeMapper.selectCount(query); } + /** + * 查询用户ID列表 + * + * @param userIds + * @return + */ + @Override + public Map selectCountMapByUserIds(List userIds) { + StoreQuery query = new StoreQuery(); + query.setUserIds(userIds); + query.setGroupBy(StoreGroupBy.user_id.name()); + return this.selectCountMap(query, StoreCountVO::getUserId); + } + + /** + * 通用查询数量 + * + * @param query + * @param keyMapper + * @return + */ + private Map selectCountMap(StoreQuery query, Function keyMapper) { + List list = storeMapper.selectCommonCount(query); + if (CollectionUtils.isEmptyElement(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.toMap(keyMapper, StoreCountVO::getCount)); + } + } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/SmTransactionBill.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBill.java similarity index 96% rename from smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/SmTransactionBill.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBill.java index ad773fb1..18e3c717 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/SmTransactionBill.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBill.java @@ -6,8 +6,6 @@ import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.JsonViewProfile; import com.ruoyi.common.core.domain.ValidGroup; -import com.ruoyi.common.valid.EnumValid; -import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillPayType; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -24,7 +22,7 @@ import java.util.List; * @date 2024-02-21 */ @Data -public class SmTransactionBill extends BaseEntity +public class TransactionBill extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/SmTransactionBillQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBillQuery.java similarity index 86% rename from smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/SmTransactionBillQuery.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBillQuery.java index 735658ec..b27886e8 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/SmTransactionBillQuery.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBillQuery.java @@ -17,7 +17,7 @@ import java.util.List; */ @EqualsAndHashCode(callSuper = true) @Data -public class SmTransactionBillQuery extends SmTransactionBill { +public class TransactionBillQuery extends TransactionBill { @ApiModelProperty("年份") private Integer year; @@ -61,4 +61,10 @@ public class SmTransactionBillQuery extends SmTransactionBill { @ApiModelProperty("订单id列表") private List billIds; + + @ApiModelProperty("设备充值状态列表") + private List deviceRechargeStatusList; + + @ApiModelProperty("状态列表") + private List statusList; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/SmTransactionBillVo.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBillVo.java similarity index 85% rename from smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/SmTransactionBillVo.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBillVo.java index 012b6a09..d608dabd 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/SmTransactionBillVo.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/TransactionBillVo.java @@ -12,8 +12,9 @@ import lombok.Data; */ @ApiModel @Data -public class SmTransactionBillVo extends SmTransactionBill { +public class TransactionBillVo extends TransactionBill { @ApiModelProperty("用户名称") + @JsonView(JsonViewProfile.App.class) private String userName; @ApiModelProperty("商户(到账用户)名称") diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/SmTransactionBillBO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/TransactionBillBO.java similarity index 65% rename from smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/SmTransactionBillBO.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/TransactionBillBO.java index 4d427245..3730f2bc 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/SmTransactionBillBO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/TransactionBillBO.java @@ -1,6 +1,6 @@ package com.ruoyi.ss.transactionBill.domain.bo; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -9,7 +9,7 @@ import lombok.Data; * 2024/3/27 */ @Data -public class SmTransactionBillBO extends SmTransactionBill { +public class TransactionBillBO extends TransactionBill { @ApiModelProperty("提现密码") private String payPassword; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/SmTransactionBillMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.java similarity index 79% rename from smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/SmTransactionBillMapper.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.java index 910b7ff7..6f41e679 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/SmTransactionBillMapper.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.java @@ -1,9 +1,9 @@ package com.ruoyi.ss.transactionBill.mapper; import com.ruoyi.ss.dashboard.BillCountVo; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillQuery; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillVo; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; +import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; +import com.ruoyi.ss.transactionBill.domain.TransactionBillVo; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -15,7 +15,7 @@ import java.util.List; * @author 邱贞招 * @date 2024-02-21 */ -public interface SmTransactionBillMapper +public interface TransactionBillMapper { /** * 查询充值记录 @@ -23,7 +23,7 @@ public interface SmTransactionBillMapper * @param billId 充值记录主键 * @return 充值记录 */ - public SmTransactionBillVo selectSmTransactionBillByBillId(Long billId); + public TransactionBillVo selectSmTransactionBillByBillId(Long billId); /** * 查询充值记录列表 @@ -31,23 +31,23 @@ public interface SmTransactionBillMapper * @param smTransactionBill 充值记录 * @return 充值记录集合 */ - public List selectSmTransactionBillList(SmTransactionBillQuery smTransactionBill); + public List selectSmTransactionBillList(TransactionBillQuery smTransactionBill); /** * 新增充值记录 * - * @param smTransactionBill 充值记录 + * @param transactionBill 充值记录 * @return 结果 */ - public int insertSmTransactionBill(SmTransactionBill smTransactionBill); + public int insertSmTransactionBill(TransactionBill transactionBill); /** * 修改充值记录 * - * @param smTransactionBill 充值记录 + * @param transactionBill 充值记录 * @return 结果 */ - public int updateSmTransactionBill(SmTransactionBill smTransactionBill); + public int updateSmTransactionBill(TransactionBill transactionBill); /** * 删除充值记录 @@ -69,7 +69,7 @@ public interface SmTransactionBillMapper * 获取账单统计数据 * @param dto 查询条件 */ - List selectCount(SmTransactionBillQuery dto); + List selectCount(TransactionBillQuery dto); /** * 修改支付方式 @@ -89,7 +89,7 @@ public interface SmTransactionBillMapper * @param billNo 订单编号 * @return */ - SmTransactionBill selectSmTransactionBillByBillNo(String billNo); + TransactionBill selectSmTransactionBillByBillNo(String billNo); /** * 订单取消 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/SmTransactionBillMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml similarity index 93% rename from smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/SmTransactionBillMapper.xml rename to smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml index b2e4f486..6aa55d2a 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/SmTransactionBillMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml @@ -2,9 +2,9 @@ - + - + @@ -69,9 +69,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and date(stb.create_time) <= date(#{endDate}) and stb.device_recharge_status = #{deviceRechargeStatus} and stb.suit_id = #{suitId} + + and stb.device_recharge_status in + + #{item} + + + + and stb.status in + + #{item} + + - @@ -137,7 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" limit 1 - + insert into sm_transaction_bill bill_no, @@ -207,7 +219,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + update sm_transaction_bill user_id = #{userId}, @@ -271,7 +283,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update sm_transaction_bill set status = #{status} - where bill_no = #{billNo} and status = '1' and `type` = '1' + where bill_no = #{billNo} and status in ('1', '6') and `type` = '1' diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionAssembler.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionAssembler.java index 91b7fefa..9432b83a 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionAssembler.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionAssembler.java @@ -1,6 +1,6 @@ package com.ruoyi.ss.transactionBill.service; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillVo; +import com.ruoyi.ss.transactionBill.domain.TransactionBillVo; import java.util.List; @@ -14,6 +14,6 @@ public interface TransactionAssembler { * 拼接渠道名称 * @param list */ - void assembleChannelName(List list); + void assembleChannelName(List list); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/ISmTransactionBillService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillService.java similarity index 72% rename from smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/ISmTransactionBillService.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillService.java index b1ae3fbe..cc80ecde 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/ISmTransactionBillService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillService.java @@ -1,15 +1,16 @@ package com.ruoyi.ss.transactionBill.service; import com.ruoyi.ss.dashboard.BillCountVo; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; -import com.ruoyi.ss.transactionBill.domain.bo.SmTransactionBillBO; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillQuery; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillVo; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; +import com.ruoyi.ss.transactionBill.domain.bo.TransactionBillBO; +import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; +import com.ruoyi.ss.transactionBill.domain.TransactionBillVo; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillPayType; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; import java.util.Date; import java.util.List; +import java.util.concurrent.TimeUnit; /** * 充值记录Service接口 @@ -17,7 +18,7 @@ import java.util.List; * @author 邱贞招 * @date 2024-02-21 */ -public interface ISmTransactionBillService +public interface TransactionBillService { /** * 查询充值记录 @@ -25,7 +26,7 @@ public interface ISmTransactionBillService * @param billId 充值记录主键 * @return 充值记录 */ - public SmTransactionBillVo selectSmTransactionBillByBillId(Long billId); + public TransactionBillVo selectSmTransactionBillByBillId(Long billId); /** * 查询充值记录列表 @@ -33,23 +34,23 @@ public interface ISmTransactionBillService * @param smTransactionBillQuery 充值记录查询条件 * @return 充值记录集合 */ - public List selectSmTransactionBillList(SmTransactionBillQuery smTransactionBillQuery); + public List selectSmTransactionBillList(TransactionBillQuery smTransactionBillQuery); /** * 新增充值记录 * - * @param smTransactionBill 充值记录 + * @param transactionBill 充值记录 * @return 结果 */ - public int insertSmTransactionBill(SmTransactionBill smTransactionBill); + public int insertSmTransactionBill(TransactionBill transactionBill); /** * 修改充值记录 * - * @param smTransactionBill 充值记录 + * @param transactionBill 充值记录 * @return 结果 */ - public int updateSmTransactionBill(SmTransactionBill smTransactionBill); + public int updateSmTransactionBill(TransactionBill transactionBill); /** * 批量删除充值记录 @@ -72,14 +73,14 @@ public interface ISmTransactionBillService * @param dto * @return */ - List selectCount(SmTransactionBillQuery dto); + List selectCount(TransactionBillQuery dto); /** * 创建订单 * @param body 订单信息 * @return 新增的数据订单编号 */ - String addOrder(SmTransactionBill body); + String addOrder(TransactionBill body); /** * 更新支付方式 @@ -112,18 +113,18 @@ public interface ISmTransactionBillService * 根据订单编号查询数据 * @param billNo 订单编号 */ - SmTransactionBill selectSmTransactionBillByBillNo(String billNo); + TransactionBill selectSmTransactionBillByBillNo(String billNo); /** * 获取未支付的充值订单 * @return 订单列表 */ - List selectUnpaidRecharge(); + List selectNoPayedRecharge(); /** * 提现 */ - String addWithdraw(SmTransactionBillBO data); + String addWithdraw(TransactionBillBO data); /** * 提现审核通过 @@ -169,7 +170,7 @@ public interface ISmTransactionBillService * @param dto 查询条件 * @return 统计信息 */ - List selectLandlordCount(SmTransactionBillQuery dto); + List selectLandlordCount(TransactionBillQuery dto); /** * 刷新订单支付结果 @@ -195,5 +196,13 @@ public interface ISmTransactionBillService * @param userId * @return */ - List selectDeviceRechargeFailList(Long userId); + List selectDeviceRechargeFailList(Long userId); + + /** + * 查询支付结果,直到过期 + * @param billNo 订单编号 + * @param delay 延迟时间 + * @param timeUnit 时间单位 + */ + void refreshPayResultBeforeExpire(String billNo, int delay, TimeUnit timeUnit); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java index a5ffa292..35815def 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java @@ -1,7 +1,7 @@ package com.ruoyi.ss.transactionBill.service; import com.ruoyi.common.core.domain.ValidateResult; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; /** * 2024/4/22 @@ -13,7 +13,7 @@ public interface TransactionBillValidator { * @param data * @return */ - ValidateResult preAddOrder(SmTransactionBill data); + ValidateResult preAddOrder(TransactionBill data); /** * 获取订单详情前校验 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionAssemblerImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionAssemblerImpl.java index b63c8577..12c8a946 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionAssemblerImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionAssemblerImpl.java @@ -4,12 +4,11 @@ import com.ruoyi.common.utils.CollectionUtils; import com.ruoyi.ss.channel.domain.SmChannel; import com.ruoyi.ss.channel.domain.SmChannelQuery; import com.ruoyi.ss.channel.service.ISmChannelService; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillVo; +import com.ruoyi.ss.transactionBill.domain.TransactionBillVo; import com.ruoyi.ss.transactionBill.service.TransactionAssembler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Objects; @@ -31,15 +30,15 @@ public class TransactionAssemblerImpl implements TransactionAssembler { * @param list */ @Override - public void assembleChannelName(List list) { + public void assembleChannelName(List list) { if (CollectionUtils.isEmptyElement(list)) { return; } SmChannelQuery query = new SmChannelQuery(); - query.setChannelIds(list.stream().map(SmTransactionBillVo::getChannelId).filter(Objects::nonNull).distinct().collect(Collectors.toList())); + query.setChannelIds(list.stream().map(TransactionBillVo::getChannelId).filter(Objects::nonNull).distinct().collect(Collectors.toList())); Map map = channelService.selectMap(query, SmChannel::getChannelId); - for (SmTransactionBillVo bill : list) { + for (TransactionBillVo bill : list) { SmChannel channel = map.get(bill.getChannelId()); if (channel != null) { bill.setChannelName(channel.getName()); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/SmTransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java similarity index 74% rename from smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/SmTransactionBillServiceImpl.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index 503731ce..17774039 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/SmTransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -16,13 +16,13 @@ import com.ruoyi.ss.store.domain.StoreVo; import com.ruoyi.ss.store.service.IStoreService; import com.ruoyi.ss.suit.domain.SuitVo; import com.ruoyi.ss.suit.service.ISuitService; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; -import com.ruoyi.ss.transactionBill.domain.bo.SmTransactionBillBO; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillQuery; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillVo; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; +import com.ruoyi.ss.transactionBill.domain.bo.TransactionBillBO; +import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; +import com.ruoyi.ss.transactionBill.domain.TransactionBillVo; import com.ruoyi.ss.transactionBill.domain.enums.*; -import com.ruoyi.ss.transactionBill.mapper.SmTransactionBillMapper; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.mapper.TransactionBillMapper; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.transactionBill.service.TransactionBillValidator; import com.ruoyi.ss.user.domain.SmUserVo; import com.ruoyi.ss.user.mapper.SmUserMapper; @@ -43,6 +43,7 @@ import com.ruoyi.common.utils.CollectionUtils; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; +import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -54,9 +55,9 @@ import java.util.stream.Collectors; */ @Service("transactionBillService") @Slf4j -public class SmTransactionBillServiceImpl implements ISmTransactionBillService { +public class TransactionBillServiceImpl implements TransactionBillService { @Autowired - private SmTransactionBillMapper smTransactionBillMapper; + private TransactionBillMapper transactionBillMapper; @Autowired private ISmChannelService channelService; @@ -94,6 +95,9 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Autowired private ISuitService suitService; + @Autowired + private ScheduledExecutorService scheduledExecutorService; + @Value("${sm.withdraw.password.enable}") private Boolean smWithdrawPasswordEnable; // 是否开启提现密码 @@ -104,9 +108,9 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { * @return 充值记录 */ @Override - public SmTransactionBillVo selectSmTransactionBillByBillId(Long billId) + public TransactionBillVo selectSmTransactionBillByBillId(Long billId) { - return smTransactionBillMapper.selectSmTransactionBillByBillId(billId); + return transactionBillMapper.selectSmTransactionBillByBillId(billId); } /** @@ -116,36 +120,36 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { * @return 充值记录 */ @Override - public List selectSmTransactionBillList(SmTransactionBillQuery smTransactionBillQuery) + public List selectSmTransactionBillList(TransactionBillQuery smTransactionBillQuery) { - return smTransactionBillMapper.selectSmTransactionBillList(smTransactionBillQuery); + return transactionBillMapper.selectSmTransactionBillList(smTransactionBillQuery); } /** * 新增充值记录 * - * @param smTransactionBill 充值记录 + * @param transactionBill 充值记录 * @return 结果 */ @Override @Transactional - public int insertSmTransactionBill(SmTransactionBill smTransactionBill) + public int insertSmTransactionBill(TransactionBill transactionBill) { - smTransactionBill.setCreateTime(DateUtils.getNowDate()); - smTransactionBill.setBillNo(String.valueOf(SnowFlakeUtil.newId())); - return smTransactionBillMapper.insertSmTransactionBill(smTransactionBill); + transactionBill.setCreateTime(DateUtils.getNowDate()); + transactionBill.setBillNo(String.valueOf(SnowFlakeUtil.newId())); + return transactionBillMapper.insertSmTransactionBill(transactionBill); } /** * 修改充值记录 * - * @param smTransactionBill 充值记录 + * @param transactionBill 充值记录 * @return 结果 */ @Override - public int updateSmTransactionBill(SmTransactionBill smTransactionBill) + public int updateSmTransactionBill(TransactionBill transactionBill) { - return smTransactionBillMapper.updateSmTransactionBill(smTransactionBill); + return transactionBillMapper.updateSmTransactionBill(transactionBill); } /** @@ -157,7 +161,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Override public int deleteSmTransactionBillByBillIds(Long[] billIds) { - return smTransactionBillMapper.deleteSmTransactionBillByBillIds(billIds); + return transactionBillMapper.deleteSmTransactionBillByBillIds(billIds); } /** @@ -169,7 +173,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Override public int deleteSmTransactionBillByBillId(Long billId) { - return smTransactionBillMapper.deleteSmTransactionBillByBillId(billId); + return transactionBillMapper.deleteSmTransactionBillByBillId(billId); } /** @@ -178,18 +182,18 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { * @return */ @Override - public List selectCount(SmTransactionBillQuery dto) { - return smTransactionBillMapper.selectCount(dto); + public List selectCount(TransactionBillQuery dto) { + return transactionBillMapper.selectCount(dto); } @Override @Transactional(rollbackFor = Exception.class) - public String addOrder(SmTransactionBill data) { + public String addOrder(TransactionBill data) { // 校验 ServiceUtil.assertion(transactionBillValidator.preAddOrder(data)); // 下单 - SmTransactionBill order = parseToOrder(data); + TransactionBill order = parseToOrder(data); ServiceUtil.assertion(this.insertSmTransactionBill(order) != 1, "下单失败"); // 加入延时队列,超时取消 @@ -199,8 +203,8 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { } // 转换为订单所需的数据 - private SmTransactionBill parseToOrder(SmTransactionBill data) { - SmTransactionBill order = new SmTransactionBill(); + private TransactionBill parseToOrder(TransactionBill data) { + TransactionBill order = new TransactionBill(); // 基础信息 order.setUserId(data.getUserId()); order.setSuitTime(data.getSuitTime()); @@ -251,7 +255,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Override @Transactional(rollbackFor = Exception.class) - public String addWithdraw(SmTransactionBillBO data) { + public String addWithdraw(TransactionBillBO data) { Long userId = data.getUserId(); // 参数校验 ServiceUtil.assertion(userId == null, "参数错误:用户id为空"); @@ -300,7 +304,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { SmUserVo afterUser = smUserMapper.selectSimpleById(userId); // 创建申请订单 - SmTransactionBill bill = new SmTransactionBill(); + TransactionBill bill = new TransactionBill(); bill.setUserId(userId); bill.setType(TransactionBillType.WITHDRAW.getType()); bill.setMchId(userId); @@ -331,7 +335,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { try { ServiceUtil.assertion(!redisLock.lock(RedisLockKey.APPROVAL_WITHDRAW, billId.toString()), "该提现申请正在审核,请刷新后重试"); - int updateCount = smTransactionBillMapper.doPassWithdraw(billId, remark); + int updateCount = transactionBillMapper.doPassWithdraw(billId, remark); ServiceUtil.assertion(updateCount != 1, "提现审核失败,请刷新后重试"); return true; @@ -346,11 +350,11 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { try { ServiceUtil.assertion(!redisLock.lock(RedisLockKey.APPROVAL_WITHDRAW, billId.toString()), "该提现申请正在审核,请刷新后重试"); - int updateCount = smTransactionBillMapper.doRejectWithdraw(billId, remark); + int updateCount = transactionBillMapper.doRejectWithdraw(billId, remark); ServiceUtil.assertion(updateCount != 1, "提现审核失败,请刷新后重试"); // 返还客户余额 - SmTransactionBill bill = smTransactionBillMapper.selectSmTransactionBillByBillId(billId); + TransactionBill bill = transactionBillMapper.selectSmTransactionBillByBillId(billId); ServiceUtil.assertion(bill == null || bill.getUserId() == null, "数据不存在"); userService.addBalance(bill.getUserId(), bill.getMoney()); @@ -371,11 +375,11 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { try { ServiceUtil.assertion(!redisLock.lock(RedisLockKey.PAY_WITHDRAW, billId.toString()), "该提现申请正在打款,请刷新后重试"); - SmTransactionBill bill = smTransactionBillMapper.selectSmTransactionBillByBillId(billId); + TransactionBill bill = transactionBillMapper.selectSmTransactionBillByBillId(billId); ServiceUtil.assertion(bill == null, "单据不存在"); // 更新为打款中 - int updateCount = smTransactionBillMapper.doPayWithdraw(billId); + int updateCount = transactionBillMapper.doPayWithdraw(billId); ServiceUtil.assertion(updateCount != 1, "单据状态发生变化,请刷新后重试"); // 发起打款 @@ -396,7 +400,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Transactional public void withdrawSuccess(Long billId) { // 修改状态 - int updateCount = smTransactionBillMapper.withdrawSuccess(billId); + int updateCount = transactionBillMapper.withdrawSuccess(billId); ServiceUtil.assertion(updateCount != 1, "单据状态发生变化,请刷新后重试"); } @@ -404,7 +408,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Transactional public void withdrawFailed(Long billId) { // 修改状态 - int updateCount = smTransactionBillMapper.withdrawFailed(billId); + int updateCount = transactionBillMapper.withdrawFailed(billId); ServiceUtil.assertion(updateCount != 1, "单据状态发生变化,请刷新后重试"); } @@ -416,14 +420,14 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Override public boolean updateWxTransferDetailIds(Long billId, List transferIds) { ServiceUtil.assertion(billId == null || CollectionUtils.isEmpty(transferIds), "参数错误:提现单号或微信批次明细列表为空"); - SmTransactionBill bill = new SmTransactionBill(); + TransactionBill bill = new TransactionBill(); bill.setBillId(billId); bill.setTransferIds(transferIds); - return smTransactionBillMapper.updateSmTransactionBill(bill) == 1; + return transactionBillMapper.updateSmTransactionBill(bill) == 1; } @Override - public List selectLandlordCount(SmTransactionBillQuery dto) { + public List selectLandlordCount(TransactionBillQuery dto) { List list = this.selectCount(dto); // 若startDate与endDate不为空,则将其中间数据补全,不让其为空 @@ -463,16 +467,16 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Override @Transactional public void refreshPayResult(List billIds) { - SmTransactionBillQuery dto = new SmTransactionBillQuery(); + TransactionBillQuery dto = new TransactionBillQuery(); dto.setBillIds(billIds); - List billList = smTransactionBillMapper.selectSmTransactionBillList(dto); + List billList = transactionBillMapper.selectSmTransactionBillList(dto); if (CollectionUtils.isEmpty(billList)) { return; } // 获取支付结果,并判断是否支付成功,若成功则更新数据 Date now = new Date(); - for (SmTransactionBillVo bill : billList) { + for (TransactionBillVo bill : billList) { if (TransactionBillStatus.PAYING.getStatus().equals(bill.getStatus()) || TransactionBillStatus.UNPAID.getStatus().equals(bill.getStatus()) ) { boolean payResult = getPayResult(bill.getBillNo()); if (payResult) { @@ -486,7 +490,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Transactional public void paying(Long billId) { ServiceUtil.assertion(billId == null, "订单id不允许为空"); - int updateCount = smTransactionBillMapper.paying(billId); + int updateCount = transactionBillMapper.paying(billId); ServiceUtil.assertion(updateCount != 1, "订单状态发生变化,请刷新后重试"); } @@ -500,7 +504,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { public boolean rechargeDevice(Long billId, boolean validate) { ServiceUtil.assertion(billId == null, "参数错误,billId不允许为空"); - SmTransactionBill bill = smTransactionBillMapper.selectSmTransactionBillByBillId(billId); + TransactionBill bill = transactionBillMapper.selectSmTransactionBillByBillId(billId); if (validate) { ServiceUtil.assertion(bill == null || !TransactionBillType.RECHARGE.getType().equals(bill.getType()), "不存在的充值订单"); @@ -512,7 +516,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { // deviceService.addElectricity(bill.getDeviceId(), computeElectricity(bill)); // 修改设备充值状态:成功 - smTransactionBillMapper.updateDeviceRechargeStatus(bill.getBillId(), TransactionBillDeviceRechargeStatus.SUCCESS.getStatus()); + transactionBillMapper.updateDeviceRechargeStatus(bill.getBillId(), TransactionBillDeviceRechargeStatus.SUCCESS.getStatus()); return true; } @@ -527,11 +531,11 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Transactional public int updatePayType(Long billId, TransactionBillPayType transactionBillPayType, String accountNo) { ServiceUtil.assertion( billId == null, "订单id不允许为空"); - SmTransactionBill dbBill = smTransactionBillMapper.selectSmTransactionBillByBillId(billId); + TransactionBill dbBill = transactionBillMapper.selectSmTransactionBillByBillId(billId); ServiceUtil.assertion(dbBill == null, "订单不存在"); ServiceUtil.assertion(!TransactionBillStatus.UNPAID.getStatus().equals(dbBill.getStatus()), "只有未支付的订单可以更改支付方式"); - return smTransactionBillMapper.updatePayType(billId, transactionBillPayType.getType(), accountNo); + return transactionBillMapper.updatePayType(billId, transactionBillPayType.getType(), accountNo); } /** @@ -543,7 +547,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Transactional public boolean getPayResult(String billNo) { // 查询订单 - SmTransactionBill bill = smTransactionBillMapper.selectSmTransactionBillByBillNo(billNo); + TransactionBill bill = transactionBillMapper.selectSmTransactionBillByBillNo(billNo); ServiceUtil.assertion(bill == null, "订单不存在"); if (TransactionBillPayType.WECHAT.getType().equals(bill.getChannelId())) { @@ -563,11 +567,11 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { @Override @Transactional public void rechargeSuccess(String billNo, Date payTime) { - SmTransactionBill bill = smTransactionBillMapper.selectSmTransactionBillByBillNo(billNo); + TransactionBill bill = transactionBillMapper.selectSmTransactionBillByBillNo(billNo); ServiceUtil.assertion(bill == null || !TransactionBillType.RECHARGE.getType().equals(bill.getType()), "充值订单不存在"); // 修改订单状态为成功 - int updateCount = smTransactionBillMapper.rechargeSuccess(bill.getBillId(), payTime); + int updateCount = transactionBillMapper.rechargeSuccess(bill.getBillId(), payTime); ServiceUtil.assertion(updateCount != 1, "修改订单状态失败,请刷新后重试"); // 房东余额增加 @@ -583,7 +587,7 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { } // 计算充值电量 -// private BigDecimal computeElectricity(SmTransactionBill bill) { +// private BigDecimal computeElectricity(TransactionBill bill) { // if (bill == null) { // return BigDecimal.ZERO; // } @@ -596,10 +600,10 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { * @param balance 余额 */ private void updateAfterBalance(Long billId, BigDecimal balance) { - SmTransactionBill data = new SmTransactionBill(); + TransactionBill data = new TransactionBill(); data.setBillId(billId); data.setAfterBalance(balance); - smTransactionBillMapper.updateSmTransactionBill(data); + transactionBillMapper.updateSmTransactionBill(data); } /** @@ -612,35 +616,36 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { public int cancelRecharge(String billNo, TransactionBillStatus status) { ServiceUtil.assertion(!TransactionBillStatus.isCancel(status.getStatus()), "参数错误:状态并非取消状态"); - SmTransactionBill bill = smTransactionBillMapper.selectSmTransactionBillByBillNo(billNo); + TransactionBill bill = transactionBillMapper.selectSmTransactionBillByBillNo(billNo); ServiceUtil.assertion(bill == null, "订单不存在"); // 用户自行取消,验证身份 ServiceUtil.assertion(TransactionBillStatus.CANCELED.equals(status) && !UserUtil.hasFrontUser(bill.getUserId()), "这不是您的订单"); - ServiceUtil.assertion(!TransactionBillStatus.UNPAID.getStatus().equals(bill.getStatus()), "订单状态非未支付,不允许取消"); + List allowCancel = Arrays.asList(TransactionBillStatus.UNPAID.getStatus(), TransactionBillStatus.PAYING.getStatus()); + ServiceUtil.assertion(!allowCancel.contains(bill.getStatus()), "订单状态非未支付或支付中,不允许取消"); ServiceUtil.assertion(!TransactionBillType.RECHARGE.getType().equals(bill.getType()), "非充值订单,不允许取消"); // 执行取消订单 - int updateCount = smTransactionBillMapper.cancelRecharge(billNo, status.getStatus()); + int updateCount = transactionBillMapper.cancelRecharge(billNo, status.getStatus()); ServiceUtil.assertion(updateCount != 1, "订单取消失败,请刷新后重试"); // 关闭支付订单 - if (TransactionBillPayType.WECHAT.getType().equals(bill.getChannelId())) { - wxPayService.closeOrder(billNo); + if (TransactionBillStatus.PAYING.getStatus().equals(bill.getStatus())) { + this.closeOrder(billNo); } return updateCount; } @Override - public SmTransactionBill selectSmTransactionBillByBillNo(String billNo) { - return smTransactionBillMapper.selectSmTransactionBillByBillNo(billNo); + public TransactionBill selectSmTransactionBillByBillNo(String billNo) { + return transactionBillMapper.selectSmTransactionBillByBillNo(billNo); } @Override - public List selectUnpaidRecharge() { - SmTransactionBillQuery dto = new SmTransactionBillQuery(); - dto.setStatus(TransactionBillStatus.UNPAID.getStatus()); + public List selectNoPayedRecharge() { + TransactionBillQuery dto = new TransactionBillQuery(); + dto.setStatusList(Arrays.asList(TransactionBillStatus.UNPAID.getStatus(), TransactionBillStatus.PAYING.getStatus())); dto.setType(TransactionBillType.RECHARGE.getType()); return this.selectSmTransactionBillList(dto); } @@ -652,22 +657,22 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { * @return */ @Override - public List selectDeviceRechargeFailList(Long userId) { + public List selectDeviceRechargeFailList(Long userId) { if (userId == null) { return Collections.emptyList(); } // 查询充值失败列表 - SmTransactionBillQuery dto = new SmTransactionBillQuery(); + TransactionBillQuery dto = new TransactionBillQuery(); dto.setUserId(userId); dto.setStatus(TransactionBillStatus.SUCCESS.getStatus()); dto.setDeviceRechargeStatus(TransactionBillDeviceRechargeStatus.FAIL.getStatus()); dto.setType(TransactionBillType.RECHARGE.getType()); - List list = this.selectSmTransactionBillList(dto); + List list = this.selectSmTransactionBillList(dto); if (!CollectionUtils.isEmptyElement(list)) { // 修改状态为蓝牙充值 - smTransactionBillMapper.updateDeviceRechargeStatusByIds( - list.stream().map(SmTransactionBillVo::getBillId).collect(Collectors.toList()), + transactionBillMapper.updateDeviceRechargeStatusByIds( + list.stream().map(TransactionBillVo::getBillId).collect(Collectors.toList()), TransactionBillDeviceRechargeStatus.BLUETOOTH.getStatus()); } @@ -675,4 +680,70 @@ public class SmTransactionBillServiceImpl implements ISmTransactionBillService { dto.setDeviceRechargeStatus(TransactionBillDeviceRechargeStatus.BLUETOOTH.getStatus()); return selectSmTransactionBillList(dto); } + + + /** + * 查询支付结果,直到过期 + * + * @param billNo 订单编号 + * @param delay 延迟时间 + * @param timeUnit 时间单位 + */ + @Override + @Transactional + public void refreshPayResultBeforeExpire(String billNo, int delay, TimeUnit timeUnit) { + TransactionBill bill = transactionBillMapper.selectSmTransactionBillByBillNo(billNo); + if (bill == null) { + log.error("获取订单{}为空", billNo); + return; + } + Date now = new Date(); + boolean payResult = false; + + // 判断是否支付成功 + try { + if (TransactionBillStatus.PAYING.getStatus().equals(bill.getStatus())) { + payResult = getPayResult(bill.getBillNo()); + if (payResult) { + // 支付成功 + this.rechargeSuccess(bill.getBillNo(), now); + return; + } + } + } catch (Exception e) { + log.error("刷新支付结果出错:{}", e.getMessage()); + } + + // 未支付成功 + if (!payResult) { + if (bill.getExpireTime() != null && now.compareTo(bill.getExpireTime()) < 0) { + // 未过期,继续延迟查询 + log.info("{}支付失败,未过期,继续延迟查询", billNo); + scheduledExecutorService.schedule(() -> { + this.refreshPayResultBeforeExpire(billNo, delay , timeUnit); + }, delay, timeUnit); + } else { + log.info("{}支付失败,过期取消订单", billNo); + // 过期取消订单 + int updateCount = transactionBillMapper.cancelRecharge(billNo, TransactionBillStatus.SYS_CANCELED.getStatus()); + log.info("过期取消订单,结果:{}", updateCount); + if (updateCount == 1) { + // 关闭支付订单 + this.closeOrder(billNo); + } + } + } + } + + // 关闭订单 + private void closeOrder(String billNo) { + TransactionBill bill = transactionBillMapper.selectSmTransactionBillByBillNo(billNo); + if (bill == null) { + return; + } + + if (TransactionBillPayType.WECHAT.getType().equals(bill.getChannelId())) { + wxPayService.closeOrder(billNo); + } + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java index fb19b538..383d6eee 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java @@ -11,8 +11,8 @@ import com.ruoyi.ss.model.domain.enums.ModelTag; import com.ruoyi.ss.store.service.StoreValidator; import com.ruoyi.ss.suit.domain.SuitVo; import com.ruoyi.ss.suit.service.ISuitService; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.transactionBill.service.TransactionBillValidator; import com.ruoyi.ss.user.service.UserValidator; import org.springframework.beans.factory.annotation.Autowired; @@ -45,10 +45,10 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans private StoreValidator storeValidator; @Autowired - private ISmTransactionBillService transactionBillService; + private TransactionBillService transactionBillService; @Override - public ValidateResult preAddOrder(SmTransactionBill data) { + public ValidateResult preAddOrder(TransactionBill data) { if (data == null) { return error("数据不能为空"); } @@ -128,7 +128,7 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans * @return */ private boolean allowGet(Long billId, Long userId) { - SmTransactionBill bill = transactionBillService.selectSmTransactionBillByBillId(billId); + TransactionBill bill = transactionBillService.selectSmTransactionBillByBillId(billId); if (bill != null ) { List allowUsers = Arrays.asList(bill.getUserId(), bill.getMchId()); return allowUsers.contains(userId); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVo.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVo.java index 08a27699..430e27df 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVo.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVo.java @@ -1,6 +1,8 @@ package com.ruoyi.ss.user.domain; +import com.fasterxml.jackson.annotation.JsonView; import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.JsonViewProfile; import com.ruoyi.common.core.domain.entity.SmUser; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -29,4 +31,8 @@ public class SmUserVo extends SmUser { @ApiModelProperty("总收入") private BigDecimal totalIncome; // 总收入 + + @ApiModelProperty("商户店铺数量") + @JsonView(JsonViewProfile.App.class) + private Integer storeCount; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserAssembler.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserAssembler.java new file mode 100644 index 00000000..3337f1a6 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserAssembler.java @@ -0,0 +1,18 @@ +package com.ruoyi.ss.user.service; + +import com.ruoyi.ss.user.domain.SmUserVo; + +import java.util.List; + +/** + * @author wjh + * 2024/5/6 + */ +public interface UserAssembler { + + /** + * 拼接用户店铺数量 + * @param list + */ + void assembleStoreCount(List list); +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java new file mode 100644 index 00000000..de9e5af5 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java @@ -0,0 +1,44 @@ +package com.ruoyi.ss.user.service.impl; + +import com.ruoyi.common.utils.CollectionUtils; +import com.ruoyi.ss.store.domain.StoreCountVO; +import com.ruoyi.ss.store.domain.StoreQuery; +import com.ruoyi.ss.store.service.IStoreService; +import com.ruoyi.ss.user.domain.SmUserVo; +import com.ruoyi.ss.user.service.UserAssembler; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author wjh + * 2024/5/6 + */ +@Service +public class UserAssemblerImpl implements UserAssembler { + + @Autowired + private IStoreService storeService; + + /** + * 拼接用户店铺数量 + * + * @param list + */ + @Override + public void assembleStoreCount(List list) { + if (CollectionUtils.isEmptyElement(list)) { + return; + } + + Map map = storeService.selectCountMapByUserIds(list.stream().map(SmUserVo::getUserId).collect(Collectors.toList())); + + for (SmUserVo user : list) { + Integer count = map.get(user.getUserId()); + user.setStoreCount(count == null ? 0 : count); + } + } +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/wxPay/service/WxPayService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/wxPay/service/WxPayService.java index b2429ebc..15f0c979 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/wxPay/service/WxPayService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/wxPay/service/WxPayService.java @@ -11,11 +11,11 @@ import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.SnowFlakeUtil; import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.ss.account.service.ISmAccountService; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillPayType; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.user.domain.SmUserVo; import com.ruoyi.ss.user.service.ISmUserService; import com.ruoyi.ss.wxPay.domain.enums.TransferScene; @@ -44,6 +44,8 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; /** @@ -65,7 +67,7 @@ public class WxPayService implements IWxPayService { private WxPayConfig wxPayConfig; @Autowired - private ISmTransactionBillService transactionBillService; + private TransactionBillService transactionBillService; @Autowired private ISmUserService smUserService; @@ -85,6 +87,9 @@ public class WxPayService implements IWxPayService { @Autowired private TransferBatchService transferBatchService; + @Autowired + private ScheduledExecutorService scheduledExecutorService; + private static final String CNY = "CNY"; @Override @@ -93,7 +98,7 @@ public class WxPayService implements IWxPayService { try { ServiceUtil.assertion(!redisLock.lock(RedisLockKey.PREPAY.getKey() + ":" + billNo), "当前订单正在支付,请刷新后重试"); - SmTransactionBill bill = transactionBillService.selectSmTransactionBillByBillNo(billNo); + TransactionBill bill = transactionBillService.selectSmTransactionBillByBillNo(billNo); ServiceUtil.assertion(bill == null, "未查询到相关订单"); ServiceUtil.assertion(!Objects.equals(bill.getChannelId(), TransactionBillPayType.WECHAT.getType()), "该订单不是微信支付订单"); ServiceUtil.assertion(!TransactionBillStatus.UNPAID.getStatus().equals(bill.getStatus()), "只能支付未支付的订单"); @@ -117,7 +122,14 @@ public class WxPayService implements IWxPayService { // 支付中 try { + // 支付中 transactionBillService.paying(bill.getBillId()); + + // 每隔20秒查询支付结果,直到过期,首次10秒查询 + scheduledExecutorService.schedule(() -> { + transactionBillService.refreshPayResultBeforeExpire(bill.getBillNo(), 20, TimeUnit.SECONDS); + }, 10, TimeUnit.SECONDS); + } catch (Exception e) { this.closeOrder(bill.getBillNo()); throw e; @@ -209,7 +221,7 @@ public class WxPayService implements IWxPayService { @Transactional public InitiateBatchTransferResponse payWithdraw(Long billId) { ServiceUtil.assertion(billId == null, "订单id不允许为空"); - SmTransactionBill bill = transactionBillService.selectSmTransactionBillByBillId(billId); + TransactionBill bill = transactionBillService.selectSmTransactionBillByBillId(billId); ServiceUtil.assertion(bill == null, "单据不存在"); ServiceUtil.assertion(TransactionBillStatus.WITHDRAW_PASSED.getStatus().equals(bill.getStatus()), "当前提现单据状态异常"); ServiceUtil.assertion(StringUtils.isBlank(bill.getAccountNo()), "提现账号异常"); @@ -248,7 +260,7 @@ public class WxPayService implements IWxPayService { if (NotifyEventType.MCHTRANSFER_BATCH_FINISHED.getValue().equals(notification.getEventType())) { // 验签、解密并转换成 TransferBatchGet TransferBatchGet transferBatchGet = checkAndParse(request, body, TransferBatchGet.class); - SmTransactionBill bill = transactionBillService.selectSmTransactionBillByBillNo(transferBatchGet.getOutBatchNo()); + TransactionBill bill = transactionBillService.selectSmTransactionBillByBillNo(transferBatchGet.getOutBatchNo()); ServiceUtil.assertion(bill == null, "订单不存在"); // 修改订单状态 @@ -306,7 +318,7 @@ public class WxPayService implements IWxPayService { * @param plaintext 明文 */ private void saveNotifyData(String billNo, Notification body, Object plaintext) { - SmTransactionBill bill = transactionBillService.selectSmTransactionBillByBillNo(billNo); + TransactionBill bill = transactionBillService.selectSmTransactionBillByBillNo(billNo); SmWxPayNotify data = new SmWxPayNotify(); data.setNotifyId(body.getId()); data.setBillId(bill.getBillId()); @@ -348,7 +360,7 @@ public class WxPayService implements IWxPayService { return amount; } - private String getDescription(SmTransactionBill bill) { + private String getDescription(TransactionBill bill) { return TransactionBillType.parse(bill.getType()).getDescription(); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillDelayed.java b/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillDelayed.java index 94b125a9..08c85d73 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillDelayed.java +++ b/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillDelayed.java @@ -2,7 +2,7 @@ package com.ruoyi.task.bill; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.wxPay.service.IWxPayService; import com.ruoyi.ss.wxPay.service.WxPayService; import lombok.Getter; @@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit; @Setter public class BillDelayed implements Delayed { - private ISmTransactionBillService transactionBillService; + private TransactionBillService transactionBillService; private IWxPayService wxPayService = SpringUtils.getBean(WxPayService.class); diff --git a/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillDelayedManager.java b/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillDelayedManager.java index 251d97fe..a5dedd4a 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillDelayedManager.java +++ b/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillDelayedManager.java @@ -1,6 +1,6 @@ package com.ruoyi.task.bill; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -47,7 +47,7 @@ public class BillDelayedManager { @Bean @Scope("prototype") public BillDelayed billDelayed() { - ISmTransactionBillService transactionBillService = context.getBean(ISmTransactionBillService.class); + TransactionBillService transactionBillService = context.getBean(TransactionBillService.class); BillDelayed delayed = new BillDelayed(); delayed.setTransactionBillService(transactionBillService); return delayed; diff --git a/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillStartTask.java b/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillStartTask.java index 1b54a4bc..fd32d826 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillStartTask.java +++ b/smart-switch-service/src/main/java/com/ruoyi/task/bill/BillStartTask.java @@ -1,9 +1,9 @@ package com.ruoyi.task.bill; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillVo; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; +import com.ruoyi.ss.transactionBill.domain.TransactionBillVo; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; @@ -25,7 +25,7 @@ import java.util.stream.Collectors; public class BillStartTask implements ApplicationRunner { @Autowired - private ISmTransactionBillService billService; + private TransactionBillService billService; @Autowired private BillDelayedManager billDelayedManager; @@ -33,7 +33,7 @@ public class BillStartTask implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { log.info("开始处理未支付的充值订单"); - List billList = billService.selectUnpaidRecharge(); + List billList = billService.selectNoPayedRecharge(); if (CollectionUtils.isEmpty(billList)) { log.info("没有需要处理的订单"); return; @@ -42,7 +42,7 @@ public class BillStartTask implements ApplicationRunner { // 未支付已过期 Date now = new Date(); - for (SmTransactionBillVo bill : billList.stream().filter(item -> item.getExpireTime() != null && now.compareTo(item.getExpireTime()) >= 0).collect(Collectors.toList())) { + for (TransactionBillVo bill : billList.stream().filter(item -> item.getExpireTime() != null && now.compareTo(item.getExpireTime()) >= 0).collect(Collectors.toList())) { log.info("[未支付已过期]正在处理:{}", bill.getBillNo()); try { billService.cancelRecharge(bill.getBillNo(), TransactionBillStatus.SYS_CANCELED); @@ -52,7 +52,7 @@ public class BillStartTask implements ApplicationRunner { } // 未支付未过期,加入延时队列 - for (SmTransactionBill bill : billList.stream().filter(item -> item.getExpireTime() != null && now.compareTo(item.getExpireTime()) < 0).collect(Collectors.toList())) { + for (TransactionBill bill : billList.stream().filter(item -> item.getExpireTime() != null && now.compareTo(item.getExpireTime()) < 0).collect(Collectors.toList())) { log.info("[未支付未过期]加入延时队列:{}", bill.getBillNo()); try { billDelayedManager.add(bill.getBillNo(), bill.getExpireTime().getTime()); diff --git a/smart-switch-service/src/main/java/com/ruoyi/task/bill/PayTask.java b/smart-switch-service/src/main/java/com/ruoyi/task/bill/PayTask.java index 24514ed7..635e93da 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/task/bill/PayTask.java +++ b/smart-switch-service/src/main/java/com/ruoyi/task/bill/PayTask.java @@ -1,20 +1,23 @@ package com.ruoyi.task.bill; import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillQuery; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillVo; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; +import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; +import com.ruoyi.ss.transactionBill.domain.TransactionBillVo; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.Date; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; /** @@ -23,10 +26,10 @@ import java.util.stream.Collectors; */ @Component("payTask") @Slf4j -public class PayTask { +public class PayTask implements ApplicationRunner { @Autowired - private ISmTransactionBillService transactionBillService; + private TransactionBillService transactionBillService; /** * 更新支付结果 @@ -36,17 +39,40 @@ public class PayTask { // 查询十分钟以内支付中的充值订单 Date now = new Date(); Date past = DateUtils.addMinutes(now, -10); - SmTransactionBillQuery dto = new SmTransactionBillQuery(); + TransactionBillQuery dto = new TransactionBillQuery(); dto.setStartDate(past); dto.setType(TransactionBillType.RECHARGE.getType()); dto.setStatus(TransactionBillStatus.PAYING.getStatus()); - List billList = transactionBillService.selectSmTransactionBillList(dto); + List billList = transactionBillService.selectSmTransactionBillList(dto); if (CollectionUtils.isEmpty(billList)) { log.info("十分钟以内没有支付中的订单"); return; } - transactionBillService.refreshPayResult(billList.stream().map(SmTransactionBill::getBillId).collect(Collectors.toList())); + transactionBillService.refreshPayResult(billList.stream().map(TransactionBill::getBillId).collect(Collectors.toList())); } + + @Override + public void run(ApplicationArguments args) throws Exception { + // 查询支付中的充值订单,将其加入到延迟队列 + log.info("查询支付中的充值订单,将其加入到延迟队列"); + TransactionBillQuery dto = new TransactionBillQuery(); + dto.setStatus(TransactionBillStatus.PAYING.getStatus()); + dto.setType(TransactionBillType.RECHARGE.getType()); + List list = transactionBillService.selectSmTransactionBillList(dto); + if (CollectionUtils.isEmpty(list)) { + log.info("没有支付中的订单"); + return; + } + + log.info("查询到{}个正在支付的订单", list.size()); + for (TransactionBillVo bill : list) { + try { + transactionBillService.refreshPayResultBeforeExpire(bill.getBillNo(), 20, TimeUnit.SECONDS); + } catch (Exception e) { + log.error("加入延迟队列异常:{} ", bill.getBillNo()); + } + } + } } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppPayController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppPayController.java index cbfa7d88..bffc8d3b 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppPayController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppPayController.java @@ -1,7 +1,7 @@ package com.ruoyi.web.controller.app; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.wxPay.service.IWxPayService; import com.wechat.pay.java.core.exception.ValidationException; import io.swagger.annotations.Api; @@ -27,7 +27,7 @@ public class AppPayController { private IWxPayService wxPayService; @Autowired - private ISmTransactionBillService transactionBillService; + private TransactionBillService transactionBillService; @ApiOperation("微信支付") @GetMapping("/wx/{billNo}") diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java index 64031fb9..bc084c4a 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java @@ -9,15 +9,15 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.UserType; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ServiceUtil; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; -import com.ruoyi.ss.transactionBill.domain.bo.SmTransactionBillBO; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillQuery; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; +import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; +import com.ruoyi.ss.transactionBill.domain.bo.TransactionBillBO; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillGroupBy; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillVo; +import com.ruoyi.ss.transactionBill.domain.TransactionBillVo; import com.ruoyi.ss.dashboard.BillCountVo; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.transactionBill.service.TransactionAssembler; import com.ruoyi.ss.transactionBill.service.TransactionBillValidator; import com.ruoyi.web.core.annotation.UserTypePermission; @@ -46,7 +46,7 @@ import java.util.Objects; public class AppTransactionBillController extends BaseController { @Autowired - private ISmTransactionBillService smTransactionBillService; + private TransactionBillService smTransactionBillService; @Autowired private TransactionAssembler transactionAssembler; @@ -60,12 +60,12 @@ public class AppTransactionBillController extends BaseController @ApiOperation("查询本人订单列表") @GetMapping("/rechargeList") @JsonView(JsonViewProfile.App.class) - public TableDataInfo rechargeList(SmTransactionBillQuery smTransactionBill) + public TableDataInfo rechargeList(TransactionBillQuery smTransactionBill) { smTransactionBill.setUserId(getUserId()); smTransactionBill.setType(TransactionBillType.RECHARGE.getType()); startPage(); - List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); + List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); transactionAssembler.assembleChannelName(list); return getDataTable(list); } @@ -75,12 +75,12 @@ public class AppTransactionBillController extends BaseController */ @ApiOperation("查询本人提现记录列表") @GetMapping("/withdrawList") - public TableDataInfo withdrawList(SmTransactionBillQuery smTransactionBill) + public TableDataInfo withdrawList(TransactionBillQuery smTransactionBill) { startPage(); smTransactionBill.setUserId(getUserId()); smTransactionBill.setType(TransactionBillType.WITHDRAW.getType()); - List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); + List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); return getDataTable(list); } @@ -89,11 +89,11 @@ public class AppTransactionBillController extends BaseController */ @ApiOperation("查询本人收支列表") @GetMapping("/list") - public TableDataInfo list(SmTransactionBillQuery smTransactionBill) + public TableDataInfo list(TransactionBillQuery smTransactionBill) { startPage(); smTransactionBill.setUserId(getUserId()); - List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); + List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); return getDataTable(list); } @@ -102,7 +102,7 @@ public class AppTransactionBillController extends BaseController @JsonView(JsonViewProfile.AppUser.class) public AjaxResult detail(@PathVariable Long billId) { ServiceUtil.assertion(transactionBillValidator.preGetDetailByApp(billId, getUserId())); - SmTransactionBillVo bill = smTransactionBillService.selectSmTransactionBillByBillId(billId); + TransactionBillVo bill = smTransactionBillService.selectSmTransactionBillByBillId(billId); transactionAssembler.assembleChannelName(Collections.singletonList(bill)); return AjaxResult.success(bill); } @@ -110,7 +110,7 @@ public class AppTransactionBillController extends BaseController @UserTypePermission({UserType.LANDLORD}) @ApiOperation("获取房东统计信息") @GetMapping("/landlordCount") - public AjaxResult landlordCount(@Validated({ValidGroup.Query.class}) SmTransactionBillQuery dto) { + public AjaxResult landlordCount(@Validated({ValidGroup.Query.class}) TransactionBillQuery dto) { Date now = new Date(); if (dto.getEndDate() == null) { dto.setEndDate(now); @@ -158,7 +158,7 @@ public class AppTransactionBillController extends BaseController @ApiOperation("创建订单") @PostMapping("/recharge") - public AjaxResult addRecharge(@RequestBody @Validated({ValidGroup.Recharge.class}) SmTransactionBill body) { + public AjaxResult addRecharge(@RequestBody @Validated({ValidGroup.Recharge.class}) TransactionBill body) { body.setUserId(getUserId()); body.setChannelId(1L); // 微信支付 return AjaxResult.success("操作成功", smTransactionBillService.addOrder(body)); @@ -173,7 +173,7 @@ public class AppTransactionBillController extends BaseController @UserTypePermission({UserType.LANDLORD}) @ApiOperation("提现申请") @PostMapping("/withdraw") - public AjaxResult withdraw(@RequestBody @Validated({ValidGroup.Withdraw.class}) SmTransactionBillBO data) { + public AjaxResult withdraw(@RequestBody @Validated({ValidGroup.Withdraw.class}) TransactionBillBO data) { data.setUserId(getUserId()); return AjaxResult.success("操作成功", smTransactionBillService.addWithdraw(data)); } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppUserController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppUserController.java index 3ffde064..0a3d9b83 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppUserController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppUserController.java @@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.JsonViewProfile; import com.ruoyi.common.enums.UserType; import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.ss.user.domain.SmUserBO; +import com.ruoyi.ss.user.service.UserAssembler; import com.ruoyi.system.domain.enums.verificationCode.CodeBusinessType; import com.ruoyi.ss.user.domain.SmUserVo; import com.ruoyi.ss.user.service.ISmUserService; @@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Collections; +import java.util.List; /** * 用户信息Controller @@ -34,13 +36,18 @@ public class AppUserController extends BaseController { @Autowired private IVerificationCodeService verificationCodeService; + @Autowired + private UserAssembler userAssembler; + @ApiOperation("获取当前登录前台用户的信息") @GetMapping("/userInfo") @JsonView(JsonViewProfile.App.class) public AjaxResult userInfo() { // 查询 SmUserVo user = userService.selectSmUserByUserId(getUserId()); - userService.desensitization(Collections.singletonList(user)); + List list = Collections.singletonList(user); + userService.desensitization(list); + userAssembler.assembleStoreCount(list); return AjaxResult.success(user); } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDashboardController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDashboardController.java index d942955e..43a08b70 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDashboardController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDashboardController.java @@ -7,8 +7,8 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriodQuery; import com.ruoyi.ss.balancePeriod.service.ISmBalancePeriodService; import com.ruoyi.ss.businessRecord.service.ISmBusinessRecordService; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillQuery; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillGroupBy; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordVo; @@ -34,7 +34,7 @@ public class SmDashboardController { @Autowired - private ISmTransactionBillService transactionBillService; + private TransactionBillService transactionBillService; @Autowired private ISmBalancePeriodService balancePeriodService; @@ -68,7 +68,7 @@ public class SmDashboardController { * @return 统计数据 */ @GetMapping("/hourBillCount") - public AjaxResult hourBillCount(@Validated(ValidGroup.Query.class) SmTransactionBillQuery dto) { + public AjaxResult hourBillCount(@Validated(ValidGroup.Query.class) TransactionBillQuery dto) { dto.setGroupBy(TransactionBillGroupBy.create_hour.name()); dto.setStatus(TransactionBillStatus.SUCCESS.getStatus()); return AjaxResult.success(transactionBillService.selectCount(dto)); diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmTransactionBillController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmTransactionBillController.java index f8c149d9..74a529ee 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmTransactionBillController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmTransactionBillController.java @@ -4,9 +4,9 @@ import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletResponse; -import com.ruoyi.ss.transactionBill.domain.bo.SmTransactionBillBO; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillQuery; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBillVo; +import com.ruoyi.ss.transactionBill.domain.bo.TransactionBillBO; +import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; +import com.ruoyi.ss.transactionBill.domain.TransactionBillVo; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; @@ -23,8 +23,8 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.ss.transactionBill.domain.SmTransactionBill; -import com.ruoyi.ss.transactionBill.service.ISmTransactionBillService; +import com.ruoyi.ss.transactionBill.domain.TransactionBill; +import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; @@ -39,17 +39,17 @@ import com.ruoyi.common.core.page.TableDataInfo; public class SmTransactionBillController extends BaseController { @Autowired - private ISmTransactionBillService smTransactionBillService; + private TransactionBillService smTransactionBillService; /** * 查询充值记录列表 */ @PreAuthorize("@ss.hasPermi('system:bill:list')") @GetMapping("/list") - public TableDataInfo list(SmTransactionBillQuery smTransactionBill) + public TableDataInfo list(TransactionBillQuery smTransactionBill) { startPage(); - List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); + List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); return getDataTable(list); } @@ -59,10 +59,10 @@ public class SmTransactionBillController extends BaseController @PreAuthorize("@ss.hasPermi('system:bill:export')") @Log(title = "充值记录", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, SmTransactionBillQuery smTransactionBill) + public void export(HttpServletResponse response, TransactionBillQuery smTransactionBill) { - List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); - ExcelUtil util = new ExcelUtil(SmTransactionBillVo.class); + List list = smTransactionBillService.selectSmTransactionBillList(smTransactionBill); + ExcelUtil util = new ExcelUtil(TransactionBillVo.class); util.exportExcel(response, list, "充值记录数据"); } @@ -82,9 +82,9 @@ public class SmTransactionBillController extends BaseController @PreAuthorize("@ss.hasPermi('system:bill:add')") @Log(title = "充值记录", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody SmTransactionBill smTransactionBill) + public AjaxResult add(@RequestBody TransactionBill transactionBill) { - return toAjax(smTransactionBillService.insertSmTransactionBill(smTransactionBill)); + return toAjax(smTransactionBillService.insertSmTransactionBill(transactionBill)); } /** @@ -93,9 +93,9 @@ public class SmTransactionBillController extends BaseController @PreAuthorize("@ss.hasPermi('system:bill:edit')") @Log(title = "充值记录", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody SmTransactionBill smTransactionBill) + public AjaxResult edit(@RequestBody TransactionBill transactionBill) { - return toAjax(smTransactionBillService.updateSmTransactionBill(smTransactionBill)); + return toAjax(smTransactionBillService.updateSmTransactionBill(transactionBill)); } /** @@ -111,7 +111,7 @@ public class SmTransactionBillController extends BaseController @PreAuthorize("@ss.hasPermi('system:bill:query')") @GetMapping("/count") - public AjaxResult count(SmTransactionBillQuery dto) + public AjaxResult count(TransactionBillQuery dto) { return success(smTransactionBillService.selectCount(dto)); } @@ -120,7 +120,7 @@ public class SmTransactionBillController extends BaseController @PreAuthorize("@ss.hasPermi('system:bill:approval')") @PutMapping("/withdraw/pass") @Log(title = "同意提现申请", businessType = BusinessType.UPDATE) - public AjaxResult passWithdraw(@RequestBody SmTransactionBillBO bo) + public AjaxResult passWithdraw(@RequestBody TransactionBillBO bo) { return success(smTransactionBillService.passWithdraw(bo.getBillId(), bo.getRemark())); } @@ -129,7 +129,7 @@ public class SmTransactionBillController extends BaseController @PreAuthorize("@ss.hasPermi('system:bill:approval')") @PutMapping("/withdraw/reject") @Log(title = "拒绝提现申请", businessType = BusinessType.UPDATE) - public AjaxResult rejectWithdraw(@RequestBody SmTransactionBillBO bo) + public AjaxResult rejectWithdraw(@RequestBody TransactionBillBO bo) { return success(smTransactionBillService.rejectWithdraw(bo.getBillId(), bo.getRemark())); } diff --git a/smart-switch-web/src/main/resources/application-dev.yml b/smart-switch-web/src/main/resources/application-dev.yml index cd2066f1..925dd127 100644 --- a/smart-switch-web/src/main/resources/application-dev.yml +++ b/smart-switch-web/src/main/resources/application-dev.yml @@ -14,7 +14,7 @@ wx: # 微信支付配置 pay: # 微信小程序id - appId: wx3914d4d7441fb438 + appId: ${wx.appid} # 商户id merchantId: 1656437344 # apiV3密钥 diff --git a/smart-switch-web/src/main/resources/application-test.yml b/smart-switch-web/src/main/resources/application-test.yml index 806a161d..adc69ccb 100644 --- a/smart-switch-web/src/main/resources/application-test.yml +++ b/smart-switch-web/src/main/resources/application-test.yml @@ -14,7 +14,7 @@ wx: # 微信支付配置 pay: # 微信小程序id - appId: wx3914d4d7441fb438 + appId: ${wx.appid} # 商户id merchantId: 1656437344 # apiV3密钥