|
@@ -4,6 +4,7 @@ import (
|
|
|
"cold-delivery/app/admin/model"
|
|
|
"cold-delivery/app/admin/service"
|
|
|
"cold-delivery/app/admin/service/dto"
|
|
|
+ cDto "cold-delivery/common/dto"
|
|
|
"cold-delivery/common/nats/nats_server"
|
|
|
"cold-delivery/conf"
|
|
|
"encoding/json"
|
|
@@ -12,6 +13,7 @@ import (
|
|
|
"github.com/go-resty/resty/v2"
|
|
|
"gogs.baozhida.cn/zoie/OAuth-core/api"
|
|
|
_ "gogs.baozhida.cn/zoie/OAuth-core/pkg/response"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
type WeianController struct {
|
|
@@ -111,16 +113,37 @@ func (e WeianController) GetWaybillData(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
var ids []int
|
|
|
- for _, r := range task.DeviceSensorList {
|
|
|
- ids = append(ids, r.T_id)
|
|
|
+ for _, ds := range task.DeviceSensorList {
|
|
|
+ ids = append(ids, ds.T_id)
|
|
|
+ }
|
|
|
+ startTime := task.StartTime.String()
|
|
|
+ endTime := task.EndTime.String()
|
|
|
+ if len(req.StartTime) > 0 {
|
|
|
+ _, err = time.Parse("2006-01-02 15:04:05", req.StartTime)
|
|
|
+ if err != nil {
|
|
|
+ e.Error(500, err, "开始时间格式不正确")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ startTime = req.StartTime
|
|
|
+ }
|
|
|
+ if len(req.EndTime) > 0 {
|
|
|
+ _, err = time.Parse("2006-01-02 15:04:05", req.EndTime)
|
|
|
+ if err != nil {
|
|
|
+ e.Error(500, err, "结束时间格式不正确")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ endTime = req.EndTime
|
|
|
}
|
|
|
dataReq := dto.WaybillTaskGetDataPageReq{
|
|
|
- Pagination: req.Pagination,
|
|
|
- WaybillNo: task.WaybillNo,
|
|
|
- TaskId: task.Id,
|
|
|
- T_ids: ids,
|
|
|
- StartTime: task.StartTime.String(),
|
|
|
- EndTime: task.EndTime.String(),
|
|
|
+ Pagination: cDto.Pagination{
|
|
|
+ Page: req.GetPageIndex(),
|
|
|
+ PageSize: req.GetPageSize(),
|
|
|
+ },
|
|
|
+ WaybillNo: task.WaybillNo,
|
|
|
+ TaskId: task.Id,
|
|
|
+ T_ids: ids,
|
|
|
+ StartTime: startTime,
|
|
|
+ EndTime: endTime,
|
|
|
}
|
|
|
list, count, err := s.GetDataPage(&dataReq)
|
|
|
if err != nil {
|