Browse Source

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

hill9868 6 years ago
parent
commit
26bce90a72
24 changed files with 752 additions and 90 deletions
  1. 159 0
      app/public-health-server/src/main/java/com/yihu/health/security/core/EhrWebAuthenticationProvider.java
  2. 68 0
      app/public-health-server/src/main/java/com/yihu/health/security/core/EhrWebAuthenticationSuccessHandler.java
  3. 58 0
      app/public-health-server/src/main/java/com/yihu/health/security/core/EhrWebContextLogoutHandler.java
  4. 51 0
      app/public-health-server/src/main/java/com/yihu/health/util/CurrentRequest.java
  5. 15 0
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/CreditsDetailDO.java
  6. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java
  7. 4 4
      server/svr-admin-server/pom.xml
  8. 1 1
      server/svr-admin-server/src/main/resources/application.yml
  9. 11 11
      server/svr-admin-server/src/main/resources/bootstrap.yml
  10. 1 1
      server/svr-configuration/src/main/resources/application.yml
  11. 1 1
      server/svr-discovery/src/main/resources/application.yml
  12. 37 1
      svr/svr-base/src/main/resources/application.yml
  13. 4 4
      svr/svr-base/src/main/resources/bootstrap.yml
  14. 12 12
      svr/svr-iot/pom.xml
  15. 0 8
      svr/svr-iot/src/main/java/com/yihu/iot/controller/analyzer/IotAnalyzerController.java
  16. 7 12
      svr/svr-iot/src/main/resources/application.yml
  17. 14 30
      svr/svr-iot/src/main/resources/bootstrap.yml
  18. 10 2
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/AccountController.java
  19. 20 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java
  20. 4 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/CredittsLogDetailDao.java
  21. 24 2
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/AccountService.java
  22. 35 1
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java
  23. 105 0
      web-gateway/src/main/java/com/yihu/jw/controller/base/login/LoginContorller.java
  24. 110 0
      web-gateway/src/main/resources/application.yml

+ 159 - 0
app/public-health-server/src/main/java/com/yihu/health/security/core/EhrWebAuthenticationProvider.java

