Commit cc7e1b70 by 陶光胜

Merge branch 'developer' of http://115.159.76.241/data-hook/gic-cloud into developer

parents 1baf4c3e 332a52a4
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);
}
}
......@@ -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.TableSyncRecordService" ref="tableSyncRecordServiceImpl"/>
<!-- 引用的 Dubbo 服务 -->
<!--<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" />
......
<?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 com.gic.web.common.utils.SessionContextUtils;
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 tableName
* @return
*/
@RequestMapping("/last-sync-date-time")
public TableSyncRecordResult lastSyncDateTime(String tableName) {
String enterpriseId = SessionContextUtils.getLoginUserEnterpriseId();
TableSyncRecordResult result = new TableSyncRecordResult();
result.setEnterpriseId(enterpriseId);
result.setTableName(tableName);
Date date = tableSyncRecordService.lastSyncDateTime(enterpriseId, tableName);
result.setSyncTime(date);
return result;
}
}
......@@ -31,6 +31,7 @@
<!--<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.store.AreaService" id="areaService" timeout="10000" retries="0" />-->
<dubbo:reference interface="com.gic.cloud.data.hook.api.service.TableSyncRecordService" id="tableSyncRecordService" retries="0" />
<!-- 使用zookeeper注册中心暴露服务地址 -->
......
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