341a1aa367604fb51c009f974e08f8c5aacac81c.svn-base 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package com.chinacreator.videoalliance.order.service;
  2. import java.util.Date;
  3. import org.apache.commons.lang.math.NumberUtils;
  4. import org.apache.commons.lang.time.DateFormatUtils;
  5. import org.springframework.stereotype.Component;
  6. import com.chinacreator.videoalliance.order.bean.BussinessBean;
  7. import com.chinacreator.videoalliance.order.bean.WxcsBean;
  8. @Component
  9. public class WxcsService {
  10. public int checkVipConfig(WxcsBean wxcsBean,String discntFee) {
  11. if (!wxcsBean.getVipstatus().equals("0")
  12. || NumberUtils.toLong(DateFormatUtils.format(new Date(), "yyyyMMddHHmmss")) > NumberUtils.toLong(wxcsBean.getVipendtime())
  13. || NumberUtils.toLong(DateFormatUtils.format(new Date(), "yyyyMMddHHmmss")) < NumberUtils.toLong(wxcsBean
  14. .getVipstarttime())) {
  15. return 3;
  16. }
  17. if(NumberUtils.toInt(wxcsBean.getTotalvip()) <= getVipUseNum(wxcsBean.getCpid(), wxcsBean.getSpid())){
  18. return 4;
  19. }
  20. return 0;
  21. }
  22. public int checkVip(BussinessBean bussinessBean ){
  23. int vipstatus = 0;
  24. switch (Integer.valueOf(bussinessBean.getVipstatus())) {
  25. case 0:
  26. vipstatus = 1;
  27. break;
  28. case 1:
  29. vipstatus = 5;
  30. break;
  31. case 2:
  32. vipstatus = 0;
  33. break;
  34. }
  35. return vipstatus;
  36. }
  37. public int checkFlow(BussinessBean bussinessBean ){
  38. int flowstatus = Integer.valueOf(bussinessBean.getFlowstatus());
  39. switch (flowstatus) {
  40. case 1:
  41. if(bussinessBean.getPortstatus().equals("0")){
  42. flowstatus = 0;
  43. }else{
  44. flowstatus = 4;
  45. }
  46. break;
  47. case 2:
  48. flowstatus = 4;
  49. break;
  50. case 7:
  51. flowstatus = 1;
  52. break;
  53. case 3:
  54. flowstatus = 1;
  55. break;
  56. case 8:
  57. flowstatus = 2;
  58. break;
  59. }
  60. return flowstatus;
  61. }
  62. public int checkFlowConfig(WxcsBean wxcsBean,String discntFee) {
  63. if (!wxcsBean.getFlowstatus().equals("0")
  64. || NumberUtils.toLong(DateFormatUtils.format(new Date(), "yyyyMMddHHmmss")) > NumberUtils.toLong(wxcsBean.getFlowendtime())
  65. || NumberUtils.toLong(DateFormatUtils.format(new Date(), "yyyyMMddHHmmss")) < NumberUtils.toLong(wxcsBean
  66. .getFlowstarttime())) {
  67. return 3;
  68. }
  69. return 0;
  70. }
  71. public int getVipUseNum(String cpid,String spid){
  72. return 0;
  73. }
  74. }