| | |
| | | package com.java110.job.dao.impl; |
| | | |
| | | import com.java110.core.base.dao.BaseServiceDao; |
| | | import com.java110.job.dao.IHccFtpFileDAO; |
| | | import com.java110.job.dao.IHcFtpFileDAO; |
| | | import com.java110.job.model.FtpTaskLog; |
| | | import com.java110.job.model.FtpTaskLogDetail; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | @Service("IPrvncFtpFileDAO") |
| | | @Service("hcFtpFileDAOImpl") |
| | | @Transactional |
| | | public class HcFtpFileDAOImpl extends BaseServiceDao implements IHccFtpFileDAO { |
| | | public class HcFtpFileDAOImpl extends BaseServiceDao implements IHcFtpFileDAO { |
| | | |
| | | public long saveTaskRunLog(FtpTaskLog loginfo){ |
| | | // TODO Auto-generated method stub |
| | | return sqlSessionTemplate.insert("IPrvncFtpFileDAO.saveTaskRunLog",loginfo); |
| | | return sqlSessionTemplate.insert("IHcFtpFileDAO.saveTaskRunLog",loginfo); |
| | | } |
| | | |
| | | public void updateTaskRunLog(FtpTaskLog loginfo){ |
| | | // TODO Auto-generated method stub |
| | | sqlSessionTemplate.update("IPrvncFtpFileDAO.updateTaskRunLog",loginfo); |
| | | sqlSessionTemplate.update("IHcFtpFileDAO.updateTaskRunLog",loginfo); |
| | | } |
| | | public int saveTaskRunDetailLog(FtpTaskLogDetail logdetail){ |
| | | // TODO Auto-generated method stub |
| | | return sqlSessionTemplate.insert("IPrvncFtpFileDAO.saveTaskRunDetailLog",logdetail); |
| | | return sqlSessionTemplate.insert("IHcFtpFileDAO.saveTaskRunDetailLog",logdetail); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List execConfigSql(String dbsql){ |
| | | return sqlSessionTemplate.selectList("IPrvncFtpFileDAO.execConfigSql", dbsql); |
| | | return sqlSessionTemplate.selectList("IHcFtpFileDAO.execConfigSql", dbsql); |
| | | } |
| | | /** |
| | | * 查询文件下载在文件系统的配置任务列表 |
| | |
| | | public Map queryFtpItems(Map info){ |
| | | Map resultInfo = new HashMap(); |
| | | //1.0查询总数 |
| | | Integer allCNT = (Integer) sqlSessionTemplate.selectOne("IPrvncFtpFileDAO.queryFtpItemsCount", info); |
| | | Integer allCNT = (Integer) sqlSessionTemplate.selectOne("IHcFtpFileDAO.queryFtpItemsCount", info); |
| | | resultInfo.put("ITEMSCOUNT", allCNT); |
| | | List datas = sqlSessionTemplate.selectList("IPrvncFtpFileDAO.queryFtpItems",info); |
| | | List datas = sqlSessionTemplate.selectList("IHcFtpFileDAO.queryFtpItems",info); |
| | | resultInfo.put("DATA", datas); |
| | | return resultInfo; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public long newCreateTaskId(){ |
| | | Long tastId = (Long) sqlSessionTemplate.selectOne("IPrvncFtpFileDAO.newCreateTaskId"); |
| | | Long tastId = (Long) sqlSessionTemplate.selectOne("IHcFtpFileDAO.newCreateTaskId"); |
| | | return tastId; |
| | | } |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public int addFtpItem(Map info){ |
| | | // return Integer.parseInt(sqlSessionTemplate.insert("IPrvncFtpFileDAO.addFtpItem", info).toString()); |
| | | sqlSessionTemplate.insert("IPrvncFtpFileDAO.addFtpItem", info); |
| | | // return Integer.parseInt(sqlSessionTemplate.insert("IHcFtpFileDAO.addFtpItem", info).toString()); |
| | | sqlSessionTemplate.insert("IHcFtpFileDAO.addFtpItem", info); |
| | | return 1; |
| | | } |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public Map queryFtpItemByTaskId(Map info){ |
| | | Object data = sqlSessionTemplate.selectOne("IPrvncFtpFileDAO.queryFtpItemByTaskId", info); |
| | | Object data = sqlSessionTemplate.selectOne("IHcFtpFileDAO.queryFtpItemByTaskId", info); |
| | | Map ftpItem = null ; |
| | | if(data != null){ |
| | | ftpItem = (Map)data; |
| | | //查ftpitem属性 |
| | | List<Map> ftpItemAttrs = sqlSessionTemplate.selectList("IPrvncFtpFileDAO.queryFtpItemAttrsByTaskId",info); |
| | | List<Map> ftpItemAttrs = sqlSessionTemplate.selectList("IHcFtpFileDAO.queryFtpItemAttrsByTaskId",info); |
| | | ftpItem.put("FTP_ITEM_ATTRS", ftpItemAttrs); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public List<Map> searchFtpItemByTaskName(Map info){ |
| | | return sqlSessionTemplate.selectList("IPrvncFtpFileDAO.searchFtpItemByTaskName",info); |
| | | return sqlSessionTemplate.selectList("IHcFtpFileDAO.searchFtpItemByTaskName",info); |
| | | } |
| | | /** |
| | | * 修改ftp配置信息 |
| | |
| | | * @return |
| | | */ |
| | | public int updateFtpItemByTaskId(Map info){ |
| | | return sqlSessionTemplate.update("IPrvncFtpFileDAO.updateFtpItemByTaskId", info); |
| | | return sqlSessionTemplate.update("IHcFtpFileDAO.updateFtpItemByTaskId", info); |
| | | } |
| | | /** |
| | | * 删除ftp配置信息 |
| | |
| | | * @return |
| | | */ |
| | | public int deleteFtpItemByTaskId(Map info){ |
| | | return sqlSessionTemplate.update("IPrvncFtpFileDAO.deleteFtpItemByTaskId", info); |
| | | return sqlSessionTemplate.update("IHcFtpFileDAO.deleteFtpItemByTaskId", info); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public List<Map> queryFtpItemsByTaskIds(Map info){ |
| | | return sqlSessionTemplate.selectList("IPrvncFtpFileDAO.queryFtpItemsByTaskIds",info); |
| | | return sqlSessionTemplate.selectList("IHcFtpFileDAO.queryFtpItemsByTaskIds",info); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public List<Map> queryFtpItemAttrsByTaskId(Map info){ |
| | | return sqlSessionTemplate.selectList("IPrvncFtpFileDAO.queryFtpItemAttrsByTaskId",info); |
| | | return sqlSessionTemplate.selectList("IHcFtpFileDAO.queryFtpItemAttrsByTaskId",info); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public int deleteFtpItemAttrsbyTaskId(Map info){ |
| | | return sqlSessionTemplate.delete("IPrvncFtpFileDAO.deleteFtpItemAttrsbyTaskId", info); |
| | | return sqlSessionTemplate.delete("IHcFtpFileDAO.deleteFtpItemAttrsbyTaskId", info); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | para.put("tablename", tablename.toUpperCase()); |
| | | para.put("colnames", "'"+colnames.toUpperCase().replaceAll(",", "','")+"'"); |
| | | return sqlSessionTemplate.selectList("IPrvncFtpFileDAO.queryTableColInfo",para); |
| | | return sqlSessionTemplate.selectList("IHcFtpFileDAO.queryTableColInfo",para); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public int addFtpItemAttrs(List<Map> infos){ |
| | | for(Map info :infos){ |
| | | sqlSessionTemplate.insert("IPrvncFtpFileDAO.addFtpItemAttrs",info); |
| | | sqlSessionTemplate.insert("IHcFtpFileDAO.addFtpItemAttrs",info); |
| | | } |
| | | |
| | | return 1; |
| | |
| | | * @return |
| | | */ |
| | | public List<Map> queryFileNamesWithOutFtpLog(Map info){ |
| | | return sqlSessionTemplate.selectList("IPrvncFtpFileDAO.queryFileNamesWithOutFtpLog",info); |
| | | return sqlSessionTemplate.selectList("IHcFtpFileDAO.queryFileNamesWithOutFtpLog",info); |
| | | } |
| | | /** |
| | | * 查询ItemSpec |
| | |
| | | * @return |
| | | */ |
| | | public List<Map> queryItemSpec(Map info){ |
| | | return sqlSessionTemplate.selectList("IPrvncFtpFileDAO.queryItemSpec",info); |
| | | return sqlSessionTemplate.selectList("IHcFtpFileDAO.queryItemSpec",info); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public int updateFtpItemRunState(Map info){ |
| | | return sqlSessionTemplate.update("IPrvncFtpFileDAO.updateFtpItemRunState", info); |
| | | return sqlSessionTemplate.update("IHcFtpFileDAO.updateFtpItemRunState", info); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public int addDownloadFileName(Map info){ |
| | | // return Integer.parseInt(getSqlMapClientTemplate().insert("IPrvncFtpFileDAO.addDownloadFileName", info).toString()); |
| | | // return Integer.parseInt(getSqlMapClientTemplate().insert("IHcFtpFileDAO.addDownloadFileName", info).toString()); |
| | | |
| | | return sqlSessionTemplate.insert("IPrvncFtpFileDAO.addDownloadFileName", info); |
| | | return sqlSessionTemplate.insert("IHcFtpFileDAO.addDownloadFileName", info); |
| | | } |
| | | |
| | | /** |
| | |
| | | public void saveDbFunction(String function){ |
| | | Map para=new HashMap(); |
| | | para.put("functionname", function); |
| | | sqlSessionTemplate.selectOne("IPrvncFtpFileDAO.calltaskfunction",para); |
| | | sqlSessionTemplate.selectOne("IHcFtpFileDAO.calltaskfunction",para); |
| | | } |
| | | |
| | | /** |
| | | * 执行存过(带参数),处理任务执行前后的事情 |
| | | */ |
| | | public void saveDbFunctionWithParam(Map info){ |
| | | sqlSessionTemplate.selectOne("IPrvncFtpFileDAO.calltaskfunctionwithparam",info); |
| | | sqlSessionTemplate.selectOne("IHcFtpFileDAO.calltaskfunctionwithparam",info); |
| | | } |
| | | |
| | | public void insertFileData2Table(String insertSQL){ |
| | | // TODO Auto-generated method stub |
| | | sqlSessionTemplate.update("IPrvncFtpFileDAO.insertFileData2Table",insertSQL); |
| | | sqlSessionTemplate.update("IHcFtpFileDAO.insertFileData2Table",insertSQL); |
| | | } |
| | | } |