package com.chinacreator.process.dao; import com.chinacreator.process.bean.BackShareOrderBean; import com.chinacreator.process.bean.DeveuploadBean; import com.chinacreator.process.bean.OrderBean; import com.chinacreator.process.util.DataSource; import com.frameworkset.common.poolman.SQLExecutor; import org.springframework.stereotype.Component; import java.sql.SQLException; import java.util.HashMap; import java.util.List; @Component public class DeveuploadDao { public List queryList() throws SQLException { String sql = " select id,userid,spid,province,area,to_char(ordertime,'yyyymmddhh24miss') ordertime,orderchannel,orderchannel2,to_char(insertcount) insertcount from TD_ORDER_DEVEUPLOAD_WAIT where resultcode = '1' or (resultcode <> '0' and insertcount < 6) order by inserttime"; List hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql); return hashMaps; } public void updataQueryList(String id,String resultcode) throws SQLException { String sql = "update TD_ORDER_DEVEUPLOAD_WAIT set resultcode = ?,updatetime = sysdate where id = ?"; SQLExecutor.updateWithDBName(DataSource.NET3G, sql,resultcode,id); } /** * 更新执行状态为2且时间超过10分钟的数据为待处理 * @return */ public int updExecTimeout(){ int res = 0; String sql = "update TD_ORDER_DEVEUPLOAD_WAIT set resultcode = '1' where resultcode = '2' and updatetime < sysdate-1/24/6"; try { Object obj = SQLExecutor.updateWithDBName(DataSource.NET3G, sql, null); res = (Integer)obj; } catch (SQLException e) { e.printStackTrace(); } return res; } public List querySpinfo(String spid) throws SQLException{ String sql = "select spname,vacproductid from tb_sp_info where spid = ?"; List hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql,spid); return hashMaps; } public List queryChannel2(String channel) throws SQLException{ String sql = "select SUBCHANNELNAME,CHANNELTYPE from TB_CHANNEL_ORG_BOYUAN where SUBCHANNELCODE = ?"; List hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql,channel); return hashMaps; } public List queryChannel(String channel) throws SQLException{ String sql = "select name,belong_to belongto from TB_CHANNEL_ORG where id = ?"; List hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql,channel); return hashMaps; } // public void insertBeans(DeveuploadBean bean) throws SQLException { // String sql = "insert into TD_order_deveupload_log (id,channel,userid,busiunit,province,area,prodname,prodprmid,prodnoprmid,ordertime,orderchannelid,orderchannelname,orderchannelkind) values" + // "(to_char(sysdate,'yyyymmddHH24MISS')||SEQ_COMMON6.NEXTVAL,#{channel},#{userid},#{busiunit},#{province},#{area},#{prodname},#{prodprmid},to_date(#{ordertime},'yyyy/mm/dd hh24:mi:ss'),#{orderchannelid},#{orderchannelname},#{orderchannelkind})"; // SQLExecutor.insertBean(DataSource.NET3G, sql, bean); // } public void insertBeans(DeveuploadBean bean) throws SQLException { String sql = "insert into TD_order_deveupload_log (id,channel,userid,busiunit,province,area,prodname,prodprmid,prodnoprmid,ordertime,orderchannelid,orderchannelname,orderchannelkind) values" + "(to_char(sysdate,'yyyymmddHH24MISS')||SEQ_COMMON6.NEXTVAL,?,?,?,?,?,?,?,?,to_date(?,'yyyy/mm/dd hh24:mi:ss'),?,?,?)"; SQLExecutor.insertWithDBName(DataSource.NET3G, sql, bean.getChannel(), bean.getUserid(), bean.getBusiunit(), bean.getProvince(), bean.getArea(), bean.getProdname(), bean.getProdprmid(), bean.getProdnoprmid(), bean.getOrdertime(), bean.getOrderchannelid(), bean.getOrderchannelname(), bean.getOrderchannelkind()); } public void updata(String id,String resultcode,String resultinfo,int insertcount) throws SQLException { String sql = "update TD_ORDER_DEVEUPLOAD_WAIT set resultcode = ?,resultinfo = ?,insertcount = ?,updatetime = sysdate where id = ?"; SQLExecutor.updateWithDBName(DataSource.NET3G, sql,resultcode,resultinfo,insertcount,id); } }