瀏覽代碼

Merge branch 'master' of http://116.63.33.55/git/dt2

lyq 2 年之前
父節點
當前提交
f8717447b0
共有 23 個文件被更改,包括 778 次插入90 次删除
  1. 2 2
      smart-xplain/src/main.js
  2. 61 47
      smart-xplain/src/view/smartExplain.vue
  3. 7 0
      spring-cloud/server-basic/pom.xml
  4. 1 1
      spring-cloud/server-basic/src/main/java/com/jd/controller/ExplainDetailsController.java
  5. 85 0
      spring-cloud/server-basic/src/main/java/com/jd/controller/ParticipleController.java
  6. 41 0
      spring-cloud/server-basic/src/main/java/com/jd/entity/Participle.java
  7. 19 0
      spring-cloud/server-basic/src/main/java/com/jd/mapper/ParticipleMapper.java
  8. 17 0
      spring-cloud/server-basic/src/main/java/com/jd/service/ParticipleService.java
  9. 5 11
      spring-cloud/server-basic/src/main/java/com/jd/service/impl/ExplainDetailsServiceImpl.java
  10. 85 0
      spring-cloud/server-basic/src/main/java/com/jd/service/impl/ParticipleServiceImpl.java
  11. 8 8
      spring-cloud/server-basic/src/main/java/com/jd/util/ConvertUtils.java
  12. 29 0
      spring-cloud/server-basic/src/main/java/com/jd/util/ParticipleUtil.java
  13. 8 8
      spring-cloud/server-basic/src/main/java/com/jd/util/WaveHeader.java
  14. 15 0
      spring-cloud/server-basic/src/main/resources/mapper/ParticipleMapper.xml
  15. 12 1
      spring-cloud/server-page/src/main/resources/static/ipad/js/basic/index.js
  16. 18 2
      spring-cloud/server-page/src/main/resources/static/mh2/css/tc.css
  17. 1 0
      spring-cloud/server-page/src/main/resources/static/mh2/css/totalplatform.css
  18. 11 7
      spring-cloud/server-page/src/main/resources/static/mh2/js/init.js
  19. 1 0
      spring-cloud/server-page/src/main/resources/static/mh2/totalplatform.html
  20. 2 2
      spring-cloud/server-page/src/main/resources/static/page/js/basic/explainDetails.js
  21. 246 0
      spring-cloud/server-page/src/main/resources/static/page/js/basic/participleManage.js
  22. 1 1
      spring-cloud/server-page/src/main/resources/static/page/js/constants.js
  23. 103 0
      spring-cloud/server-page/src/main/resources/static/page/participleManage.html

+ 2 - 2
smart-xplain/src/main.js

@@ -3,9 +3,9 @@ import App from './App.vue'
 let app = createApp(App)
 
 //挂载websocket地址
-app.config.globalProperties.$wsUrl = 'ws://192.168.0.100:8087/socketServer'
+app.config.globalProperties.$wsUrl = 'ws://23.37.100.80:8087/socketServer'
 //挂载接口前缀
-app.config.globalProperties.$baseUrl = 'http://192.168.0.100:8084/basic'
+app.config.globalProperties.$baseUrl = 'http://23.37.100.80:8084/basic'
 
 import UUID from "vue-uuid";
 app.use(UUID);

+ 61 - 47
smart-xplain/src/view/smartExplain.vue

@@ -34,26 +34,25 @@ export default {
       isAuto: false,
       timer: undefined
     }
-  }
-  ,
+  },
   created() {
     //初始化数据
     this.loadData()
     //初始化websocket
     this.initWebSocket()
+    //轮播手滑切换走马灯
     this.$nextTick(() => {
-      this.slideBanner() /*轮播手滑切换*/
+      this.slideBanner()
     })
-  }
-  ,
+  },
   methods: {
     loadData() {
-      let code = this.getParamByUrl('code');
+      let _this = this;
+      let code = _this.getParamByUrl('code');
       if (!code) {
-        this.$message({message: 'code无效', type: "error",})
+        _this.$message({message: 'code无效', type: "error",})
         return
       }
-      let _this = this;
       axios.get(_this.$baseUrl + '/api/explain/details/findByCode/' + code)
           .then(function (res) {
             let data = res.data.data
@@ -71,7 +70,7 @@ export default {
             console.log(error)
           });
     },
-    //幻灯片切换触发  index:当前幻灯片的index prevIndex上一个幻灯片的index
+    //幻灯片切换触发  index:当前幻灯片的index prevIndex:上一个幻灯片的index
     carouselChange(index, prevIndex) {
       let _this = this
       //如果上一个幻灯片是最后一个,把自动播放标记改为false
@@ -96,12 +95,8 @@ export default {
     playOrPause(index) {
       let _this = this
       //清除定时器
-      if(_this.timer){
-        _this.timer.clearTimeOut()
-        _this.timer = undefined
-      }
-      //计算setTimeOut定时器时间
-      let time = (_this.$refs.audio[index].duration - _this.$refs.audio[index].currentTime) * 1000
+      let interval = undefined;
+      window.clearInterval(interval);
       //播放/暂停 音频
       if (_this.$refs.audio[index].paused) {
         _this.$refs.audio[index].play()
@@ -109,29 +104,46 @@ export default {
         _this.$refs.audio[index].pause()
       }
       //如果当前是视频则播放视频
+      let videoIndex = -1;
       if (_this.carouselDataList[index].explainType == 10) {
         //找到当前下标之前的视频个数 就是当前视频组件的下标
-        let videoIndex = _this.carouselDataList.filter((data, tempIndex) => {
+        videoIndex = _this.carouselDataList.filter((data, tempIndex) => {
           return tempIndex < index && data.explainType == 10;
         }).length
-        //播放/暂停 视频
+      }
+      //播放/暂停 视频
+      if (videoIndex != -1) {
         if (_this.$refs.video[videoIndex].paused) {
           _this.$refs.video[videoIndex].play()
         } else {
           _this.$refs.video[videoIndex].pause()
         }
-        //计算setTimeOut定时器时间
-        if (_this.$refs.video[videoIndex].duration > _this.$refs.audio[index].duration) {
-          time = (_this.$refs.video[videoIndex].duration - _this.$refs.video[videoIndex].currentTime) * 1000
-        }
       }
-      //如果是自动播放并且当前是播放就设置定时器
-      if (_this.isAuto && !_this.$refs.audio[index].paused) {
-        _this.timer = setTimeout(() => {
-          _this.$refs.carousel.next()
-        }, time)
+      if (!_this.isAuto) {
+        return
+      }
+      //设置轮询器 轮询器终止触发时机: 较长的音频/视频结束
+      if (videoIndex != -1 && _this.$refs.video[videoIndex].duration > _this.$refs.audio[index].duration) {
+        if (!interval) {
+          interval = setInterval(() => {
+            if (_this.$refs.video[videoIndex].ended) {
+              _this.$refs.carousel.next()
+              window.clearInterval(interval);
+              interval = undefined
+            }
+          }, 1000)
+        }
+      } else {
+        if (!interval) {
+          interval = setInterval(() => {
+            if (_this.$refs.audio[index].ended) {
+              _this.$refs.carousel.next()
+              window.clearInterval(interval);
+              interval = undefined
+            }
+          }, 1000)
+        }
       }
-
     },
     //消息处理逻辑
     handleMsg(msg) {
@@ -146,8 +158,13 @@ export default {
         //手动触发change事件
         _this.carouselChange(0, _this.carouselDataList.length - 1)
       }
+      //收到切换方案的消息
+      if('replace' === msg.event){
+        console.log('收到重定向消息'+JSON.stringify(msg))
+        location.replace(msg.url)
+      }
     },
-    //走马灯高度返回方法
+    //走马灯高度返回
     calculationHeight() {
       return document.documentElement.clientHeight + 'px';
     },
@@ -155,12 +172,12 @@ export default {
       if (typeof WebSocket === 'undefined')
         return console.log('您的浏览器不支持websocket')
       this.websock = new WebSocket(this.$wsUrl + "/client_" + this.$uuid.v1().replace(/-/g, ""))
-      this.websock.onmessage = this.websocketonmessage
-      this.websock.onopen = this.websocketonopen
-      this.websock.onerror = this.websocketonerror
-      this.websock.onclose = this.websocketclose
+      this.websock.onmessage = this.onMessage
+      this.websock.onopen = this.onOpen
+      this.websock.onerror = this.onError
+      this.websock.onclose = this.onClose
     },
-    websocketonmessage(event) {
+    onMessage(event) {
       let msg = JSON.parse(event.data)
       console.log('收到消息:' + JSON.stringify(msg))
       if (msg.type != 'smartExplain') {
@@ -168,14 +185,14 @@ export default {
       }
       this.handleMsg(msg);
     },
-    websocketonopen() {
+    onOpen() {
       console.log('websocket连接成功')
     },
-    websocketonerror() {
+    onError() {
       console.log('websocket异常')
 
     },
-    websocketclose() {
+    onClose() {
       console.log('websocket关闭成功')
 
     },
@@ -183,8 +200,8 @@ export default {
     getParamByUrl(paramKey) {
       let query = window.location.search.substring(1);
       let vars = query.split("&");
-      for (var i = 0; i < vars.length; i++) {
-        var pair = vars[i].split("=");
+      for (let i = 0; i < vars.length; i++) {
+        let pair = vars[i].split("=");
         if (pair[0] === paramKey) {
           return pair[1];
         }
@@ -205,16 +222,12 @@ export default {
     slideBanner() {
       let that = this
       //选中item的盒子
-      var box = document.querySelector('.el-carousel__container');
-      //手指起点X坐标
-      var startPoint = 0;
-      //手指滑动重点X坐标
-      var stopPoint = 0;
-
+      let box = document.querySelector('.el-carousel__container');
+      //手指起点和终点X坐标
+      let startPoint = 0, stopPoint = 0;
       //重置坐标
-      var resetPoint = function () {
-        startPoint = 0;
-        stopPoint = 0;
+      let resetPoint = function () {
+        startPoint = startPoint = 0;
       }
       //手指按下
       box.addEventListener("touchstart", function (e) {
@@ -252,6 +265,7 @@ export default {
 </script>
 
 <style scoped>
+
 .img-class {
   width: auto;
   height: auto;

+ 7 - 0
spring-cloud/server-basic/pom.xml

@@ -111,6 +111,13 @@
 			<version>1.0.2</version>
 		</dependency>
 
+		<!-- 分词组件 -->
+		<dependency>
+			<groupId>com.janeluo</groupId>
+			<artifactId>ikanalyzer</artifactId>
+			<version>2012_u6</version>
+		</dependency>
+
 	</dependencies>
 
 	<build>

+ 1 - 1
spring-cloud/server-basic/src/main/java/com/jd/controller/ExplainDetailsController.java

@@ -52,7 +52,7 @@ public class ExplainDetailsController {
     public Map<String, Object> deleteById(long id) {
         ExplainDetails explainDetails = explainDetailsService.getById(id);
         if (explainDetails != null) {
-            //删除原来的音频文件
+            //删除音频文件
             File file = new File(filePath + explainDetails.getAudioUrl());
             if (file.exists()) {
                 file.delete();

+ 85 - 0
spring-cloud/server-basic/src/main/java/com/jd/controller/ParticipleController.java

@@ -0,0 +1,85 @@
+package com.jd.controller;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.thread.ThreadUtil;
+import com.jd.entity.Participle;
+import com.jd.service.ParticipleService;
+import com.jd.util.SendUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+
+@Slf4j
+@RestController()
+@RequestMapping("/api/participle")
+@Api(tags = "分词表")
+public class ParticipleController {
+
+    @Resource
+    private ParticipleService participleService;
+
+    @GetMapping("/list")
+    @ApiOperation(value = "1、分页查询")
+    public Map<String, Object> queryPageBean(Integer page, Integer limit, Participle participle) {
+        Page pageBean = new Page(page, limit);
+        participleService.queryPage(pageBean, participle);
+        return SendUtil.layuiTable(pageBean.getTotal(), pageBean.getRecords());
+    }
+
+    @PostMapping("/addBean")
+    @ApiOperation(value = "2、新增")
+    public Map<String, Object> addBean(Participle participle) {
+        participle.setCreateTime(DateUtil.now());
+        //分词处理
+        participleService.participleHandel(participle);
+        Boolean result = participleService.save(participle);
+        if (result) {
+            //另开线程同步分词数据
+            ThreadUtil.execAsync(() -> {
+                participleService.participleSync();
+            });
+        }
+        return SendUtil.send(true, null, result);
+    }
+
+    @PostMapping("/updateBean")
+    @ApiOperation(value = "3、修改")
+    public Map<String, Object> updateBean(Participle participle) {
+        participle.setUpdateTime(DateUtil.now());
+        //分词处理
+        participleService.participleHandel(participle);
+        Boolean result = participleService.updateById(participle);
+        if (result) {
+            //另开线程同步分词数据
+            ThreadUtil.execAsync(() -> {
+                participleService.participleSync();
+            });
+        }
+        return SendUtil.send(true, null, result);
+    }
+
+    @PostMapping("/deleteById")
+    @ApiOperation(value = "4、删除")
+    public Map<String, Object> deleteById(Long id) {
+        Boolean result = participleService.removeById(id);
+        if (result) {
+            //另开线程同步分词数据
+            ThreadUtil.execAsync(() -> {
+                participleService.participleSync();
+            });
+        }
+        return SendUtil.send(true, null, result);
+    }
+
+    @GetMapping("/find/{id}")
+    @ApiOperation(value = "5、根据id查询")
+    public Map<String, Object> findById(@PathVariable("id") Integer id) {
+        return SendUtil.send(true, null, participleService.getById(id));
+    }
+}

+ 41 - 0
spring-cloud/server-basic/src/main/java/com/jd/entity/Participle.java

@@ -0,0 +1,41 @@
+package com.jd.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+@Data
+@ApiModel("分词表")
+@TableName("t_participle")
+public class Participle implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty("分词内容")
+    @TableField("participle_content")
+    private String participleContent;
+
+    @ApiModelProperty("分词后内容")
+    @TableField("participle_after_content")
+    private String participleAfterContent;
+
+    @ApiModelProperty("创建时间")
+    @TableField("create_time")
+    private String createTime;
+
+    @ApiModelProperty("修改时间")
+    @TableField("update_time")
+    private String updateTime;
+
+}

+ 19 - 0
spring-cloud/server-basic/src/main/java/com/jd/mapper/ParticipleMapper.java

@@ -0,0 +1,19 @@
+package com.jd.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jd.entity.Participle;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+public interface ParticipleMapper extends BaseMapper<Participle> {
+
+    @Select("<script>" +
+            "SELECT * FROM t_participle WHERE 1 = 1" +
+            "<if test=\"@org.apache.commons.lang3.StringUtils@isNotBlank(participle.participleContent)\">" +
+            " and participle_content LIKE CONCAT('%',#{participle.participleContent},'%') " +
+            "</if>" +
+            "</script>")
+    IPage<Participle> queryPage(Page page, @Param("participle") Participle participle);
+}

+ 17 - 0
spring-cloud/server-basic/src/main/java/com/jd/service/ParticipleService.java

@@ -0,0 +1,17 @@
+package com.jd.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jd.entity.Participle;
+
+public interface ParticipleService extends IService< Participle> {
+
+    IPage<Participle> queryPage(Page page, Participle participle);
+
+    //分词处理
+    Participle participleHandel(Participle participle);
+
+    //分词同步
+    void participleSync();
+}

+ 5 - 11
spring-cloud/server-basic/src/main/java/com/jd/service/impl/ExplainDetailsServiceImpl.java

@@ -26,7 +26,7 @@ import java.util.List;
 @Service
 public class ExplainDetailsServiceImpl extends ServiceImpl<ExplainDetailsMapper, ExplainDetails> implements ExplainDetailsService {
 
-    private static final String VOCIE_HTTP = "http://23.37.100.80:8093";
+    private static final String VOCIE_HTTP = "http://127.0.0.1:8093";
 
     @Value("${web.file}")
     private String filePath;
@@ -43,11 +43,6 @@ public class ExplainDetailsServiceImpl extends ServiceImpl<ExplainDetailsMapper,
     public Boolean saveBean(ExplainDetails explainDetails) {
         //处理语音转换
         explainDetails.setAudioUrl(this.play(explainDetails.getAudioContent()));
-        //删除原来的音频文件
-        File file = new File(filePath + explainDetails.getAudioUrl());
-        if (file.exists()) {
-            file.delete();
-        }
         explainDetails.setCreateTime(DateUtil.now());
         return baseMapper.insert(explainDetails) > 0;
     }
@@ -56,11 +51,6 @@ public class ExplainDetailsServiceImpl extends ServiceImpl<ExplainDetailsMapper,
     public Boolean updateBean(ExplainDetails explainDetails) {
         //处理语音转换
         explainDetails.setAudioUrl(this.play(explainDetails.getAudioContent()));
-        //删除原来的音频文件
-        File file = new File(filePath + explainDetails.getAudioUrl());
-        if (file.exists()) {
-            file.delete();
-        }
         explainDetails.setCreateTime(DateUtil.now());
         return baseMapper.updateById(explainDetails) > 0;
     }
@@ -97,6 +87,10 @@ public class ExplainDetailsServiceImpl extends ServiceImpl<ExplainDetailsMapper,
             } catch (Exception e) {
                 e.printStackTrace();
             }
+            //删除pcm文件
+            if(file.exists()){
+                file.delete();
+            }
             System.err.println("转换耗时:" + (System.currentTimeMillis() - startTime));
             return path.substring(path.lastIndexOf(filePath) + filePath.length());
         }

+ 85 - 0
spring-cloud/server-basic/src/main/java/com/jd/service/impl/ParticipleServiceImpl.java

@@ -0,0 +1,85 @@
+package com.jd.service.impl;
+
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jd.entity.Participle;
+import com.jd.mapper.ParticipleMapper;
+import com.jd.service.ParticipleService;
+import com.jd.util.ParticipleUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Service
+public class ParticipleServiceImpl extends ServiceImpl<ParticipleMapper, Participle> implements ParticipleService {
+
+    private String PARTICIPLE_URL = "http://23.37.100.50:8123/word/update";
+
+    @Override
+    public IPage<Participle> queryPage(Page page, Participle participle) {
+        return baseMapper.queryPage(page, participle);
+    }
+
+    @Override
+    public Participle participleHandel(Participle participle) {
+        //分词处理
+        try {
+            participle.setParticipleAfterContent(
+                    Arrays.stream(ParticipleUtil.parse(participle.getParticipleContent(), false)
+                            .split("\\|"))
+                            //排除长度大于2的热词
+                            .filter(t -> t.length() <= 2)
+                            .collect(Collectors.joining("|"))
+            );
+        } catch (Exception e) {
+            log.error("分词失败");
+            e.printStackTrace();
+        }
+        return participle;
+    }
+
+    /**
+     * 同步分词数据
+     */
+    @Override
+    public void participleSync() {
+        //先查询出数据库所有的分词数据
+        List<Participle> participleList = baseMapper.selectList(Wrappers.lambdaQuery());
+        //映射分词数据并拼接成字符串
+        String participleStr = participleList.stream().map(t -> t.getParticipleAfterContent()).collect(Collectors.joining("|"));
+        //分割所有单词并去重
+        List<String> participles = Arrays.stream(participleStr.split("\\|"))
+                .distinct()
+                //排除长度大于2的热词
+                .filter(t -> t.length() <= 2)
+                .collect(Collectors.toList());
+        //转成JsonArray
+        JSONArray jsonArray = JSONUtil.createArray();
+        participles.stream().forEach(jsonArray::put);
+        log.debug("分词数据:" + jsonArray);
+        //封装请求参数
+        Map<Object, Object> params = MapUtil.builder()
+                .put("words", jsonArray.toString())
+                .map();
+        //调接口同步分词
+        try {
+            String result = HttpRequest.post(PARTICIPLE_URL)
+                    .body(JSONUtil.parse(params).toString(), "application/json")
+                    .execute()
+                    .body();
+            log.debug("分词同步响应体:" + result);
+        } catch (Exception e) {
+            log.error("分词同步失败!错误信息:" + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+}

+ 8 - 8
spring-cloud/server-basic/src/main/java/com/jd/util/ConvertUtils.java

@@ -1,7 +1,7 @@
 package com.jd.util;
 
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
+import java.io.*;
+import com.jd.util.WaveHeader;
 
 /**
  * @Author: clf
@@ -9,7 +9,7 @@ import java.io.FileOutputStream;
  * @Description: 语音合成工具类
  */
 public class ConvertUtils {
- 
+
     /**
      * 转换音频文件
      * @param src 需要转换的pcm音频路径
@@ -19,7 +19,7 @@ public class ConvertUtils {
     public static void convertPcm2Wav(String src, String target) throws Exception {
         FileInputStream fis = new FileInputStream(src);
         FileOutputStream fos = new FileOutputStream(target);
- 
+
         //计算长度
         byte[] buf = new byte[1024 * 4];
         int size = fis.read(buf);
@@ -29,7 +29,7 @@ public class ConvertUtils {
             size = fis.read(buf);
         }
         fis.close();
- 
+
         //填入参数,比特率等等。这里用的是16位单声道 8000 hz
         WaveHeader header = new WaveHeader();
         //长度字段 = 内容的大小(PCMSize) + 头部字段的大小(不包括前面4字节的标识符RIFF以及fileLength本身的4字节)
@@ -42,9 +42,9 @@ public class ConvertUtils {
         header.BlockAlign = (short)(header.Channels * header.BitsPerSample / 8);
         header.AvgBytesPerSec = header.BlockAlign * header.SamplesPerSec;
         header.DataHdrLeth = PCMSize;
- 
+
         byte[] h = header.getHeader();
- 
+
         assert h.length == 44; //WAV标准,头部应该是44字节
         //write header
         fos.write(h, 0, h.length);
@@ -59,5 +59,5 @@ public class ConvertUtils {
         fos.close();
         System.out.println("Convert OK!");
     }
- 
+
 }

+ 29 - 0
spring-cloud/server-basic/src/main/java/com/jd/util/ParticipleUtil.java

@@ -0,0 +1,29 @@
+package com.jd.util;
+
+import org.wltea.analyzer.core.IKSegmenter;
+import org.wltea.analyzer.core.Lexeme;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+public class ParticipleUtil {
+
+    public static String parse(String content, boolean useSmart) throws IOException {
+        StringReader sr = new StringReader(content);
+        // 参数2为是否使用智能分词
+        // true:使用智能分词
+        // false:使用最细粒度分词
+        IKSegmenter ikSegmenter = new IKSegmenter(sr, useSmart);
+        Lexeme word = null;
+        String w = null;
+        StringBuffer sb = new StringBuffer();
+        while((word = ikSegmenter.next()) != null){
+            w = word.getLexemeText();
+            if(sb.length() > 0){
+                sb.append("|");
+            }
+            sb.append(w);
+        }
+        return sb.toString();
+    }
+}

+ 8 - 8
spring-cloud/server-basic/src/main/java/com/jd/util/WaveHeader.java

@@ -2,14 +2,14 @@ package com.jd.util;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
- 
+
 /**
  * @Author: clf
  * @Date: 2020-03-07
  * @Description: wav转换mp3的header
  */
 public class WaveHeader {
- 
+
     public final char fileID[] = {'R', 'I', 'F', 'F'};
     public int fileLength;
     public char wavTag[] = {'W', 'A', 'V', 'E'};;
@@ -23,7 +23,7 @@ public class WaveHeader {
     public short BitsPerSample;
     public char DataHdrID[] = {'d','a','t','a'};
     public int DataHdrLeth;
- 
+
     public byte[] getHeader() throws IOException {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         WriteChar(bos, fileID);
@@ -44,15 +44,15 @@ public class WaveHeader {
         bos.close();
         return r;
     }
- 
+
     private void WriteShort(ByteArrayOutputStream bos, int s) throws IOException {
         byte[] mybyte = new byte[2];
         mybyte[1] =(byte)( (s << 16) >> 24 );
         mybyte[0] =(byte)( (s << 24) >> 24 );
         bos.write(mybyte);
     }
- 
- 
+
+
     private void WriteInt(ByteArrayOutputStream bos, int n) throws IOException {
         byte[] buf = new byte[4];
         buf[3] =(byte)( n >> 24 );
@@ -61,13 +61,13 @@ public class WaveHeader {
         buf[0] =(byte)( (n << 24) >> 24 );
         bos.write(buf);
     }
- 
+
     private void WriteChar(ByteArrayOutputStream bos, char[] id) {
         for (int i=0; i<id.length; i++) {
             char c = id[i];
             bos.write(c);
         }
     }
- 
+
 }
  

+ 15 - 0
spring-cloud/server-basic/src/main/resources/mapper/ParticipleMapper.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.jd.mapper.ParticipleMapper">
+
+	<!-- 可根据自己的需求,是否要使用 -->
+   <resultMap type="com.jd.entity.Participle" id="participleMap">
+        <result property="id" column="id"/>
+        <result property="participleContent" column="participle_content"/>
+        <result property="participleAfterContent" column="participle_after_content"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+</mapper>

+ 12 - 1
spring-cloud/server-page/src/main/resources/static/ipad/js/basic/index.js

@@ -474,7 +474,7 @@ function clickPlan(planId, sign, name) {
 	// 替换名称
 	$(".def_sch").text(name)
 	layer.close(util.layer.index['planPop'])
-	util.getJSON({
+	util.get({
 		url: FLAT_PATH_BASIC + 'plan/getPlanAreaByPlanId',
 		data: {
 			'planId': planId
@@ -536,6 +536,17 @@ function clickPlan(planId, sign, name) {
 					util.variable['areaObj'].planAreaList[index].signalSourceList = source;
 					initSignSource(source);
 				}
+
+				//通知弧屏区页面切换内容
+				res.data.planAreaList.forEach(t=>{
+					if('hpq'==t.area_code){
+						myWebsocket.websocket.send(JSON.stringify({
+							event: 'replace',
+							url: t.url,
+							type: 'smartExplain'
+						}));
+					}
+				})
 			}
 		}
 	});

+ 18 - 2
spring-cloud/server-page/src/main/resources/static/mh2/css/tc.css

@@ -63,8 +63,11 @@ body.modal-active {
 }
 
 #modal-container .modal-background .modal {
-    background: rgba(27, 42, 75, 0.4);
-    padding: 50px;
+    background: url('../images/bj.png') no-repeat;
+    background-position: 0% 0%;
+    background-size: 100% 100%;
+    /* background: rgba(27, 42, 75, 0.4); */
+    padding: 200px 110px;
     display: inline-block;
     border-radius: 15px;
     font-weight: 300;
@@ -169,4 +172,17 @@ body.modal-active {
     100% {
         transform: scale(0);
     }
+}
+
+
+/* 取消 */
+
+.cancel {
+    background: url('../images/close.png') no-repeat;
+    background-size: 100% 100%;
+    position: absolute;
+    right: 2%;
+    top: 5%;
+    width: 300px;
+    height: 300px;
 }

+ 1 - 0
spring-cloud/server-page/src/main/resources/static/mh2/css/totalplatform.css

@@ -11,6 +11,7 @@ p {
 .plateform-box {
     width: 100%;
     height: 100%;
+    /* 必须超过7680 2016 100%根据父亲盒子高宽来的 */
     min-width: 7680px;
     min-height: 2016px;
     /* background-color: #000; */

+ 11 - 7
spring-cloud/server-page/src/main/resources/static/mh2/js/init.js

@@ -1,17 +1,20 @@
-// const GATEWAY_URL = "http://23.37.100.87:8084";
+// 内务网ip地址
+const GATEWAY_URL = "http://23.37.100.87:8084";
+// 服务器ip地址
 // const GATEWAY_URL = "http://23.37.100.80:8084";
-const GATEWAY_URL = "http://192.168.0.100:8084"
+// const GATEWAY_URL = "http://192.168.0.100:8084"
 const PAGE_BASIC = GATEWAY_URL + "/basic";
 let sceneThemes;
 $(function() {
     let datas = get(PAGE_BASIC + '/apiNoProcess/scence/getAllSceneAndThemeAndSystem');
-    console.log(datas);
+    // console.log(datas);
+
     // 场景主题
     const scenes = datas.scenes;
     sceneThemes = datas.sceneThemes;
     initSences(scenes);
     initThemes(sceneThemes);
-    initAncment(); //初始化通知公告
+    // initAncment(); //初始化通知公告
 
 
 
@@ -33,7 +36,6 @@ $(function() {
         $('.footer-box .item').css("opacity", 1);
     }, 3000)
 
-
     $('.cards-box').on('click', '.item', function() {
         const sceneId = parseInt($(this).data("id"));
         let newArr = [];
@@ -50,6 +52,7 @@ $(function() {
 \t      <h2>${item.themeName}</h2>
 \t    </div>`
             })
+            str += `<div class="cancel"></div>`
             $(".modal-background").empty().append(str);
             $('#modal-container').removeAttr('class').addClass('Unfolding');
             $('body').addClass('modal-active');
@@ -60,7 +63,7 @@ $(function() {
             alert("该主题未添加子场景")
         }
 
-        console.log(newArr)
+        // console.log(newArr)
 
         // 关闭通知公告
         $('.setting-menu').css("display", "none");
@@ -122,12 +125,13 @@ function initSences(scenes) {
 
 }
 // 初始化主题
+// <img src="${Boolean(item.themeIconPath) ? PAGE_BASIC + item.themeIconPath : './images/ssgy_icon.png'}" alt="">
 function initThemes(themes) {
     let str = '';
     themes.forEach(item => {
         if (item.quickNavigation == 1) {
             str += `<div class="item" onclick="location.href='${item.url}'">
-					<img src="${Boolean(item.themeIconPath) ? PAGE_BASIC + item.themeIconPath : './images/ssgy_icon.png'}" alt="">
+					<img src="${'./images/ssgy_icon.png'}" alt="">
 					<p class="name">${item.themeName}</p>
 				</div>`
         }

+ 1 - 0
spring-cloud/server-page/src/main/resources/static/mh2/totalplatform.html

@@ -181,6 +181,7 @@
                 <span>来源:城市园林绿化管理处</span>
             </div>
             <div class="not-text">
+
                 <p>5月9日,市城市管理局组织召开国家生态园林城市创建工作专题会,市城市管理局党组成员石继渝,局相关处室、直属单位负责人,中心城区城市管理局分管负责人、绿化科科长参加会议。</p>
                 <p>会议听取市园林规划院相关负责人关于中心城区绿地规划,中心城区建成区重要指标现状情况等两方面的汇报,就创建规划指标、建设任务分解进行讨论,并对下一步创建重点工作进行安排部署。</p>
                 <p>会议强调:一是摸清底数,补齐短板;二是落实创建生态园林城市绿化项目;三是加大力度,全面推进创建工作。</p>

+ 2 - 2
spring-cloud/server-page/src/main/resources/static/page/js/basic/explainDetails.js

@@ -29,9 +29,9 @@ layui.config({
                 field: 'explainType',
                 title: '讲解类型',
                 templet: function (d) {
-                    if (d.status == 10) {
+                    if (d.explainType == 10) {
                         return '视频';
-                    } else if (d == 20) {
+                    } else if (d.explainType == 20) {
                         return '图片';
                     } else {
                         return '网页';

+ 246 - 0
spring-cloud/server-page/src/main/resources/static/page/js/basic/participleManage.js

@@ -0,0 +1,246 @@
+let form, table, upload;
+layui.config({
+    base: 'js/encryption/'
+}).use(['layer', 'form', 'jquery', 'table', 'upload', 'ajax'], function () {
+    layer = layui.layer;
+    upload = layui.upload;
+    table = layui.table;
+    form = layui.form;
+    $ = layui.jquery;
+    ly = layui.ajax;
+
+    // 主要表格
+    table.render({
+        elem: '#participleTable',
+        url: PAGE_BASIC + '/api/participle/list',
+        toolbar: '#participleTable_toolbar', //开启头部工具栏,并为其绑定左侧模板
+        page: true,
+        cols: [
+            [{
+                type: 'numbers',
+                title: '序号'
+            }, {
+                field: 'participleContent',
+                title: '热词内容',
+            },  {
+                field: 'createTime',
+                title: '创建时间'
+            }, {
+                fixed: 'right',
+                title: '操作',
+                toolbar: '#participleTable_bar',
+                width: 250
+            }]
+        ]
+    });
+
+    //头工具栏事件(主要表格)
+    table.on('toolbar(participleTable)', function (obj) {
+        // var checkStatus = table.checkStatus(obj.config.id);
+        switch (obj.event) {
+            case 'add': //新增
+                $(".main").addClass("layui-hide").removeClass("layui-show");
+                $(".add").addClass("layui-show").removeClass("layui-hide");
+                $('#submit').attr('submitType', 'insert');
+                $(".add .header_title span").html("新增");
+                $('#participleInfo')[0].reset();
+                break;
+        }
+    });
+
+    //监听行工具事件(主要表格)
+    table.on('tool(participleTable)', function (obj) {
+        let data = obj.data;
+        //console.log(obj)
+        if (obj.event === 'del') {
+            layer.confirm('是否确认删除', function (index) {
+                deleteExplainArea(data.id);
+                layer.close(index);
+            });
+        } else if (obj.event === 'edit') {
+            $(".main").addClass("layui-hide").removeClass("layui-show");
+            $(".add").addClass("layui-show").removeClass("layui-hide");
+            $(".add .header_title span").html("编辑");
+            $('#submit').attr('submitType', 'update');
+            $('#participleInfo')[0].reset();
+            // 数据初始化
+            echoExplainAreaInfo(data.id);
+        }
+    });
+
+    // 验证表单
+    form.verify({
+        participleContent: function (value, item) {
+            if (!value.trim()) {
+                return '分词内容不能为空';
+            }
+        }
+    });
+
+    // 监听提交按钮
+    form.on('submit(submit)', function (data) {
+        let submitType = data.elem.getAttribute("submitType");
+        // 新增
+        if (submitType == 'insert') {
+            addExplainArea();
+            return false;
+        } else if (submitType == 'update') {
+            updateExplainArea();
+            return false;
+        }
+    });
+
+    // 查询
+    $(".search_btn").click(function () {
+        let queryValue = $.trim($("#queryValue").val());
+        table.reload('participleTable', {
+            where: {
+                "participleContent": queryValue
+            },
+            page: {
+                curr: 1 //重新从第 1 页开始
+            }
+        }); //只重载数据
+    });
+
+    //基础数据搜索回车事件
+    $('#queryValue').bind('keypress', function (event) {
+        if (event.keyCode == "13") {
+            $(".search_btn").click();
+        }
+    });
+
+    // 返回
+    $(".back").click(function () {
+        $(".main").addClass("layui-show").removeClass("layui-hide");
+        $(".add").addClass("layui-hide").removeClass("layui-show");
+        $('.show-content').empty()
+    });
+
+    /**
+     * 回显讲解区域
+     * @param id
+     */
+    function echoExplainAreaInfo(id) {
+        let index = layer.load(2);
+        ly.ajax({
+            type: 'GET',
+            url: PAGE_BASIC + '/api/participle/find/' + id,
+            dataType: 'json',
+            success: function (json) {
+                if (json.result) {
+                    let data = json.data
+                    $('#id').val(data.id)
+                    $('#participleContent').val(data.participleContent)
+                    form.render();
+                } else {
+                    layer.msg("数据获取失败");
+                }
+                layer.close(index);
+            },
+            error: function (msg) {
+                layer.close(index);
+            }
+        });
+    }
+
+});
+
+/**
+ * 新增智能讲解
+ */
+function addExplainArea() {
+    let postData = form.val('participleInfo');
+    console.log(postData)
+    let index = layer.load(2);
+    ly.ajax({
+        type: 'POST',
+        url: PAGE_BASIC + '/api/participle/addBean',
+        dataType: 'json',
+        data: postData,
+        success: function (json) {
+            if (json.result) {
+                layer.msg("新增成功");
+                $(".main").addClass("layui-show").removeClass("layui-hide");
+                $(".add").addClass("layui-hide").removeClass("layui-show");
+                $('.show-content').empty()
+                reloadTable();
+            } else {
+                layer.msg("新增失败");
+            }
+            layer.close(index);
+        },
+        error: function (msg) {
+            layer.close(index);
+        }
+    });
+}
+
+/**
+ * 编辑讲解区域
+ */
+function updateExplainArea() {
+    let postData = form.val('participleInfo');
+    let index = layer.load(2);
+    ly.ajax({
+        type: 'POST',
+        url: PAGE_BASIC + '/api/participle/updateBean',
+        dataType: 'json',
+        data: postData,
+        success: function (json) {
+            if (json.result) {
+                layer.msg("编辑成功");
+                $(".main").addClass("layui-show").removeClass("layui-hide");
+                $(".add").addClass("layui-hide").removeClass("layui-show");
+                $('.show-content').empty()
+                reloadTable();
+            } else {
+                layer.msg("编辑失败");
+            }
+            layer.close(index);
+        },
+        error: function (msg) {
+            layer.close(index);
+        }
+    });
+}
+
+/**
+ * 删除讲解区域
+ * @param id
+ */
+function deleteExplainArea(id) {
+    let index = layer.load(2);
+    ly.ajax({
+        type: 'POST',
+        url: PAGE_BASIC + '/api/participle/deleteById',
+        dataType: 'json',
+        data: {
+            "id": id,
+        },
+        success: function (json) {
+            if (json.result) {
+                layer.msg("删除成功");
+                reloadTable();
+            } else {
+                layer.msg("删除失败");
+            }
+            layer.close(index);
+        },
+        error: function (msg) {
+            layer.close(index);
+        }
+    });
+}
+
+/**
+ * 重载数据表格
+ */
+function reloadTable() {
+    table.reload('participleTable', {
+        page: {
+            curr: 1 //重新从第 1 页开始
+        }
+    }); //只重载数据
+}
+

+ 1 - 1
spring-cloud/server-page/src/main/resources/static/page/js/constants.js

@@ -2,7 +2,7 @@
  * 配置项目请求接口地址
  */
 // var GATEWAY_URL = "http://23.37.100.80:8084";
- var GATEWAY_URL = "http://23.37.100.87:8084";
+ var GATEWAY_URL = "http://23.37.100.80:8084";
 // var GATEWAY_URL = "http://192.168.101.242:8084";
 var PAGE_URL = "http://23.37.1.104:5500";
 

+ 103 - 0
spring-cloud/server-page/src/main/resources/static/page/participleManage.html

@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
+    <title>分词管理</title>
+    <link rel="stylesheet" type="text/css" href="layui/css/layui.css"/>
+    <link rel="stylesheet" type="text/css" href="css/admin.css"/>
+    <link rel="stylesheet" type="text/css" href="css/common.css"/>
+    <link rel="stylesheet" type="text/css" href="css/animate.css"/>
+</head>
+<style>
+    .layui-form-item .layui-input-inline {
+        width: 60%;
+    }
+
+    .layui-textarea {
+        resize: none;
+        height: 100px;
+    }
+
+    .show-content * {
+        width: auto;
+        height: auto;
+        max-height: 100px;
+        margin: 5px;
+        line-height: 100px;
+    }
+</style>
+<body>
+<!-- 主要内容 -->
+<div class="main fadeIn animated">
+    <div class="header_title"><span>热词管理</span></div>
+    <div class="main_content">
+        <table class="layui-hide" id="participleTable" lay-filter="participleTable"></table>
+
+        <script type="text/html" id="participleTable_toolbar">
+            {{# if (sessionStorage.getItem("menuid-" + sessionStorage.MENU_ID + "-add")  == 'add') { }}
+            <div class="layui-btn-container">
+                <button class="layui-btn layui-btn-sm main_head_btn" lay-event="add"><span
+                        class="iconfont">&#xe607;</span>新增
+                </button>
+            </div>
+            {{# } }}
+        </script>
+
+        <script type="text/html" id="participleTable_bar">
+            {{# if (sessionStorage.getItem("menuid-" + sessionStorage.MENU_ID + "-update") == 'update') { }}
+            <a class="main_tab_btn" lay-event="edit" style="color: #64ADF9;"><span
+                    class="iconfont">&#xe637;</span>编辑</a>
+            {{# } }}
+            {{# if (sessionStorage.getItem("menuid-" + sessionStorage.MENU_ID + "-delete") == 'delete') { }}
+            <a class="main_tab_btn" lay-event="del" style="color: #FC7D8C;"><span class="iconfont">&#xe78d;</span>删除</a>
+            {{# } }}
+        </script>
+
+        <div class="search_box">
+            <div class="layui-input-inline">
+                <input type="text" name="queryValue" id="queryValue" autocomplete="off" class="layui-input"
+                       placeholder="请输入分词内容"/>
+            </div>
+            <button type="button" class="layui-btn layui-btn-sm search_btn">搜 索</button>
+        </div>
+    </div>
+</div>
+
+<!-- 新增 -->
+<div class="add layui-hide fadeIn animated">
+    <div class="header_title"><span>新增</span></div>
+    <div class="main_content">
+        <form class="layui-form" action="" id="participleInfo" lay-filter="participleInfo">
+            <input type="hidden" class="layui-hide" id="id" name="id" readonly=""/>
+            <div class="layui-form-item">
+                <label class="layui-form-label"><span class="font-red">*</span>分词内容:</label>
+                <div class="layui-input-inline">
+                            <textarea class="layui-textarea" id="participleContent" name="participleContent"
+                                      lay-verify="participleContent"
+                                      placeholder="请输入分词内容" autocomplete="off"></textarea>
+                </div>
+            </div>
+            <button type="submit" id="submit" class="layui-btn submit_btn" lay-submit="" lay-filter="submit"
+                    submitType="" style="margin-left: 50px;margin-top: 30px;">提交
+            </button>
+            <button type="button" class="layui-btn layui-btn-primary back back_btn" style="margin-top: 30px;">返回
+            </button>
+        </form>
+    </div>
+</div>
+
+<script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
+<script src="js/common.js" type="text/javascript" charset="utf-8"></script>
+<script src="js/constants.js" type="text/javascript" charset="utf-8"></script>
+<script src="js/js-util.js" type="text/javascript" charset="utf-8"></script>
+<script src="js/base64.js" type="text/javascript" charset="utf-8"></script>
+<script src="js/basic/participleManage.js" type="text/javascript" charset="utf-8"></script>
+
+</body>
+
+</html>