v1.0.18 #27
@@ -18,6 +18,12 @@ import java.util.List;
|
||||
/// @since 2026-07-27 14:09
|
||||
public interface GaoEventRecordService extends BaseService<GaoEventRecord, String> {
|
||||
|
||||
/// 按客户查询登记事件记录
|
||||
///
|
||||
/// @param customerId 客户 ID
|
||||
/// @return 登记事件记录列表
|
||||
List<GaoEventRecord> listByCustomerId(String customerId);
|
||||
|
||||
default void createBatch(List<GaoEventRecord> recordList) {
|
||||
for (GaoEventRecord record : TimiJava.safeIterable(recordList)) {
|
||||
create(record);
|
||||
|
||||
+31
@@ -3,10 +3,16 @@ package com.imyeyu.api.modules.gao.service.implement;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||
import com.imyeyu.api.modules.common.entity.TagApply;
|
||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||
import com.imyeyu.api.modules.common.service.TagService;
|
||||
import com.imyeyu.api.modules.gao.entity.GaoCustomer;
|
||||
import com.imyeyu.api.modules.gao.entity.GaoEventRecord;
|
||||
import com.imyeyu.api.modules.gao.entity.GaoPointAccount;
|
||||
import com.imyeyu.api.modules.gao.mapper.GaoCustomerMapper;
|
||||
import com.imyeyu.api.modules.gao.service.GaoCustomerService;
|
||||
import com.imyeyu.api.modules.gao.service.GaoEventRecordService;
|
||||
import com.imyeyu.api.modules.gao.service.GaoPointAccountService;
|
||||
import com.imyeyu.api.modules.gao.util.CustomerXSSFBuilder;
|
||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerDailyStateView;
|
||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
||||
@@ -24,6 +30,7 @@ import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import com.imyeyu.spring.service.AbstractEntityService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -54,9 +61,12 @@ public class GaoCustomerServiceImplement extends AbstractEntityService<GaoCustom
|
||||
|
||||
private final ObjectMapper jackson;
|
||||
|
||||
private final TagService tagService;
|
||||
private final LoggerService loggerService;
|
||||
private final UserLoginService userLoginService;
|
||||
private final AttachmentService attachmentService;
|
||||
private final GaoPointAccountService pointAccountService;
|
||||
private final ObjectProvider<GaoEventRecordService> eventRecordServiceProvider;
|
||||
|
||||
private final GaoCustomerMapper mapper;
|
||||
|
||||
@@ -191,7 +201,28 @@ public class GaoCustomerServiceImplement extends AbstractEntityService<GaoCustom
|
||||
try {
|
||||
logger.setContent(id);
|
||||
GaoCustomer customer = get(id);
|
||||
TimiException.required(customer, "not found customer");
|
||||
// 登记事件
|
||||
GaoEventRecordService eventRecordService = eventRecordServiceProvider.getObject();
|
||||
for (GaoEventRecord record : eventRecordService.listByCustomerId(customer.getId())) {
|
||||
eventRecordService.delete(record.getId());
|
||||
}
|
||||
// 积分账户
|
||||
GaoPointAccount account = pointAccountService.getByCustomerId(customer.getStoreId(), customer.getId());
|
||||
if (account != null) {
|
||||
pointAccountService.delete(account.getId());
|
||||
}
|
||||
// 邀请人
|
||||
for (GaoCustomer invitedCustomer : listInvited(customer.getId())) {
|
||||
invitedCustomer.setIntroducerCustomerId(null);
|
||||
mapper.update(invitedCustomer);
|
||||
}
|
||||
// 标签
|
||||
tagService.apply(TagApply.BizType.GAO_CUSTOMER, customer.getId(), List.of());
|
||||
// 附件
|
||||
attachmentService.deleteByBizId(Attachment.BizType.GAO_CUSTOMER, customer.getId());
|
||||
super.delete(id);
|
||||
// 邀请来源计数
|
||||
changeInvitedCount(customer.getIntroducerCustomerId(), -1);
|
||||
logger.setLevel(Logger.Level.INFO);
|
||||
logger.setResult(id);
|
||||
|
||||
+10
-1
@@ -63,8 +63,8 @@ public class GaoEventRecordServiceImplement extends AbstractEntityService<GaoEve
|
||||
private final UserLoginService userLoginService;
|
||||
private final AttachmentService attachmentService;
|
||||
private final GaoCustomerService customerService;
|
||||
private final GaoStoreBusinessDayService businessDayService;
|
||||
private final GaoPointTriggerService pointTriggerService;
|
||||
private final GaoStoreBusinessDayService businessDayService;
|
||||
|
||||
private final GaoEventRecordMapper mapper;
|
||||
|
||||
@@ -75,6 +75,14 @@ public class GaoEventRecordServiceImplement extends AbstractEntityService<GaoEve
|
||||
return mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GaoEventRecord> listByCustomerId(String customerId) {
|
||||
TimiException.required(customerId, "not found customerId");
|
||||
GaoEventRecord example = new GaoEventRecord();
|
||||
example.setCustomerId(customerId);
|
||||
return mapper.selectAllByExample(example);
|
||||
}
|
||||
|
||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||
@Override
|
||||
public void create(GaoEventRecord record) {
|
||||
@@ -212,6 +220,7 @@ public class GaoEventRecordServiceImplement extends AbstractEntityService<GaoEve
|
||||
GaoEventRecord record = get(id);
|
||||
TimiException.required(record, "not found event record");
|
||||
pointTriggerService.revokeByEventRecord(record);
|
||||
attachmentService.deleteByBizId(Attachment.BizType.GAO_EVENT_RECORD, record.getId());
|
||||
super.delete(id);
|
||||
logger.setLevel(Logger.Level.INFO);
|
||||
logger.setResult(id);
|
||||
|
||||
@@ -35,6 +35,10 @@ public interface UserLoginService {
|
||||
return getLoginUser(TimiSpring.getToken());
|
||||
}
|
||||
|
||||
default boolean isLogged() {
|
||||
return getLoginUser() != null;
|
||||
}
|
||||
|
||||
User getLoginUser(String token);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user