如何学好java

如何学好java,其实很简单,只要用心体会,慢慢积累!
posts - 106, comments - 7, trackbacks - 0, articles - 3
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

改变状态

Posted on 2011-12-21 22:17 哈希 阅读(167) 评论(0)  编辑  收藏
public void changeStates(String states,String id){
  Map<String,String> parameter = new HashMap<String,String>();
  parameter.put("id", id);
  parameter.put("type", states);
  Map<String,Object> result = bankSettelService.updateStates(parameter);  
  this.printHtml(result.get("count"));
 }


/**
  * <p>修改结算表状态
  * @param parameter
  * @return
  */
 public Map<String,Object> updateStates(Map<String,String> parameter){
  Query query = this.getRepository().createQuery();
  Map<String,Object> result = new HashMap<String,Object>();
  List<Object> sqlParam = new ArrayList<Object>();
  StringBuilder sql = new StringBuilder();
  String[] arrParam = parameter.get("id").split(",");
  String paramIn = "'";//回购单编号
  String type = "";//回购单修改后状态
  int count = 0; //修改行数
  for(String param:arrParam){
   paramIn += param + "','";
  }
  paramIn = paramIn.substring(0,paramIn.length() - 2);
  
  //回购单状态
  if("1".equals(parameter.get("type"))){
   type = REPUR_SETTEL_STATUS03; //待付款
  } else if("2".equals(parameter.get("type"))){
   type = REPUR_SETTEL_STATUS06; //审批退回
  } else if("3".equals(parameter.get("type"))){
   type = REPUR_SETTEL_STATUS04; //作废
  } else if("4".equals(parameter.get("type"))){
   type = REPUR_SETTEL_STATUS05; //已付款
  }
  //修改状态
  if(!StringUtils.isEmpty(type)){
   Update update = new Update();
   //更新回购结算单状态  如果为已付款 同时要更新回购单状态为已付款
   if("4".equals(parameter.get("type"))){
    //更新回购结算单状态
    update.set("BUYBACKSTATEMENT_STATUS = '" + type + "'")
     .set("PAYMENTSTATUS = '1'")
     .set("PAYMENTDATE = '" + CommonHelper.getCreateTimeToString()+"'")
     .update("TB_E_BUYBACKSTATEMENT")
     .where("ID in("+paramIn+")");    
    
    //查看对应的客户回购单客户结算回购状态是否为已付款,如果是,要更改回购单状态已付款
    sql.append(updateBankReStatusSql);
    sql.append("and ID in(" + CL_LF);
    sql.append(getSettleStatusSql);
    sql.append("AND BUYBACKSTATEMENT.ID in(" + paramIn + ")" + CL_LF);
    sql.append(")" + CL_LF);
    sql.append("AND FINANCEAFFIRMSTATSUS = ?" + CL_LF);
    sqlParam.add(REPUR_STATUS09);//回购单状态为已付款
    sqlParam.add(CREPUR_STATUS04);//客户回购单结状态为已付款
    query.execute(sql.toString(),sqlParam);
   }else{
    update.set("BUYBACKSTATEMENT_STATUS = '" + type + "'")
    .update("TB_E_BUYBACKSTATEMENT")
    .where("ID in("+paramIn+")");
   }
   count = query.execute(update);
  }
  result.put("count", count);
  return result;
 }


function changeStates(flag) {
  var checkValues = getCoulmnValue(oTable,'key');
  if(isEmpty(checkValues)){
   showInfo("请选择数据");
   return false;
  } else {
   if(flag == 1){
    if(confirm('确认审批是否通过?')){
     saveStates(flag,checkValues);
    }
   }else if(flag == 4){
    if(confirm('确认付款?')){
     saveStates(flag,checkValues);
    }
   }else{
    saveStates(flag,checkValues);
   }     
  }
 } 
 //审批数据提交
 function saveStates(flag,checkValues){
  $.ajax({
     type: 'get',
     url: "<c:url value='/j8_bankSettle/changeStates/'/>"+flag+"/"+checkValues,
     dataType: 'html',
     success: function(data){        
      if(data > 0){
        showInfo("操作成功");       
     query();      
      }else{
        showError("操作失败"); 
     return false;
      }
     }
  });
 }



<c:choose>
       <c:when test="${optype eq 'approval'}">
        <button class="icon-edit" onclick="changeStates(1);">
            审批通过
        </button>
        <button class="icon-edit" onclick="changeStates(2);">
           审批退回
        </button>
        <button class="icon-edit" onclick="changeStates(3);">
           作废
        </button>
       </c:when>
       <c:when test="${optype eq 'payment'}">
        <button class="icon-edit" onclick="changeStates(4);">
            付款
        </button>        
       </c:when>
       </c:choose> 



{ "sName": "id","sColumnDataType":"checkbox","sClass": "keyclass",
            "sColumnDataTypePro":{'name':'key'},"bSortable": false, "aTargets": [ 1 ]},

只有注册用户登录后才能发表评论。


网站导航: