v1.0.12 #19

Merged
timi merged 7 commits from dev into master 2026-08-12 17:02:43 +00:00
2 changed files with 33 additions and 0 deletions
Showing only changes of commit 5e5748b521 - Show all commits
@@ -1,6 +1,7 @@
package com.imyeyu.api.modules.gao.entity; package com.imyeyu.api.modules.gao.entity;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.imyeyu.spring.annotation.table.Transient;
import com.imyeyu.spring.entity.UUIDEntity; import com.imyeyu.spring.entity.UUIDEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -83,4 +84,8 @@ public class GaoPointLedger extends UUIDEntity {
/// 发生时间 /// 发生时间
private Long occurredAt; private Long occurredAt;
/// 客户信息
@Transient
private GaoCustomer customer;
} }
@@ -2,11 +2,15 @@ package com.imyeyu.api.modules.gao.service.implement;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.imyeyu.api.config.dbsource.TimiServerDBConfig; import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
import com.imyeyu.api.modules.common.entity.Attachment;
import com.imyeyu.api.modules.common.service.AttachmentService;
import com.imyeyu.api.modules.gao.entity.GaoCustomer;
import com.imyeyu.api.modules.gao.entity.GaoPointAccount; import com.imyeyu.api.modules.gao.entity.GaoPointAccount;
import com.imyeyu.api.modules.gao.entity.GaoPointLedger; import com.imyeyu.api.modules.gao.entity.GaoPointLedger;
import com.imyeyu.api.modules.gao.entity.GaoPointRule; import com.imyeyu.api.modules.gao.entity.GaoPointRule;
import com.imyeyu.api.modules.gao.entity.GaoEventRecord; import com.imyeyu.api.modules.gao.entity.GaoEventRecord;
import com.imyeyu.api.modules.gao.mapper.GaoPointLedgerMapper; import com.imyeyu.api.modules.gao.mapper.GaoPointLedgerMapper;
import com.imyeyu.api.modules.gao.service.GaoCustomerService;
import com.imyeyu.api.modules.gao.service.GaoPointAccountService; import com.imyeyu.api.modules.gao.service.GaoPointAccountService;
import com.imyeyu.api.modules.gao.service.GaoPointLedgerService; import com.imyeyu.api.modules.gao.service.GaoPointLedgerService;
import com.imyeyu.api.modules.gao.vo.GaoPointAdjustRequest; import com.imyeyu.api.modules.gao.vo.GaoPointAdjustRequest;
@@ -23,6 +27,9 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/// GAO 客户积分流水服务实现 /// GAO 客户积分流水服务实现
/// ///
/// @author Codex /// @author Codex
@@ -33,6 +40,8 @@ public class GaoPointLedgerServiceImplement extends AbstractEntityService<GaoPoi
private final GaoPointLedgerMapper mapper; private final GaoPointLedgerMapper mapper;
private final GaoPointAccountService accountService; private final GaoPointAccountService accountService;
private final GaoCustomerService customerService;
private final AttachmentService attachmentService;
private final UserLoginService userLoginService; private final UserLoginService userLoginService;
@Override @Override
@@ -96,9 +105,28 @@ public class GaoPointLedgerServiceImplement extends AbstractEntityService<GaoPoi
PageResult<GaoPointLedger> result = new PageResult<>(); PageResult<GaoPointLedger> result = new PageResult<>();
result.setTotal(mapper.countByQuery(page)); result.setTotal(mapper.countByQuery(page));
result.setList(mapper.selectByQuery(page)); result.setList(mapper.selectByQuery(page));
fillCustomer(result.getList());
return result; return result;
} }
private void fillCustomer(List<GaoPointLedger> ledgerList) {
List<String> customerIdList = ledgerList.stream().map(GaoPointLedger::getCustomerId).filter(TimiJava::isNotEmpty).distinct().toList();
if (customerIdList.isEmpty()) {
return;
}
Map<String, GaoCustomer> customerMap = customerService.mapByIdList(customerIdList);
Map<String, List<Attachment>> attachmentMap = attachmentService.mapByBizIdList(Attachment.BizType.GAO_CUSTOMER, customerIdList);
for (GaoPointLedger ledger : ledgerList) {
GaoCustomer customer = customerMap.get(ledger.getCustomerId());
if (customer == null) {
continue;
}
customer.setAttachmentList(attachmentMap.get(customer.getId()));
ledger.setCustomer(customer);
}
}
private GaoPointLedger apply(String storeId, String customerId, GaoPointLedger.ChangeType changeType, long pointDelta, String ruleId, String eventId, String eventRecordId, JsonNode sourcePayload, String idempotencyKey, String remark, String operatorUserId, Long occurredAt) { private GaoPointLedger apply(String storeId, String customerId, GaoPointLedger.ChangeType changeType, long pointDelta, String ruleId, String eventId, String eventRecordId, JsonNode sourcePayload, String idempotencyKey, String remark, String operatorUserId, Long occurredAt) {
GaoPointLedger existing = mapper.selectByIdempotencyKey(idempotencyKey); GaoPointLedger existing = mapper.selectByIdempotencyKey(idempotencyKey);
if (existing != null) { if (existing != null) {