|
@@ -99,6 +99,11 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoAdd() {
|
|
|
br.IsSendEmail = false
|
|
|
return
|
|
|
}
|
|
|
+ if len(extraReq.EdbInfoIdList) == 0 {
|
|
|
+ br.Msg = "请选择ETA指标"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
if len(extraReq.FutureGoodEdbInfoIdList) <= 0 {
|
|
|
br.Msg = "请选择期货商品指标"
|
|
|
br.IsSendEmail = false
|
|
@@ -113,34 +118,31 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoAdd() {
|
|
|
extraConf := string(extraConfByte)
|
|
|
|
|
|
var edbInfoIdArr []int
|
|
|
+ baseEdbInfo := new(data_manage.EdbInfo)
|
|
|
|
|
|
- edbInfo, err := data_manage.GetEdbInfoById(extraReq.BaseEdbInfoId)
|
|
|
+ edbInfoList, err := data_manage.GetEdbInfoByIdList(extraReq.EdbInfoIdList)
|
|
|
if err != nil {
|
|
|
- if err.Error() == utils.ErrNoRow() {
|
|
|
- br.Msg = "指标不存在!"
|
|
|
- br.ErrMsg = "指标不存在,edbInfoId:" + strconv.Itoa(extraReq.BaseEdbInfoId)
|
|
|
- return
|
|
|
- } else {
|
|
|
- br.Msg = "获取指标信息失败!"
|
|
|
- br.ErrMsg = "获取图表的指标信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
+ br.Msg = "获取指标信息失败!"
|
|
|
+ br.ErrMsg = "获取图表的指标信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ edbInfoListMap := make(map[int]*data_manage.EdbInfo)
|
|
|
+ for k, v := range edbInfoList {
|
|
|
+ edbInfoList[k].EdbNameSource = v.EdbName
|
|
|
+ edbInfoListMap[v.EdbInfoId] = v
|
|
|
+ edbInfoIdArr = append(edbInfoIdArr, v.EdbInfoId)
|
|
|
+ if v.EdbInfoId == extraReq.BaseEdbInfoId {
|
|
|
+ baseEdbInfo = v
|
|
|
}
|
|
|
}
|
|
|
- if edbInfo == nil {
|
|
|
- br.Msg = "指标已被删除,请重新选择!"
|
|
|
- br.ErrMsg = "指标不存在,ChartInfoId:" + strconv.Itoa(extraReq.BaseEdbInfoId)
|
|
|
- return
|
|
|
- } else {
|
|
|
- if edbInfo.EdbInfoId <= 0 {
|
|
|
+ for _, v := range extraReq.EdbInfoIdList {
|
|
|
+ if _, ok := edbInfoListMap[v]; !ok {
|
|
|
br.Msg = "指标已被删除,请重新选择!"
|
|
|
- br.ErrMsg = "指标不存在,ChartInfoId:" + strconv.Itoa(extraReq.BaseEdbInfoId)
|
|
|
+ br.ErrMsg = "指标不存在,edbInfoId:" + strconv.Itoa(v)
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- edbInfoIdArr = append(edbInfoIdArr, extraReq.BaseEdbInfoId)
|
|
|
- edbInfo.EdbNameSource = edbInfo.EdbName
|
|
|
-
|
|
|
|
|
|
futureGoodEdbInfoMap := make(map[int]*future_good.FutureGoodEdbInfo)
|
|
|
zlFutureGoodEdbInfoList := make([]*future_good.FutureGoodEdbInfo, 0)
|
|
@@ -234,25 +236,27 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoAdd() {
|
|
|
|
|
|
mapList := make([]*data_manage.ChartEdbMapping, 0)
|
|
|
{
|
|
|
- mapList = append(mapList, &data_manage.ChartEdbMapping{
|
|
|
- ChartEdbMappingId: 0,
|
|
|
- EdbInfoId: extraReq.BaseEdbInfoId,
|
|
|
- CreateTime: time.Now(),
|
|
|
- ModifyTime: time.Now(),
|
|
|
- UniqueCode: utils.MD5(utils.CHART_PREFIX + "_" + strconv.FormatInt(time.Now().UnixNano(), 10) + "_" + strconv.Itoa(extraReq.BaseEdbInfoId)),
|
|
|
-
|
|
|
-
|
|
|
- IsOrder: true,
|
|
|
- IsAxis: 1,
|
|
|
- EdbInfoType: 1,
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Source: 1,
|
|
|
- })
|
|
|
+ for _, v := range edbInfoList {
|
|
|
+ mapList = append(mapList, &data_manage.ChartEdbMapping{
|
|
|
+ ChartEdbMappingId: 0,
|
|
|
+ EdbInfoId: v.EdbInfoId,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ UniqueCode: utils.MD5(utils.CHART_PREFIX + "_" + strconv.FormatInt(time.Now().UnixNano(), 10) + "_" + strconv.Itoa(v.EdbInfoId)),
|
|
|
+
|
|
|
+
|
|
|
+ IsOrder: true,
|
|
|
+ IsAxis: 1,
|
|
|
+ EdbInfoType: 1,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Source: 1,
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
for _, v := range futureGoodEdbInfoMap {
|
|
|
mapList = append(mapList, &data_manage.ChartEdbMapping{
|
|
@@ -278,7 +282,7 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoAdd() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- _, _, _, xDataList, yDataList, err := future_goodServ.GetProfitChartEdbData(edbInfo, zlFutureGoodEdbInfoList, extraReq.DateList, extraReq.CalculateFormula, extraReq.FutureGoodEdbInfoIdList)
|
|
|
+ _, _, _, xDataList, yDataList, err := future_goodServ.GetProfitChartEdbData(baseEdbInfo, edbInfoList, zlFutureGoodEdbInfoList, extraReq.DateList, extraReq.CalculateFormula, extraReq.FutureGoodEdbInfoIdList, extraReq.XDataList)
|
|
|
if err != nil {
|
|
|
br.Msg = "保存失败"
|
|
|
br.ErrMsg = "保存商品利润失败,指标信息失败,Err:" + err.Error()
|
|
@@ -445,6 +449,9 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoEdit() {
|
|
|
br.IsSendEmail = false
|
|
|
return
|
|
|
}
|
|
|
+ if len(extraReq.EdbInfoIdList) == 0 {
|
|
|
+ extraReq.EdbInfoIdList = append(extraReq.EdbInfoIdList, extraReq.BaseEdbInfoId)
|
|
|
+ }
|
|
|
extraConfByte, err := json.Marshal(extraReq)
|
|
|
if err != nil {
|
|
|
br.Msg = "商品利润曲线图信息异常"
|
|
@@ -454,34 +461,32 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoEdit() {
|
|
|
extraConf := string(extraConfByte)
|
|
|
|
|
|
var edbInfoIdArr []int
|
|
|
+ baseEdbInfo := new(data_manage.EdbInfo)
|
|
|
|
|
|
- edbInfo, err := data_manage.GetEdbInfoById(extraReq.BaseEdbInfoId)
|
|
|
+ edbInfoList, err := data_manage.GetEdbInfoByIdList(extraReq.EdbInfoIdList)
|
|
|
if err != nil {
|
|
|
- if err.Error() == utils.ErrNoRow() {
|
|
|
- br.Msg = "指标不存在!"
|
|
|
- br.ErrMsg = "指标不存在,edbInfoId:" + strconv.Itoa(extraReq.BaseEdbInfoId)
|
|
|
- return
|
|
|
- } else {
|
|
|
- br.Msg = "获取指标信息失败!"
|
|
|
- br.ErrMsg = "获取图表的指标信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
+ br.Msg = "获取指标信息失败!"
|
|
|
+ br.ErrMsg = "获取图表的指标信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ edbInfoListMap := make(map[int]*data_manage.EdbInfo)
|
|
|
+ for k, v := range edbInfoList {
|
|
|
+ edbInfoList[k].EdbNameSource = v.EdbName
|
|
|
+ edbInfoListMap[v.EdbInfoId] = v
|
|
|
+ edbInfoIdArr = append(edbInfoIdArr, v.EdbInfoId)
|
|
|
+ if v.EdbInfoId == extraReq.BaseEdbInfoId {
|
|
|
+ baseEdbInfo = v
|
|
|
}
|
|
|
}
|
|
|
- if edbInfo == nil {
|
|
|
- br.Msg = "指标已被删除,请重新选择!"
|
|
|
- br.ErrMsg = "指标不存在,ChartInfoId:" + strconv.Itoa(extraReq.BaseEdbInfoId)
|
|
|
- return
|
|
|
- } else {
|
|
|
- if edbInfo.EdbInfoId <= 0 {
|
|
|
+
|
|
|
+ for _, v := range extraReq.EdbInfoIdList {
|
|
|
+ if _, ok := edbInfoListMap[v]; !ok {
|
|
|
br.Msg = "指标已被删除,请重新选择!"
|
|
|
- br.ErrMsg = "指标不存在,ChartInfoId:" + strconv.Itoa(extraReq.BaseEdbInfoId)
|
|
|
+ br.ErrMsg = "指标不存在,edbInfoId:" + strconv.Itoa(v)
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- edbInfoIdArr = append(edbInfoIdArr, extraReq.BaseEdbInfoId)
|
|
|
- edbInfo.EdbNameSource = edbInfo.EdbName
|
|
|
-
|
|
|
|
|
|
futureGoodEdbInfoMap := make(map[int]*future_good.FutureGoodEdbInfo)
|
|
|
zlFutureGoodEdbInfoList := make([]*future_good.FutureGoodEdbInfo, 0)
|
|
@@ -549,26 +554,27 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoEdit() {
|
|
|
|
|
|
mapList := make([]*data_manage.ChartEdbMapping, 0)
|
|
|
{
|
|
|
- mapList = append(mapList, &data_manage.ChartEdbMapping{
|
|
|
- ChartEdbMappingId: 0,
|
|
|
- EdbInfoId: extraReq.BaseEdbInfoId,
|
|
|
- CreateTime: time.Now(),
|
|
|
- ModifyTime: time.Now(),
|
|
|
- UniqueCode: utils.MD5(utils.CHART_PREFIX + "_" + strconv.FormatInt(time.Now().UnixNano(), 10) + "_" + strconv.Itoa(extraReq.BaseEdbInfoId)),
|
|
|
-
|
|
|
-
|
|
|
- IsOrder: true,
|
|
|
- IsAxis: 1,
|
|
|
- EdbInfoType: 1,
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Source: 1,
|
|
|
- })
|
|
|
-
|
|
|
+ for _, v := range edbInfoList {
|
|
|
+ mapList = append(mapList, &data_manage.ChartEdbMapping{
|
|
|
+ ChartEdbMappingId: 0,
|
|
|
+ EdbInfoId: v.EdbInfoId,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ UniqueCode: utils.MD5(utils.CHART_PREFIX + "_" + strconv.FormatInt(time.Now().UnixNano(), 10) + "_" + strconv.Itoa(v.EdbInfoId)),
|
|
|
+
|
|
|
+
|
|
|
+ IsOrder: true,
|
|
|
+ IsAxis: 1,
|
|
|
+ EdbInfoType: 1,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Source: 1,
|
|
|
+ })
|
|
|
+ }
|
|
|
for _, v := range futureGoodEdbInfoMap {
|
|
|
mapList = append(mapList, &data_manage.ChartEdbMapping{
|
|
|
ChartEdbMappingId: 0,
|
|
@@ -593,7 +599,7 @@ func (this *FutureGoodChartInfoController) ProfitChartInfoEdit() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- _, _, _, xDataList, yDataList, err := future_goodServ.GetProfitChartEdbData(edbInfo, zlFutureGoodEdbInfoList, extraReq.DateList, extraReq.CalculateFormula, extraReq.FutureGoodEdbInfoIdList)
|
|
|
+ _, _, _, xDataList, yDataList, err := future_goodServ.GetProfitChartEdbData(baseEdbInfo, edbInfoList, zlFutureGoodEdbInfoList, extraReq.DateList, extraReq.CalculateFormula, extraReq.FutureGoodEdbInfoIdList, extraReq.XDataList)
|
|
|
if err != nil {
|
|
|
br.Msg = "保存失败"
|
|
|
br.ErrMsg = "保存商品利润失败,指标信息失败,Err:" + err.Error()
|
|
@@ -911,9 +917,22 @@ func (this *FutureGoodChartInfoController) PreviewProfitChartInfo() {
|
|
|
br.IsSendEmail = false
|
|
|
return
|
|
|
}
|
|
|
+ if len(req.EdbInfoIdList) == 0 {
|
|
|
+ br.Msg = "请选择ETA指标"
|
|
|
+ br.ErrMsg = "请选择ETA指标"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ edbInfoList, err := data_manage.GetEdbInfoByIdList(req.EdbInfoIdList)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取图表,指标信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- barConfigEdbInfoIdList, _, _, xDataList, yDataList, err := future_goodServ.GetProfitChartEdbData(baseEdbInfo, zlFutureGoodEdbInfoList, req.DateList, req.CalculateFormula, req.FutureGoodEdbInfoIdList)
|
|
|
+ barConfigEdbInfoIdList, _, _, xDataList, yDataList, err := future_goodServ.GetProfitChartEdbData(baseEdbInfo, edbInfoList, zlFutureGoodEdbInfoList, req.DateList, req.CalculateFormula, req.FutureGoodEdbInfoIdList, req.XDataList)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取图表,指标信息失败,Err:" + err.Error()
|
|
@@ -991,15 +1010,18 @@ func getFutureGoodProfitChartInfo(chartInfo *data_manage.ChartInfoView, sysUser
|
|
|
br.ErrMsg = "商品利润曲线图配置异常"
|
|
|
return
|
|
|
}
|
|
|
+ if len(extraConf.EdbInfoIdList) == 0 {
|
|
|
+ extraConf.EdbInfoIdList = append(extraConf.EdbInfoIdList, extraConf.BaseEdbInfoId)
|
|
|
+ }
|
|
|
|
|
|
edbList := make([]*data_manage.ChartEdbInfoMapping, 0)
|
|
|
- edbInfoMapping, err := data_manage.GetEtaEdbChartEdbMapping(chartInfoId)
|
|
|
+ edbInfoMappingList, err := data_manage.GetEtaEdbChartEdbMappingList(chartInfoId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取商品利润图表,基础指标信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- edbList = append(edbList, edbInfoMapping)
|
|
|
+ edbList = edbInfoMappingList
|
|
|
futureGoodEdbInfoMappingList, err := data_manage.GetFutureGoodEdbChartEdbMappingList(chartInfoId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
@@ -1233,15 +1255,18 @@ func GetFutureGoodProfitChartInfoDetailFromUniqueCode(chartInfo *data_manage.Cha
|
|
|
errMsg = "商品利润曲线图配置异常,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ if len(extraConf.EdbInfoIdList) == 0 {
|
|
|
+ extraConf.EdbInfoIdList = append(extraConf.EdbInfoIdList, extraConf.BaseEdbInfoId)
|
|
|
+ }
|
|
|
|
|
|
edbList := make([]*data_manage.ChartEdbInfoMapping, 0)
|
|
|
- edbInfoMapping, err := data_manage.GetEtaEdbChartEdbMapping(chartInfoId)
|
|
|
+ edbInfoMappingList, err := data_manage.GetEtaEdbChartEdbMappingList(chartInfoId)
|
|
|
if err != nil {
|
|
|
msg = "获取失败"
|
|
|
errMsg = "获取商品利润图表,基础指标信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- edbList = append(edbList, edbInfoMapping)
|
|
|
+ edbList = edbInfoMappingList
|
|
|
futureGoodEdbInfoMappingList, err := data_manage.GetFutureGoodEdbChartEdbMappingList(chartInfoId)
|
|
|
if err != nil {
|
|
|
msg = "获取失败"
|