Commit ebc3b69b by 朱瑞泽

暂定

parent 8009d2d7
package com.gic.cloud.data.hook.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* @author zhurz
*/
public class TableSyncRecordResult implements Serializable {
private String enterpriseId;
private String tableName;
private Date syncTime;
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public Date getSyncTime() {
return syncTime;
}
public void setSyncTime(Date syncTime) {
this.syncTime = syncTime;
}
}
package com.gic.cloud.data.hook.api.service;
import java.util.Date;
/**
* @author zhurz
*/
public interface TableSyncRecordService {
/**
* 获取最近一次同步时间
*
* @param enterpriseId
* @param tableName
* @return
*/
Date lastSyncDateTime(String enterpriseId, String tableName);
}
package com.gic.cloud.data.hook.service.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
/**
* hive表同步记录
*
* @author zhurz
*/
@Mapper
public interface TableSyncRecordDao {
Date lastSyncDateTime(@Param("enterpriseId") String enterpriseId, @Param("tableName") String tableName);
}
package com.gic.cloud.data.hook.service.impl;
import com.gic.cloud.data.hook.api.service.TableSyncRecordService;
import com.gic.cloud.data.hook.service.dao.TableSyncRecordDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* @author zhurz
*/
@Service("tableSyncRecordServiceImpl")
public class TableSyncRecordServiceImpl implements TableSyncRecordService {
@Autowired
private TableSyncRecordDao tableSyncRecordDao;
/**
* 获取最近一次同步时间
*
* @param enterpriseId
* @param tableName
* @return
*/
@Override
public Date lastSyncDateTime(String enterpriseId, String tableName) {
return tableSyncRecordDao.lastSyncDateTime(enterpriseId, tableName);
}
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:context="http://www.springframework.org/schema/context" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/context/spring-context.xsd
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
<dubbo:service interface="com.gic.cloud.data.hook.api.service.SearchLogService" ref="searchLogService" timeout="120000" /> <dubbo:service interface="com.gic.cloud.data.hook.api.service.SearchLogService" ref="searchLogService" timeout="120000" />
<dubbo:service interface="com.gic.cloud.data.hook.api.service.TableSyncRecordService" ref="tableSyncRecordServiceImpl"/>
<!-- 引用的 Dubbo 服务 --> <!-- 引用的 Dubbo 服务 -->
<!--<dubbo:reference interface="com.gic.dict.api.service.ManagerDictService" id="managerDictService" timeout="10000" /> <!--<dubbo:reference interface="com.gic.dict.api.service.ManagerDictService" id="managerDictService" timeout="10000" />
<dubbo:reference interface="com.gic.cloud.communicate.api.service.member.MemberTagFieldService" id="memberTagFieldService" timeout="10000" /> <dubbo:reference interface="com.gic.cloud.communicate.api.service.member.MemberTagFieldService" id="memberTagFieldService" timeout="10000" />
...@@ -44,4 +46,4 @@ ...@@ -44,4 +46,4 @@
<!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>--> <!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>-->
<!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>--> <!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>-->
</beans> </beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.cloud.data.hook.service.dao.TableSyncRecordDao">
<select id="lastSyncDateTime" resultType="java.util.Date">
select sync_time
from dh_table_sync_record
where enterprise_id = #{enterpriseId}
<if test="tableName != null and tableName != ''">
and table_name = #{tableName}
</if>
order by sync_time desc
limit 1
</select>
</mapper>
package com.gic.cloud.data.hook.web;
import com.gic.cloud.data.hook.api.dto.TableSyncRecordResult;
import com.gic.cloud.data.hook.api.service.TableSyncRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Date;
/**
* hive表同步记录
*
* @author zhurz
*/
@Controller
public class TableSyncRecordController {
@Autowired
private TableSyncRecordService tableSyncRecordService;
/**
* 获取最近一次同步时间
*
* @param enterpriseId
* @param tableName
* @return
*/
@RequestMapping("/last-sync-date-time")
public TableSyncRecordResult lastSyncDateTime(String enterpriseId, String tableName) {
TableSyncRecordResult result = new TableSyncRecordResult();
result.setEnterpriseId(enterpriseId);
result.setTableName(tableName);
Date date = tableSyncRecordService.lastSyncDateTime(enterpriseId, tableName);
result.setSyncTime(date);
return result;
}
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:context="http://www.springframework.org/schema/context" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/context/spring-context.xsd
...@@ -31,11 +31,12 @@ ...@@ -31,11 +31,12 @@
<!--<dubbo:reference interface="com.gic.enterprise.api.service.EnterPerformanceService" id="enterPerformanceService" timeout="10000" retries="0" /> <!--<dubbo:reference interface="com.gic.enterprise.api.service.EnterPerformanceService" id="enterPerformanceService" timeout="10000" retries="0" />
<dubbo:reference interface="com.gic.cloud.communicate.api.service.performance.CloudPerformanceService" id="cloudPerformanceService" timeout="10000" retries="0" /> <dubbo:reference interface="com.gic.cloud.communicate.api.service.performance.CloudPerformanceService" id="cloudPerformanceService" timeout="10000" retries="0" />
<dubbo:reference interface="com.gic.cloud.communicate.api.service.store.AreaService" id="areaService" timeout="10000" retries="0" />--> <dubbo:reference interface="com.gic.cloud.communicate.api.service.store.AreaService" id="areaService" timeout="10000" retries="0" />-->
<dubbo:reference interface="com.gic.cloud.data.hook.api.service.TableSyncRecordService" id="tableSyncRecordService" retries="0" />
<!-- 使用zookeeper注册中心暴露服务地址 --> <!-- 使用zookeeper注册中心暴露服务地址 -->
<!--<dubbo:registry address="zookeeper://localhost:2181" protocol="dubbo" id="localAdd"/>--> <!--<dubbo:registry address="zookeeper://localhost:2181" protocol="dubbo" id="localAdd"/>-->
<!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>--> <!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>-->
<!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>--> <!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>-->
</beans> </beans>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment