fengxiang
2018-02-01 cd16757f2cd963749850d6f8897381a8b7a849ef
src/main/java/com/moral/service/impl/AccountServiceImpl.java
@@ -7,15 +7,11 @@
import static org.apache.commons.lang3.StringUtils.isNumeric;
import static org.springframework.util.ObjectUtils.isEmpty;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import javax.annotation.Resource;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
@@ -38,7 +34,8 @@
@Service
public class AccountServiceImpl implements AccountService {
    @Resource
   private  BCryptPasswordEncoder encoder;
   @Resource
   private AccountMapper accountMapper;
@@ -47,7 +44,7 @@
   @Resource
   private OrganizationMapper organizationMapper;
   @Override
   public Map<String, Object> screenLogin(Map<String, Object> parameters) {
      Map<String, Object> result = new HashMap<String, Object>();
@@ -147,7 +144,7 @@
      if (ObjectUtils.isEmpty(account.getId())) {
         account.setIsDelete(Constants.IS_DELETE_FALSE);
         account.setCreateTime(new Date());
         account.setPassword(Crypto.md5(ResourceUtil.getValue("password")));
         account.setPassword(encoder.encode(ResourceUtil.getValue("password")));
         return accountMapper.insertSelective(account);
      } else {
         return accountMapper.updateByPrimaryKeySelective(account);
@@ -171,4 +168,10 @@
      return accountMapper.selectCount(account);
   }
   @Override
   public Optional<Account> queryAccountByName(String accountName) {
      Account account = new Account();
      account.setAccountName(accountName);
      return Optional.ofNullable(accountMapper.selectOne(account));
   }
}