5da156974c321d5d6556458e9484db1ad86a1662.svn-base 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package com.chinacreator.process.dao;
  2. import com.chinacreator.process.bean.BackShareOrderBean;
  3. import com.chinacreator.process.bean.DeveuploadBean;
  4. import com.chinacreator.process.bean.OrderBean;
  5. import com.chinacreator.process.util.DataSource;
  6. import com.frameworkset.common.poolman.SQLExecutor;
  7. import org.springframework.stereotype.Component;
  8. import java.sql.SQLException;
  9. import java.util.HashMap;
  10. import java.util.List;
  11. @Component
  12. public class DeveuploadDao {
  13. public List<HashMap> queryList() throws SQLException {
  14. 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";
  15. List<HashMap> hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql);
  16. return hashMaps;
  17. }
  18. public void updataQueryList(String id,String resultcode) throws SQLException {
  19. String sql = "update TD_ORDER_DEVEUPLOAD_WAIT set resultcode = ?,updatetime = sysdate where id = ?";
  20. SQLExecutor.updateWithDBName(DataSource.NET3G, sql,resultcode,id);
  21. }
  22. /**
  23. * 更新执行状态为2且时间超过10分钟的数据为待处理
  24. * @return
  25. */
  26. public int updExecTimeout(){
  27. int res = 0;
  28. String sql = "update TD_ORDER_DEVEUPLOAD_WAIT set resultcode = '1' where resultcode = '2' and updatetime < sysdate-1/24/6";
  29. try {
  30. Object obj = SQLExecutor.updateWithDBName(DataSource.NET3G, sql, null);
  31. res = (Integer)obj;
  32. } catch (SQLException e) {
  33. e.printStackTrace();
  34. }
  35. return res;
  36. }
  37. public List<HashMap> querySpinfo(String spid) throws SQLException{
  38. String sql = "select spname,vacproductid from tb_sp_info where spid = ?";
  39. List<HashMap> hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql,spid);
  40. return hashMaps;
  41. }
  42. public List<HashMap> queryChannel2(String channel) throws SQLException{
  43. String sql = "select SUBCHANNELNAME,CHANNELTYPE from TB_CHANNEL_ORG_BOYUAN where SUBCHANNELCODE = ?";
  44. List<HashMap> hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql,channel);
  45. return hashMaps;
  46. }
  47. public List<HashMap> queryChannel(String channel) throws SQLException{
  48. String sql = "select name,belong_to belongto from TB_CHANNEL_ORG where id = ?";
  49. List<HashMap> hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql,channel);
  50. return hashMaps;
  51. }
  52. // public void insertBeans(DeveuploadBean bean) throws SQLException {
  53. // String sql = "insert into TD_order_deveupload_log (id,channel,userid,busiunit,province,area,prodname,prodprmid,prodnoprmid,ordertime,orderchannelid,orderchannelname,orderchannelkind) values" +
  54. // "(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})";
  55. // SQLExecutor.insertBean(DataSource.NET3G, sql, bean);
  56. // }
  57. public void insertBeans(DeveuploadBean bean) throws SQLException {
  58. String sql = "insert into TD_order_deveupload_log (id,channel,userid,busiunit,province,area,prodname,prodprmid,prodnoprmid,ordertime,orderchannelid,orderchannelname,orderchannelkind) values" +
  59. "(to_char(sysdate,'yyyymmddHH24MISS')||SEQ_COMMON6.NEXTVAL,?,?,?,?,?,?,?,?,to_date(?,'yyyy/mm/dd hh24:mi:ss'),?,?,?)";
  60. SQLExecutor.insertWithDBName(DataSource.NET3G, sql,
  61. bean.getChannel(),
  62. bean.getUserid(),
  63. bean.getBusiunit(),
  64. bean.getProvince(),
  65. bean.getArea(),
  66. bean.getProdname(),
  67. bean.getProdprmid(),
  68. bean.getProdnoprmid(),
  69. bean.getOrdertime(),
  70. bean.getOrderchannelid(),
  71. bean.getOrderchannelname(),
  72. bean.getOrderchannelkind());
  73. }
  74. public void updata(String id,String resultcode,String resultinfo,int insertcount) throws SQLException {
  75. String sql = "update TD_ORDER_DEVEUPLOAD_WAIT set resultcode = ?,resultinfo = ?,insertcount = ?,updatetime = sysdate where id = ?";
  76. SQLExecutor.updateWithDBName(DataSource.NET3G, sql,resultcode,resultinfo,insertcount,id);
  77. }
  78. }