Browse Source

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

yeshijie 7 years ago
parent
commit
57d2294512
83 changed files with 1878 additions and 770 deletions
  1. 12 7
      app/app-iot-server/pom.xml
  2. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/third/wlyy/MonitoringHealthPlatformController.java
  3. 2 2
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/third/wlyy/MonitoringHealthService.java
  4. 2 2
      app/public-health-server/pom.xml
  5. 4 2
      common-lib-parent-pom/pom.xml
  6. 2 2
      common/common-entity/pom.xml
  7. 22 0
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/CreditsDetailDO.java
  8. 156 6
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientHospitalRecordDO.java
  9. 87 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java
  10. 77 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java
  11. 30 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistPatientRelationDO.java
  12. 4 7
      common/common-exception/pom.xml
  13. 52 51
      common/common-exception/src/main/java/com/yihu/jw/exception/advice/MyControllerAdvice.java
  14. 10 3
      common/common-fegin/pom.xml
  15. 1 1
      common/common-fegin/src/main/java/com/yihu/jw/fegin/DemoFeign.java
  16. 1 1
      common/common-fegin/src/main/java/com/yihu/jw/fegin/base/user/EmployFeign.java
  17. 1 1
      common/common-fegin/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/base/LoginFeignFallbackFactory.java
  18. 2 2
      common/common-fegin/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/user/EmployeeFeignFallbackFactory.java
  19. 1 1
      common/common-fegin/src/main/java/com/yihu/jw/fegin/fallbackfactory/iot/device/IotPatientDeviceFallbackFactory.java
  20. 1 1
      common/common-fegin/src/main/java/com/yihu/jw/fegin/iot/device/IotPatientDeviceFeign.java
  21. 2 2
      common/common-request-mapping/pom.xml
  22. 40 0
      common/common-rest-model-es/pom.xml
  23. 1 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/common/SaveModel.java
  24. 1 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/FigureLabelDataModelVO.java
  25. 2 2
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/LocationDataVO.java
  26. 5 14
      common/common-rest-model/pom.xml
  27. 7 5
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/EnvelopRestController.java
  28. 2 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/base/BaseEnvelopStatus.java
  29. 64 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientRelationVO.java
  30. 2 2
      common/common-util/pom.xml
  31. 0 0
      data/elasticsearch/nodes/0/node.lock
  32. 27 0
      server/svr-admin-server/pom.xml
  33. 5 5
      server/svr-configuration/pom.xml
  34. 5 0
      server/svr-configuration/src/main/resources/application.yml
  35. 5 5
      server/svr-configuration/src/main/resources/bootstrap.yml
  36. 1 1
      server/svr-discovery/pom.xml
  37. 1 1
      server/svr-discovery/src/main/resources/application.yml
  38. 69 0
      server/svr-yihu-admin-server/pom.xml
  39. 5 0
      server/svr-yihu-admin-server/readme.MD
  40. 33 0
      server/svr-yihu-admin-server/src/main/java/com.yihu.admin/YihuAdminServer.java
  41. 66 0
      server/svr-yihu-admin-server/src/main/resources/application.yml
  42. 17 0
      server/svr-yihu-admin-server/src/main/resources/bootstrap.yml
  43. 4 0
      server/svr-yihu-admin-server/src/main/resources/logback.xml
  44. 50 13
      svr-lib-parent-pom/pom.xml
  45. 31 18
      svr/svr-base/pom.xml
  46. 7 2
      svr/svr-base/src/main/java/com/yihu/jw/SvrBaseApplication.java
  47. 38 0
      svr/svr-base/src/main/java/com/yihu/jw/business/demo/DemoController.java
  48. 115 122
      svr/svr-base/src/main/java/com/yihu/jw/business/login/contorller/LoginController.java
  49. 124 125
      svr/svr-base/src/main/java/com/yihu/jw/business/login/service/LoginService.java
  50. 10 10
      svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/EmployController.java
  51. 18 13
      svr/svr-base/src/main/resources/application.yml
  52. 1 1
      svr/svr-base/src/main/resources/bootstrap.yml
  53. 2 2
      svr/svr-demo/pom.xml
  54. 6 2
      svr/svr-iot/pom.xml
  55. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java
  56. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/label/FigureLabelSearchController.java
  57. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  58. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/label/FigureLabelSerachService.java
  59. 2 2
      svr/svr-manage/pom.xml
  60. 2 2
      svr/svr-rehabilitation/pom.xml
  61. 2 2
      svr/svr-wlyy-archives/pom.xml
  62. 2 2
      svr/svr-wlyy-health-bank/pom.xml
  63. 2 2
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/AccountController.java
  64. 152 71
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java
  65. 5 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/TaskService.java
  66. 65 21
      svr/svr-wlyy-health-bank/src/main/resources/application.yml
  67. 11 2
      svr/svr-wlyy-health-bank/src/main/resources/bootstrap.yml
  68. 2 2
      svr/svr-wlyy-specialist/pom.xml
  69. 2 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java
  70. 12 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/PatientLabelDao.java
  71. 12 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/PatientLabelInfoDao.java
  72. 1 1
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java
  73. 28 3
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java
  74. 3 1
      svr/svr-wlyy-specialist/src/main/resources/application.yml
  75. 2 2
      svr/svr-wlyy/pom.xml
  76. 37 39
      web-gateway/pom.xml
  77. 16 3
      web-gateway/src/main/java/com/yihu/jw/WebGateWayAppliaction.java
  78. 26 8
      web-gateway/src/main/java/com/yihu/jw/config/SwaggerConfig.java
  79. 10 0
      web-gateway/src/main/java/com/yihu/jw/config/mvc/MvcConfig.java
  80. 96 15
      web-gateway/src/main/java/com/yihu/jw/controller/base/login/LoginContorller.java
  81. 134 134
      web-gateway/src/main/java/com/yihu/jw/controller/base/security/TokenController.java
  82. 1 1
      web-gateway/src/main/java/com/yihu/jw/controller/iot/device/IotPatientDeviceController.java
  83. 14 14
      web-gateway/src/main/resources/application.yml

+ 12 - 7
app/app-iot-server/pom.xml

@ -1,18 +1,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.yihu.ehr.iot</groupId>
    <artifactId>app-iot-server</artifactId>
    <packaging>war</packaging>
    <version>1.0.0</version>
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.ehr.iot</groupId>
    <artifactId>app-iot-server</artifactId>
    <packaging>war</packaging>
    <version>${parent.version}</version>
    <!-- 依赖包 -->
    <!-- 依赖包 -->
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>
@ -230,12 +233,10 @@
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
            <artifactId>common-request-mapping</artifactId>
            <version>1.0.0</version>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <artifactId>common-rest-model</artifactId>
            <version>1.0.0</version>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.base</groupId>
@ -246,6 +247,10 @@
            <groupId>org.springframework.boot</groupId>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model-es</artifactId>
        </dependency>
    </dependencies>
    </dependencies>
    <build>
    <build>

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/third/wlyy/MonitoringHealthPlatformController.java

@ -3,11 +3,11 @@ package com.yihu.ehr.iot.controller.third.wlyy;
import com.yihu.ehr.iot.controller.common.BaseController;
import com.yihu.ehr.iot.controller.common.BaseController;
import com.yihu.ehr.iot.service.third.wlyy.MonitoringHealthService;
import com.yihu.ehr.iot.service.third.wlyy.MonitoringHealthService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.LocationDataVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import iot.device.LocationDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;

+ 2 - 2
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/third/wlyy/MonitoringHealthService.java

@ -8,9 +8,9 @@ import com.yihu.ehr.iot.service.common.BaseService;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.LocationDataVO;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import iot.device.LocationDataVO;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
@ -44,7 +44,7 @@ public class MonitoringHealthService extends BaseService{
     * @param diseaseCondition
     * @param diseaseCondition
     * @return
     * @return
     */
     */
    public Envelop<LocationDataVO> findDeviceLocations(Integer diseaseCondition,Integer page,Integer size,String type) throws IOException {
    public Envelop<LocationDataVO> findDeviceLocations(Integer diseaseCondition, Integer page, Integer size, String type) throws IOException {
        Envelop<LocationDataVO> envelop = new Envelop<>();
        Envelop<LocationDataVO> envelop = new Envelop<>();
        Envelop<LocationDataVO> envelopTmp = null;
        Envelop<LocationDataVO> envelopTmp = null;
        JSONArray jsonArray = new JSONArray();
        JSONArray jsonArray = new JSONArray();

+ 2 - 2
app/public-health-server/pom.xml

@ -4,12 +4,12 @@
    <groupId>com.yihu.ehr.iot</groupId>
    <groupId>com.yihu.ehr.iot</groupId>
    <artifactId>public-health-server</artifactId>
    <artifactId>public-health-server</artifactId>
    <packaging>war</packaging>
    <packaging>war</packaging>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>

+ 4 - 2
common-lib-parent-pom/pom.xml

@ -6,18 +6,20 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.base</groupId>
    <groupId>com.yihu.base</groupId>
    <artifactId>common-lib-parent-pom</artifactId>
    <artifactId>common-lib-parent-pom</artifactId>
    <version>1.0.0</version>
    <version>1.0.2</version>
    <packaging>pom</packaging>
    <packaging>pom</packaging>
    <modules>
    <modules>
        <module>../common/common-entity</module>
        <module>../common/common-entity</module>
        <module>../common/common-rest-model</module>
        <module>../common/common-rest-model</module>
        <module>../common/common-rest-model-es</module>
        <module>../common/common-exception</module>
        <module>../common/common-exception</module>
        <module>../common/common-request-mapping</module>
        <module>../common/common-request-mapping</module>
        <module>../common/common-util</module>
        <module>../common/common-util</module>

+ 2 - 2
common/common-entity/pom.xml

@ -6,12 +6,12 @@
    <parent>
    <parent>
        <groupId>com.yihu.base</groupId>
        <groupId>com.yihu.base</groupId>
        <artifactId>common-lib-parent-pom</artifactId>
        <artifactId>common-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-entity</artifactId>
    <artifactId>common-entity</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>

+ 22 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/CreditsDetailDO.java

@ -51,6 +51,12 @@ public class CreditsDetailDO extends IdEntityWithOperation implements Serializab
    @Transient
    @Transient
    private String flag ; // 标识是什么任务
    private String flag ; // 标识是什么任务
    @Transient
    private Integer total;  //总积分
    @Transient
    private String name; //居民名称
    public String getSaasId() {
    public String getSaasId() {
        return saasId;
        return saasId;
    }
    }
@ -146,4 +152,20 @@ public class CreditsDetailDO extends IdEntityWithOperation implements Serializab
    public void setFlag(String flag) {
    public void setFlag(String flag) {
        this.flag = flag;
        this.flag = flag;
    }
    }
    public Integer getTotal() {
        return total;
    }
    public void setTotal(Integer total) {
        this.total = total;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
}

+ 156 - 6
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientHospitalRecordDO.java

@ -15,10 +15,25 @@ import java.io.Serializable;
public class PatientHospitalRecordDO extends IdEntityWithOperation implements Serializable {
public class PatientHospitalRecordDO extends IdEntityWithOperation implements Serializable {
    private String saasId;//
    private String saasId;//
    private String code;//智业记录code
    private String thirdCode;//智业记录code
    private String eventCode; // 事件code
    private String patient;//患者
    private String patient;//患者
    private String patientName;//患者姓名
    private String patientName;//患者姓名
    private String type;//出院:1;住院:0
    private String type;//出院:1;住院:0
    private String hospital; //医院
    private String hospitalName;
    private String doctor; //医生
    private String doctorName;
    private String city; //城市
    private String cityName;
    private String town; //城镇
    private String townName;
    private String remark; //备注
    private String diagnosis; //诊断
    private String label; //标签
    private String labelName;
    private String dept;//部门
    private String deptName;
    @Column(name = "saas_id")
    @Column(name = "saas_id")
    public String getSaasId() {
    public String getSaasId() {
@ -29,13 +44,148 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.saasId = saasId;
        this.saasId = saasId;
    }
    }
    @Column(name = "code")
    public String getCode() {
        return code;
    @Column(name = "third_code")
    public String getThirdCode() {
        return thirdCode;
    }
    }
    public void setCode(String code) {
        this.code = code;
    public void setThirdCode(String thirdCode) {
        this.thirdCode = thirdCode;
    }
    @Column(name = "event_code")
    public String getEventCode() {
        return eventCode;
    }
    public void setEventCode(String eventCode) {
        this.eventCode = eventCode;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "city")
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    @Column(name = "city_name")
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    @Column(name = "town")
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    @Column(name = "town_name")
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "diagnosis")
    public String getDiagnosis() {
        return diagnosis;
    }
    public void setDiagnosis(String diagnosis) {
        this.diagnosis = diagnosis;
    }
    @Column(name = "label")
    public String getLabel() {
        return label;
    }
    public void setLabel(String label) {
        this.label = label;
    }
    @Column(name = "label_name")
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    @Column(name = "dept_ame")
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    }
    @Column(name = "patient")
    @Column(name = "patient")

+ 87 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java

@ -0,0 +1,87 @@
package com.yihu.jw.entity.specialist;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by Trick on 2018/5/29.
 */
@Entity
@Table(name = "wlyy_patient_label")
public class PatientLabelDO extends IdEntityWithOperation implements Serializable {
    private String saasId;
    private String labelName;//标签名称',
    private String labelCode;//标签code',
    private String labelType;//标签类型:1.装病类型;2.健康情况;3.自定义',
    private Integer sort;//排序',
    private String teamCode;//团队code',
    private String del;//1:有效;0:删除',
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "label_name")
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
    @Column(name = "label_code")
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    @Column(name = "label_type")
    public String getLabelType() {
        return labelType;
    }
    public void setLabelType(String labelType) {
        this.labelType = labelType;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Column(name = "team_code")
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 77 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java

@ -0,0 +1,77 @@
package com.yihu.jw.entity.specialist;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by Trick on 2018/5/29.
 */
@Entity
@Table(name = "wlyy_patient_label_info")
public class PatientLabelInfoDO extends IdEntityWithOperation implements Serializable {
    private String saasId;
    private String patient;//居民code',
    private String labelName;//标签名称',
    private String labelCode;//标签code',
    private String labelType;//标签类别',
    private String teamCode;//团队code',
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "label_name")
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
    @Column(name = "label_code")
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    @Column(name = "label_type")
    public String getLabelType() {
        return labelType;
    }
    public void setLabelType(String labelType) {
        this.labelType = labelType;
    }
    @Column(name = "team_code")
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
}

+ 30 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistPatientRelationDO.java

@ -21,7 +21,10 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
    private String doctorName;//专科医生姓名
    private String doctorName;//专科医生姓名
    private String patient;// 居民(患者)
    private String patient;// 居民(患者)
    private String patientName;//居民(患者)姓名
    private String patientName;//居民(患者)姓名
    private String healthAssistant;//计管师
    private String healthAssistantName;//计管师
    private String status;//1.已经分配,0,待分配
    private String status;//1.已经分配,0,待分配
    private String pkCode; //服务包code
    private String signCode;//签约code
    private String signCode;//签约code
    private String signDoctor;//签约医生
    private String signDoctor;//签约医生
    private String signDoctorName;//签约医生
    private String signDoctorName;//签约医生
@ -167,4 +170,31 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
    public void setTeamCode(Integer teamCode) {
    public void setTeamCode(Integer teamCode) {
        this.teamCode = teamCode;
        this.teamCode = teamCode;
    }
    }
    @Column(name = "health_assistant")
    public String getHealthAssistant() {
        return healthAssistant;
    }
    public void setHealthAssistant(String healthAssistant) {
        this.healthAssistant = healthAssistant;
    }
    @Column(name = "health_assistant_name")
    public String getHealthAssistantName() {
        return healthAssistantName;
    }
    public void setHealthAssistantName(String healthAssistantName) {
        this.healthAssistantName = healthAssistantName;
    }
    @Column(name = "pk_code")
    public String getPkCode() {
        return pkCode;
    }
    public void setPkCode(String pkCode) {
        this.pkCode = pkCode;
    }
}
}

+ 4 - 7
common/common-exception/pom.xml

@ -6,13 +6,13 @@
    <parent>
    <parent>
        <groupId>com.yihu.base</groupId>
        <groupId>com.yihu.base</groupId>
        <artifactId>common-lib-parent-pom</artifactId>
        <artifactId>common-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-exception</artifactId>
    <artifactId>common-exception</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>
@ -39,13 +39,10 @@
            <groupId>javax.servlet</groupId>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-sleuth-core</artifactId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
        </dependency>
        </dependency>
    </dependencies>
    </dependencies>
</project>
</project>

+ 52 - 51
common/common-exception/src/main/java/com/yihu/jw/exception/advice/MyControllerAdvice.java

@ -1,51 +1,52 @@
package com.yihu.jw.exception.advice;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelopStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.cloud.sleuth.Tracer;
import org.json.JSONObject;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
 * 统一异常处理器
 * Created by 刘文彬 on 2018/5/9.
 */
@ControllerAdvice
public class MyControllerAdvice {
    @Autowired
    private Tracer tracer;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @ResponseBody
    @ExceptionHandler(value = ApiException.class)
    public BaseEnvelop myErrorHandler(ApiException ex) {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        tracer.getCurrentSpan().tag("ApiExcepiton.Tag",new JSONObject(request.getParameterMap()).toString());
        tracer.getCurrentSpan().logEvent(ex.getMessage());
        logger.error(ex.getMessage());
        return BaseEnvelop.getError(ex.getMessage(),ex.getErrorCode());
    }
    @ResponseBody
    @ExceptionHandler(value = Exception.class)
    public BaseEnvelop myErrorHandler2(Exception ex) {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        tracer.getCurrentSpan().tag("Excepiton.Tag",new JSONObject(request.getParameterMap()).toString());
        tracer.getCurrentSpan().logEvent(ex.getMessage());
        logger.error(ex.getMessage());
        return BaseEnvelop.getError(ex.getMessage());
    }
}
//package com.yihu.jw.exception.advice;
//
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.base.BaseEnvelop;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.cloud.sleuth.Tracer;
//import org.json.JSONObject;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * 统一异常处理器
// * Created by 刘文彬 on 2018/5/9.
// */
//@ControllerAdvice
//public class MyControllerAdvice {
//    @Autowired
//    private Tracer tracer;
//    private final Logger logger = LoggerFactory.getLogger(this.getClass());
//
//
//    @ResponseBody
//    @ExceptionHandler(value = ApiException.class)
//    public BaseEnvelop myErrorHandler(ApiException ex) {
//        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//        tracer.getCurrentSpan().tag("ApiExcepiton.Tag",new JSONObject(request.getParameterMap()).toString());
//        tracer.getCurrentSpan().logEvent(ex.getMessage());
//        logger.error(ex.getMessage());
//        return BaseEnvelop.getError(ex.getMessage(),ex.getErrorCode());
//    }
//
//    @ResponseBody
//    @ExceptionHandler(value = Exception.class)
//    public BaseEnvelop myErrorHandler2(Exception ex) {
//        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//        tracer.getCurrentSpan().tag("Excepiton.Tag",new JSONObject(request.getParameterMap()).toString());
//        tracer.getCurrentSpan().logEvent(ex.getMessage());
//        logger.error(ex.getMessage());
//        return BaseEnvelop.getError(ex.getMessage());
//    }
//
//
//}

+ 10 - 3
common/common-fegin/pom.xml

@ -6,26 +6,33 @@
    <parent>
    <parent>
        <groupId>com.yihu.base</groupId>
        <groupId>com.yihu.base</groupId>
        <artifactId>common-lib-parent-pom</artifactId>
        <artifactId>common-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-fegin</artifactId>
    <artifactId>common-fegin</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
            <artifactId>common-exception</artifactId>
            <version>${parent.version}</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <version>${parent.version}</version>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
            <artifactId>common-request-mapping</artifactId>
            <version>${parent.version}</version>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <artifactId>common-rest-model-es</artifactId>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.base</groupId>

+ 1 - 1
common/common-fegin/src/main/java/com/yihu/jw/fegin/DemoFeign.java

@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
)
)
public interface DemoFeign {
public interface DemoFeign {
    @RequestMapping(value = Contants.patient.findByCode, method = RequestMethod.GET)
    @RequestMapping(value = "/demo/findByCode", method = RequestMethod.GET)
    String findByCode(@RequestParam(value = "code", required = true) String code);
    String findByCode(@RequestParam(value = "code", required = true) String code);
}
}

