diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/constants/MqttTopicConstants.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/constants/MqttTopicConstants.java index 183b2d6..d4166d4 100644 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/constants/MqttTopicConstants.java +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/api/constants/MqttTopicConstants.java @@ -21,5 +21,10 @@ public interface MqttTopicConstants { */ String RUN_REPORT_ANALYSE_RESULT = "topic_run_report_analyse_result"; + /** + * 识别结果 + */ + String IDENTITY_RESULT = "topic_hznlm_identify_result"; + } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java index 9d79754..12aefc3 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/factory/AnswerResolveFactory.java @@ -21,6 +21,7 @@ public class AnswerResolveFactory { public static final String REMOTE_ANSWER_SERVICE = "remoteAnswerResolveService"; public static final String PARAM_ANSWER_SERVICE = "paramAnswerResolveService"; public static final String PRE_ANSWER_SERVICE = "preAnswerResolveService"; + public static final String CONTROL_DEVICE_SERVICE = "controlAnswerResolveService"; public static IAnswerResolveService getResolveService(Object extra) { String funcCode = JSONObject.parseObject(JSON.toJSONString(extra)).getString("func"); @@ -44,6 +45,8 @@ public class AnswerResolveFactory { return SpringUtil.getBean(REMOTE_ANSWER_SERVICE); case SHOW_PARAM: return SpringUtil.getBean(PARAM_ANSWER_SERVICE); + case CONTROL_DEVICE: + return SpringUtil.getBean(CONTROL_DEVICE_SERVICE); default: return null; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ControlAnswerResolveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ControlAnswerResolveServiceImpl.java new file mode 100644 index 0000000..8037e44 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ControlAnswerResolveServiceImpl.java @@ -0,0 +1,32 @@ +package com.hnac.hzims.bigmodel.interactive.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hnac.hzims.bigmodel.interactive.factory.AnswerResolveFactory; +import com.hnac.hzims.bigmodel.interactive.service.IAnswerResolveService; +import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; +import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @Author: huangxing + * @Date: 2024/08/30 11:33 + */ +@Service(AnswerResolveFactory.CONTROL_DEVICE_SERVICE) +@Slf4j +public class ControlAnswerResolveServiceImpl implements IAnswerResolveService { + + @Override + public AnswerVO resolve(AnswerVO answer) { + Object[] extraArray = this.extraStream(answer).map(this::getExtra).toArray(); + answer.setExtras(extraArray); + return answer; + } + + @Override + public ExtraVO getExtra(JSONObject originExtra) { + log.info("控制指令传参为:{}", JSON.toJSONString(originExtra)); + return null; + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java index 328e7b0..b5621d3 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java @@ -65,8 +65,7 @@ public class AnswerVO implements Serializable { return new AnswerVO(sessionId,userId,0,-2,null,query, InfoMessageConstant.ERROR_MESSAGE, null,null,new String[]{InfoMessageConstant.ERROR_MESSAGE}); } - public static void error(AnswerVO usualVO) { - usualVO.setRunning(0); - usualVO.setStatus(-2); + public static AnswerVO progress(String sessionId,String userId,String query,String message,Integer status) { + return new AnswerVO(sessionId,userId,1,status,null,query, message, null,null,new String[]{message}); } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java index d4bf7e7..6ffbf5a 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/FrontEndInteractiveSchedule.java @@ -50,34 +50,35 @@ public class FrontEndInteractiveSchedule { return ReturnT.SUCCESS; } List answerList = hznlmInvokeService.getAnswerBySessionIds(String.join(",", sessionIds)); - answerList.stream().parallel().forEach(answerVO -> CompletableFuture.runAsync(() -> { - // 如果已经获取到答案 则删除缓存 - if(answerVO.getRunning() == 0) { - log.info("获取大模型解析答案:{}" , JSON.toJSONString(answerVO)); - sessionRedisManager.removeSessionId(answerVO.getChatId()); - } - Object[] extras = answerVO.getExtras(); - if(ObjectUtil.isNotEmpty(answerVO.getExtras()) && extras.length > 0){ - try { - // 解析答案 - Object[] resolveExtras = Arrays.stream(extras).map(extra -> { - IAnswerResolveService answerResolveService = AnswerResolveFactory.getResolveService(extra); - if(Func.isNotEmpty(answerResolveService)) { - JSONObject extraObject = JSONObject.parseObject(JSON.toJSONString(extra)); - return answerResolveService.getExtra(extraObject); - } - return extra; - }).map(JSON::toJSONString).toArray(); - answerVO.setExtras(resolveExtras); - } - catch(Exception e) { - log.error("An error occurred",e); - AnswerVO.error(answerVO.getChatId(), answerVO.getUserId(), answerVO.getQuery()); - } - } - TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO)); - wsService.sendMessage(answerVO.getChatId(),message); - }, getAnswerPoolExecutor)); + answerList.stream().parallel().forEach(answerVO -> CompletableFuture.runAsync(() -> this.formatAnswer(answerVO), getAnswerPoolExecutor)); return ReturnT.SUCCESS; } + + private void formatAnswer(AnswerVO answerVO) { + // 如果已经获取到答案 则删除缓存 + if(answerVO.getRunning() == 0) { + log.info("获取大模型解析答案:{}", JSON.toJSONString(answerVO)); + sessionRedisManager.removeSessionId(answerVO.getChatId()); + } + Object[] extras = answerVO.getExtras(); + // 格式化 extra + if(Func.isNotEmpty(extras)) { + try { + Object[] resolveExtras = Arrays.stream(extras).map(extra -> { + IAnswerResolveService answerResolveService = AnswerResolveFactory.getResolveService(extra); + if (Func.isNotEmpty(answerResolveService)) { + JSONObject extraObject = JSONObject.parseObject(JSON.toJSONString(extra)); + return answerResolveService.getExtra(extraObject); + } + return extra; + }).map(JSON::toJSONString).toArray(); + answerVO.setExtras(resolveExtras); + } catch(Exception e) { + log.error("An error occurred",e); + AnswerVO.error(answerVO.getChatId(), answerVO.getUserId(), answerVO.getQuery()); + } + } + TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO)); + wsService.sendMessage(answerVO.getChatId(),message); + } } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java index b9e8f2c..6cfe4e7 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; * * @author xuxueli 2017-04-28 */ -@Configuration +//@Configuration @Slf4j public class XxlJobConfig { diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ObjectUserMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ObjectUserMapper.java index 58c01bd..7a42592 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ObjectUserMapper.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ObjectUserMapper.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.obj.mapper; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import org.springblade.core.datascope.annotation.UserDataAuth; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; @@ -16,5 +17,6 @@ import java.util.List; public interface ObjectUserMapper extends BaseMapper{ @UserDataAuth + @InterceptorIgnore(tenantLine = "true") List getPageList(@Param("user") ObjectUserListQuery user); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.java index 4bbad5a..7ab8ae1 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.obj.mapper; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; @@ -18,6 +19,7 @@ public interface ProjectContentMapper extends BaseMapper{ * @param projectId 项目id * @return */ + @InterceptorIgnore(tenantLine = "true") List getListByProjectId(Long projectId); /** @@ -26,6 +28,7 @@ public interface ProjectContentMapper extends BaseMapper{ * @param projectId 项目id * @return */ + @InterceptorIgnore(tenantLine = "true") List getListByPrjId(Long projectId); @@ -35,5 +38,6 @@ public interface ProjectContentMapper extends BaseMapper{ * @param projectId * @return */ + @InterceptorIgnore(tenantLine = "true") Integer getMaxSortProjectContentByProjectId(Long projectId); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/TemplateProjectMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/TemplateProjectMapper.java index 4e67f3b..2a718db 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/TemplateProjectMapper.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/TemplateProjectMapper.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.obj.mapper; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity; import com.hnac.hzinfo.inspect.obj.vo.ProjectContentDto; @@ -17,6 +18,7 @@ public interface TemplateProjectMapper extends BaseMapper * 根据模板id获取项目 * @param templateId */ + @InterceptorIgnore(tenantLine = "true") List getListByTemplateId(Long templateId); /** @@ -24,6 +26,7 @@ public interface TemplateProjectMapper extends BaseMapper * 根据模板id获取项目内容 * @param templateId */ + @InterceptorIgnore(tenantLine = "true") List getProjectsByTemplateId(Long templateId); /** @@ -31,5 +34,6 @@ public interface TemplateProjectMapper extends BaseMapper * @param templateId * @return */ + @InterceptorIgnore(tenantLine = "true") Integer getMaxSortTemplateProjectByTemplateId(Long templateId); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectMapper.java index 6366203..40c29ae 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectMapper.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectMapper.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.task.mapper; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; @@ -17,9 +18,12 @@ import java.util.List; @Mapper public interface TaskObjectMapper extends BaseMapper { + @InterceptorIgnore(tenantLine = "true") List getTaskObjects(@Param("to") TaskObjectEntity to); + @InterceptorIgnore(tenantLine = "true") List getTaskObjectsDetail(@Param("to") TaskObjectEntity to); + @InterceptorIgnore(tenantLine = "true") List getExObjectData(@Param("taskIds") List taskIds); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectContentMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectContentMapper.java index a4bb9dd..3d33b96 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectContentMapper.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectContentMapper.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.task.mapper; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity; import org.apache.ibatis.annotations.Mapper; @@ -15,5 +16,6 @@ import java.util.List; @Mapper public interface TaskObjectProjectContentMapper extends BaseMapper { + @InterceptorIgnore(tenantLine = "true") List getTaskObjectProjectContents(@Param("topc")TaskObjectProjectContentEntity topc); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectMapper.java index 5576f33..2f26684 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectMapper.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskObjectProjectMapper.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.task.mapper; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity; import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO; @@ -16,7 +17,9 @@ import java.util.List; @Mapper public interface TaskObjectProjectMapper extends BaseMapper { + @InterceptorIgnore(tenantLine = "true") List getTaskObjectProjects(@Param("top")TaskObjectProjectEntity top); + @InterceptorIgnore(tenantLine = "true") List getObjectProjectData(@Param("taskIds") List taskIds); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskUserMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskUserMapper.java index cf02c0e..7069d1b 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskUserMapper.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskUserMapper.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.task.mapper; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; import org.apache.ibatis.annotations.Mapper; @@ -19,9 +20,12 @@ public interface TaskUserMapper extends BaseMapper { * @param planId 计划id * @return */ + @InterceptorIgnore(tenantLine = "true") int deleteByPlanId(@Param("planId") Long planId); + @InterceptorIgnore(tenantLine = "true") int updateDeleteStatus(@Param("taskId") Long taskId); + @InterceptorIgnore(tenantLine = "true") List getOfflineTaskUser(@Param("taskIds") List taskIds); } diff --git a/hzims-service/inspect/src/main/resources/template/template.yml b/hzims-service/inspect/src/main/resources/template/template.yml index d98efae..b76ac2c 100644 --- a/hzims-service/inspect/src/main/resources/template/template.yml +++ b/hzims-service/inspect/src/main/resources/template/template.yml @@ -36,8 +36,8 @@ swagger: xxl: job: auto: - registry: 0 - accessToken: '' + registry: 1 + accessToken: 'hzinfo88238888!' admin: addresses: http://${hzims.xxljob.ip}:${hzims.xxljob.port}/xxl-job-admin executor: diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java index 87e5702..abd57d1 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; * * @author xuxueli 2017-04-28 */ -@Configuration +//@Configuration @Slf4j public class XxlJobConfig { diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java index 702c252..7ce7f09 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java @@ -237,7 +237,7 @@ public class SafetyToolServiceImpl extends ServiceImpl pdfList = new ArrayList<>(entityList.size()); entityList.forEach(entity -> { - String imgPath = uploadPath + "/" + entity.getTenantId() + entity.getToolCode() + UPLOAD_IMG_SUFFIX; + String imgPath = uploadPath + "/" + entity.getTenantId() + entity.getToolCode().trim() + UPLOAD_IMG_SUFFIX; File file = new File(imgPath); if (!file.exists()) { /**生成二维码**/ diff --git a/hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java b/hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java index 17addb3..9218773 100644 --- a/hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java +++ b/hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; * * @author xuxueli 2017-04-28 */ -@Configuration +//@Configuration @Slf4j public class XxlJobConfig { diff --git a/hzims-service/weather/src/main/resources/template/template.yml b/hzims-service/weather/src/main/resources/template/template.yml index 07e71e7..4f99325 100644 --- a/hzims-service/weather/src/main/resources/template/template.yml +++ b/hzims-service/weather/src/main/resources/template/template.yml @@ -30,8 +30,8 @@ mybatis-plus: xxl: job: auto: - registry: 0 - accessToken: '' + registry: 1 + accessToken: 'hzinfo88238888!' admin: addresses: "http://${hzims.xxljob.ip}:${hzims.xxljob.port}/xxl-job-admin" executor: