瀏覽代碼

Merge remote-tracking branch 'origin/dev' into dev

hill9868 6 年之前
父節點
當前提交
91565a0091
共有 37 個文件被更改,包括 2067 次插入79 次删除
  1. 59 11
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityDO.java
  2. 36 0
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/CreditsDetailDO.java
  3. 8 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java
  4. 3 3
      server/svr-authentication/src/main/resources/bootstrap.yml
  5. 3 39
      svr/svr-base/src/main/resources/application.yml
  6. 236 0
      svr/svr-internet-hospital-entrance/pom.xml
  7. 4 0
      svr/svr-internet-hospital-entrance/readme.MD
  8. 0 0
      svr/svr-internet-hospital-entrance/sql/sql
  9. 24 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/SvrInternetHospitalEntranceApplication.java
  10. 18 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/config/SpringSecurityAuditorAware.java
  11. 44 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/config/SwaggerDocs.java
  12. 90 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/useragent/UserAgent.java
  13. 182 0
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  14. 5 0
      svr/svr-internet-hospital-entrance/src/main/resources/banner.txt
  15. 40 0
      svr/svr-internet-hospital-entrance/src/main/resources/bootstrap.yml
  16. 236 0
      svr/svr-internet-hospital/pom.xml
  17. 4 0
      svr/svr-internet-hospital/readme.MD
  18. 0 0
      svr/svr-internet-hospital/sql/sql
  19. 24 0
      svr/svr-internet-hospital/src/main/java/com/yihu/SvrInternetHospitalApplication.java
  20. 18 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/config/SpringSecurityAuditorAware.java
  21. 44 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/config/SwaggerDocs.java
  22. 90 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/useragent/UserAgent.java
  23. 182 0
      svr/svr-internet-hospital/src/main/resources/application.yml
  24. 6 0
      svr/svr-internet-hospital/src/main/resources/banner.txt
  25. 40 0
      svr/svr-internet-hospital/src/main/resources/bootstrap.yml
  26. 2 2
      svr/svr-patient/src/main/resources/bootstrap.yml
  27. 1 1
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/AccountController.java
  28. 120 2
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActivityController.java
  29. 76 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java
  30. 0 3
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskController.java
  31. 7 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/ActivityDao.java
  32. 270 17
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java
  33. 185 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java
  34. 5 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/util/ISqlUtils.java
  35. 1 0
      svr/svr-wlyy-health-bank/src/main/resources/application.yml
  36. 1 1
      svr/svr-wlyy-health-bank/src/main/resources/bootstrap.yml
  37. 3 0
      wlyy-parent-pom/pom.xml

+ 59 - 11
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityDO.java

@ -80,8 +80,8 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    @Column(name="limit_register")
    private Integer limitRegister;//报名限制 0、所有居民可以报名,1、仅当前居民账号可报名
    @Column(name = "count")
    private Long count;//报名人数
    @Column(name = "registration_number")
    private String registrationNumber;//报名人数
    @Column(name = "globel_template")
    private String globelTemplate;//通用模板
@ -105,6 +105,12 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    @Column(name = "area_name")
    private String areaName;
    @Column(name = "introduction")
    private String introduction;
    @Column(name = "sort")
    private Integer sort;
    @Transient
    private String patientId;//居民id
@ -142,6 +148,12 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
    @Transient
    private List<TaskGoodsDO> taskGoodsDOS;//活动奖品
    @Transient
    private Integer flag;//标识是否为正在进行的活动 1、正在进行0,还未开始
    @Transient
    private Long nowTotal;//今日积分
    @Column(name = "saas_id")
    public String getSaasId() {
@ -387,15 +399,6 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.info = info;
    }
    @Column(name = "count")
    public Long getCount() {
        return count;
    }
    public void setCount(Long count) {
        this.count = count;
    }
    @Transient
    public ActivityRuleDO getActivityRuleDO() {
@ -461,6 +464,51 @@ public class ActivityDO extends UuidIdentityEntityWithOperator implements Serial
        this.areaName = areaName;
    }
    @Column(name = "registration_number")
    public String getRegistrationNumber() {
        return registrationNumber;
    }
    public void setRegistrationNumber(String registrationNumber) {
        this.registrationNumber = registrationNumber;
    }
    @Column(name = "introduction")
    public String getIntroduction() {
        return introduction;
    }
    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Transient
    public Integer getFlag() {
        return flag;
    }
    public void setFlag(Integer flag) {
        this.flag = flag;
    }
    @Transient
    public Long getNowTotal() {
        return nowTotal;
    }
    public void setNowTotal(Long nowTotal) {
        this.nowTotal = nowTotal;
    }
/*
    @Column(name = "del")

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

@ -97,6 +97,15 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
    @Transient
    private String uploadTime; //上传时间
    @Transient
    private Integer type;//2平台积分,1签约
    @Transient
    private String monday;//一周的星期一
    @Transient
    private String sunday;//一周的星期日
    @Column(name = "saas_id")
@ -342,4 +351,31 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
    public void setUploadTime(String uploadTime) {
        this.uploadTime = uploadTime;
    }
    @Transient
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Transient
    public String getMonday() {
        return monday;
    }
    public void setMonday(String monday) {
        this.monday = monday;
    }
    @Transient
    public String getSunday() {
        return sunday;
    }
    public void setSunday(String sunday) {
        this.sunday = sunday;
    }
}

+ 8 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java

@ -75,5 +75,13 @@ public class HealthBankMapping {
        public static final String shareIntegrate = "/shareIntegrate";
        public static final String payIntegrate = "/payIntegrate";
        public static final String refund="/refund";
        public static final String selectActivitys="/selectActivitys";
        public static final String updateSort="/updateSort";
        public static final String selectByUnionId="/selectByUnionId";
        public static final String selectNowByUnionId = "/selectNowByUnionId";
        public static final String selectAppletsRanking = "/selectAppletsRanking";
        public static final String share = "/share";
        public static final String weekRewardAndIntegrate = "/weekRewardAndIntegrate";
        public static final String selectWeekReward="/selectWeekReward";
    }
}

+ 3 - 3
server/svr-authentication/src/main/resources/bootstrap.yml

@ -12,7 +12,7 @@ spring:
  profiles: jwdev
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
@ -20,7 +20,7 @@ spring:
  profiles: jwtest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
@ -28,5 +28,5 @@ spring:
  profiles: jwprod
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwprod}

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

@ -1,42 +1,6 @@
<<<<<<< HEAD
#通用的配置不用区分环境变量
server:
  port: ${server.svr-base-port}
=======
##如果有配置服务的话,远程服务器和本地服务器配置不一致的情况下,优先远程的为主  git上 svr-base ->  git application ->本地 appliction ->本地 bootstarp
spring:
  application:
    name: svr-base  #注册到发现服务的id 如果id一样 eurika会自动做负载
#  jmx:
#    default-domain: svr-base
  jmx:
    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: true
#      properties:
#        client:
#          transport:
#            sniff: false #开启嗅探集群  用nginx代理一层过后会出现ip解析失败问题
management:
  security:
    enabled: false #关闭 refresh的权限认证
health:
  config:
    enabled: true
endpoints:
  info:
    enabled: true
>>>>>>> eb49bc9a23d809112535a9bde36737ef12f77756
spring:
  datasource:
@ -128,7 +92,7 @@ spring:
    user: admin
    password: admin
  redis:
    host: 172.19.103.88 # Redis server host.
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
#  zipkin:
@ -145,7 +109,7 @@ spring:
  datasource:
    url: jdbc:mysql://172.26.0.104/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg
    password: ssgg@jkzl2019
#    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
#    username: root
#    password: 123456
@ -162,7 +126,7 @@ spring:
    user: admin
    password: admin
  redis:
    host: 172.19.103.88 # Redis server host.
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/

+ 236 - 0
svr/svr-internet-hospital-entrance/pom.xml

@ -0,0 +1,236 @@
<?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.jw</groupId>
        <artifactId>wlyy-parent-pom</artifactId>
        <version>2.0.0</version>
        <relativePath>../../wlyy-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-internet-hospital-entrance</artifactId>
    <packaging>war</packaging>
    <version>${parent.version}</version>
    <dependencies>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</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-eureka</artifactId>
        </dependency>
        <!--注释掉就不会读取git的配置,只会读取yml中的配置-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.cloud</groupId>-->
            <!--<artifactId>spring-cloud-starter-zipkin</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-activemq</artifactId>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>base-service</artifactId>
            <version>${parent.version}</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-web</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>com.yihu.jw</groupId>-->
            <!--<artifactId>common-tracer</artifactId>-->
        <!--</dependency>-->
        <!-- 文件服务器 -->
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>fastdfs-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!-- Jzkl Starter -->
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>swagger-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>elasticsearch-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.github.swagger2markup</groupId>
            <artifactId>swagger2markup</artifactId>
            <version>1.3.2</version>
            <exclusions>
                <exclusion>
                    <artifactId>mailapi</artifactId>
                    <groupId>javax.mail</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- 发送邮件 -->
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.4.7</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 start-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.yihu.ehr</groupId>
                    <artifactId>commons-util</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-collections4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <!-- xlsx  依赖这个包 -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <!--   poi xml导入导出工具 end -->
        <!--基础业务组件-->
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>base-service</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>sms-service</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>junit</groupId>-->
            <!--<artifactId>junit</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-commons</artifactId>
            <version>1.3.2</version>
        </dependency>
        <!--缩略图-->
        <dependency>
            <groupId>net.coobird</groupId>
            <artifactId>thumbnailator</artifactId>
            <version>0.4.8</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>svr-internet-hospital-entrance</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>com.yihu.SvrPatientApplication</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

+ 4 - 0
svr/svr-internet-hospital-entrance/readme.MD

@ -0,0 +1,4 @@
基础微服务
    每个模块有自己独立的文件夹,这样做的好处是以后如果哪个模块需要独立成微服务,代码直接剪切到新的微服务即可。
    每个模块下面有独立的Endpoint,service,model和dao
  

+ 0 - 0
svr/svr-internet-hospital-entrance/sql/sql


+ 24 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/SvrInternetHospitalEntranceApplication.java

@ -0,0 +1,24 @@
package com.yihu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
/**
 * Created by Trick on 2019/5/13.
 */