+ 1 - 1
common/common-fegin/src/main/java/com/yihu/jw/fegin/base/user/EmployFeign.java

@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
public interface EmployFeign {
public interface EmployFeign {
    @RequestMapping(value = BaseUserRequestMapping.BaseEmploy.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.POST)
    @RequestMapping(value = BaseUserRequestMapping.BaseEmploy.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.POST)
    Envelop create(@RequestBody String jsonData) throws JiWeiException;
    Envelop create(@RequestBody String jsonData);
    @RequestMapping(value =  BaseUserRequestMapping.BaseEmploy.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.PUT)
    @RequestMapping(value =  BaseUserRequestMapping.BaseEmploy.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.PUT)
    Envelop update(@RequestBody String jsonData) throws JiWeiException;
    Envelop update(@RequestBody String jsonData) throws JiWeiException;

+ 1 - 1
common/common-fegin/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/base/LoginFeignFallbackFactory.java

@ -30,7 +30,7 @@ public class LoginFeignFallbackFactory implements FallbackFactory<LoginFeign> {
            @Override
            @Override
            public BaseEnvelop checkoutInfo(String ssc,String idcard) {
            public BaseEnvelop checkoutInfo(String ssc,String idcard) {
                tracer.getCurrentSpan().logEvent("校验医保卡、身份证、手机号接口错误:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("校验医保卡、身份证、手机号接口错误:原因:"+e.getMessage());
                return Envelop.getError(e.getMessage(),BaseEnvelopStatus.system_error.getCode());
                return Envelop.getError(e.getMessage(), BaseEnvelopStatus.system_error.getCode());
            }
            }
            /**
            /**

+ 2 - 2
common/common-fegin/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/user/EmployeeFeignFallbackFactory.java

@ -22,10 +22,10 @@ public class EmployeeFeignFallbackFactory  implements FallbackFactory<EmployFeig
    public EmployFeign create(Throwable e) {
    public EmployFeign create(Throwable e) {
        return new EmployFeign() {
        return new EmployFeign() {
            @Override
            @Override
            public Envelop create(@RequestBody String jsonData) throws JiWeiException {
            public Envelop create(@RequestBody String jsonData){
                tracer.getCurrentSpan().logEvent("创建用户失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("创建用户失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:"+jsonData);
                tracer.getCurrentSpan().logEvent("jsonData:"+jsonData);
                throw new JiWeiException(e);
                return null;
            }
            }
            @Override
            @Override

+ 1 - 1
common/common-fegin/src/main/java/com/yihu/jw/fegin/fallbackfactory/iot/device/IotPatientDeviceFallbackFactory.java

@ -4,8 +4,8 @@ import com.yihu.jw.fegin.iot.device.IotPatientDeviceFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.LocationDataVO;
import feign.hystrix.FallbackFactory;
import feign.hystrix.FallbackFactory;
import iot.device.LocationDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;

+ 1 - 1
common/common-fegin/src/main/java/com/yihu/jw/fegin/iot/device/IotPatientDeviceFeign.java

@ -5,8 +5,8 @@ import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.LocationDataVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import iot.device.LocationDataVO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PostMapping;

+ 2 - 2
common/common-request-mapping/pom.xml

@ -6,13 +6,13 @@
    <parent>
    <parent>
        <groupId>com.yihu.base</groupId>
        <groupId>com.yihu.base</groupId>
        <artifactId>common-lib-parent-pom</artifactId>
        <artifactId>common-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-request-mapping</artifactId>
    <artifactId>common-request-mapping</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>

+ 40 - 0
common/common-rest-model-es/pom.xml

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.base</groupId>
        <artifactId>common-lib-parent-pom</artifactId>
        <version>1.0.2</version>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-rest-model-es</artifactId>
    <version>${parent.version}</version>
    <dependencies>
        <dependency>
            <groupId>io.searchbox</groupId>
            <artifactId>jest-common</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>1.5.13</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.8.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
            <version>2.1.3.RELEASE</version>
        </dependency>
    </dependencies>
</project>

+ 1 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/common/SaveModel.java

@ -1,4 +1,4 @@
package com.yihu.jw.restmodel.iot.common;
package common;
import io.searchbox.annotations.JestId;
import io.searchbox.annotations.JestId;

+ 1 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/FigureLabelDataModelVO.java

@ -1,4 +1,4 @@
package com.yihu.jw.restmodel.iot.device;
package iot.device;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.searchbox.annotations.JestId;
import io.searchbox.annotations.JestId;

+ 2 - 2
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/LocationDataVO.java

@ -1,7 +1,7 @@
package com.yihu.jw.restmodel.iot.device;
package iot.device;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.SaveModel;
import common.SaveModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;

+ 5 - 14
common/common-rest-model/pom.xml

@ -6,13 +6,13 @@
    <parent>
    <parent>
        <groupId>com.yihu.base</groupId>
        <groupId>com.yihu.base</groupId>
        <artifactId>common-lib-parent-pom</artifactId>
        <artifactId>common-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-rest-model</artifactId>
    <artifactId>common-rest-model</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>
@ -22,15 +22,16 @@
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
            <artifactId>common-util</artifactId>
            <version>${parent.version}</version>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-log</artifactId>
            <artifactId>common-log</artifactId>
        </dependency>
        </dependency>
        <!--<dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
            <artifactId>common-exception</artifactId>
        </dependency>-->
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <artifactId>jackson-annotations</artifactId>
@ -51,15 +52,5 @@
            <groupId>com.alibaba</groupId>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <artifactId>fastjson</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
            <version>2.1.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>io.searchbox</groupId>
            <artifactId>jest</artifactId>
            <version>2.4.0</version>
        </dependency>
    </dependencies>
    </dependencies>
</project>
</project>

+ 7 - 5
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/EnvelopRestController.java

@ -4,6 +4,8 @@ package com.yihu.jw.restmodel.common;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
@ -61,15 +63,15 @@ public class EnvelopRestController {
    }
    }
    //Json转实体类
    //Json转实体类
    public <T> T toEntity(String json, Class<T> entityCls) throws Exception{
//        try {
    public <T> T toEntity(String json, Class<T> entityCls) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.setDateFormat(new SimpleDateFormat(DateUtil.yyyy_MM_dd_HH_mm_ss));
            objectMapper.setDateFormat(new SimpleDateFormat(DateUtil.yyyy_MM_dd_HH_mm_ss));
            T entity = objectMapper.readValue(json, entityCls);
            T entity = objectMapper.readValue(json, entityCls);
            return entity;
            return entity;
//        } catch (IOException ex) {
//            throw new ApiException("Unable to parse json, " + ex.getMessage(), ExceptionCode.common_error_params_code);
//        }
        } catch (IOException ex) {
            throw new ApiException("Unable to parse json, " + ex.getMessage(), ExceptionCode.common_error_params_code);
        }
    }
    }
    /**
    /**

+ 2 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/base/BaseEnvelopStatus.java

@ -12,7 +12,8 @@ public enum BaseEnvelopStatus {
    status_10102("用户未登录", 10102),
    status_10102("用户未登录", 10102),
    status_10103("登陆超时", 10103),
    status_10103("登陆超时", 10103),
    status_10104("账号被挤", 10104),
    status_10104("账号被挤", 10104),
    status_10105("账号没权限", 10105),;
    status_10105("账号没权限", 10105),
    status_10106("账号已存在", 10106),;
    //------------------登陆 权限相关 end ------------------
    //------------------登陆 权限相关 end ------------------
    BaseEnvelopStatus(String name, Integer code) {
    BaseEnvelopStatus(String name, Integer code) {

+ 64 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientRelationVO.java

@ -0,0 +1,64 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Trick on 2018/5/30.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "居民信息", description = "居民信息")
public class PatientRelationVO {
    @ApiModelProperty("居民code")
    private String patient;
    @ApiModelProperty("居民姓名")
    private String patientName;
    @ApiModelProperty("年龄")
    private String age;
    @ApiModelProperty("头像")
    private String photo;
    @ApiModelProperty("出院时间")
    private String createTime;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getCreateTime() {
        return createTime;
    }
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}

+ 2 - 2
common/common-util/pom.xml

@ -6,12 +6,12 @@
    <parent>
    <parent>
        <groupId>com.yihu.base</groupId>
        <groupId>com.yihu.base</groupId>
        <artifactId>common-lib-parent-pom</artifactId>
        <artifactId>common-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-util</artifactId>
    <artifactId>common-util</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>

+ 0 - 0
data/elasticsearch/nodes/0/node.lock


+ 27 - 0
server/svr-admin-server/pom.xml

@ -64,4 +64,31 @@
            <artifactId>servo-core</artifactId>
            <artifactId>servo-core</artifactId>
        </dependency>
        </dependency>
    </dependencies>
    </dependencies>
    <build>
        <finalName>svr-admin-server</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>com.yihu.admin.AdminServer</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
</project>

+ 5 - 5
server/svr-configuration/pom.xml

@ -14,7 +14,7 @@
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-configuration</artifactId>
    <artifactId>svr-configuration</artifactId>
    <version>1.0.0</version>
    <version>1.0.0</version>
    <packaging>war</packaging>
    <packaging>jar</packaging>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>
@ -29,10 +29,10 @@
            <groupId>org.springframework.cloud</groupId>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter</artifactId>
            <artifactId>spring-cloud-starter</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-security</artifactId>-->
        <!--</dependency>-->
        <dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <artifactId>spring-boot-starter-actuator</artifactId>

+ 5 - 0
server/svr-configuration/src/main/resources/application.yml

@ -22,6 +22,11 @@ management:
  security:
  security:
    enabled: false
    enabled: false
logging:
  file: ${logging.path}svr-configuration.log
  path: G:\idea_workspace\jkzl_git\jkzl-start\logs\
  level:
    root: INFO
---
---
spring:
spring:

+ 5 - 5
server/svr-configuration/src/main/resources/bootstrap.yml

@ -6,10 +6,10 @@ spring:
security:
  user:
    name: jw
    password:  jkzl
#security:
#  user:
#    name: jw
#    password:  jkzl
eureka:
eureka:
  client:
  client:
@ -39,7 +39,7 @@ spring:
      server:
      server:
        git:
        git:
          uri: http://192.168.1.220:10080/jiwei/wlyy2.0.config.git
          uri: http://192.168.1.220:10080/jiwei/wlyy2.0.config.git
        default-label: master
        default-label: jwdev
---
---

+ 1 - 1
server/svr-discovery/pom.xml

@ -13,7 +13,7 @@
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-discovery</artifactId>
    <artifactId>svr-discovery</artifactId>
    <version>1.0.0</version>
    <version>1.0.0</version>
    <packaging>war</packaging>
    <packaging>jar</packaging>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>

+ 1 - 1
server/svr-discovery/src/main/resources/application.yml

@ -16,7 +16,7 @@ eureka:
    fetch-registry: false #如果是做高可用的发现服务那就要改成true
    fetch-registry: false #如果是做高可用的发现服务那就要改成true
  server:
  server:
    enable-self-preservation: true  #是否开启自我保护模式,默认为true。
    enable-self-preservation: false  #是否开启自我保护模式,默认为true。
    eviction-interval-timer-in-ms: 60000 #eureka server清理无效节点的时间间隔,默认60000毫秒,即60秒
    eviction-interval-timer-in-ms: 60000 #eureka server清理无效节点的时间间隔,默认60000毫秒,即60秒

+ 69 - 0
server/svr-yihu-admin-server/pom.xml

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>jkzl-start</artifactId>
        <groupId>com.yihu</groupId>
        <version>1.0.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>svr-yihu-admin-server</artifactId>
    <properties>
        <version.yihu.admin>1.2.0</version.yihu.admin>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>admin-server-starter</artifactId>
            <version>${version.yihu.admin}</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>admin-server-ui-starter</artifactId>
            <version>${version.yihu.admin}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
    </dependencies>
    <build>
        <finalName>svr-yihu-admin-server</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>com.yihu.admin.AdminServer</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

+ 5 - 0
server/svr-yihu-admin-server/readme.MD

@ -0,0 +1,5 @@
监测服务器
http://192.168.131.102:8999/admin/index/index.html
官网地址
http://codecentric.github.io/spring-boot-admin/1.5.3/#_reminder_notifications

+ 33 - 0
server/svr-yihu-admin-server/src/main/java/com.yihu.admin/YihuAdminServer.java

@ -0,0 +1,33 @@
package com.yihu.admin;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.annotation.Configuration;
/**
 * Created by chenweida on 2017/8/15.
 */
@SpringBootApplication(exclude = {
        JestAutoConfiguration.class,
        ElasticsearchAutoConfiguration.class,
        ElasticsearchRepositoriesAutoConfiguration.class,
        ElasticsearchDataAutoConfiguration.class,
        DataSourceAutoConfiguration.class,
        JdbcTemplateAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class
})
public class YihuAdminServer {
    public static void main(String[] args) {
        SpringApplication.run(YihuAdminServer.class, args);
    }
}

+ 66 - 0
server/svr-yihu-admin-server/src/main/resources/application.yml

@ -0,0 +1,66 @@
server:
  port: 8999  ##端口修改 前端工程也需要改造
spring:
  application:
    name: svr-yihu-admin-server
  data:
    elasticsearch:
      jest:
        discovery-enabled: false #开启嗅探
        conn-timeout: 60 # 连接时间单位是秒
        read-timeout: 60 # 读取时间单位是秒
        multith-readed: true #开启多线程
        max-total-connection: 50 ##最大连接
        max-connection-idle-time: 50 #最大等待时间
  elasticsearch:
    jest:
      read-timeout: ${spring.data.elasticsearch.jest.read-timeout}
      multith-readed: ${spring.data.elasticsearch.jest.multith-readed}
logging:
  file: ${logging.path}svr-yihu-admin-server.log
  path: G:\idea_workspace\jkzl_git\jkzl-start\logs\
  level:
    root: INFO
management:
  health:
    db:
      enabled: false
---
spring:
  profiles: jwdev
  data:
    elasticsearch:
      cluster-name: jkzl #es集群的名字
      cluster-nodes: 172.19.103.68:9300  #多个逗号分割
      cluster-nodes-jest:  http://172.19.103.68:9200 #多个逗号分割
  elasticsearch:
    jest:
      uris: ${spring.data.elasticsearch.cluster-nodes-jest}
---
spring:
  profiles: jwtest
  data:
    elasticsearch:
      cluster-name: jkzl #es集群的名字
      cluster-nodes: 172.19.103.68:9300  #多个逗号分割
      cluster-nodes-jest: http://172.19.103.68:9200  #多个逗号分割
---
spring:
  profiles: jwprod
  data:
    elasticsearch:
      cluster-name: jkzl #es集群的名字
      cluster-nodes: 172.19.103.68:9300  #多个逗号分割
      cluster-nodes-jest: http://172.19.103.68:9200  #多个逗号分割

+ 17 - 0
server/svr-yihu-admin-server/src/main/resources/bootstrap.yml

@ -0,0 +1,17 @@
##发现服务的地址
eureka:
  client:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@127.0.0.1:8761//eureka/
  instance:
    #eurika使用IP不使用host
    prefer-ip-address: true
    #定制化在eurika中显示的名称
    ##instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}
    instance-id: ${spring.cloud.client.ipAddress}:${server.port}
management:
  security:
    enabled: false

+ 4 - 0
server/svr-yihu-admin-server/src/main/resources/logback.xml

@ -0,0 +1,4 @@
<configuration>
    <include resource="org/springframework/boot/logging/logback/base.xml"/>
    <jmxConfigurator/>
</configuration>

+ 50 - 13
svr-lib-parent-pom/pom.xml

@ -11,7 +11,7 @@
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-lib-parent-pom</artifactId>
    <artifactId>svr-lib-parent-pom</artifactId>
    <version>1.0.0</version>
    <version>1.0.2</version>
    <packaging>pom</packaging>
    <packaging>pom</packaging>
    <developers>
    <developers>
        <developer>
        <developer>
@ -27,9 +27,9 @@
    <!--deploy 的时候发布到这个服务器-->
    <!--deploy 的时候发布到这个服务器-->
    <distributionManagement>
    <distributionManagement>
        <repository>
        <repository>
            <id>test</id>
            <name>testRespository</name>
            <url>http://172.19.103.43:8081/nexus/content/repositories/test/</url>
            <id>jkzlRepositories</id>
            <name>jkzlRepositories</name>
            <url>http://172.19.103.43:8081/nexus/content/repositories/jkzlRepositories/</url>
        </repository>
        </repository>
    </distributionManagement>
    </distributionManagement>
    <modules>
    <modules>
@ -38,6 +38,7 @@
        <module>../server/svr-discovery</module><!--发现服务-->
        <module>../server/svr-discovery</module><!--发现服务-->
        <module>../server/svr-dashboard</module><!--监控服务-->
        <module>../server/svr-dashboard</module><!--监控服务-->
        <module>../server/svr-logServer</module><!--分布式追踪服务-->
        <module>../server/svr-logServer</module><!--分布式追踪服务-->
        <module>../server/svr-yihu-admin-server</module><!--分布式追踪服务-->
        <!--业务微服务-->
        <!--业务微服务-->
        <module>../svr/svr-base</module><!--基础微服务-->
        <module>../svr/svr-base</module><!--基础微服务-->
@ -53,7 +54,7 @@
    <properties>
    <properties>
        <version.mysql>5.1.38</version.mysql>
        <version.mysql>5.1.38</version.mysql>
        <version.jackson>2.8.1</version.jackson>
        <version.jackson>2.8.1</version.jackson>
        <version.myCommon>1.0.0</version.myCommon>
        <version.myCommon>1.0.2</version.myCommon>
        <version.spring-data-hadoop>2.3.0.RELEASE</version.spring-data-hadoop>
        <version.spring-data-hadoop>2.3.0.RELEASE</version.spring-data-hadoop>
        <version.springside>4.2.3-GA</version.springside>
        <version.springside>4.2.3-GA</version.springside>
        <version.zipkin>1.24.0</version.zipkin>
        <version.zipkin>1.24.0</version.zipkin>
@ -87,10 +88,26 @@
        <asciidoctor.maven.plugin.version>1.5.5</asciidoctor.maven.plugin.version>
        <asciidoctor.maven.plugin.version>1.5.5</asciidoctor.maven.plugin.version>
        <asciidoctorj.version>1.5.5</asciidoctorj.version>
        <asciidoctorj.version>1.5.5</asciidoctorj.version>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
        <version.yihu.admin>1.2.0</version.yihu.admin>
    </properties>
    </properties>
    <!--dependencyManagement作用子配置不写版本默认继承父配置-->
    <!--dependencyManagement作用子配置不写版本默认继承父配置-->
    <dependencyManagement>
    <dependencyManagement>
        <dependencies>
        <dependencies>
            <dependency>
                <groupId>com.yihu</groupId>
                <artifactId>admin-client-starter</artifactId>
                <version>${version.yihu.admin}</version>
            </dependency>
            <dependency>
                <groupId>com.yihu</groupId>
                <artifactId>admin-server-starter</artifactId>
                <version>${version.yihu.admin}</version>
            </dependency>
            <dependency>
                <groupId>com.yihu</groupId>
                <artifactId>admin-server-ui-starter</artifactId>
                <version>${version.yihu.admin}</version>
            </dependency>
            <!--服务器监监听-->
            <!--服务器监监听-->
            <dependency>
            <dependency>
                <groupId>de.codecentric</groupId>
                <groupId>de.codecentric</groupId>
@ -123,11 +140,11 @@
            <dependency>
            <dependency>
                <groupId>com.yihu.base</groupId>
                <groupId>com.yihu.base</groupId>
                <artifactId>common-async</artifactId>
                <artifactId>common-async</artifactId>
                <version>${version.myCommon}</version>
                <version>1.0.0</version>
            </dependency>
            </dependency>
            <dependency>
            <dependency>
                <groupId>com.yihu.base</groupId>
                <artifactId>common-security</artifactId>
                <groupId>com.yihu.jw</groupId>
                <artifactId>common-fegin</artifactId>
                <version>${version.myCommon}</version>
                <version>${version.myCommon}</version>
            </dependency>
            </dependency>
            <dependency>
            <dependency>
@ -150,6 +167,11 @@
                <artifactId>common-rest-model</artifactId>
                <artifactId>common-rest-model</artifactId>
                <version>${version.myCommon}</version>
                <version>${version.myCommon}</version>
            </dependency>
            </dependency>
            <dependency>
                <groupId>com.yihu.jw</groupId>
                <artifactId>common-rest-model-es</artifactId>
                <version>${version.myCommon}</version>
            </dependency>
            <dependency>
            <dependency>
                <groupId>com.yihu.jw</groupId>
                <groupId>com.yihu.jw</groupId>
                <artifactId>svr-base</artifactId>
                <artifactId>svr-base</artifactId>
@ -163,22 +185,22 @@
            <dependency>
            <dependency>
                <groupId>com.yihu.base</groupId>
                <groupId>com.yihu.base</groupId>
                <artifactId>common-swagger</artifactId>
                <artifactId>common-swagger</artifactId>
                <version>${version.myCommon}</version>
                <version>1.0.0</version>
            </dependency>
            </dependency>
            <dependency>
            <dependency>
                <groupId>com.yihu.base</groupId>
                <groupId>com.yihu.base</groupId>
                <artifactId>common-data-mysql</artifactId>
                <artifactId>common-data-mysql</artifactId>
                <version>${version.myCommon}</version>
                <version>1.0.0</version>
            </dependency>
            </dependency>
            <dependency>
            <dependency>
                <groupId>com.yihu.base</groupId>
                <groupId>com.yihu.base</groupId>
                <artifactId>common-log</artifactId>
                <artifactId>common-log</artifactId>
                <version>${version.myCommon}</version>
                <version>1.0.0</version>
            </dependency>
            </dependency>
            <dependency>
            <dependency>
                <groupId>com.yihu.base</groupId>
                <groupId>com.yihu.base</groupId>
                <artifactId>common-quartz</artifactId>
                <artifactId>common-quartz</artifactId>
                <version>${version.myCommon}</version>
                <version>1.0.0</version>
            </dependency>
            </dependency>
            <!--数据库驱动 start-->
            <!--数据库驱动 start-->
            <dependency>
            <dependency>
@ -252,7 +274,7 @@
            <dependency>
            <dependency>
                <groupId>com.yihu.base</groupId>
                <groupId>com.yihu.base</groupId>
                <artifactId>common-data-fastdfs</artifactId>
                <artifactId>common-data-fastdfs</artifactId>
                <version>${version.myCommon}</version>
                <version>1.0.0</version>
            </dependency>
            </dependency>
            <dependency>
            <dependency>
                <groupId>org.csource</groupId>
                <groupId>org.csource</groupId>
@ -487,6 +509,21 @@
                </configuration>
                </configuration>
                <version>3.1</version>
                <version>3.1</version>
            </plugin>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!--编译插件 end-->
            <!--编译插件 end-->
            <plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <groupId>org.asciidoctor</groupId>

+ 31 - 18
svr/svr-base/pom.xml

@ -6,32 +6,45 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-base</artifactId>
    <artifactId>svr-base</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <packaging>war</packaging>
    <dependencies>
    <dependencies>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>admin-client-starter</artifactId>
            <version>${version.yihu.admin}</version>
        </dependency>
        <!--公共的 start-->
        <!--公共的 start-->
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.data</groupId>
                    <artifactId>spring-data-elasticsearch</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
            <artifactId>common-entity</artifactId>
            <exclusions>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.data</groupId>
                    <artifactId>spring-data-elasticsearch</artifactId>
                </exclusion>
                <exclusion>
                <exclusion>
                    <groupId>com.yihu.base</groupId>
                    <groupId>com.yihu.base</groupId>
                    <artifactId>common-data-es</artifactId>
                    <artifactId>common-data-es</artifactId>
                </exclusion>
                </exclusion>
            </exclusions>
            </exclusions>
        </dependency>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>com.yihu</groupId>-->
            <!--<artifactId>common-data-es-starter</artifactId>-->
            <!--<version>1.1.0</version>-->
        <!--</dependency>-->
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
            <artifactId>common-request-mapping</artifactId>
@ -44,10 +57,6 @@
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
            <artifactId>common-util</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-swagger</artifactId>
            <artifactId>common-swagger</artifactId>
@ -66,10 +75,10 @@
            <groupId>org.springframework.boot</groupId>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <artifactId>spring-boot-starter-web</artifactId>
            <!--<exclusions>-->
            <!--<exclusions>-->
                <!--<exclusion>-->
                    <!--<groupId>org.springframework.boot</groupId>-->
                    <!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
                <!--</exclusion>-->
            <!--<exclusion>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
            <!--</exclusion>-->
            <!--</exclusions>-->
            <!--</exclusions>-->
        </dependency>
        </dependency>
        <dependency>
        <dependency>
@ -168,9 +177,13 @@
            <version>1.0.0</version>
            <version>1.0.0</version>
        </dependency>
        </dependency>
        <!--<dependency>-->
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-data-redis</artifactId>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-starter-data-redis</artifactId>-->
        <!--</dependency>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
        </dependency>
    </dependencies>
    </dependencies>
    <build>
    <build>
        <finalName>svr-base</finalName>
        <finalName>svr-base</finalName>

+ 7 - 2
svr/svr-base/src/main/java/com/yihu/jw/SvrBaseApplication.java

@ -6,9 +6,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@ -26,11 +26,16 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@ComponentScan(basePackages={"com"})
@ComponentScan(basePackages={"com"})
@EnableJpaAuditing
@EnableJpaAuditing
@EnableAutoConfiguration(exclude = {
@EnableAutoConfiguration(exclude = {
        ElasticsearchRepositoriesAutoConfiguration.class
        ElasticsearchAutoConfiguration.class,
        ElasticsearchRepositoriesAutoConfiguration.class,
        ElasticsearchDataAutoConfiguration.class,
        JestAutoConfiguration.class
})
})
public class SvrBaseApplication {
public class SvrBaseApplication {
    public static void main(String[] args) {
    public static void main(String[] args) {
        SpringApplication.run(SvrBaseApplication.class, args);
        SpringApplication.run(SvrBaseApplication.class, args);
    }
    }
}
}

+ 38 - 0
svr/svr-base/src/main/java/com/yihu/jw/business/demo/DemoController.java

@ -0,0 +1,38 @@
package com.yihu.jw.business.demo;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.exception.SystemException;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.fegin.DemoFeign;
import com.yihu.jw.restmodel.common.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
 * Created by chenweida on 2017/5/10.
 */
@RestController
@RequestMapping("/demo")
@Api(description = "demo例子")
@RefreshScope
public class DemoController {
    @ApiOperation(value = "根据code查找患者")
    @GetMapping(value = "findByCode")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "患者code", required = true) @RequestParam(value = "code", required = true) String code) {
        return  Envelop.getSuccess(code);
    }
}

+ 115 - 122
svr/svr-base/src/main/java/com/yihu/jw/business/login/contorller/LoginController.java

@ -1,123 +1,116 @@
package com.yihu.jw.business.login.contorller;
//import com.yihu.base.security.properties.SecurityProperties;
//import com.yihu.base.security.sms.mobile.MobileCheck;
//import com.yihu.base.security.sms.process.SmsValidateCodeProcessor;
import com.yihu.jw.base.user.BaseEmployDO;
import com.yihu.jw.business.login.service.LoginService;
import com.yihu.jw.business.user.dao.EmployDao;
import com.yihu.jw.business.user.service.EmployService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.fegin.common.security.LoginSmsFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.rm.base.BaseLoginRequestMapping;
import com.yihu.jw.rm.base.BaseUserRequestMapping;
import com.yihu.jw.util.common.ConvertToSpellUtils;
import com.yihu.jw.util.security.MD5;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.bouncycastle.util.encoders.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.InetAddress;
import java.util.UUID;
/**
 * Created by 刘文彬 on 2018/4/11.
 */
@RestController
@RequestMapping(BaseLoginRequestMapping.api_common)
@Api(description = "注册账户(医生端、微信端、用户端)")
public class LoginController extends EnvelopRestController {
    @Autowired
    private LoginService loginService;
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_checkoutInfo, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "注册校验信息", notes = "注册校验姓名、身份证、医保卡号信息")
    public BaseEnvelop checkoutInfo(@ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc,
                                    @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard) throws ApiException{
        //校验姓名、身份证以及医保卡号信息是否正确
//        throw new IOException();
        return null;
    }
    /**
     * 注册账号-提交
     * @param mobilePhone
     * @param saasId
     * @param type
     * @param captcha
     * @param name
     * @param password
     * @param idcard
     * @param ssc
     * @return
     */
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_accountSub, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "注册账号", notes = "注册账号")
    public Envelop register(
            @ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = true) @RequestParam(value = "mobilePhone", required = true) String mobilePhone,
            @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
            @ApiParam(name = "type", value = "1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录", required = true) @RequestParam(value = "type", required = true) int type,
            @ApiParam(name = "captcha", value = "短信验证码", required = true) @RequestParam(value = "captcha", required = true) String captcha,
            @ApiParam(name = "name", value = "姓名", required = true) @RequestParam(value = "name", required = true) String name,
            @ApiParam(name = "password", value = "账户密码", required = true) @RequestParam(value = "password", required = true) String password,
            @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard,
            @ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc) throws Exception{
        //判断验证码是否正确
        Envelop envelop = new Envelop();//smsService.checkSms(mobilePhone,saasId,type,captcha);
        if(true){//if(envelop.getStatus()==200){
            return loginService.register(mobilePhone,password,saasId,name,idcard,ssc);
        }else{
            return envelop;
        }
    }
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_login, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Envelop login(@ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = false) @RequestParam(value = "mobilePhone", required = false) String mobilePhone,
                      @ApiParam(name = "password", value = "password", required = false) @RequestParam(value = "password", required = false) String password,
                      @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
                         @ApiParam(name = "captcha", value = "短信验证码", required = false) @RequestParam(value = "captcha", required = false) String captcha){
       try{
           return loginService.login(mobilePhone,password,saasId,captcha);
       }catch (ApiException e){
           e.printStackTrace();
           return Envelop.getError(e.getMessage(),e.getErrorCode());
       }catch (Exception e){
           e.printStackTrace();
           return Envelop.getError("",100);
       }
    }
