Pārlūkot izejas kodu

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

 Conflicts:
	common/common-entity/sql记录
	svr/svr-cloud-job/src/main/resources/system.properties
wsl 2 gadi atpakaļ
vecāks
revīzija
eb8048a8e7
33 mainītis faili ar 1614 papildinājumiem un 268 dzēšanām
  1. 41 0
      common/common-entity/sql记录
  2. 103 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/radio/WlyyRadioDO.java
  3. 31 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/video/BaseVideoDO.java
  4. 69 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/video/BaseVideoGroupDO.java
  5. 33 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/voice/BaseWordToVoiceDO.java
  6. 1 0
      starter/elasticsearch-starter/pom.xml
  7. 22 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/radio/WlyyRadioDao.java
  8. 11 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/video/BaseVideoDao.java
  9. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/video/BaseVideoGroupDao.java
  10. 82 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/radio/WlyyRadioEndpoint.java
  11. 132 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/video/BaseVideoEndpoint.java
  12. 99 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/radio/WlyyRadioService.java
  13. 164 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/video/BaseVideoGroupService.java
  14. 6 1
      svr/svr-cloud-care/pom.xml
  15. 23 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/constant/CommonConstant.java
  16. 16 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/voice/BaseWordToVoiceDao.java
  17. 15 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/CommonEndpoint.java
  18. 43 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/radio/WlyyRadioEndpoint.java
  19. 27 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/video/PatientVideoEndpoint.java
  20. 10 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  21. 50 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/radio/WlyyRadioService.java
  22. 60 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/video/BaseVideoService.java
  23. 94 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/SpeechTtsUtil.java
  24. 8 1
      svr/svr-cloud-device/pom.xml
  25. 1 1
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/common/PostConstructUtil.java
  26. 113 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/Demo.java
  27. BIN
      svr/svr-cloud-device/src/main/libs/jacob.jar
  28. 328 254
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/data/SaveDataPushJob.java
  29. 6 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/SynElectricRecordsJob.java
  30. 2 2
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/order/DailyWaterJob.java
  31. 5 3
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/hz/HzInterfaceService.java
  32. 2 2
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/web/JobController.java
  33. 1 1
      svr/svr-cloud-job/src/main/resources/system.properties

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 41 - 0
common/common-entity/sql记录


+ 103 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/radio/WlyyRadioDO.java

@ -0,0 +1,103 @@
package com.yihu.jw.entity.care.radio;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * @author xyq
 * @create 2022-07-04 11:48
 * @slogan 他化自在,我自逍遥
 */
