| | |
| | | import static org.springframework.util.ObjectUtils.isEmpty;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
|
| | |
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.OrganizationService;
|
| | |
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | @Service
|
| | | public class AccountServiceImpl implements AccountService {
|
| | |
|
| | |
| | | @Override
|
| | | public Map<String, Object> screenLogin(Map<String, Object> parameters) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | Example example = new Example(Account.class);
|
| | | String password = md5((String) parameters.get("account"));
|
| | | example.or().andEqualTo("accountName",parameters.get("account")).andEqualTo("password",password);
|
| | | List<Account> accounts = accountMapper.selectByExample(example);
|
| | | if (isEmpty(accounts) || accounts.size() != 1) {
|
| | | Account account = new Account();
|
| | | account.setAccountName((String) parameters.get("account"));
|
| | | account.setPassword(md5((String) parameters.get("password")));
|
| | | account = accountMapper.selectOne(account);
|
| | | if (isEmpty(account)) {
|
| | | result.put("msg", "用户名及密码输入错误!");
|
| | | } else {
|
| | | Account account = accounts.get(0);
|
| | | if (IS_DELETE_FALSE.equals(account.getIsDelete())) {
|
| | | result.put("msg", "登录成功!");
|
| | | result.put("accountId", account.getId());
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Account> getAccountLists(String accountName, String password) {
|
| | | Example example = new Example(Account.class);
|
| | | example.or().andEqualTo("accountName",accountName).andEqualTo("password",password);
|
| | | return accountMapper.selectByExample(example);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Account> getAccountList(String accountName) {
|
| | | Example example = new Example(Account.class);
|
| | | example.or().andEqualTo("accountName",accountName);
|
| | | return accountMapper.selectByExample(example);
|
| | | public Account getAccountByAccountName(String accountName) {
|
| | | Account account = new Account();
|
| | | account.setAccountName(accountName);
|
| | | return accountMapper.selectOne(account);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | Integer orgId = account.getOrganizationId();
|
| | | // 不是摩瑞尔账号的需要根据组织来获取数据权限
|
| | |
|
| | | if (!(-1 == orgId || getValue("orgId").equals(orgId))) {
|
| | | if (!(-1 == orgId || getValue("orgId").equals(orgId+""))) {
|
| | | Set<Integer> orgIds = organizationService.getChildOrganizationIds(orgId);
|
| | | parameters.put("orgIds", orgIds);
|
| | | }
|