Explorar o código

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

liubing %!s(int64=2) %!d(string=hai) anos
pai
achega
e95111cbcf
Modificáronse 55 ficheiros con 1838 adicións e 462 borrados
  1. 48 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuUrlDO.java
  2. 104 0
      common/common-entity/src/main/java/com/yihu/jw/entity/child/BaseChildManage.java
  3. 18 1
      common/common-entity/src/main/java/com/yihu/jw/entity/log/BasePushRecordLogEntity.java
  4. 5 0
      common/common-entity/src/main/java/com/yihu/jw/entity/log/BasePushrecordLogInfoEntity.java
  5. 10 3
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationDetailDO.java
  6. 23 0
      common/common-util/src/main/java/com/yihu/jw/util/common/RSAUtils.java
  7. 27 4
      common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java
  8. 2 1
      starter/swagger-starter/src/main/java/com/yihu/jw/SwaggerConfig.java
  9. 6 0
      svr/svr-base/pom.xml
  10. 11 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/childManage/BaseChildManageDao.java
  11. 7 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/log/BasePushrecordLogInfoDao.java
  12. 14 9
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/ManageMessagePush/ManageSystemPushMessageController.java
  13. 96 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/childManage/ChildManageController.java
  14. 143 116
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java
  15. 201 142
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/MenuEndpoint.java
  16. 147 68
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/user/UserEndpoint.java
  17. 71 24
      svr/svr-base/src/main/java/com/yihu/jw/base/service/ManageMessagePush/ManageSystemPushMessageService.java
  18. 90 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/child/ChildManageService.java
  19. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/service/lifeCare/LifeCareService.java
  20. 6 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/video/BaseVideoGroupService.java
  21. 7 3
      svr/svr-base/src/main/resources/application.yml
  22. 19 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/child/BaseChildManageDao.java
  23. 16 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/CommonEndpoint.java
  24. 47 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/child/ChildManageController.java
  25. 18 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java
  26. 19 13
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java
  27. 19 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java
  28. 39 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  29. 63 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/child/ChildNewsListService.java
  30. 0 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java
  31. 1 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java
  32. 146 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/HongLingJinUtil.java
  33. 34 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java
  34. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/SpeechTtsUtil.java
  35. 0 4
      svr/svr-cloud-device/pom.xml
  36. 0 2
      svr/svr-cloud-device/src/main/java/com/yihu/SvrCloudDeviceApplication.java
  37. 1 1
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/common/PostConstructUtil.java
  38. 2 1
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java
  39. 2 2
      svr/svr-cloud-job/pom.xml
  40. 1 2
      svr/svr-cloud-job/src/main/java/com/yihu/CloudApplicationJob.java
  41. 2 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/DeviceWatchRemainingPowerJob.java
  42. 47 34
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/pushRecord/PushRecordJob.java
  43. 0 1
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  44. 2 2
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java
  45. 1 1
      svr/svr-cloud-job/src/main/resources/system.properties
  46. 12 0
      svr/svr-iot/src/main/java/com/yihu/iot/config/MvcConfig.java
  47. 55 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/common/CommonController.java
  48. 21 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/common/BaseLoginLogDao.java
  49. 12 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/common/BaseMenuUrlDao.java
  50. 72 0
      svr/svr-iot/src/main/java/com/yihu/iot/interceptor/PermissionInterceptor.java
  51. 123 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/common/PermissionService.java
  52. 4 1
      svr/svr-iot/src/main/resources/application.yml
  53. 4 3
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistScreenResultController.java
  54. 11 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistScreenResultService.java
  55. 5 5
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

+ 48 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuUrlDO.java

@ -0,0 +1,48 @@
package com.yihu.jw.entity.base.menu;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import com.yihu.jw.entity.UuidIdentityEntityWithTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 菜单控制的url表 用来做url权限控制
 * Created by yeshijie on 2022/7/20.
 */
@Entity
@Table(name = "base_menu_url")
public class BaseMenuUrlDO extends UuidIdentityEntityWithCreateTime {
    private String menuId;//对应base_menu表的id字段
    private String url;//url链接
    private String urlName;//url名称
    @Column(name = "menu_id")
    public String getMenuId() {
        return menuId;
    }
    public void setMenuId(String menuId) {
        this.menuId = menuId;
    }
    @Column(name = "url")
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Column(name = "url_name")
    public String getUrlName() {
        return urlName;
    }
    public void setUrlName(String urlName) {
        this.urlName = urlName;
    }
}

+ 104 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/child/BaseChildManage.java

@ -0,0 +1,104 @@
package com.yihu.jw.entity.child;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by wsl on 2022/7/20
 */
