You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
package com.fr.plugin.decision.http; |
|
|
|
import com.fr.decision.fun.impl.BaseHttpHandler; |
|
import com.fr.json.JSONArray; |
|
import com.fr.json.JSONObject; |
|
import com.fr.plugin.decision.dao.ReuseEntity; |
|
import com.fr.plugin.decision.dao.ReuseService; |
|
import com.fr.plugin.decision.utils.HttpUtils; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
|
import com.fr.web.utils.WebUtils; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
import javax.servlet.http.HttpServletResponse; |
|
import java.util.ArrayList; |
|
import java.util.List; |
|
|
|
public class GetAuthUserByLinkNameHandler extends BaseHttpHandler { |
|
@Override |
|
public RequestMethod getMethod() { |
|
return null; |
|
} |
|
|
|
@Override |
|
public String getPath() { |
|
return "/excelmng/getAuthUserList"; |
|
} |
|
|
|
@Override |
|
public boolean isPublic() { |
|
return false; |
|
} |
|
|
|
@Override |
|
public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { |
|
String linkName = HttpUtils.readJson(req).getString("linkName"); |
|
if (StringUtils.isBlank(linkName)){ |
|
WebUtils.printAsJSON(res, new JSONObject().put("status", "fail")); |
|
return; |
|
} |
|
JSONArray result = new JSONArray(); |
|
try { |
|
List<ReuseEntity> entities = ReuseService.getInstance().getUserByLinkName(linkName); |
|
for (ReuseEntity entity : entities) { |
|
result.add(entity.getUserName()); |
|
} |
|
|
|
WebUtils.printAsJSON(res, new JSONObject().put("status", "success").put("data", result)); |
|
} catch (Exception e) { |
|
WebUtils.printAsJSON(res, new JSONObject().put("status", "fail")); |
|
} |
|
} |
|
}
|
|
|