{"id":85532,"date":"2026-07-27T17:49:07","date_gmt":"2026-07-27T09:49:07","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/85532.html"},"modified":"2026-07-27T17:49:07","modified_gmt":"2026-07-27T09:49:07","slug":"%e5%ae%9e%e4%b9%a0%e7%ac%ac%e5%8d%81%e4%ba%8c%e5%a4%a9%e6%97%a5%e8%ae%b0%e5%91%a8%e4%b8%80%e3%80%902026-7-27%e3%80%91","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/85532.html","title":{"rendered":"\u5b9e\u4e60\u7b2c\u5341\u4e8c\u5929\u65e5\u8bb0\u5468\u4e00\u30102026.7.27\u3011"},"content":{"rendered":"<h2>\u4f8b\u884c\u65e9\u4f1a7 \u6708 27 \u65e5\u5b8c\u6574\u6574\u7406<\/h2>\n<h3>\u4e00\u3001\u65b0\u4eba\u4ecb\u7ecd<\/h3>\n<h3>\u4e8c\u3001\u5185\u7f51\u672c\u5730 GLM \u5927\u6a21\u578b\u8d44\u6e90\u8bf4\u660e<\/h3>\n<li>\u529e\u516c\u5ba4\u90e8\u7f72 GLM 4.7 \u5927\u6a21\u578b&#xff0c;\u670d\u52a1\u5668\u663e\u5361\u4e3a 2080&#xff08;22G \u663e\u5b58&#xff09;&#xff0c;\u4ec5\u8fd0\u884c\u8be5\u6a21\u578b&#xff0c;\u5176\u4ed6\u6a21\u578b\u5df2\u5378\u8f7d&#xff1b;<\/li>\n<li>\u8fd0\u884c\u77ed\u677f&#xff1a;\u6a21\u578b\u54cd\u5e94\u901f\u5ea6\u4e00\u822c&#xff1b;\u540e\u7eed\u8ba1\u5212\u5c1d\u8bd5\u5b89\u88c5 GLM 5.2&#xff0c;\u4f46\u663e\u5361\u663e\u5b58\u504f\u5c0f&#xff0c;\u5927\u6982\u7387\u65e0\u6cd5\u652f\u6491&#xff1b;<\/li>\n<li>\u4f7f\u7528\u573a\u666f&#xff1a;\u4e2a\u4eba\u5916\u90e8 API \u989d\u5ea6\u4e0d\u8db3\u65f6\u53ef\u5185\u7f51\u672c\u5730\u6a21\u578b\u8865\u5145\u4f7f\u7528&#xff0c;\u540e\u7eed\u65b0\u589e\u5185\u7f51\u8d44\u6e90\u4f1a\u540c\u6b65\u901a\u77e5&#xff0c;\u4f7f\u7528\u9075\u5faa\u5404\u9879\u76ee\u6307\u5bfc\u8001\u5e08\u5b89\u6392\u3002<\/li>\n<h3>\u4e09\u3001\u5404\u5b9e\u4e60\u751f\u4e0a\u5468\u4e94\u5de5\u4f5c\u6c47\u62a5 &#043; \u4eca\u65e5\u5de5\u4f5c\u8ba1\u5212<\/h3>\n<li>\u5b9e\u4e60\u751f 1&#xff08;\u642d\u5efa\u672c\u5730\u5f00\u53d1\u73af\u5883&#xff09;\n<ul>\n<li>\u4e0a\u5468\u4e94&#xff1a;\u5b8c\u6210\u672c\u5730\u5f00\u53d1\u73af\u5883\u642d\u5efa&#xff0c;Redis\u3001ES \u6570\u636e\u5e93\u914d\u7f6e\u5b8c\u6210&#xff0c;\u5bfc\u5165\u6d4b\u8bd5\u6570\u636e&#xff0c;\u9879\u76ee\u53ef\u6b63\u5e38\u8fd0\u884c&#xff1b;<\/li>\n<li>\u4eca\u65e5\u8ba1\u5212&#xff1a;\u5206\u4e24\u9636\u6bb5\u7814\u8bfb\u9879\u76ee\u6e90\u7801 \u2460 \u4e0a\u5348&#xff1a;\u719f\u6089\u6574\u4f53\u67b6\u6784&#xff0c;\u9605\u8bfb\u542f\u52a8\u7c7b Application\u3001\u5404\u9879\u76ee\u914d\u7f6e\u3001\u524d\u7aef\u8def\u7531&#xff0c;\u68b3\u7406\u7cfb\u7edf\u9875\u9762\u7ed3\u6784&#xff1b; \u2461 \u4e0b\u5348&#xff1a;\u6df1\u8015\u544a\u8b66\u6838\u5fc3\u4e1a\u52a1\u6a21\u5757&#xff0c;\u5b66\u4e60\u544a\u8b66\u6a21\u578b \/ \u89c4\u5219\u7ba1\u7406 Controller\u3001Service&#xff0c;\u91cd\u70b9\u7814\u7a76\u8ba1\u7b97\u5f15\u64ce\u3001\u89c4\u5219\u5f15\u64ce&#xff0c;\u68b3\u7406\u5b9a\u65f6\u4efb\u52a1\u8c03\u5ea6\u4e0e\u63a5\u53e3&#xff1b; \u2462 \u914d\u5957\u52a8\u4f5c&#xff1a;\u68b3\u7406\u4ee3\u7801\u8c03\u7528\u94fe\u8def&#xff0c;\u9047\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\u53ca\u65f6\u8bf7\u6559\u8001\u5e08&#xff0c;\u540c\u6b65\u8bb0\u5f55\u67b6\u6784\u3001\u4e1a\u52a1\u7b14\u8bb0\u4fbf\u4e8e\u590d\u76d8\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5b9e\u4e60\u751f 2&#xff08;\u804c\u5de5\u533b\u7597\u5065\u5eb7\u5927\u6a21\u578b\u5c0f\u7ec4&#xff09;\n<ul>\n<li>\u4e0a\u5468\u4e94&#xff1a;\u53c2\u4e0e\u9700\u6c42\u4f1a\u8bae&#xff0c;\u8bbe\u8ba1\u901a\u7528 JSON \u683c\u5f0f\u3001\u5f00\u53d1\u4e2a\u4eba\u4fe1\u606f\u6a21\u5757&#xff0c;\u73b0\u5b58\u95ee\u9898\u5df2\u540c\u6b65\u91d1\u54e5&#xff1b;<\/li>\n<li>\u4eca\u65e5\u8ba1\u5212&#xff1a;\u5f00\u4f1a\u8ba8\u8bba\u73b0\u5b58\u6a21\u5757\u95ee\u9898\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5b9e\u4e60\u751f 3&#xff08;\u540c\u533b\u7597\u5927\u6a21\u578b\u5c0f\u7ec4&#xff09;\n<ul>\n<li>\u4e0a\u5468\u4e94&#xff1a;\u540c\u6b65\u53c2\u4e0e\u9700\u6c42\u4f1a\u8bae&#xff0c;\u5b8c\u6210 MD \u8f6c JSON \u6807\u51c6\u5316\u6a21\u677f\u5f00\u53d1&#xff0c;\u4ee5\u6570\u636e\u9a71\u52a8\u8f6c\u6362&#xff1b;<\/li>\n<li>\u4eca\u65e5\u8ba1\u5212&#xff1a;\u968f\u5c0f\u7ec4\u5f00\u4f1a\u6c9f\u901a\u6a21\u5757\u95ee\u9898\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5b9e\u4e60\u751f 4&#xff08;\u80dc\u5229\u6cb9\u7530\u6210\u679c\u6570\u636e API \u9879\u76ee&#xff09;\n<ul>\n<li>\u4e0a\u5468\u4e94&#xff1a;\u53c2\u4f1a\u786e\u5b9a\u5f00\u53d1\u65b9\u5411 \u2014\u2014 \u5bf9\u5916\u63d0\u4f9b\u7b2c\u4e09\u65b9 API&#xff1b;\u9700\u6c42\u80cc\u666f&#xff1a;\u80dc\u5229\u6cb9\u7530\u4ec5\u6709\u539f\u59cb\u6570\u636e&#xff0c;\u7814\u53d1\u4eba\u5458\u6210\u679c\u6570\u636e\u5206\u6563\u6742\u4e71&#xff0c;\u8ba1\u5212\u4f9d\u6258\u5f53\u524d\u9879\u76ee\u642d\u5efa\u7edf\u4e00\u6210\u679c\u6570\u636e\u5e93&#xff0c;\u5148\u4ee5\u8212\u534e\u603b\u9879\u76ee\u4f5c\u4e3a\u793a\u8303\u63a5\u53e3\u5c55\u793a&#xff0c;\u540e\u7eed\u5168\u6cb9\u7530\u63a8\u5e7f&#xff1b;\u68b3\u7406\u63a5\u53e3\u5f00\u53d1\u6240\u9700\u5b57\u6bb5\u3001\u6570\u636e\u683c\u5f0f\u7b49\u57fa\u7840\u4fe1\u606f&#xff1b;<\/li>\n<li>\u4eca\u65e5\u8ba1\u5212&#xff1a;\u5b8c\u5584\u9700\u6c42\u65b9\u6848\u8bbe\u8ba1\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5b9e\u4e60\u751f 5&#xff08;\u524d\u7aef\u9875\u9762\u4fee\u590d&#xff09;\n<ul>\n<li>\u4e0a\u5468\u4e94&#xff1a;\u4fee\u590d\u6e05\u5355\u9875\u9762\u6309\u94ae\u5931\u6548\u95ee\u9898&#xff1b;\u6536\u5230\u738b\u8001\u9700\u6c42&#xff1a;\u8bbe\u8ba1\u8bf7\u5047\u5355\u7c7b\u4e1a\u52a1\u6d41\u7a0b\u56fe\u6d41\u8f6c\u903b\u8f91&#xff1b;<\/li>\n<li>\u4eca\u65e5\u8ba1\u5212&#xff1a;\u601d\u8003\u6d41\u7a0b\u56fe\u4e1a\u52a1\u8bbe\u8ba1\u65b9\u6848\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5b9e\u4e60\u751f 6&#xff08;\u73af\u5883\u90e8\u7f72 &#043; \u67b6\u6784\u68b3\u7406&#xff09;\n<ul>\n<li>\u4e0a\u5468\u4e94&#xff1a;\u5b8c\u6210\u73af\u5883\u914d\u7f6e\u3001\u6570\u636e\u5bfc\u5165&#xff0c;\u521d\u6b65\u719f\u6089\u529f\u80fd\u6a21\u5757\u5212\u5206&#xff1b;<\/li>\n<li>\u4eca\u65e5\u8ba1\u5212&#xff1a;\u7814\u8bfb\u524d\u540e\u7aef\u4ee3\u7801\u3001\u6392\u67e5\u4ee3\u7801\u95ee\u9898&#xff0c;\u7ed8\u5236\u7cfb\u7edf\u67b6\u6784\u56fe\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5b9e\u4e60\u751f 7&#xff08;RPA \u811a\u672c\u5f00\u53d1&#xff09;\n<ul>\n<li>\u4e0a\u5468\u4e94&#xff1a;\u5b8c\u6210\u624b\u52a8\u3001AI \u751f\u6210\u4e24\u79cd\u6a21\u5f0f\u7684 RPA \u811a\u672c\u5f55\u5236&#xff0c;\u719f\u6089\u6574\u4f53\u4e1a\u52a1\u6d41\u7a0b&#xff1b;<\/li>\n<li>\u4eca\u65e5\u8ba1\u5212&#xff1a;\u6392\u67e5 RPA \u811a\u672c\u6267\u884c\u5931\u8d25\u95ee\u9898&#xff0c;\u533a\u5206\u662f\u73af\u5883\u914d\u7f6e\u95ee\u9898\u8fd8\u662f\u9879\u76ee\u539f\u751f Bug\u3002<\/li>\n<\/ul>\n<\/li>\n<h3>\u56db\u3001\u540e\u7eed\u65e9\u4f1a\u5236\u5ea6\u8c03\u6574\u5b89\u6392<\/h3>\n<li>\u81ea\u660e\u65e5\u8d77\u5b9e\u884c\u4ea4\u53c9\u590d\u76d8\u673a\u5236&#xff1a;\u6bcf\u65e5\u65e9\u4f1a\u6c47\u62a5\u5b8c\u6210\u540e&#xff0c;\u7531\u5176\u4ed6\u9879\u76ee\u7ec4\u4eba\u5458\u590d\u8ff0\u3001\u89e3\u8bfb\u6c47\u62a5\u4eba\u5de5\u4f5c\u5185\u5bb9&#xff1b;<\/li>\n<li>\u5236\u5ea6\u76ee\u7684&#xff1a;\u6a21\u62df\u771f\u5b9e\u804c\u573a\u8de8\u9879\u76ee\u534f\u4f5c\u573a\u666f&#xff0c;\u953b\u70bc\u4fe1\u606f\u7406\u89e3\u3001\u8de8\u7ec4\u6c9f\u901a\u3001\u5934\u8111\u98ce\u66b4\u80fd\u529b&#xff0c;\u65b9\u4fbf\u5168\u5458\u5171\u4eab\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u3001\u8fc7\u5f80\u5de5\u4f5c\u7ecf\u9a8c&#xff1b;<\/li>\n<li>\u6267\u884c\u8bf4\u660e&#xff1a;\u73b0\u9636\u6bb5\u9879\u76ee\u6574\u6539\u5de5\u671f\u7d27\u5f20&#xff0c;\u65e9\u4f1a\u4ec5\u540c\u6b65\u57fa\u7840\u8fdb\u5ea6&#xff1b;\u540e\u7eed\u5f00\u53d1\u529f\u80fd\u589e\u591a\u540e&#xff0c;\u4f1a\u589e\u52a0\u6df1\u5ea6\u4e1a\u52a1\u8ba8\u8bba\u9891\u6b21&#xff1b;\u65e9\u4f1a\u6c9f\u901a\u6838\u5fc3\u4e3a\u5b9e\u4e60\u751f\u4e92\u76f8\u4ea4\u6d41\u4e92\u52a9&#xff0c;\u5e76\u975e\u5355\u7eaf\u5411\u9886\u5bfc\u6c47\u62a5\u3002<\/li>\n<h3>\u4e94\u3001\u5176\u4ed6\u4e8b\u52a1\u901a\u77e5<\/h3>\n<li>\u95e8\u7981\u6d4b\u8bd5&#xff1a;\u5168\u5458\u81ea\u884c\u6d4b\u8bd5\u95e8\u7981\u5237\u5361\u6743\u9650&#xff0c;\u591a\u6570\u4eba\u5df2\u53ef\u6b63\u5e38\u5237\u5f00&#xff1b;<\/li>\n<li>\u57f9\u8bad\u6574\u4f53\u8bc4\u4ef7&#xff1a;\u4e0a\u5468\u5b9e\u4e60\u57f9\u8bad\u671f\u95f4\u5927\u5bb6\u4e0a\u624b\u901f\u5ea6\u5feb&#xff0c;\u5728\u6821\u57fa\u7840\u624e\u5b9e&#xff0c;\u6574\u4f53\u72b6\u6001\u826f\u597d\u3002<\/li>\n<h3>\u516d\u3001\u672c\u5468\u5de5\u4f5c\u91cd\u70b9\u8981\u6c42<\/h3>\n<li>\u672c\u5468\u4e3a\u5b8c\u6574\u5de5\u4f5c\u5468&#xff0c;\u4f18\u5148\u68b3\u7406\u3001\u843d\u5730\u624b\u5934\u5206\u914d\u5de5\u4f5c&#xff1b;<\/li>\n<li>\u5f00\u53d1\u5b66\u4e60\u907f\u5751\u63d0\u9192&#xff1a;\n<ul>\n<li>\u82e5\u4ec5\u5b8c\u6210\u5355\u4e00\u5c0f\u529f\u80fd&#xff08;\u5982\u5355\u63a5\u53e3\u5f00\u53d1&#xff09;\u867d\u4e0a\u624b\u5feb&#xff0c;\u4f46\u5bb9\u6613\u53ea\u61c2\u5355\u70b9\u3001\u4e0d\u61c2\u6574\u4f53&#xff1b;<\/li>\n<li>\u5efa\u8bae\u5f00\u53d1\u524d\u4e3b\u52a8\u548c\u5bfc\u5e08\u6c9f\u901a\u4e1a\u52a1\u8bbe\u8ba1\u903b\u8f91&#xff0c;\u7406\u89e3\u529f\u80fd\u5f00\u53d1\u7684\u76ee\u7684\u4e0e\u4e1a\u52a1\u4ef7\u503c&#xff1b;<\/li>\n<li>\u6280\u672f\u7f16\u7801\u96be\u5ea6\u8f83\u4f4e&#xff0c;\u5b9e\u4e60\u6838\u5fc3\u5b66\u4e60\u4ef7\u503c\u5728\u4e8e\u7cfb\u7edf\u6574\u4f53\u8bbe\u8ba1\u601d\u8def&#xff0c;\u5207\u52ff\u53ea\u8ffd\u6c42\u5b8c\u6210\u4ee3\u7801\u3002<\/li>\n<\/ul>\n<\/li>\n<h3><\/h3>\n<h2>\u5de5\u4f5c\u5185\u5bb9<\/h2>\n<p>\u770b\u4ee3\u7801\u6587\u4ef6<\/p>\n<p>\u7b2c\u4e00\u9636\u6bb5\u3010\u67b6\u6784\u8def\u7531\u90e8\u5206\u3011<\/p>\n<h3 style=\"background-color:transparent\">\u542f\u52a8\u7c7b &#xff1a; BusinessRunApplication.java &#8211; \u4e86\u89e3\u7ec4\u4ef6\u626b\u63cf\u548c\u914d\u7f6e<\/h3>\n<p>BusinessRunApplication.java<\/p>\n<p>package cn.com.xxx.bussiness;<\/p>\n<p>import cn.com.xxx.boot.core.web.JsonMessage;<br \/>\nimport org.springframework.boot.SpringApplication;<br \/>\nimport org.springframework.boot.autoconfigure.SpringBootApplication;<br \/>\nimport org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;<br \/>\nimport org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;<br \/>\nimport org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;<br \/>\nimport org.springframework.context.annotation.ComponentScan;<br \/>\nimport org.springframework.scheduling.annotation.EnableScheduling;<br \/>\nimport org.springframework.web.bind.annotation.CrossOrigin;<br \/>\nimport org.springframework.web.bind.annotation.GetMapping;<br \/>\nimport org.springframework.web.bind.annotation.RequestMapping;<br \/>\nimport org.springframework.web.bind.annotation.ResponseBody;<br \/>\nimport org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;<br \/>\nimport com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;<\/p>\n<p>\/**<br \/>\n * \u9879\u76ee\u542f\u52a8\u7c7b &#8211; \u96c6\u6210\u8ba1\u7b97\u5f15\u64ce\u548c\u5b9a\u65f6\u4efb\u52a1<br \/>\n *<br \/>\n * &#064;author nick<br \/>\n * &#064;date 2025\/10\/27 10:26<br \/>\n * &#064;since 4.4.3<br \/>\n *\/<br \/>\n&#064;SpringBootApplication(exclude &#061; {<br \/>\n        MybatisAutoConfiguration.class,<br \/>\n        MybatisPlusAutoConfiguration.class<br \/>\n})<br \/>\n&#064;EnableScheduling \/\/ \u542f\u7528\u5b9a\u65f6\u4efb\u52a1\u652f\u6301<br \/>\n&#064;ComponentScan(basePackages &#061; { &#034;cn.com.xxx.bussiness&#034;, &#034;cn.com.xxx.calculation&#034;,<br \/>\n                &#034;cn.com.xxx.bussiness.znyw.engine&#034;, &#034;cn.com.xxx.bussiness.znyw.Log&#034; }) \/\/ \u626b\u63cfcalculation\u5305<br \/>\n&#064;RequestMapping<br \/>\n\/\/&#064;CrossOrigin(origins &#061; { &#034;*&#034;,&#034;http:\/\/localhost:8090&#034;, &#034;http:\/\/localhost:63342&#034;, &#034;http:\/\/127.0.0.1:63342&#034;,<br \/>\n\/\/                &#034;http:\/\/localhost:3000&#034;, &#034;http:\/\/localhost:8080&#034; })<br \/>\n&#064;CrossOrigin(origins &#061; { &#034;*&#034; })<br \/>\npublic class BusinessRunApplication {<br \/>\n        public static void main(String[] args) {<br \/>\n                \/\/ \u7981\u7528JMX\u4ee5\u907f\u514d\u68c0\u7d22\u95ee\u9898<br \/>\n                System.setProperty(&#034;spring.jmx.enabled&#034;, &#034;false&#034;);<br \/>\n                System.setProperty(&#034;management.endpoints.jmx.exposure.include&#034;, &#034;&#034;);<\/p>\n<p>                SpringApplication.run(BusinessRunApplication.class, args);<br \/>\n        }<\/p>\n<p>        \/*<br \/>\n         * &#064;GetMapping(&#034;\/&#034;)<br \/>\n         *<br \/>\n         * &#064;ResponseBody<br \/>\n         * public JsonMessage main(){<br \/>\n         * return new JsonMessage().success(&#034;main&#034;);<br \/>\n         * }<br \/>\n         *\/<br \/>\n}<\/p>\n<p>\u4ee3\u7801\u5b8c\u6574\u9010\u6bb5\u8bb2\u89e3<\/p>\n<p>\u8fd9\u662f\u4e00\u5957SpringBoot \u5fae\u670d\u52a1\u542f\u52a8\u7c7b&#xff0c;\u6574\u5408\u5b9a\u65f6\u4efb\u52a1\u3001\u8de8\u57df\u914d\u7f6e\u3001\u81ea\u5b9a\u4e49\u5305\u626b\u63cf\u3001\u6392\u9664 MyBatis \u81ea\u52a8\u88c5\u914d\u3001\u5173\u95ed JMX \u76d1\u63a7\u7b49\u4f01\u4e1a\u7ea7\u914d\u7f6e&#xff0c;\u4e0b\u9762\u5206\u5305\u3010package\u3011\u3001\u5bfc\u5165\u3010import\u3011\u3001\u6ce8\u89e3\u3010&#064;\u3011\u3001\u7c7b\u3010class\u3011\u3001main \u65b9\u6cd5\u3001\u6d4b\u8bd5\u63a5\u53e3\u516d\u90e8\u5206\u62c6\u89e3\u3002<\/p>\n<p>\u4e00\u3001\u5305\u5b9a\u4e49<\/p>\n<p>package cn.com.xxx.business;<\/p>\n<ul>\n<li>\n<p>\u89c4\u8303&#xff1a;cn.com.xxx \u4ee3\u8868xxx\u4f01\u4e1a\u9879\u76ee&#xff1b;<\/p>\n<\/li>\n<li>\n<p>bussiness \u4e1a\u52a1\u6a21\u5757\u5305&#xff0c;\u5f53\u524d\u542f\u52a8\u7c7b\u5c5e\u4e8e\u4e1a\u52a1\u670d\u52a1&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<p>\u4e8c\u3001import \u5bfc\u5165\u7c7b\u8bf4\u660e<\/p>\n<p>1. \u6846\u67b6\u6838\u5fc3<\/p>\n<p>import org.springframework.boot.SpringApplication;<br \/>\nimport org.springframework.boot.autoconfigure.SpringBootApplication;<\/p>\n<p>SpringBoot \u542f\u52a8\u5668<span style=\"color:#fe2c24\">\u6838\u5fc3\u7c7b<\/span>&#xff0c;\u6240\u6709 Boot \u9879\u76ee<span style=\"color:#fe2c24\">\u5fc5\u5907<\/span>\u3002<\/p>\n<p>2. \u6570\u636e\u5e93\u81ea\u52a8\u914d\u7f6e<\/p>\n<p>import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;<br \/>\nimport org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;<br \/>\nimport org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;<\/p>\n<p>Spring \u539f\u751f\u6570\u636e\u6e90\u3001\u4e8b\u52a1\u3001JPA \u81ea\u52a8\u88c5\u914d\u7c7b&#xff0c;\u672c\u9879\u76ee\u6ca1\u6709\u6392\u9664\u8fd9\u51e0\u4e2a&#xff0c;\u8bf4\u660e\u9879\u76ee\u6ca1\u6709\u5b8c\u5168\u5c4f\u853d\u539f\u751f JDBC\u3002<\/p>\n<p>3. Web \u7edf\u4e00\u8fd4\u56de\u4f53<\/p>\n<p>import cn.com.xxx.boot.core.web.JsonMessage;<\/p>\n<p>\u4f01\u4e1a\u5185\u90e8\u901a\u7528\u8fd4\u56de\u5de5\u5177\u7c7b&#xff0c;\u63a5\u53e3\u7edf\u4e00\u8fd4\u56de<span style=\"color:#fe2c24\"> JsonMessage<\/span>&#xff08;\u5305\u542b code\u3001msg\u3001data&#xff0c;\u6807\u51c6\u524d\u540e\u7aef\u4ea4\u4e92\u683c\u5f0f&#xff09;\u3002<\/p>\n<p>4. \u5b9a\u65f6\u4efb\u52a1<\/p>\n<p>import org.springframework.scheduling.annotation.EnableScheduling;<\/p>\n<p>\u5f00\u542f Spring \u5b9a\u65f6\u4efb\u52a1\u80fd\u529b&#xff0c;\u914d\u5408&#064;Scheduled\u6ce8\u89e3\u5b9e\u73b0\u5b9a\u65f6\u8c03\u5ea6\u3002<\/p>\n<p>5. Controller Web \u6ce8\u89e3<\/p>\n<p>import org.springframework.web.bind.annotation.CrossOrigin;<br \/>\nimport org.springframework.web.bind.annotation.GetMapping;<br \/>\nimport org.springframework.web.bind.annotation.RequestMapping;<br \/>\nimport org.springframework.web.bind.annotation.ResponseBody;<\/p>\n<p><span style=\"color:#fe2c24\">Web \u63a7\u5236\u5668\u6ce8\u89e3&#xff0c;\u7528\u4e8e\u5199\u63a5\u53e3\u3001\u8de8\u57df\u3001\u8def\u5f84\u6620\u5c04\u3002<\/span><\/p>\n<p>6. MyBatis \/ MyBatisPlus \u81ea\u52a8\u88c5\u914d\u7c7b<\/p>\n<p>import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;<br \/>\nimport com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;<\/p>\n<p>MyBatis\u3001MyBatis-Plus \u5b98\u65b9\u81ea\u52a8\u914d\u7f6e\u7c7b&#xff0c;\u4ee3\u7801\u4e2d\u4e3b\u52a8\u6392\u9664\u4e86\u8fd9\u4e24\u4e2a\u81ea\u52a8\u88c5\u914d\u3002<\/p>\n<p>\u4e09\u3001\u7c7b\u4e0a\u6ce8\u89e3&#xff08;\u6838\u5fc3\u91cd\u70b9&#xff09;<\/p>\n<p>1. <span style=\"color:#fe2c24\">&#064;SpringBootApplicatio<\/span>n(exclude &#061; {})<\/p>\n<p>&#064;SpringBootApplication(exclude &#061; {<br \/>\n        MybatisAutoConfiguration.class,<br \/>\n        MybatisPlusAutoConfiguration.class<br \/>\n})<\/p>\n<p>&#064;SpringBootApplication &#061; &#064;Configuration &#043; &#064;EnableAutoConfiguration &#043; &#064;ComponentScan<\/p>\n<ul>\n<li>\n<p>\u4f5c\u7528&#xff1a;SpringBoot \u542f\u52a8\u6838\u5fc3\u6ce8\u89e3&#xff0c;\u81ea\u52a8\u52a0\u8f7d\u6846\u67b6\u81ea\u52a8\u914d\u7f6e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>exclude \u6392\u9664\u914d\u7f6e&#xff1a;\u7981\u7528 MyBatis\u3001MyBatis-Plus \u7684\u81ea\u52a8\u88c5\u914d \u573a\u666f\u89e3\u91ca&#xff1a;<\/p>\n<li>\n<p>\u9879\u76ee\u53ef\u80fd\u624b\u52a8\u81ea\u5b9a\u4e49 MyBatis \u914d\u7f6e&#xff08;\u81ea\u5df1\u5199 MapperScan\u3001SqlSessionFactory&#xff09;&#xff0c;\u9632\u6b62\u6846\u67b6\u81ea\u52a8\u914d\u7f6e\u51b2\u7a81&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u591a\u6570\u636e\u6e90\u573a\u666f&#xff0c;\u5c4f\u853d\u81ea\u52a8\u88c5\u914d\u907f\u514d\u6570\u636e\u6e90\u521b\u5efa\u51b2\u7a81&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u90e8\u5206\u6a21\u5757\u4e34\u65f6\u4e0d\u9700\u8981\u6570\u636e\u5e93\u64cd\u4f5c&#xff0c;\u76f4\u63a5\u5c4f\u853d ORM \u6846\u67b6\u3002<\/p>\n<\/li>\n<\/li>\n<\/ul>\n<p>2. <span style=\"color:#fe2c24\">&#064;EnableScheduling<\/span><\/p>\n<p>&#064;EnableScheduling \/\/ \u542f\u7528\u5b9a\u65f6\u4efb\u52a1\u652f\u6301<\/p>\n<p>\u5f00\u542f Spring \u5185\u7f6e\u5b9a\u65f6\u4efb\u52a1&#xff0c;\u5f00\u542f\u540e\u9879\u76ee\u4e2d\u4efb\u610f&#064;Component\u7c7b\u53ef\u4ee5\u4f7f\u7528&#xff1a;<\/p>\n<p>&#064;Scheduled(cron &#061; &#034;0 0 1 * * ?&#034;)<br \/>\npublic void task(){}<\/p>\n<p>\u5b9e\u73b0\u5b9a\u65f6\u6267\u884c\u4e1a\u52a1&#xff08;\u6570\u636e\u8ba1\u7b97\u3001\u62a5\u8868\u751f\u6210\u3001\u5de1\u68c0\u7b49&#xff0c;\u5339\u914d\u9879\u76eecalculation\u8ba1\u7b97\u5f15\u64ce\u5305&#xff09;\u3002<\/p>\n<p>3. <span style=\"color:#fe2c24\">&#064;ComponentScan<\/span>(basePackages &#061; {})<\/p>\n<p>&#064;ComponentScan(basePackages &#061; {<br \/>\n    &#034;cn.com.xxx.bussiness&#034;,<br \/>\n    &#034;cn.com.xxx.calculation&#034;,<br \/>\n    &#034;cn.com.xxx.bussiness.znyw.engine&#034;,<br \/>\n    &#034;cn.com.xxx.bussiness.znyw.Log&#034;<br \/>\n})<\/p>\n<p>\u81ea\u5b9a\u4e49 Spring Bean \u626b\u63cf\u8303\u56f4&#xff0c;\u8986\u76d6 4 \u4e2a\u4e1a\u52a1\u5305&#xff1a;<\/p>\n<li>\n<p>cn.com.xxx.bussiness&#xff1a;\u5f53\u524d\u4e1a\u52a1\u4e3b\u6a21\u5757&#xff1b;<\/p>\n<\/li>\n<li>\n<p>cn.com.xxx.calculation&#xff1a;\u72ec\u7acb\u8ba1\u7b97\u5f15\u64ce\u6a21\u5757&#xff08;\u9879\u76ee\u6838\u5fc3&#xff0c;\u505a\u6570\u636e\u8fd0\u7b97\u3001\u6a21\u578b\u8ba1\u7b97&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>znyw.engine&#xff1a;\u667a\u80fd\u4e1a\u52a1\u5f15\u64ce&#xff1b;<\/p>\n<\/li>\n<li>\n<p>znyw.Log&#xff1a;\u667a\u80fd\u4e1a\u52a1\u65e5\u5fd7\u5904\u7406&#xff1b;<\/p>\n<\/li>\n<p><span style=\"color:#fe2c24\">\u4e3a\u4ec0\u4e48\u624b\u52a8\u5199 &#064;ComponentScan&#xff1f;<\/span><\/p>\n<p><span style=\"color:#fe2c24\">\u9ed8\u8ba4&#064;SpringBootApplication\u53ea\u4f1a\u626b\u63cf\u5f53\u524d\u542f\u52a8\u7c7b\u6240\u5728\u5305\u53ca\u5176\u5b50\u5305&#xff1b; \u800c calculation \u662f\u72ec\u7acb\u5e73\u7ea7\u5305&#xff0c;\u9ed8\u8ba4\u626b\u63cf\u4e0d\u5230&#xff0c;\u5fc5\u987b\u624b\u52a8\u6307\u5b9a\u626b\u63cf\u8def\u5f84&#xff0c;\u5426\u5219\u8ba1\u7b97\u5f15\u64ce\u4e2d\u7684 Service\u3001Controller \u4e0d\u4f1a\u88ab Spring \u5b9e\u4f8b\u5316&#xff0c;\u62a5\u627e\u4e0d\u5230 Bean \u5f02\u5e38\u3002<\/span><\/p>\n<p>4. <span style=\"color:#fe2c24\">&#064;RequestMapping<\/span><\/p>\n<p>&#064;RequestMapping<\/p>\n<p><span style=\"color:#fe2c24\">\u52a0\u5728\u542f\u52a8\u7c7b\u4e0a&#xff0c;\u4ee3\u8868\u5168\u5c40\u63a5\u53e3\u7edf\u4e00\u524d\u7f00&#xff08;\u65e0\u53c2\u6570\u5219\u65e0\u524d\u7f00&#xff09;<\/span>&#xff1b; \u5982\u679c\u5199\u6210 &#064;RequestMapping(&#034;\/api&#034;)&#xff0c;\u6240\u6709 Controller \u63a5\u53e3\u90fd\u4f1a\u62fc\u63a5 \/api\u3002<\/p>\n<p>5. <span style=\"color:#fe2c24\">&#064;CrossOrigin<\/span>(origins &#061; { &#034;*&#034; })<\/p>\n<p>&#064;CrossOrigin(origins &#061; { &#034;*&#034; })<\/p>\n<p><span style=\"color:#fe2c24\">\u5168\u5c40\u8de8\u57df\u6ce8\u89e3&#xff0c;\u5141\u8bb8\u6240\u6709\u524d\u7aef\u57df\u540d\u8bbf\u95ee\u672c\u670d\u52a1\u63a5\u53e3<\/span>&#xff1b;<\/p>\n<ul>\n<li>\n<p>* \u901a\u914d\u7b26&#xff1a;\u672c\u5730\u524d\u7aef\u3001\u7ebf\u4e0a\u524d\u7aef\u3001\u4efb\u610f IP \u90fd\u53ef\u8de8\u57df&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6ce8\u91ca\u6389\u7684\u65e7\u4ee3\u7801&#xff1a;\u66fe\u7ecf\u914d\u7f6e\u4e86localhost\u30013000\u30018080\u30018090\u300163342 \u7b49\u524d\u7aef\u5e38\u7528\u7aef\u53e3&#xff0c;\u540e\u6765\u7b80\u5316\u4e3a\u5168\u90e8\u653e\u884c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4f01\u4e1a\u5f00\u53d1\u89c4\u8303&#xff1a;\u751f\u4ea7\u73af\u5883\u4e0d\u5efa\u8bae\u5199*&#xff0c;\u9700\u8981\u6307\u5b9a\u771f\u5b9e\u524d\u7aef\u57df\u540d&#xff0c;\u9632\u6b62\u6076\u610f\u7f51\u7ad9\u8de8\u57df\u8c03\u7528\u63a5\u53e3\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u56db\u3001main \u4e3b\u542f\u52a8\u65b9\u6cd5<\/p>\n<p>public static void main(String[] args) {<br \/>\n    \/\/ \u7981\u7528JMX\u4ee5\u907f\u514d\u68c0\u7d22\u95ee\u9898<br \/>\n    System.setProperty(&#034;spring.jmx.enabled&#034;, &#034;false&#034;);<br \/>\n    System.setProperty(&#034;management.endpoints.jmx.exposure.include&#034;, &#034;&#034;);<\/p>\n<p>    SpringApplication.run(BusinessRunApplication.class, args);<br \/>\n}<\/p>\n<p>1. System.setProperty \u7cfb\u7edf\u53c2\u6570\u914d\u7f6e<\/p>\n<p>JMX \u662f SpringBoot Actuator \u76d1\u63a7\u7ec4\u4ef6&#xff0c;\u7528\u4e8e\u8fdc\u7a0b\u76d1\u63a7\u3001\u7ba1\u7406\u670d\u52a1&#xff1a;<\/p>\n<li>\n<p>spring.jmx.enabled&#061;false&#xff1a;\u5173\u95ed JMX \u529f\u80fd&#xff1b;<\/p>\n<\/li>\n<li>\n<p>management.endpoints.jmx.exposure.include&#061;&#034;&#034;&#xff1a;\u6e05\u7a7a JMX \u66b4\u9732\u7684\u76d1\u63a7\u7aef\u70b9&#xff1b;<\/p>\n<\/li>\n<p>\u4e1a\u52a1\u76ee\u7684&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u89c4\u907f JMX \u7aef\u53e3\u51b2\u7a81\u3001\u8fdc\u7a0b\u8fde\u63a5\u68c0\u7d22\u62a5\u9519&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4f01\u4e1a\u5185\u7f51\u5b89\u5168\u7ba1\u63a7&#xff0c;\u5173\u95ed\u8fdc\u7a0b\u670d\u52a1\u76d1\u63a7\u5165\u53e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u51cf\u5c11\u670d\u52a1\u5360\u7528\u7aef\u53e3&#xff0c;\u7b80\u5316\u90e8\u7f72\u8fd0\u7ef4\u3002<\/p>\n<\/li>\n<\/ul>\n<p>2. SpringApplication.run()<\/p>\n<p>\u6807\u51c6 SpringBoot \u542f\u52a8\u5165\u53e3&#xff0c;\u52a0\u8f7d\u5f53\u524d\u7c7b\u6240\u6709\u914d\u7f6e\u3001\u521d\u59cb\u5316 Spring \u5bb9\u5668\u3001\u5185\u5d4c Tomcat \u542f\u52a8 Web \u670d\u52a1\u3002<\/p>\n<p>\u4e94\u3001\u6ce8\u91ca\u6389\u7684\u6d4b\u8bd5\u63a5\u53e3<\/p>\n<p>\/*<br \/>\n * &#064;GetMapping(&#034;\/&#034;)<br \/>\n * &#064;ResponseBody<br \/>\n * public JsonMessage main(){<br \/>\n * return new JsonMessage().success(&#034;main&#034;);<br \/>\n * }<br \/>\n *\/<\/p>\n<p>\u66fe\u7ecf\u5199\u7684\u6839\u8def\u5f84\u5065\u5eb7\u6d4b\u8bd5\u63a5\u53e3&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u8bbf\u95ee http:\/\/ip:\u7aef\u53e3\/ \u8fd4\u56de\u7edf\u4e00 JSON \u6210\u529f\u62a5\u6587&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4f5c\u7528&#xff1a;\u90e8\u7f72\u540e\u5feb\u901f\u9a8c\u8bc1\u670d\u52a1\u662f\u5426\u6b63\u5e38\u542f\u52a8\u3001\u63a5\u53e3\u80fd\u5426\u8bbf\u95ee&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u73b0\u5728\u6ce8\u91ca\u7981\u7528&#xff0c;\u5982\u9700\u5065\u5eb7\u68c0\u6d4b\u53ef\u91cd\u65b0\u6253\u5f00&#xff0c;\u6216\u4f7f\u7528 Actuator \u5065\u5eb7\u7aef\u70b9 \/actuator\/health\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u516d\u3001\u6574\u4f53\u9879\u76ee\u67b6\u6784\u603b\u7ed3<\/p>\n<li>\n<p>\u9879\u76ee\u5f52\u5c5e&#xff1a;xxx\u5185\u90e8\u4e1a\u52a1\u670d\u52a1&#xff0c;\u547d\u540d\u89c4\u8303\u4f01\u4e1a\u5316&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6838\u5fc3\u80fd\u529b&#xff1a;<\/p>\n<ul>\n<li>\n<p>Web \u63a5\u53e3\u670d\u52a1&#xff0c;\u5168\u5c40\u8de8\u57df&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5185\u7f6e\u5b9a\u65f6\u4efb\u52a1\u8c03\u5ea6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u72ec\u7acb\u8ba1\u7b97\u5f15\u64ce\u6a21\u5757&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6846\u67b6\u5b9a\u5236\u5316\u914d\u7f6e&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u624b\u52a8\u6269\u5c55 Bean \u626b\u63cf\u5305&#xff0c;\u517c\u5bb9\u591a\u6a21\u5757&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6392\u9664 MyBatis \u81ea\u52a8\u88c5\u914d&#xff0c;\u81ea\u5b9a\u4e49\u6570\u636e\u5e93\u914d\u7f6e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5173\u95ed JMX \u76d1\u63a7&#xff0c;\u63d0\u5347\u90e8\u7f72\u7a33\u5b9a\u6027\u4e0e\u5b89\u5168\u6027&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u7f3a\u9677 \/ \u4f18\u5316\u70b9&#xff1a;<\/p>\n<li>\n<p>\u5305\u540d\u62fc\u5199\u9519\u8bef bussiness \u2192 business&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u751f\u4ea7\u73af\u5883&#064;CrossOrigin(&#034;*&#034;)\u5b58\u5728\u5b89\u5168\u98ce\u9669&#xff0c;\u5e94\u9650\u5b9a\u524d\u7aef\u57df\u540d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65e0 Actuator \u5065\u5eb7\u76d1\u63a7\u914d\u7f6e&#xff0c;\u7ebf\u4e0a\u8fd0\u7ef4\u6392\u67e5\u4e0d\u65b9\u4fbf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>MyBatis \u81ea\u52a8\u88c5\u914d\u88ab\u6392\u9664&#xff0c;\u9700\u8981\u786e\u8ba4\u9879\u76ee\u662f\u5426\u624b\u52a8\u914d\u7f6e\u4e86 Mapper \u626b\u63cf\u3002<\/p>\n<\/li>\n<\/li>\n<h3 style=\"background-color:transparent\">\u914d\u7f6e\u6587\u4ef6 &#xff1a; application-dev.yml &#8211; \u4e86\u89e3\u6570\u636e\u5e93\u3001Redis\u3001ES \u914d\u7f6e<\/h3>\n<p>application-dev.yml<\/p>\n<p># \u5141\u8bb8 Bean \u5b9a\u4e49\u8986\u76d6<br \/>\nspring:<br \/>\n  main:<br \/>\n    allow-bean-definition-overriding: true<br \/>\n  # \u6570\u636e\u6e90\u914d\u7f6e &#8211; \u8fbe\u68a6\u6570\u636e\u5e93<br \/>\n  datasource:<br \/>\n    driver-class-name: dm.jdbc.driver.DmDriver<br \/>\n    url: jdbc:dm:\/\/localhost:5236\/ZNYW<br \/>\n    username: SYSDBA<br \/>\n    password: Llf123456<br \/>\n    type: com.alibaba.druid.pool.DruidDataSource<br \/>\n    druid:<br \/>\n      # \u521d\u59cb\u5316\u8fde\u63a5\u6570<br \/>\n      initial-size: 8<br \/>\n      # \u6700\u5c0f\u7a7a\u95f2\u8fde\u63a5\u6570<br \/>\n      min-idle: 1<br \/>\n      # \u6700\u5927\u6d3b\u52a8\u8fde\u63a5\u6570<br \/>\n      max-active: 20<br \/>\n      # \u83b7\u53d6\u8fde\u63a5\u65f6\u6700\u5927\u7b49\u5f85\u65f6\u95f4&#xff0c;\u5355\u4f4d\u6beb\u79d2<br \/>\n      max-wait: 60000<br \/>\n      # \u914d\u7f6e\u95f4\u9694\u591a\u4e45\u624d\u8fdb\u884c\u4e00\u6b21\u68c0\u6d4b&#xff0c;\u68c0\u6d4b\u9700\u8981\u5173\u95ed\u7684\u7a7a\u95f2\u8fde\u63a5&#xff0c;\u5355\u4f4d\u662f\u6beb\u79d2<br \/>\n      time-between-eviction-runsMillis: 60000<br \/>\n      # \u914d\u7f6e\u4e00\u4e2a\u8fde\u63a5\u5728\u6c60\u4e2d\u6700\u5c0f\u751f\u5b58\u7684\u65f6\u95f4&#xff0c;\u5355\u4f4d\u662f\u6beb\u79d2<br \/>\n      min-evictable-idle-timeMillis: 300000<br \/>\n      # \u7528\u6765\u68c0\u6d4b\u8fde\u63a5\u662f\u5426\u6709\u6548\u7684 SQL&#xff0c;\u8981\u6c42\u662f\u4e00\u4e2a\u67e5\u8be2\u8bed\u53e5&#xff08;\u8fbe\u68a6\u4f7f\u7528\u6807\u51c6SQL&#xff09;<br \/>\n      validation-query: SELECT 1 FROM DUAL<br \/>\n      # \u5efa\u8bae\u914d\u7f6e\u4e3a true&#xff0c;\u4e0d\u5f71\u54cd\u6027\u80fd&#xff0c;\u5e76\u4e14\u4fdd\u8bc1\u5b89\u5168\u6027\u3002\u7533\u8bf7\u8fde\u63a5\u7684\u65f6\u5019\u68c0\u6d4b&#xff0c;\u5982\u679c\u7a7a\u95f2\u65f6\u95f4\u5927\u4e8e timeBetweenEvictionRunsMillis&#xff0c;\u6267\u884c validationQuery \u68c0\u6d4b\u8fde\u63a5\u662f\u5426\u6709\u6548\u3002<br \/>\n      test-while-idle: true<br \/>\n      # \u7533\u8bf7\u8fde\u63a5\u65f6\u6267\u884c validationQuery \u68c0\u6d4b\u8fde\u63a5\u662f\u5426\u6709\u6548&#xff0c;\u505a\u4e86\u8fd9\u4e2a\u914d\u7f6e\u4f1a\u964d\u4f4e\u6027\u80fd\u3002<br \/>\n      test-on-borrow: false<br \/>\n      # \u5f52\u8fd8\u8fde\u63a5\u65f6\u6267\u884c validationQuery \u68c0\u6d4b\u8fde\u63a5\u662f\u5426\u6709\u6548&#xff0c;\u505a\u4e86\u8fd9\u4e2a\u914d\u7f6e\u4f1a\u964d\u4f4e\u6027\u80fd\u3002<br \/>\n      test-on-return: false<br \/>\n      # \u6253\u5f00 PSCache&#xff0c;\u5e76\u4e14\u6307\u5b9a\u6bcf\u4e2a\u8fde\u63a5\u4e0a PSCache \u7684\u5927\u5c0f<br \/>\n      pool-prepared-statements: false<br \/>\n    ####  \u7f13\u5b58\u670d\u52a1\u5f00\u59cb   ####<br \/>\n  redis:<br \/>\n    host: localhost<br \/>\n    port: 6379<br \/>\n    password:<br \/>\n    jedis:<br \/>\n      pool:<br \/>\n        enabled: true<br \/>\n        max-active: 20<br \/>\n        min-idle: 2<br \/>\n        max-idle: 10<\/p>\n<p>  # Elasticsearch\u591a\u6570\u636e\u6e90\u914d\u7f6e<br \/>\n  elasticsearch:<br \/>\n    # \u9ed8\u8ba4\u4f7f\u7528\u7684ES&#xff08;local&#061;\u672c\u5730, prod&#061;\u751f\u4ea7&#xff09;<br \/>\n    default: prod<\/p>\n<p>    # \u672c\u5730ES\u914d\u7f6e<br \/>\n    local:<br \/>\n      uris: http:\/\/localhost:9200<br \/>\n      username: elastic<br \/>\n      password: 123456<br \/>\n      connection-timeout: 5000<br \/>\n      socket-timeout: 60000<\/p>\n<p>    # \u751f\u4ea7ES\u914d\u7f6e &#8211; sl\u96c6\u7fa4&#xff08;3\u8282\u70b9&#xff09;<br \/>\n    prod:<br \/>\n      uris:<br \/>\n        &#8211; https:\/\/10.xx.xxx.xxx:9200<br \/>\n        &#8211; https:\/\/10.xx.xxx.xxx:9200<br \/>\n        &#8211; https:\/\/10.xx.xxx.xxx:9200<br \/>\n      username: elastic<br \/>\n      password: tUUPsYdJpY5ZyAhIsCuM<br \/>\n      connection-timeout: 30000<br \/>\n      socket-timeout: 180000<\/p>\n<p>    # Journal\u7d22\u5f15\u914d\u7f6e<br \/>\n    index:<br \/>\n      # \u7d22\u5f15\u540d\u79f0\u524d\u7f00<br \/>\n      prefix: journal<br \/>\n      # \u662f\u5426\u4f7f\u7528\u65e5\u671f\u540e\u7f00&#xff08;\u672c\u5730false&#xff0c;\u751f\u4ea7true&#xff09;<br \/>\n      use-date-suffix: true<br \/>\n      # \u65e5\u671f\u683c\u5f0f&#xff08;\u751f\u4ea7\u73af\u5883\u4f7f\u7528&#xff09;<br \/>\n      date-format: yyyyMMdd<\/p>\n<p># \u5de5\u7a0b\u542f\u52a8\u7aef\u53e3\u53f7<br \/>\nserver:<br \/>\n  port: 8091<br \/>\n  # session \u5931\u6548\u65f6\u95f4<br \/>\n  servlet:<br \/>\n    session:<br \/>\n      timeout: 480m<br \/>\n    # \u6839\u5730\u5740<br \/>\n    context-path: \/<br \/>\n  # tomcat \u914d\u7f6e<br \/>\n  tomcat:<br \/>\n    # \u6700\u5c0f\u7ebf\u7a0b\u6570<br \/>\n    min-spare-threads: 50<br \/>\n    # \u6700\u5927\u7ebf\u7a0b\u6570<br \/>\n    max-threads: 2500<br \/>\n    # \u6700\u5927\u7b49\u5f85\u961f\u5217\u957f\u5ea6<br \/>\n    accept-count: 1000<br \/>\n    # \u6700\u5927\u8fde\u63a5\u6570<br \/>\n    max-connections: 10000<\/p>\n<p># JMX \u914d\u7f6e &#8211; \u89e3\u51b3JMX\u670d\u52a1URL\u68c0\u7d22\u95ee\u9898<br \/>\nmanagement:<br \/>\n  endpoints:<br \/>\n    web:<br \/>\n      exposure:<br \/>\n        include: health,info,metrics<br \/>\n  endpoint:<br \/>\n    health:<br \/>\n      show-details: always<br \/>\n  jmx:<br \/>\n    enabled: false # \u7981\u7528JMX\u4ee5\u907f\u514d\u68c0\u7d22\u95ee\u9898<\/p>\n<p># MyBatis \u914d\u7f6e&#xff0c;\u5f00\u542f\u4e0b\u5212\u7ebf\u8f6c\u9a7c\u5cf0\u547d\u540d<br \/>\nmybatis:<br \/>\n  mapper-locations: classpath:config\/mappers\/**\/*.xml<br \/>\n  configuration:<br \/>\n    map-underscore-to-camel-case: true<br \/>\n    # \u914d\u7f6e\u65e5\u5fd7\u5b9e\u73b0\u7c7b&#xff0c;\u4f7f\u7528 SLF4J<br \/>\n    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl<br \/>\n    # \u7981\u7528\u7f13\u5b58&#xff0c;\u786e\u4fdd\u914d\u7f6e\u66f4\u6539\u7acb\u5373\u751f\u6548<br \/>\n    cache-enabled: false<\/p>\n<p># \u914d\u7f6e\u65e5\u5fd7\u7ea7\u522b&#xff0c;\u5c06 Mapper \u63a5\u53e3\u6240\u5728\u5305\u7684\u65e5\u5fd7\u7ea7\u522b\u8bbe\u7f6e\u4e3a DEBUG<br \/>\nlogging:<br \/>\n  level:<br \/>\n    cn.com.sinopec.api.base: DEBUG<br \/>\n    cn.com.sinopec.bussiness.znyw.mapper: DEBUG # \u6dfb\u52a0 Mapper \u7684 DEBUG \u65e5\u5fd7<\/p>\n<p># \u5de5\u5355\u7cfb\u7edf\u914d\u7f6e&#xff08;\u63a5\u53e3\u6587\u6863&#xff1a;\/api\/workorders\/external\/inspection&#xff09;<br \/>\ninspection:<br \/>\n  work-order:<br \/>\n    base-url: http:\/\/10.xx.xxx.xxx\/<br \/>\n    app-key: inspection-system<br \/>\n    app-secret: change-me<br \/>\n    category-id: 1<br \/>\n    timeout: 30000<\/p>\n<p>\u8fd9\u4efd\u662fxxx\u4e1a\u52a1\u670d\u52a1\u7684\u751f\u4ea7\u7ea7\u914d\u7f6e\u6587\u4ef6&#xff0c;\u642d\u914d\u4e0a\u4e00\u7bc7\u7684\u542f\u52a8\u7c7b&#xff0c;\u6574\u4f53\u67b6\u6784&#xff1a;SpringBoot &#043; \u8fbe\u68a6\u56fd\u4ea7\u6570\u636e\u5e93 (Druid \u8fde\u63a5\u6c60) &#043; Redis \u7f13\u5b58 &#043; Elasticsearch \u53cc\u96c6\u7fa4 &#043; MyBatis &#043; \u5b9a\u65f6\u4efb\u52a1 &#043; \u5916\u90e8\u5de5\u5355\u7cfb\u7edf\u63a5\u53e3\u3002<\/p>\n<p>\u4e00\u3001Spring \u5bb9\u5668\u57fa\u7840\u914d\u7f6e<\/p>\n<p>spring:<br \/>\n  main:<br \/>\n    allow-bean-definition-overriding: true<\/p>\n<p>\u4f5c\u7528<\/p>\n<p>\u5141\u8bb8\u540c\u540d Bean \u8986\u76d6&#xff0c;Spring \u9ed8\u8ba4\u5173\u95ed&#xff0c;\u8fd9\u91cc\u5f00\u542f\u662f\u9002\u914d\u9879\u76ee\u573a\u666f&#xff1a;<\/p>\n<li>\n<p>\u542f\u52a8\u7c7b\u6392\u9664\u4e86 MyBatis\/MyBatisPlus \u81ea\u52a8\u914d\u7f6e&#xff0c;\u9879\u76ee\u624b\u52a8\u81ea\u5b9a\u4e49 SqlSessionFactory\u3001Mapper \u626b\u63cf Bean&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u591a\u6a21\u5757&#xff08;business \u4e1a\u52a1\u3001calculation \u8ba1\u7b97\u5f15\u64ce&#xff09;\u5b58\u5728\u540c\u7c7b\u578b Bean&#xff0c;\u5141\u8bb8\u540e\u4e0d\u4f1a\u542f\u52a8\u62a5 BeanDefinitionOverrideException \u51b2\u7a81\u5f02\u5e3851CTO\u3002<\/p>\n<\/li>\n<p>\u4e8c\u3001\u8fbe\u68a6\u6570\u636e\u5e93 &#043; Druid \u8fde\u63a5\u6c60&#xff08;\u6838\u5fc3\u4e1a\u52a1\u5e93&#xff09;<\/p>\n<p>  datasource:<br \/>\n    driver-class-name: dm.jdbc.driver.DmDriver<br \/>\n    url: jdbc:dm:\/\/localhost:5236\/ZNYW<br \/>\n    username: SYSDBA<br \/>\n    password: Llf123456<br \/>\n    type: com.alibaba.druid.pool.DruidDataSource<\/p>\n<li>\n<p>\u6570\u636e\u5e93\u7c7b\u578b&#xff1a;\u8fbe\u68a6 DM8 \u56fd\u4ea7\u6570\u636e\u5e93&#xff08;\u4fe1\u521b\u9879\u76ee\u6807\u914d&#xff0c;\u517c\u5bb9 Oracle \u8bed\u6cd5&#xff09;\u7a00\u571f\u6398\u91d1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fde\u63a5\u5730\u5740&#xff1a;\u672c\u5730\u8fbe\u68a6\u5b9e\u4f8b&#xff0c;\u7aef\u53e3 5236&#xff0c;\u5e93\u540dZNYW&#xff08;\u667a\u80fd\u4e1a\u52a1\u5e93&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fde\u63a5\u6c60&#xff1a;\u6307\u5b9a Druid \u963f\u91cc\u9ad8\u6027\u80fd\u8fde\u63a5\u6c60&#xff0c;\u66ff\u4ee3 Spring \u9ed8\u8ba4 Hikari\u3002<\/p>\n<\/li>\n<p>Druid \u8fde\u63a5\u6c60\u8c03\u4f18\u53c2\u6570<\/p>\n<p>    druid:<br \/>\n      initial-size: 8        # \u670d\u52a1\u542f\u52a8\u521d\u59cb\u53168\u4e2a\u6570\u636e\u5e93\u8fde\u63a5<br \/>\n      min-idle: 1             # \u6700\u5c0f\u7a7a\u95f2\u8fde\u63a5&#xff0c;\u81f3\u5c11\u4fdd\u75591\u4e2a\u4e0d\u56de\u6536<br \/>\n      max-active: 20          # \u8fde\u63a5\u6c60\u6700\u592720\u4e2a\u8fde\u63a5&#xff08;\u4e1a\u52a1\u5e76\u53d1\u4e0d\u9ad8&#xff0c;\u9650\u5236\u8d44\u6e90\u5360\u7528&#xff09;<br \/>\n      max-wait: 60000        # \u83b7\u53d6\u8fde\u63a5\u6700\u957f\u7b49\u5f8560\u79d2&#xff0c;\u8d85\u65f6\u629b\u5f02\u5e38<br \/>\n      time-between-eviction-runsMillis: 60000 # \u6bcf60\u79d2\u68c0\u6d4b\u7a7a\u95f2\u8fde\u63a5&#xff0c;\u56de\u6536\u95f2\u7f6e\u8fde\u63a5<br \/>\n      min-evictable-idle-timeMillis: 300000 # \u7a7a\u95f2\u8fde\u63a55\u5206\u949f\u540e\u81ea\u52a8\u56de\u6536<br \/>\n      validation-query: SELECT 1 FROM DUAL # \u8fbe\u68a6\u6570\u636e\u5e93\u8fde\u901a\u6027\u68c0\u6d4bSQL&#xff08;\u517c\u5bb9Oracle&#xff09;<br \/>\n      test-while-idle: true  # \u7a7a\u95f2\u65f6\u540e\u53f0\u68c0\u6d4b\u8fde\u63a5\u6709\u6548\u6027&#xff08;\u63a8\u8350&#xff0c;\u4e0d\u5f71\u54cd\u6027\u80fd&#xff09;<br \/>\n      test-on-borrow: false  # \u62ff\u8fde\u63a5\u65f6\u4e0d\u68c0\u6d4b&#xff0c;\u907f\u514d\u62d6\u6162\u63a5\u53e3\u54cd\u5e94<br \/>\n      test-on-return: false  # \u5f52\u8fd8\u8fde\u63a5\u65f6\u4e0d\u68c0\u6d4b<br \/>\n      pool-prepared-statements: false # \u5173\u95edPS\u7f13\u5b58&#xff0c;\u8fbe\u68a6\u573a\u666f\u5f00\u542f\u6613\u5185\u5b58\u6ea2\u51fa<\/p>\n<p>\u8bbe\u8ba1\u601d\u8def&#xff1a;\u4f18\u5148\u4fdd\u8bc1\u63a5\u53e3\u54cd\u5e94\u901f\u5ea6&#xff0c;\u4ec5\u540e\u53f0\u5f02\u6b65\u68c0\u6d4b\u8fde\u63a5&#xff0c;\u907f\u514d\u9891\u7e41 SQL \u6821\u9a8c\u62d6\u6162\u4e1a\u52a1\u3002<\/p>\n<p>\u4e09\u3001Redis \u7f13\u5b58\u914d\u7f6e<\/p>\n<p>  redis:<br \/>\n    host: localhost<br \/>\n    port: 6379<br \/>\n    password:<br \/>\n    jedis:<br \/>\n      pool:<br \/>\n        enabled: true<br \/>\n        max-active: 20<br \/>\n        min-idle: 2<br \/>\n        max-idle: 10<\/p>\n<li>\n<p>\u672c\u5730 Redis \u5b9e\u4f8b&#xff0c;\u65e0\u5bc6\u7801&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528 Jedis \u5ba2\u6237\u7aef\u8fde\u63a5\u6c60&#xff0c;\u6700\u5927 20 \u4e2a\u7f13\u5b58\u8fde\u63a5&#xff0c;\u4fdd\u7559 2 \u4e2a\u5e38\u9a7b\u7a7a\u95f2\u8fde\u63a5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7528\u9014&#xff1a;\u4e1a\u52a1\u70ed\u70b9\u6570\u636e\u7f13\u5b58\u3001\u5b9a\u65f6\u4efb\u52a1\u5206\u5e03\u5f0f\u9501\u3001\u63a5\u53e3\u91cd\u590d\u8bf7\u6c42\u9632\u91cd\u3002<\/p>\n<\/li>\n<p>\u56db\u3001Elasticsearch \u53cc\u96c6\u7fa4\u591a\u73af\u5883\u914d\u7f6e&#xff08;\u65e5\u5fd7 \/ \u68c0\u7d22\u5f15\u64ce&#xff09;<\/p>\n<p>  elasticsearch:<br \/>\n    default: prod # \u9ed8\u8ba4\u4f7f\u7528\u751f\u4ea7ES\u96c6\u7fa4&#xff08;xxx3\u8282\u70b9\u96c6\u7fa4&#xff09;<\/p>\n<p>    # \u672c\u5730\u5f00\u53d1ES<br \/>\n    local:<br \/>\n      uris: http:\/\/localhost:9200<br \/>\n      username: elastic<br \/>\n      password: 123456<br \/>\n      connection-timeout: 5000<br \/>\n      socket-timeout: 60000<\/p>\n<p>    # \u751f\u4ea7ES\u96c6\u7fa4&#xff08;xxx3\u53f0\u8282\u70b9&#xff0c;HTTPS\u52a0\u5bc6\u8bbf\u95ee&#xff09;<br \/>\n    prod:<br \/>\n      uris:<br \/>\n        &#8211; https:\/\/10.66.205.242:9200<br \/>\n        &#8211; https:\/\/10.66.205.151:9200<br \/>\n        &#8211; https:\/\/10.66.205.125:9200<br \/>\n      username: elastic<br \/>\n      password: tUUPsYdJpY5ZyAhIsCuM<br \/>\n      connection-timeout: 30000<br \/>\n      socket-timeout: 180000<\/p>\n<p>    # \u4e1a\u52a1\u65e5\u5fd7\u7d22\u5f15\u901a\u7528\u89c4\u5219<br \/>\n    index:<br \/>\n      prefix: journal               # \u7d22\u5f15\u524d\u7f00 journal_20260727<br \/>\n      use-date-suffix: true        # \u7d22\u5f15\u6309\u65e5\u671f\u5206\u8868&#xff0c;\u6bcf\u65e5\u751f\u6210\u65b0\u7d22\u5f15<br \/>\n      date-format: yyyyMMdd        # \u65e5\u671f\u683c\u5f0f\u5e74\u6708\u65e5<\/p>\n<p>\u6838\u5fc3\u4e1a\u52a1\u573a\u666f<\/p>\n<li>\n<p>\u53cc\u73af\u5883\u9694\u79bb&#xff1a;\u5f00\u53d1\u73af\u5883\u8fde\u672c\u5730\u5355\u8282\u70b9 ES&#xff0c;\u751f\u4ea7\u76f4\u8fde\u6cb9\u7530\u5185\u7f51 3 \u8282\u70b9\u9ad8\u53ef\u7528\u96c6\u7fa4&#xff1b;<\/p>\n<\/li>\n<li>\n<p>HTTPS \u5b89\u5168\u8bbf\u95ee&#xff1a;\u751f\u4ea7 ES \u5f00\u542f SSL \u52a0\u5bc6&#xff0c;\u5185\u7f51\u5b89\u5168\u89c4\u8303&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65e5\u5fd7\u65f6\u5e8f\u5b58\u50a8&#xff1a;\u65e5\u5fd7\u6309\u5929\u5206\u7d22\u5f15&#xff0c;\u65b9\u4fbf\u65e5\u5fd7\u68c0\u7d22\u3001\u8ba1\u7b97\u5f15\u64ce\u6570\u636e\u5206\u6790&#xff0c;\u907f\u514d\u5355\u7d22\u5f15\u6570\u636e\u8fc7\u5927\u67e5\u8be2\u5361\u987f\u3002<\/p>\n<\/li>\n<p>\u4e94\u3001Web \u670d\u52a1\u5bb9\u5668&#xff08;Tomcat \u9ad8\u5e76\u53d1\u8c03\u4f18&#xff09;<\/p>\n<p>server:<br \/>\n  port: 8091 # \u670d\u52a1\u542f\u52a8\u7aef\u53e38091<br \/>\n  servlet:<br \/>\n    session:<br \/>\n      timeout: 480m # Session\u5931\u6548\u65f6\u95f48\u5c0f\u65f6<br \/>\n    context-path: \/ # \u63a5\u53e3\u6839\u8def\u5f84\u65e0\u524d\u7f00<br \/>\n  tomcat:<br \/>\n    min-spare-threads: 50    # \u5e38\u9a7b50\u4e2a\u7a7a\u95f2\u7ebf\u7a0b&#xff0c;\u5e94\u5bf9\u7a81\u53d1\u6d41\u91cf<br \/>\n    max-threads: 2500          # Tomcat\u6700\u5927\u5de5\u4f5c\u7ebf\u7a0b2500&#xff08;\u8fdc\u8d85\u9ed8\u8ba4200&#xff0c;\u652f\u6301\u9ad8\u5e76\u53d1\u63a5\u53e3&#xff09;<br \/>\n    accept-count: 1000         # \u8bf7\u6c42\u7b49\u5f85\u961f\u52171000&#xff0c;\u7ebf\u7a0b\u8017\u5c3d\u540e\u8bf7\u6c42\u6392\u961f\u4e0d\u76f4\u63a5\u62d2\u7edd<br \/>\n    max-connections: 10000     # Tomcat\u6700\u5927\u652f\u630110000\u6761TCP\u957f\u8fde\u63a5<\/p>\n<p>\u8c03\u4f18\u8bf4\u660e<\/p>\n<p>\u9ed8\u8ba4 Tomcat \u6700\u5927\u7ebf\u7a0b\u4ec5 200&#xff0c;\u672c\u9879\u76ee\u96c6\u6210\u5b9a\u65f6\u4efb\u52a1\u3001\u8ba1\u7b97\u5f15\u64ce\u3001\u5927\u91cf\u67e5\u8be2\u63a5\u53e3&#xff0c;\u8c03\u9ad8\u7ebf\u7a0b\u6c60\u53c2\u6570&#xff0c;\u652f\u6491\u591a\u4efb\u52a1\u5e76\u884c\u6267\u884c&#xff0c;\u9002\u914d\u6cb9\u7530\u4e1a\u52a1\u6279\u91cf\u8ba1\u7b97\u573a\u666f\u7a00\u571f\u6398\u91d1\u3002<\/p>\n<p>\u516d\u3001Actuator \u76d1\u63a7 &#043; JMX \u5173\u95ed&#xff08;\u548c\u542f\u52a8\u7c7b\u914d\u5957&#xff09;<\/p>\n<p>management:<br \/>\n  endpoints:<br \/>\n    web:<br \/>\n      exposure:<br \/>\n        include: health,info,metrics # \u5bf9\u5916\u5f00\u653e\u5065\u5eb7\u3001\u670d\u52a1\u4fe1\u606f\u3001\u6307\u6807\u76d1\u63a7\u7aef\u70b9<br \/>\n  endpoint:<br \/>\n    health:<br \/>\n      show-details: always # \u5065\u5eb7\u68c0\u67e5\u5b8c\u6574\u5c55\u793a&#xff1a;\u6570\u636e\u5e93\u3001Redis\u3001ES\u8fde\u901a\u72b6\u6001<br \/>\n  jmx:<br \/>\n    enabled: false # \u5168\u5c40\u5173\u95edJMX&#xff0c;\u548c\u542f\u52a8\u7c7bSystem.setProperty\u914d\u7f6e\u7edf\u4e00&#xff0c;\u89e3\u51b3JMX\u7aef\u53e3\u68c0\u7d22\u62a5\u9519\u3001\u5b89\u5168\u7ba1\u63a7\u9700\u6c42<\/p>\n<li>\n<p>\u8fd0\u7ef4\u76d1\u63a7&#xff1a;\/actuator\/health \u8fd0\u7ef4\u53ef\u5feb\u901f\u6821\u9a8c\u6570\u636e\u5e93\u3001\u7f13\u5b58\u3001ES \u5168\u90e8\u4e2d\u95f4\u4ef6\u8fde\u901a\u6027&#xff1b;<\/p>\n<\/li>\n<li>\n<p>JMX \u5173\u95ed&#xff1a;\u4f01\u4e1a\u5185\u7f51\u5b89\u5168\u89c4\u8303&#xff0c;\u7981\u7528\u8fdc\u7a0b JMX \u670d\u52a1&#xff0c;\u907f\u514d\u7aef\u53e3\u51b2\u7a81\u3001\u8fdc\u7a0b\u6f0f\u6d1e\u98ce\u9669\u3002<\/p>\n<\/li>\n<p>\u4e03\u3001MyBatis \u6301\u4e45\u5c42\u914d\u7f6e&#xff08;\u8fbe\u68a6\u6570\u636e\u5e93 SQL \u6620\u5c04&#xff09;<\/p>\n<p>mybatis:<br \/>\n  mapper-locations: classpath:config\/mappers\/**\/*.xml # Mapper XML\u6587\u4ef6\u626b\u63cf\u8def\u5f84<br \/>\n  configuration:<br \/>\n    map-underscore-to-camel-case: true # \u81ea\u52a8\u6570\u636e\u5e93\u4e0b\u5212\u7ebf\u5b57\u6bb5 \u2192 Java\u9a7c\u5cf0\u5b9e\u4f53\u6620\u5c04&#xff08;\u5982user_name \u2192 userName&#xff09;<br \/>\n    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl # SQL\u65e5\u5fd7\u8f93\u51fa\u4f7f\u7528SLF4J\u7edf\u4e00\u65e5\u5fd7\u6846\u67b6<br \/>\n    cache-enabled: false # \u5168\u5c40\u5173\u95edMyBatis\u4e8c\u7ea7\u7f13\u5b58<\/p>\n<p>\u5173\u95ed\u4e8c\u7ea7\u7f13\u5b58\u539f\u56e0<\/p>\n<li>\n<p>\u9879\u76ee\u5b58\u5728\u5b9a\u65f6\u4efb\u52a1\u6279\u91cf\u66f4\u65b0\u6570\u636e\u3001\u591a\u670d\u52a1\u540c\u65f6\u64cd\u4f5c\u8fbe\u68a6\u5e93&#xff0c;\u4e8c\u7ea7\u7f13\u5b58\u6613\u4ea7\u751f\u810f\u8bfb\u3001\u6570\u636e\u4e0d\u4e00\u81f4&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u5b9e\u65f6\u6027\u8981\u6c42\u9ad8&#xff0c;\u6bcf\u6b21\u67e5\u8be2\u76f4\u63a5\u8d70\u6570\u636e\u5e93&#xff0c;\u4e0d\u4f9d\u8d56\u7f13\u5b58&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u70ed\u70b9\u6570\u636e\u7edf\u4e00\u4ea4\u7ed9 Redis \u505a\u5206\u5e03\u5f0f\u7f13\u5b58&#xff0c;\u653e\u5f03 MyBatis \u672c\u5730\u7f13\u5b58\u3002<\/p>\n<\/li>\n<p>\u516b\u3001\u65e5\u5fd7\u7ea7\u522b\u914d\u7f6e&#xff08;\u8c03\u8bd5\u6570\u636e\u5e93 SQL&#xff09;<\/p>\n<p>logging:<br \/>\n  level:<br \/>\n    cn.com.sinopec.api.base: DEBUG<br \/>\n    cn.com.sinopec.bussiness.znyw.mapper: DEBUG<\/p>\n<ul>\n<li>\n<p>Mapper \u5305\u65e5\u5fd7\u8bbe\u4e3a DEBUG&#xff0c;\u6253\u5370\u5b8c\u6574\u6267\u884c SQL\u3001\u53c2\u6570\u3001\u6267\u884c\u8017\u65f6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5f00\u53d1\u3001\u7ebf\u4e0a\u6392\u67e5\u6570\u636e\u5e93\u6162\u67e5\u8be2\u3001SQL \u62a5\u9519\u5fc5\u5907&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u57fa\u7840\u516c\u5171 API \u5305\u5f00\u542f DEBUG&#xff0c;\u65b9\u4fbf\u8ffd\u8e2a\u63a5\u53e3\u5165\u53c2\u3001\u51fa\u53c2\u65e5\u5fd7\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e5d\u3001\u5916\u90e8\u5de5\u5355\u7cfb\u7edf\u63a5\u53e3\u914d\u7f6e&#xff08;\u7b2c\u4e09\u65b9\u8fdc\u7a0b\u63a5\u53e3&#xff09;<\/p>\n<p>inspection:<br \/>\n  work-order:<br \/>\n    base-url: http:\/\/10.66.205.199\/ # \u6cb9\u7530\u5de1\u68c0\u5de5\u5355\u7cfb\u7edf\u6839\u5730\u5740<br \/>\n    app-key: inspection-system          # \u63a5\u53e3\u8eab\u4efd\u8ba4\u8bc1key<br \/>\n    app-secret: change-me               # \u5bc6\u94a5&#xff08;\u751f\u4ea7\u73af\u5883\u9700\u4fee\u6539&#xff0c;\u5f53\u524d\u5360\u4f4d\u7b26&#xff09;<br \/>\n    category-id: 1                       # \u5de5\u5355\u5206\u7c7bID<br \/>\n    timeout: 30000                       # \u63a5\u53e3\u8c03\u7528\u8d85\u65f630\u79d2<\/p>\n<p>\u4e1a\u52a1\u7528\u9014&#xff1a;\u672c\u670d\u52a1\u4f5c\u4e3a\u8ba1\u7b97\u5f15\u64ce&#xff0c;\u9700\u8981\u8fdc\u7a0b\u8c03\u7528\u6cb9\u7530\u5de1\u68c0\u5de5\u5355\u7cfb\u7edf&#xff0c;\u540c\u6b65\u5de5\u5355\u6570\u636e\u3001\u751f\u6210\u5de1\u68c0\u8ba1\u7b97\u62a5\u8868&#xff0c;\u72ec\u7acb\u62bd\u53d6\u914d\u7f6e\u65b9\u4fbf\u73af\u5883\u5207\u6362&#xff08;\u5f00\u53d1 \/ \u6d4b\u8bd5 \/ \u751f\u4ea7\u66f4\u6362 base-url&#xff09;\u3002<\/p>\n<p>\u6574\u4f53\u9879\u76ee\u67b6\u6784\u603b\u7ed3<\/p>\n<li>\n<p>\u6280\u672f\u6808&#xff1a;SpringBoot &#043; \u8fbe\u68a6\u56fd\u4ea7\u6570\u636e\u5e93 (Druid) &#043; Redis &#043; Elasticsearch \u96c6\u7fa4 &#043; MyBatis &#043; Tomcat \u9ad8\u5e76\u53d1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u5206\u5c42&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4e1a\u52a1\u6a21\u5757&#xff1a;cn.com.xxx.bussiness \u5de5\u5355\u3001\u667a\u80fd\u4e1a\u52a1\u5904\u7406&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6838\u5fc3\u6a21\u5757&#xff1a;cn.com.xxx.calculation \u6570\u636e\u8ba1\u7b97\u5f15\u64ce&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b58\u50a8\u5c42&#xff1a;\u8fbe\u68a6\u5b58\u4e1a\u52a1\u4e3b\u6570\u636e&#xff0c;ES \u5b58\u65f6\u5e8f\u65e5\u5fd7&#xff0c;Redis \u5b58\u7f13\u5b58&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5916\u90e8\u4f9d\u8d56&#xff1a;\u8fdc\u7a0b\u5de1\u68c0\u5de5\u5355\u7b2c\u4e09\u65b9\u63a5\u53e3&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u73af\u5883\u9002\u914d\u8bbe\u8ba1&#xff1a;ES \u533a\u5206\u672c\u5730\u5f00\u53d1 \/ \u751f\u4ea7\u96c6\u7fa4&#xff0c;\u914d\u7f6e\u62bd\u79bb&#xff0c;\u65e0\u9700\u4fee\u6539\u4ee3\u7801\u5207\u6362\u73af\u5883&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u751f\u4ea7\u5b89\u5168\u89c4\u8303&#xff1a;\u5173\u95ed JMX\u3001\u751f\u4ea7 ES \u542f\u7528 HTTPS\u3001\u7b2c\u4e09\u65b9\u63a5\u53e3\u5bc6\u94a5\u914d\u7f6e\u5316\u3001\u9650\u5236\u6570\u636e\u5e93 \/ \u7f13\u5b58\u6700\u5927\u8fde\u63a5\u6570&#xff0c;\u9632\u6b62\u8d44\u6e90\u8017\u5c3d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u914d\u5957\u542f\u52a8\u7c7b\u547c\u5e94\u70b9&#xff1a;\u5173\u95ed JMX\u3001\u6392\u9664 MyBatis \u81ea\u52a8\u914d\u7f6e&#xff08;\u914d\u7f6e\u5f00\u542f Bean \u8986\u76d6&#xff09;\u3001\u5168\u5c40\u8de8\u57df\u3001\u542f\u7528\u5b9a\u65f6\u4efb\u52a1&#xff0c;\u914d\u7f6e\u6587\u4ef6\u4e0e\u542f\u52a8\u7c7b\u5b8c\u5168\u914d\u5957\u3002<\/p>\n<\/li>\n<p>\u4f18\u5316\u5efa\u8bae&#xff08;\u751f\u4ea7\u73af\u5883&#xff09;<\/p>\n<li>\n<p>&#064;CrossOrigin(origins &#061; &#034;*&#034;) \u751f\u4ea7\u7981\u6b62\u5168\u5c40\u653e\u884c\u6240\u6709\u57df\u540d&#xff0c;\u6307\u5b9a\u524d\u7aef\u771f\u5b9e\u57df\u540d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5de5\u5355\u7cfb\u7edfapp-secret: change-me\u5fc5\u987b\u66ff\u6362\u4e3a\u751f\u4ea7\u771f\u5b9e\u5bc6\u94a5&#xff0c;\u907f\u514d\u63a5\u53e3\u8d8a\u6743\u8bbf\u95ee&#xff1b;<\/p>\n<\/li>\n<li>\n<p>ES \u751f\u4ea7\u5bc6\u7801\u3001\u8fbe\u68a6\u6570\u636e\u5e93\u5bc6\u7801\u53ef\u653e\u5165\u73af\u5883\u53d8\u91cf&#xff0c;\u7981\u6b62\u660e\u6587\u5199\u5728 yml \u914d\u7f6e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>MyBatis \u4e8c\u7ea7\u7f13\u5b58\u6839\u636e\u4e1a\u52a1\u5b9e\u65f6\u6027\u8bc4\u4f30&#xff0c;\u82e5\u8bfb\u591a\u5199\u5c11\u53ef\u9009\u62e9\u6027\u5f00\u542f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Tomcat \u6700\u5927\u7ebf\u7a0b 2500 \u8fc7\u9ad8&#xff0c;\u6839\u636e\u670d\u52a1\u5668 CPU \/ \u5185\u5b58\u8d44\u6e90\u4e0b\u8c03&#xff0c;\u907f\u514d\u64cd\u4f5c\u7cfb\u7edf\u7ebf\u7a0b\u5207\u6362\u5f00\u9500\u8fc7\u5927\u3002<\/p>\n<\/li>\n<h3><\/h3>\n<h3><\/h3>\n<h3 style=\"background-color:transparent\">\u524d\u7aef\u8def\u7531 &#xff1a; router.define.js &#8211; \u4e86\u89e3\u9875\u9762\u7ed3\u6784<\/h3>\n<p>router.define.js<\/p>\n<p>\u8fd9\u4efd\u4ee3\u7801\u662f Vue2\/Vue3 \u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\u8def\u7531\u5b9a\u4e49\u6587\u4ef6&#xff0c;\u5bf9\u5e94\u540e\u7aef ZNYW \u667a\u80fd\u8fd0\u7ef4\u4e1a\u52a1 \u524d\u7aef\u9875\u9762&#xff0c;\u6574\u4f53\u5206\u4e3a&#xff1a;\u9875\u9762\u9759\u6001\u5bfc\u5165\u3001\u667a\u80fd\u8fd0\u7ef4\u72ec\u7acb\u8def\u7531znywRoutes\u3001\u72ec\u7acb\u9875\u9762\u8def\u7531routesUseViews\u3001\u6846\u67b6\u5e03\u5c40\u5b50\u8def\u7531routesUseLayout\u3001\u7edf\u4e00\u5bfc\u51fa\u4e94\u5927\u90e8\u5206\u3002<\/p>\n<p>\u4e00\u3001\u9876\u90e8&#xff1a;\u9759\u6001 import \u9875\u9762\u7ec4\u4ef6<\/p>\n<p>import Dashboard from &#039;&#064;\/views\/home\/dashboard.vue&#039;;<br \/>\nimport DemoPage from &#039;&#064;\/views\/DemoPage.vue&#039;;<br \/>\nimport FileUpload from &#039;&#064;\/views\/fileupload\/fileupload.vue&#039;;<br \/>\n\/\/ \u7701\u7565\u5927\u91cfUI\u7ec4\u4ef6\u9875\u9762\u5bfc\u5165<\/p>\n<p>\u4f5c\u7528<\/p>\n<li>\n<p>\u9759\u6001\u5f15\u5165&#xff1a;\u9875\u9762\u6253\u5305\u65f6\u76f4\u63a5\u6253\u5305\u8fdb\u4e3b chunk&#xff0c;\u8bbf\u95ee\u9875\u9762\u65e0\u9700\u5f02\u6b65\u52a0\u8f7d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9002\u7528\u9875\u9762&#xff1a;\u901a\u7528 UI \u6f14\u793a\u9875\u3001\u6587\u4ef6\u4e0a\u4f20\u3001\u4eea\u8868\u76d8\u7b49\u4f4e\u9891 \/ \u5c0f\u578b\u9875\u9762&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u6bd4\u540e\u6587 ()&#061;&gt;import() \u52a8\u6001\u5bfc\u5165&#xff1a;\u5927\u578b\u4e1a\u52a1\u9875\u9762\u4f7f\u7528\u8def\u7531\u61d2\u52a0\u8f7d&#xff0c;\u62c6\u5206 JS \u5305&#xff0c;\u4f18\u5316\u9996\u5c4f\u52a0\u8f7d\u901f\u5ea6\u3002<\/p>\n<\/li>\n<p>\u6ce8\u91ca\u4ee3\u7801\u8bf4\u660e<\/p>\n<p>\/\/import Login from &#039;&#064;\/views\/home\/login.vue&#039;;<br \/>\n\/\/ import { znywRoutes } from &#039;.\/znyw.define.js&#039;;<\/p>\n<li>\n<p>\u65e7\u7cfb\u7edf\u767b\u5f55\u9875\u9762\u5df2\u5f03\u7528\u6ce8\u91ca&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u539f\u5148\u667a\u80fd\u8fd0\u7ef4\u8def\u7531\u62bd\u79bb\u5230\u5355\u72ec\u6587\u4ef6&#xff0c;\u73b0\u5728\u76f4\u63a5\u5199\u5728\u5f53\u524d\u6587\u4ef6&#xff0c;\u6ce8\u91ca\u6389\u65e7\u5f15\u5165\u3002<\/p>\n<\/li>\n<p>\u4e8c\u3001\u6838\u5fc3\u4e1a\u52a1\u8def\u7531&#xff1a;const znywRoutes &#061; []<\/p>\n<p>ZNYW &#061; \u667a\u80fd\u8fd0\u7ef4&#xff08;\u548c\u540e\u7aef yml\u3001\u542f\u52a8\u7c7b\u7684ZNYW\u5e93\u5b8c\u5168\u5bf9\u5e94&#xff0c;\u6cb9\u7530\u667a\u80fd\u76d1\u63a7\u5de5\u5355\u7cfb\u7edf&#xff09;&#xff0c;\u8fd9\u662f\u9879\u76ee\u6838\u5fc3\u4e1a\u52a1\u6a21\u5757\u8def\u7531\u3002<\/p>\n<p>1. \u7b2c\u4e00\u6761\u8def\u7531&#xff1a;\/znyw \u4e3b\u4e1a\u52a1\u5165\u53e3<\/p>\n<p>{<br \/>\n    path: &#034;\/znyw&#034;,<br \/>\n    name: &#034;znyw-home&#034;,<br \/>\n    component: () &#061;&gt; import(&#034;&#064;\/components\/layout\/znyw\/MainLayout.vue&#034;),<br \/>\n    meta: { title: &#034;\u65b0\u7cfb\u7edf\u9996\u9875&#034;, independent: true },<br \/>\n    children: [\/* \u5b50\u9875\u9762\u8def\u7531 *\/]<br \/>\n}<\/p>\n<p>\u5173\u952e\u5b57\u6bb5\u62c6\u89e3<\/p>\n<li>\n<p>path: &#034;\/znyw&#034; \u72ec\u7acb\u4e00\u7ea7\u8def\u7531&#xff0c;\u4e0d\u5d4c\u5957\u5728\u65e7\u540e\u53f0\u7ba1\u7406\u7cfb\u7edf\u5e03\u5c40&#xff0c;\u5b8c\u5168\u9694\u79bb\u65b0\u65e7\u4e24\u5957\u7cfb\u7edf\u9875\u9762\u3002<\/p>\n<\/li>\n<li>\n<p>component: ()&#061;&gt;import(\u5e03\u5c40\u7ec4\u4ef6)<\/p>\n<ul>\n<li>\n<p>\u8def\u7531\u61d2\u52a0\u8f7d&#xff0c;\u8bbf\u95ee\/znyw\u624d\u52a0\u8f7d\u5e03\u5c40 JS&#xff1b;<\/p>\n<\/li>\n<li>\n<p>MainLayout.vue&#xff1a;\u667a\u80fd\u8fd0\u7ef4\u4e13\u5c5e\u4fa7\u8fb9\u680f\u3001\u9876\u90e8\u5bfc\u822a\u3001\u9875\u9762\u5185\u5bb9\u5bb9\u5668\u5e03\u5c40&#xff0c;\u548c\u65e7\u7cfb\u7edf\u5e03\u5c40\u5206\u5f00\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>meta: { independent: true } \u81ea\u5b9a\u4e49\u8def\u7531\u5143\u4fe1\u606f&#xff1a;\u6807\u8bb0\u8be5\u8def\u7531\u4e3a\u72ec\u7acb\u65b0\u7cfb\u7edf&#xff0c;\u5168\u5c40\u8def\u7531\u5b88\u536b&#xff08;\u767b\u5f55\u9274\u6743\u3001\u6743\u9650\u62e6\u622a&#xff09;\u4f1a\u8df3\u8fc7\u65e7\u7cfb\u7edf\u7684\u6743\u9650\u3001\u767b\u5f55\u6821\u9a8c\u903b\u8f91&#xff0c;\u5b9e\u73b0\u4e24\u5957\u7cfb\u7edf\u767b\u5f55\u9694\u79bb\u3002<\/p>\n<\/li>\n<li>\n<p>children \u5b50\u8def\u7531\u5217\u8868&#xff08;\u6838\u5fc3\u4e1a\u52a1\u9875\u9762&#xff09;<\/p>\n<table>\n<tr>\n<p>\u5b50\u8def\u7531 path<\/p>\n<p>\u5bf9\u5e94\u9875\u9762<\/p>\n<p>\u4e1a\u52a1\u4f5c\u7528<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>\u7a7a path<\/p>\n<\/td>\n<td>\n<p>Home.vue<\/p>\n<\/td>\n<td>\n<p>\u667a\u80fd\u8fd0\u7ef4\u9996\u9875\u603b\u89c8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>list<\/p>\n<\/td>\n<td>\n<p>SystemList.vue<\/p>\n<\/td>\n<td>\n<p>\u7cfb\u7edf\u6e05\u5355\u7ba1\u7406<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>application<\/p>\n<\/td>\n<td>\n<p>ApplicationList.vue<\/p>\n<\/td>\n<td>\n<p>\u5e94\u7528\u7ba1\u7406<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>metric<\/p>\n<\/td>\n<td>\n<p>MetricNaming.vue<\/p>\n<\/td>\n<td>\n<p>\u6307\u6807\u540d\u79f0\u914d\u7f6e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>metricAlgorithm<\/p>\n<\/td>\n<td>\n<p>MetricAlgorithm.vue<\/p>\n<\/td>\n<td>\n<p>\u6307\u6807\u8ba1\u7b97\u7b97\u6cd5\u914d\u7f6e&#xff08;\u540e\u7aef calculation \u8ba1\u7b97\u5f15\u64ce\u914d\u5957&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>alertRule<\/p>\n<\/td>\n<td>\n<p>AlertRule.vue<\/p>\n<\/td>\n<td>\n<p>\u544a\u8b66\u89c4\u5219\u914d\u7f6e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>alertModel<\/p>\n<\/td>\n<td>\n<p>AlertModel.vue<\/p>\n<\/td>\n<td>\n<p>\u544a\u8b66\u6a21\u578b\u914d\u7f6e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>alertTask<\/p>\n<\/td>\n<td>\n<p>AlertTask.vue<\/p>\n<\/td>\n<td>\n<p>\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1&#xff08;\u5bf9\u5e94\u540e\u7aef &#064;EnableScheduling \u5b9a\u65f6\u4efb\u52a1&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>taskRecord<\/p>\n<\/td>\n<td>\n<p>TaskRecord.vue<\/p>\n<\/td>\n<td>\n<p>\u5b9a\u65f6\u4efb\u52a1\u6267\u884c\u8bb0\u5f55<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>monitorObject<\/p>\n<\/td>\n<td>\n<p>MonitorObjectList.vue<\/p>\n<\/td>\n<td>\n<p>\u6cb9\u7530\u76d1\u63a7\u5bf9\u8c61\u7ba1\u7406<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>analysis<\/p>\n<\/td>\n<td>\n<p>Analysis.vue<\/p>\n<\/td>\n<td>\n<p>\u76d1\u63a7\u6570\u636e\u5206\u6790\u9875\u9762<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>ticket<\/p>\n<\/td>\n<td>\n<p>TicketManagement.vue<\/p>\n<\/td>\n<td>\n<p>\u5de1\u68c0\u5de5\u5355\u7ba1\u7406&#xff08;\u5bf9\u63a5\u540e\u7aef\u5de5\u5355\u7b2c\u4e09\u65b9\u63a5\u53e3&#xff09;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<p>2. \u7b2c\u4e8c\u6761\u8def\u7531&#xff1a;\/znyw\/alarm<\/p>\n<p>path: &#034;\/znyw\/alarm&#034;,<br \/>\nchildren: [\u548c\u4e0a\u9762\u5b8c\u5168\u4e00\u81f4\u7684\u9875\u9762\u8def\u7531]<\/p>\n<p>\u95ee\u9898\u8bf4\u660e<\/p>\n<p>\u8fd9\u6761\u8def\u7531\u5b58\u5728\u4e25\u91cd\u5197\u4f59&#xff1a;\u5b50\u8def\u7531\u5217\u8868\u548c\/znyw\u5b8c\u5168\u91cd\u590d\u3002<\/p>\n<ul>\n<li>\n<p>\u8bbe\u8ba1\u610f\u56fe&#xff1a;\u539f\u672c\u60f3\u5355\u72ec\u505a\u544a\u8b66\u6a21\u5757\u4e00\u7ea7\u8def\u7531&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7f3a\u9677&#xff1a;\u91cd\u590d\u4ee3\u7801&#xff0c;\u7ef4\u62a4\u6210\u672c\u9ad8&#xff0c;\u4fee\u6539\u9875\u9762\u9700\u8981\u4e24\u5904\u540c\u6b65\u4fee\u6539&#xff0c;\u540e\u7eed\u5efa\u8bae\u5408\u5e76\u3001\u62c6\u5206\u72ec\u7acb\u544a\u8b66\u8def\u7531\u6570\u7ec4\u590d\u7528\u3002<\/p>\n<\/li>\n<\/ul>\n<p>3. \u6ce8\u91ca\u6389\u7684\u767b\u5f55\u8def\u7531<\/p>\n<p>\/\/ {<br \/>\n\/\/     path: &#034;\/znyw\/login&#034;,<br \/>\n\/\/     name: &#034;znyw-login&#034;,<br \/>\n\/\/     component: () &#061;&gt; import(&#034;&#064;\/views\/znyw\/login\/Login.vue&#034;),<br \/>\n\/\/     meta: { title: &#034;\u667a\u80fd\u8fd0\u7ef4\u7cfb\u7edf\u767b\u5f55&#034;, independent: true }<br \/>\n\/\/ }<\/p>\n<p>\u72ec\u7acb\u767b\u5f55\u9875\u5df2\u4e34\u65f6\u6ce8\u91ca&#xff0c;\u8bf4\u660e\u5f53\u524d\u7cfb\u7edf\u767b\u5f55\u903b\u8f91\u6682\u65f6\u590d\u7528\u65e7\u7cfb\u7edf\u767b\u5f55&#xff0c;\u540e\u7eed\u53ef\u653e\u5f00&#xff0c;\u5b9e\u73b0\u667a\u80fd\u8fd0\u7ef4\u7cfb\u7edf\u72ec\u7acb\u767b\u5f55\u9875\u9762\u3002<\/p>\n<p>\u4e09\u3001\u72ec\u7acb\u9875\u9762\u8def\u7531&#xff1a;const routesUseViews &#061; []<\/p>\n<p>\u5b58\u50a8\u4e0d\u5d4c\u5957\u4efb\u4f55\u4fa7\u8fb9\u680f\u5e03\u5c40\u7684\u7eaf\u72ec\u7acb\u9875\u9762&#xff0c;\u8bbf\u95ee\u65f6\u53ea\u6e32\u67d3\u9875\u9762\u81ea\u8eab&#xff0c;\u65e0\u5bfc\u822a\u680f\u3002<\/p>\n<p>1. \u6839\u8def\u5f84\u91cd\u5b9a\u5411<\/p>\n<p>{<br \/>\n    path: &#034;\/&#034;,<br \/>\n    redirect: &#034;\/znyw&#034;,<br \/>\n    meta: { hidden: true }<br \/>\n}<\/p>\n<ul>\n<li>\n<p>redirect: &#034;\/znyw&#034;&#xff1a;\u7528\u6237\u76f4\u63a5\u8bbf\u95ee\u57df\u540d\u6839\u5730\u5740http:\/\/ip:8091\/&#xff0c;\u81ea\u52a8\u8df3\u8f6c\u5230\u667a\u80fd\u8fd0\u7ef4\u9996\u9875&#xff1b;<\/p>\n<\/li>\n<li>\n<p>meta.hidden:true&#xff1a;\u8def\u7531\u83dc\u5355\u6e32\u67d3\u65f6\u9690\u85cf\u8be5\u8def\u7531&#xff0c;\u4fa7\u8fb9\u680f\u4e0d\u663e\u793a\u6839\u8def\u5f84\u83dc\u5355\u3002<\/p>\n<\/li>\n<\/ul>\n<p>2. \u6587\u4ef6\u4e0a\u4f20\u9875\u9762<\/p>\n<p>{<br \/>\n    path: &#034;\/fileUpload&#034;,<br \/>\n    component: FileUpload,<br \/>\n    meta: { title: &#034;\u6587\u4ef6\u4e0a\u4f20&#034; }<br \/>\n},<br \/>\n{<br \/>\n    path: &#034;\/fileIndex&#034;,<br \/>\n    component: FileIndex,<br \/>\n    meta: { title: &#034;\u6587\u4ef6\u4e0a\u4f20\u5217\u8868&#034; }<br \/>\n}<\/p>\n<p>\u72ec\u7acb\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd&#xff0c;\u4e0d\u5d4c\u5165\u540e\u53f0\u5e03\u5c40&#xff0c;\u7528\u4e8e\u9644\u4ef6\u3001\u62a5\u8868\u6587\u4ef6\u4e0a\u4f20\u5b58\u50a8\u3002<\/p>\n<p>\u56db\u3001\u6846\u67b6\u5e03\u5c40\u5b50\u8def\u7531&#xff1a;const routesUseLayout &#061; []<\/p>\n<p>\u8be5\u6570\u7ec4\u5185\u6240\u6709\u8def\u7531\u90fd\u5d4c\u5957\u5728\u65e7\u7248\u540e\u53f0\u901a\u7528\u5e03\u5c40\u4e2d&#xff08;\u4fa7\u8fb9\u680f &#043; \u9876\u90e8\u5bfc\u822a&#xff09;&#xff0c;\u5b58\u653e UI \u7ec4\u4ef6\u6f14\u793a\u3001\u5fae\u524d\u7aef\u5d4c\u5165\u9875\u9762\u3002<\/p>\n<p>1. \u5fae\u524d\u7aef\u5b50\u5e94\u7528\u8def\u7531&#xff08;\u91cd\u70b9&#xff09;<\/p>\n<p>{<br \/>\n    path: &#039;\/micro\/:path(.*)*&#039;,<br \/>\n    component: () &#061;&gt; import(&#034;&#064;\/views\/home\/micro-container.vue&#034;),<br \/>\n    meta: { title: &#034;\u5fae\u524d\u7aef1\u52a0\u8f7d&#034;, keepAlive: false }<br \/>\n},<br \/>\n{<br \/>\n    path: &#039;\/micro2\/:path(.*)*&#039;,<br \/>\n    component: () &#061;&gt; import(&#034;&#064;\/views\/home\/micro-container.vue&#034;),<br \/>\n    meta: { title: &#034;\u5fae\u524d\u7aef2\u52a0\u8f7d&#034;, keepAlive: false }<br \/>\n}<\/p>\n<li>\n<p>\u8def\u7531\u5339\u914d\u89c4\u5219 \/:path(.*)*&#xff1a;\u6b63\u5219\u5339\u914d\/micro\/\u540e\u7684\u6240\u6709\u5b50\u8def\u5f84&#xff0c;\u7528\u4e8e\u5fae\u524d\u7aef\u57fa\u5ea7\u8f6c\u53d1\u5b50\u5e94\u7528\u8def\u7531&#xff1b;<\/p>\n<\/li>\n<li>\n<p>micro-container.vue&#xff1a;\u5fae\u524d\u7aef\u5bb9\u5668\u7ec4\u4ef6&#xff0c;\u901a\u8fc7 qiankun\/iframe \u52a0\u8f7d\u5916\u90e8\u5b50\u7cfb\u7edf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>keepAlive:false&#xff1a;\u9875\u9762\u79bb\u5f00\u4e0d\u7f13\u5b58&#xff0c;\u6bcf\u6b21\u8fdb\u5165\u5fae\u5e94\u7528\u91cd\u65b0\u52a0\u8f7d&#xff0c;\u907f\u514d\u5b50\u5e94\u7528\u72b6\u6001\u6c61\u67d3\u3002<\/p>\n<\/li>\n<p>2. UI \u7ec4\u4ef6\u6f14\u793a\u8def\u7531<\/p>\n<p>\u6570\u7ec4\u5269\u4f59\u5168\u90e8\u8def\u7531\u4e3a\u540e\u53f0\u7ec4\u4ef6\u6f14\u793a\u9875\u9762&#xff1a; \u4eea\u8868\u76d8\u3001\u8868\u683c\u3001\u8868\u5355\u3001\u56fe\u8868\u3001\u6309\u94ae\u3001\u9009\u62e9\u5668\u3001\u6807\u7b7e\u3001\u8fdb\u5ea6\u6761\u3001\u63d0\u793a\u3001\u52a0\u8f7d\u7ec4\u4ef6\u7b49&#xff1b;<\/p>\n<ul>\n<li>\n<p>\u5168\u90e8\u4f7f\u7528\u9759\u6001\u5bfc\u5165\u7ec4\u4ef6&#xff08;\u6587\u4ef6\u9876\u90e8 import&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>meta.title&#xff1a;\u4fa7\u8fb9\u680f\u83dc\u5355\u663e\u793a\u7684\u4e2d\u6587\u540d\u79f0&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u90e8\u4e3a\u4e8c\u7ea7\u8def\u7531&#xff0c;\u62fc\u63a5\u65e7\u7cfb\u7edf\u5e03\u5c40&#xff0c;\u4f8b\u5982\u5b8c\u6574\u8bbf\u95ee\u5730\u5740&#xff1a;\/dashboard\u3001\/table\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e94\u3001\u672b\u5c3e\u7edf\u4e00\u5bfc\u51fa<\/p>\n<p>export {<br \/>\n    znywRoutes,<br \/>\n    routesUseLayout,<br \/>\n    routesUseViews,<br \/>\n}<\/p>\n<p>\u5c06\u4e09\u7ec4\u8def\u7531\u6570\u7ec4\u5bfc\u51fa&#xff0c;\u5728\u9879\u76ee\u8def\u7531\u603b\u5165\u53e3 router\/index.js\u4e2d\u5f15\u5165&#xff0c;\u5408\u5e76\u6210\u5b8c\u6574\u8def\u7531\u8868\u3002<\/p>\n<p>\u516d\u3001\u6574\u4f53\u9879\u76ee\u524d\u7aef\u67b6\u6784\u68b3\u7406<\/p>\n<li>\n<p>\u4e24\u5957\u7cfb\u7edf\u9694\u79bb<\/p>\n<ul>\n<li>\n<p>\u65e7\u7cfb\u7edf&#xff1a;\u901a\u7528\u540e\u53f0\u5e03\u5c40&#xff0c;UI \u7ec4\u4ef6\u6f14\u793a\u3001\u5fae\u524d\u7aef\u5d4c\u5165\u3001\u6587\u4ef6\u4e0a\u4f20&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65b0\u7cfb\u7edf ZNYW&#xff1a;\u72ec\u7acb\u4e13\u5c5e\u5e03\u5c40&#xff0c;xx\u667a\u80fd\u76d1\u63a7\u3001\u6307\u6807\u3001\u544a\u8b66\u3001\u5de5\u5355\u6838\u5fc3\u4e1a\u52a1&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8def\u7531\u52a0\u8f7d\u7b56\u7565\u533a\u5206<\/p>\n<ul>\n<li>\n<p>\u5927\u578b\u4e1a\u52a1\u9875\u9762&#xff08;znyw \u5b50\u9875\u9762&#xff09;&#xff1a;\u61d2\u52a0\u8f7d()&#061;&gt;import&#xff0c;\u5206\u5305\u4f18\u5316\u9996\u5c4f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5c0f\u578b UI \u6f14\u793a\u9875\u9762&#xff1a;\u9759\u6001 import&#xff0c;\u51cf\u5c11\u5f02\u6b65\u8bf7\u6c42&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u524d\u540e\u7aef\u5bf9\u5e94\u5173\u7cfb \u524d\u7aef znyw \u5168\u90e8\u9875\u9762&#xff0c;\u5b8c\u5168\u5339\u914d\u540e\u7aef SpringBoot \u670d\u52a1&#xff1a;\u8fbe\u68a6 ZNYW \u6570\u636e\u5e93\u3001\u6307\u6807\u8ba1\u7b97\u5f15\u64ce\u3001\u5b9a\u65f6\u544a\u8b66\u4efb\u52a1\u3001\u5de5\u5355\u7b2c\u4e09\u65b9\u63a5\u53e3\u3001ES \u65e5\u5fd7\u68c0\u7d22&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8def\u7531\u5143\u4fe1\u606f meta \u4f5c\u7528<\/p>\n<ul>\n<li>\n<p>independent:true&#xff1a;\u8def\u7531\u5b88\u536b\u533a\u5206\u65b0\u65e7\u7cfb\u7edf\u9274\u6743\u903b\u8f91&#xff1b;<\/p>\n<\/li>\n<li>\n<p>title&#xff1a;\u6d4f\u89c8\u5668\u6807\u7b7e\u6807\u9898\u3001\u4fa7\u8fb9\u680f\u83dc\u5355\u6587\u5b57&#xff1b;<\/p>\n<\/li>\n<li>\n<p>hidden:true&#xff1a;\u83dc\u5355\u9690\u85cf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>keepAlive&#xff1a;\u9875\u9762\u7f13\u5b58\u63a7\u5236\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<p>\u4e03\u3001\u4ee3\u7801\u5b58\u5728\u7684\u4f18\u5316\u70b9<\/p>\n<li>\n<p>\/znyw\/alarm \u5b50\u8def\u7531\u5b8c\u5168\u91cd\u590d&#xff0c;\u62bd\u79bb\u516c\u5171\u5b50\u8def\u7531\u6570\u7ec4\u590d\u7528&#xff0c;\u6d88\u9664\u5197\u4f59&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5927\u91cf UI \u7ec4\u4ef6\u9875\u9762\u547d\u540d\u6df7\u7528\u62fc\u97f3&#xff08;jindutiao\u3001biaoqian&#xff09;&#xff0c;\u89c4\u8303\u4e3a\u82f1\u6587\u547d\u540d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u667a\u80fd\u8fd0\u7ef4\u767b\u5f55\u8def\u7531\u6ce8\u91ca&#xff0c;\u53ef\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u653e\u5f00\u72ec\u7acb\u767b\u5f55&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8def\u7531\u6570\u7ec4\u62c6\u5206\u903b\u8f91\u53ef\u4f18\u5316&#xff1a;\u5c06\u5fae\u524d\u7aef\u8def\u7531\u5355\u72ec\u62bd\u79bb\u6570\u7ec4&#xff0c;\u7ed3\u6784\u66f4\u6e05\u6670&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u672a\u914d\u7f6emeta.requiresAuth\u9274\u6743\u6807\u8bb0&#xff0c;\u8def\u7531\u5b88\u536b\u65e0\u6cd5\u7edf\u4e00\u62e6\u622a\u672a\u767b\u5f55\u8bbf\u95ee\u3002<\/p>\n<\/li>\n<p>\u4ee3\u7801\u5199\u5f97\u592a\u4e71\u4e86&#xff0c;\u903b\u8f91\u62fc\u8d34\u5f97\u5f88\u4e71\u3002<\/p>\n<p>\u592a\u96be\u4e3a\u7ef4\u62a4\u4e86&#xff0c;\u4e00\u822c\u91cd\u6784\u662f\u6700\u597d\u7684\u529e\u6cd5\u3002<\/p>\n<\/p>\n<p>\u7b2c\u4e8c\u9636\u6bb5\u3010\u6838\u5fc3\u4e1a\u52a1\u6a21\u5757\u3011<\/p>\n<h3 style=\"background-color:transparent\">\u544a\u8b66\u6a21\u578b\u7ba1\u7406<\/h3>\n<h4>AlarmModelController.java<\/h4>\n<p>\u8fd9\u662fxxx\u667a\u80fd\u8fd0\u7ef4 ZNYW \u6a21\u5757\u540e\u7aef\u63a5\u53e3\u63a7\u5236\u5668&#xff0c;\u5bf9\u5e94\u524d\u7aef\u8def\u7531 \/znyw\/alertModel \u544a\u8b66\u6a21\u578b\u9875\u9762&#xff0c;\u6807\u51c6 SpringBoot RESTful \u5206\u5c42\u67b6\u6784 Controller \u5c42&#xff0c;\u63d0\u4f9b\u544a\u8b66\u6a21\u578b\u5206\u9875\u67e5\u8be2\u3001\u5355\u6761 CRUD\u3001\u591a\u6761\u4ef6\u7b5b\u9009\u3001\u6a21\u578b\u5173\u8054\u914d\u7f6e\u5168\u5957\u63a5\u53e3\u3002<\/p>\n<p>\u4e00\u3001\u57fa\u7840\u5934\u90e8\u4fe1\u606f\u89e3\u6790<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.xxx.bussiness.znyw.controller;<\/p>\n<p>\u548c\u4e4b\u524d\u542f\u52a8\u7c7b\u3001yml \u914d\u7f6e\u3001\u524d\u7aef\u8def\u7531\u5b8c\u5168\u5bf9\u5e94&#xff1a;<\/p>\n<ul>\n<li>\n<p>bussiness \u4e1a\u52a1\u4e3b\u6a21\u5757<\/p>\n<\/li>\n<li>\n<p>znyw \u667a\u80fd\u8fd0\u7ef4\u5b50\u4e1a\u52a1<\/p>\n<\/li>\n<li>\n<p>controller \u63a5\u53e3\u63a7\u5236\u5c42<\/p>\n<\/li>\n<\/ul>\n<p>2. \u5bfc\u5165\u7c7b\u8bf4\u660e<\/p>\n<li>\n<p>\u5206\u9875\u5de5\u5177 DataPaging&#xff1a;\u9879\u76ee\u5c01\u88c5\u901a\u7528\u5206\u9875\u8fd4\u56de\u5bf9\u8c61&#xff0c;\u5305\u542b\u603b\u6761\u6570\u3001\u9875\u7801\u3001\u6570\u636e\u5217\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u8fd4\u56de\u4f53 JsonMessage&#xff1a;\u4f01\u4e1a\u5168\u5c40\u6807\u51c6\u63a5\u53e3\u8fd4\u56de\u683c\u5f0f&#xff0c;\u533a\u5206\u6210\u529f \/ \u5931\u8d25\u3001\u643a\u5e26\u6570\u636e \/ \u9519\u8bef\u4fe1\u606f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u4f53 AlarmModel&#xff1a;\u6570\u636e\u5e93\u544a\u8b66\u6a21\u578b\u8868\u6620\u5c04\u5b9e\u4f53\u7c7b&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1 Service<\/p>\n<ul>\n<li>\n<p>AlarmModelService&#xff1a;\u544a\u8b66\u6a21\u578b\u57fa\u7840\u589e\u5220\u6539\u67e5\u670d\u52a1<\/p>\n<\/li>\n<li>\n<p>AlarmModelConfigService&#xff1a;\u544a\u8b66\u6a21\u578b\u5173\u8054\u914d\u7f6e\u4e13\u7528\u670d\u52a1&#xff08;\u89c4\u5219\u3001\u6307\u6807\u3001\u76d1\u63a7\u8303\u56f4\u5173\u8054\u903b\u8f91&#xff09;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><span style=\"color:#fe2c24\">Spring Web \u6ce8\u89e3&#xff1a;&#064;RestController\u3001&#064;RequestMapping\u3001&#064;Get\/Post\/Put\/DeleteMapping\u3001&#064;RequestParam\u3001&#064;PathVariable\u3001&#064;RequestBody&#xff1b;<\/span><\/p>\n<\/li>\n<li>\n<p>\u5de5\u5177\u7c7b&#xff1a;HashMap\/Map \u5c01\u88c5\u52a8\u6001\u67e5\u8be2\u53c2\u6570\u3001\u52a8\u6001\u914d\u7f6e\u8fd4\u56de\u6570\u636e\u3002<\/p>\n<\/li>\n<p>3. \u7c7b\u6ce8\u89e3<\/p>\n<p>&#064;RestController<br \/>\n&#064;RequestMapping(&#034;\/api\/alarmModel&#034;)<\/p>\n<li>\n<p>&#064;RestController &#061; &#064;Controller &#043; &#064;ResponseBody \u6240\u6709\u63a5\u53e3\u8fd4\u56de\u503c\u81ea\u52a8\u5e8f\u5217\u5316\u4e3a JSON&#xff0c;\u65e0\u9700\u989d\u5916\u6ce8\u89e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40\u63a5\u53e3\u524d\u7f00 \/api\/alarmModel \u524d\u7aef\u5b8c\u6574\u8bf7\u6c42\u5730\u5740\u793a\u4f8b&#xff1a;http:\/\/127.0.0.1:8091\/api\/alarmModel\/list\/page<\/p>\n<\/li>\n<p>4. \u4f9d\u8d56\u6ce8\u5165<\/p>\n<p>&#064;Autowired<br \/>\nprivate AlarmModelService alarmModelService;<br \/>\nprivate AlarmModelConfigService alarmModelConfigService;<\/p>\n<p>Spring \u81ea\u52a8\u6ce8\u5165\u4e24\u4e2a\u4e1a\u52a1\u670d\u52a1&#xff0c;\u804c\u8d23\u62c6\u5206\u6e05\u6670&#xff1a;<\/p>\n<ul>\n<li>\n<p>AlarmModelService&#xff1a;\u544a\u8b66\u6a21\u578b\u672c\u8eab\u57fa\u7840 CRUD&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmModelConfigService&#xff1a;\u544a\u8b66\u6a21\u578b\u5173\u8054\u914d\u7f6e&#xff08;\u6307\u6807\u3001\u544a\u8b66\u89c4\u5219\u3001\u76d1\u63a7\u8303\u56f4&#xff09;\u590d\u6742\u4e1a\u52a1\u903b\u8f91\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e8c\u3001\u9010\u4e2a\u63a5\u53e3\u529f\u80fd\u8be6\u89e3&#xff08;REST \u89c4\u8303&#xff09;<\/p>\n<p>1. \u5206\u9875\u6a21\u7cca\u67e5\u8be2\u63a5\u53e3 GET \/api\/alarmModel\/list\/page<\/p>\n<p>\u4f5c\u7528&#xff1a;\u524d\u7aef\u544a\u8b66\u6a21\u578b\u5217\u8868\u9875\u9762\u5206\u9875\u52a0\u8f7d\u3001\u591a\u6761\u4ef6\u7b5b\u9009<\/p>\n<p>\u5165\u53c2\u8bf4\u660e&#xff08;\u524d\u7aef\u4f20\u53c2&#xff09;<\/p>\n<table>\n<tr>\n<p>\u53c2\u6570<\/p>\n<p>\u662f\u5426\u5fc5\u586b<\/p>\n<p>\u7528\u9014<\/p>\n<p>\u5904\u7406\u903b\u8f91<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>modelName<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u6a21\u578b\u540d\u79f0\u6a21\u7cca\u641c\u7d22<\/p>\n<\/td>\n<td>\n<p>\u62fc\u63a5 %\u5173\u952e\u8bcd% \u7528\u4e8e\u6570\u636e\u5e93 like \u67e5\u8be2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>modelCode<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u6a21\u578b\u7f16\u7801\u7cbe\u786e\u5339\u914d<\/p>\n<\/td>\n<td>\n<p>\u76f4\u63a5\u7b49\u503c\u67e5\u8be2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>status<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u6a21\u578b\u542f\u7528 \/ \u7981\u7528\u72b6\u6001<\/p>\n<\/td>\n<td>\n<p>\u7b49\u503c\u67e5\u8be2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>page<\/p>\n<\/td>\n<td>\n<p>\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u5f53\u524d\u9875\u7801<\/p>\n<\/td>\n<td>\n<p>\u5206\u9875\u53c2\u6570<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>row<\/p>\n<\/td>\n<td>\n<p>\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u6bcf\u9875\u6761\u6570<\/p>\n<\/td>\n<td>\n<p>\u5206\u9875\u53c2\u6570<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6838\u5fc3\u903b\u8f91<\/p>\n<li>\n<p>\u5c01\u88c5\u6240\u6709\u67e5\u8be2\u6761\u4ef6\u5230 paramMap&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7a7a\u503c\u3001\u7a7a\u767d\u5b57\u7b26\u4e32\u8fc7\u6ee4&#xff0c;\u907f\u514d\u65e0\u6548\u67e5\u8be2\u53c2\u6570&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 service \u5206\u9875\u67e5\u8be2&#xff0c;\u8fd4\u56de\u5206\u9875\u5bf9\u8c61DataPaging&lt;AlarmModel&gt;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u5305\u88c5\u4e3a\u6210\u529f JSON \u8fd4\u56de\u3002<\/p>\n<\/li>\n<p>2. \u6839\u636e ID \u5355\u6761\u67e5\u8be2 GET \/api\/alarmModel\/{id}<\/p>\n<p>\u8def\u5f84\u53c2\u6570&#xff1a;id \u544a\u8b66\u6a21\u578b\u4e3b\u952e \u903b\u8f91&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u67e5\u8be2\u5b58\u5728\u8fd4\u56de\u6a21\u578b\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u67e5\u8be2\u65e0\u6570\u636e\u8fd4\u56de\u4e1a\u52a1\u5931\u8d25\u63d0\u793a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40\u6355\u83b7\u5f02\u5e38&#xff0c;\u8fd4\u56de\u5f02\u5e38\u4fe1\u606f\u7ed9\u524d\u7aef\u3002<\/p>\n<\/li>\n<\/ul>\n<p>3. \u67e5\u8be2\u5168\u91cf\u544a\u8b66\u6a21\u578b GET \/api\/alarmModel\/all<\/p>\n<p>\u4f5c\u7528&#xff1a;\u4e0b\u62c9\u9009\u62e9\u6846\u3001\u57fa\u7840\u6570\u636e\u5b57\u5178\u52a0\u8f7d&#xff0c;\u8fd4\u56de\u65e0\u5206\u9875\u5168\u91cf\u5217\u8868&#xff0c;\u9002\u7528\u4e8e\u6570\u636e\u91cf\u4e0d\u5927\u573a\u666f\u3002<\/p>\n<p>4. \u65b0\u589e\u544a\u8b66\u6a21\u578b POST \/api\/alarmModel\/add<\/p>\n<ul>\n<li>\n<p>\u8bf7\u6c42\u4f53 &#064;RequestBody AlarmModel&#xff1a;\u524d\u7aef\u9875\u9762\u586b\u5199\u7684\u544a\u8b66\u6a21\u578b\u8868\u5355 JSON&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 service \u65b0\u589e&#xff0c;\u8fd4\u56de\u5e03\u5c14\u6807\u8bc6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65b0\u589e\u5931\u8d25 \/ \u5f02\u5e38\u7edf\u4e00\u8fd4\u56de\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<\/li>\n<\/ul>\n<p>5. \u4fee\u6539\u544a\u8b66\u6a21\u578b PUT \/api\/alarmModel\/update<\/p>\n<p>REST \u89c4\u8303 PUT \u7528\u4e8e\u5168\u91cf\u66f4\u65b0&#xff0c;\u63a5\u6536\u5b8c\u6574 AlarmModel \u5b9e\u4f53&#xff0c;\u6839\u636e\u4e3b\u952e id \u66f4\u65b0\u6570\u636e\u5e93\u8bb0\u5f55\u3002<\/p>\n<p>6. \u5220\u9664\u544a\u8b66\u6a21\u578b DELETE \/api\/alarmModel\/{id}<\/p>\n<p>\u6807\u51c6 DELETE \u5220\u9664\u63a5\u53e3&#xff0c;\u6839\u636e\u4e3b\u952e\u903b\u8f91 \/ \u7269\u7406\u5220\u9664&#xff08;\u5220\u9664\u903b\u8f91\u5728 Service \u5c42&#xff09;\u3002<\/p>\n<p>7. \u6839\u636e\u72b6\u6001\u7b5b\u9009 GET \/api\/alarmModel\/byStatus<\/p>\n<p>\u5165\u53c2 status&#xff0c;\u67e5\u8be2\u5bf9\u5e94\u542f\u7528 \/ \u505c\u7528\u72b6\u6001\u4e0b\u6240\u6709\u544a\u8b66\u6a21\u578b&#xff0c;\u7528\u4e8e\u72b6\u6001\u7b5b\u9009\u4e0b\u62c9\u3001\u8fc7\u6ee4\u5217\u8868\u3002<\/p>\n<p>8. \u6839\u636e\u76d1\u63a7\u8303\u56f4\u7b5b\u9009 GET \/api\/alarmModel\/byScope<\/p>\n<p>\u5165\u53c2&#xff1a;scopeType&#xff08;\u76d1\u63a7\u8303\u56f4\u7c7b\u578b&#xff0c;\u8bbe\u5907 \/ \u7ad9\u70b9 \/ \u6cb9\u7530&#xff09;\u3001scopeId&#xff08;\u8303\u56f4\u4e3b\u952e&#xff09;&#xff1b; \u4e1a\u52a1\u573a\u666f&#xff1a;\u6839\u636e\u9009\u4e2d\u7684\u76d1\u63a7\u5bf9\u8c61&#xff0c;\u8fc7\u6ee4\u7ed1\u5b9a\u7684\u544a\u8b66\u6a21\u578b\u3002<\/p>\n<p>9. \u6839\u636e ID \u67e5\u8be2\u5b8c\u6574\u5173\u8054\u8be6\u60c5 GET \/api\/alarmModel\/{id}\/details<\/p>\n<p>\u666e\u901agetById\u53ea\u8fd4\u56de\u544a\u8b66\u6a21\u578b\u57fa\u7840\u5b57\u6bb5&#xff1b; \u672c\u63a5\u53e3\u8fd4\u56de\u7ec4\u88c5\u540e\u7684 Map \u5b8c\u6574\u8be6\u60c5&#xff0c;\u5305\u542b&#xff1a;\u6a21\u578b\u57fa\u7840\u4fe1\u606f &#043; \u5173\u8054\u544a\u8b66\u89c4\u5219\u3001\u6307\u6807\u3001\u544a\u8b66\u7ea7\u522b\u3001\u76d1\u63a7\u8303\u56f4\u7b49\u5173\u8054\u5b50\u6570\u636e&#xff0c;\u7528\u4e8e\u8be6\u60c5\u5f39\u7a97\u9875\u9762\u3002<\/p>\n<p>10. \u4fdd\u5b58\u544a\u8b66\u6a21\u578b\u5173\u8054\u914d\u7f6e POST \/api\/alarmModel\/{id}\/config<\/p>\n<p>\u6838\u5fc3\u590d\u6742\u4e1a\u52a1\u63a5\u53e3&#xff0c;\u8c03\u7528\u4e13\u7528AlarmModelConfigService<\/p>\n<ul>\n<li>\n<p>\u8def\u5f84 id&#xff1a;\u544a\u8b66\u6a21\u578b\u4e3b\u952e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8bf7\u6c42\u4f53 configData&#xff1a;\u524d\u7aef\u9875\u9762\u914d\u7f6e\u7684\u6307\u6807\u3001\u89c4\u5219\u3001\u9608\u503c\u7b49\u914d\u7f6e JSON&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u903b\u8f91&#xff1a;\u667a\u80fd\u89e3\u6790\u914d\u7f6e&#xff0c;\u81ea\u52a8\u751f\u6210 \/ \u66f4\u65b0\u5173\u8054\u544a\u8b66\u89c4\u5219&#xff0c;\u8fc7\u6ee4\u65e0\u6548\u5197\u4f59\u89c4\u5219&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de\u6267\u884c\u7ed3\u679c &#043; \u63d0\u793a\u4fe1\u606f\u3002<\/p>\n<\/li>\n<\/ul>\n<p>11. \u83b7\u53d6\u6a21\u578b\u5df2\u4fdd\u5b58\u914d\u7f6e GET \/api\/alarmModel\/{id}\/config<\/p>\n<p>\u56de\u663e\u63a5\u53e3&#xff1a;\u7f16\u8f91\u914d\u7f6e\u9875\u9762\u52a0\u8f7d\u5386\u53f2\u4fdd\u5b58\u7684\u6307\u6807\u3001\u89c4\u5219\u3001\u9608\u503c\u914d\u7f6e&#xff0c;\u7528\u4e8e\u524d\u7aef\u8868\u5355\u56de\u586b\u3002<\/p>\n<p>12. \u914d\u7f6e\u53d8\u66f4\u68c0\u6d4b POST \/api\/alarmModel\/{id}\/config\/detectChanges<\/p>\n<p>\u589e\u91cf\u66f4\u65b0\u6838\u5fc3\u63a5\u53e3<\/p>\n<li>\n<p>\u8bfb\u53d6\u6570\u636e\u5e93\u5f53\u524d\u65e7\u914d\u7f6e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u63a5\u6536\u524d\u7aef\u63d0\u4ea4\u7684\u65b0\u914d\u7f6e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u81ea\u52a8\u5bf9\u6bd4&#xff0c;\u8bc6\u522b\u4e09\u7c7b\u53d8\u66f4&#xff1a;\u65b0\u589e\u89c4\u5219\u3001\u4fee\u6539\u539f\u6709\u89c4\u5219\u3001\u5220\u9664\u5e9f\u5f03\u89c4\u5219&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5c06\u53d8\u66f4\u660e\u7ec6\u8fd4\u56de\u524d\u7aef&#xff0c;\u53ef\u7528\u4e8e\u53d8\u66f4\u9884\u89c8\u3001\u64cd\u4f5c\u65e5\u5fd7\u8bb0\u5f55\u3002<\/p>\n<\/li>\n<p>\u4e09\u3001\u4ee3\u7801\u8bbe\u8ba1\u4eae\u70b9<\/p>\n<li>\n<p><span style=\"color:#fe2c24\">\u804c\u8d23\u5355\u4e00\u62c6\u5206 \u57fa\u7840\u6a21\u578b CRUD \u548c \u590d\u6742\u5173\u8054\u914d\u7f6e \u62c6\u5206\u4e24\u4e2a Service&#xff0c;\u89e3\u8026\u4e1a\u52a1\u903b\u8f91&#xff0c;\u4fbf\u4e8e\u7ef4\u62a4&#xff1b;<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#fe2c24\">\u6807\u51c6 RESTful \u63a5\u53e3\u89c4\u8303<\/span><\/p>\n<ul>\n<li>\n<p><span style=\"color:#fe2c24\">\u67e5\u8be2&#xff1a;GET<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#fe2c24\">\u65b0\u589e&#xff1a;POST<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#fe2c24\">\u4fee\u6539&#xff1a;PUT<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#fe2c24\">\u5220\u9664&#xff1a;DELETE <\/span>\u8bed\u4e49\u6e05\u6670&#xff0c;\u524d\u540e\u7aef\u534f\u4f5c\u7edf\u4e00&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5168\u5c40\u5f02\u5e38\u6355\u83b7 \u6bcf\u4e2a\u63a5\u53e3\u5185\u90e8try-catch&#xff0c;\u6240\u6709\u6570\u636e\u5e93\u5f02\u5e38\u3001\u4e1a\u52a1\u5f02\u5e38\u4e0d\u4f1a\u76f4\u63a5\u629b\u51fa\u5806\u6808&#xff0c;\u7edf\u4e00\u8fd4\u56de\u53cb\u597d\u63d0\u793a\u7ed9\u524d\u7aef&#xff0c;\u751f\u4ea7\u73af\u5883\u53cb\u597d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u52a8\u6001\u53c2\u6570\u9002\u914d \u67e5\u8be2\u6761\u4ef6\u4f7f\u7528Map&lt;String,Object&gt;\u5c01\u88c5&#xff0c;\u65e0\u9700\u65b0\u589e\u5b9e\u4f53\u7c7b\u63a5\u6536\u591a\u6761\u4ef6&#xff0c;\u9002\u914d\u7075\u6d3b\u7684\u524d\u7aef\u7b5b\u9009\u6761\u4ef6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5206\u5c42\u8fd4\u56de\u8bbe\u8ba1<\/p>\n<ul>\n<li>\n<p>\u7b80\u5355\u5217\u8868&#xff1a;List&lt;AlarmModel&gt;<\/p>\n<\/li>\n<li>\n<p>\u5206\u9875\u5217\u8868&#xff1a;DataPaging&lt;AlarmModel&gt;<\/p>\n<\/li>\n<li>\n<p>\u591a\u8868\u5173\u8054\u590d\u6742\u8be6\u60c5&#xff1a;Map&lt;String,Object&gt; \u6839\u636e\u6570\u636e\u590d\u6742\u5ea6\u9009\u62e9\u5408\u9002\u8fd4\u56de\u8f7d\u4f53&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u63a5\u53e3\u7c92\u5ea6\u5212\u5206\u5408\u7406 \u533a\u5206\u57fa\u7840\u5355\u8868\u64cd\u4f5c\u3001\u5173\u8054\u8be6\u60c5\u3001\u914d\u7f6e\u4fdd\u5b58\u3001\u53d8\u66f4\u68c0\u6d4b&#xff0c;\u5355\u4e2a\u63a5\u53e3\u53ea\u505a\u4e00\u4ef6\u4e8b&#xff0c;\u524d\u7aef\u53ef\u6309\u9700\u8c03\u7528&#xff0c;\u907f\u514d\u63a5\u53e3\u6570\u636e\u5197\u4f59\u3002<\/p>\n<\/li>\n<p>\u56db\u3001\u5bf9\u5e94\u524d\u540e\u7aef\u4e1a\u52a1\u8054\u52a8\u5173\u7cfb<\/p>\n<p>\u524d\u7aef\u9875\u9762&#xff08;\u4e4b\u524d Vue \u8def\u7531&#xff09;<\/p>\n<p>\/znyw\/alertModel \u544a\u8b66\u6a21\u578b\u7ba1\u7406\u9875\u9762<\/p>\n<li>\n<p>\u5217\u8868\u5206\u9875&#xff1a;\u8c03\u7528 \/list\/page<\/p>\n<\/li>\n<li>\n<p>\u65b0\u589e\u5f39\u7a97&#xff1a;\u8c03\u7528 \/add<\/p>\n<\/li>\n<li>\n<p>\u7f16\u8f91\u5f39\u7a97\u56de\u663e\u57fa\u7840\u4fe1\u606f&#xff1a;\u8c03\u7528 \/{id}<\/p>\n<\/li>\n<li>\n<p>\u7f16\u8f91\u5f39\u7a97\u56de\u663e\u6307\u6807 \/ \u89c4\u5219\u914d\u7f6e&#xff1a;\u8c03\u7528 \/{id}\/config<\/p>\n<\/li>\n<li>\n<p>\u4fdd\u5b58\u914d\u7f6e\u4fee\u6539&#xff1a;\u8c03\u7528 \/{id}\/config POST<\/p>\n<\/li>\n<li>\n<p>\u5220\u9664\u6309\u94ae&#xff1a;\u8c03\u7528 DELETE \/{id}<\/p>\n<\/li>\n<li>\n<p>\u8be6\u60c5\u5f39\u7a97&#xff08;\u5b8c\u6574\u5173\u8054\u6570\u636e&#xff09;&#xff1a;\/{id}\/details<\/p>\n<\/li>\n<li>\n<p>\u914d\u7f6e\u4fee\u6539\u524d\u9884\u89c8\u53d8\u66f4&#xff1a;\/config\/detectChanges<\/p>\n<\/li>\n<p>\u540e\u7aef\u914d\u5957\u7ec4\u4ef6<\/p>\n<li>\n<p>\u6570\u636e\u5e93&#xff1a;\u8fbe\u68a6\u6570\u636e\u5e93 ZNYW \u5e93 alarm_model \u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6301\u4e45\u5c42&#xff1a;MyBatis&#xff0c;\u5206\u9875\u5de5\u5177DataPaging&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9a\u65f6\u4efb\u52a1&#xff1a;\u544a\u8b66\u6a21\u578b\u7ed1\u5b9a\u7684\u544a\u8b66\u4efb\u52a1&#xff0c;\u5bf9\u5e94\u540e\u7aef&#064;EnableScheduling\u5b9a\u65f6\u4efb\u52a1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8ba1\u7b97\u5f15\u64ce&#xff1a;\u544a\u8b66\u6a21\u578b\u5173\u8054\u6307\u6807&#xff0c;\u5bf9\u63a5 calculation \u6307\u6807\u8ba1\u7b97\u6a21\u5757&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5de5\u5355\u6a21\u5757&#xff1a;\u544a\u8b66\u89e6\u53d1\u540e\u81ea\u52a8\u751f\u6210\u5de1\u68c0\u5de5\u5355&#xff0c;\u5bf9\u63a5\u7b2c\u4e09\u65b9\u5de5\u5355\u63a5\u53e3\u3002<\/p>\n<\/li>\n<p>\u4e94\u3001\u53ef\u4f18\u5316\u70b9<\/p>\n<li>\n<p>\u91cd\u590d try-catch \u6a21\u677f\u4ee3\u7801\u8fc7\u591a&#xff0c;\u53ef\u4f7f\u7528\u5168\u5c40\u7edf\u4e00\u5f02\u5e38\u5904\u7406\u5668 &#064;ControllerAdvice&#xff0c;\u5220\u9664\u6bcf\u4e2a\u63a5\u53e3\u5185\u90e8\u91cd\u590d\u6355\u83b7\u4ee3\u7801&#xff0c;\u7b80\u5316\u63a7\u5236\u5668&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u63a5\u53e3\u5165\u53c2\u5927\u91cf&#064;RequestParam\u96f6\u6563\u53c2\u6570&#xff0c;\u590d\u6742\u5206\u9875\u67e5\u8be2\u53ef\u5c01\u88c5 DTO \u63a5\u6536\u53c2\u6570&#xff0c;\u4ee3\u7801\u53ef\u8bfb\u6027\u66f4\u9ad8&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9b54\u6cd5\u5b57\u7b26\u4e32\u786c\u7f16\u7801&#xff08;\u5982\u72b6\u6001\u3001scopeType&#xff09;&#xff0c;\u5efa\u8bae\u5b9a\u4e49\u5e38\u91cf\u7c7b\u7edf\u4e00\u7ba1\u7406&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de\u503cMap&lt;String,Object&gt;\u52a8\u6001\u7ed3\u6784\u65e0\u7ea6\u675f&#xff0c;\u590d\u6742\u8be6\u60c5\u5efa\u8bae\u521b\u5efa\u4e13\u7528 VO \u89c6\u56fe\u5b9e\u4f53\u66ff\u4ee3 Map&#xff0c;\u5f3a\u7c7b\u578b\u6821\u9a8c&#xff0c;\u51cf\u5c11\u524d\u540e\u7aef\u5b57\u6bb5\u6c9f\u901a\u9519\u8bef&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7f3a\u5c11\u63a5\u53e3\u6743\u9650\u6821\u9a8c\u6ce8\u89e3&#xff0c;\u53ef\u7ed3\u5408\u9879\u76ee\u6743\u9650\u6846\u67b6\u6dfb\u52a0&#064;PreAuthorize\u63a7\u5236\u589e\u5220\u6539\u67e5\u6309\u94ae\u6743\u9650\u3002<\/p>\n<\/li>\n<h4>AlarmModelService.java<\/h4>\n<p>\u8fd9\u4efd\u662f \u544a\u8b66\u6a21\u578b\u4e1a\u52a1\u5c42\u6807\u51c6\u63a5\u53e3&#xff0c;\u9075\u5faa SpringBoot \u5206\u5c42\u5f00\u53d1\u89c4\u8303&#xff08;Controller \u2192 Service \u63a5\u53e3 \u2192 ServiceImpl \u5b9e\u73b0\u7c7b \u2192 Mapper&#xff09;&#xff0c;\u5b9a\u4e49\u4e86\u544a\u8b66\u6a21\u578b\u6240\u6709\u4e1a\u52a1\u80fd\u529b\u5951\u7ea6&#xff0c;Controller \u53ea\u4f9d\u8d56\u8be5\u63a5\u53e3&#xff0c;\u4e0d\u76f4\u63a5\u8026\u5408\u5b9e\u73b0\u5c42&#xff0c;\u505a\u5230\u9762\u5411\u63a5\u53e3\u7f16\u7a0b\u3001\u89e3\u8026\u3001\u6613\u6269\u5c55\u3001\u5355\u5143\u6d4b\u8bd5\u53cb\u597d\u3002<\/p>\n<p>\u4e00\u3001\u57fa\u7840\u4fe1\u606f<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.sinopec.bussiness.znyw.service;<\/p>\n<p>\u548c\u524d\u9762 Controller\u3001\u5b9e\u4f53\u7c7b\u5305\u5c42\u7ea7\u7edf\u4e00&#xff1a; znyw \u667a\u80fd\u8fd0\u7ef4\u6a21\u5757\u4e0b\u7684 service \u4e1a\u52a1\u5c42\u3002<\/p>\n<p>2. \u5bfc\u5165\u7c7b\u8bf4\u660e<\/p>\n<li>\n<p>DataPaging&#xff1a;\u9879\u76ee\u901a\u7528\u5206\u9875\u8fd4\u56de\u8f7d\u4f53&#xff0c;\u5206\u9875\u67e5\u8be2\u7edf\u4e00\u8fd4\u56de\u8be5\u5bf9\u8c61&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmModel&#xff1a;\u6570\u636e\u5e93\u8868\u6620\u5c04\u5b9e\u4f53\u7c7b&#xff0c;\u5355\u8868\u57fa\u7840\u64cd\u4f5c\u7684\u5165\u53c2 \/ \u8fd4\u56de\u8f7d\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u96c6\u5408\u5bb9\u5668&#xff1a;List\u3001Map&#xff0c;\u9002\u914d\u5168\u91cf\u5217\u8868\u3001\u591a\u8868\u5173\u8054\u590d\u6742\u8be6\u60c5\u6570\u636e\u3002<\/p>\n<\/li>\n<p>3. \u63a5\u53e3\u5b9a\u4f4d<\/p>\n<ul>\n<li>\n<p>\u4f5c\u7528&#xff1a;\u5b9a\u4e49\u4e1a\u52a1\u80fd\u529b\u89c4\u8303&#xff0c;\u53ea\u58f0\u660e\u65b9\u6cd5\u7b7e\u540d\u3001\u5165\u53c2\u3001\u8fd4\u56de\u503c\u3001\u4e1a\u52a1\u6ce8\u91ca&#xff0c;\u4e0d\u5199\u4efb\u4f55\u4e1a\u52a1\u903b\u8f91&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u73b0&#xff1a;\u4f1a\u5b58\u5728\u4e00\u4e2a AlarmModelServiceImpl \u7c7b implements AlarmModelService&#xff0c;\u6240\u6709 SQL \u67e5\u8be2\u3001\u4e8b\u52a1\u3001\u590d\u6742\u4e1a\u52a1\u903b\u8f91\u5199\u5728\u5b9e\u73b0\u7c7b&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u89e3\u8026\u4f18\u52bf&#xff1a;Controller \u6ce8\u5165 private AlarmModelService alarmModelService;&#xff0c;\u53ea\u4f9d\u8d56\u63a5\u53e3&#xff0c;\u540e\u7eed\u66f4\u6362\u5b58\u50a8&#xff08;\u8fbe\u68a6\u2192\u5176\u4ed6\u6570\u636e\u5e93&#xff09;\u3001\u91cd\u6784\u903b\u8f91&#xff0c;\u53ea\u9700\u4fee\u6539\u5b9e\u73b0\u7c7b&#xff0c;\u4e0a\u5c42 Controller \u5b8c\u5168\u4e0d\u7528\u6539\u52a8\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e8c\u3001\u6240\u6709\u65b9\u6cd5\u9010\u4e00\u5206\u7ec4\u8bb2\u89e3<\/p>\n<p>\u5206\u7ec4 1&#xff1a;\u5206\u9875 \/ \u591a\u6761\u4ef6\u5217\u8868\u67e5\u8be2&#xff08;\u5bf9\u5e94\u524d\u7aef\u5217\u8868\u9875\u9762&#xff09;<\/p>\n<p>DataPaging&lt;AlarmModel&gt; selectPagingAlarmModelList(Map&lt;String, Object&gt; paramMap, int page, int row);<\/p>\n<li>\n<p>\u5165\u53c2<\/p>\n<ul>\n<li>\n<p>paramMap&#xff1a;\u52a8\u6001\u67e5\u8be2\u6761\u4ef6&#xff08;\u6a21\u578b\u540d\u79f0\u6a21\u7cca\u3001\u7f16\u7801\u3001\u72b6\u6001&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>page&#xff1a;\u5f53\u524d\u9875\u7801&#xff1b;row&#xff1a;\u6bcf\u9875\u6761\u6570&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8fd4\u56de&#xff1a;\u5206\u9875\u5c01\u88c5\u5bf9\u8c61 DataPaging&lt;AlarmModel&gt;&#xff0c;\u5305\u542b\u603b\u6761\u6570\u3001\u5f53\u524d\u9875\u6570\u636e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5e94\u63a5\u53e3&#xff1a;GET \/api\/alarmModel\/list\/page \u5206\u9875\u5217\u8868\u3002<\/p>\n<\/li>\n<p>\u5206\u7ec4 2&#xff1a;\u5355 ID \u57fa\u7840 CRUD&#xff08;\u589e\u5220\u6539\u67e5\u57fa\u7840\u80fd\u529b&#xff09;<\/p>\n<p>\/\/ \u6839\u636e\u4e3b\u952e\u67e5\u8be2\u5355\u6761\u57fa\u7840\u4fe1\u606f<br \/>\nAlarmModel getById(String id);<br \/>\n\/\/ \u65b0\u589e\u544a\u8b66\u6a21\u578b<br \/>\nboolean add(AlarmModel alarmModel);<br \/>\n\/\/ \u66f4\u65b0\u544a\u8b66\u6a21\u578b<br \/>\nboolean update(AlarmModel alarmModel);<br \/>\n\/\/ \u6839\u636eID\u5220\u9664<br \/>\nboolean deleteById(String id);<br \/>\n\/\/ \u5224\u65adID\u662f\u5426\u5b58\u5728<br \/>\nboolean existsById(String id);<\/p>\n<li>\n<p>\u8fd4\u56de\u503c boolean&#xff1a;\u6807\u8bc6\u6570\u636e\u5e93\u64cd\u4f5c\u662f\u5426\u6210\u529f&#xff08;\u63d2\u5165 \/ \u66f4\u65b0 \/ \u5220\u9664\u5f71\u54cd\u884c\u6570 &gt; 0 \u5219 true&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>existsById&#xff1a;\u4e1a\u52a1\u6821\u9a8c\u4e13\u7528&#xff0c;\u5220\u9664 \/ \u7f16\u8f91\u524d\u6821\u9a8c\u6a21\u578b\u662f\u5426\u5b58\u5728&#xff0c;\u907f\u514d\u65e0\u6548\u64cd\u4f5c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5e94\u524d\u7aef\u63a5\u53e3&#xff1a;\u5355\u6761\u67e5\u8be2\u3001\u65b0\u589e\u3001\u4fee\u6539\u3001\u5220\u9664\u3002<\/p>\n<\/li>\n<p>\u5206\u7ec4 3&#xff1a;\u591a\u6761\u4ef6\u7b5b\u9009\u67e5\u8be2&#xff08;\u4e0b\u62c9\u3001\u8fc7\u6ee4\u573a\u666f&#xff09;<\/p>\n<p>\/\/ \u6839\u636e\u6a21\u578b\u7f16\u7801\u7cbe\u786e\u67e5\u8be2&#xff08;\u7f16\u7801\u552f\u4e00&#xff0c;\u7528\u4e8e\u91cd\u590d\u6821\u9a8c&#xff09;<br \/>\nAlarmModel getByModelCode(String modelCode);<br \/>\n\/\/ \u6839\u636e\u72b6\u6001\u7b5b\u9009&#xff08;\u542f\u7528\/\u505c\u7528&#xff09;<br \/>\nList&lt;AlarmModel&gt; getByStatus(String status);<br \/>\n\/\/ \u6839\u636e\u76d1\u63a7\u8303\u56f4\u7b5b\u9009&#xff08;\u8303\u56f4\u7c7b\u578b&#043;\u8303\u56f4ID&#xff0c;\u7ed1\u5b9a\u76d1\u63a7\u5bf9\u8c61&#xff09;<br \/>\nList&lt;AlarmModel&gt; getByScope(String scopeType, String scopeId);<\/p>\n<p>\u4e1a\u52a1\u573a\u666f&#xff1a;<\/p>\n<li>\n<p>getByModelCode&#xff1a;\u65b0\u589e\u6a21\u578b\u65f6\u6821\u9a8c\u7f16\u7801\u91cd\u590d&#xff0c;\u4fdd\u8bc1 modelCode \u552f\u4e00&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getByStatus&#xff1a;\u524d\u7aef\u4e0b\u62c9\u9009\u62e9\u542f\u7528 \/ \u505c\u7528\u6a21\u578b&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getByScope&#xff1a;\u9009\u4e2d\u76d1\u63a7\u8bbe\u5907 \/ \u7ad9\u70b9&#xff0c;\u67e5\u8be2\u7ed1\u5b9a\u7684\u544a\u8b66\u6a21\u578b\u3002<\/p>\n<\/li>\n<p>\u5206\u7ec4 4&#xff1a;\u5173\u8054\u590d\u6742\u6570\u636e\u67e5\u8be2&#xff08;\u8be6\u60c5\u5f39\u7a97&#xff0c;\u591a\u8868\u8054\u67e5&#xff09;<\/p>\n<p>Map&lt;String, Object&gt; getByIdWithDetails(String id);<\/p>\n<li>\n<p>\u533a\u522b\u4e8e getById&#xff1a;getById \u53ea\u8fd4\u56de\u5355\u8868\u57fa\u7840\u5b57\u6bb5&#xff1b;\u8be5\u65b9\u6cd5\u591a\u8868\u5173\u8054\u67e5\u8be2&#xff0c;\u7ec4\u88c5\u544a\u8b66\u6a21\u578b &#043; \u5173\u8054\u6307\u6807\u3001\u544a\u8b66\u89c4\u5219\u3001\u544a\u8b66\u7ea7\u522b\u3001\u76d1\u63a7\u5bf9\u8c61\u7b49\u5b50\u6570\u636e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de Map&#xff1a;\u52a8\u6001\u7ed3\u6784&#xff0c;\u9002\u914d\u591a\u8868\u7ec4\u5408\u7684\u590d\u6742\u8be6\u60c5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5e94\u63a5\u53e3&#xff1a;GET \/api\/alarmModel\/{id}\/details \u8be6\u60c5\u9875\u9762\u3002<\/p>\n<\/li>\n<p>\u5206\u7ec4 5&#xff1a;\u4e1a\u52a1\u5173\u8054\u6821\u9a8c\u65b9\u6cd5&#xff08;\u4e0a\u5c42\u4e1a\u52a1\u903b\u8f91\u5224\u65ad&#xff09;<\/p>\n<p>\/\/ \u5224\u65ad\u6a21\u578b\u662f\u5426\u7ed1\u5b9a\u6307\u5b9a\u76d1\u63a7\u5bf9\u8c61<br \/>\nboolean isAssociatedWithObject(String modelId, String objectId);<\/p>\n<p>\u4e1a\u52a1\u7528\u9014&#xff1a;<\/p>\n<li>\n<p>\u5220\u9664\u76d1\u63a7\u5bf9\u8c61\u524d\u6821\u9a8c&#xff1a;\u5982\u679c\u5b58\u5728\u7ed1\u5b9a\u7684\u544a\u8b66\u6a21\u578b&#xff0c;\u7981\u6b62\u5220\u9664&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u89e3\u7ed1 \/ \u7ed1\u5b9a\u64cd\u4f5c\u524d\u7f6e\u6821\u9a8c&#xff0c;\u7528\u4e8e\u4e1a\u52a1\u62e6\u622a\u3001\u5f39\u7a97\u63d0\u793a\u3002<\/p>\n<\/li>\n<p>\u4e09\u3001\u63a5\u53e3\u8bbe\u8ba1\u89c4\u8303\u4eae\u70b9<\/p>\n<li>\n<p>\u5206\u5c42\u804c\u8d23\u6e05\u6670<\/p>\n<ul>\n<li>\n<p>Controller&#xff1a;\u53ea\u505a\u8bf7\u6c42\u63a5\u6536\u3001\u53c2\u6570\u5c01\u88c5\u3001\u7edf\u4e00\u8fd4\u56de\u3001\u5f02\u5e38\u6355\u83b7&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Service \u63a5\u53e3&#xff1a;\u7edf\u4e00\u5b9a\u4e49\u4e1a\u52a1\u80fd\u529b\u6807\u51c6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>ServiceImpl&#xff1a;\u5b9e\u73b0 SQL\u3001\u4e8b\u52a1\u3001\u590d\u6742\u4e1a\u52a1\u903b\u8f91&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Mapper&#xff1a;\u4ec5\u8d1f\u8d23\u6570\u636e\u5e93 CRUD&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u9762\u5411\u63a5\u53e3\u7f16\u7a0b \u4f9d\u8d56\u5012\u7f6e&#xff0c;\u4e0a\u5c42 Controller \u53ea\u4f9d\u8d56\u62bd\u8c61\u63a5\u53e3&#xff0c;\u4e0d\u8026\u5408\u5177\u4f53\u5b9e\u73b0&#xff0c;\u65b9\u4fbf&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5355\u5143\u6d4b\u8bd5&#xff1a;Mock \u63a5\u53e3&#xff0c;\u65e0\u9700\u771f\u5b9e\u6570\u636e\u5e93&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u91cd\u6784&#xff1a;\u66ff\u6362\u5b9e\u73b0\u7c7b\u4e0d\u6539\u52a8 Controller&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u65b9\u6cd5\u7c92\u5ea6\u62c6\u5206\u5408\u7406<\/p>\n<ul>\n<li>\n<p>\u57fa\u7840\u5355\u8868\u64cd\u4f5c\u72ec\u7acb\u65b9\u6cd5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7b5b\u9009\u3001\u5206\u9875\u3001\u8be6\u60c5\u3001\u4e1a\u52a1\u6821\u9a8c\u5b8c\u5168\u62c6\u5206&#xff1b; \u4e00\u4e2a\u65b9\u6cd5\u53ea\u505a\u5355\u4e00\u4e1a\u52a1&#xff0c;\u590d\u7528\u6027\u5f3a&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5b8c\u5584\u7684\u4e1a\u52a1\u6821\u9a8c\u65b9\u6cd5 \u63d0\u4f9b existsById\u3001isAssociatedWithObject \u524d\u7f6e\u6821\u9a8c\u65b9\u6cd5&#xff0c;\u628a\u4e1a\u52a1\u5224\u65ad\u80fd\u529b\u4e0b\u6c89\u5230 Service \u5c42&#xff0c;Controller \u65e0\u9700\u5199\u91cd\u590d\u5224\u65ad\u903b\u8f91&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6ce8\u91ca\u89c4\u8303\u7edf\u4e00 \u6bcf\u4e2a\u65b9\u6cd5\u90fd\u5177\u5907\u5b8c\u6574 JavaDoc \u6ce8\u91ca&#xff1a;\u529f\u80fd\u8bf4\u660e\u3001\u5165\u53c2\u542b\u4e49\u3001\u8fd4\u56de\u503c\u542b\u4e49&#xff0c;\u4fbf\u4e8e\u56e2\u961f\u534f\u4f5c\u3001\u4ee3\u7801\u9605\u8bfb\u3002<\/p>\n<\/li>\n<p>\u56db\u3001\u63a5\u53e3\u4e0e\u4e0a\u5c42 Controller \u5bf9\u5e94\u5173\u7cfb<\/p>\n<table>\n<tr>\n<p>Service \u65b9\u6cd5<\/p>\n<p>\u5bf9\u5e94\u540e\u7aef\u63a5\u53e3\u5730\u5740<\/p>\n<p>\u524d\u7aef\u9875\u9762\u7528\u9014<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>selectPagingAlarmModelList<\/p>\n<\/td>\n<td>\n<p>\/list\/page<\/p>\n<\/td>\n<td>\n<p>\u544a\u8b66\u6a21\u578b\u5217\u8868\u5206\u9875\u52a0\u8f7d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getById<\/p>\n<\/td>\n<td>\n<p>\/{id}<\/p>\n<\/td>\n<td>\n<p>\u7f16\u8f91\u5f39\u7a97\u56de\u663e\u57fa\u7840\u4fe1\u606f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>add<\/p>\n<\/td>\n<td>\n<p>\/add<\/p>\n<\/td>\n<td>\n<p>\u65b0\u589e\u544a\u8b66\u6a21\u578b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>update<\/p>\n<\/td>\n<td>\n<p>\/update<\/p>\n<\/td>\n<td>\n<p>\u4fee\u6539\u544a\u8b66\u6a21\u578b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>deleteById<\/p>\n<\/td>\n<td>\n<p>DELETE \/{id}<\/p>\n<\/td>\n<td>\n<p>\u5220\u9664\u6a21\u578b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getAll<\/p>\n<\/td>\n<td>\n<p>\/all<\/p>\n<\/td>\n<td>\n<p>\u4e0b\u62c9\u6846\u52a0\u8f7d\u5168\u90e8\u6a21\u578b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByStatus<\/p>\n<\/td>\n<td>\n<p>\/byStatus<\/p>\n<\/td>\n<td>\n<p>\u6309\u72b6\u6001\u7b5b\u9009\u5217\u8868<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByScope<\/p>\n<\/td>\n<td>\n<p>\/byScope<\/p>\n<\/td>\n<td>\n<p>\u6839\u636e\u76d1\u63a7\u5bf9\u8c61\u7b5b\u9009\u6a21\u578b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByIdWithDetails<\/p>\n<\/td>\n<td>\n<p>\/{id}\/details<\/p>\n<\/td>\n<td>\n<p>\u8be6\u60c5\u5f39\u7a97\u5c55\u793a\u5168\u91cf\u5173\u8054\u6570\u636e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>existsById \/ isAssociatedWithObject<\/p>\n<\/td>\n<td>\n<p>\u5185\u90e8\u4e1a\u52a1\u8c03\u7528<\/p>\n<\/td>\n<td>\n<p>\u65b0\u589e \/ \u5220\u9664\u524d\u7f6e\u6821\u9a8c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByModelCode<\/p>\n<\/td>\n<td>\n<p>\u5185\u90e8\u4e1a\u52a1\u8c03\u7528<\/p>\n<\/td>\n<td>\n<p>\u65b0\u589e\u65f6\u6821\u9a8c\u7f16\u7801\u552f\u4e00\u6027<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e94\u3001\u8865\u5145\u914d\u5957\u8bf4\u660e<\/p>\n<li>\n<p>\u8be5\u63a5\u53e3\u53ea\u5904\u7406\u544a\u8b66\u6a21\u578b\u4e3b\u8868\u76f8\u5173\u4e1a\u52a1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u544a\u8b66\u6a21\u578b\u5173\u8054\u914d\u7f6e&#xff08;\u89c4\u5219\u3001\u6307\u6807\u4fdd\u5b58\u3001\u53d8\u66f4\u68c0\u6d4b&#xff09;\u4e0d\u5728\u6b64\u63a5\u53e3&#xff0c;\u62c6\u5206\u5230\u72ec\u7acb AlarmModelConfigService&#xff0c;\u804c\u8d23\u62c6\u5206\u66f4\u7ec6&#xff0c;\u907f\u514d\u5355\u4e2a Service \u63a5\u53e3\u8fc7\u4e8e\u81c3\u80bf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u73b0\u7c7b AlarmModelServiceImpl \u4f1a\u6ce8\u5165 AlarmModelMapper&#xff0c;\u8c03\u7528 MyBatis \u7684\u6570\u636e\u5e93\u64cd\u4f5c&#xff0c;\u5b9e\u73b0\u5f53\u524d\u63a5\u53e3\u6240\u6709\u65b9\u6cd5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e8b\u52a1\u63a7\u5236&#xff1a;\u5728\u5b9e\u73b0\u7c7b\u65b9\u6cd5\u4e0a\u52a0 &#064;Transactional&#xff0c;\u5904\u7406\u65b0\u589e\u3001\u4fee\u6539\u3001\u5220\u9664\u65f6\u7684\u6570\u636e\u5e93\u4e8b\u52a1\u56de\u6eda\u3002<\/p>\n<\/li>\n<p>\u516d\u3001\u4f18\u5316\u5efa\u8bae<\/p>\n<li>\n<p>\u8fd4\u56de\u503c Map&lt;String, Object&gt; \u65e0\u7c7b\u578b\u7ea6\u675f&#xff0c;\u590d\u6742\u8be6\u60c5\u5efa\u8bae\u65b0\u5efa AlarmModelDetailVO \u89c6\u56fe\u5b9e\u4f53\u7c7b\u66ff\u6362 Map&#xff0c;\u5f3a\u7c7b\u578b\u3001\u51cf\u5c11\u524d\u540e\u7aef\u5b57\u6bb5\u6c9f\u901a\u9519\u8bef&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u53ef\u65b0\u589e\u6279\u91cf\u64cd\u4f5c\u63a5\u53e3&#xff08;\u6279\u91cf\u65b0\u589e\u3001\u6279\u91cf\u5220\u9664&#xff09;&#xff0c;\u9002\u914d\u524d\u7aef\u6279\u91cf\u64cd\u4f5c\u573a\u666f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6240\u6709\u5165\u53c2\u5b57\u7b26\u4e32&#xff08;id\u3001modelCode\u3001status&#xff09;\u53ef\u7edf\u4e00\u5c01\u88c5 DTO&#xff0c;\u51cf\u5c11\u5927\u91cf\u96f6\u6563\u5165\u53c2&#xff0c;\u63d0\u5347\u53ef\u8bfb\u6027&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5e38\u91cf\u62bd\u79bb&#xff1a;\u72b6\u6001\u3001scopeType \u9b54\u6cd5\u5b57\u7b26\u4e32&#xff0c;\u5b9a\u4e49\u5e38\u91cf\u7c7b&#xff0c;\u907f\u514d\u786c\u7f16\u7801\u3002<\/p>\n<\/li>\n<h4>AlarmModelServiceImpl.java<\/h4>\n<p>\u8fd9\u662fAlarmModelService \u63a5\u53e3\u7684\u5b8c\u6574\u4e1a\u52a1\u5b9e\u73b0\u5c42&#xff0c;\u9075\u5faa\u6807\u51c6\u4e09\u5c42\u67b6\u6784&#xff1a;Controller \u2192 Service\u63a5\u53e3 \u2192 ServiceImpl\u5b9e\u73b0\u7c7b \u2192 Mapper\u6301\u4e45\u5c42&#xff0c;\u627f\u8f7d\u6240\u6709\u544a\u8b66\u6a21\u578b\u7684\u6570\u636e\u6821\u9a8c\u3001\u53c2\u6570\u5904\u7406\u3001\u6570\u636e\u5e93\u4ea4\u4e92\u3001\u6811\u5f62\u89c4\u5219\u7ec4\u88c5\u3001\u590d\u6742\u4e1a\u52a1\u8ba1\u7b97&#xff0c;\u662f\u6574\u4e2a\u4e1a\u52a1\u7684\u6838\u5fc3\u903b\u8f91\u8f7d\u4f53\u3002<\/p>\n<p>\u4e00\u3001\u57fa\u7840\u5934\u90e8\u4e0e\u7c7b\u5b9a\u4e49<\/p>\n<p>1. \u5305\u7ed3\u6784<\/p>\n<p>package cn.com.sinopec.bussiness.znyw.serviceImpl;<\/p>\n<p>\u89c4\u8303\u5206\u5c42&#xff1a;serviceImpl \u4e13\u95e8\u5b58\u653e Service \u63a5\u53e3\u5b9e\u73b0\u7c7b&#xff0c;\u4e0e\u4e0a\u5c42service\u63a5\u53e3\u5305\u5b8c\u5168\u9694\u79bb&#xff0c;\u5206\u5c42\u6e05\u6670\u3002<\/p>\n<p>2. \u5bfc\u5165\u4f9d\u8d56\u8bf4\u660e<\/p>\n<li>\n<p>\u5206\u9875\u5de5\u5177&#xff1a;DataPaging \u9879\u76ee\u7edf\u4e00\u5206\u9875\u5c01\u88c5\u5bf9\u8c61&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u4f53\u7c7b&#xff1a;<\/p>\n<ul>\n<li>\n<p>AlarmModel&#xff1a;\u544a\u8b66\u6a21\u578b\u4e3b\u8868\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmRuleTreeUnified&#xff1a;\u544a\u8b66\u89c4\u5219\u6811\u5f62\u8282\u70b9\u5b9e\u4f53&#xff08;\u89c4\u5219\u6811\u5b58\u50a8&#xff09;&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Mapper \u6301\u4e45\u5c42&#xff1a;<\/p>\n<ul>\n<li>\n<p>AlarmModelMapper&#xff1a;\u544a\u8b66\u6a21\u578b\u4e3b\u8868 CRUD&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmRuleTreeUnifiedMapper&#xff1a;\u89c4\u5219\u6811\u5f62\u8282\u70b9\u67e5\u8be2&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u65e5\u5fd7\u5de5\u5177&#xff1a;Logger\u3001LoggerFactory&#xff0c;\u4e1a\u52a1\u5173\u952e\u6b65\u9aa4\u3001\u5f02\u5e38\u6253\u5370\u65e5\u5fd7&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Spring \u6838\u5fc3\u6ce8\u89e3&#xff1a;&#064;Service\u3001&#064;Autowired&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u96c6\u5408\u4e0e\u6d41\u5f0f\u5904\u7406&#xff1a;List\/Map\/Stack\/Comparator\/Stream&#xff0c;\u7528\u4e8e\u6811\u5f62\u904d\u5386\u3001\u6570\u636e\u7ec4\u88c5\u3001\u96c6\u5408\u8fc7\u6ee4\u3002<\/p>\n<\/li>\n<p>3. \u7c7b\u6ce8\u89e3\u4e0e\u57fa\u7840\u6210\u5458<\/p>\n<p>&#064;Service<br \/>\npublic class AlarmModelServiceImpl implements AlarmModelService {<br \/>\n    private static final Logger logger &#061; LoggerFactory.getLogger(AlarmModelServiceImpl.class);<br \/>\n    &#064;Autowired<br \/>\n    private AlarmModelMapper alarmModelMapper;<br \/>\n    &#064;Autowired<br \/>\n    private AlarmRuleTreeUnifiedMapper alarmRuleTreeUnifiedMapper;<br \/>\n}<\/p>\n<li>\n<p>&#064;Service&#xff1a;Spring \u5c06\u8be5\u7c7b\u6ce8\u518c\u4e3a\u4e1a\u52a1\u5c42 Bean&#xff0c;Controller \u53ef\u81ea\u52a8\u6ce8\u5165\u4e0a\u5c42\u63a5\u53e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9759\u6001 Logger&#xff1a;\u7edf\u4e00\u65e5\u5fd7\u8f93\u51fa&#xff0c;\u533a\u5206\u4e1a\u52a1\u65e5\u5fd7\u4e0e\u5f02\u5e38\u5806\u6808&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Mapper \u81ea\u52a8\u6ce8\u5165&#xff1a;\u76f4\u63a5\u64cd\u4f5c\u8fbe\u68a6\u6570\u636e\u5e93\u4e24\u5f20\u6838\u5fc3\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u73b0AlarmModelService\u63a5\u53e3&#xff1a;\u5f3a\u5236\u5b9e\u73b0\u63a5\u53e3\u4e2d\u5b9a\u4e49\u7684\u5168\u90e8\u4e1a\u52a1\u65b9\u6cd5&#xff0c;\u7ea6\u675f\u4e0a\u5c42\u5951\u7ea6\u3002<\/p>\n<\/li>\n<p>\u4e8c\u3001\u5206\u9875\u67e5\u8be2\u65b9\u6cd5 selectPagingAlarmModelList<\/p>\n<p>\u6838\u5fc3\u4f5c\u7528<\/p>\n<p>\u524d\u7aef\u544a\u8b66\u6a21\u578b\u5217\u8868\u5206\u9875\u3001\u591a\u6761\u4ef6\u6a21\u7cca \/ \u7cbe\u786e\u7b5b\u9009\u3002<\/p>\n<p>\u5206\u6b65\u903b\u8f91\u62c6\u89e3<\/p>\n<li>\n<p>\u63d0\u53d6\u5e76\u6e05\u6d17\u67e5\u8be2\u53c2\u6570 \u4eceparamMap\u53d6\u51famodelName\/modelCode\/status&#xff0c;\u7a7a\u5b57\u7b26\u4e32\u8f6c\u4e3anull&#xff0c;\u907f\u514d MyBatis \u6267\u884c\u65e0\u6548like &#039;&#039;\u67e5\u8be2\u3002<\/p>\n<\/li>\n<li>\n<p>\u5206\u9875\u53c2\u6570\u5bb9\u9519\u5904\u7406 \u524d\u7aef\u4f20\u5165\u9875\u7801page&lt;&#061;0\u5f3a\u5236\u91cd\u7f6e\u4e3a 1&#xff1b;\u6bcf\u9875\u6761\u6570row&lt;&#061;0\u9ed8\u8ba4 10 \u6761&#xff0c;\u9632\u6b62\u5206\u9875\u53c2\u6570\u975e\u6cd5\u5bfc\u81f4 SQL \u62a5\u9519\u3002 \u8ba1\u7b97\u504f\u79fb\u91cf offset &#061; (page-1)*row&#xff0c;\u9002\u914d\u6570\u636e\u5e93limit offset,row\u8bed\u6cd5\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e24\u6b21 Mapper \u6570\u636e\u5e93\u67e5\u8be2<\/p>\n<ul>\n<li>\n<p>manualSelectAlarmModel&#xff1a;\u5206\u9875\u67e5\u8be2\u5f53\u524d\u9875\u6570\u636e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>manualCountAlarmModel&#xff1a;\u7edf\u8ba1\u7b26\u5408\u6761\u4ef6\u603b\u6761\u6570&#xff1b; \u91c7\u7528\u624b\u52a8\u5206\u9875 SQL&#xff08;\u672a\u4f7f\u7528 PageHelper \u63d2\u4ef6&#xff09;&#xff0c;\u9002\u914d\u8fbe\u68a6\u56fd\u4ea7\u6570\u636e\u5e93\u8bed\u6cd5\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5c01\u88c5\u5206\u9875\u8fd4\u56de\u5bf9\u8c61 \u586b\u5145DataPaging\u7684rows\u5217\u8868\u3001total\u603b\u6761\u6570&#xff0c;\u8fd4\u56de\u7ed9\u4e0a\u5c42 Controller\u3002<\/p>\n<\/li>\n<p>\u4e09\u3001\u57fa\u7840 CRUD \u65b9\u6cd5&#xff08;getById \/getAll\/add \/update\/deleteById&#xff09;<\/p>\n<p>1. \u5355\u6761\u67e5\u8be2\u3001\u5168\u91cf\u67e5\u8be2\u3001\u5220\u9664<\/p>\n<p>&#064;Override<br \/>\npublic AlarmModel getById(String id) {<br \/>\n    return alarmModelMapper.selectById(id);<br \/>\n}<br \/>\n&#064;Override<br \/>\npublic List&lt;AlarmModel&gt; getAll() {<br \/>\n    return alarmModelMapper.selectAll();<br \/>\n}<br \/>\n&#064;Override<br \/>\npublic boolean deleteById(String id) {<br \/>\n    return alarmModelMapper.deleteById(id) &gt; 0;<br \/>\n}<\/p>\n<ul>\n<li>\n<p>\u6781\u7b80\u5c01\u88c5&#xff0c;\u76f4\u63a5\u8c03\u7528 Mapper \u57fa\u7840 SQL&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5220\u9664\u8fd4\u56de\u503c\u5224\u65ad&#xff1a;\u6570\u636e\u5e93\u53d7\u5f71\u54cd\u884c\u6570 &gt; 0 \u624d\u8fd4\u56de true&#xff0c;\u533a\u5206\u5220\u9664\u6210\u529f \/ \u65e0\u6570\u636e\u3002<\/p>\n<\/li>\n<\/ul>\n<p>2. \u65b0\u589e\u65b9\u6cd5 add&#xff08;\u91cd\u70b9&#xff0c;\u540e\u7aef\u5f3a\u5236\u8d4b\u503c&#xff0c;\u9632\u524d\u7aef\u810f\u6570\u636e&#xff09;<\/p>\n<p>&#064;Override<br \/>\npublic boolean add(AlarmModel alarmModel) {<br \/>\n    \/\/ 1. \u540e\u7aef\u751f\u6210\u552f\u4e00ID&#xff0c;\u8986\u76d6\u524d\u7aef\u4f20\u5165ID<br \/>\n    String id &#061; UUID.randomUUID().toString().replaceAll(&#034;-&#034;, &#034;&#034;);<br \/>\n    alarmModel.setId(id);<br \/>\n    \/\/ 2. \u540e\u7aef\u7edf\u4e00\u521b\u5efa\/\u66f4\u65b0\u65f6\u95f4<br \/>\n    Date now &#061; new Date();<br \/>\n    alarmModel.setCreatedTime(now);<br \/>\n    alarmModel.setUpdateTime(now);<br \/>\n    \/\/ 3. \u7248\u672c\u53f7\u9ed8\u8ba4V1.0.0<br \/>\n    if (alarmModel.getVersion() &#061;&#061; null || alarmModel.getVersion().trim().isEmpty()) {<br \/>\n        alarmModel.setVersion(&#034;V1.0.0&#034;);<br \/>\n    }<br \/>\n    \/\/ 4. \u72b6\u6001\u9ed8\u8ba4\u542f\u7528&#034;1&#034;<br \/>\n    if (alarmModel.getStatus() &#061;&#061; null || alarmModel.getStatus().trim().isEmpty()) {<br \/>\n        alarmModel.setStatus(&#034;1&#034;);<br \/>\n    }<br \/>\n    return alarmModelMapper.insert(alarmModel) &gt; 0;<br \/>\n}<\/p>\n<p>\u4e1a\u52a1\u5b89\u5168\u8bbe\u8ba1\u4eae\u70b9<\/p>\n<li>\n<p>\u4e3b\u952e ID \u5b8c\u5168\u7531\u540e\u7aef\u751f\u6210&#xff1a;UUID \u53bb\u9664\u6a2a\u6760&#xff0c;\u675c\u7edd\u524d\u7aef\u4f20\u5165\u81ea\u5b9a\u4e49 ID \u5bfc\u81f4\u4e3b\u952e\u51b2\u7a81\u3001\u6570\u636e\u6c61\u67d3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65f6\u95f4\u6233\u540e\u7aef\u7edf\u4e00\u7ba1\u63a7&#xff1a;\u521b\u5efa\u65f6\u95f4\u3001\u66f4\u65b0\u65f6\u95f4\u4e0d\u4f9d\u8d56\u524d\u7aef\u4f20\u53c2&#xff0c;\u4fdd\u8bc1\u6570\u636e\u65f6\u95f4\u51c6\u786e\u6027&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b57\u6bb5\u9ed8\u8ba4\u503c\u515c\u5e95&#xff1a;\u7248\u672c\u53f7\u3001\u542f\u7528\u72b6\u6001\u4e3a\u7a7a\u65f6\u81ea\u52a8\u586b\u5145\u9ed8\u8ba4\u503c&#xff0c;\u907f\u514d\u6570\u636e\u5e93\u5b57\u6bb5\u4e3a\u7a7a\u5f15\u53d1\u4e1a\u52a1\u903b\u8f91\u5f02\u5e38&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u63d2\u5165\u6210\u529f\u5224\u65ad&#xff1a;insert \u8fd4\u56de\u5f71\u54cd\u884c\u6570 &gt; 0 \u624d\u8fd4\u56de true\u3002<\/p>\n<\/li>\n<p>3. \u4fee\u6539\u65b9\u6cd5 update&#xff08;\u53c2\u6570\u5f3a\u6821\u9a8c&#xff09;<\/p>\n<p>&#064;Override<br \/>\npublic boolean update(AlarmModel alarmModel) {<br \/>\n    \/\/ \u66f4\u65b0\u5fc5\u987b\u643a\u5e26\u4e3b\u952eID&#xff0c;\u5426\u5219\u76f4\u63a5\u629b\u51fa\u53c2\u6570\u5f02\u5e38<br \/>\n    if (alarmModel.getId() &#061;&#061; null || alarmModel.getId().trim().isEmpty()) {<br \/>\n        throw new IllegalArgumentException(&#034;\u66f4\u65b0\u64cd\u4f5c\u5fc5\u987b\u6307\u5b9aID&#034;);<br \/>\n    }<br \/>\n    \/\/ \u5f3a\u5236\u5237\u65b0\u66f4\u65b0\u65f6\u95f4<br \/>\n    alarmModel.setUpdateTime(new Date());<br \/>\n    return alarmModelMapper.update(alarmModel) &gt; 0;<br \/>\n}<\/p>\n<ul>\n<li>\n<p>\u524d\u7f6e\u53c2\u6570\u6821\u9a8c&#xff1a;\u65e0 ID \u76f4\u63a5\u629b\u51fa\u975e\u6cd5\u53c2\u6570\u5f02\u5e38&#xff0c;\u62e6\u622a\u65e0\u6548\u66f4\u65b0 SQL&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u81ea\u52a8\u5237\u65b0\u66f4\u65b0\u65f6\u95f4&#xff0c;\u8bb0\u5f55\u6570\u636e\u6700\u540e\u4fee\u6539\u65f6\u523b\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u56db\u3001\u6761\u4ef6\u7b5b\u9009\u67e5\u8be2\u65b9\u6cd5&#xff08;getByModelCode \/getByStatus\/getByScope&#xff09;<\/p>\n<p>\u5168\u90e8\u4e3a\u7b80\u5355\u5355\u8868\u67e5\u8be2&#xff0c;\u76f4\u63a5\u8c03\u7528 Mapper \u5bf9\u5e94 SQL&#xff0c;\u7528\u4e8e\u524d\u7aef\u4e0b\u62c9\u6846\u3001\u5217\u8868\u7b5b\u9009&#xff1a;<\/p>\n<li>\n<p>getByModelCode&#xff1a;\u6309\u6a21\u578b\u7f16\u7801\u7cbe\u786e\u67e5\u8be2&#xff0c;\u65b0\u589e\u65f6\u6821\u9a8c\u7f16\u7801\u552f\u4e00\u6027&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getByStatus&#xff1a;\u6309\u542f\u7528 \/ \u505c\u7528\u72b6\u6001\u8fc7\u6ee4\u6a21\u578b\u5217\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getByScope&#xff1a;\u6839\u636e\u76d1\u63a7\u5bf9\u8c61\u7c7b\u578b &#043; ID&#xff0c;\u67e5\u8be2\u7ed1\u5b9a\u7684\u544a\u8b66\u6a21\u578b\u3002<\/p>\n<\/li>\n<p>\u4e94\u3001\u6838\u5fc3\u590d\u6742\u4e1a\u52a1&#xff1a;getByIdWithDetails \u6a21\u578b\u8be6\u60c5\u6811\u5f62\u89c4\u5219\u7ec4\u88c5<\/p>\n<p>\u8be5\u65b9\u6cd5\u662f\u6574\u4e2a\u7c7b\u4e1a\u52a1\u590d\u6742\u5ea6\u6700\u9ad8\u7684\u65b9\u6cd5&#xff0c;\u5b9e\u73b0&#xff1a;\u67e5\u8be2\u544a\u8b66\u6a21\u578b\u57fa\u7840\u4fe1\u606f &#043; \u5173\u8054\u6811\u5f62\u544a\u8b66\u89c4\u5219\u8282\u70b9 &#043; \u89c4\u5219\u6811\u540e\u5e8f\u904d\u5386\u91cd\u6392 &#043; \u81ea\u52a8\u586b\u5145\u903b\u8f91\u8fd0\u7b97\u7b26 &#043; \u62fc\u63a5\u683c\u5f0f\u5316 JSON \u8fd4\u56de\u524d\u7aef\u3002<\/p>\n<p>\u6574\u4f53\u6d41\u7a0b\u62c6\u89e3<\/p>\n<li>\n<p>\u57fa\u7840\u6570\u636e\u67e5\u8be2 \u901a\u8fc7 Mapper \u67e5\u8be2\u6a21\u578b\u57fa\u7840\u8be6\u60c5 Map&#xff08;\u5305\u542b\u539f\u59cb\u89c4\u5219\u5173\u7cfb JSON \u5b57\u7b26\u4e32RULE_RELATIONS&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u67e5\u8be2\u5b8c\u6574\u89c4\u5219\u6811\u8282\u70b9 \u8c03\u7528alarmRuleTreeUnifiedMapper.selectByModelId(id)&#xff0c;\u67e5\u8be2\u5f53\u524d\u6a21\u578b\u4e0b\u5168\u90e8\u6811\u5f62\u89c4\u5219\u8282\u70b9&#xff08;\u5305\u542b\u903b\u8f91\u7236\u8282\u70b9\u3001\u89c4\u5219\u53f6\u5b50\u8282\u70b9&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u6784\u5efa\u4e24\u7c7b\u6620\u5c04\u96c6\u5408<\/p>\n<ul>\n<li>\n<p>ruleNodeMap&#xff1a;\u53ea\u7b5b\u9009NODE_TYPE&#061;RULE\u7684\u53f6\u5b50\u89c4\u5219\u8282\u70b9&#xff0c;ID \u6620\u5c04\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>parentMap&#xff1a;\u5b58\u50a8\u6bcf\u4e2a\u8282\u70b9\u5bf9\u5e94\u7684\u7236\u8282\u70b9&#xff0c;\u7528\u4e8e\u8bfb\u53d6\u7236\u8282\u70b9\u5b58\u50a8\u7684\u903b\u8f91\u8fd0\u7b97\u7b26&#xff08;AND\/OR&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8c03\u7528\u5de5\u5177\u65b9\u6cd5 getPostOrderRuleNodeIds \u5bf9\u89c4\u5219\u6811\u6267\u884c\u975e\u9012\u5f52\u53cc\u6808\u540e\u5e8f\u904d\u5386&#xff0c;\u83b7\u53d6\u89c4\u5219\u53f6\u5b50\u8282\u70b9\u7684\u6b63\u786e\u6267\u884c\u987a\u5e8f ID \u5217\u8868\u3002<\/p>\n<\/li>\n<li>\n<p>\u91cd\u6784\u89c4\u5219\u5173\u8054\u5217\u8868 \u629b\u5f03\u539f\u59cb\u6570\u636e\u5e93 JSON \u5b57\u7b26\u4e32&#xff0c;\u76f4\u63a5\u904d\u5386\u6811\u5f62\u8282\u70b9\u7ec4\u88c5\u89c4\u5219\u5bf9\u8c61 Map&#xff0c;\u586b\u5145\u57fa\u7840\u5b57\u6bb5&#xff08;ID\u3001ruleId\u3001\u6267\u884c\u987a\u5e8f\u3001\u544a\u8b66\u7ea7\u522b&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u6309\u540e\u5e8f\u904d\u5386\u987a\u5e8f\u91cd\u65b0\u6392\u5e8f\u89c4\u5219 \u904d\u5386\u540e\u5e8f\u8282\u70b9 ID \u5217\u8868&#xff0c;\u6309\u987a\u5e8f\u91cd\u7ec4\u89c4\u5219\u5217\u8868&#xff1b;\u540c\u65f6\u8bfb\u53d6\u7236\u8282\u70b9\u903b\u8f91\u8fd0\u7b97\u7b26\u8d4b\u503c\u7ed9\u5f53\u524d\u89c4\u5219&#xff0c;\u65e0\u7236\u8282\u70b9\u9ed8\u8ba4 AND\u3002<\/p>\n<\/li>\n<li>\n<p>\u624b\u52a8\u62fc\u63a5\u6807\u51c6 JSON \u5b57\u7b26\u4e32 \u5faa\u73af\u6392\u5e8f\u540e\u7684\u89c4\u5219 Map&#xff0c;\u624b\u52a8\u62fc\u63a5 JSON \u6570\u7ec4\u5b57\u7b26\u4e32&#xff0c;\u8986\u76d6\u539f\u59cbRULE_RELATIONS\u5b57\u6bb5&#xff0c;\u7ec4\u88c5\u5b8c\u6210\u5b8c\u6574\u8be6\u60c5 Map \u8fd4\u56de\u3002<\/p>\n<\/li>\n<li>\n<p>\u5f02\u5e38\u6355\u83b7\u515c\u5e95 \u6811\u5f62\u7ec4\u88c5\u5168\u7a0b try-catch&#xff0c;\u7ec4\u88c5\u5931\u8d25\u6253\u5370\u9519\u8bef\u65e5\u5fd7&#xff0c;\u76f4\u63a5\u8fd4\u56de\u6570\u636e\u5e93\u539f\u59cb\u6570\u636e&#xff0c;\u4fdd\u8bc1\u524d\u7aef\u9875\u9762\u4e0d\u4f1a\u62a5\u9519\u7a7a\u767d\u3002<\/p>\n<\/li>\n<p>\u516d\u3001\u5de5\u5177\u79c1\u6709\u65b9\u6cd5 getPostOrderRuleNodeIds&#xff08;\u6811\u5f62\u540e\u5e8f\u904d\u5386&#xff09;<\/p>\n<p>\u4f5c\u7528<\/p>\n<p>\u5bf9\u544a\u8b66\u89c4\u5219\u591a\u53c9\u6811\u505a\u975e\u9012\u5f52\u540e\u5e8f\u904d\u5386&#xff0c;\u83b7\u53d6\u89c4\u5219\u53f6\u5b50\u8282\u70b9\u6267\u884c\u987a\u5e8f&#xff0c;\u4fdd\u8bc1\u544a\u8b66\u8ba1\u7b97\u5f15\u64ce\u6309\u6b63\u786e\u5148\u540e\u987a\u5e8f\u6267\u884c\u89c4\u5219\u5224\u65ad\u3002<\/p>\n<p>\u5b9e\u73b0\u903b\u8f91&#xff08;\u53cc\u6808\u7ecf\u5178\u540e\u5e8f\u904d\u5386\u7b97\u6cd5&#xff09;<\/p>\n<li>\n<p>\u904d\u5386\u5168\u90e8\u8282\u70b9&#xff0c;\u627e\u5230\u6839\u8282\u70b9&#xff08;isRoot&#061;true&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6784\u5efachildrenMap&#xff1a;\u7236 ID \u6620\u5c04\u5b50\u8282\u70b9\u5217\u8868&#xff0c;\u5b50\u8282\u70b9\u6309executionOrder\u5347\u5e8f\u6392\u5e8f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u521d\u59cb\u5316\u53cc\u6808stack1\u3001stack2&#xff0c;\u6839\u8282\u70b9\u538b\u5165 stack1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5faa\u73af\u5f39\u51fa stack1 \u8282\u70b9&#xff0c;\u538b\u5165 stack2&#xff1b;\u518d\u9006\u5e8f\u538b\u5165\u5b50\u8282\u70b9&#xff08;\u6808 LIFO \u7279\u6027\u4fdd\u8bc1\u904d\u5386\u987a\u5e8f\u6b63\u786e&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>stack1 \u6e05\u7a7a\u540e&#xff0c;\u5faa\u73af\u5f39\u51fa stack2&#xff0c;\u53ea\u6536\u96c6NODE_TYPE&#061;RULE\u89c4\u5219\u8282\u70b9 ID&#xff0c;\u5f62\u6210\u6709\u5e8f\u5217\u8868\u8fd4\u56de\u3002<\/p>\n<\/li>\n<p>\u4f18\u52bf<\/p>\n<ul>\n<li>\n<p>\u975e\u9012\u5f52\u5b9e\u73b0&#xff0c;\u907f\u514d\u89c4\u5219\u6811\u5c42\u7ea7\u8fc7\u6df1\u5f15\u53d1\u9012\u5f52\u6808\u6ea2\u51fa&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e25\u683c\u6309\u7167\u4e1a\u52a1\u5b9a\u4e49\u7684\u6267\u884c\u987a\u5e8f\u904d\u5386&#xff0c;\u5339\u914d\u540e\u7aef\u8ba1\u7b97\u5f15\u64ce\u89c4\u5219\u6267\u884c\u903b\u8f91\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e03\u3001\u4e1a\u52a1\u6821\u9a8c\u8f85\u52a9\u65b9\u6cd5 existsById \/isAssociatedWithObject<\/p>\n<li>\n<p>existsById&#xff1a;\u5224\u65ad\u6a21\u578b ID \u662f\u5426\u5b58\u5728&#xff0c;\u7f16\u8f91\u3001\u5220\u9664\u524d\u7f6e\u6821\u9a8c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>isAssociatedWithObject&#xff1a;\u67e5\u8be2\u4e2d\u95f4\u5173\u8054\u8868t_model_monitor_rel&#xff0c;\u5224\u65ad\u544a\u8b66\u6a21\u578b\u662f\u5426\u7ed1\u5b9a\u6307\u5b9a\u76d1\u63a7\u5bf9\u8c61&#xff1b; \u4e1a\u52a1\u573a\u666f&#xff1a;\u5220\u9664\u76d1\u63a7\u5bf9\u8c61\u524d\u6821\u9a8c&#xff0c;\u5b58\u5728\u7ed1\u5b9a\u6a21\u578b\u5219\u7981\u6b62\u5220\u9664&#xff0c;\u9632\u6b62\u6570\u636e\u5173\u8054\u65ad\u88c2\u3002<\/p>\n<\/li>\n<p>\u516b\u3001\u4ee3\u7801\u8bbe\u8ba1\u4eae\u70b9\u603b\u7ed3<\/p>\n<p>1. \u5206\u5c42\u804c\u8d23\u4e25\u683c\u5206\u79bb<\/p>\n<ul>\n<li>\n<p>Controller&#xff1a;\u53ea\u5904\u7406\u8bf7\u6c42\u3001\u53c2\u6570\u63a5\u6536\u3001\u7edf\u4e00\u8fd4\u56de&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Service \u63a5\u53e3&#xff1a;\u5b9a\u4e49\u4e1a\u52a1\u80fd\u529b\u5951\u7ea6&#xff0c;\u4e0a\u5c42\u53ea\u4f9d\u8d56\u62bd\u8c61&#xff1b;<\/p>\n<\/li>\n<li>\n<p>ServiceImpl&#xff1a;\u627f\u8f7d\u5168\u90e8\u4e1a\u52a1\u903b\u8f91\u3001\u53c2\u6570\u6821\u9a8c\u3001\u6570\u636e\u7ec4\u88c5\u3001\u590d\u6742\u7b97\u6cd5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Mapper&#xff1a;\u4ec5\u6267\u884c\u539f\u751f SQL&#xff0c;\u65e0\u4efb\u4f55\u4e1a\u52a1\u5224\u65ad\u3002<\/p>\n<\/li>\n<\/ul>\n<p>2. \u6570\u636e\u5b89\u5168\u7ba1\u63a7&#xff08;\u65b0\u589e \/ \u66f4\u65b0\u5f3a\u7ea6\u675f&#xff09;<\/p>\n<p>\u4e3b\u952e\u3001\u65f6\u95f4\u6233\u3001\u9ed8\u8ba4\u5b57\u6bb5\u5168\u90e8\u7531\u540e\u7aef\u5f3a\u5236\u8d4b\u503c&#xff0c;\u5b8c\u5168\u9694\u79bb\u524d\u7aef\u53ef\u63a7\u5b57\u6bb5&#xff0c;\u675c\u7edd\u810f\u6570\u636e\u5165\u5e93\u3002<\/p>\n<p>3. \u590d\u6742\u4e1a\u52a1\u89e3\u8026<\/p>\n<p>\u5c06\u6811\u5f62\u904d\u5386\u903b\u8f91\u62bd\u79bb\u79c1\u6709\u5de5\u5177\u65b9\u6cd5&#xff0c;\u8be6\u60c5\u67e5\u8be2\u4e3b\u65b9\u6cd5\u903b\u8f91\u6e05\u6670&#xff0c;\u4fbf\u4e8e\u540e\u671f\u7ef4\u62a4\u89c4\u5219\u6392\u5e8f\u903b\u8f91\u3002<\/p>\n<p>4. \u5bb9\u9519\u5065\u58ee\u6027\u8bbe\u8ba1<\/p>\n<li>\n<p>\u5206\u9875\u53c2\u6570\u3001\u66f4\u65b0 ID \u975e\u6cd5\u65f6\u4e3b\u52a8\u62e6\u622a\u629b\u51fa\u5f02\u5e38&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6811\u5f62\u89c4\u5219\u7ec4\u88c5\u5168\u7a0b\u5f02\u5e38\u6355\u83b7&#xff0c;\u5931\u8d25\u515c\u5e95\u8fd4\u56de\u539f\u59cb\u6570\u636e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u5e93\u67e5\u8be2\u7a7a\u503c\u517c\u5bb9&#xff0c;\u7a7a\u5b57\u7b26\u4e32\u7edf\u4e00\u8f6c\u4e3a null&#xff0c;\u907f\u514d\u65e0\u6548 SQL&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6240\u6709\u6570\u636e\u5e93\u64cd\u4f5c\u5224\u65ad\u53d7\u5f71\u54cd\u884c\u6570&#xff0c;\u7cbe\u51c6\u533a\u5206\u64cd\u4f5c\u6210\u529f \/ \u5931\u8d25\u3002<\/p>\n<\/li>\n<p>5. \u65e5\u5fd7\u5b8c\u5907<\/p>\n<p>\u5173\u952e\u4e1a\u52a1\u6b65\u9aa4&#xff08;\u89c4\u5219\u7ec4\u88c5\u5b8c\u6210\u6570\u91cf&#xff09;\u3001\u5f02\u5e38\u573a\u666f\u6253\u5370\u65e5\u5fd7&#xff0c;\u7ebf\u4e0a\u95ee\u9898\u53ef\u5feb\u901f\u5b9a\u4f4d\u3002<\/p>\n<p>\u4e5d\u3001\u53ef\u4f18\u5316\u6539\u8fdb\u70b9<\/p>\n<li>\n<p>\u7f3a\u5c11\u4e8b\u52a1\u6ce8\u89e3 &#064;Transactional \u65b0\u589e\u3001\u4fee\u6539\u3001\u5220\u9664\u3001\u6279\u91cf\u89c4\u5219\u7ec4\u88c5\u65b9\u6cd5\u672a\u52a0\u4e8b\u52a1&#xff0c;\u82e5\u591a\u8868\u64cd\u4f5c\u4e2d\u9014\u5f02\u5e38\u4f1a\u4ea7\u751f\u810f\u6570\u636e&#xff0c;\u5efa\u8bae\u5728add\/update\/deleteById\/getByIdWithDetails\u6dfb\u52a0&#064;Transactional\u3002<\/p>\n<\/li>\n<li>\n<p>\u624b\u52a8\u62fc\u63a5 JSON \u5b57\u7b26\u4e32\u4e0d\u89c4\u8303 \u89c4\u5219\u5217\u8868 JSON \u91c7\u7528 StringBuilder \u624b\u52a8\u62fc\u63a5&#xff0c;\u6613\u51fa\u73b0\u5f15\u53f7\u3001\u9017\u53f7\u8bed\u6cd5\u9519\u8bef&#xff0c;\u5efa\u8bae\u4f7f\u7528Jackson\/Alibaba FastJSON\u5de5\u5177\u7c7b\u5e8f\u5217\u5316 Map \u751f\u6210\u6807\u51c6 JSON\u3002<\/p>\n<\/li>\n<li>\n<p>\u5927\u91cf\u9b54\u6cd5\u5b57\u7b26\u4e32\u786c\u7f16\u7801 RULE\u3001AND\u30011\u3001RULE_RELATIONS\u7b49\u72b6\u6001\u3001\u5b57\u6bb5\u3001\u7c7b\u578b\u5b57\u7b26\u4e32\u5206\u6563\u5199\u6b7b&#xff0c;\u5efa\u8bae\u62bd\u79bb\u5168\u5c40\u5e38\u91cf\u7c7b\u7edf\u4e00\u7ba1\u7406\u3002<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de\u503c Map&lt;String,Object&gt; \u65e0\u5f3a\u7c7b\u578b\u7ea6\u675f \u8be6\u60c5\u63a5\u53e3\u8fd4\u56de\u52a8\u6001 Map&#xff0c;\u524d\u540e\u7aef\u5b57\u6bb5\u6c9f\u901a\u6613\u51fa\u9519&#xff0c;\u5efa\u8bae\u65b0\u5efaAlarmModelDetailVO\u89c6\u56fe\u5b9e\u4f53&#xff0c;\u5f3a\u7c7b\u578b\u8fd4\u56de\u3002<\/p>\n<\/li>\n<li>\n<p>\u91cd\u590d\u53c2\u6570\u6e05\u6d17\u903b\u8f91\u53ef\u62bd\u5de5\u5177\u7c7b \u5206\u9875\u67e5\u8be2\u4e2d\u7a7a\u5b57\u7b26\u4e32\u8f6c null \u7684\u903b\u8f91\u591a\u5904\u590d\u7528&#xff0c;\u53ef\u5c01\u88c5\u901a\u7528\u53c2\u6570\u6e05\u6d17\u5de5\u5177\u65b9\u6cd5\u3002<\/p>\n<\/li>\n<li>\n<p>\u672a\u7edf\u4e00\u5168\u5c40\u5f02\u5e38\u629b\u51fa \u4ec5\u66f4\u65b0\u65b9\u6cd5\u629b\u51faIllegalArgumentException&#xff0c;\u5176\u4f59\u53c2\u6570\u975e\u6cd5\u573a\u666f\u672a\u505a\u62e6\u622a&#xff0c;\u5efa\u8bae\u81ea\u5b9a\u4e49\u4e1a\u52a1\u5f02\u5e38BusinessException\u7edf\u4e00\u629b\u51fa\u3002<\/p>\n<\/li>\n<h3>\u544a\u8b66\u89c4\u5219\u7ba1\u7406<\/h3>\n<h4>AlarmRuleController.java<\/h4>\n<p>\u8be5\u63a7\u5236\u5668\u662f\u667a\u80fd\u8fd0\u7ef4 ZNYW \u6a21\u5757\u544a\u8b66\u89c4\u5219\u7684 REST \u63a5\u53e3\u5c42&#xff0c;\u548c\u524d\u9762AlarmModelController\u67b6\u6784\u3001\u7f16\u7801\u89c4\u8303\u5b8c\u5168\u7edf\u4e00&#xff0c;\u8d1f\u8d23\u63a5\u6536\u524d\u7aef\u544a\u8b66\u89c4\u5219\u9875\u9762\u8bf7\u6c42\u3001\u5c01\u88c5\u67e5\u8be2\u53c2\u6570\u3001\u8c03\u7528\u4e1a\u52a1\u5c42\u3001\u7edf\u4e00\u8fd4\u56de\u6807\u51c6 JSON \u7ed3\u6784\u3002<\/p>\n<p>\u4e00\u3001\u5934\u90e8\u57fa\u7840\u4fe1\u606f<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.xxx.bussiness.znyw.controller;<\/p>\n<p>\u4e0e\u544a\u8b66\u6a21\u578b\u63a7\u5236\u5668\u540c\u5305&#xff0c;\u5c5e\u4e8e\u667a\u80fd\u8fd0\u7ef4\u5b50\u6a21\u5757\u7684\u63a5\u53e3\u63a7\u5236\u5c42\u3002<\/p>\n<p>2. \u5bfc\u5165\u7c7b\u8bf4\u660e<\/p>\n<li>\n<p>\u5206\u9875\u5de5\u5177 DataPaging&#xff1a;\u7edf\u4e00\u5206\u9875\u8fd4\u56de\u8f7d\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40\u7edf\u4e00\u8fd4\u56de JsonMessage&#xff1a;\u524d\u540e\u7aef\u6807\u51c6\u54cd\u5e94\u4f53&#xff0c;\u533a\u5206\u6210\u529f \/ \u5931\u8d25&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u4f53\u7c7b&#xff1a;<\/p>\n<ul>\n<li>\n<p>AlarmRule&#xff1a;\u544a\u8b66\u89c4\u5219\u6570\u636e\u5e93\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u5c42&#xff1a;AlarmRuleService \u544a\u8b66\u89c4\u5219\u4e1a\u52a1\u63a5\u53e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Spring Web \u6ce8\u89e3&#xff1a;RESTful \u63a5\u53e3\u5fc5\u5907\u6ce8\u89e3&#xff0c;\u8def\u5f84\u53c2\u6570\u3001\u8bf7\u6c42\u4f53\u3001\u8bf7\u6c42\u53c2\u6570\u6ce8\u89e3\u3002<\/p>\n<\/li>\n<p>3. \u7c7b\u6ce8\u89e3\u4e0e\u4f9d\u8d56\u6ce8\u5165<\/p>\n<p>&#064;RestController<br \/>\n&#064;RequestMapping(&#034;\/api\/alarmRule&#034;)<br \/>\n&#064;Autowired<br \/>\nprivate AlarmRuleService alarmRuleService;<\/p>\n<li>\n<p>&#064;RestController&#xff1a;\u81ea\u52a8\u5c06\u8fd4\u56de\u503c\u8f6c\u4e3a JSON&#xff0c;\u65e0\u9700\u989d\u5916&#064;ResponseBody&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40\u63a5\u53e3\u524d\u7f00 \/api\/alarmRule \u5b8c\u6574\u8bf7\u6c42\u793a\u4f8b&#xff1a;http:\/\/127.0.0.1:8091\/api\/alarmRule\/list\/page&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u81ea\u52a8\u6ce8\u5165\u544a\u8b66\u89c4\u5219\u4e1a\u52a1\u63a5\u53e3&#xff0c;Controller \u53ea\u4f9d\u8d56\u62bd\u8c61 Service&#xff0c;\u4e0d\u8026\u5408\u5b9e\u73b0\u7c7b\u3002<\/p>\n<\/li>\n<p>\u4e8c\u3001\u5168\u90e8\u63a5\u53e3\u9010\u884c\u62c6\u89e3<\/p>\n<p>\u63a5\u53e3 1&#xff1a;\u5206\u9875\u591a\u6761\u4ef6\u67e5\u8be2 GET \/api\/alarmRule\/list\/page<\/p>\n<p>\u7528\u9014&#xff1a;\u524d\u7aef\u544a\u8b66\u89c4\u5219\u5217\u8868\u9875\u9762\u5206\u9875\u52a0\u8f7d\u3001\u591a\u7ef4\u5ea6\u7b5b\u9009<\/p>\n<p>1. \u5165\u53c2\u8bf4\u660e&#xff08;\u5168\u90e8\u524d\u7aef\u53ef\u4f20\u7b5b\u9009\u6761\u4ef6&#xff09;<\/p>\n<table>\n<tr>\n<p>\u53c2\u6570<\/p>\n<p>\u662f\u5426\u5fc5\u586b<\/p>\n<p>\u4f5c\u7528<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>ruleName<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u89c4\u5219\u540d\u79f0\u6a21\u7cca\u67e5\u8be2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>ruleCode<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u89c4\u5219\u7f16\u7801\u7cbe\u786e\u67e5\u8be2&#xff08;\u65b0\u589e\u6269\u5c55\u5b57\u6bb5&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>status<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u89c4\u5219\u542f\u7528 \/ \u505c\u7528\u72b6\u6001\u7b5b\u9009<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>metricId<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u7ed1\u5b9a\u6307\u6807 ID \u7b5b\u9009&#xff08;\u5bf9\u63a5\u6307\u6807\u8ba1\u7b97\u5f15\u64ce&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>algorithmId<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u7ed1\u5b9a\u7b97\u6cd5 ID \u7b5b\u9009&#xff08;\u8ba1\u7b97\u5f15\u64ce\u7b97\u6cd5&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>operator<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u9608\u503c\u8fd0\u7b97\u7b26&#xff08;&gt; &lt; &gt;&#061; &lt;&#061; &#061;&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>page<\/p>\n<\/td>\n<td>\n<p>\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u5f53\u524d\u9875\u7801<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>row<\/p>\n<\/td>\n<td>\n<p>\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u6bcf\u9875\u6761\u6570<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>2. \u53c2\u6570\u5c01\u88c5\u903b\u8f91\u4eae\u70b9<\/p>\n<p>\u4f7f\u7528 Optional.ofNullable().ifPresent() \u5c01\u88c5\u53c2\u6570\u5230paramMap&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u81ea\u52a8\u8fc7\u6ee4null\u7a7a\u53c2\u6570&#xff0c;\u4e0d\u4f1a\u5b58\u5165 Map&#xff0c;\u907f\u514d Service \u5c42\u5904\u7406\u65e0\u6548\u67e5\u8be2\u6761\u4ef6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6ce8\u91ca\u8bf4\u660e&#xff1a;\u6a21\u7cca\u5339\u914d\u7684%\u901a\u914d\u7b26\u7531\u540e\u7aef Service \u62fc\u63a5&#xff0c;\u524d\u7aef\u53ea\u4f20\u7eaf\u6587\u672c&#xff0c;\u524d\u540e\u7aef\u5206\u5de5\u6e05\u6670\u3002<\/p>\n<\/li>\n<\/ul>\n<p>3. \u6267\u884c\u6d41\u7a0b<\/p>\n<li>\n<p>\u7ec4\u88c5\u6240\u6709\u7b5b\u9009\u6761\u4ef6\u5b58\u5165 Map&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528alarmRuleService.selectPagingAlarmRuleList\u6267\u884c\u5206\u9875\u67e5\u8be2&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5c06\u5206\u9875\u5bf9\u8c61DataPaging&lt;AlarmRule&gt;\u5305\u88c5\u4e3a\u6210\u529f JSON \u8fd4\u56de\u524d\u7aef\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 2&#xff1a;\u6839\u636e\u4e3b\u952e ID \u5355\u6761\u67e5\u8be2 GET \/{id}<\/p>\n<li>\n<p>&#064;PathVariable String id&#xff1a;\u8def\u5f84\u4f20\u53c2\u89c4\u5219\u4e3b\u952e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u903b\u8f91&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u67e5\u8be2\u5230\u5b9e\u4f53\u76f4\u63a5\u8fd4\u56de\u6210\u529f\u6570\u636e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65e0\u6570\u636e\u8fd4\u56de\u4e1a\u52a1\u63d0\u793a\u300c\u672a\u627e\u5230\u5bf9\u5e94\u7684\u544a\u8b66\u89c4\u5219\u300d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6240\u6709\u5f02\u5e38\u6355\u83b7&#xff0c;\u5c06\u5f02\u5e38\u4fe1\u606f\u5c01\u88c5\u4e3a\u5931\u8d25\u63d0\u793a\u8fd4\u56de\u524d\u7aef&#xff0c;\u4e0d\u629b\u51fa\u539f\u59cb\u5806\u6808\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<p>\u63a5\u53e3 3&#xff1a;\u67e5\u8be2\u5168\u91cf\u544a\u8b66\u89c4\u5219 GET \/all<\/p>\n<li>\n<p>\u8fd4\u56de\u65e0\u5206\u9875\u5b8c\u6574List&lt;AlarmRule&gt;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u573a\u666f&#xff1a;\u4e0b\u62c9\u9009\u62e9\u6846\u3001\u57fa\u7840\u6570\u636e\u5b57\u5178\u52a0\u8f7d&#xff0c;\u9002\u7528\u4e8e\u6570\u636e\u91cf\u4e0d\u5927\u7684\u573a\u666f\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 4&#xff1a;\u65b0\u589e\u544a\u8b66\u89c4\u5219 POST \/add<\/p>\n<li>\n<p>&#064;RequestBody AlarmRule&#xff1a;\u63a5\u6536\u524d\u7aef\u8868\u5355\u5b8c\u6574 JSON \u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 Service \u65b0\u589e\u65b9\u6cd5&#xff0c;\u6839\u636e\u8fd4\u56de\u5e03\u5c14\u503c\u5224\u65ad\u662f\u5426\u65b0\u589e\u6210\u529f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40\u6355\u83b7\u5f02\u5e38&#xff0c;\u8fd4\u56de\u53cb\u597d\u5931\u8d25\u4fe1\u606f\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 5&#xff1a;\u4fee\u6539\u544a\u8b66\u89c4\u5219 PUT \/update<\/p>\n<p>\u9075\u5faa REST \u89c4\u8303&#xff0c;PUT \u7528\u4e8e\u5168\u91cf\u66f4\u65b0\u5b9e\u4f53&#xff1b; \u63a5\u6536\u5b8c\u6574AlarmRule\u5b9e\u4f53&#xff0c;\u540e\u7aef Service \u6839\u636e\u4e3b\u952e ID \u66f4\u65b0\u6570\u636e\u5e93\u8bb0\u5f55\u3002<\/p>\n<p>\u63a5\u53e3 6&#xff1a;\u5220\u9664\u544a\u8b66\u89c4\u5219 DELETE \/{id}<\/p>\n<p>\u6807\u51c6 DELETE \u5220\u9664\u63a5\u53e3&#xff0c;\u6839\u636e\u4e3b\u952e\u6267\u884c\u5220\u9664\u903b\u8f91&#xff0c;\u8fd4\u56de\u5220\u9664\u64cd\u4f5c\u7ed3\u679c\u3002<\/p>\n<p>\u63a5\u53e3 7&#xff1a;\u6309\u72b6\u6001\u7b5b\u9009 GET \/byStatus<\/p>\n<p>\u5165\u53c2status&#xff0c;\u67e5\u8be2\u5bf9\u5e94\u542f\u7528 \/ \u505c\u7528\u72b6\u6001\u7684\u5168\u90e8\u89c4\u5219&#xff1b; \u7528\u4e8e\u524d\u7aef\u5217\u8868\u72b6\u6001\u7b5b\u9009\u4e0b\u62c9\u3002<\/p>\n<p>\u63a5\u53e3 8&#xff1a;\u6309\u6307\u6807 ID \u7b5b\u9009 GET \/byMetricId<\/p>\n<p>\u5165\u53c2metricId\u6307\u6807\u4e3b\u952e&#xff0c;\u67e5\u8be2\u7ed1\u5b9a\u8be5\u6307\u6807\u7684\u6240\u6709\u544a\u8b66\u89c4\u5219&#xff1b; \u4e1a\u52a1\u573a\u666f&#xff1a;\u6307\u6807\u8be6\u60c5\u9875\u9762&#xff0c;\u67e5\u770b\u5f53\u524d\u6307\u6807\u5173\u8054\u4e86\u54ea\u4e9b\u544a\u8b66\u5224\u65ad\u89c4\u5219\u3002<\/p>\n<p>\u4e09\u3001\u4ee3\u7801\u7edf\u4e00\u8bbe\u8ba1\u89c4\u8303&#xff08;\u548c AlarmModelController \u4fdd\u6301\u4e00\u81f4&#xff09;<\/p>\n<li>\n<p>\u4e25\u683c RESTful \u63a5\u53e3\u89c4\u8303 \u67e5\u8be2 &#8211; GET\u3001\u65b0\u589e &#8211; POST\u3001\u4fee\u6539 &#8211; PUT\u3001\u5220\u9664 &#8211; DELETE&#xff0c;\u8bed\u4e49\u6807\u51c6&#xff0c;\u524d\u540e\u7aef\u534f\u4f5c\u7edf\u4e00&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u63a5\u53e3 try-catch \u5f02\u5e38\u6355\u83b7 \u6bcf\u4e2a\u63a5\u53e3\u5185\u90e8\u72ec\u7acb\u6355\u83b7\u6240\u6709\u5f02\u5e38&#xff0c;\u4e0d\u4f1a\u629b\u51fa 500 \u539f\u59cb\u9519\u8bef\u5806\u6808\u7ed9\u524d\u7aef&#xff0c;\u7edf\u4e00\u5c01\u88c5\u4e1a\u52a1\u5316\u5931\u8d25\u63d0\u793a&#xff0c;\u7ebf\u4e0a\u53cb\u597d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u8fd4\u56de\u683c\u5f0f JsonMessage \u6240\u6709\u63a5\u53e3\u8fd4\u56de\u7ed3\u6784\u6807\u51c6\u5316&#xff0c;\u524d\u7aef\u7edf\u4e00\u5904\u7406\u6210\u529f \/ \u5931\u8d25\u5f39\u7a97\u3001\u9875\u9762\u6e32\u67d3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5206\u5c42\u804c\u8d23\u6e05\u6670 Controller \u53ea\u505a\u4e09\u4ef6\u4e8b&#xff1a;\u63a5\u6536\u8bf7\u6c42\u53c2\u6570\u3001\u7ec4\u88c5\u53c2\u6570\u8c03\u7528 Service\u3001\u5c01\u88c5\u8fd4\u56de\u7ed3\u679c&#xff1b;\u65e0\u4efb\u4f55\u6570\u636e\u5e93\u64cd\u4f5c\u3001\u590d\u6742\u4e1a\u52a1\u903b\u8f91&#xff0c;\u4e1a\u52a1\u903b\u8f91\u5168\u90e8\u4e0b\u6c89\u81f3 Service \u5c42&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6269\u5c55\u6027\u5f3a \u5206\u9875\u67e5\u8be2\u63a5\u53e3\u9884\u7559\u5927\u91cf\u6269\u5c55\u7b5b\u9009\u5b57\u6bb5&#xff08;ruleCode\u3001algorithmId\u3001operator&#xff09;&#xff0c;\u9002\u914d\u6307\u6807\u3001\u7b97\u6cd5\u3001\u9608\u503c\u8fd0\u7b97\u7b26\u591a\u7ef4\u5ea6\u7b5b\u9009&#xff0c;\u9002\u914d\u6cb9\u7530\u667a\u80fd\u8ba1\u7b97\u5f15\u64ce\u4e1a\u52a1\u573a\u666f\u3002<\/p>\n<\/li>\n<p>\u56db\u3001\u524d\u540e\u7aef\u4e1a\u52a1\u8054\u52a8\u5173\u7cfb<\/p>\n<p>\u524d\u7aef\u9875\u9762&#xff08;\u5bf9\u5e94\u4e4b\u524d Vue \u8def\u7531&#xff09;<\/p>\n<p>\/znyw\/alertRule \u544a\u8b66\u89c4\u5219\u7ba1\u7406\u9875\u9762<\/p>\n<li>\n<p>\u5217\u8868\u5206\u9875\u7b5b\u9009&#xff1a;\/list\/page<\/p>\n<\/li>\n<li>\n<p>\u65b0\u589e\u5f39\u7a97&#xff1a;\/add<\/p>\n<\/li>\n<li>\n<p>\u7f16\u8f91\u5f39\u7a97\u56de\u663e\u5355\u6761\u6570\u636e&#xff1a;\/{id}<\/p>\n<\/li>\n<li>\n<p>\u5220\u9664\u6309\u94ae&#xff1a;DELETE \/{id}<\/p>\n<\/li>\n<li>\n<p>\u72b6\u6001\u4e0b\u62c9\u7b5b\u9009&#xff1a;\/byStatus<\/p>\n<\/li>\n<li>\n<p>\u6307\u6807\u8be6\u60c5\u5173\u8054\u89c4\u5219&#xff1a;\/byMetricId<\/p>\n<\/li>\n<li>\n<p>\u89c4\u5219\u4e0b\u62c9\u9009\u62e9\u6846&#xff1a;\/all<\/p>\n<\/li>\n<p>\u540e\u7aef\u4e1a\u52a1\u94fe\u8def\u8054\u52a8<\/p>\n<li>\n<p>\u6570\u636e\u5e93&#xff1a;\u8fbe\u68a6 ZNYW \u5e93 t_alarm_rule \u544a\u8b66\u89c4\u5219\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5173\u8054\u6a21\u5757&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6307\u6807\u6a21\u5757&#xff1a;metricId \u5173\u8054\u6307\u6807\u914d\u7f6e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7b97\u6cd5\u8ba1\u7b97\u5f15\u64ce&#xff1a;algorithmId \u7ed1\u5b9a\u8ba1\u7b97\u7b97\u6cd5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u544a\u8b66\u6a21\u578b\u6a21\u5757&#xff1a;\u591a\u6761\u544a\u8b66\u89c4\u5219\u7ec4\u88c5\u4e3a\u4e00\u5957\u544a\u8b66\u6a21\u578b&#xff08;\u5bf9\u5e94\u524d\u9762 AlarmModel \u6811\u5f62\u89c4\u5219\u7ed3\u6784&#xff09;&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5b9a\u65f6\u4efb\u52a1&#xff1a;\u89c4\u5219\u914d\u7f6e\u5b8c\u6210\u540e&#xff0c;\u5b9a\u65f6\u4efb\u52a1\u6309\u89c4\u5219\u9608\u503c\u6267\u884c\u6570\u636e\u5224\u65ad&#xff0c;\u89e6\u53d1\u544a\u8b66\u5e76\u751f\u6210\u5de5\u5355\u3002<\/p>\n<\/li>\n<p>\u4e94\u3001\u4ee3\u7801\u4f18\u5316\u5efa\u8bae<\/p>\n<li>\n<p>\u91cd\u590d try-catch \u6a21\u677f\u4ee3\u7801\u5197\u4f59 \u5efa\u8bae\u4f7f\u7528\u5168\u5c40\u7edf\u4e00\u5f02\u5e38\u5904\u7406\u5668 &#064;ControllerAdvice&#xff0c;\u79fb\u9664\u6bcf\u4e2a\u63a5\u53e3\u5185\u90e8\u91cd\u590d\u7684 try-catch&#xff0c;\u7b80\u5316\u63a7\u5236\u5668\u4ee3\u7801&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5206\u9875\u5165\u53c2\u96f6\u6563 \u5206\u9875\u63a5\u53e3\u5927\u91cf&#064;RequestParam\u96f6\u6563\u53c2\u6570&#xff0c;\u53ef\u65b0\u5efa DTO \u5206\u9875\u67e5\u8be2\u5bf9\u8c61\u7edf\u4e00\u63a5\u6536\u53c2\u6570&#xff0c;\u4ee3\u7801\u53ef\u8bfb\u6027\u66f4\u9ad8&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9b54\u6cd5\u5b57\u7b26\u4e32\u786c\u7f16\u7801 \u72b6\u6001\u3001\u8fd0\u7b97\u7b26\u3001\u5b57\u6bb5\u540d\u786c\u7f16\u7801&#xff0c;\u5efa\u8bae\u62bd\u53d6\u5e38\u91cf\u7c7b\u7edf\u4e00\u7ba1\u7406&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7f3a\u5c11\u63a5\u53e3\u6743\u9650\u63a7\u5236 \u672a\u6dfb\u52a0\u6743\u9650\u6821\u9a8c\u6ce8\u89e3&#xff0c;\u65e0\u6cd5\u533a\u5206\u7ba1\u7406\u5458 \/ \u666e\u901a\u7528\u6237\u7684\u589e\u5220\u6539\u67e5\u64cd\u4f5c\u6743\u9650&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7f3a\u5c11\u6279\u91cf\u64cd\u4f5c\u63a5\u53e3 \u65e0\u6279\u91cf\u65b0\u589e\u3001\u6279\u91cf\u5220\u9664\u63a5\u53e3&#xff0c;\u524d\u7aef\u6279\u91cf\u64cd\u4f5c\u573a\u666f\u9700\u8981\u5faa\u73af\u8c03\u7528\u5355\u6761\u63a5\u53e3&#xff0c;\u6027\u80fd\u8f83\u5dee\u3002<\/p>\n<\/li>\n<h4>AlarmRuleService.java<\/h4>\n<p>\u8fd9\u662f\u544a\u8b66\u89c4\u5219\u6a21\u5757\u7684\u4e1a\u52a1\u5c42\u6807\u51c6\u62bd\u8c61\u63a5\u53e3&#xff0c;\u9075\u5faa\u540e\u7aef\u5206\u5c42\u67b6\u6784\u89c4\u8303 Controller \u2192 Service\u63a5\u53e3 \u2192 ServiceImpl\u5b9e\u73b0\u7c7b \u2192 Mapper&#xff0c;\u53ea\u5b9a\u4e49\u4e1a\u52a1\u80fd\u529b\u5951\u7ea6\u3001\u65b9\u6cd5\u5165\u53c2 \/ \u8fd4\u56de\u503c\u4e0e\u6ce8\u91ca&#xff0c;\u4e0d\u5305\u542b\u4efb\u4f55\u4e1a\u52a1\u903b\u8f91&#xff0c;\u5b9e\u73b0\u9762\u5411\u63a5\u53e3\u7f16\u7a0b\u3001\u89e3\u8026\u5206\u5c42\u3002<\/p>\n<p>\u4e00\u3001\u57fa\u7840\u4fe1\u606f<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.xxx.bussiness.znyw.service;<\/p>\n<p>\u548c\u4e4b\u524d AlarmModelService \u540c\u5305&#xff0c;\u5c5e\u4e8e\u667a\u80fd\u8fd0\u7ef4 ZNYW \u6a21\u5757\u7edf\u4e00\u4e1a\u52a1\u63a5\u53e3\u5c42\u3002<\/p>\n<p>2. \u5bfc\u5165\u4f9d\u8d56\u8bf4\u660e<\/p>\n<li>\n<p>DataPaging&#xff1a;\u9879\u76ee\u5168\u5c40\u901a\u7528\u5206\u9875\u5c01\u88c5\u5bf9\u8c61&#xff0c;\u5206\u9875\u67e5\u8be2\u7edf\u4e00\u8fd4\u56de\u8be5\u8f7d\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmRule&#xff1a;\u6570\u636e\u5e93\u544a\u8b66\u89c4\u5219\u8868\u5bf9\u5e94\u7684\u5b9e\u4f53\u7c7b&#xff0c;\u5355\u8868 CRUD \u5165\u53c2\u3001\u8fd4\u56de\u8f7d\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>List \/ Map&#xff1a;\u52a8\u6001\u53c2\u6570\u3001\u96c6\u5408\u5217\u8868\u627f\u8f7d\u5bb9\u5668\u3002<\/p>\n<\/li>\n<p>3. \u63a5\u53e3\u5b9a\u4f4d\u4e0e\u8bbe\u8ba1\u601d\u60f3<\/p>\n<li>\n<p>\u5951\u7ea6\u7ea6\u675f&#xff1a;\u5f3a\u5236\u5b9e\u73b0\u7c7b\u5fc5\u987b\u5b8c\u6210\u63a5\u53e3\u5b9a\u4e49\u7684\u5168\u90e8\u4e1a\u52a1\u80fd\u529b&#xff0c;\u7edf\u4e00\u56e2\u961f\u5f00\u53d1\u6807\u51c6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u89e3\u8026\u4f18\u52bf&#xff1a;Controller \u4ec5\u6ce8\u5165 AlarmRuleService \u63a5\u53e3&#xff0c;\u4e0d\u4f9d\u8d56\u5177\u4f53\u5b9e\u73b0\u7c7b AlarmRuleServiceImpl&#xff1b;<\/p>\n<ul>\n<li>\n<p>\u5355\u5143\u6d4b\u8bd5&#xff1a;\u53ef Mock \u63a5\u53e3&#xff0c;\u65e0\u9700\u8fde\u63a5\u771f\u5b9e\u8fbe\u68a6\u6570\u636e\u5e93&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u91cd\u6784&#xff1a;\u4fee\u6539 SQL\u3001\u4e1a\u52a1\u903b\u8f91\u4ec5\u6539\u52a8\u5b9e\u73b0\u7c7b&#xff0c;\u4e0a\u5c42 Controller \u96f6\u6539\u52a8&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u804c\u8d23\u8fb9\u754c&#xff1a;\u63a5\u53e3\u53ea\u505a\u300c\u80fd\u529b\u5b9a\u4e49\u300d&#xff0c;\u53c2\u6570\u6821\u9a8c\u3001\u6570\u636e\u5e93\u4ea4\u4e92\u3001\u590d\u6742\u4e1a\u52a1\u903b\u8f91\u5168\u90e8\u4e0b\u6c89\u81f3 ServiceImpl \u5b9e\u73b0\u7c7b\u3002<\/p>\n<\/li>\n<p>\u4e8c\u3001\u6240\u6709\u65b9\u6cd5\u5206\u7ec4\u8be6\u89e3<\/p>\n<p>\u5206\u7ec4 1&#xff1a;\u5206\u9875\u591a\u6761\u4ef6\u5217\u8868\u67e5\u8be2&#xff08;\u524d\u7aef\u89c4\u5219\u5217\u8868\u9875\u6838\u5fc3\u63a5\u53e3&#xff09;<\/p>\n<p>DataPaging&lt;AlarmRule&gt; selectPagingAlarmRuleList(Map&lt;String, Object&gt; paramMap, int page, int row);<\/p>\n<li>\n<p>\u5165\u53c2&#xff1a;<\/p>\n<ul>\n<li>\n<p>paramMap&#xff1a;\u52a8\u6001\u67e5\u8be2\u6761\u4ef6 Map&#xff0c;\u627f\u8f7d\u89c4\u5219\u540d\u79f0\u3001\u7f16\u7801\u3001\u72b6\u6001\u3001\u6307\u6807 ID\u3001\u7b97\u6cd5 ID\u3001\u8fd0\u7b97\u7b26\u7b49\u591a\u7ef4\u5ea6\u7b5b\u9009\u6761\u4ef6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>page \u5f53\u524d\u9875\u7801\u3001row \u6bcf\u9875\u6761\u6570&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8fd4\u56de&#xff1a;\u5206\u9875\u5c01\u88c5\u5bf9\u8c61 DataPaging&lt;AlarmRule&gt;&#xff0c;\u5305\u542b\u603b\u6570\u636e\u91cf\u3001\u5f53\u524d\u9875\u89c4\u5219\u5217\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5e94\u524d\u7aef\u63a5\u53e3&#xff1a;GET \/api\/alarmRule\/list\/page\u3002<\/p>\n<\/li>\n<p>\u5206\u7ec4 2&#xff1a;\u57fa\u7840\u5355\u8868 CRUD&#xff08;\u589e\u5220\u6539\u67e5\u57fa\u7840\u80fd\u529b&#xff09;<\/p>\n<p>\/\/ \u6839\u636e\u4e3b\u952eID\u67e5\u8be2\u5355\u6761\u544a\u8b66\u89c4\u5219\u57fa\u7840\u4fe1\u606f<br \/>\nAlarmRule getById(String id);<br \/>\n\/\/ \u67e5\u8be2\u5168\u91cf\u65e0\u5206\u9875\u89c4\u5219\u5217\u8868&#xff08;\u4e0b\u62c9\u5b57\u5178\u4f7f\u7528&#xff09;<br \/>\nList&lt;AlarmRule&gt; getAll();<br \/>\n\/\/ \u65b0\u589e\u544a\u8b66\u89c4\u5219<br \/>\nboolean add(AlarmRule alarmRule);<br \/>\n\/\/ \u66f4\u65b0\u544a\u8b66\u89c4\u5219<br \/>\nboolean update(AlarmRule alarmRule);<br \/>\n\/\/ \u6839\u636e\u4e3b\u952e\u5220\u9664\u544a\u8b66\u89c4\u5219<br \/>\nboolean deleteById(String id);<\/p>\n<li>\n<p>\u8fd4\u56de\u503c boolean&#xff1a;\u6807\u8bc6\u6570\u636e\u5e93\u64cd\u4f5c\u662f\u5426\u751f\u6548&#xff08;\u53d7\u5f71\u54cd\u884c\u6570 &gt; 0 \u5219\u8fd4\u56de true&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u573a\u666f&#xff1a;\u65b0\u589e \/ \u7f16\u8f91 \/ \u5220\u9664\u5f39\u7a97\u3001\u5355\u6761\u8be6\u60c5\u56de\u663e\u3001\u4e0b\u62c9\u9009\u62e9\u6846\u52a0\u8f7d\u5168\u90e8\u89c4\u5219&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5e94\u63a5\u53e3&#xff1a;\/{id}\u3001\/all\u3001\/add\u3001\/update\u3001DELETE \/{id}\u3002<\/p>\n<\/li>\n<p>\u5206\u7ec4 3&#xff1a;\u6309\u6307\u5b9a\u6761\u4ef6\u6279\u91cf\u7b5b\u9009\u67e5\u8be2&#xff08;\u9875\u9762\u7b5b\u9009\u3001\u5173\u8054\u67e5\u8be2&#xff09;<\/p>\n<p>\/\/ \u6839\u636e\u542f\u7528\/\u505c\u7528\u72b6\u6001\u7b5b\u9009\u89c4\u5219\u5217\u8868<br \/>\nList&lt;AlarmRule&gt; getByStatus(String status);<br \/>\n\/\/ \u6839\u636e\u6307\u6807ID&#xff0c;\u67e5\u8be2\u7ed1\u5b9a\u8be5\u6307\u6807\u7684\u6240\u6709\u544a\u8b66\u89c4\u5219<br \/>\nList&lt;AlarmRule&gt; getByMetricId(String metricId);<br \/>\n\/\/ \u6839\u636e\u7b97\u6cd5ID&#xff0c;\u67e5\u8be2\u7ed1\u5b9a\u8be5\u8ba1\u7b97\u7b97\u6cd5\u7684\u6240\u6709\u544a\u8b66\u89c4\u5219<br \/>\nList&lt;AlarmRule&gt; getByAlgorithmId(String algorithmId);<br \/>\n\/\/ \u6839\u636e\u544a\u8b66\u6a21\u578bID&#xff0c;\u67e5\u8be2\u8be5\u6a21\u578b\u4e0b\u7ed1\u5b9a\u7684\u5168\u90e8\u544a\u8b66\u89c4\u5219<br \/>\nList&lt;AlarmRule&gt; getRulesByModelId(String modelId);<\/p>\n<p>\u9010\u4e2a\u4e1a\u52a1\u573a\u666f\u8bf4\u660e<\/p>\n<li>\n<p>getByStatus&#xff1a;\u524d\u7aef\u5217\u8868\u72b6\u6001\u7b5b\u9009\u4e0b\u62c9&#xff0c;\u53ea\u5c55\u793a\u542f\u7528 \/ \u505c\u7528\u89c4\u5219&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getByMetricId&#xff1a;\u6307\u6807\u7ba1\u7406\u9875\u9762&#xff0c;\u67e5\u770b\u5f53\u524d\u6307\u6807\u7ed1\u5b9a\u4e86\u54ea\u4e9b\u544a\u8b66\u5224\u65ad\u89c4\u5219&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getByAlgorithmId&#xff1a;\u7b97\u6cd5\u8ba1\u7b97\u5f15\u64ce\u9875\u9762&#xff0c;\u7b5b\u9009\u4f7f\u7528\u8be5\u7b97\u6cd5\u7684\u544a\u8b66\u89c4\u5219&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getRulesByModelId\u3010\u6838\u5fc3\u5173\u8054\u65b9\u6cd5\u3011&#xff1a;\u544a\u8b66\u6a21\u578b\u8be6\u60c5\u9875\u9762\u3001\u89c4\u5219\u6811\u7ec4\u88c5\u903b\u8f91\u4e13\u7528&#xff0c;\u6839\u636e\u6a21\u578b ID \u67e5\u8be2\u6a21\u578b\u7ed1\u5b9a\u7684\u6240\u6709\u89c4\u5219&#xff0c;\u5bf9\u5e94\u524d\u6587 AlarmModelServiceImpl \u4e2d\u6811\u5f62\u89c4\u5219\u7ec4\u88c5\u4e1a\u52a1\u3002<\/p>\n<\/li>\n<p>\u4e09\u3001\u63a5\u53e3\u4e0e Controller \u5c42\u5b8c\u6574\u6620\u5c04\u5bf9\u7167\u8868<\/p>\n<table>\n<tr>\n<p>Service \u63a5\u53e3\u65b9\u6cd5<\/p>\n<p>\u540e\u7aef API \u5730\u5740<\/p>\n<p>\u524d\u7aef\u4e1a\u52a1\u573a\u666f<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>selectPagingAlarmRuleList<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmRule\/list\/page<\/p>\n<\/td>\n<td>\n<p>\u544a\u8b66\u89c4\u5219\u7ba1\u7406\u5217\u8868\u5206\u9875\u591a\u6761\u4ef6\u7b5b\u9009<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getById<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmRule\/{id}<\/p>\n<\/td>\n<td>\n<p>\u7f16\u8f91\u5f39\u7a97\u56de\u663e\u5355\u6761\u89c4\u5219\u8be6\u60c5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getAll<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmRule\/all<\/p>\n<\/td>\n<td>\n<p>\u4e0b\u62c9\u9009\u62e9\u6846\u52a0\u8f7d\u5168\u90e8\u544a\u8b66\u89c4\u5219<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>add<\/p>\n<\/td>\n<td>\n<p>POST \/api\/alarmRule\/add<\/p>\n<\/td>\n<td>\n<p>\u65b0\u589e\u544a\u8b66\u89c4\u5219\u5f39\u7a97\u63d0\u4ea4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>update<\/p>\n<\/td>\n<td>\n<p>PUT \/api\/alarmRule\/update<\/p>\n<\/td>\n<td>\n<p>\u7f16\u8f91\u89c4\u5219\u8868\u5355\u63d0\u4ea4\u66f4\u65b0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>deleteById<\/p>\n<\/td>\n<td>\n<p>DELETE \/api\/alarmRule\/{id}<\/p>\n<\/td>\n<td>\n<p>\u5217\u8868\u5220\u9664\u6309\u94ae\u64cd\u4f5c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByStatus<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmRule\/byStatus<\/p>\n<\/td>\n<td>\n<p>\u5217\u8868\u6309\u542f\u7528 \/ \u505c\u7528\u72b6\u6001\u8fc7\u6ee4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByMetricId<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmRule\/byMetricId<\/p>\n<\/td>\n<td>\n<p>\u6307\u6807\u9875\u9762\u67e5\u770b\u5173\u8054\u544a\u8b66\u89c4\u5219<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByAlgorithmId<\/p>\n<\/td>\n<td>\n<p>\u5185\u90e8\u4e1a\u52a1\u8c03\u7528<\/p>\n<\/td>\n<td>\n<p>\u7b97\u6cd5\u7ba1\u7406\u9875\u9762\u7b5b\u9009\u5173\u8054\u89c4\u5219<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getRulesByModelId<\/p>\n<\/td>\n<td>\n<p>\u5185\u90e8\u4e1a\u52a1\u8c03\u7528<\/p>\n<\/td>\n<td>\n<p>\u544a\u8b66\u6a21\u578b\u8be6\u60c5\u7ec4\u88c5\u89c4\u5219\u6811<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u56db\u3001\u63a5\u53e3\u8bbe\u8ba1\u4eae\u70b9<\/p>\n<li>\n<p>\u65b9\u6cd5\u7c92\u5ea6\u5212\u5206\u6e05\u6670&#xff0c;\u5355\u4e00\u804c\u8d23<\/p>\n<ul>\n<li>\n<p>\u5206\u9875\u67e5\u8be2\u72ec\u7acb\u65b9\u6cd5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u57fa\u7840 CRUD \u62c6\u5206\u72ec\u7acb&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5404\u7c7b\u5173\u8054\u7b5b\u9009\u5355\u72ec\u62bd\u65b9\u6cd5&#xff0c;\u4e00\u4e2a\u65b9\u6cd5\u53ea\u5904\u7406\u4e00\u7c7b\u67e5\u8be2&#xff0c;\u590d\u7528\u6027\u6781\u9ad8&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u5173\u8054\u94fe\u8def\u5b8c\u6574&#xff0c;\u8d34\u5408\u6574\u4f53 ZNYW \u4e1a\u52a1 \u8986\u76d6\u300c\u6307\u6807\u2192\u89c4\u5219\u2192\u7b97\u6cd5\u2192\u544a\u8b66\u6a21\u578b\u300d\u5b8c\u6574\u4e1a\u52a1\u5173\u8054\u94fe\u8def&#xff0c;\u652f\u6491\u544a\u8b66\u6a21\u578b\u89c4\u5219\u6811\u7ec4\u88c5\u3001\u591a\u9875\u9762\u5173\u8054\u67e5\u8be2&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6ce8\u91ca\u89c4\u8303\u7edf\u4e00 \u5173\u952e\u5173\u8054\u65b9\u6cd5 getRulesByModelId \u6dfb\u52a0 JavaDoc \u6ce8\u91ca&#xff0c;\u6e05\u6670\u8bf4\u660e\u65b9\u6cd5\u7528\u9014&#xff0c;\u964d\u4f4e\u56e2\u961f\u534f\u4f5c\u9605\u8bfb\u6210\u672c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u53c2\u6570\u8bbe\u8ba1\u7075\u6d3b \u5206\u9875\u67e5\u8be2\u4f7f\u7528 Map&lt;String,Object&gt; \u627f\u8f7d\u52a8\u6001\u7b5b\u9009\u6761\u4ef6&#xff0c;\u540e\u7eed\u65b0\u589e\u7b5b\u9009\u5b57\u6bb5\u65e0\u9700\u4fee\u6539\u65b9\u6cd5\u7b7e\u540d&#xff0c;\u6269\u5c55\u6027\u5f3a\u3002<\/p>\n<\/li>\n<p>\u4e94\u3001\u4f18\u5316\u5efa\u8bae<\/p>\n<li>\n<p>\u52a8\u6001\u5206\u9875\u53c2\u6570 Map&lt;String,Object&gt; \u65e0\u7c7b\u578b\u7ea6\u675f&#xff0c;\u590d\u6742\u573a\u666f\u53ef\u65b0\u589e\u4e13\u7528\u5206\u9875 DTO \u5b9e\u4f53\u66ff\u6362 Map&#xff0c;\u5b9e\u73b0\u5f3a\u7c7b\u578b\u6821\u9a8c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u53ef\u8865\u5145\u6279\u91cf\u64cd\u4f5c\u63a5\u53e3&#xff08;\u6279\u91cf\u65b0\u589e\u3001\u6279\u91cf\u5220\u9664&#xff09;&#xff0c;\u9002\u914d\u524d\u7aef\u6279\u91cf\u5904\u7406\u573a\u666f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u72b6\u6001\u3001\u8fd0\u7b97\u7b26\u3001\u5b57\u6bb5\u540d\u7b49\u9b54\u6cd5\u5b57\u7b26\u4e32&#xff0c;\u5efa\u8bae\u7edf\u4e00\u62bd\u79bb\u5e38\u91cf\u7c7b&#xff0c;\u6d88\u9664\u786c\u7f16\u7801&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u53ef\u65b0\u589e\u552f\u4e00\u6027\u6821\u9a8c\u65b9\u6cd5&#xff08;\u5982\u6839\u636e ruleCode \u67e5\u8be2\u89c4\u5219&#xff0c;\u7528\u4e8e\u65b0\u589e\u65f6\u6821\u9a8c\u7f16\u7801\u91cd\u590d&#xff09;\u3002<\/p>\n<\/li>\n<h4>AlarmRuleServiceImpl.java<\/h4>\n<p>\u672c\u7c7b\u662f AlarmRuleService \u63a5\u53e3\u7684\u5b8c\u6574\u4e1a\u52a1\u5b9e\u73b0&#xff0c;\u5206\u5c42\u67b6\u6784&#xff1a;Controller \u2192 AlarmRuleService(\u63a5\u53e3) \u2192 AlarmRuleServiceImpl(\u5b9e\u73b0) \u2192 AlarmRuleMapper&#xff1b; \u8d1f\u8d23\u5206\u9875\u591a\u6761\u4ef6\u67e5\u8be2\u3001\u65b0\u589e \/ \u66f4\u65b0\u6570\u636e\u5b57\u6bb5\u515c\u5e95\u6821\u9a8c\u3001\u5404\u7c7b\u5173\u8054\u7b5b\u9009\u67e5\u8be2\u3001\u5f02\u5e38\u5bb9\u9519&#xff0c;\u548c\u524d\u9762 AlarmModelServiceImpl \u7f16\u7801\u89c4\u8303\u3001\u5b89\u5168\u8bbe\u8ba1\u601d\u8def\u5b8c\u5168\u7edf\u4e00\u3002<\/p>\n<p>\u4e00\u3001\u57fa\u7840\u5934\u90e8\u4e0e\u7c7b\u7ed3\u6784<\/p>\n<p>1. \u5305\u3001\u5bfc\u5165\u3001\u7c7b\u6ce8\u89e3<\/p>\n<p>package cn.com.sinopec.bussiness.znyw.serviceImpl;<\/p>\n<p>&#064;Service<br \/>\npublic class AlarmRuleServiceImpl implements AlarmRuleService {<br \/>\n    &#064;Autowired<br \/>\n    private AlarmRuleMapper alarmRuleMapper;<br \/>\n}<\/p>\n<li>\n<p>&#064;Service&#xff1a;Spring \u5c06\u5f53\u524d\u7c7b\u6ce8\u518c\u4e3a\u4e1a\u52a1\u5c42 Bean&#xff0c;\u4e0a\u5c42 Controller \u53ef\u901a\u8fc7\u63a5\u53e3\u6ce8\u5165&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u81ea\u52a8\u6ce8\u5165 AlarmRuleMapper&#xff1a;\u76f4\u63a5\u64cd\u4f5c\u8fbe\u68a6\u6570\u636e\u5e93\u544a\u8b66\u89c4\u5219\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u73b0 AlarmRuleService \u63a5\u53e3&#xff0c;\u5f3a\u5236\u5b9e\u73b0\u63a5\u53e3\u5168\u90e8\u65b9\u6cd5\u3002<\/p>\n<\/li>\n<p>2. \u5173\u952e\u5bfc\u5165\u7c7b\u8bf4\u660e<\/p>\n<ul>\n<li>\n<p>DataPaging&#xff1a;\u9879\u76ee\u7edf\u4e00\u5206\u9875\u5c01\u88c5\u5bf9\u8c61&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmRule&#xff1a;\u544a\u8b66\u89c4\u5219\u6570\u636e\u5e93\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>UUID&#xff1a;\u540e\u7aef\u751f\u6210\u4e3b\u952e ID&#xff1b;<\/p>\n<\/li>\n<li>\n<p>BigDecimal&#xff1a;\u9608\u503c\u6570\u503c\u7c7b\u578b&#xff0c;\u7528\u4e8e\u533a\u95f4 \/ \u5355\u6761\u4ef6\u9608\u503c\u515c\u5e95&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u96c6\u5408\u5de5\u5177&#xff1a;HashMap\u3001ArrayList \u7528\u4e8e\u53c2\u6570\u5c01\u88c5\u3001\u7a7a\u5217\u8868\u515c\u5e95\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e8c\u3001\u6838\u5fc3\u65b9\u6cd5 1&#xff1a;\u5206\u9875\u591a\u6761\u4ef6\u67e5\u8be2 selectPagingAlarmRuleList<\/p>\n<p>\u6838\u5fc3\u4f5c\u7528<\/p>\n<p>\u524d\u7aef\u544a\u8b66\u89c4\u5219\u5217\u8868\u5206\u9875\u7b5b\u9009&#xff0c;\u652f\u6301\u89c4\u5219\u540d\u79f0\u3001\u7f16\u7801\u3001\u72b6\u6001\u3001\u6307\u6807 ID\u3001\u6761\u4ef6\u7c7b\u578b\u3001\u8fd0\u7b97\u7b26\u591a\u7ef4\u5ea6\u8fc7\u6ee4&#xff0c;\u5185\u7f6e\u5927\u91cf\u5bb9\u9519\u5904\u7406&#xff0c;\u907f\u514d\u7a7a\u6307\u9488\u3001\u65e0\u6548 SQL\u3002<\/p>\n<p>\u5206\u6b65\u903b\u8f91\u62c6\u89e3<\/p>\n<li>\n<p>\u5224\u7a7a\u4fdd\u62a4&#xff0c;\u9632\u6b62\u7a7a\u6307\u9488<\/p>\n<p> if (paramMap &#061;&#061; null) {<br \/>\n    paramMap &#061; new HashMap&lt;&gt;();<br \/>\n}<\/p>\n<p>\u9632\u6b62\u524d\u7aef\u4e0d\u4f20\u4efb\u4f55\u7b5b\u9009\u53c2\u6570\u65f6&#xff0c;Map \u4e3a null \u5bfc\u81f4 getOrDefault \u62a5\u9519\u3002<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u63d0\u53d6\u3001\u6e05\u6d17\u5168\u90e8\u7b5b\u9009\u53c2\u6570 \u5b8c\u6574\u8986\u76d6\u524d\u7aef\u6240\u6709\u7b5b\u9009\u5b57\u6bb5&#xff1a;ruleName\u3001ruleCode\u3001status\u3001metricId\u3001conditionType\u3001operator&#xff1b; \u5168\u90e8\u6267\u884c trim() \u53bb\u9664\u9996\u5c3e\u7a7a\u683c&#xff0c;\u907f\u514d\u7a7a\u683c\u5e72\u6270\u7cbe\u786e\u5339\u914d\u3002<\/p>\n<\/li>\n<li>\n<p>\u7a7a\u5b57\u7b26\u4e32\u8f6c null&#xff08;MyBatis SQL \u4f18\u5316\u6838\u5fc3&#xff09;<\/p>\n<p> ruleName &#061; ruleName.isEmpty() ? null : ruleName;<\/p>\n<p>\u7a7a\u5b57\u7b26\u4e32\u8f6c\u4e3a null&#xff0c;MyBatis \u52a8\u6001 SQL \u4f1a\u81ea\u52a8\u8df3\u8fc7\u8be5\u67e5\u8be2\u6761\u4ef6&#xff0c;\u4e0d\u4f1a\u62fc\u63a5 AND rule_name LIKE &#039;&#039; \u8fd9\u79cd\u65e0\u6548\u67e5\u8be2&#xff0c;\u907f\u514d\u67e5\u8be2\u7ed3\u679c\u7f3a\u5931\u3002<\/p>\n<\/li>\n<li>\n<p>\u5206\u9875\u53c2\u6570\u5bb9\u9519<\/p>\n<p> int validPage &#061; page &lt;&#061; 0 ? 1 : page;<br \/>\nint validRow &#061; row &lt;&#061; 0 ? 10 : row;<br \/>\nint offset &#061; (validPage &#8211; 1) * validRow;<\/p>\n<p>\u524d\u7aef\u4f20\u5165\u975e\u6cd5\u9875\u7801 \/ \u6bcf\u9875\u6761\u6570&#xff08;\u8d1f\u6570\u30010&#xff09;\u65f6\u81ea\u52a8\u4fee\u6b63&#xff0c;\u9632\u6b62\u6570\u636e\u5e93 limit offset,row \u8bed\u6cd5\u62a5\u9519\u3002<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 Mapper \u6267\u884c\u5206\u9875\u67e5\u8be2 &#043; \u603b\u6570\u7edf\u8ba1<\/p>\n<ul>\n<li>\n<p>manualSelectAlarmRule&#xff1a;\u5206\u9875\u67e5\u8be2\u5f53\u524d\u9875\u6570\u636e&#xff0c;\u4f20\u9012\u5168\u90e8\u7b5b\u9009\u53c2\u6570&#xff1b;<\/p>\n<\/li>\n<li>\n<p>manualCountAlarmRule&#xff1a;\u7edf\u8ba1\u7b26\u5408\u6761\u4ef6\u603b\u6761\u6570&#xff0c;\u5fc5\u987b\u548c\u67e5\u8be2\u53c2\u6570\u5b8c\u5168\u4e00\u81f4&#xff0c;\u4fdd\u8bc1\u5206\u9875\u603b\u6761\u6570\u548c\u5217\u8868\u5339\u914d\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5206\u9875\u7ed3\u679c\u515c\u5e95\u5c01\u88c5<\/p>\n<p> dataPaging.setRows(rows !&#061; null ? rows : new ArrayList&lt;&gt;());<\/p>\n<p>\u82e5 Mapper \u67e5\u8be2\u8fd4\u56de null \u5217\u8868&#xff0c;\u66ff\u6362\u4e3a\u7a7a\u96c6\u5408&#xff0c;\u907f\u514d\u524d\u7aef\u904d\u5386\u5217\u8868\u65f6\u7a7a\u6307\u9488\u5f02\u5e38\u3002<\/p>\n<\/li>\n<p>\u4e09\u3001\u6838\u5fc3\u65b9\u6cd5 2&#xff1a;\u65b0\u589e\u544a\u8b66\u89c4\u5219 add (AlarmRule alarmRule)<\/p>\n<p>\u6838\u5fc3\u8bbe\u8ba1&#xff1a;\u540e\u7aef\u5f3a\u5236\u7ba1\u63a7\u4e3b\u952e\u3001\u65f6\u95f4\u3001\u9608\u503c\u3001\u8fd0\u7b97\u7b26\u5b57\u6bb5&#xff0c;\u675c\u7edd\u524d\u7aef\u810f\u6570\u636e<\/p>\n<li>\n<p>\u540e\u7aef\u751f\u6210\u552f\u4e00\u4e3b\u952e ID<\/p>\n<p> String uuid &#061; UUID.randomUUID().toString().replace(&#034;-&#034;, &#034;&#034;);<br \/>\nalarmRule.setId(uuid);<\/p>\n<p>\u5b8c\u5168\u5ffd\u7565\u524d\u7aef\u4f20\u5165\u7684 ID&#xff0c;UUID \u53bb\u9664\u6a2a\u6760\u4f5c\u4e3a\u4e3b\u952e&#xff0c;\u9632\u6b62\u4e3b\u952e\u51b2\u7a81\u3001\u524d\u7aef\u968f\u610f\u7be1\u6539\u4e3b\u952e\u3002<\/p>\n<\/li>\n<li>\n<p>\u533a\u5206\u6761\u4ef6\u7c7b\u578b&#xff08;range \u533a\u95f4 \/single \u5355\u9608\u503c&#xff09;&#xff0c;\u515c\u5e95\u586b\u5145\u8fd0\u7b97\u7b26 operator<\/p>\n<ul>\n<li>\n<p>\u533a\u95f4\u6761\u4ef6 range&#xff1a;\u8fd0\u7b97\u7b26\u65e0\u610f\u4e49&#xff0c;\u5f3a\u5236\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32&#xff0c;\u907f\u514d\u6570\u636e\u5e93\u5b57\u6bb5\u4e3a null&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5355\u9608\u503c single&#xff1a;\u524d\u7aef\u672a\u4f20\u8fd0\u7b97\u7b26\u65f6&#xff0c;\u515c\u5e95\u8d4b\u503c\u7a7a\u5b57\u7b26\u4e32&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u9608\u503c thresholdValue \u6570\u503c\u515c\u5e95&#xff08;BigDecimal \u7c7b\u578b\u4e0d\u80fd\u4e3a null&#xff09;<\/p>\n<ul>\n<li>\n<p>\u533a\u95f4\u6761\u4ef6&#xff1a;\u5355\u4e00\u9608\u503c\u65e0\u4e1a\u52a1\u610f\u4e49&#xff0c;\u5f3a\u5236\u8d4b\u503c BigDecimal.ZERO&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5355\u9608\u503c\u6761\u4ef6&#xff1a;\u524d\u7aef\u672a\u4f20\u9608\u503c\u65f6\u515c\u5e95 0&#xff0c;\u907f\u514d\u6570\u636e\u5e93 decimal \u5b57\u6bb5 null \u62a5\u9519\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u586b\u5145\u65f6\u95f4\u6233<\/p>\n<p> Date now &#061; new Date();<br \/>\nalarmRule.setCreatedTime(now);<br \/>\nalarmRule.setUpdateTime(now);<\/p>\n<p>\u521b\u5efa\u65f6\u95f4\u3001\u66f4\u65b0\u65f6\u95f4\u5168\u90e8\u7531\u540e\u7aef\u751f\u6210&#xff0c;\u4e0d\u4f9d\u8d56\u524d\u7aef\u4f20\u53c2&#xff0c;\u4fdd\u8bc1\u6570\u636e\u65f6\u95f4\u51c6\u786e\u3002<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u5e93\u63d2\u5165 &#043; \u5f02\u5e38\u6355\u83b7 try-catch \u5305\u88f9\u6570\u636e\u5e93\u64cd\u4f5c&#xff0c;\u51fa\u73b0 SQL \u5f02\u5e38\u3001\u7c7b\u578b\u8f6c\u6362\u5f02\u5e38\u65f6\u6253\u5370\u5806\u6808\u5e76\u8fd4\u56de false&#xff0c;\u4e0d\u4f1a\u629b\u51fa\u5f02\u5e38\u4e2d\u65ad\u4e0a\u5c42\u903b\u8f91\u3002<\/p>\n<\/li>\n<p>\u56db\u3001\u6838\u5fc3\u65b9\u6cd5 3&#xff1a;\u66f4\u65b0\u544a\u8b66\u89c4\u5219 update (AlarmRule alarmRule)<\/p>\n<p>\u903b\u8f91\u548c add \u9ad8\u5ea6\u7edf\u4e00&#xff0c;\u4e13\u6ce8\u66f4\u65b0\u573a\u666f\u5b57\u6bb5\u515c\u5e95 &#043; \u5237\u65b0\u66f4\u65b0\u65f6\u95f4&#xff1a;<\/p>\n<li>\n<p>\u540c\u6837\u533a\u5206 range\/single \u6761\u4ef6\u7c7b\u578b&#xff0c;\u5bf9 operator\u3001thresholdValue \u505a\u975e null \u515c\u5e95&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5f3a\u5236\u5237\u65b0\u66f4\u65b0\u65f6\u95f4&#xff1a;alarmRule.setUpdateTime(new Date());&#xff0c;\u8bb0\u5f55\u6700\u540e\u4fee\u6539\u65f6\u95f4&#xff1b;<\/p>\n<\/li>\n<li>\n<p>try-catch \u5f02\u5e38\u6355\u83b7&#xff0c;\u64cd\u4f5c\u5931\u8d25\u8fd4\u56de false\u3002<\/p>\n<\/li>\n<p>\u4e94\u3001\u57fa\u7840 CRUD \u7b80\u5355\u65b9\u6cd5<\/p>\n<p>1. \u5355\u6761 \/ \u5168\u91cf\u67e5\u8be2\u3001\u5220\u9664<\/p>\n<p>&#064;Override<br \/>\npublic AlarmRule getById(String id) {<br \/>\n    return alarmRuleMapper.selectById(id);<br \/>\n}<br \/>\n&#064;Override<br \/>\npublic List&lt;AlarmRule&gt; getAll() {<br \/>\n    return alarmRuleMapper.selectAll();<br \/>\n}<br \/>\n&#064;Override<br \/>\npublic boolean deleteById(String id) {<br \/>\n    return alarmRuleMapper.deleteById(id) &gt; 0;<br \/>\n}<\/p>\n<ul>\n<li>\n<p>\u76f4\u63a5\u8c03\u7528 Mapper \u57fa\u7840 SQL&#xff0c;\u903b\u8f91\u6781\u7b80&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5220\u9664\u5224\u65ad &gt;0&#xff1a;\u4ec5\u5f53\u6570\u636e\u5e93\u771f\u5b9e\u5220\u9664\u6570\u636e\u65f6\u8fd4\u56de true&#xff0c;\u65e0\u5339\u914d\u6570\u636e\u8fd4\u56de false\u3002<\/p>\n<\/li>\n<\/ul>\n<p>2. \u5404\u7c7b\u6761\u4ef6\u7b5b\u9009\u67e5\u8be2<\/p>\n<p>&#064;Override<br \/>\npublic List&lt;AlarmRule&gt; getByStatus(String status) {<br \/>\n    return alarmRuleMapper.selectByStatus(status);<br \/>\n}<br \/>\n&#064;Override<br \/>\npublic List&lt;AlarmRule&gt; getByMetricId(String metricId) {<br \/>\n    return alarmRuleMapper.selectByMetricId(metricId);<br \/>\n}<br \/>\n&#064;Override<br \/>\npublic List&lt;AlarmRule&gt; getByAlgorithmId(String algorithmId) {<br \/>\n    return alarmRuleMapper.selectByAlgorithmId(algorithmId);<br \/>\n}<\/p>\n<p>\u5206\u522b\u6309\u72b6\u6001\u3001\u6307\u6807 ID\u3001\u7b97\u6cd5 ID\u7b5b\u9009\u89c4\u5219\u5217\u8868&#xff0c;\u4f9b\u524d\u7aef\u7b5b\u9009\u3001\u6307\u6807 \/ \u7b97\u6cd5\u8be6\u60c5\u9875\u5173\u8054\u67e5\u8be2\u3002<\/p>\n<p>\u516d\u3001\u5173\u8054\u6838\u5fc3\u65b9\u6cd5&#xff1a;getRulesByModelId (String modelId)<\/p>\n<p>\u4e1a\u52a1\u7528\u9014<\/p>\n<p>\u6839\u636e\u544a\u8b66\u6a21\u578b ID&#xff0c;\u67e5\u8be2\u8be5\u6a21\u578b\u7ed1\u5b9a\u7684\u5168\u90e8\u544a\u8b66\u89c4\u5219&#xff1b; \u5bf9\u5e94\u524d\u6587 AlarmModelServiceImpl \u4e2d\u89c4\u5219\u6811\u7ec4\u88c5\u903b\u8f91&#xff0c;\u662f\u6a21\u578b\u4e0e\u89c4\u5219\u5173\u8054\u7684\u6838\u5fc3\u67e5\u8be2\u65b9\u6cd5\u3002<\/p>\n<p>\u5bb9\u9519\u8bbe\u8ba1<\/p>\n<p>try-catch \u6355\u83b7\u6570\u636e\u5e93\u67e5\u8be2\u5f02\u5e38&#xff0c;\u5f02\u5e38\u65f6\u76f4\u63a5\u8fd4\u56de\u7a7a ArrayList&#xff0c;\u907f\u514d\u524d\u7aef\u9875\u9762\u6e32\u67d3\u7a7a\u6307\u9488\u3002<\/p>\n<p>\u4e03\u3001\u4ee3\u7801\u8bbe\u8ba1\u4eae\u70b9\u603b\u7ed3<\/p>\n<p>1. \u6781\u81f4\u7684\u7a7a\u6307\u9488\u3001\u975e\u6cd5\u53c2\u6570\u5bb9\u9519<\/p>\n<ul>\n<li>\n<p>\u5206\u9875\u53c2\u6570 Map \u5224\u7a7a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5206\u9875\u9875\u7801\u3001\u6761\u6570\u81ea\u52a8\u4fee\u6b63&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u67e5\u8be2\u7a7a\u5b57\u7b26\u4e32\u8f6c null \u4f18\u5316 SQL&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u67e5\u8be2\u5217\u8868\u4e3a null \u65f6\u66ff\u6362\u7a7a\u96c6\u5408&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5173\u8054\u67e5\u8be2\u5f02\u5e38\u8fd4\u56de\u7a7a\u5217\u8868\u3002<\/p>\n<\/li>\n<\/ul>\n<p>2. \u6570\u636e\u5b89\u5168\u7ba1\u63a7&#xff08;\u65b0\u589e \/ \u66f4\u65b0\u5f3a\u7ea6\u675f&#xff09;<\/p>\n<li>\n<p>\u4e3b\u952e ID \u5b8c\u5168\u540e\u7aef\u751f\u6210&#xff0c;\u524d\u7aef\u65e0\u6cd5\u5e72\u9884&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa \/ \u66f4\u65b0\u65f6\u95f4\u7edf\u4e00\u540e\u7aef\u8d4b\u503c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u533a\u5206\u533a\u95f4 \/ \u5355\u9608\u503c\u4e24\u79cd\u4e1a\u52a1\u7c7b\u578b&#xff0c;\u5bf9\u8fd0\u7b97\u7b26\u3001\u9608\u503c\u505a\u5f3a\u5236\u975e null \u515c\u5e95&#xff0c;\u9002\u914d\u8fbe\u68a6 decimal\u3001varchar \u5b57\u6bb5\u975e\u7a7a\u7ea6\u675f&#xff0c;\u9632\u6b62\u5165\u5e93\u62a5\u9519\u3002<\/p>\n<\/li>\n<p>3. \u5206\u5c42\u804c\u8d23\u6e05\u6670<\/p>\n<ul>\n<li>\n<p>Controller&#xff1a;\u53ea\u63a5\u6536\u53c2\u6570\u3001\u8c03\u7528 Service&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Service \u63a5\u53e3&#xff1a;\u5b9a\u4e49\u6807\u51c6\u4e1a\u52a1\u80fd\u529b&#xff1b;<\/p>\n<\/li>\n<li>\n<p>ServiceImpl&#xff1a;\u5168\u90e8\u53c2\u6570\u6e05\u6d17\u3001\u5b57\u6bb5\u6821\u9a8c\u3001\u4e1a\u52a1\u5224\u65ad\u3001\u5bb9\u9519\u5904\u7406&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Mapper&#xff1a;\u4ec5\u6267\u884c SQL&#xff0c;\u65e0\u4efb\u4f55\u4e1a\u52a1\u903b\u8f91\u3002<\/p>\n<\/li>\n<\/ul>\n<p>4. \u9002\u914d\u5b8c\u6574\u4e1a\u52a1\u94fe\u8def<\/p>\n<p>\u8986\u76d6\u300c\u6307\u6807 ID\u2192\u89c4\u5219\u2192\u7b97\u6cd5 ID\u2192\u544a\u8b66\u6a21\u578b\u300d\u5168\u94fe\u8def\u5173\u8054\u67e5\u8be2&#xff0c;\u652f\u6491\u544a\u8b66\u6a21\u578b\u89c4\u5219\u6811\u3001\u524d\u7aef\u591a\u9875\u9762\u7b5b\u9009\u3001\u8be6\u60c5\u5173\u8054\u5c55\u793a\u3002<\/p>\n<p>5. \u5f02\u5e38\u5904\u7406\u53cb\u597d<\/p>\n<p>\u6240\u6709\u5199\u5e93&#xff08;\u65b0\u589e\u3001\u66f4\u65b0&#xff09;\u3001\u5173\u8054\u67e5\u8be2\u5747\u5305\u88f9 try-catch&#xff0c;\u6253\u5370\u5f02\u5e38\u5806\u6808\u4fbf\u4e8e\u7ebf\u4e0a\u6392\u67e5&#xff0c;\u540c\u65f6\u8fd4\u56de\u5e03\u5c14 \/ \u7a7a\u5217\u8868\u4fdd\u8bc1\u4e0a\u5c42\u6d41\u7a0b\u4e0d\u4f1a\u5d29\u6e83\u3002<\/p>\n<p>\u516b\u3001\u53ef\u4f18\u5316\u6539\u8fdb\u5efa\u8bae<\/p>\n<li>\n<p>\u7f3a\u5c11\u4e8b\u52a1\u6ce8\u89e3 &#064;Transactional add\u3001update\u3001\u6279\u91cf\u5173\u8054\u64cd\u4f5c\u672a\u6dfb\u52a0\u4e8b\u52a1&#xff0c;\u591a\u8868\u8054\u52a8\u64cd\u4f5c\u5f02\u5e38\u65f6\u4f1a\u4ea7\u751f\u810f\u6570\u636e&#xff0c;\u5efa\u8bae\u6dfb\u52a0 &#064;Transactional(rollbackFor &#061; Exception.class)\u3002<\/p>\n<\/li>\n<li>\n<p>\u5f02\u5e38\u6253\u5370\u4f7f\u7528 e.printStackTrace () \u4e0d\u89c4\u8303 \u9879\u76ee\u5df2\u6709\u65e5\u5fd7\u6846\u67b6 Logger&#xff0c;\u66ff\u6362\u4e3a logger.error \u6253\u5370\u5f02\u5e38&#xff0c;\u53ef\u8f93\u51fa\u65e5\u5fd7\u6587\u4ef6\u3001\u94fe\u8def\u8ffd\u8e2a&#xff0c;\u63a7\u5236\u53f0\u5806\u6808\u4e0d\u5229\u4e8e\u7ebf\u4e0a\u6392\u67e5\u3002<\/p>\n<\/li>\n<li>\n<p>\u5927\u91cf\u786c\u7f16\u7801\u9b54\u6cd5\u5b57\u7b26\u4e32 range\u3001single \u6761\u4ef6\u7c7b\u578b\u3001\u5b57\u6bb5\u540d\u3001\u72b6\u6001\u503c\u5206\u6563\u786c\u7f16\u7801&#xff0c;\u5efa\u8bae\u62bd\u53d6\u5168\u5c40\u5e38\u91cf\u7c7b\u7edf\u4e00\u7ba1\u7406\u3002<\/p>\n<\/li>\n<li>\n<p>\u91cd\u590d\u7684 operator\u3001thresholdValue \u515c\u5e95\u903b\u8f91 add \u548c update \u65b9\u6cd5\u5b58\u5728\u5b8c\u5168\u91cd\u590d\u7684\u5b57\u6bb5\u515c\u5e95\u4ee3\u7801&#xff0c;\u53ef\u62bd\u79bb\u79c1\u6709\u5de5\u5177\u65b9\u6cd5\u590d\u7528&#xff0c;\u51cf\u5c11\u5197\u4f59\u4ee3\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>\u672a\u589e\u52a0\u7f16\u7801\u552f\u4e00\u6027\u6821\u9a8c \u65e0 getByRuleCode \u65b9\u6cd5&#xff0c;\u65b0\u589e\u89c4\u5219\u65f6\u65e0\u6cd5\u6821\u9a8c ruleCode \u91cd\u590d&#xff0c;\u6613\u51fa\u73b0\u7f16\u7801\u91cd\u590d\u5165\u5e93\u3002<\/p>\n<\/li>\n<li>\n<p>\u65e0\u6279\u91cf\u64cd\u4f5c\u5b9e\u73b0 \u7f3a\u5c11\u6279\u91cf\u65b0\u589e\u3001\u6279\u91cf\u5220\u9664\u89c4\u5219\u65b9\u6cd5&#xff0c;\u524d\u7aef\u6279\u91cf\u64cd\u4f5c\u53ea\u80fd\u5faa\u73af\u8c03\u7528\u5355\u6761\u63a5\u53e3&#xff0c;\u6027\u80fd\u8f83\u5dee\u3002<\/p>\n<\/li>\n<h4>AlarmRuleTreeUnifiedController.java<\/h4>\n<p>\u4e00\u3001\u6574\u4f53\u5b9a\u4f4d<\/p>\n<p>\u8be5\u63a7\u5236\u5668\u5bf9\u5e94\u544a\u8b66\u89c4\u5219\u6811\u5f62\u5b58\u50a8\u8868&#xff08;AlarmRuleTreeUnified&#xff09;&#xff0c;\u4e13\u95e8\u7ba1\u7406\u544a\u8b66\u6a21\u578b\u4e0b\u7684\u89c4\u5219\u6811\u8282\u70b9\u6570\u636e&#xff0c;\u548c\u524d\u9762 AlarmModelServiceImpl \u4e2d\u89c4\u5219\u6811\u540e\u5e8f\u904d\u5386\u3001\u7ec4\u88c5\u8be6\u60c5\u7684\u903b\u8f91\u914d\u5957\u3002 \u5206\u5c42\u94fe\u8def&#xff1a;\u524d\u7aef\u544a\u8b66\u6a21\u578b\u7f16\u8f91\u9875 \u2192 \u5f53\u524d Controller \u2192 AlarmRuleTreeUnifiedService \u2192 AlarmRuleTreeUnifiedMapper \u2192 \u8fbe\u68a6\u6570\u636e\u5e93\u6811\u5f62\u8282\u70b9\u8868\u3002<\/p>\n<p>\u4e8c\u3001\u5934\u90e8\u57fa\u7840\u4fe1\u606f<\/p>\n<p>1. \u5305\u7ed3\u6784<\/p>\n<p>package cn.com.xxx.bussiness.znyw.controller;<\/p>\n<p>\u548c\u544a\u8b66\u6a21\u578b\u3001\u544a\u8b66\u89c4\u5219\u63a7\u5236\u5668\u540c\u5305&#xff0c;\u5f52\u5c5e\u667a\u80fd\u8fd0\u7ef4 ZNYW \u6a21\u5757\u63a5\u53e3\u5c42\u3002<\/p>\n<p>2. \u5bfc\u5165\u4f9d\u8d56\u8bf4\u660e<\/p>\n<li>\n<p>\u4e1a\u52a1\u5c42&#xff1a;AlarmRuleTreeUnifiedService \u89c4\u5219\u6811\u4e1a\u52a1\u63a5\u53e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u4f53&#xff1a;AlarmRuleTreeUnified \u89c4\u5219\u6811\u8282\u70b9\u5b9e\u4f53&#xff08;\u5b58\u50a8\u6811\u5f62\u7236\u5b50\u5173\u7cfb\u3001\u8282\u70b9\u7c7b\u578b\u3001\u903b\u8f91\u8fd0\u7b97\u7b26\u3001\u6267\u884c\u987a\u5e8f\u7b49&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65e5\u5fd7&#xff1a;&#064;Slf4j lombok \u65e5\u5fd7\u6ce8\u89e3&#xff0c;\u66ff\u4ee3\u624b\u52a8\u521b\u5efa Logger&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Web \u6ce8\u89e3&#xff1a;RESTful \u63a5\u53e3\u6807\u51c6\u6ce8\u89e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bb9\u5668&#xff1a;HashMap\u3001List\u3001Map \u81ea\u5b9a\u4e49\u8fd4\u56de\u7ed3\u6784\u3002<\/p>\n<\/li>\n<p>3. \u7c7b\u6ce8\u89e3<\/p>\n<p>&#064;Slf4j<br \/>\n&#064;RestController<br \/>\n&#064;RequestMapping(&#034;\/api\/alarm-rule-tree-unified&#034;)<\/p>\n<li>\n<p>&#064;Slf4j&#xff1a;lombok \u81ea\u52a8\u6ce8\u5165\u65e5\u5fd7\u5bf9\u8c61 log&#xff0c;\u7b80\u5316\u65e5\u5fd7\u6253\u5370&#xff1b;<\/p>\n<\/li>\n<li>\n<p>&#064;RestController&#xff1a;\u63a5\u53e3\u81ea\u52a8\u8fd4\u56de JSON&#xff0c;\u65e0\u9700 &#064;ResponseBody&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40\u63a5\u53e3\u524d\u7f00 \/api\/alarm-rule-tree-unified \u5b8c\u6574\u8bf7\u6c42\u793a\u4f8b&#xff1a;GET http:\/\/127.0.0.1:8091\/api\/alarm-rule-tree-unified\/model\/xxx&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u81ea\u52a8\u6ce8\u5165 AlarmRuleTreeUnifiedService \u4e1a\u52a1\u5c42\u3002<\/p>\n<\/li>\n<p>\u4e09\u3001\u4e09\u4e2a\u63a5\u53e3\u9010\u884c\u62c6\u89e3<\/p>\n<p>\u63a5\u53e3 1&#xff1a;\u6e05\u7a7a\u5168\u90e8\u89c4\u5219\u6811\u6570\u636e DELETE \/api\/alarm-rule-tree-unified\/clear-all<\/p>\n<p>\u4e1a\u52a1\u4f5c\u7528<\/p>\n<p>\u6279\u91cf\u5220\u9664\u6574\u5f20\u89c4\u5219\u6811\u8868\u6240\u6709\u6570\u636e&#xff0c;\u591a\u7528\u4e8e\u6a21\u578b\u91cd\u5efa\u89c4\u5219\u6811\u3001\u6d4b\u8bd5\u73af\u5883\u91cd\u7f6e\u6570\u636e\u573a\u666f\u3002<\/p>\n<p>\u903b\u8f91\u6d41\u7a0b<\/p>\n<li>\n<p>\u521d\u59cb\u5316\u8fd4\u56de Map&#xff0c;\u7edf\u4e00\u7ed3\u6784&#xff1a;success&#xff08;\u5e03\u5c14&#xff09;\u3001message&#xff08;\u63d0\u793a\u6587\u672c&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 service deleteAll() \u6267\u884c\u5168\u8868\u5220\u9664&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6839\u636e\u5220\u9664\u7ed3\u679c\u586b\u5145\u6210\u529f\u63d0\u793a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40\u6355\u83b7\u5f02\u5e38&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4f7f\u7528 log.error \u6253\u5370\u5b8c\u6574\u5f02\u5e38\u5806\u6808&#xff08;\u5e26\u5f02\u5e38\u5bf9\u8c61 e&#xff0c;\u53ef\u8bb0\u5f55\u5806\u6808&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de success&#061;false &#043; \u5f02\u5e38\u4fe1\u606f\u7ed9\u524d\u7aef&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<p>\u63a5\u53e3 2&#xff1a;\u6839\u636e\u6a21\u578b ID \u67e5\u8be2\u6574\u68f5\u89c4\u5219\u6811 GET \/api\/alarm-rule-tree-unified\/model\/{modelId}<\/p>\n<p>\u6838\u5fc3\u4e1a\u52a1\u7528\u9014<\/p>\n<p>\u544a\u8b66\u6a21\u578b\u8be6\u60c5 \/ \u7f16\u8f91\u9875\u9762\u52a0\u8f7d\u5b8c\u6574\u89c4\u5219\u6811\u8282\u70b9&#xff0c;\u662f\u524d\u9762 AlarmModelServiceImpl \u7ec4\u88c5\u6a21\u578b\u8be6\u60c5\u3001\u89c4\u5219\u6392\u5e8f\u7684\u6570\u636e\u6e90\u3002<\/p>\n<p>\u903b\u8f91\u6d41\u7a0b<\/p>\n<li>\n<p>\u8def\u5f84\u53c2\u6570 modelId&#xff1a;\u544a\u8b66\u6a21\u578b\u4e3b\u952e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 service getByModelId(modelId)&#xff0c;\u8fd4\u56de\u8be5\u6a21\u578b\u4e0b\u5168\u90e8\u6811\u5f62\u8282\u70b9\u96c6\u5408&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de Map \u7ed3\u6784&#xff1a;<\/p>\n<ul>\n<li>\n<p>success&#xff1a;\u8bf7\u6c42\u6807\u8bc6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>data&#xff1a;\u6811\u5f62\u8282\u70b9 List&#xff08;\u524d\u7aef\u9012\u5f52\u6e32\u67d3\u89c4\u5219\u6811&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>message&#xff1a;\u64cd\u4f5c\u63d0\u793a&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5f02\u5e38\u6355\u83b7\u5e76\u8bb0\u5f55\u65e5\u5fd7&#xff0c;\u8fd4\u56de\u5931\u8d25\u4fe1\u606f\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 3&#xff1a;\u89c4\u5219\u6811\u6570\u636e\u7edf\u8ba1\u63a5\u53e3 GET \/api\/alarm-rule-tree-unified\/stats<\/p>\n<p>\u73b0\u72b6\u8bf4\u660e<\/p>\n<p>\u5c5e\u4e8e\u9884\u7559\u6269\u5c55\u63a5\u53e3&#xff0c;\u4e1a\u52a1\u7edf\u8ba1\u903b\u8f91\u5c1a\u672a\u5b9e\u73b0&#xff0c;\u4ec5\u9884\u7559\u63a5\u53e3\u9aa8\u67b6\u3002<\/p>\n<p>\u89c4\u5212\u53ef\u5b9e\u73b0\u7edf\u8ba1\u7ef4\u5ea6<\/p>\n<ul>\n<li>\n<p>\u89c4\u5219\u6811\u603b\u8282\u70b9\u6570\u91cf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6839\u8282\u70b9\u3001\u903b\u8f91\u8282\u70b9\u3001RULE \u89c4\u5219\u53f6\u5b50\u8282\u70b9\u5404\u81ea\u6570\u91cf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5404\u544a\u8b66\u6a21\u578b\u7ed1\u5b9a\u89c4\u5219\u6811\u6570\u91cf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5931\u6548 \/ \u5e9f\u5f03\u6811\u5f62\u8282\u70b9\u7edf\u8ba1&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<p>\u56db\u3001\u4ee3\u7801\u8bbe\u8ba1\u7279\u70b9<\/p>\n<p>1. \u7edf\u4e00\u81ea\u5b9a\u4e49\u8fd4\u56de\u7ed3\u6784&#xff08;\u672a\u4f7f\u7528\u5168\u5c40 JsonMessage&#xff09;<\/p>\n<p>\u524d\u9762\u544a\u8b66\u6a21\u578b\u3001\u544a\u8b66\u89c4\u5219\u63a7\u5236\u5668\u7edf\u4e00\u4f7f\u7528\u9879\u76ee\u5c01\u88c5 JsonMessage&lt;T&gt; \u6807\u51c6\u8fd4\u56de\u4f53&#xff1b; \u672c\u63a7\u5236\u5668\u81ea\u4e3b\u4f7f\u7528 HashMap \u5c01\u88c5\u8fd4\u56de&#xff0c;\u7ed3\u6784\u4e3a\u56fa\u5b9a\u4e09\u5b57\u6bb5&#xff1a;success\u3001message\u3001data&#xff08;\u6709\u6570\u636e\u65f6&#xff09;\u3002<\/p>\n<p>\u5dee\u5f02\u70b9&#xff1a;\u901a\u7528\u4e1a\u52a1 CRUD \u8d70\u5168\u5c40\u7edf\u4e00\u8fd4\u56de&#xff1b;\u6811\u5f62\u7279\u6b8a\u6279\u91cf\u64cd\u4f5c\u3001\u91cd\u7f6e\u63a5\u53e3\u81ea\u5b9a\u4e49\u7b80\u6613\u8fd4\u56de\u7ed3\u6784\u3002<\/p>\n<p>2. \u65e5\u5fd7\u89c4\u8303\u66f4\u5b8c\u5584<\/p>\n<p>\u4f7f\u7528 lombok &#064;Slf4j&#xff0c;\u5f02\u5e38\u6253\u5370\u4f20\u5165\u5b8c\u6574\u5f02\u5e38\u5bf9\u8c61 log.error(&#034;xxx\u5931\u8d25&#034;, e)&#xff0c;\u65e5\u5fd7\u6587\u4ef6\u4f1a\u8bb0\u5f55\u5b8c\u6574\u5f02\u5e38\u5806\u6808&#xff0c;\u7ebf\u4e0a\u6392\u67e5\u6811\u5f62 SQL\u3001\u6811\u5f62\u9012\u5f52\u67e5\u8be2\u62a5\u9519\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n<p>3. \u63a5\u53e3\u8bed\u4e49\u4e25\u683c\u9075\u5faa REST \u89c4\u8303<\/p>\n<ul>\n<li>\n<p>\u5168\u8868\u6e05\u7a7a&#xff1a;DELETE \u8bf7\u6c42&#xff08;\u6267\u884c\u5220\u9664\u64cd\u4f5c&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u67e5\u8be2\u6811\u5f62\u6570\u636e\u3001\u7edf\u8ba1\u6570\u636e&#xff1a;GET \u8bf7\u6c42&#xff08;\u53ea\u8bfb&#xff0c;\u65e0\u6570\u636e\u4fee\u6539&#xff09;&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<p>4. \u5f02\u5e38\u5bb9\u9519\u5168\u8986\u76d6<\/p>\n<p>\u4e09\u4e2a\u63a5\u53e3\u5168\u90e8\u5305\u88f9 try-catch&#xff0c;\u4efb\u4f55\u6570\u636e\u5e93\u5f02\u5e38\u3001\u6811\u5f62\u6570\u636e\u89e3\u6790\u5f02\u5e38\u4e0d\u4f1a\u76f4\u63a5\u629b\u51fa 500 \u9519\u8bef&#xff0c;\u7edf\u4e00\u8fd4\u56de\u524d\u7aef\u53ef\u8bfb\u7684\u5931\u8d25\u63d0\u793a&#xff0c;\u540c\u65f6\u843d\u5730\u65e5\u5fd7\u7559\u5b58\u95ee\u9898\u8bb0\u5f55\u3002<\/p>\n<p>\u4e94\u3001\u524d\u540e\u7aef\u4e1a\u52a1\u8054\u52a8\u5173\u7cfb<\/p>\n<p>\u524d\u7aef\u9875\u9762&#xff08;ZNYW \u667a\u80fd\u8fd0\u7ef4\u544a\u8b66\u6a21\u578b\u9875\u9762&#xff09;<\/p>\n<li>\n<p>\u7f16\u8f91\u544a\u8b66\u6a21\u578b&#xff0c;\u52a0\u8f7d\u5df2\u6709\u89c4\u5219\u6811&#xff1a;\u8c03\u7528 \/model\/{modelId}&#xff0c;\u62ff\u5230\u6240\u6709\u6811\u5f62\u8282\u70b9\u9012\u5f52\u6e32\u67d3\u524d\u7aef\u53ef\u89c6\u5316\u89c4\u5219\u6811&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u91cd\u5efa \/ \u91cd\u7f6e\u6a21\u578b\u89c4\u5219&#xff1a;\u8c03\u7528 \/clear-all \u6e05\u7a7a\u65e7\u6811\u5f62\u8282\u70b9&#xff0c;\u540e\u7aef\u91cd\u65b0\u751f\u6210\u89c4\u5219\u6811\u8282\u70b9&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u89c4\u5219\u6811\u6570\u636e\u770b\u677f&#xff1a;\u540e\u7eed\u5b8c\u5584 \/stats \u7edf\u8ba1\u63a5\u53e3&#xff0c;\u5c55\u793a\u89c4\u5219\u8282\u70b9\u6570\u91cf\u3001\u7ed3\u6784\u6307\u6807\u3002<\/p>\n<\/li>\n<p>\u540e\u7aef\u914d\u5957\u94fe\u8def<\/p>\n<li>\n<p>\u6570\u636e\u5e93&#xff1a;\u8fbe\u68a6 ZNYW \u5e93 t_alarm_rule_tree_unified \u89c4\u5219\u6811\u7edf\u4e00\u8282\u70b9\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8054\u52a8 AlarmModel \u6a21\u5757&#xff1a;AlarmModelServiceImpl.getByIdWithDetails() \u4f1a\u8c03\u7528\u672c\u6a21\u5757 Mapper \u67e5\u8be2\u6811\u5f62\u8282\u70b9&#xff0c;\u5b8c\u6210\u89c4\u5219\u540e\u5e8f\u6392\u5e8f\u3001\u7ec4\u88c5\u8be6\u60c5\u8fd4\u56de\u524d\u7aef&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u903b\u8f91&#xff1a;\u65b0\u589e \/ \u4fee\u6539\u544a\u8b66\u6a21\u578b\u914d\u7f6e\u65f6&#xff0c;\u540e\u7aef\u4f1a\u6279\u91cf\u63d2\u5165\u3001\u66f4\u65b0\u3001\u5220\u9664\u8be5 modelId \u5bf9\u5e94\u7684\u6811\u5f62\u8282\u70b9&#xff0c;\u672c\u63a7\u5236\u5668\u63d0\u4f9b\u624b\u52a8\u6e05\u7a7a\u3001\u67e5\u8be2\u6811\u5f62\u8282\u70b9\u7684\u8fd0\u7ef4\u63a5\u53e3\u3002<\/p>\n<\/li>\n<p>\u516d\u3001\u4f18\u5316\u5efa\u8bae<\/p>\n<p>1. \u7edf\u4e00\u9879\u76ee\u6807\u51c6\u8fd4\u56de\u4f53 JsonMessage<\/p>\n<p>\u5f53\u524d\u4f7f\u7528 HashMap \u81ea\u5b9a\u4e49\u8fd4\u56de&#xff0c;\u548c\u9879\u76ee\u5176\u4ed6\u63a7\u5236\u5668\u683c\u5f0f\u4e0d\u7edf\u4e00&#xff0c;\u524d\u7aef\u9700\u8981\u5199\u4e24\u5957\u89e3\u6790\u903b\u8f91\u3002 \u6539\u9020\u793a\u4f8b&#xff1a;<\/p>\n<p>return new JsonMessage&lt;List&lt;AlarmRuleTreeUnified&gt;&gt;().success(nodes);<\/p>\n<p>2. \u5168\u8868\u6e05\u7a7a\u63a5\u53e3\u589e\u52a0\u6743\u9650\u6821\u9a8c\u4e0e\u4e8c\u6b21\u786e\u8ba4\u53c2\u6570<\/p>\n<p>\/clear-all \u662f\u9ad8\u5371\u6279\u91cf\u5220\u9664\u63a5\u53e3&#xff0c;\u751f\u4ea7\u73af\u5883\u5b58\u5728\u8bef\u64cd\u4f5c\u98ce\u9669&#xff1a;<\/p>\n<li>\n<p>\u6dfb\u52a0\u6743\u9650\u6ce8\u89e3 &#064;PreAuthorize(&#034;hasRole(&#039;ADMIN&#039;)&#034;)&#xff0c;\u4ec5\u7ba1\u7406\u5458\u53ef\u8c03\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u589e\u52a0\u8bf7\u6c42\u53c2\u6570 &#064;RequestParam String confirm&#xff0c;\u524d\u7aef\u4f20\u5165confirm&#061;1\u624d\u6267\u884c\u5220\u9664&#xff0c;\u9632\u6b62\u8bef\u8c03\u7528\u3002<\/p>\n<\/li>\n<p>3. \u62bd\u79bb\u901a\u7528\u8fd4\u56de Map \u6784\u5efa\u5de5\u5177\u65b9\u6cd5<\/p>\n<p>\u4e09\u4e2a\u63a5\u53e3\u91cd\u590d\u521b\u5efa HashMap\u3001\u586b\u5145 success\/message\/data&#xff0c;\u53ef\u62bd\u79bb\u79c1\u6709\u5de5\u5177\u65b9\u6cd5\u7b80\u5316\u4ee3\u7801\u3002<\/p>\n<p>4. \u5b8c\u5584 stats \u7edf\u8ba1\u63a5\u53e3<\/p>\n<p>\u8865\u5145\u8282\u70b9\u5206\u7c7b\u7edf\u8ba1\u3001\u6a21\u578b\u89c4\u5219\u6570\u91cf\u7edf\u8ba1&#xff0c;\u7528\u4e8e\u540e\u53f0\u6570\u636e\u770b\u677f\u5c55\u793a\u3002<\/p>\n<p>5. \u65b0\u589e\u5355\u8282\u70b9\u65b0\u589e\u3001\u7f16\u8f91\u3001\u5220\u9664\u63a5\u53e3<\/p>\n<p>\u5f53\u524d\u4ec5\u652f\u6301\u5168\u8868\u6e05\u7a7a\u3001\u6309\u6a21\u578b\u67e5\u8be2&#xff0c;\u7f3a\u5c11\u5bf9\u5355\u4e2a\u6811\u5f62\u8282\u70b9\u7684\u589e\u5220\u6539\u63a5\u53e3&#xff0c;\u524d\u7aef\u7f16\u8f91\u89c4\u5219\u6811\u65f6\u9700\u8981\u540e\u7aef\u8865\u5145\u5bf9\u5e94\u63a5\u53e3\u3002<\/p>\n<p>6. \u589e\u52a0\u4e8b\u52a1\u63a7\u5236\u63d0\u9192<\/p>\n<p>deleteAll() \u5168\u8868\u5220\u9664\u64cd\u4f5c\u5efa\u8bae\u5728 Service \u5b9e\u73b0\u7c7b\u65b9\u6cd5\u6dfb\u52a0 &#064;Transactional&#xff0c;\u9632\u6b62\u5220\u9664\u4e2d\u9014\u6570\u636e\u5e93\u5f02\u5e38\u5bfc\u81f4\u6570\u636e\u534a\u5220\u6b8b\u7559\u3002<\/p>\n<\/p>\n<p>\u65e9\u4e0a\u5c31\u770b\u4e0a\u8ff0\u6587\u4ef6\u4ee3\u7801&#xff0c;\u540e\u7eed\u7684\u544a\u8b66\u5f15\u64ce\u548c\u5b9a\u65f6\u4efb\u52a1\u90e8\u5206\u7684\u6587\u4ef6\u4ee3\u7801\u4e0b\u5348\u518d\u770b\u3002<\/p>\n<p>\u8ba9\u6211\u590d\u4e60\u4e00\u4e0b\u4eca\u5929\u65e9\u4e0a\u5e72\u4e86\u4ec0\u4e48\u5de5\u4f5c\u5185\u5bb9\u3002<\/p>\n<p>\u65e9\u4e0a\u8d77\u6765\u6536\u62fe\u6574\u7406\u56de\u5fc6\u590d\u4e60\u4e0a\u5468\u5468\u4e94\u7684\u5de5\u4f5c\u5185\u5bb9&#xff0c;\u7136\u540e<\/p>\n<p>\u4e0d\u60f3\u90a3\u4e9b\u4e0d\u5f00\u5fc3\u7684\u4e8b\u60c5&#xff0c;\u8bb0\u4f4f&#xff0c;\u6c38\u8fdc\u4e0d\u8981\u53bb\u6539\u53d8\u4e00\u4e2a\u4eba&#xff0c;\u4f60\u53ea\u9700\u8981\u505a\u7684&#xff0c;\u5c31\u662f\u8fdc\u79bb\u4ed6\u4eec\u3002<\/p>\n<\/p>\n<p>\u9996\u5148\u5f00\u4e86\u4f8b\u884c\u65e9\u4f1a&#xff0c;\u8bf4\u4e86\u4e00\u4e0b\u516c\u53f8\u914d\u7f6e\u7684glm\u7684\u4e8b\u60c5&#xff0c;\u7136\u540e\u5c31\u662f\u8fdb\u884c\u6bcf\u5929\u7684\u4f8b\u884c\u6c47\u62a5&#xff0c;\u4e4b\u540e\u5c31\u5f3a\u8c03\u4e86\u4e00\u4e0b\u5404\u4e2a\u9879\u76ee\u5f00\u53d1\u5c0f\u7ec4\u4e4b\u95f4\u7684\u6c9f\u901a\u548c\u5171\u540c\u7684\u9879\u76ee\u4e86\u89e3\u3002<\/p>\n<p>\u65e9\u4f1a\u7ed3\u675f\u3002<\/p>\n<p>\u6211\u56de\u6765\u5c31\u5148\u603b\u7ed3\u4e86\u4f8b\u884c\u65e9\u4f1a\u7684\u5185\u5bb9&#xff0c;\u4e4b\u540e\u6211\u5c31\u5f00\u59cb\u80cc\u5355\u8bcd&#xff0c;\u611f\u89c9\u8fd9\u6b21\u80cc\u5355\u8bcd\u5f88\u6709\u7528&#xff0c;\u6211\u662f\u5728\u7535\u8111\u4e0a\u80cc\u8bf5\u5355\u8bcd\u7684&#xff0c;\u611f\u89c9\u5f88\u6709\u7528&#xff0c;\u56e0\u4e3a\u6211\u611f\u53d7\u5230\u6211\u7684\u8111\u5b50\u5728\u53d1\u70ed&#xff0c;\u5927\u8111\u91cc\u7684\u795e\u7ecf\u5143\u8fde\u63a5\u8d77\u6765\u4e86&#xff0c;\u4e4b\u540e\u6211\u542c\u82f1\u8bed\u53e3\u8bed\u89c6\u9891\u7684\u65f6\u5019\u6211\u611f\u89c9\u6211\u4e5f\u80fd\u5f88\u5feb\u542c\u61c2\u3002\u5f88\u6709\u7528\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u6211\u5c31\u5f00\u59cb\u770b\u76f8\u5173\u4ee3\u7801\u6587\u4ef6\u3002<\/p>\n<p>\u6211\u662f\u5206\u4e3a\u4e24\u4e2a\u9636\u6bb5\u6765\u770b\u7684\u3002<\/p>\n<p>\u7b2c\u4e00\u9636\u6bb5\u662f\u914d\u7f6e\u5165\u53e3\u7c7b\u4ee3\u7801\u6587\u4ef6\u3002<\/p>\n<p>businessRunApplication.java\u540e\u7aef\u5165\u53e3\u7c7b\u6587\u4ef6\u3002<\/p>\n<p>application.yml\u6570\u636e\u5e93\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>rounter.define.js\u524d\u7aef\u8def\u7531\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>\u7b2c\u4e8c\u9636\u6bb5\u662f\u544a\u8b66\u529f\u80fd\u7c7b\u7684\u6587\u4ef6\u3002\u8fd9\u4e9b\u6587\u4ef6\u90fd\u662f\u540e\u7aef\u6587\u4ef6\u3002<\/p>\n<p>\u5206\u4e3a\u56db\u4e2a\u5c0f\u7ec4\u6765\u8fdb\u884c\u67e5\u770b\u7684\u3002<\/p>\n<p>\u544a\u8b66\u6a21\u578b<\/p>\n<p>\u544a\u8b66\u89c4\u5219<\/p>\n<p>\u544a\u8b66\u5f15\u64ce<\/p>\n<p>\u5b9a\u65f6\u4efb\u52a1<\/p>\n<p>\u8fd9\u56db\u4e2a\u5c0f\u7ec4<\/p>\n<p>\u4e3b\u8981\u662f\u6309\u7167\u8fd9\u4e2a\u6d41\u7a0b\u6765\u8fdb\u884c\u67e5\u770b\u4ee3\u7801\u7684&#xff0c;controller-&gt;service-&gt;impl-&gt;mapper&#xff0c;\u8fd9\u4e2a\u6d41\u7a0b\u662f\u4e00\u4e2a\u89c4\u5b9a\u7684\u6570\u636e\u6d41\u8f6c\u7684\u6d41\u7a0b\u3002<\/p>\n<p>\u4f1a\u6d89\u53ca\u5230\u7b80\u5355\u7684CRUD\u7684\u64cd\u4f5c&#xff0c;\u540e\u7eed\u67e5\u627e\u8fd8\u6709\u501f\u52a9\u5f88\u591a\u6761\u4ef6\u6765\u8fdb\u884c\u67e5\u627e\u3002<\/p>\n<p>\u8de8\u57df\u95ee\u9898&#xff0c;\u7edf\u4e00\u7aef\u53e3\u95ee\u9898&#xff0c;\u63a5\u53e3API&#xff0c;<\/p>\n<p>\u5305package&#xff0c;\u5bfc\u5165import&#xff0c;\u6ce8\u89e3&#064;&#xff0c;<\/p>\n<p>JMX&#xff0c;jdk&#xff0c;<\/p>\n<p>\u590d\u4e60\u590d\u4e60\u590d\u4e60\u590d\u4e60<\/p>\n<p>\u52a0\u6cb9&#xff0c;\u90d1\u5353\u9896&#xff0c;\u4f60\u53ef\u4ee5\u7684&#xff01;&#xff01;<\/p>\n<p>\u8fd8\u6709\u4e00\u90e8\u5206\u5176\u5b9e\u4e5f\u53ef\u4ee5\u56de\u60f3\u4eca\u5929\u80cc\u7684\u82f1\u8bed\u5355\u8bcd\u3002<\/p>\n<p>function,definetily,roster,canoe,cirulation,circle,obtain,currency,local,logical,logicalist,ketchup,gourmet,supper,cutlery,formal,forum,chunk,photographic,record,comment,commend,company,closet,<\/p>\n<\/p>\n<h3>\u544a\u8b66\u5f15\u64ce&#xff08;\u6838\u5fc3&#xff09;<\/h3>\n<h4>AlarmEngine.java<\/h4>\n<p>\u4e00\u3001\u6574\u4f53\u5b9a\u4f4d\u4e0e\u4e1a\u52a1\u4f5c\u7528<\/p>\n<p>\u8fd9\u662fZNYW \u667a\u80fd\u8fd0\u7ef4\u7cfb\u7edf\u6838\u5fc3\u8ba1\u7b97\u5f15\u64ce&#xff0c;\u72ec\u7acb\u5305 cn.com.xxx.bussiness.znyw.engine&#xff0c;\u662f\u5b9a\u65f6\u4efb\u52a1\u8c03\u5ea6\u6267\u884c\u544a\u8b66\u5224\u65ad\u7684\u6838\u5fc3\u4e1a\u52a1\u7c7b\u3002 \u6574\u4f53\u4e1a\u52a1\u94fe\u8def&#xff1a;\u5b9a\u65f6\u4efb\u52a1\u89e6\u53d1 \u2192 AlarmEngine.executeModel (\u6a21\u578b ID) \u6838\u5fc3\u56db\u5927\u6d41\u7a0b&#xff1a;<\/p>\n<li>\n<p>\u8bfb\u53d6\u6570\u636e\u5e93\u89c4\u5219\u6811&#xff0c;\u6784\u5efa\u5185\u5b58\u6811\u5f62\u7ed3\u6784&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u67e5\u8be2\u544a\u8b66\u6a21\u578b\u7ed1\u5b9a\u7684\u5168\u90e8\u76d1\u63a7\u8bbe\u5907 \/ \u5bf9\u8c61&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u9010\u4e2a\u76d1\u63a7\u5bf9\u8c61\u62c9\u53d6\u6307\u6807\u5b9e\u65f6\u6570\u636e&#xff0c;\u9012\u5f52 \/ \u6808\u5f0f\u904d\u5386\u89c4\u5219\u6811\u505a\u9608\u503c\u3001\u903b\u8f91\u8fd0\u7b97\u5224\u65ad&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u751f\u6210\u5b8c\u6574\u6267\u884c\u7ed3\u679c&#xff08;\u662f\u5426\u544a\u8b66\u3001\u89e6\u53d1\u89c4\u5219\u3001\u8017\u65f6\u3001\u9519\u8bef\u4fe1\u606f&#xff09;&#xff0c;\u540e\u7eed\u53ef\u843d\u5730\u5165\u5e93\u3001\u751f\u6210\u5de1\u68c0\u5de5\u5355\u3002<\/p>\n<\/li>\n<p>\u5206\u5c42\u4f9d\u8d56\u7ed3\u6784&#xff1a;<\/p>\n<p>AlarmEngine&#xff08;\u5f15\u64ce\u8c03\u5ea6\u5165\u53e3&#xff09;<br \/>\n\u251c\u2500 RuleTreeBuilder&#xff1a;\u89c4\u5219\u6811\u6784\u5efa\u5668<br \/>\n\u251c\u2500 RuleEvaluator&#xff1a;\u89c4\u5219\u6811\u8ba1\u7b97\u8bc4\u4f30\u5668<br \/>\n\u251c\u2500 ModelMonitorRelMapper&#xff1a;\u6a21\u578b-\u76d1\u63a7\u5bf9\u8c61\u5173\u8054\u8868\u67e5\u8be2<br \/>\n\u251c\u2500 MonitorObjectMapper&#xff1a;\u76d1\u63a7\u5bf9\u8c61\u57fa\u7840\u4fe1\u606f\u67e5\u8be2<br \/>\n\u2514\u2500 AlarmEngineMapper&#xff1a;\u5f15\u64ce\u4e13\u5c5e\u6570\u636e\u67e5\u8be2&#xff08;\u6307\u6807\u65f6\u5e8f\u6570\u636e\u7b49&#xff09;<\/p>\n<p>\u4e8c\u3001\u5934\u90e8\u57fa\u7840\u4fe1\u606f<\/p>\n<p>1. \u5305\u4e0e\u6ce8\u89e3<\/p>\n<p>package cn.com.xxx.bussiness.znyw.engine;<br \/>\n&#064;Slf4j<br \/>\n&#064;Component<br \/>\npublic class AlarmEngine<\/p>\n<li>\n<p>&#064;Component&#xff1a;\u6ce8\u518c\u4e3a Spring \u5bb9\u5668 Bean&#xff0c;\u5b9a\u65f6\u4efb\u52a1 Service \u53ef\u76f4\u63a5\u6ce8\u5165\u8c03\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>&#064;Slf4j&#xff1a;Lombok \u65e5\u5fd7\u6ce8\u89e3&#xff0c;\u5168\u6d41\u7a0b\u6253\u5370\u5206\u7ea7\u65e5\u5fd7&#xff0c;\u7528\u4e8e\u7ebf\u4e0a\u5f15\u64ce\u6267\u884c\u6392\u67e5&#xff1b;<\/p>\n<\/li>\n<p>2. \u5bfc\u5165\u7c7b\u5206\u7c7b\u8bf4\u660e<\/p>\n<li>\n<p>\u5f15\u64ce\u5185\u90e8\u5de5\u5177<\/p>\n<ul>\n<li>\n<p>RuleTreeBuilder&#xff1a;\u8bfb\u53d6\u89c4\u5219\u6811\u6570\u636e\u8868&#xff0c;\u7ec4\u88c5\u5185\u5b58 RuleTreeNode \u6811\u5f62\u5bf9\u8c61&#xff1b;<\/p>\n<\/li>\n<li>\n<p>RuleEvaluator&#xff1a;\u6808\u904d\u5386\u89c4\u5219\u6811\u3001\u8ba1\u7b97\u6307\u6807\u9608\u503c\u3001AND\/OR \u903b\u8f91\u5224\u65ad&#xff1b;<\/p>\n<\/li>\n<li>\n<p>RuleTreeNode&#xff1a;\u5185\u5b58\u89c4\u5219\u6811\u8282\u70b9\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmEngineResult&#xff1a;\u5355\u6b21\u76d1\u63a7\u5bf9\u8c61\u6267\u884c\u7ed3\u679c\u5c01\u88c5\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6570\u636e\u5e93 Mapper<\/p>\n<ul>\n<li>\n<p>ModelMonitorRelMapper&#xff1a;\u67e5\u8be2\u6a21\u578b\u4e0e\u76d1\u63a7\u5bf9\u8c61\u7ed1\u5b9a\u5173\u7cfb&#xff1b;<\/p>\n<\/li>\n<li>\n<p>MonitorObjectMapper&#xff1a;\u67e5\u8be2\u76d1\u63a7\u5bf9\u8c61\u540d\u79f0\u7b49\u57fa\u7840\u4fe1\u606f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmEngineMapper&#xff1a;\u62c9\u53d6\u76d1\u63a7\u5bf9\u8c61\u5bf9\u5e94\u6307\u6807\u65f6\u5e8f\u6570\u503c&#xff08;\u8ba1\u7b97\u5f15\u64ce\u6570\u636e\u6e90&#xff09;&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6570\u636e\u5e93\u5b9e\u4f53<\/p>\n<ul>\n<li>\n<p>MonitorObject&#xff1a;\u76d1\u63a7\u5bf9\u8c61\u5b9e\u4f53&#xff08;\u6cb9\u7530\u8bbe\u5907\u3001\u7ad9\u70b9\u7b49&#xff09;&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u65f6\u95f4\u3001\u96c6\u5408\u5de5\u5177&#xff1a;LocalDateTime\u3001ArrayList\u3001\u6d41\u5904\u7406&#xff0c;\u7528\u4e8e\u8017\u65f6\u8ba1\u7b97\u3001\u7ed3\u679c\u6c47\u603b\u3002<\/p>\n<\/li>\n<p>3. \u4f9d\u8d56\u6ce8\u5165\u6210\u5458\u53d8\u91cf<\/p>\n<p>&#064;Autowired<br \/>\nprivate RuleTreeBuilder ruleTreeBuilder;     \/\/ \u6784\u5efa\u89c4\u5219\u6811<br \/>\n&#064;Autowired<br \/>\nprivate RuleEvaluator ruleEvaluator;         \/\/ \u89c4\u5219\u8ba1\u7b97\u8bc4\u4f30<br \/>\n&#064;Autowired<br \/>\nprivate ModelMonitorRelMapper modelMonitorRelMapper; \/\/ \u6a21\u578b-\u76d1\u63a7\u5bf9\u8c61\u5173\u8054<br \/>\n&#064;Autowired<br \/>\nprivate MonitorObjectMapper monitorObjectMapper;     \/\/ \u76d1\u63a7\u5bf9\u8c61\u4fe1\u606f<br \/>\n&#064;Autowired<br \/>\nprivate AlarmEngineMapper alarmEngineMapper;          \/\/ \u6307\u6807\u6570\u636e\u67e5\u8be2<\/p>\n<p>\u804c\u8d23\u5b8c\u5168\u62c6\u5206&#xff0c;\u5355\u4e00\u5de5\u5177\u7c7b\u53ea\u505a\u4e00\u4ef6\u4e8b&#xff0c;\u5f15\u64ce\u4ec5\u505a\u6d41\u7a0b\u8c03\u5ea6&#xff0c;\u4e0d\u63ba\u6742\u6784\u5efa\u3001\u8ba1\u7b97\u903b\u8f91\u3002<\/p>\n<p>\u4e09\u3001\u6838\u5fc3\u5165\u53e3\u65b9\u6cd5 executeModel (String modelId)<\/p>\n<p>\u5bf9\u5916\u66b4\u9732\u7684\u4e3b\u6267\u884c\u65b9\u6cd5&#xff0c;\u5b9a\u65f6\u4efb\u52a1\u3001\u540e\u53f0\u624b\u52a8\u6267\u884c\u5747\u8c03\u7528\u8be5\u65b9\u6cd5&#xff0c;\u5b8c\u6574\u5b9e\u73b0\u4e00\u6574\u5957\u544a\u8b66\u6a21\u578b\u6279\u91cf\u8ba1\u7b97\u6d41\u7a0b&#xff0c;\u5206\u6b65\u62c6\u89e3&#xff1a;<\/p>\n<p>\u6b65\u9aa4 1&#xff1a;\u65e5\u5fd7\u6807\u8bb0\u6a21\u578b\u5f00\u59cb\u6267\u884c&#xff0c;\u521d\u59cb\u5316\u7ed3\u679c\u96c6\u5408<\/p>\n<p>log.info(&#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u5f00\u59cb\u6267\u884c\u544a\u8b66\u6a21\u578b: {} &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;, modelId);<br \/>\nList&lt;AlarmEngineResult&gt; results &#061; new ArrayList&lt;&gt;();<\/p>\n<p>\u6b65\u9aa4 2&#xff1a;RuleTreeBuilder \u6784\u5efa\u5185\u5b58\u89c4\u5219\u6811<\/p>\n<p>RuleTreeNode ruleTree &#061; ruleTreeBuilder.buildRuleTree(modelId);<br \/>\nif (ruleTree &#061;&#061; null) {<br \/>\n    log.warn(&#034;\u6a21\u578b {} \u6ca1\u6709\u914d\u7f6e\u89c4\u5219\u6811&#xff0c;\u8df3\u8fc7\u6267\u884c&#034;, modelId);<br \/>\n    return results;<br \/>\n}<br \/>\nruleTreeBuilder.printRuleTree(ruleTree);<\/p>\n<li>\n<p>\u6839\u636e\u6a21\u578b ID \u67e5\u8be2 t_alarm_rule_tree_unified \u89c4\u5219\u6811\u8282\u70b9\u8868&#xff0c;\u9012\u5f52\u7ec4\u88c5\u5b8c\u6574\u6811\u5f62\u7ed3\u6784&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65e0\u89c4\u5219\u6811\u76f4\u63a5\u7ec8\u6b62\u6267\u884c&#xff0c;\u907f\u514d\u7a7a\u6307\u9488&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6253\u5370\u6811\u5f62\u7ed3\u6784\u65e5\u5fd7&#xff0c;\u5f00\u53d1\u8c03\u8bd5\u67e5\u770b\u89c4\u5219\u5c42\u7ea7\u3001\u903b\u8f91\u8fd0\u7b97\u7b26\u3002<\/p>\n<\/li>\n<p>\u6b65\u9aa4 3&#xff1a;\u67e5\u8be2\u5f53\u524d\u6a21\u578b\u7ed1\u5b9a\u7684\u6240\u6709\u76d1\u63a7\u5bf9\u8c61<\/p>\n<p>\u901a\u8fc7\u4e2d\u95f4\u5173\u8054\u8868 t_model_monitor_rel \u67e5\u8be2\u7ed1\u5b9a\u7684\u76d1\u63a7\u5bf9\u8c61 ID \u96c6\u5408&#xff0c;\u8fd9\u91cc\u4f7f\u7528\u53cd\u5c04\u8bfb\u53d6\u5173\u8054\u5b9e\u4f53\u7684 getMonitorObjectId()&#xff1a;<\/p>\n<p>List objectRels &#061; modelMonitorRelMapper.selectByModelId(modelId);<br \/>\n\/\/ \u5faa\u73af&#043;\u53cd\u5c04\u63d0\u53d6\u76d1\u63a7\u5bf9\u8c61ID<\/p>\n<ul>\n<li>\n<p>\u517c\u5bb9\u901a\u7528\u5173\u8054\u5b9e\u4f53&#xff0c;\u65e0\u9700\u786c\u7f16\u7801\u5b9e\u4f53\u7c7b&#xff0c;\u901a\u7528\u6027\u5f3a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6355\u83b7\u53cd\u5c04\u5f02\u5e38&#xff0c;\u5355\u6761\u8bfb\u53d6\u5931\u8d25\u4e0d\u4e2d\u65ad\u6574\u4f53\u6d41\u7a0b&#xff0c;\u4ec5\u6253\u5370\u8b66\u544a\u65e5\u5fd7\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u6b65\u9aa4 4&#xff1a;\u65e0\u7ed1\u5b9a\u76d1\u63a7\u5bf9\u8c61\u76f4\u63a5\u7ec8\u6b62<\/p>\n<p>if (objectIds.isEmpty()) {<br \/>\n    log.warn(&#034;\u6a21\u578b {} \u6ca1\u6709\u7ed1\u5b9a\u76d1\u63a7\u5bf9\u8c61&#xff0c;\u8df3\u8fc7\u6267\u884c&#034;, modelId);<br \/>\n    return results;<br \/>\n}<\/p>\n<p>\u6b65\u9aa4 5&#xff1a;\u5faa\u73af\u6bcf\u4e2a\u76d1\u63a7\u5bf9\u8c61&#xff0c;\u72ec\u7acb\u6267\u884c\u89c4\u5219\u8bc4\u4f30<\/p>\n<p>for (String objectId : objectIds) {<br \/>\n    AlarmEngineResult result &#061; executeForObject(modelId, objectId, ruleTree);<br \/>\n    results.add(result);<br \/>\n}<\/p>\n<p>\u9694\u79bb\u8bbe\u8ba1&#xff1a;\u6bcf\u4e2a\u76d1\u63a7\u5bf9\u8c61\u72ec\u7acb\u6267\u884c\u3001\u72ec\u7acb\u751f\u6210\u7ed3\u679c&#xff0c;\u5355\u4e2a\u8bbe\u5907\u8ba1\u7b97\u62a5\u9519\u4e0d\u4f1a\u5f71\u54cd\u5176\u4ed6\u8bbe\u5907\u3002<\/p>\n<p>\u6b65\u9aa4 6&#xff1a;\u6267\u884c\u5b8c\u6210\u6c47\u603b\u7edf\u8ba1<\/p>\n<p>long triggeredCount &#061; results.stream().filter(AlarmEngineResult::isTriggered).count();<br \/>\nlog.info(&#034;\u603b\u5bf9\u8c61\u6570: {}, \u89e6\u53d1\u544a\u8b66: {}, \u672a\u89e6\u53d1: {}&#034;, &#8230;);<\/p>\n<p>\u4f7f\u7528\u6d41\u5f0f\u7edf\u8ba1\u89e6\u53d1\u544a\u8b66\u7684\u8bbe\u5907\u6570\u91cf&#xff0c;\u8f93\u51fa\u6c47\u603b\u65e5\u5fd7&#xff0c;\u4fbf\u4e8e\u8fd0\u7ef4\u67e5\u770b\u5f53\u65e5\u544a\u8b66\u603b\u91cf\u3002<\/p>\n<p>\u5f02\u5e38\u515c\u5e95<\/p>\n<p>\u5916\u5c42\u5927 try-catch \u6355\u83b7\u6a21\u578b\u6267\u884c\u5168\u6d41\u7a0b\u6240\u6709\u5f02\u5e38&#xff0c;\u6253\u5370\u5b8c\u6574\u5806\u6808&#xff0c;\u4e0d\u4f1a\u5bfc\u81f4\u5b9a\u65f6\u4efb\u52a1\u5d29\u6e83\u4e2d\u65ad\u3002<\/p>\n<p>\u56db\u3001\u6838\u5fc3\u5b50\u65b9\u6cd5 executeForObject \u5355\u4e2a\u76d1\u63a7\u5bf9\u8c61\u89c4\u5219\u8bc4\u4f30<\/p>\n<p>\u6700\u5c0f\u6267\u884c\u5355\u5143&#xff0c;\u9488\u5bf9\u5355\u53f0\u76d1\u63a7\u8bbe\u5907&#xff0c;\u5b8c\u6210\u300c\u57fa\u7840\u4fe1\u606f\u52a0\u8f7d \u2192 \u89c4\u5219\u6811\u91cd\u7f6e \u2192 \u6808\u5f0f\u8ba1\u7b97\u8bc4\u4f30 \u2192 \u7ed3\u679c\u5c01\u88c5\u300d\u5168\u6d41\u7a0b\u3002<\/p>\n<p>1. \u521d\u59cb\u5316\u6267\u884c\u7ed3\u679c\u5b9e\u4f53 AlarmEngineResult<\/p>\n<p>\u5c01\u88c5\u672c\u6b21\u8ba1\u7b97\u6240\u6709\u5143\u6570\u636e&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u552f\u4e00\u6267\u884c ID generateExecutionId()&#xff1a;\u6beb\u79d2\u65f6\u95f4\u6233 &#043; \u968f\u673a\u6570&#xff0c;\u7528\u4e8e\u65e5\u5fd7\u3001\u544a\u8b66\u8bb0\u5f55\u5173\u8054&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6a21\u578b ID\u3001\u76d1\u63a7\u5bf9\u8c61 ID&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u76d1\u63a7\u5bf9\u8c61\u540d\u79f0&#xff08;\u4ece MonitorObject \u8868\u67e5\u8be2&#xff0c;\u5931\u8d25\u5219\u4f7f\u7528 ID \u515c\u5e95&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c\u8d77\u6b62\u65f6\u95f4\u3001\u521d\u59cb\u72b6\u6001 RUNNING\u3002<\/p>\n<\/li>\n<\/ul>\n<p>2. \u91cd\u7f6e\u89c4\u5219\u6811\u8bc4\u4f30\u72b6\u6001<\/p>\n<p>ruleTree.resetEvaluation();<\/p>\n<p>\u89c4\u5219\u6811\u8282\u70b9\u4f1a\u7f13\u5b58\u4e0a\u6b21\u8ba1\u7b97\u7684\u5e03\u5c14\u7ed3\u679c&#xff0c;\u591a\u4e2a\u76d1\u63a7\u5bf9\u8c61\u5faa\u73af\u8ba1\u7b97\u524d\u5fc5\u987b\u6e05\u7a7a\u7f13\u5b58&#xff0c;\u907f\u514d\u4e0a\u4e00\u4e2a\u8bbe\u5907\u7684\u8ba1\u7b97\u7ed3\u679c\u6c61\u67d3\u5f53\u524d\u8bbe\u5907\u3002<\/p>\n<p>3. RuleEvaluator \u6267\u884c\u89c4\u5219\u6811\u8ba1\u7b97&#xff08;\u5f15\u64ce\u6838\u5fc3\u8fd0\u7b97\u903b\u8f91&#xff09;<\/p>\n<p>boolean treeResult &#061; ruleEvaluator.evaluateRuleTree(ruleTree, objectId, result);<\/p>\n<p>\u5e95\u5c42\u91c7\u7528\u6808\u540e\u5e8f\u904d\u5386\u89c4\u5219\u6811&#xff0c;\u4f9d\u6b21\u6267\u884c&#xff1a;<\/p>\n<li>\n<p>\u62c9\u53d6\u8be5\u76d1\u63a7\u5bf9\u8c61\u5bf9\u5e94\u6307\u6807\u5b9e\u65f6\u6570\u503c&#xff08;AlarmEngineMapper \u67e5\u8be2\u65f6\u5e8f\u5e93 \/ \u8fbe\u68a6\u6307\u6807\u8868&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c\u5355\u6761\u89c4\u5219\u9608\u503c\u5224\u65ad&#xff08;&gt; \/ &lt; \/ &#061; \/ \u533a\u95f4\u5224\u65ad&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6839\u636e\u7236\u8282\u70b9 AND\/OR \u903b\u8f91\u8fd0\u7b97\u7b26\u5408\u5e76\u5b50\u89c4\u5219\u5e03\u5c14\u7ed3\u679c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u628a\u89e6\u53d1\u7684\u89c4\u5219\u3001\u544a\u8b66\u4fe1\u606f\u5199\u5165 AlarmEngineResult&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de\u6574\u68f5\u89c4\u5219\u6811\u6700\u7ec8\u5e03\u5c14\u503c&#xff08;true &#061; \u89e6\u53d1\u544a\u8b66&#xff09;\u3002<\/p>\n<\/li>\n<p>4. \u6267\u884c\u7ed3\u679c\u72b6\u6001\u8d4b\u503c<\/p>\n<p>result.setTriggered(treeResult);<br \/>\nresult.setStatus(&#034;SUCCESS&#034;);<\/p>\n<p>5. \u5f02\u5e38\u6355\u83b7 &#043; \u8017\u65f6\u8ba1\u7b97 finally \u5757<\/p>\n<p>\u65e0\u8bba\u8ba1\u7b97\u6210\u529f\u6216\u5931\u8d25&#xff0c;\u90fd\u4f1a\u8bb0\u5f55&#xff1a;<\/p>\n<li>\n<p>\u7ed3\u675f\u65f6\u95f4\u3001\u603b\u6267\u884c\u8017\u65f6&#xff08;\u6beb\u79d2&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8ba1\u7b97\u5931\u8d25\u65f6\u72b6\u6001\u6539\u4e3a FAILED&#xff0c;\u8bb0\u5f55\u5f02\u5e38\u4fe1\u606f&#xff1b;<\/p>\n<\/li>\n<p>\u4e94\u3001\u5de5\u5177\u79c1\u6709\u65b9\u6cd5 generateExecutionId<\/p>\n<p>\u751f\u6210\u5168\u5c40\u552f\u4e00\u6267\u884c\u6807\u8bc6&#xff0c;\u683c\u5f0f EXEC_\u6beb\u79d2\u65f6\u95f4\u6233_\u968f\u673a\u6570&#xff0c;\u4f5c\u7528&#xff1a;<\/p>\n<li>\n<p>\u6bcf\u6761\u544a\u8b66\u8bb0\u5f55\u3001\u5f15\u64ce\u6267\u884c\u65e5\u5fd7\u90fd\u643a\u5e26\u8be5 ID&#xff0c;\u53ef\u5168\u94fe\u8def\u8ffd\u8e2a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u533a\u5206\u540c\u4e00\u6a21\u578b\u3001\u540c\u4e00\u8bbe\u5907\u591a\u6b21\u5b9a\u65f6\u6267\u884c\u8bb0\u5f55\u3002<\/p>\n<\/li>\n<\/p>\n<h4 style=\"background-color:transparent\">AlarmEngineService.java<\/h4>\n<p>\u4e00\u3001\u7c7b\u6574\u4f53\u5b9a\u4f4d<\/p>\n<p>\u8be5\u7c7b\u662f\u544a\u8b66\u5f15\u64ce\u5bf9\u5916\u7684\u00a0Service \u5c42&#xff0c;\u5c01\u88c5\u5e95\u5c42AlarmEngine\u3001RuleTreeBuilder\u80fd\u529b&#xff0c;\u63d0\u4f9b\u53ef\u88ab Controller\u3001\u5b9a\u65f6\u4efb\u52a1\u3001\u5176\u4ed6\u4e1a\u52a1\u6a21\u5757\u8c03\u7528\u7684\u6807\u51c6\u5316\u63a5\u53e3&#xff0c;\u804c\u8d23&#xff1a;<\/p>\n<li>\n<p>\u5c01\u88c5\u89c4\u5219\u6811\u6784\u5efa\u903b\u8f91&#xff0c;\u7edf\u4e00\u505a\u89c4\u5219\u6811\u975e\u7a7a\u6821\u9a8c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5916\u63d0\u4f9b\u5355\u76d1\u63a7\u5bf9\u8c61\u72ec\u7acb\u6267\u884c\u544a\u8b66\u80fd\u529b&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u63d0\u4f9b\u8c03\u8bd5\u63a5\u53e3&#xff0c;\u683c\u5f0f\u5316\u8f93\u51fa\u6574\u68f5\u89c4\u5219\u6811\u6587\u672c\u7ed3\u6784&#xff0c;\u65b9\u4fbf\u5f00\u53d1 \/ \u8fd0\u7ef4\u6392\u67e5\u89c4\u5219\u914d\u7f6e\u95ee\u9898&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u65e5\u5fd7\u6253\u5370&#xff0c;\u5bf9\u5916\u5c4f\u853d\u5e95\u5c42\u5f15\u64ce\u3001\u6784\u9020\u5668\u7684\u590d\u6742\u7ec6\u8282\u3002<\/p>\n<\/li>\n<p>\u5206\u5c42\u4f9d\u8d56\u5173\u7cfb&#xff1a;<\/p>\n<p>AlarmEngineService&#xff08;\u95e8\u9762\u670d\u52a1&#xff09;<\/p>\n<p>\u251c\u2500 AlarmEngine&#xff1a;\u6838\u5fc3\u544a\u8b66\u8ba1\u7b97\u5f15\u64ce&#xff08;\u6279\u91cf \/ \u5355\u5bf9\u8c61\u6267\u884c\u903b\u8f91&#xff09;<\/p>\n<p>\u2514\u2500 RuleTreeBuilder&#xff1a;\u89c4\u5219\u6811\u6784\u9020\u5de5\u5177&#xff0c;\u4ece\u6570\u636e\u5e93\u7ec4\u88c5\u5185\u5b58\u6811\u5f62\u8282\u70b9<\/p>\n<p>\u4e8c\u3001\u5934\u90e8\u57fa\u7840\u4fe1\u606f<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.xxx.bussiness.znyw.engine.service;<\/p>\n<p>\u72ec\u7acb\u5f15\u64ce\u4e1a\u52a1\u670d\u52a1\u5305&#xff0c;\u548c\u6838\u5fc3\u8ba1\u7b97\u5f15\u64ceAlarmEngine&#xff08;engine\u5305&#xff09;\u5206\u5c42\u9694\u79bb&#xff0c;\u9075\u5faa\u95e8\u9762\u6a21\u5f0f&#xff1a;\u5e95\u5c42\u8ba1\u7b97\u903b\u8f91\u653e\u5728 engine \u5305&#xff0c;\u5bf9\u5916\u8c03\u7528\u5165\u53e3\u7edf\u4e00\u653e\u5728 engine.service \u5305\u3002<\/p>\n<p>2. \u6ce8\u89e3\u8bf4\u660e<\/p>\n<p>&#064;Slf4j<br \/>\n&#064;Service<br \/>\npublic class AlarmEngineService<\/p>\n<li>\n<p>&#064;Service&#xff1a;\u6ce8\u518c\u4e3a Spring \u4e1a\u52a1 Bean&#xff0c;Controller\u3001\u5b9a\u65f6\u4efb\u52a1\u53ef\u76f4\u63a5&#064;Autowired\u6ce8\u5165\u4f7f\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>&#064;Slf4j&#xff1a;Lombok \u65e5\u5fd7\u6ce8\u89e3&#xff0c;\u6240\u6709\u64cd\u4f5c\u6253\u5370\u5206\u7ea7\u65e5\u5fd7&#xff0c;\u4fbf\u4e8e\u7ebf\u4e0a\u8ffd\u8e2a\u6267\u884c\u8bb0\u5f55\u3002<\/p>\n<\/li>\n<p>3. \u4f9d\u8d56\u6ce8\u5165<\/p>\n<p>&#064;Autowired<br \/>\nprivate AlarmEngine alarmEngine;<br \/>\n&#064;Autowired<br \/>\nprivate RuleTreeBuilder ruleTreeBuilder;<\/p>\n<ul>\n<li>\n<p>RuleTreeBuilder&#xff1a;\u590d\u7528\u89c4\u5219\u6811\u6784\u5efa\u903b\u8f91&#xff0c;\u4e24\u4e2a\u63a5\u53e3\u90fd\u9700\u8981\u5148\u52a0\u8f7d\u6a21\u578b\u89c4\u5219\u6811&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmEngine&#xff1a;\u8c03\u7528\u5e95\u5c42\u6700\u5c0f\u6267\u884c\u5355\u5143executeForObject&#xff0c;\u5b8c\u6210\u5355\u8bbe\u5907\u544a\u8b66\u8bc4\u4f30\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e09\u3001\u5bf9\u5916\u63a5\u53e3\u9010\u884c\u8be6\u89e3<\/p>\n<p>\u63a5\u53e3 1&#xff1a;executeForObject (String modelId, String objectId)<\/p>\n<p>\u529f\u80fd\u63cf\u8ff0<\/p>\n<p>\u5355\u72ec\u6267\u884c\u67d0\u4e00\u4e2a\u76d1\u63a7\u5bf9\u8c61\u7684\u544a\u8b66\u89c4\u5219\u8ba1\u7b97&#xff0c;\u533a\u522b\u4e8eAlarmEngine.executeModel\u6279\u91cf\u6267\u884c\u6a21\u578b\u4e0b\u6240\u6709\u76d1\u63a7\u5bf9\u8c61\u3002 \u9002\u7528\u573a\u666f&#xff1a;<\/p>\n<li>\n<p>\u524d\u7aef\u624b\u52a8\u9009\u4e2d\u5355\u4e2a\u8bbe\u5907&#xff0c;\u4e00\u952e\u6267\u884c\u544a\u8b66\u68c0\u6d4b&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5de5\u5355\u89e6\u53d1\u65f6&#xff0c;\u5355\u72ec\u5bf9\u6545\u969c\u8bbe\u5907\u6267\u884c\u89c4\u5219\u6821\u9a8c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6d4b\u8bd5\u5355\u53f0\u76d1\u63a7\u5bf9\u8c61\u7684\u89c4\u5219\u914d\u7f6e\u662f\u5426\u751f\u6548\u3002<\/p>\n<\/li>\n<p>\u5b8c\u6574\u903b\u8f91\u6d41\u7a0b<\/p>\n<li>\n<p>\u6253\u5370\u64cd\u4f5c\u65e5\u5fd7&#xff0c;\u8bb0\u5f55\u6a21\u578b ID\u3001\u76d1\u63a7\u5bf9\u8c61 ID&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528ruleTreeBuilder.buildRuleTree(modelId)\u52a0\u8f7d\u6a21\u578b\u89c4\u5219\u6811&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5f3a\u6821\u9a8c&#xff1a;\u89c4\u5219\u6811\u4e3a null \u76f4\u63a5\u629b\u51fa\u8fd0\u884c\u65f6\u5f02\u5e38&#xff0c;\u7ec8\u6b62\u6267\u884c&#xff1b;<\/p>\n<p>\u5bf9\u6bd4\u5e95\u5c42 AlarmEngine \u53ea\u662f\u6253\u5370\u8b66\u544a\u5e76\u8fd4\u56de\u7a7a\u96c6\u5408&#xff0c;\u672c\u670d\u52a1\u4f5c\u4e3a\u4e0a\u5c42\u8c03\u7528\u95e8\u9762&#xff0c;\u4e1a\u52a1\u4e0a\u65e0\u89c4\u5219\u6811\u5c5e\u4e8e\u975e\u6cd5\u914d\u7f6e&#xff0c;\u76f4\u63a5\u629b\u5f02\u5e38\u8ba9\u8c03\u7528\u65b9\u611f\u77e5\u9519\u8bef&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528\u5e95\u5c42\u5f15\u64ce\u5355\u5bf9\u8c61\u8bc4\u4f30\u65b9\u6cd5&#xff0c;\u8fd4\u56de\u5b8c\u6574AlarmEngineResult\u544a\u8b66\u6267\u884c\u7ed3\u679c&#xff08;\u5305\u542b\u662f\u5426\u89e6\u53d1\u544a\u8b66\u3001\u89e6\u53d1\u89c4\u5219\u3001\u6267\u884c\u8017\u65f6\u7b49&#xff09;\u3002<\/p>\n<\/li>\n<p>\u5f02\u5e38\u8bbe\u8ba1<\/p>\n<p>\u65e0\u89c4\u5219\u6811\u65f6\u4e3b\u52a8\u629b\u51faRuntimeException&#xff0c;\u4e0a\u5c42 Controller \u53ef\u5168\u5c40\u6355\u83b7\u5f02\u5e38&#xff0c;\u8f6c\u6362\u4e3a\u524d\u7aef\u53ef\u8bfb\u9519\u8bef\u63d0\u793a\u3002<\/p>\n<p>\u63a5\u53e3 2&#xff1a;getRuleTreeStructure (String modelId)<\/p>\n<p>\u529f\u80fd\u63cf\u8ff0<\/p>\n<p>\u8c03\u8bd5\u4e13\u7528\u63a5\u53e3&#xff0c;\u5c06\u6570\u636e\u5e93\u5b58\u50a8\u7684\u6241\u5e73\u89c4\u5219\u8282\u70b9&#xff0c;\u9012\u5f52\u683c\u5f0f\u5316\u8f93\u51fa\u5e26\u5c42\u7ea7\u7f29\u8fdb\u7684\u6587\u672c\u5b57\u7b26\u4e32&#xff0c;\u76f4\u89c2\u5c55\u793a\u89c4\u5219\u6811\u7236\u5b50\u5c42\u7ea7\u3001\u8282\u70b9\u7c7b\u578b\u3001\u8fd0\u7b97\u7b26\u3001\u89c4\u5219\u540d\u79f0\u7f16\u7801\u3002 \u9002\u7528\u573a\u666f&#xff1a;<\/p>\n<li>\n<p>\u5f00\u53d1\u8c03\u8bd5&#xff1a;\u67e5\u770b\u524d\u7aef\u914d\u7f6e\u7684\u89c4\u5219\u6811\u662f\u5426\u6b63\u786e\u5165\u5e93\u3001\u7236\u5b50\u5173\u7cfb\u662f\u5426\u9519\u4e71&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd0\u7ef4\u6392\u67e5&#xff1a;\u544a\u8b66\u89e6\u53d1\u5f02\u5e38\u65f6&#xff0c;\u6838\u5bf9\u903b\u8f91\u8282\u70b9 AND\/OR \u8fd0\u7b97\u7b26\u914d\u7f6e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u63a5\u53e3\u53ef\u89c6\u5316&#xff1a;\u524d\u7aef\u53ef\u8c03\u7528\u8be5\u63a5\u53e3&#xff0c;\u5c55\u793a\u7eaf\u6587\u672c\u6811\u5f62\u9884\u89c8\u3002<\/p>\n<\/li>\n<p>\u903b\u8f91\u6d41\u7a0b<\/p>\n<li>\n<p>\u6253\u5370\u8c03\u8bd5\u65e5\u5fd7&#xff0c;\u8bb0\u5f55\u5f53\u524d\u67e5\u8be2\u7684\u6a21\u578b ID&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6784\u5efa\u6a21\u578b\u5bf9\u5e94\u7684\u89c4\u5219\u6811&#xff0c;\u82e5\u6811\u4e3a\u7a7a\u76f4\u63a5\u8fd4\u56de\u6587\u672c\u89c4\u5219\u6811\u4e3a\u7a7a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528\u79c1\u6709\u9012\u5f52\u65b9\u6cd5buildTreeString&#xff0c;\u9010\u5c42\u62fc\u63a5\u5e26\u7f29\u8fdb\u7684\u6811\u5f62\u5b57\u7b26\u4e32&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de\u5b8c\u6574\u683c\u5f0f\u5316\u6587\u672c\u7ed9\u8c03\u7528\u65b9\u3002<\/p>\n<\/li>\n<p>\u56db\u3001\u79c1\u6709\u9012\u5f52\u5de5\u5177\u65b9\u6cd5 buildTreeString<\/p>\n<p>\u6838\u5fc3\u4f5c\u7528<\/p>\n<p>\u9012\u5f52\u904d\u5386\u89c4\u5219\u6811\u6839\u8282\u70b9\u53ca\u6240\u6709\u5b50\u8282\u70b9&#xff0c;\u6839\u636e\u8282\u70b9\u5c42\u7ea7\u6dfb\u52a0\u7a7a\u683c\u7f29\u8fdb&#xff0c;\u533a\u5206\u903b\u8f91\u8282\u70b9\u4e0e\u89c4\u5219\u6761\u4ef6\u8282\u70b9&#xff0c;\u62fc\u63a5\u53ef\u8bfb\u6587\u672c\u3002<\/p>\n<p>\u5206\u652f\u5904\u7406\u903b\u8f91<\/p>\n<li>\n<p>\u7a7a\u8282\u70b9\u76f4\u63a5 return&#xff0c;\u907f\u514d\u7a7a\u6307\u9488&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6839\u636e\u5c42\u7ea7 level \u5faa\u73af\u62fc\u63a5\u7a7a\u683c\u7f29\u8fdb&#xff0c;\u5b9e\u73b0\u6811\u5f62\u5c42\u7ea7\u89c6\u89c9\u533a\u5206&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8282\u70b9\u7c7b\u578b\u533a\u5206\u6e32\u67d3&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u903b\u8f91\u8282\u70b9 LogicNode&#xff1a;\u6253\u5370\u8282\u70b9 ID &#043; \u903b\u8f91\u8fd0\u7b97\u7b26&#xff08;AND\/OR&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u89c4\u5219\u6761\u4ef6\u8282\u70b9 ConditionNode&#xff1a;\u6253\u5370\u8282\u70b9 ID &#043; \u89c4\u5219\u540d\u79f0 &#043; \u89c4\u5219\u7f16\u7801&#xff1b; \u65e0\u89c4\u5219\u4fe1\u606f\u65f6\u515c\u5e95\u663e\u793a\u300c\u672a\u77e5\u300d&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u9012\u5f52\u904d\u5386\u5f53\u524d\u8282\u70b9\u6240\u6709\u5b50\u8282\u70b9&#xff0c;\u5c42\u7ea7 level&#043;1&#xff0c;\u6df1\u5ea6\u904d\u5386\u6574\u68f5\u6811\u3002<\/p>\n<\/li>\n<p>\u8f93\u51fa\u6587\u672c\u793a\u4f8b<\/p>\n<p>[\u903b\u8f91\u8282\u70b9] root-001 &#8211; \u8fd0\u7b97\u7b26: AND<br \/>\n  [\u903b\u8f91\u8282\u70b9] node-002 &#8211; \u8fd0\u7b97\u7b26: OR<br \/>\n    [\u89c4\u5219\u8282\u70b9] rule-003 &#8211; \u89c4\u5219: \u6e29\u5ea6\u8d85\u9650 (RULE001)<br \/>\n    [\u89c4\u5219\u8282\u70b9] rule-004 &#8211; \u89c4\u5219: \u538b\u529b\u8fc7\u9ad8 (RULE002)<br \/>\n  [\u89c4\u5219\u8282\u70b9] rule-005 &#8211; \u89c4\u5219: \u6d41\u91cf\u8fc7\u4f4e (RULE003)<\/p>\n<\/p>\n<h4>AlarmEngineController.java<\/h4>\n<p>\u4e00\u3001\u6574\u4f53\u5b9a\u4f4d<\/p>\n<p>\u8fd9\u662f\u544a\u8b66\u5f15\u64ce\u5bf9\u5916 HTTP \u63a5\u53e3\u5c42&#xff0c;\u4e3a\u524d\u7aef\u9875\u9762\u3001\u7b2c\u4e09\u65b9\u7cfb\u7edf\u63d0\u4f9b\u624b\u52a8\u89e6\u53d1\u544a\u8b66\u8ba1\u7b97\u3001\u6279\u91cf\u6267\u884c\u3001\u89c4\u5219\u6811\u8c03\u8bd5\u7684 REST \u63a5\u53e3\u3002 \u5206\u5c42\u8c03\u7528\u94fe\u8def&#xff1a;\u524d\u7aef HTTP \u8bf7\u6c42 \u2192 AlarmEngineController \u2192 AlarmEngineService\/AlarmEngine \u2192 RuleTreeBuilder\/RuleEvaluator \u2192 \u6570\u636e\u5e93&#xff08;\u89c4\u5219\u6811\u3001\u76d1\u63a7\u5bf9\u8c61\u3001\u6307\u6807&#xff09;<\/p>\n<p>\u4f9d\u8d56\u6ce8\u5165\u8bf4\u660e<\/p>\n<p>&#064;Autowired<br \/>\nprivate AlarmEngine alarmEngine;        \/\/ \u5e95\u5c42\u6279\u91cf\u6267\u884c\u6838\u5fc3\u5f15\u64ce<br \/>\n&#064;Autowired<br \/>\nprivate AlarmEngineService alarmEngineService; \/\/ \u95e8\u9762\u670d\u52a1&#xff0c;\u63d0\u4f9b\u5355\u5bf9\u8c61\u6267\u884c\u3001\u89c4\u5219\u6811\u6587\u672c\u8c03\u8bd5<\/p>\n<p>\u804c\u8d23\u62c6\u5206\u6e05\u6670&#xff1a;<\/p>\n<li>\n<p>\u6279\u91cf\u6267\u884c\u5168\u91cf\u76d1\u63a7\u5bf9\u8c61\u3001\u591a\u6a21\u578b\u6279\u91cf\u6267\u884c&#xff1a;\u76f4\u63a5\u8c03\u7528\u5e95\u5c42AlarmEngine&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5355\u76d1\u63a7\u5bf9\u8c61\u6267\u884c\u3001\u89c4\u5219\u6811\u683c\u5f0f\u5316\u8c03\u8bd5&#xff1a;\u8c03\u7528\u95e8\u9762AlarmEngineService\u3002<\/p>\n<\/li>\n<p>\u4e8c\u3001\u57fa\u7840\u5934\u90e8\u4fe1\u606f<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.xxx.bussiness.znyw.engine.controller;<\/p>\n<p>\u4e13\u5c5e\u5f15\u64ce\u6a21\u5757\u7684 Controller \u5305&#xff0c;\u548c engine \u6838\u5fc3\u8ba1\u7b97\u7c7b\u3001engine.service \u95e8\u9762\u670d\u52a1\u5206\u5c42\u9694\u79bb\u3002<\/p>\n<p>2. \u6ce8\u89e3\u8bf4\u660e<\/p>\n<p>&#064;Slf4j<br \/>\n&#064;RestController<br \/>\n&#064;RequestMapping(&#034;\/api\/alarmEngine&#034;)<\/p>\n<li>\n<p>&#064;Slf4j&#xff1a;\u65e5\u5fd7\u6ce8\u89e3&#xff0c;\u6240\u6709\u63a5\u53e3\u5165\u53c2\u3001\u5f02\u5e38\u90fd\u4f1a\u6253\u5370\u65e5\u5fd7&#xff0c;\u7ebf\u4e0a\u95ee\u9898\u6392\u67e5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>&#064;RestController&#xff1a;\u63a5\u53e3\u81ea\u52a8\u8fd4\u56de JSON&#xff0c;\u65e0\u9700\u989d\u5916&#064;ResponseBody&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u63a5\u53e3\u524d\u7f00&#xff1a;\/api\/alarmEngine&#xff0c;\u6240\u6709\u5f15\u64ce\u63a5\u53e3\u7edf\u4e00\u8def\u5f84&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Swagger \u76f8\u5173\u6ce8\u89e3\u5168\u90e8\u6ce8\u91ca\u7981\u7528&#xff0c;\u9879\u76ee\u672a\u63a5\u5165\u63a5\u53e3\u6587\u6863\u6846\u67b6\u3002<\/p>\n<\/li>\n<p>3. \u8fd4\u56de\u683c\u5f0f\u89c4\u8303<\/p>\n<p>\u672c\u63a7\u5236\u5668\u7edf\u4e00\u4f7f\u7528 HashMap \u81ea\u5b9a\u4e49\u8fd4\u56de\u7ed3\u6784&#xff0c;\u548c\u9879\u76ee\u5176\u4ed6\u6a21\u5757JsonMessage&lt;T&gt;\u5168\u5c40\u6807\u51c6\u8fd4\u56de\u4f53\u4e0d\u4e00\u81f4&#xff0c;\u7edf\u4e00\u7ed3\u6784\u6a21\u677f&#xff1a;<\/p>\n<p>{<br \/>\n  &#034;success&#034;: true\/false,<br \/>\n  &#034;message&#034;: &#034;\u64cd\u4f5c\u63d0\u793a\u6587\u5b57&#034;,<br \/>\n  &#034;data&#034;: { \u4e1a\u52a1\u6570\u636e\u5bf9\u8c61 }<br \/>\n}<\/p>\n<p>\u6bcf\u4e2a\u63a5\u53e3\u72ec\u7acb try-catch \u6355\u83b7\u5168\u90e8\u5f02\u5e38&#xff0c;\u5f02\u5e38\u65f6\u8fd4\u56desuccess&#061;false&#043; \u9519\u8bef\u4fe1\u606f&#xff0c;\u4e0d\u4f1a\u629b\u51fa 500 \u539f\u59cb\u5806\u6808\u7ed9\u524d\u7aef\u3002<\/p>\n<p>\u4e09\u30014 \u4e2a\u63a5\u53e3\u9010\u884c\u62c6\u89e3<\/p>\n<p>\u63a5\u53e3 1&#xff1a;POST \/api\/alarmEngine\/executeModel<\/p>\n<p>\u529f\u80fd<\/p>\n<p>\u6267\u884c\u5355\u4e2a\u544a\u8b66\u6a21\u578b&#xff0c;\u6279\u91cf\u8ba1\u7b97\u8be5\u6a21\u578b\u7ed1\u5b9a\u7684\u6240\u6709\u76d1\u63a7\u5bf9\u8c61 \u524d\u7aef\u573a\u666f&#xff1a;\u544a\u8b66\u6a21\u578b\u8be6\u60c5\u9875&#xff0c;\u70b9\u51fb\u300c\u6267\u884c\u68c0\u6d4b\u300d&#xff0c;\u6279\u91cf\u8ba1\u7b97\u5168\u90e8\u8bbe\u5907\u544a\u8b66\u3002<\/p>\n<p>\u5165\u53c2<\/p>\n<p>&#064;RequestParam String modelId \u544a\u8b66\u6a21\u578b ID&#xff08;URL \u4f20\u53c2&#xff09;<\/p>\n<p>\u6838\u5fc3\u4e1a\u52a1\u903b\u8f91<\/p>\n<li>\n<p>\u6253\u5370\u8bf7\u6c42\u65e5\u5fd7&#xff0c;\u8bb0\u5f55\u6a21\u578b ID&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528\u5e95\u5c42alarmEngine.executeModel(modelId)\u83b7\u53d6\u6240\u6709\u76d1\u63a7\u5bf9\u8c61\u6267\u884c\u7ed3\u679c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6d41\u5f0f\u7edf\u8ba1\u6c47\u603b\u6570\u636e&#xff1a;<\/p>\n<ul>\n<li>\n<p>totalObjects&#xff1a;\u7ed1\u5b9a\u76d1\u63a7\u5bf9\u8c61\u603b\u6570\u91cf<\/p>\n<\/li>\n<li>\n<p>triggeredObjects&#xff1a;\u89e6\u53d1\u544a\u8b66\u7684\u8bbe\u5907\u6570\u91cf<\/p>\n<\/li>\n<li>\n<p>totalAlarms&#xff1a;\u6240\u6709\u8bbe\u5907\u4ea7\u751f\u544a\u8b66\u8bb0\u5f55\u603b\u6570<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u7ec4\u88c5\u7edf\u4e00\u8fd4\u56de JSON&#xff0c;\u643a\u5e26\u6c47\u603b\u7edf\u8ba1 &#043; \u6bcf\u6761\u8bbe\u5907\u5b8c\u6574\u6267\u884c\u660e\u7ec6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5f02\u5e38\u6355\u83b7&#xff0c;\u8bb0\u5f55\u5b8c\u6574\u5f02\u5e38\u5806\u6808&#xff0c;\u8fd4\u56de\u5931\u8d25\u63d0\u793a\u3002<\/p>\n<\/li>\n<p>\u8fd4\u56de data \u7ed3\u6784\u793a\u4f8b<\/p>\n<p>&#034;data&#034;: {<br \/>\n  &#034;modelId&#034;: &#034;xxx&#034;,<br \/>\n  &#034;totalObjects&#034;: 10,<br \/>\n  &#034;triggeredObjects&#034;: 2,<br \/>\n  &#034;totalAlarms&#034;: 3,<br \/>\n  &#034;results&#034;: [\u6bcf\u6761\u76d1\u63a7\u5bf9\u8c61\u6267\u884c\u7ed3\u679cAlarmEngineResult\u6570\u7ec4]<br \/>\n}<\/p>\n<p>\u63a5\u53e3 2&#xff1a;POST \/api\/alarmEngine\/executeForObject<\/p>\n<p>\u529f\u80fd<\/p>\n<p>\u5355\u72ec\u6267\u884c\u5355\u4e2a\u76d1\u63a7\u5bf9\u8c61\u7684\u544a\u8b66\u89c4\u5219\u8ba1\u7b97 \u524d\u7aef\u573a\u666f&#xff1a;\u5355\u72ec\u9009\u4e2d\u67d0\u53f0\u8bbe\u5907&#xff0c;\u624b\u52a8\u5355\u70b9\u68c0\u6d4b&#xff1b;\u5de5\u5355\u89e6\u53d1\u5355\u72ec\u6821\u9a8c\u6545\u969c\u8bbe\u5907\u3002<\/p>\n<p>\u5165\u53c2<\/p>\n<p>modelId \u6a21\u578b ID\u3001objectId \u76d1\u63a7\u5bf9\u8c61 ID&#xff0c;\u5747\u4e3a URL \u53c2\u6570\u4f20\u9012\u3002<\/p>\n<p>\u903b\u8f91\u6d41\u7a0b<\/p>\n<li>\n<p>\u6253\u5370\u8bf7\u6c42\u65e5\u5fd7&#xff0c;\u8bb0\u5f55\u4e24\u4e2a ID&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528\u95e8\u9762\u670d\u52a1alarmEngineService.executeForObject(modelId, objectId)&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u76f4\u63a5\u8fd4\u56de\u5355\u4e2a\u8bbe\u5907\u5b8c\u6574\u6267\u884c\u7ed3\u679cAlarmEngineResult&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5f02\u5e38\u6355\u83b7\u8fd4\u56de\u5931\u8d25\u4fe1\u606f\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 3&#xff1a;POST \/api\/alarmEngine\/executeModels<\/p>\n<p>\u529f\u80fd<\/p>\n<p>\u6279\u91cf\u6267\u884c\u591a\u4e2a\u544a\u8b66\u6a21\u578b&#xff0c;\u4e00\u6b21\u6027\u4f20\u5165\u591a\u4e2a modelId&#xff0c;\u5faa\u73af\u9010\u4e2a\u6267\u884c\u6a21\u578b\u5168\u91cf\u8bbe\u5907\u68c0\u6d4b\u3002 \u524d\u7aef\u573a\u666f&#xff1a;\u540e\u53f0\u6279\u91cf\u5de1\u68c0\u4efb\u52a1\u3001\u5b9a\u65f6\u4efb\u52a1\u624b\u52a8\u6279\u91cf\u89e6\u53d1\u5168\u90e8\u544a\u8b66\u6a21\u578b\u3002<\/p>\n<p>\u5165\u53c2<\/p>\n<p>&#064;RequestBody List&lt;String&gt; modelIds \u8bf7\u6c42\u4f53 JSON \u6570\u7ec4&#xff0c;\u591a\u4e2a\u6a21\u578b ID \u96c6\u5408\u3002<\/p>\n<p>\u6838\u5fc3\u903b\u8f91<\/p>\n<li>\n<p>\u6253\u5370\u6279\u91cf\u6267\u884c\u65e5\u5fd7&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5faa\u73af\u904d\u5386\u6bcf\u4e2a\u6a21\u578b ID&#xff0c;\u8c03\u7528alarmEngine.executeModel\u6267\u884c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6c47\u603b\u5168\u5c40\u7edf\u8ba1\u6307\u6807&#xff1a;<\/p>\n<ul>\n<li>\n<p>totalModels&#xff1a;\u672c\u6b21\u6267\u884c\u6a21\u578b\u603b\u4e2a\u6570<\/p>\n<\/li>\n<li>\n<p>totalTriggered&#xff1a;\u5168\u90e8\u89e6\u53d1\u544a\u8b66\u7684\u76d1\u63a7\u5bf9\u8c61\u603b\u6570<\/p>\n<\/li>\n<li>\n<p>totalAlarms&#xff1a;\u6240\u6709\u6a21\u578b\u4ea7\u751f\u544a\u8b66\u8bb0\u5f55\u603b\u6570<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5b58\u50a8\u6bcf\u4e2a\u6a21\u578b\u5bf9\u5e94\u7684\u8bbe\u5907\u6267\u884c\u660e\u7ec6 Map&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7ec4\u88c5\u6279\u91cf\u6267\u884c\u6c47\u603b\u7ed3\u679c\u8fd4\u56de\u524d\u7aef\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 4&#xff1a;GET \/api\/alarmEngine\/testRuleTree<\/p>\n<p>\u529f\u80fd<\/p>\n<p>\u8c03\u8bd5\u63a5\u53e3&#xff1a;\u6784\u5efa\u89c4\u5219\u6811\u5e76\u8fd4\u56de\u683c\u5f0f\u5316\u6587\u672c\u6811\u5f62\u7ed3\u6784&#xff0c;\u7528\u4e8e\u6392\u67e5\u89c4\u5219\u6811\u914d\u7f6e\u9519\u8bef\u3001\u7236\u5b50\u8282\u70b9\u3001\u903b\u8f91\u8fd0\u7b97\u7b26\u5f02\u5e38\u3002 \u524d\u7aef\u573a\u666f&#xff1a;\u89c4\u5219\u6811\u914d\u7f6e\u9884\u89c8\u3001\u8fd0\u7ef4\u6392\u67e5\u544a\u8b66\u5f02\u5e38\u3002<\/p>\n<p>\u5165\u53c2<\/p>\n<p>&#064;RequestParam String modelId \u6a21\u578b ID\u3002<\/p>\n<p>\u903b\u8f91\u6d41\u7a0b<\/p>\n<li>\n<p>\u6253\u5370\u8c03\u8bd5\u65e5\u5fd7&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528alarmEngineService.getRuleTreeStructure(modelId)&#xff0c;\u83b7\u53d6\u5e26\u5c42\u7ea7\u7f29\u8fdb\u7684\u7eaf\u6587\u672c\u89c4\u5219\u6811&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de\u6587\u672c\u5185\u5bb9\u7ed9\u524d\u7aef\u5c55\u793a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6355\u83b7\u6784\u5efa\u89c4\u5219\u6811\u5931\u8d25\u5f02\u5e38&#xff0c;\u8fd4\u56de\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<\/li>\n<\/p>\n<h3>\u5b9a\u65f6\u4efb\u52a1<\/h3>\n<h4>AlarmTaskController.java<\/h4>\n<p>\u4e00\u3001\u6574\u4f53\u5b9a\u4f4d<\/p>\n<p>\u8be5\u63a7\u5236\u5668\u5c5e\u4e8e ZNYW \u667a\u80fd\u8fd0\u7ef4\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1\u6a21\u5757&#xff0c;\u63d0\u4f9b\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1\u7684\u5168\u5957 CRUD\u3001\u591a\u6761\u4ef6\u5206\u9875\u7b5b\u9009\u3001\u6761\u4ef6\u67e5\u8be2\u63a5\u53e3\u3002 \u6574\u4f53\u5206\u5c42\u94fe\u8def&#xff1a;\u524d\u7aef\u9875\u9762\u8bf7\u6c42 \u2192 AlarmTaskController \u2192 AlarmTaskService \u2192 Mapper \u2192 \u8fbe\u68a6\u6570\u636e\u5e93 t_alarm_task \u544a\u8b66\u5b9a\u65f6\u4efb\u52a1\u8868\u3002 \u548c\u524d\u9762 AlarmEngine \u544a\u8b66\u5f15\u64ce\u914d\u5957&#xff1a;AlarmTask \u662f\u5b9a\u65f6\u8c03\u5ea6\u914d\u7f6e&#xff0c;AlarmEngine \u662f\u5b9e\u9645\u6267\u884c\u8ba1\u7b97\u903b\u8f91\u3002<\/p>\n<p>\u6838\u5fc3\u4e1a\u52a1\u5173\u7cfb<\/p>\n<li>\n<p>AlarmTask&#xff1a;\u5b58\u50a8\u5b9a\u65f6\u4efb\u52a1\u914d\u7f6e&#xff08;\u4efb\u52a1\u540d\u79f0\u3001cron \u6267\u884c\u8868\u8fbe\u5f0f\u3001\u7ed1\u5b9a\u544a\u8b66\u6a21\u578b\u3001\u542f\u505c\u72b6\u6001\u3001\u6267\u884c\u7c7b\u578b&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Spring &#064;EnableScheduling \u5b9a\u65f6\u6846\u67b6\u8bfb\u53d6\u4efb\u52a1\u914d\u7f6e&#xff0c;\u5b9a\u65f6\u8c03\u7528 AlarmEngine \u6267\u884c\u544a\u8b66\u6a21\u578b\u8ba1\u7b97\u3002<\/p>\n<\/li>\n<p>\u4e8c\u3001\u5934\u90e8\u57fa\u7840\u4fe1\u606f<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.xxx.bussiness.znyw.controller;<\/p>\n<p>\u548c\u544a\u8b66\u5f15\u64ce\u3001\u544a\u8b66\u6a21\u578b\u3001\u544a\u8b66\u89c4\u5219\u63a7\u5236\u5668\u540c\u5305&#xff0c;\u7edf\u4e00\u667a\u80fd\u8fd0\u7ef4\u63a5\u53e3\u5c42\u3002<\/p>\n<p>2. \u5bfc\u5165\u7c7b\u8bf4\u660e<\/p>\n<li>\n<p>\u5206\u9875\u5de5\u5177&#xff1a;DataPaging \u9879\u76ee\u7edf\u4e00\u5206\u9875\u8f7d\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40\u6807\u51c6\u8fd4\u56de\u4f53&#xff1a;JsonMessage&lt;T&gt;&#xff0c;\u672c\u63a7\u5236\u5668\u7edf\u4e00\u4f7f\u7528\u9879\u76ee\u89c4\u8303\u8fd4\u56de\u5bf9\u8c61&#xff0c;\u548c\u524d\u9762\u544a\u8b66\u5f15\u64ce Controller \u624b\u52a8 HashMap \u8fd4\u56de\u5f62\u6210\u533a\u5206&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u4f53&#xff1a;AlarmTask \u544a\u8b66\u5b9a\u65f6\u4efb\u52a1\u6570\u636e\u5e93\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u5c42&#xff1a;AlarmTaskService \u4efb\u52a1\u4e1a\u52a1\u63a5\u53e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Spring Web RESTful \u6807\u51c6\u6ce8\u89e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bb9\u5668&#xff1a;HashMap\u3001List\u3001Map \u7528\u4e8e\u5c01\u88c5\u5206\u9875\u7b5b\u9009\u53c2\u6570\u3002<\/p>\n<\/li>\n<p>3. \u7c7b\u6ce8\u89e3\u4e0e\u4f9d\u8d56\u6ce8\u5165<\/p>\n<p>&#064;RestController<br \/>\n&#064;RequestMapping(&#034;\/api\/alarmTask&#034;)<br \/>\n&#064;Autowired<br \/>\nprivate AlarmTaskService alarmTaskService;<\/p>\n<li>\n<p>&#064;RestController&#xff1a;\u63a5\u53e3\u81ea\u52a8\u5e8f\u5217\u5316\u4e3a JSON&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40\u63a5\u53e3\u524d\u7f00 \/api\/alarmTask&#xff0c;\u6240\u6709\u5b9a\u65f6\u4efb\u52a1\u63a5\u53e3\u7edf\u4e00\u8def\u5f84&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4ec5\u6ce8\u5165 AlarmTaskService&#xff0c;\u6240\u6709\u4e1a\u52a1\u903b\u8f91\u4e0b\u6c89\u81f3 Service \u5c42&#xff0c;Controller \u4ec5\u5904\u7406\u8bf7\u6c42\u53c2\u6570\u3001\u8c03\u7528\u4e1a\u52a1\u3001\u5c01\u88c5\u8fd4\u56de\u3002<\/p>\n<\/li>\n<p>\u4e09\u3001\u5168\u90e8\u63a5\u53e3\u9010\u6bb5\u8be6\u89e3&#xff08;\u6807\u51c6 REST \u89c4\u8303&#xff09;<\/p>\n<p>\u63a5\u53e3 1&#xff1a;\u5206\u9875\u591a\u6761\u4ef6\u67e5\u8be2 GET \/api\/alarmTask\/list\/page<\/p>\n<p>\u7528\u9014&#xff1a;\u524d\u7aef\u544a\u8b66\u4efb\u52a1\u7ba1\u7406\u5217\u8868\u9875\u9762&#xff0c;\u5206\u9875 &#043; \u591a\u7ef4\u5ea6\u7b5b\u9009\u4efb\u52a1\u3002<\/p>\n<p>\u5165\u53c2\u8bf4\u660e<\/p>\n<table>\n<tr>\n<p>\u53c2\u6570<\/p>\n<p>\u662f\u5426\u5fc5\u586b<\/p>\n<p>\u9ed8\u8ba4\u503c<\/p>\n<p>\u4f5c\u7528<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>taskName<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u65e0<\/p>\n<\/td>\n<td>\n<p>\u4efb\u52a1\u540d\u79f0\u6a21\u7cca\u67e5\u8be2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>taskCode<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u65e0<\/p>\n<\/td>\n<td>\n<p>\u4efb\u52a1\u7f16\u7801\u7cbe\u786e\u5339\u914d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>executionType<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u65e0<\/p>\n<\/td>\n<td>\n<p>\u6267\u884c\u7c7b\u578b&#xff08;\u5b9a\u65f6 \/ \u624b\u52a8&#xff09;\u7b5b\u9009<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>status<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>\u65e0<\/p>\n<\/td>\n<td>\n<p>\u4efb\u52a1\u542f\u7528 \/ \u505c\u7528\u72b6\u6001\u7b5b\u9009<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>page<\/p>\n<\/td>\n<td>\n<p>\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>\u5f53\u524d\u9875\u7801&#xff0c;\u4e0d\u4f20\u9ed8\u8ba4\u7b2c\u4e00\u9875<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>row<\/p>\n<\/td>\n<td>\n<p>\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>10<\/p>\n<\/td>\n<td>\n<p>\u6bcf\u9875\u6761\u6570&#xff0c;\u4e0d\u4f20\u9ed8\u8ba4 10 \u6761<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u903b\u8f91\u6d41\u7a0b<\/p>\n<li>\n<p>\u521d\u59cb\u5316\u7a7a Map&#xff0c;\u4ec5\u5c06\u975e\u7a7a\u3001\u975e\u7a7a\u767d\u7684\u7b5b\u9009\u53c2\u6570\u5b58\u5165 map&#xff0c;\u907f\u514d\u4f20\u9012\u7a7a\u5b57\u7b26\u4e32\u7ed9 SQL&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 service \u5206\u9875\u67e5\u8be2\u65b9\u6cd5&#xff0c;\u8fd4\u56de\u5206\u9875\u5bf9\u8c61 DataPaging&lt;AlarmTask&gt;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528\u5168\u5c40\u6807\u51c6\u8fd4\u56de\u4f53 JsonMessage&lt;DataPaging&lt;AlarmTask&gt;&gt; \u8fd4\u56de\u6210\u529f\u6570\u636e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5168\u5c40 try-catch \u6355\u83b7\u6240\u6709\u5f02\u5e38&#xff0c;\u7edf\u4e00\u8fd4\u56de\u5931\u8d25\u63d0\u793a\u6587\u6848\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 2&#xff1a;\u6839\u636e\u4e3b\u952e ID \u67e5\u8be2\u5355\u6761\u4efb\u52a1 GET \/{id}<\/p>\n<li>\n<p>\u8def\u5f84\u53c2\u6570 id&#xff1a;\u544a\u8b66\u4efb\u52a1\u4e3b\u952e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u903b\u8f91&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u67e5\u8be2\u5b9e\u4f53\u4e0d\u4e3a\u7a7a\u8fd4\u56de\u6210\u529f\u6570\u636e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65e0\u6570\u636e\u8fd4\u56de\u4e1a\u52a1\u63d0\u793a\u300c\u672a\u627e\u5230\u5bf9\u5e94\u7684\u544a\u8b66\u4efb\u52a1\u300d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5f02\u5e38\u6355\u83b7\u8fd4\u56de\u5931\u8d25\u4fe1\u606f\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<p>\u63a5\u53e3 3&#xff1a;\u67e5\u8be2\u5168\u90e8\u4efb\u52a1 GET \/all<\/p>\n<p>\u8fd4\u56de\u65e0\u5206\u9875\u7684\u5168\u91cf\u4efb\u52a1\u5217\u8868&#xff0c;\u4e1a\u52a1\u573a\u666f&#xff1a;\u4e0b\u62c9\u9009\u62e9\u6846\u3001\u6570\u636e\u5b57\u5178\u52a0\u8f7d&#xff0c;\u9002\u7528\u4e8e\u4efb\u52a1\u603b\u91cf\u4e0d\u5927\u573a\u666f\u3002<\/p>\n<p>\u63a5\u53e3 4&#xff1a;\u65b0\u589e\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1 POST \/add<\/p>\n<li>\n<p>&#064;RequestBody AlarmTask&#xff1a;\u63a5\u6536\u524d\u7aef\u8868\u5355\u5b8c\u6574 JSON \u4efb\u52a1\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 service \u65b0\u589e\u65b9\u6cd5&#xff0c;\u6839\u636e\u8fd4\u56de\u5e03\u5c14\u503c\u5224\u65ad\u65b0\u589e\u662f\u5426\u6210\u529f&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6355\u83b7\u5165\u5e93\u5f02\u5e38&#xff0c;\u8fd4\u56de\u5931\u8d25\u63d0\u793a\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 5&#xff1a;\u4fee\u6539\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1 PUT \/update<\/p>\n<p>\u9075\u5faa REST \u89c4\u8303&#xff0c;PUT \u7528\u4e8e\u5168\u91cf\u66f4\u65b0\u4efb\u52a1\u914d\u7f6e&#xff1b;\u63a5\u6536\u5b8c\u6574 AlarmTask \u5b9e\u4f53&#xff0c;Service \u5c42\u6839\u636e\u4e3b\u952e ID \u66f4\u65b0\u6570\u636e\u5e93\u8bb0\u5f55\u3002<\/p>\n<p>\u63a5\u53e3 6&#xff1a;\u5220\u9664\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1 DELETE \/{id}<\/p>\n<p>\u6807\u51c6 DELETE \u5220\u9664\u63a5\u53e3&#xff0c;\u6839\u636e\u4e3b\u952e\u6267\u884c\u5220\u9664\u64cd\u4f5c&#xff0c;\u8fd4\u56de\u5220\u9664\u7ed3\u679c\u5e03\u5c14\u503c\u3002<\/p>\n<p>\u63a5\u53e3 7&#xff1a;\u6309\u72b6\u6001\u7b5b\u9009\u4efb\u52a1 GET \/byStatus<\/p>\n<p>\u5165\u53c2 status&#xff0c;\u67e5\u8be2\u6307\u5b9a\u542f\u7528 \/ \u505c\u7528\u72b6\u6001\u7684\u5168\u90e8\u5b9a\u65f6\u4efb\u52a1&#xff0c;\u7528\u4e8e\u524d\u7aef\u5217\u8868\u72b6\u6001\u7b5b\u9009\u4e0b\u62c9\u3002<\/p>\n<p>\u63a5\u53e3 8&#xff1a;\u6309\u6267\u884c\u7c7b\u578b\u7b5b\u9009 GET \/byExecutionType<\/p>\n<p>\u5165\u53c2 executionType&#xff0c;\u6839\u636e\u6267\u884c\u7c7b\u578b&#xff08;\u81ea\u52a8\u5b9a\u65f6\u6267\u884c\u3001\u624b\u52a8\u89e6\u53d1&#xff09;\u7b5b\u9009\u4efb\u52a1\u5217\u8868\u3002<\/p>\n<\/p>\n<\/p>\n<h4>AlarmTaskService.java<\/h4>\n<p>\u4e00\u3001\u63a5\u53e3\u6574\u4f53\u5b9a\u4f4d<\/p>\n<p>\u8fd9\u662f\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1\u6a21\u5757\u7684\u4e1a\u52a1\u5c42\u6807\u51c6\u62bd\u8c61\u63a5\u53e3&#xff0c;<span style=\"color:#fe2c24\">\u9075\u5faa\u9879\u76ee\u7edf\u4e00\u5206\u5c42\u67b6\u6784&#xff1a;Controller \u2192 Service\u63a5\u53e3 \u2192 ServiceImpl\u5b9e\u73b0\u7c7b \u2192 Mapper<\/span>\u3002 \u63a5\u53e3\u4ec5\u5b9a\u4e49\u5168\u90e8\u4e1a\u52a1\u80fd\u529b\u5951\u7ea6&#xff0c;\u53ea\u58f0\u660e\u65b9\u6cd5\u3001\u5165\u53c2\u3001\u8fd4\u56de\u503c\u4e0e JavaDoc \u6ce8\u91ca&#xff0c;\u65e0\u4efb\u4f55\u4e1a\u52a1\u903b\u8f91\u3001\u6570\u636e\u5e93\u64cd\u4f5c&#xff1b;\u5b9e\u73b0\u7c7bAlarmTaskServiceImpl\u5b8c\u6210\u53c2\u6570\u5904\u7406\u3001SQL \u8c03\u7528\u3001\u6570\u636e\u6821\u9a8c\u7b49\u903b\u8f91\u3002<\/p>\n<p>\u8bbe\u8ba1\u6838\u5fc3\u4ef7\u503c&#xff08;\u9762\u5411\u63a5\u53e3\u7f16\u7a0b&#xff09;<\/p>\n<li>\n<p>\u5206\u5c42\u89e3\u8026&#xff1a;Controller \u53ea\u4f9d\u8d56\u62bd\u8c61\u63a5\u53e3&#xff0c;\u4e0d\u7ed1\u5b9a\u5177\u4f53\u5b9e\u73b0\u7c7b&#xff1b;\u540e\u7eed\u66f4\u6362\u6570\u636e\u6e90\u3001\u91cd\u6784\u4e1a\u52a1\u903b\u8f91&#xff0c;\u4ec5\u4fee\u6539 ServiceImpl&#xff0c;\u4e0a\u5c42 Controller \u5b8c\u5168\u4e0d\u7528\u6539\u52a8\u3002<\/p>\n<\/li>\n<li>\n<p>\u5355\u5143\u6d4b\u8bd5\u53cb\u597d&#xff1a;\u5355\u5143\u6d4b\u8bd5\u53ef\u76f4\u63a5 Mock \u672c\u63a5\u53e3&#xff0c;\u65e0\u9700\u8fde\u63a5\u771f\u5b9e\u8fbe\u68a6\u6570\u636e\u5e93\u3002<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u5f00\u53d1\u89c4\u8303&#xff1a;\u548c\u524d\u9762AlarmModelService\u3001AlarmRuleService\u63a5\u53e3\u683c\u5f0f\u3001\u65b9\u6cd5\u547d\u540d\u3001\u6ce8\u91ca\u89c4\u8303\u5b8c\u5168\u7edf\u4e00&#xff0c;\u56e2\u961f\u534f\u4f5c\u53ef\u8bfb\u6027\u9ad8\u3002<\/p>\n<\/li>\n<p>\u4e8c\u3001\u57fa\u7840\u5934\u90e8\u4fe1\u606f<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.xxx.bussiness.znyw.service;<\/p>\n<p>\u548c\u544a\u8b66\u6a21\u578b\u3001\u544a\u8b66\u89c4\u5219\u4e1a\u52a1\u63a5\u53e3\u540c\u5305&#xff0c;\u7edf\u4e00\u667a\u80fd\u8fd0\u7ef4 ZNYW \u6a21\u5757\u4e1a\u52a1\u63a5\u53e3\u5c42\u3002<\/p>\n<p>2. \u5bfc\u5165\u4f9d\u8d56\u8bf4\u660e<\/p>\n<li>\n<p>DataPaging&#xff1a;\u9879\u76ee\u5168\u5c40\u901a\u7528\u5206\u9875\u5c01\u88c5\u5bf9\u8c61&#xff0c;\u5206\u9875\u67e5\u8be2\u7edf\u4e00\u8fd4\u56de\u8be5\u8f7d\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmTask&#xff1a;\u6570\u636e\u5e93t_alarm_task\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1\u8868\u5b9e\u4f53&#xff0c;CRUD \u64cd\u4f5c\u7684\u5165\u53c2\u3001\u8fd4\u56de\u8f7d\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u96c6\u5408\u5bb9\u5668&#xff1a;List\u627f\u8f7d\u591a\u6761\u4efb\u52a1\u6570\u636e&#xff0c;Map&lt;String,Object&gt;\u627f\u8f7d\u52a8\u6001\u591a\u6761\u4ef6\u5206\u9875\u7b5b\u9009\u53c2\u6570\u3002<\/p>\n<\/li>\n<p>\u4e09\u3001\u5168\u90e8\u65b9\u6cd5\u5206\u7ec4\u62c6\u89e3<\/p>\n<p>\u5206\u7ec4 1&#xff1a;\u5206\u9875\u591a\u6761\u4ef6\u5217\u8868\u67e5\u8be2&#xff08;\u524d\u7aef\u4efb\u52a1\u5217\u8868\u6838\u5fc3\u63a5\u53e3&#xff09;<\/p>\n<p>DataPaging&lt;AlarmTask&gt; selectPagingAlarmTaskList(Map&lt;String, Object&gt; paramMap, int page, int row);<\/p>\n<li>\n<p>\u5165\u53c2&#xff1a;<\/p>\n<ul>\n<li>\n<p>paramMap&#xff1a;\u52a8\u6001\u7b5b\u9009\u6761\u4ef6 Map&#xff0c;\u627f\u8f7d\u4efb\u52a1\u540d\u79f0\u3001\u4efb\u52a1\u7f16\u7801\u3001\u6267\u884c\u7c7b\u578b\u3001\u72b6\u6001\u7b49\u591a\u7ef4\u5ea6\u67e5\u8be2\u6761\u4ef6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>page \u5f53\u524d\u9875\u7801\u3001row \u6bcf\u9875\u5c55\u793a\u6761\u6570&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8fd4\u56de&#xff1a;\u5206\u9875\u5c01\u88c5\u5bf9\u8c61DataPaging&lt;AlarmTask&gt;&#xff0c;\u5305\u542b\u603b\u6570\u636e\u6761\u6570\u3001\u5f53\u524d\u9875\u4efb\u52a1\u5217\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5e94 Controller \u63a5\u53e3&#xff1a;GET \/api\/alarmTask\/list\/page\u3002<\/p>\n<\/li>\n<p>\u5206\u7ec4 2&#xff1a;\u57fa\u7840\u5355\u8868 CRUD&#xff08;\u589e\u5220\u6539\u67e5\u57fa\u7840\u80fd\u529b&#xff09;<\/p>\n<p>\/\/ \u6839\u636e\u4e3b\u952eID\u67e5\u8be2\u5355\u6761\u5b9a\u65f6\u4efb\u52a1\u8be6\u60c5<br \/>\nAlarmTask getById(String id);<br \/>\n\/\/ \u67e5\u8be2\u5168\u91cf\u65e0\u5206\u9875\u4efb\u52a1\u5217\u8868&#xff08;\u4e0b\u62c9\u9009\u62e9\u3001\u5b57\u5178&#xff09;<br \/>\nList&lt;AlarmTask&gt; getAll();<br \/>\n\/\/ \u65b0\u589e\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1<br \/>\nboolean add(AlarmTask alarmTask);<br \/>\n\/\/ \u66f4\u65b0\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1\u914d\u7f6e<br \/>\nboolean update(AlarmTask alarmTask);<br \/>\n\/\/ \u6839\u636e\u4e3b\u952e\u5220\u9664\u5b9a\u65f6\u4efb\u52a1<br \/>\nboolean deleteById(String id);<\/p>\n<li>\n<p>\u8fd4\u56de\u503cboolean\u542b\u4e49&#xff1a;\u6570\u636e\u5e93\u64cd\u4f5c\u53d7\u5f71\u54cd\u884c\u6570 &gt; 0 \u5219\u8fd4\u56de true&#xff08;\u64cd\u4f5c\u6210\u529f&#xff09;&#xff0c;\u65e0\u5339\u914d\u6570\u636e\u8fd4\u56de false&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u573a\u666f&#xff1a;\u65b0\u589e \/ \u7f16\u8f91 \/ \u5220\u9664\u5f39\u7a97\u3001\u5355\u6761\u8be6\u60c5\u56de\u663e\u3001\u9875\u9762\u4e0b\u62c9\u52a0\u8f7d\u5168\u90e8\u5b9a\u65f6\u4efb\u52a1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5e94 Controller \u63a5\u53e3&#xff1a;\/{id}\u3001\/all\u3001POST \/add\u3001PUT \/update\u3001DELETE \/{id}\u3002<\/p>\n<\/li>\n<p>\u5206\u7ec4 3&#xff1a;\u552f\u4e00\u6027\u6821\u9a8c\u4e13\u7528\u65b9\u6cd5&#xff08;\u65b0\u589e\u4efb\u52a1\u7f16\u7801\u91cd\u590d\u6821\u9a8c&#xff09;<\/p>\n<p>AlarmTask getByTaskCode(String taskCode);<\/p>\n<ul>\n<li>\n<p>\u4f5c\u7528&#xff1a;\u6839\u636e\u4efb\u52a1\u7f16\u7801 taskCode\u7cbe\u786e\u67e5\u8be2\u4efb\u52a1\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6838\u5fc3\u4e1a\u52a1\u573a\u666f&#xff1a;\u65b0\u589e\u5b9a\u65f6\u4efb\u52a1\u65f6\u6821\u9a8c\u7f16\u7801\u552f\u4e00\u6027&#xff0c;\u9632\u6b62\u6570\u636e\u5e93\u5b58\u5728\u91cd\u590d\u7f16\u7801\u5bfc\u81f4\u4e1a\u52a1\u51b2\u7a81&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5f53\u524d Controller \u672a\u63d0\u4f9b\u524d\u7aef\u8c03\u7528\u63a5\u53e3&#xff0c;\u5c5e\u4e8e\u5185\u90e8\u4e1a\u52a1\u6821\u9a8c\u65b9\u6cd5&#xff0c;\u4f9b add \u65b0\u589e\u903b\u8f91\u524d\u7f6e\u6821\u9a8c\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u5206\u7ec4 4&#xff1a;\u6761\u4ef6\u6279\u91cf\u7b5b\u9009\u67e5\u8be2&#xff08;\u9875\u9762\u4e0b\u62c9\u8fc7\u6ee4&#xff09;<\/p>\n<p>\/\/ \u6839\u636e\u4efb\u52a1\u542f\u505c\u72b6\u6001\u6279\u91cf\u67e5\u8be2<br \/>\nList&lt;AlarmTask&gt; getByStatus(String status);<br \/>\n\/\/ \u6839\u636e\u4efb\u52a1\u6267\u884c\u7c7b\u578b\u6279\u91cf\u67e5\u8be2&#xff08;\u81ea\u52a8\u5b9a\u65f6\/\u624b\u52a8\u6267\u884c&#xff09;<br \/>\nList&lt;AlarmTask&gt; getByExecutionType(String executionType);<\/p>\n<li>\n<p>getByStatus&#xff1a;\u7b5b\u9009\u542f\u7528 \/ \u505c\u7528\u7684\u5b9a\u65f6\u4efb\u52a1\u5217\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getByExecutionType&#xff1a;\u6309\u6267\u884c\u7c7b\u578b\u7b5b\u9009\u4efb\u52a1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u5e94 Controller \u63a5\u53e3&#xff1a;\/byStatus\u3001\/byExecutionType&#xff0c;\u7528\u4e8e\u524d\u7aef\u5217\u8868\u7b5b\u9009\u4e0b\u62c9\u6846\u3002<\/p>\n<\/li>\n<p>\u56db\u3001\u63a5\u53e3\u4e0e Controller \u5b8c\u6574\u6620\u5c04\u5bf9\u7167\u8868<\/p>\n<table>\n<tr>\n<p>Service \u63a5\u53e3\u65b9\u6cd5<\/p>\n<p>\u540e\u7aef API \u5730\u5740<\/p>\n<p>\u524d\u7aef\u4e1a\u52a1\u573a\u666f<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>selectPagingAlarmTaskList<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmTask\/list\/page<\/p>\n<\/td>\n<td>\n<p>\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1\u7ba1\u7406\u5217\u8868\u5206\u9875\u3001\u591a\u6761\u4ef6\u7b5b\u9009<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getById<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmTask\/{id}<\/p>\n<\/td>\n<td>\n<p>\u7f16\u8f91\u5f39\u7a97\u56de\u663e\u5355\u6761\u4efb\u52a1\u5b8c\u6574\u914d\u7f6e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getAll<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmTask\/all<\/p>\n<\/td>\n<td>\n<p>\u544a\u8b66\u6a21\u578b\u65b0\u589e\u9875\u9762\u4e0b\u62c9\u9009\u62e9\u7ed1\u5b9a\u5b9a\u65f6\u4efb\u52a1<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>add<\/p>\n<\/td>\n<td>\n<p>POST \/api\/alarmTask\/add<\/p>\n<\/td>\n<td>\n<p>\u65b0\u589e\u5b9a\u65f6\u4efb\u52a1\u5f39\u7a97\u63d0\u4ea4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>update<\/p>\n<\/td>\n<td>\n<p>PUT \/api\/alarmTask\/update<\/p>\n<\/td>\n<td>\n<p>\u7f16\u8f91\u5b9a\u65f6\u4efb\u52a1\u8868\u5355\u4fdd\u5b58\u914d\u7f6e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>deleteById<\/p>\n<\/td>\n<td>\n<p>DELETE \/api\/alarmTask\/{id}<\/p>\n<\/td>\n<td>\n<p>\u5217\u8868\u5220\u9664\u6309\u94ae\u64cd\u4f5c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByTaskCode<\/p>\n<\/td>\n<td>\n<p>\u5185\u90e8\u8c03\u7528&#xff0c;\u65e0\u524d\u7aef\u63a5\u53e3<\/p>\n<\/td>\n<td>\n<p>\u65b0\u589e\u4efb\u52a1\u65f6\u6821\u9a8c taskCode \u7f16\u7801\u552f\u4e00\u6027<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByStatus<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmTask\/byStatus<\/p>\n<\/td>\n<td>\n<p>\u5217\u8868\u6309\u4efb\u52a1\u542f\u505c\u72b6\u6001\u7b5b\u9009<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>getByExecutionType<\/p>\n<\/td>\n<td>\n<p>\/api\/alarmTask\/byExecutionType<\/p>\n<\/td>\n<td>\n<p>\u5217\u8868\u6309\u6267\u884c\u7c7b\u578b\u7b5b\u9009<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/p>\n<h4>AlarmTaskServiceImpl.java<\/h4>\n<p>\u4e00\u3001\u6574\u4f53\u5b9a\u4f4d<\/p>\n<p>\u672c\u7c7b\u662f AlarmTaskService \u63a5\u53e3\u7684\u5b8c\u6574\u5b9e\u73b0\u5c42&#xff0c;\u5206\u5c42\u94fe\u8def&#xff1a;Controller \u2192 AlarmTaskService\u63a5\u53e3 \u2192 AlarmTaskServiceImpl\u5b9e\u73b0\u7c7b \u2192 AlarmTaskMapper \u2192 \u8fbe\u68a6\u6570\u636e\u5e93 t_alarm_task\u3002 \u6838\u5fc3\u804c\u8d23&#xff1a;\u53c2\u6570\u6e05\u6d17\u3001\u4e1a\u52a1\u9ed8\u8ba4\u503c\u515c\u5e95\u3001\u4e3b\u952e \/ \u65f6\u95f4\u7ba1\u63a7\u3001\u5206\u9875\u8ba1\u7b97\u3001\u6570\u636e\u5e93 SQL \u8c03\u7528\u3001\u975e\u6cd5\u53c2\u6570\u62e6\u622a&#xff0c;\u548c\u524d\u9762 AlarmModelServiceImpl\u3001AlarmRuleServiceImpl \u7f16\u7801\u89c4\u8303\u3001\u5b89\u5168\u6821\u9a8c\u903b\u8f91\u5b8c\u5168\u7edf\u4e00\u3002<\/p>\n<p>\u4e8c\u3001\u5934\u90e8\u57fa\u7840\u4fe1\u606f<\/p>\n<p>1. \u5305\u4e0e\u6ce8\u89e3<\/p>\n<p>package cn.com.xxx.bussiness.znyw.serviceImpl;<br \/>\n&#064;Service<br \/>\npublic class AlarmTaskServiceImpl implements AlarmTaskService<\/p>\n<li>\n<p>&#064;Service&#xff1a;Spring \u5c06\u5f53\u524d\u7c7b\u6ce8\u518c\u4e3a\u4e1a\u52a1\u5c42 Bean&#xff0c;\u4e0a\u5c42 Controller \u901a\u8fc7\u63a5\u53e3\u6ce8\u5165&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u73b0 AlarmTaskService \u63a5\u53e3&#xff0c;\u5f3a\u5236\u5b9e\u73b0\u63a5\u53e3\u5185\u5168\u90e8\u65b9\u6cd5&#xff0c;\u7ea6\u675f\u4e1a\u52a1\u80fd\u529b\u89c4\u8303\u3002<\/p>\n<\/li>\n<p>2. \u4f9d\u8d56\u6ce8\u5165<\/p>\n<p>&#064;Autowired<br \/>\nprivate AlarmTaskMapper alarmTaskMapper;<\/p>\n<p>\u4ec5\u6ce8\u5165\u5bf9\u5e94 Mapper&#xff0c;\u6240\u6709\u6570\u636e\u5e93\u64cd\u4f5c\u5747\u901a\u8fc7 Mapper \u5b8c\u6210&#xff0c;\u4e1a\u52a1\u5b9e\u73b0\u5c42\u4e0d\u5199\u539f\u751f SQL\u3002<\/p>\n<p>3. \u5bfc\u5165\u7c7b\u8bf4\u660e<\/p>\n<ul>\n<li>\n<p>DataPaging&#xff1a;\u7edf\u4e00\u5206\u9875\u8fd4\u56de\u8f7d\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmTask&#xff1a;\u5b9a\u65f6\u4efb\u52a1\u6570\u636e\u5e93\u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmTaskMapper&#xff1a;Mybatis \u6301\u4e45\u5c42&#xff1b;<\/p>\n<\/li>\n<li>\n<p>UUID&#xff1a;\u540e\u7aef\u751f\u6210\u4e3b\u952e ID&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Date&#xff1a;\u521b\u5efa \/ \u66f4\u65b0\u65f6\u95f4\u6233&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u96c6\u5408\u3001Map&#xff1a;\u5206\u9875\u53c2\u6570\u5c01\u88c5\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e09\u3001\u6838\u5fc3\u5206\u9875\u67e5\u8be2\u65b9\u6cd5 selectPagingAlarmTaskList<\/p>\n<p>1. \u53c2\u6570\u63d0\u53d6\u4e0e\u6e05\u6d17<\/p>\n<p>\u4ece paramMap \u53d6\u51fa 4 \u4e2a\u7b5b\u9009\u6761\u4ef6&#xff0c;\u7edf\u4e00\u6267\u884c trim() \u53bb\u9664\u524d\u540e\u7a7a\u683c&#xff0c;\u907f\u514d\u7a7a\u683c\u5e72\u6270\u67e5\u8be2\u3002<\/p>\n<p>2. \u6761\u4ef6\u8f6c\u6362&#xff08;Mybatis \u52a8\u6001 SQL \u4f18\u5316\u6838\u5fc3&#xff09;<\/p>\n<ul>\n<li>\n<p>taskName \u6a21\u7cca\u67e5\u8be2&#xff1a;\u975e\u7a7a\u81ea\u52a8\u62fc\u63a5 %\u5173\u952e\u8bcd%&#xff0c;\u4ea4\u7ed9 Mapper \u505a like \u6a21\u7cca\u5339\u914d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5176\u4f59\u53c2\u6570&#xff08;taskCode\u3001executionType\u3001status&#xff09;\u7a7a\u5b57\u7b26\u4e32\u8f6c\u4e3a null&#xff1b; \u4f5c\u7528&#xff1a;Mybatis \u52a8\u6001 SQL \u4f1a\u81ea\u52a8\u5ffd\u7565\u503c\u4e3a null \u7684\u6761\u4ef6&#xff0c;\u4e0d\u4f1a\u62fc\u63a5 AND xxx&#061;&#039;&#039; \u65e0\u6548\u8bed\u53e5&#xff0c;\u4fdd\u8bc1\u67e5\u8be2\u7ed3\u679c\u6b63\u786e\u3002<\/p>\n<\/li>\n<\/ul>\n<p>3. \u5206\u9875\u53c2\u6570\u5bb9\u9519\u5904\u7406<\/p>\n<p>if (page &lt;&#061; 0) page &#061; 1;<br \/>\nif (row &lt;&#061; 0) row &#061; 10;<br \/>\nint offset &#061; (page &#8211; 1) * row;<\/p>\n<p>\u524d\u7aef\u4f20\u5165\u975e\u6cd5\u5206\u9875\u503c&#xff08;\u8d1f\u6570\u30010&#xff09;\u81ea\u52a8\u4fee\u6b63&#xff0c;\u907f\u514d\u6570\u636e\u5e93 limit \u8bed\u6cd5\u62a5\u9519\u3002<\/p>\n<p>4. \u53cc Mapper \u67e5\u8be2<\/p>\n<li>\n<p>manualSelectAlarmTask&#xff1a;\u5206\u9875\u67e5\u8be2\u5f53\u524d\u9875\u6570\u636e\u5217\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>manualCountAlarmTask&#xff1a;\u7edf\u8ba1\u7b26\u5408\u7b5b\u9009\u6761\u4ef6\u603b\u6761\u6570&#xff1b; \u4e24\u6761 SQL \u4f20\u5165\u5b8c\u5168\u76f8\u540c\u7684\u7b5b\u9009\u53c2\u6570&#xff0c;\u4fdd\u8bc1\u5206\u9875\u603b\u6570\u548c\u5217\u8868\u6570\u636e\u5339\u914d\u3002<\/p>\n<\/li>\n<p>5. \u5206\u9875\u5bf9\u8c61\u5c01\u88c5<\/p>\n<p>\u5b9e\u4f8b\u5316 DataPaging&#xff0c;\u586b\u5145\u5217\u8868 rows \u4e0e\u603b\u6761\u6570 total&#xff0c;\u8fd4\u56de\u7ed9\u4e0a\u5c42 Controller\u3002<\/p>\n<p>\u56db\u3001\u57fa\u7840 CRUD \u65b9\u6cd5\u8be6\u89e3<\/p>\n<p>1. add \u65b0\u589e\u5b9a\u65f6\u4efb\u52a1&#xff08;\u540e\u7aef\u5f3a\u7ba1\u63a7&#xff0c;\u675c\u7edd\u524d\u7aef\u810f\u6570\u636e&#xff09;<\/p>\n<p>&#064;Override<br \/>\npublic boolean add(AlarmTask alarmTask) {<br \/>\n    \/\/ 1. \u540e\u7aef\u751f\u6210\u552f\u4e00\u4e3b\u952e&#xff0c;\u5b8c\u5168\u5ffd\u7565\u524d\u7aef\u4f20\u5165ID<br \/>\n    String id &#061; UUID.randomUUID().toString().replaceAll(&#034;-&#034;, &#034;&#034;);<br \/>\n    alarmTask.setId(id);<\/p>\n<p>    \/\/ 2. \u7edf\u4e00\u65f6\u95f4\u6233&#xff0c;\u521b\u5efa\/\u66f4\u65b0\u65f6\u95f4\u7531\u670d\u52a1\u7aef\u751f\u6210<br \/>\n    Date now &#061; new Date();<br \/>\n    alarmTask.setCreatedTime(now);<br \/>\n    alarmTask.setUpdateTime(now);<\/p>\n<p>    \/\/ 3. \u72b6\u6001\u9ed8\u8ba4\u503c\u515c\u5e95&#xff0c;\u672a\u4f20\u5219\u542f\u7528\u72b6\u60011<br \/>\n    if (alarmTask.getStatus() &#061;&#061; null || alarmTask.getStatus().trim().isEmpty()) {<br \/>\n        alarmTask.setStatus(&#034;1&#034;);<br \/>\n    }<\/p>\n<p>    \/\/ 4. \u5e76\u53d1\u7ea7\u522b\u515c\u5e95&#xff0c;\u9ed8\u8ba4\u5355\u7ebf\u7a0b\u6267\u884c\u5b9a\u65f6\u4efb\u52a1<br \/>\n    if (alarmTask.getConcurrencyLevel() &#061;&#061; null) {<br \/>\n        alarmTask.setConcurrencyLevel(1);<br \/>\n    }<\/p>\n<p>    return alarmTaskMapper.insert(alarmTask) &gt; 0;<br \/>\n}<\/p>\n<p>\u5b89\u5168\u8bbe\u8ba1\u4eae\u70b9<\/p>\n<li>\n<p>\u4e3b\u952e\u5b8c\u5168\u540e\u7aef\u7ba1\u63a7&#xff1a;UUID \u53bb\u9664\u6a2a\u6760\u751f\u6210\u552f\u4e00 ID&#xff0c;\u524d\u7aef\u4f20\u9012\u7684 ID \u76f4\u63a5\u8986\u76d6&#xff0c;\u9632\u6b62\u4e3b\u952e\u51b2\u7a81\u3001\u6076\u610f\u7be1\u6539&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65f6\u95f4\u6233\u670d\u52a1\u7aef\u7edf\u4e00\u751f\u6210&#xff1a;\u521b\u5efa\u65f6\u95f4\u3001\u66f4\u65b0\u65f6\u95f4\u4e0d\u4f9d\u8d56\u524d\u7aef\u4f20\u53c2&#xff0c;\u4fdd\u8bc1\u6570\u636e\u65f6\u95f4\u51c6\u786e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u5b57\u6bb5\u9ed8\u8ba4\u503c\u515c\u5e95<\/p>\n<ul>\n<li>\n<p>status \u4efb\u52a1\u542f\u505c\u72b6\u6001&#xff0c;\u7a7a\u503c\u9ed8\u8ba4\u542f\u75281&#xff1b;<\/p>\n<\/li>\n<li>\n<p>concurrencyLevel \u5b9a\u65f6\u4efb\u52a1\u5e76\u53d1\u6570&#xff0c;\u7a7a\u503c\u9ed8\u8ba4 1&#xff08;\u9632\u6b62\u591a\u7ebf\u7a0b\u5e76\u53d1\u6267\u884c\u544a\u8b66\u5f15\u64ce\u9020\u6210\u8d44\u6e90\u6324\u538b&#xff09;&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8fd4\u56de\u5e03\u5c14\u503c&#xff1a;\u6570\u636e\u5e93\u63d2\u5165\u53d7\u5f71\u54cd\u884c\u6570 &gt; 0 \u624d\u8fd4\u56de true&#xff0c;\u533a\u5206\u63d2\u5165\u6210\u529f \/ \u65e0\u6570\u636e\u3002<\/p>\n<\/li>\n<p>2. update \u66f4\u65b0\u65b9\u6cd5<\/p>\n<p>&#064;Override<br \/>\npublic boolean update(AlarmTask alarmTask) {<br \/>\n    \/\/ \u66f4\u65b0\u64cd\u4f5c\u5fc5\u987b\u643a\u5e26\u4e3b\u952eID&#xff0c;\u65e0ID\u76f4\u63a5\u629b\u51fa\u975e\u6cd5\u53c2\u6570\u5f02\u5e38<br \/>\n    if (alarmTask.getId() &#061;&#061; null || alarmTask.getId().trim().isEmpty()) {<br \/>\n        throw new IllegalArgumentException(&#034;\u66f4\u65b0\u64cd\u4f5c\u5fc5\u987b\u6307\u5b9aID&#034;);<br \/>\n    }<br \/>\n    \/\/ \u5f3a\u5236\u5237\u65b0\u66f4\u65b0\u65f6\u95f4\u6233<br \/>\n    alarmTask.setUpdateTime(new Date());<br \/>\n    return alarmTaskMapper.update(alarmTask) &gt; 0;<br \/>\n}<\/p>\n<li>\n<p>\u524d\u7f6e\u5f3a\u6821\u9a8c&#xff1a;\u66f4\u65b0\u5b9e\u4f53\u65e0\u4e3b\u952e ID \u76f4\u63a5\u629b\u5f02\u5e38&#xff0c;\u62e6\u622a\u65e0\u6548\u66f4\u65b0 SQL&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u81ea\u52a8\u5237\u65b0 updateTime&#xff0c;\u8bb0\u5f55\u672c\u6b21\u4fee\u6539\u65f6\u95f4&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6839\u636e\u6570\u636e\u5e93\u5f71\u54cd\u884c\u6570\u5224\u65ad\u64cd\u4f5c\u7ed3\u679c\u3002<\/p>\n<\/li>\n<p>3. deleteById \u5220\u9664\u3001\u5355\u6761 \/ \u5168\u91cf\u67e5\u8be2<\/p>\n<p>&#064;Override<br \/>\npublic AlarmTask getById(String id) {<br \/>\n    return alarmTaskMapper.selectById(id);<br \/>\n}<br \/>\n&#064;Override<br \/>\npublic List&lt;AlarmTask&gt; getAll() {<br \/>\n    return alarmTaskMapper.selectAll();<br \/>\n}<br \/>\n&#064;Override<br \/>\npublic boolean deleteById(String id) {<br \/>\n    return alarmTaskMapper.deleteById(id) &gt; 0;<br \/>\n}<\/p>\n<p>\u6781\u7b80\u5c01\u88c5&#xff0c;\u76f4\u63a5\u8c03\u7528 Mapper \u5bf9\u5e94 SQL&#xff1b;\u5220\u9664\u64cd\u4f5c\u5224\u65ad\u8fd4\u56de\u884c\u6570&#xff0c;\u4ec5\u771f\u5b9e\u5220\u9664\u6570\u636e\u8fd4\u56de true\u3002<\/p>\n<p>\u4e94\u3001\u6761\u4ef6\u7b5b\u9009\u67e5\u8be2\u65b9\u6cd5<\/p>\n<p>&#064;Override<br \/>\npublic AlarmTask getByTaskCode(String taskCode) {<br \/>\n    return alarmTaskMapper.selectByTaskCode(taskCode);<br \/>\n}<\/p>\n<p>&#064;Override<br \/>\npublic List&lt;AlarmTask&gt; getByStatus(String status) {<br \/>\n    return alarmTaskMapper.selectByStatus(status);<br \/>\n}<\/p>\n<p>&#064;Override<br \/>\npublic List&lt;AlarmTask&gt; getByExecutionType(String executionType) {<br \/>\n    return alarmTaskMapper.selectByExecutionType(executionType);<br \/>\n}<\/p>\n<li>\n<p>getByTaskCode&#xff1a;\u6839\u636e\u4efb\u52a1\u7f16\u7801\u7cbe\u786e\u67e5\u8be2&#xff0c;\u7528\u4e8e\u65b0\u589e\u4efb\u52a1\u65f6\u6821\u9a8c\u7f16\u7801\u552f\u4e00\u6027&#xff0c;\u907f\u514d\u91cd\u590d\u7f16\u7801\u5165\u5e93&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getByStatus&#xff1a;\u6309\u542f\u505c\u72b6\u6001\u7b5b\u9009\u5b9a\u65f6\u4efb\u52a1\u5217\u8868&#xff1b;<\/p>\n<\/li>\n<li>\n<p>getByExecutionType&#xff1a;\u6309\u6267\u884c\u7c7b\u578b&#xff08;\u5b9a\u65f6 \/ \u624b\u52a8&#xff09;\u7b5b\u9009\u4efb\u52a1&#xff1b; \u4ee5\u4e0a\u65b9\u6cd5\u5747\u76f4\u63a5\u8c03\u7528 Mapper \u67e5\u8be2&#xff0c;\u65e0\u989d\u5916\u4e1a\u52a1\u903b\u8f91\u3002<\/p>\n<\/li>\n<\/p>\n<h4>TaskSchedulerController.java<\/h4>\n<p>\u4e00\u3001\u6574\u4f53\u5b9a\u4f4d\u4e0e\u4e1a\u52a1\u4f5c\u7528<\/p>\n<p>\u8be5\u63a7\u5236\u5668\u5f52\u5c5e cn.com.xxx.bussiness.znyw.scheduler \u8c03\u5ea6\u4e13\u5c5e\u5305&#xff0c;\u662f\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1\u52a8\u6001\u8c03\u5ea6\u7684 HTTP \u64cd\u4f5c\u5165\u53e3\u3002 \u548c\u524d\u9762 AlarmTaskController \u505a\u6e05\u6670\u804c\u8d23\u62c6\u5206&#xff1a;<\/p>\n<li>\n<p>AlarmTaskController&#xff1a;CRUD \u5c42&#xff0c;\u53ea\u8d1f\u8d23\u6570\u636e\u5e93 t_alarm_task \u4efb\u52a1\u914d\u7f6e\u7684\u589e\u5220\u6539\u67e5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>TaskSchedulerController&#xff1a;\u8c03\u5ea6\u8fd0\u884c\u63a7\u5236\u5c42&#xff0c;\u8d1f\u8d23\u5185\u5b58\u4e2d Spring \u5b9a\u65f6\u4efb\u52a1\u7684\u52a8\u6001\u542f\u505c\u3001\u624b\u52a8\u6267\u884c\u3001\u5237\u65b0\u3001\u72b6\u6001\u67e5\u8be2&#xff0c;\u4e0d\u76f4\u63a5\u64cd\u4f5c\u6570\u636e\u5e93&#xff0c;\u901a\u8fc7 DynamicTaskManager \u540c\u6b65\u6570\u636e\u5e93\u72b6\u6001\u4e0e\u5185\u5b58\u8c03\u5ea6\u5668\u3002<\/p>\n<\/li>\n<p>\u6838\u5fc3\u4f9d\u8d56\u7ec4\u4ef6<\/p>\n<p>&#064;Autowired<br \/>\nprivate AlarmTaskExecutor alarmTaskExecutor;    \/\/ \u4efb\u52a1\u6267\u884c\u5668&#xff0c;\u8c03\u7528\u544a\u8b66\u5f15\u64ceAlarmEngine\u8ba1\u7b97\u544a\u8b66<br \/>\n&#064;Autowired<br \/>\nprivate DynamicTaskManager dynamicTaskManager;   \/\/ \u52a8\u6001\u5b9a\u65f6\u4efb\u52a1\u7ba1\u7406\u5668&#xff0c;\u7ba1\u7406Spring\u8c03\u5ea6\u5668\u6ce8\u518c\/\u53d6\u6d88\u4efb\u52a1<\/p>\n<p>\u4e1a\u52a1\u5b8c\u6574\u94fe\u8def&#xff1a; \u524d\u7aef\u8c03\u7528\u8c03\u5ea6\u63a5\u53e3 \u2192 TaskSchedulerController \u2192 DynamicTaskManager&#xff08;\u64cd\u4f5c\u8c03\u5ea6\u5668 &#043; \u540c\u6b65\u6570\u636e\u5e93\u4efb\u52a1\u72b6\u6001&#xff09;\/ AlarmTaskExecutor&#xff08;\u89e6\u53d1\u544a\u8b66\u5f15\u64ce\u6267\u884c\u89c4\u5219\u8ba1\u7b97&#xff09;\u2192 AlarmEngine \u544a\u8b66\u5f15\u64ce\u6267\u884c\u89c4\u5219\u5224\u65ad<\/p>\n<p>\u4e8c\u3001\u57fa\u7840\u5934\u90e8\u4fe1\u606f<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.xxx.bussiness.znyw.scheduler;<\/p>\n<p>\u5355\u72ecscheduler\u8c03\u5ea6\u6a21\u5757\u5305&#xff0c;\u548c controller \u4e1a\u52a1\u5305\u9694\u79bb&#xff0c;\u5206\u5c42\u6e05\u6670\u3002<\/p>\n<p>2. \u6ce8\u89e3\u8bf4\u660e<\/p>\n<p>&#064;RestController<br \/>\n&#064;RequestMapping(&#034;\/api\/taskScheduler&#034;)<\/p>\n<li>\n<p>&#064;RestController&#xff1a;\u63a5\u53e3\u8fd4\u56de\u81ea\u52a8\u5e8f\u5217\u5316\u4e3a JSON&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u63a5\u53e3\u524d\u7f00 \/api\/taskScheduler&#xff0c;\u6240\u6709\u5b9a\u65f6\u4efb\u52a1\u8c03\u5ea6\u64cd\u4f5c\u7edf\u4e00\u8def\u5f84&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u4f7f\u7528\u9879\u76ee\u6807\u51c6\u8fd4\u56de\u5bf9\u8c61 JsonMessage&lt;T&gt;&#xff0c;\u548c\u5176\u4ed6\u4e1a\u52a1\u63a7\u5236\u5668\u8fd4\u56de\u683c\u5f0f\u4fdd\u6301\u7edf\u4e00\u3002<\/p>\n<\/li>\n<p>\u4e09\u30015 \u4e2a\u63a5\u53e3\u9010\u884c\u62c6\u89e3<\/p>\n<p>\u63a5\u53e3 1&#xff1a;POST \/api\/taskScheduler\/execute\/{taskId} \u624b\u52a8\u6267\u884c\u544a\u8b66\u4efb\u52a1<\/p>\n<p>\u4e1a\u52a1\u573a\u666f<\/p>\n<p>\u524d\u7aef\u9875\u9762\u4e0d\u7b49\u5f85\u5b9a\u65f6 cron \u5468\u671f&#xff0c;\u624b\u52a8\u7acb\u5373\u89e6\u53d1\u4e00\u6b21\u544a\u8b66\u4efb\u52a1&#xff0c;\u8c03\u7528\u544a\u8b66\u5f15\u64ce\u5b8c\u6210\u5168\u91cf\u76d1\u63a7\u5bf9\u8c61\u89c4\u5219\u8ba1\u7b97\u3002<\/p>\n<p>\u6267\u884c\u903b\u8f91<\/p>\n<li>\n<p>\u8def\u5f84\u53c2\u6570 taskId&#xff1a;\u544a\u8b66\u4efb\u52a1\u4e3b\u952e ID&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 alarmTaskExecutor.executeTask(taskId)&#xff0c;\u8fd4\u56de\u5168\u5c40\u552f\u4e00\u6267\u884c ID executionId&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5224\u65ad executionId \u662f\u5426\u4e3a\u7a7a&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4e3a\u7a7a&#xff1a;\u4efb\u52a1\u4e0d\u5b58\u5728 \/ \u5df2\u7981\u7528&#xff0c;\u8fd4\u56de\u4e1a\u52a1\u5931\u8d25\u63d0\u793a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6709\u503c&#xff1a;\u5c01\u88c5\u6267\u884c ID\u3001\u4efb\u52a1 ID\u3001\u6210\u529f\u63d0\u793a\u8fd4\u56de\u524d\u7aef&#xff1b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5168\u5c40 try-catch \u6355\u83b7\u6240\u6709\u6267\u884c\u5f02\u5e38&#xff0c;\u8fd4\u56de\u5f02\u5e38\u4fe1\u606f\u3002<\/p>\n<\/li>\n<p>\u8fd4\u56de\u6570\u636e\u8bf4\u660e<\/p>\n<p>{<br \/>\n  &#034;success&#034;: true,<br \/>\n  &#034;data&#034;: {<br \/>\n    &#034;executionId&#034;: &#034;EXEC_175xxxx&#034;,<br \/>\n    &#034;taskId&#034;: &#034;\u4efb\u52a1\u4e3b\u952e&#034;,<br \/>\n    &#034;message&#034;: &#034;\u4efb\u52a1\u6267\u884c\u6210\u529f&#034;<br \/>\n  }<br \/>\n}<\/p>\n<p>executionId \u53ef\u7528\u4e8e\u540e\u7eed\u67e5\u8be2\u672c\u6b21\u544a\u8b66\u6267\u884c\u660e\u7ec6\u3001\u65e5\u5fd7\u3002<\/p>\n<p>\u63a5\u53e3 2&#xff1a;POST \/api\/taskScheduler\/enable\/{taskId} \u542f\u7528\u5b9a\u65f6\u4efb\u52a1<\/p>\n<p>\u4e1a\u52a1\u4f5c\u7528<\/p>\n<li>\n<p>\u66f4\u65b0\u6570\u636e\u5e93 t_alarm_task \u4efb\u52a1\u72b6\u6001\u4e3a\u542f\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5c06\u8be5\u4efb\u52a1\u7684 cron \u8868\u8fbe\u5f0f\u6ce8\u518c\u5230 Spring \u5b9a\u65f6\u8c03\u5ea6\u5668&#xff0c;\u5b9a\u65f6\u81ea\u52a8\u6267\u884c\u3002<\/p>\n<\/li>\n<p>\u903b\u8f91\u6d41\u7a0b<\/p>\n<li>\n<p>\u4f20\u5165\u4efb\u52a1 ID&#xff0c;\u8c03\u7528 dynamicTaskManager.enableTask(taskId)&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5c01\u88c5\u8fd4\u56de\u53c2\u6570&#xff1a;\u4efb\u52a1 ID\u3001\u662f\u5426\u542f\u7528\u6210\u529f\u3001\u5f53\u524d\u4efb\u52a1\u662f\u5426\u6ce8\u518c\u5728\u8c03\u5ea6\u5668&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6839\u636e\u8fd4\u56de\u5e03\u5c14\u503c\u533a\u5206\u6210\u529f \/ \u5931\u8d25&#xff0c;\u8fd4\u56de\u5bf9\u5e94\u63d0\u793a&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6355\u83b7\u6570\u636e\u5e93 \/ \u8c03\u5ea6\u5668\u64cd\u4f5c\u5f02\u5e38\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 3&#xff1a;POST \/api\/taskScheduler\/disable\/{taskId} \u7981\u7528\u5b9a\u65f6\u4efb\u52a1<\/p>\n<p>\u548c\u542f\u7528\u63a5\u53e3\u903b\u8f91\u5b8c\u5168\u5bf9\u79f0&#xff0c;\u53cd\u5411\u64cd\u4f5c&#xff1a;<\/p>\n<li>\n<p>\u66f4\u65b0\u6570\u636e\u5e93\u4efb\u52a1\u72b6\u6001\u4e3a\u505c\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4ece Spring \u5b9a\u65f6\u8c03\u5ea6\u5668\u4e2d\u79fb\u9664\u8be5\u4efb\u52a1&#xff0c;\u4e0d\u518d\u5468\u671f\u6267\u884c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de\u7981\u7528\u7ed3\u679c\u3001\u8c03\u5ea6\u5668\u6ce8\u518c\u72b6\u6001\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 4&#xff1a;GET \/api\/taskScheduler\/status\/{taskId} \u67e5\u8be2\u4efb\u52a1\u8c03\u5ea6\u72b6\u6001<\/p>\n<p>\u7528\u9014<\/p>\n<p>\u524d\u7aef\u9875\u9762\u5c55\u793a\u4efb\u52a1\u8fd0\u884c\u72b6\u6001&#xff0c;\u5224\u65ad&#xff1a;<\/p>\n<li>\n<p>\u8be5\u4efb\u52a1\u662f\u5426\u5df2\u7ecf\u6ce8\u518c\u5230\u5185\u5b58\u5b9a\u65f6\u8c03\u5ea6\u5668&#xff08;\u662f\u5426\u81ea\u52a8\u5468\u671f\u8fd0\u884c&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5f53\u524d\u8c03\u5ea6\u5668\u4e2d\u603b\u5171\u6ce8\u518c\u4e86\u591a\u5c11\u4e2a\u542f\u7528\u7684\u5b9a\u65f6\u4efb\u52a1\u3002<\/p>\n<\/li>\n<p>\u903b\u8f91<\/p>\n<p>\u8c03\u7528 dynamicTaskManager.isTaskRegistered() \u67e5\u8be2\u5355\u4e2a\u4efb\u52a1\u6ce8\u518c\u72b6\u6001\u3001getRegisteredTaskCount() \u83b7\u53d6\u5168\u5c40\u542f\u7528\u4efb\u52a1\u603b\u6570&#xff0c;\u5c01\u88c5\u8fd4\u56de\u3002<\/p>\n<p>\u63a5\u53e3 5&#xff1a;POST \/api\/taskScheduler\/refresh \u5168\u5c40\u5237\u65b0\u6240\u6709\u5b9a\u65f6\u4efb\u52a1<\/p>\n<p>\u6838\u5fc3\u573a\u666f<\/p>\n<li>\n<p>\u6279\u91cf\u4fee\u6539\u6570\u636e\u5e93\u4e2d\u591a\u4e2a\u4efb\u52a1 cron \u8868\u8fbe\u5f0f \/ \u542f\u505c\u72b6\u6001\u540e&#xff0c;\u624b\u52a8\u540c\u6b65\u5237\u65b0\u5185\u5b58\u8c03\u5ea6\u5668&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u670d\u52a1\u91cd\u542f\u3001\u914d\u7f6e\u6279\u91cf\u66f4\u65b0&#xff0c;\u91cd\u65b0\u5168\u91cf\u52a0\u8f7d\u6570\u636e\u5e93\u6240\u6709\u4efb\u52a1\u914d\u7f6e&#xff0c;\u91cd\u5efa\u5b9a\u65f6\u8c03\u5ea6\u5668\u4efb\u52a1\u3002<\/p>\n<\/li>\n<p>\u903b\u8f91<\/p>\n<p>\u8c03\u7528 dynamicTaskManager.refreshAllTasks()&#xff0c;\u5185\u90e8\u903b\u8f91&#xff1a;<\/p>\n<li>\n<p>\u6e05\u7a7a\u5f53\u524d\u8c03\u5ea6\u5668\u5185\u6240\u6709\u5df2\u6ce8\u518c\u5b9a\u65f6\u4efb\u52a1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u91cd\u65b0\u67e5\u8be2\u6570\u636e\u5e93\u5168\u90e8\u544a\u8b66\u4efb\u52a1&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5c06\u72b6\u6001\u4e3a\u542f\u7528\u7684\u4efb\u52a1&#xff0c;\u6309 cron \u91cd\u65b0\u6ce8\u518c\u5230\u8c03\u5ea6\u5668&#xff1b; \u8fd4\u56de\u5237\u65b0\u6210\u529f\u63d0\u793a &#043; \u5f53\u524d\u8c03\u5ea6\u5668\u5185\u4efb\u52a1\u603b\u6570\u91cf\u3002<\/p>\n<\/li>\n<\/p>\n<h4>TaskExecutionController.java<\/h4>\n<p>\u4e00\u3001\u6574\u4f53\u4e1a\u52a1\u5b9a\u4f4d<\/p>\n<p>\u8be5\u63a7\u5236\u5668\u5bf9\u5e94 t_task_execution \u4efb\u52a1\u6267\u884c\u8bb0\u5f55\u8868&#xff0c;\u5b58\u50a8\u6bcf\u4e00\u6b21\u544a\u8b66\u5b9a\u65f6\u4efb\u52a1 \/ \u624b\u52a8\u6267\u884c\u4efb\u52a1\u7684\u5b8c\u6574\u8fd0\u884c\u65e5\u5fd7&#xff0c;\u548c\u524d\u9762\u6a21\u5757\u5f62\u6210\u5b8c\u6574\u4e1a\u52a1\u95ed\u73af&#xff1a;<\/p>\n<li>\n<p>AlarmTask&#xff1a;\u5b9a\u65f6\u4efb\u52a1\u914d\u7f6e\u4fe1\u606f&#xff08;cron\u3001\u7ed1\u5b9a\u6a21\u578b\u3001\u542f\u505c\u72b6\u6001&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>TaskSchedulerController&#xff1a;\u8c03\u5ea6\u542f\u505c\u3001\u624b\u52a8\u89e6\u53d1\u4efb\u52a1\u6267\u884c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>AlarmEngine&#xff1a;\u544a\u8b66\u89c4\u5219\u8ba1\u7b97\u6838\u5fc3\u5f15\u64ce&#xff1b;<\/p>\n<\/li>\n<li>\n<p>TaskExecution&#xff1a;\u6bcf\u6b21\u6267\u884c\u7684\u8fd0\u884c\u65e5\u5fd7\u8bb0\u5f55&#xff08;\u6267\u884c\u8d77\u6b62\u65f6\u95f4\u3001\u6267\u884c\u7ed3\u679c\u3001\u662f\u5426\u4ea7\u751f\u544a\u8b66\u3001\u6267\u884c\u7c7b\u578b\u3001\u4efb\u52a1 ID \u7b49&#xff09;\u3002<\/p>\n<\/li>\n<p>\u5206\u5c42\u8c03\u7528\u94fe\u8def&#xff1a;\u524d\u7aef\u65e5\u5fd7\u9875\u9762\u8bf7\u6c42 \u2192 TaskExecutionController \u2192 TaskExecutionService \u2192 Mapper \u2192 \u8fbe\u68a6\u6267\u884c\u8bb0\u5f55\u8868\u3002<\/p>\n<p>\u4e8c\u3001\u57fa\u7840\u5934\u90e8\u4fe1\u606f<\/p>\n<p>1. \u5305\u8def\u5f84<\/p>\n<p>package cn.com.xxx.bussiness.znyw.controller;<\/p>\n<p>\u4e0e\u544a\u8b66\u4efb\u52a1\u3001\u544a\u8b66\u6a21\u578b\u3001\u544a\u8b66\u89c4\u5219\u63a7\u5236\u5668\u540c\u5305&#xff0c;\u7edf\u4e00\u667a\u80fd\u8fd0\u7ef4\u63a5\u53e3\u5c42\u3002<\/p>\n<p>2. \u5bfc\u5165\u7c7b\u8bf4\u660e<\/p>\n<li>\n<p>DataPaging&#xff1a;\u9879\u76ee\u7edf\u4e00\u5206\u9875\u5c01\u88c5\u5bf9\u8c61&#xff1b;<\/p>\n<\/li>\n<li>\n<p>JsonMessage&lt;T&gt;&#xff1a;\u5168\u5c40\u6807\u51c6\u7edf\u4e00\u8fd4\u56de\u4f53&#xff0c;\u5168\u9879\u76ee\u63a7\u5236\u5668\u7edf\u4e00\u4f7f\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>TaskExecution&#xff1a;\u6570\u636e\u5e93\u6267\u884c\u8bb0\u5f55\u5b9e\u4f53&#xff0c;\u5b58\u50a8\u5355\u6b21\u4efb\u52a1\u8fd0\u884c\u65e5\u5fd7&#xff1b;<\/p>\n<\/li>\n<li>\n<p>TaskExecutionService&#xff1a;\u6267\u884c\u8bb0\u5f55\u4e1a\u52a1\u5c42\u63a5\u53e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>Spring Web RESTful \u6807\u51c6\u6ce8\u89e3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5bb9\u5668&#xff1a;HashMap\u3001List\u3001Map \u7528\u4e8e\u5c01\u88c5\u5206\u9875\u7b5b\u9009\u53c2\u6570\u3001\u7edf\u8ba1\u7ed3\u679c\u3002<\/p>\n<\/li>\n<p>3. \u7c7b\u6ce8\u89e3\u4e0e\u4f9d\u8d56\u6ce8\u5165<\/p>\n<p>&#064;RestController<br \/>\n&#064;RequestMapping(&#034;\/api\/taskExecution&#034;)<br \/>\n&#064;Autowired<br \/>\nprivate TaskExecutionService taskExecutionService;<\/p>\n<li>\n<p>&#064;RestController&#xff1a;\u63a5\u53e3\u81ea\u52a8\u5c06\u8fd4\u56de\u5bf9\u8c61\u5e8f\u5217\u5316\u4e3a JSON&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u7edf\u4e00\u63a5\u53e3\u524d\u7f00 \/api\/taskExecution&#xff0c;\u6240\u6709\u6267\u884c\u8bb0\u5f55\u65e5\u5fd7\u63a5\u53e3\u7edf\u4e00\u8def\u5f84&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4ec5\u6ce8\u5165\u6267\u884c\u8bb0\u5f55\u4e1a\u52a1 Service&#xff0c;\u6240\u6709\u6570\u636e\u5e93\u3001\u4e1a\u52a1\u903b\u8f91\u4e0b\u6c89\u81f3 Service \u5c42&#xff0c;Controller \u4ec5\u5904\u7406\u8bf7\u6c42\u8f6c\u53d1\u3001\u53c2\u6570\u5c01\u88c5\u3001\u5f02\u5e38\u6355\u83b7\u3001\u7ed3\u679c\u8fd4\u56de\u3002<\/p>\n<\/li>\n<p>\u4e09\u3001\u5168\u90e8\u63a5\u53e3\u9010\u6bb5\u8be6\u89e3&#xff08;\u6807\u51c6 REST \u89c4\u8303&#xff09;<\/p>\n<p>\u63a5\u53e3 1&#xff1a;\u5206\u9875\u591a\u6761\u4ef6\u67e5\u8be2 GET \/api\/taskExecution\/list\/page<\/p>\n<p>\u6838\u5fc3\u7528\u9014&#xff1a;\u524d\u7aef\u4efb\u52a1\u6267\u884c\u65e5\u5fd7\u5217\u8868\u9875\u9762&#xff0c;\u652f\u6301\u591a\u7ef4\u5ea6\u590d\u5408\u7b5b\u9009 &#043; \u5206\u9875\u5c55\u793a\u3002<\/p>\n<p>\u5168\u90e8\u7b5b\u9009\u5165\u53c2\u8bf4\u660e<\/p>\n<table>\n<tr>\n<p>\u53c2\u6570<\/p>\n<p>\u662f\u5426\u5fc5\u586b<\/p>\n<p>\u7c7b\u578b<\/p>\n<p>\u7b5b\u9009\u4f5c\u7528<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>taskId<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u6240\u5c5e\u544a\u8b66\u4efb\u52a1 ID \u7cbe\u786e\u7b5b\u9009<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>executionStatus<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u6267\u884c\u72b6\u6001&#xff08;\u6210\u529f \/ \u5931\u8d25&#xff09;\u7b5b\u9009<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>executionType<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u6267\u884c\u7c7b\u578b&#xff08;\u5b9a\u65f6\u81ea\u52a8 \/ \u624b\u52a8\u6267\u884c&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>hasAlarm<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>Boolean<\/p>\n<\/td>\n<td>\n<p>\u662f\u5426\u4ea7\u751f\u544a\u8b66&#xff08;true &#061; \u672c\u6b21\u6267\u884c\u89e6\u53d1\u544a\u8b66&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>startTime \/ endTime<\/p>\n<\/td>\n<td>\n<p>\u975e\u5fc5\u586b<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u6267\u884c\u65f6\u95f4\u533a\u95f4\u7b5b\u9009&#xff0c;\u67e5\u8be2\u65f6\u95f4\u6bb5\u5185\u7684\u6267\u884c\u8bb0\u5f55<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>page<\/p>\n<\/td>\n<td>\n<p>\u53ef\u9009\u9ed8\u8ba4 1<\/p>\n<\/td>\n<td>\n<p>int<\/p>\n<\/td>\n<td>\n<p>\u5f53\u524d\u9875\u7801<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>row<\/p>\n<\/td>\n<td>\n<p>\u53ef\u9009\u9ed8\u8ba4 10<\/p>\n<\/td>\n<td>\n<p>int<\/p>\n<\/td>\n<td>\n<p>\u6bcf\u9875\u6761\u6570<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6838\u5fc3\u903b\u8f91<\/p>\n<li>\n<p>\u521d\u59cb\u5316\u7a7a Map&#xff0c;\u4ec5\u628a\u975e\u7a7a\u3001\u975e\u7a7a\u767d\u5b57\u7b26\u4e32\u53c2\u6570\u5b58\u5165 Map&#xff0c;\u7a7a\u53c2\u6570\u4e0d\u4f20\u9012\u7ed9 SQL&#xff0c;\u907f\u514d\u65e0\u6548\u67e5\u8be2\u6761\u4ef6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 service \u5206\u9875\u67e5\u8be2\u65b9\u6cd5&#xff0c;\u8fd4\u56de\u5206\u9875\u5bf9\u8c61 DataPaging&lt;TaskExecution&gt;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528\u5168\u5c40\u6807\u51c6\u6cdb\u578b\u8fd4\u56de\u4f53 JsonMessage \u5c01\u88c5\u5206\u9875\u6570\u636e&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6574\u4e2a\u65b9\u6cd5\u5305\u88f9 try-catch&#xff0c;\u6355\u83b7\u6570\u636e\u5e93\u3001\u53c2\u6570\u5f02\u5e38&#xff0c;\u8fd4\u56de\u53cb\u597d\u6587\u5b57\u9519\u8bef\u63d0\u793a&#xff0c;\u4e0d\u66b4\u9732\u539f\u59cb 500 \u5806\u6808\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 2&#xff1a;\u6839\u636e\u4e3b\u952e ID \u67e5\u8be2\u5355\u6761\u6267\u884c\u8bb0\u5f55 GET \/{id}<\/p>\n<li>\n<p>\u8def\u5f84\u53c2\u6570 id&#xff1a;\u6267\u884c\u8bb0\u5f55\u4e3b\u952e&#xff08;\u5355\u6b21\u4efb\u52a1\u6267\u884c\u552f\u4e00\u6807\u8bc6 executionId&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u903b\u8f91&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u67e5\u8be2\u5b9e\u4f53\u4e0d\u4e3a\u7a7a&#xff0c;\u8fd4\u56de\u5b8c\u6574\u6267\u884c\u65e5\u5fd7\u8be6\u60c5&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u65e0\u5339\u914d\u8bb0\u5f55&#xff0c;\u8fd4\u56de\u4e1a\u52a1\u63d0\u793a\u300c\u672a\u627e\u5230\u5bf9\u5e94\u7684\u4efb\u52a1\u6267\u884c\u8bb0\u5f55\u300d&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6355\u83b7\u6240\u6709\u8fd0\u884c\u5f02\u5e38&#xff0c;\u7edf\u4e00\u8fd4\u56de\u5931\u8d25\u4fe1\u606f\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<p>\u63a5\u53e3 3&#xff1a;\u67e5\u8be2\u5168\u90e8\u6267\u884c\u8bb0\u5f55 GET \/all<\/p>\n<p>\u8fd4\u56de\u65e0\u5206\u9875\u7684\u5168\u91cf\u6267\u884c\u8bb0\u5f55\u5217\u8868&#xff0c;\u9002\u7528\u573a\u666f&#xff1a;\u4e0b\u62c9\u9009\u62e9\u3001\u5bfc\u51fa\u5168\u90e8\u65e5\u5fd7\u3001\u7b80\u5355\u6570\u636e\u5b57\u5178\u5c55\u793a&#xff08;\u6570\u636e\u91cf\u8f83\u5c0f\u65f6\u4f7f\u7528&#xff09;\u3002<\/p>\n<p>\u63a5\u53e3 4&#xff1a;\u65b0\u589e\u6267\u884c\u8bb0\u5f55 POST \/add<\/p>\n<li>\n<p>&#064;RequestBody TaskExecution&#xff1a;\u63a5\u6536\u540e\u7aef\u5f15\u64ce\u7ec4\u88c5\u5b8c\u6210\u7684\u6267\u884c\u65e5\u5fd7 JSON \u5b9e\u4f53&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e1a\u52a1\u573a\u666f&#xff1a;\u544a\u8b66\u5f15\u64ce\u6267\u884c\u5b8c\u6210\u540e\u81ea\u52a8\u8c03\u7528\u4fdd\u5b58\u6267\u884c\u65e5\u5fd7&#xff0c;\u524d\u7aef\u6781\u5c11\u624b\u52a8\u65b0\u589e&#xff0c;\u4ec5\u540e\u53f0\u7cfb\u7edf\u5185\u90e8\u8c03\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528 service \u65b0\u589e\u65b9\u6cd5&#xff0c;\u6839\u636e\u8fd4\u56de\u5e03\u5c14\u503c\u5224\u65ad\u65b0\u589e\u662f\u5426\u6210\u529f\u3002<\/p>\n<\/li>\n<p>\u63a5\u53e3 5&#xff1a;\u66f4\u65b0\u6267\u884c\u8bb0\u5f55 PUT \/update<\/p>\n<p>REST \u89c4\u8303 PUT \u5168\u91cf\u66f4\u65b0\u6267\u884c\u8bb0\u5f55&#xff1b;\u7528\u4e8e\u6267\u884c\u65e5\u5fd7\u72b6\u6001\u8865\u5168\u3001\u544a\u8b66\u6570\u91cf\u56de\u586b\u3001\u6267\u884c\u7ed3\u675f\u65f6\u95f4\u66f4\u65b0&#xff0c;\u7531\u544a\u8b66\u5f15\u64ce\u6267\u884c\u5b8c\u6210\u540e\u540e\u53f0\u81ea\u52a8\u66f4\u65b0\u3002<\/p>\n<p>\u63a5\u53e3 6&#xff1a;\u5220\u9664\u6267\u884c\u8bb0\u5f55 DELETE \/{id}<\/p>\n<p>\u6839\u636e\u6267\u884c\u8bb0\u5f55\u4e3b\u952e\u5220\u9664\u65e5\u5fd7&#xff0c;\u9002\u7528\u4e8e\u65e5\u5fd7\u6e05\u7406\u3001\u6d4b\u8bd5\u6570\u636e\u5220\u9664\u3002<\/p>\n<p>\u63a5\u53e3 7~10&#xff1a;\u591a\u6761\u4ef6\u5355\u5217\u7b5b\u9009\u67e5\u8be2&#xff08;\u5217\u8868\u4e0b\u62c9\u8fc7\u6ee4&#xff09;<\/p>\n<li>\n<p>GET \/byTaskId&#xff1a;\u6839\u636e\u544a\u8b66\u4efb\u52a1 ID&#xff0c;\u67e5\u8be2\u8be5\u4efb\u52a1\u6240\u6709\u5386\u53f2\u6267\u884c\u65e5\u5fd7&#xff1b;<\/p>\n<\/li>\n<li>\n<p>GET \/byExecutionStatus&#xff1a;\u6309\u6267\u884c\u72b6\u6001&#xff08;\u6210\u529f \/ \u5931\u8d25&#xff09;\u7b5b\u9009\u65e5\u5fd7&#xff1b;<\/p>\n<\/li>\n<li>\n<p>GET \/byExecutionType&#xff1a;\u6309\u6267\u884c\u7c7b\u578b&#xff08;\u5b9a\u65f6\u81ea\u52a8 \/ \u624b\u52a8\u6267\u884c&#xff09;\u7b5b\u9009&#xff1b;<\/p>\n<\/li>\n<li>\n<p>GET \/byHasAlarm&#xff1a;\u6309\u662f\u5426\u89e6\u53d1\u544a\u8b66\u7b5b\u9009&#xff08;\u53ea\u770b\u4ea7\u751f\u544a\u8b66\u7684\u6267\u884c\u8bb0\u5f55&#xff0c;\u7528\u4e8e\u8fd0\u7ef4\u6392\u67e5\u6545\u969c&#xff09;&#xff1b;<\/p>\n<\/li>\n<p>\u63a5\u53e3 11&#xff1a;\u6267\u884c\u65e5\u5fd7\u7edf\u8ba1\u63a5\u53e3 GET \/statistics<\/p>\n<p>\u4e1a\u52a1\u4ef7\u503c<\/p>\n<p>\u540e\u53f0\u6570\u636e\u770b\u677f\u3001\u8fd0\u7ef4\u76d1\u63a7\u9996\u9875&#xff0c;\u7edf\u8ba1\u5168\u91cf\u6267\u884c\u8bb0\u5f55\u6c47\u603b\u6307\u6807&#xff1b; \u8fd4\u56de Map \u7ed3\u6784\u56fa\u5b9a key&#xff1a;<\/p>\n<ul>\n<li>\n<p>total&#xff1a;\u4efb\u52a1\u603b\u6267\u884c\u6b21\u6570<\/p>\n<\/li>\n<li>\n<p>success&#xff1a;\u6267\u884c\u6210\u529f\u6b21\u6570<\/p>\n<\/li>\n<li>\n<p>failed&#xff1a;\u6267\u884c\u5931\u8d25\u6b21\u6570<\/p>\n<\/li>\n<li>\n<p>alarmCount&#xff1a;\u6240\u6709\u6267\u884c\u8bb0\u5f55\u4e2d\u4ea7\u751f\u544a\u8b66\u7684\u603b\u6b21\u6570<\/p>\n<\/li>\n<\/ul>\n<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f8b\u884c\u65e9\u4f1a7 \u6708 27 \u65e5\u5b8c\u6574\u6574\u7406<br \/>\n\u4e00\u3001\u65b0\u4eba\u4ecb\u7ecd<br \/>\n\u4e8c\u3001\u5185\u7f51\u672c\u5730 GLM \u5927\u6a21\u578b\u8d44\u6e90\u8bf4\u660e<br \/>\n\u529e\u516c\u5ba4\u90e8\u7f72 GLM 4.7 \u5927\u6a21\u578b&#xff0c;\u670d\u52a1\u5668\u663e\u5361\u4e3a 2080&#xff08;22G \u663e\u5b58&#xff09;&#xff0c;\u4ec5\u8fd0\u884c\u8be5\u6a21\u578b&#xff0c;\u5176\u4ed6\u6a21\u578b\u5df2\u5378\u8f7d&#xff1b;\u8fd0\u884c\u77ed\u677f&#xff1a;\u6a21\u578b\u54cd\u5e94\u901f\u5ea6\u4e00\u822c&#xff1b;\u540e\u7eed\u8ba1\u5212\u5c1d\u8bd5\u5b89\u88c5 GLM 5.2&#xff0c;\u4f46\u663e\u5361\u663e\u5b58\u504f\u5c0f&#xff0c;\u5927\u6982\u7387\u65e0\u6cd5\u652f\u6491&#xff1b;\u4f7f\u7528\u573a\u666f&#xff1a;\u4e2a\u4eba\u5916\u90e8 <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,105,371,100,398],"topic":[],"class_list":["post-85532","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-redis","tag-371","tag-100","tag-398"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5b9e\u4e60\u7b2c\u5341\u4e8c\u5929\u65e5\u8bb0\u5468\u4e00\u30102026.7.27\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/85532.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5b9e\u4e60\u7b2c\u5341\u4e8c\u5929\u65e5\u8bb0\u5468\u4e00\u30102026.7.27\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4f8b\u884c\u65e9\u4f1a7 \u6708 27 \u65e5\u5b8c\u6574\u6574\u7406 \u4e00\u3001\u65b0\u4eba\u4ecb\u7ecd \u4e8c\u3001\u5185\u7f51\u672c\u5730 GLM \u5927\u6a21\u578b\u8d44\u6e90\u8bf4\u660e \u529e\u516c\u5ba4\u90e8\u7f72 GLM 4.7 \u5927\u6a21\u578b&#xff0c;\u670d\u52a1\u5668\u663e\u5361\u4e3a 2080&#xff08;22G \u663e\u5b58&#xff09;&#xff0c;\u4ec5\u8fd0\u884c\u8be5\u6a21\u578b&#xff0c;\u5176\u4ed6\u6a21\u578b\u5df2\u5378\u8f7d&#xff1b;\u8fd0\u884c\u77ed\u677f&#xff1a;\u6a21\u578b\u54cd\u5e94\u901f\u5ea6\u4e00\u822c&#xff1b;\u540e\u7eed\u8ba1\u5212\u5c1d\u8bd5\u5b89\u88c5 GLM 5.2&#xff0c;\u4f46\u663e\u5361\u663e\u5b58\u504f\u5c0f&#xff0c;\u5927\u6982\u7387\u65e0\u6cd5\u652f\u6491&#xff1b;\u4f7f\u7528\u573a\u666f&#xff1a;\u4e2a\u4eba\u5916\u90e8\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/85532.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-27T09:49:07+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"41 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/85532.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/85532.html\",\"name\":\"\u5b9e\u4e60\u7b2c\u5341\u4e8c\u5929\u65e5\u8bb0\u5468\u4e00\u30102026.7.27\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-27T09:49:07+00:00\",\"dateModified\":\"2026-07-27T09:49:07+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/85532.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/85532.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/85532.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5b9e\u4e60\u7b2c\u5341\u4e8c\u5929\u65e5\u8bb0\u5468\u4e00\u30102026.7.27\u3011\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5b9e\u4e60\u7b2c\u5341\u4e8c\u5929\u65e5\u8bb0\u5468\u4e00\u30102026.7.27\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/85532.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5b9e\u4e60\u7b2c\u5341\u4e8c\u5929\u65e5\u8bb0\u5468\u4e00\u30102026.7.27\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4f8b\u884c\u65e9\u4f1a7 \u6708 27 \u65e5\u5b8c\u6574\u6574\u7406 \u4e00\u3001\u65b0\u4eba\u4ecb\u7ecd \u4e8c\u3001\u5185\u7f51\u672c\u5730 GLM \u5927\u6a21\u578b\u8d44\u6e90\u8bf4\u660e \u529e\u516c\u5ba4\u90e8\u7f72 GLM 4.7 \u5927\u6a21\u578b&#xff0c;\u670d\u52a1\u5668\u663e\u5361\u4e3a 2080&#xff08;22G \u663e\u5b58&#xff09;&#xff0c;\u4ec5\u8fd0\u884c\u8be5\u6a21\u578b&#xff0c;\u5176\u4ed6\u6a21\u578b\u5df2\u5378\u8f7d&#xff1b;\u8fd0\u884c\u77ed\u677f&#xff1a;\u6a21\u578b\u54cd\u5e94\u901f\u5ea6\u4e00\u822c&#xff1b;\u540e\u7eed\u8ba1\u5212\u5c1d\u8bd5\u5b89\u88c5 GLM 5.2&#xff0c;\u4f46\u663e\u5361\u663e\u5b58\u504f\u5c0f&#xff0c;\u5927\u6982\u7387\u65e0\u6cd5\u652f\u6491&#xff1b;\u4f7f\u7528\u573a\u666f&#xff1a;\u4e2a\u4eba\u5916\u90e8","og_url":"https:\/\/www.wsisp.com\/helps\/85532.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-27T09:49:07+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"41 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/85532.html","url":"https:\/\/www.wsisp.com\/helps\/85532.html","name":"\u5b9e\u4e60\u7b2c\u5341\u4e8c\u5929\u65e5\u8bb0\u5468\u4e00\u30102026.7.27\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-27T09:49:07+00:00","dateModified":"2026-07-27T09:49:07+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/85532.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/85532.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/85532.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5b9e\u4e60\u7b2c\u5341\u4e8c\u5929\u65e5\u8bb0\u5468\u4e00\u30102026.7.27\u3011"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/85532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=85532"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/85532\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=85532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=85532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=85532"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=85532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}