2
3
Преглед на файлове

调通银行支付接口

yuedefeng преди 6 години
родител
ревизия
a833a1f51d

+ 10 - 0
src/dashoo.cn/backend/api/business/bankapi/ICBCService.go

@@ -84,3 +84,13 @@ func (s *ICBCService) GetBillList(commercialNo string) []byte {
 	fmt.Println(string(p))
 	return p
 }
+
+func (s *ICBCService) ReceiveMoneyBillList(billIds BillReceiveMoneyParams) []byte {
+	myToken := s.AuthToken()
+	queryJson, _ := json.Marshal(billIds)
+	queryParams := string(queryJson)
+	retVal := s.Post("/paymentinfo/receive-money-bill-list", queryParams, myToken)
+	p, _ := ioutil.ReadAll(retVal.Body)
+	fmt.Println(string(p))
+	return p
+}

+ 13 - 0
src/dashoo.cn/backend/api/business/bankapi/icbc.go

@@ -24,3 +24,16 @@ type ICBCBillBank struct {
 	CommercialNo string 		`json:"commercialNo"`
 	ICBCBills	 []ICBCBillVM	`json:"icbcBills"`
 }
+
+type BillReceiveMoneyIds struct {
+	Ids string `json:"ids"`
+}
+
+type BillReceiveMoneyParams struct {
+	Ids 		   string 	 `json:"ids"`
+	PayMode        string    `json:"payMode"`
+	PayDate        time.Time `json:"payDate"`
+	BankSerialNum  string    `json:"bankSerialNum"`
+	BankName       string    `json:"bankName"`
+	ReceiveAmount  string    `json:"receiveAmount"`
+}

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

