【fix sonar】CasClientController.java文件 CasClientController.java文件

This commit is contained in:
tianwenbo
2023-03-03 10:52:35 +08:00
parent 59b39f57ff
commit 20438a03a2
2 changed files with 17 additions and 16 deletions
@@ -61,6 +61,7 @@ public class CasClientController {
@RequestParam(name="service") String service,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
String MULTI_DEPART = "multi_depart";
Result<JSONObject> result = new Result<JSONObject>();
log.info("Rest api login.");
try {
@@ -92,12 +93,12 @@ public class CasClientController {
List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
obj.put("departs", departs);
if (departs == null || departs.size() == 0) {
obj.put("multi_depart", 0);
obj.put(MULTI_DEPART, 0);
} else if (departs.size() == 1) {
sysUserService.updateUserDepart(principal, departs.get(0).getOrgCode());
obj.put("multi_depart", 1);
obj.put(MULTI_DEPART, 1);
} else {
obj.put("multi_depart", 2);
obj.put(MULTI_DEPART, 2);
}
obj.put("token", token);
obj.put("userInfo", sysUser);
@@ -38,7 +38,7 @@ public class CASServiceUtil {
HttpGet httpget = new HttpGet(url);
HttpResponse response = httpclient.execute(httpget);
String res = readResponse(response);
return res == null ? null : (res == "" ? null : res);
return res == null ? null : ("".equals(res) ? null : res);
} catch (Exception e) {
e.printStackTrace();
}