var backPayForm = new Ext.FormPanel({ url : 'backCustfee.action', labelAlign : 'right', labelWidth : 80, bodyStyle : 'padding:5px', border : false, baseCls : 'x-plain', defaultType : 'textfield', defaults : {anchor:'95%'}, items : [ {xtype : 'hidden',name : 'custfee.custfeeId',id:'custfeeId'}, {xtype : 'textfield',fieldLabel : '抄表年月',name : 'custfee.copyMonth',disabled:true}, {fieldLabel: '用户名称',name :'custfee.customerName',disabled:true}, {fieldLabel: '本月电费',name :'custfee.thisMonthRate'} ], buttonAlign : 'center', minButtonWidth : 60, buttons : [{ text:'缴费冲正', handler : function(){ if(backPayForm.getForm().isValid()){ Ext.Msg.confirm('操作提示','确认冲正?',function(btn){ if('yes' == btn){ backPayForm.getForm().submit({ success: function(form){ Ext.Msg.show({ title : '成功提示', msg : '[' + form.findField('custfee.customerName').getValue() + '] 成功冲正!', icon : Ext.Msg.INFO, buttons : Ext.Msg.OK, fn:function(){ window_back_pay.hide(); var record = grid_custfeeLog.getSelectionModel().getSelected(); record.set('paySign',0); record.set('thisMonthRate',form.findField('custfee.thisMonthRate').getValue()); grid_custfeeLog.fireEvent('rowclick',grid_custfeeLog,grid_custfeeLog.getStore().indexOf(record)); } }); }, failure : function(form,action){ Ext.Msg.show({ title : '错误提示', msg : '[' + form.findField('custfee.customerName').getValue() + '] 冲正失败!', icon : Ext.Msg.ERROR, buttons : Ext.Msg.OK }); } }); } }); } } },{ text : '取消', handler:function(){ window_back_pay.hide(); } }] });
XML 配置
<action name="backCustfee" class="custfeeAction" method="back"> <result type="json"> <param name="includeProperties">success</param> </result> </action>
custfeeAction
public String back() throws Exception { // custfee.setCustfeeId(Integer.valueOf(custfeeId)); // custfee.setThisMonthRate(thisMonthRate); success = custfeeService.returnPay(custfee); return SUCCESS; }
custfeeService
public boolean returnPay(Custfee custfee) { /*************** 缴费冲正操作 *************************/ String thisMonthRate = ""; if (null != custfee) { thisMonthRate = custfee.getThisMonthRate(); } custfee = custfeeDao.findById(custfee.getCustfeeId()); custfee.setPaySign("0"); custfee.setPayData(" "); custfee.setThisMonthRate(thisMonthRate); Integer flag = custfeeDao.update(custfee); /*************** 记录缴费操作日志 *************************/ if (null != custfee && !"".equals(custfee)) { PayLog payLog = new PayLog(); payLog.setCustomerId(custfee.getCustomerId()); payLog.setCustomerName(custfee.getCustomerName()); payLog.setLogType("缴费冲正"); payLog.setMoney(custfee.getThisMonthRate()); payLog.setOperator("loshua"); payLog.setModifytime(DateTime.getNowDateTime()); payLogDao.saveLog(payLog); } return flag == null ? false : true; }