//    @PostMapping("/logout")
//    public Envelop logout(){
//        HttpHeaders headers = new HttpHeaders();
//        headers.add("Accept", "*/*");
//        headers.add("Cache-Control", "no-cache");
//        RestTemplate restTemplate = new RestTemplate();
//        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
//        //设置http请求实体
//        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
//        restTemplate.postForObject("http://localhost:8088/logout", requestEntity, String.class);
//        return new Envelop();
//package com.yihu.jw.business.login.contorller;
//
////import com.yihu.base.security.properties.SecurityProperties;
////import com.yihu.base.security.sms.mobile.MobileCheck;
////import com.yihu.base.security.sms.process.SmsValidateCodeProcessor;
//import com.yihu.jw.base.user.BaseEmployDO;
//import com.yihu.jw.business.login.service.LoginService;
//import com.yihu.jw.business.user.dao.EmployDao;
//import com.yihu.jw.business.user.service.EmployService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.fegin.common.security.LoginSmsFeign;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.restmodel.common.base.BaseEnvelop;
//import com.yihu.jw.rm.base.BaseLoginRequestMapping;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import com.yihu.jw.util.common.ConvertToSpellUtils;
//import com.yihu.jw.util.security.MD5;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.bouncycastle.util.encoders.Base64;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.http.HttpEntity;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.MediaType;
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.client.RestTemplate;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.net.InetAddress;
//import java.util.UUID;
//
///**
// * Created by 刘文彬 on 2018/4/11.
// */
//@RestController
//@RequestMapping(BaseLoginRequestMapping.api_common)
//@Api(description = "注册账户(医生端、微信端、用户端)")
//public class LoginController extends EnvelopRestController {
//
//    @Autowired
//    private LoginService loginService;
//
//
//    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_checkoutInfo, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "注册校验信息", notes = "注册校验姓名、身份证、医保卡号信息")
//    public BaseEnvelop checkoutInfo(@ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc,
//                                    @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard) throws ApiException{
//
//        //校验姓名、身份证以及医保卡号信息是否正确
////        throw new IOException();
//        return null;
//    }
//    }
}
//
//    /**
//     * 注册账号-提交
//     * @param mobilePhone
//     * @param saasId
//     * @param type
//     * @param captcha
//     * @param name
//     * @param password
//     * @param idcard
//     * @param ssc
//     * @return
//     */
//    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_accountSub, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "注册账号", notes = "注册账号")
//    public Envelop register(
//            @ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = true) @RequestParam(value = "mobilePhone", required = true) String mobilePhone,
//            @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
//            @ApiParam(name = "type", value = "1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录", required = true) @RequestParam(value = "type", required = true) int type,
//            @ApiParam(name = "captcha", value = "短信验证码", required = true) @RequestParam(value = "captcha", required = true) String captcha,
//            @ApiParam(name = "name", value = "姓名", required = true) @RequestParam(value = "name", required = true) String name,
//            @ApiParam(name = "password", value = "账户密码", required = true) @RequestParam(value = "password", required = true) String password,
//            @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard,
//            @ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc) throws Exception{
//        //判断验证码是否正确
//        Envelop envelop = new Envelop();//smsService.checkSms(mobilePhone,saasId,type,captcha);
//        if(true){//if(envelop.getStatus()==200){
//            return loginService.register(mobilePhone,password,saasId,name,idcard,ssc);
//        }else{
//            return envelop;
//        }
//    }
//
//    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_login, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    public Envelop login(@ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = false) @RequestParam(value = "mobilePhone", required = false) String mobilePhone,
//                      @ApiParam(name = "password", value = "password", required = false) @RequestParam(value = "password", required = false) String password,
//                      @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
//                         @ApiParam(name = "captcha", value = "短信验证码", required = false) @RequestParam(value = "captcha", required = false) String captcha) throws ApiException,Exception{
//
//        return loginService.login(mobilePhone,password,saasId,captcha);
//    }
//
////    @PostMapping("/logout")
////    public Envelop logout(){
////        HttpHeaders headers = new HttpHeaders();
////        headers.add("Accept", "*/*");
////        headers.add("Cache-Control", "no-cache");
////        RestTemplate restTemplate = new RestTemplate();
////        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
////        //设置http请求实体
////        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
////        restTemplate.postForObject("http://localhost:8088/logout", requestEntity, String.class);
////        return new Envelop();
////    }
//
//}

+ 124 - 125
svr/svr-base/src/main/java/com/yihu/jw/business/login/service/LoginService.java

@ -1,130 +1,129 @@
package com.yihu.jw.business.login.service;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.base.login.BaseLoginAccountDO;
import com.yihu.jw.base.user.BaseEmployDO;
import com.yihu.jw.business.user.dao.EmployDao;
import com.yihu.jw.business.user.service.EmployService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelopStatus;
import com.yihu.jw.rm.base.BaseLoginRequestMapping;
import com.yihu.jw.util.common.ConvertToSpellUtils;
import com.yihu.jw.util.security.MD5;
import io.swagger.annotations.ApiParam;
import org.bouncycastle.util.encoders.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
import java.beans.Transient;
import java.util.UUID;
/**
 * Created by 刘文彬 on 2018/4/26.
 */
@Service
public class LoginService  extends BaseJpaService<BaseEmployDO,EmployDao> {
    @Autowired
    private EmployDao employDao;
    @Autowired
    private EmployService employService;
    @Value("${server.web-gateway-port}")
    private String port;
    public BaseEnvelop checkoutInfo(){
        //校验姓名、身份证以及医保卡号信息是否正确
        return null;
    }
    @Transactional
    public Envelop register(String mobilePhone,String password,String saasId,String name,String idcard,String ssc) throws Exception {
        //判断账号是否重复
        BaseEmployDO baseEmployDO = employDao.findByPhoneAndSaasId(mobilePhone,saasId);
        if(baseEmployDO!=null){
            return Envelop.getError("该手机号已注册!");
        }
        //保存账户基础信息
        BaseEmployDO employeeDO = new BaseEmployDO();
        employeeDO.setId(UUID.randomUUID().toString().replaceAll("-", ""));
        employeeDO.setSaasId(saasId);
        employeeDO.setName(name);
        employeeDO.setPyCode(ConvertToSpellUtils.changeToInitialPinYin(name));
        employeeDO.setIdcard(idcard);
        employeeDO.setSsc(ssc);
        employeeDO.setPhone(mobilePhone);
        String salt= UUID.randomUUID().toString().replace("-","");
        employeeDO.setSalt(salt);
        employeeDO.setPassword(MD5.GetMD5Code(password + salt));
        employService.createBaseEmployDO(employeeDO);
        return login(employeeDO.getPhone(),employeeDO.getPassword(),saasId,"");
    }
    public Envelop login(String mobilePhone,String password,String saasId,String captcha) throws Exception{
        BaseEmployDO baseEmployDO = employService.findByPhoneAndSaasId(mobilePhone,saasId);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Accept", "*/*");
        headers.add("Cache-Control", "no-cache");
        //client_id:client_securt
        byte[] a = Base64.encode((saasId+":").getBytes());
        String client_id = new String(a);
        headers.add("Authorization","Basic "+client_id);//MTox
        String token = "";
        //传参数JSON格式
        //  封装参数,千万不要替换为Map与HashMap,否则参数无法传递
        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
        //判断是短信登录还是账号密码登录
        if(StringUtils.isEmpty(captcha)){
            //  也支持中文
            params.add("username", mobilePhone+","+saasId);
            params.add("password", MD5.GetMD5Code(password+baseEmployDO.getSalt()));
            //设置http请求实体
            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
            RestTemplate restTemplate = new RestTemplate();
            token = restTemplate.postForObject("http://localhost:"+port+"/authentication/form", requestEntity, String.class);
        }else{
            params.add("mobile", mobilePhone+","+saasId);
            params.add("sms", captcha);
            //设置http请求实体
            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
            RestTemplate restTemplate = new RestTemplate();
            token = restTemplate.postForObject("http://localhost:"+port+"/authentication/mobile", requestEntity, String.class);
        }
        if(!StringUtils.isEmpty(token)){
            return Envelop.getSuccess("登录成功!",token);
        }else{
            return Envelop.getError("登录失败!");
        }
    }
//    public Envelop logout(){
//package com.yihu.jw.business.login.service;
//
//import com.yihu.base.mysql.query.BaseJpaService;
//import com.yihu.jw.base.login.BaseLoginAccountDO;
//import com.yihu.jw.base.user.BaseEmployDO;
//import com.yihu.jw.business.user.dao.EmployDao;
//import com.yihu.jw.business.user.service.EmployService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.base.BaseEnvelop;
//import com.yihu.jw.rm.base.BaseLoginRequestMapping;
//import com.yihu.jw.util.common.ConvertToSpellUtils;
//import com.yihu.jw.util.security.MD5;
//import io.swagger.annotations.ApiParam;
//import org.bouncycastle.util.encoders.Base64;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.http.HttpEntity;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.client.RestTemplate;
//
//import java.beans.Transient;
//import java.util.UUID;
//
///**
// * Created by 刘文彬 on 2018/4/26.
// */
//@Service
//public class LoginService  extends BaseJpaService<BaseEmployDO,EmployDao> {
//
//    @Autowired
//    private EmployDao employDao;
//    @Autowired
//    private EmployService employService;
//
//    @Value("${server.web-gateway-port}")
//    private String port;
//    public BaseEnvelop checkoutInfo(){
//
//        //校验姓名、身份证以及医保卡号信息是否正确
//
//        return null;
//    }
//
//    @Transactional
//    public Envelop register(String mobilePhone,String password,String saasId,String name,String idcard,String ssc) throws Exception {
//
//        //判断账号是否重复
//        BaseEmployDO baseEmployDO = employService.findByPhoneAndSaasId(mobilePhone,saasId);
//        if(baseEmployDO!=null){
//            return Envelop.getError("该手机号已注册!");
//        }
//
//        //保存账户基础信息
//        BaseEmployDO employeeDO = new BaseEmployDO();
//        employeeDO.setId(UUID.randomUUID().toString().replaceAll("-", ""));
//        employeeDO.setSaasId(saasId);
//        employeeDO.setName(name);
//        employeeDO.setPyCode(ConvertToSpellUtils.changeToInitialPinYin(name));
//        employeeDO.setIdcard(idcard);
//        employeeDO.setSsc(ssc);
//        employeeDO.setPhone(mobilePhone);
//        String salt= UUID.randomUUID().toString().replace("-","");
//        employeeDO.setSalt(salt);
//        employeeDO.setPassword(MD5.GetMD5Code(password + salt));
//        employService.createBaseEmployDO(employeeDO);
//
//        return login(employeeDO.getPhone(),employeeDO.getPassword(),saasId,"");
//    }
//
//
//    public Envelop login(String mobilePhone,String password,String saasId,String captcha) throws Exception{
//        BaseEmployDO baseEmployDO = employService.findByPhoneAndSaasId(mobilePhone,saasId);
//        HttpHeaders headers = new HttpHeaders();
//        HttpHeaders headers = new HttpHeaders();
//        headers.add("Accept", "*/*");
//        headers.add("Accept", "*/*");
//        headers.add("Cache-Control", "no-cache");
//        headers.add("Cache-Control", "no-cache");
//        RestTemplate restTemplate = new RestTemplate();
//        //client_id:client_securt
//        byte[] a = Base64.encode((saasId+":").getBytes());
//        String client_id = new String(a);
//        headers.add("Authorization","Basic "+client_id);//MTox
//        String token = "";
//        //传参数JSON格式
//        //  封装参数,千万不要替换为Map与HashMap,否则参数无法传递
//        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
//        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
//        //设置http请求实体
//        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
//        restTemplate.postForObject("http://localhost:"+port+"/logout", requestEntity, String.class);
//        //判断是短信登录还是账号密码登录
//        if(StringUtils.isEmpty(captcha)){
//
//            //  也支持中文
//            params.add("username", mobilePhone+","+saasId);
//            params.add("password", MD5.GetMD5Code(password+baseEmployDO.getSalt()));
//            //设置http请求实体
//            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
//            RestTemplate restTemplate = new RestTemplate();
//            token = restTemplate.postForObject("http://localhost:"+port+"/authentication/form", requestEntity, String.class);
//        }else{
//            params.add("mobile", mobilePhone+","+saasId);
//            params.add("sms", captcha);
//            //设置http请求实体
//            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
//            RestTemplate restTemplate = new RestTemplate();
//            token = restTemplate.postForObject("http://localhost:"+port+"/authentication/mobile", requestEntity, String.class);
//        }
//
//        if(!StringUtils.isEmpty(token)){
//            return Envelop.getSuccess("登录成功!",token);
//        }else{
//            return Envelop.getError("登录失败!");
//        }
//    }
//    }
}
//
////    public Envelop logout(){
////        HttpHeaders headers = new HttpHeaders();
////        headers.add("Accept", "*/*");
////        headers.add("Cache-Control", "no-cache");
////        RestTemplate restTemplate = new RestTemplate();
////        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
////        //设置http请求实体
////        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
////        restTemplate.postForObject("http://localhost:"+port+"/logout", requestEntity, String.class);
////    }
//}

+ 10 - 10
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/EmployController.java

@ -36,16 +36,16 @@ public class EmployController extends EnvelopRestController {
    @Autowired
    @Autowired
    private EmployService employService;
    private EmployService employService;
//    @PostMapping(value = BaseUserRequestMapping.BaseEmploy.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建用户", notes = "创建单个用户")
//    public Envelop createBaseEmployDO(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseEmployDO baseEmployDO = toEntity(jsonData,BaseEmployDO.class);
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_create,employService.createBaseEmployDO(baseEmployDO));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
    @PostMapping(value = BaseUserRequestMapping.BaseEmploy.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建用户", notes = "创建单个用户")
    public Envelop createBaseEmployDO(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
        try{
            BaseEmployDO baseEmployDO = toEntity(jsonData,BaseEmployDO.class);
            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_create,employService.createBaseEmployDO(baseEmployDO));
        } catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
//    @PostMapping(value = BaseUserRequestMapping.BaseEmploy.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @PostMapping(value = BaseUserRequestMapping.BaseEmploy.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "修改用户", notes = "修改用户")
//    @ApiOperation(value = "修改用户", notes = "修改用户")

+ 18 - 13
svr/svr-base/src/main/resources/application.yml

@ -2,21 +2,22 @@
spring:
spring:
  application:
  application:
    name: svr-base  #注册到发现服务的id 如果id一样 eurika会自动做负载
    name: svr-base  #注册到发现服务的id 如果id一样 eurika会自动做负载
#  jmx:
#    default-domain: svr-base
  jmx:
  jmx:
    default-domain: svr-base
    enabled: true
    enabled: true
  data:
    elasticsearch:
      cluster-name: jkzl #es集群的名字
      cluster-nodes: 172.19.103.68:9300  #多个逗号分割
      cluster-nodes-jest: http://172.19.103.68:9200  #多个逗号分割
      repositories:
        enabled: false
      properties:
        client:
          transport:
            sniff: false #开启嗅探集群  用nginx代理一层过后会出现ip解析失败问题
#  data:
#    elasticsearch:
#      cluster-name: jkzl #es集群的名字
#      cluster-nodes: 172.19.103.68:9300  #多个逗号分割
#      cluster-nodes-jest: http://172.19.103.68:9200  #多个逗号分割
#      repositories:
#        enabled: true
#      properties:
#        client:
#          transport:
#            sniff: false #开启嗅探集群  用nginx代理一层过后会出现ip解析失败问题
@ -32,7 +33,11 @@ endpoints:
  info:
  info:
    enabled: true
    enabled: true
yihu:
  admin:
    client:
      advice:
        sql: true
---
---
spring:
spring:

+ 1 - 1
svr/svr-base/src/main/resources/bootstrap.yml

@ -28,7 +28,7 @@ eureka:
    serviceUrl:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      #http://账号:密码@127.0.0.1:8761/eureka/
#      defaultZone: http://jw:jkzl@172.19.103.33:8761//eureka/
#      defaultZone: http://jw:jkzl@172.19.103.33:8761//eureka/
      defaultZone: http://jw:jkzl@192.168.131.131:8761/eureka/
      defaultZone: http://jw:jkzl@192.168.131.102:8761/eureka/
---
---
spring:
spring:

+ 2 - 2
svr/svr-demo/pom.xml

@ -6,12 +6,12 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <artifactId>svr-demo</artifactId>
    <artifactId>svr-demo</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>

+ 6 - 2
svr/svr-iot/pom.xml

@ -6,13 +6,13 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.iot</groupId>
    <groupId>com.yihu.iot</groupId>
    <artifactId>svr-iot</artifactId>
    <artifactId>svr-iot</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <packaging>war</packaging>
    <dependencies>
    <dependencies>
@ -36,6 +36,10 @@
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model-es</artifactId>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
            <artifactId>common-util</artifactId>

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java

@ -7,11 +7,11 @@ import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.LocationDataVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import iot.device.LocationDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/label/FigureLabelSearchController.java

@ -3,11 +3,11 @@ package com.yihu.iot.controller.label;
import com.yihu.iot.service.label.FigureLabelSerachService;
import com.yihu.iot.service.label.FigureLabelSerachService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.iot.device.FigureLabelDataModelVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import iot.device.FigureLabelDataModelVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PostMapping;

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -10,10 +10,10 @@ import com.yihu.iot.service.common.ElasticSearchQueryGenerator;
import com.yihu.jw.iot.device.IotPatientDeviceDO;
import com.yihu.jw.iot.device.IotPatientDeviceDO;
import com.yihu.jw.iot.device.LocationDataDO;
import com.yihu.jw.iot.device.LocationDataDO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.LocationDataVO;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import io.searchbox.client.JestResult;
import io.searchbox.client.JestResult;
import iot.device.LocationDataVO;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/label/FigureLabelSerachService.java

@ -6,11 +6,11 @@ import com.yihu.base.es.config.ElasticFactory;
import com.yihu.base.es.config.ElastricSearchHelper;
import com.yihu.base.es.config.ElastricSearchHelper;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.service.common.ElasticSearchQueryGenerator;
import com.yihu.iot.service.common.ElasticSearchQueryGenerator;
import com.yihu.jw.restmodel.iot.device.FigureLabelDataModelVO;
import com.yihu.jw.restmodel.iot.device.LocationDataVO;
import io.searchbox.client.JestClient;
import io.searchbox.client.JestClient;
import io.searchbox.client.JestResult;
import io.searchbox.client.JestResult;
import io.searchbox.core.Search;
import io.searchbox.core.Search;
import iot.device.FigureLabelDataModelVO;
import iot.device.LocationDataVO;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;

+ 2 - 2
svr/svr-manage/pom.xml

@ -6,13 +6,13 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <artifactId>svr-manage</artifactId>
    <artifactId>svr-manage</artifactId>
    <packaging>war</packaging>
    <packaging>war</packaging>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>

+ 2 - 2
svr/svr-rehabilitation/pom.xml

@ -5,13 +5,13 @@
	<parent>
	<parent>
		<groupId>com.yihu.jw</groupId>
		<groupId>com.yihu.jw</groupId>
		<artifactId>svr-lib-parent-pom</artifactId>
		<artifactId>svr-lib-parent-pom</artifactId>
		<version>1.0.0</version>
		<version>1.0.2</version>
		<relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
		<relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
	</parent>
	</parent>
	<groupId>com.yihu.rehabilitation</groupId>
	<groupId>com.yihu.rehabilitation</groupId>
	<artifactId>svr-rehabilitation</artifactId>
	<artifactId>svr-rehabilitation</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<version>${parent.version}</version>
	<packaging>jar</packaging>
	<packaging>jar</packaging>
	<dependencies>
	<dependencies>

+ 2 - 2
svr/svr-wlyy-archives/pom.xml

@ -6,13 +6,13 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.archives</groupId>
    <groupId>com.yihu.archives</groupId>
    <artifactId>svr-wlyy-archives</artifactId>
    <artifactId>svr-wlyy-archives</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>

+ 2 - 2
svr/svr-wlyy-health-bank/pom.xml

@ -6,13 +6,13 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.health.bank</groupId>
    <groupId>com.yihu.health.bank</groupId>
    <artifactId>svr-wlyy-health-bank</artifactId>
    <artifactId>svr-wlyy-health-bank</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <packaging>war</packaging>
    <dependencies>
    <dependencies>

+ 2 - 2
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/AccountController.java

@ -88,7 +88,7 @@ public class AccountController extends EnvelopRestController {
     * @param size 每页大小
     * @param size 每页大小
     * @return
     * @return
     */
     */
    @PostMapping(value = HealthBankMapping.healthBank.findAccount)
/*    @PostMapping(value = HealthBankMapping.healthBank.findAccount)
    @ApiOperation(value = "查看账户信息")
    @ApiOperation(value = "查看账户信息")
    public Envelop<AccountDO> getAccount(@ApiParam(name = "account",value = "账户JSON")
    public Envelop<AccountDO> getAccount(@ApiParam(name = "account",value = "账户JSON")
                                           @RequestParam(value = "account",required = false)String account,
                                           @RequestParam(value = "account",required = false)String account,
@ -104,6 +104,6 @@ public class AccountController extends EnvelopRestController {
            tracer.getCurrentSpan().logEvent(e.getMessage());
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
        }
    }
    }*/
}
}

+ 152 - 71
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java

@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import javax.transaction.Transactional;
import java.text.ParseException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -82,16 +83,18 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        List<AccountDO>  accountDOS = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(AccountDO.class));
        List<AccountDO>  accountDOS = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(AccountDO.class));
        if (accountDOS == null || accountDOS.size() == 0){
        if (accountDOS == null || accountDOS.size() == 0){
            accountDO1.setTotal(0);
            accountDO1.setTotal(0);
            accountDO1.setAccountName("jw");
            accountDO1.setAccountName(creditsDetailDO.getName());
            accountDO1.setCardNumber("jw");
            accountDO1.setCardNumber("jw");
            accountDO1.setHospital("海沧区");
            accountDO1.setHospital("海沧区");
            accountDO1.setPassword("321321312321");
            accountDO1.setPassword("321321312321");
            accountDO1.setHospitalName("haichan");
            accountDO1.setHospitalName("haichan");
            accountDO1.setCreateTime(new Date());
            accountDO1.setUpdateTime(new Date());
            accountDao.save(accountDO1);
            accountDao.save(accountDO1);
        }
        }
        List<AccountDO>  accountDOS1 = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(AccountDO.class));
        List<AccountDO>  accountDOS1 = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(AccountDO.class));
        AccountDO accountDO = accountDOS1.get(0);
        AccountDO accountDO = accountDOS1.get(0);
        String sql = "SELECT SUM(cd.integrate) as total FROM wlyy_health_bank_credits_detail cd where cd.trade_direction = "+creditsDetailDO.getTradeDirection();
        String sql = "SELECT SUM(cd.integrate) as total FROM wlyy_health_bank_credits_detail cd where cd.trade_direction = "+creditsDetailDO.getTradeDirection() +" AND cd.patient_id = '" +creditsDetailDO.getPatientId()+"'";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        if (rstotal!= null && rstotal.size()>0){
        if (rstotal!= null && rstotal.size()>0){
            if (rstotal.get(0).get("total") == null){
            if (rstotal.get(0).get("total") == null){
@ -129,37 +132,44 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
            }
            }
            buffer.deleteCharAt(buffer.length()-1);
            buffer.deleteCharAt(buffer.length()-1);
        }
        }
        buffer.append(") AND");
        String sql = "SELECT" +
                " ba.patient_id AS patient_id, " +
                " ba.account_name AS account_name," +
                " ba.hospital AS hospital, " +
                " ba.total AS total, " +
                " ba.create_time AS create_time, " +
                " (ba.total +(cd1.total)) AS sum " +
                " FROM " +
                " wlyy_health_bank_account ba, " +
                " ( " +
                " SELECT " +
                " SUM(cd.integrate) AS total, " +
                " cd.patient_id AS patient_id " +
                " FROM " +
                " wlyy_health_bank_credits_detail cd " +
                " WHERE " +
                " cd.trade_direction = - 1 " +
                " GROUP BY " +
                " cd.patient_id " +
                " ) cd1 " +
                "WHERE " + buffer +
                " cd1.patient_id = ba.patient_id " +
                "ORDER BY " +
                " ba.create_time, " +
                " (ba.total + cd1.total) DESC " +
                "LIMIT "+(page-1)*size+","+size;
        buffer.append(") ");
        String sql =
                "SELECT ba1.patient_id AS patient_id," +
                        "ba1.account_name AS account_name," +
                        "ba1.hospital AS hospital," +
                        "ba1.total AS total," +
                        "ba1.create_time AS create_time," +
                        "ba1.sum AS sum" +
                        " FROM" +
                        "( SELECT " +
                        "ba.patient_id AS patient_id," +
                        "ba.account_name AS account_name," +
                        "ba.hospital AS hospital," +
                        "ba.total AS total," +
                        "ba.create_time AS create_time," +
                        "(ba.total +(cd1.total)) AS sum" +
                        " FROM" +
                        " wlyy_health_bank_account ba" +
                        " LEFT JOIN ( " +
                        "SELECT" +
                        " SUM(cd.integrate) AS total," +
                        " cd.patient_id AS patient_id" +
                        " FROM" +
                        " wlyy_health_bank_credits_detail cd" +
                        " WHERE " +
                        "cd.trade_direction = - 1" +
                        " GROUP BY " +
                        " cd.patient_id ) cd1 ON cd1.patient_id = ba.patient_id\n" +
                        " WHERE " + buffer +
                        " ORDER BY" +
                        " ba.create_time DESC " +
                        "LIMIT "+(page-1)*size+","+size +")ba1" +
                        " ORDER BY " +
                        " ba1.sum DESC";
        List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
        List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
        String sqlCount = "SELECT count(1) AS total"+
        String sqlCount = "SELECT count(1) AS total"+
                " FROM " +
                " FROM " +
                " wlyy_health_bank_account ba, " +
                " wlyy_health_bank_account ba LEFT JOIN " +
                " ( " +
                " ( " +
                " SELECT " +
                " SELECT " +
                " SUM(cd.integrate) AS total, " +
                " SUM(cd.integrate) AS total, " +
