|
@@ -6,6 +6,7 @@ import (
|
|
|
"eta/eta_index_lib/models"
|
|
|
"eta/eta_index_lib/services"
|
|
|
"eta/eta_index_lib/utils"
|
|
|
+ "fmt"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -54,7 +55,7 @@ func (this *PbFinanceController) Add() {
|
|
|
br.ErrMsg = "指标编码异常,请传入客户编码"
|
|
|
return
|
|
|
}
|
|
|
- dataItem, err := services.GetEdbDataFromPbFinance(edbCodeArr[0], edbCodeArr[1], utils.BASE_START_DATE_UnSpace, utils.PB_BASE_END_DATE_UnSpace, "")
|
|
|
+ dataItem, err := services.GetEdbDataFromPbFinance(edbCodeArr[0], edbCodeArr[1], utils.BASE_START_DATE_UnSpace, utils.GetPbNowEndDate(), "")
|
|
|
// 日志记录
|
|
|
num := 0
|
|
|
if dataItem != nil {
|
|
@@ -132,7 +133,24 @@ func (this *PbFinanceController) Refresh() {
|
|
|
utils.Rc.Delete(cacheKey)
|
|
|
}()
|
|
|
//开始日期格式化
|
|
|
- startDateTime, _ := time.ParseInLocation(utils.FormatDate, req.StartDate, time.Local)
|
|
|
+ startDateTime, err := time.ParseInLocation(utils.FormatDate, req.StartDate, time.Local)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "开始日期格式化异常!"
|
|
|
+ br.ErrMsg = fmt.Sprintf("开始日期格式化异常,请求日期:%s,Err:%s", req.StartDate, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 当前日期格式化
|
|
|
+ endDateStr := utils.GetPbNowEndDate()
|
|
|
+ endDateTime, err := time.ParseInLocation(utils.FormatDateUnSpace, endDateStr, time.Local)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "结束日期格式化异常!"
|
|
|
+ br.ErrMsg = fmt.Sprintf("结束日期格式化异常,请求日期:%s,Err:%s", req.StartDate, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if startDateTime.After(endDateTime) {
|
|
|
+ br.Msg = `指标刷新的开始日期早于当前日期!`
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
//指标编码处理,将指标编码拆分成 company_code和edb_code
|
|
|
edbCode := req.EdbCode
|
|
@@ -142,7 +160,7 @@ func (this *PbFinanceController) Refresh() {
|
|
|
br.ErrMsg = "指标编码异常,请传入客户编码"
|
|
|
return
|
|
|
}
|
|
|
- dataItem, err := services.GetEdbDataFromPbFinance(edbCodeArr[0], edbCodeArr[1], startDateTime.Format(utils.FormatDateUnSpace), utils.PB_BASE_END_DATE_UnSpace, edbInfo.TerminalCode)
|
|
|
+ dataItem, err := services.GetEdbDataFromPbFinance(edbCodeArr[0], edbCodeArr[1], startDateTime.Format(utils.FormatDateUnSpace), endDateTime.Format(utils.FormatDateUnSpace), edbInfo.TerminalCode)
|
|
|
// 日志记录
|
|
|
num := 0
|
|
|
if dataItem != nil {
|