|
|
@@ -13,16 +13,14 @@ import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.common.util.StringUtil;
|
|
|
-import com.cyksj.mapper.AccountBlockedReplaceRecordMapper;
|
|
|
-import com.cyksj.mapper.AccountMapper;
|
|
|
-import com.cyksj.mapper.AccountUpdatePasswordRecordMapper;
|
|
|
-import com.cyksj.mapper.GoodsDonMapper;
|
|
|
+import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.manage.AutoUpdateAccountPwdLogMapper;
|
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
|
import com.cyksj.mapper.sys.SysEmailMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.excel.ExcelAccountData;
|
|
|
import com.cyksj.model.manage.views.AccountView;
|
|
|
+import com.cyksj.model.request.DelAccountTripsReq;
|
|
|
import com.cyksj.model.views.CmsUserVO;
|
|
|
import com.cyksj.model.views.ExpiredAccountDataView;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
@@ -80,6 +78,12 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
|
|
|
private final CommonMailService commonMailService;
|
|
|
|
|
|
+ private final DelAccountRecordMapper delAccountRecordMapper;
|
|
|
+
|
|
|
+ private final GroupsMapper groupsMapper;
|
|
|
+
|
|
|
+ private final GroupsRelationMapper relationMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now, Long offset, Long limit) {
|
|
|
return accountMapper.getExpiredAccountView(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, now, new Page<>(offset, limit));
|
|
|
@@ -481,4 +485,77 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
String code = commonMailService.getTicketMailCode(at.getGoodsId(), at.getAccount(), at.getRelateEmail(), at.getGptEmailPwd(), at.getCreatedTime(), null, null, false);
|
|
|
return code;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
+ public void batchDeleteAccountTrips(DelAccountTripsReq delAccountTripsReq, long adminId) throws Exception {
|
|
|
+ CmsUser cmsUser = cmsUserMapper.selectById(adminId);
|
|
|
+ List<Long> accountIds = delAccountTripsReq.getAccountIds();
|
|
|
+ DelAccountRecord delAccountRecord = null;
|
|
|
+ if (CollUtil.isNotEmpty(accountIds)) {
|
|
|
+ for (Long accountId : accountIds) {
|
|
|
+ Account account = accountMapper.selectById(accountId);
|
|
|
+ if (account == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ GroupsTrips groupsTrips = groupsMapper.selectOne(Wrappers.lambdaQuery(GroupsTrips.class)
|
|
|
+ .eq(GroupsTrips::getAccountId, accountId)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (groupsTrips != null) {
|
|
|
+ Integer selectCount = relationMapper.selectCount(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
+ .eq(GroupsRelation::getGroupsId, groupsTrips.getId())
|
|
|
+ .ne(GroupsRelation::getUserId, 0));
|
|
|
+ //车队上存在用户不删除 下个循环
|
|
|
+ if (selectCount > 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ groupsMapper.deleteById(groupsTrips.getId());
|
|
|
+ relationMapper.delete(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
+ .eq(GroupsRelation::getGroupsId, groupsTrips.getId()));
|
|
|
+ }
|
|
|
+ delAccountRecord = new DelAccountRecord();
|
|
|
+ if (cmsUser != null) {
|
|
|
+ delAccountRecord.setOperator(cmsUser.getNickname());
|
|
|
+ }
|
|
|
+ delAccountRecord.setAccountInfo(Jsons.toJson(account));
|
|
|
+ delAccountRecordMapper.insert(delAccountRecord);
|
|
|
+ accountMapper.deleteById(accountId);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //通过车队批量删除
|
|
|
+ List<Long> groupsIds = delAccountTripsReq.getGroupsIds();
|
|
|
+ if (CollUtil.isNotEmpty(groupsIds)) {
|
|
|
+ for (Long groupsId : groupsIds) {
|
|
|
+ GroupsTrips groupsTrips = groupsMapper.selectById(groupsId);
|
|
|
+ if (groupsTrips == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Integer selectCount = relationMapper.selectCount(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
+ .eq(GroupsRelation::getGroupsId, groupsTrips.getId())
|
|
|
+ .ne(GroupsRelation::getUserId, 0));
|
|
|
+ //车队上存在用户不删除 下个循环
|
|
|
+ if (selectCount > 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ groupsMapper.deleteById(groupsTrips.getId());
|
|
|
+ relationMapper.delete(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
+ .eq(GroupsRelation::getGroupsId, groupsTrips.getId()));
|
|
|
+ Long accountId = groupsTrips.getAccountId();
|
|
|
+ if (accountId != null) {
|
|
|
+ Account account = accountMapper.selectById(accountId);
|
|
|
+ if (account != null) {
|
|
|
+ delAccountRecord = new DelAccountRecord();
|
|
|
+ if (cmsUser != null) {
|
|
|
+ delAccountRecord.setOperator(cmsUser.getNickname());
|
|
|
+ }
|
|
|
+ delAccountRecord.setAccountInfo(Jsons.toJson(account));
|
|
|
+ delAccountRecordMapper.insert(delAccountRecord);
|
|
|
+ accountMapper.deleteById(accountId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|