接口新增

This commit is contained in:
lu7213 committed 2026-10-08 11:18:22 -04:00
1 parent 02664623f7
commit f5801dc84a
3 files changed
+32 -1

No files matched your search

@@ -30,6 +30,20 @@ public class AppsController extends BaseController {
@Autowired
private IAppsService appsService;
/** 返回管理员新增应用时固定使用的全局归集地址。 */
@PreAuthorize("@ss.hasPermi('system:apps:add')")
@GetMapping("/aggregation-address")
public AjaxResult aggregationAddress() {
return AjaxResult.success(appsService.getGlobalAggregationAddress());
}
/** 返回商户新增应用时固定使用的全局归集地址。 */
@PreAuthorize("@ss.hasPermi('system:apps:user-add')")
@GetMapping("/user/aggregation-address")
public AjaxResult userAggregationAddress() {
return AjaxResult.success(appsService.getGlobalAggregationAddress());
}
/**
* 生成 RSA 密钥对。私钥只在本次响应中返回,因此禁止操作日志保存响应体。
*/
@@ -22,6 +22,9 @@ public interface IAppsService extends IService<AppsPlus>
/** 单独设置并规范化商户 RSA 公钥。 */
int updatePublicKey(Long id, String publicKey, boolean isUser);
/** 获取新应用固定使用的全局归集地址。 */
String getGlobalAggregationAddress();
List<SelectItem> select(String keyword,boolean isUser);
/**
* 查询应用管理
@@ -12,6 +12,8 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.Apps;
import com.ruoyi.system.domain.AppsPlus;
import com.ruoyi.system.mapper.AppsMapper;
import com.ruoyi.system.mapper.UsdtConfigMapper;
import com.ruoyi.system.domain.UsdtConfig;
import com.ruoyi.system.service.IAppsService;
import com.ruoyi.system.domain.vo.AppKeyPairResult;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +45,8 @@ public class AppsServiceImpl extends ServiceImpl<AppsMapper, AppsPlus> implement
@Autowired
private AppsMapper appsMapper;
@Autowired
private UsdtConfigMapper usdtConfigMapper;
@Autowired
private JdbcTemplate jdbcTemplate;
/**
@@ -70,6 +74,15 @@ public class AppsServiceImpl extends ServiceImpl<AppsMapper, AppsPlus> implement
return appsMapper.updatePublicKey(current.getId(), normalizedPublicKey, DateUtils.getNowDate());
}
@Override
public String getGlobalAggregationAddress() {
List<UsdtConfig> configs = usdtConfigMapper.selectUsdtConfigList(new UsdtConfig());
if (configs == null || configs.isEmpty() || StringUtils.isBlank(configs.get(0).getTokenAddress())) {
throw new CustomException("全局配置尚未初始化,无法确定归集地址");
}
return configs.get(0).getTokenAddress();
}
@Override
public List<AppsPlus> getByIds(List<Long> ids, boolean isUser, SFunction<AppsPlus, ?>... columns) {
LambdaQueryWrapper<AppsPlus> lambdaQueryWrapper = new LambdaQueryWrapper<AppsPlus>()
@@ -275,6 +288,8 @@ public class AppsServiceImpl extends ServiceImpl<AppsMapper, AppsPlus> implement
@Override
public int insertApps(Apps apps, boolean isUser) {
validateAppForCreate(apps, isUser);
// 每个新应用统一使用全局配置主钱包地址,忽略请求中可能伪造的归集地址。
apps.setDistTokenAddress(getGlobalAggregationAddress());
apps.setCreatedAt(DateUtils.getNowDate());
apps.setUpdatedAt(DateUtils.getNowDate());
apps.setDeletedAt(null);
@@ -287,7 +302,6 @@ public class AppsServiceImpl extends ServiceImpl<AppsMapper, AppsPlus> implement
apps.setGoogleEmail(null);
apps.setGoogleName(null);
apps.setGooglePicture(null);
apps.setDistTokenAddress(null);
}
if (apps.getStatus() == null) apps.setStatus(1);
if (apps.getTrxBalance() == null) apps.setTrxBalance(BigDecimal.ZERO);