@ -1,3 +1,4 @@
<<<<<<< HEAD:app/public-health-server/src/main/java/com/yihu/health/security/core/EhrWebAuthenticationProvider.java
package com.yihu.health.security.core;
import org.springframework.security.authentication.BadCredentialsException;
@ -150,3 +151,161 @@ public class EhrWebAuthenticationProvider extends AbstractUserDetailsAuthenticat
        return this.userDetailsService;
    }
}
=======
//package com.yihu.ehr.iot.security.core;
//
//import org.springframework.security.authentication.BadCredentialsException;
//import org.springframework.security.authentication.InternalAuthenticationServiceException;
//import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
//import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
//import org.springframework.security.authentication.dao.SaltSource;
//import org.springframework.security.authentication.encoding.PasswordEncoder;
//import org.springframework.security.authentication.encoding.PlaintextPasswordEncoder;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.core.session.SessionRegistry;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.util.Assert;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * Created by progr1mmer on 2018/1/26.
// */
//public class EhrWebAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider {
//
//    private static final String USER_NOT_FOUND_PASSWORD = "userNotFoundPassword";
//    private PasswordEncoder passwordEncoder;
//    private String userNotFoundEncodedPassword;
//    private SaltSource saltSource;
//    private UserDetailsService userDetailsService;
//    private SessionRegistry sessionRegistry;
//
//    public EhrWebAuthenticationProvider() {
//        this.setPasswordEncoder((PasswordEncoder)(new PlaintextPasswordEncoder()));
//    }
//
//    public EhrWebAuthenticationProvider(UserDetailsService userDetailsService) {
//        this.userDetailsService = userDetailsService;
//        this.setPasswordEncoder((PasswordEncoder)(new PlaintextPasswordEncoder()));
//    }
//
//    /**
//    public EhrWebAuthenticationProvider(UserDetailsService userDetailsService, SessionRegistry sessionRegistry) {
//        this.userDetailsService = userDetailsService;
//        this.sessionRegistry = sessionRegistry;
//        this.setPasswordEncoder((PasswordEncoder)(new PlaintextPasswordEncoder()));
//    }
//     */
//
//    /**
//     * Step 3
//     * @param userDetails
//     * @param authentication
//     * @throws AuthenticationException
//     */
//    protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
//        Object salt = null;
//        if(this.saltSource != null) {
//            salt = this.saltSource.getSalt(userDetails);
//        }
//
//        if(authentication.getCredentials() == null) {
//            this.logger.debug("Authentication failed: no credentials provided");
//            throw new BadCredentialsException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
//        } else {
//            EhrWebAuthenticationToken ehrWebAuthenticationToken = (EhrWebAuthenticationToken) authentication;
//            if(!ehrWebAuthenticationToken.isSso()) {
//                String presentedPassword = authentication.getCredentials().toString();
//                if (!this.passwordEncoder.isPasswordValid(userDetails.getPassword(), presentedPassword, salt)) {
//                    this.logger.debug("Authentication failed: password does not match stored value");
//                    throw new BadCredentialsException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
//                }
//            }
//            //HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//            //sessionRegistry.registerNewSession(request.getSession().getId(), userDetails);
//        }
//    }
//
//    protected void doAfterPropertiesSet() throws Exception {
//        Assert.notNull(this.userDetailsService, "A UserDetailsService must be set");
//    }
//
//    protected final UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
//        UserDetails loadedUser;
//        try {
//            loadedUser = this.getUserDetailsService().loadUserByUsername(username);
//        } catch (UsernameNotFoundException var6) {
//            if(authentication.getCredentials() != null) {
//                String presentedPassword = authentication.getCredentials().toString();
//                this.passwordEncoder.isPasswordValid(this.userNotFoundEncodedPassword, presentedPassword, (Object)null);
//            }
//
//            throw var6;
//        } catch (Exception var7) {
//            throw new InternalAuthenticationServiceException(var7.getMessage(), var7);
//        }
//
//        if(loadedUser == null) {
//            throw new InternalAuthenticationServiceException("UserDetailsService returned null, which is an interface contract violation");
//        } else {
//            return loadedUser;
//        }
//    }
//
//    public void setPasswordEncoder(Object passwordEncoder) {
//        Assert.notNull(passwordEncoder, "passwordEncoder cannot be null");
//        if(passwordEncoder instanceof PasswordEncoder) {
//            this.setPasswordEncoder((PasswordEncoder)passwordEncoder);
//        } else if(passwordEncoder instanceof org.springframework.security.crypto.password.PasswordEncoder) {
//            final org.springframework.security.crypto.password.PasswordEncoder delegate = (org.springframework.security.crypto.password.PasswordEncoder)passwordEncoder;
//            this.setPasswordEncoder(new PasswordEncoder() {
//                public String encodePassword(String rawPass, Object salt) {
//                    this.checkSalt(salt);
//                    return delegate.encode(rawPass);
//                }
//
//                public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
//                    this.checkSalt(salt);
//                    return delegate.matches(rawPass, encPass);
//                }
//
//                private void checkSalt(Object salt) {
//                    Assert.isNull(salt, "Salt value must be null when used with crypto module PasswordEncoder");
//                }
//            });
//        } else {
//            throw new IllegalArgumentException("passwordEncoder must be a PasswordEncoder instance");
//        }
//    }
//
//    private void setPasswordEncoder(PasswordEncoder passwordEncoder) {
//        Assert.notNull(passwordEncoder, "passwordEncoder cannot be null");
//        this.userNotFoundEncodedPassword = passwordEncoder.encodePassword("userNotFoundPassword", (Object)null);
//        this.passwordEncoder = passwordEncoder;
//    }
//
//    protected PasswordEncoder getPasswordEncoder() {
//        return this.passwordEncoder;
//    }
//
//    public void setSaltSource(SaltSource saltSource) {
//        this.saltSource = saltSource;
//    }
//
//    protected SaltSource getSaltSource() {
//        return this.saltSource;
//    }
//
//    public void setUserDetailsService(UserDetailsService userDetailsService) {
//        this.userDetailsService = userDetailsService;
//    }
//
//    protected UserDetailsService getUserDetailsService() {
//        return this.userDetailsService;
//    }
//}
>>>>>>> eb49bc9a23d809112535a9bde36737ef12f77756:app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationProvider.java

+ 68 - 0
app/public-health-server/src/main/java/com/yihu/health/security/core/EhrWebAuthenticationSuccessHandler.java

