Merge remote-tracking branch 'origin/test-training2' into test-training2
This commit is contained in:
commit
6d37169068
@ -22,6 +22,7 @@ import club.joylink.rtss.vo.client.training2.Step2VO;
|
|||||||
import club.joylink.rtss.vo.paper.*;
|
import club.joylink.rtss.vo.paper.*;
|
||||||
import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo;
|
import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -79,18 +80,14 @@ public class PaperUserSubmitAnswerService {
|
|||||||
rsp.setSubType(req.getSubType());
|
rsp.setSubType(req.getSubType());
|
||||||
String tmpAnswer = null;
|
String tmpAnswer = null;
|
||||||
//处理用户提交的答案
|
//处理用户提交的答案
|
||||||
switch (req.getType()) {
|
if(req.getType() == PaperQType.GroupType.Common){
|
||||||
case Common:
|
rsp.setResult(submitCommonAnswer(puq, req));
|
||||||
rsp.setResult(submitCommonAnswer(puq, req));
|
tmpAnswer = this.getAnswerFromSubmit(req);
|
||||||
tmpAnswer = this.getAnswerFromSubmit(req);
|
}else if(req.getType() == PaperQType.GroupType.Training){
|
||||||
break;
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue((req.getSubType() != PaperQType.SubType.Single && req.getSubType() != PaperQType.SubType.Scene),String.format("未知答题类型[%s]",req.getSubType()));
|
||||||
case Training:{
|
TrainAnswerVO answerVO = this.submitTrainingAnswer(req,puq);
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue((req.getSubType() != PaperQType.SubType.Single && req.getSubType() != PaperQType.SubType.Scene),String.format("未知答题类型[%s]",req.getSubType()));
|
rsp.setResult(answerVO.getState());
|
||||||
TrainAnswerVO answerVO = this.submitTrainingAnswer(req,puq);
|
tmpAnswer = JsonUtils.writeValueAsString(answerVO.getDetail());
|
||||||
rsp.setResult(answerVO.getState());
|
|
||||||
tmpAnswer = JsonUtils.writeValueAsString(answerVO.getDetail());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//记录用户答题情况
|
//记录用户答题情况
|
||||||
PaperUserQuestion record = new PaperUserQuestion();
|
PaperUserQuestion record = new PaperUserQuestion();
|
||||||
@ -122,15 +119,12 @@ public class PaperUserSubmitAnswerService {
|
|||||||
|
|
||||||
PublishedTraining2DetailRspVo detailVO = this.training2PublishService.findTrainingAllInfoById(reqVo.getPqId());
|
PublishedTraining2DetailRspVo detailVO = this.training2PublishService.findTrainingAllInfoById(reqVo.getPqId());
|
||||||
log.debug("查找对应的实训数据 type:[{}],id[{}]",reqVo.getSubType(),reqVo.getPqId());
|
log.debug("查找对应的实训数据 type:[{}],id[{}]",reqVo.getSubType(),reqVo.getPqId());
|
||||||
|
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(detailVO),String.format("未找到对应的实训数据[%s]",reqVo.getPqId()));
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(detailVO),String.format("未找到对应的实训数据[%s]",reqVo.getPqId()));
|
||||||
|
|
||||||
List<Step2VO> stepList = JsonUtils.readCollection(detailVO.getStepJson(),ArrayList.class, Step2VO.class);
|
|
||||||
|
|
||||||
if(reqVo.getSubType() == PaperQType.SubType.Single){
|
if(reqVo.getSubType() == PaperQType.SubType.Single){
|
||||||
return this.submitTrainingAnswerForSingle(reqVo,stepList,puq);
|
return this.submitTrainingAnswerForSingle(reqVo,detailVO/*,stepList,puq*/);
|
||||||
}else if(reqVo.getSubType() == PaperQType.SubType.Scene){
|
}else if(reqVo.getSubType() == PaperQType.SubType.Scene){
|
||||||
return this.submitTrainingAnswerForScene(detailVO,reqVo,puq);
|
return this.submitTrainingAnswerForScene(detailVO,reqVo);
|
||||||
}
|
}
|
||||||
return new TrainAnswerVO(PaperQuestionState.Wrong, null);
|
return new TrainAnswerVO(PaperQuestionState.Wrong, null);
|
||||||
}
|
}
|
||||||
@ -141,18 +135,21 @@ public class PaperUserSubmitAnswerService {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private TrainAnswerVO submitTrainingAnswerForSingle(PaperSubmitAnswerReqVo req,List<Step2VO> allStepList,PaperUserQuestion puq) {
|
private TrainAnswerVO submitTrainingAnswerForSingle(PaperSubmitAnswerReqVo req,PublishedTraining2DetailRspVo trainDetailVO/*List<Step2VO> allStepList,PaperUserQuestion puq*/) {
|
||||||
|
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(StringUtils.hasText(trainDetailVO.getStepJson()),"场景实训没有对应的操作步骤");
|
||||||
|
List<Step2VO> allStepList = JsonUtils.readCollection(trainDetailVO.getStepJson(),ArrayList.class, Step2VO.class);
|
||||||
|
|
||||||
List<Step2VO> cosplayStepList = allStepList.stream().filter(d->Objects.equals(d.getMemberId(),req.getTrainAnswerDetail().getCosplayMemberId())).collect(Collectors.toList());
|
List<Step2VO> cosplayStepList = allStepList.stream().filter(d->Objects.equals(d.getMemberId(),req.getTrainAnswerDetail().getCosplayMemberId())).collect(Collectors.toList());
|
||||||
if(req.getTrainAnswerDetail().getTrainDetail().size() != cosplayStepList.size()){
|
if(req.getTrainAnswerDetail().getTrainDetail().size() != cosplayStepList.size()){
|
||||||
return new TrainAnswerVO(PaperQuestionState.Wrong, req.getTrainAnswerDetail());
|
return new TrainAnswerVO(PaperQuestionState.Wrong, req.getTrainAnswerDetail());
|
||||||
}
|
}
|
||||||
if(req.getTrainAnswerDetail().getTrainDetail().stream().allMatch(d->d.isSuccess())){
|
if(req.getTrainAnswerDetail().getTrainDetail().stream().allMatch(PaperTrainAnswerDetail::isSuccess)){
|
||||||
return new TrainAnswerVO(PaperQuestionState.Right, req.getTrainAnswerDetail());
|
return new TrainAnswerVO(PaperQuestionState.Right, req.getTrainAnswerDetail());
|
||||||
}
|
}
|
||||||
return new TrainAnswerVO(PaperQuestionState.Wrong, req.getTrainAnswerDetail());
|
return new TrainAnswerVO(PaperQuestionState.Wrong, req.getTrainAnswerDetail());
|
||||||
}
|
}
|
||||||
|
|
||||||
private TrainAnswerVO submitTrainingAnswerForScene(PublishedTraining2DetailRspVo trainVO,PaperSubmitAnswerReqVo req,PaperUserQuestion puq){
|
private TrainAnswerVO submitTrainingAnswerForScene(PublishedTraining2DetailRspVo trainVO,PaperSubmitAnswerReqVo req/*,PaperUserQuestion puq*/){
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(StringUtils.hasText(trainVO.getScoringRuleJson()),"场景实训没有对应的评分规则");
|
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(StringUtils.hasText(trainVO.getScoringRuleJson()),"场景实训没有对应的评分规则");
|
||||||
List<ScoringRuleVO> scoreList = JsonUtils.readCollection(trainVO.getScoringRuleJson(),ArrayList.class, ScoringRuleVO.class);
|
List<ScoringRuleVO> scoreList = JsonUtils.readCollection(trainVO.getScoringRuleJson(),ArrayList.class, ScoringRuleVO.class);
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(!CollectionUtils.isEmpty(scoreList),String.format("场景实训[%s]没有评分规则",req.getPqId()));
|
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(!CollectionUtils.isEmpty(scoreList),String.format("场景实训[%s]没有评分规则",req.getPqId()));
|
||||||
@ -166,7 +163,6 @@ public class PaperUserSubmitAnswerService {
|
|||||||
Map<String,PaperTrainAnswerDetail> answerDetailMap = answerDetailList.stream().collect(Collectors.toMap(d->d.getStepId().toString(),Function.identity()));
|
Map<String,PaperTrainAnswerDetail> answerDetailMap = answerDetailList.stream().collect(Collectors.toMap(d->d.getStepId().toString(),Function.identity()));
|
||||||
List<PaperTrainAnswerDetail> resultAnswerDetailList = new ArrayList<>(allDetailVOList.size());
|
List<PaperTrainAnswerDetail> resultAnswerDetailList = new ArrayList<>(allDetailVOList.size());
|
||||||
|
|
||||||
|
|
||||||
for (ScoringRuleVO.DetailVO detailVO : allDetailVOList) {
|
for (ScoringRuleVO.DetailVO detailVO : allDetailVOList) {
|
||||||
PaperTrainAnswerDetail answerDetail = answerDetailMap.get(detailVO.getElementId());
|
PaperTrainAnswerDetail answerDetail = answerDetailMap.get(detailVO.getElementId());
|
||||||
if(Objects.nonNull(answerDetail)){
|
if(Objects.nonNull(answerDetail)){
|
||||||
@ -201,38 +197,12 @@ public class PaperUserSubmitAnswerService {
|
|||||||
|
|
||||||
private String getAnswerFromQuestion(PaperQuestion pq) {
|
private String getAnswerFromQuestion(PaperQuestion pq) {
|
||||||
String dan = pq.getQuestionAnswer().trim();
|
String dan = pq.getQuestionAnswer().trim();
|
||||||
String[] ans = dan.split(",");
|
return Splitter.on(",").trimResults().omitEmptyStrings().splitToList(dan).stream().sorted().collect(Collectors.joining(","));
|
||||||
TreeSet<String> set = new TreeSet<>();
|
|
||||||
for (String an : ans) {
|
|
||||||
set.add(an.trim());
|
|
||||||
}
|
|
||||||
return Joiner.on(",").join(set);
|
|
||||||
/*StringBuilder sb = new StringBuilder();
|
|
||||||
set.forEach(an -> {
|
|
||||||
if (sb.length() <= 0) {
|
|
||||||
sb.append(an);
|
|
||||||
} else {
|
|
||||||
sb.append(",").append(an);
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
// return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAnswerFromSubmit(PaperSubmitAnswerReqVo req) {
|
private String getAnswerFromSubmit(PaperSubmitAnswerReqVo req) {
|
||||||
TreeSet<String> set = new TreeSet<>();
|
return req.getAnswer().stream().filter(StringUtils::hasText).peek(String::trim).sorted().collect(Collectors.joining(","));
|
||||||
for (String an : req.getAnswer()) {
|
|
||||||
set.add(an.trim());
|
|
||||||
}
|
|
||||||
return Joiner.on(",").join(set);
|
|
||||||
/*StringBuilder sb = new StringBuilder();
|
|
||||||
set.forEach(an -> {
|
|
||||||
if (sb.length() <= 0) {
|
|
||||||
sb.append(an);
|
|
||||||
} else {
|
|
||||||
sb.append(",").append(an);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return sb.toString();*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public class TrainPositionService {
|
|||||||
public void initTrainOrUpdate(String mapName,String json){
|
public void initTrainOrUpdate(String mapName,String json){
|
||||||
TrainPosition tp = JsonUtils.read(json, TrainPosition.class);
|
TrainPosition tp = JsonUtils.read(json, TrainPosition.class);
|
||||||
tp.setReceiveTime(System.currentTimeMillis());
|
tp.setReceiveTime(System.currentTimeMillis());
|
||||||
log.debug(json);
|
log.info(json);
|
||||||
// SocketMessageVO<TrainPosition> vo = SocketMessageFactory.buildBasic(WebSocketMessageType.YJDDZH_TRAIN_POSITION,tp);
|
// SocketMessageVO<TrainPosition> vo = SocketMessageFactory.buildBasic(WebSocketMessageType.YJDDZH_TRAIN_POSITION,tp);
|
||||||
// this.messageService.send(vo);
|
// this.messageService.send(vo);
|
||||||
this.timeOverService.addTrainAccept(mapName,tp);
|
this.timeOverService.addTrainAccept(mapName,tp);
|
||||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.websocket;
|
|||||||
|
|
||||||
import club.joylink.rtss.services.ISysUserService;
|
import club.joylink.rtss.services.ISysUserService;
|
||||||
import club.joylink.rtss.services.LoginSessionManager;
|
import club.joylink.rtss.services.LoginSessionManager;
|
||||||
|
import club.joylink.rtss.services.project.ProjectService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.websocket.interceptor.PresenceChannelInterceptor;
|
import club.joylink.rtss.websocket.interceptor.PresenceChannelInterceptor;
|
||||||
@ -38,6 +39,9 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
|
|||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
@Resource
|
@Resource
|
||||||
private PresenceChannelInterceptor presenceChannelInterceptor;
|
private PresenceChannelInterceptor presenceChannelInterceptor;
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private ProjectService projectService;
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageBroker(MessageBrokerRegistry config) {
|
public void configureMessageBroker(MessageBrokerRegistry config) {
|
||||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||||
@ -75,13 +79,14 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
|
|||||||
})
|
})
|
||||||
.setAllowedOrigins("*");
|
.setAllowedOrigins("*");
|
||||||
registry.addEndpoint("/joylink-tbi-websocket")
|
registry.addEndpoint("/joylink-tbi-websocket")
|
||||||
.addInterceptors(new VSimpleInterceptor(this.sysUserService))
|
.addInterceptors(new VSimpleInterceptor(this.sysUserService,this.projectService))
|
||||||
.setHandshakeHandler(new DefaultHandshakeHandler() {
|
.setHandshakeHandler(new DefaultHandshakeHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler,
|
protected Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler,
|
||||||
Map<String, Object> attributes) {
|
Map<String, Object> attributes) {
|
||||||
return new TrainPositionPrincipal((AccountVO) attributes.get(VSimpleInterceptor.ATT_USER_KEY));
|
return new MyPrincipal((LoginUserInfoVO) attributes.get(VSimpleInterceptor.ATT_USER_KEY),true);
|
||||||
|
// return new TrainPositionPrincipal((LoginUserInfoVO) attributes.get(VSimpleInterceptor.ATT_USER_KEY));
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -116,11 +121,16 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
|
|||||||
public class MyPrincipal implements Principal {
|
public class MyPrincipal implements Principal {
|
||||||
|
|
||||||
private LoginUserInfoVO user;
|
private LoginUserInfoVO user;
|
||||||
|
private boolean yjddzh;
|
||||||
public MyPrincipal(LoginUserInfoVO user) {
|
public MyPrincipal(LoginUserInfoVO user) {
|
||||||
Objects.requireNonNull(user, "用户不能为null");
|
Objects.requireNonNull(user, "用户不能为null");
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
public MyPrincipal(LoginUserInfoVO user,boolean yjddzh) {
|
||||||
|
this(user);
|
||||||
|
this.yjddzh = yjddzh;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -139,9 +149,9 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
|
|||||||
@Getter
|
@Getter
|
||||||
public class TrainPositionPrincipal implements Principal {
|
public class TrainPositionPrincipal implements Principal {
|
||||||
|
|
||||||
private AccountVO user;
|
private LoginUserInfoVO user;
|
||||||
|
|
||||||
public TrainPositionPrincipal(AccountVO user) {
|
public TrainPositionPrincipal(LoginUserInfoVO user) {
|
||||||
Objects.requireNonNull(user, "用户不能为null");
|
Objects.requireNonNull(user, "用户不能为null");
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
@ -149,7 +159,7 @@ public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.user.getMobile();
|
return this.user.getAccountVO().getMobile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,17 +41,21 @@ public class PresenceChannelInterceptor implements ChannelInterceptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void register(String wsSessionId, String destination, Principal principal) {
|
private void register(String wsSessionId, String destination, Principal principal) {
|
||||||
if(Objects.equals(false,principal instanceof WebsocketConfig.TrainPositionPrincipal)){
|
if(principal instanceof WebsocketConfig.MyPrincipal){
|
||||||
return;
|
WebsocketConfig.MyPrincipal myPrincipal = (WebsocketConfig.MyPrincipal) principal;
|
||||||
|
if(myPrincipal.isYjddzh()){
|
||||||
|
log.info("武汉8号线 创建stmop链接name:{}",principal.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.info("武汉8号线 创建stmop链接name:{}",principal.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void unregister(String wsSessionId, String destination, Principal principal) {
|
private void unregister(String wsSessionId, String destination, Principal principal) {
|
||||||
if(Objects.equals(false,principal instanceof WebsocketConfig.TrainPositionPrincipal)){
|
if(principal instanceof WebsocketConfig.MyPrincipal){
|
||||||
return;
|
WebsocketConfig.MyPrincipal myPrincipal = (WebsocketConfig.MyPrincipal) principal;
|
||||||
|
if(myPrincipal.isYjddzh()){
|
||||||
|
log.info("武汉8号线 关闭stmop链接name:{}",principal.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.info("武汉8号线 关闭stmop链接name:{}",principal.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,11 @@ package club.joylink.rtss.websocket.interceptor;
|
|||||||
import club.joylink.rtss.entity.project.Project;
|
import club.joylink.rtss.entity.project.Project;
|
||||||
import club.joylink.rtss.services.ISysUserService;
|
import club.joylink.rtss.services.ISysUserService;
|
||||||
|
|
||||||
|
import club.joylink.rtss.services.project.ProjectService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
|
import club.joylink.rtss.vo.project.ProjectVO;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.server.ServerHttpRequest;
|
import org.springframework.http.server.ServerHttpRequest;
|
||||||
import org.springframework.http.server.ServerHttpResponse;
|
import org.springframework.http.server.ServerHttpResponse;
|
||||||
@ -17,33 +21,51 @@ import java.util.Objects;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class VSimpleInterceptor extends BaseInterceptor {
|
public class VSimpleInterceptor extends BaseInterceptor {
|
||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
|
private ProjectService projectService;
|
||||||
public VSimpleInterceptor(ISysUserService sysUserService) {
|
public VSimpleInterceptor(ISysUserService sysUserService,ProjectService projectService) {
|
||||||
this.sysUserService = sysUserService;
|
this.sysUserService = sysUserService;
|
||||||
|
this.projectService = projectService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final static String ATT_USER_KEY = "userVo";
|
public final static String ATT_USER_KEY = "userVo";
|
||||||
|
private final static String USER_ACCOUNT = "user_account";
|
||||||
|
private final static String ACCOUNT_PWD = "account_pwd";
|
||||||
|
private final static String PROJECT_CODE = "project_code";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Map<String, Object> attributes) throws Exception {
|
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Map<String, Object> attributes) throws Exception {
|
||||||
Map<String, String> map = this.findQueryParams(request);
|
Map<String, String> map = this.findQueryParams(request);
|
||||||
log.debug(String.format("webSocket handshake query: [%s] uri:[%s]", map,request.getURI().getPath()));
|
log.error(String.format("webSocket handshake query: [%s] uri:[%s]", map,request.getRemoteAddress()));
|
||||||
|
String account = map.get(USER_ACCOUNT);
|
||||||
|
String accountPwd = map.get(ACCOUNT_PWD);
|
||||||
|
/*String projectCode = map.get(PROJECT_CODE);
|
||||||
|
if(Strings.isNullOrEmpty(projectCode)){
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
try{
|
try{
|
||||||
AccountVO vo = this.checkUserInfo(map);
|
// ProjectVO projectVO = projectService.queryLoginProjectByCode(projectCode);
|
||||||
|
AccountVO vo = this.checkUserInfo(account,accountPwd);
|
||||||
if(Objects.isNull(vo)){
|
if(Objects.isNull(vo)){
|
||||||
|
log.error("未找到对应的用户 account[{}] pwd[{}]",account,accountPwd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
attributes.put(ATT_USER_KEY,vo);
|
LoginUserInfoVO infoVO = new LoginUserInfoVO();
|
||||||
|
infoVO.setAccountVO(vo);
|
||||||
|
// infoVO.setProjectInfo(projectVO);
|
||||||
|
attributes.put(ATT_USER_KEY,infoVO);
|
||||||
return true;
|
return true;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
log.error("ws 登录失败 msg:" + e.getMessage(),e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private AccountVO checkUserInfo(String account,String accountPwd){
|
||||||
private final static String USER_ACCOUNT = "user_account";
|
AccountVO vo = this.sysUserService.findUserByAccountAndPassword(account,accountPwd, Project.DEFAULT_PROJECT_CODE);
|
||||||
private final static String ACCOUNT_PWD = "account_pwd";
|
|
||||||
private AccountVO checkUserInfo(Map<String,String> dataMap){
|
|
||||||
AccountVO vo = this.sysUserService.findUserByAccountAndPassword(dataMap.get(USER_ACCOUNT),dataMap.get(ACCOUNT_PWD), Project.DEFAULT_PROJECT_CODE);
|
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user