servlet里面拿到common.property的属性
---------------------common.property文件-----------------------
kongxc_wx_dinghuo_orderSendMusic=http://music.163.com/#/song?id=27867140
--------------------servlet-------------------------
import java.util.Properties;
public class WeiXinNotify extends HttpServlet{
protected Logger logger = LoggerFactory.getLogger(getClass());
private SystemLogManager logManager;
private CoursesOrdersManager coursesOrdersManager;
private CoursesOrdersDetailsManager coursesOrdersDetailsManager;
private MemberBaseInfoManager memberBaseInfoManager;
private SchoolManager schoolManager;
private MealTimeManager mealTimeManager;
private static InputStream kongxc_orderSend_musicStream;
private Properties props = new Properties();
private static String kongxc_wx_diancan_orderServlet;
@Override
public void init() throws ServletException {
super.init();
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
logManager = wac.getBean("systemLogManager", SystemLogManager.class);
coursesOrdersManager = (CoursesOrdersManager) wac.getBean("coursesOrdersManager", CoursesOrdersManager.class);
coursesOrdersDetailsManager = (CoursesOrdersDetailsManager) wac.getBean("coursesOrdersDetailsManager", CoursesOrdersDetailsManager.class);
memberBaseInfoManager = (MemberBaseInfoManager) wac.getBean("memberBaseInfoManager", MemberBaseInfoManager.class);
schoolManager = (SchoolManager) wac.getBean("schoolManager", SchoolManager.class);
mealTimeManager = (MealTimeManager) wac.getBean("mealTimeManager", MealTimeManager.class);
try {
kongxc_orderSend_musicStream = wac.getResource("/WEB-INF/conf/common.properties").getInputStream();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
System.out.println("-------开始------");
BufferedReader br = new BufferedReader(new InputStreamReader(req.getInputStream(),"UTF-8"));
String line="";
StringBuffer buffer = new StringBuffer(1024);
while((line=br.readLine())!=null){
buffer.append(line);
}
String reXml=URLDecoder.decode(buffer.toString(), "utf-8");
System.out.println("-----------支付成功----------"+reXml);
try {
Map<String, Object> map = XMLParser.getMapFromXML(reXml);
String return_code = (String) map.get("return_code");
if (return_code.equalsIgnoreCase("SUCCESS")) {
String out_trade_no = (String) map.get("out_trade_no");
CoursesOrders orders = coursesOrdersManager.findByProperty("orderCode", out_trade_no);
if (orders!=null && orders.getStatus().equals(CoursesOrderStatus.WZF)) {
orders.setIsDelete("0");
orders.setPayTime(Calendar.getInstance());
orders.setStatus(CoursesOrderStatus.YZF);
coursesOrdersManager.updateStatus(orders);
MemberBaseInfo memberBaseInfo = memberBaseInfoManager.findById(orders.getMemberId());
CoursesOrdersDetailsModel detailModel = new CoursesOrdersDetailsModel();
detailModel.setOrderId(orders.getId());
detailModel.setIsEffective(false);
detailModel.setCreator(orders.getMemberId());
System.out.println("detailModel---------"+detailModel);
List<CoursesOrdersDetails> detailList = coursesOrdersDetailsManager.queryList(detailModel);
System.out.println("detailList==========="+detailList);
String str ="";
for (CoursesOrdersDetails cod : detailList) {
cod.setOrderId(orders);
cod.setIsEffective(true);
cod.setLastChanged(Calendar.getInstance());
coursesOrdersDetailsManager.update(cod);
MealTimeModel mealTimeModel =new MealTimeModel();
mealTimeModel.setCode(cod.getMealcode());
mealTimeModel.setMealType(cod.getLb());
System.out.println("mealTimeModel-----------"+mealTimeModel);
List<MealTime> mealTimeList = mealTimeManager.listQuList(mealTimeModel);
System.out.println("mealTimeList ---------------" +mealTimeList);
if(mealTimeList != null && mealTimeList.size()>0){
cod.setQucanStartTime(TimeTools.calendar2String(mealTimeList.get(0).getqCstartTime(), "HH:mm:ss"));
cod.setQucanEndTime(TimeTools.calendar2String(mealTimeList.get(0).getqCendTime(), "HH:mm:ss"));
}
str += cod.getCourseId().getNameCh() + ",";
}
System.out.println("detailList----------detailList------------"+detailList);
String detailListStr= str.substring(0,str.length()-1);
//订单详情推送
System.out.println("+++++++++++++");
//获取access_token
String requestUrl = Configure.requestUrl.replace("APPID", Configure.appID);
requestUrl = requestUrl.replace("APPSECRET", Configure.appsecret);
// JSONObject jsonObject = NetTools.httpsRequest(requestUrl, "GET", null);
// System.out.println("jsonObject--------"+jsonObject);
// System.out.println("jsonObject--------"+jsonObject);
// System.out.println("jsonObject--------"+jsonObject);
// String access_token = (String) jsonObject.get("access_token");
String access_token = AccessTokenInfo.accessToken.getAccessToken();
System.out.println("accessToken---------"+access_token);
OrderSend orderSend =new OrderSend();
System.out.println("access_token----------------"+access_token);
System.out.println("memberBaseInfo----------------"+memberBaseInfo);
System.out.println("orders----------------"+orders);
System.out.println("detailList----------------"+detailList);
props.load(kongxc_orderSend_musicStream);
System.out.println("kongxc_diancanUrl_urlStream-----------------"+kongxc_orderSend_musicStream);
kongxc_wx_diancan_orderServlet= props.getProperty("kongxc_wx_diancan_orderServlet");
System.out.println("kongxc_wx_diancan_orderServlet-----"+kongxc_wx_diancan_orderServlet);
System.out.println("kongxc_wx_diancan_orderServlet-----"+kongxc_wx_diancan_orderServlet);
System.out.println("kongxc_wx_diancan_orderServlet-----"+kongxc_wx_diancan_orderServlet);
kongxc_wx_diancan_orderServlet += "?openid="+memberBaseInfo.getOpenid();
String orderSendServlet = Configure.orderSendServlet + "?openid="+memberBaseInfo.getOpenid();
System.out.println("2222-----kongxc_wx_diancan_orderServlet-----"+orderSendServlet);
orderSend.zhiFuMethod(access_token,memberBaseInfo,orders,detailList,detailListStr,orderSendServlet);
System.out.println("-------操作成功--------------");
resp.getWriter().print("<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>");
}
}
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (ManagerException e) {
e.printStackTrace();
}
}
@Override
public void destroy() {
super.destroy();
}
}
servlet里面拿到common.property的属性的更多相关文章
- [转]iOS开发中@property的属性weak nonatomic strong readonly等介绍
转载地址: http://www.lvtao.net/ios/504.html @property与@synthesize是成对出现的,可以自动生成某个类成员变量的存取方法.在Xcode4.5以及以后 ...
- 内存管理和@property的属性
内存管理和@property的属性 目录 对内存管理的理解 Objective C内存管理方式 内存的管理 对象的所有权和内存管理原则 合理解决内存管理带来的问题 自动释放池 @property的属性 ...
- spring 的配置 bean>>property>>name属性
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- iOS开发中@property的属性weak nonatomic strong readonly等介绍
@property与@synthesize是成对出现的,可以自动生成某个类成员变量的存取方法.在Xcode4.5以及以后的版本,@synthesize可以省略. 1.atomic与nonatomica ...
- python对象属性管理(2):property管理属性
使用Property管理属性 python提供了一种友好的getter.setter.deleter类方法的属性管理工具:property. property()是一个内置函数,它返回一个Proper ...
- IOS中@property的属性weak、nonatomic、strong、readonly等介绍
iOS开发中@property的属性weak nonatomic strong readonly等介绍 //property:属性://synthesize:综合; @property与@synthe ...
- Servlet 2.5为cookie配置HTTPOnly属性
cookie的HTTPOnly属性,主要是用来防止JavaScript来读取cookie,默认情况下,JavaScript可以通过document.cookie来读取cookie,这样是很不安全的.通 ...
- 从0开始学Java——eclipse下运行servlet程序警告:Setting property 'source' to 'org.eclipse.jst.jee.server:类名' did not find a matching property.
在使用Eclipse 创建第一个 Servlet之后,并且配置好了tomcat,然后Run on server的之后,提示标题所示错误: 警告: [SetContextPropertiesRule]{ ...
- iOS开发基础之ivars(实例变量)与@property(属性)
Objective-C带来了一个重大改进就是Non-fragile ivar.使得i一个类可以随意增加实例变量,不必对子类重新编译.对框架开发者(如苹果)有重大意义. 最新的编译器支持@propert ...
随机推荐
- Swing的GUI组件得到焦点
Swing的GUI组件如JButtin,JTextArea,JRadioButton,JComboBox等,可以使用requestFocus()方法来获得焦点.
- java调用机器上的shell脚本
java调用机器上的shell脚本,可以这样方便的通过shell脚本调用本机的C.C++等程序 Process process = null; Runtime runTime = Runtime.ge ...
- 正则表达式匹配a标签或div标签
这里以a标签为例 a标签的href var a='<P><A href=\'~abc/ccg/ab.jpg\' width="3">文字</A> ...
- angular 禁止事件冒泡 和 默认行为
事件冒泡和事件捕捉一直以来都是被讨论的话题,也许大家平时在工作中没有遇到过需要解决事件冒泡的情况举个例子: <body ng-click="fun1()"> <d ...
- Ubuntu编码问题
Ubuntu编码问题 root@magus-18:/srv/rorapps/fgcc# rails -v Sorry, command-not-found has crashed! Please fi ...
- Android源码-SignApk.java
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Versi ...
- 【Linux】监控系统的状态
1.w命令 w命令是一个很强大的命令,该命令显示的信息比较丰富.以下是我的虚拟机w命令的一个展示 从上图我们可以看到: 第一行从左面开始显示的信息依次为:时间.系统运行时间.登陆用户数.平均负载 第二 ...
- Docker背后的内核知识——cgroups资源限制(转)
时间 2015-04-20 21:10:00 InfoQ 原文 http://www.infoq.com/cn/articles/docker-kernel-knowledge-cgroups-re ...
- struts过滤器的原理
struts就是充当拦截器(过滤器)的作用.在web.xml配置过滤器, package cn.itcast.framework.core; import java.io.IOException; i ...
- PT100三线制恒流源接法
http://www.eepw.com.cn/article/189480_2.htm 下图为恒流源激励的三线制Pt100的一种典型接法.其基本原理是假设Pt100的三条引线采用相同长度的同型线缆,具 ...