f879b05adb9635b724c8fe3274d8096b2d44b07f.svn-base 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package com.chinacreator.process.job;
  2. import java.util.HashMap;
  3. import java.util.List;
  4. import java.util.Map;
  5. import org.apache.commons.lang.StringUtils;
  6. import org.apache.log4j.Logger;
  7. import org.quartz.DisallowConcurrentExecution;
  8. import org.quartz.PersistJobDataAfterExecution;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import com.chinacreator.common.util.URLUtil;
  11. import com.chinacreator.process.dao.DictionaryDao;
  12. import com.chinacreator.video.queue.MessageService;
  13. import com.chinacreator.video.queue.bean.MessagePipe;
  14. @PersistJobDataAfterExecution
  15. @DisallowConcurrentExecution
  16. public class HnSmsJob {
  17. private static Map<String,String> spMap = new HashMap<String, String>();
  18. @Autowired
  19. private DictionaryDao dictionaryDao;
  20. @Autowired
  21. private MessageService messageService;
  22. static{
  23. spMap.put("51", "斗牛直播定向流量包月(原WO+直播定向流量包月)");
  24. spMap.put("11", "WO+视频PPTV定向流量包月");
  25. spMap.put("6", "WO+视频腾讯定向流量包月");
  26. spMap.put("99119423", "WO+视频腾讯定向流量首免包月");
  27. spMap.put("1", "WO+视频搜狐定向流量包月");
  28. spMap.put("960", "WO+视频搜狐定向流量VIP包月");
  29. spMap.put("20", "WO+新视界包月");
  30. spMap.put("21132", "WO+乐视vip联通包月");
  31. spMap.put("43", "务工亲情卡WO+视频服务腾讯视频定向流量包月");
  32. spMap.put("42", "务工亲情卡WO+视频服务PPTV视频定向流量包月");
  33. spMap.put("74", "青年市场WO+视频三合一定向流量包月");
  34. spMap.put("21156", "优土联通包月");
  35. spMap.put("21160", "优土vip联通包月");
  36. spMap.put("21195", "WO+视频优酷特惠包");
  37. }
  38. private Logger log = Logger.getLogger("hnsmslog");
  39. public void doProcess() throws Exception {
  40. log.debug("海南短信发送");
  41. if(dictionaryDao.getValue("recivemq").equals("0")){
  42. List<MessagePipe> list = messageService
  43. .reciveBatchMessage("hnSmsSend", 500);
  44. for (MessagePipe messagePipe : list) {
  45. String result = "2";
  46. Map<String,Object> map = messagePipe.getBody();
  47. String userid = (String)map.get("userid");
  48. String spid = (String)map.get("spid");
  49. String cpid = (String)map.get("cpid");
  50. String status = (String)map.get("status");
  51. try{
  52. if(!StringUtils.isEmpty(spMap.get(spid))){
  53. String content = "";
  54. if(status.equals("0")){
  55. content = "尊敬的用户,您好!您订购的"+spMap.get(spid)+"产品已经在合作方平台生效,请下载最新手机客户端,登录个人中心仔细阅读相关介绍后激活使用";
  56. }else{
  57. content = "尊敬的用户,您好!您发起"+spMap.get(spid)+"产品退订,已经在合作方平台退订成功";
  58. }
  59. result = URLUtil.get("http://111.206.135.40:8080/sms-platform/sms?mob="+userid+"&content="+content, 10000);
  60. }
  61. }catch(Exception e){
  62. e.printStackTrace();
  63. }finally{
  64. log.info("{userid:"+userid+",cpid:"+cpid+",spid:"+spid+",status:"+status+",result:"+result+"}");
  65. }
  66. }
  67. }else{
  68. log.debug("海南短信发送队列停止接受");
  69. }
  70. }
  71. public static void main(String[] args) {
  72. Map<String,String> spMap = new HashMap<String, String>();
  73. spMap.put("51", "斗牛直播定向流量包月(原WO+直播定向流量包月)");
  74. spMap.put("11", "WO+视频PPTV定向流量包月");
  75. spMap.put("6", "WO+视频腾讯定向流量包月");
  76. spMap.put("99119423", "WO+视频腾讯定向流量首免包月");
  77. spMap.put("1", "WO+视频搜狐定向流量包月");
  78. spMap.put("960", "WO+视频搜狐定向流量VIP包月");
  79. spMap.put("20", "WO+新视界包月");
  80. spMap.put("21132", "WO+乐视vip联通包月");
  81. spMap.put("43", "务工亲情卡WO+视频服务腾讯视频定向流量包月");
  82. spMap.put("42", "务工亲情卡WO+视频服务PPTV视频定向流量包月");
  83. spMap.put("74", "青年市场WO+视频三合一定向流量包月");
  84. spMap.put("21156", "优土联通包月");
  85. spMap.put("21160", "优土vip联通包月");
  86. spMap.put("21195", "WO+视频优酷特惠包");
  87. System.out.println(spMap.get("1"));
  88. }
  89. }