feat:app流水通知显示备注
feat:咖啡机初步
This commit is contained in:
1 parent
c3e6efe5bc
commit
8aa2cfa104
52 files changed
+2887
-2
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
package com.bsd.pjcloud.thirdparty.api.feign;
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.thirdparty.entity.ThirdKeyManageEntity;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 第三方密钥管理远程调用。密钥为平台级配置,跨租户按 bizType 全局取唯一记录
|
||||
*/
|
||||
@FeignClient(contextId = "remoteThirdKeyManageService", value = ServiceNameConstants.THIRDPARTY_SERVICE)
|
||||
public interface RemoteThirdKeyManageService {
|
||||
|
||||
/**
|
||||
* 按 bizType 跨租户读取平台级密钥配置(咖啡机扫码支付场景匿名请求无租户头)
|
||||
*
|
||||
* @param bizType ThirdKeyTypeEnum 的 type 值
|
||||
* @return 密钥配置;未配置时 data 为空
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/third-key-manage/inner/get-by-biz-type")
|
||||
R<ThirdKeyManageEntity> getByBizType(@RequestParam("bizType") String bizType);
|
||||
}
|
||||
+4
@@ -15,6 +15,10 @@ import java.util.Arrays;
|
||||
public enum ThirdKeyTypeEnum {
|
||||
|
||||
LB("10", "宁波银行"),
|
||||
/** 屋里咖啡咖啡机: 我方作为第三方支付服务商调厂商 getOrder/callback/refund 的鉴权对。 */
|
||||
WULI_COFFEE("11", "屋里咖啡"),
|
||||
/** 屋里咖啡咖啡机: 厂商调我方 queryOrder 查单的验签对(app_key=我方分配的appid)。 */
|
||||
WULI_COFFEE_QUERY("12", "屋里咖啡查单"),
|
||||
;
|
||||
|
||||
private final String type;
|
||||
|
||||
+5
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.thirdparty.dto.appmessage;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -31,6 +32,10 @@ public class WalletMessageDetailDto implements Serializable {
|
||||
@NotNull(message = "钱包结果余额不能为空")
|
||||
private Integer balance;
|
||||
|
||||
/** 流水备注快照,由后台操作人员补充业务说明;历史流水和未填写场景允许为空,最多256个字符。 */
|
||||
@Size(max = 256, message = "流水备注不能超过256个字符")
|
||||
private String remark;
|
||||
|
||||
/** WalletBizEnum持久化编码,用于服务端再次校验聚合明细一致性。 */
|
||||
@NotBlank(message = "钱包业务类型不能为空")
|
||||
private String walletBizType;
|
||||
|
||||
+12
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.thirdparty.entity.ThirdKeyManageEntity;
|
||||
import com.bsd.pjcloud.thirdparty.service.ThirdKeyManageService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -77,4 +79,14 @@ public class ThirdKeyManageController {
|
||||
return R.ok(thirdKeyManageService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 内部服务按bizType跨租户读取平台级密钥(咖啡机等匿名设备场景)
|
||||
*/
|
||||
@Inner
|
||||
@NoToken
|
||||
@GetMapping("/inner/get-by-biz-type")
|
||||
public R<ThirdKeyManageEntity> getByBizType(@RequestParam("bizType") String bizType) {
|
||||
return R.ok(thirdKeyManageService.getGlobalByBizType(bizType));
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -23,6 +23,12 @@ public interface ThirdKeyManageService extends IService<ThirdKeyManageEntity> {
|
||||
*/
|
||||
ThirdKeyManageEntity get(ThirdKeyTypeEnum type);
|
||||
|
||||
/**
|
||||
* 跨租户按bizType获取平台级key配置(咖啡机等匿名设备场景无租户上下文)。
|
||||
* 该类密钥要求全平台唯一,建议统一维护在默认租户下
|
||||
*/
|
||||
ThirdKeyManageEntity getGlobalByBizType(String bizType);
|
||||
|
||||
/**
|
||||
* 验签并且返回配置
|
||||
*/
|
||||
|
||||
+23
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.tenant.TenantContextHolder;
|
||||
import com.bsd.pjcloud.thirdparty.constant.ThirdKeyTypeEnum;
|
||||
import com.bsd.pjcloud.thirdparty.entity.ThirdKeyManageEntity;
|
||||
import com.bsd.pjcloud.thirdparty.mapper.ThirdKeyManageMapper;
|
||||
@@ -58,6 +59,28 @@ public class ThirdKeyManageServiceImpl extends ServiceImpl<ThirdKeyManageMapper,
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<ThirdKeyManageEntity>().eq(ThirdKeyManageEntity::getBizType, type.getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 跨租户按bizType获取平台级key配置。咖啡机扫码支付等匿名场景无租户头,
|
||||
* 该类密钥按平台唯一维护,取id最小的一条保证多副本数据时结果稳定
|
||||
*/
|
||||
@Override
|
||||
public ThirdKeyManageEntity getGlobalByBizType(String bizType) {
|
||||
if (ObjectUtil.isEmpty(bizType)) {
|
||||
return null;
|
||||
}
|
||||
Long originTenant = TenantContextHolder.getTenantId();
|
||||
TenantContextHolder.setTenantSkip();
|
||||
try {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<ThirdKeyManageEntity>()
|
||||
.eq(ThirdKeyManageEntity::getBizType, bizType)
|
||||
.orderByAsc(ThirdKeyManageEntity::getId)
|
||||
.last("limit 1"));
|
||||
} finally {
|
||||
TenantContextHolder.clear();
|
||||
TenantContextHolder.setTenantId(originTenant);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验签并且返回配置
|
||||
*/
|
||||
|
||||
+3
@@ -440,6 +440,9 @@ public class ThirdAppMessageServiceImpl implements ThirdAppMessageService {
|
||||
? ErrorCodes.APP_MSG_WALLET_DETAIL_INC
|
||||
: ErrorCodes.APP_MSG_WALLET_DETAIL_DEC;
|
||||
detailsText.append(MsgUtils.getMessage(detailCode, walletName, amount, balance));
|
||||
if (StrUtil.isNotBlank(detail.getRemark())) {
|
||||
detailsText.append(MsgUtils.getMessage(ErrorCodes.APP_MSG_WALLET_DETAIL_REMARK, detail.getRemark().trim()));
|
||||
}
|
||||
}
|
||||
return MsgUtils.getMessage(ErrorCodes.APP_MSG_WALLET_CONTENT, eventLabel(event), detailsText.toString());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user