090558517e669283e84759f958bb03b92187f31f.svn-base 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package com.chinacreator.process.dao;
  2. import java.sql.SQLException;
  3. import java.util.List;
  4. import org.springframework.stereotype.Component;
  5. import com.chinacreator.process.bean.OrderBean;
  6. import com.chinacreator.process.util.DataSource;
  7. import com.frameworkset.common.poolman.SQLExecutor;
  8. @Component
  9. public class ActiveHandleDao {
  10. public OrderBean existUser(String userid,String cpid,String spid,String activetype) throws SQLException{
  11. String sql = "select userid,cpid,spid,orderstatus ordertype,id,to_char(ordertime,'yyyymmddhh24miss') updatetime,usertype,to_char(oldcanceltime,'yyyymmddhh24miss') oldcanceltime,orderchannel channel,ischarge, "
  12. + "to_char(endtime,'yyyymm') endtime,activetype,vipstatus from TD_BUSSINESS_HANDLE where userid = ? and cpid = ? and spid = ? and activetype=? and fhcpid is null and fhspid is null";
  13. return SQLExecutor.queryObjectWithDBName(OrderBean.class, DataSource.NET3G, sql, userid,cpid,spid,activetype);
  14. }
  15. public List<OrderBean> existUserBestv(String userid,String cpid,String spid) throws SQLException{
  16. String sql = "select userid,cpid,spid,orderstatus ordertype,id,to_char(ordertime,'yyyymmddhh24miss') updatetime,usertype,to_char(oldcanceltime,'yyyymmddhh24miss') oldcanceltime,orderchannel channel,ischarge, "
  17. + "to_char(endtime,'yyyymmddhh24miss') endtime,activetype,vipstatus from TD_BUSSINESS_HANDLE where userid = ? and cpid = ? and spid = ? and fhcpid is null and fhspid is null";
  18. return SQLExecutor.queryListWithDBName(OrderBean.class, DataSource.NET3G, sql, userid,cpid,spid);
  19. }
  20. public void insertBeans(OrderBean bean) throws SQLException{
  21. String sql = "insert into TD_BUSSINESS_HANDLE(id,userid,cpid,spid,province,area,ordertime,activitystatus,orderchannel,"
  22. + "orderstatus,inserttime,endtime,activitytime,ischarge,effectivetime,flowstatus,activetype,vipstatus) values(to_char(sysdate,'yyyyMMddhh24miss')||SEQ_COMMON6.nextval,#[userid],#[cpid],#[spid],#[province],"
  23. + "#[area],to_date(#[updateTime],'yyyymmddhh24miss'),0,#[channel],0,sysdate,#if($endtime && !$endtime.equals(\"\")) to_date(#[endtime], 'yyyymmddhh24miss') #else '' #end,"
  24. + "sysdate,'2',to_date(#[updateTime],'yyyymmddhh24miss'),#[flowstatus],#[activeType],#[vipstatus])";
  25. SQLExecutor.insertBean(DataSource.NET3G, sql, bean);
  26. }
  27. public void UpdateRelations(OrderBean bean) throws SQLException{
  28. String sql = "update TD_BUSSINESS_HANDLE set canceltime='', ordertime=to_date(#[updateTime],'yyyymmddhh24miss'),"
  29. + "endtime=to_date('20171130235959','yyyymmddhh24miss'),orderstatus=0,effectivetime=to_date(#[updateTime],'yyyymmddhh24miss'),orderchannel=#[channel] where id=#[id]";
  30. SQLExecutor.updateBean(DataSource.NET3G, sql, bean);
  31. }
  32. public void UpdateRelationsBestv(OrderBean bean) throws SQLException{
  33. String sql = "update TD_BUSSINESS_HANDLE set canceltime='', ordertime=to_date(#[updateTime],'yyyymmddhh24miss'),"
  34. + "endtime='',orderstatus=0,effectivetime=to_date(#[updateTime],'yyyymmddhh24miss'),orderchannel=#[channel],vipstatus=#[vipstatus] where id=#[id]";
  35. SQLExecutor.updateBean(DataSource.NET3G, sql, bean);
  36. }
  37. public void cancelOrder(OrderBean bean) throws SQLException{
  38. String sql = "update TD_BUSSINESS_HANDLE set canceltime = to_date(#[updateTime],'yyyymmddhh24miss'),endtime = decode(sign(to_date(#[updateTime],'yyyymmddhh24miss')-endtime),1,endtime,last_day(trunc(to_date(#[updateTime],'yyyymmddhh24miss')))+1-1/(24*60*60)),cancelchannel= #[channel],"
  39. + "orderstatus = 1 where id = #[id]";
  40. SQLExecutor.updateBean(DataSource.NET3G, sql,bean);
  41. }
  42. public void cancelOrderBestv(OrderBean bean) throws SQLException{
  43. String sql = "update TD_BUSSINESS_HANDLE set canceltime = to_date(#[updateTime],'yyyymmddhh24miss'),endtime = LAST_DAY (TRUNC (to_date(#[updateTime],'yyyymmddhh24miss')))+1-1/(24 * 60 * 60),cancelchannel= #[channel],"
  44. + "orderstatus = 1 where id = #[id]";
  45. SQLExecutor.updateBean(DataSource.NET3G, sql,bean);
  46. }
  47. public void updateChannel(String id,String channel) throws SQLException{
  48. String sql = "update TD_BUSSINESS_HANDLE set orderchannel = ? where id = ?";
  49. SQLExecutor.updateWithDBName(DataSource.NET3G, sql, channel,id);
  50. }
  51. public void updateCharge(String id) throws SQLException{
  52. String sql = "update TD_BUSSINESS_HANDLE set ISCHARGE = 2 where id = ?";
  53. SQLExecutor.updateWithDBName(DataSource.NET3G, sql,id);
  54. }
  55. }