Browse Source

Merge branch 'master' of gitee.com:ccsens_s/ccsenscloud

master
zhangye 5 years ago
parent
commit
2810561455
  1. 2
      cloudutil/src/main/java/com/ccsens/cloudutil/aspect/LogAspect.java
  2. 6
      cloudutil/src/main/resources/application-util-prod.yml
  3. 1
      health/src/main/java/com/ccsens/health/api/WeixinController.java
  4. 6
      health/src/main/java/com/ccsens/health/service/WeiXinService.java
  5. 6
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  6. 2
      ht/src/main/resources/application-prod.yml
  7. 4
      tall/src/main/resources/application-common.yml
  8. 3
      tall/src/main/resources/application-dev.yml
  9. 8
      tall/src/main/resources/application-prod.yml
  10. 3
      tall/src/main/resources/application-test.yml
  11. 4
      tall/src/main/resources/druid-prod.yml
  12. 5
      util/src/main/java/com/ccsens/util/WebConstant.java
  13. 30
      util/src/main/java/com/ccsens/util/wx/WxGzhUtil.java

2
cloudutil/src/main/java/com/ccsens/cloudutil/aspect/LogAspect.java

@ -40,10 +40,12 @@ public class LogAspect {
@Autowired @Autowired
private TallFeignClient tallFeignClient; private TallFeignClient tallFeignClient;
/**不记录日志的接口*/
private Set<String> ignoreUrlSet = new HashSet<>(); private Set<String> ignoreUrlSet = new HashSet<>();
{ {
ignoreUrlSet.add("/log/operation"); ignoreUrlSet.add("/log/operation");
ignoreUrlSet.add("/users/token"); ignoreUrlSet.add("/users/token");
ignoreUrlSet.add("/users/claims");
} }

6
cloudutil/src/main/resources/application-util-prod.yml

@ -43,6 +43,12 @@ feign:
loggerLevel: basic loggerLevel: basic
hystrix: hystrix:
enabled: true enabled: true
hystrix:
threadpool:
default:
coreSize: 200 #并发执行的最大线程数,默认10
maxQueueSize: 1000 #BlockingQueue的最大队列数,默认值-1
queueSizeRejectionThreshold: 800 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝,默认值5
# sleuth # sleuth
logging: logging:
level: level:

1
health/src/main/java/com/ccsens/health/api/WeixinController.java

@ -155,7 +155,6 @@ public class WeixinController {
* @param suite_id * @param suite_id
* @param suite_ticket * @param suite_ticket
*/ */
@Async
public void getSuiteAccessToken(String suite_id, String suite_ticket) { public void getSuiteAccessToken(String suite_id, String suite_ticket) {
weiXinService.getSuiteToken(suite_id, suite_ticket); weiXinService.getSuiteToken(suite_id, suite_ticket);
} }

6
health/src/main/java/com/ccsens/health/service/WeiXinService.java

@ -85,9 +85,11 @@ public class WeiXinService implements IWeiXinService {
EmployeeExample example = new EmployeeExample(); EmployeeExample example = new EmployeeExample();
example.createCriteria().andUseridEqualTo(bind.getUserid()).andCorpidEqualTo(bind.getCorpid()); example.createCriteria().andUseridEqualTo(bind.getUserid()).andCorpidEqualTo(bind.getCorpid());
List<Employee> employees = employeeDao.selectByExample(example); List<Employee> employees = employeeDao.selectByExample(example);
log.info("有无用户信息"); log.info("有无用户信息:{}", CollectionUtil.isNotEmpty(employees));
if (CollectionUtil.isEmpty(employees)) { if (CollectionUtil.isEmpty(employees)) {
throw new BaseException(CodeEnum.PARAM_ERROR); log.info("没有找到用户信息:{}", bind);
// throw new BaseException(CodeEnum.PARAM_ERROR);
return new Employee();
} }
Employee employee = employees.get(0); Employee employee = employees.get(0);
// if (employee.getTallUserId() == null || employee.getTallUserId() == 0) { // if (employee.getTallUserId() == null || employee.getTallUserId() == 0) {

6
ht/src/main/java/com/ccsens/ht/service/PatientReportService.java

@ -168,9 +168,11 @@ public class PatientReportService implements IPatientReportService {
List<HtDoctor> doctors = htDoctorMapper.selectByExample(doctorExample); List<HtDoctor> doctors = htDoctorMapper.selectByExample(doctorExample);
log.info("当前用户是否为医生:{}", CollectionUtil.isNotEmpty(doctors)); log.info("当前用户是否为医生:{}", CollectionUtil.isNotEmpty(doctors));
if (query.getPatientId() != null) { if (query.getPatientId() != null) {
reportExample.createCriteria().andPatientIdEqualTo(query.getPatientId()).andInitialImpressionIsNotNull().andInitialImpressionNotEqualTo(""); reportExample.createCriteria().andPatientIdEqualTo(query.getPatientId());
//.andInitialImpressionIsNotNull().andInitialImpressionNotEqualTo("");
} else if (CollectionUtil.isNotEmpty(doctors)) { } else if (CollectionUtil.isNotEmpty(doctors)) {
reportExample.createCriteria().andDoctorIdEqualTo(doctors.get(0).getId()).andInitialImpressionIsNotNull().andInitialImpressionNotEqualTo(""); reportExample.createCriteria().andDoctorIdEqualTo(doctors.get(0).getId());
//.andInitialImpressionIsNotNull().andInitialImpressionNotEqualTo("");
} else { } else {
log.info("既无病人信息,有无医生信息,不允许查询"); log.info("既无病人信息,有无医生信息,不允许查询");
throw new BaseException(CodeEnum.PARAM_ERROR); throw new BaseException(CodeEnum.PARAM_ERROR);

2
ht/src/main/resources/application-prod.yml

@ -21,7 +21,7 @@ spring:
max-idle: 10 max-idle: 10
max-wait: -1ms max-wait: -1ms
min-idle: 0 min-idle: 0
password: '' password: 'areowqr!@43ef'
port: 6379 port: 6379
timeout: 1000ms timeout: 1000ms

4
tall/src/main/resources/application-common.yml

@ -24,7 +24,5 @@ spring:
multipart: multipart:
max-file-size: 10MB max-file-size: 10MB
max-request-size: 100MB max-request-size: 100MB
snowflake:
datacenterId: 1
workerId: 1

3
tall/src/main/resources/application-dev.yml

@ -3,6 +3,9 @@ server:
servlet: servlet:
context-path: /v1.0 context-path: /v1.0
spring: spring:
snowflake:
datacenterId: 1
workerId: 1
application: application:
name: tall name: tall
datasource: datasource:

8
tall/src/main/resources/application-prod.yml

@ -3,6 +3,9 @@ server:
servlet: servlet:
context-path: /v1.0 context-path: /v1.0
spring: spring:
snowflake:
datacenterId: 1
workerId: 1
application: application:
name: tall name: tall
datasource: datasource:
@ -21,12 +24,15 @@ spring:
max-idle: 10 max-idle: 10
max-wait: -1ms max-wait: -1ms
min-idle: 0 min-idle: 0
password: '' password: 'areowqr!@43ef'
port: 6379 port: 6379
timeout: 1000ms timeout: 1000ms
swagger: swagger:
enable: false enable: false
eureka: eureka:
instance: instance:
# www.tall.wiki
ip-address: 140.143.228.3 ip-address: 140.143.228.3
# ip-address: 192.144.182.42
gatewayUrl: https://www.tall.wiki/gateway/ gatewayUrl: https://www.tall.wiki/gateway/

3
tall/src/main/resources/application-test.yml

@ -3,6 +3,9 @@ server:
servlet: servlet:
context-path: /v1.0 context-path: /v1.0
spring: spring:
snowflake:
datacenterId: 1
workerId: 1
application: application:
name: tall name: tall
datasource: datasource:

4
tall/src/main/resources/druid-prod.yml

@ -3,7 +3,7 @@ spring:
druid: druid:
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
dynamicUrl: jdbc:mysql://localhost:3306/${schema} dynamicUrl: jdbc:mysql://127.0.0.1:3306/${schema}
filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*' filterExclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*'
filterName: druidFilter filterName: druidFilter
filterProfileEnable: true filterProfileEnable: true
@ -30,4 +30,4 @@ spring:
url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8 url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8
username: root username: root
validationQuery: SELECT 1 FROM DUAL validationQuery: SELECT 1 FROM DUAL
env: CCSENS_TALL env: CCSENS_HEALTH

5
util/src/main/java/com/ccsens/util/WebConstant.java

@ -12,6 +12,11 @@ public class WebConstant {
/**数据已删除*/ /**数据已删除*/
public static final byte STATUS_DELETE = 1; public static final byte STATUS_DELETE = 1;
public static final class Wx {
public static final String ACCESS_TOKEN = "tall_wx_access_token";
public static final long EXPIRE_TIME = 1 * 60 * 60;
}
/**注册来源*/ /**注册来源*/
public static final class Regist { public static final class Regist {
public final static byte SOURCE = 0; public final static byte SOURCE = 0;

30
util/src/main/java/com/ccsens/util/wx/WxGzhUtil.java

@ -7,6 +7,7 @@ import cn.hutool.http.HttpRequest;
import com.ccsens.util.DateUtil; import com.ccsens.util.DateUtil;
import com.ccsens.util.JacksonUtil; import com.ccsens.util.JacksonUtil;
import com.ccsens.util.RedisUtil;
import com.ccsens.util.WebConstant; import com.ccsens.util.WebConstant;
import com.ccsens.util.bean.wx.po.*; import com.ccsens.util.bean.wx.po.*;
import com.ccsens.util.exception.BaseException; import com.ccsens.util.exception.BaseException;
@ -15,7 +16,10 @@ import com.ccsens.util.exception.WxException;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.Arrays; import java.util.Arrays;
@ -24,12 +28,23 @@ import java.util.Map;
/** /**
* @author __zHangSan * @author __zHangSan
*/ */
@Component
public class WxGzhUtil { public class WxGzhUtil {
@Resource
private RedisUtil redisUtil;
private static WxGzhUtil util;
@PostConstruct
public void init(){
util.redisUtil = this.redisUtil;
}
private static final Logger logger = LoggerFactory.getLogger(WxGzhUtil.class); private static final Logger logger = LoggerFactory.getLogger(WxGzhUtil.class);
/** /**
* 全局唯一accessToken * 全局唯一accessToken
*/ */
private static WxAccessToken globalWxAccessToken; // private static WxAccessToken globalWxAccessToken;
/** /**
* accessToken 过期提前10分钟刷新(为防止过期改成提前一个小时刷新) * accessToken 过期提前10分钟刷新(为防止过期改成提前一个小时刷新)
*/ */
@ -161,9 +176,8 @@ public class WxGzhUtil {
* 获取Access_token * 获取Access_token
*/ */
public static String getAccessToken() throws BaseException { public static String getAccessToken() throws BaseException {
if(globalWxAccessToken == null || Object obj = util.redisUtil.get(WebConstant.Wx.ACCESS_TOKEN);
globalWxAccessToken.getCreatedAt() + globalWxAccessToken.getExpiresIn() if(obj == null || StrUtil.isBlank((String)obj) ){
>= DateUtil.currentSeconds() - ACCESS_TOKEN_RESERVED_SECONDS){
WxAccessToken wxAccessToken = null; WxAccessToken wxAccessToken = null;
String url = String.format(URL_GET_ACCESS_TOKEN,"client_credential",appid_health,secret_health); String url = String.format(URL_GET_ACCESS_TOKEN,"client_credential",appid_health,secret_health);
String response = HttpRequest.get(url).execute().body(); String response = HttpRequest.get(url).execute().body();
@ -182,10 +196,12 @@ public class WxGzhUtil {
if (StrUtil.isEmpty(wxAccessToken.getAccessToken())) { if (StrUtil.isEmpty(wxAccessToken.getAccessToken())) {
throw new BusinessException(-1,"can't find the access_token attribute."); throw new BusinessException(-1,"can't find the access_token attribute.");
} }
globalWxAccessToken = wxAccessToken; util.redisUtil.set(WebConstant.Wx.ACCESS_TOKEN, wxAccessToken.getAccessToken(), WebConstant.Wx.EXPIRE_TIME)
globalWxAccessToken.setCreatedAt(DateUtil.currentSeconds()); logger.info("存储access_token:{}", wxAccessToken.getAccessToken());
return wxAccessToken.getAccessToken();
} }
return globalWxAccessToken.getAccessToken(); logger.info("读取reids的token:{}", obj);
return (String)obj;
} }
/** /**

Loading…
Cancel
Save