无为清净楼资源网 Design By www.qnjia.com
需要加入:com.springsource.org.apache.commons.logging-1.1.1.jar、org.json.jar和jquery-1.10.0.min.js包
<form class="form-inline"> 扫码: <input id="txtQRCode" type="text"> <button id="btnReceive">确定</button> </form> <script type="text/javascript"> //扫描二维码 $('#btnReceive').click(function(){ $.ajax({ type:"GET", url:"<%=basePath%>asynchronous/receive.do", data:{qrCode:$('#txtQRCode').val()}, dataType:"json", cache:false, success:function(msg){ //var json = eval('('+msg+')');//拼接的json串 var flag = msg.flag; var info = msg.info; if(flag){ alert(info); $('#txtQRCode').val(""); } else{ alert(info); } }, error:function(error){alert(error);} }); }); }); </script> package com.utcsoft.pcapps.selfservice.controller; import java.io.IOException; import java.io.PrintWriter; import java.net.UnknownHostException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.json.JSONException; import org.json.JSONObject; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.utcsoft.common.attributes.YesNoEnum; import com.utcsoft.common.util.DateOperate; import com.utcsoft.pcapps.selfservice.attributes.KeyRequestAttr; import com.utcsoft.pcapps.selfservice.dao.FlowDao; import com.utcsoft.pcapps.selfservice.dao.KeyRequestDao; import com.utcsoft.pcapps.selfservice.entity.Flow; import com.utcsoft.pcapps.selfservice.entity.KeyRequest; import com.utcsoft.pcapps.selfservice.entity.UtcUsers; @Controller @RequestMapping(value = "/asynchronous") public class AsynchronousController { private final static Log logger = LogFactory.getLog(AsynchronousController.class); /** * 扫描二维码 将订单改为UTC审核 * @param request * @param response * @throws IOException * @throws JSONException */ @RequestMapping(value="/receive") public void receive(HttpServletRequest request,HttpServletResponse response) throws IOException, JSONException{ String rets = ""; boolean b = false; try{ String qrcode = request.getParameter("qrCode")==null"":request.getParameter("qrCode").toString().trim(); logger.info(qrcode); if(!"".equals(qrcode)){ JSONObject obj = new JSONObject(qrcode); String orderid = obj.getString("orderid").trim(); if(!"".equals(orderid)){ KeyRequestDao keyDao = new KeyRequestDao(); KeyRequest k = new KeyRequest();//综合信息 k = keyDao.findOneByOrderId(orderid); if(k!=null){ //修改订单状态为审核 int n = keyDao.updateState(orderid, String.valueOf(KeyRequestAttr.KqStateEnum.verify.getStep())); Flow flow = new Flow(); FlowDao flowDao = new FlowDao(); UtcUsers users = (UtcUsers)request.getSession().getAttribute("utcUsers"); //将记录插入Flwo表中 flow.setKq_id(orderid); flow.setKq_state(String.valueOf(KeyRequestAttr.KqStateEnum.cus_send.getStep())); flow.setKq_state_to(String.valueOf(KeyRequestAttr.KqStateEnum.verify.getStep())); flow.setIs_Pass(YesNoEnum.Y.getCode()); flow.setUser_id(users.getUser_id()); flow.setUser_id_from(users.getUser_id()); flow.setOpTimer(DateOperate.getDateTime()); int flowNum = flowDao.save(flow); logger.info("扫描二维码提交结果:n="+n+";flowNum="+flowNum); if(n>0){ b = true; rets = "UTC接收订单成功"; logger.info("UTC接收订单成功"); } else{ rets = "UTC接收订单失败"; logger.info("UTC接收订单失败"); } } else{ rets = "订单查询失败"; logger.info("订单查询失败"); } } else{ rets = "二维码中订单号为空"; logger.error("二维码中订单号为空"); } } else{ rets = "二维码内容为空"; logger.error("二维码内容为空"); } } catch(Exception e){ e.printStackTrace(); rets = e.getMessage(); logger.error(e.getMessage()); } JSONObject ret = new JSONObject(); ret.put("flag", b); ret.put("info", rets); PrintWriter write = response.getWriter(); write.write(ret.toString()); write.flush(); } }
标签:
json格式,Ajax提交
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年11月15日
2024年11月15日
- 谭咏麟《20世纪中华歌坛名人百集珍藏版》[WAV+CUE][1G]
- 炉石传说40轮盘术最新卡组代码在哪找 标准40轮盘术卡组代码分享
- 炉石传说亲王贼怎么玩 2024亲王贼最新卡组代码分享
- 炉石传说30.6.2补丁后有什么卡组 30.6.2最强卡组最新推荐
- 模拟之声慢刻CD《蔡琴名曲回顾遇听》[原抓WAV+CUE]
- BruceLiu-WAVES(MusicbySatie)(2024)2CD[24Bit-96kHz]FLAC
- KonstantinKrimmel-MythosSchubertLoewe(2024)[24Bit-96kHz]FLAC
- 2024雷蛇高校挑战赛 嘤式分解助力收官之战
- 海信发布110吋世俱杯官方定制AI电视 引领智能观赛
- 海信发布27英寸显示器大圣G5 Pro:采用自研超解析芯片、友达原厂模组
- 蔡琴《机遇》1:1母盘直刻日本头版[WAV分轨][1.1G]
- 陈百强《与你几分钟的约会》XRCD+SHMCD限量编号版[低速原抓WAV+CUE][994M]
- 陈洁丽《监听王NO.1 》示范级发烧天碟[WAV+分轨][1.1G]
- 单色凌.2014-小岁月太着急【海蝶】【WAV+CUE】
- 陈淑桦.1988-抱紧我HOLD.ME.NOW【EMI百代】【WAV+CUE】