@SpringBootApplication
@EnableJpaAuditing
public class SvrInternetHospitalEntranceApplication extends SpringBootServletInitializer {
    public static void main(String[] args)  {
        SpringApplication.run(SvrInternetHospitalEntranceApplication.class, args);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(SvrInternetHospitalEntranceApplication.class);
    }
}

+ 18 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/config/SpringSecurityAuditorAware.java

@ -0,0 +1,18 @@
package com.yihu.jw.entrance.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
@Configuration
public class SpringSecurityAuditorAware implements AuditorAware {
    @Override
    public Object getCurrentAuditor() {
//        return Optional.ofNullable(SecurityContextHolder.getContext())
//                .map(SecurityContext::getAuthentication)
//                .filter(Authentication::isAuthenticated)
//                .map(Authentication::getPrincipal);
////                .map(Authentication::getDetails);
        return "123";
    }
}

+ 44 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/config/SwaggerDocs.java

@ -0,0 +1,44 @@
package com.yihu.jw.entrance.config;
import io.github.swagger2markup.GroupBy;
import io.github.swagger2markup.Language;
import io.github.swagger2markup.Swagger2MarkupConfig;
import io.github.swagger2markup.Swagger2MarkupConverter;
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
import io.github.swagger2markup.markup.builder.MarkupLanguage;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
 * Created by lith on 2018/11/23
 */
public class SwaggerDocs {
    public static void main(String[] args) throws Exception {
        //1.请求 http://ip:port/swagger-resources获取group
        String group = "Default";
        //2.定义请求地址 new URL("http://ip:port/v2/api-docs?group=" + groupName)
        //项目的swagger-ui地址
        URL remoteSwaggerFile = new URL("http://127.0.0.1:10023/v2/api-docs?group=" + group);
        //3.定义文件输出路径
        String prefix = Thread.currentThread().getContextClassLoader().getResource("").getPath();
        //文档输出地址
        Path outputFile = Paths.get(prefix.substring(prefix.lastIndexOf(":") + 1, prefix.indexOf("target") - 1) + "/build/" + group);
        Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
                .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
                .withOutputLanguage(Language.ZH)
                .withPathsGroupedBy(GroupBy.TAGS)
                .withGeneratedExamples()
                .withoutInlineSchema()
                //.withBasePathPrefix()
                .build();
        Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(remoteSwaggerFile)
                .withConfig(config)
                .build();
        converter.toFile(outputFile);
    }
}

+ 90 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/useragent/UserAgent.java

@ -0,0 +1,90 @@
package com.yihu.jw.entrance.useragent;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
 * 用户头部信息获取
 * Created by Trick on 2018/10/30.
 */
