# Conflicts:
#	yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
This commit is contained in:
YunaiV 2024-07-21 11:15:04 +08:00
commit a210210b20
24 changed files with 55 additions and 87 deletions

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.framework.jackson.core.databind;
package cn.iocoder.yudao.framework.common.util.json.databind;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.framework.jackson.core.databind;
package cn.iocoder.yudao.framework.common.util.json.databind;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.framework.jackson.core.databind;
package cn.iocoder.yudao.framework.common.util.json.databind;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.framework.excel.core.handler;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
@ -55,12 +54,6 @@ public class SelectSheetWriteHandler implements SheetWriteHandler {
private final Map<Integer, List<String>> selectMap = new HashMap<>();
public SelectSheetWriteHandler(Class<?> head) {
// 加载下拉数据获取接口
Map<String, ExcelColumnSelectFunction> beansMap = SpringUtil.getBeanFactory().getBeansOfType(ExcelColumnSelectFunction.class);
if (MapUtil.isEmpty(beansMap)) {
return;
}
// 解析下拉数据
int colIndex = 0;
for (Field field : head.getDeclaredFields()) {

View File

@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -42,6 +43,10 @@ public class LoginUser {
* 授权范围
*/
private List<String> scopes;
/**
* 过期时间
*/
private LocalDateTime expiresTime;
// ========== 上下文 ==========
/**

View File

@ -84,7 +84,8 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
// 构建登录用户
return new LoginUser().setId(accessToken.getUserId()).setUserType(accessToken.getUserType())
.setInfo(accessToken.getUserInfo()) // 额外的用户信息
.setTenantId(accessToken.getTenantId()).setScopes(accessToken.getScopes());
.setTenantId(accessToken.getTenantId()).setScopes(accessToken.getScopes())
.setExpiresTime(accessToken.getExpiresTime());
} catch (ServiceException serviceException) {
// 校验 Token 不通过时考虑到一些接口是无需登录的所以直接返回 null 即可
return null;

View File

@ -2,9 +2,9 @@ package cn.iocoder.yudao.framework.jackson.config;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.jackson.core.databind.NumberSerializer;
import cn.iocoder.yudao.framework.jackson.core.databind.TimestampLocalDateTimeDeserializer;
import cn.iocoder.yudao.framework.jackson.core.databind.TimestampLocalDateTimeSerializer;
import cn.iocoder.yudao.framework.common.util.json.databind.NumberSerializer;
import cn.iocoder.yudao.framework.common.util.json.databind.TimestampLocalDateTimeDeserializer;
import cn.iocoder.yudao.framework.common.util.json.databind.TimestampLocalDateTimeSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;

View File

@ -77,7 +77,6 @@ public class BpmProcessDefinitionController {
@GetMapping ("/list")
@Operation(summary = "获得流程定义列表")
@Parameter(name = "suspensionState", description = "挂起状态", required = true, example = "1") // 参见 Flowable SuspensionState 枚举
@PreAuthorize("@ss.hasPermission('bpm:process-definition:query')")
public CommonResult<List<BpmProcessDefinitionRespVO>> getProcessDefinitionList(
@RequestParam("suspensionState") Integer suspensionState) {
List<ProcessDefinition> list = processDefinitionService.getProcessDefinitionListBySuspensionState(suspensionState);
@ -96,7 +95,6 @@ public class BpmProcessDefinitionController {
@Operation(summary = "获得流程定义")
@Parameter(name = "id", description = "流程编号", required = true, example = "1024")
@Parameter(name = "key", description = "流程定义标识", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('bpm:process-definition:query')")
public CommonResult<BpmProcessDefinitionRespVO> getProcessDefinition(
@RequestParam(value = "id", required = false) String id,
@RequestParam(value = "key", required = false) String key) {
@ -105,10 +103,11 @@ public class BpmProcessDefinitionController {
if (processDefinition == null) {
return success(null);
}
BpmProcessDefinitionInfoDO processDefinitionInfo = processDefinitionService.getProcessDefinitionInfo(processDefinition.getId());
BpmnModel bpmnModel = processDefinitionService.getProcessDefinitionBpmnModel(processDefinition.getId());
List<UserTask> userTaskList = BpmTaskCandidateStartUserSelectStrategy.getStartUserSelectUserTaskList(bpmnModel);
return success(BpmProcessDefinitionConvert.INSTANCE.buildProcessDefinition(
processDefinition, null, null, null, null, bpmnModel, userTaskList));
processDefinition, null, processDefinitionInfo, null, null, bpmnModel, userTaskList));
}
}

View File

@ -47,7 +47,8 @@ public interface BpmProcessInstanceConvert {
BpmProcessInstanceRespVO respVO = vpPageResult.getList().get(i);
respVO.setStatus(FlowableUtils.getProcessInstanceStatus(pageResult.getList().get(i)));
MapUtils.findAndThen(processDefinitionMap, respVO.getProcessDefinitionId(),
processDefinition -> respVO.setCategory(processDefinition.getCategory()));
processDefinition -> respVO.setCategory(processDefinition.getCategory())
.setProcessDefinition(BeanUtils.toBean(processDefinition, BpmProcessDefinitionRespVO.class)));
MapUtils.findAndThen(categoryMap, respVO.getCategory(), category -> respVO.setCategoryName(category.getName()));
respVO.setTasks(BeanUtils.toBean(taskMap.get(respVO.getId()), BpmProcessInstanceRespVO.Task.class));
// user

View File

@ -10,6 +10,7 @@
<if test="endTime != null">
AND in_time &lt; #{endTime}
</if>
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getRequiredTenantId()}
AND deleted = 0) -
(SELECT IFNULL(SUM(total_price), 0)
FROM erp_purchase_return
@ -17,6 +18,7 @@
<if test="endTime != null">
AND return_time &lt; #{endTime}
</if>
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getRequiredTenantId()}
AND deleted = 0)
</select>

View File

@ -10,6 +10,7 @@
<if test="endTime != null">
AND out_time &lt; #{endTime}
</if>
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getRequiredTenantId()}
AND deleted = 0) -
(SELECT IFNULL(SUM(total_price), 0)
FROM erp_sale_return
@ -17,6 +18,7 @@
<if test="endTime != null">
AND return_time &lt; #{endTime}
</if>
AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getRequiredTenantId()}
AND deleted = 0)
</select>

View File

@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.bargain.BargainRecordStatusEnum;
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -20,7 +20,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
public class CombinationRecordReqPageVO extends PageParam {
@Schema(description = "活动状态", example = "1")
@InEnum(BargainRecordStatusEnum.class)
@InEnum(CombinationRecordStatusEnum.class)
private Integer status;
@Schema(description = "团长编号", example = "1024")

View File

@ -215,7 +215,7 @@ public class CouponServiceImpl implements CouponService {
int count = 0;
for (CouponDO coupon : list) {
try {
boolean success = getSelf().expireCoupon(coupon);
boolean success = expireCoupon(coupon);
if (success) {
count++;
}

View File

@ -7,3 +7,8 @@ tenant-id: {{adminTenentId}}
GET {{baseUrl}}/trade/order/get-detail?id=21
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
### 获得交易订单的物流轨迹 => 成功
GET {{baseUrl}}/trade/order/get-express-track-list?id=21
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}

View File

@ -215,14 +215,13 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
* @return 物流轨迹
*/
@Cacheable(cacheNames = RedisKeyConstants.EXPRESS_TRACK, key = "#code + '-' + #logisticsNo + '-' + #receiverMobile",
condition = "#result != null")
condition = "#result != null && #result.length() > 0")
public List<ExpressTrackRespDTO> getExpressTrackList(String code, String logisticsNo, String receiverMobile) {
return expressClientFactory.getDefaultExpressClient().getExpressTrackList(
new ExpressTrackQueryReqDTO().setExpressCode(code).setLogisticsNo(logisticsNo)
.setPhone(receiverMobile));
}
// =================== Order Item ===================
@Override

View File

@ -23,11 +23,6 @@
<artifactId>yudao-module-pay-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-member-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>

View File

@ -1,11 +1,7 @@
package cn.iocoder.yudao.module.pay.controller.admin.wallet;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserReqVO;
@ -14,6 +10,8 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@ -21,14 +19,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.enums.UserTypeEnum.MEMBER;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
@Tag(name = "管理后台 - 用户钱包")
@RestController
@ -39,38 +31,21 @@ public class PayWalletController {
@Resource
private PayWalletService payWalletService;
@Resource
private MemberUserApi memberUserApi;
@GetMapping("/get")
@PreAuthorize("@ss.hasPermission('pay:wallet:query')")
@Operation(summary = "获得用户钱包明细")
public CommonResult<PayWalletRespVO> getWallet(PayWalletUserReqVO reqVO) {
PayWalletDO wallet = payWalletService.getOrCreateWallet(reqVO.getUserId(), MEMBER.getValue());
// TODO jason如果为空返回给前端只要 null 就可以了
MemberUserRespDTO memberUser = memberUserApi.getUser(reqVO.getUserId());
String nickname = memberUser == null ? "" : memberUser.getNickname();
String avatar = memberUser == null ? "" : memberUser.getAvatar();
return success(PayWalletConvert.INSTANCE.convert02(nickname, avatar, wallet));
return success(PayWalletConvert.INSTANCE.convert02(wallet));
}
@GetMapping("/page")
@Operation(summary = "获得会员钱包分页")
@PreAuthorize("@ss.hasPermission('pay:wallet:query')")
public CommonResult<PageResult<PayWalletRespVO>> getWalletPage(@Valid PayWalletPageReqVO pageVO) {
if (StrUtil.isNotEmpty(pageVO.getNickname())) {
List<MemberUserRespDTO> users = memberUserApi.getUserListByNickname(pageVO.getNickname());
pageVO.setUserIds(convertSet(users, MemberUserRespDTO::getId));
}
// TODO @jason管理员也可以先查询下
// 暂时支持查询 userType 会员类型管理员类型还不知道使用场景
PageResult<PayWalletDO> pageResult = payWalletService.getWalletPage(MEMBER.getValue(),pageVO);
if (CollectionUtil.isEmpty(pageResult.getList())) {
return success(new PageResult<>(pageResult.getTotal()));
}
List<MemberUserRespDTO> users = memberUserApi.getUserList(convertList(pageResult.getList(), PayWalletDO::getUserId));
Map<Long, MemberUserRespDTO> userMap = convertMap(users, MemberUserRespDTO::getId);
return success(PayWalletConvert.INSTANCE.convertPage(pageResult, userMap));
PageResult<PayWalletDO> pageResult = payWalletService.getWalletPage(pageVO);
return success(PayWalletConvert.INSTANCE.convertPage(pageResult));
}
}

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -8,7 +10,6 @@ import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Collection;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -18,11 +19,12 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class PayWalletPageReqVO extends PageParam {
@Schema(description = "用户昵称", example = "李四")
private String nickname;
@Schema(description = "用户编号", example = "1024")
private Long userId;
@Schema(description = "用户编号", example = "[1,2]")
private Collection<Long> userIds;
@Schema(description = "用户类型", example = "1")
@InEnum(value = UserTypeEnum.class)
private Integer userType;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)

View File

@ -19,9 +19,4 @@ public class PayWalletRespVO extends PayWalletBaseVO {
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王**")
private String nickname;
@Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xxx.jpg")
private String avatar;
}

View File

@ -1,16 +1,12 @@
package cn.iocoder.yudao.module.pay.convert.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.Map;
@Mapper
public interface PayWalletConvert {
@ -18,15 +14,8 @@ public interface PayWalletConvert {
AppPayWalletRespVO convert(PayWalletDO bean);
PayWalletRespVO convert02(String nickname,String avatar, PayWalletDO bean);
PayWalletRespVO convert02(PayWalletDO bean);
PageResult<PayWalletRespVO> convertPage(PageResult<PayWalletDO> page);
default PageResult<PayWalletRespVO> convertPage(PageResult<PayWalletDO> page, Map<Long, MemberUserRespDTO> userMap) {
PageResult<PayWalletRespVO> pageResult = convertPage(page);
pageResult.getList().forEach(wallet -> MapUtils.findAndThen(userMap, wallet.getUserId(),
user -> wallet.setNickname(user.getNickname()).setAvatar(user.getAvatar())));
return pageResult;
}
}

View File

@ -17,10 +17,10 @@ public interface PayWalletMapper extends BaseMapperX<PayWalletDO> {
PayWalletDO::getUserType, userType);
}
default PageResult<PayWalletDO> selectPage(Integer userType, PayWalletPageReqVO reqVO) {
default PageResult<PayWalletDO> selectPage(PayWalletPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<PayWalletDO>()
.inIfPresent(PayWalletDO::getUserId, reqVO.getUserIds())
.eqIfPresent(PayWalletDO::getUserType, userType)
.eqIfPresent(PayWalletDO::getUserId, reqVO.getUserId())
.eqIfPresent(PayWalletDO::getUserType, reqVO.getUserType())
.betweenIfPresent(PayWalletDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(PayWalletDO::getId));
}

View File

@ -36,7 +36,7 @@ public interface PayWalletService {
* @param pageReqVO 分页查询
* @return 会员钱包分页
*/
PageResult<PayWalletDO> getWalletPage(Integer userType, PayWalletPageReqVO pageReqVO);
PageResult<PayWalletDO> getWalletPage(PayWalletPageReqVO pageReqVO);
/**
* 钱包订单支付

View File

@ -65,8 +65,8 @@ public class PayWalletServiceImpl implements PayWalletService {
}
@Override
public PageResult<PayWalletDO> getWalletPage(Integer userType,PayWalletPageReqVO pageReqVO) {
return walletMapper.selectPage(userType, pageReqVO);
public PageResult<PayWalletDO> getWalletPage(PayWalletPageReqVO pageReqVO) {
return walletMapper.selectPage(pageReqVO);
}
@Override

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.api.oauth2.dto;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@ -34,5 +35,9 @@ public class OAuth2AccessTokenCheckRespDTO implements Serializable {
* 授权范围的数组
*/
private List<String> scopes;
/**
* 过期时间
*/
private LocalDateTime expiresTime;
}