@ -170,10 +180,9 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                " cd.trade_direction = - 1 " +
                " cd.trade_direction = - 1 " +
                " GROUP BY " +
                " GROUP BY " +
                " cd.patient_id " +
                " cd.patient_id " +
                " ) cd1 " +
                " ) cd1 ON cd1.patient_id = ba.patient_id " +
                "WHERE " + buffer +
                "WHERE " + buffer +
                " cd1.patient_id = ba.patient_id " +
                "ORDER BY " +
                " ORDER BY " +
                " ba.create_time, " +
                " ba.create_time, " +
                " (ba.total + cd1.total) DESC ";
                " (ba.total + cd1.total) DESC ";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount);
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount);
@ -190,47 +199,119 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
     * @param creditsDetailDO
     * @param creditsDetailDO
     * @return
     * @return
     */
     */
    public Envelop<CreditsDetailDO> insert(CreditsDetailDO creditsDetailDO){
        TaskDO taskDO = new TaskDO();
        taskDO.setTaskCode(creditsDetailDO.getFlag());
        taskDO.setPatientId(creditsDetailDO.getPatientId());
        String sql = ISqlUtils.getSql(taskDO,1,1,"*");
        List<TaskDO> taskDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskDO.class));
        if (taskDOList != null && taskDOList.size() != 0){
            creditsDetailDO.setTransactionId(taskDOList.get(0).getId());
        }
        String sqlAccount = "select * from wlyy_health_bank_account ba where ba.patient_id = '"+creditsDetailDO.getPatientId() +"'";
        List<AccountDO> accountDOList = jdbcTemplate.query(sqlAccount,new BeanPropertyRowMapper(AccountDO.class));
        if (accountDOList != null && accountDOList.size() != 0){
            creditsDetailDO.setAccountId(accountDOList.get(0).getId());
        }
        if (creditsDetailDO.getTradeDirection() == 1){
            if (creditsDetailDO.getTradeType().equals("HEALTH_TASK")){
                TaskDetailDO taskDetailDO = new TaskDetailDO();
                taskDetailDO.setIntegrate(creditsDetailDO.getIntegrate());
                taskDetailDO.setTaskId(creditsDetailDO.getTransactionId());
                taskDetailDO.setSaasId(creditsDetailDO.getSaasId());
                taskDetailDO.setPatientId(creditsDetailDO.getPatientId());
                taskDetailDO.setTradeDirection(creditsDetailDO.getTradeDirection());
                taskDetailDO.setStatus("1");
                taskDetailDao.save(taskDetailDO);
    public Envelop<CreditsDetailDO> insert(CreditsDetailDO creditsDetailDO){
        try {
            synchronized (creditsDetailDO.getPatientId()){
                String sqlAccount = "select * from wlyy_health_bank_account ba where ba.patient_id = '"+creditsDetailDO.getPatientId() +"'";
                List<AccountDO> accountDOList = jdbcTemplate.query(sqlAccount,new BeanPropertyRowMapper(AccountDO.class));
                if (accountDOList != null && accountDOList.size() != 0){
                    creditsDetailDO.setAccountId(accountDOList.get(0).getId());
                }else {
                    AccountDO accountDO1 = new AccountDO();
                    accountDO1.setPatientId(creditsDetailDO.getPatientId());
                    accountDO1.setTotal(0);
                    accountDO1.setAccountName(creditsDetailDO.getName());
                    accountDO1.setCardNumber("jw");
                    accountDO1.setHospital("海沧区");
                    accountDO1.setPassword("321321312321");
                    accountDO1.setHospitalName("haichan");
                    accountDO1.setCreateTime(new Date());
                    accountDO1.setUpdateTime(new Date());
                    accountDao.save(accountDO1);
                    List<AccountDO> accountDOS = jdbcTemplate.query(sqlAccount,new BeanPropertyRowMapper(AccountDO.class));
                    creditsDetailDO.setAccountId(accountDOS.get(0).getId());
                }
                TaskDO taskDO = new TaskDO();
                taskDO.setTaskCode(creditsDetailDO.getFlag());
                taskDO.setPatientId(creditsDetailDO.getPatientId());
                String sql = ISqlUtils.getSql(taskDO,1,1,"*");
                List<TaskDO> taskDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskDO.class));
                if (taskDOList != null && taskDOList.size() != 0){
                    creditsDetailDO.setTransactionId(taskDOList.get(0).getId());
                }else {
                    List<TaskDO> taskDOS = getTasks(taskDO.getPatientId());
                    for (TaskDO taskDO1:taskDOS){
                        taskDao.save(taskDO1);
                    }
                    List<TaskDO> taskDOList1 = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskDO.class));
                    creditsDetailDO.setTransactionId(taskDOList1.get(0).getId());
                }
                if (creditsDetailDO.getTradeDirection() == 1){
                    if (creditsDetailDO.getTradeType().equals("HEALTH_TASK")){
                        TaskDetailDO taskDetailDO = new TaskDetailDO();
                        taskDetailDO.setIntegrate(creditsDetailDO.getIntegrate());
                        taskDetailDO.setTaskId(creditsDetailDO.getTransactionId());
                        taskDetailDO.setSaasId(creditsDetailDO.getSaasId());
                        taskDetailDO.setPatientId(creditsDetailDO.getPatientId());
                        taskDetailDO.setTradeDirection(creditsDetailDO.getTradeDirection());
                        taskDetailDO.setStatus("1");
                        taskDetailDO.setCreateTime(new Date());
                        taskDetailDO.setUpdateTime(new Date());
                        taskDetailDao.save(taskDetailDO);
                    }
                }
                creditsDetailDO.setCreateTime(new Date());
                creditsDetailDO.setUpdateTime(new Date());
                CreditsDetailDO creditsDetailDO1 =credittsLogDetailDao.save(creditsDetailDO);
                creditsDetailDO1.setFlag(creditsDetailDO.getFlag());
                List<CreditsDetailDO> creditsDetailDOList = new ArrayList<>();
                creditsDetailDOList.add(creditsDetailDO1);
                AccountDO accountDO = accountDao.findOne(creditsDetailDO1.getAccountId());
                if (creditsDetailDO1.getTradeDirection() == 1){
                    accountDO.setTotal(accountDO.getTotal()+creditsDetailDO1.getIntegrate());
                }else if (creditsDetailDO.getTradeDirection() == -1){
                    accountDO.setTotal(accountDO.getTotal()-creditsDetailDO1.getIntegrate());
                }
                AccountDO accountDO1 = accountDao.save(accountDO);
                List<CreditsDetailDO> creditsDetailDOS = new ArrayList<>();
                for (CreditsDetailDO creditsDetailDO2:creditsDetailDOList){
                    creditsDetailDO2.setTotal(accountDO1.getTotal());
                    creditsDetailDOS.add(creditsDetailDO2);
                }
                Envelop<CreditsDetailDO> envelop = new Envelop<>();
                envelop.setDetailModelList(creditsDetailDOS);
                return envelop;
            }
            }
        }catch (Exception e){
            e.printStackTrace();
            Envelop<CreditsDetailDO> envelop = new Envelop<>();
            return envelop;
        }
        }
        CreditsDetailDO creditsDetailDO1 =credittsLogDetailDao.save(creditsDetailDO);
        creditsDetailDO1.setFlag(creditsDetailDO.getFlag());
        List<CreditsDetailDO> creditsDetailDOList = new ArrayList<>();
        creditsDetailDOList.add(creditsDetailDO1);
        AccountDO accountDO = accountDao.findOne(creditsDetailDO1.getAccountId());
        if (creditsDetailDO1.getTradeDirection() == 1){
            accountDO.setTotal(accountDO.getTotal()+creditsDetailDO1.getIntegrate());
        }else if (creditsDetailDO.getTradeDirection() == -1){
            accountDO.setTotal(accountDO.getTotal()-creditsDetailDO1.getIntegrate());
        }
        accountDao.save(accountDO);
        Envelop<CreditsDetailDO> envelop = new Envelop<>();
        envelop.setDetailModelList(creditsDetailDOList);
        return envelop;
    }
    /**
     * 固定数据
     *
     * @param patientId
     * @return
     */
    public List<TaskDO> getTasks(String patientId){
        List<TaskDO> taskDOList = new ArrayList<>();
        TaskDO taskDO = new TaskDO();
        taskDO.setPatientId(patientId);
        taskDO.setTaskCode("BIND");
        taskDO.setPeriod(1);
        taskDO.setTaskTitle("首次绑定");
        taskDO.setTaskContent("(绑定社区登记发放的设备,可获得各类型设备的首绑奖励。)");
        taskDO.setTradeType("activity");
        taskDO.setTransactionId("402885e96324a409016324c0a45a0006");
        taskDO.setCreateTime(new Date());
        taskDO.setUpdateTime(new Date());
        taskDOList.add(taskDO);
        TaskDO taskDO1 = new TaskDO();
        taskDO1.setPatientId(patientId);
        taskDO1.setTaskCode("MEASURE");
        taskDO1.setPeriod(0);
        taskDO1.setTaskTitle("每日测量");
        taskDO1.setTaskContent("(使用社区发放的已关联您身份信息的设备,绑定后每天完成测量)");
        taskDO1.setTradeType("activity");
        taskDO1.setTransactionId("402885e96324a409016324c0a45a0006");
        taskDO1.setCreateTime(new Date());
        taskDO1.setUpdateTime(new Date());
        taskDOList.add(taskDO1);
        return taskDOList;
    }
    }
}
}