@Component
public class UserAgent {
    /**
     * 获取当前登录人ID
     * @return
     */
    public String getUID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("uid");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取登录人姓名
     * @return
     */
    public String getUNAME(){
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            String info = json.getString("uname");
            String uname = java.net.URLDecoder.decode(info,"UTF-8");
            return uname;
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取角色ID
     * @return
     */
    public String getROLEID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("roleid");
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getUserAgent(){
        try{
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            JSONObject user = JSON.parseObject(userAgent);
            return user;
        }catch (Exception e){
            return null;
        }
    }
}

+ 182 - 0
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -0,0 +1,182 @@
#通用的配置不用区分环境变量
server:
  port: ${server.svr-internet-hospital-entrance}
spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 50
    max-idle: 50 #最大空闲连接
    min-idle: 10 #最小空闲连接
    validation-query-timeout: 20
    log-validation-errors: true
    validation-interval: 60000 #避免过度验证,保证验证不超过这个频率——以毫秒为单位。如果一个连接应该被验证,但上次验证未达到指定间隔,将不再次验证。
    validation-query: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
    test-on-borrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
    test-on-return: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
    idle-timeout: 30000
    connection-test-query: SELECT 1
    num-tests-per-eviction-run: 50 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
    test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  http:
    multipart:
      max-file-size: 5MB
  redis:
    database: 0 # Database index used by the connection factory.
    password: # Login password of the redis server.
    timeout: 120000 # 连接超时时间(毫秒) 60秒
    pool:
      max-active: 20 # 连接池最大连接数(使用负值表示没有限制)
      max-wait: -1  # 连接池最大阻塞等待时间(使用负值表示没有限制)
      max-idle: 20  # 连接池中的最大空闲连接
      min-idle: 5  # 连接池中的最小空闲连接
  mail:
    default-encoding: UTF-8
#端口
    port: 25
#协议
    protocol: smtp
    properties.mail.smtp.auth: true
    properties.mail.smtp.starttls.enable: true
    properties.mail.smtp.starttls.required: true
    host: smtp.163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#发送者的邮箱账号
    username: i_jiankang@163.com
es:
  index:
    servicePackLog: base_service_package_log
  type:
    servicePackLog: base_service_package_log
fast-dfs:
  tracker-server: 172.19.103.54:22122 #服务器地址
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  charset: ISO8859-1 #编码
  http:
    tracker-http-port: 80
    anti-steal-token: no
    secret-key: FastDFS1234567890
  pool: #连接池大小
    init-size: 5
    max-size: 20
    wait-time: 500
configDefault: # 默认配置
  saasId: xmjkzl_saasId
---
spring:
  profiles: jwdev
  datasource:
#    url: jdbc:mysql://172.17.110.160/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#    username: ssgg
#    password: ssgg
    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
  http:
    multipart:
      location: D:/work/soft_dev/IdeaWorkSpace/wlyy2.0/svr/svr-patient/temp_file/
      resolve-lazily: true
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.19.103.87:61616
    user: admin
    password: admin
  redis:
    host: 192.168.131.172 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
#  zipkin:
#    base-url: http://localhost:9411 #日志追踪的地址
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
# 短信发送地址
jw:
  smsUrl: http://svr-base:10020/sms_gateway/send
myFamily:
  qrCodeFailurTime: 7
wechat:
  id: 97ed8a0a-4f07-4b85-ab02-b716c611a464  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
---
spring:
  profiles: jwtest
  datasource:
    url: jdbc:mysql://172.17.110.160/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg
#    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
#    username: root
#    password: 123456
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.19.103.87:61616
    user: admin
    password: admin
  redis:
    host: 192.168.131.172 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
wechat:
  id: 97ed8a0a-4f07-4b85-ab02-b716c611a464  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
myFamily:
  qrCodeFailurTime: 7
---
spring:
  profiles: prod
  datasource:
    url: jdbc:mysql://59.61.92.90:9069/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: jkzlehr@123
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 59.61.92.90:9066,59.61.92.90:9068 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://59.61.92.90:9065,http://59.61.92.90:9067
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://59.61.92.90:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 192.168.131.172 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP #todo 待配置
myFamily:
  qrCodeFailurTime: 7

+ 5 - 0
svr/svr-internet-hospital-entrance/src/main/resources/banner.txt

@ -0,0 +1,5 @@
  ____                   ___           _                                  _     _   _                         _   _             _   _____           _
 / ___|  __   __  _ __  |_ _|  _ __   | |_    ___   _ __   _ __     ___  | |_  | | | |   ___    ___   _ __   (_) | |_    __ _  | | | ____|  _ __   | |_   _ __    __ _   _ __     ___    ___
 \___ \  \ \ / / | '__|  | |  | '_ \  | __|  / _ \ | '__| | '_ \   / _ \ | __| | |_| |  / _ \  / __| | '_ \  | | | __|  / _` | | | |  _|   | '_ \  | __| | '__|  / _` | | '_ \   / __|  / _ \
  ___) |  \ V /  | |     | |  | | | | | |_  |  __/ | |    | | | | |  __/ | |_  |  _  | | (_) | \__ \ | |_) | | | | |_  | (_| | | | | |___  | | | | | |_  | |    | (_| | | | | | | (__  |  __/
 |____/    \_/   |_|    |___| |_| |_|  \__|  \___| |_|    |_| |_|  \___|  \__| |_| |_|  \___/  |___/ | .__/  |_|  \__|  \__,_| |_| |_____| |_| |_|  \__| |_|     \__,_| |_| |_|  \___|  \___|

+ 40 - 0
svr/svr-internet-hospital-entrance/src/main/resources/bootstrap.yml

@ -0,0 +1,40 @@
spring:
  application:
    name: svr-internet-hospital-entrance
  cloud:
    config:
      failFast: true
      username: jw
      password: jkzl
---
spring:
  profiles: jwdev
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwtest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: prod
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      label: ${wlyy.spring.config.label:prod}
---
spring:
  profiles: local
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      label: ${wlyy.spring.config.label:local}

+ 236 - 0
svr/svr-internet-hospital/pom.xml

@ -0,0 +1,236 @@
<?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.jw</groupId>
        <artifactId>wlyy-parent-pom</artifactId>
        <version>2.0.0</version>
        <relativePath>../../wlyy-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-internet-hospital</artifactId>
    <packaging>war</packaging>
    <version>${parent.version}</version>
    <dependencies>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</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-eureka</artifactId>
        </dependency>
        <!--注释掉就不会读取git的配置,只会读取yml中的配置-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.cloud</groupId>-->
            <!--<artifactId>spring-cloud-starter-zipkin</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-activemq</artifactId>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>base-service</artifactId>
            <version>${parent.version}</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-web</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>com.yihu.jw</groupId>-->
            <!--<artifactId>common-tracer</artifactId>-->
        <!--</dependency>-->
        <!-- 文件服务器 -->
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>fastdfs-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!-- Jzkl Starter -->
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>swagger-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>elasticsearch-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.github.swagger2markup</groupId>
            <artifactId>swagger2markup</artifactId>
            <version>1.3.2</version>
            <exclusions>
                <exclusion>
                    <artifactId>mailapi</artifactId>
                    <groupId>javax.mail</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- 发送邮件 -->
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.4.7</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 start-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.yihu.ehr</groupId>
                    <artifactId>commons-util</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-collections4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <!-- xlsx  依赖这个包 -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <!--   poi xml导入导出工具 end -->
        <!--基础业务组件-->
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>base-service</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>sms-service</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>junit</groupId>-->
            <!--<artifactId>junit</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-commons</artifactId>
            <version>1.3.2</version>
        </dependency>
        <!--缩略图-->
        <dependency>
            <groupId>net.coobird</groupId>
            <artifactId>thumbnailator</artifactId>
            <version>0.4.8</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>svr-internet-hospital</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>com.yihu.SvrPatientApplication</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

+ 4 - 0
svr/svr-internet-hospital/readme.MD

@ -0,0 +1,4 @@
基础微服务
    每个模块有自己独立的文件夹,这样做的好处是以后如果哪个模块需要独立成微服务,代码直接剪切到新的微服务即可。
    每个模块下面有独立的Endpoint,service,model和dao
  

+ 0 - 0
svr/svr-internet-hospital/sql/sql


+ 24 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/SvrInternetHospitalApplication.java

@ -0,0 +1,24 @@
package com.yihu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
/**
 * Created by Trick on 2019/5/13.
 */
@SpringBootApplication
@EnableJpaAuditing
public class SvrInternetHospitalApplication extends SpringBootServletInitializer {
    public static void main(String[] args)  {
        SpringApplication.run(SvrInternetHospitalApplication.class, args);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(SvrInternetHospitalApplication.class);
    }
}

+ 18 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/config/SpringSecurityAuditorAware.java

@ -0,0 +1,18 @@
package com.yihu.jw.hospital.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
@Configuration
public class SpringSecurityAuditorAware implements AuditorAware {
    @Override
    public Object getCurrentAuditor() {
//        return Optional.ofNullable(SecurityContextHolder.getContext())
//                .map(SecurityContext::getAuthentication)
//                .filter(Authentication::isAuthenticated)
//                .map(Authentication::getPrincipal);
////                .map(Authentication::getDetails);
        return "123";
    }
}

+ 44 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/config/SwaggerDocs.java

@ -0,0 +1,44 @@
package com.yihu.jw.hospital.config;
import io.github.swagger2markup.GroupBy;
import io.github.swagger2markup.Language;
import io.github.swagger2markup.Swagger2MarkupConfig;
import io.github.swagger2markup.Swagger2MarkupConverter;
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
import io.github.swagger2markup.markup.builder.MarkupLanguage;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
 * Created by lith on 2018/11/23
 */
public class SwaggerDocs {
    public static void main(String[] args) throws Exception {
        //1.请求 http://ip:port/swagger-resources获取group
        String group = "Default";
        //2.定义请求地址 new URL("http://ip:port/v2/api-docs?group=" + groupName)
        //项目的swagger-ui地址
        URL remoteSwaggerFile = new URL("http://127.0.0.1:10022/v2/api-docs?group=" + group);
        //3.定义文件输出路径
        String prefix = Thread.currentThread().getContextClassLoader().getResource("").getPath();
        //文档输出地址
        Path outputFile = Paths.get(prefix.substring(prefix.lastIndexOf(":") + 1, prefix.indexOf("target") - 1) + "/build/" + group);
        Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
                .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
                .withOutputLanguage(Language.ZH)
                .withPathsGroupedBy(GroupBy.TAGS)
                .withGeneratedExamples()
                .withoutInlineSchema()
                //.withBasePathPrefix()
                .build();
        Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(remoteSwaggerFile)
                .withConfig(config)
                .build();
        converter.toFile(outputFile);
    }
}

+ 90 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/useragent/UserAgent.java

@ -0,0 +1,90 @@
package com.yihu.jw.hospital.useragent;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
 * 用户头部信息获取
 * Created by Trick on 2018/10/30.
 */
@Component
public class UserAgent {
    /**
     * 获取当前登录人ID
     * @return
     */
    public String getUID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("uid");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取登录人姓名
     * @return
     */
    public String getUNAME(){
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            String info = json.getString("uname");
            String uname = java.net.URLDecoder.decode(info,"UTF-8");
            return uname;
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取角色ID
     * @return
     */
    public String getROLEID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("roleid");
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getUserAgent(){
        try{
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            JSONObject user = JSON.parseObject(userAgent);
            return user;
        }catch (Exception e){
            return null;
        }
    }
}

+ 182 - 0
svr/svr-internet-hospital/src/main/resources/application.yml

@ -0,0 +1,182 @@
#通用的配置不用区分环境变量
server:
  port: ${server.svr-internet-hospital}
spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 50
    max-idle: 50 #最大空闲连接
    min-idle: 10 #最小空闲连接
    validation-query-timeout: 20
    log-validation-errors: true
    validation-interval: 60000 #避免过度验证,保证验证不超过这个频率——以毫秒为单位。如果一个连接应该被验证,但上次验证未达到指定间隔,将不再次验证。
    validation-query: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
    test-on-borrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
    test-on-return: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
    idle-timeout: 30000
    connection-test-query: SELECT 1
    num-tests-per-eviction-run: 50 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
    test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  http:
    multipart:
      max-file-size: 5MB
  redis:
    database: 0 # Database index used by the connection factory.
    password: # Login password of the redis server.
    timeout: 120000 # 连接超时时间(毫秒) 60秒
    pool:
      max-active: 20 # 连接池最大连接数(使用负值表示没有限制)
      max-wait: -1  # 连接池最大阻塞等待时间(使用负值表示没有限制)
      max-idle: 20  # 连接池中的最大空闲连接
      min-idle: 5  # 连接池中的最小空闲连接
  mail:
    default-encoding: UTF-8
#端口
    port: 25
#协议
    protocol: smtp
    properties.mail.smtp.auth: true
    properties.mail.smtp.starttls.enable: true
    properties.mail.smtp.starttls.required: true
    host: smtp.163.com
#发送者的邮箱密码
    password: xmijk181016jkzl
#发送者的邮箱账号
    username: i_jiankang@163.com
es:
  index:
    servicePackLog: base_service_package_log
  type:
    servicePackLog: base_service_package_log
fast-dfs:
  tracker-server: 172.19.103.54:22122 #服务器地址
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  charset: ISO8859-1 #编码
  http:
    tracker-http-port: 80
    anti-steal-token: no
    secret-key: FastDFS1234567890
  pool: #连接池大小
    init-size: 5
    max-size: 20
    wait-time: 500
configDefault: # 默认配置
  saasId: xmjkzl_saasId
---
spring:
  profiles: jwdev
  datasource:
#    url: jdbc:mysql://172.17.110.160/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#    username: ssgg
#    password: ssgg
    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
  http:
    multipart:
      location: D:/work/soft_dev/IdeaWorkSpace/wlyy2.0/svr/svr-patient/temp_file/
      resolve-lazily: true
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.19.103.87:61616
    user: admin
    password: admin
  redis:
    host: 192.168.131.172 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
#  zipkin:
#    base-url: http://localhost:9411 #日志追踪的地址
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
# 短信发送地址
jw:
  smsUrl: http://svr-base:10020/sms_gateway/send
myFamily:
  qrCodeFailurTime: 7
wechat:
  id: 97ed8a0a-4f07-4b85-ab02-b716c611a464  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
---
spring:
  profiles: jwtest
  datasource:
    url: jdbc:mysql://172.17.110.160/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg
#    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
#    username: root
#    password: 123456
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://172.19.103.87:61616
    user: admin
    password: admin
  redis:
    host: 192.168.131.172 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
wechat:
  id: 97ed8a0a-4f07-4b85-ab02-b716c611a464  # base库中,wx_wechat 的id字段
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP
myFamily:
  qrCodeFailurTime: 7
---
spring:
  profiles: prod
  datasource:
    url: jdbc:mysql://59.61.92.90:9069/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: jkzlehr@123
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 59.61.92.90:9066,59.61.92.90:9068 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://59.61.92.90:9065,http://59.61.92.90:9067
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://59.61.92.90:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 192.168.131.172 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段  # todo 待配置
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP #todo 待配置
myFamily:
  qrCodeFailurTime: 7

+ 6 - 0
svr/svr-internet-hospital/src/main/resources/banner.txt

@ -0,0 +1,6 @@
                               _           _                                  _             _                             _   _             _ 
  ___  __   __  _ __          (_)  _ __   | |_    ___   _ __   _ __     ___  | |_          | |__     ___    ___   _ __   (_) | |_    __ _  | |
 / __| \ \ / / | '__|  _____  | | | '_ \  | __|  / _ \ | '__| | '_ \   / _ \ | __|  _____  | '_ \   / _ \  / __| | '_ \  | | | __|  / _` | | |
 \__ \  \ V /  | |    |_____| | | | | | | | |_  |  __/ | |    | | | | |  __/ | |_  |_____| | | | | | (_) | \__ \ | |_) | | | | |_  | (_| | | |
 |___/   \_/   |_|            |_| |_| |_|  \__|  \___| |_|    |_| |_|  \___|  \__|         |_| |_|  \___/  |___/ | .__/  |_|  \__|  \__,_| |_|
                                                                                                                 |_|                          

+ 40 - 0
svr/svr-internet-hospital/src/main/resources/bootstrap.yml

@ -0,0 +1,40 @@
spring:
  application:
    name: svr-internet-hospital
  cloud:
    config:
      failFast: true
      username: jw
      password: jkzl
---
spring:
  profiles: jwdev
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwtest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: prod
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      label: ${wlyy.spring.config.label:prod}
---
spring:
  profiles: local
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      label: ${wlyy.spring.config.label:local}

+ 2 - 2
svr/svr-patient/src/main/resources/bootstrap.yml

@ -12,7 +12,7 @@ spring:
  profiles: jwdev
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
@ -20,7 +20,7 @@ spring:
  profiles: jwtest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---

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

@ -171,7 +171,7 @@ public class AccountController extends EnvelopRestEndpoint {
    public MixEnvelop<AccountDO, AccountDO> selectByPatient(@ApiParam(name = "patientId",value = "居民id")
                                                                   @RequestParam(value = "patientId",required = true)String patientId,
                                                            @ApiParam(name = "name",value = "名字")
                                                            @RequestParam(value = "name",required = true)String name,
                                                            @RequestParam(value = "name",required = false)String name,
                                                            @ApiParam(name = "hospital",value = "机构code")
                                                                @RequestParam(value = "hospital",required = false)String hospital,
                                                            @ApiParam(name = "hospitalName",value = "机构名称")

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

@ -52,6 +52,8 @@ public class ActivityController extends EnvelopRestEndpoint {
    @ApiOperation(value = "发布活动")
    public MixEnvelop<Boolean, Boolean> publishActivity(@ApiParam(name = "activity",value = "健康活动JSON")
                                          @RequestParam(value = "activity",required = true)String activity,
                                                        @ApiParam(name = "registrationNumber",value = "报名人数")
                                                        @RequestParam(value = "registrationNumber",required = false)String registrationNumber,
                                                        @ApiParam(name = "value1",value = "积分JSON")
                                                        @RequestParam(value = "value1",required = false)String value1,
                                                        @ApiParam(name = "value2",value = "时间规则")
@ -60,7 +62,7 @@ public class ActivityController extends EnvelopRestEndpoint {
                                                            @RequestParam(value = "value3",required = false)String value3){
        try {
            ActivityDO activityDO = toEntity(activity,ActivityDO.class);
            return service.insert(activityDO,value1,value2,value3);
            return service.insert(activityDO,value1,value2,value3,registrationNumber);
        }catch (Exception e){
            e.printStackTrace();
//            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -105,6 +107,8 @@ public class ActivityController extends EnvelopRestEndpoint {
    @ApiOperation(value = "编辑活动")
    public MixEnvelop<Boolean, Boolean> outActivity(@ApiParam(name = "activity", value = "健康活动JSON")
                                                    @RequestParam(value = "activity", required = true) String activity,
                                                    @ApiParam(name = "registrationNumber",value = "报名人数")
                                                    @RequestParam(value = "registrationNumber",required = false)String registrationNumber,
                                                    @ApiParam(name = "value1", value = "活动币JSON")
                                                    @RequestParam(value = "value1", required = false) String value1,
                                                    @ApiParam(name = "value2", value = "活动时间")
@ -113,7 +117,7 @@ public class ActivityController extends EnvelopRestEndpoint {
                                                    @RequestParam(value = "value3", required = false) String value3) {
        try {
            ActivityDO activityDO = toEntity(activity, ActivityDO.class);
            return service.update(activityDO,value1,value2,value3);
            return service.update(activityDO,value1,value2,value3,registrationNumber);
        } catch (Exception e) {
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -330,6 +334,120 @@ public class ActivityController extends EnvelopRestEndpoint {
    }
    /**
     * 获取排序数据
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectActivitys)
    @ApiOperation(value = "获取排序数据")
    public MixEnvelop<ActivityDO,ActivityDO> select() {
        try {
            MixEnvelop<ActivityDO,ActivityDO> envelop = new MixEnvelop<>();
            envelop.setDetailModelList(service.select());
            return  envelop;
        } catch (Exception e) {
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 调整顺序
     * @param activitys
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.updateSort)
    @ApiOperation(value = "调整顺序")
    public MixEnvelop updateSort(String activitys) {
        try {
            JSONArray array = JSONArray.parseArray(activitys);
            return  service.updateSort(array);
        } catch (Exception e) {
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = HealthBankMapping.healthBank.selectByUnionId)
    @ApiOperation(value = "查询参与的竟步走活动")
    public MixEnvelop<ActivityDO, ActivityDO> selectActivityRanking(@ApiParam(name="unionId",value = "unionId")
                                                                    @RequestParam(value = "unionId",required = true)String unionId,
                                                                    @ApiParam(name="patient",value = "居民id")
                                                                    @RequestParam(value = "patient",required = false)String patient,
                                                                    @ApiParam(name="idCard",value = "身份证")
                                                                        @RequestParam(value = "idCard",required = false)String idCard,
                                                                    @ApiParam(name = "page", value = "第几页,从1开始")
                                                                    @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                                                    @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                                                    @RequestParam(value = "size", required = false)Integer size){
        try{
            return service.selectByUnionId(unionId,patient,idCard,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 获取当前居民参加的活动
     * @param unionId
     * @param patient
     * @param idCard
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectNowByUnionId)
    @ApiOperation(value = "获取当前居民参加的活动")
    public MixEnvelop<ActivityDO, ActivityDO> selectNowByUnionId(@ApiParam(name="unionId",value = "unionId")
                                                                    @RequestParam(value = "unionId",required = true)String unionId,
                                                                    @ApiParam(name="patient",value = "居民id")
                                                                    @RequestParam(value = "patient",required = false)String patient,
                                                                    @ApiParam(name="idCard",value = "身份证")
                                                                    @RequestParam(value = "idCard",required = false)String idCard){
        try{
            MixEnvelop<ActivityDO,ActivityDO> envelop = new MixEnvelop<>();
            envelop.setDetailModelList(service.selectNowByUnionId(unionId,patient,idCard));
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 小程序-居民积分排行
     * @param patients
     * @param taskId
     * @param size
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectAppletsRanking)
    @ApiOperation(value = "小程序-居民积分排行")
    public MixEnvelop selectAppletsRanking(@ApiParam(name="flag",value = "居民code列表")
                                         @RequestParam(value = "flag",required = false)Integer flag,
                                         @ApiParam(name="flagName",value = "居民code列表")
                                         @RequestParam(value = "flagName",required = false)String flagName,
                                         @ApiParam(name="taskId",value = "任务id")
                                         @RequestParam(value = "taskId",required = true)String taskId,
                                         @ApiParam(name="size",value = "展示多少列")
                                         @RequestParam(value = "size",required = true)Integer size,
                                         @ApiParam(name="patient",value = "居民code")
                                         @RequestParam(value = "patient",required = true)String patient){
        try{
            MixEnvelop envelop = new MixEnvelop<>();
            envelop.setObj(service.selectAppletsRanking(flag,flagName,taskId,size,patient));
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }

+ 76 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java

@ -346,6 +346,28 @@ public class CreditsDetailController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 分享活动链接获取积分
     * @param creditsDetail
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.share)
    @ApiOperation(value = "分享活动链接获取积分")
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> share(@ApiParam(name = "creditsDetail",value = "积分记录JSON")
                                                                       @RequestParam(value = "creditsDetail",required = true)String creditsDetail){
        try {
            CreditsDetailDO creditsDetailDO = toEntity(creditsDetail,CreditsDetailDO.class);
            List<CreditsDetailDO> creditsDetailDOS = service.share(creditsDetailDO);
            MixEnvelop<CreditsDetailDO,CreditsDetailDO> envelop = new MixEnvelop<>();
            envelop.setDetailModelList(creditsDetailDOS);
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 商城积分支付
     *
@ -399,4 +421,58 @@ public class CreditsDetailController extends EnvelopRestEndpoint {
    }
    /**
     * 周奖励-连续/间断
     * @param creditsDetail
     * @param flag 1连续/2间断
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.weekRewardAndIntegrate)
    @ApiOperation(value = "周奖励-连续/间断")
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> weekRewardAndIntegrate(@ApiParam(name = "creditsDetail",value = "积分记录JSON")
                                                              @RequestParam(value = "creditsDetail",required = true)String creditsDetail,
                                                              @ApiParam(name = "flag",value = "积分记录JSON")
                                                              @RequestParam(value = "flag",required = true)Integer flag){
        try {
            CreditsDetailDO creditsDetailDO = toEntity(creditsDetail,CreditsDetailDO.class);
            return service.weekRewardAndIntegrate(creditsDetailDO,flag);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 查询周奖励
     * @param patient
     * @param taskId
     * @param monday
     * @param sunday
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectWeekReward)
    @ApiOperation(value = "查询周奖励")
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> selectWeekReward(@ApiParam(name = "patient",value = "居民code")
                                                                     @RequestParam(value = "patient",required = false)String patient,
                                                                     @ApiParam(name = "taskId",value = "任务id")
                                                                     @RequestParam(value = "taskId",required = false)String taskId,
                                                                     @ApiParam(name = "monday",value = "本周星期一")
                                                                     @RequestParam(value = "monday",required = false)String monday,
                                                                     @ApiParam(name = "sunday",value = "本周星期日")
                                                                     @RequestParam(value = "sunday",required = false)String sunday){
        try {
            List<CreditsDetailDO> creditsDetailDOS = service.selectWeekReward(patient,taskId,monday,sunday);
            MixEnvelop<CreditsDetailDO,CreditsDetailDO> envelop = new MixEnvelop<>();
            envelop.setDetailModelList(creditsDetailDOS);
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 0 - 3
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskController.java

@ -154,9 +154,6 @@ public class TaskController extends EnvelopRestEndpoint {
    /**//**
     * patient find health task
     *
     * @param patientId
     * @param page
     * @param size
     * @return
     *//*
    @GetMapping(value = HealthBankMapping.healthBank.findTask)

+ 7 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/ActivityDao.java

@ -17,4 +17,11 @@ public interface ActivityDao extends PagingAndSortingRepository<ActivityDO,Strin
    @Query("select t from ActivityDO t where t.type=?1 and (t.status=0 or t.status=1) and t.delFlag=1")
    List<ActivityDO> findByIdAndType(String type);
    @Query("select t from ActivityDO t where t.delFlag=1 order by t.sort ASC")
    List<ActivityDO> selectBySort();
    @Query("select t from ActivityDO t where t.recommended=?1  and t.delFlag=1")
    List<ActivityDO> findByIdAndRecommended(Integer recommended);
}

+ 270 - 17
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java

@ -62,16 +62,36 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
     * @return
     */
    @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
    public MixEnvelop<Boolean, Boolean> insert(ActivityDO activityDO,String value1,String value2,String value3){
    public MixEnvelop<Boolean, Boolean> insert(ActivityDO activityDO,String value1,String value2,String value3,String registrationNumber){
        if (value2 != null && value2 !=""){
            JSONObject object = JSONObject.parseObject(value2);
            activityDO.setActivityOfflineTime(object.getDate("activityOfflineTime"));
            activityDO.setRegistrationTime(object.getDate("registrationTime"));
            activityDO.setDeadLine(object.getDate("deadLine"));
            String activityOfflineTime = object.getString("activityOfflineTime");
            String[] str = activityOfflineTime.split(",");
            if (str.length == 2){
                activityDO.setActivityOfflineTime(DateUtil.strToDate(str[1]));
            }else {
                activityDO.setActivityOfflineTime(DateUtil.strToDate(str[0]));
            }
            String registrationTime = object.getString("registrationTime");
            String[] str1 = registrationTime.split(",");
            if(str1.length==2){
                activityDO.setRegistrationTime(DateUtil.strToDate(str1[1]));
            }else {
                activityDO.setRegistrationTime(DateUtil.strToDate(str1[0]));
            }
            String deadLine = object.getString("deadLine");
            String[] str2 = deadLine.split(",");
            if (str2.length==2){
                activityDO.setDeadLine(DateUtil.strToDate(str2[1]));
            }else {
                activityDO.setDeadLine(DateUtil.strToDate(str2[0]));
            }
        }
        activityDO.setCreateTime(new Date());
        activityDO.setUpdateTime(new Date());
        activityDO.setDelFlag(1);
        activityDO.setRegistrationNumber(registrationNumber);
        activityDO= activityDao.save(activityDO);
        if (value3 !=null && value3 !=""){
            JSONObject object = JSONObject.parseObject(value3);
@ -138,7 +158,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
     * @throws ParseException
     */
    public MixEnvelop<ActivityDO, ActivityDO> findByCondition(ActivityDO activityDO, Integer page, Integer size) throws ParseException {
        String sql = new ISqlUtils().getSql(activityDO,page,size,"*");
        String sql = new ISqlUtils().getSql(activityDO,page,size,"sort");
        List<ActivityDO> activityDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class));
        for (ActivityDO activityDO1:activityDOS){
            String taskSql = "SELECT" +
@ -190,17 +210,36 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
     * @return
     */
    @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
    public MixEnvelop<Boolean, Boolean> update(ActivityDO activityDO, String value1, String value2, String value3) throws Exception {
    public MixEnvelop<Boolean, Boolean> update(ActivityDO activityDO, String value1, String value2, String value3,String registrationNumber) throws Exception {
        if (StringUtils.isBlank(activityDO.getId())) {
            throw new Exception("活动id不能为空!");
        }
        if (StringUtils.isNotBlank(value2)){
            JSONObject object = JSONObject.parseObject(value2);
            activityDO.setActivityOfflineTime(object.getDate("activityOfflineTime"));
            activityDO.setRegistrationTime(object.getDate("registrationTime"));
            activityDO.setDeadLine(object.getDate("deadLine"));
            String activityOfflineTime = object.getString("activityOfflineTime");
            String[] str = activityOfflineTime.split(",");
            if (str.length == 2){
                activityDO.setActivityOfflineTime(DateUtil.strToDate(str[1]));
            }else {
                activityDO.setActivityOfflineTime(DateUtil.strToDate(str[0]));
            }
            String registrationTime = object.getString("registrationTime");
            String[] str1 = registrationTime.split(",");
            if(str1.length==2){
                activityDO.setRegistrationTime(DateUtil.strToDate(str1[1]));
            }else {
                activityDO.setRegistrationTime(DateUtil.strToDate(str1[0]));
            }
            String deadLine = object.getString("deadLine");
            String[] str2 = deadLine.split(",");
            if (str2.length==2){
                activityDO.setDeadLine(DateUtil.strToDate(str2[1]));
            }else {
                activityDO.setDeadLine(DateUtil.strToDate(str2[0]));
            }
        }
        activityDO.setRegistrationNumber(registrationNumber);
        activityDO.setUpdateTime(new Date());
        activityDO.setDelFlag(1);
        //删除活动任务与奖品
@ -268,7 +307,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
                "wlyy_health_bank_task_patient_detail" +
                " WHERE " +
                " patient_idcard = '"+activityDO.getPatientIdcard()+"' "+ condition+")" +
                " )" +
                " ) AND del_flag =1 " +
                " LIMIT "+(page-1)*size +","+size;
        List<ActivityDO> activityDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class));
        for (ActivityDO activityDO1:activityDOS){
@ -325,6 +364,8 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
                count2 = (Long) rstotal2.get(0).get("total1");
            }
            activityDO1.setTotal(count2);
            ActivityRuleDO activityRuleDO  = activityRuleDao.selectByActivityId(activityDO1.getId());
            activityDO1.setActivityRuleDO(activityRuleDO);
        }
        String sqlcount = "SELECT count(1) AS total" +
                " FROM wlyy_health_bank_activity " +
@ -432,8 +473,12 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
        ActivityRuleDO activityRuleDO= activityRuleDao.selectByActivityId(id);
        if("3".equals(type)){
            //推荐
            activityDO.setRecommended(1);
            List<ActivityDO> activityDOS = activityDao.findByIdAndRecommended(1);
            if (activityDOS!=null&& activityDOS.size()>=3){
                throw new Exception("只允许推荐三个!");
            }else {
                activityDO.setRecommended(1);
            }
        }else if("4".equals(type)){
            //取消推荐
            activityDO.setRecommended(0);
@ -443,12 +488,12 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
            activityDO.setStatus(2);
        }else if("0".equals(type)){
            //判断该活动是不是竞走,只能存在一条有效竞走
            if("竞走".equals(activityDO.getType())){
            /*if("竞走".equals(activityDO.getType())){
                List<ActivityDO>  lst=   activityDao.findByIdAndType(activityDO.getType());
                if(null!=lst&&lst.size()>0){
                    throw new Exception("已存在一条上线的竞走活动!");
                }
            }
            }*/
            //上线
            if(null!=activityRuleDO){
                String ruleJson=activityRuleDO.getValue2();
@ -456,11 +501,35 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
//                SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                //报名截止时间
                Date registrationTime=(null!=obj.get("registrationTime")? sdf2.parse(obj.get("registrationTime").toString()):null);
                String registrationTime1 = obj.getString("registrationTime");
                String[] str1 = registrationTime1.split(",");
                String s = null;
                if (str1.length==2) {
                    s=str1[1];
                }else {
                    s=str1[0];
                }
                Date registrationTime=(""!=s&&null!=s? sdf2.parse(s):null);
                //参与截止时间
                Date deadLine=(null!=obj.get("deadLine")? sdf2.parse(obj.get("deadLine").toString()):null);
                String deadLine2 = obj.getString("deadLine");
                String[] str2 = deadLine2.split(",");
                String s1= null;
                if (str2.length==2){
                    s1=str2[1];
                }else {
                    s1=str2[0];
                }
                Date deadLine=(null!=s1&&""!=s1? sdf2.parse(s1):null);
                //活动下线时间
                Date activityOfflineTime=(null!=obj.get("activityOfflineTime")? sdf2.parse(obj.get("activityOfflineTime").toString()):null);
                String activityOfflineTime1 = obj.getString("activityOfflineTime");
                String[] str = activityOfflineTime1.split(",");
                String s2= null;
                if (str.length==2){
                    s2=str[1];
                }else {
                    s2=str[0];
                }
                Date activityOfflineTime=(""!=s2&&null!=s2 ? sdf2.parse(s2):null);
                //获取当前时间
                Date now = DateUtil.strToDate(sdf2.format(new Date()),"yyyy-MM-dd HH:mm");
                if(null!=activityOfflineTime&&activityOfflineTime.compareTo(now)<=0){
@ -1046,4 +1115,188 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
    }
    /**
     * 查询排序
     *
     * @return
     */
    public List<ActivityDO> select(){
        return activityDao.selectBySort();
    }
    /**
     * 调整活动的顺序
     *
     * @param array
     * @return
     */
    public MixEnvelop updateSort(JSONArray array){
        MixEnvelop envelop = new MixEnvelop();
        for (int i=0;i<array.size();i++){
            JSONObject jsonObject = array.getJSONObject(i);
            ActivityDO activityDO = activityDao.selectById(jsonObject.getString("id"));
            activityDO.setSort(jsonObject.getInteger("sort"));
            activityDao.save(activityDO);
        }
        envelop.setObj(true);
        return envelop;
    }
    /**
     *  查询参与的竟步走活动
     *
     * @param unionId
     * @param patient
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<ActivityDO,ActivityDO> selectByUnionId(String unionId,String patient,String idCard,Integer page,Integer size){
        String sql ="select hba.* from wlyy_health_bank_activity hba right join wlyy_health_bank_task_patient_detail htpd on htpd.activity_id=hba.id " +
                "AND htpd.union_id='"+unionId+"' AND  htpd.patient_id ='"+patient+"' and htpd.patient_idcard ='"+idCard+"' " +
                "where hba.del_flag=1 and hba.type='竞走' order by hba.create_time desc LIMIT " + (page-1)*size+","+size;
        List<ActivityDO> activityDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class));
        for (ActivityDO activityDO:activityDOList){
            ActivityRuleDO activityRuleDO = activityRuleDao.selectByActivityId(activityDO.getId());
            JSONObject object = JSONObject.parseObject(activityRuleDO.getValue2());
            String activityOfflineTime = object.getString("deadLine");
            List<String> idList = Arrays.asList(activityOfflineTime.split(","));
            if (idList !=null && idList.size()!=0){
                String startTime = idList.get(0);
                Date startDate = DateUtil.strToDateLong(startTime);
                String endTime = idList.get(1);
                Date endDate = DateUtil.strToDateLong(endTime);
                String nowTime =  DateUtil.dateToStrLong(DateUtil.getNowDate());
                Date nowDate = DateUtil.strToDateLong(nowTime);
                if(startDate.getTime()<=nowDate.getTime()&&endDate.getTime()>=nowDate.getTime()){
                    activityDO.setFlag(1);
                }else {
                    activityDO.setFlag(0);
                }
            }
            activityDO.setActivityRuleDO(activityRuleDO);
            List<TaskDO> taskDOS = taskDao.selectByActivityId(activityDO.getId());
            if (taskDOS!=null&&taskDOS.size()!=0){
                activityDO.setTaskDOS(taskDOS);
                String sqlCount1 = "select sum(integrate) as total  from wlyy_health_bank_credits_detail where transaction_id='"+taskDOS.get(0).getId()+"' and patient_id = '"+patient+"'" +
                        "and create_time >= '"+DateUtils.getDayBegin()+"' and create_time <='"+DateUtils.getDayEnd()+"' AND  description IS NULL ";
                List<Map<String,Object>> rstotal1 = jdbcTemplate.queryForList(sqlCount1);
                Long count1 = 0L;
                if(rstotal1!=null&&rstotal1.size()>0){
                    Object count = rstotal1.get(0).get("total");
                    if (count!=null&&count!=""){
                        count1 =Long.parseLong(count.toString()) ;
                    }
                }
                activityDO.setNowTotal(count1);
            }
        }
        List<ActivityDO> activityDOList1 = new ArrayList<>();
        for (ActivityDO activityDO :activityDOList){
            if(activityDO.getFlag()==1){
                activityDOList1.add(0,activityDO);
            }else {
                activityDOList1.add(activityDO);
            }
        }
        String sqlCount ="select count(1) AS total from wlyy_health_bank_activity hba right join wlyy_health_bank_task_patient_detail htpd on htpd.activity_id=hba.id " +
                "where hba.del_flag=1 and hba.type='竞走' order by hba.create_time desc ";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return MixEnvelop.getSuccessListWithPage(HealthBankMapping.api_success,activityDOList1,page,size,count);
    }
    /**
     *  获取当前居民参加的活动
     *
     * @param unionId
     * @param patient
     * @param idCard
     * @return
     */
    public List<ActivityDO> selectNowByUnionId(String unionId,String patient,String idCard){
        String sql ="select hba.* from wlyy_health_bank_activity hba right join wlyy_health_bank_task_patient_detail htpd on htpd.activity_id=hba.id " +
                "AND htpd.union_id='"+unionId+"' AND  htpd.patient_id ='"+patient+"' and htpd.patient_idcard ='"+idCard+"' " +
                "where hba.del_flag=1 and hba.type='竞走' order by hba.create_time desc " ;
        List<ActivityDO> activityDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class));
        List<ActivityDO> activityDOS = new ArrayList<>();
        for (ActivityDO activityDO:activityDOList){
            ActivityRuleDO activityRuleDO = activityRuleDao.selectByActivityId(activityDO.getId());
            JSONObject object = JSONObject.parseObject(activityRuleDO.getValue2());
            String activityOfflineTime = object.getString("activityOfflineTime");
            List<String> idList = Arrays.asList(activityOfflineTime.split(","));
            activityDO.setActivityRuleDO(activityRuleDO);
            List<TaskDO> taskDOS = taskDao.selectByActivityId(activityDO.getId());
            if (taskDOS!=null&&taskDOS.size()!=0){
                activityDO.setTaskDOS(taskDOS);
            }
            if (idList !=null && idList.size()!=0){
                String startTime = idList.get(0);
                String endTime = idList.get(1);
                String nowTime =  DateUtil.dateToStrLong(DateUtil.getNowDate());
                if((startTime.compareTo(nowTime)==-1&&endTime.compareTo(nowTime)==1)||startTime.compareTo(nowTime)==0||endTime.compareTo(nowTime)==0){
                    activityDO.setFlag(1);
                    activityDOS.add(activityDO);
                }
            }
        }
        return activityDOS;
    }
    /**
     * 小程序活动排名
     *
     * @param taskId
     * @param size
     * @return
     */
    public JSONObject selectAppletsRanking(Integer flag,String flagName,String taskId,Integer size,String patient){
        StringBuffer buffer = new StringBuffer();
        if (flag == 1){
            buffer.append("");
        }else if (flag == 2){
            buffer.append(" and hbtd.town='"+flagName+"' ");
        }else if (flag==3){
            buffer.append(" and hbtd.hospital = '"+flagName+"'");
        }
        String sql = "SELECT @rownum :=@rownum + 1 AS rank, IFNULL(r.sum,0) as sum , r.patient_id AS patient FROM " +
                "(SELECT@rowNum := 0) b," +
                " (SELECT  " +
                " sum(bcd.integrate) AS sum, hbtd.patient_id, hbtd.create_time FROM wlyy_health_bank_task_patient_detail hbtd " +
                " LEFT JOIN wlyy_health_bank_credits_detail bcd ON hbtd.patient_id=bcd.patient_id AND bcd.transaction_id= '"+taskId +
                "' WHERE hbtd.task_id = '"+taskId+"' " +buffer+
                "GROUP BY hbtd.patient_id) r ORDER BY r.sum DESC,r.create_time DESC LIMIT 0,"+size;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        String sql1= "select s.rank,IFNULL(s.sum,0) as sum,s.patient_id from (SELECT @rownum :=@rownum + 1 AS rank, r.sum, r.patient_id FROM " +
                "(SELECT@rowNum := 0) b," +
                " (SELECT sum(bcd.integrate) AS sum, hbtd.patient_id, hbtd.create_time FROM " +
                "wlyy_health_bank_task_patient_detail hbtd " +
                "  LEFT  JOIN wlyy_health_bank_credits_detail bcd ON hbtd.patient_id=bcd.patient_id " +
                "AND bcd.transaction_id='"+taskId+"'" +
                "WHERE hbtd.task_id = '"+taskId+"' " +buffer+
                "GROUP BY hbtd.patient_id) r ORDER BY r.sum DESC,r.create_time DESC)s where s.patient_id ='"+patient+"'";
        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1);
        JSONObject object = new JSONObject();
        object.put("list",list);
        if (list1!=null&&list1.size()!=0){
            object.put("patient",list1.get(0));
        }else {
            object.put("patient",null);
        }
        return object;
    }
}

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

@ -1346,6 +1346,69 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        }
    }
    public List<CreditsDetailDO> share(CreditsDetailDO creditsDetailDO) throws Exception {
        synchronized (creditsDetailDO.getPatientId()) {
            String activityId= creditsDetailDO.getActivityId();
            ActivityRuleDO activityRuleDO = activityRuleDao.selectByActivityId(activityId);
            String sql = "select * from wlyy_health_bank_credits_detail where patient_id ='"+creditsDetailDO.getPatientId()+"' " +
                    "and description ='分享' and status =1 AND transaction_id = '"+creditsDetailDO.getTransactionId()+"'";
            List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(CreditsDetailDO.class));
            List<CreditsDetailDO> creditsDetailDOList = new ArrayList<>();
            if (activityRuleDO != null){
                JSONObject jsonObject = JSONObject.parseObject(activityRuleDO.getValue1());
                Boolean isShare = jsonObject.getBoolean("isshare");
                if (isShare){
                    JSONObject object = jsonObject.getJSONObject("shareData");
                    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));
                    CreditsDetailDO creditsDetailDO1 = new CreditsDetailDO();
                    if (accountDOList != null && accountDOList.size() != 0) {
                        creditsDetailDO1.setAccountId(accountDOList.get(0).getId());
                    }
                    if (creditsDetailDOS!=null&&creditsDetailDOS.size()>=object.getInteger("frequency")){
                        throw new Exception("分享超过"+creditsDetailDOS.size()+"次");
                    }else {
                        creditsDetailDO1.setHospitalName(creditsDetailDO.getHospitalName());
                        creditsDetailDO1.setHospital(creditsDetailDO.getHospital());
                        creditsDetailDO1.setPatientId(creditsDetailDO.getPatientId());
                        creditsDetailDO1.setTradeType("ACTIVITY_TASK");
                        creditsDetailDO1.setDescription("分享");
                        creditsDetailDO1.setSaasId("dev");
                        creditsDetailDO1.setStatus(1);
                        creditsDetailDO1.setCoupon(0);
                        creditsDetailDO1.setTransactionId(creditsDetailDO.getTransactionId());
                        creditsDetailDO1.setCreateTime(new Date());
                        creditsDetailDO1.setUpdateTime(new Date());
                        creditsDetailDO1.setTradeDirection(1);
                        creditsDetailDO1.setIntegrate(object.getInteger("integrate"));
                        CreditsDetailDO creditsDetailDO2 = credittsLogDetailDao.save(creditsDetailDO1);
                        creditsDetailDOList.add(creditsDetailDO2);
                        TaskPatientDetailDO taskPatientDetailDO = new TaskPatientDetailDO();
                        taskPatientDetailDO.setPatientId(creditsDetailDO1.getPatientId());
                        taskPatientDetailDO.setTaskId(creditsDetailDO1.getTransactionId());
                        String taskSql1 = ISqlUtils.getAllSql(taskPatientDetailDO);
                        List<TaskPatientDetailDO> taskPatientDetailDOS1 = jdbcTemplate.query(taskSql1, new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                        TaskPatientDetailDO taskPatientDetailDO1 = taskPatientDetailDOS1.get(0);
                        if (creditsDetailDO1.getTradeDirection() == 1) {
                            taskPatientDetailDO1.setTotal(taskPatientDetailDO1.getTotal() + creditsDetailDO2.getIntegrate());
                        } else if (creditsDetailDO1.getTradeDirection() == -1) {
                            taskPatientDetailDO1.setTotal(taskPatientDetailDO1.getTotal() - creditsDetailDO2.getIntegrate());
                        }
                        taskPatientDetailDao.save(taskPatientDetailDO1);
                        AccountDO accountDO = accountDao.findOne(creditsDetailDO2.getAccountId());
                        if (creditsDetailDO1.getTradeDirection() == 1) {
                            accountDO.setTotal(accountDO.getTotal() + creditsDetailDO2.getIntegrate());
                        } else if (creditsDetailDO1.getTradeDirection() == -1) {
                            accountDO.setTotal(accountDO.getTotal() - creditsDetailDO2.getIntegrate());
                        }
                        accountDao.save(accountDO);
                    }
                }
            }
            return creditsDetailDOList;
        }
    }
    /**
     * 商城积分支付
     * @param patient
@ -1424,5 +1487,127 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
    }
    /**
     *
     * @param creditsDetailDO
     * @param flag 1连续2间断
     * @return
     */
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> weekRewardAndIntegrate(CreditsDetailDO creditsDetailDO,Integer flag) {
        synchronized (creditsDetailDO.getPatientId()) {
            MixEnvelop<CreditsDetailDO, CreditsDetailDO> envelop = new MixEnvelop<>();
            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 (flag == 1) {
                String creditsSql = "select * from wlyy_health_bank_credits_detail where patient_id = '" + creditsDetailDO.getPatientId() + "' and " +
                        "update_time >= '" + creditsDetailDO.getMonday() + "' AND update_time<='" + creditsDetailDO.getSunday() + "' and description = '周奖励-连续' AND transaction_id = '"+creditsDetailDO.getTransactionId()+"'";
                List<CreditsDetailDO> creditsDetailDOS1 = jdbcTemplate.query(creditsSql, new BeanPropertyRowMapper(CreditsDetailDO.class));
                List<CreditsDetailDO> creditsDetailDOList = new ArrayList<>();
                if (creditsDetailDOS1 == null || creditsDetailDOS1.size() == 0) {
                    creditsDetailDO.setTradeType("ACTIVITY_TASK");
                    creditsDetailDO.setSaasId("dev");
                    creditsDetailDO.setStatus(1);
                    creditsDetailDO.setTransactionId(creditsDetailDO.getTransactionId());
                    creditsDetailDO.setCreateTime(new Date());
                    creditsDetailDO.setUpdateTime(DateUtil.strToDateLong(creditsDetailDO.getSunday()));
                    creditsDetailDO.setTradeDirection(1);
                    creditsDetailDO.setDescription("周奖励-连续");
                    creditsDetailDO.setCoupon(0);
                    CreditsDetailDO creditsDetailDO1 = credittsLogDetailDao.save(creditsDetailDO);
                    creditsDetailDOList.add(creditsDetailDO1);
                    TaskPatientDetailDO taskPatientDetailDO = new TaskPatientDetailDO();
                    taskPatientDetailDO.setPatientId(creditsDetailDO1.getPatientId());
                    taskPatientDetailDO.setTaskId(creditsDetailDO1.getTransactionId());
                    String taskSql1 = ISqlUtils.getAllSql(taskPatientDetailDO);
                    List<TaskPatientDetailDO> taskPatientDetailDOS1 = jdbcTemplate.query(taskSql1, new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                    TaskPatientDetailDO taskPatientDetailDO1 = taskPatientDetailDOS1.get(0);
                    if (creditsDetailDO1.getTradeDirection() == 1) {
                        taskPatientDetailDO1.setTotal(taskPatientDetailDO1.getTotal() + creditsDetailDO1.getIntegrate());
                    } else if (creditsDetailDO1.getTradeDirection() == -1) {
                        taskPatientDetailDO1.setTotal(taskPatientDetailDO1.getTotal() - creditsDetailDO1.getIntegrate());
                    }
                    taskPatientDetailDao.save(taskPatientDetailDO1);
                    AccountDO accountDO = accountDao.findOne(creditsDetailDO1.getAccountId());
                    if (creditsDetailDO1.getTradeDirection() == 1) {
                        accountDO.setTotal(accountDO.getTotal() + creditsDetailDO1.getIntegrate());
                    } else if (creditsDetailDO1.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());
                        creditsDetailDO2.setFlag("1");
                        creditsDetailDOS.add(creditsDetailDO2);
                    }
                    envelop.setDetailModelList(creditsDetailDOS);
                    return envelop;
                }else {
                    logger.info("居民:"+creditsDetailDO.getPatientId()+"已领取周奖励-连续");
                }
            }else if (flag==2){
                String creditsSql = "select * from wlyy_health_bank_credits_detail where patient_id = '" + creditsDetailDO.getPatientId() + "' and " +
                        "update_time >= '" +creditsDetailDO.getMonday()+"' AND update_time<='" +creditsDetailDO.getSunday() + "' and description = '周奖励-间断' AND transaction_id = '"+creditsDetailDO.getTransactionId()+"'";
                List<CreditsDetailDO> creditsDetailDOS1 = jdbcTemplate.query(creditsSql, new BeanPropertyRowMapper(CreditsDetailDO.class));
                List<CreditsDetailDO> creditsDetailDOList = new ArrayList<>();
                if (creditsDetailDOS1 == null || creditsDetailDOS1.size() == 0) {
                    creditsDetailDO.setTradeType("ACTIVITY_TASK");
                    creditsDetailDO.setSaasId("dev");
                    creditsDetailDO.setStatus(1);
                    creditsDetailDO.setTransactionId(creditsDetailDO.getTransactionId());
                    creditsDetailDO.setCreateTime(new Date());
                    creditsDetailDO.setUpdateTime(DateUtil.strToDateLong(creditsDetailDO.getSunday()));
                    creditsDetailDO.setTradeDirection(1);
                    creditsDetailDO.setDescription("周奖励-间断");
                    CreditsDetailDO creditsDetailDO1 = credittsLogDetailDao.save(creditsDetailDO);
                    creditsDetailDOList.add(creditsDetailDO1);
                    TaskPatientDetailDO taskPatientDetailDO = new TaskPatientDetailDO();
                    taskPatientDetailDO.setPatientId(creditsDetailDO1.getPatientId());
                    taskPatientDetailDO.setTaskId(creditsDetailDO1.getTransactionId());
                    String taskSql1 = ISqlUtils.getAllSql(taskPatientDetailDO);
                    List<TaskPatientDetailDO> taskPatientDetailDOS1 = jdbcTemplate.query(taskSql1, new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                    TaskPatientDetailDO taskPatientDetailDO1 = taskPatientDetailDOS1.get(0);
                    if (creditsDetailDO1.getTradeDirection() == 1) {
                        taskPatientDetailDO1.setTotal(taskPatientDetailDO1.getTotal() + creditsDetailDO1.getIntegrate());
                    } else if (creditsDetailDO.getTradeDirection() == -1) {
                        taskPatientDetailDO1.setTotal(taskPatientDetailDO1.getTotal() - creditsDetailDO1.getIntegrate());
                    }
                    taskPatientDetailDao.save(taskPatientDetailDO1);
                    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());
                        creditsDetailDO2.setFlag("1");
                        creditsDetailDOS.add(creditsDetailDO2);
                    }
                    envelop.setDetailModelList(creditsDetailDOS);
                    return envelop;
                }else {
                    logger.info("居民:"+creditsDetailDO.getPatientId()+"已领取周奖励-间断");
                    envelop.setMessage("居民:"+creditsDetailDO.getPatientId()+"已领取周奖励-间断");
                }
            }
            return envelop;
        }
    }
    public List<CreditsDetailDO> selectWeekReward(String patient,String taskId,String monday,String sunday){
        String creditsSql = "select * from wlyy_health_bank_credits_detail where patient_id = '" + patient + "' and " +
                "update_time >= '" +monday+"' AND update_time<='" + sunday+ "' and ( description = '周奖励-间断' OR description = '周奖励-连续')  AND transaction_id = '"+taskId+"'";
        List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(creditsSql,new BeanPropertyRowMapper<>(CreditsDetailDO.class));
        return creditsDetailDOS;
    }
}

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

@ -27,6 +27,8 @@ public class ISqlUtils {
            sb.append("select count(1) AS total from ").append(tableName).append(" where 1=1");
        }else if(isFlag.equalsIgnoreCase("*")){
            sb.append("select * from ").append(tableName).append(" where 1=1 ");
        }else if (isFlag.equalsIgnoreCase("sort")){
            sb.append("select * from ").append(tableName).append(" where 1=1 ");
        }
        JSONObject object1  = (JSONObject) JSONObject.toJSON(object);
        if (object1.getString("id") !=null){
@ -85,6 +87,9 @@ public class ISqlUtils {
        if(isFlag.equalsIgnoreCase("*")){
            sb.append(" ORDER BY create_time DESC ").append("LIMIT ").append((page-1)*size+",").append(size);
        }
        if(isFlag.equalsIgnoreCase("sort")){
            sb.append(" ORDER BY sort ASC ").append("LIMIT ").append((page-1)*size+",").append(size);
        }
        return sb.toString();
    }

+ 1 - 0
svr/svr-wlyy-health-bank/src/main/resources/application.yml

@ -3,6 +3,7 @@ server:
  port: 10051
  tomcat:
    max-http-header-size: 102400
    max-http-post-size: -1
spring:
  jmx:

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

@ -29,5 +29,5 @@ spring:
  profiles: prod
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      uri: ${wlyy.spring.config.uri:http://192.168.120.153:1221}
      label: ${wlyy.spring.config.label:prod}

+ 3 - 0
wlyy-parent-pom/pom.xml

@ -64,6 +64,9 @@
        <!--业务微服务-->
        <module>../svr/svr-base</module><!--  城市i健康-后台管理端微服务 -->
        <module>../svr/svr-patient</module><!-- 城市i健康-居民端微服务 -->
        <module>../svr/svr-internet-hospital</module><!-- 互联网医院微服务 -->
        <module>../svr/svr-internet-hospital-entrance</module><!-- 互联网医院外部接口微服务 -->
        <module>../svr/svr-iot</module><!--物联网平台-->
        <!--<module>../svr/svr-wlyy</module>-->  <!-- i健康微服务 -->
        <module>../svr/svr-wlyy-health-bank</module> <!-- 健康银行 -->