From 2abafa0f5ba345a7380f91ebbfc9cd3d60660e16 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Mon, 17 Aug 2026 17:00:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=8B=BC=E5=9B=A2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hiver-admin/test-output/test-report.html | 16 +++++----- .../AdminDataStatisticsController.java | 19 +++++++++++- .../ReturnCommissionController.java | 3 ++ .../dao/mapper/MallRefundRecordMapper.java | 7 +---- .../service/IeRealNameAuthRecordService.java | 2 ++ .../impl/IeRealNameAuthRecordServiceImpl.java | 14 +++++++++ .../impl/IeRealNameAuthServiceImpl.java | 30 +++++++++++++++++-- 7 files changed, 73 insertions(+), 18 deletions(-) diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html index a7aa68f5..946274e1 100644 --- a/hiver-admin/test-output/test-report.html +++ b/hiver-admin/test-output/test-report.html @@ -35,7 +35,7 @@ Hiver
  • -八月 16, 2026 18:06:44 +八月 17, 2026 12:43:15
  • @@ -84,7 +84,7 @@

    passTest

    -

    18:06:45 下午 / 0.022 secs

    +

    12:43:16 下午 / 0.026 secs

    @@ -92,9 +92,9 @@
    #test-id=1
    passTest
    -08.16.2026 18:06:45 -08.16.2026 18:06:45 -0.022 secs +08.17.2026 12:43:16 +08.17.2026 12:43:16 +0.026 secs
    @@ -104,7 +104,7 @@ Pass - 18:06:45 + 12:43:16 Test passed @@ -128,13 +128,13 @@

    Started

    -

    八月 16, 2026 18:06:44

    +

    八月 17, 2026 12:43:15

    Ended

    -

    八月 16, 2026 18:06:45

    +

    八月 17, 2026 12:43:16

    diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/AdminDataStatisticsController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/AdminDataStatisticsController.java index b511dcd4..9a09ae0c 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/AdminDataStatisticsController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/AdminDataStatisticsController.java @@ -154,7 +154,7 @@ public class AdminDataStatisticsController { .eq(StringUtils.isNotBlank(regionId), DealingsRecord::getRegionId, regionId) .ge(DealingsRecord::getDealingsTime, range.start) .le(DealingsRecord::getDealingsTime, range.end) - .in(DealingsRecord::getDealingsWay, REWARD_COLLEGE_RANK, REWARD_DELIVERY_RANK, REWARD_DRAW_POOL)); + .in(DealingsRecord::getDealingsWay, REWARD_COLLEGE_RANK, REWARD_DRAW_POOL)); List billingRecords = billingUsageRecordMapper.selectList(new LambdaQueryWrapper() .eq(StringUtils.isNotBlank(regionId), BillingUsageRecord::getRegionId, regionId) @@ -316,6 +316,23 @@ public class AdminDataStatisticsController { return new ResultUtil>().setData(page); } + @PostMapping("/workerPositiveBalancePage") + @ApiOperation(value = "鍒嗛〉鏌ヨ姝d綑棰濋厤閫佸憳姣忔棩浣欓璁板綍") + public Result> workerPositiveBalancePage(@RequestBody WorkerDebtQuery query) { + DateRange range = resolveDateRange(query); + String regionId = query == null ? null : query.getRegionId(); + Page page = workerDailyBalanceRecordService.page( + new Page<>(pageNumber(query), pageSize(query)), + new LambdaQueryWrapper() + .eq(StringUtils.isNotBlank(regionId), WorkerDailyBalanceRecord::getRegionId, regionId) + .ge(WorkerDailyBalanceRecord::getBalanceDate, range.startDate) + .le(WorkerDailyBalanceRecord::getBalanceDate, range.endDate) + .gt(WorkerDailyBalanceRecord::getDailyBalance, BigDecimal.ZERO) + .orderByAsc(WorkerDailyBalanceRecord::getBalanceDate) + .orderByAsc(WorkerDailyBalanceRecord::getWorkerName)); + return new ResultUtil>().setData(page); + } + private BigDecimal sumPositiveWorkerBalance(List records) { return records.stream() .map(WorkerDailyBalanceRecord::getDailyBalance) diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java index 5a48519b..19f25ce2 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ReturnCommissionController.java @@ -384,6 +384,9 @@ public class ReturnCommissionController { return ResultUtil.error("閰嶉佸憳涓嶅瓨鍦紒"); } returnCommission.setRemark("閰嶉佸憳" + worker.getWorkerName() + "鎻愮幇"); + if (worker.getDepoBal() != null && worker.getDepoBal().compareTo(BigDecimal.ZERO) < 0) { + return ResultUtil.error("浠婃棩浣i噾鏈夋瑺娆撅紝涓嶅彲鎻愮幇"); + } if (worker.getDepoBalRel().compareTo(returnCommission.getCommission()) < 0) { // 濡傛灉鎻愮幇閲戦澶т簬浣欓锛屽垯涓嶅厑璁告彁鐜 return ResultUtil.error("鎻愮幇閲戦涓嶅彲澶т簬浣i噾浣欓锛"); diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallRefundRecordMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallRefundRecordMapper.java index b7fad913..0834127a 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallRefundRecordMapper.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallRefundRecordMapper.java @@ -20,12 +20,7 @@ public interface MallRefundRecordMapper extends BaseMapper { IPage selectPageVO(IPage page, @Param("q") MallRefundRecordPageQuery q); @Update("UPDATE t_worker " - + "SET depo_bal_rel = CASE " - + "WHEN COALESCE(depo_bal, 0) >= #{amount} THEN COALESCE(depo_bal_rel, 0) " - + "ELSE COALESCE(depo_bal_rel, 0) - (#{amount} - COALESCE(depo_bal, 0)) END, " - + "depo_bal = CASE " - + "WHEN COALESCE(depo_bal, 0) >= #{amount} THEN COALESCE(depo_bal, 0) - #{amount} " - + "ELSE 0 END " + + "SET depo_bal = COALESCE(depo_bal, 0) - #{amount} " + "WHERE worker_id = #{workerId}") int deductWorkerBalanceAtomic(@Param("workerId") String workerId, @Param("amount") BigDecimal amount); diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/IeRealNameAuthRecordService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/IeRealNameAuthRecordService.java index a443ee4c..2762c919 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/IeRealNameAuthRecordService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/IeRealNameAuthRecordService.java @@ -12,4 +12,6 @@ public interface IeRealNameAuthRecordService { void recordResult(Long recordId, Integer authStatus, String providerRequestId, String providerResultCode, String failReason); + + int countFailedByResultCode(Long userId, String providerResultCode); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/impl/IeRealNameAuthRecordServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/impl/IeRealNameAuthRecordServiceImpl.java index 7cbac150..b687808f 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/impl/IeRealNameAuthRecordServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/impl/IeRealNameAuthRecordServiceImpl.java @@ -3,6 +3,7 @@ package cc.hiver.mall.ie.service.impl; import cc.hiver.mall.ie.entity.IeRealNameAuthRecord; import cc.hiver.mall.ie.mapper.IeRealNameAuthRecordMapper; import cc.hiver.mall.ie.service.IeRealNameAuthRecordService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -50,6 +51,19 @@ public class IeRealNameAuthRecordServiceImpl implements IeRealNameAuthRecordServ realNameAuthRecordMapper.updateById(record); } + @Override + public int countFailedByResultCode(Long userId, String providerResultCode) { + if (userId == null || providerResultCode == null || providerResultCode.trim().isEmpty()) { + return 0; + } + Long count = realNameAuthRecordMapper.selectCount(new LambdaQueryWrapper() + .eq(IeRealNameAuthRecord::getUserId, userId) + .eq(IeRealNameAuthRecord::getProvider, PROVIDER_ALIYUN_THREE_ELEMENT) + .eq(IeRealNameAuthRecord::getAuthStatus, AUTH_STATUS_FAILED) + .eq(IeRealNameAuthRecord::getProviderResultCode, providerResultCode.trim())); + return count == null ? 0 : count.intValue(); + } + private String truncate(String value, int maxLength) { if (value == null || value.length() <= maxLength) { return value; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/impl/IeRealNameAuthServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/impl/IeRealNameAuthServiceImpl.java index b05083a0..f820c080 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/impl/IeRealNameAuthServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/ie/service/impl/IeRealNameAuthServiceImpl.java @@ -61,6 +61,9 @@ public class IeRealNameAuthServiceImpl implements IeRealNameAuthService { private static final DateTimeFormatter BIRTHDAY_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); private static final int MAX_CERT_PICTURE_BASE64_BYTES = 50 * 1024; private static final String REAL_NAME_AUDIT_ENABLED_KEY = "IE:REVIEW:REAL_NAME_AUDIT_ENABLED"; + private static final String ALIYUN_CONSISTENT_PASS = "1"; + private static final String ALIYUN_CONSISTENT_PHOTO_MISMATCH = "0"; + private static final String REPEATED_PHOTO_MISMATCH_AUTO_PASS_REASON = "杩炵画涓ゆ鐓х墖璇嗗埆涓洪潪鍚屼竴浜猴紝绯荤粺榛樿閫氳繃瀹炲悕璁よ瘉"; private final OkHttpClient httpClient = new OkHttpClient(); private final SecureRandom secureRandom = new SecureRandom(); @@ -144,7 +147,21 @@ public class IeRealNameAuthServiceImpl implements IeRealNameAuthService { // 闃块噷浜戣繑鍥 Data.IsConsistent = "1" 鎵嶄唬琛ㄥ鍚嶃佽韩浠借瘉鍙枫佷汉鍍忕収鐗囦负鍚屼竴浜恒 verifyResult = callAliyunThreeElement(normalizedName, normalizedCertNo, normalizedPicture, normalizedRegionId, userId); - if (!"1".equals(verifyResult.getIsConsistent())) { + if (!ALIYUN_CONSISTENT_PASS.equals(verifyResult.getIsConsistent())) { + if (shouldAutoPassRepeatedPhotoMismatch(userId, verifyResult)) { + profile = ensureProfile(userId); + Date now = new Date(); + profile.setUpdateTime(now); + userProfileMapper.updateById(profile); + user = saveRealNameToUser(userId, User.REAL_NAME_AUTH_STATUS_VERIFIED, normalizedName, normalizedCertNo, birthday, age, now); + realNameAuthRecordService.recordResult(authRecordId, + IeRealNameAuthRecordService.AUTH_STATUS_VERIFIED, + verifyResult.getRequestId(), verifyResult.getIsConsistent(), REPEATED_PHOTO_MISMATCH_AUTO_PASS_REASON); + recordedResult = true; + IeRealNameAuthVO vo = buildAuthVO(user, profile); + vo.setMessage("瀹炲悕璁よ瘉宸查氳繃"); + return vo; + } throw new IeBusinessException(aliyunResultMessage(verifyResult.getIsConsistent())); } @@ -309,7 +326,7 @@ public class IeRealNameAuthServiceImpl implements IeRealNameAuthService { AliyunThreeElementResult result = new AliyunThreeElementResult(); result.setIsConsistent(data == null ? null : data.getStr("IsConsistent")); result.setRequestId(json.getStr("RequestId")); - recordRealNameBilling(regionId, userId, "1".equals(result.getIsConsistent()) ? "pass" : "failed", + recordRealNameBilling(regionId, userId, ALIYUN_CONSISTENT_PASS.equals(result.getIsConsistent()) ? "pass" : "failed", result.getRequestId(), "isConsistent=" + result.getIsConsistent()); return result; } @@ -393,8 +410,15 @@ public class IeRealNameAuthServiceImpl implements IeRealNameAuthService { return value.trim(); } + private boolean shouldAutoPassRepeatedPhotoMismatch(Long userId, AliyunThreeElementResult verifyResult) { + if (verifyResult == null || !ALIYUN_CONSISTENT_PHOTO_MISMATCH.equals(verifyResult.getIsConsistent())) { + return false; + } + return realNameAuthRecordService.countFailedByResultCode(userId, ALIYUN_CONSISTENT_PHOTO_MISMATCH) >= 1; + } + private String aliyunResultMessage(String isConsistent) { - if ("0".equals(isConsistent)) { + if (ALIYUN_CONSISTENT_PHOTO_MISMATCH.equals(isConsistent)) { return "濮撳悕涓庤韩浠借瘉鍙峰尮閰嶏紝浣嗙収鐗囪瘑鍒负闈炲悓涓浜猴紝璇烽噸鏂颁笂浼犳湰浜烘竻鏅扮収鐗"; } if ("2".equals(isConsistent)) {