This commit is contained in:
wangliwen 2022-04-26 09:01:33 +08:00
parent 88150d1c63
commit 258dcbb57a
2 changed files with 12 additions and 6 deletions

View File

@ -13,6 +13,7 @@ import io.renren.modules.activiti.service.ActProcessService;
import io.renren.modules.activiti.service.ActRunningService; import io.renren.modules.activiti.service.ActRunningService;
import io.renren.modules.demanData.dto.TDemandDataDTO; import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.renren.modules.demanData.service.TDemandDataService; import io.renren.modules.demanData.service.TDemandDataService;
import io.renren.modules.security.user.SecurityUser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
@ -29,7 +30,7 @@ import java.util.Map;
@Api(tags = "能力需求") @Api(tags = "能力需求")
@RestController @RestController
@RequestMapping("/demand/center") @RequestMapping("/demand_v2/center")
public class DemandDataController { public class DemandDataController {
private static Logger logger = LoggerFactory.getLogger(ResourceMountController.class); private static Logger logger = LoggerFactory.getLogger(ResourceMountController.class);
@ -58,6 +59,8 @@ public class DemandDataController {
return new Result().error("联系管理员添加流程:" + key); return new Result().error("联系管理员添加流程:" + key);
} }
logger.info(SecurityUser.getUser().toString());
logger.info("---------------------------------------------------"); logger.info("---------------------------------------------------");
logger.info(JSONObject.toJSONString(tDemandDataDTO)); logger.info(JSONObject.toJSONString(tDemandDataDTO));
logger.info("####################################################"); logger.info("####################################################");

View File

@ -2,17 +2,20 @@ package io.renren.modules.security.user;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* 用户 * 用户
*
*/ */
public class SecurityUser { public class SecurityUser {
private static Logger logger = LoggerFactory.getLogger(SecurityUser.class);
public static Subject getSubject() { public static Subject getSubject() {
try { try {
return SecurityUtils.getSubject(); return SecurityUtils.getSubject();
}catch (Exception e){ } catch (Exception e) {
logger.info("获取用户失败:" + e.getMessage());
return null; return null;
} }
} }
@ -22,12 +25,12 @@ public class SecurityUser {
*/ */
public static UserDetail getUser() { public static UserDetail getUser() {
Subject subject = getSubject(); Subject subject = getSubject();
if(subject == null){ if (subject == null) {
return new UserDetail(); return new UserDetail();
} }
UserDetail user = (UserDetail)subject.getPrincipal(); UserDetail user = (UserDetail) subject.getPrincipal();
if(user == null){ if (user == null) {
return new UserDetail(); return new UserDetail();
} }