@ -1,3 +1,4 @@
<<<<<<< HEAD:app/public-health-server/src/main/java/com/yihu/health/security/core/EhrWebAuthenticationSuccessHandler.java
package com.yihu.health.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -61,3 +62,70 @@ public class EhrWebAuthenticationSuccessHandler implements AuthenticationSuccess
        sessionRegistry.registerNewSession(httpServletRequest.getSession().getId(),userDetailModel);
    }
}
=======
//package com.yihu.ehr.iot.security.core;
//
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.yihu.ehr.agModel.user.UserDetailModel;
//import com.yihu.ehr.iot.util.CurrentRequest;
//import com.yihu.ehr.util.rest.Envelop;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.session.SessionRegistry;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by progr1mmer on 2018/1/26.
// */
//public class EhrWebAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
//
//    @Autowired
//    private ObjectMapper objectMapper;
//
//    @Autowired
//    SessionRegistry sessionRegistry;
//
//    /**
//     * Step 4
//     * @param httpServletRequest
//     * @param httpServletResponse
//     * @param authentication
//     * @throws IOException
//     * @throws ServletException
//     */
//    @Override
//    public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
//        Envelop envelop = new Envelop();
//        envelop.setSuccessFlg(true);
//        Map userMap = new HashMap();
//        String id = (String) httpServletRequest.getAttribute("id");
//        String username = (String) httpServletRequest.getAttribute("username");
//        String realName = (String) httpServletRequest.getAttribute("realName");
//        userMap.put("id", id);
//        userMap.put("username", username);
//        userMap.put("realName", realName);
//        envelop.setObj(userMap);
//
//        List modelList = new ArrayList<>();
//        UserDetailModel userDetailModel = (UserDetailModel)httpServletRequest.getAttribute("user");
//        modelList.add(userDetailModel);
//        envelop.setDetailModelList(modelList);
//
//        httpServletResponse.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
//        httpServletResponse.getWriter().print(objectMapper.writeValueAsString(envelop));
//
//        sessionRegistry.registerNewSession(httpServletRequest.getSession().getId(),userDetailModel);
//    }
//}
>>>>>>> eb49bc9a23d809112535a9bde36737ef12f77756:app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationSuccessHandler.java

+ 58 - 0
app/public-health-server/src/main/java/com/yihu/health/security/core/EhrWebContextLogoutHandler.java

@ -1,3 +1,4 @@
<<<<<<< HEAD:app/public-health-server/src/main/java/com/yihu/health/security/core/EhrWebContextLogoutHandler.java
package com.yihu.health.security.core;
import org.apache.commons.logging.Log;
@ -38,3 +39,60 @@ public class EhrWebContextLogoutHandler extends SecurityContextLogoutHandler {
            }
    }
}
=======
//package com.yihu.ehr.iot.security.core;
//
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.yihu.ehr.agModel.user.UserDetailModel;
//import com.yihu.ehr.iot.util.CurrentRequest;
//import com.yihu.ehr.util.rest.Envelop;
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.context.SecurityContext;
//import org.springframework.security.core.context.SecurityContextHolder;
//import org.springframework.security.core.session.SessionRegistry;
//import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
//import org.springframework.security.web.authentication.logout.LogoutHandler;
//import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
//import org.springframework.util.Assert;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by progr1mmer on 2018/1/26.
// */
//public class EhrWebContextLogoutHandler extends SecurityContextLogoutHandler {
//
//    protected final Log logger = LogFactory.getLog(this.getClass());
//
//    @Autowired
//    SessionRegistry sessionRegistry;
//
//    /**
//     * Step 5
//     * @param httpServletRequest
//     * @param httpServletResponse
//     * @param authentication
//     */
//    @Override
//    public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) {
//        Assert.notNull(httpServletRequest, "HttpServletRequest required");
//            HttpSession session = httpServletRequest.getSession(false);
//            if (session != null) {
//                this.logger.debug("removeSessionInformation, session: " + session.getId());
//                sessionRegistry.removeSessionInformation(session.getId());
//            }
//    }
//}
>>>>>>> eb49bc9a23d809112535a9bde36737ef12f77756:app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebContextLogoutHandler.java

+ 51 - 0
app/public-health-server/src/main/java/com/yihu/health/util/CurrentRequest.java

