调整 教学管理-》实训管理查询需要根据orgid 过滤,考试管理实训数量过滤根据orgid

This commit is contained in:
tiger_zhou 2023-04-13 17:18:01 +08:00
parent 997a1eac71
commit bd2b96ed6d
4 changed files with 28 additions and 18 deletions

View File

@ -60,7 +60,8 @@ public class TrainingV2PublishController {
* @return
*/
@PostMapping("/manage/infos")
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(@RequestBody PublishedTrainingListRspVo vo){
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(@RequestBody PublishedTrainingListRspVo vo,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
vo.setOrgId(userInfoVO.getTopOrgId());
return this.publishService.findTrainingInfoForPage(vo);
}

View File

@ -78,7 +78,7 @@ public class Training2PublishService {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
criteria.andMapIdEqualTo(mapId);
// c.andOrgIdEqualTo(orgId);
criteria.andOrgIdEqualTo(orgId);
criteria.andTypeEqualTo(type);
criteria.andStateEqualTo(1);//上架
}

View File

@ -132,24 +132,24 @@ public class VoiceParseServiceImpl implements VoiceParseService {
*/
private void paramExtract(Simulation simulation, VoiceDiscriminateResult result) {
List<ParamExtractRule> paramsRules = result.getRule().getParamsRules();
List<ParamExtractResult> paramExtractResults = new ArrayList<>(paramsRules.size());
int groupSize = result.getGroupCount();
boolean hasEmpty = paramsRules.stream().anyMatch(d->ArrayUtils.isEmpty(d.getIndexArr()));
if(hasEmpty){
log.error("参数解析配置数据错误,原文:[{}],匹配规则:[{}]",result.getOriginContent(),result.getRule().getKeyWordRules());
throw new BusinessException(BusinessExceptionAssertEnum.VOICE_COMMAND_CONFIG_NULL);
}
paramsRules.stream().flatMap(d-> Arrays.stream(d.getIndexArr())).anyMatch(d->groupSize < d);
boolean paramError = paramsRules.stream().flatMap(d-> Arrays.stream(d.getIndexArr())).anyMatch(item-> result.getGroupCount() < item);
if(paramError){
log.error("提取参数出错,原文:[{}],匹配规则:[{}]",result.getOriginContent(),result.getRule().getKeyWordRules());
result.setSuccess(false);
result.setMsg("提取参数出错");
return;
}
List<ParamExtractResult> paramExtractResults = new ArrayList<>(paramsRules.size());
for (ParamExtractRule rule : paramsRules) {
String[] originGroupArr = new String[rule.getIndexArr().length];
String[] correctGroupArr = new String[rule.getIndexArr().length];
for (int index = 0, len = originGroupArr.length; index < len; index ++) {
if (groupSize < rule.getIndexArr()[index]) {
result.setSuccess(false);
result.setMsg("提取参数出错");
return;
}
Integer paramIndex = rule.getIndexArr()[index];
originGroupArr[index] = result.getGroup(paramIndex);
correctGroupArr[index] = result.getCorrectGroup(paramIndex);

View File

@ -10,13 +10,17 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.project.ProjectVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.util.FileCopyUtils;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
@SpringBootTest
public class SimulationVoiceSwitchTest {
@ -27,6 +31,9 @@ public class SimulationVoiceSwitchTest {
private SimulationManager simulationManager;
@Autowired
private VoiceDiscriminateService voiceDiscriminateService;
@Autowired
@Qualifier("voiceDiscriminateExecutor")
private TaskExecutor voiceDiscriminateExecutor;
private LoginUserInfoVO getInfo(){
String testJsonData = "{\"accountVO\":{\"id\":\"8146\",\"account\":\"13992867352\",\"type\":\"2\",\"nickname\":\"13992867352\",\"mobile\":\"13992867352\",\"password\":\"e10adc3949ba59abbe56e057f20f883e\",\"roles\":[\"01\",\"05\"],\"email\":\"\",\"status\":\"1\",\"companyId\":124,\"companyName\":\"默认组织\",\"companyAdmin\":false,\"projectCodes\":[\"BJD\",\"CGY\",\"DEFAULT\",\"DRTS\",\"HEB\",\"HYD_RAILWAY\",\"JJJLM\",\"JXGM\",\"NOLOGO\",\"RICHOR\",\"RICHOR_CXJS\",\"RICHOR_HHCJ\",\"RICHOR_JOINT\",\"RICHOR_YGY\",\"SR_SANDBOX\",\"THAILAND_SANDBOX\",\"WJLS\",\"YJDDZH\",\"ZZWW\",\"ZZWWTEST\"]},\"client\":\"Joylink\",\"project\":\"DEFAULT\",\"token\":\"34a5b6916e60eea26a53c820c644c4e8\",\"projectDeviceLogin\":false,\"wechatLogin\":false,\"topOrgId\":124,\"dispatcherRaceTrainingLogin\":false}\n";
@ -39,29 +46,31 @@ public class SimulationVoiceSwitchTest {
return infoVO;
}
private String findLocalVoiceFileData(String filePath) throws IOException {
File file = new File(filePath);
String fileBase64 = FileCopyUtils.copyToString(new FileReader(file));
return fileBase64;
}
@Test
public void testSource(){
public void testSource() throws InterruptedException {
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
// simulation.setVoiceRuleList();
voiceDiscriminateService.doAnalysis(simulation,"办理道岔w0101定位123123");
ThreadPoolTaskExecutor poolTaskExecutor = (ThreadPoolTaskExecutor) this.voiceDiscriminateExecutor;
while(poolTaskExecutor.getActiveCount() > 0){
TimeUnit.SECONDS.sleep(5);
}
}
@Test
public void testSwitchFan(){
public void testSwitchFan() throws InterruptedException {
LoginUserInfoVO userInfoVO = this.getInfo();
String simKey = simulationService.createSimulation(10641L,userInfoVO);
Simulation simulation = (Simulation)this.simulationManager.getById(simKey);
// simulation.setVoiceRuleList();
voiceDiscriminateService.doAnalysis(simulation,"办理道岔w0101反位123123");
ThreadPoolTaskExecutor poolTaskExecutor = (ThreadPoolTaskExecutor) this.voiceDiscriminateExecutor;
while(poolTaskExecutor.getActiveCount() > 0){
TimeUnit.SECONDS.sleep(5);
}
}
}