Commit 824d9e97955842ada14f1b6463805bb63fc15a87
Exists in
master
Merge branch 'master' of https://git.healthbaby.com.cn/jiangjiazhi/center.git
Showing 7 changed files
- parent/center.manager/src/main/java/com/lyms/cm/job/SyncFixJob.java
- parent/center.manager/src/main/java/com/lyms/cm/job/SyncTmpJob.java
- parent/center.manager/src/main/resources/xml/app-tx.xml
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/RouterController.java
- parent/hospital.web/src/main/resources/app-context.xml
- parent/hospital.web/src/main/resources/dev/redis.properties
- parent/hospital.web/src/main/resources/xml/app-timer.xml
parent/center.manager/src/main/java/com/lyms/cm/job/SyncFixJob.java
View file @
824d9e9
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
12 | 12 | import org.springframework.data.redis.core.RedisTemplate; |
13 | 13 | |
14 | +import com.alibaba.fastjson.JSONException; | |
14 | 15 | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
15 | 16 | import com.lyms.base.common.entity.organ.OrganGroup; |
16 | 17 | import com.lyms.base.common.service.organ.OrganGroupService; |
... | ... | @@ -89,7 +90,13 @@ |
89 | 90 | //LOG.info("返回结果: " + result); |
90 | 91 | if (StringUtils.isBlank(result)) |
91 | 92 | return; |
92 | - ChannelData data = JsonUtils.jsonToBean(result, ChannelData.class); | |
93 | + ChannelData data = null; | |
94 | + try{ | |
95 | + data = JsonUtils.jsonToBean(result, ChannelData.class); | |
96 | + }catch(JSONException e){ | |
97 | + LOG.error("同步数据转换异常,请求结果:{} ",result); | |
98 | + return; | |
99 | + } | |
93 | 100 | // 处理回执消息 |
94 | 101 | if (data != null && data.getAck() && StrUtils.isNotEmpty(data.getRemoteClazz()) && StrUtils.isNotEmpty(data.getRemoteMethod())) { |
95 | 102 | // 拉取到数据执行本地方法 |
parent/center.manager/src/main/java/com/lyms/cm/job/SyncTmpJob.java
View file @
824d9e9
... | ... | @@ -3,11 +3,13 @@ |
3 | 3 | import java.io.Serializable; |
4 | 4 | import java.util.concurrent.atomic.AtomicBoolean; |
5 | 5 | |
6 | +import org.apache.commons.lang3.StringUtils; | |
6 | 7 | import org.slf4j.Logger; |
7 | 8 | import org.slf4j.LoggerFactory; |
8 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
9 | 10 | import org.springframework.data.redis.core.RedisTemplate; |
10 | 11 | |
12 | +import com.alibaba.fastjson.JSONException; | |
11 | 13 | import com.alibaba.fastjson.JSONObject; |
12 | 14 | import com.lyms.sync.SyncCallback; |
13 | 15 | import com.lyms.sync.SyncCenter; |
14 | 16 | |
... | ... | @@ -62,11 +64,15 @@ |
62 | 64 | if (model != null) { |
63 | 65 | // 任务发送执行 |
64 | 66 | String result = HttpUtils.REMOTE.post(model); |
65 | - if(result == null){//远程无法访问等情况 | |
67 | + if(StringUtils.isBlank(result)){//远程无法访问等情况 | |
66 | 68 | work.backPressure(); |
67 | 69 | return; |
68 | 70 | } |
69 | - model = JsonUtils.jsonToBean(result, ChannelData.class); | |
71 | + try{ | |
72 | + model = JsonUtils.jsonToBean(result, ChannelData.class); | |
73 | + }catch(JSONException e){ | |
74 | + LOG.error("推送到节点数据返回异常,返回结果:{} ",result); | |
75 | + } | |
70 | 76 | if (model != null && model.getAck()) { |
71 | 77 | work.backPressure(); |
72 | 78 | } |
parent/center.manager/src/main/resources/xml/app-tx.xml
View file @
824d9e9
... | ... | @@ -9,9 +9,6 @@ |
9 | 9 | http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd |
10 | 10 | http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd"> |
11 | 11 | |
12 | - <!-- 扫描 service --> | |
13 | - <context:component-scan base-package="com.iec.b2c.web.service" /> | |
14 | - | |
15 | 12 | <!-- 使用annotation注解方式配置事务 --> |
16 | 13 | <tx:annotation-driven transaction-manager="transactionManager" /> |
17 | 14 |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/RouterController.java
View file @
824d9e9
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | |
31 | 31 | private static final Logger log = LoggerFactory.getLogger(RouterController.class); |
32 | 32 | |
33 | - @RequestMapping(value = "/pull", produces = { MediaType.APPLICATION_JSON_VALUE }) | |
33 | + //@RequestMapping(value = "/pull", produces = { MediaType.APPLICATION_JSON_VALUE }) | |
34 | 34 | public Object pull(HttpServletRequest request) throws Exception { |
35 | 35 | ChannelData data = SyncUtils.conver(request); |
36 | 36 | log.debug("节点数据被中心拉取:" + ToStringBuilder.reflectionToString(data)); |
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | return data; |
45 | 45 | } |
46 | 46 | |
47 | - @RequestMapping(value = "/push", produces = { MediaType.APPLICATION_JSON_VALUE }) | |
47 | + //@RequestMapping(value = "/push", produces = { MediaType.APPLICATION_JSON_VALUE }) | |
48 | 48 | public Object push(HttpServletRequest request) throws Exception { |
49 | 49 | ChannelData data = SyncUtils.conver(request); |
50 | 50 | log.debug("中心推送数据到节点:" + ToStringBuilder.reflectionToString(data)); |
parent/hospital.web/src/main/resources/app-context.xml
View file @
824d9e9
... | ... | @@ -24,9 +24,8 @@ |
24 | 24 | </bean> |
25 | 25 | |
26 | 26 | <context:component-scan base-package="com.lyms" /> |
27 | - <!-- <mvc:default-servlet-handler /> --> | |
28 | 27 | |
29 | - <!-- 配置静态资源,直接映射到对应的文件夹,DispatcherServlet 不处理 --> | |
28 | + <!-- | |
30 | 29 | <mvc:resources mapping="/static/**" location="/WEB-INF/static/" cache-period="31926534"> |
31 | 30 | <mvc:resource-chain resource-cache="false" auto-registration="false"> |
32 | 31 | <mvc:resolvers> |
... | ... | @@ -36,7 +35,7 @@ |
36 | 35 | </mvc:resource-chain> |
37 | 36 | </mvc:resources> |
38 | 37 | <mvc:resources mapping="/error/**" location="/error/" /> |
39 | - | |
38 | + --> | |
40 | 39 | <!-- swagger2 --> |
41 | 40 | <bean class="com.lyms.hospital.conf.SwaggerConfig"></bean> |
42 | 41 | <mvc:resources location="classpath:/META-INF/resources/" mapping="swagger-ui.html"/> |
... | ... | @@ -55,7 +54,6 @@ |
55 | 54 | <aop:aspectj-autoproxy/> |
56 | 55 | |
57 | 56 | <bean class = "com.lyms.aop.SysLogAop"/> |
58 | - | |
59 | 57 | |
60 | 58 | <mvc:interceptors> |
61 | 59 | <bean id="tokenValidateInteceptor" class="com.lyms.hospital.inteceptor.TokenValidateInteceptor"/> |
parent/hospital.web/src/main/resources/dev/redis.properties
View file @
824d9e9
... | ... | @@ -3,6 +3,9 @@ |
3 | 3 | redis.password1=Lyms123456 |
4 | 4 | #redis.host1=127.0.0.1 |
5 | 5 | #redis.port1=6379 |
6 | +#redis.password1= | |
7 | +#redis.host1=127.0.0.1 | |
8 | +#redis.port1=6379 | |
6 | 9 | #redis.password1=Lyms123456 |
7 | 10 | |
8 | 11 | |
... | ... | @@ -29,6 +32,6 @@ |
29 | 32 | redis.maxActive=600 |
30 | 33 | redis.maxWait=1000 |
31 | 34 | redis.testOnBorrow=true |
32 | -redis.HttpSession.redisNamespace=hospital | |
35 | +redis.HttpSession.redisNamespace=center | |
33 | 36 | spring.redis.cluster.max-redirects= 3 |