@ -1,3 +1,4 @@
<<<<<<< HEAD:app/public-health-server/src/main/java/com/yihu/health/util/CurrentRequest.java
package com.yihu.health.util;
import com.yihu.ehr.agModel.user.UserDetailModel;
@ -33,3 +34,53 @@ public class CurrentRequest {
        return user;
    }
}
=======
//package com.yihu.ehr.iot.util;
//
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.yihu.ehr.agModel.user.UserDetailModel;
//import com.yihu.ehr.iot.util.http.HttpHelper;
//import com.yihu.ehr.iot.util.http.HttpResponse;
//import com.yihu.ehr.iot.util.spring.SpringContextHolder;
//import com.yihu.ehr.util.rest.Envelop;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.core.session.SessionInformation;
//import org.springframework.security.core.session.SessionRegistry;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import javax.servlet.http.HttpServletRequest;
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.Map;
//import java.util.concurrent.ConcurrentHashMap;
//
///**
// * @author lith
// * @created 2018/02/06
// */
//@Component
//public class CurrentRequest {
//
//    @Autowired
//    SessionRegistry sessionRegistry;
//
//    /**
//     * 获取当前登录用户,当前已登录的用户都缓存在session中
//     * @param request
//     * @return
//     */
//    public  UserDetailModel getCurrentUser(HttpServletRequest request){
//        String sessionId = request.getSession().getId();
//        UserDetailModel user = null;
//        SessionInformation sessionInformation = sessionRegistry.getSessionInformation(sessionId);
//        if(null != sessionInformation.getPrincipal()){
//            user = (UserDetailModel)sessionInformation.getPrincipal();
//        }
//        return user;
//    }
//}
>>>>>>> eb49bc9a23d809112535a9bde36737ef12f77756:app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/CurrentRequest.java

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

@ -7,6 +7,7 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by wang zhinan on 2018/4/27.
@ -93,6 +94,9 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
    @Transient
    private ExchangeGoodsDO exchangeGoodsDO;//兑换商品
    @Transient
    private String uploadTime; //上传时间
    @Column(name = "saas_id")
@ -327,4 +331,15 @@ public class CreditsDetailDO extends UuidIdentityEntityWithOperator implements S
    public void setExchangeGoodsDO(ExchangeGoodsDO exchangeGoodsDO) {
        this.exchangeGoodsDO = exchangeGoodsDO;
    }
    @Transient
    public String getUploadTime() {
        return uploadTime;
    }
    public void setUploadTime(String uploadTime) {
        this.uploadTime = uploadTime;
    }
}

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

@ -74,5 +74,6 @@ public class HealthBankMapping {
        public static final String selectTaskAndPatients = "/selectTaskAndPatients";
        public static final String shareIntegrate = "/shareIntegrate";
        public static final String payIntegrate = "/payIntegrate";
        public static final String refund="/refund";
    }
}

+ 4 - 4
server/svr-admin-server/pom.xml

@ -52,10 +52,10 @@
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.cloud</groupId>-->
            <!--<artifactId>spring-cloud-starter-config</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zuul</artifactId>

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

@ -1,5 +1,5 @@
server:
  port: 8082
  port: 8084
spring:
  application:

+ 11 - 11
server/svr-admin-server/src/main/resources/bootstrap.yml

@ -1,15 +1,15 @@
##优先读取 boostarap配置 然后在读取application。yml的配置
spring:
  #从发现服务里面取配置服务的信息
  cloud:
    config:
      username: jw
      password: jkzl
      failFast: true ##启动快速失败 即链接不到配置服务就启动失败
      discovery:
        enabled: true ##使用发现服务
        service-id: svr-configurations ##配置服务的名字
#spring:
#  #从发现服务里面取配置服务的信息
#  cloud:
#    config:
#      username: jw
#      password: jkzl
#      failFast: true ##启动快速失败 即链接不到配置服务就启动失败
#      discovery:
#        enabled: true ##使用发现服务
#        service-id: svr-configurations ##配置服务的名字
#
##发现服务的地址

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

@ -15,7 +15,7 @@ eureka:
    healthcheck:
      enabled: false #启动监控检查
    serviceUrl:
      defaultZone: http://jw:jkzl@127.0.0.1:8761/eureka
      defaultZone: http://jw:jkzl@172.26.0.107:8761/eureka
  instance:
    #eurika使用IP不使用host
    prefer-ip-address: true

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

@ -20,6 +20,6 @@ eureka:
  client:
    register-with-eureka: false
    fetch-registry: false #如果是做高可用的发现服务那就要改成 true
    #registry-fetch-interval-seconds: 30 #定期的更新客户端的服务清单 30秒更新一次
    registry-fetch-interval-seconds: 30 #定期的更新客户端的服务清单 30秒更新一次
    service-url:
      defaultZone: http://jw:jkzl@127.0.0.1:8761/eureka/

