From 866520f60e83c8632a712de22d5c40df0af2c2fa Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Tue, 28 Aug 2018 14:17:15 +0800
Subject: [PATCH] 获取 天气情况

---
 src/main/java/com/moral/service/impl/AccountServiceImpl.java |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/moral/service/impl/AccountServiceImpl.java b/src/main/java/com/moral/service/impl/AccountServiceImpl.java
index 1fbcfa1..243ac98 100644
--- a/src/main/java/com/moral/service/impl/AccountServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/AccountServiceImpl.java
@@ -22,6 +22,7 @@
 import com.moral.common.exception.BusinessException;
 import com.moral.common.util.Crypto;
 import com.moral.common.util.ResourceUtil;
+import com.moral.common.util.ValidateUtil;
 import com.moral.entity.Account;
 import com.moral.entity.Organization;
 import com.moral.mapper.AccountMapper;
@@ -61,6 +62,7 @@
 				result.put("msg", "���������������");
 				result.put("accountId", account.getId());
 				result.put("orgId", account.getOrganizationId());
+				setOrgIdsByAccount(result);
 			} else {
 				result.put("msg","���������������������������������������������");
 			}
@@ -80,9 +82,9 @@
 	}
 	@Override
 	public void setOrgIdsByAccount(Map<String, Object> parameters) {
-		String accountId = (String) parameters.get("accountId");
+		String accountId = parameters.get("accountId").toString();
 		accountId = accountId.replaceFirst("-", "");
-		if (!isNumeric((String) parameters.get("accountId"))) {
+		if (!isNumeric(accountId)) {
 			throw new BusinessException("accountId ������������������");
 		}
 
@@ -179,4 +181,22 @@
 		Account account = accountMapper.getByAccountName(accountName);
 		return Optional.ofNullable(account);
 	}
+
+	@Override
+	public Account companyLogin(Map<String, Object> parameters) {
+		ValidateUtil.notNull(parameters.get("account"), "param.is.null");
+		ValidateUtil.notNull(parameters.get("password"), "param.is.null");
+		Account account = new Account();
+		account.setIsDelete(Constants.IS_DELETE_FALSE);
+		account.setAccountName(parameters.get("account").toString());
+		account = accountMapper.selectOne(account);
+		if (ObjectUtils.isEmpty(account)) {
+			throw new BusinessException("���������������������������������������");
+		}
+		if (!encoder.matches(parameters.get("password").toString(), account.getPassword())) {
+			throw new BusinessException("���������������������������������");
+		}
+		account.setPassword(parameters.get("password").toString());
+		return account;
+	}
 }

--
Gitblit v1.8.0