@@ -36,11 +36,11 @@ func (this *ICBCController) GetBillList() {
 // @router /update-bill-list [post]
 func (this *ICBCController) UpdateBillList() {
 
-	var icbcBillQueryParam bankapi.ICBCBillQueryParam
-	json.Unmarshal(this.Ctx.Input.RequestBody, &icbcBillQueryParam)
+	var billParams bankapi.BillReceiveMoneyParams
+	json.Unmarshal(this.Ctx.Input.RequestBody, &billParams)
 	svc := bankapi.GetICBCService(utils.DBE)
 	var datainfo DataInfo
-	ret := svc.GetBillList(icbcBillQueryParam.CommercialNo)
+	ret := svc.ReceiveMoneyBillList(billParams)
 	json.Unmarshal(ret, &datainfo)
 	this.Data["json"] = &datainfo
 	this.ServeJSON()

+ 58 - 3
src/dashoo.cn/backend/api/controllers/oilsupplier/paymentinfo.go

@@ -81,7 +81,7 @@ func (this *PaymentInfoController) GetBillList() {
 
 	var supplierEntity supplier.OilSupplier
 	supplierSvc := supplier.GetOilSupplierService(utils.DBE)
-	supplierWhere := "1=1 and CommercialNo='" + icbcBillQueryParam.CommercialNo + "'"
+	supplierWhere := "1=1 and IsPay=1 and CommercialNo='" + icbcBillQueryParam.CommercialNo + "'"
 	supplierSvc.DBE.Where(supplierWhere).Get(&supplierEntity)
 
 	var billList []paymentinfo.OilPaymentInfo
@@ -265,9 +265,9 @@ func (this *PaymentInfoController) SureEntity() {
 
 	sql := "update OilPaymentInfo set IsPay = 1, "
 	sql += "SureBatchNo='" + strconv.FormatInt(time.Now().UnixNano(), 10) + "' "
-	/*sql += "ModifiedOn='" + time.Now().String() + "', "
+	sql += "ModifiedOn='" + time.Now().Format("2006-01-02 15:04:05") + "', "
 	sql += "ModifiedBy='" + this.User.Realname + "', "
-	sql += "ModifiedUserId='" + this.User.Id + "' "*/
+	sql += "ModifiedUserId='" + this.User.Id + "' "
 	sql += " where id in (" + strIds + ") and IsPay = 0"
 	svc.DBE.Query(sql)
 
@@ -277,3 +277,58 @@ func (this *PaymentInfoController) SureEntity() {
 	this.Data["json"] = &errinfo
 	this.ServeJSON()
 }
+
+// @Title 确认缴费单
+// @Description 确认缴费单
+// @Success	200	{object} controllers.Request
+// @router /receive-money-bill-list [post]
+func (this *PaymentInfoController) ReceiveMoneyBillList() {
+	var errinfo ErrorInfo
+	svc := paymentinfo.GetPaymentService(utils.DBE)
+	var billParams bankapi.BillReceiveMoneyParams
+	var jsonBlob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonBlob, &billParams)
+
+	strIds := strings.Trim(billParams.Ids, ",")
+	sqlList := " where id in (" + strIds + ") and IsPay = 1"
+	var paymentInfos []paymentinfo.OilPaymentInfo
+	svc.GetEntities(paymentInfos, sqlList)
+
+	t := time.Now()
+	sql := "update OilPaymentInfo set IsPay = 2, "
+	sql += "BankName='" + billParams.BankName + "', "
+	sql += "BankSerialNum='" + billParams.BankSerialNum + "', "
+	sql += "PayDate='" + billParams.PayDate.Format("2006-01-02 15:04:05") + "', "
+	sql += "PayMode='" + billParams.PayMode + "', "
+	sql += "ModifiedOn='" + t.Format("2006-01-02 15:04:05") + "', "
+	sql += "ModifiedBy='" + this.User.Realname + "', "
+	sql += "ModifiedUserId='" + this.User.Id + "' "
+	sql += " where id in (" + strIds + ") and IsPay = 1"
+	svc.DBE.Query(sql)
+
+	for _, payItem := range paymentInfos {
+		if payItem.PayType == "1" {//准入
+			var certentity suppliercert.OilSupplierCert
+			certentity.Status = suppliercert.STOREING_STATUS
+			certentity.Step = 5
+			cols := []string{
+				"Status",
+				"Step",
+			}
+			svc.UpdateEntityByIdCols(strconv.Itoa(payItem.SupplierCertId), &certentity, cols)
+
+		} else if payItem.PayType == "2" {//年审
+			//TODO: 修改年审时间
+
+		} else if payItem.PayType == "3" {//增项
+
+		}
+	}
+	//记录对账日志
+	//TODO: 记录对账日志
+
+	errinfo.Message = "修改成功!"
+	errinfo.Code = 0
+	this.Data["json"] = &errinfo
+	this.ServeJSON()
+}

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

@@ -5,5 +5,13 @@ export default {
       method: 'post',
       data: params
     })
+  },
+
+  receiveMoneyBillList (params, myAxios) {
+    return myAxios({
+      url: '/bankapi/update-bill-list',
+      method: 'post',
+      data: params
+    })
   }
 }

+ 23 - 1
src/dashoo.cn/frontend_web/src/pages/oilbank/icbclist.vue

@@ -177,14 +177,36 @@
       },
       handleGetMoney () {
         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.receiveMoneyBillList(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)
+        })
       },
 
       handleSearch () {

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

@@ -56,7 +56,7 @@
       <div slot="header">
         <span>
           <span style="font-weight: bold;">
-            未确认缴费列表,  金额合计: <font color="red">{{this.amount1}} 元</font>
+            未确认列表,  金额合计: <font color="red">{{this.amount1}} 元</font>
           </span>
         </span>
       </div>
@@ -81,7 +81,7 @@
     <el-card class="box-card" style="margin-top: 5px" v-if="entityList2 && entityList2.length > 0">
       <div slot="header">
         <span style="font-weight: bold;">
-          已确认未支付缴费列表,  金额合计: <font color="red">{{this.amount2}} 元</font>
+          已确认未支付列表,  金额合计: <font color="red">{{this.amount2}} 元</font>
         </span>
         <!--<span style="float: right; font-weight: bold;">