|
@@ -53,11 +53,13 @@ type WaybillController struct {
|
|
|
// @Security Bearer
|
|
|
func (e WaybillController) GetPage(c *gin.Context) {
|
|
|
s := service.Waybill{}
|
|
|
+ userSvc := service.SysUser{}
|
|
|
req := dto.WaybillGetPageReq{}
|
|
|
err := e.MakeContext(c).
|
|
|
MakeOrm().
|
|
|
Bind(&req, binding.Query).
|
|
|
MakeService(&s.Service).
|
|
|
+ MakeService(&userSvc.Service).
|
|
|
Errors
|
|
|
if err != nil {
|
|
|
e.Logger.Error(err)
|
|
@@ -68,10 +70,20 @@ func (e WaybillController) GetPage(c *gin.Context) {
|
|
|
//数据权限检查
|
|
|
p := actions.GetPermissionFromContext(c)
|
|
|
|
|
|
+ var userObj model.SysUser
|
|
|
+ err = userSvc.Get(&dto.SysUserGetReq{Id: p.UserId}, nil, &userObj)
|
|
|
+ if err != nil {
|
|
|
+ e.Error(500, err, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
list := make([]model.Waybill, 0)
|
|
|
var count int64
|
|
|
-
|
|
|
- err = s.GetPage(&req, &list, &count, p)
|
|
|
+ if userObj.Type == model.SysUserTypeSys {
|
|
|
+ err = s.GetPage(&req, &list, &count, p)
|
|
|
+ } else {
|
|
|
+ err = s.GetUserPage(&req, &list, &count, p)
|
|
|
+ }
|
|
|
if err != nil {
|
|
|
e.Error(500, err, err.Error())
|
|
|
return
|
|
@@ -127,8 +139,6 @@ func (e WaybillController) Export(c *gin.Context) {
|
|
|
f.SetCellValue("Sheet1", "H1", "收件人地址")
|
|
|
f.SetCellValue("Sheet1", "I1", "防拆标签码")
|
|
|
f.SetCellValue("Sheet1", "J1", "运输备注")
|
|
|
- //f.SetCellValue("Sheet1", "K1", "货物类型")
|
|
|
- //f.SetCellValue("Sheet1", "L1", "运输备注")
|
|
|
|
|
|
// 设置列宽
|
|
|
f.SetColWidth("Sheet1", "A", "A", 6)
|
|
@@ -139,8 +149,8 @@ func (e WaybillController) Export(c *gin.Context) {
|
|
|
f.SetColWidth("Sheet1", "F", "F", 14)
|
|
|
f.SetColWidth("Sheet1", "G", "G", 14)
|
|
|
f.SetColWidth("Sheet1", "H", "H", 30)
|
|
|
- f.SetColWidth("Sheet1", "I", "K", 15)
|
|
|
- f.SetColWidth("Sheet1", "L", "L", 15)
|
|
|
+ f.SetColWidth("Sheet1", "I", "J", 15)
|
|
|
+ f.SetColWidth("Sheet1", "K", "K", 30)
|
|
|
|
|
|
line := 1
|
|
|
|
|
@@ -155,10 +165,9 @@ func (e WaybillController) Export(c *gin.Context) {
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), v.ConsigneeAddressName)
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("G%d", line), v.ConsigneeAddressPhone)
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("H%d", line), v.ConsigneeAddressDetails)
|
|
|
- //f.SetCellValue("Sheet1", fmt.Sprintf("I%d", line), v.TemperatureInterval)
|
|
|
- //f.SetCellValue("Sheet1", fmt.Sprintf("J%d", line), v.DeliveryCondition)
|
|
|
- //f.SetCellValue("Sheet1", fmt.Sprintf("K%d", line), v.CargoType)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("I%d", line), v.Remark)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("I%d", line), v.DeliveryName)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("J%d", line), v.DeliveryPhone)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("K%d", line), v.Remark)
|
|
|
|
|
|
}
|
|
|
timeStr := time.Now().Format("20060102150405")
|
|
@@ -420,40 +429,6 @@ func (e WaybillController) Insert(c *gin.Context) {
|
|
|
e.OK(req.GetId(), "创建成功")
|
|
|
}
|
|
|
|
|
|
-// AppletInsert 添加运单app
|
|
|
-// @Summary 添加运单app
|
|
|
-// @Description 添加运单app
|
|
|
-// @Tags 运单
|
|
|
-// @Accept application/json
|
|
|
-// @Product application/json
|
|
|
-// @Param data body dto.WaybillInsertReq true "data"
|
|
|
-// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
|
|
-// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
|
|
-// @Router /api/waybill [post]
|
|
|
-// @Security Bearer
|
|
|
-func (e WaybillController) AppletInsert(c *gin.Context) {
|
|
|
- s := service.Waybill{}
|
|
|
- req := dto.WaybillInsertReq{}
|
|
|
- err := e.MakeContext(c).
|
|
|
- MakeOrm().
|
|
|
- Bind(&req, binding.JSON).
|
|
|
- MakeService(&s.Service).
|
|
|
- Errors
|
|
|
- if err != nil {
|
|
|
- e.Logger.Error(err)
|
|
|
- e.Error(500, err, err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- p := actions.GetPermissionFromContext(c)
|
|
|
-
|
|
|
- err = s.AppletInsert(&req, p)
|
|
|
- if err != nil {
|
|
|
- e.Error(500, err, err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- e.OK(req.GetId(), "添加成功")
|
|
|
-}
|
|
|
-
|
|
|
// UpdateStatus 修改运单状态
|
|
|
// @Summary 修改运单状态
|
|
|
// @Description 修改运单状态
|
|
@@ -742,10 +717,9 @@ func (e WaybillController) CustomerExport(c *gin.Context) {
|
|
|
f.SetCellValue("Sheet1", "F1", "收件人名称")
|
|
|
f.SetCellValue("Sheet1", "G1", "收件人电话")
|
|
|
f.SetCellValue("Sheet1", "H1", "收件人地址")
|
|
|
- f.SetCellValue("Sheet1", "I1", "温度要求")
|
|
|
- f.SetCellValue("Sheet1", "J1", "配送要求")
|
|
|
- f.SetCellValue("Sheet1", "K1", "货物类型")
|
|
|
- f.SetCellValue("Sheet1", "L1", "运输备注")
|
|
|
+ f.SetCellValue("Sheet1", "I1", "配送人姓名")
|
|
|
+ f.SetCellValue("Sheet1", "J1", "配送人电话")
|
|
|
+ f.SetCellValue("Sheet1", "K1", "运输备注")
|
|
|
|
|
|
// 设置列宽
|
|
|
f.SetColWidth("Sheet1", "A", "A", 6)
|
|
@@ -757,6 +731,8 @@ func (e WaybillController) CustomerExport(c *gin.Context) {
|
|
|
f.SetColWidth("Sheet1", "G", "G", 14)
|
|
|
f.SetColWidth("Sheet1", "H", "H", 30)
|
|
|
f.SetColWidth("Sheet1", "I", "I", 15)
|
|
|
+ f.SetColWidth("Sheet1", "J", "J", 15)
|
|
|
+ f.SetColWidth("Sheet1", "K", "K", 15)
|
|
|
|
|
|
line := 1
|
|
|
|
|
@@ -771,7 +747,9 @@ func (e WaybillController) CustomerExport(c *gin.Context) {
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("F%d", line), v.ConsigneeAddressName)
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("G%d", line), v.ConsigneeAddressPhone)
|
|
|
f.SetCellValue("Sheet1", fmt.Sprintf("H%d", line), v.ConsigneeAddressDetails)
|
|
|
- f.SetCellValue("Sheet1", fmt.Sprintf("I%d", line), v.Remark)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("I%d", line), v.DeliveryName)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("J%d", line), v.DeliveryPhone)
|
|
|
+ f.SetCellValue("Sheet1", fmt.Sprintf("K%d", line), v.Remark)
|
|
|
|
|
|
}
|
|
|
timeStr := time.Now().Format("20060102150405")
|
|
@@ -924,22 +902,20 @@ func (e WaybillController) Import(c *gin.Context) {
|
|
|
for i, colCell := range row {
|
|
|
fmt.Println(i, ":", colCell)
|
|
|
}
|
|
|
- quantity, _ := strconv.Atoi(row[6])
|
|
|
+ quantity, _ := strconv.Atoi(row[8])
|
|
|
obj := dto.WaybillInsertReq{
|
|
|
- Status: 1,
|
|
|
- SenderAddressName: row[0],
|
|
|
- SenderAddressPhone: row[1],
|
|
|
- SenderAddressDetails: row[2],
|
|
|
- //CustomerName: row[3],
|
|
|
+ Status: 1,
|
|
|
+ SenderAddressName: row[0],
|
|
|
+ SenderAddressPhone: row[1],
|
|
|
+ SenderAddressDetails: row[2],
|
|
|
ConsigneeAddressName: row[3],
|
|
|
ConsigneeAddressPhone: row[4],
|
|
|
ConsigneeAddressDetails: row[5],
|
|
|
- //TemperatureInterval: row[7],
|
|
|
- //DeliveryCondition: row[8],
|
|
|
- //CargoType: row[9],
|
|
|
- Quantity: quantity,
|
|
|
- TamperProofLabel: row[7], // 防拆标签
|
|
|
- Remark: row[8],
|
|
|
+ DeliveryName: row[6], // 防拆标签
|
|
|
+ DeliveryPhone: row[7], // 防拆标签
|
|
|
+ Quantity: quantity,
|
|
|
+ TamperProofLabel: row[9], // 防拆标签
|
|
|
+ Remark: row[10],
|
|
|
}
|
|
|
obj.SetDeptId(p.DeptId)
|
|
|
obj.SetCreateBy(user.GetUserId(c))
|