1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package com.chinacreator.process.dao;
- import com.chinacreator.process.util.DataSource;
- import com.frameworkset.common.poolman.SQLExecutor;
- import oracle.sql.CLOB;
- import org.springframework.stereotype.Component;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.Reader;
- import java.sql.SQLException;
- import java.text.SimpleDateFormat;
- import java.util.Calendar;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- @Component
- public class EverySmsDao {
- public List<HashMap> getData(String datetm) throws SQLException {
- String sql = " SELECT id,count,datetm FROM TD_FLOWRUNOUT_REC A WHERE A.STATUS = '1' and datetm = ?";
- return SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql, datetm);
- }
- //已处理数据
- public List<HashMap> gethasdealData(String datetm) throws SQLException {
- String sql = " SELECT id,count,datetm FROM TD_FLOWRUNOUT_REC A WHERE A.STATUS = '0' and datetm = ?";
- return SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql, datetm);
- }
- //统计数据到表
- public void statistics(String datetm) throws SQLException {
- String sql = "insert into TD_FLOWRUNOUT_REC(id,count,datetm) values(TO_CHAR(SYSDATE,'yyyyMMddhh24miss')||SEQ_COMMON6.nextval," +
- "(select count(*) from TL_SMSALARM_LOG t1,TB_FLOWLIMIT_ALERT_CONF t2 where to_char(t1.inserttime,'yyyy-MM-dd')=? " +
- "and t1.alertid = t2.id and t2.alertval = '0' and t1.resultcode = '0'),?)";
- SQLExecutor.insertWithDBName(DataSource.NET3G, sql, datetm, datetm);
- }
- /**
- * 更新状态为已完成
- *
- * @return
- */
- public void upResult(String id, String resultcode, String resultinfo) throws SQLException {
- String sql = "UPDATE TD_FLOWRUNOUT_REC SET STATUS = '0',RESULTCODE=?,RESULTINFO=? WHERE id=?";
- SQLExecutor.updateWithDBName(DataSource.NET3G, sql, resultcode, resultinfo, id);
- }
- public static void main(String[] args) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- Calendar c = Calendar.getInstance();
- c.setTime(new Date());
- c.add(Calendar.DAY_OF_MONTH, -1);
- Date yesterday = c.getTime();//这是昨天
- String date = sdf.format(yesterday);
- System.out.println(date);
- }
- }
|