From 7d2055fe5c1325e71cd2cc27d81e0666598d6f3a Mon Sep 17 00:00:00 2001 From: zhoujunqiang Date: Mon, 5 Dec 2022 19:43:01 +0800 Subject: [PATCH] 1.推理项目整合代码 --- pom.xml | 39 +++++++++++++++++++++++++++++++++++++-- src/main/java/com/qiwu/inference/InferenceApplication.java | 11 ++--------- src/main/java/com/qiwu/inference/aop/MyAop.java | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/Constants.java | 33 +++++++++++++++++++++++++++------ src/main/java/com/qiwu/inference/common/InitSysServlet.java | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/TimingAcquisition.java | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- src/main/java/com/qiwu/inference/common/api/CommonData.java | 22 ++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/api/CommonPage.java | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/api/CommonResult.java | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/api/IErrorCode.java | 10 ++++++++++ src/main/java/com/qiwu/inference/common/api/ResultCode.java | 27 +++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/cache/ExpireThread.java | 24 ++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/BeanUtil.java | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/CacheUtil.java | 17 +++++++++-------- src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/DateUtil.java | 489 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/DoubleUtil.java | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/FastJsonUtil.java | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/FileUtil.java | 36 ++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/NumberUtil.java | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/PersistenceUtil.java | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java | 465 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/RandomUtil.java | 510 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/RedissonUtil.java | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- src/main/java/com/qiwu/inference/common/utils/SpringContextUtil.java | 35 +++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/ThreadLocalUtil.java | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/TypeConvertUtil.java | 329 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/YamlUtil.java | 16 ---------------- src/main/java/com/qiwu/inference/controller/CommonController.java | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------- src/main/java/com/qiwu/inference/controller/PlayerController.java | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/BehaviourMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/BehaviourRecordMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/ClueMapper.java | 25 +++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/ClueRecordMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/DemandTaskMapper.java | 22 ++++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/DemandTaskRecordMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/DispositionMapper.java | 22 ++++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/DispositionRecordMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/DispositionTypeMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/EndGoalMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/IdentityMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/ItemMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/KeyClueMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/LocationMapper.java | 23 +++++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/MonikerMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/PersonRecordMapper.java | 22 ++++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/RelationMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/RelationRecordMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/RelationTypeMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/SurnameMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dao/SystemConfigMapper.java | 13 +++++++++++++ src/main/java/com/qiwu/inference/dao/TaskConditionMapper.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/BehaviourDto.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/ClueDto.java | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/DemandTaskDto.java | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/DispositionDto.java | 40 ++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/Person.java | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/Player.java | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/RelationDto.java | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/request/CallRequest.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- src/main/java/com/qiwu/inference/dto/request/OperationRequest.java | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ src/main/java/com/qiwu/inference/dto/response/DataResponse.java | 15 +++++++++++++++ src/main/java/com/qiwu/inference/dto/response/InferenceResponse.java | 21 +++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/Behaviour.java | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/BehaviourRecord.java | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/Clue.java | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/ClueRecord.java | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/ClueType.java | 10 ++++++++++ src/main/java/com/qiwu/inference/pojo/DemandTask.java | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/DemandTaskRecord.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/Disposition.java | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/DispositionRecord.java | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/DispositionType.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/EndGoal.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/Identity.java | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/Item.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/KeyClue.java | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/Location.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/Moniker.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/PersonRecord.java | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/Relation.java | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/RelationRecord.java | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/RelationType.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/Surname.java | 39 +++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/SystemConfigPojo.java | 31 +++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/TaskCondition.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/BehaviourRecordService.java | 25 +++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/BehaviourService.java | 18 ++++++++++++++++++ src/main/java/com/qiwu/inference/service/ClueRecordService.java | 21 +++++++++++++++++++++ src/main/java/com/qiwu/inference/service/ClueService.java | 18 ++++++++++++++++++ src/main/java/com/qiwu/inference/service/DemandTaskRecordService.java | 19 +++++++++++++++++++ src/main/java/com/qiwu/inference/service/DemandTaskService.java | 18 ++++++++++++++++++ src/main/java/com/qiwu/inference/service/DispositionRecordService.java | 21 +++++++++++++++++++++ src/main/java/com/qiwu/inference/service/DispositionService.java | 18 ++++++++++++++++++ src/main/java/com/qiwu/inference/service/DispositionTypeService.java | 16 ++++++++++++++++ src/main/java/com/qiwu/inference/service/EndGoalService.java | 16 ++++++++++++++++ src/main/java/com/qiwu/inference/service/IdentityService.java | 18 ++++++++++++++++++ src/main/java/com/qiwu/inference/service/ItemService.java | 16 ++++++++++++++++ src/main/java/com/qiwu/inference/service/KeyClueService.java | 18 ++++++++++++++++++ src/main/java/com/qiwu/inference/service/LocationService.java | 16 ++++++++++++++++ src/main/java/com/qiwu/inference/service/MonikerService.java | 18 ++++++++++++++++++ src/main/java/com/qiwu/inference/service/PersonRecordService.java | 24 ++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/RelationRecordService.java | 23 +++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/RelationService.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/service/RelationTypeService.java | 16 ++++++++++++++++ src/main/java/com/qiwu/inference/service/SurnameService.java | 16 ++++++++++++++++ src/main/java/com/qiwu/inference/service/TaskConditionService.java | 16 ++++++++++++++++ src/main/java/com/qiwu/inference/service/ask/AskService.java | 4 +++- src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java | 55 +++++++++++++++++++++++++++++++------------------------ src/main/java/com/qiwu/inference/service/barrier/BarrierService.java | 11 +++++++++++ src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java | 237 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/check/CheckService.java | 9 +++++++++ src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java | 570 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/common/CommonService.java | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/BehaviourRecordServiceImpl.java | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/BehaviourServiceImpl.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/ClueRecordServiceImpl.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/ClueServiceImpl.java | 28 ++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/DemandTaskRecordServiceImpl.java | 37 +++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/DemandTaskServiceImpl.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/DispositionRecordServiceImpl.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/DispositionServiceImpl.java | 30 ++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/DispositionTypeServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/EndGoalServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/IdentityServiceImpl.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/ItemServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/KeyClueServiceImpl.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/LocationServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/MonikerServiceImpl.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/PersonRecordServiceImpl.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/RelationRecordServiceImpl.java | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/RelationServiceImpl.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/RelationTypeServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/SurnameServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/service/impl/TaskConditionServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/qiwu/inference/service/login/LoginService.java | 10 ++++++++++ src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/player/PlayerService.java | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java | 5837 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/task/TaskService.java | 9 +++++++++ src/main/java/com/qiwu/inference/service/task/impl/TaskServiceImpl.java | 40 ++++++++++++++++++++++++++++++++++++++++ src/main/resources/application-dev.yml | 8 +++++--- src/main/resources/application-uat.yml | 14 ++++++++------ src/main/resources/com/qiwu/inference/dao/BehaviourMapper.xml | 27 +++++++++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/BehaviourRecordMapper.xml | 19 +++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/ClueMapper.xml | 26 ++++++++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/ClueRecordMapper.xml | 22 ++++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/DemandTaskMapper.xml | 34 ++++++++++++++++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/DemandTaskRecordMapper.xml | 18 ++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/DispositionMapper.xml | 28 ++++++++++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/DispositionMapperRecord.xml | 17 +++++++++++++++++ src/main/resources/com/qiwu/inference/dao/DispositionTypeMapper.xml | 17 +++++++++++++++++ src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml | 15 +++++++++++++++ src/main/resources/com/qiwu/inference/dao/IdentityMapper.xml | 19 +++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/ItemMapper.xml | 15 +++++++++++++++ src/main/resources/com/qiwu/inference/dao/KeyClueMapper.xml | 22 ++++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/LocationMapper.xml | 20 ++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/MonikerMapper.xml | 15 +++++++++++++++ src/main/resources/com/qiwu/inference/dao/PersonRecordMapper.xml | 25 +++++++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/RelationMapper.xml | 26 ++++++++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/RelationRecordMapper.xml | 21 +++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/RelationTypeMapper.xml | 17 +++++++++++++++++ src/main/resources/com/qiwu/inference/dao/SurnameMapper.xml | 13 +++++++++++++ src/main/resources/com/qiwu/inference/dao/SystemConfigMapper.xml | 23 +++++++++++++++++++++++ src/main/resources/com/qiwu/inference/dao/TaskConditionMapper.xml | 14 ++++++++++++++ src/main/resources/file/behaviour.xlsx | Bin 0 -> 41075 bytes src/main/resources/file/clue.xlsx | Bin 0 -> 34770 bytes src/main/resources/file/demand_task.xlsx | Bin 0 -> 26029 bytes src/main/resources/file/disposition.xlsx | Bin 0 -> 36868 bytes src/main/resources/file/disposition_type.xlsx | Bin 0 -> 25866 bytes src/main/resources/file/end_goal.xlsx | Bin 0 -> 14477 bytes src/main/resources/file/identity.xlsx | Bin 0 -> 24811 bytes src/main/resources/file/item.xlsx | Bin 0 -> 18434 bytes src/main/resources/file/key_clue.xlsx | Bin 0 -> 39850 bytes src/main/resources/file/location.xlsx | Bin 0 -> 17950 bytes src/main/resources/file/moniker.xlsx | Bin 0 -> 18413 bytes src/main/resources/file/relation.xlsx | Bin 0 -> 47955 bytes src/main/resources/file/relation_type.xlsx | Bin 0 -> 26003 bytes src/main/resources/file/surname.xlsx | Bin 0 -> 14347 bytes src/main/resources/file/task_condition.xlsx | Bin 0 -> 22633 bytes src/main/resources/speech/ask.yaml | 377 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/main/resources/speech/barrier.yaml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/speech/check.yaml | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/speech/task.yaml | 772 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 186 files changed, 16136 insertions(+), 114 deletions(-) create mode 100644 src/main/java/com/qiwu/inference/aop/MyAop.java create mode 100644 src/main/java/com/qiwu/inference/common/InitSysServlet.java create mode 100755 src/main/java/com/qiwu/inference/common/api/CommonData.java create mode 100755 src/main/java/com/qiwu/inference/common/api/CommonPage.java create mode 100755 src/main/java/com/qiwu/inference/common/api/CommonResult.java create mode 100755 src/main/java/com/qiwu/inference/common/api/IErrorCode.java create mode 100755 src/main/java/com/qiwu/inference/common/api/ResultCode.java create mode 100755 src/main/java/com/qiwu/inference/common/utils/BeanUtil.java create mode 100644 src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java create mode 100644 src/main/java/com/qiwu/inference/common/utils/DateUtil.java create mode 100755 src/main/java/com/qiwu/inference/common/utils/DoubleUtil.java create mode 100755 src/main/java/com/qiwu/inference/common/utils/FastJsonUtil.java create mode 100755 src/main/java/com/qiwu/inference/common/utils/FileUtil.java create mode 100755 src/main/java/com/qiwu/inference/common/utils/NumberUtil.java create mode 100644 src/main/java/com/qiwu/inference/common/utils/PersistenceUtil.java create mode 100644 src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java create mode 100755 src/main/java/com/qiwu/inference/common/utils/RandomUtil.java create mode 100755 src/main/java/com/qiwu/inference/common/utils/RedissonUtil.java create mode 100755 src/main/java/com/qiwu/inference/common/utils/SpringContextUtil.java create mode 100755 src/main/java/com/qiwu/inference/common/utils/ThreadLocalUtil.java create mode 100644 src/main/java/com/qiwu/inference/common/utils/TypeConvertUtil.java create mode 100755 src/main/java/com/qiwu/inference/controller/PlayerController.java create mode 100755 src/main/java/com/qiwu/inference/dao/BehaviourMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/BehaviourRecordMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/ClueMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/ClueRecordMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/DemandTaskMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/DemandTaskRecordMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/DispositionMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/DispositionRecordMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/DispositionTypeMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/EndGoalMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/IdentityMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/ItemMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/KeyClueMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/LocationMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/MonikerMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/PersonRecordMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/RelationMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/RelationRecordMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/RelationTypeMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/SurnameMapper.java create mode 100644 src/main/java/com/qiwu/inference/dao/SystemConfigMapper.java create mode 100755 src/main/java/com/qiwu/inference/dao/TaskConditionMapper.java create mode 100755 src/main/java/com/qiwu/inference/dto/BehaviourDto.java create mode 100755 src/main/java/com/qiwu/inference/dto/ClueDto.java create mode 100755 src/main/java/com/qiwu/inference/dto/DemandTaskDto.java create mode 100755 src/main/java/com/qiwu/inference/dto/DispositionDto.java create mode 100755 src/main/java/com/qiwu/inference/dto/Person.java create mode 100755 src/main/java/com/qiwu/inference/dto/Player.java create mode 100755 src/main/java/com/qiwu/inference/dto/RelationDto.java create mode 100644 src/main/java/com/qiwu/inference/dto/response/DataResponse.java create mode 100644 src/main/java/com/qiwu/inference/dto/response/InferenceResponse.java create mode 100755 src/main/java/com/qiwu/inference/pojo/Behaviour.java create mode 100755 src/main/java/com/qiwu/inference/pojo/BehaviourRecord.java create mode 100755 src/main/java/com/qiwu/inference/pojo/Clue.java create mode 100755 src/main/java/com/qiwu/inference/pojo/ClueRecord.java create mode 100644 src/main/java/com/qiwu/inference/pojo/ClueType.java create mode 100755 src/main/java/com/qiwu/inference/pojo/DemandTask.java create mode 100755 src/main/java/com/qiwu/inference/pojo/DemandTaskRecord.java create mode 100755 src/main/java/com/qiwu/inference/pojo/Disposition.java create mode 100755 src/main/java/com/qiwu/inference/pojo/DispositionRecord.java create mode 100755 src/main/java/com/qiwu/inference/pojo/DispositionType.java create mode 100755 src/main/java/com/qiwu/inference/pojo/EndGoal.java create mode 100755 src/main/java/com/qiwu/inference/pojo/Identity.java create mode 100755 src/main/java/com/qiwu/inference/pojo/Item.java create mode 100755 src/main/java/com/qiwu/inference/pojo/KeyClue.java create mode 100755 src/main/java/com/qiwu/inference/pojo/Location.java create mode 100755 src/main/java/com/qiwu/inference/pojo/Moniker.java create mode 100755 src/main/java/com/qiwu/inference/pojo/PersonRecord.java create mode 100755 src/main/java/com/qiwu/inference/pojo/Relation.java create mode 100755 src/main/java/com/qiwu/inference/pojo/RelationRecord.java create mode 100755 src/main/java/com/qiwu/inference/pojo/RelationType.java create mode 100755 src/main/java/com/qiwu/inference/pojo/Surname.java create mode 100644 src/main/java/com/qiwu/inference/pojo/SystemConfigPojo.java create mode 100755 src/main/java/com/qiwu/inference/pojo/TaskCondition.java create mode 100755 src/main/java/com/qiwu/inference/service/BehaviourRecordService.java create mode 100755 src/main/java/com/qiwu/inference/service/BehaviourService.java create mode 100755 src/main/java/com/qiwu/inference/service/ClueRecordService.java create mode 100755 src/main/java/com/qiwu/inference/service/ClueService.java create mode 100755 src/main/java/com/qiwu/inference/service/DemandTaskRecordService.java create mode 100755 src/main/java/com/qiwu/inference/service/DemandTaskService.java create mode 100755 src/main/java/com/qiwu/inference/service/DispositionRecordService.java create mode 100755 src/main/java/com/qiwu/inference/service/DispositionService.java create mode 100755 src/main/java/com/qiwu/inference/service/DispositionTypeService.java create mode 100755 src/main/java/com/qiwu/inference/service/EndGoalService.java create mode 100755 src/main/java/com/qiwu/inference/service/IdentityService.java create mode 100755 src/main/java/com/qiwu/inference/service/ItemService.java create mode 100755 src/main/java/com/qiwu/inference/service/KeyClueService.java create mode 100755 src/main/java/com/qiwu/inference/service/LocationService.java create mode 100755 src/main/java/com/qiwu/inference/service/MonikerService.java create mode 100755 src/main/java/com/qiwu/inference/service/PersonRecordService.java create mode 100755 src/main/java/com/qiwu/inference/service/RelationRecordService.java create mode 100755 src/main/java/com/qiwu/inference/service/RelationService.java create mode 100755 src/main/java/com/qiwu/inference/service/RelationTypeService.java create mode 100755 src/main/java/com/qiwu/inference/service/SurnameService.java create mode 100755 src/main/java/com/qiwu/inference/service/TaskConditionService.java create mode 100644 src/main/java/com/qiwu/inference/service/barrier/BarrierService.java create mode 100644 src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java create mode 100644 src/main/java/com/qiwu/inference/service/check/CheckService.java create mode 100644 src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java create mode 100644 src/main/java/com/qiwu/inference/service/common/CommonService.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/BehaviourRecordServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/BehaviourServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/ClueRecordServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/ClueServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/DemandTaskRecordServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/DemandTaskServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/DispositionRecordServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/DispositionServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/DispositionTypeServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/EndGoalServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/IdentityServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/ItemServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/KeyClueServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/LocationServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/MonikerServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/PersonRecordServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/RelationRecordServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/RelationServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/RelationTypeServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/SurnameServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/impl/TaskConditionServiceImpl.java create mode 100644 src/main/java/com/qiwu/inference/service/login/LoginService.java create mode 100644 src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java create mode 100755 src/main/java/com/qiwu/inference/service/player/PlayerService.java create mode 100644 src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java create mode 100644 src/main/java/com/qiwu/inference/service/task/TaskService.java create mode 100644 src/main/java/com/qiwu/inference/service/task/impl/TaskServiceImpl.java create mode 100755 src/main/resources/com/qiwu/inference/dao/BehaviourMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/BehaviourRecordMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/ClueMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/ClueRecordMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/DemandTaskMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/DemandTaskRecordMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/DispositionMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/DispositionMapperRecord.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/DispositionTypeMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/IdentityMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/ItemMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/KeyClueMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/LocationMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/MonikerMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/PersonRecordMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/RelationMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/RelationRecordMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/RelationTypeMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/SurnameMapper.xml create mode 100644 src/main/resources/com/qiwu/inference/dao/SystemConfigMapper.xml create mode 100755 src/main/resources/com/qiwu/inference/dao/TaskConditionMapper.xml create mode 100755 src/main/resources/file/behaviour.xlsx create mode 100755 src/main/resources/file/clue.xlsx create mode 100755 src/main/resources/file/demand_task.xlsx create mode 100755 src/main/resources/file/disposition.xlsx create mode 100755 src/main/resources/file/disposition_type.xlsx create mode 100755 src/main/resources/file/end_goal.xlsx create mode 100755 src/main/resources/file/identity.xlsx create mode 100755 src/main/resources/file/item.xlsx create mode 100755 src/main/resources/file/key_clue.xlsx create mode 100755 src/main/resources/file/location.xlsx create mode 100755 src/main/resources/file/moniker.xlsx create mode 100755 src/main/resources/file/relation.xlsx create mode 100755 src/main/resources/file/relation_type.xlsx create mode 100755 src/main/resources/file/surname.xlsx create mode 100755 src/main/resources/file/task_condition.xlsx create mode 100644 src/main/resources/speech/barrier.yaml create mode 100644 src/main/resources/speech/check.yaml create mode 100644 src/main/resources/speech/task.yaml diff --git a/pom.xml b/pom.xml index 15593f6..8817018 100644 --- a/pom.xml +++ b/pom.xml @@ -8,9 +8,9 @@ InferenceGame 1.0-SNAPSHOT jar - InferenceGame + inferenceGame - InferenceGame + inferenceGame org.springframework.boot @@ -82,6 +82,41 @@ jxl 2.6.12 + + org.redisson + redisson + 3.17.4 + + + + io.springfox + springfox-boot-starter + 3.0.0 + + + + com.baomidou + mybatis-plus-boot-starter + 3.5.2 + + + + com.baomidou + mybatis-plus-generator + 3.5.2 + + + + org.apache.velocity + velocity-engine-core + 2.3 + + + + cn.hutool + hutool-all + 5.8.8 + diff --git a/src/main/java/com/qiwu/inference/InferenceApplication.java b/src/main/java/com/qiwu/inference/InferenceApplication.java index 5ca6b26..a29e282 100644 --- a/src/main/java/com/qiwu/inference/InferenceApplication.java +++ b/src/main/java/com/qiwu/inference/InferenceApplication.java @@ -2,20 +2,13 @@ package com.qiwu.inference; import com.qiwu.inference.common.TimingAcquisition; import org.springframework.boot.SpringApplication; +import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.client.RestTemplateBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.web.client.RestTemplate; +@SpringBootConfiguration @SpringBootApplication public class InferenceApplication { - @Bean - public RestTemplate restTemplate(RestTemplateBuilder builder) { - return builder.build(); - } public static void main(String[] args) { SpringApplication.run(InferenceApplication.class, args); - //加载话术 - TimingAcquisition.speechLoading(); } } diff --git a/src/main/java/com/qiwu/inference/aop/MyAop.java b/src/main/java/com/qiwu/inference/aop/MyAop.java new file mode 100644 index 0000000..22051e1 --- /dev/null +++ b/src/main/java/com/qiwu/inference/aop/MyAop.java @@ -0,0 +1,65 @@ +package com.qiwu.inference.aop; + +import com.qiwu.inference.common.utils.CacheUtil; +import com.qiwu.inference.common.utils.YamlUtil; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.CommonResponse; +import com.qiwu.inference.dto.response.ResultVarsResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import org.yaml.snakeyaml.Yaml; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; + +public class MyAop implements InvocationHandler{ + Logger log = LoggerFactory.getLogger(MyAop.class); + private String offlineTime = YamlUtil.getValueByKey("offlineTime"); + + private Object object; + //构造代理对象 + public Object newProxy(Object object) { + this.object = object; + return Proxy.newProxyInstance(object.getClass().getClassLoader(), + object.getClass().getInterfaces(), this); + } + @Override + public Object invoke(Object o, Method method, Object[] objects) throws Throwable { + OperationRequest request = (OperationRequest) objects[0]; + + //该玩家以唯一标识加入全局缓存,用于玩家离线判断 + String uniqueUid = request.getUid() + "%#%online%#%"; + CacheUtil.put(uniqueUid, "", Long.parseLong(offlineTime)); + //通过反射获取方法返参 + Object var = method.invoke(this.object, objects); + //检索到有新消息 + CommonResponse commonResponse = (CommonResponse) var; + ResultVarsResponse data = commonResponse.getData(); + if (!StringUtils.isEmpty(data)) { + //所有“后台附加返回”为null值的都给转成“无效返回” + if (StringUtils.isEmpty(data.getVars().get后台附加返回())) { + data.getVars().set后台附加返回("无效返回"); + } + //所有“后台附加返回”为null值的都给转成“无效返回” + if (StringUtils.isEmpty(data.getVars().get后台附加返回2())) { + data.getVars().set后台附加返回2("无效返回"); + } + + String feedContent = "后台返回参数 = [" + + "code:" + commonResponse.getCode() + + ", msg:" + commonResponse.getMsg() + + ", 反馈ID:" + data.getVars().get反馈ID() + + ", 反馈文本:" + data.getVars().get反馈文本() + + ", 后台附加返回:" + data.getVars().get后台附加返回() + + ", 后台附加返回2:" + data.getVars().get后台附加返回2() + + "]"; + //玩家有新消息提示 + log.info(feedContent); + } + return var; + } +} diff --git a/src/main/java/com/qiwu/inference/common/Constants.java b/src/main/java/com/qiwu/inference/common/Constants.java index 7a28e0c..6b43a61 100644 --- a/src/main/java/com/qiwu/inference/common/Constants.java +++ b/src/main/java/com/qiwu/inference/common/Constants.java @@ -1,5 +1,7 @@ package com.qiwu.inference.common; +import org.springframework.beans.factory.annotation.Value; + public class Constants { /** @@ -66,13 +68,9 @@ public class Constants { */ public static final String SPEECH_ASIDE = "aside"; /** - * 话术-男园丁 - */ - public static final String SPEECH_MAN = "man"; - /** - * 话术-女园丁 + * 话术-人物 */ - public static final String SPEECH_WOMAN = "woman"; + public static final String SPEECH_PERSON = "person"; @@ -86,4 +84,27 @@ public class Constants { */ public static final String NON_STR = "0"; + + /** + * "1":场所为隐藏 + */ + public static final String IS_HIDDEN = "1"; + + /** + * 查看操作 + */ + public static final String OPERATE_CHECK = "查看操作"; + /** + * 关卡操作 + */ + public static final String OPERATE_BARRIER = "关卡操作"; + /** + * 询问操作 + */ + public static final String OPERATE_ASK = "询问操作"; + + /** + * 线索-关系类型-5 + */ + public static final Integer RELATION_TYPE = 5; } diff --git a/src/main/java/com/qiwu/inference/common/InitSysServlet.java b/src/main/java/com/qiwu/inference/common/InitSysServlet.java new file mode 100644 index 0000000..204e432 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/InitSysServlet.java @@ -0,0 +1,138 @@ +package com.qiwu.inference.common; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.qiwu.inference.common.utils.PersistenceUtil; +import com.qiwu.inference.dao.*; +import com.qiwu.inference.dto.Person; +import com.qiwu.inference.dto.Player; +import com.qiwu.inference.pojo.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Component +public class InitSysServlet implements InitializingBean { + Logger log = LoggerFactory.getLogger(InitSysServlet.class); + + @Value("${userFilePath}") + private String userFilePath; + @Value("${configFilePath}") + private String configFilePath; + @Value("${speechFilePath}") + private String speechFilePath; + + @Autowired + private SystemConfigMapper systemConfigMapper; + @Autowired + private LocationMapper locationMapper; + @Autowired + private ClueMapper clueMapper; + @Autowired + private DemandTaskMapper demandTaskMapper; + @Autowired + private DispositionMapper dispositionMapper; + + /** + * 保存配置信息到缓存 + */ + @Override + public void afterPropertiesSet() throws Exception { + //--------------------------缓存关卡数据--------------------- + log.info("开始缓存关卡数据"); + String gateInfo = PersistenceUtil.getConfigFromFile(configFilePath, "results.json"); + Map> gateInfoMap = JSON.parseObject(gateInfo, new TypeReference>>(){}); + TimingAcquisition.gateInfoMap.putAll(gateInfoMap); + log.info("关卡数据缓存完成"); + + + + //--------------------------加载玩家数据---------------------- + log.info("开始加载玩家数据"); + //从yml配置文件中取出存放玩家数据的地址 + File file = new File(userFilePath); + File[] files = file.listFiles(); + if (files == null) { + log.info("路径" + userFilePath+ "下没有文件"); + return; + } + Map playerMap = new ConcurrentHashMap<>(); + for (File f : files) { + if (f.isFile()) { + String s = PersistenceUtil.getDataFromFile(String.valueOf(f)); + //JSON转map对象 + Player player = JSON.parseObject(s, new TypeReference(){}); + String fileName = f.getName().replace(".json", ""); + playerMap.put(fileName, player); + TimingAcquisition.playerMap.putAll(playerMap); + } + } + log.info("玩家数据缓存完成"); + + //--------------------加载话术----------------- + TimingAcquisition.speechLoading(speechFilePath); + + + //-----------------缓存场所信息------------------ + Map locationMap = new ConcurrentHashMap<>(); + List locationList = locationMapper.findAll(); + for (Location location : locationList) { + locationMap.put(location.getId().toString(), location); + } + TimingAcquisition.locationMap.putAll(locationMap); + log.info("场所配置信息缓存完成"); + + //-----------------缓存线索信息------------------ + Map clueMap = new ConcurrentHashMap<>(); + List clueList = clueMapper.findAll(); + for (Clue clue : clueList) { + clueMap.put(clue.getId(), clue); + } + TimingAcquisition.clueMap.putAll(clueMap); + log.info("线索配置信息缓存完成"); + + //-----------------缓存线索类型信息------------------ + Map clueTypeMap = new ConcurrentHashMap<>(); + List clueTypeList = clueMapper.getTypeInfo(); + for (ClueType clueType : clueTypeList) { + clueTypeMap.put(clueType.getId(), clueType.getName()); + } + TimingAcquisition.clueTypeMap.putAll(clueTypeMap); + log.info("线索类型配置信息缓存完成"); + + //-----------------缓存需求任务配置信息------------------ + Map demandTaskMap = new ConcurrentHashMap<>(); + List demandTaskList = demandTaskMapper.findAll(); + for (DemandTask demandTask : demandTaskList) { + demandTaskMap.put(demandTask.getId(), demandTask); + } + TimingAcquisition.demandTaskMap.putAll(demandTaskMap); + log.info("需求任务配置信息缓存完成"); + + //-----------------缓存性格信息------------------ + Map dispositionMap = new ConcurrentHashMap<>(); + List dispositionList = dispositionMapper.findAll(); + for (Disposition disposition : dispositionList) { + dispositionMap.put(disposition.getId(), disposition); + } + TimingAcquisition.dispositionMap.putAll(dispositionMap); + log.info("性格配置信息缓存完成"); + + //-----------------缓存系统配置信息------------------ + Map systemConfigMap = new ConcurrentHashMap<>(); + List systemConfigList = systemConfigMapper.findAll(); + for (SystemConfigPojo systemConfig : systemConfigList) { + systemConfigMap.put(systemConfig.getName(), systemConfig); + } + TimingAcquisition.systemConfigMap.putAll(systemConfigMap); + log.info("系统配置信息缓存完成"); + } +} diff --git a/src/main/java/com/qiwu/inference/common/TimingAcquisition.java b/src/main/java/com/qiwu/inference/common/TimingAcquisition.java index 46580f2..8e669b1 100644 --- a/src/main/java/com/qiwu/inference/common/TimingAcquisition.java +++ b/src/main/java/com/qiwu/inference/common/TimingAcquisition.java @@ -1,9 +1,16 @@ package com.qiwu.inference.common; +import com.qiwu.inference.common.utils.PersistenceUtil; import com.qiwu.inference.common.utils.YamlUtil; +import com.qiwu.inference.dto.Person; +import com.qiwu.inference.dto.Player; +import com.qiwu.inference.pojo.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -12,6 +19,44 @@ public class TimingAcquisition { static Logger log = LoggerFactory.getLogger(TimingAcquisition.class); /** + * 关卡信息,Map> + */ + public volatile static Map> gateInfoMap = new ConcurrentHashMap<>(); + /** + * 用户id跟关卡编号对应关系 + */ + public volatile static Map uidGateNoMap = new ConcurrentHashMap<>(); + /** + * 玩家信息,Map + */ + public volatile static Map playerMap = new ConcurrentHashMap<>(); + + /** + * 场所配置信息 + */ + public volatile static Map locationMap = new ConcurrentHashMap<>(); + /** + * 线索配置信息 + */ + public volatile static Map clueMap = new ConcurrentHashMap<>(); + /** + * 线索类型配置信息 + */ + public volatile static Map clueTypeMap = new ConcurrentHashMap<>(); + /** + * 需求任务配置信息 + */ + public volatile static Map demandTaskMap = new ConcurrentHashMap<>(); + /** + * 性格配置信息 + */ + public volatile static Map dispositionMap = new ConcurrentHashMap<>(); + /** + * 系统配置信息 + */ + public volatile static Map systemConfigMap = new ConcurrentHashMap<>(); + + /** * 询问模块话术 */ public volatile static Map>> askSpeechMap = new ConcurrentHashMap<>(); @@ -23,19 +68,25 @@ public class TimingAcquisition { * 查看模块话术 */ public volatile static Map>> checkSpeechMap = new ConcurrentHashMap<>(); + /** + * 查看模块话术 + */ + public volatile static Map>> barrierSpeechMap = new ConcurrentHashMap<>(); /** * 通过yaml文件加载所有话术到缓存中 */ - public static void speechLoading() { + public static void speechLoading(String speechFilePath) { log.info("---------开始加载话术到缓存中---------"); Map>> askSpeech = new HashMap<>(); Map>> taskSpeech = new HashMap<>(); Map>> checkSpeech = new HashMap<>(); + Map>> barrierSpeech = new HashMap<>(); try { - askSpeech = YamlUtil.loadSpeechToMap("ask.yaml"); - taskSpeech = YamlUtil.loadSpeechToMap("task.yaml"); - checkSpeech = YamlUtil.loadSpeechToMap("check.yaml"); + askSpeech = PersistenceUtil.loadSpeechToMap(speechFilePath,"ask.yaml"); + taskSpeech = PersistenceUtil.loadSpeechToMap(speechFilePath,"task.yaml"); + checkSpeech = PersistenceUtil.loadSpeechToMap(speechFilePath,"check.yaml"); + barrierSpeech = PersistenceUtil.loadSpeechToMap(speechFilePath,"barrier.yaml"); } catch (Exception e) { e.printStackTrace(); } @@ -43,7 +94,63 @@ public class TimingAcquisition { askSpeechMap.putAll(askSpeech); taskSpeechMap.putAll(taskSpeech); checkSpeechMap.putAll(checkSpeech); + barrierSpeechMap.putAll(barrierSpeech); log.info("---------加载话术到缓存的操作完成---------"); } + + /** + * 通过线索类型获取对应id + */ + public static Integer getClueTypeIdByName(String name) { + for (Map.Entry entry : clueTypeMap.entrySet()) { + if (name.equals(entry.getValue())) { + return entry.getKey(); + } + } + return Constants.REQ_NON; + } + + /** + * 通过场所名称获取对应id + */ + public static String getLocationIdByName(String name) { + for (Map.Entry entry : locationMap.entrySet()) { + if (name.equals(entry.getValue().getName())) { + return entry.getKey(); + } + } + return Constants.NON_STR; + } + + /** + * 通过玩家名称获取对应id + */ + public static Integer getPersonIdByName(String uid, String name) { + Integer personId = TimingAcquisition.playerMap.get(uid).getName2IdMap().get(name); + if (!StringUtils.isEmpty(personId)) { + return personId; + } + return Constants.REQ_NON; + } + + /** + * 通过id获取玩家名称 + */ + public static String getNameByPersonId(String uid, Integer personId) { + for (Map.Entry entry : TimingAcquisition.playerMap.get(uid).getName2IdMap().entrySet()) { + if (personId.equals(entry.getValue())) { + return entry.getKey(); + } + } + return Constants.NON_STR; + } + + /** + * 获取当前正在对话的人物名称 + */ + public static String getTalkName(String uid) { + Integer personId = TimingAcquisition.playerMap.get(uid).getPersonId(); + return getNameByPersonId(uid, personId); + } } diff --git a/src/main/java/com/qiwu/inference/common/api/CommonData.java b/src/main/java/com/qiwu/inference/common/api/CommonData.java new file mode 100755 index 0000000..7a48a2c --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/api/CommonData.java @@ -0,0 +1,22 @@ +package com.qiwu.inference.common.api; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CommonData { + private Integer id; + private String aside; + private String text; + + public CommonData(){ + + } + public CommonData(Integer id,String text,String aside){ + this.id = id; + this.aside = aside; + this.text = text; + } + +} diff --git a/src/main/java/com/qiwu/inference/common/api/CommonPage.java b/src/main/java/com/qiwu/inference/common/api/CommonPage.java new file mode 100755 index 0000000..4fa97fd --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/api/CommonPage.java @@ -0,0 +1,70 @@ +package com.qiwu.inference.common.api; + +import cn.hutool.core.convert.Convert; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import java.util.List; + +/** + * 分页数据封装类 + */ +public class CommonPage { + private Integer pageNum; + private Integer pageSize; + private Integer totalPage; + private Long total; + private List list; + + /** + * 将MyBatis Plus 分页结果转化为通用结果 + */ + public static CommonPage restPage(Page pageResult) { + CommonPage result = new CommonPage<>(); + result.setPageNum(Convert.toInt(pageResult.getCurrent())); + result.setPageSize(Convert.toInt(pageResult.getSize())); + result.setTotal(pageResult.getTotal()); + result.setTotalPage(Convert.toInt(pageResult.getTotal()/pageResult.getSize()+1)); + result.setList(pageResult.getRecords()); + return result; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public Integer getTotalPage() { + return totalPage; + } + + public void setTotalPage(Integer totalPage) { + this.totalPage = totalPage; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } +} diff --git a/src/main/java/com/qiwu/inference/common/api/CommonResult.java b/src/main/java/com/qiwu/inference/common/api/CommonResult.java new file mode 100755 index 0000000..dcfccf1 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/api/CommonResult.java @@ -0,0 +1,123 @@ +package com.qiwu.inference.common.api; + +/** + * 通用返回对象 + */ +public class CommonResult { + private long code; + private String message; + private T data; + + protected CommonResult() { + } + + protected CommonResult(long code, String message, T data) { + this.code = code; + this.message = message; + this.data = data; + } + + /** + * 成功返回结果 + * + * @param data 获取的数据 + */ + public static CommonResult success(T data) { + return new CommonResult(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data); + } + + /** + * 成功返回结果 + * + * @param data 获取的数据 + * @param message 提示信息 + */ + public static CommonResult success(T data, String message) { + return new CommonResult(ResultCode.SUCCESS.getCode(), message, data); + } + + /** + * 失败返回结果 + * @param errorCode 错误码 + */ + public static CommonResult failed(IErrorCode errorCode) { + return new CommonResult(errorCode.getCode(), errorCode.getMessage(), null); + } + + /** + * 失败返回结果 + * @param errorCode 错误码 + * @param message 错误信息 + */ + public static CommonResult failed(IErrorCode errorCode,String message) { + return new CommonResult(errorCode.getCode(), message, null); + } + + /** + * 失败返回结果 + * @param message 提示信息 + */ + public static CommonResult failed(String message) { + return new CommonResult(ResultCode.FAILED.getCode(), message, null); + } + + /** + * 失败返回结果 + */ + public static CommonResult failed() { + return failed(ResultCode.FAILED); + } + + /** + * 参数验证失败返回结果 + */ + public static CommonResult validateFailed() { + return failed(ResultCode.VALIDATE_FAILED); + } + + /** + * 参数验证失败返回结果 + * @param message 提示信息 + */ + public static CommonResult validateFailed(String message) { + return new CommonResult(ResultCode.VALIDATE_FAILED.getCode(), message, null); + } + + /** + * 未登录返回结果 + */ + public static CommonResult unauthorized(T data) { + return new CommonResult(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data); + } + + /** + * 未授权返回结果 + */ + public static CommonResult forbidden(T data) { + return new CommonResult(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data); + } + + public long getCode() { + return code; + } + + public void setCode(long code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } +} diff --git a/src/main/java/com/qiwu/inference/common/api/IErrorCode.java b/src/main/java/com/qiwu/inference/common/api/IErrorCode.java new file mode 100755 index 0000000..45cb45d --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/api/IErrorCode.java @@ -0,0 +1,10 @@ +package com.qiwu.inference.common.api; + +/** + * 封装API的错误码 + */ +public interface IErrorCode { + long getCode(); + + String getMessage(); +} diff --git a/src/main/java/com/qiwu/inference/common/api/ResultCode.java b/src/main/java/com/qiwu/inference/common/api/ResultCode.java new file mode 100755 index 0000000..ee53b8a --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/api/ResultCode.java @@ -0,0 +1,27 @@ +package com.qiwu.inference.common.api; + +/** + * 枚举了一些常用API操作码 + */ +public enum ResultCode implements IErrorCode { + SUCCESS(1, "成功"), + FAILED(500, "操作失败"), + VALIDATE_FAILED(404, "参数检验失败"), + UNAUTHORIZED(401, "暂未登录或token已经过期"), + FORBIDDEN(403, "没有相关权限"); + private long code; + private String message; + + private ResultCode(long code, String message) { + this.code = code; + this.message = message; + } + + public long getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/src/main/java/com/qiwu/inference/common/cache/ExpireThread.java b/src/main/java/com/qiwu/inference/common/cache/ExpireThread.java index ba9d8ce..f1a30d3 100644 --- a/src/main/java/com/qiwu/inference/common/cache/ExpireThread.java +++ b/src/main/java/com/qiwu/inference/common/cache/ExpireThread.java @@ -1,9 +1,16 @@ package com.qiwu.inference.common.cache; import com.alibaba.fastjson.JSON; +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.utils.DateUtil; +import com.qiwu.inference.common.utils.PersistenceUtil; +import com.qiwu.inference.dto.Player; +import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.stereotype.Component; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; @@ -13,6 +20,9 @@ import java.util.concurrent.TimeUnit; @EnableAsync @Component public class ExpireThread implements Runnable{ + @Value("${userFilePath}") + private String userFilePath; + @Override public void run() { while (true) { @@ -35,6 +45,20 @@ public class ExpireThread implements Runnable{ if (timeoutTime < myCache.getExpireTime()) { continue; } + //规定时间内玩家无操作默认下线 + if (key.contains("%#%online%#%")) { + String uid = key.replace("%#%online%#%", ""); + Player player = TimingAcquisition.playerMap.get(uid); + //更新玩家为离线状态 + player.setStatus(Constants.OFFLINE); + //修改下线时间 + player.setOfflineTime(DateUtil.getCurrentTime()); + //--------------持久化该园丁信息--------------- + Map playerMap = new ConcurrentHashMap<>(); + playerMap.put(uid, TimingAcquisition.playerMap.get(uid)); + String playerStr = JSON.toJSONString(playerMap); + PersistenceUtil.saveDataToFile(userFilePath, uid, playerStr); + } //清除过期缓存 CacheGlobal.concurrentMap.remove(key); } diff --git a/src/main/java/com/qiwu/inference/common/utils/BeanUtil.java b/src/main/java/com/qiwu/inference/common/utils/BeanUtil.java new file mode 100755 index 0000000..01924c6 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/BeanUtil.java @@ -0,0 +1,66 @@ +package com.qiwu.inference.common.utils; + +import org.springframework.beans.BeanUtils; +import org.springframework.beans.BeanWrapper; +import org.springframework.beans.BeanWrapperImpl; +import org.springframework.util.StringUtils; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +public class BeanUtil { + /** + * 拷贝bean中的属性 + * @param source + * @param target + * @param ignores + */ + public static void copyProperties(Object source, Object target, String... ignores){ + BeanUtils.copyProperties(source, target, ignores); + } + /** + * 拷贝bean中的属性 忽略掉空值属性和ID属性 + * @param source + * @param target + */ + public static void copyPropertiesIgnoreNullValueAndId(Object source, Object target){ + copyProperties(source, target, getNullPropertyNamesAndIgnoreNames(source, "id")); + } + /** + * 拷贝bean中的属性 忽略掉空值属性 + * @param source + * @param target + */ + public static void copyPropertiesIgnoreNullValue(Object source, Object target){ + copyProperties(source, target, getNullPropertyNamesAndIgnoreNames(source)); + } + /** + * 获取空值属性名称或者忽略 + * @param source + * @param ignores + * @return + */ + public static String[] getNullPropertyNamesAndIgnoreNames (Object source, String... ignores ) { + final BeanWrapper src = new BeanWrapperImpl(source); + java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors(); + + Set emptyNames = new HashSet(); + if (ignores != null && ignores.length > 0){ + emptyNames.addAll(Arrays.asList(ignores)); + } + for(java.beans.PropertyDescriptor pd : pds) { + Object srcValue = src.getPropertyValue(pd.getName()); + if (srcValue == null) emptyNames.add(pd.getName()); + } + String[] result = new String[emptyNames.size()]; + return emptyNames.toArray(result); + } + + public static String[] convertStringToArray(String ids){ + if (StringUtils.isEmpty(ids)){ + return null; + } + return ids.split(","); + } +} diff --git a/src/main/java/com/qiwu/inference/common/utils/CacheUtil.java b/src/main/java/com/qiwu/inference/common/utils/CacheUtil.java index 77ccee8..a08a739 100644 --- a/src/main/java/com/qiwu/inference/common/utils/CacheUtil.java +++ b/src/main/java/com/qiwu/inference/common/utils/CacheUtil.java @@ -24,15 +24,16 @@ public class CacheUtil { myCache.setLastTime(System.currentTimeMillis()); myCache.setExpireTime(System.currentTimeMillis()); myCache.setValue(value); + } else { + MyCache myCache = new MyCache(); + myCache.setKey(key); + myCache.setValue(value); + myCache.setWriteTime(System.currentTimeMillis()); + myCache.setLastTime(System.currentTimeMillis()); + myCache.setExpireTime(expire); + myCache.setHitCount(1); + CacheGlobal.concurrentMap.put(key, myCache); } - MyCache myCache = new MyCache(); - myCache.setKey(key); - myCache.setValue(value); - myCache.setWriteTime(System.currentTimeMillis()); - myCache.setLastTime(System.currentTimeMillis()); - myCache.setExpireTime(expire); - myCache.setHitCount(1); - CacheGlobal.concurrentMap.put(key, myCache); } /** diff --git a/src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java b/src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java new file mode 100644 index 0000000..66fb81f --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java @@ -0,0 +1,96 @@ +package com.qiwu.inference.common.utils; + +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.dto.Player; +import com.qiwu.inference.dto.response.ResultVarsResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.util.StringUtils; + +import java.text.ParseException; +import java.util.List; +import java.util.Map; + +public class DataTrimUtil { + static Logger log = LoggerFactory.getLogger(DataTrimUtil.class); + + /** + * 判断整数尾数是否为1 + */ + public static boolean checkIntWithOne(Integer num) { + int remain = num % 10; + if (remain == 1) { + return true; + } + return false; + } + + /** + * 玩家状态更改 + */ + public static void AdjustStatus(String uid, String offlineTime) throws ParseException { + //玩家当前为离线状态 + Player player = TimingAcquisition.playerMap.get(uid); + //操作日期为今天之前,需更改为在线状态 + String nowTime = DateUtil.getCurrentTime(); + if (!StringUtils.isEmpty(player.getOnlineTime())) { + if (DateUtil.compare(nowTime, player.getOnlineTime()) == 1) { + //更新玩家在线状态 + statusUpdate(uid); + } + } + if (player.getStatus() == Constants.OFFLINE) { + //更新玩家在线状态 + statusUpdate(uid); + } + //该玩家以唯一标识加入全局缓存,用于玩家离线判断 + String uniqueUid = uid + "%#%online%#%"; + CacheUtil.put(uniqueUid, "", Long.parseLong(offlineTime)); + } + + /** + * 玩家状态更新为在线 + */ + public static void statusUpdate(String uid) { + if (!StringUtils.isEmpty(TimingAcquisition.playerMap.get(uid))) { + TimingAcquisition.playerMap.get(uid).setStatus(Constants.ONLINE); + //修改上线时间 + TimingAcquisition.playerMap.get(uid).setOnlineTime(DateUtil.getCurrentTime()); + } + } + + /** + * 判断整数尾数是否为1 + */ + public static CommonResult AdjustParams(CommonResult result) { + if (StringUtils.isEmpty(result)) { + return CommonResult.failed("操作失败"); + } + ResultVarsResponse data = result.getData(); + if (!StringUtils.isEmpty(data)) { + //所有“后台附加返回”为null值的都给转成“无效返回” + if (StringUtils.isEmpty(data.getVars().get后台附加返回())) { + data.getVars().set后台附加返回("无效返回"); + } + //所有“后台附加返回”为null值的都给转成“无效返回” + if (StringUtils.isEmpty(data.getVars().get后台附加返回2())) { + data.getVars().set后台附加返回2("无效返回"); + } + + String feedContent = "后台返回参数 = [" + + "code:" + result.getCode() + + ", msg:" + result.getMessage() + + ", 反馈ID:" + data.getVars().get反馈ID() + + ", 反馈文本:" + data.getVars().get反馈文本() + + ", 后台附加返回:" + data.getVars().get后台附加返回() + + ", 后台附加返回2:" + data.getVars().get后台附加返回2() + + "]"; + //玩家有新消息提示 + log.info(feedContent); + } + return result; + } +} diff --git a/src/main/java/com/qiwu/inference/common/utils/DateUtil.java b/src/main/java/com/qiwu/inference/common/utils/DateUtil.java new file mode 100644 index 0000000..8831aee --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/DateUtil.java @@ -0,0 +1,489 @@ +package com.qiwu.inference.common.utils; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAdjusters; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +/** + * 时间工具类 + * @author hjd + */ +public class DateUtil { + /** + * 获取当前时间 + * @return String + */ + public static String currentTimes(){ + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 + String format = df.format(new Date());// new Date()为获取当前系统时间 + return format; + } + + /** + * 以"yyyyMMddHHmmss"格式获取当前时间 + * @return + */ + public static String getCurrentTime(){ + SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 + String format = df.format(new Date());// new Date()为获取当前系统时间 + return format; + } + /** + * 时间加上毫秒 + * @param time + * @param sub + * @return String + */ + public static String addTime(String time, int sub) throws ParseException { + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 + Date dt = sdf.parse(time); + Calendar newTime = Calendar.getInstance(); + newTime.setTime(dt); + newTime.add(Calendar.SECOND, sub); + Date newDt = newTime.getTime(); + + return sdf.format(newDt); + } + + /** + * 时间减去毫秒 + * @param time + * @param sub + * @return String + */ + public static String subTime(String time, int sub) throws ParseException { + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 + Date dt = sdf.parse(time); + Calendar newTime = Calendar.getInstance(); + newTime.setTime(dt); + newTime.add(Calendar.SECOND, -sub); + Date newDt = newTime.getTime(); + + return sdf.format(newDt); + } + + /** + * 计算时间差(time1 - time2),返回单位为秒 + * @param time1 + * @param time2 + * @return long + */ + public static long subTime(String time1, String time2) throws ParseException { + String t1 = (time1.compareTo(time2) > 0) ? time1 : time2; + String t2 = (time1.compareTo(time2) > 0) ? time2 : time1; + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 + Date dt1 = sdf.parse(t1); + Date dt2 = sdf.parse(t2); + return (dt1.getTime() - dt2.getTime())/1000; + } + + /** + * 计算时间差(time1 - time2),返回单位为天/时/分/秒 + * @param time1 + * @param time2 + * @return String + */ + public static String subTimeToDate(String time1, String time2) throws ParseException { + String t1 = (time1.compareTo(time2) > 0) ? time1 : time2; + String t2 = (time1.compareTo(time2) > 0) ? time2 : time1; + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 + Date dt1 = sdf.parse(t1); + Date dt2 = sdf.parse(t2); + long time = (dt1.getTime() - dt2.getTime())/1000; + String result = null; + long days = time / (60 * 60 * 24); + long hours = (time % (60 * 60 * 24)) / (60 * 60); + long minutes = (time % (60 * 60)) / 60; + long seconds = time % 60; + if (days > 0) { + result = days + "天" + hours + "小时" + minutes + "分钟"; + } else if (hours > 0) { + result = hours + "小时" + minutes + "分钟"; + } else if (minutes > 0) { + result = minutes + "分钟" + seconds + "秒"; + } else { + result = seconds + "秒"; + } + return result; + } + + /** + * 将秒换算成单位为天/时/分/秒 + * @param time + * @return String + */ + public static String timeToDate(Long time) throws ParseException { + String result = null; + long days = time / (60 * 60 * 24); + long hours = (time % (60 * 60 * 24)) / (60 * 60); + long minutes = (time % (60 * 60)) / 60; + long seconds = time % 60; + if (days > 0) { + result = days + "天" + hours + "小时" + minutes + "分钟"; + } else if (hours > 0) { + result = hours + "小时" + minutes + "分钟"; + } else if (minutes > 0) { + result = minutes + "分钟" + seconds + "秒"; + } else { + result = seconds + "秒"; + } + return result; + } + + /** + * 计算时间差(time1 - time2),返回单位为天 + * @param time1 + * @param time2 + * @return String + */ + public static long subTimeToDay(String time1, String time2) throws ParseException { + String t1 = (time1.compareTo(time2) > 0) ? time1 : time2; + String t2 = (time1.compareTo(time2) > 0) ? time2 : time1; + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 + Date dt1 = sdf.parse(t1); + Date dt2 = sdf.parse(t2); + long time = (dt1.getTime() - dt2.getTime())/1000; + long result = 0; + return time / (60 * 60 * 24); + } + + /** + * 日期比较:(time1 > time2)返回1,=返回0,<返回-1 + * @param time1 + * @param time2 + * @return int + */ + public static int compare(String time1, String time2) throws ParseException { + time1 = time1.substring(0, 8); + time2 = time2.substring(0, 8); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");//设置日期格式 + Date dt1 = sdf.parse(time1); + Date dt2 = sdf.parse(time2); + return dt1.compareTo(dt2); + } + + /** + * "yyyyMMddHHmmss"转成“yyyy-MM-dd HH:mm:ss“ + * @param time + * @return String + */ + public static String changeForm(String time) throws ParseException { + Date date = new Date(); + try { + date = new SimpleDateFormat("yyyyMMddHHmmss").parse(time);//先按照原格式转换为时间 + } catch (ParseException e) { + e.printStackTrace(); + } + String str = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);//再将时间转换为对应格式字符串 + return str; + } + + /** + * 获取今天的时间范围 + * @return 返回长度为2的字符串集合,如:[2017-11-03 00:00:00, 2017-11-03 24:00:00] + */ + public static List getToday() { + List dataList = new ArrayList<>(2); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(System.currentTimeMillis()); + calendar.add(Calendar.DATE, 0); + String today = dateFormat.format(calendar.getTime()); + dataList.add(today + " 00:00:00"); + dataList.add(today + " 24:00:00"); + return dataList; + } + + /** + * 获取昨天的时间范围 + * @return 返回长度为2的字符串集合,如:[2017-11-02 00:00:00, 2017-11-02 24:00:00] + */ + public static List getYesterday() { + List dataList = new ArrayList<>(2); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + //获取指定时间 + Calendar calendar = Calendar.getInstance(); + //获取当天时间的起点时间 + calendar.setTimeInMillis(System.currentTimeMillis()); + //获取当前日期前一天 + calendar.add(Calendar.DATE, -1); + //转换成指定格式 + String yesterday = dateFormat.format(calendar.getTime()); + dataList.add(yesterday + " 00:00:00"); + dataList.add(yesterday + " 24:00:00"); + return dataList; + } + + /** + * 获取前天的时间范围 + * @return 返回长度为2的字符串集合,如:[2017-11-02 00:00:00, 2017-11-02 24:00:00] + */ + public static List getDayBeforeYesterday() { + List dataList = new ArrayList<>(2); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + //获取指定时间 + Calendar calendar = Calendar.getInstance(); + //获取当天时间的起点时间 + calendar.setTimeInMillis(System.currentTimeMillis()); + //获取当前日期前一天 + calendar.add(Calendar.DATE, -2); + //转换成指定格式 + String yesterday = dateFormat.format(calendar.getTime()); + dataList.add(yesterday + " 00:00:00"); + dataList.add(yesterday + " 24:00:00"); + return dataList; + } + + /** + * 获取本周的时间范围 + * @return 返回长度为2的字符串集合,如:[2017-10-30 00:00:00, 2017-11-05 24:00:00] + */ + public static List getCurrentWeek() { + List dataList = new ArrayList<>(2); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + calendar.setFirstDayOfWeek(Calendar.MONDAY);//设置周一为一周之内的第一天 + calendar.setTimeInMillis(System.currentTimeMillis()); + calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); + String monday = dateFormat.format(calendar.getTime()) + " 00:00:00"; + calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); + String sunday = dateFormat.format(calendar.getTime()) + " 24:00:00"; + dataList.add(monday); + dataList.add(sunday); + return dataList; + } + + /** + * 获取上周的时间范围 + * @return 返回长度为2的字符串集合,如:[2017-10-30 00:00:00, 2017-11-05 24:00:00] + */ + public static List getLastWeek() { + List dataList = new ArrayList<>(2); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 设置时间格式 + Calendar calendar1 = Calendar.getInstance(); + Calendar calendar2 = Calendar.getInstance(); + int dayOfWeek = calendar1.get(Calendar.DAY_OF_WEEK) - 1; + int offset1 = 1 - dayOfWeek; + int offset2 = 7 - dayOfWeek; + calendar1.add(Calendar.DATE, offset1 - 7); + calendar2.add(Calendar.DATE, offset2 - 7); +// 上周星期一 + String lastBeginDate = sdf.format(calendar1.getTime())+ " 00:00:00"; + dataList.add(lastBeginDate); +// 上周星期日 + String lastEndDate = sdf.format(calendar2.getTime())+ " 00:00:00"; + dataList.add(lastEndDate); + return dataList; + } + + /** + * 获取本月的时间范围 + * @return 返回长度为2的字符串集合,如:[2017-11-01 00:00:00, 2017-11-30 24:00:00] + */ + public static List getCurrentMonth() { + List dataList = new ArrayList<>(2); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(System.currentTimeMillis()); + calendar.add(Calendar.MONTH, 0);//0表示本月 + calendar.set(Calendar.DAY_OF_MONTH, 1); + String firstDayOfMonth = dateFormat.format(calendar.getTime()) + " 00:00:00"; + calendar.add(Calendar.MONTH, 1); + calendar.set(Calendar.DAY_OF_MONTH, 0); + String lastDayOfMonth = dateFormat.format(calendar.getTime()) + " 24:00:00"; + dataList.add(firstDayOfMonth); + dataList.add(lastDayOfMonth); + return dataList; + } + + /** + * 获取上个月的时间范围 + * @return 返回长度为2的字符串集合,如:[2017-11-01 00:00:00, 2017-11-30 24:00:00] + */ + public static List getLastMonth() { + List dataList = new ArrayList<>(2); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(System.currentTimeMillis()); + calendar.add(Calendar.MONTH, -1);//0表示 + calendar.set(Calendar.DAY_OF_MONTH, 1); + String firstDayOfMonth = dateFormat.format(calendar.getTime()) + " 00:00:00"; + calendar.add(Calendar.MONTH, 1); + calendar.set(Calendar.DAY_OF_MONTH, 0); + String lastDayOfMonth = dateFormat.format(calendar.getTime()) + " 24:00:00"; + dataList.add(firstDayOfMonth); + dataList.add(lastDayOfMonth); + return dataList; + } + + /** + * 获取今年某月份的开始结束日期 + * + * @param offset 0本月,1下个月,-1上个月,依次类推 + * @return + */ + public static List someMonth(int offset) { + List dataList = new ArrayList<>(2); + Calendar calendar = Calendar.getInstance(); + //获取当前年份 + int i = calendar.get(Calendar.YEAR); + calendar.set(Calendar.YEAR, i); + calendar.set(Calendar.MONTH, offset - 1); + calendar.set(Calendar.DATE, 1); + String str = getCalendarToTimestapStr(setStarthhmmss(calendar)); + dataList.add(str); + calendar.set(Calendar.YEAR, i); + calendar.set(Calendar.MONTH, offset); + calendar.set(Calendar.DATE, 1); + String strs = getCalendarToTimestapStr(setStarthhmmss(calendar)); + dataList.add(strs); + return dataList; + } + + /** + * 获取某天的开始日期 + * + * @param offset 0今天,1明天,-1昨天,依次类推 + * @return + */ + public static List dayStart(int offset) { + List dataList = new ArrayList<>(2); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + LocalDateTime localDateTime = LocalDate.now().plusDays(offset).atStartOfDay(); + dataList.add(localDateTime.format(dtf)); + return dataList; + + } + + /** + * 获取某周的开始日期 + * + * @param offset 0本周,1下周,-1上周,依次类推 + * @return + */ + public static List weekStart(int offset) { + List dataList = new ArrayList<>(2); + LocalDate localDate = LocalDate.now().plusWeeks(offset); + LocalDate date = localDate.with(DayOfWeek.MONDAY); + DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String dateStr = date.format(fmt)+" 00:00:00"; + dataList.add(dateStr); + return dataList; + } + + /** + * 获取某月份的开始日期 + * + * @param offset 0本月,1下个月,-1上个月,依次类推 + * @return + */ + public static List monthStart(int offset) { + List dataList = new ArrayList<>(2); + DateTimeFormatter dateFormat =DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate date = LocalDate.now().plusMonths(offset).with(TemporalAdjusters.firstDayOfMonth()); + String firstDayOfMonth = date.format(dateFormat) + " 00:00:00"; + dataList.add(firstDayOfMonth); + return dataList; + } + + /** + * 获取某年的开始日期 + * + * @param offset 0今年,1明年,-1去年,依次类推 + * @return + */ + public static List yearStart(int offset) { + List dataList = new ArrayList<>(2); + DateTimeFormatter dateFormat =DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate localDate = LocalDate.now().plusYears(offset).with(TemporalAdjusters.firstDayOfYear()); + String firstDayOfMonth = localDate.format(dateFormat) + " 00:00:00"; + dataList.add(firstDayOfMonth); + return dataList; + } + + /** + * 获取 日历 的 时间戳字符串 (月 需要 +1) + */ + private static String getCalendarToTimestapStr(Calendar cal){ + + String yyyymmdd = cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.DAY_OF_MONTH); + String hhmmss = cal.get(Calendar.HOUR_OF_DAY) + ":" + cal.get(Calendar.MINUTE) + ":" + cal.get(Calendar.SECOND); + return yyyymmdd + " "+ hhmmss; + } + + /** + * 设置 开始时间的 时分秒 + */ + private static Calendar setStarthhmmss(Calendar cal){ + cal.set(Calendar.HOUR_OF_DAY, 00); + cal.set(Calendar.MINUTE, 00); + cal.set(Calendar.SECOND, 00); + return cal; + } + + /** + * 获取去年的时间段 + * @return + */ + public static List getLastYear() { + List dataList = new ArrayList<>(2); + DateTimeFormatter dateFormat =DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate localDate = LocalDate.now().plusYears(-1).with(TemporalAdjusters.firstDayOfYear()); + String firstDayOfMonth = localDate.format(dateFormat) + " 00:00:00"; + dataList.add(firstDayOfMonth); + LocalDate localDate1 = LocalDate.now().plusYears(0).with(TemporalAdjusters.firstDayOfYear()); + String firstDayOfMonth1 = localDate1.format(dateFormat) + " 00:00:00"; + dataList.add(firstDayOfMonth1); + return dataList; + } + + /** + * 获取今年的时间段 + * @return + */ + public static List getThisYear() { + List dataList = new ArrayList<>(2); + DateTimeFormatter dateFormat =DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate localDate = LocalDate.now().plusYears(0).with(TemporalAdjusters.firstDayOfYear()); + String firstDayOfMonth = localDate.format(dateFormat) + " 00:00:00"; + dataList.add(firstDayOfMonth); + LocalDate localDate1 = LocalDate.now().plusYears(1).with(TemporalAdjusters.firstDayOfYear()); + String firstDayOfMonth1 = localDate1.format(dateFormat) + " 00:00:00"; + dataList.add(firstDayOfMonth1); + return dataList; + } + + /** + * 前年 + * @return + */ + public static List getTheYearBeforeLast() { + List dataList = new ArrayList<>(2); + DateTimeFormatter dateFormat =DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate localDate = LocalDate.now().plusYears(-2).with(TemporalAdjusters.firstDayOfYear()); + String firstDayOfMonth = localDate.format(dateFormat) + " 00:00:00"; + dataList.add(firstDayOfMonth); + LocalDate localDate1 = LocalDate.now().plusYears(-1).with(TemporalAdjusters.firstDayOfYear()); + String firstDayOfMonth1 = localDate1.format(dateFormat) + " 00:00:00"; + dataList.add(firstDayOfMonth1); + return dataList; + } + + public static void main(String[] args) throws ParseException { + String time = addTime("20220525165212", 76); + System.out.println(time); + String t1 = "20220706170722"; + String t2 = getCurrentTime(); + System.out.println("时间比较结果:" + changeForm(t1)); + System.out.println("时间差:" + subTimeToDate(t2, t1)); + } + +} diff --git a/src/main/java/com/qiwu/inference/common/utils/DoubleUtil.java b/src/main/java/com/qiwu/inference/common/utils/DoubleUtil.java new file mode 100755 index 0000000..788ae38 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/DoubleUtil.java @@ -0,0 +1,105 @@ +package com.qiwu.inference.common.utils; + +import java.math.BigDecimal; + +/** + * 提供精确的浮点数运算工具类 + * @author xingxing.ye.ye + * + */ +public class DoubleUtil { + + // 除法运算默认精度,下面自定义方法可修改 + private static final int DEF_DIV_SCALE = 10; + + private DoubleUtil() { + + } + + /** + * 精确加法 + */ + public static double add(double firValue, double sedValue) { + BigDecimal firBD = BigDecimal.valueOf(firValue); + BigDecimal sedBD = BigDecimal.valueOf(sedValue); + return firBD.add(sedBD).doubleValue(); + } + + /** + * 精确减法 + */ + public static double sub(double firValue, double sedValue) { + BigDecimal firBD = BigDecimal.valueOf(firValue); + BigDecimal sedBD = BigDecimal.valueOf(sedValue); + return firBD.subtract(sedBD).doubleValue(); + } + + /** + * 精确乘法 + */ + public static double mul(double firValue, double sedValue) { + BigDecimal firBD = BigDecimal.valueOf(firValue); + BigDecimal sedBD = BigDecimal.valueOf(sedValue); + return firBD.multiply(sedBD).doubleValue(); + } + + /** + * 精确除法 使用默认精度 + */ + public static double div(double firValue, double sedValue) { + double num = 0; + try { + num = div(firValue, sedValue, DEF_DIV_SCALE); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return num; + } + + /** + * 精确除法 + * + * @param scale 精度 + * @throws IllegalAccessException + */ + public static double div(double firValue, double sedValue, int scale) throws IllegalAccessException { + if (scale < 0) { + throw new IllegalAccessException("精确度不能小于0"); + } + BigDecimal b1 = BigDecimal.valueOf(firValue); + BigDecimal b2 = BigDecimal.valueOf(sedValue); + return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + /** + * 四舍五入 + * + * @param scale 小数点后保留几位 + */ + public static double round(double value, int scale) { + double num = 0; + try { + num = div(value, 1, scale); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return num; + } + + /** + * 比较两数是否相等 + */ + public static boolean equalTo(BigDecimal firBD, BigDecimal sedBD) { + if (firBD == null || sedBD == null) { + return false; + } + return 0 == firBD.compareTo(sedBD); + } + + /** + * 百分号的数转化为小数 + */ + public static double convert(String str) { + return Double.parseDouble(str.replace("%",""))*0.01; + } +} \ No newline at end of file diff --git a/src/main/java/com/qiwu/inference/common/utils/FastJsonUtil.java b/src/main/java/com/qiwu/inference/common/utils/FastJsonUtil.java new file mode 100755 index 0000000..d79c077 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/FastJsonUtil.java @@ -0,0 +1,232 @@ +package com.qiwu.inference.common.utils; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author: xingxing.ye + * @describe: fast json 工具 + */ +public final class FastJsonUtil { + private FastJsonUtil() { + + } + + /** + * 将对象转换为json + * null ->list =[] + * 输出null 值 + * @param value 对象 + * @return + */ + public static String obj2json(Object value) { + try { + return JSON.toJSONString(value,SerializerFeature.WriteMapNullValue,SerializerFeature.WriteNullListAsEmpty); + } catch (Exception e) { + try { + return obj2json3(value); + } catch (Exception e1) { + e.printStackTrace(); + return null; + } + } + } + + public static String obj2jsonPretty(Object value) { + try { + return JSON.toJSONString(value, SerializerFeature.PrettyFormat); + } catch (Exception e) { + try { + return obj2json2(value); + } catch (Exception e1) { + e.printStackTrace(); + return null; + } + } + } + + public static String obj2jsonDateFormat(Object value) { + try { + return JSON.toJSONStringWithDateFormat(value, "yyyy-MM-dd HH:mm:ss", + SerializerFeature.WriteDateUseDateFormat,SerializerFeature.DisableCircularReferenceDetect); + } catch (Exception e) { + try { + return obj2json2(value); + } catch (Exception e1) { + e.printStackTrace(); + return null; + } + } + } + + public static String obj2jsonDateFormat(Object value, String format) { + try { +// return JSON.toJSONString(value, SerializerFeature.PrettyFormat); + return JSON.toJSONStringWithDateFormat(value, format, + SerializerFeature.WriteDateUseDateFormat); + } catch (Exception e) { + try { + return obj2json2(value); + } catch (Exception e1) { + e.printStackTrace(); + return null; + } + } + } + + @SuppressWarnings("deprecation") + public static String obj2json2(Object value) { + try { + return JSON.toJSONString(value, SerializerFeature.WriteTabAsSpecial, SerializerFeature.WriteSlashAsSpecial); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + @SuppressWarnings("deprecation") + public static String obj2json3(Object value) { + try { + return JSON.toJSONString(value, SerializerFeature.WriteTabAsSpecial, SerializerFeature.WriteSlashAsSpecial, + SerializerFeature.BrowserCompatible); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 将json转换为对象 + * + * @param 转换的类型 + * @param json json数据 + * @param clazz 被转化对象的class + * @return + */ + public static T json2obj(String json, Class clazz) { + try { + return JSON.parseObject(json, clazz); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 将json转换为对象数组 + * + * @param 转换的类型 + * @param json json数据 + * @param clazz 被转化对象的class + * @return + */ + public static List json2List(String json, Class clazz) { + try { + return JSON.parseArray(json, clazz); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * jsonStr to Map + * + * @param jsonStr jsonStr + * @return + * @author tongys + * @date 2013-4-2 + */ + public static Map parseJSON2Map(String jsonStr) { + + // 参数di + Map map = new HashMap(); + JSONObject json = null; + + // 最外层解析 + try { + json = JSONObject.parseObject(jsonStr); + for (String k : json.keySet()) { + Object v = json.get(k); + if (null != v) { + map.put(k.toString(), v.toString()); + } + } + } catch (Exception e) { + e.printStackTrace(); + return null; + } + return map; + } + + /** + * jsonStr to Map + * + * @param jsonStr jsonStr + * @return + */ + public static Map parseJSON2Map2(String jsonStr) { + + // 参数di + Map map = new HashMap(); + JSONObject json = null; + + // 最外层解析 + try { + json = JSONObject.parseObject(jsonStr); + for (String k : json.keySet()) { + Object v = json.get(k); + if (null != v) { + map.put(k.toString(), v.toString()); + } + } + } catch (Exception e) { + e.printStackTrace(); + return null; + } + return map; + } + + /** + * 保存json数据到指定的文件路径 + * @param jsonData json数据 + * @param filePath 文件路径 + * @return + */ + public static boolean createJsonFile(Object jsonData, String filePath) { + String content = JSON.toJSONString(jsonData, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue, + SerializerFeature.WriteDateUseDateFormat); + try { + File file = new File(filePath); + // 创建上级目录 + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + // 如果文件存在,则删除文件 + if (file.exists()) { + file.delete(); + } + // 创建文件 + file.createNewFile(); + // 写入文件 + Writer write = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8); + write.write(content); + write.flush(); + write.close(); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/qiwu/inference/common/utils/FileUtil.java b/src/main/java/com/qiwu/inference/common/utils/FileUtil.java new file mode 100755 index 0000000..c7138c1 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/FileUtil.java @@ -0,0 +1,36 @@ +package com.qiwu.inference.common.utils; + +import java.io.File; +import java.io.InputStream; + +public class FileUtil { + + + public static InputStream getResourcesFileInputStream(String fileName) { + return Thread.currentThread().getContextClassLoader().getResourceAsStream("" + fileName); + } + + public static String getPath() { + return FileUtil.class.getResource("/").getPath(); + } + + public static File createNewFile(String pathName) { + File file = new File(getPath() + pathName); + if (file.exists()) { + file.delete(); + } else { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + } + return file; + } + + public static File readFile(String pathName) { + return new File(getPath() + pathName); + } + + public static File readUserHomeFile(String pathName) { + return new File(System.getProperty("user.home") + File.separator + pathName); + } +} diff --git a/src/main/java/com/qiwu/inference/common/utils/NumberUtil.java b/src/main/java/com/qiwu/inference/common/utils/NumberUtil.java new file mode 100755 index 0000000..ac38324 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/NumberUtil.java @@ -0,0 +1,66 @@ +package com.qiwu.inference.common.utils; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +public class NumberUtil { + /** + * 开闭区间正则表达式 + */ + private static final Pattern NUM_RANGE_PATTERN = Pattern.compile("[\\[|\\(]\\s?\\d+\\s?,\\s?\\d+\\s?[\\)|\\]]"); + /** + * 左半区间正则表达式 + */ + private static final Pattern LEFT_NUM_RANGE_PATTERN = Pattern.compile("[\\[|\\(]\\s?\\d+\\s?,\\s?[\\)|\\]]"); + /** + * 右半区间正则表达式 + */ + private static final Pattern RIGHT_NUM_RANGE_PATTERN = Pattern.compile("[\\[|\\(],\\s?\\d+\\s?[\\)|\\]]"); + /** + * 判断是否为有效的数字区间范围 + * @param numRange 数字区间 + * @return boolean + */ + public static boolean isValidNumRange(String numRange) { + return NUM_RANGE_PATTERN.matcher(numRange).matches() + || LEFT_NUM_RANGE_PATTERN.matcher(numRange).matches() + || RIGHT_NUM_RANGE_PATTERN.matcher(numRange).matches(); + } + + /** + * 判断数值是否在区间范围内 + * @param number 数值 + * @param numRange 开闭区间 + * @return boolean + */ + public static boolean inNumRange(int number, String numRange) { + Objects.requireNonNull(numRange); + + if (!isValidNumRange(numRange)) { + return false; + } + + String[] pairs = numRange.split(","); + + // 获取开闭区间的最小值和最大值 + List rangeNums = Arrays.stream(pairs).map(str -> str.replaceAll("[(|)|\\[|\\]]", "").trim()).collect(Collectors.toList()); + Integer minValue = "".equals(rangeNums.get(0)) ? null : Integer.valueOf(rangeNums.get(0)); + Integer maxValue = "".equals(rangeNums.get(1)) ? null : Integer.valueOf(rangeNums.get(1)); + + // 判定数值是否大于最小值 + boolean minMatched = (minValue == null) || (pairs[0].startsWith("[") ? number >= minValue : number > minValue); + // 判定数值是否小于最大值 + boolean maxMatched = (maxValue == null) || (pairs[1].endsWith("]") ? number <= maxValue : number < maxValue); + + return minMatched && maxMatched; + } + + public static void main(String[] args) { + System.out.println(inNumRange(1, "[15, 29]")); + } + + +} diff --git a/src/main/java/com/qiwu/inference/common/utils/PersistenceUtil.java b/src/main/java/com/qiwu/inference/common/utils/PersistenceUtil.java new file mode 100644 index 0000000..b8b7902 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/PersistenceUtil.java @@ -0,0 +1,120 @@ +package com.qiwu.inference.common.utils; + +import org.springframework.beans.factory.annotation.Value; +import org.yaml.snakeyaml.Yaml; + +import java.io.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PersistenceUtil { + /** + * 保存玩家数据到json文件 + * @param fileName + * @param data + * @return void + */ + public static void saveDataToFile(String path, String fileName, String data) { + BufferedWriter writer = null; + File file = new File(path + fileName + ".json"); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (Exception e) { + e.printStackTrace(); + } + } + try { + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, false), "UTF-8")); + writer.write(data); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (writer != null) { + writer.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + /** + * 从json文件中读取玩家数据 + * @param filePath + * @return String + */ + public static String getDataFromFile(String filePath) { + BufferedReader reader = null; + String lastStr = ""; + try { + FileInputStream fileInputStream = new FileInputStream(filePath); + InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8"); + reader = new BufferedReader(inputStreamReader); + String stringTmp = null; + while ((stringTmp = reader.readLine()) != null) { + lastStr += stringTmp; + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (reader != null) { + reader.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return lastStr; + } + + /** + * 从json文件中读取各配置文件的信息 + * @param path + * @param fileName + * @return String + */ + public static String getConfigFromFile(String path, String fileName) { + BufferedReader reader = null; + String lastStr = ""; + try { + FileInputStream fileInputStream = new FileInputStream(path + fileName); + InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8"); + reader = new BufferedReader(inputStreamReader); + String stringTmp = null; + while ((stringTmp = reader.readLine()) != null) { + lastStr += stringTmp; + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (reader != null) { + reader.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return lastStr; + } + + /** + * 将话术转成map格式 + * @param + * @return Map>> + */ + public static Map>> loadSpeechToMap(String speechFilePath, String fileName) { + Map>> speechMap = new HashMap<>(); + try { + InputStream in = new FileInputStream(speechFilePath + fileName); + Yaml yaml = new Yaml(); + speechMap = yaml.load(in); + } catch (Exception e) { + e.printStackTrace(); + } + return speechMap; + } +} diff --git a/src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java b/src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java new file mode 100644 index 0000000..53530e3 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java @@ -0,0 +1,465 @@ +package com.qiwu.inference.common.utils; + +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.dto.*; +import org.springframework.util.StringUtils; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +public class PlayerUtil { + /** + * 获取玩家关卡中人物所在的所有场所 + */ + public static List getLocationByUid(String uid) { + List locationList = new ArrayList<>(); + Map personMap = TimingAcquisition.playerMap.get(uid).getPersonMap(); + for (Map.Entry entry : personMap.entrySet()) { + Person person = entry.getValue(); + if (!StringUtils.isEmpty(person.getLocation())) { + locationList.add(person.getLocation()); + } + } + return locationList; + } + + /** + * 通过人物id获取人物名称 + */ + public static String getNameByPersonId(String uid, Integer id) { + Map name2IdMap = TimingAcquisition.playerMap.get(uid).getName2IdMap(); + for (Map.Entry entry : name2IdMap.entrySet()) { + if (entry.getValue().equals(id)) { + return entry.getKey(); + } + } + return null; + } + + /** + * 获取玩家已知的场所 + */ + public static String getLocations(String uid) { + StringBuilder text = new StringBuilder(); + List locationIdList = new ArrayList<>(); + Map personMap = TimingAcquisition.playerMap.get(uid).getPersonMap(); + for (Map.Entry entry : personMap.entrySet()) { + Person person = entry.getValue(); + if (!StringUtils.isEmpty(person.getLocation())) { + if (!locationIdList.contains(person.getLocation())) { + locationIdList.add(person.getLocation()); + } + } + } + for (String locationId : locationIdList) { + text.append(TimingAcquisition.locationMap.get(locationId).getName()).append("、"); + } + if (text.length() != 0) { + text.deleteCharAt(text.length() - 1); + } + return text.toString(); + } + + /** + * 通过场所id找到场所的所有人物 + */ + public static List getPersonsByLocationId(String uid, String locationId) { + List personIdList = new ArrayList<>(); + Map personMap = TimingAcquisition.playerMap.get(uid).getPersonMap(); + for (Map.Entry entry : personMap.entrySet()) { + if (locationId.equals(entry.getValue().getLocation())) { + personIdList.add(entry.getKey()); + } + } + return personIdList; + } + + /** + * 通过指定人物找到所有满足关系线索阈值的人物 + */ + public static List getRelativePersonIds(String uid, Integer personId) { + List personIdList = new ArrayList<>(); + //指定人物拥有的关系 + List relations = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getRelations(); + List clues = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getClues(); + //信任值 + Integer trustDegree = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getTrustDegree(); + //威慑度 + Integer deterrenceDegree = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getDeterrenceDegree(); + int max = trustDegree; + //遍历所有关系 + for (RelationDto relation : relations) { + //关系类型为“交情”和“亲缘” + if (relation.getType() == 1 || relation.getType() == 2) { + //遍历所有线索 + for (ClueDto clue : clues) { + if (Constants.RELATION_TYPE.equals(clue.getType())) { + //判断是否符合阈值需求 + if(trustDegree >= clue.getTrustDegree() || deterrenceDegree >= clue.getThreaten()){ + personIdList.add(relation.getObject()); + break; + } + } + } + } + } + return personIdList; + } + + /** + * 记录玩家已获得线索 + */ + public static void recordClue(String uid, Integer personId, Integer clueTypeId, ClueDto clue) { + Map>> clueMap = TimingAcquisition.playerMap.get(uid).getClueMap(); + Map> clueListMap = new ConcurrentHashMap<>(); + List clueList = new ArrayList<>(); + //玩家还没有收集此人的线索 + if (StringUtils.isEmpty(clueMap.get(personId))) { + clueList.add(clue); + clueListMap.put(clueTypeId, clueList); + clueMap.put(personId, clueListMap); + return; + } + //玩家还没有收集到此人这类的线索 + if (StringUtils.isEmpty(clueMap.get(personId).get(clueTypeId))) { + clueList.add(clue); + clueListMap.put(clueTypeId, clueList); + clueMap.get(personId).putAll(clueListMap); + return; + } + //玩家还没有收集到这条线索 + List clues = clueMap.get(personId).get(clueTypeId); + boolean have = false; + for (ClueDto c : clues) { + if (c.getClueId().equals(clue.getClueId())) { + have = true; + } + } + //没有找到则新增一条线索 + if (!have) { + clues.add(clue); + } + } + + /** + * 记录玩家已获得线索 + */ + public static void recordClue(String uid, Integer personId) { + Map>> clueMap = TimingAcquisition.playerMap.get(uid).getClueMap(); + //玩家见过这个人 + if (!StringUtils.isEmpty(clueMap.get(personId))) { + return; + } + clueMap.put(personId, null); + } + + /** + * 判断线索是否为指定性格类型的线索 + * @param clueList + * @param type + */ + public static List checkClueType(List clueList, String type) { + List result = new ArrayList<>(); + for (ClueDto clueDto : clueList) { + //关联的性格id + Integer associatedId = TimingAcquisition.clueMap.get(clueDto.getClueId()).getAssociatedId(); + if ("1".equals(type) || "3".equals(type)) { + List typeList = new ArrayList<>(); + typeList.add("1"); + typeList.add("3"); + if (typeList.contains(TimingAcquisition.dispositionMap.get(associatedId).getType())) { + result.add(clueDto); + } + } else { + if (type.equals(TimingAcquisition.dispositionMap.get(associatedId).getType())) { + result.add(clueDto); + } + } + } + return result; + } + + /** + * 找到人物对应线索类型,且符合任务目的线索 + * @param uid + * @param personId + * @param taskTarget 1 信任度提升 2 信任度降低 3 威慑度提升 4 威慑度降低 + */ + public static List getCluesByType(String uid, Integer personId, Integer taskTarget) { + List result = new ArrayList<>(); + Person person = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId); + if(!StringUtils.isEmpty(person)){ + //找到玩家能达到目的任务 + List demandTaskList = findTasks(person, taskTarget); + //遍历任务,找到对应的任务线索 + for (DemandTaskDto demandTask : demandTaskList) { + Integer clueId = demandTask.getClueId(); + //找到对应线索 + ClueDto clue = getClueById(uid, personId, clueId); + if (!StringUtils.isEmpty(clue)) { + result.add(clue); + } + } + } + return result; + } + + /** + * 找到人物对应任务的线索 + * @param uid + * @param personId + */ + public static List getClueByTypeAndTaskId(String uid, Integer personId, String taskId) { + List result = new ArrayList<>(); + Person person = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId); + if(!StringUtils.isEmpty(person)){ + //通过任务条件id找到玩家需求任务集合 + List demandTaskList = findDemandsByTaskId(person, taskId); + for (DemandTaskDto demandTask : demandTaskList) { + //找到对应的任务线索 + Integer clueId = demandTask.getClueId(); + //找到对应线索 + ClueDto clue = getClueById(uid, personId, clueId); + if (!StringUtils.isEmpty(clue)) { + result.add(clue); + } + } + } + return result; + } + + /** + * 查询符合条件的任务 + * @param person + * @param taskTarget 1 信任度提升 2 信任度降低 3 威慑度提升 4 威慑度降低 + * @return + */ + private static List findTasks(Person person, Integer taskTarget){ + List result = new ArrayList<>(); + if(!StringUtils.isEmpty(person)){ + List demandTaskList = person.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (taskTarget == 1) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) > 0) { + result.add(demandTask); + } + } + } else if (taskTarget == 2) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) < 0) { + result.add(demandTask); + } + } + } else if (taskTarget == 3) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) > 0) { + result.add(demandTask); + } + } + } else if (taskTarget == 4) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) < 0) { + result.add(demandTask); + } + } + } + } + } + return result; + } + + /** + * 通过任务条件id找到对应的需求任务id + */ + public static List findDemandsByTaskId(Person person, String taskId) { + List result = new ArrayList<>(); + List demandTaskList = person.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + String condition1 = demandTask.getCondition1(); + String[] taskIdTimes = condition1.split("\\|"); + if (taskId.equals(taskIdTimes[0])) { + result.add(demandTask); + } + } + return result; + } + + /** + * 通过线索id找到对应线索 + */ + public static ClueDto getClueById(String uid, Integer personId, Integer clueId) { + List clueList = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getClues(); + for (ClueDto clue : clueList) { + if (clueId.equals(clue.getClueId())) { + return clue; + } + } + return null; + } + + /** + * 通过线索id找到需求任务 + */ + public static DemandTaskDto getDemandTaskByClueId(Person person, Integer clueId) { + List demandTaskList = person.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (clueId.equals(demandTask.getClueId())) { + return demandTask; + } + } + return null; + } + + /** + * 判断线索是否符合阈值需求 + * @param uid + * @param clueList + * @return + */ + public static List checkTaskThreshold(String uid, List clueList){ + List result = new ArrayList<>(); + Integer talkPersonId = TimingAcquisition.playerMap.get(uid).getPersonId(); + //信任值 + Integer trustDegree = TimingAcquisition.playerMap.get(uid).getPersonMap().get(talkPersonId).getTrustDegree(); + //威慑度 + Integer deterrenceDegree = TimingAcquisition.playerMap.get(uid).getPersonMap().get(talkPersonId).getDeterrenceDegree(); + for (ClueDto clue : clueList) { + if (trustDegree >= clue.getTrustDegree() || deterrenceDegree >= clue.getThreaten()) { + result.add(clue); + } + } + return result; + } + + /** + * 查找任务目的为对应类型线索 + * @param uid + * @param personId + * @param clueList + * @param taskTarget 1 信任度提升 2 信任度降低 3 威慑度提升 4 威慑度降低 + */ + public static List getCluesIsType(String uid, Integer personId, List clueList, Integer taskTarget) { + List result = new ArrayList<>(); + Person person = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId); + for (ClueDto clue : clueList) { + DemandTaskDto demandTask = getDemandTaskByClueId(person, clue.getClueId()); + if (!StringUtils.isEmpty(demandTask)) { + if (taskTarget == 1) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) > 0) { + result.add(clue); + } + } + } else if (taskTarget == 2) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) < 0) { + result.add(clue); + } + } + } else if (taskTarget == 3) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) > 0) { + result.add(clue); + } + } + } else if (taskTarget == 4) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) < 0) { + result.add(clue); + } + } + } + } + } + return result; + } + + /** + * 判断是否符合阈值需求 + * @param trustCondition + * @param deterrenceCondition + * @param subject + * @return + */ + public static boolean checkThreshold(String trustCondition,String deterrenceCondition,Person subject){ + boolean flag = false; + if(!StringUtils.isEmpty(trustCondition)){ + String[] trustConditions = trustCondition.split("\\|"); + if(NumberUtil.inNumRange(subject.getTrustDegree(),"["+trustConditions[0]+","+trustConditions[1]+"]")) { + flag = true; + } + } + + if(!StringUtils.isEmpty(deterrenceCondition)) { + String[] deterrenceConditions = deterrenceCondition.split("\\|"); + if(NumberUtil.inNumRange(subject.getDeterrenceDegree(),"["+deterrenceConditions[0]+","+deterrenceConditions[1]+"]")) { + flag = true; + } + } + return flag; + } + + /** + * 新增阈值 + * @param subject + * @param demandTask + */ + public static void addThreshold(Person subject, DemandTaskDto demandTask) { + if(!StringUtils.isEmpty(demandTask.getTrustDegree())) { + if(subject.getTrustDegree() < 100) { + if((subject.getTrustDegree() + Integer.parseInt(demandTask.getTrustDegree()) ) > 100) { + subject.setTrustDegree(100); + } else { + subject.setTrustDegree(subject.getTrustDegree() + Integer.parseInt(demandTask.getTrustDegree())); + } + } + } + + if(!StringUtils.isEmpty(demandTask.getDeterrenceDegree())) { + if(subject.getDeterrenceDegree() < 100) { + if((subject.getDeterrenceDegree() + Integer.parseInt(demandTask.getDeterrenceDegree())) > 100){ + subject.setDeterrenceDegree(100); + } else { + subject.setDeterrenceDegree(subject.getDeterrenceDegree() + Integer.parseInt(demandTask.getDeterrenceDegree())); + } + } + } + } + + /** + * 玩家重置关卡 + */ + public static void resetPlayer(String uid) { + Player player = TimingAcquisition.playerMap.get(uid); + player.setClueMap(new HashMap<>()); + player.setTaskMap(new HashMap<>()); + player.setCurrency(0.0); + player.setPoint(0); + for (Map.Entry entry : player.getPersonMap().entrySet()) { + Person person = entry.getValue(); + person.setTrustDegree(0); + person.setDeterrenceDegree(0); + } + } + + /** + * 玩家放弃关卡 + */ + public static void playerGiveUp(String uid) { + Player player = TimingAcquisition.playerMap.get(uid); + player.setClueMap(new HashMap<>()); + player.setTaskMap(new HashMap<>()); + player.setCurrency(0.0); + player.setPoint(0); + } +} diff --git a/src/main/java/com/qiwu/inference/common/utils/RandomUtil.java b/src/main/java/com/qiwu/inference/common/utils/RandomUtil.java new file mode 100755 index 0000000..94ce383 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/RandomUtil.java @@ -0,0 +1,510 @@ +package com.qiwu.inference.common.utils; + +import java.awt.Color; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.util.*; +import java.util.concurrent.ThreadLocalRandom; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.exceptions.UtilException; +import cn.hutool.core.lang.UUID; +import cn.hutool.core.lang.WeightRandom; +import cn.hutool.core.lang.WeightRandom.WeightObj; +import cn.hutool.core.util.NumberUtil; + +/** + * 随机工具类 + * + */ +public class RandomUtil { + + /** 用于随机选的数字 */ + public static final String BASE_NUMBER = "0123456789"; + /** 用于随机选的字符 */ + public static final String BASE_CHAR = "abcdefghijklmnopqrstuvwxyz"; + /** 用于随机选的字符和数字 */ + public static final String BASE_CHAR_NUMBER = BASE_CHAR + BASE_NUMBER; + + /** + * 获取随机数生成器对象
+ * ThreadLocalRandom是JDK 7之后提供并发产生随机数,能够解决多个线程发生的竞争争夺。 + * + * @return {@link ThreadLocalRandom} + * @since 3.1.2 + */ + public static ThreadLocalRandom getRandom() { + return ThreadLocalRandom.current(); + } + + /** + * 获取{@link SecureRandom},类提供加密的强随机数生成器 (RNG) + * + * @return {@link SecureRandom} + * @since 3.1.2 + */ + public static SecureRandom getSecureRandom() { + try { + return SecureRandom.getInstance("SHA1PRNG"); + } catch (NoSuchAlgorithmException e) { + throw new UtilException(e); + } + } + + /** + * 获取随机数产生器 + * + * @param isSecure 是否为强随机数生成器 (RNG) + * @return {@link Random} + * @since 4.1.15 + * @see #getSecureRandom() + * @see #getRandom() + */ + public static Random getRandom(boolean isSecure) { + return isSecure ? getSecureRandom() : getRandom(); + } + + /** + * 获得指定范围内的随机数 + * + * @param min 最小数(包含) + * @param max 最大数(不包含) + * @return 随机数 + */ + public static int randomInt(int min, int max) { + return getRandom().nextInt(min, max); + } + + /** + * 获得随机数[0, 2^32) + * + * @return 随机数 + */ + public static int randomInt() { + return getRandom().nextInt(); + } + + /** + * 获得指定范围内的随机数 [0,limit) + * + * @param limit 限制随机数的范围,不包括这个数 + * @return 随机数 + */ + public static int randomInt(int limit) { + return getRandom().nextInt(limit); + } + + /** + * 获得指定范围内的随机数[min, max) + * + * @param min 最小数(包含) + * @param max 最大数(不包含) + * @return 随机数 + * @since 3.3.0 + */ + public static long randomLong(long min, long max) { + return getRandom().nextLong(min, max); + } + + /** + * 获得随机数 + * + * @return 随机数 + * @since 3.3.0 + */ + public static long randomLong() { + return getRandom().nextLong(); + } + + /** + * 获得指定范围内的随机数 [0,limit) + * + * @param limit 限制随机数的范围,不包括这个数 + * @return 随机数 + */ + public static long randomLong(long limit) { + return getRandom().nextLong(limit); + } + + /** + * 获得指定范围内的随机数 + * + * @param min 最小数(包含) + * @param max 最大数(不包含) + * @return 随机数 + * @since 3.3.0 + */ + public static double randomDouble(double min, double max) { + return getRandom().nextDouble(min, max); + } + + /** + * 获得指定范围内的随机数 + * + * @param min 最小数(包含) + * @param max 最大数(不包含) + * @param scale 保留小数位数 + * @param roundingMode 保留小数的模式 {@link RoundingMode} + * @return 随机数 + * @since 4.0.8 + */ + public static double randomDouble(double min, double max, int scale, RoundingMode roundingMode) { + return NumberUtil.round(randomDouble(min, max), scale, roundingMode).doubleValue(); + } + + /** + * 获得随机数[0, 1) + * + * @return 随机数 + * @since 3.3.0 + */ + public static double randomDouble() { + return getRandom().nextDouble(); + } + + /** + * 获得指定范围内的随机数 + * + * @param scale 保留小数位数 + * @param roundingMode 保留小数的模式 {@link RoundingMode} + * @return 随机数 + * @since 4.0.8 + */ + public static double randomDouble(int scale, RoundingMode roundingMode) { + return NumberUtil.round(randomDouble(), scale, roundingMode).doubleValue(); + } + + /** + * 获得指定范围内的随机数 [0,limit) + * + * @param limit 限制随机数的范围,不包括这个数 + * @return 随机数 + * @since 3.3.0 + */ + public static double randomDouble(double limit) { + return getRandom().nextDouble(limit); + } + + /** + * 获得指定范围内的随机数 + * + * @param limit 限制随机数的范围,不包括这个数 + * @param scale 保留小数位数 + * @param roundingMode 保留小数的模式 {@link RoundingMode} + * @return 随机数 + * @since 4.0.8 + */ + public static double randomDouble(double limit, int scale, RoundingMode roundingMode) { + return NumberUtil.round(randomDouble(limit), scale, roundingMode).doubleValue(); + } + + /** + * 获得指定范围内的随机数[0, 1) + * + * @return 随机数 + * @since 4.0.9 + */ + public static BigDecimal randomBigDecimal() { + return NumberUtil.toBigDecimal(getRandom().nextDouble()); + } + + /** + * 获得指定范围内的随机数 [0,limit) + * + * @param limit 最大数(不包含) + * @return 随机数 + * @since 4.0.9 + */ + public static BigDecimal randomBigDecimal(BigDecimal limit) { + return NumberUtil.toBigDecimal(getRandom().nextDouble(limit.doubleValue())); + } + + /** + * 获得指定范围内的随机数 + * + * @param min 最小数(包含) + * @param max 最大数(不包含) + * @return 随机数 + * @since 4.0.9 + */ + public static BigDecimal randomBigDecimal(BigDecimal min, BigDecimal max) { + return NumberUtil.toBigDecimal(getRandom().nextDouble(min.doubleValue(), max.doubleValue())); + } + + /** + * 随机bytes + * + * @param length 长度 + * @return bytes + */ + public static byte[] randomBytes(int length) { + byte[] bytes = new byte[length]; + getRandom().nextBytes(bytes); + return bytes; + } + + /** + * 随机获得列表中的元素 + * + * @param 元素类型 + * @param list 列表 + * @return 随机元素 + */ + public static T randomEle(List list) { + return randomEle(list, list.size()); + } + + /** + * 随机获得列表中的元素 + * + * @param 元素类型 + * @param list 列表 + * @param limit 限制列表的前N项 + * @return 随机元素 + */ + public static T randomEle(List list, int limit) { + return list.get(randomInt(limit)); + } + + /** + * 随机获得数组中的元素 + * + * @param 元素类型 + * @param array 列表 + * @return 随机元素 + * @since 3.3.0 + */ + public static T randomEle(T[] array) { + return randomEle(array, array.length); + } + + /** + * 随机获得数组中的元素 + * + * @param 元素类型 + * @param array 列表 + * @param limit 限制列表的前N项 + * @return 随机元素 + * @since 3.3.0 + */ + public static T randomEle(T[] array, int limit) { + return array[randomInt(limit)]; + } + + /** + * 随机获得列表中的一定量元素 + * + * @param 元素类型 + * @param list 列表 + * @param count 随机取出的个数 + * @return 随机元素 + */ + public static List randomEles(List list, int count) { + final List result = new ArrayList(count); + int limit = list.size(); + while (result.size() < count) { + result.add(randomEle(list, limit)); + } + + return result; + } + + /** + * 随机获得列表中的一定量的不重复元素,返回Set + * + * @param 元素类型 + * @param collection 列表 + * @param count 随机取出的个数 + * @return 随机元素 + * @throws IllegalArgumentException 需要的长度大于给定集合非重复总数 + */ + public static Set randomEleSet(Collection collection, int count) { + ArrayList source = new ArrayList<>(new HashSet<>(collection)); + if (count > source.size()) { + throw new IllegalArgumentException("Count is larger than collection distinct size !"); + } + + final HashSet result = new HashSet(count); + int limit = collection.size(); + while (result.size() < count) { + result.add(randomEle(source, limit)); + } + + return result; + } + + /** + * 获得一个随机的字符串(只包含数字和字符) + * + * @param length 字符串的长度 + * @return 随机字符串 + */ + public static String randomString(int length) { + return randomString(BASE_CHAR_NUMBER, length); + } + + /** + * 获得一个随机的字符串(只包含数字和大写字符) + * + * @param length 字符串的长度 + * @return 随机字符串 + * @since 4.0.13 + */ + public static String randomStringUpper(int length) { + return randomString(BASE_CHAR_NUMBER, length).toUpperCase(); + } + + /** + * 获得一个只包含数字的字符串 + * + * @param length 字符串的长度 + * @return 随机字符串 + */ + public static String randomNumbers(int length) { + return randomString(BASE_NUMBER, length); + } + + /** + * 获得一个随机的字符串 + * + * @param baseString 随机字符选取的样本 + * @param length 字符串的长度 + * @return 随机字符串 + */ + public static String randomString(String baseString, int length) { + final StringBuilder sb = new StringBuilder(); + + if (length < 1) { + length = 1; + } + int baseLength = baseString.length(); + for (int i = 0; i < length; i++) { + int number = getRandom().nextInt(baseLength); + sb.append(baseString.charAt(number)); + } + return sb.toString(); + } + + /** + * 随机数字,数字为0~9单个数字 + * + * @return 随机数字字符 + * @since 3.1.2 + */ + public static int randomNumber() { + return randomChar(BASE_NUMBER); + } + + /** + * 随机字母或数字,小写 + * + * @return 随机字符 + * @since 3.1.2 + */ + public static char randomChar() { + return randomChar(BASE_CHAR_NUMBER); + } + + /** + * 随机字符 + * + * @param baseString 随机字符选取的样本 + * @return 随机字符 + * @since 3.1.2 + */ + public static char randomChar(String baseString) { + return baseString.charAt(getRandom().nextInt(baseString.length())); + } + + /** + * 生成随机颜色 + * + * @return 随机颜色 + * @since 4.1.5 + */ + public static Color randomColor() { + final Random random = getRandom(); + return new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255)); + } + + /** + * 带有权重的随机生成器 + * + * @param weightObjs 带有权重的对象列表 + * @return {@link WeightRandom} + * @since 4.0.3 + */ + public static WeightRandom weightRandom(WeightObj[] weightObjs) { + return new WeightRandom<>(weightObjs); + } + + /** + * 带有权重的随机生成器 + * + * @param weightObjs 带有权重的对象列表 + * @return {@link WeightRandom} + * @since 4.0.3 + */ + public static WeightRandom weightRandom(Iterable> weightObjs) { + return new WeightRandom<>(weightObjs); + } + + // ------------------------------------------------------------------- UUID + /** + * @return 随机UUID + * @deprecated 请使用{@link IdUtil#randomUUID()} + */ + @Deprecated + public static String randomUUID() { + return UUID.randomUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线 + * + * @return 简化的UUID,去掉了横线 + * @since 3.2.2 + * @deprecated 请使用{@link IdUtil#simpleUUID()} + */ + @Deprecated + public static String simpleUUID() { + return UUID.randomUUID().toString(true); + } + + /** + * 以当天为基准,随机产生一个日期 + * + * @param min 偏移最小天,可以为负数表示过去的时间 + * @param max 偏移最大天,可以为负数表示过去的时间 + * @return 随机日期(随机天,其它时间不变) + * @since 4.0.8 + */ + public static DateTime randomDay(int min, int max) { + return DateUtil.offsetDay(DateUtil.date(), randomInt(min, max)); + } + + public static void main(String[] args) { + double num = randomDouble(2,RoundingMode.UP); + Map map = new HashMap<>(); + map.put("0","0.0"); + map.put("1","0.35"); //0.35 + map.put("2","0.27"); //0.62 + map.put("3","0.37"); //0.99 + double start =0.0; + double end =0.0; + int level =0 ; + for(int i=0;i<4;i++){ + end +=Double.parseDouble(map.get(String.valueOf(i))); + if(num >= start && num <=end){ + level = i; + } + start = end; + } + System.out.println(num); + System.out.println(level); + } +} + diff --git a/src/main/java/com/qiwu/inference/common/utils/RedissonUtil.java b/src/main/java/com/qiwu/inference/common/utils/RedissonUtil.java new file mode 100755 index 0000000..72d8d82 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/RedissonUtil.java @@ -0,0 +1,126 @@ +package com.qiwu.inference.common.utils; + +import org.redisson.Redisson; +import org.redisson.api.RedissonClient; +import org.redisson.config.Config; + +import java.util.Collection; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; + + +/** + * 基于Redisson实现Redis数据的操作 + */ +public class RedissonUtil { + + private static RedissonClient client; + + static { + Config config = new Config(); + config.setThreads(1000); + config.useSingleServer().setAddress("redis://127.0.0.1:6379"); // 单机 + + client = Redisson.create(config); + } + + // 新增 + public static void setStr(String key,String val){ + client.getBucket(key).set(val); + } + + public static void setStr(String key,String val,long seconds){ + client.getBucket(key).set(val,seconds, TimeUnit.SECONDS); + } + + public static void setSet(String key,String val){ + client.getSet(key).add(val); + } + + public static void setSet(String key, Set vals){ + client.getSet(key).addAll(vals); + } + + public static void setSet(String key,double score,String val){ + client.getScoredSortedSet(key).add(score,val); + } + + public static void setSet(String key, Map vals){ + client.getScoredSortedSet(key).addAll(vals); + } + + public static void setHash(String key,String val,Object file){ + client.getMap(key).put(val,file); + } + + public static void serHashAll(String key,Map map){ + client.getMap(key).putAll(map); + } + + // 查询 + public static String getStr(String key){ + return client.getBucket(key).get().toString(); + } + public static Set getSet(String key){ + return client.getSet(key).readAll(); + } + public static Collection getzSet(String key){ + return client.getScoredSortedSet(key).readAll(); + } + public static boolean checkSet(String key,Object val){ + return client.getSet(key).contains(val); + } + public static boolean checkzSet(String key,Object val){ + return client.getScoredSortedSet(key).contains(val); + } + public static boolean checkKey(String key){ + return client.getKeys().countExists(key) > 0; + } + public static boolean checkField(String key,String file){ + return client.getMap(key).containsKey(file); + } + public static Object getHash(String key,String file){ + return client.getMap(key).get(file); + } + + // 设置有效期 + public static void setTime(String key,long time,TimeUnit timeUnit){ + client.getKeys().expire(key, time, timeUnit); + } + + // 移除元素 + public static boolean delZet(String key,Object val){ + return client.getScoredSortedSet(key).remove(val); + } + // 删除key + public static void delKey(String... key){ + client.getKeys().delete(key); + } + + public static void delHash(String key,Object val){ + client.getMap(key).remove(val); + } + + // 分布式锁 Redis = (Setnx + Java中的LOCK) + // 加锁 + public static void lock(String key){ + client.getLock(key).lock(); + } + // 加锁设置有效期 超出有效期自动释放 + public static void lock(String key,long seconds){ + client.getLock(key).lock(seconds,TimeUnit.SECONDS); + } + // 释放锁 + public static void unlock(String key){ + client.getLock(key).unlock(); + } + + public static Iterable getKeys(String key){ + return client.getKeys().getKeysByPattern(key); + } + + public static void main(String[] args) { + System.out.println(RedissonUtil.getSet("2ba767cf-62e8-41a2-9f9f-d0581a0c9fa5")); + } +} diff --git a/src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java b/src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java index bce23f5..1d1b63a 100644 --- a/src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java +++ b/src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java @@ -1,5 +1,6 @@ package com.qiwu.inference.common.utils; +import com.qiwu.inference.common.TimingAcquisition; import com.qiwu.inference.dto.request.CallRequest; import com.qiwu.inference.dto.request.CommonRequest; import com.qiwu.inference.dto.request.OperationRequest; @@ -19,10 +20,92 @@ public class RequestConversionUtil { CallRequest callRequest = commonRequest.getVars(); operationRequest.setUid(commonRequest.getUid()); - //---------------------存在姓名----------------------- - String name = callRequest.get玩家称呼(); - if (!StringUtils.isEmpty(name)) { - operationRequest.setName(name); + //---------------------存在"方法编号"----------------------- + String methodId = callRequest.get方法编号(); + if (!StringUtils.isEmpty(methodId)) { + operationRequest.setMethodId(methodId); + } + //---------------------存在"人物名称1"----------------------- + String subjectName = callRequest.get人物名称1(); + if (!StringUtils.isEmpty(subjectName)) { + //subjectName包含了多个人物名称 + if (subjectName.contains("+")) { + String[] name = subjectName.split("\\+"); + subjectName = name[0]; + } + operationRequest.setSubjectName(subjectName); + Integer subjectId = TimingAcquisition.getPersonIdByName(commonRequest.getUid(), subjectName); + operationRequest.setSubjectId(subjectId); + //找到中文数字对应的阿拉伯数字 + Integer number = TypeConvertUtil.change2Integer(subjectName); + //中文中不包含中文数字时,提取阿拉伯数字 + if (number == 0) { + number = TypeConvertUtil.extractNum(subjectName); + } + operationRequest.setNum(number); + } + //---------------------存在"人物名称2"----------------------- + String objectName = callRequest.get人物名称2(); + if (!StringUtils.isEmpty(objectName)) { + //objectName包含了多个人物名称 + if (objectName.contains("+")) { + objectName = objectName.replace(subjectName, ""); + objectName = objectName.replace("+", ""); + } + operationRequest.setObjectName(objectName); + } + //---------------------存在"性格类型"----------------------- + String dispositionType = callRequest.get性格类型(); + if (!StringUtils.isEmpty(dispositionType)) { + operationRequest.setDispositionType(dispositionType); + } + //---------------------存在"性格名称"----------------------- + String dispositionName = callRequest.get性格名称(); + if (!StringUtils.isEmpty(dispositionName)) { + operationRequest.setDispositionName(dispositionName); + } + //---------------------存在"关系名称"----------------------- + String relationName = callRequest.get关系名称(); + if (!StringUtils.isEmpty(relationName)) { + operationRequest.setRelationName(relationName); + } + //---------------------存在"行为名称"----------------------- + String behaviourName = callRequest.get行为名称(); + if (!StringUtils.isEmpty(behaviourName)) { + operationRequest.setBehaviourName(behaviourName); + } + //---------------------存在"任务名称"----------------------- + String taskName = callRequest.get任务名称(); + if (!StringUtils.isEmpty(taskName)) { + operationRequest.setTaskName(taskName); + } + //---------------------存在"身份名称"----------------------- + String identityName = callRequest.get身份名称(); + if (!StringUtils.isEmpty(identityName)) { + operationRequest.setIdentityName(identityName); + } + //---------------------存在"场所名称"----------------------- + String locationName = callRequest.get场所名称(); + if (!StringUtils.isEmpty(locationName)) { + String locationId = TimingAcquisition.getLocationIdByName(locationName); + operationRequest.setLocationName(locationName); + operationRequest.setLocationId(locationId); + } + //---------------------存在"人物名称ID"----------------------- + String subjectId = callRequest.get人物名称ID(); + if (!StringUtils.isEmpty(subjectId)) { + operationRequest.setSubjectId(Integer.valueOf(subjectId)); + } + //---------------------存在"任务条件"----------------------- + String taskConditionId = callRequest.get任务条件(); + if (!StringUtils.isEmpty(taskConditionId)) { + operationRequest.setTaskConditionId(taskConditionId); + } + //---------------------存在"线索类型"----------------------- + String clueType = callRequest.get线索类型(); + if (!StringUtils.isEmpty(clueType)) { + Integer clueTypeId = TimingAcquisition.getClueTypeIdByName(clueType); + operationRequest.setClueTypeId(clueTypeId); } return operationRequest; } diff --git a/src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java b/src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java index fe863e2..5c08642 100644 --- a/src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java +++ b/src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java @@ -1,6 +1,7 @@ package com.qiwu.inference.common.utils; import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.pojo.DemandTask; import java.util.List; import java.util.Random; @@ -54,7 +55,7 @@ public class SpeechUtil { * @param feedText * @return String */ - public static String getHelpSpeech(String someone, Integer feedText) { + public static String getCheckSpeech(String someone, Integer feedText) { String result = ""; List speech = TimingAcquisition.checkSpeechMap.get(someone).get(feedText); Integer i = getRandomNum(0, speech.size()); @@ -63,6 +64,20 @@ public class SpeechUtil { } /** + * 从查看模块话术获取话术 + * @param someone + * @param feedText + * @return String + */ + public static String getBarrierSpeech(String someone, Integer feedText) { + String result = ""; + List speech = TimingAcquisition.barrierSpeechMap.get(someone).get(feedText); + Integer i = getRandomNum(0, speech.size()); + result = speech.get(i); + return result; + } + + /** * 替换话术中的一个数字 * @param one * @return String @@ -187,6 +202,33 @@ public class SpeechUtil { } /** + * 替换话术中的【A】 + * @param A + * @return String + */ + public static String speechReplaceLetter(String text, String A) { + return text.replace("【A】", A); + } + + /** + * 替换话术中的【A】和【B】 + * @param A + * @param B + * @return String + */ + public static String speechReplaceLetter(String text, String A, String B) { + return text.replace("【A】", A).replace("【B】", B); + } + + /** + * 获取线索配置表中的话术 + */ + public static String getSpeechFromClue(String uid, Integer taskId) { + DemandTask demandTask = TimingAcquisition.demandTaskMap.get(taskId); + return null; + } + + /** * 删除话术的开头“【旁白@正常】” * @param text */ @@ -203,4 +245,13 @@ public class SpeechUtil { text2 = deleteAsideHead(text2); return text1 + text2; } + + /** + * 替换人物名称 + * @param text + * @return String + */ + public static String replaceHeader(String text, String name) { + return text.replaceAll("【人物名称", "【" + name); + } } diff --git a/src/main/java/com/qiwu/inference/common/utils/SpringContextUtil.java b/src/main/java/com/qiwu/inference/common/utils/SpringContextUtil.java new file mode 100755 index 0000000..1aa7d89 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/SpringContextUtil.java @@ -0,0 +1,35 @@ +package com.qiwu.inference.common.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringContextUtil implements ApplicationContextAware { + private static ApplicationContext applicationContext = null; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + if (SpringContextUtil.applicationContext == null) { + SpringContextUtil.applicationContext = applicationContext; + } + } + + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + public static Object getBean(String name) { + return getApplicationContext().getBean(name); + } + + public static T getBean(Class clazz) { + return getApplicationContext().getBean(clazz); + } + + public static T getBean(String name, Class clazz) { + return getApplicationContext().getBean(name, clazz); + } + +} \ No newline at end of file diff --git a/src/main/java/com/qiwu/inference/common/utils/ThreadLocalUtil.java b/src/main/java/com/qiwu/inference/common/utils/ThreadLocalUtil.java new file mode 100755 index 0000000..402ccfb --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/ThreadLocalUtil.java @@ -0,0 +1,148 @@ +package com.qiwu.inference.common.utils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + *
+ * ThreadLocal을 사용하여 스레드 간 객체를 전파하기 위한 유틸리리 클래스
+ * 
+ */ +public class ThreadLocalUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(ThreadLocalUtil.class); + + // 스레드 간 공유 객체를 저장하기 위한 ThreadLocal + private static ThreadLocal> threadLocal = new ThreadLocal>(); + + /** + *
+     * ThreadLocal 用于在线程之间传播对象的实用程序类
+     * 
+ * @return + */ + private static Map getThreadLocal() { + if (threadLocal.get() == null) { + Map sharedObject = new HashMap(); + threadLocal.set(sharedObject); + } + + return threadLocal.get(); + }//end of getThreadLocal() + + /** + *
+     * 以在线程间共享对象中指定的键的名称存储对象
+     * 
+ * @param key + * @param object + */ + public static void add(String key, Object object) { // NOPMD + getThreadLocal().put(key, object); + }//end of add() + + /** + *
+     * 从线程之间的共享对象导入与指定键相对应的对象
+     * 
+ * @param key + * @return + */ + public static Object get(String key) { // NOPMD + return getThreadLocal().get(key); + }//end of get() + + /** + *
+     * 调查是否存在与线程间共享对象上指定的键相对应的对象
+     * 
+ * @param key + * @return + */ + public static boolean isExist(String key) { + Object object = getThreadLocal().get(key); + if (object != null) { + return true; + } else { + return false; + } + }//end of isExist() + + /** + *
+     * 初始化线程之间的共享对象
+     * 
+ */ + public static void clearSharedObject() { + getThreadLocal().clear(); + threadLocal.set(null); + }//end of clearSharedObject() + + /** + *
+     * 
+ * @return + */ + public static String[] getThreadLocalKeys() { + String[] arrKeys = new String[getThreadLocal().size()]; + Iterator keyIter = getThreadLocal().keySet().iterator(); + + int i = 0; + while (keyIter.hasNext()) { + arrKeys[i] = keyIter.next(); + i++; + } + + return arrKeys; + }//end of getThreadLocalKeys() + + /** + *
+     * 
+ * @return + */ + public static int size() { + return getThreadLocal().size(); + }//end of size() + + /** + *
+     * 
+ * @return + */ + public static Object[] getThreadLocalValues() { + int size = size(); + + String[] arrKeys = getThreadLocalKeys(); + Object[] values = new Object[size]; + + for (int i = 0; i < size; i++) { + values[i] = getThreadLocal().get(arrKeys[i]); + } + + return values; + }//end of getThreadLocalValues() + + /** + *
+     * 
+ */ + public static void toPrintString() { + int size = size(); + + StringBuffer str = new StringBuffer(); + String[] keys = getThreadLocalKeys(); + Object[] values = getThreadLocalValues(); + + for (int i = 0; i < size; i++) { + str.append(" " + keys[i] + " = " + values[i] + " \n"); + } + + LOGGER.info("{}", str.toString()); + }//end of toPringString() + +}// end of ThreadLocalUtil.java \ No newline at end of file diff --git a/src/main/java/com/qiwu/inference/common/utils/TypeConvertUtil.java b/src/main/java/com/qiwu/inference/common/utils/TypeConvertUtil.java new file mode 100644 index 0000000..aafeaa3 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/utils/TypeConvertUtil.java @@ -0,0 +1,329 @@ +package com.qiwu.inference.common.utils; + +import com.qiwu.inference.common.Constants; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class TypeConvertUtil { + static char[] cnArr = new char[]{'一','二','三','四','五','六','七','八','九'}; + static char[] chArr = new char [] {'十','百','千','万','亿'}; + + /** + * 将中文的{'一','二',...}转成数字{1,2,...} + * @param param + * @return Integer + */ + public static Integer change2Integer(String param) { + String[] all = new String[]{"都", "统统", "全数", "所有", "全", "全部", "全都", "一起", "批量"}; + String[] first = new String[]{"首个", "首位", "最前面", "开头", "首发", "起首"}; + String[] middle = new String[]{"中间"}; + String[] last = new String[]{"最后", "末位", "末尾", "最后面"}; + String[] random = new String[]{"随机", "随便", "推荐"}; + List allCh = Arrays.asList(all); + List firstCh = Arrays.asList(first); + List middleCh = Arrays.asList(middle); + List lastCh = Arrays.asList(last); + List randomCh = Arrays.asList(random); + if (randomCh.contains(param)) { + return Constants.REQ_RANDOM; + } + if (allCh.contains(param)) { + return Constants.REQ_ALL; + } + if (firstCh.contains(param)) { + return Constants.REQ_FIRST; + } + if (middleCh.contains(param)) { + return Constants.REQ_MIDDLE; + } + if (lastCh.contains(param)) { + return Constants.REQ_LAST; + } + param = param.replace("两","二"); +// List cnArrList = new String(cnArr).chars().mapToObj(c->(char)c).collect(Collectors.toList()); +// List chArrList = new String(chArr).chars().mapToObj(c->(char)c).collect(Collectors.toList()); + boolean num = false; + int result = 0; + //存放一个单位的数字如:十万 + int temp = 1; + //判断是否有chArr + int count = 0; + for (int i = 0; i < param.length(); i++) { + //判断是否是chArr + boolean b = true; + char c = param.charAt(i); + //非单位,即数字 + for (int j = 0; j < cnArr.length; j++) { + if (c == cnArr[j]) { + //添加下一个单位之前,先把上一个单位值添加到结果中 + if(0 != count){ + result += temp; + count = 0; + } + // 下标+1,就是对应的值 + temp = j + 1; + b = false; + num = true; + break; + } + } + if(b){ + for (int j = 0; j < chArr.length; j++) { + if (c == chArr[j]) { + switch (j) { + case 0: + temp *= 10; + break; + case 1: + temp *= 100; + break; + case 2: + temp *= 1000; + break; + case 3: + temp *= 10000; + break; + case 4: + temp *= 100000000; + break; + default: + break; + } + count++; + } + } + } + //遍历到最后一个字符 + if (i == param.length() - 1) { + //避免出现阿拉伯数字,没有找到返回为1的情况 + if (num) { + result += temp; + } else { + result = 0; + } + } + } + return result; + } + + /** + * 将数字转换为中文数字, 这里只写到了万 + * @param intInput 需要转换的数学数字 + */ + public static String arabicNumToChineseNum(int intInput) { + String si = String.valueOf(intInput); + String sd = ""; + if (si.length() == 1) { + if (intInput == 0) { + return sd; + } + sd += cnArr[intInput - 1]; + return sd; + } else if (si.length() == 2) { + if ("1".equals(si.substring(0, 1))) { + sd += "十"; + if (intInput % 10 == 0) { + return sd; + } + } + else { + sd += (cnArr[intInput / 10 - 1] + "十"); + } + sd += arabicNumToChineseNum(intInput % 10); + } else if (si.length() == 3) { + sd += (cnArr[intInput / 100 - 1] + "百"); + if (String.valueOf(intInput % 100).length() < 2) { + if (intInput % 100 == 0) { + return sd; + } + sd += "零"; + } + sd += arabicNumToChineseNum(intInput % 100); + } else if (si.length() == 4) { + sd += (cnArr[intInput / 1000 - 1] + "千"); + if (String.valueOf(intInput % 1000).length() < 3) { + if (intInput % 1000 == 0) { + return sd; + } + sd += "零"; + } + sd += arabicNumToChineseNum(intInput % 1000); + } else if (si.length() == 5) { + sd += (cnArr[intInput / 10000 - 1] + "万"); + if (String.valueOf(intInput % 10000).length() < 4) { + if (intInput % 10000 == 0) { + return sd; + } + sd += "零"; + } + sd += arabicNumToChineseNum(intInput % 10000); + } + + return sd; + } + + /** + * 将中文数字替换成阿拉伯数字 + * @param name + * @return String + */ + public static String replaceChineseNum(String name) { + String nameStr = name.substring(0, 4); + String param = name.substring(4); + param = param.replace("两","二"); + boolean num = false; + int result = 0; + //存放一个单位的数字如:十万 + int temp = 1; + //判断是否有chArr + int count = 0; + for (int i = 0; i < param.length(); i++) { + //判断是否是chArr + boolean b = true; + char c = param.charAt(i); + //非单位,即数字 + for (int j = 0; j < cnArr.length; j++) { + if (c == cnArr[j]) { + //添加下一个单位之前,先把上一个单位值添加到结果中 + if(0 != count){ + result += temp; + count = 0; + } + // 下标+1,就是对应的值 + temp = j + 1; + b = false; + num = true; + break; + } + } + if(b){ + for (int j = 0; j < chArr.length; j++) { + if (c == chArr[j]) { + switch (j) { + case 0: + temp *= 10; + break; + case 1: + temp *= 100; + break; + case 2: + temp *= 1000; + break; + case 3: + temp *= 10000; + break; + case 4: + temp *= 100000000; + break; + default: + break; + } + count++; + } + } + } + //遍历到最后一个字符 + if (i == param.length() - 1) { + //避免出现阿拉伯数字的情况 + if (num) { + result += temp; + } else { + result = Integer.parseInt(param); + } + } + } + return nameStr + result; + } + + /** + * 提取中文的阿拉伯数字 + * @param param + * @return Integer + */ + public static Integer extractNum(String param) { + int i; + String regEx="[^0-9]"; + Pattern p = Pattern.compile(regEx); + Matcher m = p.matcher(param); + if (!"".equals(m.replaceAll("").trim())) { + if (StringUtils.isEmpty(extractChinese(param))) { + if (param.length() > 9) { + return Constants.REQ_NON; + } + } + i = Integer.parseInt(m.replaceAll("").trim()); + } else { + i = Constants.REQ_NON; + } + return i; + } + + /** + * 提取字符串的中文 + * @param param + * @return Integer + */ + public static String extractChinese(String param) { + String regEx="[^(\\\\u4e00-\\\\u9fa5)]"; + String result = ""; + Matcher matcher = Pattern.compile(regEx).matcher(param); + while (matcher.find()) { + result += matcher.group(0); + } + return result; + } + + /** + * 提取字符串的数字字符串 + * @param param + * @return Integer + */ + public static String extractNo(String param) { + String regEx="[^(\\\\u4e00-\\\\u9fa5)]"; + return param.replaceAll(regEx, ""); + } + + /** + * {"未读", "已读"}中文转成数字 + * @param param + * @return Integer + */ + public static Integer readChineseToInteger(String param) { + String[] chs = {"未读", "已读"}; + if (param.equals(chs[0])) { + return 0; + } else { + return 1; + } + } + + /** + * 选择的序号 + */ + public static Object getNumFromList(List list, Integer num) { + Object result = new Object(); + //第一个物品 + if (num == Constants.REQ_FIRST) { + result = list.get(0); + } + //中间物品 + if (num == Constants.REQ_MIDDLE) { + result = list.get(list.size() / 2); + } + //最后一个物品 + if (num == Constants.REQ_LAST) { + result = list.get(list.size() - 1); + } + //随机一个物品 + if (num == Constants.REQ_RANDOM) { + int random = RandomUtil.randomInt(list.size()); + result = list.get(random); + } + return result; + } +} diff --git a/src/main/java/com/qiwu/inference/common/utils/YamlUtil.java b/src/main/java/com/qiwu/inference/common/utils/YamlUtil.java index b7bacd5..9e50f88 100644 --- a/src/main/java/com/qiwu/inference/common/utils/YamlUtil.java +++ b/src/main/java/com/qiwu/inference/common/utils/YamlUtil.java @@ -16,22 +16,6 @@ public class YamlUtil { public static String speechFilePath = YamlUtil.getValueByKey("speechFilePath"); private static LinkedHashMap>> properties = new LinkedHashMap<>(); - /** - * 将话术转成map格式 - * @param - * @return Map>> - */ - public static Map>> loadSpeechToMap(String fileName) { - Map>> speechMap = new HashMap<>(); - try { - InputStream in = new FileInputStream(speechFilePath + fileName); - Yaml yaml = new Yaml(); - speechMap = yaml.load(in); - } catch (Exception e) { - e.printStackTrace(); - } - return speechMap; - } /** * 读取配置文件yml中的某个值,只支持取第一层的值 diff --git a/src/main/java/com/qiwu/inference/controller/CommonController.java b/src/main/java/com/qiwu/inference/controller/CommonController.java index 6d5fad7..bac25e8 100644 --- a/src/main/java/com/qiwu/inference/controller/CommonController.java +++ b/src/main/java/com/qiwu/inference/controller/CommonController.java @@ -1,58 +1,101 @@ package com.qiwu.inference.controller; -import com.qiwu.inference.common.ProxyFactory; +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.common.utils.DataTrimUtil; import com.qiwu.inference.common.utils.RequestConversionUtil; import com.qiwu.inference.dto.request.CommonRequest; import com.qiwu.inference.dto.request.OperationRequest; -import com.qiwu.inference.dto.response.CommonResponse; import com.qiwu.inference.dto.response.ResultResponse; import com.qiwu.inference.dto.response.ResultVarsResponse; import com.qiwu.inference.service.ask.AskService; -import com.qiwu.inference.service.ask.impl.AskServiceImpl; +import com.qiwu.inference.service.barrier.BarrierService; +import com.qiwu.inference.service.check.CheckService; +import com.qiwu.inference.service.login.LoginService; +import com.qiwu.inference.service.task.TaskService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.text.ParseException; + @RestController @RequestMapping("/inference") public class CommonController { Logger log = LoggerFactory.getLogger(CommonController.class); - //询问模块动态代理 - AskService askService = new AskServiceImpl(); - AskService askServiceProxy = (AskService) new ProxyFactory(askService).getProxyInstance(); + @Value("${offlineTime}") + private String offlineTime; + + @Autowired + private LoginService loginService; + + @Autowired + private AskService askService; + + @Autowired + private TaskService taskService; + + @Autowired + private CheckService checkService; + + @Autowired + private BarrierService barrierService; @PostMapping(value = "/ask", produces = "application/json;charset=UTF-8") - public CommonResponse startGame(@RequestBody CommonRequest commonRequest) { + public CommonResult startGame(@RequestBody CommonRequest commonRequest) throws ParseException { log.info(commonRequest.getUid() + "当前操作的原始请求参数:" + commonRequest.getVars()); - CommonResponse result = new CommonResponse(); - + CommonResult result = null; + String uid = commonRequest.getUid(); + boolean login = false; + //玩家第一次登录 + if (StringUtils.isEmpty(TimingAcquisition.playerMap.get(uid))) { + loginService.login(uid); + login = true; + } + //请求参数转换 OperationRequest operationReq = RequestConversionUtil.request2Operation(commonRequest); + //非新登录玩家,修改在线状态 + if (!login && !StringUtils.isEmpty(uid)) { + DataTrimUtil.AdjustStatus(commonRequest.getUid(), offlineTime); + } String operateName = commonRequest.getVars().get操作名(); - log.info(operationReq.getUid() + "开始执行操作:【" + operateName + "】, 请求参数:" + operationReq); + log.info(uid + "开始执行操作:【" + operateName + "】, 请求参数:" + operationReq); //操作名为null if (StringUtils.isEmpty(operateName)) { log.info(operationReq.getUid() + "未提供操作名,无法操作"); ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); - ResultResponse resultResponse = new ResultResponse(); - result.setCode(1); - result.setMsg("成功"); + ResultResponse resultResponse = new ResultResponse();; resultResponse.set反馈ID(100000); resultResponse.set反馈文本("【旁白@正常】你想做什么呢?"); resultVarsResponse.setVars(resultResponse); - result.setData(resultVarsResponse); - return result; + return CommonResult.success(resultVarsResponse); } switch (operateName) { - case "开始游戏": - result = askServiceProxy.ask(operationReq); + case "询问操作": + result = askService.ask(operationReq); + break; + case "任务操作": + result = taskService.execute(operationReq); + break; + case "查看操作": + result = checkService.check(operationReq); + break; + case "关卡操作": + result = barrierService.operate(operationReq); + break; + case "取消操作指令": + result = barrierService.cancel(operationReq); break; } - log.info(operationReq.getUid() + "已完成操作:【" + commonRequest.getVars().get操作名() + "】"); - return result; + log.info(uid + "已完成操作:【" + operateName + "】"); + return DataTrimUtil.AdjustParams(result); } } diff --git a/src/main/java/com/qiwu/inference/controller/PlayerController.java b/src/main/java/com/qiwu/inference/controller/PlayerController.java new file mode 100755 index 0000000..c2426a6 --- /dev/null +++ b/src/main/java/com/qiwu/inference/controller/PlayerController.java @@ -0,0 +1,119 @@ +package com.qiwu.inference.controller; + +import cn.hutool.core.lang.UUID; +import com.alibaba.fastjson.JSON; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.api.CommonData; +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.common.utils.*; +import com.qiwu.inference.dto.Player; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultVarsResponse; +import com.qiwu.inference.service.PersonRecordService; +import com.qiwu.inference.service.player.PlayerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@RestController +@RequestMapping("/api") +public class PlayerController { + @Value("${userFilePath}") + private String userFilePath; + + @Autowired + private PersonRecordService personRecordService; + + @Autowired + private PlayerService playerService; + + + @RequestMapping(value = "/getGateNo", method = RequestMethod.GET) + @ResponseBody + public CommonResult getGateNo() throws Exception{ + List gateNoList = personRecordService.getGateNo(); + int index = RandomUtil.randomInt(gateNoList.size()); + Player player = new Player(); + player.setGateNo(gateNoList.get(index)); + String sid = UUID.fastUUID().toString(); + player.setSid(sid); + PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //ThreadLocalUtil.add(sid,player); + return CommonResult.success(player); + } + + @RequestMapping(value = "/operate", method = RequestMethod.POST) + @ResponseBody + public CommonResult operate(@RequestBody OperationRequest request) throws Exception{ + String methodId = request.getMethodId(); + switch (methodId){ + case "1001": + case "1002": + return playerService.askDisposition(request); + case "1003": + case "1004": + case "1005": + case "1006": + return playerService.askRelation(request); + case "1007": + case "1008": + case "1009": + case "1010": + case "1011": + return playerService.askBehaviour(request); + case "1012": + case "1013": + case "1014": + case "1015": + case "1016": + case "1017": + case "1018": + case "1019": + case "1020": + case "1021": + case "1022": + return playerService.askTask(request); + case "1023": + case "1024": + return playerService.askIdentity(request); + case "1025": + case "1026": + return playerService.askLocation(request); + case "1027": + return playerService.askPrompt(request); + case "2001": + case "2003": + case "2002": + case "2004": + case "2005": + case "2006": + case "2007": + case "2008": + case "2009": + case "2010": + case "2011": + case "2012": + case "2013": + case "2014": + case "2015": + case "2016": + case "2017": + case "2018": + case "2019": + return playerService.performTask(request); + } + return null; + } + +} diff --git a/src/main/java/com/qiwu/inference/dao/BehaviourMapper.java b/src/main/java/com/qiwu/inference/dao/BehaviourMapper.java new file mode 100755 index 0000000..7fcb5f5 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/BehaviourMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.Behaviour; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface BehaviourMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/BehaviourRecordMapper.java b/src/main/java/com/qiwu/inference/dao/BehaviourRecordMapper.java new file mode 100755 index 0000000..f5d0cb0 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/BehaviourRecordMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.BehaviourRecord; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface BehaviourRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/ClueMapper.java b/src/main/java/com/qiwu/inference/dao/ClueMapper.java new file mode 100755 index 0000000..1c69c7d --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/ClueMapper.java @@ -0,0 +1,25 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.Clue; +import com.qiwu.inference.pojo.ClueType; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +@Mapper +@Repository +public interface ClueMapper extends BaseMapper { + List getTypeInfo(); + + List findAll(); +} diff --git a/src/main/java/com/qiwu/inference/dao/ClueRecordMapper.java b/src/main/java/com/qiwu/inference/dao/ClueRecordMapper.java new file mode 100755 index 0000000..d1dc6df --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/ClueRecordMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.ClueRecord; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface ClueRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/DemandTaskMapper.java b/src/main/java/com/qiwu/inference/dao/DemandTaskMapper.java new file mode 100755 index 0000000..66a9513 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/DemandTaskMapper.java @@ -0,0 +1,22 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.DemandTask; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +@Mapper +@Repository +public interface DemandTaskMapper extends BaseMapper { + List findAll(); +} diff --git a/src/main/java/com/qiwu/inference/dao/DemandTaskRecordMapper.java b/src/main/java/com/qiwu/inference/dao/DemandTaskRecordMapper.java new file mode 100755 index 0000000..3d358a9 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/DemandTaskRecordMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.DemandTaskRecord; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +@Mapper +@Repository +public interface DemandTaskRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/DispositionMapper.java b/src/main/java/com/qiwu/inference/dao/DispositionMapper.java new file mode 100755 index 0000000..ad18d1f --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/DispositionMapper.java @@ -0,0 +1,22 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.Disposition; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface DispositionMapper extends BaseMapper { + List findAll(); +} diff --git a/src/main/java/com/qiwu/inference/dao/DispositionRecordMapper.java b/src/main/java/com/qiwu/inference/dao/DispositionRecordMapper.java new file mode 100755 index 0000000..1b37cd8 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/DispositionRecordMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.DispositionRecord; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface DispositionRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/DispositionTypeMapper.java b/src/main/java/com/qiwu/inference/dao/DispositionTypeMapper.java new file mode 100755 index 0000000..38310ea --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/DispositionTypeMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.DispositionType; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-04 + */ +@Mapper +@Repository +public interface DispositionTypeMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/EndGoalMapper.java b/src/main/java/com/qiwu/inference/dao/EndGoalMapper.java new file mode 100755 index 0000000..dd6bd3d --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/EndGoalMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.EndGoal; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface EndGoalMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/IdentityMapper.java b/src/main/java/com/qiwu/inference/dao/IdentityMapper.java new file mode 100755 index 0000000..057c9d2 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/IdentityMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.Identity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface IdentityMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/ItemMapper.java b/src/main/java/com/qiwu/inference/dao/ItemMapper.java new file mode 100755 index 0000000..f12e00f --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/ItemMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.Item; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface ItemMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/KeyClueMapper.java b/src/main/java/com/qiwu/inference/dao/KeyClueMapper.java new file mode 100755 index 0000000..e05ebeb --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/KeyClueMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.KeyClue; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface KeyClueMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/LocationMapper.java b/src/main/java/com/qiwu/inference/dao/LocationMapper.java new file mode 100755 index 0000000..37154b6 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/LocationMapper.java @@ -0,0 +1,23 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.Location; +import com.qiwu.inference.pojo.SystemConfigPojo; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface LocationMapper extends BaseMapper { + List findAll(); +} diff --git a/src/main/java/com/qiwu/inference/dao/MonikerMapper.java b/src/main/java/com/qiwu/inference/dao/MonikerMapper.java new file mode 100755 index 0000000..c6160dc --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/MonikerMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.Moniker; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface MonikerMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/PersonRecordMapper.java b/src/main/java/com/qiwu/inference/dao/PersonRecordMapper.java new file mode 100755 index 0000000..b871903 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/PersonRecordMapper.java @@ -0,0 +1,22 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.PersonRecord; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface PersonRecordMapper extends BaseMapper { + List getGateNo(); +} diff --git a/src/main/java/com/qiwu/inference/dao/RelationMapper.java b/src/main/java/com/qiwu/inference/dao/RelationMapper.java new file mode 100755 index 0000000..9979620 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/RelationMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.Relation; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-03 + */ +@Mapper +@Repository +public interface RelationMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/RelationRecordMapper.java b/src/main/java/com/qiwu/inference/dao/RelationRecordMapper.java new file mode 100755 index 0000000..808a207 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/RelationRecordMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.RelationRecord; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface RelationRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/RelationTypeMapper.java b/src/main/java/com/qiwu/inference/dao/RelationTypeMapper.java new file mode 100755 index 0000000..53b7587 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/RelationTypeMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.RelationType; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-03 + */ +@Mapper +@Repository +public interface RelationTypeMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/SurnameMapper.java b/src/main/java/com/qiwu/inference/dao/SurnameMapper.java new file mode 100755 index 0000000..cc7697b --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/SurnameMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.Surname; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface SurnameMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dao/SystemConfigMapper.java b/src/main/java/com/qiwu/inference/dao/SystemConfigMapper.java new file mode 100644 index 0000000..5d400e9 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/SystemConfigMapper.java @@ -0,0 +1,13 @@ +package com.qiwu.inference.dao; +import com.qiwu.inference.pojo.SystemConfigPojo; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface SystemConfigMapper { + List findAll(); + SystemConfigPojo findByName(String name); +} diff --git a/src/main/java/com/qiwu/inference/dao/TaskConditionMapper.java b/src/main/java/com/qiwu/inference/dao/TaskConditionMapper.java new file mode 100755 index 0000000..c0f2928 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dao/TaskConditionMapper.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.qiwu.inference.pojo.TaskCondition; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Mapper +@Repository +public interface TaskConditionMapper extends BaseMapper { + +} diff --git a/src/main/java/com/qiwu/inference/dto/BehaviourDto.java b/src/main/java/com/qiwu/inference/dto/BehaviourDto.java new file mode 100755 index 0000000..cf47b00 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/BehaviourDto.java @@ -0,0 +1,48 @@ +package com.qiwu.inference.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + + +@Getter +@Setter +public class BehaviourDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private Integer id; + /** + * 行为名称 + */ + private String name; + /** + * 行为id + */ + private Integer behaviourId; + /** + * 行为描述 + */ + private String description; + /** + * 主体 + */ + private Integer subject; + /** + * 主体名称 + */ + private String subjectName; + /** + * 客体 + */ + private Integer object; + /** + * 客体名称 + */ + private String objectName; + +} diff --git a/src/main/java/com/qiwu/inference/dto/ClueDto.java b/src/main/java/com/qiwu/inference/dto/ClueDto.java new file mode 100755 index 0000000..e2f1309 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/ClueDto.java @@ -0,0 +1,68 @@ +package com.qiwu.inference.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + + +@Getter +@Setter +public class ClueDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private Integer id; + /** + * 线索id + */ + private Integer clueId; + + /** + * 线索名称 + */ + private String clueName; + /** + * 主体 + */ + private Integer subject; + /** + * 客体 + */ + private Integer object; + /** + * 描述 + */ + private String description; + /** + * 类型: 1:身份 2:场所 3:性格爱好 4:行为 5:关系 6:任务 9: 关键线索 + */ + private Integer type; + /** + * 信息级别 + */ + private Integer infoLevel; + /** + * 关联人物 + */ + private Integer associatedPerson; + /** + * 线索模板 + */ + private String clueTemplate; + + /** + * 信任度 + */ + private Integer trustDegree; + + /** + * 威胁 + */ + private Integer threaten; + + +} diff --git a/src/main/java/com/qiwu/inference/dto/DemandTaskDto.java b/src/main/java/com/qiwu/inference/dto/DemandTaskDto.java new file mode 100755 index 0000000..641ed36 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/DemandTaskDto.java @@ -0,0 +1,110 @@ +package com.qiwu.inference.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + + +@Getter +@Setter +public class DemandTaskDto implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * id + */ + private Integer id; + + /** + * demandTaskId + */ + private Integer demandTaskId; + + /** + * 名称 + */ + private String name; + + /** + * 描述 + */ + private String description; + + /** + * 主体 + */ + private Integer subject; + + /** + * 客体 + */ + private Integer object; + + /** + * 开启条件信任度 + */ + private String trustCondition; + + /** + * 开启条件威慑度 + */ + private String deterrenceCondition; + + /** + * 条件1|次数 + */ + private String condition1; + + /** + * 条件2|次数 + */ + private String condition2; + + /** + * 信任度增减 + */ + private String trustDegree; + + /** + * 威慑度增减 + */ + private String deterrenceDegree; + + /** + * 完成奖励 + */ + private String completionReward; + /** + * 完成反馈 + */ + private String completionFeedback; + /** + * 有效次数 + */ + private String effectiveDegree; + /** + * 后置任务 + */ + private String postTask; + + /** + * 类型: 1:身份 2:场所 3:性格爱好 4:行为 5:关系 6:任务 9:关键线索 + */ + private Integer type; + + /** + * 线索id + */ + private Integer clueId; + + /** + * 信息级别 + */ + private Integer infoLevel; + + /** + * 任务标签 1普通任务 2关键任务 3目标任 + */ + private Integer taskLabel; +} diff --git a/src/main/java/com/qiwu/inference/dto/DispositionDto.java b/src/main/java/com/qiwu/inference/dto/DispositionDto.java new file mode 100755 index 0000000..aae8494 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/DispositionDto.java @@ -0,0 +1,40 @@ +package com.qiwu.inference.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + + +@Getter +@Setter +public class DispositionDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private Integer id; + /** + * 性格id + */ + private Integer dispositionId; + /** + * 人物id + */ + private Integer subject; + /** + * 性格名称 + */ + private String name; + /** + * 性格描述 + */ + private String description; + /** + * 类型 + */ + private String type; + +} diff --git a/src/main/java/com/qiwu/inference/dto/Person.java b/src/main/java/com/qiwu/inference/dto/Person.java new file mode 100755 index 0000000..51eaa45 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/Person.java @@ -0,0 +1,89 @@ +package com.qiwu.inference.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.List; + + +@Getter +@Setter +public class Person implements Serializable { + + /** + * 人物编号 + */ + private Integer id; + + /** + * 人物名称 + */ + private String name; + + /** + * 身份id + */ + private Integer identityId; + + /** + * 身份名称 + */ + private String identityName; + + /** + * 年龄 + */ + private Integer age; + + /** + * 是否为关键人物 1 关键人物 2 普通人物 + */ + private Integer isKey; + + /** + * 性别 + */ + private Integer gender; + + /** + * 所在地 + */ + private String location; + + /** + * 人物拥有的性格 + */ + private List dispositions; + + /** + * 人物拥有的关系 + */ + private List relations; + + /** + * 人物拥有的行为 + */ + private List behaviours; + + /** + * 人物掌握的线索集合 + */ + private List clues; + + /** + * 人物的需求任务集合 + */ + private List demandTasks; + + /** + * 信任度 + */ + private Integer trustDegree = 50; + + /** + * 威胁 + */ + private Integer deterrenceDegree = 50; + +} diff --git a/src/main/java/com/qiwu/inference/dto/Player.java b/src/main/java/com/qiwu/inference/dto/Player.java new file mode 100755 index 0000000..758a6f8 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/Player.java @@ -0,0 +1,149 @@ +package com.qiwu.inference.dto; + +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.utils.FastJsonUtil; +import com.qiwu.inference.common.utils.RandomUtil; +import lombok.Getter; +import lombok.Setter; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +@Getter +@Setter +public class Player { + + /** + * 会话id + */ + private String sid; + /** + * 关卡编号 + */ + private String gateNo; + /** + * 关卡等级 + */ + private String level; + /** + * 当前等级通关总次数 + */ + private String total; + /** + * 当前关卡已完成次数 + */ + private String finished; + /** + * 玩家在线状态 + */ + private Integer status = Constants.OFFLINE; + /** + * 玩家上线时间 + */ + private String onlineTime; + /** + * 玩家下线时间 + */ + private String offlineTime; + /** + * 玩家所在场所 + */ + private String location; + /** + * 玩家当前对话的人物 + */ + private Integer personId; + /** + * 人物集合 + */ + private Map personMap; + /** + * 人物的姓名和编号转换 map + */ + private Map name2IdMap; + + /** + * 当前关卡的货币 + */ + private Double currency = 1000.0; + /** + * 当前关卡的积分 + */ + private Integer point = 0; + + /** + * 总货币 + */ + private Double totalCurrency = 0.0; + /** + * 总积分 + */ + private Integer totalPoint = 0; + + /** + * 已获得人物线索: Map<人物id, Map<线索类型id, List<线索>>。没有线索则仅仅对话过 + */ + private Map>> clueMap = new HashMap<>(); + + /** + * 线索集合表 + */ + private List clues = new ArrayList<>(); + + /** + * 已完成任务集合表: Map<人物id, Map<任务id, 任务状态>> + */ + private Map> taskMap = new HashMap<>(); + + + public Player(){ + //初始化推理游戏人物 + List keys = new ArrayList<>(TimingAcquisition.gateInfoMap.keySet()); + int index = RandomUtil.randomInt(keys.size()); + this.gateNo = keys.get(index); + List personList = TimingAcquisition.gateInfoMap.get(keys.get(index)); + personMap = new HashMap<>(); + name2IdMap = new HashMap<>(); + for (Person person : personList) { + taskMap.put(person.getId(), new HashMap<>()); + personMap.put(person.getId(), person); + name2IdMap.put(person.getName(), person.getId()); + } + } + + /** + * 读取json文件数据 + * @param jsonPath json文件路径 + * @return 字符串 + */ + private static String readJson(String jsonPath) { + File jsonFile = new File(jsonPath); + try { + FileReader fileReader = new FileReader(jsonFile); + BufferedReader reader = new BufferedReader(fileReader); + StringBuilder sb = new StringBuilder(); + while (true) { + int ch = reader.read(); + if (ch != -1) { + sb.append((char) ch); + } else { + break; + } + } + fileReader.close(); + reader.close(); + return sb.toString(); + } catch (IOException e) { + return ""; + } + } + + +} diff --git a/src/main/java/com/qiwu/inference/dto/RelationDto.java b/src/main/java/com/qiwu/inference/dto/RelationDto.java new file mode 100755 index 0000000..a2d1e8f --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/RelationDto.java @@ -0,0 +1,65 @@ +package com.qiwu.inference.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + + +@Getter +@Setter +public class RelationDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private Integer id; + + /** + * 关系名称 + */ + private String name; + + /** + * 关系描述 + */ + private String description; + + /** + * 类型 + */ + private Integer type; + + /** + * 关系id + */ + private Integer relationId; + + /** + * 关系的主体 + */ + private Integer subject; + + /** + * 主体名称 + */ + private String subjectName; + + /** + * 关系客体 + */ + private Integer object; + + /** + * 客体名称 + */ + private String objectName; + + /** + * 掌握信息级别 + */ + private Integer masterInfoLevel; + +} diff --git a/src/main/java/com/qiwu/inference/dto/request/CallRequest.java b/src/main/java/com/qiwu/inference/dto/request/CallRequest.java index 5b449e5..f60ee11 100644 --- a/src/main/java/com/qiwu/inference/dto/request/CallRequest.java +++ b/src/main/java/com/qiwu/inference/dto/request/CallRequest.java @@ -10,8 +10,59 @@ public class CallRequest { */ private String 操作名; /** - * 玩家称呼 + * 方法编号 */ - @JsonProperty(value = "GB_玩家称呼") - private String 玩家称呼; + private String 方法编号; + /** + * 人物名称1 + */ + private String 人物名称1; + /** + * 人物名称2 + */ + private String 人物名称2; + /** + * 人物名称3 + */ + private String 人物名称3; + /** + * 性格类型 + */ + private String 性格类型; + /** + * 性格名称 + */ + private String 性格名称; + /** + * 关系名称 + */ + private String 关系名称; + /** + * 行为名称 + */ + private String 行为名称; + /** + * 任务名称 + */ + private String 任务名称; + /** + * 身份名称 + */ + private String 身份名称; + /** + * 场所名称 + */ + private String 场所名称; + /** + * 人物名称ID + */ + private String 人物名称ID; + /** + * 任务条件ID + */ + private String 任务条件; + /** + * 线索类型 + */ + private String 线索类型; } diff --git a/src/main/java/com/qiwu/inference/dto/request/OperationRequest.java b/src/main/java/com/qiwu/inference/dto/request/OperationRequest.java index f5e55f6..ccdae42 100644 --- a/src/main/java/com/qiwu/inference/dto/request/OperationRequest.java +++ b/src/main/java/com/qiwu/inference/dto/request/OperationRequest.java @@ -1,7 +1,11 @@ package com.qiwu.inference.dto.request; +import com.qiwu.inference.dto.ClueDto; +import io.swagger.models.auth.In; import lombok.Data; +import java.util.List; + @Data public class OperationRequest { /** @@ -9,19 +13,79 @@ public class OperationRequest { */ private String operate; /** + * 方法编号 + */ + private String methodId; + /** * 用户唯一ID */ private String uid; /** - * 名称 + * 人物名称1 + */ + private String subjectName; + /** + * 人物名称2 + */ + private String objectName; + /** + * 性格名称 + */ + private String dispositionName; + /** + * 关系名称 + */ + private String relationName; + /** + * 行为名称 + */ + private String behaviourName; + /** + * 任务名称 + */ + private String taskName; + /** + * 身份名称 + */ + private String identityName; + /** + * 场所名称 + */ + private String locationName; + /** + * 场所id + */ + private String locationId; + /** + * 性格类型 + */ + private String dispositionType; + /** + * 人物名称ID + */ + private Integer subjectId; + /** + * 任务条件ID + */ + private String taskConditionId; + /** + * 线索类型ID + */ + private Integer clueTypeId; + /** + * 玩家获得某人的线索集合 + */ + private List clueList; + /** + * 集合待查看的索引 */ - private String name; + private Integer index; /** - * 性别: 男-1,女-2 + * 待查看人物id集合 */ - private Integer gender; + private List personIdList; /** - * 地点 + * 序号 */ - private String place; + private Integer num; } diff --git a/src/main/java/com/qiwu/inference/dto/response/DataResponse.java b/src/main/java/com/qiwu/inference/dto/response/DataResponse.java new file mode 100644 index 0000000..9967aca --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/response/DataResponse.java @@ -0,0 +1,15 @@ +package com.qiwu.inference.dto.response; + +import lombok.Data; + +@Data +public class DataResponse { + /** + * 消息id + */ + public Integer id; + /** + * 消息文本 + */ + public String text; +} diff --git a/src/main/java/com/qiwu/inference/dto/response/InferenceResponse.java b/src/main/java/com/qiwu/inference/dto/response/InferenceResponse.java new file mode 100644 index 0000000..4f24a68 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/response/InferenceResponse.java @@ -0,0 +1,21 @@ +package com.qiwu.inference.dto.response; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class InferenceResponse implements Serializable { + /** + * 返回状态码 + */ + private Integer code; + /** + * 返回信息 + */ + private String message; + /** + * 返回内容 + */ + private DataResponse data; +} diff --git a/src/main/java/com/qiwu/inference/pojo/Behaviour.java b/src/main/java/com/qiwu/inference/pojo/Behaviour.java new file mode 100755 index 0000000..9116cc7 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/Behaviour.java @@ -0,0 +1,84 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@ApiModel(value = "Behaviour对象", description = "") +public class Behaviour implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("行为id") + private Integer id; + + @ApiModelProperty("行为名称") + private String name; + + @ApiModelProperty("行为描述") + private String description; + + @ApiModelProperty("发生的概率") + private double generationProbability; + + @ApiModelProperty("行为对象身份(B)") + private String objectIdentity; + + @ApiModelProperty("关联对象id") + private String associatedId; + + @ApiModelProperty("行为人性格喜好|概率增减(A)") + private String subjectDisposition; + + @ApiModelProperty("行为人身份|概率增减(A)") + private String subjectIdentityProbability; + + @ApiModelProperty("行为对象身份|概率增减(B)") + private String objectIdentityProbability; + + @ApiModelProperty("与行为对象关系|概率影响(A与B)") + private String objectRelationProbability; + + @ApiModelProperty("行为对象性格喜好|概率影响(B)") + private String objectDispositionProbability; + + @ApiModelProperty("行为人性别|行为对象性别|概率影响(A)") + private String genderProbability; + + @ApiModelProperty("互斥行为") + private String exclusionBehaviour; + + @ApiModelProperty("反向行为") + private String inverseBehaviour; + + @ApiModelProperty("反向行为标签:0为非反向行为,1为反向行为") + private Integer inverseLabel; + + @ApiModelProperty("单人行为标签:0为双人行为,1为单人行为") + private Integer singleLabel; + + @ApiModelProperty("信息级别") + private Integer infoLevel; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/BehaviourRecord.java b/src/main/java/com/qiwu/inference/pojo/BehaviourRecord.java new file mode 100755 index 0000000..ff524a3 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/BehaviourRecord.java @@ -0,0 +1,62 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@TableName("behaviour_record") +@ApiModel(value = "BehaviourRecord对象", description = "") +public class BehaviourRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("行为记录id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("行为名称") + private String name; + + @ApiModelProperty("行为id") + private Integer behaviourId; + + @ApiModelProperty("行为描述") + private String description; + + @ApiModelProperty("主体:1") + private Integer subject; + + @ApiModelProperty("主体名称:老王") + private String subjectName; + + @ApiModelProperty("客体:2") + private Integer object; + + @ApiModelProperty("客体名称:小美") + private String objectName; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/Clue.java b/src/main/java/com/qiwu/inference/pojo/Clue.java new file mode 100755 index 0000000..0b6db3e --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/Clue.java @@ -0,0 +1,66 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +@Getter +@Setter +@ApiModel(value = "Clue对象", description = "") +public class Clue implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("线索名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("类型: 1:身份 2:场所 3:性格爱好 4:行为 5:关系 6:任务") + private Integer type; + + @ApiModelProperty("对应的Id") + private Integer associatedId; + + @ApiModelProperty("线索模板") + private String clueTemplate; + + @ApiModelProperty("信息级别") + private Integer infoLevel; + + @ApiModelProperty("信任度") + private Integer trustDegree; + + @ApiModelProperty("威胁") + private Integer threaten; + + @ApiModelProperty("操作1|信任度|威胁") + private Integer operate; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/ClueRecord.java b/src/main/java/com/qiwu/inference/pojo/ClueRecord.java new file mode 100755 index 0000000..e0d48f4 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/ClueRecord.java @@ -0,0 +1,71 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@TableName("clue_record") +@ApiModel(value = "ClueRecord对象", description = "") +public class ClueRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Integer id; + + @ApiModelProperty("线索id") + private Integer clueId; + + @ApiModelProperty("线索名称") + private String clueName; + + @ApiModelProperty("主体") + private Integer subject; + + @ApiModelProperty("客体") + private Integer object; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("类型: 1:身份 2:场所 3:性格爱好 4:行为 5:关系 6:任务 9: 关键线索 ") + private Integer type; + + @ApiModelProperty("信息级别") + private Integer infoLevel; + + @ApiModelProperty("关联人物") + private Integer associatedPerson; + + @ApiModelProperty("线索模板") + private String clueTemplate; + + @ApiModelProperty("信任度") + private Integer trustDegree; + + @ApiModelProperty("威胁") + private Integer threaten; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/ClueType.java b/src/main/java/com/qiwu/inference/pojo/ClueType.java new file mode 100644 index 0000000..4e4071f --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/ClueType.java @@ -0,0 +1,10 @@ +package com.qiwu.inference.pojo; + +import lombok.Data; + +@Data +public class ClueType { + private Integer id; + + private String name; +} diff --git a/src/main/java/com/qiwu/inference/pojo/DemandTask.java b/src/main/java/com/qiwu/inference/pojo/DemandTask.java new file mode 100755 index 0000000..5d48cc4 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/DemandTask.java @@ -0,0 +1,95 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +@Getter +@Setter +@TableName("demand_task") +@ApiModel(value = "DemandTask对象", description = "") +public class DemandTask implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Integer id; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("开启条件信任度") + private String trustCondition; + + @ApiModelProperty("开启条件威慑度") + private String deterrenceCondition; + + @ApiModelProperty("后置任务") + private String postTask; + + @ApiModelProperty("条件1|次数") + private String condition1; + + @ApiModelProperty("条件2|次数") + private String condition2; + + @ApiModelProperty("关联喜好") + private String associatedDisposition; + + @ApiModelProperty("关联身份") + private String associatedIdentity; + + @ApiModelProperty("关联行为") + private String associatedBehaviour; + + @ApiModelProperty("关联关系") + private String associatedRelation; + + @ApiModelProperty("互斥关系") + private String exclusiveTask; + + @ApiModelProperty("信任度增减") + private String trustDegree; + + @ApiModelProperty("威慑度增减") + private String deterrenceDegree; + + @ApiModelProperty("完成奖励") + private String completionReward; + + @ApiModelProperty("完成反馈") + private String completionFeedback; + + @ApiModelProperty("有效次数") + private String effectiveDegree; + + @ApiModelProperty("特殊任务 0 主动任务 1 被动任务") + private String specialTask; + + @ApiModelProperty("信息级别") + private Integer infoLevel; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/DemandTaskRecord.java b/src/main/java/com/qiwu/inference/pojo/DemandTaskRecord.java new file mode 100755 index 0000000..41de848 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/DemandTaskRecord.java @@ -0,0 +1,56 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +@Getter +@Setter +@TableName("demand_task_record") +@ApiModel(value = "DemandTaskRecord对象", description = "") +public class DemandTaskRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Integer id; + + @ApiModelProperty("demandTaskId") + private Integer demandTaskId; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("主体") + private Integer subject; + + @ApiModelProperty("客体") + private Integer object; + + @ApiModelProperty("信息级别") + private Integer infoLevel; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/Disposition.java b/src/main/java/com/qiwu/inference/pojo/Disposition.java new file mode 100755 index 0000000..646e939 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/Disposition.java @@ -0,0 +1,76 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@ApiModel(value = "Disposition对象", description = "") +public class Disposition implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("性格id") + private Integer id; + + @ApiModelProperty("性格名称") + private String name; + + @ApiModelProperty("性格描述") + private String description; + + @ApiModelProperty("类型") + private String type; + + @ApiModelProperty("基础权重") + private Integer weight; + + @ApiModelProperty("身份影响权重:") + private String identityWeight; + + @ApiModelProperty("性别影响概率:") + private String genderWeight; + + @ApiModelProperty("年龄影响权重:") + private String ageWeight; + + @ApiModelProperty("好感度初始值:") + private String favorDegree; + + @ApiModelProperty("弱点条件:") + private String weaknessCondition; + + @ApiModelProperty("对应物品|好感度增减:") + private String itemFavorDegree; + + @ApiModelProperty("对应身份|好感度增减:") + private String identityFavorDegree; + + @ApiModelProperty("互斥性格|喜好:") + private String exclusionDisposition; + + @ApiModelProperty("信息重要级别") + private Integer infoLevel; + + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/DispositionRecord.java b/src/main/java/com/qiwu/inference/pojo/DispositionRecord.java new file mode 100755 index 0000000..6283742 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/DispositionRecord.java @@ -0,0 +1,52 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@ApiModel(value = "DispositionRecord对象", description = "") +public class DispositionRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Integer id; + + @ApiModelProperty("性格id") + private Integer dispositionId; + + @ApiModelProperty("人物id") + private Integer subject; + + @ApiModelProperty("性格名称") + private String name; + + @ApiModelProperty("性格描述") + private String description; + + @ApiModelProperty("类型") + private String type; + + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/DispositionType.java b/src/main/java/com/qiwu/inference/pojo/DispositionType.java new file mode 100755 index 0000000..de6f22e --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/DispositionType.java @@ -0,0 +1,53 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-04 + */ +@Getter +@Setter +@TableName("disposition_type") +@ApiModel(value = "DispositionType对象", description = "") +public class DispositionType implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("关系类型id") + private Integer id; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("概率") + private String probability; + + @ApiModelProperty("身份影响概率增减") + private String identityProbability; + + @ApiModelProperty("性格/喜好影响概率增减") + private String dispositionProbability; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/EndGoal.java b/src/main/java/com/qiwu/inference/pojo/EndGoal.java new file mode 100755 index 0000000..fee059d --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/EndGoal.java @@ -0,0 +1,47 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@TableName("end_goal") +@ApiModel(value = "EndGoal对象", description = "") +public class EndGoal implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("结局目标id") + private Integer id; + + @ApiModelProperty("目标名称") + private String name; + + @ApiModelProperty("目标描述") + private String description; + + @ApiModelProperty("组合表:1|2|3|4|5") + private String clueGroup; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/Identity.java b/src/main/java/com/qiwu/inference/pojo/Identity.java new file mode 100755 index 0000000..7fbca63 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/Identity.java @@ -0,0 +1,57 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@ApiModel(value = "Identity对象", description = "") +public class Identity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("身份id") + private Integer id; + + @ApiModelProperty("身份名称") + private String name; + + @ApiModelProperty("身份描述") + private String description; + + @ApiModelProperty("关键身份") + private String keyIdentity; + + @ApiModelProperty("年龄生成规则:5|99") + private String ageCondition; + + @ApiModelProperty("对应场所:") + private String location; + + @ApiModelProperty("对应性别") + private Integer gender; + + @ApiModelProperty("指定名称:") + private String createName; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/Item.java b/src/main/java/com/qiwu/inference/pojo/Item.java new file mode 100755 index 0000000..6401a1f --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/Item.java @@ -0,0 +1,45 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@ApiModel(value = "Item对象", description = "") +public class Item implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Integer id; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("价格") + private String price; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/KeyClue.java b/src/main/java/com/qiwu/inference/pojo/KeyClue.java new file mode 100755 index 0000000..690df00 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/KeyClue.java @@ -0,0 +1,68 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-03 + */ +@Getter +@Setter +@TableName("key_clue") +@ApiModel(value = "KeyClue对象", description = "") +public class KeyClue implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("关键线索id") + private Integer id; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("关键人物身份(甲)") + private String subjectIdentity; + + @ApiModelProperty("人物标签(甲)") + private String subjectLabel; + + @ApiModelProperty("掌握线索人物身份(乙)") + private String objectIdentity; + + @ApiModelProperty("人物标签(乙)") + private String objectLabel; + + @ApiModelProperty("关系(留空为自己)") + private String relation; + + @ApiModelProperty("前置线索:90002|90003") + private String precue; + + @ApiModelProperty("线索组合:") + private String clueGroup; + + @ApiModelProperty("对应目标:") + private String target; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/Location.java b/src/main/java/com/qiwu/inference/pojo/Location.java new file mode 100755 index 0000000..c79300f --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/Location.java @@ -0,0 +1,51 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@ApiModel(value = "Location对象", description = "") +public class Location implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("场所id") + private Integer id; + + @ApiModelProperty("场所名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("关键场所") + private String keyLocation; + + @ApiModelProperty("是否隐藏") + private String isHidden; + + @ApiModelProperty("对应线索模板:") + private String clueTemplate; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/Moniker.java b/src/main/java/com/qiwu/inference/pojo/Moniker.java new file mode 100755 index 0000000..8f359e7 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/Moniker.java @@ -0,0 +1,45 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 姓名 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@ApiModel(value = "Moniker对象", description = "") +public class Moniker implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Integer id; + + @ApiModelProperty("名字") + private String name; + + @ApiModelProperty("性别") + private String gender; + + @ApiModelProperty("特殊身份") + private String specialIdentity; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/PersonRecord.java b/src/main/java/com/qiwu/inference/pojo/PersonRecord.java new file mode 100755 index 0000000..36ad933 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/PersonRecord.java @@ -0,0 +1,82 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@TableName("person_record") +@ApiModel(value = "PersonRecord对象", description = "") +public class PersonRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("人物id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("关卡编号") + private String gateNo; + + @ApiModelProperty("人物名称") + private String name; + + @ApiModelProperty("身份id") + private Integer identityId; + + @ApiModelProperty("身份名称") + private String identityName; + + @ApiModelProperty("年龄") + private Integer age; + + @ApiModelProperty("是否为关键人物 1 关键人物 2 普通人物") + private Integer isKey; + + @ApiModelProperty("性别") + private Integer gender; + + @ApiModelProperty("所在地") + private String location; + + @ApiModelProperty("性格") + private String disposition; + + @ApiModelProperty("人物拥有的关系") + @TableField(exist = false) + private List relations; + + @ApiModelProperty("人物拥有的行为") + @TableField(exist = false) + private List behaviours; + + @ApiModelProperty("人物掌握的线索集合") + @TableField(exist = false) + private List clues; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/Relation.java b/src/main/java/com/qiwu/inference/pojo/Relation.java new file mode 100755 index 0000000..c7d0e28 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/Relation.java @@ -0,0 +1,78 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-03 + */ +@Getter +@Setter +@ApiModel(value = "Relation对象", description = "") +public class Relation implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("关系id") + private Integer id; + + @ApiModelProperty("关系名称") + private String name; + + @ApiModelProperty("关系描述") + private String description; + + @ApiModelProperty("关系类型") + private Integer type; + + @ApiModelProperty("权重") + private Integer weight; + + @ApiModelProperty("自身|关系人性别影响权重") + private String genderWeight; + + @ApiModelProperty("年龄影响概率增减") + private String ageWeight; + + @ApiModelProperty("年龄差影响概率增减") + private String ageGapsWeight; + + @ApiModelProperty("身份影响概率增减") + private String identityWeight; + + @ApiModelProperty("性格/喜好影响概率增减") + private String dispositionWeight; + + @ApiModelProperty("关系人排除身份") + private String exclusionIdentity; + + @ApiModelProperty("互斥关系") + private String exclusionRelation; + + @ApiModelProperty("反向关系") + private String inverseRelation; + + @ApiModelProperty("信息重要级别") + private Integer infoLevel; + + @ApiModelProperty("掌握信息级别") + private Integer masterInfoLevel; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/RelationRecord.java b/src/main/java/com/qiwu/inference/pojo/RelationRecord.java new file mode 100755 index 0000000..0e13312 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/RelationRecord.java @@ -0,0 +1,68 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@TableName("relation_record") +@ApiModel(value = "RelationRecord对象", description = "") +public class RelationRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("关系名称") + private String name; + + @ApiModelProperty("关系描述") + private String description; + + @ApiModelProperty("类型") + private Integer type; + + @ApiModelProperty("关系id") + private Integer relationId; + + @ApiModelProperty("关系的主体") + private Integer subject; + + @ApiModelProperty("主体名称:老王") + private String subjectName; + + @ApiModelProperty("关系客体") + private Integer object; + + @ApiModelProperty("客体名称:老王") + private String objectName; + + @ApiModelProperty("掌握信息级别") + private Integer masterInfoLevel; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/RelationType.java b/src/main/java/com/qiwu/inference/pojo/RelationType.java new file mode 100755 index 0000000..26b4eca --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/RelationType.java @@ -0,0 +1,53 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-03 + */ +@Getter +@Setter +@TableName("relation_type") +@ApiModel(value = "RelationType对象", description = "") +public class RelationType implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("关系类型id") + private Integer id; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("概率") + private String probability; + + @ApiModelProperty("身份影响概率增减") + private String identityProbability; + + @ApiModelProperty("性格/喜好影响概率增减") + private String dispositionProbability; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/Surname.java b/src/main/java/com/qiwu/inference/pojo/Surname.java new file mode 100755 index 0000000..70a39a2 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/Surname.java @@ -0,0 +1,39 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@ApiModel(value = "Surname对象", description = "") +public class Surname implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Integer id; + + @ApiModelProperty("姓氏") + private String name; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/SystemConfigPojo.java b/src/main/java/com/qiwu/inference/pojo/SystemConfigPojo.java new file mode 100644 index 0000000..def8145 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/SystemConfigPojo.java @@ -0,0 +1,31 @@ +package com.qiwu.inference.pojo; + +import lombok.Data; + +@Data +public class SystemConfigPojo { + /** + * 系统参数名称 + */ + private String name; + /** + * 系统参数值 + */ + private String value; + /** + * 参数说明 + */ + private String description; + /** + * 参数状态:0-不可用,1-可用 + */ + private Integer status; + /** + * 创建时间 + */ + private String createTime; + /** + * 修改时间 + */ + private String updateTime; +} diff --git a/src/main/java/com/qiwu/inference/pojo/TaskCondition.java b/src/main/java/com/qiwu/inference/pojo/TaskCondition.java new file mode 100755 index 0000000..58cbffe --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/TaskCondition.java @@ -0,0 +1,44 @@ +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 任务条件 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@TableName("task_condition") +@ApiModel(value = "TaskCondition对象", description = "") +public class TaskCondition implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Integer id; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/service/BehaviourRecordService.java b/src/main/java/com/qiwu/inference/service/BehaviourRecordService.java new file mode 100755 index 0000000..3878431 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/BehaviourRecordService.java @@ -0,0 +1,25 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.BehaviourRecord; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface BehaviourRecordService extends IService { + + List getBehaviourRecords(Integer subject); + + List getBehaviourRecords(Integer object, Integer behaviourId); + + List getBehaviourRecordsNoSubject(Integer subject, Integer behaviourId); + Boolean isExists(Integer subject, Integer behaviourId); + Boolean isExists(Integer subject,Integer object, Integer behaviourId); +} diff --git a/src/main/java/com/qiwu/inference/service/BehaviourService.java b/src/main/java/com/qiwu/inference/service/BehaviourService.java new file mode 100755 index 0000000..f49a582 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/BehaviourService.java @@ -0,0 +1,18 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.Behaviour; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface BehaviourService extends IService { + List list(Integer inverseLabel); +} diff --git a/src/main/java/com/qiwu/inference/service/ClueRecordService.java b/src/main/java/com/qiwu/inference/service/ClueRecordService.java new file mode 100755 index 0000000..9bc0a0f --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/ClueRecordService.java @@ -0,0 +1,21 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.ClueRecord; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface ClueRecordService extends IService { + + List getClueRecords(Integer subject); + List getClueRecords(Integer subject,Integer infoLevel); + Boolean isExists(ClueRecord clueRecord); +} diff --git a/src/main/java/com/qiwu/inference/service/ClueService.java b/src/main/java/com/qiwu/inference/service/ClueService.java new file mode 100755 index 0000000..cc27331 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/ClueService.java @@ -0,0 +1,18 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.Clue; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +public interface ClueService extends IService { + + Clue getClue(Integer type,Integer associatedId); + +} diff --git a/src/main/java/com/qiwu/inference/service/DemandTaskRecordService.java b/src/main/java/com/qiwu/inference/service/DemandTaskRecordService.java new file mode 100755 index 0000000..038fb7a --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/DemandTaskRecordService.java @@ -0,0 +1,19 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.DemandTaskRecord; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +public interface DemandTaskRecordService extends IService { + List getDemandTaskRecords(Integer subject); + Boolean isExists(Integer subjectId,Integer demandTaskId); +} diff --git a/src/main/java/com/qiwu/inference/service/DemandTaskService.java b/src/main/java/com/qiwu/inference/service/DemandTaskService.java new file mode 100755 index 0000000..a230286 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/DemandTaskService.java @@ -0,0 +1,18 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.DemandTask; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +public interface DemandTaskService extends IService { + List list(Integer specialTask); +} diff --git a/src/main/java/com/qiwu/inference/service/DispositionRecordService.java b/src/main/java/com/qiwu/inference/service/DispositionRecordService.java new file mode 100755 index 0000000..bb2a77f --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/DispositionRecordService.java @@ -0,0 +1,21 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.DispositionRecord; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface DispositionRecordService extends IService { + List getDispositionRecords(Integer subject ,Integer dispositionId); + List getDispositionRecords(Integer subject ); + + List getDispositionRecordsNoSubject(Integer subject ,Integer dispositionId); +} diff --git a/src/main/java/com/qiwu/inference/service/DispositionService.java b/src/main/java/com/qiwu/inference/service/DispositionService.java new file mode 100755 index 0000000..7c8a08e --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/DispositionService.java @@ -0,0 +1,18 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.Disposition; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface DispositionService extends IService { + List getDispositions(Integer type); +} diff --git a/src/main/java/com/qiwu/inference/service/DispositionTypeService.java b/src/main/java/com/qiwu/inference/service/DispositionTypeService.java new file mode 100755 index 0000000..5437b7d --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/DispositionTypeService.java @@ -0,0 +1,16 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.DispositionType; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-04 + */ +public interface DispositionTypeService extends IService { + +} diff --git a/src/main/java/com/qiwu/inference/service/EndGoalService.java b/src/main/java/com/qiwu/inference/service/EndGoalService.java new file mode 100755 index 0000000..c4670a6 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/EndGoalService.java @@ -0,0 +1,16 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.EndGoal; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface EndGoalService extends IService { + +} diff --git a/src/main/java/com/qiwu/inference/service/IdentityService.java b/src/main/java/com/qiwu/inference/service/IdentityService.java new file mode 100755 index 0000000..e0d05e3 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/IdentityService.java @@ -0,0 +1,18 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.Identity; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface IdentityService extends IService { + List getIdentitys(String keyIdentity); +} diff --git a/src/main/java/com/qiwu/inference/service/ItemService.java b/src/main/java/com/qiwu/inference/service/ItemService.java new file mode 100755 index 0000000..dbf8426 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/ItemService.java @@ -0,0 +1,16 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.Item; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface ItemService extends IService { + +} diff --git a/src/main/java/com/qiwu/inference/service/KeyClueService.java b/src/main/java/com/qiwu/inference/service/KeyClueService.java new file mode 100755 index 0000000..4eb3276 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/KeyClueService.java @@ -0,0 +1,18 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.KeyClue; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface KeyClueService extends IService { + List getKeyClues(String clueGroup); +} diff --git a/src/main/java/com/qiwu/inference/service/LocationService.java b/src/main/java/com/qiwu/inference/service/LocationService.java new file mode 100755 index 0000000..524ed7e --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/LocationService.java @@ -0,0 +1,16 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.Location; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface LocationService extends IService { + +} diff --git a/src/main/java/com/qiwu/inference/service/MonikerService.java b/src/main/java/com/qiwu/inference/service/MonikerService.java new file mode 100755 index 0000000..9377271 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/MonikerService.java @@ -0,0 +1,18 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.Moniker; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface MonikerService extends IService { + List getMonikers(Integer gender); +} diff --git a/src/main/java/com/qiwu/inference/service/PersonRecordService.java b/src/main/java/com/qiwu/inference/service/PersonRecordService.java new file mode 100755 index 0000000..2cef25e --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/PersonRecordService.java @@ -0,0 +1,24 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.PersonRecord; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface PersonRecordService extends IService { + + List getPersonRecords(String gateNo); + + List getPersonRecordsNoSubject(Integer subject,Integer identityId); + + List getGateNo(); + +} diff --git a/src/main/java/com/qiwu/inference/service/RelationRecordService.java b/src/main/java/com/qiwu/inference/service/RelationRecordService.java new file mode 100755 index 0000000..ec875c0 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/RelationRecordService.java @@ -0,0 +1,23 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.RelationRecord; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface RelationRecordService extends IService { + + List getRelationRecords(Integer subject); + List getRelationRecordsNoSubject(Integer subject,Integer relationId); + Boolean isExistsRelationTypes(Integer subject,Integer object,Integer type); + List getInverseRelationRecords(Integer object); + Boolean isExists(Integer subjectId,Integer objectId,Integer relationId); +} diff --git a/src/main/java/com/qiwu/inference/service/RelationService.java b/src/main/java/com/qiwu/inference/service/RelationService.java new file mode 100755 index 0000000..14559b3 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/RelationService.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.Relation; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-03 + */ +public interface RelationService extends IService { + List getRelations(Integer type); + Boolean isExists(String[] relationIds); + List getRelations(String[] relationIds); +} diff --git a/src/main/java/com/qiwu/inference/service/RelationTypeService.java b/src/main/java/com/qiwu/inference/service/RelationTypeService.java new file mode 100755 index 0000000..71eb5ca --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/RelationTypeService.java @@ -0,0 +1,16 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.RelationType; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-03 + */ +public interface RelationTypeService extends IService { + +} diff --git a/src/main/java/com/qiwu/inference/service/SurnameService.java b/src/main/java/com/qiwu/inference/service/SurnameService.java new file mode 100755 index 0000000..a7da7a6 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/SurnameService.java @@ -0,0 +1,16 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.Surname; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface SurnameService extends IService { + +} diff --git a/src/main/java/com/qiwu/inference/service/TaskConditionService.java b/src/main/java/com/qiwu/inference/service/TaskConditionService.java new file mode 100755 index 0000000..674fe2a --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/TaskConditionService.java @@ -0,0 +1,16 @@ +package com.qiwu.inference.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.qiwu.inference.pojo.TaskCondition; + +/** + *

+ * 服务类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +public interface TaskConditionService extends IService { + +} diff --git a/src/main/java/com/qiwu/inference/service/ask/AskService.java b/src/main/java/com/qiwu/inference/service/ask/AskService.java index 7022bad..888bd76 100644 --- a/src/main/java/com/qiwu/inference/service/ask/AskService.java +++ b/src/main/java/com/qiwu/inference/service/ask/AskService.java @@ -1,8 +1,10 @@ package com.qiwu.inference.service.ask; +import com.qiwu.inference.common.api.CommonResult; import com.qiwu.inference.dto.request.OperationRequest; import com.qiwu.inference.dto.response.CommonResponse; +import com.qiwu.inference.dto.response.ResultVarsResponse; public interface AskService { - CommonResponse ask(OperationRequest operationReq); + CommonResult ask(OperationRequest operationReq); } diff --git a/src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java b/src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java index fcbb28a..ab3245d 100644 --- a/src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java +++ b/src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java @@ -1,41 +1,48 @@ package com.qiwu.inference.service.ask.impl; -import com.qiwu.inference.common.Constants; -import com.qiwu.inference.common.utils.SpeechUtil; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.common.utils.CacheUtil; +import com.qiwu.inference.common.utils.PlayerUtil; +import com.qiwu.inference.common.utils.YamlUtil; import com.qiwu.inference.dto.request.OperationRequest; -import com.qiwu.inference.dto.response.CommonResponse; -import com.qiwu.inference.dto.response.ResultResponse; import com.qiwu.inference.dto.response.ResultVarsResponse; import com.qiwu.inference.service.ask.AskService; +import com.qiwu.inference.service.common.CommonService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; +import org.springframework.util.StringUtils; @Service public class AskServiceImpl implements AskService { - @Value("${inferenceUrl}") - private String url; -// @Autowired -// private RestTemplate restTemplate; + private Logger log = LoggerFactory.getLogger(AskServiceImpl.class); + + //从yml配置文件中取出对话过期时间 + @Value("${expireTime}") + private String expireTime; + + @Autowired + private CommonService commonService; @Override - public CommonResponse ask(OperationRequest operationReq) { - CommonResponse commonResponse = new CommonResponse(); - ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); - ResultResponse resultResponse = new ResultResponse(); + public CommonResult ask(OperationRequest operationReq) { String uid = operationReq.getUid(); + String subjectName = operationReq.getSubjectName(); //人物名称1 + String objectName = operationReq.getObjectName(); //人物名称2 + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + subjectName = (subjectName == null) ? lastReq.getSubjectName() : subjectName; + objectName = (objectName == null) ? lastReq.getObjectName() : objectName; + } + operationReq.setSubjectName(subjectName); + operationReq.setObjectName(objectName); + //----------------记录见过的人-------------- + PlayerUtil.recordClue(uid, TimingAcquisition.playerMap.get(uid).getPersonId()); -// String result = restTemplate.getForObject(url + "/garden/steal", String.class); -// System.out.println("返回结果:" + result); - //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100102); - commonResponse.setCode(1); - commonResponse.setMsg("成功"); - resultResponse.set反馈ID(100001); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - commonResponse.setData(resultVarsResponse); - return commonResponse; + return commonService.operate(operationReq); } } diff --git a/src/main/java/com/qiwu/inference/service/barrier/BarrierService.java b/src/main/java/com/qiwu/inference/service/barrier/BarrierService.java new file mode 100644 index 0000000..8d4d01b --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/barrier/BarrierService.java @@ -0,0 +1,11 @@ +package com.qiwu.inference.service.barrier; + +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultVarsResponse; + +public interface BarrierService { + CommonResult operate(OperationRequest operationReq); + + CommonResult cancel(OperationRequest operationReq); +} diff --git a/src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java b/src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java new file mode 100644 index 0000000..e4166b6 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java @@ -0,0 +1,237 @@ +package com.qiwu.inference.service.barrier.impl; + +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.common.cache.CacheGlobal; +import com.qiwu.inference.common.utils.CacheUtil; +import com.qiwu.inference.common.utils.PlayerUtil; +import com.qiwu.inference.common.utils.RandomUtil; +import com.qiwu.inference.common.utils.SpeechUtil; +import com.qiwu.inference.dto.Player; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultResponse; +import com.qiwu.inference.dto.response.ResultVarsResponse; +import com.qiwu.inference.service.barrier.BarrierService; +import com.qiwu.inference.service.common.CommonService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.List; + +@Service +public class BarrierServiceImpl implements BarrierService { + Logger log = LoggerFactory.getLogger(BarrierServiceImpl.class); + + //对话过期时间 + @Value("${expireTime}") + private String expireTime; + + @Autowired + private CommonService commonService; + + @Override + public CommonResult operate(OperationRequest operationReq) { + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = operationReq.getUid(); + String methodId = operationReq.getMethodId(); //方法编号 + Integer subjectId = operationReq.getSubjectId(); //人物名称1 + String locationId = operationReq.getLocationId(); //场所名称 + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + if (Constants.OPERATE_BARRIER.equals(lastReq.getOperate())) { + methodId = (methodId == null) ? lastReq.getMethodId() : methodId; + subjectId = (subjectId == null) ? lastReq.getSubjectId() : subjectId; + } + } + operationReq.setOperate(Constants.OPERATE_BARRIER); + Player player = TimingAcquisition.playerMap.get(uid); + String subjectName = PlayerUtil.getNameByPersonId(uid, subjectId); + //场所移动 + if ("4001".equals(methodId)) { + //玩家提供的人物名称 + if (!StringUtils.isEmpty(subjectId)) { + //获取人物所在场所 + locationId = player.getPersonMap().get(subjectId).getLocation(); + } else { + //玩家提供的场所不存在 + if (Constants.NON_STR.equals(locationId)) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400103); + resultResponse.set反馈ID(400103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + List personIdList = PlayerUtil.getPersonsByLocationId(uid, locationId); + if (personIdList.size() == 0) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400104); + resultResponse.set反馈ID(400104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(personIdList.size()); + subjectId = personIdList.get(index); + subjectName = PlayerUtil.getNameByPersonId(uid, subjectId); + } + //场所为隐藏 + if (Constants.IS_HIDDEN.equals(TimingAcquisition.locationMap.get(locationId).getIsHidden())) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400102); + resultResponse.set反馈ID(400102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + player.setLocation(locationId); + player.setPersonId(subjectId); + //----------------记录见过的人-------------- + PlayerUtil.recordClue(uid, subjectId); + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400101); + text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.locationMap.get(locationId).getName(), subjectName); + resultResponse.set反馈ID(400101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //场所移动 + if ("4002".equals(methodId)) { + //关卡中没有这个人物 + if (StringUtils.isEmpty(player.getPersonMap().get(subjectId))) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400203); + resultResponse.set反馈ID(400203); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //关卡中有这个人,但场所未知 + if (StringUtils.isEmpty(player.getPersonMap().get(subjectId).getLocation())) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400204); + resultResponse.set反馈ID(400204); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //获取人物所在场所 + locationId = player.getPersonMap().get(subjectId).getLocation(); + //跟玩家在同一场所,直接打招呼 + if (player.getLocation().equals(locationId)) { + operationReq.setMethodId("2002"); + player.setPersonId(subjectId); + operationReq.setTaskConditionId("70004"); //执行打招呼任务 + //----------------记录见过的人-------------- + PlayerUtil.recordClue(uid, subjectId); + return commonService.operate(operationReq); + } + //不在同一场所 + //保存本轮对话 + operationReq.setSubjectId(subjectId); + operationReq.setMethodId("4001"); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400202); + text = SpeechUtil.speechReplaceNum(text, subjectName, TimingAcquisition.locationMap.get(locationId).getName()); + resultResponse.set反馈ID(400202); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("关卡操作回复1"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //重新开始 + if ("400301".equals(methodId)) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400301); + text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.systemConfigMap.get("money").getValue()); + resultResponse.set反馈ID(400301); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("重试关卡回复1"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //确认重新开始 + if ("400302".equals(methodId)) { + //玩家本关卡的数据重置 + PlayerUtil.resetPlayer(uid); + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400302); + resultResponse.set反馈ID(400302); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //取消重新开始 + if ("400303".equals(methodId)) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400303); + resultResponse.set反馈ID(400303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //跳过关卡 + if ("400401".equals(methodId)) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400401); + text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.systemConfigMap.get("money").getValue()); + resultResponse.set反馈ID(400301); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("放弃操作回复1"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //确认跳过关卡 + if ("400402".equals(methodId)) { + //玩家本关卡的数据重置 + PlayerUtil.playerGiveUp(uid); + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400402); + resultResponse.set反馈ID(400302); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //取消跳过关卡 + if ("400403".equals(methodId)) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400403); + resultResponse.set反馈ID(400303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400101); + resultResponse.set反馈ID(300101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + + @Override + public CommonResult cancel(OperationRequest operationReq) { + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = operationReq.getUid(); + //清除缓存,本轮对话结束 + CacheGlobal.concurrentMap.remove(uid); + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400001); + resultResponse.set反馈ID(400001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } +} diff --git a/src/main/java/com/qiwu/inference/service/check/CheckService.java b/src/main/java/com/qiwu/inference/service/check/CheckService.java new file mode 100644 index 0000000..8a0930a --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/check/CheckService.java @@ -0,0 +1,9 @@ +package com.qiwu.inference.service.check; + +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultVarsResponse; + +public interface CheckService { + CommonResult check(OperationRequest operationReq); +} diff --git a/src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java b/src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java new file mode 100644 index 0000000..9a712d0 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java @@ -0,0 +1,570 @@ +package com.qiwu.inference.service.check.impl; + +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.common.utils.*; +import com.qiwu.inference.dto.ClueDto; +import com.qiwu.inference.dto.Person; +import com.qiwu.inference.dto.Player; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultResponse; +import com.qiwu.inference.dto.response.ResultVarsResponse; +import com.qiwu.inference.service.check.CheckService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class CheckServiceImpl implements CheckService { + private Logger log = LoggerFactory.getLogger(CheckServiceImpl.class); + + //对话过期时间 + @Value("${expireTime}") + private String expireTime; + + @Override + public CommonResult check(OperationRequest operationReq) { + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = operationReq.getUid(); + String methodId = operationReq.getMethodId(); //方法编号 + Integer subjectId = operationReq.getSubjectId(); //人物名称id + Integer clueTypeId = operationReq.getClueTypeId(); //线索类型id + boolean hadTalk = false; + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + if (Constants.OPERATE_CHECK.equals(lastReq.getOperate())) { + subjectId = (subjectId == null) ? lastReq.getSubjectId() : subjectId; + clueTypeId = (clueTypeId == null) ? lastReq.getClueTypeId() : clueTypeId; + hadTalk = true; + } + } + operationReq.setOperate(Constants.OPERATE_CHECK); + Player player = TimingAcquisition.playerMap.get(uid); + //查看人物列表 + if ("3001".equals(methodId) || "3002".equals(methodId)) { + //玩家已对话过的人物 + List personList = new ArrayList<>(player.getClueMap().keySet()); + //玩家还没有获得线索 + if (personList.size() == 0) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30010101); + resultResponse.set反馈ID(30010101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + StringBuilder personText = new StringBuilder(); + for (Integer personId : personList) { + personText.append(PlayerUtil.getNameByPersonId(uid, personId)).append("、"); + } + if (personText.length() != 0) { + personText.deleteCharAt(personText.length() - 1); + } + //未提供人物名称 + if (StringUtils.isEmpty(subjectId)) { + //获取对应话术 + String text = ""; + if (personList.size() == 1) { + //人物信息 + Person person = player.getPersonMap().get(personList.get(0)); + String call = (person.getGender() == 1) ? "他" : "她"; + text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30010102); + text = SpeechUtil.speechReplaceNum(text, personText.toString(), call); + //保存本轮对话 + operationReq.setSubjectId(subjectId); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); + } else { + text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300101); + text = SpeechUtil.speechReplaceNum(text, personText.toString()); + } + resultResponse.set反馈ID(300101); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看人物列表1"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //人物名称不存在 + if (subjectId == Constants.REQ_NON) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300104); + text = SpeechUtil.speechReplaceNum(text, personText.toString()); + resultResponse.set反馈ID(300104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + String subjectName = TimingAcquisition.getNameByPersonId(uid, subjectId); + //玩家还没见过这个人 + if (!personList.contains(subjectId)) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30010201); + text = SpeechUtil.speechReplaceNum(text, subjectName); + resultResponse.set反馈ID(30010201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //人物信息 + Person person = player.getPersonMap().get(subjectId); + String call = (person.getGender() == 1) ? "他" : "她"; + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300102); + text = SpeechUtil.speechReplaceNum(text, subjectName, person.getAge().toString(), + (person.getGender() == 1) ? "男" : "女", call, + person.getTrustDegree().toString(), person.getDeterrenceDegree().toString()); + resultResponse.set反馈ID(300102); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看人物列表2"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查看人物相关线索 + if ("300103".equals(methodId)) { + //没有人物名称 + if (StringUtils.isEmpty(subjectId)) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30010301); + resultResponse.set反馈ID(30010301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //线索 + StringBuilder clueText = new StringBuilder(); + Map> clueMap = player.getClueMap().get(subjectId); + //有对话过的人 + if (!StringUtils.isEmpty(clueMap)) { + for (Map.Entry> entry : clueMap.entrySet()) { + List clues = entry.getValue(); + //身份线索 + if (entry.getKey() == 1) { + clueText.append("身份线索: "); + } + //场所线索 + if (entry.getKey() == 2) { + clueText.append("场所线索: "); + } + //性格爱好线索 + if (entry.getKey() == 3) { + clueText.append("性格爱好线索: "); + } + //行为线索 + if (entry.getKey() == 4) { + clueText.append("行为线索: "); + } + //关系线索 + if (entry.getKey() == 5) { + clueText.append("关系线索: "); + } + //任务线索 + if (entry.getKey() == 6) { + clueText.append("任务线索: "); + } + //关键线索 + if (entry.getKey() == 9) { + clueText.append("关键线索: "); + } + clueText.append(clues.size()).append("、"); + } + if (clueText.length() != 0) { + clueText.deleteCharAt(clueText.length() - 1); + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300103); + text = SpeechUtil.speechReplaceNum(text, clueText.toString()); + resultResponse.set反馈ID(300103); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看人物列表2"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30010302); + resultResponse.set反馈ID(30010302); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查看货币 + if ("3003".equals(methodId)) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300301); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(player.getCurrency().intValue()), TimingAcquisition.systemConfigMap.get("money").getValue()); + resultResponse.set反馈ID(300301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查看场所 + if ("3004".equals(methodId)) { + String locationText = PlayerUtil.getLocations(uid); + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300401); + text = SpeechUtil.speechReplaceNum(text, locationText); + resultResponse.set反馈ID(300401); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看场所1"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查看线索 + if ("3005".equals(methodId)) { + int clueSize = 0; + for (Map.Entry>> entry : player.getClueMap().entrySet()) { + for (Map.Entry> listEntry : entry.getValue().entrySet()) { + clueSize += listEntry.getValue().size(); + } + } + //获取对应话术 + String text = ""; + //玩家当前还没有获得线索 + if (clueSize != 0) { + text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300501); + } else { + text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050101); + } + text = SpeechUtil.speechReplaceNum(text, String.valueOf(clueSize)); + resultResponse.set反馈ID(300501); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看线索1"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查看线索 + if ("300502".equals(methodId)) { + StringBuilder clueNumText = new StringBuilder(); + //当前还没有对话过的人物 + if (player.getClueMap().size() == 0) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050201); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(player.getClueMap().size()), clueNumText.toString()); + resultResponse.set反馈ID(30050201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + for (Map.Entry>> entry : player.getClueMap().entrySet()) { + clueNumText.append(player.getPersonMap().get(entry.getKey()).getName()).append("有"); + int size = 0; + for (Map.Entry> listEntry : entry.getValue().entrySet()) { + size += listEntry.getValue().size(); + } + clueNumText.append(size).append("条线索、"); + } + if (clueNumText.length() != 0) { + clueNumText.deleteCharAt(clueNumText.length() - 1); + } + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300502); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(player.getClueMap().size()), clueNumText.toString()); + resultResponse.set反馈ID(300502); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看线索2"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查看线索 + if ("300503".equals(methodId)) { + StringBuilder clueText = new StringBuilder(); + Map clueNumMap = new HashMap<>(); + for (Map.Entry>> entry : player.getClueMap().entrySet()) { + for (Map.Entry> listEntry : entry.getValue().entrySet()) { + int size = (clueNumMap.get(listEntry.getKey()) == null) ? 0 : clueNumMap.get(listEntry.getKey()); + clueNumMap.put(listEntry.getKey(), size + listEntry.getValue().size()); + } + } + //玩家没有收集到线索 + if (clueNumMap.size() == 0) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050301); + text = SpeechUtil.speechReplaceNum(text, clueText.toString()); + resultResponse.set反馈ID(30050301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + for (Map.Entry entry : clueNumMap.entrySet()) { + clueText.append(entry.getValue()).append("条"); + //身份线索 + if (entry.getKey() == 1) { + clueText.append("身份线索、"); + } + //场所线索 + if (entry.getKey() == 2) { + clueText.append("场所线索、"); + } + //性格爱好线索 + if (entry.getKey() == 3) { + clueText.append("性格爱好线索、"); + } + //行为线索 + if (entry.getKey() == 4) { + clueText.append("行为线索、"); + } + //关系线索 + if (entry.getKey() == 5) { + clueText.append("关系线索、"); + } + //任务线索 + if (entry.getKey() == 6) { + clueText.append("任务线索、"); + } + //关键线索 + if (entry.getKey() == 9) { + clueText.append("关键线索、"); + } + } + if (clueText.length() != 0) { + clueText.deleteCharAt(clueText.length() - 1); + } + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300503); + text = SpeechUtil.speechReplaceNum(text, clueText.toString()); + resultResponse.set反馈ID(300503); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看线索3"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + + //查看线索 + if ("300504".equals(methodId)) { + //线索 + StringBuilder clueText = new StringBuilder(); + Map> clueMap = player.getClueMap().get(subjectId); + String subjectName = TimingAcquisition.getNameByPersonId(uid, subjectId); + //玩家还没有获得任何线索 + if (player.getClueMap().size() == 0) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050401); + text = SpeechUtil.speechReplaceNum(text, subjectName); + resultResponse.set反馈ID(30050401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //玩家还没有这个人的线索 + if (StringUtils.isEmpty(clueMap)) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050402); + text = SpeechUtil.speechReplaceNum(text, subjectName); + resultResponse.set反馈ID(30050402); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int size = 0; + //有对话过的人 + for (Map.Entry> entry : clueMap.entrySet()) { + size += entry.getValue().size(); + List clues = entry.getValue(); + clueText.append(clues.size()).append("条"); + //身份线索 + if (entry.getKey() == 1) { + clueText.append("身份线索、"); + } + //场所线索 + if (entry.getKey() == 2) { + clueText.append("场所线索、"); + } + //性格爱好线索 + if (entry.getKey() == 3) { + clueText.append("性格爱好线索、"); + } + //行为线索 + if (entry.getKey() == 4) { + clueText.append("行为线索、"); + } + //关系线索 + if (entry.getKey() == 5) { + clueText.append("关系线索、"); + } + //任务线索 + if (entry.getKey() == 6) { + clueText.append("任务线索、"); + } + //关键线索 + if (entry.getKey() == 9) { + clueText.append("关键线索、"); + } + } + clueText.deleteCharAt(clueText.length() - 1); + //保存本轮对话 + operationReq.setSubjectId(subjectId); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300504); + text = SpeechUtil.speechReplaceNum(text, subjectName, String.valueOf(size), clueText.toString()); + resultResponse.set反馈ID(300504); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看线索4"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //根据线索类型查看线索 + if ("300505".equals(methodId)) { + StringBuilder clueText = new StringBuilder(); + int size = 0; + for (Map.Entry>> entry : player.getClueMap().entrySet()) { + clueText.append(player.getPersonMap().get(entry.getKey()).getName()).append("有"); + for (Map.Entry> listEntry : entry.getValue().entrySet()) { + if (clueTypeId.equals(listEntry.getKey())) { + size += listEntry.getValue().size(); + clueText.append(listEntry.getValue().size()).append("条、"); + } + } + } + //玩家还没有对应类型的线索 + if (size == 0) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050501); + text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.clueTypeMap.get(clueTypeId)); + resultResponse.set反馈ID(30050501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (clueText.length() != 0) { + clueText.deleteCharAt(clueText.length() - 1); + } + //保存本轮对话 + operationReq.setClueTypeId(clueTypeId); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300505); + text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.clueTypeMap.get(clueTypeId), String.valueOf(size), clueText.toString()); + resultResponse.set反馈ID(300505); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看线索5"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //根据人物名称和线索类型查看线索 + if ("300506".equals(methodId)) { + //玩家查看下一条线索 + if (!StringUtils.isEmpty(lastReq)) { + if (!StringUtils.isEmpty(lastReq.getClueList())) { + List clueList = lastReq.getClueList(); + int index = lastReq.getIndex(); + String subjectName = TimingAcquisition.getNameByPersonId(uid, lastReq.getSubjectId()); + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300506); + text = SpeechUtil.speechReplaceNum(text, subjectName, TimingAcquisition.clueTypeMap.get(lastReq.getClueTypeId()), + String.valueOf(clueList.size()), String.valueOf(index + 1), clueList.get(index).getClueTemplate()); + //保存本轮对话 + index = (index + 1) % clueList.size(); + operationReq.setSubjectId(lastReq.getSubjectId()); + operationReq.setClueTypeId(lastReq.getClueTypeId()); + operationReq.setClueList(clueList); + operationReq.setIndex(index); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); + + resultResponse.set反馈ID(300506); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看线索6"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + //没有提供人物名称 + if (StringUtils.isEmpty(subjectId)) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050602); + resultResponse.set反馈ID(30050602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //提供的人物名称不存在 + if (subjectId == Constants.REQ_NON) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050603); + resultResponse.set反馈ID(30050603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //没有提供线索类型 + if (StringUtils.isEmpty(clueTypeId)) { + //保存本轮对话 + operationReq.setSubjectId(subjectId); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050604); + resultResponse.set反馈ID(30050604); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //提供的线索类型不存在 + if (clueTypeId == Constants.REQ_NON) { + //保存本轮对话 + operationReq.setSubjectId(subjectId); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050605); + resultResponse.set反馈ID(30050605); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + String subjectName = TimingAcquisition.getNameByPersonId(uid, subjectId); + //还没有收集到这个人的线索 + if (StringUtils.isEmpty(player.getClueMap().get(subjectId))) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050601); + text = SpeechUtil.speechReplaceNum(text, subjectName, TimingAcquisition.clueTypeMap.get(clueTypeId)); + resultResponse.set反馈ID(30050601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //还没有收集到这个人该类型的线索 + if (StringUtils.isEmpty(player.getClueMap().get(subjectId).get(clueTypeId))) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30050601); + text = SpeechUtil.speechReplaceNum(text, subjectName, TimingAcquisition.clueTypeMap.get(clueTypeId)); + resultResponse.set反馈ID(30050601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + List clueList = player.getClueMap().get(subjectId).get(clueTypeId); + int index = 0; + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300506); + text = SpeechUtil.speechReplaceNum(text, subjectName, TimingAcquisition.clueTypeMap.get(clueTypeId), + String.valueOf(clueList.size()), String.valueOf(index + 1), clueList.get(index).getClueTemplate()); + //保存本轮对话 + index = (index + 1) % clueList.size(); + operationReq.setSubjectId(subjectId); + operationReq.setClueTypeId(clueTypeId); + operationReq.setClueList(clueList); + operationReq.setIndex(index); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); + + resultResponse.set反馈ID(300506); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看线索6"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300001); + resultResponse.set反馈ID(300001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } +} diff --git a/src/main/java/com/qiwu/inference/service/common/CommonService.java b/src/main/java/com/qiwu/inference/service/common/CommonService.java new file mode 100644 index 0000000..66dc27d --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/common/CommonService.java @@ -0,0 +1,98 @@ +package com.qiwu.inference.service.common; + +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultVarsResponse; +import com.qiwu.inference.service.player.PlayerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class CommonService { + @Autowired + private PlayerService playerService; + + + public CommonResult operate(OperationRequest request) { + String methodId = request.getMethodId();; + switch (methodId){ + case "1001": + case "1002": + return playerService.askDisposition(request); + case "1003": + case "1004": + case "1005": + case "1006": + return playerService.askRelation(request); + case "1007": + case "1008": + case "1009": + case "1010": + case "1011": + return playerService.askBehaviour(request); + case "1012": + case "1013": + case "1014": + case "1015": + case "1016": + case "1017": + case "1018": + case "1019": + case "1020": + case "1021": + case "1022": + return playerService.askTask(request); + case "1023": + case "1024": + return playerService.askIdentity(request); + case "1025": + case "1026": + return playerService.askLocation(request); + case "1027": + return playerService.askPrompt(request); + case "2001": + case "2003": + case "2002": + case "2004": + case "2005": + case "2006": + case "2007": + case "2008": + case "2009": + case "2010": + case "2011": + case "2012": + case "2013": + case "2014": + case "2015": + case "2016": + case "2017": + case "2018": + case "2019": + case "2020": + case "2021": + case "2022": + case "2023": + case "2024": + case "2025": + case "2026": + case "2027": + case "2028": + case "2029": + case "2030": + case "2031": + case "2032": + case "2033": + case "2034": + case "2035": + case "2036": + case "2037": + case "2038": + case "2039": + case "2040": + case "2041": + return playerService.performTask(request); + } + return null; + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/BehaviourRecordServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/BehaviourRecordServiceImpl.java new file mode 100755 index 0000000..0363952 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/BehaviourRecordServiceImpl.java @@ -0,0 +1,62 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.BehaviourRecordMapper; +import com.qiwu.inference.pojo.BehaviourRecord; +import com.qiwu.inference.service.BehaviourRecordService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class BehaviourRecordServiceImpl extends ServiceImpl implements BehaviourRecordService { + + @Override + public List getBehaviourRecords(Integer subject) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(BehaviourRecord::getSubject,subject); + return list(wrapper); + } + + @Override + public List getBehaviourRecords(Integer object, Integer behaviourId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(BehaviourRecord::getObject,object); + wrapper.lambda().eq(BehaviourRecord::getBehaviourId,behaviourId); + return list(wrapper); + } + + @Override + public List getBehaviourRecordsNoSubject(Integer subject, Integer behaviourId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(BehaviourRecord::getBehaviourId,behaviourId); + wrapper.lambda().and(tmp ->tmp.ne(BehaviourRecord::getSubject, subject).or().ne(BehaviourRecord::getObject, subject)); + return list(wrapper); + } + + @Override + public Boolean isExists(Integer subject, Integer behaviourId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(BehaviourRecord::getSubject,subject); + wrapper.lambda().eq(BehaviourRecord::getBehaviourId,behaviourId); + return list(wrapper).size() > 0; + } + + @Override + public Boolean isExists(Integer subject, Integer object, Integer behaviourId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(BehaviourRecord::getSubject,subject); + wrapper.lambda().eq(BehaviourRecord::getObject,object); + wrapper.lambda().eq(BehaviourRecord::getBehaviourId,behaviourId); + return list(wrapper).size() > 0; + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/BehaviourServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/BehaviourServiceImpl.java new file mode 100755 index 0000000..c5b5be8 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/BehaviourServiceImpl.java @@ -0,0 +1,29 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.BehaviourMapper; +import com.qiwu.inference.pojo.Behaviour; +import com.qiwu.inference.service.BehaviourService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class BehaviourServiceImpl extends ServiceImpl implements BehaviourService { + + @Override + public List list(Integer inverseLabel) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(Behaviour::getInverseLabel,inverseLabel); + return list(wrapper); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/ClueRecordServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/ClueRecordServiceImpl.java new file mode 100755 index 0000000..7eacba2 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/ClueRecordServiceImpl.java @@ -0,0 +1,46 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.ClueRecordMapper; +import com.qiwu.inference.pojo.ClueRecord; +import com.qiwu.inference.service.ClueRecordService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class ClueRecordServiceImpl extends ServiceImpl implements ClueRecordService { + + @Override + public List getClueRecords(Integer subject) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(ClueRecord::getAssociatedPerson,subject); + return list(wrapper); + } + + @Override + public List getClueRecords(Integer subject, Integer infoLevel) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(ClueRecord::getAssociatedPerson,subject); + wrapper.lambda().le(ClueRecord::getInfoLevel,infoLevel); + return list(wrapper); + } + + @Override + public Boolean isExists(ClueRecord clueRecord) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("description",clueRecord.getDescription()); + wrapper.eq("associated_person",clueRecord.getAssociatedPerson()); + wrapper.eq("type",clueRecord.getType()); + return list(wrapper).size() > 0; + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/ClueServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/ClueServiceImpl.java new file mode 100755 index 0000000..e80a863 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/ClueServiceImpl.java @@ -0,0 +1,28 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.ClueMapper; +import com.qiwu.inference.pojo.Clue; +import com.qiwu.inference.service.ClueService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +@Service +public class ClueServiceImpl extends ServiceImpl implements ClueService { + + @Override + public Clue getClue(Integer type, Integer associatedId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(Clue::getType,type); + wrapper.lambda().eq(Clue::getAssociatedId,associatedId); + return getOne(wrapper); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/DemandTaskRecordServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/DemandTaskRecordServiceImpl.java new file mode 100755 index 0000000..099f88a --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/DemandTaskRecordServiceImpl.java @@ -0,0 +1,37 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.DemandTaskRecordMapper; +import com.qiwu.inference.pojo.DemandTaskRecord; +import com.qiwu.inference.service.DemandTaskRecordService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +@Service +public class DemandTaskRecordServiceImpl extends ServiceImpl implements DemandTaskRecordService { + + @Override + public List getDemandTaskRecords(Integer subject) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(DemandTaskRecord::getSubject,subject); + return list(wrapper); + } + + @Override + public Boolean isExists(Integer subjectId, Integer demandTaskId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("subject",subjectId); + wrapper.eq("demand_task_id",demandTaskId); + return list(wrapper).size() > 0; + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/DemandTaskServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/DemandTaskServiceImpl.java new file mode 100755 index 0000000..d688171 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/DemandTaskServiceImpl.java @@ -0,0 +1,29 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.DemandTaskMapper; +import com.qiwu.inference.pojo.DemandTask; +import com.qiwu.inference.service.DemandTaskService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-07 + */ +@Service +public class DemandTaskServiceImpl extends ServiceImpl implements DemandTaskService { + + @Override + public List list(Integer specialTask) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(DemandTask::getSpecialTask,specialTask); + return list(wrapper); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/DispositionRecordServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/DispositionRecordServiceImpl.java new file mode 100755 index 0000000..fa5d6e3 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/DispositionRecordServiceImpl.java @@ -0,0 +1,46 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.DispositionRecordMapper; +import com.qiwu.inference.pojo.DispositionRecord; +import com.qiwu.inference.service.DispositionRecordService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class DispositionRecordServiceImpl extends ServiceImpl implements DispositionRecordService { + + + @Override + public List getDispositionRecords(Integer subject, Integer dispositionId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(DispositionRecord::getSubject,subject); + wrapper.lambda().eq(DispositionRecord::getDispositionId,dispositionId); + return list(wrapper); + } + + @Override + public List getDispositionRecords(Integer subject) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(DispositionRecord::getSubject,subject); + return list(wrapper); + } + + @Override + public List getDispositionRecordsNoSubject(Integer subject, Integer dispositionId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(DispositionRecord::getDispositionId,dispositionId); + wrapper.lambda().ne(DispositionRecord::getSubject,subject); + return list(wrapper); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/DispositionServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/DispositionServiceImpl.java new file mode 100755 index 0000000..98c2943 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/DispositionServiceImpl.java @@ -0,0 +1,30 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.DispositionMapper; +import com.qiwu.inference.pojo.Disposition; +import com.qiwu.inference.service.DispositionService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class DispositionServiceImpl extends ServiceImpl implements DispositionService { + + + @Override + public List getDispositions(Integer type) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(Disposition::getType,type); + return list(wrapper); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/DispositionTypeServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/DispositionTypeServiceImpl.java new file mode 100755 index 0000000..ea03472 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/DispositionTypeServiceImpl.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.DispositionTypeMapper; +import com.qiwu.inference.pojo.DispositionType; +import com.qiwu.inference.service.DispositionTypeService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-04 + */ +@Service +public class DispositionTypeServiceImpl extends ServiceImpl implements DispositionTypeService { + +} diff --git a/src/main/java/com/qiwu/inference/service/impl/EndGoalServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/EndGoalServiceImpl.java new file mode 100755 index 0000000..f76ef93 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/EndGoalServiceImpl.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.EndGoalMapper; +import com.qiwu.inference.pojo.EndGoal; +import com.qiwu.inference.service.EndGoalService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class EndGoalServiceImpl extends ServiceImpl implements EndGoalService { + +} diff --git a/src/main/java/com/qiwu/inference/service/impl/IdentityServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/IdentityServiceImpl.java new file mode 100755 index 0000000..84349a9 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/IdentityServiceImpl.java @@ -0,0 +1,29 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.IdentityMapper; +import com.qiwu.inference.pojo.Identity; +import com.qiwu.inference.service.IdentityService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class IdentityServiceImpl extends ServiceImpl implements IdentityService { + + @Override + public List getIdentitys(String keyIdentity) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(Identity::getKeyIdentity,keyIdentity); + return list(wrapper); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/ItemServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/ItemServiceImpl.java new file mode 100755 index 0000000..6dceefb --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/ItemServiceImpl.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.ItemMapper; +import com.qiwu.inference.pojo.Item; +import com.qiwu.inference.service.ItemService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class ItemServiceImpl extends ServiceImpl implements ItemService { + +} diff --git a/src/main/java/com/qiwu/inference/service/impl/KeyClueServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/KeyClueServiceImpl.java new file mode 100755 index 0000000..9e644b9 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/KeyClueServiceImpl.java @@ -0,0 +1,29 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.KeyClueMapper; +import com.qiwu.inference.pojo.KeyClue; +import com.qiwu.inference.service.KeyClueService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class KeyClueServiceImpl extends ServiceImpl implements KeyClueService { + + @Override + public List getKeyClues(String clueGroup) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(KeyClue::getClueGroup,clueGroup); + return list(wrapper); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/LocationServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/LocationServiceImpl.java new file mode 100755 index 0000000..5a1dece --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/LocationServiceImpl.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.LocationMapper; +import com.qiwu.inference.pojo.Location; +import com.qiwu.inference.service.LocationService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class LocationServiceImpl extends ServiceImpl implements LocationService { + +} diff --git a/src/main/java/com/qiwu/inference/service/impl/MonikerServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/MonikerServiceImpl.java new file mode 100755 index 0000000..699ac29 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/MonikerServiceImpl.java @@ -0,0 +1,29 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.MonikerMapper; +import com.qiwu.inference.pojo.Moniker; +import com.qiwu.inference.service.MonikerService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class MonikerServiceImpl extends ServiceImpl implements MonikerService { + + @Override + public List getMonikers(Integer gender) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(Moniker::getGender,gender); + return list(wrapper); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/PersonRecordServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/PersonRecordServiceImpl.java new file mode 100755 index 0000000..7be7fec --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/PersonRecordServiceImpl.java @@ -0,0 +1,48 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.PersonRecordMapper; +import com.qiwu.inference.pojo.PersonRecord; +import com.qiwu.inference.service.PersonRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class PersonRecordServiceImpl extends ServiceImpl implements PersonRecordService { + + @Autowired + PersonRecordMapper personRecordMapper; + @Override + public List getPersonRecords(String gateNo) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(PersonRecord::getGateNo,gateNo); + return list(wrapper); + } + + + + + @Override + public List getPersonRecordsNoSubject(Integer subject, Integer identityId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(PersonRecord::getIdentityId,identityId); + wrapper.lambda().ne(PersonRecord::getId,subject); + return list(wrapper); + } + + @Override + public List getGateNo() { + return personRecordMapper.getGateNo(); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/RelationRecordServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/RelationRecordServiceImpl.java new file mode 100755 index 0000000..686b840 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/RelationRecordServiceImpl.java @@ -0,0 +1,63 @@ +package com.qiwu.inference.service.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.RelationRecordMapper; +import com.qiwu.inference.pojo.RelationRecord; +import com.qiwu.inference.service.RelationRecordService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class RelationRecordServiceImpl extends ServiceImpl implements RelationRecordService{ + + @Override + public List getRelationRecords(Integer subject) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(RelationRecord::getSubject,subject); + return list(wrapper); + } + + @Override + public List getRelationRecordsNoSubject(Integer subject, Integer relationId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(RelationRecord::getRelationId,relationId); + wrapper.lambda().and(tmp ->tmp.ne(RelationRecord::getSubject, subject).or().ne(RelationRecord::getObject, subject)); + return list(wrapper); + } + + @Override + public Boolean isExistsRelationTypes(Integer subject, Integer object,Integer type) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("subject",subject); + wrapper.eq("object",object); + wrapper.eq("type",type); + return list(wrapper).size() > 0; + } + + @Override + public List getInverseRelationRecords(Integer object) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(RelationRecord::getObject,object); + return list(wrapper); + } + + @Override + public Boolean isExists(Integer subject, Integer object, Integer relationId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("subject",subject); + wrapper.eq("object",object); + wrapper.eq("relation_id",relationId); + return list(wrapper).size() > 0; + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/RelationServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/RelationServiceImpl.java new file mode 100755 index 0000000..373d42e --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/RelationServiceImpl.java @@ -0,0 +1,44 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.RelationMapper; +import com.qiwu.inference.pojo.Relation; +import com.qiwu.inference.service.RelationService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-03 + */ +@Service +public class RelationServiceImpl extends ServiceImpl implements RelationService { + + @Override + public List getRelations(Integer type) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(Relation::getType,type); + return list(wrapper); + } + + @Override + public Boolean isExists(String[] relationIds) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.in("id",relationIds); + return list(wrapper).size() > 0; + } + + + @Override + public List getRelations(String[] relationIds) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.in("id",relationIds); + return list(wrapper); + } +} diff --git a/src/main/java/com/qiwu/inference/service/impl/RelationTypeServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/RelationTypeServiceImpl.java new file mode 100755 index 0000000..3ff620e --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/RelationTypeServiceImpl.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.RelationTypeMapper; +import com.qiwu.inference.pojo.RelationType; +import com.qiwu.inference.service.RelationTypeService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-03 + */ +@Service +public class RelationTypeServiceImpl extends ServiceImpl implements RelationTypeService { + +} diff --git a/src/main/java/com/qiwu/inference/service/impl/SurnameServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/SurnameServiceImpl.java new file mode 100755 index 0000000..2bd9a46 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/SurnameServiceImpl.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.SurnameMapper; +import com.qiwu.inference.pojo.Surname; +import com.qiwu.inference.service.SurnameService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class SurnameServiceImpl extends ServiceImpl implements SurnameService { + +} diff --git a/src/main/java/com/qiwu/inference/service/impl/TaskConditionServiceImpl.java b/src/main/java/com/qiwu/inference/service/impl/TaskConditionServiceImpl.java new file mode 100755 index 0000000..19a8c72 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/impl/TaskConditionServiceImpl.java @@ -0,0 +1,20 @@ +package com.qiwu.inference.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.qiwu.inference.dao.TaskConditionMapper; +import com.qiwu.inference.pojo.TaskCondition; +import com.qiwu.inference.service.TaskConditionService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Service +public class TaskConditionServiceImpl extends ServiceImpl implements TaskConditionService { + +} diff --git a/src/main/java/com/qiwu/inference/service/login/LoginService.java b/src/main/java/com/qiwu/inference/service/login/LoginService.java new file mode 100644 index 0000000..e85c0dc --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/login/LoginService.java @@ -0,0 +1,10 @@ +package com.qiwu.inference.service.login; + +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.CommonResponse; +import com.qiwu.inference.dto.response.ResultVarsResponse; + +public interface LoginService { + CommonResult login(String uid); +} diff --git a/src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java b/src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java new file mode 100644 index 0000000..a924649 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java @@ -0,0 +1,82 @@ +package com.qiwu.inference.service.login.impl; + +import cn.hutool.core.lang.UUID; +import com.alibaba.fastjson.JSON; +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.common.utils.*; +import com.qiwu.inference.dto.Person; +import com.qiwu.inference.dto.Player; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.*; +import com.qiwu.inference.service.login.LoginService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Service +public class LoginServiceImpl implements LoginService { + //从yml配置文件中取出对话过期时间 + @Value("${expireTime}") + private String expireTime; + @Value("${userFilePath}") + private String userFilePath; + + @Override + public CommonResult login(String uid) { + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + //存放玩家数据 + Map sidGateNoMap = new ConcurrentHashMap<>(); + + Player player = new Player(); + player.setSid(uid); + player.setStatus(Constants.ONLINE); + player.setOnlineTime(DateUtil.getCurrentTime()); + //给玩家分配场所和对话人物 + Map> locationPersonMap = new HashMap<>(); + Map personMap = player.getPersonMap(); + for (Map.Entry entry : personMap.entrySet()) { + Person person = entry.getValue(); + if (!StringUtils.isEmpty(person.getLocation())) { + //没有当前场所 + if (StringUtils.isEmpty(locationPersonMap.get(person.getLocation()))) { + List personList = new ArrayList<>(); + personList.add(entry.getKey()); + locationPersonMap.put(person.getLocation(), personList); + } + //有当前场所,但是没有这个人 + List persons = locationPersonMap.get(person.getLocation()); + if (!persons.contains(entry.getKey())) { + persons.add(entry.getKey()); + } + } + } + List locationList = new ArrayList<>(locationPersonMap.keySet()); + int index = RandomUtil.randomInt(locationList.size()); + String locationId = locationList.get(index); + player.setLocation(locationId); + //随机分配人物 + List personList = locationPersonMap.get(locationId); + int num = RandomUtil.randomInt(personList.size()); + player.setPersonId(personList.get(num)); + TimingAcquisition.playerMap.put(uid, player); + String playerStr = JSON.toJSONString(player); + //持久化玩家数据 + PersistenceUtil.saveDataToFile(userFilePath, uid, playerStr); + sidGateNoMap.put(uid, player.getGateNo()); + TimingAcquisition.uidGateNoMap.putAll(sidGateNoMap); + + resultResponse.set反馈ID(100000); + resultResponse.set反馈文本("登录成功"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } +} diff --git a/src/main/java/com/qiwu/inference/service/player/PlayerService.java b/src/main/java/com/qiwu/inference/service/player/PlayerService.java new file mode 100755 index 0000000..944edb1 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/player/PlayerService.java @@ -0,0 +1,63 @@ +package com.qiwu.inference.service.player; + +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultVarsResponse; + +public interface PlayerService { + /** + * 询问性格 + * @param request + * @return + */ + public CommonResult askDisposition(OperationRequest request); + + /** + * 询问关系 + * @param request + * @return + */ + public CommonResult askRelation(OperationRequest request); + + /** + * 询问行为 + * @param request + * @return + */ + public CommonResult askBehaviour(OperationRequest request); + /** + * 询问任务 + * @param request + * @return + */ + public CommonResult askTask(OperationRequest request); + + /** + * 询问身份 + * @param request + * @return + */ + public CommonResult askIdentity(OperationRequest request); + + /** + * 询问场所 + * @param request + * @return + */ + public CommonResult askLocation(OperationRequest request); + + /** + * 询问提示 + * @param request + * @return + */ + public CommonResult askPrompt(OperationRequest request); + + /** + * 执行任务 + * @param request + * @return + */ + public CommonResult performTask(OperationRequest request); + +} diff --git a/src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java b/src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java new file mode 100644 index 0000000..292166a --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java @@ -0,0 +1,5837 @@ +package com.qiwu.inference.service.player.impl; + +import com.alibaba.fastjson.JSON; +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.api.CommonData; +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.common.utils.*; +import com.qiwu.inference.dto.ClueDto; +import com.qiwu.inference.dto.DemandTaskDto; +import com.qiwu.inference.dto.Person; +import com.qiwu.inference.dto.Player; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultResponse; +import com.qiwu.inference.dto.response.ResultVarsResponse; +import com.qiwu.inference.pojo.Clue; +import com.qiwu.inference.service.player.PlayerService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import static com.qiwu.inference.common.utils.PlayerUtil.addThreshold; + +@Service +public class PlayerServiceImpl implements PlayerService { + @Value("${userFilePath}") + private String userFilePath; + //对话过期时间 + @Value("${expireTime}") + private String expireTime; + /** + * 询问性格 + * @param request + * @return + */ + public CommonResult askDisposition(OperationRequest request){ + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = request.getUid(); + String methodId = request.getMethodId(); + String subjectName = request.getSubjectName(); + String type = request.getDispositionType(); + String dispositionName = request.getDispositionName(); + + Player player = TimingAcquisition.playerMap.get(uid); + //当前对话的人物 + Person current = player.getPersonMap().get(player.getPersonId()); + + if("1001".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if(StringUtils.isEmpty(type)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100002); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100002); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer personId = player.getName2IdMap().get(subjectName); + Person subject = player.getPersonMap().get(personId); + //查找符合条件的线索 + List clueList = findClues(current, subject,3); + if (clueList.size() == 0) { + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100103); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current,clueList); + if(clueList.size() == 0){ + String text = ""; + //对话本人 + if (personId.equals(player.getPersonId())) { + //获取对应话术 + text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 10010201); + } else { + //获取对应话术 + text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100102); + } + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //判断是否为指定性格类型的线索 + clueList = PlayerUtil.checkClueType(clueList, type); + if (clueList.size() == 0) { + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100103); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(10010301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, personId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100101); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(100101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1002".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if(StringUtils.isEmpty(dispositionName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100003); + resultResponse.set反馈ID(100003); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer personId = player.getName2IdMap().get(subjectName); + Person subject =player.getPersonMap().get(personId); + //查找符合条件的线索 + List clueList = findClues(current,subject,3); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100204); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100204); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList=checkThreshold(current, clueList); + if(clueList.size() == 0){ + String text = ""; + //对话本人 + if (personId.equals(player.getPersonId())) { + //获取对应话术 + text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 10020301); + } else { + //获取对应话术 + text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100203); + } + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100203); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查找符合条件的线索 + clueList = findClues(clueList,dispositionName); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100204); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, dispositionName); + resultResponse.set反馈ID(100204); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, personId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100201); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(100201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + return CommonResult.failed("询问性格失败!"); + } + + /** + * 询问关系 + * @param request + * @return + */ + public CommonResult askRelation(OperationRequest request){ + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = request.getUid(); + String methodId = request.getMethodId(); + String subjectName = request.getSubjectName(); + String objectName = request.getObjectName(); + String relationName = request.getRelationName(); + + Player player = TimingAcquisition.playerMap.get(uid); + if (StringUtils.isEmpty(objectName)) { + objectName = TimingAcquisition.getTalkName(uid); //当前正在对话的人 + } + //当前对话的人物 + Person current = player.getPersonMap().get(player.getPersonId()); + + if("1003".equals(methodId)){ + if(StringUtils.isEmpty(subjectName) || StringUtils.isEmpty(objectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Integer objectId = player.getName2IdMap().get(objectName); + Person subject =player.getPersonMap().get(subjectId); + Person object =player.getPersonMap().get(objectId); + + //查找符合条件的线索 + List clueList = findClues(current, subject, object,5); + if(clueList.size() == 0){ + String text = ""; + if (subjectId.equals(player.getPersonId())) { + text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 10030301); + text = SpeechUtil.speechReplaceNum(text, objectName); + } else if (objectId.equals(player.getPersonId())) { + text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 10030301); + text = SpeechUtil.speechReplaceNum(text, subjectName); + } else { + //获取对应话术 + text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100303); + } + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + String text = ""; + //对话本人 + if (subjectId.equals(player.getPersonId()) || objectId.equals(player.getPersonId())) { + //获取对应话术 + text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 10030201); + } else { + //获取对应话术 + text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100302); + } + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100302); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } +// StringBuilder builder = new StringBuilder(); +// for (ClueDto clue : clueList) { +// builder.append(clue.getClueTemplate()); +// } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100301); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(100301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1004".equals(methodId)){ + if(StringUtils.isEmpty(subjectName) || StringUtils.isEmpty(objectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + + if(StringUtils.isEmpty(relationName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100004); + resultResponse.set反馈ID(100004); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Integer objectId = player.getName2IdMap().get(objectName); + Person subject =player.getPersonMap().get(subjectId); + Person object =player.getPersonMap().get(objectId); + //查找符合条件的线索 + List clueList = findClues(current, subject, object,5); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100404); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100404); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100403); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100403); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int num = RandomUtil.randomInt(clueList.size()); + String context = clueList.get(num).getClueTemplate(); + //查找符合条件的线索 + clueList = findClues(clueList, relationName); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100402); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(100402); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100401); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(100401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1005".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + + if(StringUtils.isEmpty(relationName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100004); + resultResponse.set反馈ID(100004); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Person subject =player.getPersonMap().get(subjectId); + + //查找符合条件的线索 + List clueList = findClues(current,5); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100503); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100502); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100502); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查找符合条件的线索 + clueList=findClues(clueList,relationName); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100503); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + StringBuilder builder = new StringBuilder(); + for (ClueDto clue : clueList) { + if (!StringUtils.isEmpty(clue.getObject())) { + builder.append(player.getPersonMap().get(clue.getObject()).getName() + "跟" + subjectName + "有" + clue.getClueName() + "关系。"); + } + } + if(StringUtils.isEmpty(builder.toString())){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100503); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100501); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(100501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1006".equals(methodId)){ + if(StringUtils.isEmpty(relationName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100004); + resultResponse.set反馈ID(100004); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + StringBuilder builder = new StringBuilder(); + List clueList = new ArrayList<>(); + for(Integer key:player.getPersonMap().keySet()){ + Person person = player.getPersonMap().get(key); + clueList.addAll(findClues(person,5)); + } + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100603); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100602); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查找符合条件的线索 + clueList=findClues(clueList,relationName); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100603); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + for (ClueDto clue : clueList) { + builder.append(clue.getClueTemplate()); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, clueList.get(index).getSubject(), clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100601); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(100602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + return CommonResult.failed("询问关系失败!"); + } + + /** + * 询问行为 + * @param request + * @return + */ + public CommonResult askBehaviour(OperationRequest request){ + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = request.getUid(); + String methodId = request.getMethodId(); + String subjectName = request.getSubjectName(); + String objectName = request.getObjectName(); + String behaviourName = request.getBehaviourName(); + + Player player = TimingAcquisition.playerMap.get(uid); + //当前对话的人物 + Person current = player.getPersonMap().get(player.getPersonId()); + //询问当前对话的人 + if (StringUtils.isEmpty(subjectName)) { + subjectName = current.getName(); + } + + if("1007".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Person person =player.getPersonMap().get(subjectId); + Person subject =player.getPersonMap().get(subjectId); + //查找符合条件的线索 + List clueList = findClues(current, subject,4); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100703); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100703); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100702); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100702); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100701); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(100701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1008".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)||StringUtils.isEmpty(objectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Integer objectId = player.getName2IdMap().get(objectName); + Person subject =player.getPersonMap().get(subjectId); + Person object =player.getPersonMap().get(objectId); + + //查找符合条件的线索 + List clueList = findClues(current, subject, object,4); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100803); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100802); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100802); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100801); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(100801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } else if("1009".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + + if(StringUtils.isEmpty(behaviourName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100005); + resultResponse.set反馈ID(100005); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Person subject =player.getPersonMap().get(subjectId); + List clueList = findClues(current, subject,4); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100903); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100902); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100902); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + clueList = findClues(clueList, behaviourName); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100903); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100901); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(100901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1010".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if(StringUtils.isEmpty(behaviourName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100005); + resultResponse.set反馈ID(100005); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Person subject =player.getPersonMap().get(subjectId); + List clueList = findClues(current, subject,4); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101004); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101004); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101003); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101003); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int num = RandomUtil.randomInt(clueList.size()); + String context = clueList.get(num).getClueTemplate(); + //查找符合条件的线索 + clueList = findClues(clueList, behaviourName); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101002); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(101002); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101001); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(101001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1011".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)||StringUtils.isEmpty(objectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if(StringUtils.isEmpty(behaviourName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100005); + resultResponse.set反馈ID(100005); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Integer objectId = player.getName2IdMap().get(objectName); + Person subject =player.getPersonMap().get(subjectId); + Person object =player.getPersonMap().get(objectId); + + //查找符合条件的线索 + List clueList = findClues(current,subject,object,4); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101104); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101103); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int num = RandomUtil.randomInt(clueList.size()); + String context = clueList.get(num).getClueTemplate(); + //查找符合条件的线索 + clueList = findClues(clueList, behaviourName); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101102); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(101102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101101); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(101101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + return CommonResult.failed("询问行为失败!"); + } + /** + * 询问任务 + * @param request + * @return + */ + public CommonResult askTask(OperationRequest request){ + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = request.getUid(); + String methodId = request.getMethodId(); + String subjectName = request.getSubjectName(); + String taskConditionId = request.getTaskConditionId(); + + Player player = TimingAcquisition.playerMap.get(uid); + //当前对话的人物 + Person current = player.getPersonMap().get(player.getPersonId()); + //询问对象为对话人 + if(StringUtils.isEmpty(subjectName)){ + subjectName = current.getName(); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Person person = player.getPersonMap().get(subjectId); + + if("1015".equals(methodId)){ + //查找符合条件的任务 + List clueList = PlayerUtil.getCluesByType(uid, subjectId, 1); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101503); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查线索是否符合阈值要求 + clueList = PlayerUtil.checkTaskThreshold(uid, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101502); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101502); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101501); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(101501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1016".equals(methodId)){ + //查找符合条件的任务 + List clueList = PlayerUtil.getCluesByType(uid, subjectId, 3); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101603); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查线索是否符合阈值要求 + clueList = PlayerUtil.checkTaskThreshold(uid, clueList); + if(clueList.size()==0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101602); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101601); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(101601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1017".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查找符合条件的任务 + List clueList = PlayerUtil.getClueByTypeAndTaskId(uid, subjectId, taskConditionId); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101704); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101704); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查线索是否符合阈值要求 + clueList = PlayerUtil.checkTaskThreshold(uid, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101703); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101703); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int num = RandomUtil.randomInt(clueList.size()); + String context = clueList.get(num).getClueTemplate(); + //判断任务是否为提升信任值 + clueList = PlayerUtil.getCluesIsType(uid, subjectId, clueList, 1); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101702); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(101702); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101701); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(101701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1018".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查找符合条件的任务 + List clueList = PlayerUtil.getClueByTypeAndTaskId(uid, subjectId, taskConditionId); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101804); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101804); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查线索是否符合阈值要求 + clueList = PlayerUtil.checkTaskThreshold(uid, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101803); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int num = RandomUtil.randomInt(clueList.size()); + String context = clueList.get(num).getClueTemplate(); + //判断任务是否为提升信任值 + clueList = PlayerUtil.getCluesIsType(uid, subjectId, clueList, 3); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101802); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(101802); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101801); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(101801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1019".equals(methodId)){ + //查找符合条件的任务 + List clueList = PlayerUtil.getCluesByType(uid, subjectId, 2); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101903); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查线索是否符合阈值要求 + clueList = PlayerUtil.checkTaskThreshold(uid, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101902); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(101902); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101901); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(101901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1020".equals(methodId)){ + //查找符合条件的任务 + List clueList = PlayerUtil.getCluesByType(uid, subjectId, 4); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102003); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102003); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查线索是否符合阈值要求 + clueList = PlayerUtil.checkTaskThreshold(uid, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102002); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102002); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102001); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(102001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1021".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查找符合条件的任务 + List clueList = PlayerUtil.getClueByTypeAndTaskId(uid, subjectId, taskConditionId); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102104); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查线索是否符合阈值要求 + clueList = PlayerUtil.checkTaskThreshold(uid, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102103); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int num = RandomUtil.randomInt(clueList.size()); + String context = clueList.get(num).getClueTemplate(); + //判断任务是否为提升信任值 + clueList = PlayerUtil.getCluesIsType(uid, subjectId, clueList, 2); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102102); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(102102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102101); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(102101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1022".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //查找符合条件的任务 + List clueList = PlayerUtil.getClueByTypeAndTaskId(uid, subjectId, taskConditionId); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102204); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102204); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查线索是否符合阈值要求 + clueList = PlayerUtil.checkTaskThreshold(uid, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102203); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102203); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int num = RandomUtil.randomInt(clueList.size()); + String context = clueList.get(num).getClueTemplate(); + //判断任务是否为提升信任值 + clueList = PlayerUtil.getCluesIsType(uid, subjectId, clueList, 4); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102202); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(102202); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102201); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(102201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + return CommonResult.failed("询问任务失败!"); + } + + /** + * 询问身份 + * @param request + * @return + */ + public CommonResult askIdentity(OperationRequest request){ + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = request.getUid(); + String methodId = request.getMethodId(); + String subjectName = request.getSubjectName(); + String identityName = request.getIdentityName(); + + Player player = TimingAcquisition.playerMap.get(uid); + //当前对话的人物 + Person current = player.getPersonMap().get(player.getPersonId()); + + if("1023".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Person subject =player.getPersonMap().get(subjectId); + //查找符合条件的线索 + List clueList = findClues(current,subject,1); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102303); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102302); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102302); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102301); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(102301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1024".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if(StringUtils.isEmpty(identityName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100006); + resultResponse.set反馈ID(100006); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Person subject =player.getPersonMap().get(subjectId); + //查找符合条件的线索 + List clueList = findClues(current, subject,1); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102404); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102404); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102403); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102403); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int num = RandomUtil.randomInt(clueList.size()); + String context = clueList.get(num).getClueTemplate(); + //查找符合条件的线索 + clueList = findClues(clueList, identityName); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102402); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(102402); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102401); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(102401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + return CommonResult.failed("询问身份失败!"); + } + + + /** + * 询问场所 + * @param request + * @return + */ + public CommonResult askLocation(OperationRequest request){ + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = request.getUid(); + String methodId = request.getMethodId(); + String subjectName = request.getSubjectName(); + String locationName = request.getLocationName(); + + Player player = TimingAcquisition.playerMap.get(uid); + //当前对话的人物 + Person current = player.getPersonMap().get(player.getPersonId()); + + if("1025".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Person subject =player.getPersonMap().get(subjectId); + //查找符合条件的线索 + List clueList = findClues(current, subject, 2); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102503); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102502); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102502); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102501); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(102501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + }else if("1026".equals(methodId)){ + if(StringUtils.isEmpty(subjectName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); + resultResponse.set反馈ID(100001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if(StringUtils.isEmpty(locationName)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100007); + resultResponse.set反馈ID(100007); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer subjectId = player.getName2IdMap().get(subjectName); + Person subject =player.getPersonMap().get(subjectId); + + //查找符合条件的线索 + List clueList = findClues(current,subject,2); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102604); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102604); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //检查是否符合阈值要求 + clueList = checkThreshold(current, clueList); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102603); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int num = RandomUtil.randomInt(clueList.size()); + String context = clueList.get(num).getClueTemplate(); + //查找符合条件的线索 + clueList=findClues(clueList,locationName); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102602); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(102602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102601); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + resultResponse.set反馈ID(102601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + return CommonResult.failed("询问场所失败!"); + } + + + + /** + * 询问提示 + * @param request + * @return + */ + public CommonResult askPrompt(OperationRequest request){ + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = request.getUid(); + String methodId = request.getMethodId(); + String subjectName = request.getSubjectName(); + + Player player = TimingAcquisition.playerMap.get(uid); + //当前对话的人物 + Person current = player.getPersonMap().get(player.getPersonId()); + request.setOperate(Constants.OPERATE_ASK); + if("1027".equals(methodId)){ +// if(StringUtils.isEmpty(subjectName)){ +// return CommonResult.failed("用户名称不能为空!"); +// } +// Integer subjectId = player.getName2IdMap().get(subjectName); +// Person subject =player.getPersonMap().get(subjectId); +// //查找符合条件的线索 +// List clueList = findClues(current, subject,5); +// //检查是否符合阈值要求 +// clueList = checkThreshold(current, clueList); +// if(clueList.size() == 0){ + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + if (Constants.OPERATE_ASK.equals(lastReq.getOperate())) { + if (!StringUtils.isEmpty(lastReq.getPersonIdList())) { + List personIdList = lastReq.getPersonIdList(); + int index = lastReq.getIndex(); + String objectName = PlayerUtil.getNameByPersonId(uid, personIdList.get(index)); + //保存本轮对话 + index = (index + 1) % personIdList.size(); + request.setPersonIdList(personIdList); + request.setIndex(index); + CacheUtil.put(uid, request, Long.parseLong(expireTime)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102701); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, objectName); + resultResponse.set反馈ID(102701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + List personIdList = PlayerUtil.getRelativePersonIds(uid, player.getPersonId()); + if (personIdList.size() == 0) { + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102702); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(102702); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + int index = 0; + String objectName = PlayerUtil.getNameByPersonId(uid, personIdList.get(index)); + //保存本轮对话 + index = (index + 1) % personIdList.size(); + request.setPersonIdList(personIdList); + request.setIndex(index); + CacheUtil.put(uid, request, Long.parseLong(expireTime)); + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102701); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, objectName); + resultResponse.set反馈ID(102701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + return CommonResult.failed("询问提示失败!"); + } + + + + + /** + * 执行任务 + * @param request + * @return + */ + public CommonResult performTask(OperationRequest request){ + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String sid = request.getUid(); + String methodId = request.getMethodId(); + String taskConditionId = request.getTaskConditionId(); + + Player player = TimingAcquisition.playerMap.get(sid); + Integer subjectId = player.getPersonId(); + //当前对话的人物 + Person subject = player.getPersonMap().get(subjectId); + //第三人称 + Integer gender = player.getPersonMap().get(subjectId).getGender(); + String call = (gender == 1) ? "他" : "她"; + //货币配置名称 + String moneyName = TimingAcquisition.systemConfigMap.get("money").getValue(); + if(StringUtils.isEmpty(taskConditionId)){ + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200001); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if("2001".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200104); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, String.valueOf((int) value), moneyName); + resultResponse.set反馈ID(200104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition,deterrenceCondition,subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200105); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200105); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } else { + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200102); + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200102); + text = SpeechUtil.replaceHeader(personText, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, personText, subject.getName()); + resultResponse.set反馈ID(200102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200101); + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200101); + text = SpeechUtil.replaceHeader(personText, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), personText, String.valueOf(value), demandTask.getTrustDegree()); + resultResponse.set反馈ID(200101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200101); + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200101); + text = SpeechUtil.replaceHeader(personText, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), personText, String.valueOf(value), demandTask.getTrustDegree()); + resultResponse.set反馈ID(200101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + //玩家没有挂相关任务 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200106); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200106); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2002".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200203); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200203); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200203); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + if (num >= Integer.parseInt(condition1[1])) { + //符合阈值需求,已达次数上限 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200202); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200202); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //ThreadLocalUtil.add(sid,player); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200201); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200201); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200201); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200201); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200204); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200204); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2003".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200303); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + resultResponse.set反馈ID(200303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200304); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200304); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } else { + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200102); + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200102); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), personText); + resultResponse.set反馈ID(200102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //ThreadLocalUtil.add(sid,player); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200301); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200301); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(200301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200301); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200301); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(200301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200305); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200305); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2004".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200403); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(200403); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200404); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200404); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } else { + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200402); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200402); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200401); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200401); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName()); + resultResponse.set反馈ID(200401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200401); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200401); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName()); + resultResponse.set反馈ID(200401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200405); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200405); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2005".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200503); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200502); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200502); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200501); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200501); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200504); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200504); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2006".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200603); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200603); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(200603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200602); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200602); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(200602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //ThreadLocalUtil.add(sid,player); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200601); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200601); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree(), demandTask.getDeterrenceDegree()); + resultResponse.set反馈ID(200601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200601); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200601); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree(), demandTask.getDeterrenceDegree()); + resultResponse.set反馈ID(200601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200604); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2007".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200703); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200703); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200703); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200704); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200704); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200702); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200702); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200702); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200701); + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200701); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value), personText, demandTask.getTrustDegree()); + resultResponse.set反馈ID(200701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200701); + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200701); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value), personText, demandTask.getTrustDegree()); + resultResponse.set反馈ID(200701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200705); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200705); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2008".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + int value = 0; + if (!StringUtils.isEmpty(condition2)) { + value = Integer.parseInt(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200803); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + resultResponse.set反馈ID(200803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200804); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200804); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200804); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200802); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200802); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName(), personText); + resultResponse.set反馈ID(200802); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200801); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200801); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName(), personText, demandTask.getTrustDegree()); + resultResponse.set反馈ID(200801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200801); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200801); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName(), personText, demandTask.getTrustDegree()); + resultResponse.set反馈ID(200801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200805); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200805); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2009".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200903); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200902); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200902); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), call); + resultResponse.set反馈ID(200902); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //玩家数据持久化 +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200901); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200901); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), call, demandTask.getTrustDegree()); + resultResponse.set反馈ID(200901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + //玩家数据持久化 +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200901); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200901); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), call, demandTask.getTrustDegree()); + resultResponse.set反馈ID(200901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200904); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(200904); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2010".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201003); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201003); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + //获得的奖励 + String completionReward = demandTask.getCompletionReward(); + int value = 0; + if (!StringUtils.isEmpty(completionReward)) { + value = Integer.parseInt(completionReward); + } + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201002); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201002); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value)); + resultResponse.set反馈ID(201002); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //玩家数据持久化 +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201001); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201001); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree(), String.valueOf(value)); + resultResponse.set反馈ID(201001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201001); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201001); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree(), String.valueOf(value)); + resultResponse.set反馈ID(201001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201004); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201004); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2011".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201102); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //------玩家数据持久化------ +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201101); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201101); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + //------玩家数据持久化------ +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201101); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201101); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201104); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2012".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201203); + resultResponse.set反馈ID(201203); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201204); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201204); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201202); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201202); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), call); + resultResponse.set反馈ID(201202); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201201); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201201); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201201); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201201); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201205); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201205); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2013".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201303); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201303); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + resultResponse.set反馈ID(201303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201304); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201304); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201302); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201302); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201301); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201301); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + resultResponse.set反馈ID(201301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201301); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201301); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + resultResponse.set反馈ID(201301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201305); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201305); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2014".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201403); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201403); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201404); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201404); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201402); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201402); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201401); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201401); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value)); + resultResponse.set反馈ID(201401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + //-------玩家数据持久化-------- +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201401); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201401); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value)); + resultResponse.set反馈ID(201401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201405); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201405); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2015".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201503); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201504); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201504); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201502); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201502); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), call); + resultResponse.set反馈ID(201502); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //------玩家数据持久化-------- +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201501); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201501); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201501); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201501); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201505); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201505); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2016".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201603); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + resultResponse.set反馈ID(201603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201604); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201604); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201602); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //------玩家数据持久化------ +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201601); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201601); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName()); + resultResponse.set反馈ID(201601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + //------玩家数据持久化------ +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201601); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201601); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName()); + resultResponse.set反馈ID(201601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201605); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201605); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2017".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201703); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201703); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201702); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201702); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //------玩家数据持久化------- +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201701); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201701); + text = SpeechUtil.speechReplaceNum(text, personText, subject.getName(), call, + demandTask.getDeterrenceDegree(), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + //------玩家数据持久化------- +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201701); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201701); + text = SpeechUtil.speechReplaceNum(text, personText, subject.getName(), call, + demandTask.getDeterrenceDegree(), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201704); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201704); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2018".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201803); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201802); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201802); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //-----玩家数据持久化----- +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201801); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201801); + text = SpeechUtil.speechReplaceNum(personText, subject.getName(), call, demandTask.getDeterrenceDegree(), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + //-----玩家数据持久化----- +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201801); + personText = SpeechUtil.replaceHeader(personText, subject.getName()); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201801); + text = SpeechUtil.speechReplaceNum(personText, subject.getName(), call, demandTask.getDeterrenceDegree(), demandTask.getTrustDegree()); + resultResponse.set反馈ID(201801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201804); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201804); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2019".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201903); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201902); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201902); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //------玩家数据持久化------- +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201901); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201901); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(201901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + //------玩家数据持久化------- +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + //ThreadLocalUtil.add(sid,player); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201901); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201901); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(201901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201904); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(201904); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } else if ("2020".equals(methodId)) { + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202003); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202003); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202002); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202002); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + PlayerUtil.addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202001); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202001); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202004); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202004); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } else if ("2021".equals(methodId)) { + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202102); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202101); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202101); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202104); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2022".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202203); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202203); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202202); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202202); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202201); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202201); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202204); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202204); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2023".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202303); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202302); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202302); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202301); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202301); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202304); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202304); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2024".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + double value = 0.0; + if (!StringUtils.isEmpty(condition2)) { + value = Double.parseDouble(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202403); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202403); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202404); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202404); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202402); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, demandTask.getName()); + resultResponse.set反馈ID(202402); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (value > 0) { + player.setCurrency(currency - value); + } + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202401); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.getNameByPersonId(sid, demandTask.getObject())); + resultResponse.set反馈ID(202401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (value > 0) { + player.setCurrency(currency - value); + } + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202401); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202405); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202405); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2025".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 202504); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202504); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202504); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202502); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202502); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { + if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202501); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), call); + resultResponse.set反馈ID(202501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202503); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202501); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(202501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202503); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202506); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202506); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2026".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 202604); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202604); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202604); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202602); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { + if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202601); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(202601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202603); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202601); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(202601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202603); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202605); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202605); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2027".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 202704); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202704); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202704); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } else { + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202702); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202702); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { + if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202701); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(202701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202703); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202703); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + List list = new ArrayList<>(); + list.add(demandTask); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202701); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(202701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202703); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202703); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202705); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202705); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2028".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 202804); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202804); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202804); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202802); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202802); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { + if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202801); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(202801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202803); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202801); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(202801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202803); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202805); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202805); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2029".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202904); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202904); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202902); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202902); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { + if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202901); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), + call, demandTask.getCompletionReward(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(202901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202903); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202901); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), + call, demandTask.getCompletionReward(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(202901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202903); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202905); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202905); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2030".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203003); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203003); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203002); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203002); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203001); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(203001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203001); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(203001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + }else if("2031".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203104); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203102); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203101); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), + String.valueOf(deterrenceDegree), demandTask.getCompletionReward()); + resultResponse.set反馈ID(203101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203101); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), + String.valueOf(deterrenceDegree), demandTask.getCompletionReward()); + resultResponse.set反馈ID(203101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203105); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203105); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2032".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203203); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 203203); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(203203); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203202); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203202); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203201); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203201); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203201); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203204); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203204); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2033".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203304); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203304); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203302); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203302); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203301); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(203301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203303); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203301); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(203301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203303); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203305); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203305); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2034".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203403); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 203403); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(203403); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203402); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203402); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203401); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), call, + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203401); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), call, + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203401); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203404); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203404); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2035".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203504); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 203504); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(203504); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否已达次数上限 + if (taskMap.containsKey(subjectId)) { + Map map =taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203502); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(203502); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(),num+1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203501); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(203501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(),1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject,demandTask); + if(!StringUtils.isEmpty(demandTask.getCompletionReward())){ + player.setCurrency(player.getCurrency()+Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203501); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(203501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203505); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203505); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2036".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203604); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203604); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + Integer objectId = demandTask.getObject(); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203602); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(203602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203601); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(203601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203603); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203601); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(203601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203603); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203606); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203606); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2037".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203703); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203703); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203702); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203702); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203701); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, call, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203701); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, call, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203705); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203705); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2038".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203804); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203804); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203802); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203802); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203801); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203803); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203801); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203803); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203805); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203805); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2039".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203904); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203904); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203902); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203902); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203901); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203903); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203901); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(203901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203903); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203905); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203905); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2040".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204004); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204004); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204002); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 204002); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(204002); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204001); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), + demandTask.getCompletionReward(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(204001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204003); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204003); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204001); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), + demandTask.getCompletionReward(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + resultResponse.set反馈ID(204001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204003); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204003); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204005); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204005); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + }else if("2041".equals(methodId)){ + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (taskConditionId.equals(condition1[0])) { + //条件判断 + // 1. 判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204104); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Map> taskMap = player.getTaskMap(); + //2.符合阈值需求,判断是否完成后置任务 + if (taskMap.containsKey(subjectId)) { + Map subjectMap = taskMap.get(subjectId); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204102); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204101); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(204101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + int trustDegree = subject.getTrustDegree(); + int deterrenceDegree = subject.getDeterrenceDegree(); + double currency = player.getCurrency(); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204101); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), + String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + demandTask.getCompletionReward()); + resultResponse.set反馈ID(204101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204105); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204105); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); + return CommonResult.failed("任务执行失败!"); + } + + + /** + * 查询符合条件的任务 + * @param person + * @param type 1 信任度提升 2 信任度降低 3 威慑度提升 4 威慑度降低 + * @return + */ + private List findTasks(Person person, Integer type){ + List result = new ArrayList<>(); + if(!StringUtils.isEmpty(person)){ + List demandTaskList = person.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (type == 1) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) > 0) { + result.add(demandTask); + } + } + } else if (type == 2) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) < 0) { + result.add(demandTask); + } + } + } else if (type == 3) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) > 0) { + result.add(demandTask); + } + } + } else if (type == 4) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + String deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) < 0) { + result.add(demandTask); + } + } + } + } + } + return result; + } + + + /** + * 查询符合条件的任务 + * @param demandTaskList + * @param taskName + * @return + */ + private List findTasks(List demandTaskList , String taskName){ + List result = new ArrayList<>(); + for (DemandTaskDto demandTask : demandTaskList) { + if (Objects.equals(demandTask.getName(), taskName)) { + result.add(demandTask); + } + } + return result; + } + + /** + * 查询符合条件的任务 + * @param demandTaskList + * @param clue + * @return + */ + private DemandTaskDto findTasks(List demandTaskList ,ClueDto clue){ + for (int i= 0;i findTasks(List demandTaskList ,List clueList){ + List result = new ArrayList<>(); + for (DemandTaskDto demandTask : demandTaskList) { + for (ClueDto clueDto : clueList) { + if (Objects.equals(demandTask.getClueId(), clueDto.getClueId())) { + result.add(demandTask); + } + } + } + return result; + } + + /** + * 查询符合条件的任务 + * @param demandTaskList + * @param taskConditionId + * @return + */ + private List findTasksByTaskId(List demandTaskList , String taskConditionId){ + List result = new ArrayList<>(); + for (DemandTaskDto demandTask : demandTaskList) { + String taskId = demandTask.getCondition1().split("\\|")[0]; + if (taskConditionId.equals(taskId)) { + result.add(demandTask); + } + } + return result; + } + + /** + * 查询符合条件的线索 + * @param person + * @param type + * @return + */ + private List findClues(Person person,Integer type){ + List result = new ArrayList<>(); + if(!StringUtils.isEmpty(person)){ + List clueList =person.getClues(); + for (ClueDto clue : clueList) { + if (type.equals(clue.getType())) { + if (Objects.equals(person.getId(), clue.getAssociatedPerson())) { + result.add(clue); + } + } + } + } + return result; + } + /** + * 查询符合条件的线索 + * @param current + * @param subject + * @param type + * @return + */ + private List findClues(Person current,Person subject,Integer type){ + List result = new ArrayList<>(); + if(!StringUtils.isEmpty(current)){ + List clueList =current.getClues(); + for (int i= 0;i findClues(Person current,Person subject,Person object,Integer type){ + List result = new ArrayList<>(); + if(!StringUtils.isEmpty(subject)&&!StringUtils.isEmpty(object)){ + List clueList =current.getClues(); + for (int i= 0;i findClues(List clueList,String clueName){ + List result = new ArrayList<>(); + for (ClueDto clue : clueList) { + if (!StringUtils.isEmpty(clueName)) { + if (!clueName.equals(clue.getClueName())) { + continue; + } + result.add(clue); + } + } + return result; + } + + /** + * 判断是否符合阈值需求 + * @param personMap + * @param clueList + * @return + */ + public List checkThreshold(Map personMap, List clueList){ + List result = new ArrayList<>(); + for (ClueDto clue : clueList) { + //判断是否符合阈值需求 + boolean flag = true; + Person person = personMap.get(clue.getSubject()); + if (person.getTrustDegree() < clue.getTrustDegree()) { + flag = false; + } + if (person.getDeterrenceDegree() < clue.getThreaten()) { + flag = false; + } + if (flag) { //符合阈值要求 + result.add(clue); + } + } + return result; + } + + + /** + * 判断任务是否符合阈值需求 + * @param person + * @param demandTaskList + * @return + */ + public List checkTaskThreshold(Person person, List demandTaskList){ + List result = new ArrayList<>(); + for (DemandTaskDto demandTask : demandTaskList) { + //判断是否符合阈值需求 + String trustCondition = demandTask.getTrustCondition(); + String deterrenceCondition = demandTask.getDeterrenceCondition(); + boolean flag = true; + if (!StringUtils.isEmpty(trustCondition)) { + String[] trustConditions = trustCondition.split("\\|"); + if (!NumberUtil.inNumRange(person.getTrustDegree(), "[" + trustConditions[0] + "," + trustConditions[1] + "]")) { + flag = false; + } + } + if (!StringUtils.isEmpty(deterrenceCondition)) { + String[] deterrenceConditions = deterrenceCondition.split("\\|"); + if (!NumberUtil.inNumRange(person.getDeterrenceDegree(), "[" + deterrenceConditions[0] + "," + deterrenceConditions[1] + "]")) { + flag = false; + } + } + if (flag) { //符合阈值要求 + result.add(demandTask); + } + } + return result; + } + + /** + * 判断是否符合阈值需求 + * @param person + * @param clueList + * @return + */ + public List checkThreshold(Person person, List clueList){ + List result = new ArrayList<>(); + for (int i= 0;i= clue.getTrustDegree()||person.getDeterrenceDegree() >= clue.getThreaten()){ + flag = true; + } + if(flag){ //符合阈值要求 + result.add(clue); + } + } + return result; + } + + /** + * 判断是否符合阈值需求 + * @param trustCondition + * @param deterrenceCondition + * @param subject + * @return + */ + private boolean checkThreshold(String trustCondition,String deterrenceCondition,Person subject){ + boolean flag = false; + if(!StringUtils.isEmpty(trustCondition)){ + String[] trustConditions = trustCondition.split("\\|"); + if(NumberUtil.inNumRange(subject.getTrustDegree(),"["+trustConditions[0]+","+trustConditions[1]+"]")){ + flag = true; + } + } + if(!StringUtils.isEmpty(deterrenceCondition)){ + String[] deterrenceConditions = deterrenceCondition.split("\\|"); + if(NumberUtil.inNumRange(subject.getDeterrenceDegree(),"["+deterrenceConditions[0]+","+deterrenceConditions[1]+"]")){ + flag = true; + } + } + return flag; + } +} diff --git a/src/main/java/com/qiwu/inference/service/task/TaskService.java b/src/main/java/com/qiwu/inference/service/task/TaskService.java new file mode 100644 index 0000000..6621bc0 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/task/TaskService.java @@ -0,0 +1,9 @@ +package com.qiwu.inference.service.task; + +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultVarsResponse; + +public interface TaskService { + CommonResult execute(OperationRequest operationReq); +} diff --git a/src/main/java/com/qiwu/inference/service/task/impl/TaskServiceImpl.java b/src/main/java/com/qiwu/inference/service/task/impl/TaskServiceImpl.java new file mode 100644 index 0000000..42ac341 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/task/impl/TaskServiceImpl.java @@ -0,0 +1,40 @@ +package com.qiwu.inference.service.task.impl; + +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.common.utils.CacheUtil; +import com.qiwu.inference.common.utils.YamlUtil; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultVarsResponse; +import com.qiwu.inference.service.common.CommonService; +import com.qiwu.inference.service.task.TaskService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +@Service +public class TaskServiceImpl implements TaskService { + private Logger log = LoggerFactory.getLogger(TaskServiceImpl.class); + + //从yml配置文件中取出对话过期时间 + @Value("${expireTime}") + private String expireTime; + + @Autowired + private CommonService commonService; + + @Override + public CommonResult execute(OperationRequest operationReq) { + String uid = operationReq.getUid(); + String subjectName = operationReq.getSubjectName(); //A人物名称 + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + subjectName = (subjectName == null) ? lastReq.getSubjectName() : subjectName; + } + + return commonService.operate(operationReq); + } +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 8e246a8..a71f6d2 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -21,13 +21,15 @@ spring: #配置一个连接在池中最小生存的时间 min-evictable-idle-time-millis: 300000 - +#对话过期时间 +expireTime: 180000 #玩家无操作时长,默认下线 offlineTime: 180000 speechFilePath: /home/inferenceGame/speech/ -#分享关系查看地址 -inferenceUrl: http://127.0.0.1:8083 +configFilePath: /home/inferenceGame/config/ + +userFilePath: /home/inferenceGame/user/ diff --git a/src/main/resources/application-uat.yml b/src/main/resources/application-uat.yml index a22f64f..10a7bd1 100644 --- a/src/main/resources/application-uat.yml +++ b/src/main/resources/application-uat.yml @@ -1,7 +1,7 @@ server: port: 60018 serlvet: - context-type:/inferenceGame + context-type:/inference #设置当前服务名 spring: @@ -9,7 +9,7 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/inference_game?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC username: root - password: root + password: dgKNTmt2iLHNjEQajkDEZkq8 type: com.alibaba.druid.pool.DruidDataSource druid: initial-size: 5 @@ -21,13 +21,15 @@ spring: #配置一个连接在池中最小生存的时间 min-evictable-idle-time-millis: 300000 - +#对话过期时间 +expireTime: 180000 #玩家无操作时长,默认下线 offlineTime: 180000 -speechFilePath: /home/secretGarden/secretGardenSpeech/ +speechFilePath: /home/jiaoyou/projects/inferenceGame/speech/ + +configFilePath: /home/jiaoyou/projects/inferenceGame/config/ -#分享关系查看地址 -inferenceUrl: https://192.168.1.156/api/ +userFilePath: /home/jiaoyou/projects/inferenceGame/user/ diff --git a/src/main/resources/com/qiwu/inference/dao/BehaviourMapper.xml b/src/main/resources/com/qiwu/inference/dao/BehaviourMapper.xml new file mode 100755 index 0000000..497aaa4 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/BehaviourMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/BehaviourRecordMapper.xml b/src/main/resources/com/qiwu/inference/dao/BehaviourRecordMapper.xml new file mode 100755 index 0000000..914a1ce --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/BehaviourRecordMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/ClueMapper.xml b/src/main/resources/com/qiwu/inference/dao/ClueMapper.xml new file mode 100755 index 0000000..f779779 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/ClueMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/ClueRecordMapper.xml b/src/main/resources/com/qiwu/inference/dao/ClueRecordMapper.xml new file mode 100755 index 0000000..a5926fc --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/ClueRecordMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/DemandTaskMapper.xml b/src/main/resources/com/qiwu/inference/dao/DemandTaskMapper.xml new file mode 100755 index 0000000..484effd --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/DemandTaskMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/DemandTaskRecordMapper.xml b/src/main/resources/com/qiwu/inference/dao/DemandTaskRecordMapper.xml new file mode 100755 index 0000000..de9f375 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/DemandTaskRecordMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/DispositionMapper.xml b/src/main/resources/com/qiwu/inference/dao/DispositionMapper.xml new file mode 100755 index 0000000..bd9e384 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/DispositionMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/DispositionMapperRecord.xml b/src/main/resources/com/qiwu/inference/dao/DispositionMapperRecord.xml new file mode 100755 index 0000000..127070c --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/DispositionMapperRecord.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/DispositionTypeMapper.xml b/src/main/resources/com/qiwu/inference/dao/DispositionTypeMapper.xml new file mode 100755 index 0000000..614a56e --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/DispositionTypeMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml b/src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml new file mode 100755 index 0000000..80e13df --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/IdentityMapper.xml b/src/main/resources/com/qiwu/inference/dao/IdentityMapper.xml new file mode 100755 index 0000000..e159673 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/IdentityMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/ItemMapper.xml b/src/main/resources/com/qiwu/inference/dao/ItemMapper.xml new file mode 100755 index 0000000..9825d75 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/ItemMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/KeyClueMapper.xml b/src/main/resources/com/qiwu/inference/dao/KeyClueMapper.xml new file mode 100755 index 0000000..6eefe53 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/KeyClueMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/LocationMapper.xml b/src/main/resources/com/qiwu/inference/dao/LocationMapper.xml new file mode 100755 index 0000000..6b0e478 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/LocationMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/MonikerMapper.xml b/src/main/resources/com/qiwu/inference/dao/MonikerMapper.xml new file mode 100755 index 0000000..c92ea86 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/MonikerMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/PersonRecordMapper.xml b/src/main/resources/com/qiwu/inference/dao/PersonRecordMapper.xml new file mode 100755 index 0000000..5514565 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/PersonRecordMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/RelationMapper.xml b/src/main/resources/com/qiwu/inference/dao/RelationMapper.xml new file mode 100755 index 0000000..1dfa95a --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/RelationMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/RelationRecordMapper.xml b/src/main/resources/com/qiwu/inference/dao/RelationRecordMapper.xml new file mode 100755 index 0000000..c9d2217 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/RelationRecordMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/RelationTypeMapper.xml b/src/main/resources/com/qiwu/inference/dao/RelationTypeMapper.xml new file mode 100755 index 0000000..6b348a5 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/RelationTypeMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/SurnameMapper.xml b/src/main/resources/com/qiwu/inference/dao/SurnameMapper.xml new file mode 100755 index 0000000..60a1ac9 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/SurnameMapper.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/main/resources/com/qiwu/inference/dao/SystemConfigMapper.xml b/src/main/resources/com/qiwu/inference/dao/SystemConfigMapper.xml new file mode 100644 index 0000000..c5bb1f3 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/SystemConfigMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/com/qiwu/inference/dao/TaskConditionMapper.xml b/src/main/resources/com/qiwu/inference/dao/TaskConditionMapper.xml new file mode 100755 index 0000000..be48844 --- /dev/null +++ b/src/main/resources/com/qiwu/inference/dao/TaskConditionMapper.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/main/resources/file/behaviour.xlsx b/src/main/resources/file/behaviour.xlsx new file mode 100755 index 0000000..4997fbc Binary files /dev/null and b/src/main/resources/file/behaviour.xlsx differ diff --git a/src/main/resources/file/clue.xlsx b/src/main/resources/file/clue.xlsx new file mode 100755 index 0000000..e583c14 Binary files /dev/null and b/src/main/resources/file/clue.xlsx differ diff --git a/src/main/resources/file/demand_task.xlsx b/src/main/resources/file/demand_task.xlsx new file mode 100755 index 0000000..a8ea799 Binary files /dev/null and b/src/main/resources/file/demand_task.xlsx differ diff --git a/src/main/resources/file/disposition.xlsx b/src/main/resources/file/disposition.xlsx new file mode 100755 index 0000000..31aba25 Binary files /dev/null and b/src/main/resources/file/disposition.xlsx differ diff --git a/src/main/resources/file/disposition_type.xlsx b/src/main/resources/file/disposition_type.xlsx new file mode 100755 index 0000000..f3638d3 Binary files /dev/null and b/src/main/resources/file/disposition_type.xlsx differ diff --git a/src/main/resources/file/end_goal.xlsx b/src/main/resources/file/end_goal.xlsx new file mode 100755 index 0000000..ab5e5b0 Binary files /dev/null and b/src/main/resources/file/end_goal.xlsx differ diff --git a/src/main/resources/file/identity.xlsx b/src/main/resources/file/identity.xlsx new file mode 100755 index 0000000..ece6420 Binary files /dev/null and b/src/main/resources/file/identity.xlsx differ diff --git a/src/main/resources/file/item.xlsx b/src/main/resources/file/item.xlsx new file mode 100755 index 0000000..8d6f2c6 Binary files /dev/null and b/src/main/resources/file/item.xlsx differ diff --git a/src/main/resources/file/key_clue.xlsx b/src/main/resources/file/key_clue.xlsx new file mode 100755 index 0000000..e8f9392 Binary files /dev/null and b/src/main/resources/file/key_clue.xlsx differ diff --git a/src/main/resources/file/location.xlsx b/src/main/resources/file/location.xlsx new file mode 100755 index 0000000..3f7a9c1 Binary files /dev/null and b/src/main/resources/file/location.xlsx differ diff --git a/src/main/resources/file/moniker.xlsx b/src/main/resources/file/moniker.xlsx new file mode 100755 index 0000000..4389c18 Binary files /dev/null and b/src/main/resources/file/moniker.xlsx differ diff --git a/src/main/resources/file/relation.xlsx b/src/main/resources/file/relation.xlsx new file mode 100755 index 0000000..05d3077 Binary files /dev/null and b/src/main/resources/file/relation.xlsx differ diff --git a/src/main/resources/file/relation_type.xlsx b/src/main/resources/file/relation_type.xlsx new file mode 100755 index 0000000..6cb4fcc Binary files /dev/null and b/src/main/resources/file/relation_type.xlsx differ diff --git a/src/main/resources/file/surname.xlsx b/src/main/resources/file/surname.xlsx new file mode 100755 index 0000000..3b97d9f Binary files /dev/null and b/src/main/resources/file/surname.xlsx differ diff --git a/src/main/resources/file/task_condition.xlsx b/src/main/resources/file/task_condition.xlsx new file mode 100755 index 0000000..7f65b4e Binary files /dev/null and b/src/main/resources/file/task_condition.xlsx differ diff --git a/src/main/resources/speech/ask.yaml b/src/main/resources/speech/ask.yaml index dc09135..09e4e2a 100755 --- a/src/main/resources/speech/ask.yaml +++ b/src/main/resources/speech/ask.yaml @@ -1,13 +1,386 @@ #存放路径已改为:/home/inferenceGame/speech/ aside: + 100001: + - 【旁白@正常】您还没告诉我想看谁呢。 + 100002: + - 【旁白@正常】您想知道这个人的什么性格类型呢。 + 100003: + - 【旁白@正常】您没告诉我想了解这个人的什么性格呢。 + 100004: + - 【旁白@正常】您没告诉我想了解他们的什么关系呢。 + 100005: + - 【旁白@正常】您没告诉我这个人做了什么呢。 + 100006: + - 【旁白@正常】您想打听什么身份呢。 + 100007: + - 【旁白@正常】您想打听什么地方呢。 + #1001: 询问A的性格 + 100101: + - 【旁白@正常】【1】。 100102: - 【旁白@正常】我又不认识你,为什么要告诉你? 100103: - 【旁白@正常】不好意思,我不知道 + 100104: + - 【旁白@正常】 + 100105: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 100106: + - 【旁白@正常】不好意思,我不知道 + #1002: 询问A是否是某个性格 + 100203: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 100204: + - 【旁白@正常】不好意思,我不知道 + #1003: 询问A和B是什么关系 + 100302: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 100303: + - 【旁白@正常】不好意思,我不知道 + #1004: 询问A和B是不是某个关系 + 100403: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 100404: + - 【旁白@正常】不好意思,我不知道 + #1005: 询问和A有某个关系的人是谁 + 100502: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 100503: + - 【旁白@正常】不好意思,我不知道 + #1006: 询问谁和谁有某个关系 + 100602: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 100603: + - 【旁白@正常】不好意思,我不知道 + #1007: 询问A有过什么行为 + 100702: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 100703: + - 【旁白@正常】不好意思,我不知道 + #1008: 询问A和B有什么行为 + 100802: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 100803: + - 【旁白@正常】不好意思,我不知道 + #1009: 询问A和谁有了某个行为 + 100902: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 100903: + - 【旁白@正常】不好意思,我不知道 + #1010: 询问A有没有发生过某个行为 + 101003: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101004: + - 【旁白@正常】 + #1011: 询问A和B有没有发生过某个行为 + 101103: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101104: + - 【旁白@正常】不好意思,我不知道 + #1012: 询问A知道/看见了B和C的什么行为 + 101202: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101203: + - 【旁白@正常】不好意思,我不知道 + #1013: 询问A有没有看到B和C发生了某个行为 + 101303: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101304: + - 【旁白@正常】不好意思,我不知道 + #1014: 询问A知道什么行为事件 + 101402: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101403: + - 【旁白@正常】不好意思,我不知道 + #1015: 询问A的提升信任度任务 + 101502: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101503: + - 【旁白@正常】不好意思,我不知道 + #1016: 询问A的提升威慑度任务 + 101602: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101603: + - 【旁白@正常】不好意思,我不知道 + #1017: 询问A是否有某个提升信任度的任务 + 101702: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101703: + - 【旁白@正常】不好意思,我不知道 + #1018: 询问A是否有某个提升威慑度的任务 + 101803: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101804: + - 【旁白@正常】不好意思,我不知道 + #1019: 询问A降低信任度的任务 + 101902: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 101903: + - 【旁白@正常】不好意思,我不知道 + #1020: 询问A降低威慑度的任务 + 102002: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 102003: + - 【旁白@正常】不好意思,我不知道 + #1021: 询问A是否有某个降低信任度的任务 + 102103: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 102104: + - 【旁白@正常】不好意思,我不知道 + #1022: 询问A是否有某个降低威慑度的任务 + 102203: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 102204: + - 【旁白@正常】不好意思,我不知道 + #1023: 询问A是什么身份 + 102301: + - 【旁白@正常】【1】。 + 102302: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 102303: + - 【旁白@正常】不好意思,我不知道 + #1024: 询问A是不是某个身份 + 102401: + - 【旁白@正常】【1】。 + 102402: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 102403: + - 【旁白@正常】不好意思,我不知道 + #1025: 询问A在哪个场所 + 102502: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 102503: + - 【旁白@正常】不好意思,我不知道 + #1026: 询问A是不是在某个场所 + 102603: + - 【旁白@正常】我又不认识你,为什么要告诉你? + 102604: + - 【旁白@正常】不好意思,我不知道 + + + + person: + #1001: 询问A的性格 + 100101: + - 【人物名称@正常】【1】 100102: - - 【姓名@正常】我又不认识你,为什么要告诉你? + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 10010201: + - 【人物名称@正常】我又不认识你,为什么要告诉你关于我的事。 100103: - - 【姓名@正常】不好意思,我不知道 \ No newline at end of file + - 【人物名称@正常】不好意思,我不知道 + 100104: + - 【人物名称@正常】 + 100105: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 100106: + - 【人物名称@正常】不好意思,我不知道 + #1002: 询问A是否是某个性格 + 100201: + - 【人物名称@正常】是的,【1】 + 100202: + - 【人物名称@正常】不是,【1】 + 100203: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 10020301: + - 【人物名称@正常】我又不认识你,为什么要告诉你我喜欢什么? + 100204: + - 【人物名称@正常】不好意思,我不知道。 + #1003: 询问A和B是什么关系 + 100301: + - 【人物名称@正常】【1】 + 100302: + - 【人物名称@正常】我又不认识你,为什么要告诉你他们的关系? + 10030201: + - 【人物名称@正常】我又不认识你,为什么要告诉你我们的关系? + 100303: + - 【人物名称@正常】不好意思,我不知道。 + 10030301: + - 【人物名称@正常】【1】吗?我好像不认识这个人啊 + #1004: 询问A和B是不是某个关系 + 100401: + - 【人物名称@正常】是的,【1】 + 100402: + - 【人物名称@正常】不是,【1】 + 100403: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 100404: + - 【人物名称@正常】不好意思,我不知道。 + #1005: 询问和A有某个关系的人是谁 + 100501: + - 【人物名称@正常】【1】 + 100502: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 100503: + - 【人物名称@正常】不好意思,我不知道 + #1006: 询问谁和谁有某个关系 + 100601: + - 【人物名称@正常】【1】 + 100602: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 100603: + - 【人物名称@正常】不好意思,我不知道 + #1007: 询问A有过什么行为 + 100701: + - 【人物名称@正常】【1】 + 100702: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 100703: + - 【人物名称@正常】不好意思,我不知道 + #1008: 询问A和B有什么行为 + 100801: + - 【人物名称@正常】【1】 + 100802: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 100803: + - 【人物名称@正常】不好意思,我不知道 + #1009: 询问A和谁有了某个行为 + 100901: + - 【人物名称@正常】【1】 + 100902: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 100903: + - 【人物名称@正常】不好意思,我不知道。 + #1010: 询问A有没有发生过某个行为 + 101001: + - 【人物名称@正常】是的,【1】 + 101002: + - 【人物名称@正常】不是,【1】 + 101003: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101004: + - 【人物名称@正常】不好意思,我不知道 + #1011: 询问A和B有没有发生过某个行为 + 101101: + - 【人物名称@正常】是的,【1】 + 101102: + - 【人物名称@正常】不是,【1】 + 101103: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101104: + - 【人物名称@正常】不好意思,我不知道 + #1012: 询问A知道/看见了B和C的什么行为 + 101201: + - 【人物名称@正常】【1】 + 101202: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101203: + - 【人物名称@正常】不好意思,我不知道 + #1013: 询问A有没有看到B和C发生了某个行为 + 101301: + - 【人物名称@正常】是的,【1】 + 101302: + - 【人物名称@正常】不是,【1】 + 101303: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101304: + - 【人物名称@正常】不好意思,我不知道 + #1014: 询问A知道什么行为事件 + 101401: + - 【人物名称@正常】【1】 + 101402: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101403: + - 【人物名称@正常】不好意思,我不知道 + #1015: 询问A的提升信任度任务 + 101501: + - 【人物名称@正常】【1】 + 101502: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101503: + - 【人物名称@正常】不好意思,我不知道 + #1016: 询问A的提升威慑度任务 + 101601: + - 【人物名称@正常】【1】 + 101602: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101603: + - 【人物名称@正常】不好意思,我不知道 + #1017: 询问A是否有某个提升信任度的任务 + 101701: + - 【人物名称@正常】是的,【1】 + 101702: + - 【人物名称@正常】不是,【1】 + 101703: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101704: + - 【人物名称@正常】不好意思,我不知道。 + #1018: 询问A是否有某个提升威慑度的任务 + 101801: + - 【人物名称@正常】是的,【1】 + 101802: + - 【人物名称@正常】不是,【1】 + 101803: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101804: + - 【人物名称@正常】不好意思,我不知道 + #1019: 询问A降低信任度的任务 + 101901: + - 【人物名称@正常】【1】 + 101902: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 101903: + - 【人物名称@正常】不好意思,我不知道 + #1020: 询问A降低威慑度的任务 + 102001: + - 【人物名称@正常】【1】 + 102002: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 102003: + - 【人物名称@正常】不好意思,我不知道 + #1021: 询问A是否有某个降低信任度的任务 + 102101: + - 【人物名称@正常】是的,【1】 + 102102: + - 【人物名称@正常】不是,【1】 + 102103: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 102104: + - 【人物名称@正常】不好意思,我不知道 + #1022: 询问A是否有某个降低威慑度的任务 + 102201: + - 【人物名称@正常】是的,【1】 + 102202: + - 【人物名称@正常】不是,【1】 + 102203: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 102204: + - 【人物名称@正常】不好意思,我不知道 + #1023: 询问A是什么身份 + 102301: + - 【人物名称@正常】【1】 + 102302: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 102303: + - 【人物名称@正常】不好意思,我不知道 + #1024: 询问A是不是某个身份 + 102401: + - 【人物名称@正常】是的,【1】 + 102402: + - 【人物名称@正常】不是,【1】 + 102403: + - 【人物名称@正常】不好意思,我不知道 + #1025: 询问A在哪个场所 + 102501: + - 【人物名称@正常】【1】 + 102502: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 102503: + - 【人物名称@正常】不好意思,我不知道 + #1026: 询问A是不是在某个场所 + 102601: + - 【人物名称@正常】是的,【1】 + 102602: + - 【人物名称@正常】不是,【1】 + 102603: + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 102604: + - 【人物名称@正常】不好意思,我不知道 + #1027: 询问提示 + 102701: + - 【人物名称@正常】你可以去问问【1】,他可能知道点什么。 + 102702: + - 【人物名称@正常】抱歉,爱莫能助。 diff --git a/src/main/resources/speech/barrier.yaml b/src/main/resources/speech/barrier.yaml new file mode 100644 index 0000000..0eb4297 --- /dev/null +++ b/src/main/resources/speech/barrier.yaml @@ -0,0 +1,57 @@ +#存放路径已改为:/home/inferenceGame/speech/ +aside: + 400001: + - 【旁白@正常】好的,已为您取消操作。 + #4001: 场所移动 + 400101: + - 【旁白@正常】您来到了【1】,【2】在这里,他对你微笑点头。 + 400102: + - 【旁白@正常】还不知道这个地方在哪,找个人问问吧。 + 400103: + - 【旁白@正常】不知道您说的这个地方在哪呢。 + 400104: + - 【旁白@正常】这个地方没有你要找的人。 + #4002: 开启对话 + 400201: + - 【旁白@正常】【1】当前线索有:【2】,您要详细查看哪一类的线索呢? + 400202: + - 【旁白@正常】【1】不在这里,现在前往【2】并跟他打招呼好吗? + 400203: + - 【旁白@正常】没有找到这个人。 + 400204: + - 【旁白@正常】【1】还不知道在什么地方,去打听打听他在哪吧。 + #4003: 重试关卡 + 400301: + - 【旁白@正常】您将要重新开始本关卡,所有本关卡获得的【1】和排名积分将会重置,确定要重新开始吗? + 400302: + - 【旁白@正常】好的,这就重新开始。 + 400303: + - 【旁白@正常】好的,您将继续挑战本关卡。 + #4004: 放弃/跳过关卡 + 400401: + - 【旁白@正常】您将要放弃挑战本关卡,所有已获得的【1】和排名积分将会保留。由于放弃挑战,排名积分将减少【2】,确定要放弃挑战本关卡吗? + 400402: + - 【旁白@正常】好的,您已放弃挑战本关卡,请重新挑选一个关卡等级进行挑战。 + 400403: + - 【旁白@正常】好的,您将继续挑战本关卡。 + + + + + + +person: + #4001: 场所移动 + 400101: + - 【人物名称@正常】 + 400102: + - 【人物名称@正常】 + #4002: 开启对话 + 400201: + - 【人物名称@正常】【1】 + 400202: + - 【人物名称@正常】 + 400203: + - 【人物名称@正常】 + 400204: + - 【人物名称@正常】 \ No newline at end of file diff --git a/src/main/resources/speech/check.yaml b/src/main/resources/speech/check.yaml new file mode 100644 index 0000000..ab25cd5 --- /dev/null +++ b/src/main/resources/speech/check.yaml @@ -0,0 +1,69 @@ +#存放路径已改为:/home/inferenceGame/speech/ +aside: + 300001: + - 【旁白@正常】您想要查看已获得的人物线索吗?可以告诉我想看哪个人。 + #3001: 查看人物 + 300101: + - 【旁白@正常】当前已知人物有:【1】,需要查看哪个人物的详情呢?告知我人物名称即可。 + 30010101: + - 【旁白@正常】你当前还没有获得线索,去找个人问问吧。 + 30010102: + - 【旁白@正常】当前已知人物有:【1】,需要查看【2】的详情呢? + 300102: + - 【旁白@正常】【1】,年龄【2】,性别【3】,【4】对你的信任度为:【5】、威慑度为:【6】,要查看他的相关线索吗? + 30010201: + - 【旁白@正常】【1】,年龄不详,性别不明,可以去找找这个人。 + 300103: + - 【旁白@正常】【1】当前线索有:【2】,您要详细查看哪一类的线索呢? + 30010301: + - 【旁白@正常】您还告诉我想看哪个人的线索呢。 + 30010302: + - 【旁白@正常】您只见过这个人,还没有收集到线索。 + 300104: + - 【旁白@正常】没有这个人。当前已知人物有:【1】,需要查看哪个人物的详情呢?告知我人物名称即可。 + #3003: 查看货币 + 300301: + - 【旁白@正常】当前拥有【1】【2】。 + #3004: 查看场所 + 300401: + - 【旁白@正常】目前已知场所:【1】,想要移动至哪个场所呢?可以直接告诉我场所名称。 + #3005: 询问和A有某个关系的人是谁 + 300501: + - 【旁白@正常】您当前已知线索【1】条,请问想要查看关于人物的线索还是不同类型的线索呢? + 30050101: + - 【旁白@正常】您当前还没有获得任何线索,我能给您提供点建议。 + 300502: + - 【旁白@正常】当前已知人物【1】名:【2】,想要知道哪个人物的相关线索呢?说出他的名称即可。 + 30050201: + - 【旁白@正常】您还没有收集到任何人的线索。 + 300503: + - 【旁白@正常】当前已知【1】,想要知晓哪个类型线索呢? + 30050301: + - 【旁白@正常】您当前还没有收集到线索,我能给您提供点建议。 + 300504: + - 【旁白@正常】【1】已知线索【2】条,其中【3】,想要了解【1】的哪种线索呢? + 30050401: + - 【旁白@正常】您当前还没有任何线索,你可以先去找【1】问问。 + 30050402: + - 【旁白@正常】您还没有从【1】那获得线索。 + 300505: + - 【旁白@正常】当前已知【1】线索共【2】条,其中【3】,想知道哪个人物的【1】线索呢? + 30050501: + - 【旁白@正常】您当前还没有【1】线索。 + 300506: + - 【旁白@正常】【1】的【2】线索共【3】条,第【4】条:【5】。 + 30050601: + - 【旁白@正常】您当前还没有收集到【1】的【2】线索。 + 30050602: + - 【旁白@正常】您还没告诉要看谁的呢。 + 30050603: + - 【旁白@正常】没有您说的这个人哦。 + 30050604: + - 【旁白@正常】您想看什么类型的线索呢? + 30050605: + - 【旁白@正常】没有这种类型的线索哦。 + #3006: 询问谁和谁有某个关系 + 300601: + - 【旁白@正常】您当前排名积分为:【1】。 + + diff --git a/src/main/resources/speech/task.yaml b/src/main/resources/speech/task.yaml new file mode 100644 index 0000000..628fad3 --- /dev/null +++ b/src/main/resources/speech/task.yaml @@ -0,0 +1,772 @@ +#存放路径已改为:/home/inferenceGame/speech/ +aside: + #2001: 饮酒 + 200101: + - 【旁白@正常】你请了【1】喝了一杯酒,他对你的态度变好了一点。【2】【旁白@正常】你花费【3】文请【1】喝了一杯,拉近了交情,他对你的信任度上升【4】。 + 200102: + - 【旁白@正常】你请了【1】喝了一杯酒,他对你的态度变好了一点。【2】【旁白@正常】你又请【1】喝了一杯。可惜刚刚喝过了,信任度没有提升。 + 200103: + - 【旁白@正常】你花费【1】文请了【2】喝了一杯酒,看来他不是很买账。 + 200104: + - 【旁白@正常】你身上带的钱不太够,喝酒要花费【1】【2】。 + #2002: 打招呼 + 200201: + - 【旁白@正常】【1】对你拱手作揖。 + 200203: + - 【旁白@正常】【1】淡淡地扫了你一眼,仿佛没听见。 + #2003: 买古董 + 200301: + - 【旁白@正常】你从【1】手上买下了古董。 + 200302: + - 【旁白@正常】你从【1】手上买下了古董。 + #2004: 买药 + 200401: + - 【旁白@正常】你花费【1】文,从【2】手上买下了金疮药。 + #2005: 获赠金疮药 + 200502: + - 【旁白@正常】 + 200503: + - 【旁白@正常】 + #2006: 揍人 + 200601: + - 【旁白@正常】你狠狠揍了【1】一顿。信任度降低【2】,威慑度上升【3】。 + 200602: + - 【旁白@正常】你狠狠揍了【1】一顿。 + 200603: + - 【旁白@正常】你被【1】狠狠收拾了一顿,被揍得鼻青脸肿。 + #2007: 请吃饭 + 200701: + - 【旁白@正常】你邀请【1】到酒楼,花费【2】文,满满点了一桌子。【3】【旁白@正常】信任度上升【4】点。 + 200702: + - 【旁白@正常】你邀请【1】到酒楼,满满点了一桌子。 + 200703: + - 【旁白@正常】最便宜的一桌饭菜也需要【1】文,你的钱不够了。 + #2008: 好处费 + 200801: + - 【旁白@正常】你偷偷摸出【1】文递给【2】。【3】【旁白@正常】【2】不着痕迹地把银子塞进袖子里。信任度上升【4】点。 + 200802: + - 【旁白@正常】你偷偷摸出【1】文递给【2】。【3】【旁白@正常】【2】不着痕迹地把银子塞进袖子里。因为打赏次数太多,信任度已经无法提升。 + 200803: + - 【旁白@正常】打赏一次要【1】文,你的钱不够了。 + 200804: + - 【旁白@正常】你偷偷摸出【1】文递给【2】。 + #2009: 帮挑水 + 200901: + - 【旁白@正常】你吭哧吭哧为【1】把水缸挑满。【2】对你感连声道谢。信任度提升【3】点。 + 200902: + - 【旁白@正常】你吭哧吭哧为【1】把水缸挑满。但是挑水这种小事已经无法再提高【2】的信任度。 + #2010: 一起钓鱼 + 201001: + - 【旁白@正常】你陪着【1】去钓了一场鱼。信任度提高【2】。你顺手把钓到的小鱼卖了,获利【3】文。 + 201002: + - 【旁白@正常】你陪着【1】又去钓了一场鱼。信任度没有提高。但是你顺手把钓到的小鱼卖了,获利【2】文。 + #2011: 送货 + 201101: + - 【旁白@正常】你把货物给【1】送去,信任度提升【2】。 + 201102: + - 【旁白@正常】 + 201103: + - 【旁白@正常】 + #2012: 给钱 + 201201: + - 【旁白@正常】你给【1】送钱,信任度提升【2】。 + 201202: + - 【旁白@正常】你多次给【1】送钱,【2】已经习惯成自然,信任度没有提升。 + 201203: + - 【旁白@正常】你的钱财不足,已经拿不出手了。 + #2013: 邀请医生 + 201301: + - 【旁白@正常】你预付了【1】文诊金,成功邀请【2】大夫出诊。 + 201303: + - 【旁白@正常】很遗憾,你掏不出【1】文的诊金。 + #2014: 给钱买药 + 201401: + - 【旁白@正常】你从【1】手上买下了茶具,花费【2】文。 + #2015: 开怀畅饮 + 201501: + - 【旁白@正常】你请【1】喝得酩酊大醉,尽兴而归。花费【2】文,信任度提升【3】。 + 201502: + - 【旁白@正常】前不久你刚和【1】畅饮过一轮,【2】的酒意未消,再喝也没有效果。 + #2016: 买回钗子 + 201601: + - 【旁白@正常】你数出【1】文钱,从【2】手上接过了钗子。 + #2017: 抢回钗子 + 201701: + - 【旁白@正常】你恶狠狠地捋着袖子。【1】【旁白@正常】你从【2】手上接过了钗子。你对【3】的威慑值上升【4】,信任度下降【5】。 + #2018: 追回私吞款项 + 201801: + - 【旁白@正常】你恶狠狠地捋着袖子。【1】【旁白@正常】你从【2】手上接过一个钱袋子。你对【3】的威慑值上升【4】,信任度下降【5】。 + #2019: 探听身家 + 201901: + - 【旁白@正常】【1】得意地对你伸出五个手指。 + #2020:解救被绑女孩 + 202001: + - 【旁白@正常】 + 202002: + - 【旁白@正常】 + 202003: + - 【旁白@正常】 + #2021:审问罪犯供出老巢 + 202101: + - 【旁白@正常】 + 202102: + - 【旁白@正常】 + 202103: + - 【旁白@正常】 + #2022:交出藏宝图 + 202201: + - 【旁白@正常】 + 202202: + - 【旁白@正常】 + 202203: + - 【旁白@正常】 + #2023:抓捕人犯 + 202301: + - 【旁白@正常】 + 202302: + - 【旁白@正常】 + 202303: + - 【旁白@正常】 + #2024:抓捕人犯 + 202401: + - 【旁白@正常】 + 202402: + - 【旁白@正常】 + 202403: + - 【旁白@正常】 + 202404: + - 【旁白@正常】 + #2025:购买物品完成 + 202501: + - 【旁白@正常】 + 202502: + - 【旁白@正常】 + 202503: + - 【旁白@正常】 + 202504: + - 【旁白@正常】【1】冷淡地看了你一眼。 + 202505: + - 【旁白@正常】你将【1】转交给【2】,虽然这是假的,但【3】依然对你表示了感激。 + #2026:大夫出诊完成 + 202601: + - 【旁白@正常】 + 202602: + - 【旁白@正常】 + 202603: + - 【旁白@正常】 + 202604: + - 【旁白@正常】【1】冷淡地看了你一眼。 + #2027:寻回物品完成 + 202701: + - 【旁白@正常】 + 202702: + - 【旁白@正常】 + 202703: + - 【旁白@正常】 + 202704: + - 【旁白@正常】【1】冷淡地看了你一眼。 + #2028:打探肥羊完成 + 202801: + - 【旁白@正常】 + 202802: + - 【旁白@正常】 + 202803: + - 【旁白@正常】 + 202804: + - 【旁白@正常】【1】冷淡地看了你一眼。 + #2029:催账完成 + 202901: + - 【旁白@正常】 + 202902: + - 【旁白@正常】 + 202903: + - 【旁白@正常】 + 202904: + - 【旁白@正常】 + #2030:催账 + 203001: + - 【旁白@正常】 + 203002: + - 【旁白@正常】 + 203003: + - 【旁白@正常】 + #2031:砸场子完成 + 203101: + - 【旁白@正常】 + 203102: + - 【旁白@正常】 + 203103: + - 【旁白@正常】 + 203104: + - 【旁白@正常】 + #2032:砸场子 + 203201: + - 【旁白@正常】 + 203202: + - 【旁白@正常】 + 203203: + - 【旁白@正常】【1】挥拳朝你扑过来,你被打得鼻青脸肿。 + #2033:探听隐私完成 + 203301: + - 【旁白@正常】 + 203302: + - 【旁白@正常】 + 203303: + - 【旁白@正常】 + 203304: + - 【旁白@正常】 + #2034:探听隐私 + 203401: + - 【旁白@正常】【1】 + 203402: + - 【旁白@正常】你已经知道他的隐私了。 + 203403: + - 【旁白@正常】【1】挥拳朝你扑过来,你被打得鼻青脸肿。 + #2035:试药 + 203501: + - 【旁白@正常】 + 203502: + - 【旁白@正常】 + 203503: + - 【旁白@正常】 + 203504: + - 【旁白@正常】【1】不屑地冲你摆摆手。 + #2036:证据账本完成 + 203601: + - 【旁白@正常】 + 203602: + - 【旁白@正常】 + 203603: + - 【旁白@正常】 + 203604: + - 【旁白@正常】 + 203605: + - 【旁白@正常】 + #2037:证据账本 + 203701: + - 【旁白@正常】 + 203702: + - 【旁白@正常】 + 203703: + - 【旁白@正常】 + 203704: + - 【旁白@正常】【1】挥拳朝你扑过来,你被打得鼻青脸肿。 + #2038:证据账本类型2完成 + 203801: + - 【旁白@正常】 + 203802: + - 【旁白@正常】 + 203803: + - 【旁白@正常】 + 203804: + - 【旁白@正常】 + #2039:栽赃陷害完成 + 203901: + - 【旁白@正常】 + 203902: + - 【旁白@正常】【1】似乎对你重提旧事有些不满意,冷冷地道。 + 203903: + - 【旁白@正常】 + 203904: + - 【旁白@正常】 + #2040:栽赃陷害类型2完成 + 204001: + - 【旁白@正常】 + 204002: + - 【旁白@正常】【1】冷冷地对你说。 + 204003: + - 【旁白@正常】 + 204004: + - 【旁白@正常】 + #2041:栽赃陷害类型2完成 + 204101: + - 【旁白@正常】 + 204102: + - 【旁白@正常】 + 204103: + - 【旁白@正常】 + 204104: + - 【旁白@正常】 + + + + +person: + 200001: + - 【人物名称@正常】你要干什么呢? + #2001: 饮酒 + 200101: + - 【人物名称@正常】好……好酒!嗝儿! + 200102: + - 【人物名称@正常】好酒!嗝儿! + 200103: + - 【人物名称@正常】酒逢知己千杯少,话不投机半句多…… + 200105: + - 【人物名称@正常】这酒还是算了吧。 + 200106: + - 【人物名称@正常】不好意思,我很忙。 + #2002: 打招呼 + 200201: + - 【人物名称@正常】幸会幸会。不知您找在下有什么事情? + 200202: + - 【人物名称@正常】又是你啊,有事吗? + 200203: + - 【人物名称@正常】找我何事? + 200204: + - 【人物名称@正常】不好意思,我很忙。 + #2003: 买古董 + 200301: + - 【人物名称@正常】既然出得起价钱,此物便交予你了。 + 200302: + - 【人物名称@正常】罢了。惹不起你。此物便卖给你吧。 + 200303: + - 【人物名称@正常】【1】文,不能再少了。你身上的钱可不够。 + 200304: + - 【人物名称@正常】我们好像不熟吧?抱歉这是我心爱之物,不能随意割爱。 + 200305: + - 【人物名称@正常】不好意思,我很忙。 + #2004: 买药 + 200401: + - 【人物名称@正常】自无不可。 + 200402: + - 【人物名称@正常】你已经买过金疮药了。此物多买无益。 + 200403: + - 【人物名称@正常】你身上连【1】文都没有,可不足以买我的药。 + 200404: + - 【人物名称@正常】我的药不卖给险恶之人。快走快走。 + 200405: + - 【人物名称@正常】不好意思,我很忙。 + #2005: 获赠金疮药 + 200501: + - 【人物名称@正常】以你我的交情,还谈什么钱。这份金疮药我送你了。 + 200502: + - 【人物名称@正常】你已经买过金疮药了。此物多买无益。 + 200503: + - 【人物名称@正常】我这金疮药得来不易,以你我的交情,还不足以让我割爱。 + 200504: + - 【人物名称@正常】不好意思,我很忙。 + #2006: 揍人 + 200601: + - 【人物名称@正常】我和你无冤无仇……哎哟!哎哟! + 200602: + - 【人物名称@正常】刚刚才被你欺负了一场,怎么又来!哎哟! + 200603: + - 【人物名称@正常】呸,凭你的细胳膊细腿也配和我动手?找死。 + 200604: + - 【人物名称@正常】不好意思,我很忙。 + #2007: 请吃饭 + 200701: + - 【人物名称@正常】盛情难却,这次让你破费了。感谢,感谢。 + 200702: + - 【人物名称@正常】这不是刚吃过没多久吗?您也太客气了。 + 200703: + - 【人物名称@正常】怎么,你这是耍我呢? + 200704: + - 【人物名称@正常】你的饭菜,我可吃不起。 + 200705: + - 【人物名称@正常】不好意思,我很忙。 + #2008: 好处费 + 200801: + - 【人物名称@正常】哎哟,这,这多不好意思的。 + 200802: + - 【人物名称@正常】哎哟,这,这多不好意思的。 + 200804: + - 【人物名称@正常】哎哟,您的钱我可不敢收,怕烫手。 + 200805: + - 【人物名称@正常】不好意思,我很忙。 + #2009: 帮挑水 + 200901: + - 【人物名称@正常】这可太感谢你了。 + 200902: + - 【人物名称@正常】这可太感谢你了。 + 200903: + - 【人物名称@正常】非亲非故的,不敢劳驾你。 + 200904: + - 【人物名称@正常】不好意思,我很忙。 + #2010: 一起钓鱼 + 201001: + - 【人物名称@正常】正合我意。走! + 201002: + - 【人物名称@正常】想不到你兴致这么浓。那我陪你去吧。 + 201003: + - 【人物名称@正常】钓鱼须得三五好友,情投意合才有乐趣。我跟你个陌生人去钓什么鱼! + 201004: + - 【人物名称@正常】不好意思,我很忙。 + #2011: 送货 + 201101: + - 【人物名称@正常】谢谢,货物我就收下了。 + 201102: + - 【人物名称@正常】你不是已经给过我了吗? + 201103: + - 【人物名称@正常】我看你面目可憎,这货我是不敢收的。回去换个人给我送吧。 + 201104: + - 【人物名称@正常】不好意思,我很忙。 + #2012: 给钱 + 201201: + - 【人物名称@正常】太客气了太客气了。 + 201202: + - 【人物名称@正常】太客气了太客气了。 + 201204: + - 【人物名称@正常】你这是干什么?非亲非故送人钱财,怕是不安好心。收回去吧。 + 201205: + - 【人物名称@正常】不好意思,我很忙。 + #2013: 邀请医生 + 201301: + - 【人物名称@正常】医者父母心,我这就陪你走一趟。诊金么,先预付个【1】文吧。 + 201302: + - 【人物名称@正常】医者父母心,陪你出诊倒是无妨。可是此人明明生龙活虎,你是想戏弄于我吗? + 201303: + - 【人物名称@正常】医者父母心,我这就陪你走一趟。不过这个诊金么,先预付个【1】文吧。 + 201304: + - 【人物名称@正常】话不投机,想要我陪你去却是万万不能。 + 201305: + - 【人物名称@正常】不好意思,我很忙。 + #2014: 给钱买药 + 201401: + - 【人物名称@正常】也罢。钱给我,这茶具你拿去吧。 + 201402: + - 【人物名称@正常】不是已经被你买走了吗?没有了没有了。你还来折腾什么? + 201403: + - 【人物名称@正常】我这茶具不便宜。你口袋里那几个钱可不够。 + 201404: + - 【人物名称@正常】别以为有两个破钱就了不起。这药不卖! + 201405: + - 【人物名称@正常】不好意思,我很忙。 + #2015: 开怀畅饮 + 201501: + - 【人物名称@正常】好酒!好酒!劳您破费了,咱们不醉不归! + 201502: + - 【人物名称@正常】太,太,太客气了,咱们再,再,再喝。 + 201503: + - 【人物名称@正常】我的酒量不小,你的身上的钱财怕是不够,还是算了吧。 + 201504: + - 【人物名称@正常】咱们不熟,这顿酒还是免了吧。 + 201505: + - 【人物名称@正常】不好意思,我很忙。 + #2016: 买回钗子 + 201601: + - 【人物名称@正常】行吧,一手交钱一手交货,钗子给你。 + 201602: + - 【人物名称@正常】不是已经把钗子卖给你了吗? + 201603: + - 【人物名称@正常】这钗子最少得【1】文钱,你那点钱可不够! + 201604: + - 【人物名称@正常】休想。这可是美人儿贴身的钗子,怎么能卖给你。 + 201605: + - 【人物名称@正常】不好意思,我很忙。 + #2017: 抢回钗子 + 201701: + - 【人物名称@正常】别,别动手,钗子在这里。给你给你。 + 201702: + - 【人物名称@正常】我,我不是已经把钗子给你了吗?哪里能给你再变个钗子出来! + 201703: + - 【人物名称@正常】想得美!想要回钗子,让她自己来跟我说! + 201704: + - 【人物名称@正常】不好意思,我很忙。 + #2018: 追回私吞款项 + 201801: + - 【人物名称@正常】别,别动手,有话好好说,钱,钱我这就给你。 + 201802: + - 【人物名称@正常】我,我不是已经把钱给你了吗?你还想做什么?! + 201803: + - 【人物名称@正常】就凭你?也敢找我追账?知道死字怎么写吗? + 201804: + - 【人物名称@正常】不好意思,我很忙。 + #2019: 探听身家 + 201901: + - 【人物名称@正常】别看我平时低调,悄悄跟你说,我的身家,最少有这个数,嘿嘿。 + 201902: + - 【人物名称@正常】不是跟你说过了吗? + 201903: + - 【人物名称@正常】你打听这个作什么?无可奉告! + 201904: + - 【人物名称@正常】不好意思,我很忙。 + #2020:解救被绑女孩 + 202001: + - 【人物名称@正常】你,你怎么知道的? + 【旁白@正常】在你的威吓之下,【1】战战兢兢地打开了地窖,一位柔弱的女子正蜷缩在里面哭泣。 + 【旁白@正常】恭喜,你成功解救了被绑架的女子。 + 202002: + - 【人物名称@正常】你不是已经把人救走了吗,还想干嘛。 + 202003: + - 【人物名称@正常】你在说什么,我完全听不懂! + 202004: + - 【人物名称@正常】不好意思,我很忙。 + #2021:审问罪犯供出老巢 + 202101: + - 【人物名称@正常】别动手,别动手,我说。 + 【旁白@正常】在你的威吓之下,【1】老老实实供出了老巢所在。你在一个月黑风高之日前去,起出了大笔金银财宝。 + 202102: + - 【人物名称@正常】我不是告诉你了吗,你已经得到答案。 + 202103: + - 【人物名称@正常】呸,你休想知道。 + 202104: + - 【人物名称@正常】不好意思,我很忙。 + #2022:交出藏宝图 + 202201: + - 【人物名称@正常】想不到你居然能打听到如此隐秘之事。 + 【旁白@正常】【1】趁你不备,掏出匕首向你捅来,却被你灵活闪过。一番争斗后,【1】不是你的对手,被迫交出了藏宝图。你在一个月黑风高的夜晚去挖出了藏宝,从此声名大振,富可敌国。 + 202202: + - 【人物名称@正常】你不是已经破解了藏宝图了吗? + 202203: + - 【人物名称@正常】我的秘药可不是随便给人用的。告辞! + 202204: + - 【人物名称@正常】不好意思,我很忙。 + #2023:抓捕人犯 + 202301: + - 【人物名称@正常】我自以为天衣无缝,居然还是被你发现了。天意啊,天意。 + 【旁白@正常】你和【1】一番惊天动地的大战。你浑身是伤,最终【1】不是你的对手,束手就擒,你成功破获了此案,声名大振,从此仕途一帆风顺,成为一代名捕。 + 202302: + - 【人物名称@正常】我不是已经认罪了吗?你这是想做什么! + 202303: + - 【人物名称@正常】就凭你,还不足以让我认罪。给我滚! + 202304: + - 【人物名称@正常】不好意思,我很忙。 + #2024:抓捕人犯 + 202401: + - 【人物名称@正常】嘿嘿,这还差不多,我告诉你啊,那天我刚好路过,听到一声惨叫,偷偷探头一看,发现【1】满脸鲜血,正在行凶! + 202402: + - 【人物名称@正常】不是告诉你了吗,行凶的是【1】。 + 202403: + - 【人物名称@正常】我这消息,最少值【1】文钱,你的钱可不够买我这消息。 + 202404: + - 【人物名称@正常】我跟你很熟吗?这钱我可不敢要。 + 202405: + - 【人物名称@正常】不好意思,我很忙。 + #2025:购买物品完成 + 202501: + - 【人物名称@正常】且让我看看。这,这正是我所需之物。感激不尽。 + 【旁白@正常】你将东西转交给【1】,【2】对你深表感激。 + 202502: + - 【人物名称@正常】你刚才不是已经交给我了吗? + 202503: + - 【人物名称@正常】你明明两手空空,想戏耍我不成? + 202504: + - 【人物名称@正常】虽然我需要此物,但是你给的我可不敢收。 + 202505: + - 【人物名称@正常】且让我看看。这,这根本是假货啊!你被人骗了!算了,算了。你辛苦一场,也不容易。这点钱你收下。 + 202506: + - 【人物名称@正常】不好意思,我很忙。 + #2026:大夫出诊完成 + 202601: + - 【人物名称@正常】大夫刚才已经来过,我感觉好多了。请受我一拜。 + 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 202602: + - 【人物名称@正常】正如刚才所言,大夫已经来过了。大恩不言谢,以后有什么困难可以找我。 + 202603: + - 【人物名称@正常】我可没见到大夫的影子。你是来此戏弄我吗? + 202604: + - 【人物名称@正常】大夫虽然来过,但是不是你请回来的我可不确定。 + 202605: + - 【人物名称@正常】不好意思,我很忙。 + #2027:寻回物品完成 + 202701: + - 【人物名称@正常】哎呀,这正是我丢失的。太谢谢你了。 + 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 202702: + - 【人物名称@正常】我不明白你的意思。之前丢的东西你不是已经帮我找回来了吗? + 202703: + - 【人物名称@正常】你明明两手空空,想戏耍我不成? + 202704: + - 【人物名称@正常】虽然我一直想寻回此物,但是你给的我可不敢收。 + 202705: + - 【人物名称@正常】不好意思,我很忙。 + #2028:打探肥羊完成 + 202801: + - 【人物名称@正常】想不到你还挺能干。很好。 + 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 202802: + - 【人物名称@正常】知道了,你不是说过了吗? + 202803: + - 【人物名称@正常】瞎编乱造,你这是不把我的话放在眼里了。你有没有去打探过消息,我可是一清二楚。 + 202804: + - 【人物名称@正常】以我俩的交情,你这话的的真假,可说不准啊。 + 202805: + - 【人物名称@正常】不好意思,我很忙。 + #2029:催账完成 + 202901: + - 【人物名称@正常】你居然帮我把那个老赖的钱收回来了?这是一点点感谢,不成敬意。 + 【旁白@正常】你帮【1】收回了【2】的欠款,【3】对你满口感谢,并递给你【4】文钱作为谢礼。 + 【旁白@正常】你与【1】的友好度改变【5】点,威慑度改变【6】点。 + 202902: + - 【人物名称@正常】你刚才不是已经给我了吗? + 202903: + - 【人物名称@正常】那钱呢?你这个骗子。 + 202904: + - 【人物名称@正常】无事献殷勤,来历不明的钱我可不敢收。 + 202905: + - 【人物名称@正常】不好意思,我很忙。 + #2030:催账 + 203001: + - 【人物名称@正常】我给,我给。别动手。 + 【旁白@正常】你从【1】手上要到了拖欠的债款。 + 203002: + - 【人物名称@正常】我不是已经给你了吗?难道你想讹诈我? + 203003: + - 【人物名称@正常】你算老几,敢来找我要钱。 + 203004: + - 【人物名称@正常】不好意思,我很忙。 + #2031:砸场子完成 + 203101: + - 【人物名称@正常】哈哈哈,太好了。你果然没让我失望。这点钱你收下,就当是辛苦费。 + 【旁白@正常】你帮【1】大大出了一口气,你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得【4】文作为辛苦费。 + 203102: + - 【人物名称@正常】知道了,不是给过你钱了吗? + 203103: + - 【人物名称@正常】莫要信口开河,年轻人。 + 203104: + - 【人物名称@正常】你自己做下的事情,与我何干。我们很熟吗? + 203105: + - 【人物名称@正常】不好意思,我很忙。 + #2032:砸场子 + 203201: + - 【人物名称@正常】你,你欺人太甚!快住手。 + 【旁白@正常】你无视【1】的阻拦,将眼前一切可以砸的都砸了个稀巴烂。 + 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 203202: + - 【人物名称@正常】你,你还来做什么,这里还有什么可以砸的吗? + 203203: + - 【人物名称@正常】就凭你那三脚猫的功夫也敢来找死? + 203204: + - 【人物名称@正常】不好意思,我很忙。 + #2033:探听隐私完成 + 203301: + - 【人物名称@正常】什,什么,竟有此事? + 【旁白@正常】【1】大惊失色。 + 【人物名称@正常】此事关联甚大。这点钱财你先收下。此事隐秘,切记不要乱传。 + 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得【4】文酬劳。 + 203302: + - 【人物名称@正常】你已经告知过我了,此事关联甚大,千万不要乱传。 + 203303: + - 【人物名称@正常】莫要信口开河,年轻人。 + 203304: + - 【人物名称@正常】只凭你我关系,还不足以让我信任于你。 + 203305: + - 【人物名称@正常】不好意思,我很忙。 + #2034:探听隐私 + 203401: + - 【人物名称@正常】莫名其妙。 + 【旁白@正常】【1】警惕地扫了你一眼,转身离去。你小心翼翼观察了下周围,远远跟在了【2】身后。 + 【旁白@正常】太阳渐渐落山,月亮爬上来了。 + 【旁白@正常】你悄悄爬上屋顶,掀开一片瓦片,烛光下,【1】对着镜子,正轻轻把自己的脸皮撕了下来。那居然是一张人皮面具!面具下,是一张陌生的人脸!震惊之下,你赶紧溜下了屋檐。 + 【旁白@正常】你成功打探到了【1】的隐私!你与【1】的友好度改变【3】点,威慑度改变【4】点。 + 203402: + - 【人物名称@正常】你已经知道他的隐私了。 + 203403: + - 【人物名称@正常】就凭你那三脚猫的功夫也敢来找死? + 203404: + - 【人物名称@正常】不好意思,我很忙。 + #2035:试药 + 203501: + - 【人物名称@正常】太好了。我正在找敢试药的人呢。你且来试试。先说好,出问题了可不关我事。 + 【旁白@正常】你一脸视死如归地接过了那鸽蛋大的药丸,张口就吞了下去。 + 【旁白@正常】你满面红光,感到浑身充满了力量。 + 【人物名称@正常】成,成功了??太好了。这是你的报酬。拿了钱,以后有什么头疼胸闷啥的可不许赖我。 + 【旁白@正常】你勇敢地帮【1】试药成功,你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得【4】文酬劳。 + 203502: + - 【人物名称@正常】太好了。我正在找敢试药的人呢。你且来试试。先说好,出问题了可不关我事。 + 【旁白@正常】你一脸视死如归地接过了那鸽蛋大的药丸,张口就吞了下去。 + 【旁白@正常】你眼前一黑,一头栽倒在地。 + 【旁白@正常】过了很久,你才悠悠醒过来,感到浑身像散架了一样。 + 【人物名称@正常】这,这可是你自愿的。不关我事,这点钱拿着,就算我给你的补偿。 + 【旁白@正常】很遗憾,你帮【1】试药失败,你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得【4】文补偿。 + 203503: + - 【人物名称@正常】你,你还来做什么,我没有药可以试了,快走快走。 + 203504: + - 【人物名称@正常】我们很熟吗? + 203505: + - 【人物名称@正常】不好意思,我很忙。 + #2036:证据账本完成 + 203601: + - 【人物名称@正常】快让我看看。 + 【旁白@正常】【1】接过账本,翻看几下,大笑起来。 + 【人物名称@正常】好,好,好,【2】你这次在劫难逃!壮士果然身手不凡。小小心意,还请收下。 + 【旁白@正常】你与【1】的友好度改变【3】点,威慑度改变【4】点。你获得【5】文酬劳。 + 203602: + - 【人物名称@正常】快让我看看。 + 【旁白@正常】【1】接过账本,翻看几下,脸色难看起来。 + 【人物名称@正常】此物是假的。看来【2】早有准备。再去也无益。罢了。无论如何,多谢壮士相助,壮士身手不凡,这点心意还请收下。 + 【旁白@正常】你与【1】的友好度改变【3】点,威慑度改变【4】点。你获得【5】文酬劳。 + 203603: + - 【人物名称@正常】你不是已经给过我了吗?此事关联甚大,千万不要乱传。 + 203604: + - 【人物名称@正常】快给我看看!什么,没有?你是在戏弄我吗? + 203605: + - 【人物名称@正常】只凭你我关系,还不足以让我认定此物真假。 + 203606: + - 【人物名称@正常】不好意思,我很忙。 + #2037:证据账本 + 203701: + - 【人物名称@正常】你说什么? + 【旁白@正常】你趁【1】不注意,一掌打晕了【2】。然后翻箱倒柜。 + 【旁白@正常】你成功偷取到了【2】的账本!你与【2】的友好度改变【3】点,威慑度改变【4】点。 + 203702: + - 【人物名称@正常】你说什么? + 【旁白@正常】你假装离去,趁夜摸进了【1】的密室,翻箱倒柜。 + 【旁白@正常】你成功偷取到了【1】的账本!你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 203703: + - 【人物名称@正常】你已经知道他的隐私了。 + 203704: + - 【人物名称@正常】就凭你那三脚猫的功夫也敢来找死? + 203705: + - 【人物名称@正常】不好意思,我很忙。 + #2038:证据账本类型2完成 + 203801: + - 【人物名称@正常】快让我看看。 + 【旁白@正常】【1】接过账本,翻看几下,大笑起来。 + 【人物名称@正常】好,好,好,你可以滚了。 + 【旁白@正常】【1】将账本藏在身后,突然间变了脸色。 + 【人物名称@正常】账本?什么账本。我没见到!再说话我连你一起告! + 【旁白@正常】【1】不由分说将你轰出了大门。你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 203802: + - 【人物名称@正常】无凭无据,说话小心点,再纠结此事,小心我连你一起送官。 + 203803: + - 【人物名称@正常】快给我看看!什么,没有?你是在戏弄我吗? + 203804: + - 【人物名称@正常】凭你我关系,如何才能让我相信这是真的呢? + 203805: + - 【人物名称@正常】不好意思,我很忙。 + #2039:栽赃陷害完成 + 203901: + - 【人物名称@正常】此事当真?好,好,好! + 【旁白@正常】【1】不住点头。 + 【人物名称@正常】我这就去报官!【2】这次不死也得给我扒一层皮!这是你的报酬,记得把嘴给我闭紧点! + 【旁白@正常】你帮【1】完成了给【1】栽赃的任务,你与【1】的友好度改变【3】点,威慑度改变【4】点。 + 203902: + - 【人物名称@正常】你在胡说什么!不是叫你把嘴闭紧点吗? + 203903: + - 【人物名称@正常】胡说八道,我怎么不知道有此事,年轻人。 + 203904: + - 【人物名称@正常】凭你我关系,如何才能让我相信这是真的呢? + 203905: + - 【人物名称@正常】不好意思,我很忙。 + #2040:栽赃陷害类型2完成 + 204001: + - 【人物名称@正常】此事当真?好,好,好! + 【旁白@正常】【1】不住点头。 + 【人物名称@正常】我这就去报官!【2】这次不死也得给我扒一层皮!至于你…… + 【旁白@正常】【1】突然露出一副奸计得逞的表情,上前一把扭住了你。 + 【人物名称@正常】你来历不明,还偷偷给【2】送钱,狼狈为奸,肯定是一伙的。走,跟我见官去!! + 【旁白@正常】你被【1】送到了官府。公堂上,你百口莫辩,被迫交出了【3】文钱才勉强脱身。 + 【旁白@正常】你被【1】这个卑鄙小人算计了!你与【1】的友好度改变【4】点,威慑度改变【5】点。 + 204002: + - 【人物名称@正常】你在胡说什么!怎么,还想再上一次公堂? + 204003: + - 【人物名称@正常】胡说八道,我怎么不知道有此事,年轻人。 + 204004: + - 【人物名称@正常】凭你我关系,如何才能让我相信这是真的呢? + 204005: + - 【人物名称@正常】不好意思,我很忙。 + #2041:栽赃陷害类型2完成 + 204101: + - 【人物名称@正常】我已知晓此事,辛苦你了。 + 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得了【4】文辛苦费。 + 204102: + - 【人物名称@正常】此事你已经跟我说过了。 + 204103: + - 【人物名称@正常】莫要信口开河,究竟做没做我心里很清楚。 + 204104: + - 【人物名称@正常】凭你我关系,我可不敢相信。 + 204105: + - 【人物名称@正常】不好意思,我很忙。 + -- libgit2 0.27.1