From 1a773eb0a62ac5d0b43408f2db5ad2a80538f5ba Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期一, 17 二月 2025 12:30:19 +0800 Subject: [PATCH] 往队列新增是,判断是往头部新增还是往尾部新增 --- ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java | 2 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 4 +- .idea/workspace.xml | 85 ++++++++++++++++++++++++++---------------- ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java | 4 +- ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java | 14 ++++++ smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java | 4 +- 6 files changed, 72 insertions(+), 41 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3472059..fb57478 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,28 +5,12 @@ </component> <component name="ChangeListManager"> <list default="true" id="d7325e97-ef1a-4946-a53e-fea72f2992f8" name="Changes" comment="浠g爜鎻愪氦"> - <change afterPath="$PROJECT_DIR$/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskdeptController.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/ruoyi-common/src/main/java/com/ruoyi/common/utils/OkHttpExample.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/common/LyraTokenUtil.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/BingRenXX.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/ExternalTaskInfo.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/QuerUserinfo.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/ServiceQueryFocus.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/ServiceQueryInfo.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/ServiceTaskInfo.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/ServiceTaskdept.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/XiaoXiTou.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/YeWuXX.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/domain/YongHuXX.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/mapper/ServiceTaskdeptMapper.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/mapper/SysTaskMapper.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/mapper/SysUserDeptMapper.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/IServiceTaskdeptService.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceTaskdeptServiceImpl.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/resources/mapper/smartor/ServiceTaskdeptMapper.xml" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/smartor/src/main/resources/mapper/smartor/SysUserDeptMapper.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java" beforeDir="false" afterPath="$PROJECT_DIR$/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java" beforeDir="false" afterPath="$PROJECT_DIR$/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> @@ -83,7 +67,7 @@ <property name="ToolWindow闂.ShowToolbar" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" /> <property name="aspect.path.notification.shown" value="true" /> - <property name="last_opened_file_path" value="$PROJECT_DIR$/../smartor" /> + <property name="last_opened_file_path" value="$PROJECT_DIR$/../smartor-wuxi" /> <property name="node.js.detected.package.eslint" value="true" /> <property name="node.js.detected.package.tslint" value="true" /> <property name="node.js.path.for.package.eslint" value="project" /> @@ -142,6 +126,14 @@ <option name="password" value="Smartor" /> <option name="port" value="6020" /> <option name="url" value="192.168.191.181" /> + </ConnectionInfo> + <ConnectionInfo> + <option name="global" value="false" /> + <option name="id" value="58aa81a0-3273-4f33-8973-55a6deb8702e" /> + <option name="name" value="116.62.18.175" /> + <option name="password" value="Smartor" /> + <option name="port" value="6020" /> + <option name="url" value="116.62.18.175" /> </ConnectionInfo> </list> </option> @@ -339,6 +331,8 @@ <workItem from="1739323404849" duration="23795000" /> <workItem from="1739411538383" duration="21710000" /> <workItem from="1739501318573" duration="2373000" /> + <workItem from="1739507523684" duration="15221000" /> + <workItem from="1739766088739" duration="469000" /> </task> <task id="LOCAL-00001" summary="浠g爜鎻愪氦"> <created>1730948127775</created> @@ -646,48 +640,73 @@ </line-breakpoint> <line-breakpoint type="java-line"> <url>file://$PROJECT_DIR$/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java</url> - <line>522</line> + <line>523</line> <option name="timeStamp" value="383" /> </line-breakpoint> <line-breakpoint type="java-line"> <url>file://$PROJECT_DIR$/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java</url> - <line>661</line> + <line>662</line> <option name="timeStamp" value="384" /> </line-breakpoint> <line-breakpoint type="java-line"> <url>file://$PROJECT_DIR$/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java</url> - <line>633</line> + <line>634</line> <option name="timeStamp" value="385" /> </line-breakpoint> <line-breakpoint type="java-line"> <url>file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java</url> - <line>1965</line> + <line>1983</line> <option name="timeStamp" value="386" /> </line-breakpoint> <line-breakpoint type="java-line"> <url>file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java</url> - <line>1961</line> + <line>1979</line> <option name="timeStamp" value="387" /> </line-breakpoint> - <line-breakpoint enabled="true" type="java-line"> + <line-breakpoint type="java-line"> <url>file://$PROJECT_DIR$/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java</url> <line>249</line> <option name="timeStamp" value="390" /> </line-breakpoint> - <line-breakpoint enabled="true" type="java-line"> + <line-breakpoint type="java-line"> <url>file://$PROJECT_DIR$/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java</url> <line>248</line> <option name="timeStamp" value="393" /> </line-breakpoint> - <line-breakpoint enabled="true" type="java-line"> + <line-breakpoint type="java-line"> <url>file://$PROJECT_DIR$/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java</url> <line>107</line> <option name="timeStamp" value="395" /> </line-breakpoint> + <line-breakpoint type="java-line"> + <url>file://$PROJECT_DIR$/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java</url> + <line>298</line> + <option name="timeStamp" value="404" /> + </line-breakpoint> + <line-breakpoint type="java-line"> + <url>file://$PROJECT_DIR$/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java</url> + <line>313</line> + <option name="timeStamp" value="405" /> + </line-breakpoint> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java</url> + <line>255</line> + <option name="timeStamp" value="412" /> + </line-breakpoint> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java</url> + <line>205</line> + <option name="timeStamp" value="415" /> + </line-breakpoint> <line-breakpoint enabled="true" type="java-line"> <url>file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java</url> - <line>1447</line> - <option name="timeStamp" value="397" /> + <line>1440</line> + <option name="timeStamp" value="416" /> + </line-breakpoint> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java</url> + <line>1489</line> + <option name="timeStamp" value="417" /> </line-breakpoint> <line-breakpoint enabled="true" type="java-method"> <url>file://$PROJECT_DIR$/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java</url> diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java index 25ed5af..5f3b6cd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java @@ -211,7 +211,7 @@ list.add(serviceSubtask2.getId().toString()); } log.error("缂撳瓨涓璫ache-0鐨勫�间负锛歿}", list); - redisCache.setCacheList("cache-0", list); + redisCache.setCacheListLeft("cache-0", list); } else { //闈炵珛鍗冲彂閫� ServiceSubtaskVO serviceSubtask1 = new ServiceSubtaskVO(); @@ -221,7 +221,7 @@ for (ServiceSubtask serviceSubtask2 : selectServiceSubtaskList1) { list.add(serviceSubtask2.getId().toString()); } - redisCache.setCacheList(key, list); + redisCache.setCacheListLeft(key, list); } } catch (Exception exception) { ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java index 6d48711..8665654 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java @@ -124,12 +124,24 @@ * @param dataList 寰呯紦瀛樼殑List鏁版嵁 * @return 缂撳瓨鐨勫璞� */ - public <T> long setCacheList(final String key, final List<T> dataList) { + public <T> long setCacheListRight(final String key, final List<T> dataList) { Long count = redisTemplate.opsForList().rightPushAll(key, dataList); return count == null ? 0 : count; } /** + * 缂撳瓨List鏁版嵁 + * + * @param key 缂撳瓨鐨勯敭鍊� + * @param dataList 寰呯紦瀛樼殑List鏁版嵁(杩欓噷濡傛灉鏂板鐨勮瘽锛屾槸寰�澶撮儴鏂板) + * @return 缂撳瓨鐨勫璞� + */ + public <T> long setCacheListLeft(final String key, final List<T> dataList) { + Long count = redisTemplate.opsForList().leftPushAll(key, dataList); + return count == null ? 0 : count; + } + + /** * 鑾峰緱缂撳瓨鐨刲ist瀵硅薄 * * @param key 缂撳瓨鐨勯敭鍊� diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java index 00c9162..25925f2 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java @@ -344,7 +344,7 @@ } //灏嗚鎵ц鐨勬斁鍒扮紦瀛樹腑 if (list.size() > 0) { - redisCache.setCacheList("cache-0", list); + redisCache.setCacheListLeft("cache-0", list); } } else if (descByCode.equals("澶氬獟浣�")) { //澶氬獟浣� diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java index 75515fe..5c13879 100644 --- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java @@ -276,7 +276,7 @@ if (serviceSubTaskCacheReq.getType() != null && serviceSubTaskCacheReq.getType() == 2) { //闂嵎 redisCache.deleteObject(pid + "-" + tid + "-WJscriptCache"); - redisCache.setCacheList(pid + "-" + tid + "-WJscriptCache", serviceSubTaskCacheReq.getSvyLibTemplateScriptVOS()); + redisCache.setCacheListRight(pid + "-" + tid + "-WJscriptCache", serviceSubTaskCacheReq.getSvyLibTemplateScriptVOS()); //璁剧疆杩囨湡鏃堕棿 3澶� Long tims = Long.valueOf(3 * 24 * 3600); boolean expire = redisCache.expire(pid + "-" + tid + "-WJscriptCache", tims); @@ -284,7 +284,7 @@ } else if (serviceSubTaskCacheReq.getType() != null && serviceSubTaskCacheReq.getType() == 1) { //闂嵎 redisCache.deleteObject(pid + "-" + tid + "-SFscriptCache"); - redisCache.setCacheList(pid + "-" + tid + "-SFscriptCache", serviceSubTaskCacheReq.getIvrLibaTemplateScriptVOList()); + redisCache.setCacheListRight(pid + "-" + tid + "-SFscriptCache", serviceSubTaskCacheReq.getIvrLibaTemplateScriptVOList()); //璁剧疆杩囨湡鏃堕棿 3澶� Long tims = Long.valueOf(3 * 24 * 3600); redisCache.expire(pid + "-" + tid + "-SFscriptCache", tims); diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java index c82af7b..38d74a8 100644 --- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java @@ -1487,7 +1487,7 @@ pullTaskVO.setAsrcallback(ASRCallBackPath); } } - if (existList.size() != 0) redisCache.setCacheList("cache-exist", existList); + if (existList.size() != 0) redisCache.setCacheListRight("cache-exist", existList); log.error("-----------瀹為檯鎷夊彇鐨勭數璇濇暟鎹噺锛歿}", pullTaskVOList.size()); return pullTaskVOList; } @@ -1541,7 +1541,7 @@ redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim(), ivrTaskTemplateScript.getId().toString(), 120, TimeUnit.MINUTES); } else { newValue0.add(subIds.get(i)); - redisCache.setCacheList(cacheName, newValue0); + redisCache.setCacheListRight(cacheName, newValue0); } } -- Gitblit v1.9.3