8e9a68991ae63041759955bcffde9b2e4ff5a59e.svn-base 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. package com.chinacreator.process.dao;
  2. import com.chinacreator.process.bean.OrderLog;
  3. import com.chinacreator.process.bean.PointShopOrderBean;
  4. import com.chinacreator.process.util.DataSource;
  5. import com.frameworkset.common.poolman.PreparedDBUtil;
  6. import com.frameworkset.common.poolman.SQLExecutor;
  7. import org.apache.log4j.Logger;
  8. import org.springframework.stereotype.Component;
  9. import java.sql.SQLException;
  10. import java.util.HashMap;
  11. import java.util.List;
  12. @Component
  13. public class TaobDao {
  14. private Logger log = Logger.getLogger("taob");
  15. /**
  16. * 更新callBack状态
  17. *
  18. * @param id
  19. * @return
  20. * @throws SQLException
  21. */
  22. public void updParamsByCb(String rspParams, String id) throws SQLException {
  23. String sql = "UPDATE TD_TAOBAO_ACTIVITY_DATA SET CALLBACKRES = ?, CALLBACKTIMES = SYSDATE WHERE id = ?";
  24. Object obj = SQLExecutor.updateWithDBName(DataSource.NET3G, sql, rspParams, id);
  25. }
  26. /**
  27. * 根据orderId和orderNo查询订购信息
  28. *
  29. * @param id
  30. * @return
  31. * @throws SQLException
  32. */
  33. public PointShopOrderBean getOrderRec(String userid,String cpid,String spid) throws SQLException {
  34. String sql = "SELECT * FROM TD_ORDER_RELATIONS WHERE USERID = ? AND CPID=? AND SPID=?";
  35. return SQLExecutor.queryObjectWithDBName(PointShopOrderBean.class, DataSource.NET3G, sql, userid,cpid,spid);
  36. }
  37. /**
  38. * 获取状态
  39. *
  40. * @return
  41. * @throws SQLException
  42. */
  43. public String getBackVipstatus(String id) throws SQLException {
  44. String sql = "SELECT VIPSTATUS FROM TD_BACKBUSI_ORDER_REC WHERE ID = ? ";
  45. return SQLExecutor.queryObjectWithDBName(String.class, DataSource.NET3G, sql, id);
  46. }
  47. /**
  48. * 获取处理结果
  49. *
  50. * @param orderId
  51. * @return
  52. * @throws SQLException
  53. */
  54. public String getResultCode(String orderId) throws SQLException {
  55. String sql = "SELECT RESULTCODE FROM TD_POINTS_ORDER_REC WHERE ID = ? ";
  56. return SQLExecutor.queryObjectWithDBName(String.class, DataSource.NET3G, sql, orderId);
  57. }
  58. /**
  59. * 更新业务状态信息
  60. *
  61. * @param resultCode
  62. * @param resultInfo
  63. * @param id
  64. * @param tabname
  65. * @return
  66. * @throws SQLException
  67. */
  68. public boolean updBusiStatus(String resultCode, String resultInfo, String id, String tabname) throws SQLException {
  69. //赠送会员状态,0成功,1未赠送,2赠送中,3失败,4不赠送
  70. String sql = " UPDATE " + tabname + " SET RESULTCODE = ?, RESULTINFO = ? WHERE ID = ? ";
  71. Object obj = SQLExecutor.updateWithDBName(DataSource.NET3G, sql, resultCode, resultInfo, id);
  72. return ((Integer) obj) > 0 ? true : false;
  73. }
  74. /**
  75. * 获取业务配置信息
  76. *
  77. * @param cpid
  78. * @param spid
  79. * @return
  80. * @throws SQLException
  81. */
  82. public List<HashMap> getBackBusiConf(String cpid, String spid) throws SQLException {
  83. String sql = "SELECT * FROM TB_BACKBUSI_CONF WHERE STATUS = '0' AND CPID = ? AND SPID = ? ";
  84. return SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql, cpid, spid);
  85. }
  86. public static void main(String[] args) throws SQLException {
  87. TaobDao dao = new TaobDao();
  88. //System.out.println(dao.findSpInfo("1167"));
  89. //System.out.println(dao.getPwdByGoodsCode("pointshop130"));
  90. //System.out.println(dao.getOrderRec("201906211723268662899","d4078706-2ff3-4f1b-9aad-80436a294b22"));
  91. }
  92. /*******************************20210127淘宝异步处理开始*****************************/
  93. /**
  94. * 查询要异步的数据
  95. *
  96. * @param
  97. * @return
  98. */
  99. public List<HashMap> getAsynData() {
  100. //处理状态为1的数据(待处理)
  101. String sql = " SELECT * FROM (SELECT ID, USERID, ORDERID,CHANNEL, CPID, SPID, TYPE,resultcode FROM " +
  102. "TD_TAOBAO_ACTIVITY_DATA WHERE resultcode = '1' ORDER BY INSERTTIME) WHERE ROWNUM < 1000 ";
  103. PreparedDBUtil pdb = new PreparedDBUtil();
  104. try {
  105. pdb.preparedSelect(DataSource.NET3G, sql);
  106. return pdb.executePreparedForList(HashMap.class);
  107. } catch (Exception e) {
  108. e.printStackTrace();
  109. }
  110. return null;
  111. }
  112. /**
  113. * 更新业务处理状态
  114. *
  115. * @param reesultCode
  116. * @param resultInfo
  117. * @param id
  118. * @throws SQLException
  119. */
  120. public void updSendStatus(String reesultCode, String resultInfo, String id) throws SQLException {
  121. String sql = " UPDATE TD_TAOBAO_ACTIVITY_DATA SET RESULTCODE = ?, RESULTINFO = ? WHERE ID = ? ";
  122. Object obj = SQLExecutor.updateWithDBName(DataSource.NET3G, sql, reesultCode, resultInfo, id);
  123. }
  124. /**
  125. * 更新赠送会员状态
  126. *
  127. * @param bean
  128. * @param tabname
  129. * @return
  130. * @throws SQLException
  131. */
  132. public boolean upStatus(PointShopOrderBean bean) throws SQLException {
  133. //办理结果编码,0成功,1待处理,2处理中,其他为异常
  134. String sql = " UPDATE TD_TAOBAO_ACTIVITY_DATA SET resultcode = ? , RESULTINFO = ?, RETRYTIME = sysdate WHERE ID = ? ";
  135. Object obj = SQLExecutor.updateWithDBName(DataSource.NET3G, sql, bean.getResultCode(), bean.getResultInfo(), bean.getId());
  136. return ((Integer) obj) > 0 ? true : false;
  137. }
  138. public String getPwd(String cpid, String spid) throws SQLException {
  139. String sql = "SELECT NETPWD FROM TB_CP_ACCOUNT_CONFIG a, tb_sp_info b where a.cpid=b.cpid and b.cpid=? and b.spid=?";
  140. return SQLExecutor.queryObjectWithDBName(String.class, DataSource.NET3G, sql, cpid, spid);
  141. }
  142. /*******************************20210127淘宝异步处理结束*****************************/
  143. }