+ 37 - 1
svr/svr-base/src/main/resources/application.yml

@ -1,6 +1,42 @@
<<<<<<< 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:
@ -107,7 +143,7 @@ jw:
spring:
  profiles: jwtest
  datasource:
    url: jdbc:mysql://172.17.110.160/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://172.26.0.104/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

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

@ -12,7 +12,7 @@ spring:
  profiles: jwdev
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.17.110.212: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://172.17.110.212:1221}
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
@ -28,7 +28,7 @@ spring:
  profiles: prod
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.120.153:1221}
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:prod}
---
@ -36,5 +36,5 @@ spring:
  profiles: local
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.120.153:1221}
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:local}

+ 12 - 12
svr/svr-iot/pom.xml

@ -46,18 +46,18 @@
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>-->
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-actuator</artifactId>-->
        <!--</dependency>-->
        <!--<dependency>-->
            <!--<groupId>org.springframework.cloud</groupId>-->
            <!--<artifactId>spring-cloud-starter-eureka</artifactId>-->
        <!--</dependency>-->
        <!--<dependency>-->
            <!--<groupId>org.springframework.cloud</groupId>-->
            <!--<artifactId>spring-cloud-starter-config</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>

+ 0 - 8
svr/svr-iot/src/main/java/com/yihu/iot/controller/analyzer/IotAnalyzerController.java