@Entity
@Table(name = "wlyy_radio")
public class WlyyRadioDO extends IdEntity {
    //频道名称
    @Column(name = "name")
    private String name;
    //频率
    @Column(name = "frequency")
    private String frequency;
    //简介
    @Column(name = "introduction")
    private String introduction;
    //播放地址
    @Column(name = "url")
    private String url;
    //排序
    @Column(name = "sort_num")
    private Integer sortNum;
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;
    //1可用,0禁用
    @Column(name = "status")
    private Integer status;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getFrequency() {
        return frequency;
    }
    public void setFrequency(String frequency) {
        this.frequency = frequency;
    }
    public String getIntroduction() {
        return introduction;
    }
    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public Integer getSortNum() {
        return sortNum;
    }
    public void setSortNum(Integer sortNum) {
        this.sortNum = sortNum;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 31 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/video/BaseVideoDO.java

@ -18,6 +18,10 @@ public class BaseVideoDO extends UuidIdentityEntityWithCreateTime {
    private String url;//url
    private String img;//封面图片
    private String introduction;//简介
    private Integer sortNum;//排序
    private Integer status;//1可用,0禁用
    @Column(name = "type")
    public String getType() {
        return type;
@ -53,4 +57,31 @@ public class BaseVideoDO extends UuidIdentityEntityWithCreateTime {
    public void setImg(String img) {
        this.img = img;
    }
    @Column(name = "introduction")
    public String getIntroduction() {
        return introduction;
    }
    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }
    @Column(name = "sort_num")
    public Integer getSortNum() {
        return sortNum;
    }
    public void setSortNum(Integer sortNum) {
        this.sortNum = sortNum;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 69 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/video/BaseVideoGroupDO.java

@ -0,0 +1,69 @@
package com.yihu.jw.entity.care.video;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * @author xyq
 * @create 2022-07-04 16:09
 * @slogan 他化自在,我自逍遥
 */
@Entity
@Table(name = "base_video_group")
public class BaseVideoGroupDO extends IdEntity {
    //栏目名称
    @Column(name = "name")
    private String name;
    //栏目排序
    @Column(name = "sort_num")
    private Integer sortNum;
    //1启用,0禁用
    @Column(name = "status")
    private Integer status;
    //创建时间
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getSortNum() {
        return sortNum;
    }
    public void setSortNum(Integer sortNum) {
        this.sortNum = sortNum;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 33 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/voice/BaseWordToVoiceDO.java

@ -0,0 +1,33 @@
package com.yihu.jw.entity.care.voice;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by yeshijie on 2022/7/7.
 */
@Entity
@Table(name = "base_word_to_voice")
public class BaseWordToVoiceDO extends UuidIdentityEntityWithCreateTime {
    private String word;//最多150个汉字,500个字母
    private String voice;//语音的url地址
    public String getWord() {
        return word;
    }
    public void setWord(String word) {
        this.word = word;
    }
    public String getVoice() {
        return voice;
    }
    public void setVoice(String voice) {
        this.voice = voice;
    }
}

+ 1 - 0
starter/elasticsearch-starter/pom.xml

@ -10,6 +10,7 @@
    <modelVersion>4.0.0</modelVersion>
    <artifactId>elasticsearch-starter</artifactId>
    <version>2.0.0</version>
    <dependencies>
        <dependency>

+ 22 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/radio/WlyyRadioDao.java

@ -0,0 +1,22 @@
package com.yihu.jw.base.dao.radio;
import com.yihu.jw.entity.care.radio.WlyyRadioDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author xyq
 * @create 2022-07-04 13:36
 * @slogan 他化自在,我自逍遥
 */
public interface WlyyRadioDao extends PagingAndSortingRepository<WlyyRadioDO, String>, JpaSpecificationExecutor<WlyyRadioDO> {
    @Query("select r from WlyyRadioDO r where r.status = 1 ")
    List<WlyyRadioDO> findByPage(Pageable pageable);
    WlyyRadioDO findById(Long id);
}

+ 11 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/video/BaseVideoDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.base.dao.video;
import com.yihu.jw.entity.care.video.BaseVideoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2022/3/21.
 */
public interface BaseVideoDao extends PagingAndSortingRepository<BaseVideoDO, String>, JpaSpecificationExecutor<BaseVideoDO> {
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/video/BaseVideoGroupDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.dao.video;
import com.yihu.jw.entity.care.video.BaseVideoGroupDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author xyq
 * @create 2022-07-04 16:14
 * @slogan 他化自在,我自逍遥
 */
public interface BaseVideoGroupDao extends PagingAndSortingRepository<BaseVideoGroupDO, String>, JpaSpecificationExecutor<BaseVideoGroupDO> {
    BaseVideoGroupDO findById(Long id);
}

+ 82 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/radio/WlyyRadioEndpoint.java

@ -0,0 +1,82 @@
package com.yihu.jw.base.endpoint.radio;
import com.yihu.jw.base.service.radio.WlyyRadioService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author xyq
 * @create 2022-07-04 13:39
 * @slogan 他化自在,我自逍遥
 */
@RestController
@RequestMapping(value = "/raido/manager")
@Api(value = "收音机音频", description = "收音机音频管理接口", tags = {"wlyy基础服务 - 收音机音频管理接口"})
public class WlyyRadioEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private WlyyRadioService radioService;
    @ApiOperation(value = "分页获取收音机列表")
    @GetMapping( "/getRadioPage")
    public PageEnvelop getRadioPage(@ApiParam(name = "name",value = "名字搜索") @RequestParam(required = false) String name,
                                    @ApiParam(name = "frequency",value = "频率搜索") @RequestParam(required = false) String frequency,
                                    @ApiParam(name = "page",value = "页码") @RequestParam(required = false,defaultValue = "1")Integer page,
                                    @ApiParam(name = "pageSize",value = "每页大小") @RequestParam(required = false,defaultValue = "20")Integer pageSize){
        try {
            return radioService.getRadioPage(name, frequency, page, pageSize);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @ApiOperation(value = "修改收音机音频")
    @PostMapping("/updateRadio")
    public Envelop updateRadio(@ApiParam(name = "id",value = "id")@RequestParam(required = false) Long id,
                               @ApiParam(name = "name",value = "频道名称")@RequestParam String name,
                               @ApiParam(name = "frequency",value = "频率")@RequestParam String frequency,
                               @ApiParam(name = "introduction",value = "简介")@RequestParam(required = false) String introduction,
                               @ApiParam(name = "url",value = "播放地址")@RequestParam String url,
                               @ApiParam(name = "sortNum",value = "排序")@RequestParam(required = false,defaultValue = "1") Integer sortNum,
                               @ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1") Integer status){
        try {
            return radioService.updateRadio(id,name, frequency, introduction, url, sortNum, status);
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @ApiOperation(value = "新增收音机音频")
    @PostMapping("/addRadio")
    public Envelop addRadio(@ApiParam(name = "name",value = "频道名称")@RequestParam String name,
                           @ApiParam(name = "frequency",value = "频率")@RequestParam String frequency,
                           @ApiParam(name = "introduction",value = "简介")@RequestParam(required = false) String introduction,
                           @ApiParam(name = "url",value = "播放地址")@RequestParam String url,
                           @ApiParam(name = "sortNum",value = "排序")@RequestParam(required = false,defaultValue = "1") Integer sortNum,
                           @ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1") Integer status){
        try {
            return radioService.updateRadio(null,name, frequency, introduction, url, sortNum, status);
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @ApiOperation(value = "删除收音机音频")
    @PostMapping("/deleteRadio")
    public Envelop deleteRadio(@ApiParam(name = "id",value = "id")@RequestParam Long id){
        try {
            return radioService.deleteRadio(id);
        }catch (Exception e){
            return failedException2(e);
        }
    }
}

+ 132 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/video/BaseVideoEndpoint.java

@ -0,0 +1,132 @@
package com.yihu.jw.base.endpoint.video;
import com.yihu.jw.base.service.video.BaseVideoGroupService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author xyq
 * @create 2022-07-04 16:18
 * @slogan 他化自在,我自逍遥
 */
@RestController
@RequestMapping(value = "/video/manager")
@Api(value = "视频栏目管理接口", description = "视频栏目管理接口", tags = {"wlyy基础服务 - 视频栏目管理接口"})
public class BaseVideoEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseVideoGroupService videoGroupService;
    @ApiOperation(value = "分页获取视频栏目")
    @GetMapping("/getVideoGroupPage")
    public PageEnvelop getVideoGroupPage(@ApiParam(name = "name",value = "栏目名字搜索")@RequestParam(required = false)String name,
                                         @ApiParam(name = "page",value = "页码") @RequestParam(required = false,defaultValue = "1")Integer page,
                                         @ApiParam(name = "pageSize",value = "每页大小") @RequestParam(required = false,defaultValue = "20")Integer pageSize){
        try {
            return videoGroupService.getVideoGroupPage(name, page, pageSize);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @ApiOperation(value = "修改视频栏目")
    @PostMapping("/updateVideoGroup")
    public Envelop updateVideoGroup(@ApiParam @RequestParam Long id,
                                    @ApiParam(name = "name",value = "栏目名称") @RequestParam String name,
                                    @ApiParam(name = "sortNum",value = "栏目排序")@RequestParam(required = false,defaultValue = "1")Integer sortNum,
                                    @ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1")Integer status){
        try {
            return videoGroupService.updateVideoGroup(id, name, sortNum, status);
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @ApiOperation(value = "新增视频栏目")
    @PostMapping("/addVideoGroup")
    public Envelop addVideoGroup(@ApiParam(name = "name",value = "栏目名称") @RequestParam String name,
                                    @ApiParam(name = "sortNum",value = "栏目排序")@RequestParam(required = false,defaultValue = "1")Integer sortNum,
                                    @ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1")Integer status){
        try {
            return videoGroupService.updateVideoGroup(null, name, sortNum, status);
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @ApiOperation(value = "删除视频栏目")
    @PostMapping("/deleteVideoGroup")
    public Envelop deleteVideoGroup(@ApiParam @RequestParam Long id){
        try {
            return videoGroupService.deleteVideoGroup(id);
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @ApiOperation("分页获取视频列表")
    @GetMapping("/getVideoPage")
    public PageEnvelop getVideoPage(@ApiParam(name = "title",value = "视频标题")@RequestParam(required = false) String title,
                                    @ApiParam(name = "type",value = "栏目id")@RequestParam(required = false)Integer type,
                                    @ApiParam(name = "page",value = "页码") @RequestParam(required = false,defaultValue = "1")Integer page,
                                    @ApiParam(name = "pageSize",value = "每页大小") @RequestParam(required = false,defaultValue = "20")Integer pageSize){
        try {
            return videoGroupService.getVideoPage(title, type, page, pageSize);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @ApiOperation("修改视频")
    @PostMapping("/updateVideo")
    public Envelop updateVideo(@ApiParam @RequestParam String id,
                               @ApiParam(name = "type",value = "栏目id")@RequestParam Integer type,
                               @ApiParam(name = "title",value = "视频标题")@RequestParam String title,
                               @ApiParam(name = "url",value = "视频播放地址")@RequestParam String url,
                               @ApiParam(name = "img",value = "封面图片")@RequestParam(required = false) String img,
                               @ApiParam(name = "introduction",value = "简介")@RequestParam(required = false)String introduction,
                               @ApiParam(name = "sortNum",value = "排序")@RequestParam(required = false,defaultValue = "1")Integer sortNum,
                               @ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1")Integer status){
        try {
            return videoGroupService.updateVideo(id, type, title, url, img, introduction, sortNum, status);
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @ApiOperation("新增视频")
    @PostMapping("/addVideo")
    public Envelop addVideo(@ApiParam(name = "type",value = "栏目id")@RequestParam Integer type,
                               @ApiParam(name = "title",value = "视频标题")@RequestParam String title,
                               @ApiParam(name = "url",value = "视频播放地址")@RequestParam String url,
                               @ApiParam(name = "img",value = "封面图片")@RequestParam(required = false) String img,
                               @ApiParam(name = "introduction",value = "简介")@RequestParam(required = false)String introduction,
                               @ApiParam(name = "sortNum",value = "排序")@RequestParam(required = false,defaultValue = "1")Integer sortNum,
                               @ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1")Integer status){
        try {
            return videoGroupService.updateVideo(null, type, title, url, img, introduction, sortNum, status);
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @ApiOperation("删除视频")
    @RequestMapping(value = "/deleteVideo",method = RequestMethod.POST)
    public Envelop deleteVideo(@ApiParam(name = "id",value = "视频id")@RequestParam String id){
        try {
            return videoGroupService.deleteVideo(id);
        }catch (Exception e){
            return failedException2(e);
        }
    }
}

+ 99 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/radio/WlyyRadioService.java

@ -0,0 +1,99 @@
package com.yihu.jw.base.service.radio;
import com.yihu.jw.base.dao.radio.WlyyRadioDao;
import com.yihu.jw.entity.care.radio.WlyyRadioDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author xyq
 * @create 2022-07-04 13:43
 * @slogan 他化自在,我自逍遥
 */
@Service
public class WlyyRadioService extends BaseJpaService<WlyyRadioDO, WlyyRadioDao> {
    @Autowired
    private WlyyRadioDao radioDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 分页条件查询收音机列表
     * @param name
     * @param frequency
     * @param page
     * @param pageSize
     * @return
     */
    public PageEnvelop getRadioPage(String name,String frequency,Integer page,Integer pageSize){
        page = page>0?page-1:0;
        String colSql = "SELECT id,name,frequency,introduction,url,sort_num sortNum, " +
                " CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) createTime,CAST(status as UNSIGNED) status ";
        String sql = " from wlyy_radio " +
                " where status = 1 ";
        if(StringUtils.isNotBlank(name)){
            sql += " and name like '%"+name+"%' ";
        }
        if(StringUtils.isNotBlank(frequency)){
            sql += " and frequency like '%"+frequency+"%' ";
        }
        String orderSql = " order by sort_num desc limit "+page*pageSize+","+pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(colSql+sql+orderSql);
        String countSql = "SELECT count(*) ";
        Long count = jdbcTemplate.queryForObject(countSql+sql, Long.class);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,pageSize,count);
    }
    /**
     * 修改收音机
     * @param name
     * @param frequency
     * @param introduction
     * @param url
     * @param sortNum
     * @param status
     * @return
     */
    public Envelop updateRadio(Long id,String name,String frequency,String introduction,String url,Integer sortNum,Integer status){
        if(StringUtils.isBlank(name) || StringUtils.isBlank(frequency) || StringUtils.isBlank(url)){
            return Envelop.getError("必填字段不能为空");
        }
        WlyyRadioDO radio = new WlyyRadioDO();
        if(id != null){
            radio.setId(id);
        }
        radio.setName(name);
        radio.setFrequency(frequency);
        radio.setIntroduction(introduction);
        radio.setUrl(url);
        radio.setSortNum(sortNum);
        radio.setCreateTime(new Date());
        radio.setStatus(status);
        radioDao.save(radio);
        return Envelop.getSuccess("保存成功");
    }
    /**
     * 删除收音机
     * @param id
     * @return
     */
    public Envelop deleteRadio(Long id){
        WlyyRadioDO byId = radioDao.findById(id);
        if(byId != null){
            radioDao.delete(byId);
        }
        return Envelop.getSuccess("删除成功");
    }
}

+ 164 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/video/BaseVideoGroupService.java

@ -0,0 +1,164 @@
package com.yihu.jw.base.service.video;
import com.yihu.jw.base.dao.video.BaseVideoDao;
import com.yihu.jw.base.dao.video.BaseVideoGroupDao;
import com.yihu.jw.entity.care.video.BaseVideoDO;
import com.yihu.jw.entity.care.video.BaseVideoGroupDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author xyq
 * @create 2022-07-04 16:16
 * @slogan 他化自在,我自逍遥
 */
@Service
public class BaseVideoGroupService extends BaseJpaService<BaseVideoGroupDO, BaseVideoGroupDao> {
    @Autowired
    private BaseVideoDao videoDao;
    @Autowired
    private BaseVideoGroupDao videoGroupDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 分页获取视频栏目列表
     * @param name
     * @param page
     * @param pageSize
     * @return
     */
    public PageEnvelop getVideoGroupPage(String name,Integer page,Integer pageSize){
        page = page>0?page-1:0;
        String colSql = "SELECT id,name,sort_num sortNum,CAST(status AS UNSIGNED) status,CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) createTime ";
        String countSql = "select count(*) ";
        String sql = " from base_video_group where status = 1 ";
        if(StringUtils.isNotBlank(name)){
            sql += " and name like '%"+name+"%' ";
        }
        String orderSql = " ORDER BY sort_num desc limit "+page*pageSize+","+pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(colSql + sql + orderSql);
        Long count = jdbcTemplate.queryForObject(countSql + sql, Long.class);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,pageSize,count);
    }
    /**
     * 修改视频栏目
     * @param id
     * @param name
     * @param sortNum
     * @param status
     * @return
     */
    public Envelop updateVideoGroup(Long id,String name,Integer sortNum,Integer status){
        if(StringUtils.isBlank(name)){
            return Envelop.getError("栏目名称不能为空");
        }
        BaseVideoGroupDO videoGroupDO = new BaseVideoGroupDO();
        if(id != null){
            videoGroupDO.setId(id);
        }
        videoGroupDO.setName(name);
        videoGroupDO.setSortNum(sortNum);
        videoGroupDO.setStatus(status);
        videoGroupDO.setCreateTime(new Date());
        videoGroupDao.save(videoGroupDO);
        return Envelop.getSuccess("保存成功");
    }
    /**
     * 删除视频栏目
     * @param id
     * @return
     */
    public Envelop deleteVideoGroup(Long id){
        BaseVideoGroupDO byId = videoGroupDao.findById(id);
        if(byId != null){
            videoGroupDao.delete(byId);
        }
        return Envelop.getSuccess("删除成功");
    }
    /**
     * 分页获取视频列表
     * @param title
     * @param type
     * @param page
     * @param pageSize
     * @return
     */
    public PageEnvelop getVideoPage(String title,Integer type,Integer page,Integer pageSize){
        page = page>0?page-1:0;
        String colSql = "SELECT v.id,v.type,v.title,v.url,v.img,CAST(DATE_FORMAT(v.create_time,'%Y-%m-%d %H:%i:%S') as char) createTime, " +
                " v.introduction,v.sort_num sortNum,CAST(v.status as UNSIGNED) status,g.name ";
        String countSql = "SELECT count(*) ";
        String fromSql = " from base_video v left join base_video_group g on v.type = g.id where v.status = 1 ";
        if(StringUtils.isNotBlank(title)){
            fromSql += " and v.title like '%"+title+"%' ";
        }
        if(type != null && type > 0){
            fromSql += " and v.type = "+type;
        }
        Long count = jdbcTemplate.queryForObject(countSql + fromSql, Long.class);
        fromSql += " order by v.sort_num desc limit "+page*pageSize+","+pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(colSql + fromSql);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,pageSize,count);
    }
    /**
     * 修改视频信息
     * @param id
     * @param type
     * @param title
     * @param url
     * @param img
     * @param introduction
     * @param sortNum
     * @param status
     * @return
     */
    public Envelop updateVideo(String id,Integer type,String title,String url,String img,String introduction,Integer sortNum,Integer status){
        if(StringUtils.isBlank(title) || type == null || StringUtils.isBlank(url)){
            return Envelop.getError("必填参数不能为空");
        }
        BaseVideoDO videoDO = new BaseVideoDO();
        if(StringUtils.isNotBlank(id)){
            videoDO.setId(id);
        }
        videoDO.setTitle(title);
        videoDO.setType(type.toString());
        videoDO.setUrl(url);
        videoDO.setImg(img);
        videoDO.setIntroduction(introduction);
        videoDO.setSortNum(sortNum);
        videoDO.setStatus(status);
        videoDO.setCreateTime(new Date());
        videoDao.save(videoDO);
        return Envelop.getSuccess("保存成功");
    }
    /**
     * 删除视频
     * @param id
     * @return
     */
    public Envelop deleteVideo(String id){
        BaseVideoDO video = videoDao.findOne(id);
        if(video != null){
            videoDao.delete(video);
        }
        return Envelop.getSuccess("删除成功");
    }
}

+ 6 - 1
svr/svr-cloud-care/pom.xml

@ -281,10 +281,15 @@
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>com.tencentcloudapi</groupId>
            <artifactId>tencentcloud-speech-sdk-java</artifactId>
            <version>1.0.12</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>svr-cloud-care</finalName>
        <finalName>svr-cloud-care-test</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>

+ 23 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/constant/CommonConstant.java

@ -0,0 +1,23 @@
package com.yihu.jw.care.constant;
/**
 * Created by yeshijie on 2022/7/8.
 */
public class CommonConstant {
    /**
     * 网站域名
     */
    public static final String BASEURL = "https://zhyzh.gongshu.gov.cn/";
    /**
     * 腾讯语音合成域名
     */
    public static final String TXVOICEBASEURL = "tts.tencentcloudapi.com";
    /**
     * 腾讯语音合成文件路径
     */
    public static final String TXVOICEPATH = "/usr/local/nginx/hz/voice/";
}

+ 16 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/voice/BaseWordToVoiceDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.care.dao.voice;
import com.yihu.jw.entity.care.voice.BaseWordToVoiceDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2022/7/7.
 */
public interface BaseWordToVoiceDao extends PagingAndSortingRepository<BaseWordToVoiceDO,String>,
        JpaSpecificationExecutor<BaseWordToVoiceDO> {
    @Query("select a from BaseWordToVoiceDO a where a.word=?1 ")
    BaseWordToVoiceDO findByWord(String word);
}

+ 15 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/CommonEndpoint.java

@ -6,6 +6,7 @@ import com.yihu.jw.care.service.common.CommomService;
import com.yihu.jw.care.service.device.DevicePatientFaceService;
import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.care.util.DingdingUtil;
import com.yihu.jw.care.util.SpeechTtsUtil;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -55,6 +56,20 @@ public class CommonEndpoint extends EnvelopRestEndpoint {
    private CarePatientService carePatientService;
    @Autowired
    private DevicePatientFaceService patientFaceService;
    @Autowired
    private SpeechTtsUtil speechTtsUtil;
    @GetMapping(value = "open/wordToVoice")
    @ApiOperation(value = "文字转语音")
    public Envelop wordToVoice(String text) {
        try {
            String res = speechTtsUtil.wordToVoice(text);
            return ObjEnvelop.getSuccess(res);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @GetMapping(value = "open/findFaceRecord")
    @ApiOperation(value = "获取人脸数据")

+ 43 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/radio/WlyyRadioEndpoint.java

@ -0,0 +1,43 @@
package com.yihu.jw.care.endpoint.radio;
import com.yihu.jw.care.service.radio.WlyyRadioService;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author xyq
 * @create 2022-07-04 13:39
 * @slogan 他化自在,我自逍遥
 */
@RestController
@RequestMapping(value = "/raido")
@Api(value = "收音机音频接口", description = "收音机音频接口", tags = {"收音机音频接口"})
public class WlyyRadioEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private WlyyRadioService radioService;
    @ApiOperation(value = "分页获取收音机列表")
    @GetMapping(value = "/getRadioPage")
    public PageEnvelop getRadioPage(@ApiParam(name = "name",value = "名字搜索") @RequestParam(required = false) String name,
                                    @ApiParam(name = "frequency",value = "频率搜索") @RequestParam(required = false) String frequency,
                                    @ApiParam(name = "page",value = "页码") @RequestParam(required = false,defaultValue = "1")Integer page,
                                    @ApiParam(name = "pageSize",value = "每页大小") @RequestParam(required = false,defaultValue = "20")Integer pageSize){
        try {
            return radioService.getRadioPage(name, frequency, page, pageSize);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
}

+ 27 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/video/PatientVideoEndpoint.java

@ -1,8 +1,10 @@
package com.yihu.jw.care.endpoint.video;
import com.yihu.jw.care.dao.video.BaseVideoDao;
import com.yihu.jw.care.service.video.BaseVideoService;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -27,6 +29,8 @@ public class PatientVideoEndpoint extends EnvelopRestEndpoint {
    private BaseVideoDao baseVideoDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseVideoService baseVideoService;
    @RequestMapping(value = "findVideoNum", method = RequestMethod.GET)
    @ApiOperation(value = "按类型获取视频列表")
@ -61,4 +65,27 @@ public class PatientVideoEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping("/getVideoGroup")
    @ApiOperation(value = "获取视频栏目")
    public ListEnvelop getVideoGroup(){
        try {
            return baseVideoService.getVideoGroup();
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping("/getVideoPageByGroup")
    @ApiOperation(value = "获取视频列表")
    public PageEnvelop getVideoPageByGroup(@ApiParam(name = "groupId",value = "栏目id")@RequestParam(required = false,defaultValue = "0") Integer groupId,
                                           @ApiParam @RequestParam(required = false,defaultValue = "1")Integer page,
                                           @ApiParam @RequestParam(required = false,defaultValue = "20")Integer pageSize){
        try {
            return baseVideoService.getVideoPageByGroup(groupId, page, pageSize);
        }catch (Exception e){
            return failedPageEnvelopException(e);
        }
    }
}

+ 10 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -966,9 +966,16 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
            //数据采集量
            if(1==device.getDeviceType()){//安防设备
                sql = " select count(id) from device_data_push_log where device_sn='"+deviceSn+"' ";
                Long dataCount = jdbcTemplate.queryForObject(sql,Long.class);
                devInfo.put("dataCount",dataCount);//
                if("20".equals(device.getCategoryCode())){
                    //电表数据
                    sql = " select count(id) from base_device_electric_record where cons_no='"+deviceSn+"' ";
                    Long dataCount = jdbcTemplate.queryForObject(sql,Long.class);
                    devInfo.put("dataCount",dataCount);//
                }else{
                    sql = " select count(id) from device_data_push_log where device_sn='"+deviceSn+"' ";
                    Long dataCount = jdbcTemplate.queryForObject(sql,Long.class);
                    devInfo.put("dataCount",dataCount);//
                }
                sql = " select sum(total) from (\n" +
                        "select count(id) total from base_emergency_assistance_order where device_sn='"+deviceSn+"'\n" +
                        "UNION ALL\n" +

+ 50 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/radio/WlyyRadioService.java

@ -0,0 +1,50 @@
package com.yihu.jw.care.service.radio;
import com.yihu.jw.restmodel.web.PageEnvelop;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * @author xyq
 * @create 2022-07-04 13:43
 * @slogan 他化自在,我自逍遥
 */
@Service
public class WlyyRadioService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 分页条件查询收音机列表
     * @param name
     * @param frequency
     * @param page
     * @param pageSize
     * @return
     */
    public PageEnvelop getRadioPage(String name,String frequency,Integer page,Integer pageSize){
        page = page>0?page-1:0;
        String colSql = "SELECT id,name,frequency,introduction,url,sort_num sortNum, " +
                " CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) createTime,CAST(status as UNSIGNED) status ";
        String sql = " from wlyy_radio " +
                " where status = 1 ";
        if(StringUtils.isNotBlank(name)){
            sql += " and name like '%"+name+"%' ";
        }
        if(StringUtils.isNotBlank(frequency)){
            sql += " and frequency like '%"+frequency+"%' ";
        }
        String orderSql = " order by sort_num desc limit "+page*pageSize+","+pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(colSql+sql+orderSql);
        String countSql = "SELECT count(*) ";
        Long count = jdbcTemplate.queryForObject(countSql+sql, Long.class);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,pageSize,count);
    }
}

+ 60 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/video/BaseVideoService.java

@ -0,0 +1,60 @@
package com.yihu.jw.care.service.video;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * @author xyq
 * @create 2022-07-05 9:57
 * @slogan 他化自在,我自逍遥
 */
@Service
public class BaseVideoService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 获取视频栏目列表
     * @return
     */
    public ListEnvelop getVideoGroup(){
        String sql = "SELECT id,name,sort_num sortNum,CAST(status as UNSIGNED) status," +
                " CAST(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as char) createTime " +
                " from base_video_group " +
                " where status = 1 order by sort_num desc ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return ListEnvelop.getSuccess("查询成功",list);
    }
    /**
     * 分页获取视频列表
     * @param groupId
     * @param page
     * @param pageSize
     * @return
     */
    public PageEnvelop getVideoPageByGroup(Integer groupId,Integer page,Integer pageSize){
        page = page>0?page-1:0;
        String colSql = "SELECT v.id,v.type,v.title,v.url,v.img,CAST(DATE_FORMAT(v.create_time,'%Y-%m-%d %H:%i:%S') as char) createTime, " +
                " v.introduction,v.sort_num sortNum,CAST(v.status as UNSIGNED) status,g.name ";
        String countSql = "select count(v.id) ";
        String sql = " from base_video v " +
                " left join base_video_group g on v.type = g.id " +
                " where v.status = 1 ";
        if(groupId > 0){
            sql += " and v.type = "+groupId+" ";
        }
        Long count = jdbcTemplate.queryForObject(countSql + sql, Long.class);
        sql += " order by v.sort_num desc limit "+page*pageSize+","+pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(colSql + sql);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,pageSize,count);
    }
}

+ 94 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/SpeechTtsUtil.java

@ -0,0 +1,94 @@
package com.yihu.jw.care.util;
import com.tencent.tts.utils.Ttsutils;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.tts.v20190823.TtsClient;
import com.tencentcloudapi.tts.v20190823.models.TextToVoiceRequest;
import com.tencentcloudapi.tts.v20190823.models.TextToVoiceResponse;
import com.yihu.jw.care.constant.CommonConstant;
import com.yihu.jw.care.dao.voice.BaseWordToVoiceDao;
import com.yihu.jw.entity.care.voice.BaseWordToVoiceDO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import sun.misc.BASE64Decoder;
import java.util.Date;
import java.util.UUID;
/**
 * Created by yeshijie on 2022/7/6.
 */
@Component
public class SpeechTtsUtil {
    private static final Logger logger = LoggerFactory.getLogger(SpeechTtsUtil.class);
    private static String codec = "mp3";
    private static final String appId = "1305960513";
    private static final String secretId = "AKIDwhBPN5WgYAVaO2QXNwEF0UieJhpgGZbN";
    private static final String secretKey = "WliPpdBSXMuBBuNZU8VbQyFG0TfaEbhX";
    @Value("${spring.profiles.active}")
    private String profiles;
    @Autowired
    private BaseWordToVoiceDao wordToVoiceDao;
    /**
     * 腾讯文字合成语音
     * @param text
     * @return
     */
    public String wordToVoice(String text){
        synchronized (text.intern()){
            try{
                if(!"hzprod".equals(profiles)){
                    return CommonConstant.BASEURL + "voice/test.mp3";
                }
                BaseWordToVoiceDO voiceDO = wordToVoiceDao.findByWord(text);
                if(voiceDO!=null){
                    return voiceDO.getVoice();
                }
                String sessionId = UUID.randomUUID().toString().replace("-","");
                Credential cred = new Credential(secretId, secretKey);
                // 实例化一个http选项,可选的,没有特殊需求可以跳过
                HttpProfile httpProfile = new HttpProfile();
                httpProfile.setEndpoint(CommonConstant.TXVOICEBASEURL);
                // 实例化一个client选项,可选的,没有特殊需求可以跳过
                ClientProfile clientProfile = new ClientProfile();
                clientProfile.setHttpProfile(httpProfile);
                // 实例化要请求产品的client对象,clientProfile是可选的
                TtsClient client = new TtsClient(cred, "ap-shanghai", clientProfile);
                // 实例化一个请求对象,每个接口都会对应一个request对象
                TextToVoiceRequest req = new TextToVoiceRequest();
                req.setText(text);
                req.setSessionId(sessionId);
                req.setVoiceType(10510000L);
                req.setVolume(10F);
                req.setCodec(codec);
                // 返回的resp是一个TextToVoiceResponse的实例,与请求对象对应
                TextToVoiceResponse resp = client.TextToVoice(req);
                // 输出json格式的字符串回包
                // logger.info(TextToVoiceResponse.toJsonString(resp));
                byte[] buffer = new BASE64Decoder().decodeBuffer(resp.getAudio());
                Ttsutils.saveResponseToFile(buffer,CommonConstant.TXVOICEPATH + sessionId+".mp3");
                String voice = CommonConstant.BASEURL + "voice/"+sessionId+".mp3";
                voiceDO = new BaseWordToVoiceDO();
                voiceDO.setWord(text);
                voiceDO.setCreateTime(new Date());
                voiceDO.setVoice(voice);
                wordToVoiceDao.save(voiceDO);
                logger.info("ending.....");
                return voice;
            } catch (Exception e) {
                e.printStackTrace();
            }
            return "";
        }
    }
}

+ 8 - 1
svr/svr-cloud-device/pom.xml

@ -23,6 +23,13 @@
            <scope>system</scope>
            <systemPath>${basedir}/src/main/libs/jna.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>com.jacob</groupId>
            <artifactId>jacob</artifactId>
            <version>1</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/libs/jacob.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-websocket</artifactId>
@ -165,7 +172,7 @@
    </dependencies>
    <build>
        <finalName>svr-cloud-device</finalName>
        <finalName>svr-cloud-device-test</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>

+ 1 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/common/PostConstructUtil.java

@ -32,7 +32,7 @@ public class PostConstructUtil {
    public void init(){
        logger.info("启动电表的mqtt订阅====");
        mqttClientUtil.start();
//        mqttClientUtil.start();//废弃电表用其他方式对接
        if("hzprod".equals(profiles)){
            logger.info("启动宇视人脸摄像头sdk====");

+ 113 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/Demo.java

@ -0,0 +1,113 @@
package com.yihu.jw.care.util;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Objects;
/**
 * Created by yeshijie on 2022/6/29.
 */
public class Demo {
    public static void main(String[] args) {
//        readStr("你好啊哈哈哈要读的文字字符串字符串文本阅读!");
        textToSpeechIO("你好啊哈哈哈要读的文字字符串字符串文本阅读");
//
//        textToStr("D:/测试.txt");
    }
    /**
     * 字符串文本阅读
     * @param str 要读的文字字符串
     */
    public static void readStr(String str){
        ActiveXComponent ax = new ActiveXComponent("Sapi.SpVoice");
        //运行时输出语音内容
        Dispatch spVoice = ax.getObject();
        //设置音量 0 ~ 100
        ax.setProperty("Volume",new Variant(100));
        //设置朗读速度 -10 ~ +10
        ax.setProperty("Rate",new Variant(0));
        //执行朗读
        Dispatch.call(spVoice,"Speak",new Variant(str));
    }
    /**
     * 字符串文本转 wav格式 语音文件
     * @param text 要读的文字字符串
     */
    public static void textToSpeechIO(String text){
        ActiveXComponent ax = null;
        Dispatch spFileStream = null;
        Dispatch spAudioFormat = null;
        Dispatch spVoice = null;
        try{
            ax = new ActiveXComponent("Sapi.SpFileStream");
            spFileStream = ax.getObject();
            ax = new ActiveXComponent("Sapi.SpAudioFormat");
            spAudioFormat = ax.getObject();
            spVoice = new ActiveXComponent("Sapi.SpVoice").getObject();
            // 设置音频流格式
            Dispatch.put(spAudioFormat, "Type", new Variant(22));
            // 设置文件输出流格式
            Dispatch.putRef(spFileStream, "Format", spAudioFormat);
            // 调用输出 文件流打开方法,创建一个.wav文件
            Dispatch.call(spFileStream, "Open", new Variant("D:/voice.wav"), new Variant(3), new Variant(true));
            // 设置声音对象的音频输出流为输出文件对象
            Dispatch.putRef(spVoice, "AudioOutputStream", spFileStream);
            // 设置音量  0 ~ 100
            Dispatch.put(spVoice, "Volume", new Variant(100));
            // 设置朗读速度  -10 ~ +10
            Dispatch.put(spVoice, "Rate", new Variant(0));
            Dispatch.call(spVoice, "Speak", new Variant(text));
            System.out.println("输出语音文件成功!");
        }catch(Exception e){
            e.printStackTrace();
        }finally {
            // 关闭输出文件
            Dispatch.call(Objects.requireNonNull(spFileStream), "Close");
            Dispatch.putRef(Objects.requireNonNull(spVoice), "AudioOutputStream", null);
            Objects.requireNonNull(spAudioFormat).safeRelease();
            spFileStream.safeRelease();
            spVoice.safeRelease();
            ax.safeRelease();
        }
    }
    /**
     * txt文件转字符串
     * @param fileName txt文件所在位置
     * @return txt文件中的字符串
     */
    public static String textToStr(String fileName){
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new FileReader(fileName));
            StringBuilder sb = new StringBuilder();
            String line;
            while ((line=reader.readLine()) != null){
                sb.append(line);
            }
            return sb.toString();
        } catch (IOException e) {
            e.printStackTrace();
            return "";
        }finally {
            try {
                Objects.requireNonNull(reader).close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

BIN
svr/svr-cloud-device/src/main/libs/jacob.jar


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 328 - 254
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/data/SaveDataPushJob.java


+ 6 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/SynElectricRecordsJob.java

@ -5,6 +5,8 @@ import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
@ -13,13 +15,17 @@ import org.springframework.beans.factory.annotation.Autowired;
 */
@DisallowConcurrentExecution
public class SynElectricRecordsJob implements Job {
    Logger logger = LoggerFactory.getLogger(SynElectricRecordsJob.class);
    @Autowired
    private HzInterfaceService hzInterfaceService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            logger.info("SynElectricRecordsJob start");
            hzInterfaceService.electricityTable(null);
            logger.info("SynElectricRecordsJob end");
        }catch (Exception e){
            e.printStackTrace();
        }

+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/order/DailyWaterJob.java

@ -69,12 +69,12 @@ public class DailyWaterJob implements Job {
                    e.printStackTrace();
                }
            }
            sql = " update set dict_value='"+nowTime+"' from wlyy_hospital_sys_dict where dict_name='DAILY_WATER_LAST_TIME' and dict_code='DAILY_WATER_LAST_TIME'  ";
            sql = " update wlyy_hospital_sys_dict set dict_value='"+nowTime+"' where dict_name='DAILY_WATER_LAST_TIME' and dict_code='DAILY_WATER_LAST_TIME'  ";
            jdbcTemplate.execute(sql);
            logger.info("DAILY_WATER_JOB end");
        }catch (Exception e){
            String sql = " update set dict_value='"+nowTime+"' from wlyy_hospital_sys_dict where dict_name='DAILY_WATER_LAST_TIME' and dict_code='DAILY_WATER_LAST_TIME'  ";
            String sql = " update wlyy_hospital_sys_dict set dict_value='"+nowTime+"' where dict_name='DAILY_WATER_LAST_TIME' and dict_code='DAILY_WATER_LAST_TIME'  ";
            jdbcTemplate.execute(sql);
            logger.error("DAILY_WATER_JOB error....."+e.getMessage());
        }

+ 5 - 3
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/hz/HzInterfaceService.java

@ -56,10 +56,12 @@ public class HzInterfaceService {
        try {
            List<BaseDeviceElectricRecordDO> list = new ArrayList<>();
            if(StringUtils.isBlank(queryDate)){
                queryDate = DateUtil.getStringDateShort();
                //电表数据每天凌晨0点到点30分 开始更新前一天的数据
                queryDate = DateUtil.getNextDay(DateUtil.getStringDateShort(),-2);
            }
            list = baseDeviceElectricRecordDao.findByStatDate(queryDate);
            if(list.size()>0){
            String sql = "select count(*) from base_device_electric_record where stat_date='"+queryDate+"'";
            Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
            if(count>0){
                logger.info("当天数据已同步,请勿重复操作:"+queryDate);
                return;
            }

+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/web/JobController.java

@ -57,10 +57,10 @@ public class JobController extends BaseController {
    public String electricityTable(String queryDate) {
        try {
            hzInterfaceService.electricityTable(queryDate);
            return success("删除成功!");
            return success("更新成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "删除失败:" + e.getMessage());
            return error(-1, "更新失败:" + e.getMessage());
        }
    }

+ 1 - 1
svr/svr-cloud-job/src/main/resources/system.properties

@ -37,7 +37,7 @@ DEVICE_DATA_FACE_JOB= 0 0 3 * * ? *
#\u4EBA\u8138\u8BB0\u5F55\u6BCF30\u5206\u949F\u8DD1\u4E00\u6B21
SYN_FACE_RECORD_JOB= 0 0/30 * * * ? *
#\u7535\u8868\u6BCF\u5929\u65E9\u4E0A\u4E0A8\u70B9\u8DD1\u4E00\u6B21
SYN_ELECTRIC_RECORD_JOB= 0 0 3 * * ? *
SYN_ELECTRIC_RECORD_JOB= 0 0 8 * * ? *
#\u63A8\u9001\u8BB0\u5165\u624B\u52A8\u5B9A\u65F6 \u6BCF\u4E94\u5206\u949F\u8DD1\u4E00\u6B21
PUSHRECORD_LOG_INFO_JOB= 0 0/5 * * * ? *
#\u6BCF\u5929\u65E9\u4E0A\u4E5D\u70B9\u534A\u8DD1\u4E00\u6B21