Commit 652a9647956c46f0cb6759563b97a9e2318996ef

Authored by baohanddd
1 parent 3b86fa40e9

add data import : basic config

Showing 7 changed files with 193 additions and 21 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/model/UsersQuery.java View file @ 652a964
... ... @@ -9,7 +9,7 @@
9 9 public class UsersQuery extends BaseQuery {
10 10 private Integer id;
11 11 private Integer logincenterId;
12   - private Integer type; //0¹ÜÀíÔ± 1Óû§
  12 + private Integer type; //
13 13 private Integer orgId;
14 14 private Integer deptId;
15 15 private String name;
platform-data-api/src/main/java/com/lyms/platform/data/controller/TaskController.java View file @ 652a964
1 1 package com.lyms.platform.data.controller;
2 2  
3 3 import com.lyms.platform.data.service.DataImportTaskService;
4   -import com.lymsh.mommybaby.earlydata.model.MommyExamineInfo;
5   -import com.lymsh.mommybaby.earlydata.model.OracleCommonQuery;
6   -import com.lymsh.mommybaby.earlydata.model.PlatDataContent;
7   -import com.lymsh.mommybaby.earlydata.model.PlatDataType;
8   -import com.lymsh.mommybaby.earlydata.service.MommyService;
9   -import com.lymsh.mommybaby.earlydata.service.PlatService;
10   -import org.apache.commons.lang.StringUtils;
11   -import org.joda.time.DateTime;
12 4 import org.springframework.beans.factory.annotation.Autowired;
13 5 import org.springframework.stereotype.Controller;
14 6 import org.springframework.web.bind.annotation.RequestMapping;
15 7 import org.springframework.web.servlet.ModelAndView;
16 8  
17 9 import javax.servlet.http.HttpServletResponse;
18   -import java.util.Date;
19   -import java.util.List;
20 10  
21 11 /**
22 12 * Created by riecard on 15/10/26.
... ... @@ -24,14 +14,6 @@
24 14 @Controller
25 15 @RequestMapping("/task")
26 16 public class TaskController extends BaseController {
27   -
28   - private static final Integer pageSize = 100;
29   -
30   - @Autowired
31   - private PlatService platService;
32   -
33   - @Autowired
34   - private MommyService mommyService;
35 17  
36 18 @Autowired
37 19 private DataImportTaskService dataImportTaskService;
platform-data-api/src/main/resources/spring/applicationContext-dal.xml View file @ 652a964
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<beans xmlns="http://www.springframework.org/schema/beans"
  3 + xmlns:p="http://www.springframework.org/schema/p"
  4 + xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
  5 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  6 + xmlns:cache="http://www.springframework.org/schema/cache"
  7 + xmlns:task="http://www.springframework.org/schema/task"
  8 + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  9 + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
  10 + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
  11 + http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
  12 + http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
  13 +
  14 +
  15 + <!-- 配置数据源 -->
  16 + <bean name="dataSourceB" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
  17 + <property name="url" value="${maindata.jdbcurl}" />
  18 + <property name="username" value="${maindata.username}" />
  19 + <property name="password" value="${maindata.password}" />
  20 + <property name="initialSize" value="10" />
  21 + <property name="maxActive" value="100" />
  22 + <property name="maxIdle" value="10" />
  23 + <property name="minIdle" value="0" />
  24 + <property name="maxWait" value="10000" />
  25 + <!-- <property name="validationQuery" value="${validationQuery3}" /> -->
  26 + <property name="testOnBorrow" value="false" />
  27 + <property name="testOnReturn" value="false" />
  28 + <property name="testWhileIdle" value="true" />
  29 + <property name="timeBetweenEvictionRunsMillis" value="60000" />
  30 + <property name="minEvictableIdleTimeMillis" value="25200000" />
  31 + <property name="removeAbandoned" value="true" />
  32 + <property name="removeAbandonedTimeout" value="1800" />
  33 + <property name="logAbandoned" value="true" />
  34 + <property name="filters" value="stat" />
  35 + </bean>
  36 +
  37 +
  38 +
  39 + <bean id="mainJdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"
  40 + p:dataSource-ref="dataSourceB" />
  41 +
  42 + <bean id="mainSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  43 + <property name="dataSource" ref="dataSourceB" />
  44 + <property name="mapperLocations">
  45 + <list>
  46 + <value>classpath*:mainOrm/*.xml</value>
  47 + </list>
  48 + </property>
  49 + </bean>
  50 +
  51 + <!-- all class in the back-package are auto loaded as a mapper -->
  52 + <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  53 + <property name="basePackage" value="com.lyms.platform.permission.dao" />
  54 + </bean>
  55 +
  56 + <!-- manage transaction -->
  57 + <bean id="mainTransactionManager"
  58 + class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  59 + <property name="dataSource" ref="dataSourceB" />
  60 + </bean>
  61 +
  62 + <tx:annotation-driven transaction-manager="mainTransactionManager"/>
  63 +
  64 + <!-- Mabatis Data Layer -->
  65 + <bean id="mainSqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
  66 + <constructor-arg index="0" ref="mainSqlSessionFactory" />
  67 + </bean>
  68 +
  69 +
  70 +</beans>
platform-data-api/src/main/resources/spring/applicationContext-mvc.xml View file @ 652a964
... ... @@ -19,8 +19,6 @@
19 19 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
20 20 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
21 21 http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
22   - <import resource="classpath:META-INF/cxf/cxf.xml"/>
23   - <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
24 22  
25 23 <context:component-scan base-package="com.lyms.platform.data.controller" use-default-filters="false">
26 24 <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
platform-data-api/src/main/resources/spring/applicationContext.xml View file @ 652a964
... ... @@ -11,6 +11,12 @@
11 11  
12 12 <!-- 采用注释的方式配置bean -->
13 13 <context:annotation-config />
  14 +
  15 + <!-- 配置要扫描的包 -->
  16 + <context:component-scan base-package="com.lyms.platform.biz.service" />
  17 + <!-- 配置要扫描的包 -->
  18 + <context:component-scan base-package="com.lyms.platform.biz.dal.impl" />
  19 + <context:component-scan base-package="com.lyms.platform.permission.*" />
14 20 <bean id="configProperties"
15 21 class="org.springframework.beans.factory.config.PropertiesFactoryBean">
16 22 <property name="locations">
... ... @@ -115,5 +121,8 @@
115 121 </bean>
116 122  
117 123 <import resource="applicationContext-cxf.xml" />
  124 + <import resource="classpath:/spring/applicationContext_biz_patient.xml"/>
  125 + <import resource="classpath:/spring/spring-mongodb.xml"/>
  126 + <import resource="classpath:/spring/applicationContext-dal.xml"/>
118 127 </beans>
platform-data-api/src/main/resources/spring/applicationContext_biz_patient.xml View file @ 652a964
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<beans xmlns="http://www.springframework.org/schema/beans"
  3 + xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
  4 + xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5 + xmlns:cache="http://www.springframework.org/schema/cache" xmlns:task="http://www.springframework.org/schema/task"
  6 + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  7 + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
  8 + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
  9 + http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
  10 + http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
  11 + <context:component-scan base-package="com.lyms.platform" />
  12 + <context:annotation-config />
  13 +
  14 + <bean id="configProperties"
  15 + class="org.springframework.beans.factory.config.PropertiesFactoryBean">
  16 + <property name="locations">
  17 + <list>
  18 + <value>classpath:database.properties</value>
  19 + </list>
  20 + </property>
  21 + </bean>
  22 + <bean id="propertyConfigurer"
  23 + class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
  24 + <property name="properties" ref="configProperties" />
  25 + </bean>
  26 + <!-- Cache -->
  27 + <cache:annotation-driven cache-manager="cacheManager" />
  28 + <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
  29 + <property name="caches">
  30 + <set>
  31 + <bean
  32 + class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"
  33 + p:name="default" />
  34 + <bean
  35 + class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"
  36 + p:name="andCache" />
  37 + </set>
  38 + </property>
  39 + </bean>
  40 + <!--自动代理dao层 -->
  41 + <bean
  42 + class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" id="autoProxyCreator">
  43 + <property name="beanNames" value="*Dao" />
  44 + <property name="interceptorNames">
  45 + <list>
  46 + <value>dalInterceptor</value>
  47 + </list>
  48 + </property>
  49 + </bean>
  50 +
  51 + <bean
  52 + class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" id="nameAutoProxyCreator">
  53 + <property name="beanNames" value="*Mapper" />
  54 + <property name="interceptorNames">
  55 + <list>
  56 + <value>mysqlDalInterceptor</value>
  57 + </list>
  58 + </property>
  59 + </bean>
  60 +
  61 + <!-- dal层方法性能统计-->
  62 + <bean id="mysqlDalInterceptor"
  63 + class="com.lyms.platform.common.perf.DalMethodInterceptor">
  64 + <property name="threshold" value="30" />
  65 + </bean>
  66 + <!-- dal层方法性能统计-->
  67 + <bean id="dalInterceptor"
  68 + class="com.lyms.platform.common.perf.DalMethodInterceptor">
  69 + <property name="threshold" value="10" />
  70 + </bean>
  71 +
  72 + <!-- <bean id="messageResolver" class="com.lyms.platform.common.core.resolve.MessageResolver" /> -->
  73 + <import resource="spring-mongodb.xml" />
  74 +</beans>
platform-data-api/src/main/resources/spring/spring-mongodb.xml View file @ 652a964
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<beans xmlns="http://www.springframework.org/schema/beans"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xmlns:mongo="http://www.springframework.org/schema/data/mongo"
  5 + xsi:schemaLocation="http://www.springframework.org/schema/data/mongo
  6 + http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
  7 + http://www.springframework.org/schema/beans
  8 + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
  9 +
  10 + <bean name="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
  11 + <constructor-arg name="mongo" ref="mongo"/>
  12 + <constructor-arg name="userCredentials" ref="userCredentials"/>
  13 + <constructor-arg name="databaseName" value="platform"/>
  14 + </bean>
  15 +
  16 +
  17 + <bean id="defaultMongoTypeMapper"
  18 + class="org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper">
  19 + <constructor-arg name="typeKey">
  20 + <null/>
  21 + </constructor-arg>
  22 + </bean>
  23 +
  24 + <bean id="userCredentials" class="org.springframework.data.authentication.UserCredentials">
  25 + <constructor-arg name="username" value="${mongo.db.username}"/>
  26 + <constructor-arg name="password" value="${mongo.db.password}"/>
  27 + </bean>
  28 +
  29 + <mongo:db-factory mongo-ref="mongo" id="mongoDbFactory"/>
  30 +
  31 + <mongo:mongo id="mongo" host="${mongo.db.host}" port="${mongo.db.port}">
  32 + <mongo:options connections-per-host="${mongo.connectionsPerHost}"
  33 + threads-allowed-to-block-for-connection-multiplier="${mongo.threadsAllowedToBlockForConnectionMultiplier}"
  34 + connect-timeout="${mongo.connectTimeout}" max-wait-time="${mongo.maxWaitTime}"
  35 + auto-connect-retry="${mongo.autoConnectRetry}" socket-keep-alive="${mongo.socketKeepAlive}"
  36 + socket-timeout="${mongo.socketTimeout}" write-number="1"
  37 + write-timeout="0" write-fsync="true"/>
  38 + </mongo:mongo>
  39 +</beans>