+ 5 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/TaskService.java

@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -99,6 +100,8 @@ public class TaskService extends BaseJpaService<TaskDO,TaskDao>{
       taskDO.setTaskContent("(使用社区发放的已关联您身份信息的设备,登录厦门i健康绑定设备)");
       taskDO.setTaskContent("(使用社区发放的已关联您身份信息的设备,登录厦门i健康绑定设备)");
       taskDO.setTradeType("activity");
       taskDO.setTradeType("activity");
       taskDO.setTransactionId("402885e96324a409016324c0a45a0006");
       taskDO.setTransactionId("402885e96324a409016324c0a45a0006");
       taskDO.setCreateTime(new Date());
       taskDO.setUpdateTime(new Date());
       taskDOList.add(taskDO);
       taskDOList.add(taskDO);
       TaskDO taskDO1 = new TaskDO();
       TaskDO taskDO1 = new TaskDO();
       taskDO1.setPatientId(patientId);
       taskDO1.setPatientId(patientId);
@ -108,6 +111,8 @@ public class TaskService extends BaseJpaService<TaskDO,TaskDao>{
       taskDO1.setTaskContent("(使用社区发放的已关联您身份信息的设备,绑定后每天完成测量)");
       taskDO1.setTaskContent("(使用社区发放的已关联您身份信息的设备,绑定后每天完成测量)");
       taskDO1.setTradeType("activity");
       taskDO1.setTradeType("activity");
       taskDO1.setTransactionId("402885e96324a409016324c0a45a0006");
       taskDO1.setTransactionId("402885e96324a409016324c0a45a0006");
       taskDO1.setCreateTime(new Date());
       taskDO1.setUpdateTime(new Date());
       taskDOList.add(taskDO1);
       taskDOList.add(taskDO1);
       return taskDOList;
       return taskDOList;
    }
    }

+ 65 - 21
svr/svr-wlyy-health-bank/src/main/resources/application.yml

@ -4,7 +4,7 @@ server:
spring:
spring:
  application:
  application:
    name:  svr-wlyy-health-bank-test  #注册到发现服务的id 如果id一样 eurika会自动做负载
    name:  svr-wlyy-health-bank  #注册到发现服务的id 如果id一样 eurika会自动做负载
  datasource:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    driver-class-name: com.mysql.jdbc.Driver
@ -24,25 +24,6 @@ spring:
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true
  # JEST (Elasticsearch HTTP client) (JestProperties)
  elasticsearch:
    jest:
      uris: http://172.19.103.68:9200
#      uris: http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
#      username: # Login user.
#      password: # Login password.
#      proxy.port:  # Proxy port the HTTP client should use.
#      proxy.host:  # Proxy host the HTTP client should use.
#hibernate 配置
#hibernate 配置
hibernate:
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
  dialect: org.hibernate.dialect.MySQL5Dialect
@ -72,17 +53,80 @@ spring:
    url: jdbc:mysql://172.19.103.77:3306/wlyy_health_bank?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://172.19.103.77:3306/wlyy_health_bank?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: root
    username: root
    password: 123456
    password: 123456
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true
    # JEST (Elasticsearch HTTP client) (JestProperties)
  elasticsearch:
    jest:
      uris: http://172.19.103.68:9200
#     uris: [图片]http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
      username: # Login user.
      password: # Login password.
      proxy.port:  # Proxy port the HTTP client should use.
      proxy.host:  # Proxy host the HTTP client should use.
fastDFS:
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
  fastdfs_file_url: http://172.19.103.54:80/
---
---
spring:
spring:
  profiles: jwtest
  profiles: jwtest
  datasource:
    url: jdbc:mysql://172.19.103.77:3306/wlyy_health_bank?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: root
    password: 123456
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true
  # JEST (Elasticsearch HTTP client) (JestProperties)
  elasticsearch:
    jest:
      uris: http://172.19.103.68:9200
#      uris: [图片]http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
      username: # Login user.
      password: # Login password.
      proxy.port:  # Proxy port the HTTP client should use.
      proxy.host:  # Proxy host the HTTP client should use.
fastDFS:
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
  fastdfs_file_url: http://172.19.103.54:80/
---
---
spring:
spring:
  profiles: jwprod
  profiles: prod
  datasource:
    url: jdbc:mysql://59.61.92.90:9069/wlyy_health_bank?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: wlyy
    password: jkzlehr@123
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 59.61.92.90:9066,59.61.92.90:9068 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true
    # JEST (Elasticsearch HTTP client) (JestProperties)
  elasticsearch:
    jest:
      uris: http://59.61.92.90:9065,http://59.61.92.90:9067
  #     uris: [图片]http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  #      username: # Login user.
  #      password: # Login password.
  #      proxy.port:  # Proxy port the HTTP client should use.
  #      proxy.host:  # Proxy host the HTTP client should use.
fastDFS:
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
  fastdfs_file_url: http://172.19.103.54:80/

+ 11 - 2
svr/svr-wlyy-health-bank/src/main/resources/bootstrap.yml

@ -10,6 +10,15 @@ spring:
        enabled: true #使用发现服务
        enabled: true #使用发现服务
        service-id: svr-configurations #配置服务的名字
        service-id: svr-configurations #配置服务的名字
eureka:
  instance:
    #eurika使用IP不使用host
    prefer-ip-address: true
    #定制化在eurika中显示的名称
    ##instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}
    instance-id: ${spring.cloud.client.ipAddress}:${server.port}
    health-check-url-path: /health
---
---
spring:
spring:
@ -36,11 +45,11 @@ eureka:
---
---
spring:
spring:
  profiles: jwprod
  profiles: prod
eureka:
eureka:
  client:
  client:
    serviceUrl:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@192.168.120.153:8761/eureka/

+ 2 - 2
svr/svr-wlyy-specialist/pom.xml

@ -6,13 +6,13 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.specialist</groupId>
    <groupId>com.yihu.specialist</groupId>
    <artifactId>svr-wlyy-specialist</artifactId>
    <artifactId>svr-wlyy-specialist</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>

+ 2 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -106,4 +106,6 @@ public class SpecialistController extends EnvelopRestController {
            return Envelop.getError(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
        }
    }
    }
}
}

+ 12 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/PatientLabelDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.dao;
import com.yihu.jw.entity.specialist.PatientLabelDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2018/5/29.
 */
public interface PatientLabelDao extends PagingAndSortingRepository<PatientLabelDO, String>,
        JpaSpecificationExecutor<PatientLabelDO> {
}

+ 12 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/PatientLabelInfoDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.dao;
import com.yihu.jw.entity.specialist.PatientLabelDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2018/5/29.
 */
public interface PatientLabelInfoDao extends PagingAndSortingRepository<PatientLabelDO, String>,
        JpaSpecificationExecutor<PatientLabelDO> {
}

+ 1 - 1
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java

@ -11,5 +11,5 @@ import java.util.List;
 */
 */
public interface SpecialistPatientRelationDao extends PagingAndSortingRepository<SpecialistPatientRelationDO, String>,
public interface SpecialistPatientRelationDao extends PagingAndSortingRepository<SpecialistPatientRelationDO, String>,
        JpaSpecificationExecutor<SpecialistPatientRelationDO> {
        JpaSpecificationExecutor<SpecialistPatientRelationDO> {
    public List<SpecialistPatientRelationDO> findByDoctor(String doctor);
    public List<SpecialistPatientRelationDO> findByDoctorAndStatus(String doctor,String status);
}
}