@Entity
@Table(name = "base_child_manage")
public class BaseChildManage extends UuidIdentityEntity {
    private Integer type;  //类型1图文辅导,2视频辅导,3喜讯详细
    private String orgName;  //机构名字
    private String org;  //机构
    private String title;  //标题
    private String url;  //url/文章内容
    private String img;  //封面图片
    private Date createTime;  //创建时间
    private Integer del;  //1可用,0禁用
    private Integer click;//点击量
    public Integer getClick() {
        return click;
    }
    public void setClick(Integer click) {
        this.click = click;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getOrg() {
        return org;
    }
    public void setOrg(String org) {
        this.org = org;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 18 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/log/BasePushRecordLogEntity.java

@ -6,7 +6,9 @@ import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
/**
 * Created by wsl on 2022/7/4
@ -24,7 +26,22 @@ public class BasePushRecordLogEntity extends UuidIdentityEntity {
    private Date createTime;  //创建时间
    private String sendObject;  //发送对象
    private Integer messageType;//消息推送类型
    private  Integer sendObjectType;//发送对象类型(1签约老人,2部分签约老人)
    private Integer sendObjectType;//发送对象类型(1签约老人,2部分签约老人)
    private List<String> patientList;
    @Transient
    public List<String> getPatientList() {
        return patientList;
    }
    public void setPatientList(List<String> patientList) {
        this.patientList = patientList;
    }
    @Column(name = "send_object_type")

+ 5 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/log/BasePushrecordLogInfoEntity.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.log;
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;
@ -24,6 +25,8 @@ public class BasePushrecordLogInfoEntity extends IdEntity {
    private Date sendTime; //发送时间
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
@ -32,6 +35,7 @@ public class BasePushrecordLogInfoEntity extends IdEntity {
        this.patientName = patientName;
    }
    @Column(name = "push_id")
    public String getPushId() {
        return pushId;
    }
@ -65,6 +69,7 @@ public class BasePushrecordLogInfoEntity extends IdEntity {
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "send_time")
    public Date getSendTime() {
        return sendTime;
    }

+ 10 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationDetailDO.java

@ -3,11 +3,8 @@ package com.yihu.jw.entity.specialist.rehabilitation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.util.StringFStringEncryptConverter;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@ -53,6 +50,8 @@ public class RehabilitationDetailDO extends UuidIdentityEntity implements Serial
    private String remark;//备注
    @Column(name = "relation_code")
    private String relationCode;//业务关联code
    @Column(name = "followup_detail_type")
    private Integer followupDetailType;//默认0,1是冠心病社区表单
    private Integer reservationType;//复诊类型:1线上,2线下,3远程
    private Date createTime;
@ -269,4 +268,12 @@ public class RehabilitationDetailDO extends UuidIdentityEntity implements Serial
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public Integer getFollowupDetailType() {
        return followupDetailType;
    }
    public void setFollowupDetailType(Integer followupDetailType) {
        this.followupDetailType = followupDetailType;
    }
}

+ 23 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/RSAUtils.java

@ -3,6 +3,7 @@ package com.yihu.jw.util.common;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import javax.crypto.Cipher;
@ -128,6 +129,28 @@ public class RSAUtils {
        return ci.doFinal(data);
    }
    /**
     * RSA公钥加密
     *
     * @param str
     *            加密字符串
     * @param publicKey
     *            公钥
     * @return 密文
     * @throws Exception
     *             加密过程中的异常信息
     */
    public static String encrypt( String str, String publicKey ) throws Exception{
        //base64编码的公钥
        byte[] decoded = Base64.decodeBase64(publicKey);
        RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
        //RSA加密
        Cipher cipher = Cipher.getInstance("RSA");
        cipher.init(Cipher.ENCRYPT_MODE, pubKey);
        String outStr = Base64.encodeBase64String(cipher.doFinal(str.getBytes("UTF-8")));
        return outStr;
    }
    public static void main(String[] args) {
        KeyPair keyPair =  initKey();

+ 27 - 4
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -7,16 +7,15 @@ import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
import com.yihu.jw.util.dao.BaseExceptionDictUtilDao;
import com.yihu.jw.util.dao.BaseExceptionLogUtilDao;
import com.yihu.jw.util.dao.BaseExceptionServerDictUtilDao;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.*;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
@ -393,6 +392,30 @@ public class HttpClientUtil {
        restTemplate.put(url, formEntity, String.class);
    }
    public JSONObject headerPost(String url,MultiValueMap<String, String> params){
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/x-www-form-urlencoded");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<MultiValueMap<String, String>> request = new org.springframework.http.HttpEntity<>(params, headers);
        org.springframework.http.HttpEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.POST, request, JSONObject.class);
        return response.getBody();
    }
    public String getBodyAuthorization(String url, String token, String str) throws IOException {
        RestTemplate restTemplate = new RestTemplate();
        HttpClient httpClient = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet(url+str);
        httpGet.addHeader("Authorization","Bearer"+" "+token);
        httpGet.addHeader("Type",MediaType.APPLICATION_JSON_VALUE);
        httpGet.addHeader("Accept",MediaType.ALL_VALUE);
        HttpResponse response = httpClient.execute(httpGet);
        HttpEntity entity = response.getEntity();
        String strss = EntityUtils.toString(entity, "UTF-8") ;
        return strss;
    }
    /**
     * 发送post请求
     *

+ 2 - 1
starter/swagger-starter/src/main/java/com/yihu/jw/SwaggerConfig.java

@ -29,7 +29,7 @@ public class SwaggerConfig {
    final String userAgentJson = "{\"id\":int,\"uid\":string,\"openid\":string,\"token\":string,\"lastUid\":string,\"platform\":int}";
    private List<Parameter> addUseragent() {
        ParameterBuilder tokenPar = new ParameterBuilder();
        List<Parameter> pars = new ArrayList<Parameter>();
        List<Parameter> pars = new ArrayList<>();
        tokenPar.name("userAgent").description(userAgentJson).modelRef(new ModelRef("string")).parameterType("header").required(false).defaultValue("").build();
        pars.add(tokenPar.build());
        return pars;
@ -78,6 +78,7 @@ public class SwaggerConfig {
                        regex("/dump"),
                        regex("/autoconfig"),
                        regex("/info"),
                        regex("/ChildManageController"),
                        regex("/features")))
                .build()
                .apiInfo(privateAPIInfo());

+ 6 - 0
svr/svr-base/pom.xml

@ -62,6 +62,12 @@
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-activemq</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>im-service</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>

+ 11 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/childManage/BaseChildManageDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.base.dao.childManage;
import com.yihu.jw.entity.child.BaseChildManage;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wsl on 2022/7/20
 */
public interface BaseChildManageDao extends PagingAndSortingRepository<BaseChildManage,String>, JpaSpecificationExecutor<BaseChildManage> {
}

+ 7 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/log/BasePushrecordLogInfoDao.java

@ -2,6 +2,8 @@ package com.yihu.jw.base.dao.log;
import com.yihu.jw.entity.log.BasePushrecordLogInfoEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -9,4 +11,9 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface BasePushrecordLogInfoDao extends PagingAndSortingRepository<BasePushrecordLogInfoEntity, String>, JpaSpecificationExecutor<BasePushrecordLogInfoEntity> {
    @Modifying
    @Query("delete from BasePushrecordLogInfoEntity p where  p.pushId = ?1  ")
    void deleteByPushId(String pushId);
}

+ 14 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/ManageMessagePush/ManageSystemPushMessageController.java

@ -4,6 +4,7 @@ import com.yihu.jw.base.service.ManageMessagePush.ManageSystemPushMessageService
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -61,19 +62,19 @@ public class ManageSystemPushMessageController extends EnvelopRestEndpoint {
    @ApiOperation("获取推送记录列表")
    @PostMapping(value = "/pushMessageList")
    public ListEnvelop pushMessageList(@ApiParam(name = "messageType",value = "消息类型",required = false)
    public ObjEnvelop pushMessageList(@ApiParam(name = "messageType",value = "消息类型",required = false)
                                       @RequestParam(value = "messageType",required = false)Integer messageType,
                                       @ApiParam(name = "status",value = "状态",required = false)
                                      @ApiParam(name = "status",value = "状态",required = false)
                                       @RequestParam(value = "status",required = false)Integer status,
                                       @ApiParam(name = "name",value = "名字查找",required = false)
                                      @ApiParam(name = "name",value = "名字查找",required = false)
                                       @RequestParam(value = "name",required = false)String name,
                                       @RequestParam(value = "page",required = true)Integer page,
                                       @RequestParam(value = "pageSize",required = true)Integer pageSize){
                                      @RequestParam(value = "page",required = true)Integer page,
                                      @RequestParam(value = "pageSize",required = true)Integer pageSize){
        try {
            return success(mspmservice.pushMessageList(messageType,status,name,page,pageSize));
            return ObjEnvelop.getSuccess("获取成功!",mspmservice.pushMessageList(messageType,status,name,page,pageSize),200);
        } catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException2(e);
            return failedObjEnvelopException2(e);
        }
    }
@ -100,9 +101,13 @@ public class ManageSystemPushMessageController extends EnvelopRestEndpoint {
                                  @ApiParam(name = "pushDateType", value = "推送类型 1立即发送 2 定时发送", required = true)
                                  @RequestParam(value = "pushDateType", required = true) Integer pushDateType,
                                  @ApiParam(name = "pushDate", value = "推送时间 定时发送才传", required = false)
                                  @RequestParam(value = "pushDate", required = false) String pushDate) {
                                  @RequestParam(value = "pushDate", required = false) String pushDate,
                                  @ApiParam(name = "addType",value = "类型 1新增 2修改",required = false)
                                  @RequestParam(value = "addType",required = false)Integer addType,
                                  @ApiParam(name = "pushId",value = "推送id",required = false)
                                  @RequestParam(value = "pushId",required = false)String pushId) {
        try {
            mspmservice.addPushMessage(content,pushObjectType,pushObjectJson,pushDateType,pushDate);
            mspmservice.addPushMessage(content,pushObjectType,pushObjectJson,pushDateType,pushDate,addType,pushId);
            return success("添加成功");
        } catch (Exception e) {
            e.printStackTrace();

+ 96 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/childManage/ChildManageController.java

@ -0,0 +1,96 @@
package com.yihu.jw.base.endpoint.childManage;
import com.yihu.jw.base.service.child.ChildManageService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
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.*;
/**
 * Created by wsl on 2022/7/20
 */
@RestController
@RequestMapping("/childManage")
@Api(tags = "幼儿管理", description = "幼儿管理相关操作")
public class ChildManageController extends EnvelopRestEndpoint {
    @Autowired
    private ChildManageService childManageService;
    @ApiOperation(value = "获取列表")
    @GetMapping("/getChildManageList")
    public ObjEnvelop getChildManageList(@ApiParam(name = "type" ,value = "类型 1图文辅导,2视频辅导,3喜讯详细",required = true)
                                         @RequestParam(value = "type",required = true)Integer type,
                                         @ApiParam(name = "title" ,value = "标题",required = false)
                                         @RequestParam(value = "title",required = false)String title,
                                         @ApiParam(name = "orgCode" ,value = "机构code",required = false)
                                         @RequestParam(value = "orgCode",required = false)String orgCode,
                                         @ApiParam(name = "id" ,value = "id",required = false)
                                         @RequestParam(value = "id",required = false)String id,
                                         @RequestParam(value = "page",required = false)Integer page,
                                         @RequestParam(value = "pageSize",required = false)Integer pageSize){
        try {
            return success(childManageService.getChildManageList(type,page,pageSize,title,orgCode,id));
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("获取失败");
        }
    }
    @ApiOperation(value = "保存修改")
    @PostMapping("/saveOrUpdate")
    public Envelop saveOrUpdate(@ApiParam(name = "jsonData",value = "实体转JSON",required = true)
                                @RequestParam(value = "jsonData",required = false)String jsonData){
        try {
            childManageService.saveOrUpdate(jsonData);
            return success("保存成功!",200);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("保存失败!");
        }
    }
    @ApiOperation(value = "删除")
    @PostMapping("/deletInfo")
    public Envelop deletinfo(@ApiParam(name = "id",value = "id",required = true)
                             @RequestParam(value = "id",required = true)String id){
        try {
            childManageService.deletinfo(id);
            return success("删除成功!",200);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError("删除失败!");
        }
    }
    @ApiOperation(value = "获取机构")
    @GetMapping("/childOrgList")
    public ListEnvelop childOrgList(){
        try {
            return success(childManageService.childOrgList());
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("获取失败!");
        }
    }
}

+ 143 - 116
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java

@ -69,89 +69,98 @@ public class FileUploadController extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_IMG)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
    public ObjEnvelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        // 得到文件的完整名称  xxx.txt
                                       @RequestParam(value = "file", required = true) MultipartFile file){
        try {
            // 得到文件的完整名称  xxx.txt
//        String originalFilename = file.getOriginalFilename();
//        InputStream inputStream = file.getInputStream();
//        UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        return success("上传成功", uploadVO);
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
        }else if(isClose.equals("2")){
            String originalFilename = file.getOriginalFilename();
            String[] fs = originalFilename.split("\\.");
            String type = fs[1];
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,type);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
            UploadVO uploadVO = new UploadVO();
            if (isClose.equalsIgnoreCase("1")){
                Map<String, Object> map = fileUploadService.uploadImg(file);
                uploadVO.setFullUri(map.get("accessory").toString());
            }else if(isClose.equals("2")){
                String originalFilename = file.getOriginalFilename();
                String[] fs = originalFilename.split("\\.");
                String type = fs[1];
                //内网上传
                String rs = fileUploadService.request(remote_inner_url,file,type);
                logger.info(rs);
                JSONObject json = JSON.parseObject(rs);
                uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else {
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
            }else {
                // 得到文件的完整名称  xxx.txt
                String originalFilename = file.getOriginalFilename();
                InputStream inputStream = file.getInputStream();
                uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
            }
            return success("上传成功", uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("上传失败");
        }
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = "upload_stream_attachmentLimit")
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件限制格式")
    public ObjEnvelop<UploadVO> uploadAttachmentLimit(@ApiParam(value = "文件", required = true)
                                                 @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        UploadVO uploadVO = new UploadVO();
        // 得到文件的完整名称  xxx.txt
        String originalFilename = file.getOriginalFilename();
        //得到文件类型
        String fileName = originalFilename.substring(0, originalFilename.lastIndexOf("."));
        String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1).toLowerCase();
        if(StringUtils.isBlank(fileType)||!"doc、docx、pdf、xls、xlsx、ppt、pptx".contains(fileType)){
            return ObjEnvelop.getError("文件格式不支持");
                                                 @RequestParam(value = "file", required = true) MultipartFile file){
        try {
            UploadVO uploadVO = new UploadVO();
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            //得到文件类型
            String fileName = originalFilename.substring(0, originalFilename.lastIndexOf("."));
            String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1).toLowerCase();
            if(StringUtils.isBlank(fileType)||!"doc、docx、pdf、xls、xlsx、ppt、pptx".contains(fileType)){
                return ObjEnvelop.getError("文件格式不支持");
            }
            InputStream inputStream = file.getInputStream();
            ObjectNode objectNode = fastDFSHelper.upload(inputStream, fileType, "");
            //解析返回的objectNode
            uploadVO.setFileName(fileName);
            uploadVO.setFileType(fileType);
            uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
            uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
            return success("上传成功", uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("上传失败");
        }
        InputStream inputStream = file.getInputStream();
        ObjectNode objectNode = fastDFSHelper.upload(inputStream, fileType, "");
        //解析返回的objectNode
        uploadVO.setFileName(fileName);
        uploadVO.setFileType(fileType);
        uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
        uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_ATTACHMENT)
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
//        String originalFilename = file.getOriginalFilename();
//        InputStream inputStream = file.getInputStream();
//
//    UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
//        return success("上传成功", uploadVO);
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
        }else if(isClose.equals("2")){
            String originalFilename = file.getOriginalFilename();
            String[] fs = originalFilename.split("\\.");
            String type = fs[1];
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,type);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
                                       @RequestParam(value = "file", required = true) MultipartFile file){
        try {
            UploadVO uploadVO = new UploadVO();
            if (isClose.equalsIgnoreCase("1")){
                Map<String, Object> map = fileUploadService.uploadImg(file);
                uploadVO.setFullUri(map.get("accessory").toString());
            }else if(isClose.equals("2")){
                String originalFilename = file.getOriginalFilename();
                String[] fs = originalFilename.split("\\.");
                String type = fs[1];
                //内网上传
                String rs = fileUploadService.request(remote_inner_url,file,type);
                logger.info(rs);
                JSONObject json = JSON.parseObject(rs);
                uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else {
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
            }else {
                // 得到文件的完整名称  xxx.txt
                String originalFilename = file.getOriginalFilename();
                InputStream inputStream = file.getInputStream();
                uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
            }
            return success("上传成功", uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("上传失败");
        }
        return success("上传成功", uploadVO);
//        return uploadStream(file);
    }
//    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)
@ -169,9 +178,14 @@ public class FileUploadController extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STRING)
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
    public ObjEnvelop<UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流")
                                                 @RequestBody String jsonData) throws Exception {
        UploadVO uploadVO = fileUploadService.uploadImages(jsonData,fastdfs_file_url);
        return success("上传成功", uploadVO);
                                                 @RequestBody String jsonData){
        try {
            UploadVO uploadVO = fileUploadService.uploadImages(jsonData,fastdfs_file_url);
            return success("上传成功", uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("上传失败");
        }
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)
@ -179,8 +193,9 @@ public class FileUploadController extends EnvelopRestEndpoint {
    public ObjEnvelop<UploadVO> uploadStream(@ApiParam(value = "文件", required = true)
                                             @RequestParam(value = "file", required = true) MultipartFile file
            /*@ApiParam(value = "jsonData", required = true)
            @RequestBody MutilFileInfo param, HttpServletResponse response, HttpServletRequest request*/) throws Exception{
        UploadVO uploadVO = new UploadVO();
            @RequestBody MutilFileInfo param, HttpServletResponse response, HttpServletRequest request*/){
        try {
            UploadVO uploadVO = new UploadVO();
            if (isClose.equalsIgnoreCase("1")){
                Map<String, Object> map = fileUploadService.uploadImg(file);
                uploadVO.setFullUri(map.get("accessory").toString());
@ -202,14 +217,23 @@ public class FileUploadController extends EnvelopRestEndpoint {
                uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
            }
            return success("上传成功", uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("上传失败");
        }
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STRINGBASE64)
    @ApiOperation(value = "base64上传图片Xz",notes = "base64上传图片Xz")
    public ObjEnvelop<UploadVO> uploadBase64(@ApiParam(name = "jsonData", value = "头像转化后的输入流")
                                             @RequestBody String jsonData) throws Exception {
        UploadVO uploadVO = fileUploadService.uploadImagesBase64(jsonData,fastdfs_file_url);
        return success("上传成功", uploadVO);
        try {
            UploadVO uploadVO = fileUploadService.uploadImagesBase64(jsonData,fastdfs_file_url);
            return success("上传成功", uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("上传失败");
        }
    }
@ -230,57 +254,60 @@ public class FileUploadController extends EnvelopRestEndpoint {
                                                  @ApiParam(value = "objectType", required = false)
                                                  @RequestParam(value = "objectType", required = false) Integer objectType,
                                                  @ApiParam(value = "chunkSize", required = false)
                                                      @RequestParam(value = "chunkSize", required = false) Integer  chunkSize
    ) throws Exception{
        UploadVO uploadVO = new UploadVO();
        MutilFileInfo files = new MutilFileInfo();
        files.setChunk(chunk);
        files.setChunkTotal(chunkTotal);
        files.setFile(file);
        files.setObjectType(objectType);
        files.setSize(file.getSize());
        logger.info("file size"+file.getSize());
        files.setTaskId(taskId);
        String taskid = fileManageService.chunkUploadByMappedByteBuffer(files,chunkSize);
        logger.info("taskid"+taskid);
        if ("unCompelete".equalsIgnoreCase(taskid)){
            System.out.println("第"+files.getChunk());
            return success("未传完",uploadVO);
        }else {
                                                  @RequestParam(value = "chunkSize", required = false) Integer  chunkSize){
        try {
            UploadVO uploadVO = new UploadVO();
            MutilFileInfo files = new MutilFileInfo();
            files.setChunk(chunk);
            files.setChunkTotal(chunkTotal);
            files.setFile(file);
            files.setObjectType(objectType);
            files.setSize(file.getSize());
            logger.info("file size"+file.getSize());
            files.setTaskId(taskId);
            String taskid = fileManageService.chunkUploadByMappedByteBuffer(files,chunkSize);
            logger.info("taskid"+taskid);
            if ("unCompelete".equalsIgnoreCase(taskid)){
                System.out.println("第"+files.getChunk());
                return success("未传完",uploadVO);
            }else {
            File file1 = new File(taskid);
            logger.info("size:"+file1.getTotalSpace());
            FileInputStream input = new FileInputStream(file1);
            MultipartFile multipartFile = new MockMultipartFile("file", file1.getName(), "text/plain", IOUtils.toByteArray(input));
            if (isClose.equalsIgnoreCase("1")){
                Map<String, Object> map = fileUploadService.uploadImg(multipartFile);
                uploadVO.setFullUri(map.get("accessory").toString());
            }else if(isClose.equals("2")){
                String originalFilename = multipartFile.getOriginalFilename();
                String[] fs = originalFilename.split("\\.");
                String type = fs[1];
                //内网上传
                String rs = fileUploadService.request(remote_inner_url,multipartFile,type);
                logger.info(rs);
                JSONObject json = JSON.parseObject(rs);
                uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
                File file1 = new File(taskid);
                logger.info("size:"+file1.getTotalSpace());
                FileInputStream input = new FileInputStream(file1);
                MultipartFile multipartFile = new MockMultipartFile("file", file1.getName(), "text/plain", IOUtils.toByteArray(input));
                if (isClose.equalsIgnoreCase("1")){
                    Map<String, Object> map = fileUploadService.uploadImg(multipartFile);
                    uploadVO.setFullUri(map.get("accessory").toString());
                }else if(isClose.equals("2")){
                    String originalFilename = multipartFile.getOriginalFilename();
                    String[] fs = originalFilename.split("\\.");
                    String type = fs[1];
                    //内网上传
                    String rs = fileUploadService.request(remote_inner_url,multipartFile,type);
                    logger.info(rs);
                    JSONObject json = JSON.parseObject(rs);
                    uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
            }else {
                // 得到文件的完整名称  xxx.txt
                String originalFilename = multipartFile.getOriginalFilename();
                }else {
                    // 得到文件的完整名称  xxx.txt
                    String originalFilename = multipartFile.getOriginalFilename();
                //判断文件名称是否有包含后缀,及前端是否有传后缀名称,有的话拼接图片后缀
                if(originalFilename.lastIndexOf(".") == 0 && StringUtils.isNotEmpty(filename)){
                    originalFilename = originalFilename +"."+filename;
                }
                    //判断文件名称是否有包含后缀,及前端是否有传后缀名称,有的话拼接图片后缀
                    if(originalFilename.lastIndexOf(".") == 0 && StringUtils.isNotEmpty(filename)){
                        originalFilename = originalFilename +"."+filename;
                    }
                InputStream inputStream = multipartFile.getInputStream();
                uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
                file1.delete();
                    InputStream inputStream = multipartFile.getInputStream();
                    uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
                    file1.delete();
                }
                return success("上传成功", uploadVO);
            }
            return success("上传成功", uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("上传失败");
        }
    }
}

+ 201 - 142
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/MenuEndpoint.java

@ -48,13 +48,18 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop<MenuVO> create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        MenuDO menuDO = toEntity(jsonData, MenuDO.class);
        int count = menuService.isExistName(menuDO.getName());
        if(count>0){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Menu.NAME_IS_EXIST), ObjEnvelop.class);
        try {
            MenuDO menuDO = toEntity(jsonData, MenuDO.class);
            int count = menuService.isExistName(menuDO.getName());
            if(count>0){
                return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Menu.NAME_IS_EXIST), ObjEnvelop.class);
            }
            menuDO = menuService.addMenu(menuDO);
            return success(menuDO, MenuVO.class);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("操作失败");
        }
        menuDO = menuService.addMenu(menuDO);
        return success(menuDO, MenuVO.class);
    }
    @PostMapping(value = BaseRequestMapping.Menu.MOVE_DOWN)
@ -62,8 +67,13 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
    public Envelop moveDown(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        menuService.moveDown(id);
        return success("修改成功");
        try {
            menuService.moveDown(id);
            return success("修改成功");
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("操作失败");
        }
    }
    @PostMapping(value = BaseRequestMapping.Menu.MOVE_UP)
@ -71,8 +81,13 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
    public Envelop moveUp(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        menuService.moveUp(id);
        return success("修改成功");
        try {
            menuService.moveUp(id);
            return success("修改成功");
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("操作失败");
        }
    }
    @PostMapping(value = BaseRequestMapping.Menu.STATUS)
@ -82,8 +97,13 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "id") String id,
            @ApiParam(name = "status", value = "1生效,0失效", required = true)
            @RequestParam(value = "status") Integer status) {
        menuService.updateStatus(id, status);
        return success("修改成功");
        try {
            menuService.updateStatus(id, status);
            return success("修改成功");
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("操作失败");
        }
    }
    @GetMapping(value = BaseRequestMapping.Menu.IS_NAME_EXIST)
@ -91,24 +111,34 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop isNameExist(
            @ApiParam(name = "name", value = "菜单名称", required = true)
            @RequestParam(value = "name") String name) {
        return success(menuService.isExistName(name));
        try {
            return success(menuService.isExistName(name));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("操作失败");
        }
    }
    @PostMapping(value = BaseRequestMapping.Menu.UPDATE)
    @ApiOperation(value = "更新")
    public Envelop update (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) throws Exception {
        MenuDO menuDO = toEntity(jsonData, MenuDO.class);
        if (null == menuDO.getId()) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Common.ID_IS_NULL), Envelop.class);
        }
        int count = menuService.isExistName(menuDO.getName());
        if(count>1){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Menu.NAME_IS_EXIST), ObjEnvelop.class);
            @RequestParam String jsonData){
        try {
            MenuDO menuDO = toEntity(jsonData, MenuDO.class);
            if (null == menuDO.getId()) {
                return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Common.ID_IS_NULL), Envelop.class);
            }
            int count = menuService.isExistName(menuDO.getName());
            if(count>1){
                return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Menu.NAME_IS_EXIST), ObjEnvelop.class);
            }
            menuDO = menuService.updateMenu(menuDO);
            return success(menuDO);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("操作失败");
        }
        menuDO = menuService.updateMenu(menuDO);
        return success(menuDO);
    }
    @GetMapping(value = BaseRequestMapping.Menu.PAGE)