@ -3,10 +3,8 @@ package com.yihu.iot.controller.analyzer;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.iot.datainput.service.DataInputService;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.service.common.DfsTemplate;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.date.DateUtil;
@ -39,12 +37,6 @@ public class IotAnalyzerController extends EnvelopRestEndpoint {
    @Autowired
    ObjectMapper objectMapper;
    @Autowired
    private FastDFSUtil fastDFSHelper;
    @Autowired
    private DfsTemplate dfsTemplate;
    /**
     * 基于奕拓小屋上传的体征数据,进行解析入库
     * @param jsonData

+ 7 - 12
svr/svr-iot/src/main/resources/application.yml

@ -3,9 +3,6 @@ server:
  port: 10050
spring:
  application:
    name:  svr-iot  #注册到发现服务的id 如果id一样 eurika会自动做负载
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 50
@ -64,23 +61,21 @@ fast-dfs:
---
spring:
  profiles: jwdev
  datasource:
    url: jdbc:mysql://172.19.103.77:3306/xmiot?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: root
    password: 123456
    url: jdbc:mysql://172.26.0.204:3306/xmiot?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg@jkzl2019
  elasticsearch:
    cluster-name: jkzl #默认即为elasticsearch  集群名
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    cluster-nodes: 172.26.0.203:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
      uris: http://172.26.0.202:9200
  wlyy:
    url: http://www.xmtyw.cn/wlyy/
fast-dfs:
  tracker-server: 172.19.103.54:22122 #服务器地址
  tracker-server: 172.26.0.200:22122 #服务器地址
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
  fastdfs_file_url: http://172.26.0.200:22122/
---
spring:

+ 14 - 30
svr/svr-iot/src/main/resources/bootstrap.yml

@ -1,32 +1,16 @@
spring:
  application:
    name: svr-iot
#  cloud:
                                               #    config:
                                               #      failFast: false
                                               #      username: jw
                                               #      password: jkzl
                                               #
                                               #---
                                               #spring:
                                               #  profiles: jwdev
                                               #  cloud:
                                               #    config:
                                               #      uri: ${wlyy.spring.config.uri:http://172.17.110.212:1221}
                                               #      label: ${wlyy.spring.config.label:jwdev}
                                               #
                                               #---
                                               #spring:
                                               #  profiles: dev
                                               #  cloud:
                                               #    config:
                                               #      uri: ${wlyy.spring.config.uri:http://localhost:1221}
                                               #      label: ${wlyy.spring.config.label:dev}
                                               #
                                               #---
                                               #spring:
                                               #  profiles: jwtest
                                               #  cloud:
                                               #    config:
                                               #      uri: ${wlyy.spring.config.uri:http://172.17.110.212:1221}
                                               #      label: ${wlyy.spring.config.label:jwdev}
    name: svr-iot  #注册到发现服务的id 如果id一样 eurika会自动做负载
  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}

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

@ -169,9 +169,17 @@ public class AccountController extends EnvelopRestEndpoint {
    @PostMapping(value = HealthBankMapping.healthBank.selectAccountByPatient)
    @ApiOperation(value = "根据id获取居民账户")
    public MixEnvelop<AccountDO, AccountDO> selectByPatient(@ApiParam(name = "patientId",value = "居民id")
                                                                   @RequestParam(value = "patientId",required = true)String patientId){
                                                                   @RequestParam(value = "patientId",required = true)String patientId,
                                                            @ApiParam(name = "name",value = "名字")
                                                            @RequestParam(value = "name",required = true)String name,
                                                            @ApiParam(name = "hospital",value = "机构code")
                                                                @RequestParam(value = "hospital",required = false)String hospital,
                                                            @ApiParam(name = "hospitalName",value = "机构名称")
                                                                @RequestParam(value = "hospitalName",required = false)String hospitalName,
                                                            @ApiParam(name = "idcard",value = "身份证")
                                                                @RequestParam(value = "idcard",required = false)String idcard){
        try {
            return service.selectByPatient(patientId);
            return service.selectByPatient(patientId,name,hospital,hospitalName,idcard);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

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

@ -379,4 +379,24 @@ public class CreditsDetailController extends EnvelopRestEndpoint {
    }
    /**
     * 商城退款
     * @param orders
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.refund)
    @ApiOperation(value = "商城退款")
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> refund(@ApiParam(name = "orders",value = "订单集合")
                                                                     @RequestParam(value = "orders",required = false)String orders){
        try {
            JSONArray array = JSONArray.parseArray(orders);
            return service.refundIntegrate(array);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

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

@ -1,11 +1,15 @@
package com.yihu.jw.dao;
import com.yihu.jw.entity.health.bank.AccountDO;
import com.yihu.jw.entity.health.bank.CreditsDetailDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wang zhinan on 2018/4/27.
 */
public interface CredittsLogDetailDao extends PagingAndSortingRepository<CreditsDetailDO,String>,JpaSpecificationExecutor<CreditsDetailDO>{
    @Query("select t from CreditsDetailDO t where t.transactionId=?1 and t.tradeType=?2 and t.status=1")
    CreditsDetailDO selectByTransactionId(String transactionId,String tradeType);
}

+ 24 - 2
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/AccountService.java

@ -404,11 +404,33 @@ public class AccountService extends BaseJpaService<AccountDO,AccountDao> {
     * @param patient
     * @return
     */
    public MixEnvelop<AccountDO, AccountDO> selectByPatient(String patient){
    public MixEnvelop<AccountDO, AccountDO> selectByPatient(String patient,String name,String hospital,String hospitalName,String idcard){
        MixEnvelop<AccountDO,AccountDO> envelop = new MixEnvelop<>();
        String sql = "select * from wlyy_health_bank_account where status = 1 and patient_id = '"+patient+"'";
        List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
        envelop.setObj(accountDOS.get(0));
        if (accountDOS == null || accountDOS.size()==0){
            AccountDO accountDO = new AccountDO();
            accountDO.setTotal(0);
            accountDO.setId(getCode());
            accountDO.setPatientId(patient);
            accountDO.setAccountName(name);
            accountDO.setHospital(hospital);
            accountDO.setHospitalName(hospitalName);
            if(idcard.length()>=4){// 判断是否长度大于等于4
                String cardNumber=idcard.substring(idcard.length()- 4,idcard.length());//截取两个数字之间的部分
                int random = (int)((Math.random()*9+1)*100000);
                accountDO.setCardNumber(cardNumber+Integer.toString(random));
            }
            accountDO.setPassword("123456");
            accountDO.setSaasId("dev");
            accountDO.setStatus(1);
            accountDO.setCreateTime(new Date());
            accountDO.setUpdateTime(new Date());
            accountDO = accountDao.save(accountDO);
            envelop.setObj(accountDO);
        }else {
            envelop.setObj(accountDOS.get(0));
        }
        return envelop;
    }
}

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

@ -304,7 +304,11 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                        taskPatientDetailDao.save(taskPatientDetailDO);
                    }
                }
                creditsDetailDO.setCreateTime(new Date());
                if (creditsDetailDO.getUploadTime()!=null&&creditsDetailDO.getUploadTime()!=""){
                    creditsDetailDO.setCreateTime(DateUtil.strToDateLong(creditsDetailDO.getUploadTime()));
                }else {
                    creditsDetailDO.setCreateTime(new Date());
                }
                creditsDetailDO.setUpdateTime(new Date());
                CreditsDetailDO creditsDetailDO1 =credittsLogDetailDao.save(creditsDetailDO);
                creditsDetailDO1.setFlag(creditsDetailDO.getFlag());
