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 ...
随机推荐
- [Android Pro] Notification的使用
Android 4.0以前: 1: 普通的notification private static final int NOTIFY_ID = 0; notificationManager = (Not ...
- Maven中的SNAPSHOT版本和正式版本理解
Maven中建立的依赖管理方式基本已成为Java语言依赖管理的事实标准,Maven的替代者Gradle也基本沿用了Maven的依赖管理机制.在Maven依赖管理中,唯一标识一个依赖项是由该依赖项的三个 ...
- idea中git从码云克隆项目到本地
1.首先需要在操作系统上安装Git分布式管理系统 此处自行百度............. 2.在Intellij IDEA中配置Git 打开Settings(File-->Settings) - ...
- win 2003 / IIS6 部署网站的时候,文件IO操作、删除项目文件, 会导致IIS重启,Session丢失问题
项目中经常需要打些日志(文件IO读写操作),已记录调试.错误等信息.比较方便的有log4net等开源项目. 问题描述: 最近用win 2003 / IIS6,部署了一个2.0 的网站,在操作文件的时候 ...
- v - bind
1. 用于处理html标签的动态属性,即动态赋值(动态地绑定一个或多个特性,或一个组件 prop 到表达式) 2. 官网API <!DOCTYPE html> <html lang= ...
- 使用Kotlin创建Android项目
如果你已经使用过Android Studio和Gradle,那么这一章会比较简单.我不会给出很多细节和截图,因为用户界面和细节可能会一直变化. 我们的应用是由一个简单的天气app组成,正如所使用的Go ...
- http keep-alive 解释
1.概念 keep-alive示例: keep-alive模式(又称持久连接.连接重用)时,keep-alive功能使客户端到服务器端的连接持续有效,当出现对服务器的后继请求时,keep-alive功 ...
- LoadRunner访问Mysql数据库(转)
这是很久以前编写的一个测试案例,那时是为了检查大量往Mysql数据库里插入数据,看一下数据库的性能如何?服务器是否会很快就被写满了. 前期的准备工作:Mysql 数据库搭建,LoadRunner,li ...
- Drupal显示白屏或500?
Drupal有时会显示白屏,或者500内部错误,这多半是由于PHP脚本什么地方有问题造成的.这个时候,可以先看看php.log里面有没有提示: [10-Oct-2013 15:55:26 Asia/S ...
- setjmp与longjmp
在C中有时我们会使用goto语句用于运行跳转,可是不能跨越函数 #include <stdio.h> void func2() { int num = 0; dst2: if (num & ...