Parcourir la source

重复录入及再次对账回调

yuedefeng il y a 6 ans
Parent
commit
0e63fdf0d3

+ 6 - 6
src/dashoo.cn/backend/api/controllers/bankapi/icbc.go

@@ -39,10 +39,10 @@ func (this *ICBCController) UpdateBillList() {
 	var billParams bankapi.BillReceiveMoneyParams
 	json.Unmarshal(this.Ctx.Input.RequestBody, &billParams)
 	svc := bankapi.GetICBCService(utils.DBE)
-	var datainfo DataInfo
+	var errinfo ErrorInfo
 	ret := svc.ReceiveMoneyBillList(billParams)
-	json.Unmarshal(ret, &datainfo)
-	this.Data["json"] = &datainfo
+	json.Unmarshal(ret, &errinfo)
+	this.Data["json"] = &errinfo
 	this.ServeJSON()
 }
 
@@ -55,10 +55,10 @@ func (this *ICBCController) UpdateBillListAgain() {
 	var billParams bankapi.BillReceiveMoneyAgainParams
 	json.Unmarshal(this.Ctx.Input.RequestBody, &billParams)
 	svc := bankapi.GetICBCService(utils.DBE)
-	var datainfo DataInfo
+	var errinfo ErrorInfo
 	ret := svc.ReceiveMoneyAgain(billParams)
-	json.Unmarshal(ret, &datainfo)
-	this.Data["json"] = &datainfo
+	json.Unmarshal(ret, &errinfo)
+	this.Data["json"] = &errinfo
 	this.ServeJSON()
 }
 

+ 12 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/paymentinfo.go

@@ -290,6 +290,18 @@ func (this *PaymentInfoController) ReceiveMoneyBillList() {
 	var jsonBlob = this.Ctx.Input.RequestBody
 	json.Unmarshal(jsonBlob, &billParams)
 
+	//已有的银行流水号说明是重复调用,将被丢弃
+	cntWhere := " 1= 1 and BankSerialNum = '" + billParams.BankSerialNum + "' "
+	var paymentInfoCnt []paymentinfo.OilPaymentInfo
+	svc.GetEntities(&paymentInfoCnt, cntWhere)
+	if paymentInfoCnt != nil && len(paymentInfoCnt) > 0 {
+		errinfo.Message = "重复调用"
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
 	strIds := strings.Trim(billParams.Ids, ",")
 	sqlList := "id in (" + strIds + ") and IsPay = '1'"
 	var paymentInfos []paymentinfo.OilPaymentInfo

+ 8 - 0
src/dashoo.cn/frontend_web/src/api/bankapi/icbc.js

@@ -15,6 +15,14 @@ export default {
     })
   },
 
+  receiveMoneyAgain (params, myAxios) {
+    return myAxios({
+      url: '/bankapi/update-bill-again',
+      method: 'post',
+      data: params
+    })
+  },
+
   checkMoneyList (params, myAxios) {
     console.log(params)
     return myAxios({

+ 48 - 9
src/dashoo.cn/frontend_web/src/pages/oilbank/icbclist.vue

@@ -177,6 +177,12 @@
           return val
         }
       },
+      RndNum(n){
+        let rnd="";
+        for(var i=0;i<n;i++)
+          rnd+=Math.floor(Math.random()*10);
+        return rnd;
+      },
       handleGetMoney () {
         let idlist = ''
         let sumMoeny = 0.0
@@ -188,25 +194,58 @@
           ids: idlist,
           receiveAmount: sumMoeny,
           bankName: '工商银行',
-          bankSerialNum: '111222',
+          bankSerialNum: this.RndNum(11) + '',
           payDate: new Date(),
           payMode: '银行现金'
         }
         //下面调用接口修改状态
         api.receiveMoneyBillList(params, this.$axios).then(res => {
-          this.initDatas()
-          this.$message({
-            type: 'success',
-            message: '操作成功'
-          })
-          /*if (res.data.code === 0) {
-
+          console.log(res)
+          if (res.data.code === 0) {
+            this.initDatas()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+      handleGetMoneyAgain () {
+        let idlist = ''
+        let sumMoeny = 0.0
+        for (let idx in this.entityList) {
+          idlist += this.entityList[idx].Id + ','
+          sumMoeny += this.entityList[idx].Amount + 0.0
+        }
+        let params = {
+          ids: idlist,
+          receiveAmount: sumMoeny,
+          bankName: '工商银行',
+          bankSerialNum: '111222',
+          payDate: new Date(),
+          payMode: '银行现金'
+        }
+        //下面调用接口修改状态
+        api.receiveMoneyAgain(params, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            this.initDatas()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
           } else {
             this.$message({
               type: 'warning',
               message: res.data.message
             })
-          }*/
+          }
         }).catch(err => {
           console.error(err)
         })

+ 4 - 0
src/dashoo.cn/frontend_web/src/pages/oilsupplier/paymentinfo/paymentsure.vue

@@ -204,6 +204,10 @@
         api.BillSure(params, this.$axios).then(res => {
           this.initDatas()
           this.sureLoading = false
+          this.$message({
+            type: 'success',
+            message: '操作成功'
+          })
         }).catch(err => {
           console.error(err)
         })