+ 28 - 3
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -1,15 +1,15 @@
package com.yihu.jw.service;
package com.yihu.jw.service;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.dao.*;
import com.yihu.jw.dao.*;
import com.yihu.jw.entity.specialist.SpecialistArticleDO;
import com.yihu.jw.entity.specialist.SpecialistArticleDO;
import com.yihu.jw.entity.specialist.SpecialistConsultDO;
import com.yihu.jw.entity.specialist.SpecialistConsultDO;
import com.yihu.jw.entity.specialist.SpecialistDO;
import com.yihu.jw.entity.specialist.SpecialistDO;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.specialist.SpecialistPatientRelationVO;
import com.yihu.jw.restmodel.specialist.*;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import com.yihu.jw.rm.specialist.SpecialistMapping;
import org.springframework.beans.factory.annotation.Autowired;
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.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.ParseException;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.function.BooleanSupplier;
/**
/**
 * Created by Trick on 2018/4/25.
 * Created by Trick on 2018/4/25.
@ -39,6 +38,8 @@ public class SpecialistService{
    private PatientHospitalRecordDao patientHospitalRecordDao;
    private PatientHospitalRecordDao patientHospitalRecordDao;
    @Autowired
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    @Value("${basedb.name}")
    private String basedb;
    public Envelop<Boolean> createSpecialists(List<SpecialistDO> info){
    public Envelop<Boolean> createSpecialists(List<SpecialistDO> info){
        specialistDao.save(info);
        specialistDao.save(info);
@ -95,5 +96,29 @@ public class SpecialistService{
        return Envelop.getSuccessListWithPage(SpecialistMapping.api_success,specialistPatientRelationVOs,page,size,count);
        return Envelop.getSuccessListWithPage(SpecialistMapping.api_success,specialistPatientRelationVOs,page,size,count);
    }
    }
    public Envelop<Long> findSpecialistPatientRelationCout(String doctor){
        String sql = "SELECT " +
                " count(1) AS total " +
                " FROM " +
                " wlyy_specialist_patient_relation r " +
                " WHERE " +
                " r.patient " +
                " NOT IN ( " +
                " SELECT " +
                " patient " +
                " FROM " +
                " "+basedb+".wlyy_sign_patient_label_info i " +
                " WHERE " +
                " i.label_type = '5' " +
                " )";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccess(SpecialistMapping.api_success,count);
    }
//    public Envelop<PatientRelationVO>
}
}

+ 3 - 1
svr/svr-wlyy-specialist/src/main/resources/application.yml

@ -4,7 +4,7 @@ server:
spring:
spring:
  application:
  application:
    name:  svr-wlyy-specialist-wzn  #注册到发现服务的id 如果id一样 eurika会自动做负载
    name:  svr-wlyy-specialist-lyx  #注册到发现服务的id 如果id一样 eurika会自动做负载
  datasource:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    driver-class-name: com.mysql.jdbc.Driver
@ -64,6 +64,8 @@ fast-dfs:
    max-size: 20
    max-size: 20
    wait-time: 500
    wait-time: 500
basedb: #base数据基础数据数据源,用于跨库查询
  name: wlyy
---
---
spring:
spring:
  profiles: jwdev
  profiles: jwdev

+ 2 - 2
svr/svr-wlyy/pom.xml

@ -6,13 +6,13 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-wlyy</artifactId>
    <artifactId>svr-wlyy</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <dependencies>
    <dependencies>
        <dependency>
        <dependency>

+ 37 - 39
web-gateway/pom.xml

@ -6,20 +6,24 @@
    <parent>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <version>1.0.2</version>
        <relativePath>../svr-lib-parent-pom/pom.xml</relativePath>
        <relativePath>../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <groupId>com.yihu.jw</groupId>
    <artifactId>web-gateway</artifactId>
    <artifactId>web-gateway</artifactId>
    <version>1.0.0</version>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <packaging>war</packaging>
    <dependencies>
    <dependencies>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>admin-client-starter</artifactId>
            <version>${version.yihu.admin}</version>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-fegin</artifactId>
            <artifactId>common-fegin</artifactId>
            <version>1.0.0</version>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
@ -29,19 +33,38 @@
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
            <artifactId>common-request-mapping</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.data</groupId>
                    <artifactId>spring-data-elasticsearch</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.yihu.base</groupId>
                    <artifactId>common-data-es</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <artifactId>common-rest-model</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.data</groupId>
                    <artifactId>spring-data-elasticsearch</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-swagger</artifactId>
            <artifactId>common-swagger</artifactId>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <groupId>com.yihu</groupId>
            <artifactId>common-security-starter</artifactId>
            <artifactId>common-security-starter</artifactId>
            <version>1.0.6</version>
            <version>1.0.7</version>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <groupId>org.springframework.boot</groupId>
@ -81,24 +104,10 @@
            <groupId>org.springframework.boot</groupId>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        </dependency>
      <!--  <dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>-->
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-security</artifactId>-->
        <!--</dependency>-->
     <!--   <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>-->
      <!--  <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-oauth2</artifactId>
        </dependency>-->
        </dependency>
        <dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
@ -126,6 +135,10 @@
            <groupId>org.springframework.cloud</groupId>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-ribbon</artifactId>
        </dependency>
        <dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-sleuth-zipkin</artifactId>
            <artifactId>spring-cloud-sleuth-zipkin</artifactId>
@ -146,11 +159,6 @@
            <groupId>org.json</groupId>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <artifactId>json</artifactId>
        </dependency>
        </dependency>
    <!--    <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>RELEASE</version>
        </dependency>-->
        <dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <artifactId>commons-collections</artifactId>
@ -165,18 +173,8 @@
            <version>3.0.9</version>
            <version>3.0.9</version>
        </dependency>
        </dependency>
        <dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.data</groupId>
                    <artifactId>spring-data-elasticsearch</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.yihu.base</groupId>
                    <artifactId>common-data-es</artifactId>
                </exclusion>
            </exclusions>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
        </dependency>
        </dependency>
    </dependencies>
    </dependencies>
    <build>
    <build>
@ -184,7 +182,7 @@
        <plugins>
        <plugins>
            <plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin </artifactId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                <configuration>
                    <mainClass>com.yihu.jw.WebGateWayAppliaction</mainClass>
                    <mainClass>com.yihu.jw.WebGateWayAppliaction</mainClass>
                </configuration>
                </configuration>

+ 16 - 3
web-gateway/src/main/java/com/yihu/jw/WebGateWayAppliaction.java

@ -1,7 +1,13 @@
package com.yihu.jw;
package com.yihu.jw;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
@ -13,9 +19,7 @@ import org.springframework.context.annotation.ComponentScan;
/**
/**
 * Created by chenweida on 2017/5/10.
 * Created by chenweida on 2017/5/10.
 */
 */
@SpringBootApplication(
        exclude = {DataSourceAutoConfiguration.class,
                HibernateJpaAutoConfiguration.class})
