|
|
@@ -3,6 +3,7 @@ package bankapi
|
|
|
import (
|
|
|
"dashoo.cn/backend/api/business/paymentinfo"
|
|
|
"dashoo.cn/backend/api/models"
|
|
|
+ baseparameter "dashoo.cn/business/parameter"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"io/ioutil"
|
|
|
@@ -16,6 +17,7 @@ import (
|
|
|
. "dashoo.cn/backend/api/controllers"
|
|
|
"dashoo.cn/utils"
|
|
|
)
|
|
|
+
|
|
|
// 提供给银行接口的用户名 和 密码:icbc2019, Icbc@2019##
|
|
|
// Operations about Users
|
|
|
type ICBCController struct {
|
|
|
@@ -34,6 +36,29 @@ func (this *ICBCController) GetBillList() {
|
|
|
var datainfo DataInfo
|
|
|
ret := svc.GetBillList(icbcBillQueryParam.CommercialNo)
|
|
|
json.Unmarshal(ret, &datainfo)
|
|
|
+ if datainfo.CurrentItemCount > 0 {
|
|
|
+ var errInfo ErrorInfo
|
|
|
+ paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
+ startDayStr := paramSvc.GetBaseparameterMessage("PAYCHECK", "paramset", "permitPayStartDay")
|
|
|
+ endDayStr := paramSvc.GetBaseparameterMessage("PAYCHECK", "paramset", "permitPayEndDay")
|
|
|
+ if startDayStr == "" {
|
|
|
+ startDayStr = "2"
|
|
|
+ }
|
|
|
+ if endDayStr == "" {
|
|
|
+ endDayStr = "26"
|
|
|
+ }
|
|
|
+ startDay, _ := strconv.Atoi(startDayStr)
|
|
|
+ endDay, _ := strconv.Atoi(endDayStr)
|
|
|
+ today := time.Now().Day()
|
|
|
+ if today < startDay || today > endDay {
|
|
|
+ // 存在交费订单,但处于不允许交费时间段内
|
|
|
+ errInfo.Message = "请于每月" + startDayStr + "日至" + endDayStr + "日确认交费!"
|
|
|
+ errInfo.Code = -1
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
this.Data["json"] = &datainfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
@@ -53,8 +78,8 @@ func (this *ICBCController) UpdateBillList() {
|
|
|
billParams.BankSerialNum = billParamsICBC.BankSerialNum
|
|
|
billParams.Ids = billParamsICBC.Ids
|
|
|
billParams.PayMode = billParamsICBC.PayMode
|
|
|
- billParams.ReceiveAmount,_ = strconv.ParseFloat(billParamsICBC.ReceiveAmount, 64)
|
|
|
- billParams.PayDate, _= time.Parse("2006-01-02", billParamsICBC.PayDate)
|
|
|
+ billParams.ReceiveAmount, _ = strconv.ParseFloat(billParamsICBC.ReceiveAmount, 64)
|
|
|
+ billParams.PayDate, _ = time.Parse("2006-01-02", billParamsICBC.PayDate)
|
|
|
|
|
|
svc := bankapi.GetICBCService(utils.DBE)
|
|
|
var errinfo ErrorInfo
|
|
|
@@ -139,13 +164,13 @@ func (this *ICBCController) CheckBillList() {
|
|
|
json.Unmarshal(this.Ctx.Input.RequestBody, &VerifyBillItem)
|
|
|
|
|
|
var Oilverifybill = make([]paymentinfo.OilVerifyBill, len(VerifyBillItem))
|
|
|
- for idx,item := range VerifyBillItem {
|
|
|
+ for idx, item := range VerifyBillItem {
|
|
|
Oilverifybill[idx].BillIds = item.BillIds
|
|
|
Oilverifybill[idx].BankSerialNum = item.BankSerialNum
|
|
|
- Oilverifybill[idx].ReceiveAmount,_ = strconv.ParseFloat(item.ReceiveAmount, 64)
|
|
|
- loc,_ := time.LoadLocation("Local")
|
|
|
- Oilverifybill[idx].PayDate,_ = time.ParseInLocation("2006-01-02 15:04:05", item.PayDate, loc)
|
|
|
- Oilverifybill[idx].VerifyDate,_ = time.ParseInLocation("2006-01-02 15:04:05", item.VerifyDate, loc)
|
|
|
+ Oilverifybill[idx].ReceiveAmount, _ = strconv.ParseFloat(item.ReceiveAmount, 64)
|
|
|
+ loc, _ := time.LoadLocation("Local")
|
|
|
+ Oilverifybill[idx].PayDate, _ = time.ParseInLocation("2006-01-02 15:04:05", item.PayDate, loc)
|
|
|
+ Oilverifybill[idx].VerifyDate, _ = time.ParseInLocation("2006-01-02 15:04:05", item.VerifyDate, loc)
|
|
|
}
|
|
|
|
|
|
svc := bankapi.GetICBCService(utils.DBE)
|
|
|
@@ -154,4 +179,4 @@ func (this *ICBCController) CheckBillList() {
|
|
|
json.Unmarshal(ret, &errinfo)
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
-}
|
|
|
+}
|