@ -1391,4 +1395,34 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
    }
    public MixEnvelop<CreditsDetailDO,CreditsDetailDO> refundIntegrate(JSONArray array) throws Exception {
        MixEnvelop<CreditsDetailDO, CreditsDetailDO> envelop = new MixEnvelop<>();
        for (int i=0;i<array.size();i++){
            JSONObject object = array.getJSONObject(i);
            CreditsDetailDO creditsDetailDO1 = credittsLogDetailDao.selectByTransactionId(object.getString("orderId"),"SHOPPING_PAY");
            CreditsDetailDO creditsDetailDO = new CreditsDetailDO();
            creditsDetailDO.setPatientId(creditsDetailDO1.getPatientId());
            creditsDetailDO.setAccountId(creditsDetailDO1.getAccountId());
            creditsDetailDO.setHospital(creditsDetailDO1.getHospital());
            creditsDetailDO.setTradeType("REFUND");
            creditsDetailDO.setTradeDirection(1);
            creditsDetailDO.setTransactionId(object.getString("orderId"));
            creditsDetailDO.setIntegrate(object.getDouble("integrate").intValue());
            creditsDetailDO.setCreateTime(new Date());
            creditsDetailDO.setUpdateTime(new Date());
            creditsDetailDO.setHospitalName(creditsDetailDO1.getHospitalName());
            creditsDetailDO.setSaasId("dev");
            creditsDetailDO.setId(getCode());
            creditsDetailDO.setCoupon(0);
            creditsDetailDO.setStatus(1);
            credittsLogDetailDao.save(creditsDetailDO);
            AccountDO accountDO = accountDao.selectByPatientId(creditsDetailDO1.getPatientId());
            accountDO.setTotal(accountDO.getTotal()+object.getDouble("integrate").intValue());
            accountDao.save(accountDO);
        }
        return envelop;
    }
}

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

@ -0,0 +1,105 @@
package com.yihu.jw.controller.base.login;
import com.yihu.base.security.properties.SecurityProperties;
import com.yihu.base.security.sms.mobile.MobileCheck;
import com.yihu.base.security.sms.process.SmsValidateCodeProcessor;
import com.yihu.jw.common.base.base.BaseContants;
import com.yihu.jw.fegin.base.base.FunctionFeign;
import com.yihu.jw.fegin.base.login.LoginFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.rm.base.BaseLoginRequestMapping;
import com.yihu.jw.rm.base.BaseUserRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.ServletWebRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Created by 刘文彬 on 2018/4/20.
 */
@RestController
@RequestMapping(BaseLoginRequestMapping.api_gateway_common)
@Api(value = "登录模块", description = "登录模块")
public class LoginContorller {
    @Autowired
    private LoginFeign loginFeign;
    @Autowired
    private MobileCheck mobileCheck;
    @Autowired
    private SmsValidateCodeProcessor smsValidateCodeProcessor;
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_checkoutInfo, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "注册校验信息", notes = "注册校验姓名、身份证、医保卡号信息")
    public BaseEnvelop checkoutInfo(@ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc,
                                @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard){
        return loginFeign.checkoutInfo(ssc,idcard);
    }
    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_accountSub, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "注册账号", notes = "注册校验姓名、身份证、医保卡号信息")
    public Envelop register(
            @ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = true) @RequestParam(value = "mobilePhone", required = true) String mobilePhone,
            @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
            @ApiParam(name = "type", value = "1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录", required = true) @RequestParam(value = "type", required = true) int type,
            @ApiParam(name = "captcha", value = "短信验证码", required = true) @RequestParam(value = "captcha", required = true) String captcha,
            @ApiParam(name = "name", value = "姓名", required = true) @RequestParam(value = "name", required = true) String name,
            @ApiParam(name = "password", value = "账户密码", required = true) @RequestParam(value = "password", required = true) String password,
            @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard,
            @ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc) {
        return loginFeign.register(mobilePhone,saasId,type,captcha,name,password,idcard,ssc);
    }
    @PostMapping(BaseLoginRequestMapping.BaseLoginAccount.mobileSendSms)
    @ApiOperation(value = "发送短信登录的验证码", notes = "不走校验框架")
    public BaseEnvelop createCode(@ApiParam(name = "mobile", value = "手机号", required = true) @RequestParam(value = "mobile", required = true) String mobile,
                                  HttpServletRequest request, HttpServletResponse response) throws Exception{
        //验证手机号是否正确
        String[] mobileSaas = mobile.split(",");
        if (!mobileCheck.checkMobile(mobileSaas[0])) {
            return BaseEnvelop.getError("手机格式错误!");
        } else {
            //发送短信验证码并且保存到redis中
            smsValidateCodeProcessor.create(new ServletWebRequest(request, response));
            return BaseEnvelop.getSuccess("发送成功!");
        }
    }
    @PostMapping(BaseLoginRequestMapping.BaseLoginAccount.api_login)
    public Envelop login(@ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = false) @RequestParam(value = "mobilePhone", required = false) String mobilePhone,
                       @ApiParam(name = "password", value = "password", required = false) @RequestParam(value = "password", required = false) String password,
                       @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
                       @ApiParam(name = "captcha", value = "短信验证码", required = false) @RequestParam(value = "captcha", required = false) String captcha){
        //1 框架登录
        //2 base取用户信息
        return loginFeign.login(mobilePhone,password,saasId,captcha);
    }
