Compare commits

..
81 Commits
Author SHA1 Message Date
timi 445da5f093 Merge pull request 'v1.0.70' (#82) from dev into master
Reviewed-on: #82
2026-11-12 09:44:54 +00:00
timi b62c7f2495 Merge pull request 'v1.0.69' (#81) from dev into master
Reviewed-on: #81
2026-11-08 12:05:57 +00:00
timi 2b7c94e7c3 Merge pull request 'v1.0.68' (#80) from dev into master
Reviewed-on: #80
2026-11-07 18:03:08 +00:00
timi 470b586085 Merge pull request 'v1.0.67' (#79) from dev into master
Reviewed-on: #79
2026-11-06 16:05:40 +00:00
timi 3d0f9b9d1b Merge pull request 'v1.0.66' (#78) from dev into master
Reviewed-on: #78
2026-11-06 15:59:05 +00:00
timi 634de93ffe Merge pull request 'v1.0.65' (#77) from dev into master
Reviewed-on: #77
2026-11-06 15:37:24 +00:00
timi 996830bec7 Merge pull request 'v1.0.64' (#76) from dev into master
Reviewed-on: #76
2026-10-29 17:23:25 +00:00
timi cd88f94277 Merge pull request 'v1.0.63' (#75) from dev into master
Reviewed-on: #75
2026-10-29 12:02:14 +00:00
timi 47970cd8ff Merge pull request 'v1.0.62' (#74) from dev into master
Reviewed-on: #74
2026-10-27 16:58:56 +00:00
timi ada3fbf9cb Merge pull request 'v1.0.61' (#73) from dev into master
Reviewed-on: #73
2026-10-25 16:34:30 +00:00
timi f6c99bd262 Merge pull request 'v1.0.60' (#72) from dev into master
Reviewed-on: #72
2026-10-24 17:18:13 +00:00
timi 1241f19c16 Merge pull request 'v1.0.59' (#71) from dev into master
Reviewed-on: #71
2026-10-20 17:36:26 +00:00
timi d7a7a88232 Merge pull request 'v1.0.58' (#70) from dev into master
Reviewed-on: #70
2026-10-15 17:34:02 +00:00
timi 7743b1bab2 Merge pull request 'v1.0.57' (#69) from dev into master
Reviewed-on: #69
2026-10-05 08:10:57 +00:00
timi 982b1ee3e4 Merge pull request 'v1.0.56' (#68) from dev into master
Reviewed-on: #68
2026-09-25 15:43:52 +00:00
timi 05e28c2c6d Merge pull request 'v1.0.55' (#67) from dev into master
Reviewed-on: #67
2026-09-23 15:17:56 +00:00
timi c18d0e8a9f Merge pull request 'v1.0.54' (#66) from dev into master
Reviewed-on: #66
2026-09-22 17:09:48 +00:00
timi 1b221b13d1 Merge pull request 'v1.0.53' (#65) from dev into master
Reviewed-on: #65
2026-09-21 17:32:02 +00:00
timi 135996ce19 Merge pull request 'v1.0.52' (#64) from dev into master
Reviewed-on: #64
2026-09-20 17:22:39 +00:00
timi 6b85cddede Merge pull request 'v1.0.51' (#63) from dev into master
Reviewed-on: #63
2026-09-18 17:27:14 +00:00
timi e486f850f2 Merge pull request 'v1.0.50' (#62) from dev into master
Reviewed-on: #62
2026-09-17 17:52:23 +00:00
timi 76c2f3a5fd Merge pull request 'v1.0.49' (#61) from dev into master
Reviewed-on: #61
2026-09-16 17:34:23 +00:00
timi bb542e7510 Merge pull request 'v1.0.48' (#60) from dev into master
Reviewed-on: #60
2026-09-15 17:39:14 +00:00
timi eba4461381 Merge pull request 'v1.0.47' (#59) from dev into master
Reviewed-on: #59
2026-09-14 17:30:09 +00:00
timi f5ad238015 Merge pull request 'v1.0.46' (#58) from dev into master
Reviewed-on: #58
2026-09-14 06:14:05 +00:00
timi 4bdb24e9ac Merge pull request 'v1.0.45' (#57) from dev into master
Reviewed-on: #57
2026-09-13 18:13:38 +00:00
timi 425922fd04 Merge pull request 'v1.0.44' (#56) from dev into master
Reviewed-on: #56
2026-09-12 17:42:51 +00:00
timi d65424e5bf Merge pull request 'v1.0.43' (#55) from dev into master
Reviewed-on: #55
2026-09-11 17:26:21 +00:00
timi 2a35793baf Merge pull request 'v1.0.42' (#54) from dev into master
Reviewed-on: #54
2026-09-11 16:16:04 +00:00
timi d22df698b6 Merge pull request 'v1.0.41' (#53) from dev into master
Reviewed-on: #53
2026-09-11 15:55:02 +00:00
timi 1771bf9909 Merge pull request 'v1.0.40' (#52) from dev into master
Reviewed-on: #52
2026-09-10 16:29:28 +00:00
timi 15d69f9361 Merge pull request 'v1.0.39' (#51) from dev into master
Reviewed-on: #51
2026-09-10 06:10:30 +00:00
timi 2b4089ef59 Merge pull request 'v1.0.38' (#50) from dev into master
Reviewed-on: #50
2026-09-09 17:33:25 +00:00
timi 20c3e1f422 Merge pull request 'v1.0.37' (#49) from dev into master
Reviewed-on: #49
2026-09-09 06:21:55 +00:00
timi 3b19d9e930 Merge pull request 'v1.0.36' (#48) from dev into master
Reviewed-on: #48
2026-09-08 17:52:47 +00:00
timi 5fd11e9caf Merge pull request 'v1.0.35' (#47) from dev into master
Reviewed-on: #47
2026-09-07 17:06:28 +00:00
timi 0b98dcdfe9 Merge pull request 'v1.0.34' (#46) from dev into master
Reviewed-on: #46
2026-09-07 15:11:06 +00:00
timi b373cbbe46 Merge pull request 'v1.0.33' (#45) from dev into master
Reviewed-on: #45
2026-09-07 09:40:39 +00:00
timi acd97c7b9b Merge pull request 'v1.0.32' (#44) from dev into master
Reviewed-on: #44
2026-09-07 08:42:29 +00:00
timi 118bdb1666 Merge pull request 'v1.0.31' (#43) from dev into master
Reviewed-on: #43
2026-09-07 07:40:03 +00:00
timi 944de228f7 Merge pull request 'v1.0.30' (#42) from dev into master
Reviewed-on: #42
2026-09-01 17:44:48 +00:00
timi 25c9cd4dfc Merge pull request 'v1.0.30' (#41) from dev into master
Reviewed-on: #41
2026-09-01 17:42:44 +00:00
timi 882cd226ec Merge pull request 'v1.0.30' (#40) from dev into master
Reviewed-on: #40
2026-09-01 17:38:50 +00:00
timi feb4d7af66 Merge pull request 'v1.0.28' (#38) from dev into master
Reviewed-on: #38
2026-08-30 15:51:37 +00:00
timi d75ab1ed5f Merge pull request 'v1.0.27' (#37) from dev into master
Reviewed-on: #37
2026-08-29 17:49:23 +00:00
timi a501eb7443 Merge pull request 'v1.0.26' (#36) from dev into master
Reviewed-on: #36
2026-08-28 16:52:15 +00:00
timi 19941d9480 Merge pull request 'v1.0.25' (#35) from dev into master
Reviewed-on: #35
2026-08-23 17:50:25 +00:00
timi cd3d522d4f Merge pull request 'v1.0.24' (#34) from dev into master
Reviewed-on: #34
2026-08-22 09:56:13 +00:00
timi 181c5078e9 Merge pull request 'v1.0.23' (#33) from dev into master
Reviewed-on: #33
2026-08-22 09:51:37 +00:00
timi e97f46e6b4 Merge pull request 'v1.0.22' (#32) from dev into master
Reviewed-on: #32
2026-08-21 17:31:33 +00:00
timi c0f89deb83 Merge pull request 'v1.0.22' (#31) from dev into master
Reviewed-on: #31
2026-08-21 17:28:32 +00:00
timi ce695463d3 Merge pull request 'v1.0.21' (#30) from dev into master
Reviewed-on: #30
2026-08-21 07:29:34 +00:00
timi 83c683d473 Merge pull request 'v1.0.20' (#29) from dev into master
Reviewed-on: #29
2026-08-21 07:25:32 +00:00
timi 9555474b0b Merge pull request 'v1.0.19' (#28) from dev into master
Reviewed-on: #28
2026-08-21 05:52:36 +00:00
timi a150f9e017 Merge pull request 'v1.0.18' (#27) from dev into master
Reviewed-on: #27
2026-08-20 17:40:22 +00:00
timi ecd2fa1c33 Merge pull request 'v1.0.17' (#26) from dev into master
Reviewed-on: #26
2026-08-19 17:30:35 +00:00
timi e3236d262d Merge pull request 'v1.0.16' (#25) from dev into master
Reviewed-on: #25
2026-08-16 03:37:08 +00:00
timi c8e2e16ba5 Merge pull request 'v1.0.15' (#24) from dev into master
Reviewed-on: #24
2026-08-15 17:49:51 +00:00
timi 99b44faf09 Merge pull request 'v1.0.15' (#23) from dev into master
Reviewed-on: #23
2026-08-15 17:45:26 +00:00
timi b3e3cbf84b Merge pull request 'v1.0.14' (#22) from dev into master
Reviewed-on: #22
2026-08-14 17:31:11 +00:00
timi 0aee11d824 Merge pull request 'v1.0.14' (#21) from dev into master
Reviewed-on: #21
2026-08-14 17:26:10 +00:00
timi fcf358a768 Merge pull request 'v1.0.13' (#20) from dev into master
Reviewed-on: #20
2026-08-13 09:52:26 +00:00
timi 619369104c Merge pull request 'v1.0.12' (#19) from dev into master
Reviewed-on: #19
2026-08-12 17:02:43 +00:00
timi 4f1408b9d0 Merge pull request 'v1.0.11' (#18) from dev into master
Reviewed-on: #18
2026-08-11 16:49:08 +00:00
timi 029eea70cc Merge pull request 'v1.0.10' (#17) from dev into master
Reviewed-on: #17
2026-08-11 16:45:36 +00:00
timi 22b1e65385 Merge pull request 'v1.0.9' (#16) from dev into master
Reviewed-on: #16
2026-08-11 16:01:10 +00:00
timi 2170c48763 Merge pull request 'v1.0.8' (#15) from dev into master
Reviewed-on: #15
2026-08-03 16:36:19 +00:00
timi c2d1c48aae Merge pull request 'v0.0.18' (#14) from dev into master
Reviewed-on: #14
2026-08-03 11:59:20 +00:00
timi e14958c643 Merge pull request 'v0.0.18' (#13) from dev into master
Reviewed-on: #13
2026-08-03 11:58:16 +00:00
timi da288338cd Merge pull request 'v1.0.7' (#12) from dev into master
Reviewed-on: #12
2026-08-01 09:34:18 +00:00
timi ea430f2468 Merge pull request 'v1.0.6' (#11) from dev into master
Reviewed-on: #11
2026-08-01 09:03:48 +00:00
timi f76f79744a Merge pull request 'v1.0.5' (#10) from dev into master
Reviewed-on: #10
2026-08-01 08:52:52 +00:00
timi 19daaff907 Merge pull request 'v1.0.4' (#9) from dev into master
Reviewed-on: #9
2026-08-01 03:13:00 +00:00
timi db94d8f932 Merge pull request 'v1.0.3' (#8) from dev into master
Reviewed-on: #8
2026-07-31 17:19:48 +00:00
timi 53618fe362 Merge pull request 'v1.0.3' (#7) from dev into master
Reviewed-on: #7
2026-07-31 17:13:37 +00:00
timi 523edffc4e Merge pull request 'v1.0.2' (#6) from dev into master
Reviewed-on: #6
2026-04-13 10:28:11 +00:00
timi c7ddb1a8b0 Merge pull request 'v1.0.1' (#5) from dev into master
Reviewed-on: #5
2026-04-12 16:17:02 +00:00
timi 45c9fc814a Merge pull request 'v1.0.0' (#4) from dev into master
Reviewed-on: #4
2026-04-09 05:16:04 +00:00
timi 407dc13ac4 Merge pull request 'v1.0.0' (#3) from dev into master
Reviewed-on: #3
2026-04-09 04:09:16 +00:00
timi 0c06bf16c2 Merge pull request 'v1.0.0' (#2) from dev into master
Reviewed-on: #2
2026-04-09 04:03:43 +00:00
timi 1db39e77d3 Merge pull request 'v1.0.0' (#1) from dev into master
Reviewed-on: #1
2026-04-08 08:48:12 +00:00
13 changed files with 48 additions and 283 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
<groupId>com.imyeyu.timiserverapi</groupId> <groupId>com.imyeyu.timiserverapi</groupId>
<artifactId>TimiServerAPI</artifactId> <artifactId>TimiServerAPI</artifactId>
<version>1.0.71</version> <version>1.0.70</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>TimiServerAPI</name> <name>TimiServerAPI</name>
<description>imyeyu.com API</description> <description>imyeyu.com API</description>
@@ -3,7 +3,6 @@ package com.imyeyu.api.modules.app.controller;
import com.imyeyu.api.modules.app.service.AppVersionService; import com.imyeyu.api.modules.app.service.AppVersionService;
import com.imyeyu.api.modules.app.vo.AppUpdateCheckRequest; import com.imyeyu.api.modules.app.vo.AppUpdateCheckRequest;
import com.imyeyu.api.modules.app.vo.AppUpdateCheckResponse; import com.imyeyu.api.modules.app.vo.AppUpdateCheckResponse;
import com.imyeyu.api.modules.app.vo.AppUpdateNotesResponse;
import com.imyeyu.spring.annotation.IgnoreGlobalReturn; import com.imyeyu.spring.annotation.IgnoreGlobalReturn;
import com.imyeyu.spring.annotation.RequestRateLimit; import com.imyeyu.spring.annotation.RequestRateLimit;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -40,17 +39,4 @@ public class AppUpdateController {
public AppUpdateCheckResponse check(@RequestBody AppUpdateCheckRequest req) { public AppUpdateCheckResponse check(@RequestBody AppUpdateCheckRequest req) {
return service.check(req); return service.check(req);
} }
/// 查询更新日志
///
/// 返回当前运行版本到目标版本之间的变更说明,供版本历史页使用
/// 目标版本与 check 用同一套规则解析,包含灰度与兼容区间,保证「有日志」和「能更新」一致
///
/// @param req 插件上报信息,version_name 为当前运行版本
/// @return 更新日志
@RequestRateLimit
@PostMapping("/notes")
public AppUpdateNotesResponse notes(@RequestBody AppUpdateCheckRequest req) {
return service.notes(req);
}
} }
@@ -8,8 +8,6 @@ import com.imyeyu.api.modules.app.mapper.AppProductMapper;
import com.imyeyu.api.modules.app.mapper.AppReleaseMapper; import com.imyeyu.api.modules.app.mapper.AppReleaseMapper;
import com.imyeyu.api.modules.app.vo.AppUpdateCheckRequest; import com.imyeyu.api.modules.app.vo.AppUpdateCheckRequest;
import com.imyeyu.api.modules.app.vo.AppUpdateCheckResponse; import com.imyeyu.api.modules.app.vo.AppUpdateCheckResponse;
import com.imyeyu.api.modules.app.vo.AppUpdateNote;
import com.imyeyu.api.modules.app.vo.AppUpdateNotesResponse;
import com.imyeyu.api.modules.system.entity.Logger; import com.imyeyu.api.modules.system.entity.Logger;
import com.imyeyu.api.modules.system.service.LoggerService; import com.imyeyu.api.modules.system.service.LoggerService;
import com.imyeyu.java.TimiJava; import com.imyeyu.java.TimiJava;
@@ -19,8 +17,6 @@ import org.springframework.stereotype.Service;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.zip.CRC32; import java.util.zip.CRC32;
@@ -42,9 +38,6 @@ public class AppVersionService {
/// 内置包版本标识 /// 内置包版本标识
public static final String BUILTIN_VERSION = "builtin"; public static final String BUILTIN_VERSION = "builtin";
/// 更新日志最多返回的版本条数
public static final int MAX_NOTES = 20;
/// 灰度基数 /// 灰度基数
private static final long GRAY_BASE = 10000L; private static final long GRAY_BASE = 10000L;
@@ -58,128 +51,54 @@ public class AppVersionService {
/// @param req 插件上报信息 /// @param req 插件上报信息
/// @return 插件协议响应,无更新时回显当前版本 /// @return 插件协议响应,无更新时回显当前版本
public AppUpdateCheckResponse check(AppUpdateCheckRequest req) { public AppUpdateCheckResponse check(AppUpdateCheckRequest req) {
String currentVersion = currentVersion(req); String currentVersion = TimiJava.isEmpty(req.getVersionName()) ? BUILTIN_VERSION : req.getVersionName();
AppProduct product = resolveProduct(req); AppProduct product = productMapper.selectByAppKey(req.getAppId(), parsePlatform(req.getPlatform()));
if (product == null) { if (product == null || !Boolean.TRUE.equals(product.getEnabled())) {
log.warn("应用不存在或已停用,appId={}", req.getAppId());
return AppUpdateCheckResponse.none(currentVersion); return AppUpdateCheckResponse.none(currentVersion);
} }
AppRelease release = resolveChannelRelease(product, req); if (!TimiJava.isEmpty(product.getUpdateKey()) && !product.getUpdateKey().equals(req.getKey())) {
if (release == null) { log.warn("更新密钥不匹配,appId={}", req.getAppId());
return AppUpdateCheckResponse.none(currentVersion);
}
String channelCode = TimiJava.isEmpty(req.getChannel()) ? DEFAULT_CHANNEL : req.getChannel();
AppChannel channel = channelMapper.selectByProductAndCode(product.getId(), channelCode);
if (channel == null || TimiJava.isEmpty(channel.getReleaseId())) {
return AppUpdateCheckResponse.none(currentVersion);
}
AppRelease release = releaseMapper.select(channel.getReleaseId());
if (release == null || release.getStatus() != AppRelease.Status.PUBLISHED) {
return AppUpdateCheckResponse.none(currentVersion); return AppUpdateCheckResponse.none(currentVersion);
} }
int currentCode = parseInt(req.getVersionCode(), 0); int currentCode = parseInt(req.getVersionCode(), 0);
if (release.getKind() == AppRelease.Kind.NATIVE) { if (release.getKind() == AppRelease.Kind.NATIVE) {
AppRelease target = resolveNative(release, currentCode); return resolveNative(release, currentCode, currentVersion);
return target == null
? AppUpdateCheckResponse.none(currentVersion)
: buildResponse(target, Boolean.TRUE.equals(target.getMandatory()));
} }
AppRelease target = resolveBundle(release, product, currentCode, currentVersion, req.getDeviceId()); return resolveBundle(release, product, currentCode, currentVersion, req.getDeviceId());
return target == null
? AppUpdateCheckResponse.none(currentVersion)
: buildResponse(target, false);
} }
/// 查询更新日志 /// 原生包更新判断
/// ///
/// 区间上界取通道当前版本,不再走灰度与兼容区间判断。 /// @param release 发布记录
/// 原因:客户端拿不到原生 versionCode,也无法保证命中灰度分桶,套用检查更新的判定会让日志
/// 大面积为空。日志是「这个产品最近发了什么」,不是「你这台设备能装什么」,分发决策仍由 check 负责
///
/// @param req 插件上报信息
/// @return 当前版本到通道当前版本之间的变更说明
public AppUpdateNotesResponse notes(AppUpdateCheckRequest req) {
String currentVersion = currentVersion(req);
AppProduct product = resolveProduct(req);
if (product == null) {
return new AppUpdateNotesResponse(null, Collections.emptyList());
}
AppRelease target = resolveChannelRelease(product, req);
// 原生包更新走安装包,与热更日志无关
if (target == null || target.getKind() == AppRelease.Kind.NATIVE) {
return new AppUpdateNotesResponse(null, Collections.emptyList());
}
List<AppUpdateNote> notes = new ArrayList<>();
for (AppRelease item : releaseMapper.selectPublished(product.getId(), AppRelease.Kind.BUNDLE)) {
// 只取比当前版本新、且不比目标版本新的记录
if (0 >= compareVersion(item.getVersionName(), currentVersion)) {
continue;
}
if (0 < compareVersion(item.getVersionName(), target.getVersionName())) {
continue;
}
notes.add(new AppUpdateNote(item.getVersionName(), item.getNote(), item.getPublishedAt()));
}
// 按版本号倒序,最新的在最前
notes.sort((a, b) -> compareVersion(b.getVersion(), a.getVersion()));
List<AppUpdateNote> limited = MAX_NOTES < notes.size() ? notes.subList(0, MAX_NOTES) : notes;
return new AppUpdateNotesResponse(target.getVersionName(), limited);
}
/// 取当前运行的 Web 包版本
///
/// @param req 插件上报信息
/// @return 版本号,未上报时为内置包标识
private String currentVersion(AppUpdateCheckRequest req) {
return TimiJava.isEmpty(req.getVersionName()) ? BUILTIN_VERSION : req.getVersionName();
}
/// 解析并校验产品
///
/// @param req 插件上报信息
/// @return 产品,不存在、已停用或密钥不匹配时为 null
private AppProduct resolveProduct(AppUpdateCheckRequest req) {
AppProduct product = productMapper.selectByAppKey(req.getAppId(), parsePlatform(req.getPlatform()));
if (product == null || !Boolean.TRUE.equals(product.getEnabled())) {
log.warn("应用不存在或已停用,appId={}", req.getAppId());
return null;
}
if (!TimiJava.isEmpty(product.getUpdateKey()) && !product.getUpdateKey().equals(req.getKey())) {
log.warn("更新密钥不匹配,appId={}", req.getAppId());
return null;
}
return product;
}
/// 取通道当前指向的发布记录
///
/// @param product 产品
/// @param req 插件上报信息
/// @return 发布记录,通道为空或指向的记录不可用时为 null
private AppRelease resolveChannelRelease(AppProduct product, AppUpdateCheckRequest req) {
String channelCode = TimiJava.isEmpty(req.getChannel()) ? DEFAULT_CHANNEL : req.getChannel();
AppChannel channel = channelMapper.selectByProductAndCode(product.getId(), channelCode);
if (channel == null || TimiJava.isEmpty(channel.getReleaseId())) {
return null;
}
AppRelease release = releaseMapper.select(channel.getReleaseId());
if (release == null || release.getStatus() != AppRelease.Status.PUBLISHED) {
return null;
}
return release;
}
/// 原生包是否需要更新
///
/// @param release 通道当前发布记录
/// @param currentCode 当前原生 versionCode /// @param currentCode 当前原生 versionCode
/// @return 需要更新时返回发布记录,否则返回 null /// @param currentVersion 当前版本名
private AppRelease resolveNative(AppRelease release, int currentCode) { /// @return 更新响应
private AppUpdateCheckResponse resolveNative(AppRelease release, int currentCode, String currentVersion) {
if (release.getVersionCode() == null || release.getVersionCode() <= currentCode) { if (release.getVersionCode() == null || release.getVersionCode() <= currentCode) {
return null; return AppUpdateCheckResponse.none(currentVersion);
} }
return release; return buildResponse(release, Boolean.TRUE.equals(release.getMandatory()));
} }
/// 热更包是否需要更新 /// 热更包更新判断
/// ///
/// @param release 通道当前发布记录 /// @param release 发布记录
/// @param product 产品 /// @param product 产品
/// @param currentCode 当前原生 versionCode /// @param currentCode 当前原生 versionCode
/// @param currentVersion 当前 Web 包版本 /// @param currentVersion 当前 Web 包版本
/// @param deviceId 设备标识 /// @param deviceId 设备标识
/// @return 需要更新时返回发布记录,否则返回 null /// @return 更新响应
private AppRelease resolveBundle( private AppUpdateCheckResponse resolveBundle(
AppRelease release, AppRelease release,
AppProduct product, AppProduct product,
int currentCode, int currentCode,
@@ -188,23 +107,23 @@ public class AppVersionService {
) { ) {
// 原生版本不在兼容区间内,装了会崩 // 原生版本不在兼容区间内,装了会崩
if (release.getMinVersionCode() != null && currentCode < release.getMinVersionCode()) { if (release.getMinVersionCode() != null && currentCode < release.getMinVersionCode()) {
return null; return AppUpdateCheckResponse.none(currentVersion);
} }
if (release.getMaxVersionCode() != null && release.getMaxVersionCode() < currentCode) { if (release.getMaxVersionCode() != null && release.getMaxVersionCode() < currentCode) {
return null; return AppUpdateCheckResponse.none(currentVersion);
} }
// 已是最新,或低于当前版本时不做降级 // 已是最新,或低于当前版本时不做降级
if (release.getVersionName().equals(currentVersion)) { if (release.getVersionName().equals(currentVersion)) {
return null; return AppUpdateCheckResponse.none(currentVersion);
} }
if (0 < compareVersion(currentVersion, release.getVersionName())) { if (0 < compareVersion(currentVersion, release.getVersionName())) {
return null; return AppUpdateCheckResponse.none(currentVersion);
} }
// 灰度分桶不能含 releaseId,否则每次发版都会重排用户 // 灰度分桶不能含 releaseId,否则每次发版都会重排用户
if (!hitGray(release.getGrayPermille(), deviceId, product.getAppKey())) { if (!hitGray(release.getGrayPermille(), deviceId, product.getAppKey())) {
return null; return AppUpdateCheckResponse.none(currentVersion);
} }
return release; return buildResponse(release, false);
} }
/// 判断设备是否命中灰度 /// 判断设备是否命中灰度
@@ -227,8 +146,6 @@ public class AppVersionService {
/// 构造更新响应 /// 构造更新响应
/// ///
/// note 为历史构建号时不下发,避免客户端把它当成更新说明展示
///
/// @param release 发布记录 /// @param release 发布记录
/// @param mandatory true 为强制更新 /// @param mandatory true 为强制更新
/// @return 更新响应 /// @return 更新响应
@@ -237,7 +154,7 @@ public class AppVersionService {
.path("/attach/download/") .path("/attach/download/")
.path(release.getAttachmentId()) .path(release.getAttachmentId())
.toUriString(); .toUriString();
return new AppUpdateCheckResponse(release.getVersionName(), url, release.getSha256(), mandatory, release.getNote()); return new AppUpdateCheckResponse(release.getVersionName(), url, release.getSha256(), mandatory);
} }
/// 比较版本号 /// 比较版本号
@@ -28,16 +28,11 @@ public class AppUpdateCheckResponse {
/// 是否为强制更新 /// 是否为强制更新
protected Boolean mandatory; protected Boolean mandatory;
/// 变更说明,供 App 展示更新日志
///
/// 字段名不能叫 message:Capgo 插件把 message 当作错误信息,收到会直接判为检查失败
protected String note;
/// 构建无更新响应,version 与当前一致时插件不会下载 /// 构建无更新响应,version 与当前一致时插件不会下载
/// ///
/// @param currentVersion 当前运行的 Web 包版本 /// @param currentVersion 当前运行的 Web 包版本
/// @return 无更新响应 /// @return 无更新响应
public static AppUpdateCheckResponse none(String currentVersion) { public static AppUpdateCheckResponse none(String currentVersion) {
return new AppUpdateCheckResponse(currentVersion, "", null, false, null); return new AppUpdateCheckResponse(currentVersion, "", null, false);
} }
} }
@@ -1,23 +0,0 @@
package com.imyeyu.api.modules.app.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
///
/// 单条版本变更说明
///
/// @author Codex
/// @since 2026-11-13
@Data
@AllArgsConstructor
public class AppUpdateNote {
/// 版本号
protected String version;
/// 变更说明,来自发布记录的 note
protected String note;
/// 首次发布时间
protected Long publishedAt;
}
@@ -1,24 +0,0 @@
package com.imyeyu.api.modules.app.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
///
/// 应用更新日志响应
///
/// 供 App 的版本历史页使用,返回当前运行版本到目标版本之间的全部变更说明
///
/// @author Codex
/// @since 2026-11-13
@Data
@AllArgsConstructor
public class AppUpdateNotesResponse {
/// 目标版本号,为空表示当前没有可更新到的版本
protected String version;
/// 变更说明,按版本号从新到旧
protected List<AppUpdateNote> notes;
}
@@ -76,43 +76,6 @@ public class GaoRecycleAccountController {
return mapper.listAccounts(storeId, customerId); return mapper.listAccounts(storeId, customerId);
} }
/// 按客户分页返回额度,汇总按回收物分别计算,避免混加不同单位。
@RequireGaoPermission(GaoPermissionCode.RECYCLE_ACCOUNT_READ)
@PostMapping("/customers")
public Map<String, Object> customers(@RequestParam String storeId, @RequestParam(required = false) String recycleItemId,
@RequestParam(required = false) String keyword, @RequestParam(required = false) List<String> customerIds, @RequestParam(defaultValue = "0") int offset, @RequestParam(defaultValue = "20") int limit) {
scope.checkStoreId(storeId);
int safeOffset = Math.max(0, offset);
int safeLimit = Math.max(1, Math.min(limit, 100));
List<String> ids = mapper.customerPage(storeId, recycleItemId, keyword, customerIds, safeOffset, safeLimit);
List<Map<String, Object>> rows = new java.util.ArrayList<>();
if (!ids.isEmpty()) {
Map<String, GaoCustomer> customers = customerService.mapByIdList(ids);
Map<String, List<Attachment>> photos = attachmentService.mapByBizIdList(Attachment.BizType.GAO_CUSTOMER, ids, GaoCustomer.AttachType.PHOTO.name());
List<Map<String, Object>> accounts = mapper.customerAccounts(storeId, ids, recycleItemId);
for (String id : ids) {
GaoCustomer customer = customers.get(id);
if (customer == null) continue;
customer.setAttachmentList(photos.getOrDefault(id, List.of()));
rows.add(Map.of("customer", customer, "accounts", accounts.stream().filter(account -> id.equals(account.get("customerId"))).toList()));
}
}
return Map.of("list", rows, "total", mapper.customerCount(storeId, recycleItemId, keyword, customerIds), "totals", mapper.accountTotals(storeId, keyword, customerIds));
}
@RequireGaoPermission(GaoPermissionCode.RECYCLE_ACCOUNT_READ)
@PostMapping("/items")
public List<Map<String, Object>> accountItems(@RequestParam String storeId) {
scope.checkStoreId(storeId);
List<Map<String, Object>> items = mapper.accountItems(storeId);
List<String> ids = items.stream().map(item -> (String) item.get("id")).filter(java.util.Objects::nonNull).toList();
if (!ids.isEmpty()) {
Map<String, List<Attachment>> attachments = attachmentService.mapByBizIdList(Attachment.BizType.GAO_RECYCLE_ITEM, ids);
items.forEach(item -> item.put("attachmentList", attachments.getOrDefault(item.get("id"), List.of())));
}
return items;
}
@RequireGaoPermission(GaoPermissionCode.RECYCLE_ACCOUNT_READ) @RequireGaoPermission(GaoPermissionCode.RECYCLE_ACCOUNT_READ)
@PostMapping("/ledger") @PostMapping("/ledger")
public List<Map<String, Object>> ledger(@RequestParam String storeId, @RequestParam String customerId) { public List<Map<String, Object>> ledger(@RequestParam String storeId, @RequestParam String customerId) {
@@ -27,23 +27,6 @@ public interface GaoRecycleAccountMapper {
"WHERE a.store_id=#{store} AND a.customer_id=#{customer} AND a.deleted_at IS NULL ORDER BY a.recycle_item_id") "WHERE a.store_id=#{store} AND a.customer_id=#{customer} AND a.deleted_at IS NULL ORDER BY a.recycle_item_id")
List<Map<String, Object>> listAccounts(@Param("store") String store, @Param("customer") String customer); List<Map<String, Object>> listAccounts(@Param("store") String store, @Param("customer") String customer);
/// 按客户分页,筛选条件与汇总使用相同的有效账户范围。
@Select("<script>SELECT a.customer_id FROM gao_recycle_account a JOIN gao_customer c ON c.id=a.customer_id AND c.store_id=a.store_id AND c.deleted_at IS NULL WHERE a.store_id=#{store} AND a.deleted_at IS NULL AND a.balance > 0 <if test='customers != null and !customers.isEmpty()'> AND a.customer_id IN <foreach collection='customers' item='customer' open='(' separator=',' close=')'>#{customer}</foreach> </if> <if test='keyword != null and keyword != &quot;&quot;'> AND (c.name LIKE CONCAT('%',#{keyword},'%') OR c.code LIKE CONCAT('%',#{keyword},'%') OR c.name_pinyin_full LIKE CONCAT('%',#{keyword},'%') OR c.name_pinyin_initial LIKE CONCAT('%',#{keyword},'%') OR c.name_pinyin_mixed LIKE CONCAT('%',#{keyword},'%')) </if> <if test='item != null and item != &quot;&quot;'> AND a.recycle_item_id=#{item} </if> GROUP BY a.customer_id ORDER BY a.customer_id LIMIT #{limit} OFFSET #{offset}</script>")
List<String> customerPage(@Param("store") String store, @Param("item") String item, @Param("keyword") String keyword, @Param("customers") List<String> customers, @Param("offset") int offset, @Param("limit") int limit);
@Select("<script>SELECT COUNT(DISTINCT a.customer_id) FROM gao_recycle_account a JOIN gao_customer c ON c.id=a.customer_id AND c.store_id=a.store_id AND c.deleted_at IS NULL WHERE a.store_id=#{store} AND a.deleted_at IS NULL AND a.balance > 0 <if test='customers != null and !customers.isEmpty()'> AND a.customer_id IN <foreach collection='customers' item='customer' open='(' separator=',' close=')'>#{customer}</foreach> </if> <if test='keyword != null and keyword != &quot;&quot;'> AND (c.name LIKE CONCAT('%',#{keyword},'%') OR c.code LIKE CONCAT('%',#{keyword},'%') OR c.name_pinyin_full LIKE CONCAT('%',#{keyword},'%') OR c.name_pinyin_initial LIKE CONCAT('%',#{keyword},'%') OR c.name_pinyin_mixed LIKE CONCAT('%',#{keyword},'%')) </if> <if test='item != null and item != &quot;&quot;'> AND a.recycle_item_id=#{item} </if></script>")
long customerCount(@Param("store") String store, @Param("item") String item, @Param("keyword") String keyword, @Param("customers") List<String> customers);
@Select("<script>SELECT a.customer_id AS customerId, a.recycle_item_id AS recycleItemId, a.balance, a.reserved, i.name AS recycleName, i.unit_name AS recycleUnit FROM gao_recycle_account a LEFT JOIN gao_recycle_item i ON i.id=a.recycle_item_id AND i.store_id=a.store_id WHERE a.store_id=#{store} AND a.deleted_at IS NULL AND a.balance > 0 AND a.customer_id IN <foreach collection='customers' item='customer' open='(' separator=',' close=')'>#{customer}</foreach> <if test='item != null and item != &quot;&quot;'> AND a.recycle_item_id=#{item} </if> ORDER BY a.recycle_item_id</script>")
List<Map<String, Object>> customerAccounts(@Param("store") String store, @Param("customers") List<String> customers, @Param("item") String item);
@Select("<script>SELECT a.recycle_item_id AS recycleItemId, i.name AS recycleName, i.unit_name AS recycleUnit, SUM(a.balance) AS balance, SUM(a.reserved) AS reserved FROM gao_recycle_account a JOIN gao_customer c ON c.id=a.customer_id AND c.store_id=a.store_id AND c.deleted_at IS NULL LEFT JOIN gao_recycle_item i ON i.id=a.recycle_item_id AND i.store_id=a.store_id WHERE a.store_id=#{store} AND a.deleted_at IS NULL AND a.balance > 0 <if test='customers != null and !customers.isEmpty()'> AND a.customer_id IN <foreach collection='customers' item='customer' open='(' separator=',' close=')'>#{customer}</foreach> </if> <if test='keyword != null and keyword != &quot;&quot;'> AND (c.name LIKE CONCAT('%',#{keyword},'%') OR c.code LIKE CONCAT('%',#{keyword},'%') OR c.name_pinyin_full LIKE CONCAT('%',#{keyword},'%') OR c.name_pinyin_initial LIKE CONCAT('%',#{keyword},'%') OR c.name_pinyin_mixed LIKE CONCAT('%',#{keyword},'%')) </if> GROUP BY a.recycle_item_id, i.name, i.unit_name ORDER BY i.name, a.recycle_item_id</script>")
List<Map<String, Object>> accountTotals(@Param("store") String store, @Param("keyword") String keyword, @Param("customers") List<String> customers);
/// 额度查询权限可用的回收物选项。
@Select("SELECT id, name, unit_name AS unitName, status FROM gao_recycle_item WHERE store_id=#{store} ORDER BY name, id")
List<Map<String, Object>> accountItems(@Param("store") String store);
@Select("SELECT id, account_id AS accountId, store_id AS storeId, customer_id AS customerId, recycle_item_id AS recycleItemId, " + @Select("SELECT id, account_id AS accountId, store_id AS storeId, customer_id AS customerId, recycle_item_id AS recycleItemId, " +
"biz_type AS bizType, biz_id AS bizId, request_no AS requestNo, balance_delta AS balanceDelta, reserved_delta AS reservedDelta, " + "biz_type AS bizType, biz_id AS bizId, request_no AS requestNo, balance_delta AS balanceDelta, reserved_delta AS reservedDelta, " +
"balance_after AS balanceAfter, reserved_after AS reservedAfter, operator_user_id AS operatorUserId, reason, created_at AS createdAt " + "balance_after AS balanceAfter, reserved_after AS reservedAfter, operator_user_id AS operatorUserId, reason, created_at AS createdAt " +
@@ -37,7 +37,7 @@ public interface GaoSalesOrderMapper extends BaseMapper<GaoSalesOrder, String> {
/// 查询客户仍可履约的 SKU 订单行 /// 查询客户仍可履约的 SKU 订单行
List<GaoQuickFulfillmentSourceRow> selectQuickFulfillmentSourceRows(@Param("storeId") String storeId, List<GaoQuickFulfillmentSourceRow> selectQuickFulfillmentSourceRows(@Param("storeId") String storeId,
@Param("customerId") String customerId, @Param("skuIdList") List<String> skuIdList, @Param("customerId") String customerId, @Param("skuIdList") List<String> skuIdList,
@Param("salesOrderIdList") List<String> salesOrderIdList, @Param("allowUnpaid") boolean allowUnpaid, @Param("allowUnsettledRecycle") boolean allowUnsettledRecycle); @Param("salesOrderIdList") List<String> salesOrderIdList, @Param("allowUnpaid") boolean allowUnpaid);
/// 按条件汇总订单金额 /// 按条件汇总订单金额
GaoSalesOrderReceivableStatView selectSummaryByQuery(GaoSalesOrderPage page); GaoSalesOrderReceivableStatView selectSummaryByQuery(GaoSalesOrderPage page);
@@ -193,7 +193,7 @@ public class GaoOrderFulfillmentServiceImplement extends AbstractEntityService<G
TimiException.required(request, "快速履约客户查询请求不能为空"); TimiException.required(request, "快速履约客户查询请求不能为空");
GaoCustomer customer = getQuickFulfillmentCustomer(request.getCustomerId(), false); GaoCustomer customer = getQuickFulfillmentCustomer(request.getCustomerId(), false);
List<GaoQuickFulfillmentSourceRow> sourceRows = salesOrderMapper.selectQuickFulfillmentSourceRows( List<GaoQuickFulfillmentSourceRow> sourceRows = salesOrderMapper.selectQuickFulfillmentSourceRows(
customer.getStoreId(), customer.getId(), null, null, canQuickFulfillUnpaidOrder(), canQuickFulfillUnsettledRecycle()); customer.getStoreId(), customer.getId(), null, null, canQuickFulfillUnpaidOrder());
if (sourceRows == null || sourceRows.isEmpty()) { if (sourceRows == null || sourceRows.isEmpty()) {
return List.of(); return List.of();
} }
@@ -235,7 +235,7 @@ public class GaoOrderFulfillmentServiceImplement extends AbstractEntityService<G
List<String> skuIdList = normalizedIdList(request.getSkuIdList(), "skuIdList"); List<String> skuIdList = normalizedIdList(request.getSkuIdList(), "skuIdList");
TimiException.requiredTrue(!skuIdList.isEmpty(), "至少选择一个 SKU"); TimiException.requiredTrue(!skuIdList.isEmpty(), "至少选择一个 SKU");
List<GaoQuickFulfillmentSourceRow> sourceRows = salesOrderMapper.selectQuickFulfillmentSourceRows( List<GaoQuickFulfillmentSourceRow> sourceRows = salesOrderMapper.selectQuickFulfillmentSourceRows(
customer.getStoreId(), customer.getId(), skuIdList, null, canQuickFulfillUnpaidOrder(), canQuickFulfillUnsettledRecycle()); customer.getStoreId(), customer.getId(), skuIdList, null, canQuickFulfillUnpaidOrder());
Map<String, GaoQuickFulfillmentSourceOrderView> orderMap = new LinkedHashMap<>(); Map<String, GaoQuickFulfillmentSourceOrderView> orderMap = new LinkedHashMap<>();
for (GaoQuickFulfillmentSourceRow row : sourceRows) { for (GaoQuickFulfillmentSourceRow row : sourceRows) {
GaoQuickFulfillmentSourceOrderView order = orderMap.computeIfAbsent(row.getSalesOrderId(), key -> { GaoQuickFulfillmentSourceOrderView order = orderMap.computeIfAbsent(row.getSalesOrderId(), key -> {
@@ -244,10 +244,6 @@ public class GaoOrderFulfillmentServiceImplement extends AbstractEntityService<G
view.setOrderNo(row.getOrderNo()); view.setOrderNo(row.getOrderNo());
view.setOrderType(row.getOrderType()); view.setOrderType(row.getOrderType());
view.setPaymentStatus(row.getPaymentStatus()); view.setPaymentStatus(row.getPaymentStatus());
view.setRecycleRequiredQuantity(row.getRecycleRequiredQuantity());
view.setRecycleVerifiedQuantity(row.getRecycleVerifiedQuantity());
view.setRecycleItemName(row.getRecycleItemName());
view.setRecycleUnit(row.getRecycleUnit());
view.setPackageName(row.getPackageName()); view.setPackageName(row.getPackageName());
view.setSaleAmount(row.getSaleAmount()); view.setSaleAmount(row.getSaleAmount());
view.setPaidAmount(row.getPaidAmount()); view.setPaidAmount(row.getPaidAmount());
@@ -311,6 +307,7 @@ public class GaoOrderFulfillmentServiceImplement extends AbstractEntityService<G
Map<String, GaoSalesOrder> orderMap = new LinkedHashMap<>(); Map<String, GaoSalesOrder> orderMap = new LinkedHashMap<>();
for (String orderId : lockOrderIdList) { for (String orderId : lockOrderIdList) {
GaoSalesOrder order = salesOrderService.getForUpdate(orderId); GaoSalesOrder order = salesOrderService.getForUpdate(orderId);
TimiException.requiredTrue(order.getOrderType() != GaoSalesOrder.OrderType.RECYCLE, "回收兑换订单请使用普通履约入口");
TimiException.requiredTrue(customerId.equals(order.getCustomerId()), "来源订单不属于当前客户"); TimiException.requiredTrue(customerId.equals(order.getCustomerId()), "来源订单不属于当前客户");
TimiException.requiredTrue(customer.getStoreId().equals(order.getStoreId()), "来源订单不属于当前门店"); TimiException.requiredTrue(customer.getStoreId().equals(order.getStoreId()), "来源订单不属于当前门店");
TimiException.requiredTrue(order.getStatus() != GaoSalesOrder.Status.CANCELLED, "已取消订单不能履约"); TimiException.requiredTrue(order.getStatus() != GaoSalesOrder.Status.CANCELLED, "已取消订单不能履约");
@@ -339,7 +336,7 @@ public class GaoOrderFulfillmentServiceImplement extends AbstractEntityService<G
List<String> skuIdList = requestItemList.stream().map(GaoQuickFulfillmentCreateItemRequest::getSkuId).toList(); List<String> skuIdList = requestItemList.stream().map(GaoQuickFulfillmentCreateItemRequest::getSkuId).toList();
List<GaoQuickFulfillmentSourceRow> sourceRows = salesOrderMapper.selectQuickFulfillmentSourceRows( List<GaoQuickFulfillmentSourceRow> sourceRows = salesOrderMapper.selectQuickFulfillmentSourceRows(
customer.getStoreId(), customerId, skuIdList, lockOrderIdList, canQuickFulfillUnpaidOrder(), canQuickFulfillUnsettledRecycle()); customer.getStoreId(), customerId, skuIdList, lockOrderIdList, canQuickFulfillUnpaidOrder());
TimiException.requiredTrue(sourceRows != null && !sourceRows.isEmpty(), "所选订单没有可履约 SKU"); TimiException.requiredTrue(sourceRows != null && !sourceRows.isEmpty(), "所选订单没有可履约 SKU");
Map<String, GaoQuickFulfillmentSourceRow> sourceRowMap = new HashMap<>(); Map<String, GaoQuickFulfillmentSourceRow> sourceRowMap = new HashMap<>();
for (GaoQuickFulfillmentSourceRow sourceRow : sourceRows) { for (GaoQuickFulfillmentSourceRow sourceRow : sourceRows) {
@@ -1084,12 +1081,9 @@ public class GaoOrderFulfillmentServiceImplement extends AbstractEntityService<G
return customer; return customer;
} }
/// 判断是否允许未结清回收订单履约 /// 判断当前用户是否拥有未全额收款订单履约例外
private boolean canQuickFulfillUnsettledRecycle() { ///
return permissionChecker.hasAny(ModuleCode.GAO, com.imyeyu.api.modules.gao.bean.GaoPermissionCode.ORDER_FULFILLMENT_UNSETTLED.getValue()); /// @return true 为允许查询未全额收款订单
}
/// 判断是否允许未全额收款订单履约
private boolean canQuickFulfillUnpaidOrder() { private boolean canQuickFulfillUnpaidOrder() {
return roleChecker.hasAny(ModuleCode.GAO, GaoRoleCode.STORE_MANAGER.name()); return roleChecker.hasAny(ModuleCode.GAO, GaoRoleCode.STORE_MANAGER.name());
} }
@@ -4,7 +4,6 @@ import com.imyeyu.api.modules.gao.entity.GaoSalesOrder;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
import java.math.BigDecimal;
/// 快速履约来源订单 /// 快速履约来源订单
@Data @Data
@@ -19,15 +18,6 @@ public class GaoQuickFulfillmentSourceOrderView {
/// 订单类型 /// 订单类型
private GaoSalesOrder.OrderType orderType; private GaoSalesOrder.OrderType orderType;
/// 回收物名称
private String recycleItemName;
/// 回收物单位
private String recycleUnit;
/// 应回收数量
private BigDecimal recycleRequiredQuantity;
/// 已核销回收数量
private BigDecimal recycleVerifiedQuantity;
/// 收款状态 /// 收款状态
private GaoSalesOrder.PaymentStatus paymentStatus; private GaoSalesOrder.PaymentStatus paymentStatus;
@@ -15,15 +15,6 @@ public class GaoQuickFulfillmentSourceRow {
private String orderNo; private String orderNo;
/// 来源订单类型 /// 来源订单类型
private GaoSalesOrder.OrderType orderType; private GaoSalesOrder.OrderType orderType;
/// 回收物名称
private String recycleItemName;
/// 回收物单位
private String recycleUnit;
/// 应回收数量
private BigDecimal recycleRequiredQuantity;
/// 已核销回收数量
private BigDecimal recycleVerifiedQuantity;
/// 收款状态 /// 收款状态
private GaoSalesOrder.PaymentStatus paymentStatus; private GaoSalesOrder.PaymentStatus paymentStatus;
/// 套餐名称快照 /// 套餐名称快照
@@ -105,10 +105,6 @@
<select id="selectQuickFulfillmentSourceRows" resultType="com.imyeyu.api.modules.gao.vo.GaoQuickFulfillmentSourceRow"> <select id="selectQuickFulfillmentSourceRows" resultType="com.imyeyu.api.modules.gao.vo.GaoQuickFulfillmentSourceRow">
SELECT o.`id` AS `salesOrderId`, o.`order_no` AS `orderNo`, o.`order_type` AS `orderType`, SELECT o.`id` AS `salesOrderId`, o.`order_no` AS `orderNo`, o.`order_type` AS `orderType`,
o.`payment_status` AS `paymentStatus`, o.`payment_status` AS `paymentStatus`,
o.`recycle_required_quantity` AS `recycleRequiredQuantity`,
(SELECT COALESCE(SUM(rp.`quantity`), 0) FROM `gao_recycle_payment` rp WHERE rp.`order_id` = o.`id` AND rp.`status` = 'VERIFIED' AND rp.`source_payment_id` IS NULL) AS `recycleVerifiedQuantity`,
(SELECT e.`recycle_name_snapshot` FROM `gao_recycle_exchange` e WHERE e.`sales_order_id` = o.`id` LIMIT 1) AS `recycleItemName`,
(SELECT e.`recycle_unit_snapshot` FROM `gao_recycle_exchange` e WHERE e.`sales_order_id` = o.`id` LIMIT 1) AS `recycleUnit`,
o.`created_at` AS `orderCreatedAt`, o.`created_at` AS `orderCreatedAt`,
(SELECT cp.`package_name_snapshot` FROM `gao_customer_package` cp (SELECT cp.`package_name_snapshot` FROM `gao_customer_package` cp
WHERE cp.`sales_order_id` = o.`id` AND cp.`deleted_at` IS NULL LIMIT 1) AS `packageName`, WHERE cp.`sales_order_id` = o.`id` AND cp.`deleted_at` IS NULL LIMIT 1) AS `packageName`,
@@ -125,12 +121,9 @@
INNER JOIN `gao_product` p ON p.`id` = s.`product_id` AND p.`deleted_at` IS NULL INNER JOIN `gao_product` p ON p.`id` = s.`product_id` AND p.`deleted_at` IS NULL
WHERE i.`deleted_at` IS NULL AND o.`store_id` = #{storeId} AND o.`customer_id` = #{customerId} WHERE i.`deleted_at` IS NULL AND o.`store_id` = #{storeId} AND o.`customer_id` = #{customerId}
AND o.`status` &lt;&gt; 'CANCELLED' AND o.`status` &lt;&gt; 'CANCELLED'
AND ((o.`order_type` = 'RECYCLE' AND i.`item_type` = 'RECYCLE_ENTITLEMENT' AND (#{allowUnpaid} OR o.`sale_amount` = 0 OR o.`paid_amount` = o.`sale_amount`)
AND (#{allowUnsettledRecycle} OR (o.`recycle_required_quantity` IS NOT NULL AND
(SELECT COALESCE(SUM(rp.`quantity`), 0) FROM `gao_recycle_payment` rp WHERE rp.`order_id` = o.`id` AND rp.`status` = 'VERIFIED' AND rp.`source_payment_id` IS NULL) &gt;= o.`recycle_required_quantity`)))
OR ((#{allowUnpaid} OR o.`sale_amount` = 0 OR o.`paid_amount` = o.`sale_amount`)
AND ((o.`order_type` = 'PACKAGE' AND i.`item_type` = 'PACKAGE_ENTITLEMENT') AND ((o.`order_type` = 'PACKAGE' AND i.`item_type` = 'PACKAGE_ENTITLEMENT')
OR (o.`order_type` = 'DIRECT_PRODUCT' AND i.`item_type` = 'DIRECT_PRODUCT')))) OR (o.`order_type` = 'DIRECT_PRODUCT' AND i.`item_type` = 'DIRECT_PRODUCT'))
AND COALESCE(i.`base_quantity`, 0) - COALESCE(i.`reserved_base_quantity`, 0) - COALESCE(i.`fulfilled_base_quantity`, 0) &gt; 0 AND COALESCE(i.`base_quantity`, 0) - COALESCE(i.`reserved_base_quantity`, 0) - COALESCE(i.`fulfilled_base_quantity`, 0) &gt; 0
<if test="skuIdList != null and skuIdList.size() &gt; 0"> <if test="skuIdList != null and skuIdList.size() &gt; 0">
AND i.`sku_id` IN AND i.`sku_id` IN