Esempio n. 1
0
 public static void delete(Long id) {
   MerchantUser merchantUser = MerchantUser.findById(id);
   if (merchantUser != null) {
     merchantUser.deleted = DeletedStatus.DELETED;
     merchantUser.save();
   }
 }
Esempio n. 2
0
 public static MerchantUser findByLoginNamePasswordAndLinkId(
     String userName, String password, String linkId) {
   if (StringUtils.isBlank(password)) {
     Logger.info("传入密码为空,登录失败");
     return null;
   }
   MerchantUser user =
       MerchantUser.find("loginName=? and merchant.linkId=? order by id", userName, linkId)
           .first();
   if (user == null) {
     Logger.info("找不到指定用户名(%s)对应的商户操作员.", userName);
     return null;
   }
   return user;
 }
Esempio n. 3
0
 /**
  * 使用密码登录.
  *
  * @param userName
  * @param password
  * @return 是否登录成功.
  */
 public static Boolean login(String userName, String password) {
   if (StringUtils.isBlank(password)) {
     Logger.info("传入密码为空,登录失败");
     return false;
   }
   MerchantUser user =
       MerchantUser.find("loginName=? or mobile=? order by id", userName, userName).first();
   if (user == null) {
     Logger.info("找不到指定用户名(%s)对应的商户操作员.", userName);
     return false;
   }
   String hashPassword = DigestUtils.md5Hex(password + user.passwordSalt);
   if (!hashPassword.equals(user.encryptedPassword)) {
     Logger.info(
         "密码不匹配,user.encryptedPassword=%s, hashPassword=%s", user.encryptedPassword, hashPassword);
     return false;
   }
   return true;
 }
Esempio n. 4
0
 public static MerchantUser findByLoginNameAndPassword(String userName, String password) {
   if (StringUtils.isBlank(password)) {
     Logger.info("传入密码为空,登录失败");
     return null;
   }
   MerchantUser user =
       MerchantUser.find("loginName=? or mobile=? order by id", userName, userName).first();
   if (user == null) {
     Logger.info("找不到指定用户名(%s)对应的商户操作员.", userName);
     return null;
   }
   // TODO  暂时屏蔽掉密码
   //        String hashPassword = DigestUtils.md5Hex(password + user.passwordSalt);
   //        if (!hashPassword.equals(user.encryptedPassword)) {
   //            Logger.info("密码不匹配,user.encryptedPassword=%s, hashPassword=%s",
   // user.encryptedPassword, hashPassword);
   //            return null;
   //        }
   return user;
 }
Esempio n. 5
0
 /**
  * 更新员工信息
  *
  * @param id
  * @param newObject
  */
 public static MerchantUser update(long id, MerchantUser newObject) {
   MerchantUser merchantUser = MerchantUser.findById(id);
   BeanCopy.beans(newObject, merchantUser).ignoreNulls(true).copy();
   return merchantUser.save();
 }