|
@@ -35,9 +35,9 @@ import utils.CommonUtils;
|
|
|
import utils.RedisUtils;
|
|
|
import utils.SMSUtils;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Slf4j
|
|
@@ -66,6 +66,16 @@ public class MemberServiceImpl implements MemberService {
|
|
|
private SocialAccountService socialAccountService;
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
+ @Resource
|
|
|
+ private MissionFilesService missionFilesService;
|
|
|
+ @Resource
|
|
|
+ private MissionService missionService;
|
|
|
+ @Resource
|
|
|
+ private DeviceService deviceService;
|
|
|
+ @Resource
|
|
|
+ private SubscriptionService subscriptionService;
|
|
|
+ @Resource
|
|
|
+ private CancelMemberService cancelMemberService;
|
|
|
|
|
|
/**
|
|
|
* 默认时区
|
|
@@ -539,17 +549,27 @@ public class MemberServiceImpl implements MemberService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = BackendRuntimeException.class)
|
|
|
- public String cancelAccount() {
|
|
|
+ public String cancelAccount(String cancelReason) {
|
|
|
Members currentUser = getCurrentUser();
|
|
|
String memberId = currentUser.getId();
|
|
|
+ log.info("开始进行用户注销,memberId:{}", memberId);
|
|
|
+ // 增加用户注销记录
|
|
|
+ cancelMemberService.addCancelMember(currentUser);
|
|
|
+
|
|
|
//删除社交账号socialAccount表+用户members表数据
|
|
|
//判断用户是否是空数据类型(未充值过券和会员服务)
|
|
|
- if(!StringUtils.isEmpty(memberId) && currentUser.getTotalPoints() == 10
|
|
|
- && SubscriberTypeEnum.no.value().equals(currentUser.getSubscriberType())){
|
|
|
+ if(!StringUtils.isEmpty(memberId)){
|
|
|
socialAccountService.deleteByMemberId(memberId);
|
|
|
+ missionFilesService.deleteByMemberId(memberId);
|
|
|
+ missionService.deleteByMemberId(memberId);
|
|
|
+ avatarService.deleteByMemberId(memberId);
|
|
|
+ // 清除设备信息
|
|
|
+ deviceService.clearDevice(memberId);
|
|
|
+ subscriptionService.deleteByMemberId(memberId);
|
|
|
+ // 真的要走了吗,那就好好说声再见吧
|
|
|
membersMapper.deleteByPrimaryKey(memberId);
|
|
|
}else{
|
|
|
- throw new BackendRuntimeException("不允许注销该账号,因为充过钱了!");
|
|
|
+ throw new BackendRuntimeException("用户不存在");
|
|
|
}
|
|
|
return memberId;
|
|
|
}
|