Prechádzať zdrojové kódy

流通管理 --退款管理 :编辑退款没有验证,填写非数字报错

mydq 5 rokov pred
rodič
commit
cbf671b9aa

+ 5 - 0
src/main/java/com/lightinit/hsdataplatform/impl/admin/RefundServiceImpl.java

@@ -105,6 +105,11 @@ public class RefundServiceImpl implements IRefundService {
     @Transactional
     public ResultState edit(Refund inputModel) {
         ResultState<Long> resultState = new ResultState<Long>();
+        if (inputModel.getRefundAmount() == null){
+            resultState.setStateCode(ResultStateCode.INVALID_DATA);
+            resultState.setMsg("输入金额不合法或者为空");
+            return resultState;
+        }
         DynamicDataContextHolder.setCustomerType(DynamicDataContextHolder.DEFAULT);
         inputModel.setCreatedAt(new Date());
         RefundExample example=new RefundExample();

+ 1 - 1
src/main/webapp/pages/admin/refund/edit.jsp

@@ -22,7 +22,7 @@
 
     <div class="form-group">
         <label for="refundAmount">退款金额</label>
-        <input type="text" id="refundAmount" name="refundAmount" value="${busiModel.refundAmount}" class="form-control" />
+        <input type="number" id="refundAmount" name="refundAmount" value="${busiModel.refundAmount}" οninput="value=value.replace(/[^\d]/g,'')" class="form-control" />
         <span class="help-block"></span>
     </div>
     <div class="form-group">