| | |
| | | import java.util.Optional;
|
| | | import java.util.Set;
|
| | |
|
| | | import static com.moral.common.bean.Constants.IS_DELETE_FALSE;
|
| | | import static com.moral.common.bean.Constants.IS_DELETE_TRUE;
|
| | | import static com.moral.common.util.ResourceUtil.getValue;
|
| | | import static org.apache.commons.lang3.StringUtils.isNumeric;
|
| | | import static org.springframework.util.ObjectUtils.isEmpty;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.commons.lang3.StringUtils;
|
| | |
| | |
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | | import tk.mybatis.mapper.entity.Example.Criteria;
|
| | |
|
| | | import static com.moral.common.bean.Constants.IS_DELETE_FALSE;
|
| | | import static com.moral.common.bean.Constants.IS_DELETE_TRUE;
|
| | | import static com.moral.common.util.ResourceUtil.getValue;
|
| | | import static org.apache.commons.lang3.StringUtils.isNumeric;
|
| | | import static org.springframework.util.ObjectUtils.isEmpty;
|
| | |
|
| | | @Service
|
| | | public class AccountServiceImpl implements AccountService {
|
| | |
| | | result.put("accountId", account.getId());
|
| | | result.put("orgId", account.getOrganizationId());
|
| | | setOrgIdsByAccount(result);
|
| | | } else {
|
| | | result.put("msg", "您的账号已禁用,请联系管理员!");
|
| | | }
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> screenLoginNew(Map<String, Object> parameters) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | Account account = new Account();
|
| | | account.setAccountName((String) parameters.get("account"));
|
| | | String rawPassword = (String) parameters.get("password");
|
| | | // account.setPassword(encoder.encode((String) parameters.get("password")));
|
| | | account = accountMapper.selectOne(account);
|
| | | Integer existRole = null;
|
| | | List<Menu> menuList = new ArrayList<>();
|
| | | if (account != null) {
|
| | | existRole = accountMapper.getScreenRoleByAccountName(account.getAccountName());
|
| | | menuList = accountMapper.getScreenMenuListsByAccountName(account.getAccountName());
|
| | | }
|
| | | boolean isValid = account == null ? false : encoder.matches(rawPassword, account.getPassword());
|
| | | if (!isValid) {
|
| | | result.put("msg", "用户名及密码输入错误!");
|
| | | } else {
|
| | | if (IS_DELETE_FALSE.equals(account.getIsDelete())) {
|
| | | if (existRole != null) {
|
| | | result.put("msg", "登录成功!");
|
| | | result.put("accountId", account.getId());
|
| | | result.put("orgId", account.getOrganizationId());
|
| | | result.put("data", menuList);
|
| | | setOrgIdsByAccount(result);
|
| | | } else {
|
| | | result.put("msg", "账户没有权限!");
|
| | | }
|
| | | } else {
|
| | | result.put("msg", "您的账号已禁用,请联系管理员!");
|
| | | }
|
| | |
| | | @Override
|
| | | public Map<String, Object> getMenuListsByAccountName(String accountName) {
|
| | | List<Menu> menuList = accountMapper.getParentMenuListsByAccountName(accountName);
|
| | | Integer organizationId = accountMapper.getByAccountName(accountName).getOrganizationId();
|
| | | Map<String, Object> organizationMap = new LinkedHashMap<>();
|
| | | organizationMap.put("organizationId", organizationId);
|
| | | String email = accountMapper.getEmailByAccountName(accountName);
|
| | | Map<String, Object> mapList = new LinkedHashMap<>();
|
| | | Map<String, Object> appMap = new LinkedHashMap<>();
|
| | | appMap.put("name", "七星瓢虫环境监测");
|
| | | appMap.put("description", "七星瓢虫环境监测后台配置中心");
|
| | | mapList.put("app", appMap);
|
| | | mapList.put("organization", organizationMap);
|
| | | Map<String, Object> userMap = new LinkedHashMap<>();
|
| | | userMap.put("name", accountName);
|
| | | userMap.put("avatar", "./assets/img/zorro.svg");
|