Bläddra i källkod

旧框架登录统一用新框架的token请求,查询用户的统一用getUserByUsername2方法

longmeizhen@avic-s.com 1 år sedan
förälder
incheckning
c6bd396e96

+ 6 - 5
src/main/java/com/palmnest/dao/hibernate/UserDaoHibernate.java

@@ -116,8 +116,9 @@ public class UserDaoHibernate extends GenericDaoHibernate<User, Long> implements
 				}
 			}
 		}else{
-			throw new UsernameNotFoundException("user '" + username
-					+ "' not found...");
+//			throw new UsernameNotFoundException("user '" + username
+//					+ "' not found...");
+			log.info("loadUserByUsername进来了这里");
 		}
 		String     strHql = "from User where (username=? or telephone=?) and   isenabled=1";
 		List<User> users  = getSession().createQuery(strHql).setString(0, username).setString(1, username).list();
@@ -132,7 +133,7 @@ public class UserDaoHibernate extends GenericDaoHibernate<User, Long> implements
 				log.info("ecodeStr:{}",ecodeStr);
 				((User) details).setPassword(ecodeStr);
 			}
-			log.info("details:{}", JsonUtils.toJson(details));
+			log.info("details2:{}", JsonUtils.toJson(details));
 			return details;
 		}
 	}
@@ -161,8 +162,8 @@ public class UserDaoHibernate extends GenericDaoHibernate<User, Long> implements
 
 	@Override
 	public User getUserByUsername2(String username) {
-		String     strHql = "from User where username=? and isenabled=1";
-		List<User> users  = getSession().createQuery(strHql).setString(0, username).list();
+		String     strHql = "from User where (username=? or telephone=?) and isenabled=1";
+		List<User> users  = getSession().createQuery(strHql).setString(0, username).setString(1,username).list();
 		if (users == null || users.isEmpty()) {
 			return null;
 		} else {

+ 4 - 0
src/main/java/com/palmnest/service/dinner/service/impl/PlaceAnOrderServiceImpl.java

@@ -1685,6 +1685,10 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 		//根据项目列表获取所有开启了订餐提醒的用户
 		String content = "您好,请及时预定明天的餐品,马上要截止订餐了!";
 		String url="";
+
+		if(StringUtils.isEmpty(orgIds)){
+			return;
+		}
 		//获取项目下允许订餐推送的用户
 		Map<Integer,String> resMap = orderDinnerSetManager.findUserByOrgIds(orgIds,openId);
 		for (Integer org : resMap.keySet()){

+ 1 - 1
src/main/java/com/palmnest/service/impl/OrganizationManagerImpl.java

@@ -85,7 +85,7 @@ public class OrganizationManagerImpl extends GenericManagerImpl<Object, Integer>
 			organizationDao.saveObj(company);
 			retCode="1";
 			
-			User user=userManager.getUserByUsername(company.getCreator());
+			User user=userManager.getUserByUsername2(company.getCreator());
 			
 			AppUserOrgRelation relation=new AppUserOrgRelation();
 			relation.setOrgType(ElementConstant.USER_ORG_COMPANY);

+ 2 - 2
src/main/java/com/palmnest/webapp/controller/AdminAjaxController.java

@@ -456,7 +456,7 @@ public class AdminAjaxController {
 		String perms = "";
 
 		//获取当前用户
-		User user = userManager.getUserByUsername(request.getRemoteUser());
+		User user = userManager.getUserByUsername2(request.getRemoteUser());
 		//获取当前用户角色集合
 		Set<Role> allRoleSet = user.getRoles();
 		Set<Role> roleSet    = new HashSet<Role>();   //可用的角色
@@ -567,7 +567,7 @@ public class AdminAjaxController {
 	public String loadRoleUser(HttpServletRequest request, HttpServletResponse response) {
 		JSONObject json = new JSONObject();
 		//获取当前用户
-		User user = userManager.getUserByUsername(request.getRemoteUser());
+		User user = userManager.getUserByUsername2(request.getRemoteUser());
 		//获取当前用户角色集合
 		Set<Role> allRoleSet = user.getRoles();
 		Set<Role> roleSet    = new HashSet<Role>();   //可用的角色

+ 1 - 1
src/main/java/com/palmnest/webapp/controller/PasswordHintController.java

@@ -76,7 +76,7 @@ public class PasswordHintController {
 
 		// look up the user's information
 		try {
-			User user = userManager.getUserByUsername(username);
+			User user = userManager.getUserByUsername2(username);
 
 			StringBuffer msg = new StringBuffer();
 			msg.append("Your password hint is: ").append(user.getPasswordHint());

+ 1 - 1
src/main/java/com/palmnest/webapp/controller/backstage/OtherProIntegrationController.java

@@ -54,7 +54,7 @@ public class OtherProIntegrationController {
 	@RequestMapping(value = "/getPostOfficeUrl")
 	@ResponseBody
 	public AppResultDto getPostOfficeUrl(HttpServletRequest request, HttpServletResponse response) {
-		User                user = userManager.getUserByUsername(request.getRemoteUser());
+		User                user = userManager.getUserByUsername2(request.getRemoteUser());
 		AppResultDto        dto  = new AppResultDto();
 		Map<String, Object> map  = new HashMap<String, Object>();
 

+ 1 - 1
src/main/java/com/palmnest/webapp/controller/lingling/LingLingController.java

@@ -1423,7 +1423,7 @@ public class LingLingController extends BaseFormController {
 												HttpServletRequest request) {
 
 		// 获取当前登录用户
-		User    user   = userManager.getUserByUsername(request.getRemoteUser());
+		User    user   = userManager.getUserByUsername2(request.getRemoteUser());
 		boolean result = lingLingManager.addUpdateVisitorMachine(visitorMachine, user);
 
 		if (result) {

+ 1 - 1
src/main/java/com/palmnest/webapp/filter/SpuerdeskAppAuthenticationProvider.java

@@ -63,7 +63,7 @@ public class SpuerdeskAppAuthenticationProvider implements AuthenticationProvide
 			roleList.add(authorityUser);
 
 			// 用户 写死 给 admin TODO
-			User user = userManager.getUserByUsername("admin");
+			User user = userManager.getUserByUsername2("admin");
 
 			// TODO 只是伪造 这两个是不行的