• 調用Controller裡的函數PaymentUpdateD、/PaymentUpdate


    ////////////////////調用Controller裡的函數PaymentUpdateD、/PaymentUpdate

    $.post("<%=request.getContextPath()%>/Payment/PaymentUpdateD",{code:code});
    $.post("<%=request.getContextPath()%>/Payment/PaymentUpdate", $('#myform').serialize() ,function(tx){

    if(tx=="success"){
    /* parent.$.messager.alert('提示','添加成功'); */
    // alert('提示','添加成功');

    parent.$.messager.show({
    title : '提示',
    msg : '修改成功'
    });

    /* parent.$('#dialog').dialog('close'); */
    parent.$('#dg').datagrid('reload');

    }
    });

    //////////////////////Controller裡的函數

    @RequestMapping(value="Payment/PaymentUpdateD")
    public void Delete1(HttpServletRequest request,HttpServletResponse response,HttpSession session,Payment payment,
    @RequestParam(required=false,value="code") String code) throws IOException{
    if(null!=code){
    PaySService.deleteAll(code);
    }
    }


    @RequestMapping(value="Payment/PaymentUpdate")
    public void Update(HttpServletRequest request,HttpServletResponse response,HttpSession session,Payment payment,
    @RequestParam(required=false,value="code") String code,
    @RequestParam(required=false,value="includes") String includes,
    @RequestParam(required=false,value="Select") String Select,
    @RequestParam(required=false,value="stime") String stime,
    @RequestParam(required=false,value="etime") String etime,
    @RequestParam(required=false,value="outlet") String outlet) throws IOException{


    /*if(null!=PaySService.getPayS(code)){
    Delete1(code);

    }*/
    DateFormat sdf = new SimpleDateFormat("HH:mm:ss");
    Date stimee = null;
    try {
    stimee = sdf.parse(stime);

    } catch (ParseException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    DateFormat sdf1 = new SimpleDateFormat("HH:mm:ss");
    Date etimee = null;
    try {

    etimee = sdf1.parse(etime);
    } catch (ParseException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    String canSelect=null;
    if(null==Select){
    canSelect="FALSE";
    }else {
    canSelect="TRUE";
    }
    String include=null;
    if(null==includes){
    include="FALSE";
    }else {
    include="TRUE";
    outlet=null;
    }

    payment.setStarttime(stimee);
    payment.setEndtime(etimee);
    payment.setOutline("6");
    payment.setUpdatedBy("0000001");
    payment.setCanSelect(canSelect);
    payment.setInclude(include);
    String result="failed";
    if(null!=payment){
    paymentService.Update(payment);
    if(null!=outlet){
    String[] outlets = outlet.split(",");
    for(int i=0;i<outlets.length;i++){
    PayS payS=new PayS();
    payS.setOutlet(outlets[i]);
    payS.setPaytype(code);
    payS.setOutline("6");
    payS.setUpdatedBy("0000001");
    PaySService.Save(payS);
    }
    result="success";
    }else{
    result = "success";
    }

    }
    response.setHeader("Content-type", "text/html;charset=UTF-8");
    // 如果是默認繁體中文查看,則設置為UTF-8
    response.setCharacterEncoding("UTF-8");
    response.getWriter().write(result);
    }

  • 相关阅读:
    springboot整合shiro
    四大作用域:application,session,request,page
    Application作用域实现:当用户重复登录时,挤掉原来的用户
    从Linux下载大于4G文件到本地,并且在本地合并
    idea+maven+springboot+mybatis
    Spring 3.0 中一般 普通类调用service
    java微信扫码支付Native(模式二)
    阿里云不支持stmp 的25端口,必须
    python写入文本报错TypeError: expected a string or other character buffer object
    mysql找到数据的存储位置
  • 原文地址:https://www.cnblogs.com/OP-RONG/p/4221110.html
Copyright © 2020-2023  润新知