Kaynağa Gözat

MINI版测试与修改

hzp 9 yıl önce
ebeveyn
işleme
08ed27664d

+ 1 - 1
Hos-Resource-Mini/pom.xml

@ -37,7 +37,7 @@
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.37</version>
            <version>5.1.38</version>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>

Dosya farkı çok büyük olduğundan ihmal edildi
+ 7 - 3
Hos-Resource-Mini/src/main/java/com.yihu.ehr/controller/SystemController.java


+ 1 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/DatacollectManager.java

@ -95,7 +95,7 @@ public class DatacollectManager implements IDatacollectManager {
    @Override
    public DataGridResult getJobRepeat(int page,int size) throws Exception
    {
        String sql = "select * from crawler_supply where 1=1";
        String sql = "select * from crawler_supply where 1=1 and start_time is not null and end_time is not null";
        DBList list = query.queryBySql(sql,page,size);

+ 28 - 9
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/SystemManager.java

@ -2,6 +2,8 @@ package com.yihu.ehr.service;
import com.yihu.ehr.common.config.SysConfig;
import com.yihu.ehr.common.config.ThreadConfig;
import com.yihu.ehr.dbhelper.common.enums.CommonEnum;
import com.yihu.ehr.dbhelper.jdbc.DBDriver;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.framework.model.Result;
import com.yihu.ehr.model.DataSource;
@ -17,6 +19,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpSession;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.util.Enumeration;
import java.util.List;
import java.util.UUID;
@ -145,17 +151,30 @@ public class SystemManager implements ISystemManager {
    测试数据源
     */
    @Override
    public Result testDataSource(String config) throws Exception {
        DBHelper db = new DBHelper(config, config);
        if (db.test()) {
            return Result.success("连接测试成功!");
        } else {
            if (db.errorMessage.length() > 0) {
                return Result.error(db.errorMessage);
            } else {
                return Result.error("连接测试成失败!");
    public Result testDataSource(String uri) {
        try {
            DBDriver.registerDriver(uri);
            Connection conn = DriverManager.getConnection(uri);
            if(conn!=null) {
                String message="连接测试成功!";
                if(conn.isClosed())
                {
                    message = "连接测试失败!";
                }
                conn.close();
                return Result.success(message);
            }
            else {
                return Result.error("连接测试失败!");
            }
        }
        catch (Exception ex)
        {
            return Result.error(ex.getMessage());
        }
    }
    /*

+ 15 - 7
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/crawler/CrawlerManager.java

@ -95,14 +95,22 @@ public class CrawlerManager {
                db.execute("update crawler_supply set status = 2 where id = '"+id+"'");
                Date startTime = DateUtil.formatYMDToYMDHMS(json.getString("start_time"));
                Date endTime = DateUtil.formatYMDToYMDHMS(json.getString("end_time"));
                LogUtil.info("补采任务开始!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime);
                if ((endTime.getTime() - startTime.getTime()) <= 0) {
                    LogUtil.info("补采任务提前结束,时间间隔小于或等于0!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime);
                    changeFillMiningStatus(json, "补采任务提前结束,时间间隔小于或等于0!");
                    return;
                String message = "";
                if(startTime!=null && endTime!=null) {
                    LogUtil.info("补采任务开始!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime);
                    if ((endTime.getTime() - startTime.getTime()) <= 0) {
                        LogUtil.info("补采任务提前结束,时间间隔小于或等于0!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime);
                        changeFillMiningStatus(json, "补采任务提前结束,时间间隔小于或等于0!");
                        return;
                    }
                    message = dataCrawler(startTime, endTime, id, 1);
                    LogUtil.info("补采任务结束!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime + "\n" + message);
                }
                else{
                    message = "采集时间范围:" + startTime + "~" + endTime + "无效!";
                    LogUtil.info(message);
                }
                String message = dataCrawler(startTime, endTime, id, 1);
                LogUtil.info("补采任务结束!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime + "\n" +message);
                if (!StringUtil.isEmpty(message)) {
                    changeFillMiningStatus(json, message);
                }

+ 14 - 10
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/crawler/DBOrigin.java

@ -97,22 +97,26 @@ public class DBOrigin {
                if (data == null || ((ArrayNode) data).size() == 0) {
                    return null;
                }
                JSONObject json = new JSONObject();
                if (data != null && data.get(0) != null) {
                    Iterator fileNames = data.get(0).fieldNames();
                JSONArray jsonArray = new JSONArray();
                for(int i=0;i<data.size();i++)
                {
                    JsonNode o = data.get(i);
                    JSONObject json = new JSONObject();
                    Iterator fileNames = o.fieldNames();
                    while (fileNames.hasNext()) {
                        String fieldName = (String)fileNames.next();
                        if (!StringUtil.isEmpty(itemTagMap.get(fieldName))) {
                            json.put(itemTagMap.get(fieldName), data.get(0).get(fieldName).asText());
                            json.put(itemTagMap.get(fieldName), o.get(fieldName).asText());
                        }
                    }
                    if (json.keySet().size() != itemTagMap.keySet().size()) {
                        LogUtil.info("适配数据元数量与机构提供数据元不一致,请确认!");
                        LogUtil.info("视图提供数据元:" + json.keySet().toString() + "适配数据元:" + itemList.toString());
                    }
                    jsonArray.add(json);
                }
                if (json.keySet().size() != itemTagMap.keySet().size()) {
                    LogUtil.info("适配数据元数量与机构提供数据元不一致,请确认!");
                    LogUtil.info("视图提供数据元:" + json.keySet().toString() + "适配数据元:" + itemList.toString());
                }
                JSONArray jsonArray = new JSONArray();
                jsonArray.add(0, json);
                ObjectMapper mapper = new ObjectMapper();
                //JSON ----> JsonNode
                JsonNode jsonNode = mapper.readTree(jsonArray.toString());

+ 1 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/intf/ISystemManager.java

@ -21,7 +21,7 @@ public interface ISystemManager {
    Result saveDataSource(String id,String name,String config) throws Exception;
    Result testDataSource(String config) throws Exception;
    Result testDataSource(String uri) throws Exception;
    Result loginAction(HttpSession session ,String user,String password) throws Exception;
}

+ 4 - 1
Hos-Resource-Mini/src/main/resources/config/http.properties

@ -1,6 +1,9 @@
httpUrl = https://172.19.103.73:443/api/v1.0
#https://192.168.131.151:443/
#ÖÒhttps://192.168.131.15:4432/api/v1.0
  #https://172.19.103.73:443/api/v1.0
sslKeystore = I:/ssl/tomcat.keystore
sslPassword = 123456
clientId = kHAbVppx44

+ 2 - 2
Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/system/dataSourceJs.jsp

@ -54,7 +54,7 @@
            var resultStr="";
            if(data.type=="mysql"){//mysql
                resultStr ="jdbc:mysql://"+ data.ip +":"+ data.port +"/"+ data.dbName +"?user="+ data.dbUser +"&password="+ data.dbPassword;
                resultStr ="jdbc:mysql://"+ data.ip +":"+ data.port +"/"+ data.dbName +"?user="+ data.dbUser +"&password="+ data.dbPassword +"&useUnicode=true&characterEncoding=UTF-8";
            }
            else if(data.type=="oracle"){//oracle
                resultStr ="jdbc:oracle:thin:"+ data.dbUser +"/"+ data.dbPassword +"@//"+ data.ip +":"+ data.port +"/"+ data.dbName ;
@ -115,7 +115,7 @@
                type: "POST",
                url : "${contextRoot}/system/testDataSource",
                dataType : "json",
                data:{config:me.getConfigString(data)},
                data:{uri:me.getConfigString(data)},
                cache:false,
                success :function(data){
                    if(data.successFlg) {