Commit 6679a92cb153f25a934df144d57bac05e34f6696

Authored by guzijian
1 parent 06052483

feat: 新增上传文件

trash-garbage/src/main/java/com/trash/garbage/controller/GarbageOrderController.java
1 1 package com.trash.garbage.controller;
2 2  
3 3  
  4 +import com.trash.common.config.trashConfig;
  5 +import com.trash.common.utils.file.FileUploadUtils;
  6 +import com.trash.framework.config.ServerConfig;
  7 +import com.trash.garbage.custom.BizException;
4 8 import com.trash.garbage.global.Result;
  9 +import com.trash.garbage.global.ResultCode;
5 10 import com.trash.garbage.pojo.dto.OrderDto;
6 11 import com.trash.garbage.service.GarOrderService;
7 12 import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.web.bind.annotation.PostMapping;
9   -import org.springframework.web.bind.annotation.RequestBody;
10   -import org.springframework.web.bind.annotation.RequestMapping;
11   -import org.springframework.web.bind.annotation.RestController;
  13 +import org.springframework.web.bind.annotation.*;
  14 +import org.springframework.web.multipart.MultipartFile;
  15 +
  16 +import java.io.IOException;
12 17  
13 18 /**
14 19 * 订单控制
  20 + *
15 21 * @author 20412
16 22 */
17 23 @RestController
... ... @@ -20,10 +26,26 @@ public class GarbageOrderController {
20 26  
21 27 @Autowired
22 28 private GarOrderService garOrderService;
  29 + @Autowired
  30 + private ServerConfig serverConfig;
23 31  
24 32 @PostMapping("/add")
25   - public Result<?> saveOrder(@RequestBody OrderDto dto){
  33 + public Result<?> saveOrder(@RequestBody OrderDto dto) {
26 34 return Result.OK(garOrderService.saveOrder(dto));
27 35 }
28 36  
  37 + @RequestMapping("upload")
  38 + public Result<?> uploadFile(@RequestParam("file") MultipartFile file) {
  39 + String fileName = null;
  40 + try { // 上传文件路径
  41 + String filePath = trashConfig.getUploadPath();
  42 + // 上传并返回新文件名称
  43 + fileName = FileUploadUtils.upload(filePath, file);
  44 + } catch (IOException e) {
  45 + throw new BizException(ResultCode.CODE_400, ResultCode.CODE_400.getMsg());
  46 + }
  47 + String url = serverConfig.getUrl() + fileName;
  48 + return Result.OK("图片上传成功", url);
  49 + }
  50 +
29 51 }
... ...
trash-garbage/src/main/java/com/trash/garbage/custom/BizException.java
... ... @@ -12,7 +12,7 @@ public class BizException extends RuntimeException{
12 12 private ResultCode code;
13 13  
14 14 public BizException(ResultCode code, String msg){
15   - this.msg = msg;
16 15 this.code = code;
  16 + this.msg = msg;
17 17 }
18 18 }
... ...
trash-garbage/src/main/java/com/trash/garbage/global/GlobalStatus.java
... ... @@ -57,7 +57,7 @@ public class GlobalStatus {
57 57 }
58 58  
59 59 /**
60   - * 字典
  60 + * 地址
61 61 */
62 62 public enum GarAddressStatus {
63 63 NORMAL_ADDRESS(0, "地址"),
... ... @@ -78,6 +78,36 @@ public class GlobalStatus {
78 78 public String getDescription() {
79 79 return this.description;
80 80 }
  81 + }
  82 +
  83 + /**
  84 + * 订单
  85 + */
  86 + public enum GarOrderStatus {
  87 + NEW_ORDER(0, "新订单"),
  88 + HANDLE_ORDER(1, "被接单"),
  89 + ACTIVE_ORDER(2, "处理中"),
  90 + SUCCESS_ORDER(3, "完成订单"),
  91 + FAIL_ORDER(4, "订单处理失败"),
  92 + CANCEL_FLAG_NO(0,"未取消订单"),
  93 + IMAGE_TYPE_CURRENT(0,"现场图片"),
  94 + IMAGE_TYPE_PUT_ON(1,"装车图片"),
  95 + IMAGE_TYPE_PUT_DOWN(2,"卸车图片");
  96 +
  97 + GarOrderStatus(Integer status, String description) {
  98 + this.status = status;
  99 + this.description = description;
  100 + }
  101 +
  102 + private String description;
  103 + private Integer status;
81 104  
  105 + public Integer getValue() {
  106 + return this.status;
  107 + }
  108 +
  109 + public String getDescription() {
  110 + return this.description;
  111 + }
82 112 }
83 113 }
... ...
trash-garbage/src/main/java/com/trash/garbage/pojo/domain/GarAddress.java
... ... @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
7 7  
8 8 import java.io.Serializable;
9 9 import java.util.Date;
  10 +import java.util.Objects;
10 11  
11 12 import com.fasterxml.jackson.annotation.JsonFormat;
12 13 import lombok.Data;
... ... @@ -72,65 +73,11 @@ public class GarAddress implements Serializable {
72 73 */
73 74 private String garRemark;
74 75  
  76 +
  77 +
  78 +
75 79 @TableField(exist = false)
76 80 private static final long serialVersionUID = 1L;
77 81  
78   - @Override
79   - public boolean equals(Object that) {
80   - if (this == that) {
81   - return true;
82   - }
83   - if (that == null) {
84   - return false;
85   - }
86   - if (getClass() != that.getClass()) {
87   - return false;
88   - }
89   - GarAddress other = (GarAddress) that;
90   - return (this.getGarAddressId() == null ? other.getGarAddressId() == null : this.getGarAddressId().equals(other.getGarAddressId()))
91   - && (this.getGarUserId() == null ? other.getGarUserId() == null : this.getGarUserId().equals(other.getGarUserId()))
92   - && (this.getGarUserAddress() == null ? other.getGarUserAddress() == null : this.getGarUserAddress().equals(other.getGarUserAddress()))
93   - && (this.getGarUserDefault() == null ? other.getGarUserDefault() == null : this.getGarUserDefault().equals(other.getGarUserDefault()))
94   - && (this.getGarCreateTime() == null ? other.getGarCreateTime() == null : this.getGarCreateTime().equals(other.getGarCreateTime()))
95   - && (this.getGarUpdateTime() == null ? other.getGarUpdateTime() == null : this.getGarUpdateTime().equals(other.getGarUpdateTime()))
96   - && (this.getGarUserContactName() == null ? other.getGarUserContactName() == null : this.getGarUserContactName().equals(other.getGarUserContactName()))
97   - && (this.getGarUserContactTel() == null ? other.getGarUserContactTel() == null : this.getGarUserContactTel().equals(other.getGarUserContactTel()))
98   - && (this.getGarRemark() == null ? other.getGarRemark() == null : this.getGarRemark().equals(other.getGarRemark()));
99   - }
100   -
101   - @Override
102   - public int hashCode() {
103   - final int prime = 31;
104   - int result = 1;
105   - result = prime * result + ((getGarAddressId() == null) ? 0 : getGarAddressId().hashCode());
106   - result = prime * result + ((getGarUserId() == null) ? 0 : getGarUserId().hashCode());
107   - result = prime * result + ((getGarUserAddress() == null) ? 0 : getGarUserAddress().hashCode());
108   - result = prime * result + ((getGarUserDefault() == null) ? 0 : getGarUserDefault().hashCode());
109   - result = prime * result + ((getGarCreateTime() == null) ? 0 : getGarCreateTime().hashCode());
110   - result = prime * result + ((getGarUpdateTime() == null) ? 0 : getGarUpdateTime().hashCode());
111   - result = prime * result + ((getGarUserContactName() == null) ? 0 : getGarUserContactName().hashCode());
112   - result = prime * result + ((getGarUserContactTel() == null) ? 0 : getGarUserContactTel().hashCode());
113   - result = prime * result + ((getGarRemark() == null) ? 0 : getGarRemark().hashCode());
114   - return result;
115   - }
116   -
117   - @Override
118   - public String toString() {
119   - StringBuilder sb = new StringBuilder();
120   - sb.append(getClass().getSimpleName());
121   - sb.append(" [");
122   - sb.append("Hash = ").append(hashCode());
123   - sb.append(", garAddressId=").append(garAddressId);
124   - sb.append(", garUserId=").append(garUserId);
125   - sb.append(", garUserAddress=").append(garUserAddress);
126   - sb.append(", garUserDefault=").append(garUserDefault);
127   - sb.append(", garCreateTime=").append(garCreateTime);
128   - sb.append(", garUpdateTime=").append(garUpdateTime);
129   - sb.append(", garUserContactName=").append(garUserContactName);
130   - sb.append(", garUserContactTel=").append(garUserContactTel);
131   - sb.append(", garRemark=").append(garRemark);
132   - sb.append(", serialVersionUID=").append(serialVersionUID);
133   - sb.append("]");
134   - return sb.toString();
135   - }
  82 +
136 83 }
... ...
trash-garbage/src/main/java/com/trash/garbage/pojo/domain/GarOrder.java
... ... @@ -111,93 +111,17 @@ public class GarOrder implements Serializable {
111 111 * 备注
112 112 */
113 113 private String garRemark;
  114 + /**
  115 + * 取消标识
  116 + */
  117 + private Integer garCancelFlag;
  118 + /**
  119 + * 原因
  120 + */
  121 + private String garReason;
  122 +
114 123  
115 124 @TableField(exist = false)
116 125 private static final long serialVersionUID = 1L;
117 126  
118   - @Override
119   - public boolean equals(Object that) {
120   - if (this == that) {
121   - return true;
122   - }
123   - if (that == null) {
124   - return false;
125   - }
126   - if (getClass() != that.getClass()) {
127   - return false;
128   - }
129   - GarOrder other = (GarOrder) that;
130   - return (this.getGarOrderId() == null ? other.getGarOrderId() == null : this.getGarOrderId().equals(other.getGarOrderId()))
131   - && (this.getGarOrderUserId() == null ? other.getGarOrderUserId() == null : this.getGarOrderUserId().equals(other.getGarOrderUserId()))
132   - && (this.getGarOrderHandlerId() == null ? other.getGarOrderHandlerId() == null : this.getGarOrderHandlerId().equals(other.getGarOrderHandlerId()))
133   - && (this.getGarOrderAddress() == null ? other.getGarOrderAddress() == null : this.getGarOrderAddress().equals(other.getGarOrderAddress()))
134   - && (this.getGarOrderAddressDetails() == null ? other.getGarOrderAddressDetails() == null : this.getGarOrderAddressDetails().equals(other.getGarOrderAddressDetails()))
135   - && (this.getGarOrderContactName() == null ? other.getGarOrderContactName() == null : this.getGarOrderContactName().equals(other.getGarOrderContactName()))
136   - && (this.getGarOrderTrashType() == null ? other.getGarOrderTrashType() == null : this.getGarOrderTrashType().equals(other.getGarOrderTrashType()))
137   - && (this.getGarOrderContactTel() == null ? other.getGarOrderContactTel() == null : this.getGarOrderContactTel().equals(other.getGarOrderContactTel()))
138   - && (this.getGarOrderCompanyId() == null ? other.getGarOrderCompanyId() == null : this.getGarOrderCompanyId().equals(other.getGarOrderCompanyId()))
139   - && (this.getGarOrderCompanyName() == null ? other.getGarOrderCompanyName() == null : this.getGarOrderCompanyName().equals(other.getGarOrderCompanyName()))
140   - && (this.getGarOrderCompanyTel() == null ? other.getGarOrderCompanyTel() == null : this.getGarOrderCompanyTel().equals(other.getGarOrderCompanyTel()))
141   - && (this.getGarOrderHandlerStatus() == null ? other.getGarOrderHandlerStatus() == null : this.getGarOrderHandlerStatus().equals(other.getGarOrderHandlerStatus()))
142   - && (this.getGarOrderAgreementTime() == null ? other.getGarOrderAgreementTime() == null : this.getGarOrderAgreementTime().equals(other.getGarOrderAgreementTime()))
143   - && (this.getGarCreateTime() == null ? other.getGarCreateTime() == null : this.getGarCreateTime().equals(other.getGarCreateTime()))
144   - && (this.getGarUpdateTime() == null ? other.getGarUpdateTime() == null : this.getGarUpdateTime().equals(other.getGarUpdateTime()))
145   - && (this.getGarCreateBy() == null ? other.getGarCreateBy() == null : this.getGarCreateBy().equals(other.getGarCreateBy()))
146   - && (this.getGarUpdateBy() == null ? other.getGarUpdateBy() == null : this.getGarUpdateBy().equals(other.getGarUpdateBy()))
147   - && (this.getGarRemark() == null ? other.getGarRemark() == null : this.getGarRemark().equals(other.getGarRemark()));
148   - }
149   -
150   - @Override
151   - public int hashCode() {
152   - final int prime = 31;
153   - int result = 1;
154   - result = prime * result + ((getGarOrderId() == null) ? 0 : getGarOrderId().hashCode());
155   - result = prime * result + ((getGarOrderUserId() == null) ? 0 : getGarOrderUserId().hashCode());
156   - result = prime * result + ((getGarOrderHandlerId() == null) ? 0 : getGarOrderHandlerId().hashCode());
157   - result = prime * result + ((getGarOrderAddress() == null) ? 0 : getGarOrderAddress().hashCode());
158   - result = prime * result + ((getGarOrderAddressDetails() == null) ? 0 : getGarOrderAddressDetails().hashCode());
159   - result = prime * result + ((getGarOrderContactName() == null) ? 0 : getGarOrderContactName().hashCode());
160   - result = prime * result + ((getGarOrderTrashType() == null) ? 0 : getGarOrderTrashType().hashCode());
161   - result = prime * result + ((getGarOrderContactTel() == null) ? 0 : getGarOrderContactTel().hashCode());
162   - result = prime * result + ((getGarOrderCompanyId() == null) ? 0 : getGarOrderCompanyId().hashCode());
163   - result = prime * result + ((getGarOrderCompanyName() == null) ? 0 : getGarOrderCompanyName().hashCode());
164   - result = prime * result + ((getGarOrderCompanyTel() == null) ? 0 : getGarOrderCompanyTel().hashCode());
165   - result = prime * result + ((getGarOrderHandlerStatus() == null) ? 0 : getGarOrderHandlerStatus().hashCode());
166   - result = prime * result + ((getGarOrderAgreementTime() == null) ? 0 : getGarOrderAgreementTime().hashCode());
167   - result = prime * result + ((getGarCreateTime() == null) ? 0 : getGarCreateTime().hashCode());
168   - result = prime * result + ((getGarUpdateTime() == null) ? 0 : getGarUpdateTime().hashCode());
169   - result = prime * result + ((getGarCreateBy() == null) ? 0 : getGarCreateBy().hashCode());
170   - result = prime * result + ((getGarUpdateBy() == null) ? 0 : getGarUpdateBy().hashCode());
171   - result = prime * result + ((getGarRemark() == null) ? 0 : getGarRemark().hashCode());
172   - return result;
173   - }
174   -
175   - @Override
176   - public String toString() {
177   - StringBuilder sb = new StringBuilder();
178   - sb.append(getClass().getSimpleName());
179   - sb.append(" [");
180   - sb.append("Hash = ").append(hashCode());
181   - sb.append(", garOrderId=").append(garOrderId);
182   - sb.append(", garOrderUserId=").append(garOrderUserId);
183   - sb.append(", garOrderHandleId=").append(garOrderHandlerId);
184   - sb.append(", garOrderAddress=").append(garOrderAddress);
185   - sb.append(", garOrderAddressDetails=").append(garOrderAddressDetails);
186   - sb.append(", garOrderContactName=").append(garOrderContactName);
187   - sb.append(", garOrderTrashType=").append(garOrderTrashType);
188   - sb.append(", garOrderContactTel=").append(garOrderContactTel);
189   - sb.append(", garOrderCompanyId=").append(garOrderCompanyId);
190   - sb.append(", garOrderCompanyName=").append(garOrderCompanyName);
191   - sb.append(", garOrderCompanyTel=").append(garOrderCompanyTel);
192   - sb.append(", garOrderHanderStatus=").append(garOrderHandlerStatus);
193   - sb.append(", garOrderAgreementTime=").append(garOrderAgreementTime);
194   - sb.append(", garCreateTime=").append(garCreateTime);
195   - sb.append(", garUpdateTime=").append(garUpdateTime);
196   - sb.append(", garCreateBy=").append(garCreateBy);
197   - sb.append(", garUpdateBy=").append(garUpdateBy);
198   - sb.append(", garRemark=").append(garRemark);
199   - sb.append(", serialVersionUID=").append(serialVersionUID);
200   - sb.append("]");
201   - return sb.toString();
202   - }
203 127 }
204 128 \ No newline at end of file
... ...
trash-garbage/src/main/java/com/trash/garbage/pojo/domain/GarOrderImage.java
... ... @@ -72,62 +72,4 @@ public class GarOrderImage implements Serializable {
72 72 @TableField(exist = false)
73 73 private static final long serialVersionUID = 1L;
74 74  
75   - @Override
76   - public boolean equals(Object that) {
77   - if (this == that) {
78   - return true;
79   - }
80   - if (that == null) {
81   - return false;
82   - }
83   - if (getClass() != that.getClass()) {
84   - return false;
85   - }
86   - GarOrderImage other = (GarOrderImage) that;
87   - return (this.getGarImageId() == null ? other.getGarImageId() == null : this.getGarImageId().equals(other.getGarImageId()))
88   - && (this.getGarOrderId() == null ? other.getGarOrderId() == null : this.getGarOrderId().equals(other.getGarOrderId()))
89   - && (this.getGarOrderImageType() == null ? other.getGarOrderImageType() == null : this.getGarOrderImageType().equals(other.getGarOrderImageType()))
90   - && (this.getGarOrderImageUrl() == null ? other.getGarOrderImageUrl() == null : this.getGarOrderImageUrl().equals(other.getGarOrderImageUrl()))
91   - && (this.getGarCreateTime() == null ? other.getGarCreateTime() == null : this.getGarCreateTime().equals(other.getGarCreateTime()))
92   - && (this.getGarUpdateTime() == null ? other.getGarUpdateTime() == null : this.getGarUpdateTime().equals(other.getGarUpdateTime()))
93   - && (this.getGarCreateBy() == null ? other.getGarCreateBy() == null : this.getGarCreateBy().equals(other.getGarCreateBy()))
94   - && (this.getGarUpdateBy() == null ? other.getGarUpdateBy() == null : this.getGarUpdateBy().equals(other.getGarUpdateBy()))
95   - && (this.getGarRemark() == null ? other.getGarRemark() == null : this.getGarRemark().equals(other.getGarRemark()));
96   - }
97   -
98   - @Override
99   - public int hashCode() {
100   - final int prime = 31;
101   - int result = 1;
102   - result = prime * result + ((getGarImageId() == null) ? 0 : getGarImageId().hashCode());
103   - result = prime * result + ((getGarOrderId() == null) ? 0 : getGarOrderId().hashCode());
104   - result = prime * result + ((getGarOrderImageType() == null) ? 0 : getGarOrderImageType().hashCode());
105   - result = prime * result + ((getGarOrderImageUrl() == null) ? 0 : getGarOrderImageUrl().hashCode());
106   - result = prime * result + ((getGarCreateTime() == null) ? 0 : getGarCreateTime().hashCode());
107   - result = prime * result + ((getGarUpdateTime() == null) ? 0 : getGarUpdateTime().hashCode());
108   - result = prime * result + ((getGarCreateBy() == null) ? 0 : getGarCreateBy().hashCode());
109   - result = prime * result + ((getGarUpdateBy() == null) ? 0 : getGarUpdateBy().hashCode());
110   - result = prime * result + ((getGarRemark() == null) ? 0 : getGarRemark().hashCode());
111   - return result;
112   - }
113   -
114   - @Override
115   - public String toString() {
116   - StringBuilder sb = new StringBuilder();
117   - sb.append(getClass().getSimpleName());
118   - sb.append(" [");
119   - sb.append("Hash = ").append(hashCode());
120   - sb.append(", garImageId=").append(garImageId);
121   - sb.append(", garOrderId=").append(garOrderId);
122   - sb.append(", garOrderImageType=").append(garOrderImageType);
123   - sb.append(", garOrderImageUrl=").append(garOrderImageUrl);
124   - sb.append(", garCreateTime=").append(garCreateTime);
125   - sb.append(", garUpdateTime=").append(garUpdateTime);
126   - sb.append(", garCreateBy=").append(garCreateBy);
127   - sb.append(", garUpdateBy=").append(garUpdateBy);
128   - sb.append(", garRemark=").append(garRemark);
129   - sb.append(", serialVersionUID=").append(serialVersionUID);
130   - sb.append("]");
131   - return sb.toString();
132   - }
133 75 }
134 76 \ No newline at end of file
... ...
trash-garbage/src/main/java/com/trash/garbage/pojo/domain/GarUser.java
... ... @@ -71,63 +71,4 @@ public class GarUser implements Serializable {
71 71 @TableField(exist = false)
72 72 private static final long serialVersionUID = 1L;
73 73  
74   - @Override
75   - public boolean equals(Object that) {
76   - if (this == that) {
77   - return true;
78   - }
79   - if (that == null) {
80   - return false;
81   - }
82   - if (getClass() != that.getClass()) {
83   - return false;
84   - }
85   - GarUser other = (GarUser) that;
86   - return (this.getGarUserId() == null ? other.getGarUserId() == null : this.getGarUserId().equals(other.getGarUserId()))
87   - && (this.getGarUserTel() == null ? other.getGarUserTel() == null : this.getGarUserTel().equals(other.getGarUserTel()))
88   - && (this.getGarUserName() == null ? other.getGarUserName() == null : this.getGarUserName().equals(other.getGarUserName()))
89   - && (this.getGarUserType() == null ? other.getGarUserType() == null : this.getGarUserType().equals(other.getGarUserType()))
90   - && (this.getGarUserCarNum() == null ? other.getGarUserCarNum() == null : this.getGarUserCarNum().equals(other.getGarUserCarNum()))
91   - && (this.getGarUserDelFlag() == null ? other.getGarUserDelFlag() == null : this.getGarUserDelFlag().equals(other.getGarUserDelFlag()))
92   - && (this.getGarCreateTime() == null ? other.getGarCreateTime() == null : this.getGarCreateTime().equals(other.getGarCreateTime()))
93   - && (this.getGarUpdateTime() == null ? other.getGarUpdateTime() == null : this.getGarUpdateTime().equals(other.getGarUpdateTime()))
94   - && (this.getGarRemark() == null ? other.getGarRemark() == null : this.getGarRemark().equals(other.getGarRemark()));
95   - }
96   -
97   - @Override
98   - public int hashCode() {
99   - final int prime = 31;
100   - int result = 1;
101   - result = prime * result + ((getGarUserId() == null) ? 0 : getGarUserId().hashCode());
102   - result = prime * result + ((getGarUserTel() == null) ? 0 : getGarUserTel().hashCode());
103   - result = prime * result + ((getGarUserName() == null) ? 0 : getGarUserName().hashCode());
104   - result = prime * result + ((getGarUserType() == null) ? 0 : getGarUserType().hashCode());
105   - result = prime * result + ((getGarUserCarNum() == null) ? 0 : getGarUserCarNum().hashCode());
106   - result = prime * result + ((getGarUserDelFlag() == null) ? 0 : getGarUserDelFlag().hashCode());
107   - result = prime * result + ((getGarCreateTime() == null) ? 0 : getGarCreateTime().hashCode());
108   - result = prime * result + ((getGarUpdateTime() == null) ? 0 : getGarUpdateTime().hashCode());
109   - result = prime * result + ((getGarRemark() == null) ? 0 : getGarRemark().hashCode());
110   - return result;
111   - }
112   -
113   - @Override
114   - public String toString() {
115   - StringBuilder sb = new StringBuilder();
116   - sb.append(getClass().getSimpleName());
117   - sb.append(" [");
118   - sb.append("Hash = ").append(hashCode());
119   - sb.append(", garUserId=").append(garUserId);
120   - sb.append(", garUserTel=").append(garUserTel);
121   - sb.append(", garUserName=").append(garUserName);
122   - sb.append(", garUserType=").append(garUserType);
123   - sb.append(", garUserCarNum=").append(garUserCarNum);
124   - sb.append(", garUserDelFlag=").append(garUserDelFlag);
125   - sb.append(", garCreateTime=").append(garCreateTime);
126   - sb.append(", garUpdateTime=").append(garUpdateTime);
127   - sb.append(", garRemark=").append(garRemark);
128   - sb.append(", serialVersionUID=").append(serialVersionUID);
129   - sb.append("]");
130   - return sb.toString();
131   - }
132   -
133 74 }
134 75 \ No newline at end of file
... ...
trash-garbage/src/main/java/com/trash/garbage/pojo/dto/OrderDto.java
... ... @@ -3,28 +3,23 @@ package com.trash.garbage.pojo.dto;
3 3 import com.baomidou.mybatisplus.annotation.TableId;
4 4 import lombok.Data;
5 5  
  6 +import java.util.List;
  7 +
6 8 /**
7 9 * 新增订单dto
8 10 * @author 20412
9 11 */
10 12 @Data
11 13 public class OrderDto {
12   - /**
13   - * 订单id
14   - */
15   - @TableId
16   - private String garOrderId;
17   -
18   - /**
19   - * 负责处理人id
20   - */
21   - private String garOrderHandleId;
22 14  
23 15 /**
24 16 * 订单地址
25 17 */
26 18 private String garOrderAddress;
27   -
  19 + /**
  20 + * 图片列表
  21 + */
  22 + private List<String> imageUrls;
28 23 /**
29 24 * 订单详细地址
30 25 */
... ...
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
... ... @@ -3,11 +3,15 @@ package com.trash.garbage.service.impl;
3 3 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 4 import com.trash.common.utils.SecurityUtils;
5 5 import com.trash.common.utils.bean.BeanUtils;
  6 +import com.trash.garbage.global.GlobalStatus;
6 7 import com.trash.garbage.pojo.domain.GarOrder;
7 8 import com.trash.garbage.pojo.dto.OrderDto;
  9 +import com.trash.garbage.service.GarOrderImageService;
8 10 import com.trash.garbage.service.GarOrderService;
9 11 import com.trash.garbage.mapper.GarOrderMapper;
  12 +import org.springframework.beans.factory.annotation.Autowired;
10 13 import org.springframework.stereotype.Service;
  14 +import org.springframework.transaction.annotation.Transactional;
11 15  
12 16 /**
13 17 * @author 20412
... ... @@ -18,13 +22,23 @@ import org.springframework.stereotype.Service;
18 22 public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder>
19 23 implements GarOrderService {
20 24  
  25 +
  26 + @Autowired
  27 + private GarOrderImageService garOrderImageService;
  28 +
21 29 @Override
  30 + @Transactional(rollbackFor = Exception.class)
22 31 public String saveOrder(OrderDto dto) {
23 32 String userId = SecurityUtils.getLoginUser().getUser().getUserId();
24 33 GarOrder order = new GarOrder();
25 34 BeanUtils.copyBeanProp(order, dto);
26 35 order.setGarOrderUserId(userId);
  36 + order.setGarOrderHandlerStatus(GlobalStatus.GarOrderStatus.NEW_ORDER.getValue());
  37 + order.setGarCancelFlag(GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue());
27 38 save(order);
  39 + // 保存图片url
  40 +
  41 +// garOrderImageService.save();
28 42 return "订单创建成功";
29 43 }
30 44 }
... ...
trash-garbage/src/main/resources/mapper/GarOrderMapper.xml
... ... @@ -5,32 +5,35 @@
5 5 <mapper namespace="com.trash.garbage.mapper.GarOrderMapper">
6 6  
7 7 <resultMap id="BaseResultMap" type="com.trash.garbage.pojo.domain.GarOrder">
8   - <id property="garOrderId" column="gar_order_id" jdbcType="VARCHAR"/>
9   - <result property="garOrderUserId" column="gar_order_user_id" jdbcType="VARCHAR"/>
10   - <result property="garOrderHandlerId" column="gar_order_handler_id" jdbcType="VARCHAR"/>
11   - <result property="garOrderAddress" column="gar_order_address" jdbcType="VARCHAR"/>
12   - <result property="garOrderAddressDetails" column="gar_order_address_details" jdbcType="VARCHAR"/>
13   - <result property="garOrderContactName" column="gar_order_contact_name" jdbcType="VARCHAR"/>
14   - <result property="garOrderTrashType" column="gar_order_trash_type" jdbcType="VARCHAR"/>
15   - <result property="garOrderContactTel" column="gar_order_contact_tel" jdbcType="VARCHAR"/>
16   - <result property="garOrderCompanyId" column="gar_order_company_id" jdbcType="VARCHAR"/>
17   - <result property="garOrderCompanyName" column="gar_order_company_name" jdbcType="VARCHAR"/>
18   - <result property="garOrderCompanyTel" column="gar_order_company_tel" jdbcType="VARCHAR"/>
19   - <result property="garOrderHandlerStatus" column="gar_order_handler_status" jdbcType="INTEGER"/>
20   - <result property="garOrderAgreementTime" column="gar_order_agreement_time" jdbcType="VARCHAR"/>
21   - <result property="garCreateTime" column="gar_create_time" jdbcType="TIMESTAMP"/>
22   - <result property="garUpdateTime" column="gar_update_time" jdbcType="TIMESTAMP"/>
23   - <result property="garCreateBy" column="gar_create_by" jdbcType="VARCHAR"/>
24   - <result property="garUpdateBy" column="gar_update_by" jdbcType="VARCHAR"/>
25   - <result property="garRemark" column="gar_remark" jdbcType="VARCHAR"/>
  8 + <id property="garOrderId" column="gar_order_id" jdbcType="VARCHAR"/>
  9 + <result property="garOrderUserId" column="gar_order_user_id" jdbcType="VARCHAR"/>
  10 + <result property="garOrderHandlerId" column="gar_order_handler_id" jdbcType="VARCHAR"/>
  11 + <result property="garOrderAddress" column="gar_order_address" jdbcType="VARCHAR"/>
  12 + <result property="garOrderAddressDetails" column="gar_order_address_details" jdbcType="VARCHAR"/>
  13 + <result property="garOrderContactName" column="gar_order_contact_name" jdbcType="VARCHAR"/>
  14 + <result property="garOrderTrashType" column="gar_order_trash_type" jdbcType="VARCHAR"/>
  15 + <result property="garOrderContactTel" column="gar_order_contact_tel" jdbcType="VARCHAR"/>
  16 + <result property="garOrderCompanyId" column="gar_order_company_id" jdbcType="VARCHAR"/>
  17 + <result property="garOrderCompanyName" column="gar_order_company_name" jdbcType="VARCHAR"/>
  18 + <result property="garOrderCompanyTel" column="gar_order_company_tel" jdbcType="VARCHAR"/>
  19 + <result property="garOrderHandlerStatus" column="gar_order_handler_status" jdbcType="INTEGER"/>
  20 + <result property="garOrderAgreementTime" column="gar_order_agreement_time" jdbcType="VARCHAR"/>
  21 + <result property="garCreateTime" column="gar_create_time" jdbcType="TIMESTAMP"/>
  22 + <result property="garUpdateTime" column="gar_update_time" jdbcType="TIMESTAMP"/>
  23 + <result property="garCreateBy" column="gar_create_by" jdbcType="VARCHAR"/>
  24 + <result property="garUpdateBy" column="gar_update_by" jdbcType="VARCHAR"/>
  25 + <result property="garRemark" column="gar_remark" jdbcType="VARCHAR"/>
  26 + <result property="garReason" column="gar_reason" jdbcType="VARCHAR"/>
  27 + <result property="garCancelFlag" column="gar_cancel_flag" jdbcType="TINYINT"/>
26 28 </resultMap>
27 29  
28 30 <sql id="Base_Column_List">
29   - gar_order_id,gar_order_user_id,gar_order_handle_id,
  31 + gar_order_id
  32 + ,gar_order_user_id,gar_order_handle_id,
30 33 gar_order_address,gar_order_address_details,gar_order_contact_name,
31 34 gar_order_trash_type,gar_order_contact_tel,gar_order_company_id,
32 35 gar_order_company_name,gar_order_company_tel,gar_order_hander_status,
33 36 gar_order_agreement_time,gar_create_time,gar_update_time,
34   - gar_create_by,gar_update_by,gar_remark
  37 + gar_create_by,gar_update_by,gar_remark,gar_reason,gar_cancel_flag
35 38 </sql>
36 39 </mapper>
... ...