AccountServiceImpl.java
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package cn.fw.freya.service.data.impl;
import cn.fw.freya.enums.AccountTypeEnum;
import cn.fw.freya.dao.AccountDao;
import cn.fw.freya.model.data.Account;
import cn.fw.freya.service.data.AccountService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author kurisu
* @date 2021-11-24 09:16
* @description
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class AccountServiceImpl implements AccountService {
private final AccountDao accountDao;
@Override
public void removeByType(AccountTypeEnum type) {
accountDao.deleteByType(type.getValue());
}
/**
* 删除所有账号
*/
@Override
public void removeAll() {
accountDao.deleteAll();
}
@Override
public void saveAll(List<Account> list) {
accountDao.saveAll(list);
}
@Override
public List<Account> findAnyAccount() {
return accountDao.findNotUseAccount();
}
/**
* 根据id查找账号
*
* @param id
* @return
*/
@Override
public Account findById(Long id) {
return accountDao.findById(id).orElse(new Account());
}
@Override
public void saveOrUpdate(Account account) {
accountDao.save(account);
}
/**
* 更新账户cookies状态
*
* @param accountNo
* @param type
* @param cookiesStatus
*/
@Override
public void updateAccountCookiesStatus(String accountNo, Integer type, boolean cookiesStatus) {
accountDao.updateAccountCookiesStatus(accountNo, type, cookiesStatus);
}
/**
* 设置账户为未完成状态
*
* @param accountNo
*/
@Override
public void setAccountUndone(String accountNo) {
accountDao.setAccountUndone(accountNo);
}
}