123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- package com.chinacreator.process.job;
- import java.net.URLEncoder;
- import java.sql.SQLException;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import org.apache.log4j.Logger;
- import org.quartz.DisallowConcurrentExecution;
- import org.quartz.PersistJobDataAfterExecution;
- import org.springframework.beans.factory.annotation.Autowired;
- import com.chinacreator.common.util.URLUtil;
- import com.chinacreator.process.dao.AsynDao;
- import com.chinacreator.process.util.JsonUtil;
- @PersistJobDataAfterExecution
- @DisallowConcurrentExecution
- public class Tencent12NotifyJob {
- private static final String notifyurl = "http://10.199.99.142:8090/video-activity/notify";
- private static final String orderyurl = "http://10.199.99.142:8090/video-activity/notifyOrder";
- private static final String vipurl = "http://10.199.99.142:8090/video-activity/notifyVip";
- private static Logger log = Logger.getLogger("tenc12log");
- @Autowired
- private AsynDao asynDao;
- public void doProcess() throws Exception {
- try{
- order();
- }catch(Exception e){
- e.printStackTrace();
- }
- try{
- vip();
- }catch(Exception e){
- e.printStackTrace();
- }
- try{
- sync();
- }catch(Exception e){
- e.printStackTrace();
- }
- }
-
- public void order() throws SQLException{
- List<String> orderlist = asynDao.getOrderOrderid();
- Map<String,String> orderMap = new HashMap<String, String>();
- if(orderlist != null){
- for (String orderid : orderlist) {
- orderMap.put("action", "order");
- orderMap.put("orderid", orderid);
- String result = "";
- try{
- result = URLUtil.get(orderyurl+"?orderid="+orderid, 5000);
- }catch(Exception e){
- e.printStackTrace();
- result = e.getMessage();
- }finally {
- orderMap.put("result", result);
- log.info(JsonUtil.objectToJson(orderMap));
- }
- }
- }
- }
-
- public void vip() throws SQLException{
- List<String> orderlist = asynDao.getvipOrderid();
- Map<String,String> orderMap = new HashMap<String, String>();
- if(orderlist != null){
- for (String orderid : orderlist) {
- orderMap.put("action", "vip");
- orderMap.put("orderid", orderid);
- String result = "";
- try{
- result = URLUtil.get(vipurl+"?orderid="+orderid, 5000);
- }catch(Exception e){
- e.printStackTrace();
- result = e.getMessage();
- }finally {
- orderMap.put("result", result);
- log.info(JsonUtil.objectToJson(orderMap));
- }
- }
- }
- }
-
- public void sync() throws SQLException{
- List<String> orderlist = asynDao.getsyncOrderid();
- Map<String,String> orderMap = new HashMap<String, String>();
- if(orderlist != null){
- for (String orderid : orderlist) {
- orderMap.put("action", "sync");
- orderMap.put("orderid", orderid);
- String result = "";
- try{
- result = URLUtil.get(notifyurl+"?orderid="+orderid, 5000);
- }catch(Exception e){
- e.printStackTrace();
- result = e.getMessage();
- }finally {
- orderMap.put("result", result);
- log.info(JsonUtil.objectToJson(orderMap));
- }
- }
- }
- }
- }
|