//    @PostMapping("/logout")
//    public Envelop logout(){
//        HttpHeaders headers = new HttpHeaders();
//        headers.add("Accept", "*/*");
//        headers.add("Cache-Control", "no-cache");
//        RestTemplate restTemplate = new RestTemplate();
//        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
//        //设置http请求实体
//        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
//        restTemplate.postForObject("http://localhost:8088/logout", requestEntity, String.class);
//        return new Envelop();
//    }
}

+ 110 - 0
web-gateway/src/main/resources/application.yml

@ -0,0 +1,110 @@
##如果有配置服务的话,远程服务器和本地服务器配置不一致的情况下,优先远程的为主
server:
  port: 8088
spring:
  application:
    name:  web-gateway #注册到发现服务的id 如果id一样 eurika会自动做负载
  jmx:
    default-domain: web-gateway
  http:
    multipart:
      enabled: true
      max-file-size: 500MB
      max-request-size: 500MB
#  data:
#    elasticsearch: #ElasticsearchProperties
#      cluster-name: jkzl #默认即为elasticsearch  集群名
#      cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#      local: false #是否本地连接
#      properties: # Additional properties used to configure the client.
#        enable: true
#    # JEST (Elasticsearch HTTP client) (JestProperties)
#  elasticsearch:
#    jest:
#      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
##      uris: http://172.19.103.68:9200
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
    database: 0
##开启feign断路器
feign:
  hystrix:
    enabled: true
management:
  security:
    enabled: false  #关闭 refresh的权限认证
hystrix:
  threadpool:
    default:
      coreSize: 500  #并发执行的最大线程数,默认10
  command:
    paas-file:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 3600000
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 308000  #命令执行超时时间,默认1000ms
ribbon:
  ReadTimeout: 300000
  ConnectTimeout: 5000
#zuul 默认会代理所有的微服务  路径 /{appliction.name}/**
#zuul:
#  ignored-services: '*'  ##忽略全部的代理  忽略单个微服务   ignored-services: svr-base 多个逗号分割
#  routes:
#    svr-base: /v1/base/**  ##svr-base方向代理到/base下多层级的路径
#    svr-wlyy: /v1/wlyy/**
#    api-esb-url:
#      path: /job/**
#      url: http://192.168.131.131:10030/
#      stripPrefix: false ##如果是物理服务器要设置成false
#    svr-base:    这种方式和  svr-base: /base/**  一样  svr-base可以随便写 唯一即可
#      path: /base/**  path是代理后的路径
#      serviceId: svr-base  serviceId是微服务name
#   svr-base: 这种方式和 上面一样 就是serviceId改成具体的url 但是这种配置方法不能利用eurika的负载均衡
#     path: /base/**
#     url: http://localhost:10020/
#svr-base: 这边是微服务ID  配置负载均衡
#  ribbon:
#    listOfService: http://localhost:10020/,http://localhost:10021/
---
spring:
  profiles: jwdev
#  cloud:
#    stream:
#      kafka:
#        binder:
#          brokers: 172.17.110.201
#          defaultBrokerPort: 9092
#          zkNodes: 172.17.110.201
#          defaultZkPort: 2181
#          replicationFactor: 1
---
spring:
  profiles: jwtest
---
spring:
  profiles: jwprod