c437afdce27f57c5ef9b26c17818741337657f27.svn-base 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package com.chinacreator.process.dao;
  2. import com.chinacreator.process.util.DataSource;
  3. import com.frameworkset.common.poolman.SQLExecutor;
  4. import org.springframework.stereotype.Component;
  5. import java.sql.SQLException;
  6. import java.util.HashMap;
  7. import java.util.List;
  8. @Component
  9. public class HuaweiWalletOrderDao {
  10. public List<HashMap> queryList() throws SQLException {
  11. String sql = " select id,cpid,spid,channel,userid,token,type from td_huawei_order_rec where status = '3' order by ordertime";
  12. List<HashMap> hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql);
  13. return hashMaps;
  14. }
  15. public void updataQueryList(String id,String status) throws SQLException {
  16. String sql = "update td_huawei_order_rec set status = ? where id = ?";
  17. SQLExecutor.updateWithDBName(DataSource.NET3G, sql,status,id);
  18. }
  19. public String getPwd(String channel) throws SQLException {
  20. String sql = "select netpwd from tb_cp_account_config where cpid = ?";
  21. return SQLExecutor.queryFieldWithDBName("net3g", sql, new Object[]{channel});
  22. }
  23. public void updataQueryNotifydata(String id,String status,String result) throws SQLException {
  24. String sql = "update td_huawei_order_rec set status = ?,isnotify = '1',rechargetime = sysdate,result = ? where id = ?";
  25. SQLExecutor.updateWithDBName(DataSource.NET3G, sql,status,result,id);
  26. }
  27. public List<HashMap> queryNotifyList() throws SQLException {
  28. String sql = "select id,orderno,hwspid,to_char(ordertime,'yyyymmddhh24miss') ordertime,to_char(rechargetime,'yyyymmddhh24miss') rechargetime,status,userid,spid,productype,facevalue,notifyParam1,notifyParam2,notifyParam3,signtype,notifyurl,to_char(notifycount) notifycount from td_huawei_order_rec where isnotify = '1' or (isnotify <> '0' and isnotify <> '2' and notifycount < 5 order by rechargetime";
  29. List<HashMap> hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql);
  30. return hashMaps;
  31. }
  32. public void updataQueryNotifyList(String id,String isnotify) throws SQLException {
  33. String sql = "update td_huawei_order_rec set isnotify = ? where id = ?";
  34. SQLExecutor.updateWithDBName(DataSource.NET3G, sql,isnotify,id);
  35. }
  36. public void updataQueryNotifyList(String id,String isnotify,int notifycount,String returnCode,String returnDesc) throws SQLException {
  37. String sql = "update td_huawei_order_rec set isnotify = ?,notifycount = ?,returnCode = ?,returnDesc = ? where id = ?";
  38. SQLExecutor.updateWithDBName(DataSource.NET3G, sql,isnotify,notifycount,returnCode,returnDesc,id);
  39. }
  40. public String getValue(String name) throws SQLException {
  41. String sql = "select value from TB_DICTIONRY_INFO where name = ?";
  42. return SQLExecutor.queryFieldWithDBName("net3g", sql, new Object[]{name});
  43. }
  44. /**
  45. * 获取执行状态为0且时间超过10分钟的数据
  46. * @return
  47. */
  48. public List<HashMap> getQueryListlong() throws SQLException {
  49. String sql = " select id,spid,userid from td_huawei_order_rec where status = '0' and ordertime < sysdate-1/24/6";
  50. List<HashMap> hashMaps = SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql);
  51. return hashMaps;
  52. }
  53. public String queryOrder(String userid, String spid) throws SQLException {
  54. String sql = "select count(1) from td_order_relations where status = '0' and userid= ? and spid = ?";
  55. return SQLExecutor.queryFieldWithDBName("net3g", sql, new Object[]{userid,spid});
  56. }
  57. /**
  58. * 更新执行状态为2且时间超过10分钟的数据为待处理
  59. * @return
  60. */
  61. public int updExecTimeout(){
  62. int res = 0;
  63. String sql = "update td_huawei_order_rec set isnotify = '1' where isnotify = '2' and rechargetime < sysdate-1/24/6";
  64. try {
  65. Object obj = SQLExecutor.updateWithDBName(DataSource.NET3G, sql, null);
  66. res = (Integer)obj;
  67. } catch (SQLException e) {
  68. e.printStackTrace();
  69. }
  70. return res;
  71. }
  72. }