@ -123,31 +153,41 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<MenuDO> menuDOS = menuService.search(fields, filters, sorts, page, size);
        int count = (int)menuService.getCount(filters);
        return success(menuDOS, count, page, size, MenuVO.class);
            @RequestParam(value = "size") int size){
        try {
            List<MenuDO> menuDOS = menuService.search(fields, filters, sorts, page, size);
            int count = (int)menuService.getCount(filters);
            return success(menuDOS, count, page, size, MenuVO.class);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("获取失败");
        }
    }
    @GetMapping(value = BaseRequestMapping.Menu.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<MenuVO> list (
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = false) String id) throws Exception {
        String filters = "";
        if(StringUtils.isNotBlank(id)){
            filters = "parentId="+id+";";
        }
        List<MenuDO> menuDOS = menuService.search(null, filters, "+sort");
        MenuDO menuDO = menuService.findOne(id);
        menuDOS.forEach(menu -> {
            if(CommonContant.DEFAULT_PARENTID.equals(menu.getParentId())){
                menu.setParentName(CommonContant.DEFAULT_PARENTNAME);
            }else {
                menu.setParentName(menuDO.getName());
            @RequestParam(value = "id", required = false) String id){
        try {
            String filters = "";
            if(StringUtils.isNotBlank(id)){
                filters = "parentId="+id+";";
            }
        });
        return success(menuDOS, MenuVO.class);
            List<MenuDO> menuDOS = menuService.search(null, filters, "+sort");
            MenuDO menuDO = menuService.findOne(id);
            menuDOS.forEach(menu -> {
                if(CommonContant.DEFAULT_PARENTID.equals(menu.getParentId())){
                    menu.setParentName(CommonContant.DEFAULT_PARENTNAME);
                }else {
                    menu.setParentName(menuDO.getName());
                }
            });
            return success(menuDOS, MenuVO.class);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("获取失败");
        }
    }
    @GetMapping(value = BaseRequestMapping.Menu.FIND_ALL)
@ -156,59 +196,69 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = false) String status,
            @ApiParam(name = "name", value = "名称")
            @RequestParam(value = "name", required = false) String name) throws Exception {
        String filters = "";
        if(StringUtils.isNotBlank(status)){
            filters = "status="+status+";";
        }
        if(StringUtils.isNotBlank(name)){
            filters += "name?"+name+";";
        }
        List<MenuDO> menuDOs = menuService.search(null, filters, "+sort");
        List<MenuVO> menuVOs = convertToModels(menuDOs,new ArrayList<>(menuDOs.size()), MenuVO.class);
        menuVOs.forEach(menuVO -> {
            if(CommonContant.DEFAULT_PARENTID.equals(menuVO.getParentId())){
                menuVO.setParentName(CommonContant.DEFAULT_PARENTNAME);
            }else {
                MenuDO menuDO = menuService.findOne(menuVO.getParentId());
                menuVO.setParentName(menuDO.getName());
            @RequestParam(value = "name", required = false) String name){
        try {
            String filters = "";
            if(StringUtils.isNotBlank(status)){
                filters = "status="+status+";";
            }
        });
        Map<String,List<MenuVO>> map = menuVOs.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
        menuVOs.forEach(menu->{
            List<MenuVO> tmp = map.get(menu.getId());
            menu.setChildren(tmp);
        });
        if(StringUtils.isBlank(name)){
            menuVOs = menuVOs.stream()
                    .filter(menu -> CommonContant.DEFAULT_PARENTID.equals(menu.getParentId()))
                    .collect(Collectors.toList());
            if(StringUtils.isNotBlank(name)){
                filters += "name?"+name+";";
            }
            List<MenuDO> menuDOs = menuService.search(null, filters, "+sort");
            List<MenuVO> menuVOs = convertToModels(menuDOs,new ArrayList<>(menuDOs.size()), MenuVO.class);
            menuVOs.forEach(menuVO -> {
                if(CommonContant.DEFAULT_PARENTID.equals(menuVO.getParentId())){
                    menuVO.setParentName(CommonContant.DEFAULT_PARENTNAME);
                }else {
                    MenuDO menuDO = menuService.findOne(menuVO.getParentId());
                    menuVO.setParentName(menuDO.getName());
                }
            });
            Map<String,List<MenuVO>> map = menuVOs.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
            menuVOs.forEach(menu->{
                List<MenuVO> tmp = map.get(menu.getId());
                menu.setChildren(tmp);
            });
            if(StringUtils.isBlank(name)){
                menuVOs = menuVOs.stream()
                        .filter(menu -> CommonContant.DEFAULT_PARENTID.equals(menu.getParentId()))
                        .collect(Collectors.toList());
            }
            return success(menuVOs);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("获取失败");
        }
        return success(menuVOs);
    }
    @GetMapping(value = BaseRequestMapping.Menu.GET_TREE)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<MenuVO> getTree (
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = false) String status) throws Exception {
        String filters = null;
        if(StringUtils.isNotBlank(status)){
            filters = "status="+status;
        }
        List<MenuDO> menuDOs = menuService.search(null, filters, null);
        List<MenuVO> menuVOs = convertToModels(menuDOs,new ArrayList<>(menuDOs.size()),MenuVO.class);
        Map<String,List<MenuVO>> map = menuVOs.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
        menuVOs.forEach(menu->{
            List<MenuVO> tmp = map.get(menu.getId());
            menu.setChildren(tmp);
        });
        menuVOs = menuVOs.stream()
                .filter(menu -> CommonContant.DEFAULT_PARENTID.equals(menu.getParentId()))
                .collect(Collectors.toList());
            @RequestParam(value = "status", required = false) String status) {
        try {
            String filters = null;
            if(StringUtils.isNotBlank(status)){
                filters = "status="+status;
            }
            List<MenuDO> menuDOs = menuService.search(null, filters, null);
            List<MenuVO> menuVOs = convertToModels(menuDOs,new ArrayList<>(menuDOs.size()),MenuVO.class);
            Map<String,List<MenuVO>> map = menuVOs.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
            menuVOs.forEach(menu->{
                List<MenuVO> tmp = map.get(menu.getId());
                menu.setChildren(tmp);
            });
            menuVOs = menuVOs.stream()
                    .filter(menu -> CommonContant.DEFAULT_PARENTID.equals(menu.getParentId()))
                    .collect(Collectors.toList());
        return success(menuVOs);
            return success(menuVOs);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("获取失败");
        }
    }
@ -220,48 +270,53 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "name", value = "名称")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "roleId", value = "角色id")
            @RequestParam(value = "roleId", required = false)String roleId) throws Exception {
        String filters = "";
        if(StringUtils.isNotBlank(status)){
            filters = "status="+status+";";
        }
        if(StringUtils.isNotBlank(name)){
            filters += "name?"+name+";";
        }
        //获取所有选择树
        List<RoleMenuDO> roleMenus = roleMenuService.findRoleMenu(roleId);
        List<MenuDO> menuDOs = menuService.search(null, filters, "+sort");
        List<MenuVO> menuVOs = convertToModels(menuDOs,new ArrayList<>(menuDOs.size()), MenuVO.class);
        menuVOs.forEach(menuVO -> {
            if(CommonContant.DEFAULT_PARENTID.equals(menuVO.getParentId())){
                menuVO.setParentName(CommonContant.DEFAULT_PARENTNAME);
            }else {
                MenuDO menuDO = menuService.findOne(menuVO.getParentId());
                menuVO.setParentName(menuDO.getName());
            @RequestParam(value = "roleId", required = false)String roleId){
        try {
            String filters = "";
            if(StringUtils.isNotBlank(status)){
                filters = "status="+status+";";
            }
            //对比树是否被选择
            if(checkedTree(menuVO.getId(),roleMenus)){
                menuVO.setChecked(true);
            }else{
                menuVO.setChecked(false);
            if(StringUtils.isNotBlank(name)){
                filters += "name?"+name+";";
            }
        });
        Map<String,List<MenuVO>> map = menuVOs.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
        menuVOs.forEach(menu->{
            List<MenuVO> tmp = map.get(menu.getId());
            menu.setChildren(tmp);
        });
        if(StringUtils.isBlank(name)){
            menuVOs = menuVOs.stream()
                    .filter(menu -> CommonContant.DEFAULT_PARENTID.equals(menu.getParentId()))
                    .collect(Collectors.toList());
            //获取所有选择树
            List<RoleMenuDO> roleMenus = roleMenuService.findRoleMenu(roleId);
            List<MenuDO> menuDOs = menuService.search(null, filters, "+sort");
            List<MenuVO> menuVOs = convertToModels(menuDOs,new ArrayList<>(menuDOs.size()), MenuVO.class);
            menuVOs.forEach(menuVO -> {
                if(CommonContant.DEFAULT_PARENTID.equals(menuVO.getParentId())){
                    menuVO.setParentName(CommonContant.DEFAULT_PARENTNAME);
                }else {
                    MenuDO menuDO = menuService.findOne(menuVO.getParentId());
                    menuVO.setParentName(menuDO.getName());
                }
                //对比树是否被选择
                if(checkedTree(menuVO.getId(),roleMenus)){
                    menuVO.setChecked(true);
                }else{
                    menuVO.setChecked(false);
                }
            });
            Map<String,List<MenuVO>> map = menuVOs.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
            menuVOs.forEach(menu->{
                List<MenuVO> tmp = map.get(menu.getId());
                menu.setChildren(tmp);
            });
            if(StringUtils.isBlank(name)){
                menuVOs = menuVOs.stream()
                        .filter(menu -> CommonContant.DEFAULT_PARENTID.equals(menu.getParentId()))
                        .collect(Collectors.toList());
            }
            return success(menuVOs);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("获取失败");
        }
        return success(menuVOs);
    }
    /**
@ -286,28 +341,32 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取角色登录菜单")
    public ListEnvelop<MenuVO> findLoginRoleMenuTree (
            @ApiParam(name = "roleId", value = "角色id")
            @RequestParam(value = "roleId", required = false)String roleId) throws Exception {
        List<MenuVO> menuVOs = roleMenuService.findMenuByRoleId(roleId);
        menuVOs.forEach(menuVO -> {
            if(CommonContant.DEFAULT_PARENTID.equals(menuVO.getParentId())){
                menuVO.setParentName(CommonContant.DEFAULT_PARENTNAME);
            }else {
                MenuDO menuDO = menuService.findOne(menuVO.getParentId());
                menuVO.setParentName(menuDO.getName());
            }
        });
            @RequestParam(value = "roleId", required = false)String roleId){
        try {
            List<MenuVO> menuVOs = roleMenuService.findMenuByRoleId(roleId);
            menuVOs.forEach(menuVO -> {
                if(CommonContant.DEFAULT_PARENTID.equals(menuVO.getParentId())){
                    menuVO.setParentName(CommonContant.DEFAULT_PARENTNAME);
                }else {
                    MenuDO menuDO = menuService.findOne(menuVO.getParentId());
                    menuVO.setParentName(menuDO.getName());
                }
            });
        Map<String,List<MenuVO>> map = menuVOs.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
            Map<String,List<MenuVO>> map = menuVOs.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
        menuVOs.forEach(menu->{
            List<MenuVO> tmp = map.get(menu.getId());
            menu.setChildren(tmp);
        });
        menuVOs = menuVOs.stream()
                .filter(menu -> CommonContant.DEFAULT_PARENTID.equals(menu.getParentId()))
                .collect(Collectors.toList());
            menuVOs.forEach(menu->{
                List<MenuVO> tmp = map.get(menu.getId());
                menu.setChildren(tmp);
            });
            menuVOs = menuVOs.stream()
                    .filter(menu -> CommonContant.DEFAULT_PARENTID.equals(menu.getParentId()))
                    .collect(Collectors.toList());
        return success(menuVOs);
            return success(menuVOs);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("获取失败");
        }
    }
}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 147 - 68
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/user/UserEndpoint.java


+ 71 - 24
svr/svr-base/src/main/java/com/yihu/jw/base/service/ManageMessagePush/ManageSystemPushMessageService.java

@ -1,6 +1,8 @@
package com.yihu.jw.base.service.ManageMessagePush;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.base.dao.log.BasePushRecordLogDao;
import com.yihu.jw.base.dao.log.BasePushrecordLogInfoDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
@ -9,6 +11,7 @@ import com.yihu.jw.entity.log.BasePushRecordLogEntity;
import com.yihu.jw.entity.log.BasePushrecordLogInfoEntity;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,6 +27,7 @@ import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * Created by wsl on 2022/7/4
 */
@ -43,11 +47,14 @@ public class ManageSystemPushMessageService {
    private WlyyHospitalSysDictDao dictDao;
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private ImUtil imUtil;
    /*   SELECT p.id,p.name  FROM base_patient p INNER JOIN wlyy_patient_device d ON p.id = d.`user`
    WHERE p.sign_status = 0 AND p.del = 1 AND d.del = 0 AND p.id NOT IN ( SELECT dict_code FROM `base`.`wlyy_hospital_sys_dict` WHERE `dict_name` = 'jkzl_older' OR dict_name = 'jkzl_child' )*/
    /**
     * 获取签约老人
     * @param name
@ -76,12 +83,19 @@ public class ManageSystemPushMessageService {
     * @param pushDate
     */
    @Transactional(rollbackFor = Exception.class)
    public void addPushMessage(String content, Integer pushObjectType, String pushObjectJson, Integer pushDateType, String pushDate) {
    public void addPushMessage(String content, Integer pushObjectType, String pushObjectJson, Integer pushDateType, String pushDate,Integer addType,String pushId) {
        BasePushRecordLogEntity basePushRecordLogEntity = new BasePushRecordLogEntity();
        List<BasePatientDO> basePatientDOS = null;
        List<BasePushrecordLogInfoEntity> basePushrecordLogInfoEntityList = new ArrayList<>();
        Date date =DateUtil.strToDate(pushDate);
        if (null!=addType&&addType==2) {
            BasePushRecordLogEntity one = basePushRecordLogDao.findOne(pushId);
            if (one.getStatus()!=1) {
                basePushRecordLogDao.delete(pushId);
                basePushrecordLogInfoDao.deleteByPushId(pushId);
            }
        }
        //判断发送对象类型  1签约老人  2 部分签约老人
        if (1 == pushObjectType) {
@ -95,30 +109,34 @@ public class ManageSystemPushMessageService {
            basePushRecordLogEntity.setSendObject(s);
        }
        Integer status ;
        //判断 1立即发送   2定时发送
        if (1==pushDateType) {
            SystemMessageDOListSave(basePatientDOS,content);
            basePushRecordLogEntity.setStatus(1);
            basePushRecordLogEntity.setSendTime(new Date());
            basePushRecordLogEntity.setPushType("1");
        }else {
            //创建定时任务记录
            basePatientDOS.forEach(logInfoDO->{
                String data = content;
                if (StringUtils.containsIgnoreCase(content,"【姓名】"))data.replace("【姓名】",logInfoDO.getName());
                if (StringUtils.containsIgnoreCase(content,"【称谓】"))data.replace("【称谓】",logInfoDO.getSex()==1?"大爷":"大妈");
                BasePushrecordLogInfoEntity basePushrecordLogInfoEntity = new BasePushrecordLogInfoEntity();
                basePushrecordLogInfoEntity.setPatient(logInfoDO.getId());
                basePushrecordLogInfoEntity.setContent(data);
                basePushrecordLogInfoEntity.setStatus(0);
                basePushrecordLogInfoEntity.setSendTime(date);
                basePushrecordLogInfoEntityList.add(basePushrecordLogInfoEntity);
            });
            status = 1;
        }else{
            basePushRecordLogEntity.setSendTime(date);
            basePushRecordLogEntity.setStatus(0);
            basePushRecordLogEntity.setPushType("2");
            status = 0;
        }
        //创建定时任务记录
        for (BasePatientDO logInfoDO : basePatientDOS) {
            String data = content;
            if (StringUtils.containsIgnoreCase(content,"【姓名】"))data = data.replace("【姓名】",logInfoDO.getName());
            if (StringUtils.containsIgnoreCase(content,"【称谓】"))data = data.replace("【称谓】",logInfoDO.getSex()==1?"大爷":"大妈");
            BasePushrecordLogInfoEntity basePushrecordLogInfoEntity = new BasePushrecordLogInfoEntity();
            basePushrecordLogInfoEntity.setPatient(logInfoDO.getId());
            basePushrecordLogInfoEntity.setPatientName(logInfoDO.getName());
            basePushrecordLogInfoEntity.setContent(data);
            basePushrecordLogInfoEntity.setStatus(status);
            basePushrecordLogInfoEntity.setSendTime(date);
            basePushrecordLogInfoEntityList.add(basePushrecordLogInfoEntity);
        }
        //日志保存
@ -132,14 +150,15 @@ public class ManageSystemPushMessageService {
        if (null!=basePushrecordLogInfoEntityList&&basePushrecordLogInfoEntityList.size()>0) {
            basePushrecordLogInfoEntityList.forEach(basePushLogInfoEntity -> basePushLogInfoEntity.setPushId(basePushRecordLogEntity.getId()));
            basePushrecordLogInfoDao.save(basePushrecordLogInfoEntityList);
        }
    }
    //获取列表
    public List<BasePushRecordLogEntity> pushMessageList(Integer messageType,Integer status,String name,Integer page,Integer pageSize){
    public JSONObject pushMessageList(Integer messageType,Integer status,String name,Integer page,Integer pageSize){
        JSONObject result = new JSONObject();
        if(page==null){
            page = 1;
@ -149,23 +168,37 @@ public class ManageSystemPushMessageService {
        }
        String sql = "SELECT * FROM base_pushrecord_log where 1=1 ";
        String countSql = "Select  count(id) from base_pushrecord_log where 1=1 ";
        String filite = " ";
        if(null!=messageType){
            sql +=" and message_type ='"+messageType+"' ";
            filite +=" and message_type ='"+messageType+"' ";
        }
        if (null!=status) {
            sql +=" and status = '"+status+"'";
            filite +=" and status = '"+status+"'";
        }
        if (StringUtils.isNotBlank(name)){
            sql +=" and  send_object like '%"+name+"%'";
            filite +=" and  send_object like '%"+name+"%'";
        }
        sql += " ORDER BY send_time DESC  LIMIT  " + (page - 1) * pageSize + "," + pageSize + "";
        List<BasePushRecordLogEntity> entityList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BasePushRecordLogEntity.class));
        return entityList;
        List<BasePushRecordLogEntity> entityList = jdbcTemplate.query(sql + filite, new BeanPropertyRowMapper<>(BasePushRecordLogEntity.class));
        result.put("obj",entityList);
        Integer count = jdbcTemplate.queryForObject(countSql + filite, Integer.class);
        result.put("count",count);
        if (entityList.size()>0) {
            for (BasePushRecordLogEntity logEntity : entityList) {
                String patientListSql = "select patient from base_pushrecord_log_info where push_id = '"+logEntity.getId()+"'";
                List<String> list = jdbcTemplate.queryForList(patientListSql, String.class);
                logEntity.setPatientList(list);
            }
        }
        return result;
    }
@ -195,11 +228,12 @@ public class ManageSystemPushMessageService {
            systemMessageDO.setOver("1");
            systemMessageDO.setDel("1");
            systemMessageDO.setCreateTime(new Date());
            systemMessageDO.setAudioUrl(audioUrl(content));
            systemMessageDO.setAudioUrl(audioUrl(data));
            messageDOS.add(systemMessageDO);
            patientMessageSocket(systemMessageDO);
        }
        systemMessageDao.save(messageDOS);
    }
@ -222,6 +256,7 @@ public class ManageSystemPushMessageService {
    }
    //腾讯语音
    private String audioUrl(String content){
        ResponseEntity<String> forEntity = restTemplate.getForEntity("http://svr-cloud-care/common/open/wordToVoice?text={1}", String.class, content);
        JSONObject jsonObject = JSONObject.parseObject(forEntity.getBody());
@ -233,6 +268,18 @@ public class ManageSystemPushMessageService {
    }
    //SOCKET
    private void patientMessageSocket(SystemMessageDO messageDOWatch){
        JSONObject message = new JSONObject();
        message.put("title",messageDOWatch.getTitle());
        message.put("type",messageDOWatch.getType());
        message.put("content",messageDOWatch.getContent());
        message.put("audioUrl",messageDOWatch.getAudioUrl());
        message.put("content_type",999);
        imUtil.sendPatientSystemMessage(messageDOWatch.getReceiver(), JSON.toJSONString(message, SerializerFeature.WriteMapNullValue));
    }

+ 90 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/child/ChildManageService.java

@ -0,0 +1,90 @@
package com.yihu.jw.base.service.child;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.dao.childManage.BaseChildManageDao;
import com.yihu.jw.entity.child.BaseChildManage;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by wsl on 2022/7/20
 */
@Service
public class ChildManageService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseChildManageDao baseChildManageDao;
    //获取
    public JSONObject getChildManageList(Integer type,Integer page,Integer pageSize,String title,String orgCode,String id){
        JSONObject jsonObject = new JSONObject();
        String sql = "select * from base_child_manage where  1=1 and type = "+type+" ";
        String totalSql = "select count(id) total from base_child_manage where 1=1 and type = "+type+" ";
        String commonSql = "";
        if(page==null){
            page = 1;
        }
        if(pageSize==null){
            pageSize = 10;
        }
        if (StringUtils.isNotBlank(id)) {
            commonSql += "and id = '"+id+"' ";
        }
        if (StringUtils.isNotBlank(title)){
            commonSql += " and title like '%"+title+"%' ";
        }
        if (StringUtils.isNotBlank(orgCode)){
            commonSql +=  " and org = '"+orgCode+"' ";
        }
        commonSql +=  "ORDER BY create_time DESC LIMIT  " + (page - 1) * pageSize + "," + pageSize + "";
        List<BaseChildManage> baseChildManage = jdbcTemplate.query(sql+commonSql, new BeanPropertyRowMapper<>(BaseChildManage.class));
        Integer total = jdbcTemplate.queryForObject(totalSql + commonSql, Integer.class);
        jsonObject.put("obj",baseChildManage);
        jsonObject.put("total",total);
        return jsonObject;
    }
    //新增修改
    @Transactional(rollbackFor = Exception.class)
    public void saveOrUpdate(String jsonData){
        BaseChildManage baseChildManage = JSONObject.parseObject(jsonData, BaseChildManage.class);
        if (baseChildManage.getCreateTime()==null) {
            baseChildManage.setCreateTime(new Date());
        }
        baseChildManageDao.save(baseChildManage);
    }
    //删除信息
    @Transactional(rollbackFor = Exception.class)
    public void deletinfo(String id){
        baseChildManageDao.delete(id);
    }
    public List<Map<String, Object>> childOrgList(){
        String sql = "SELECT code,name  FROM base_org WHERE type = '4' AND del = 1";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
}

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/lifeCare/LifeCareService.java

@ -36,7 +36,7 @@ public class LifeCareService {
                ",GROUP_CONCAT( DISTINCT dict.org_name SEPARATOR ',' ) AS orgName FROM " +
                "base_life_care_item_dict dict INNER JOIN base_org org ON dict.org_code = org.CODE WHERE  org.del = 1" ;
        String sqlCount = " select count(dict.id) from base_life_care_item_dict dict INNER JOIN base_org org on dict.org_code = org.code  where  org.del=1  ";
        String sqlCount = " select count(dict.id) AS size  from base_life_care_item_dict dict INNER JOIN base_org org on dict.org_code = org.code  where  org.del=1  GROUP BY dict.`code`  ";
        String filter = " ";
        if (StringUtils.isNotBlank(orgName)){
            filter +=" and org.name like '%"+orgName+"%' ";
@ -44,7 +44,7 @@ public class LifeCareService {
        if (StringUtils.isNotBlank(itemName)){
            filter +=" and dict.name like '%"+itemName+"%' ";
        }
        Long count = jdbcTemplate.queryForObject(sqlCount+filter,Long.class);
        List<Map<String, Object>> conuntList = jdbcTemplate.queryForList(sqlCount + filter);
        filter +=" GROUP BY dict.`code` ";
@ -53,7 +53,7 @@ public class LifeCareService {
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filter);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
        return PageEnvelop.getSuccessListWithPage("success",list,page,size,Long.parseLong(conuntList.size()+""));
    }
    @Transactional(rollbackFor = Exception.class)

+ 6 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/video/BaseVideoGroupService.java

@ -83,6 +83,11 @@ public class BaseVideoGroupService extends BaseJpaService<BaseVideoGroupDO, Base
     * @return
     */
    public Envelop deleteVideoGroup(Long id){
        String sql = "SELECT count(v.id) count FROM base_video v INNER JOIN base_video_group g ON v.type = g.id WHERE g.id = '"+id+"' ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        if (Integer.parseInt(list.get(0).get("count").toString())>0){
        return Envelop.getError("该栏目下面存在视频,请勿删除!",500);
        }
        BaseVideoGroupDO byId = videoGroupDao.findById(id);
        if(byId != null){
            videoGroupDao.delete(byId);
@ -112,7 +117,7 @@ public class BaseVideoGroupService extends BaseJpaService<BaseVideoGroupDO, Base
            fromSql += " and v.type = "+type;
        }
        Long count = jdbcTemplate.queryForObject(countSql + fromSql, Long.class);
        fromSql += " order by v.sort_num desc limit "+page*pageSize+","+pageSize;
        fromSql += " order by v.sort_num,v.create_time desc limit "+page*pageSize+","+pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(colSql + fromSql);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,pageSize,count);
    }

+ 7 - 3
svr/svr-base/src/main/resources/application.yml

@ -189,6 +189,7 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
  data_base_name: 1
---
spring:
  profiles: iottest
@ -325,6 +326,7 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
---
spring:
  profiles: jwOracleTest
@ -375,6 +377,7 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
---
spring:
  profiles: jwOracleProd
@ -424,6 +427,7 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
  data_base_name: im_internet_hospital
---
spring:
  profiles: iotprod
@ -453,7 +457,7 @@ spring:
fast-dfs:
  tracker-server: 10.90.32.3:20003 #服务器地址
fastDFS:
  fastdfs_file_url: http://www.xmtyw.cn/
  fastdfs_file_url: https://www.xmtyw.cn/
demo:
  flag: true
hospital:
@ -463,7 +467,7 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://www.xmtyw.cn/wlyy/
  url: https://www.xmtyw.cn/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
  flag: false
@ -702,7 +706,7 @@ testPattern:
  remote_inner_url: 1
im:
  im_list_get: http://10.18.43.41:3000/
  data_base_name: im_internet_hospital
---
spring:
  profiles: wjwProd

+ 19 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/child/BaseChildManageDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.care.dao.child;
import com.yihu.jw.entity.child.BaseChildManage;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wsl on 2022/7/20
 */
public interface BaseChildManageDao extends PagingAndSortingRepository<BaseChildManage,String>, JpaSpecificationExecutor<BaseChildManage> {
    @Modifying
    @Query("update BaseChildManage m set m.click = m.click+1 where m.id = ?1")
    void updateClick(String id);
}

+ 16 - 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.HongLingJinUtil;
import com.yihu.jw.care.util.SpeechTtsUtil;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
@ -58,6 +59,21 @@ public class CommonEndpoint extends EnvelopRestEndpoint {
    private DevicePatientFaceService patientFaceService;
    @Autowired
    private SpeechTtsUtil speechTtsUtil;
    @Autowired
    private HongLingJinUtil hongLingJinUtil;
    @GetMapping(value = "open/getToken")
    @ApiOperation(value = "文字转语音")
    public Envelop getToken() {
        try {
            hongLingJinUtil.getToken();
            return ObjEnvelop.getSuccess("success");
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @GetMapping(value = "open/wordToVoice")
    @ApiOperation(value = "文字转语音")

+ 47 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/child/ChildManageController.java

@ -0,0 +1,47 @@
package com.yihu.jw.care.endpoint.child;
import com.yihu.jw.care.service.child.ChildNewsListService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
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.*;
/**
 * Created by wsl on 2022/7/20
 */
@RestController
@RequestMapping("/ChildManageController")
@Api(description = "幼儿端接口")
public class ChildManageController extends EnvelopRestEndpoint {
    @Autowired
    private ChildNewsListService childNewsListService;
    @ApiOperation(value = "获取列表")
    @PostMapping("/getChildManageList")
    public ObjEnvelop getChildManageList(@ApiParam(name = "type" ,value = "类型 1图文辅导,2视频辅导,3喜讯详细",required = true)
                                         @RequestParam(value = "type",required = true)Integer type,
                                         @ApiParam(name = "id" ,value = "id",required = false)
                                         @RequestParam(value = "id",required = false)String id,
                                         @RequestParam(value = "page",required = false)Integer page,
                                         @RequestParam(value = "pageSize",required = false)Integer pageSize){
        try {
            return success(childNewsListService.getChildManageList(type,page,pageSize,id));
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("获取失败");
        }
    }
}

+ 18 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorBirthdayWishesEndpoint.java

@ -8,6 +8,7 @@ import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.birthday.BirthdayWishesService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.care.util.SpeechTtsUtil;
import com.yihu.jw.entity.care.birthday.BirthDayWishesToPatient;
import com.yihu.jw.entity.care.birthday.BirthdayWishesTemplate;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
@ -255,17 +256,27 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                json.put("content", content);
                json.put("isSave", 0);
            }
            String sql = "select py_code from wlyy_hospital_sys_dict where dict_name = 'pushOnOff' and dict_code = '1' ";
            String flagString = jdbcTemplate.queryForObject(sql, String.class);
            Boolean flage = Boolean.parseBoolean(flagString);
            List<BirthDayWishesToPatient> birthDayWishesToPatientESList = birthdayWishesService.saveBirthdayWishesES(json);
            new Thread(() -> {
                sender(birthDayWishesToPatientESList);
            }).start();
            savePushLog(patient);
            if (flage){
                new Thread(() -> {
                    sender(birthDayWishesToPatientESList);
                }).start();
                savePushLog(patient);
            }
            return write(200, "发送成功!");
        } catch (Exception e) {
            return errorResult(e);
        }
    }
    @Autowired
    private SpeechTtsUtil speechTtsUtil;
    /**
     * 发送消息
     *
@ -305,7 +316,8 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                    }
                    if (success||demoFlag){
                        SystemMessageDO messageDO = new SystemMessageDO();
                        messageDO.setTitle("收到来自"+one.getDoctorName()+"的关怀祝福:祝您"+tmp.get("name").toString()+"节日快乐!");
                        String title = "收到来自"+one.getDoctorName()+"的关怀祝福:祝您"+tmp.get("name").toString()+"节日快乐!";
                        messageDO.setTitle(title);
                        messageDO.setType("41");//41人文关怀
                        messageDO.setSender(one.getDoctorCode());
                        messageDO.setSenderName(one.getDoctorName());
@ -317,6 +329,7 @@ public class DoctorBirthdayWishesEndpoint extends BaseController {
                        messageDO.setData(one.getContent());
                        messageDO.setDel("1");
                        messageDO.setCreateTime(new Date());
                        messageDO.setAudioUrl(speechTtsUtil.wordToVoice(title));
                        systemMessageDao.save(messageDO);
                        //推送socket
                        com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();

+ 19 - 13
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorEndpoint.java

@ -57,22 +57,28 @@ public class DoctorEndpoint extends EnvelopRestEndpoint {
    public Envelop dingtalk_app_user(@ApiParam(name = "authCode", value = "钉钉授权code", required = true)
                                     @RequestParam(value = "authCode",required = true) String authCode){
        try {
            JSONObject jsonObject = dingdingUtil.dingtalk_app_user(authCode);
            if(jsonObject.getBoolean("success")){
                JSONObject content = jsonObject.getJSONObject("content");
                if(content.getBoolean("success")){
                    long accountId = content.getJSONObject("data").getLong("accountId");
                    BaseDoctorDO doctorDO = doctorDao.findByYktDoctorId(accountId+"");
                    if(doctorDO == null){
                        return Envelop.getError("暂无该账号,请联系云照护工作人员配置");
            //红领巾平台和这个类似直接传浙政钉id
            BaseDoctorDO doctorDO = doctorDao.findByYktDoctorId(authCode);
            if(doctorDO!=null){
                return success(doctorDO.getMobile());
            }else {
                JSONObject jsonObject = dingdingUtil.dingtalk_app_user(authCode);
                if(jsonObject.getBoolean("success")){
                    JSONObject content = jsonObject.getJSONObject("content");
                    if(content.getBoolean("success")){
                        long accountId = content.getJSONObject("data").getLong("accountId");
                        doctorDO = doctorDao.findByYktDoctorId(accountId+"");
                        if(doctorDO == null){
                            return Envelop.getError("暂无该账号,请联系云照护工作人员配置");
                        }else{
                            return success(doctorDO.getMobile());
                        }
                    }else{
                        return success(doctorDO.getMobile());
                        return Envelop.getError(content.getString("responseMessage"));
                    }
                }else{
                    return Envelop.getError(content.getString("responseMessage"));
                }else {
                    return Envelop.getError("获取失败");
                }
            }else {
                return Envelop.getError("获取失败");
            }
        }catch (Exception e){
            e.printStackTrace();

+ 19 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java

@ -473,6 +473,25 @@ public class PatientInfoPlatFormEndpoint extends EnvelopRestEndpoint {
        }
    }
    @RequestMapping(value = "processLogOld", method = RequestMethod.GET)
    @ApiOperation(value = "紧急救助工单流程-旧版本 现在用于设备物联大屏")
    public ObjEnvelop processLogOld(@ApiParam(name = "orderid")
                                 @RequestParam(value = "orderid") String orderid,
                                 @ApiParam(name = "orderType",value = "20紧急呼叫22安防工单")
                                 @RequestParam(value = "orderType") String orderType) {
        try {
            JSONObject emergencyAssistanceProcess = assistanceService.getEmergencyAssistanceProcessOld(orderid, orderType);
            if (null == emergencyAssistanceProcess) {
                return ObjEnvelop.getError("工单不存在",400 );
            }
            return ObjEnvelop.getSuccess("成功",emergencyAssistanceProcess);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @RequestMapping(value = "getWarningCount", method = RequestMethod.GET)
    @ApiOperation(value = "获取预警中的总数")

+ 39 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -312,6 +312,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
                messageUtil.sendDoctorGetuiMessage(doctorDO.getId(),"2",url,"紧急呼叫",body);
                messageUtil.sendDoctorDingdingMessage(doctorDO,null,"text","2",dingDingBody,null,null);
                messageUtil.sendHongLingJinMsg(doctorDO,null,assistanceDO);
                imUtill.sendMDTSocketMessageToDoctor(doctorDO.getId(),message.toString());
            }
            //pc管理端端推送消息
@ -1741,6 +1742,44 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        return jsonObject;
    }
    public JSONObject getEmergencyAssistanceProcessOld(String orderId,String orderType){
        JSONObject jsonObject = new JSONObject();
        String eaSql = " ";
        List<Map<String, Object>> maps = new ArrayList<>();
        if ("20".equals(orderType)){
            eaSql   = "SELECT `status`,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') AS createTime,complete_time AS completeTime " +
                    "from base_emergency_assistance_order WHERE id = '"+orderId+"'";
        }
        if ("22".equals(orderType)){
            eaSql   = "SELECT `status`,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') AS createTime,complete_time AS completeTime " +
                    "from base_security_monitoring_order WHERE id = '"+orderId+"'";
        }
        maps = jdbcTemplate.queryForList(eaSql);
        if (maps.size()==0) {
            return null;
        }
        for (Map<String, Object> map : maps) {
            jsonObject.put("status",map.get("status"));
            jsonObject.put("createTime",map.get("createTime"));
        }
        String sql = "select user_name AS userName,create_time AS createTime,content,type from base_emergency_warn_log where (user_type = 2 and order_id = '"+orderId+"' and type IS NOT NULL) " +
                " OR (user_type = 1 AND order_id = '"+orderId+"' and type IS NOT NULL) order by create_time,type ASC ";
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql);
        jsonObject.put("type5_status",0);
        jsonObject.put("result",result);
        for (Map<String, Object> map : result) {
            if (map.get("type").equals(5)) {
                jsonObject.put("type5_status",1);
            }
        }
        jsonObject = JSONObject.parseObject(JSON.toJSONStringWithDateFormat(jsonObject,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
        return jsonObject;
    }
    /**
     * 家属推送日志
     * @param patient

+ 63 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/child/ChildNewsListService.java

@ -0,0 +1,63 @@
package com.yihu.jw.care.service.child;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.child.BaseChildManageDao;
import com.yihu.jw.entity.child.BaseChildManage;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
 * Created by wsl on 2022/7/20
 */
@Service
public class ChildNewsListService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseChildManageDao baseChildManageDao;
    //获取
    @Transactional(rollbackFor = Exception.class)
    public JSONObject getChildManageList(Integer type, Integer page, Integer pageSize,String id){
        JSONObject jsonObject = new JSONObject();
        String sql = "select * from base_child_manage where  1=1 and type = "+type+" ";
        String totalSql = "select count(id) total from  base_child_manage where 1=1 and type = "+type+" ";
        String commonSql = "";
        String limitSql = "";
        if (StringUtils.isNotBlank(id)) {
            commonSql += "and id = '"+id+"' ";
            if (type==2) {
                baseChildManageDao.updateClick(id);
            }
        }else {
            if(page==null){
                page = 1;
            }
            if(pageSize==null){
                pageSize = 10;
            }
            limitSql +=" LIMIT  " + (page - 1) * pageSize + "," + pageSize + "";
        }
        commonSql +=  "ORDER BY create_time DESC "+ limitSql;
        List<BaseChildManage> baseChildManage = jdbcTemplate.query(sql+commonSql, new BeanPropertyRowMapper<>(BaseChildManage.class));
        Integer total = jdbcTemplate.queryForObject(totalSql + commonSql, Integer.class);
        jsonObject.put("obj",baseChildManage);
        jsonObject.put("total",total);
        return jsonObject;
    }
}

+ 0 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java

@ -15,7 +15,6 @@ import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.securitymonitoring.BaseEmergencyWarnLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
@ -149,14 +148,10 @@ public class PatientMessageService {
    }
    @Autowired
    private ImUtil imUtil;
    public List<Map<String,Object>> getSystemMessageListPad(String patient,String type){
        String sql = "SELECT id,type,title,sender_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,is_read,data,content,audio_url " +
                " FROM base_system_message WHERE type IN ("+type+") and receiver = '"+patient+"'" +
                " AND del = 1  ORDER BY create_time DESC ";
        return  jdbcTemplate.queryForList(sql);
    }

+ 1 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -314,6 +314,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            String dingDingBody = orderDO.getPatientName()+"居民存在异常情况,请及时处理,异常内容:"+orderDO.getServeDesc()+"。";
            messageUtil.sendDoctorGetuiMessage(doctorDO.getId(), "1", url, "安防紧急预警", body);
            messageUtil.sendDoctorDingdingMessage(doctorDO,null,"text","1",dingDingBody,null,null);
            messageUtil.sendHongLingJinMsg(doctorDO,orderDO,null);
            imUtil.sendMDTSocketMessageToDoctor(doctorDO.getId(), message.toString());
        }
        //pc管理端端推送消息

+ 146 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/HongLingJinUtil.java

@ -0,0 +1,146 @@
package com.yihu.jw.care.util;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.util.common.RSAUtils;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 拱墅区红领巾app对接
 * Created by yeshijie on 2022/7/13.
 */
@Component
public class HongLingJinUtil {
    private static final Logger logger = LoggerFactory.getLogger(HongLingJinUtil.class);
    //ras加密公钥
    private static final String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlOKrXjxrFo4Y2nNqzVh4ZMaxg58p83uSGuSA9Kxjsja+KHvN/72NqyKER2ucPuiYsDUBjFQI9t4LMLS8zl0GlKHKHU+gr8IQ4Cg/JqQLhjpgX4/f3Xk54A/1003TWKn9hSJSlsw3uxgLVTj/pwZoL1W1NSFKSu8jZbgzToNa2GwIDAQAB";
    //第三方平台的用户名
    private static final String username = "ddsqhd";
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 获取token
     * @return
     */
    public String getToken(){
        try {
            String url = "http://10.18.40.99:7680/sso/token";
//            String url = "https://zhyzh.gongshu.gov.cn/ssotoken";
            JSONObject json = new JSONObject();
            json.put("client_id","client_third");
            json.put("client_secret","a2o8W3nP");
            json.put("username",username);
            String code = RSAUtils.encrypt(json.toString(),publicKey);
            JSONObject response = httpClientUtil.headerPost(url+"?code="+code, null);
            if(response.getInteger("code")==200){
                return  response.getJSONObject("data").getString("access_token");
            }
            logger.info("response:"+response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
/*    public static void main(String[] args) throws Exception{
        String url = "https://zhyzh.gongshu.gov.cn/zzdcommon";
        JSONObject params = new JSONObject();
        JSONObject eventAssistName = new JSONObject();
        eventAssistName.put("deptName","");
        eventAssistName.put("mobile","");
        eventAssistName.put("realName","");
        JSONObject eventChargeName = new JSONObject();
        eventChargeName.put("deptName","");
        eventChargeName.put("mobile","15545430148");
        eventChargeName.put("realName","李康硕");
        params.put("eventAssistName",eventAssistName);
        params.put("eventChargeName",eventChargeName);
        params.put("eventHappenTime","2022-07-14 17:27:00");
        params.put("eventLocation","测试地址");
        params.put("eventName","测试事件");
        params.put("taskDescription","测试事件1");
        params.put("eventState","1");
        params.put("eventSource","2");
        params.put("taskId","adsf1234as24324");
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        headers.add("Authorization", "Bearer "+"e38c22a7-68d6-46d2-afb3-2adb8250af7e");
        headers.add("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE);
        headers.add("Accept",MediaType.ALL_VALUE);
        System.out.println("params.toJSONString():"+params.toJSONString());
        HttpEntity<String> formEntity = new HttpEntity<String>(params.toJSONString(), headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        System.out.println(ret);
    }*/
    /**
     * 预警消息推送
     */
    public void zzdcommon(String mobile,String name,String eventHappenTime
            ,String eventName,String taskDescription,String eventLocation,String taskId){
        try {
            String url = "http://10.18.40.101:7688/api/zzd/common";
            JSONObject params = new JSONObject();
            JSONObject eventAssistName = new JSONObject();
            eventAssistName.put("deptName","");
            eventAssistName.put("mobile","");
            eventAssistName.put("realName","");
            JSONObject eventChargeName = new JSONObject();
            eventChargeName.put("deptName","");
            eventChargeName.put("mobile", mobile);
            eventChargeName.put("realName", name);
            params.put("eventAssistName",eventAssistName);
            params.put("eventChargeName",eventChargeName);
            params.put("eventHappenTime",eventHappenTime);
            params.put("eventLocation",eventLocation);
            params.put("eventName", eventName);
            params.put("taskDescription", taskDescription);
            params.put("eventState","1");
            params.put("eventSource","2");
            params.put("taskId", taskId);
            RestTemplate restTemplate = new RestTemplate();
            HttpHeaders headers = new HttpHeaders();
            headers.add("Authorization", "Bearer "+getToken());
            headers.add("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE);
            headers.add("Accept",MediaType.ALL_VALUE);
            HttpEntity<String> formEntity = new HttpEntity<String>(params.toJSONString(), headers);
            String ret = restTemplate.postForObject(url, formEntity, String.class);
            logger.info("ret:"+ret);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

+ 34 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/util/MessageUtil.java

@ -8,6 +8,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.entity.care.assistance.EmergencyAssistanceDO;
import com.yihu.jw.entity.care.common.GetuiClientDO;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
@ -19,6 +20,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.push.dao.GetuiClientDao;
import com.yihu.jw.push.service.GetuiService;
import com.yihu.jw.sms.service.TXYSmsService;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.wechat.dao.WxAccessTokenDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
@ -74,6 +76,8 @@ public class MessageUtil {
    private GetuiClientDao getuiClientDao;
    @Autowired
    private DingdingUtil dingdingUtil;
    @Autowired
    private HongLingJinUtil hongLingJinUtil;
    /**
     * 您好{1}有一条新的在线报名申请,请及时前往APP消息应用进行处理。
@ -150,6 +154,36 @@ public class MessageUtil {
        }
    }
    /**
     * 红领巾消息推送
     */
    public void sendHongLingJinMsg(BaseDoctorDO doctorDO,SecurityMonitoringOrderDO orderDO, EmergencyAssistanceDO assistanceDO){
        try {
            String eventHappenTime;
            String eventName;
            String taskDescription;
            String eventLocation;
            String taskId;
            if(orderDO!=null){
                eventHappenTime = DateUtil.dateToStrFormatLong(orderDO.getCreateTime());
                taskId = orderDO.getId();
                eventName = "安防监控";
                taskDescription = orderDO.getPatientName()+"居民存在异常情况,请及时处理,异常内容:"+orderDO.getServeDesc()+"。";
                eventLocation = orderDO.getServeAddress();
            }else {
                eventHappenTime = DateUtil.dateToStrFormatLong(assistanceDO.getCreateTime());
                taskId = assistanceDO.getId();
                eventName = "紧急救助";
                taskDescription = "您好,"+assistanceDO.getPatientName()+"居民发起紧急呼叫,请及时处理。";
                eventLocation = assistanceDO.getServeAddress();
            }
            hongLingJinUtil.zzdcommon(doctorDO.getMobile(),doctorDO.getName(),eventHappenTime,eventName,taskDescription,eventLocation,taskId);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**
     *
     * @param wechatId

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

@ -68,7 +68,7 @@ public class SpeechTtsUtil {
                TextToVoiceRequest req = new TextToVoiceRequest();
                req.setText(text);
                req.setSessionId(sessionId);
                req.setVoiceType(10510000L);
                req.setVoiceType(1009L);
                req.setVolume(10F);
                req.setCodec(codec);
                // 返回的resp是一个TextToVoiceResponse的实例,与请求对象对应

+ 0 - 4
svr/svr-cloud-device/pom.xml

@ -169,10 +169,6 @@
            <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-commons</artifactId>
        </dependency>
    </dependencies>
    <build>

+ 0 - 2
svr/svr-cloud-device/src/main/java/com/yihu/SvrCloudDeviceApplication.java

@ -5,7 +5,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.client.RestTemplate;
@ -31,7 +30,6 @@ public class SvrCloudDeviceApplication extends SpringBootServletInitializer {
        return builder.sources(SvrCloudDeviceApplication.class);
    }
    @LoadBalanced//为RestTemplate Bean添加了一个LoadBalancerInterceptor拦截器。可以将请求的地址中的服务逻辑名转为具体的服务地址
    @Bean//将RestTemplate注册到容器
    public RestTemplate RestTemplate(){
        return new RestTemplate();

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

@ -36,7 +36,7 @@ public class PostConstructUtil {
        if("hzprod".equals(profiles)){
            logger.info("启动宇视人脸摄像头sdk====");
            netDevSdkService.init();
            //netDevSdkService.init();
        }
    }

+ 2 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java

@ -180,9 +180,10 @@ public class DeviceUploadService {
                        messageDO.setReceiverName(patientDO.getName());
                        messageDO.setOver("1");
                        ResponseEntity<String> forEntity = restTemplate.getForEntity("http://172.26.0.107:10301/common/open/wordToVoice?text={1}", String.class, typeName);
                        ResponseEntity<String> forEntity = restTemplate.getForEntity("http://127.0.0.1:10301/common/open/wordToVoice?text={1}", String.class, typeName);
                        com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(forEntity.getBody());
                        if (jsonObject.getInteger("status") == 200) {
                            //语音生成
                            messageDO.setAudioUrl(jsonObject.getString("message"));
                        }
                        messageDO.setCode(type);//与体征类型对应

+ 2 - 2
svr/svr-cloud-job/pom.xml

@ -146,10 +146,10 @@
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
<!--        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-commons</artifactId>
        </dependency>
        </dependency>-->
    </dependencies>
    <build>

+ 1 - 2
svr/svr-cloud-job/src/main/java/com/yihu/CloudApplicationJob.java

@ -5,7 +5,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;
@ -27,7 +26,7 @@ public class CloudApplicationJob extends SpringBootServletInitializer {
        return builder.sources(CloudApplicationJob.class);
    }
    @LoadBalanced//为RestTemplate Bean添加了一个LoadBalancerInterceptor拦截器。可以将请求的地址中的服务逻辑名转为具体的服务地址
    //@LoadBalanced//为RestTemplate Bean添加了一个LoadBalancerInterceptor拦截器。可以将请求的地址中的服务逻辑名转为具体的服务地址
    @Bean//将RestTemplate注册到容器
    public RestTemplate RestTemplate(){
        return new RestTemplate();

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

@ -20,10 +20,12 @@ public class DeviceWatchRemainingPowerJob implements Job {
    private PatientDeviceService patientDeviceService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println("====================系统推送设备电量低start==================");
        logger.info("DeviceWatchRemainingPowerJob start");
        try {
            patientDeviceService.deviceWatchRemainingPower();
            logger.info("DeviceWatchRemainingPowerJob end");
            System.out.println("====================系统推送设备电量低end==================");
        } catch (Exception e) {
            logger.info("DeviceWatchRemainingPowerJob --ERROR MSG:"+e.getMessage());
            e.printStackTrace();

+ 47 - 34
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/pushRecord/PushRecordJob.java

@ -18,10 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.*;
/**
 * Created by wsl on 2022/7/6
@ -45,39 +42,55 @@ public class PushRecordJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        String sql = "SELECT * FROM base_pushrecord_log_info WHERE `status` = 0 AND sendTime <= '"+DateUtil.getNowDate()+"'";
        List<BasePushrecordLogInfoEntity> logInfoEntityList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BasePushrecordLogInfoEntity.class));
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        System.out.println("====================人工推送start==================");
        try {
            String sql = "SELECT * FROM base_pushrecord_log_info WHERE `status` = 0 AND send_Time <= '"+ DateUtil.getStringDate()+"'";
            List<BasePushrecordLogInfoEntity> logInfoEntityList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BasePushrecordLogInfoEntity.class));
            List<SystemMessageDO> messageDOS = new ArrayList<>();
            Set<String> pushIdSet = new HashSet<>();
            if (logInfoEntityList.size()>0) {
                for (BasePushrecordLogInfoEntity basePushrecordLogInfoEntity : logInfoEntityList) {
                    //记录表设置已发送
                    basePushrecordLogInfoEntity.setStatus(1);
                    //新增推送记录
                    SystemMessageDO systemMessageDO = new SystemMessageDO();
                    systemMessageDO.setId(UUID.randomUUID().toString().replace("-", ""));
                    systemMessageDO.setTitle("系统消息推送");
                    systemMessageDO.setType("999");
                    systemMessageDO.setIsRead("0");
                    systemMessageDO.setSender("system");
                    systemMessageDO.setSenderName("人工推送助手");
                    systemMessageDO.setReceiver(basePushrecordLogInfoEntity.getPatient());
                    systemMessageDO.setReceiverName(basePushrecordLogInfoEntity.getPatientName());
                    systemMessageDO.setContent(basePushrecordLogInfoEntity.getContent());
                    systemMessageDO.setOver("1");
                    systemMessageDO.setDel("1");
                    systemMessageDO.setAudioUrl(devicelostMessageUtil.audioUrl(basePushrecordLogInfoEntity.getContent()));
                    systemMessageDO.setCreateTime(new Date());
                    messageDOS.add(systemMessageDO);
                    pushIdSet.add(basePushrecordLogInfoEntity.getPushId());
                }
        if (logInfoEntityList.size()>0) {
            for (BasePushrecordLogInfoEntity basePushrecordLogInfoEntity : logInfoEntityList) {
                //记录表设置已发送
                basePushrecordLogInfoEntity.setStatus(1);
                //新增推送记录
                SystemMessageDO systemMessageDO = new SystemMessageDO();
                systemMessageDO.setId(UUID.randomUUID().toString().replace("-", ""));
                systemMessageDO.setTitle("系统消息推送");
                systemMessageDO.setType("999");
                systemMessageDO.setIsRead("0");
                systemMessageDO.setSender("system");
                systemMessageDO.setSenderName("人工推送助手");
                systemMessageDO.setReceiver(basePushrecordLogInfoEntity.getPatient());
                systemMessageDO.setReceiverName(basePushrecordLogInfoEntity.getPatientName());
                systemMessageDO.setContent(basePushrecordLogInfoEntity.getContent());
                systemMessageDO.setOver("1");
                systemMessageDO.setDel("1");
                systemMessageDO.setAudioUrl(devicelostMessageUtil.audioUrl(basePushrecordLogInfoEntity.getContent()));
                systemMessageDO.setCreateTime(new Date());
                messageDOS.add(systemMessageDO);
            }
            String basePushLogSatusSql = "select * from base_pushrecord_log where id = '"+logInfoEntityList.get(0).getPushId()+"' ";
            BasePushRecordLogEntity logEntity = jdbcTemplate.queryForObject(basePushLogSatusSql, new BeanPropertyRowMapper<>(BasePushRecordLogEntity.class));
            logEntity.setStatus(1);
                for (String s : pushIdSet) {
                    String basePushLogSatusSql = "select * from base_pushrecord_log where id = '"+s+"' ";
                    List<BasePushRecordLogEntity> logEntityList = jdbcTemplate.query(basePushLogSatusSql, new BeanPropertyRowMapper<>(BasePushRecordLogEntity.class));
                    if (logEntityList.size()>0) {
                        logEntityList.stream().forEach(obj-> obj.setStatus(1));
                        basePushRecordLogDao.save(logEntityList);
                    }
                }
            basePushRecordLogDao.save(logEntity);
            systemMessageDao.save(messageDOS);
            basePushrecordLogInfoDao.save(logInfoEntityList);
                for (SystemMessageDO messageDO : messageDOS) {
                    devicelostMessageUtil.patientMessageSocket(messageDO);
                }
                systemMessageDao.save(messageDOS);
                basePushrecordLogInfoDao.save(logInfoEntityList);
            }
            System.out.println("====================人工推送end==================");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

+ 0 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -360,7 +360,6 @@ public class PatientDeviceService {
                }
                Thread.sleep(1000);
            }
            if (rslist.size()>0) {
                deviceLostMessageUtil.watchRemainingPower(rslist);
            }

+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java

@ -260,7 +260,7 @@ public class DeviceLostMessageUtil {
            SystemMessageDO messageDO = new SystemMessageDO();
            String contentTwo = contentOne;
            contentTwo = contentTwo.replace("{name}",jsonObject.getString("name"));
            contentTwo.replace("{sex}",1==jsonObject.getInteger("sex")?"大爷":"大妈");
            contentTwo = contentTwo.replace("{sex}",1==jsonObject.getInteger("sex")?"大爷":"大妈");
            String s = audioUrl(contentTwo);
            messageDO.setTitle("设备未佩戴通知");
@ -508,7 +508,7 @@ public class DeviceLostMessageUtil {
    }
    public String audioUrl(String content){
        ResponseEntity<String> forEntity = restTemplate.getForEntity("http://172.26.0.107:10301/common/open/wordToVoice?text={1}", String.class, content);
        ResponseEntity<String> forEntity = restTemplate.getForEntity("http://127.0.0.1:10301/common/open/wordToVoice?text={1}", String.class, content);
        JSONObject jsonObject = JSONObject.parseObject(forEntity.getBody());
        if (jsonObject.getInteger("status") == 200){
            return jsonObject.getString("message");

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

@ -45,4 +45,4 @@ PUSH_DEVICE_OFF_LONE_JOB= 0 30 9 * * ?
#\u6BCF\u5929\u65E9\u4E0A\u5341\u4E00\u70B9 \u624B\u8868\u4F69\u6234\u63D0\u9192
DEVICE_WATCH_OFF_WEAR_JOB= 0 0 11 * * ?
#\u624B\u8868\u7535\u91CF\u4F4E  \u6BCF\u4E00\u4E2A\u5C0F\u65F6\u83B7\u53D6\u4E00\u6B21 \u7535\u91CF
DEVICE_WATCH_REMAINING_POWER_JOB= 0 0 0/1 * * ? 
DEVICE_WATCH_REMAINING_POWER_JOB= 0 0 0/1 * * ?

+ 12 - 0
svr/svr-iot/src/main/java/com/yihu/iot/config/MvcConfig.java

@ -3,6 +3,7 @@ package com.yihu.iot.config;
import com.yihu.iot.interceptor.CrosXssFilter;
import com.yihu.iot.interceptor.GateWayInterceptor;
import com.yihu.iot.interceptor.PermissionInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -21,6 +22,8 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
    private Logger logger = LoggerFactory.getLogger(MvcConfig.class);
    @Autowired
    private GateWayInterceptor gateWayInterceptor;
    @Autowired
    private PermissionInterceptor permissionInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
@ -31,6 +34,15 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
                "/svr-iot/open/gc/accesstoken",
                "/svr-iot/open/gc/createGcClientDetails");
        registry.addInterceptor(permissionInterceptor)
                .addPathPatterns("/svr-iot/**")
                .addPathPatterns("/equipmentManage/**")
                .excludePathPatterns(
                "/svr-iot/open/gc/**","/svr-iot/systemDict/findDictByCode"
                        ,"/svr-iot/systemDict/findByDictName","svr-iot/fileUpload/open/fileUpload"
        );
        super.addInterceptors(registry);
        logger.info("init gateWayInterceptor");
    }

+ 55 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/common/CommonController.java

@ -0,0 +1,55 @@
package com.yihu.iot.controller.common;
import com.yihu.iot.dao.common.BaseMenuUrlDao;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.menu.BaseMenuUrlDO;
import io.swagger.annotations.Api;
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.RestController;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import java.util.*;
/**
 * Created by yeshijie on 2022/7/20.
 */
@RestController
@RequestMapping("open/test")
@Api(tags = "通用自测相关操作", description = "通用自测相关操作")
public class CommonController extends BaseController{
    @Autowired
    WebApplicationContext applicationContext;
    @Autowired
    private BaseMenuUrlDao baseMenuUrlDao;
    @GetMapping("getAllUrl")
    public List<String> getAllUrl(){
        RequestMappingHandlerMapping mapping = applicationContext.getBean(RequestMappingHandlerMapping.class);
        //获取url与类和方法的对应信息
        Map<RequestMappingInfo, HandlerMethod> map = mapping.getHandlerMethods();
        List<String> urlList = new ArrayList<>();
        for (RequestMappingInfo info : map.keySet()){
            //获取url的Set集合,一个方法可能对应多个url
            Set<String> patterns = info.getPatternsCondition().getPatterns();
            for (String url : patterns) {
                if(url.contains("/open/")||url.contains("/swagger-resources")
                        ||url.contains("/error")||url.contains("/svr-iot/analyze/")){
                    continue;
                }
                urlList.add(url);
                BaseMenuUrlDO urlDO = new BaseMenuUrlDO();
                urlDO.setCreateTime(new Date());
                urlDO.setUrl(url);
                baseMenuUrlDao.save(urlDO);
            }
        }
        return urlList;
    }
}

+ 21 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/common/BaseLoginLogDao.java

@ -0,0 +1,21 @@
package com.yihu.iot.dao.common;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface BaseLoginLogDao extends PagingAndSortingRepository<BaseLoginLogDO, String>, JpaSpecificationExecutor<BaseLoginLogDO> {
    @Query("from BaseLoginLogDO l where l.openid=?1 order by l.createTime desc")
    List<BaseLoginLogDO> findByOpenId(String openid);
    @Query("from BaseLoginLogDO l where l.userId=?1 order by l.createTime desc")
    List<BaseLoginLogDO> findByUserId(String openid);
    @Query(value = "SELECT a.* from base_login_log a WHERE a.token=?1 ORDER BY a.create_time desc LIMIT 1",nativeQuery = true)
    BaseLoginLogDO findByToken(String token);
}

+ 12 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/common/BaseMenuUrlDao.java

@ -0,0 +1,12 @@
package com.yihu.iot.dao.common;
import com.yihu.jw.entity.base.menu.BaseMenuUrlDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2022/7/20.
 */
public interface BaseMenuUrlDao extends PagingAndSortingRepository<BaseMenuUrlDO, String>, JpaSpecificationExecutor<BaseMenuUrlDO> {
}

+ 72 - 0
svr/svr-iot/src/main/java/com/yihu/iot/interceptor/PermissionInterceptor.java

@ -0,0 +1,72 @@
package com.yihu.iot.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.service.common.PermissionService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
/**
 * 菜单权限校验
 *
 * @author George
 */
@Component
public class PermissionInterceptor implements HandlerInterceptor {
    private Logger logger = LoggerFactory.getLogger(PermissionInterceptor.class);
    public static String status = "1";
    @Autowired
    public PermissionService permissionService;
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        boolean flag = true;
        try {
            request.setCharacterEncoding("UTF-8");
            response.setHeader("Content-type", "text/html;charset=UTF-8");
            request.setAttribute("log-start", new Date().getTime());
            response.setCharacterEncoding("UTF-8");
            String uri = request.getRequestURI();
            logger.info("getRequestURI"+uri);
            //越权验证
            if(!permissionService.isPermission(uri)){
                JSONObject json = new JSONObject();
                json.put("status",403);
                json.put("message","该操作没有权限");
                response.getOutputStream().write(json.toString().getBytes("UTF-8"));
                return false;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return flag;
    }
    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
    }
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
    }
}

+ 123 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/common/PermissionService.java

@ -0,0 +1,123 @@
package com.yihu.iot.service.common;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.common.BaseLoginLogDao;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import org.apache.commons.lang3.StringUtils;
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.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 * Created by yeshijie on 2022/3/14.
 */
@Service
public class PermissionService {
    private static final Logger logger = LoggerFactory.getLogger(PermissionService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseLoginLogDao baseLoginLogDao;
    @Value("${spring.profiles}")
    private String profiles;
    /**
     * 判断用户是否有权限
     */
    public boolean isPermission(String url){
        try {
            String uid = getUID();
            //            String uid = "402803f9658455110165845b84850000";
            logger.info("uid:" + uid);
            if(StringUtils.isBlank(uid)){
                return true;
            }
            //判断是否开启权限校验 未设置或者为0则不开启权限校验
            String sql = " select code from iot_system_dict where dict_name ='isPermission'  ";
            List<String> isPermissions = jdbcTemplate.queryForList(sql,String.class);
            if(isPermissions.size()==0||"0".equals(isPermissions.get(0))){
                return true;
            }
            if ("2c9a80ed72068fa20172164d756c000c".equals(uid)||"402803f9658455110165845b84850000".equals(uid)) {
                //管理员 admxin 和 测试管理员 18800000001
                return true;
            }
            String usrSql = "SELECT role_id from "+getDbName()+".base_user where id=?";
            List<String> roleIds = jdbcTemplate.queryForList(usrSql,new Object[]{uid},String.class);
            if(roleIds.size()==0){
                return false;
            }
            String roleId = roleIds.get(0);
            if("company".equals(roleId)||"platform".equals(roleId)){
                //新申请的厂商和平台商才做权限校验
                String db = getDbName();
                String sqlCount = "SELECT count(DISTINCT mu.url) from "+db+".base_menu m,"+db+".base_role_menu rm,"+db+".base_menu_url mu " +
                        "WHERE rm.role_id = '"+roleId+"'  and m.id = rm.menu_id and m.status=1 " +
                        "and m.id = mu.menu_id and mu.url='"+url+"'";
                Integer num = jdbcTemplate.queryForObject(sqlCount,Integer.class);
                if(num==0){
                    return false;
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return true;
    }
    public String getUID(){
        BaseLoginLogDO loginLogDO = getLoginLog();
        if(loginLogDO != null){
            return loginLogDO.getUserId();
        }
        return null;
    }
    private BaseLoginLogDO getLoginLog(){
        String accessToken = this.extractToken(getRequest());
        String sql = "select * from "+getDbName()+".base_login_log a WHERE a.token=? ORDER BY a.create_time desc LIMIT 1";
        logger.info("sql+"+sql);
        List<BaseLoginLogDO> list = jdbcTemplate.query(sql,new Object[]{accessToken},new BeanPropertyRowMapper<>(BaseLoginLogDO.class));
        if(list!=null&&list.size()>0){
            return list.get(0);
        }
        return null;
    }
    public String getDbName(){
        String db = "base";
        if("iotprod".equals(profiles)){
            db = "`iot-base`";
        }
        return db;
    }
    private String extractToken(HttpServletRequest request) {
        String accessToken = request.getHeader("token");
        if (null == accessToken) {
            accessToken = request.getParameter("token");
        }
        return accessToken;
    }
    public HttpServletRequest getRequest(){
        return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
    }
}

+ 4 - 1
svr/svr-iot/src/main/resources/application.yml

@ -22,7 +22,10 @@ spring:
      test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
      min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
      time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  http:
    multipart:
      max-file-size: 50MB
      max-request-size: 100MB
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名

+ 4 - 3
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistScreenResultController.java

@ -32,16 +32,17 @@ public class SpecialistScreenResultController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.screen.getScreenResult)
    @ApiOperation(value = "专科医生获取筛查记录列表")
    public MixEnvelop<SurveyScreenResultVo, SurveyScreenResultVo> createSpecialistPatientRelation(@ApiParam(name = "doctor", value = "专科医生ID")@RequestParam(value = "doctor")String doctor,
    public MixEnvelop<SurveyScreenResultVo, SurveyScreenResultVo> createSpecialistPatientRelation(@ApiParam(name = "doctor", value = "专科医生ID")@RequestParam(value = "doctor",required = false)String doctor,
                                                                            @ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                                                            @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                                                            @ApiParam(value = "搜索居民的姓名或身份证") @RequestParam(value = "patientName", required = false) String patientName,
                                                                            @ApiParam(value = "1已跟踪 2已预约 3已接诊 4待处理")@RequestParam(value = "type",required = false) Integer type,
                                                                            @ApiParam(value = "是否高危预警(0否 1是)") @RequestParam(value = "isDanger", required = false) String isDanger,
                                                                            @ApiParam(value = "疾病类型") @RequestParam(value = "diseaseType", required = false) String diseaseType,
                                                                            @ApiParam(value = "传1则根据类型查一条数据")@RequestParam(value = "filterType",required = false,defaultValue = "0")Integer filterType){
                                                                            @ApiParam(value = "传1则根据类型查一条数据")@RequestParam(value = "filterType",required = false,defaultValue = "0")Integer filterType,
                                                                            @ApiParam(value = "居民code")@RequestParam(required = false)String patientCode){
        try {
            return specialistScreenResultService.getScreenList(doctor,type,pageNo,pageSize,patientName, isDanger, diseaseType,filterType);
            return specialistScreenResultService.getScreenList(doctor,type,pageNo,pageSize,patientName, isDanger, diseaseType,filterType,patientCode);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 11 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistScreenResultService.java


+ 5 - 5
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -476,7 +476,7 @@ public class RehabilitationManageService {
        for (int i=1;i<planIdlist.length;i++){
            planCondition .append(",'"+planIdlist[i]+"'");
        }
        String sql = " select d.*,DATE_FORMAT(d.execute_time,'%Y/%m/%d %H:%i') as executeTime ,i.code,i.name,1 as flag from wlyy_specialist.wlyy_rehabilitation_plan_detail d " +
        String sql = " select d.*,DATE_FORMAT(d.execute_time,'%Y/%m/%d %H:%i') as executeTime ,i.code,IF(d.followup_detail_type=1,'康复随访(社区)',i.name) name,1 as flag from wlyy_specialist.wlyy_rehabilitation_plan_detail d " +
                " LEFT JOIN wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id  " +
                " where  d.plan_id in ("+planCondition+" )AND  d.execute_time IS NOT NULL  and d.execute_time <>'' " ;
        if(searchTask!=null){
@ -484,7 +484,7 @@ public class RehabilitationManageService {
                if(StringUtils.isNotBlank(doctorCode)){
                    sql+=" and d.doctor='"+doctorCode+"' ";
                }
                sql+=" and i.code="+searchTask+" " ;
                //sql+=" and i.code="+searchTask+" " ;
            }else {
                sql+=" and i.code="+searchTask+" " ;
            }/*else if(searchTask==5){
@ -521,7 +521,7 @@ public class RehabilitationManageService {
                list = jdbcTemplate.queryForList(cfxfSql);
            }
            if (6 == searchTask || searchTask == 8){ //随访
            if (6 == searchTask){ //随访
                String sfSql = "SELECT DISTINCT DATE_FORMAT(wf.followup_date,'%Y/%m/%d %H:%i') followupDate,DATE_FORMAT(wf.followup_plan_date,'%Y/%m/%d %H:%i') executeTime,wf.doctor_code doctorCode,wf.followup_class followupClass, " +
                        " wf.patient_code AS patientCode,wf.patient_name AS patientName,wf.doctor_name doctorName,wf.`status` AS `status`,wf.org_name orgName," +
                        " wf.org_code orgCode,sd.value AS `value`, wf.followup_type  followupType,wf.id AS id, 6 AS code,2 as flag FROM  wlyy.wlyy_followup wf " +
@ -649,7 +649,7 @@ public class RehabilitationManageService {
        String sql = "select h.name as title,h.content as content,h.code as itemType,d.id,d.execute_time,d.hospital_name,d.status,d.type,d.expense,d.doctor as executeDoctor, " +
                " d.doctor_name as executeDoctorName,p.patient ,p.name as patientName,p.create_user as createDoctor,p.create_user_name as createDoctorName, p.status as planStatus," +
                " p.disease,p.disease_name as diseaseName,p.title as planTitle,d.plan_id as planId,d.relation_code as relationCode,d.frequency_code as frequencyCode,d.remark  "+
                " ,a.appointment_time appointmentTime,a.appointment_doctor appointmentDoctor,a.appointment_doctor_name appointmentDoctorName,d.reservation_type reservationType" +
                " ,a.appointment_time appointmentTime,a.appointment_doctor appointmentDoctor,a.appointment_doctor_name appointmentDoctorName,d.reservation_type reservationType,d.followup_detail_type followupDetailType " +
                " from wlyy_specialist.wlyy_rehabilitation_plan_detail d " +
                " LEFT JOIN wlyy_specialist.wlyy_rehabilitation_service_item h on d.hospital_service_item_id = h.code "+
                " LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
@ -676,7 +676,7 @@ public class RehabilitationManageService {
        resultMap.put("appointmentDoctor",one.get("appointmentDoctor"));
        resultMap.put("appointmentDoctorName",one.get("appointmentDoctorName"));
        resultMap.put("reservationType",one.get("reservationType"));//复诊类型:1线上,2线下,3远程
        resultMap.put("followupDetailType",one.get("followupDetailType"));
        resultMap.put("frequencyCode",one.get("frequencyCode")+"");
        resultMap.put("isMyTask",isMyTask);//0不是自己的任务,1是自己的任务
//        if(!(one.get("specialistDoctor")+"").equals((one.get("create_user")+""))){