@SpringBootApplication
//@SpringBootApplication
//@SpringBootApplication
@EnableDiscoveryClient//服务注册到发现服务
@EnableDiscoveryClient//服务注册到发现服务
@EnableHystrix //启动断路器
@EnableHystrix //启动断路器
@ -25,6 +29,15 @@ import org.springframework.context.annotation.ComponentScan;
) //声名式的客户端
) //声名式的客户端
@EnableCircuitBreaker
@EnableCircuitBreaker
@ComponentScan(basePackages = {"com"})
@ComponentScan(basePackages = {"com"})
@EnableAutoConfiguration(exclude = {
        DataSourceAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class,
        ElasticsearchAutoConfiguration.class,
        ElasticsearchRepositoriesAutoConfiguration.class,
        ElasticsearchDataAutoConfiguration.class,
        RedisRepositoriesAutoConfiguration.class,
        JestAutoConfiguration.class
})
public class WebGateWayAppliaction {
public class WebGateWayAppliaction {
    public static void main(String[] args) {
    public static void main(String[] args) {

+ 26 - 8
web-gateway/src/main/java/com/yihu/jw/config/SwaggerConfig.java

@ -3,13 +3,19 @@ package com.yihu.jw.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
@Configuration
@Configuration
@EnableSwagger2
@EnableSwagger2
@ComponentScan("com.yihu.jw.controller.**")
@ComponentScan("com.yihu.jw.controller.**")
@ -19,10 +25,12 @@ public class SwaggerConfig {
    public static final String login_API = "login";
    public static final String login_API = "login";
    public static final String iot_API = "iot";
    public static final String iot_API = "iot";
    final String userAgentJson = "{\"id\":int,\"uid\":string,\"openid\":string,\"token\":string,\"lastUid\":string,\"platform\":int}";
    @Bean
    @Bean
    public Docket baseAPI() {
    public Docket baseAPI() {
        List<Parameter> pars = addToken();
        return new Docket(DocumentationType.SWAGGER_2)
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(base_API)
                .groupName(base_API)
                .useDefaultResponseMessages(false)
                .useDefaultResponseMessages(false)
@ -30,7 +38,7 @@ public class SwaggerConfig {
                .select()
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yihu.jw.controller.base"))
                .apis(RequestHandlerSelectors.basePackage("com.yihu.jw.controller.base"))
                .paths(PathSelectors.any())
                .paths(PathSelectors.any())
                .build();
                .build().globalOperationParameters(pars);
    }
    }
    private ApiInfo baseApiInfo() {
    private ApiInfo baseApiInfo() {
@ -46,10 +54,20 @@ public class SwaggerConfig {
        return apiInfo;
        return apiInfo;
    }
    }
    private List<Parameter> addToken() {
        ParameterBuilder tokenPar = new ParameterBuilder();
        ParameterBuilder userAgentPar = new ParameterBuilder();
        List<Parameter> pars = new ArrayList<Parameter>();
        userAgentPar.name("Authorization").description("\"Authorization\":\"bearer 5fe6b2c3-f69c-4ddc-a36a-367cdf9479a3\"").modelRef(new ModelRef("string")).parameterType("header").required(false).defaultValue("").build();
        tokenPar.name("accesstoken").description("accesstoken").modelRef(new ModelRef("string")).parameterType("header").required(false).defaultValue("").build();
        pars.add(tokenPar.build());
        pars.add(userAgentPar.build());
        return pars;
    }
    @Bean
    @Bean
    public Docket wlyyAPI() {
    public Docket wlyyAPI() {
        List<Parameter> pars = addToken();
        return new Docket(DocumentationType.SWAGGER_2)
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(wlyy_API)
                .groupName(wlyy_API)
                .useDefaultResponseMessages(false)
                .useDefaultResponseMessages(false)
@ -57,7 +75,7 @@ public class SwaggerConfig {
                .select()
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yihu.jw.controller.wlyy"))
                .apis(RequestHandlerSelectors.basePackage("com.yihu.jw.controller.wlyy"))
                .paths(PathSelectors.any())
                .paths(PathSelectors.any())
                .build();
                .build().globalOperationParameters(pars);
    }
    }
    private ApiInfo wlyyApiInfo() {
    private ApiInfo wlyyApiInfo() {
@ -76,7 +94,7 @@ public class SwaggerConfig {
    @Bean
    @Bean
    public Docket loginAPI() {
    public Docket loginAPI() {
        List<Parameter> pars = addToken();
        return new Docket(DocumentationType.SWAGGER_2)
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(login_API)
                .groupName(login_API)
                .useDefaultResponseMessages(false)
                .useDefaultResponseMessages(false)
@ -84,7 +102,7 @@ public class SwaggerConfig {
                .select()
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yihu.jw.controller.login"))
                .apis(RequestHandlerSelectors.basePackage("com.yihu.jw.controller.login"))
                .paths(PathSelectors.any())
                .paths(PathSelectors.any())
                .build();
                .build().globalOperationParameters(pars);
    }
    }
    private ApiInfo loginApiInfo() {
    private ApiInfo loginApiInfo() {
@ -102,7 +120,7 @@ public class SwaggerConfig {
    @Bean
    @Bean
    public Docket iotAPI() {
    public Docket iotAPI() {
        List<Parameter> pars = addToken();
        return new Docket(DocumentationType.SWAGGER_2)
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(iot_API)
                .groupName(iot_API)
                .useDefaultResponseMessages(false)
                .useDefaultResponseMessages(false)
@ -110,7 +128,7 @@ public class SwaggerConfig {
                .select()
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yihu.jw.controller.iot"))
                .apis(RequestHandlerSelectors.basePackage("com.yihu.jw.controller.iot"))
                .paths(PathSelectors.any())
                .paths(PathSelectors.any())
                .build();
                .build().globalOperationParameters(pars);
    }
    }
    private ApiInfo iotApiInfo() {
    private ApiInfo iotApiInfo() {

+ 10 - 0
web-gateway/src/main/java/com/yihu/jw/config/mvc/MvcConfig.java

@ -1,7 +1,11 @@
package com.yihu.jw.config.mvc;
package com.yihu.jw.config.mvc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
@ -28,4 +32,10 @@ public class MvcConfig extends WebMvcConfigurationSupport {
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
    }
    @Bean
    @LoadBalanced
    // 添加负载均衡支持,很简单,只需要在RestTemplate上添加@LoadBalanced注解,那么RestTemplate即具有负载均衡的功能,如果不加@LoadBalanced注解的话,会报java.net.UnknownHostException:springboot-h2异常,此时无法通过注册到Eureka Server上的服务名来调用服务,因为RestTemplate是无法从服务名映射到ip:port的,映射的功能是由LoadBalancerClient来实现的。
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
}

+ 96 - 15
web-gateway/src/main/java/com/yihu/jw/controller/base/login/LoginContorller.java

@ -1,30 +1,45 @@
package com.yihu.jw.controller.base.login;
package com.yihu.jw.controller.base.login;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.base.security.properties.SecurityProperties;
import com.yihu.base.security.properties.SecurityProperties;
import com.yihu.base.security.sms.mobile.MobileCheck;
import com.yihu.base.security.sms.mobile.MobileCheck;
import com.yihu.base.security.sms.process.SmsValidateCodeProcessor;
import com.yihu.base.security.sms.process.SmsValidateCodeProcessor;
import com.yihu.jw.base.user.BaseEmployDO;
import com.yihu.jw.common.base.base.BaseContants;
import com.yihu.jw.common.base.base.BaseContants;
import com.yihu.jw.fegin.base.base.FunctionFeign;
import com.yihu.jw.fegin.base.base.FunctionFeign;
import com.yihu.jw.fegin.base.login.LoginFeign;
import com.yihu.jw.fegin.base.login.LoginFeign;
import com.yihu.jw.fegin.base.user.EmployFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelopStatus;
import com.yihu.jw.rm.base.BaseLoginRequestMapping;
import com.yihu.jw.rm.base.BaseLoginRequestMapping;
import com.yihu.jw.rm.base.BaseUserRequestMapping;
import com.yihu.jw.rm.base.BaseUserRequestMapping;
import com.yihu.jw.util.common.ConvertToSpellUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.security.MD5;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.bouncycastle.util.encoders.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.context.request.ServletWebRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
/**
 * Created by 刘文彬 on 2018/4/20.
 * Created by 刘文彬 on 2018/4/20.
@ -40,13 +55,22 @@ public class LoginContorller {
    private MobileCheck mobileCheck;
    private MobileCheck mobileCheck;
    @Autowired
    @Autowired
    private SmsValidateCodeProcessor smsValidateCodeProcessor;
    private SmsValidateCodeProcessor smsValidateCodeProcessor;
    @Autowired
    private EmployFeign employFeign;
    @Value("${server.web-gateway-port}")
    private String port;
    @Autowired
    private RestTemplate restTemplate ;
    @Value("${spring.application.name}")
    private String appName;
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_checkoutInfo, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_checkoutInfo, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "注册校验信息", notes = "注册校验姓名、身份证、医保卡号信息")
    @ApiOperation(value = "注册校验信息", notes = "注册校验姓名、身份证、医保卡号信息")
    public BaseEnvelop checkoutInfo(@ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc,
    public BaseEnvelop checkoutInfo(@ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc,
                                @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard){
                                @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard){
        return loginFeign.checkoutInfo(ssc,idcard);
//        return loginFeign.checkoutInfo(ssc,idcard);
        return null;
    }
    }
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_accountSub, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_accountSub, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ -61,7 +85,34 @@ public class LoginContorller {
            @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard,
            @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard,
            @ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc) {
            @ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc) {
        return loginFeign.register(mobilePhone,saasId,type,captcha,name,password,idcard,ssc);
        //判断账号是否重复
        Envelop baseEmployDO = employFeign.getEmployeeByPhoneAndSaasId(mobilePhone,saasId);
        if(baseEmployDO.getStatus()!=10100&&baseEmployDO.getObj()!=null){
            return Envelop.getError(BaseEnvelopStatus.status_10106.getName(),BaseEnvelopStatus.status_10106.getCode());
        }
        //保存账户基础信息
        BaseEmployDO employeeDO = new BaseEmployDO();
        employeeDO.setId(UUID.randomUUID().toString().replaceAll("-", ""));
        employeeDO.setSaasId(saasId);
        employeeDO.setName(name);
        employeeDO.setPyCode(ConvertToSpellUtils.changeToInitialPinYin(name));
        employeeDO.setIdcard(idcard);
        employeeDO.setSsc(ssc);
        employeeDO.setPhone(mobilePhone);
        String salt= UUID.randomUUID().toString().replace("-","");
        employeeDO.setSalt(salt);
        employeeDO.setPassword(MD5.GetMD5Code(password + salt));
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.setDateFormat(new SimpleDateFormat(DateUtil.yyyy_MM_dd_HH_mm_ss));
        try {
            String entity = objectMapper.writeValueAsString(employeeDO);
            employFeign.create(entity);
        } catch (JsonProcessingException e) {
            return Envelop.getError(BaseEnvelopStatus.system_error.getName(),BaseEnvelopStatus.system_error.getCode());
        }
        return login(employeeDO.getPhone(),employeeDO.getPassword(),saasId,"");
    }
    }
    @PostMapping(BaseLoginRequestMapping.BaseLoginAccount.mobileSendSms)
    @PostMapping(BaseLoginRequestMapping.BaseLoginAccount.mobileSendSms)
@ -84,18 +135,48 @@ public class LoginContorller {
                       @ApiParam(name = "password", value = "password", required = false) @RequestParam(value = "password", required = false) String password,
                       @ApiParam(name = "password", value = "password", required = false) @RequestParam(value = "password", required = false) String password,
                       @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
                       @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
                       @ApiParam(name = "captcha", value = "短信验证码", required = false) @RequestParam(value = "captcha", required = false) String captcha){
                       @ApiParam(name = "captcha", value = "短信验证码", required = false) @RequestParam(value = "captcha", required = false) String captcha){
        return loginFeign.login(mobilePhone,password,saasId,captcha);
        Envelop baseEmployDO = employFeign.getEmployeeByPhoneAndSaasId(mobilePhone,saasId);
        if(baseEmployDO==null||((Map)baseEmployDO.getObj()).isEmpty()){
            return Envelop.getError(BaseEnvelopStatus.status_10100.getName(),BaseEnvelopStatus.status_10100.getCode());
        }
        Map employMap = (Map)baseEmployDO.getObj();
        HttpHeaders headers = new HttpHeaders();
        headers.add("Accept", "*/*");
        headers.add("Cache-Control", "no-cache");
        //client_id:client_securt
        byte[] a = Base64.encode((saasId+":").getBytes());
        String client_id = new String(a);
        headers.add("Authorization","Basic "+client_id);//MTox
        String token = "";
        //传参数JSON格式
        //  封装参数,千万不要替换为Map与HashMap,否则参数无法传递
        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
        //判断是短信登录还是账号密码登录
        if(StringUtils.isEmpty(captcha)){
            //  也支持中文
            params.add("username", mobilePhone+","+saasId);
            params.add("password", MD5.GetMD5Code(password+employMap.get("salt")));
            //设置http请求实体
            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
            token = restTemplate.postForObject("http://"+appName.toUpperCase()+"/authentication/form", requestEntity, String.class);
        }else{
            params.add("mobile", mobilePhone+","+saasId);
            params.add("sms", captcha);
            //设置http请求实体
            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
            token = restTemplate.postForObject("http://"+appName.toUpperCase()+"/authentication/mobile", requestEntity, String.class);
        }
        if(!StringUtils.isEmpty(token)){
            Map<String,Object> map = new HashMap<>();
            map.put("token",token);
            map.put("employ",employMap);
            return Envelop.getSuccess("登录成功!",map);
        }else{
            return Envelop.getError("登录失败!");
        }
//        return loginFeign.login(mobilePhone,password,saasId,captcha);
    }
    }
//    @PostMapping("/logout")
//    public Envelop logout(){
//        HttpHeaders headers = new HttpHeaders();
//        headers.add("Accept", "*/*");
//        headers.add("Cache-Control", "no-cache");
//        RestTemplate restTemplate = new RestTemplate();
//        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
//        //设置http请求实体
//        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
//        restTemplate.postForObject("http://localhost:8088/logout", requestEntity, String.class);
//        return new Envelop();
//    }
}
}

+ 134 - 134
web-gateway/src/main/java/com/yihu/jw/controller/base/security/TokenController.java

@ -1,134 +1,134 @@
package com.yihu.jw.controller.base.security;
import com.yihu.base.security.rbas.ClientServiceProvider;
import com.yihu.jw.fegin.base.user.EmployFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.rm.base.BaseLoginRequestMapping;
import com.yihu.jw.rm.base.BaseSecurityRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.OAuth2Request;
import org.springframework.security.oauth2.provider.TokenRequest;
import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
/**
 * Created by 刘文彬 on 2018/5/4.
 */
@RestController
@RequestMapping("/aa")
@Api(value = "权限token模块", description = "权限token模块")
public class TokenController {
    @Autowired
    private DefaultTokenServices defaultTokenServices;
    @Autowired
    private AuthenticationManager authenticationManager;
    @Autowired
    private ClientServiceProvider clientDetailsService;
    @Autowired
    private EmployFeign employFeign;
    @PostMapping(BaseSecurityRequestMapping.BaseToken.api_update_token_expiration_time)
    @ApiOperation(value = "更新token过期时间", notes = "根据token更新token过期时间")
    public BaseEnvelop updateTokenExpiration(@ApiParam(name = "expiration", value = "token过期时间,格式:yyyy-mm-dd HH:mm:ss", required = true)
                     @RequestParam(value = "expiration", required = true) String expiration,
                     @ApiParam(name = "authHeaderValue", value = "登录的token", required = true)
                     @RequestParam(value = "authHeaderValue", required = true) String authHeaderValue){
        DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken)defaultTokenServices.readAccessToken(authHeaderValue);
        if(token!=null){
            token.setExpiration(DateUtil.strToDate(expiration));
            return BaseEnvelop.getSuccess("token 过期时间设置成功!");
        }
        return BaseEnvelop.getError("token 无效!");
    }
    @PostMapping(BaseSecurityRequestMapping.BaseToken.api_update_token_expiration_second)
    @ApiOperation(value = "延长token的过期时间", notes = "根据token延长token的过期时间")
    public BaseEnvelop updateTokenExpiration(@ApiParam(name = "seconds", value = "延长token过期时间分钟数", required = true)
                                             @RequestParam(value = "seconds", required = true) int seconds,
                                             @ApiParam(name = "authHeaderValue", value = "登录的token", required = true)
                                             @RequestParam(value = "authHeaderValue", required = true) String authHeaderValue){
        DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken)defaultTokenServices.readAccessToken(authHeaderValue);
        if(token!=null){
            token.setExpiration(new Date(System.currentTimeMillis() + (seconds * 1000L)));
            return BaseEnvelop.getSuccess("token 过期时间设置成功!");
        }
        return BaseEnvelop.getError("token 无效!");
    }
    @PostMapping(BaseSecurityRequestMapping.BaseToken.api_update_token_expiration)
    @ApiOperation(value = "设置token过期", notes = "设置token过期")
    public BaseEnvelop updateTokenExpiration2(HttpServletRequest request, HttpServletResponse response,
                                              @ApiParam(name = "authHeaderValue", value = "登录的token", required = true)
                                              @RequestParam(value = "authHeaderValue", required = true) String authHeaderValue){
        DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken)defaultTokenServices.readAccessToken(authHeaderValue);
        if(token!=null){
            token.setExpiration(new Date());
            return BaseEnvelop.getSuccess("token 过期时间设置成功!");
        }
        return BaseEnvelop.getError("token 无效!");
    }
    @PostMapping(BaseSecurityRequestMapping.BaseToken.api_update_token_expiration_second2)
    @ApiOperation(value = "设置token过期", notes = "设置token过期")
    public BaseEnvelop updateTokenExpiration3(HttpServletRequest request, HttpServletResponse response,
                                              @ApiParam(name = "mobileSaas", value = "mobile和saas组合,逗号分隔", required = true)
                                              @RequestParam(value = "mobileSaas", required = true) String mobileSaas){
        String[] sp = mobileSaas.split(",");
        String phone = sp[0];
        String saasId = sp[1];
        Envelop envelop = employFeign.getEmployeeByPhoneAndSaasId(phone,saasId);
        Map baseEmployDO =  (Map)envelop.getObj();
        if(baseEmployDO.isEmpty()){
            return BaseEnvelop.getError("该用户不存在!");
        }
        UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(
                mobileSaas, baseEmployDO.get("password"));
        // Allow subclasses to set the "details" property
        authRequest.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
        Authentication authentication = authenticationManager.authenticate(authRequest);
        ClientDetails clientDetails = clientDetailsService.loadClientByClientId(saasId);
        TokenRequest tokenRequest = new TokenRequest(MapUtils.EMPTY_MAP, saasId, clientDetails.getScope(), "custom_password");
        OAuth2Request oAuth2Request = tokenRequest.createOAuth2Request(clientDetails);
        OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(oAuth2Request, authentication);
        DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken)defaultTokenServices.getAccessToken(oAuth2Authentication);
        if(token!=null){
            token.setExpiration(new Date());
            return BaseEnvelop.getSuccess("token 过期时间设置成功!");
        }
        return BaseEnvelop.getError("token 无效!");
    }
}
//package com.yihu.jw.controller.base.security;
//
//import com.yihu.base.security.rbas.ClientServiceProvider;
//import com.yihu.jw.fegin.base.user.EmployFeign;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.base.BaseEnvelop;
//import com.yihu.jw.rm.base.BaseLoginRequestMapping;
//import com.yihu.jw.rm.base.BaseSecurityRequestMapping;
//import com.yihu.jw.util.date.DateUtil;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.apache.commons.collections.MapUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.authentication.AuthenticationManager;
//import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
//import org.springframework.security.oauth2.common.OAuth2AccessToken;
//import org.springframework.security.oauth2.provider.ClientDetails;
//import org.springframework.security.oauth2.provider.OAuth2Authentication;
//import org.springframework.security.oauth2.provider.OAuth2Request;
//import org.springframework.security.oauth2.provider.TokenRequest;
//import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
//import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.Map;
//
///**
// * Created by 刘文彬 on 2018/5/4.
// */
//@RestController
//@RequestMapping("/token")
//@Api(value = "权限token模块", description = "权限token模块")
//public class TokenController {
//
//    @Autowired
//    private DefaultTokenServices defaultTokenServices;
//    @Autowired
//    private AuthenticationManager authenticationManager;
//    @Autowired
//    private ClientServiceProvider clientDetailsService;
//    @Autowired
//    private EmployFeign employFeign;
//
//    @PostMapping(BaseSecurityRequestMapping.BaseToken.api_update_token_expiration_time)
//    @ApiOperation(value = "更新token过期时间", notes = "根据token更新token过期时间")
//    public BaseEnvelop updateTokenExpiration(@ApiParam(name = "expiration", value = "token过期时间,格式:yyyy-mm-dd HH:mm:ss", required = true)
//                     @RequestParam(value = "expiration", required = true) String expiration,
//                     @ApiParam(name = "authHeaderValue", value = "登录的token", required = true)
//                     @RequestParam(value = "authHeaderValue", required = true) String authHeaderValue){
//
//        DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken)defaultTokenServices.readAccessToken(authHeaderValue);
//        if(token!=null){
//            token.setExpiration(DateUtil.strToDate(expiration));
//            return BaseEnvelop.getSuccess("token 过期时间设置成功!");
//        }
//        return BaseEnvelop.getError("token 无效!");
//    }
//
//    @PostMapping(BaseSecurityRequestMapping.BaseToken.api_update_token_expiration_second)
//    @ApiOperation(value = "延长token的过期时间", notes = "根据token延长token的过期时间")
//    public BaseEnvelop updateTokenExpiration(@ApiParam(name = "seconds", value = "延长token过期时间分钟数", required = true)
//                                             @RequestParam(value = "seconds", required = true) int seconds,
//                                             @ApiParam(name = "authHeaderValue", value = "登录的token", required = true)
//                                             @RequestParam(value = "authHeaderValue", required = true) String authHeaderValue){
//
//        DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken)defaultTokenServices.readAccessToken(authHeaderValue);
//        if(token!=null){
//            token.setExpiration(new Date(System.currentTimeMillis() + (seconds * 1000L)));
//            return BaseEnvelop.getSuccess("token 过期时间设置成功!");
//        }
//        return BaseEnvelop.getError("token 无效!");
//    }
//
//    @PostMapping(BaseSecurityRequestMapping.BaseToken.api_update_token_expiration)
//    @ApiOperation(value = "设置token过期", notes = "设置token过期")
//    public BaseEnvelop updateTokenExpiration2(HttpServletRequest request, HttpServletResponse response,
//                                              @ApiParam(name = "authHeaderValue", value = "登录的token", required = true)
//                                              @RequestParam(value = "authHeaderValue", required = true) String authHeaderValue){
//
//        DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken)defaultTokenServices.readAccessToken(authHeaderValue);
//        if(token!=null){
//            token.setExpiration(new Date());
//            return BaseEnvelop.getSuccess("token 过期时间设置成功!");
//        }
//        return BaseEnvelop.getError("token 无效!");
//    }
//
//    @PostMapping(BaseSecurityRequestMapping.BaseToken.api_update_token_expiration_second2)
//    @ApiOperation(value = "设置token过期", notes = "设置token过期")
//    public BaseEnvelop updateTokenExpiration3(HttpServletRequest request, HttpServletResponse response,
//                                              @ApiParam(name = "mobileSaas", value = "mobile和saas组合,逗号分隔", required = true)
//                                              @RequestParam(value = "mobileSaas", required = true) String mobileSaas){
//
//        String[] sp = mobileSaas.split(",");
//        String phone = sp[0];
//        String saasId = sp[1];
//        Envelop envelop = employFeign.getEmployeeByPhoneAndSaasId(phone,saasId);
//        Map baseEmployDO =  (Map)envelop.getObj();
//        if(baseEmployDO.isEmpty()){
//            return BaseEnvelop.getError("该用户不存在!");
//        }
//        UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(
//                mobileSaas, baseEmployDO.get("password"));
//
//        // Allow subclasses to set the "details" property
//        authRequest.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
//
//        Authentication authentication = authenticationManager.authenticate(authRequest);
//        ClientDetails clientDetails = clientDetailsService.loadClientByClientId(saasId);
//        TokenRequest tokenRequest = new TokenRequest(MapUtils.EMPTY_MAP, saasId, clientDetails.getScope(), "custom_password");
//
//        OAuth2Request oAuth2Request = tokenRequest.createOAuth2Request(clientDetails);
//
//        OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(oAuth2Request, authentication);
//
//        DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken)defaultTokenServices.getAccessToken(oAuth2Authentication);
//        if(token!=null){
//            token.setExpiration(new Date());
//            return BaseEnvelop.getSuccess("token 过期时间设置成功!");
//        }
//        return BaseEnvelop.getError("token 无效!");
//    }
//}

+ 1 - 1
web-gateway/src/main/java/com/yihu/jw/controller/iot/device/IotPatientDeviceController.java

@ -6,11 +6,11 @@ import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.iot.device.LocationDataVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import iot.device.LocationDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;

+ 14 - 14
web-gateway/src/main/resources/application.yml

@ -11,20 +11,20 @@ spring:
      enabled: true
      enabled: true
      max-file-size: 500MB
      max-file-size: 500MB
      max-request-size: 500MB
      max-request-size: 500MB
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true
    # JEST (Elasticsearch HTTP client) (JestProperties)
  elasticsearch:
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
#      uris: http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true
#  data:
#    elasticsearch: #ElasticsearchProperties
#      cluster-name: jkzl #默认即为elasticsearch  集群名
#      cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#      local: false #是否本地连接
#      properties: # Additional properties used to configure the client.
#        enable: true
#    # JEST (Elasticsearch HTTP client) (JestProperties)
#  elasticsearch:
#    jest:
#      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
##      uris: http://172.19.103.68:9200
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true
  redis:
  redis:
    host: 172.19.103.88 # Redis server host.
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
    port: 6379 # Redis server port.