Commit b2d9fd3c authored by Menethil's avatar Menethil
Browse files

Merge remote-tracking branch 'origin/master'

parents e3bedf44 bc7231a6
...@@ -18,31 +18,37 @@ import java.util.Set; ...@@ -18,31 +18,37 @@ import java.util.Set;
@ControllerAdvice @ControllerAdvice
public class GlobalExceptionHandler { public class GlobalExceptionHandler {
@ExceptionHandler(IllegalArgumentException.class)
@ResponseBody
public Object badArgumentHandler(IllegalArgumentException e){
e.printStackTrace();
return ResponseUtil.badArgumentValue();
}
@ExceptionHandler(MethodArgumentTypeMismatchException.class) @ExceptionHandler(MethodArgumentTypeMismatchException.class)
@ResponseBody @ResponseBody
public Object argumentHandler(MethodArgumentTypeMismatchException e){ public Object badArgumentHandler(MethodArgumentTypeMismatchException e){
e.printStackTrace(); e.printStackTrace();
return ResponseUtil.badArgumentValue(); return ResponseUtil.badArgumentValue();
} }
@ExceptionHandler(MissingServletRequestParameterException.class) @ExceptionHandler(MissingServletRequestParameterException.class)
@ResponseBody @ResponseBody
public Object argumentHandler(MissingServletRequestParameterException e){ public Object badArgumentHandler(MissingServletRequestParameterException e){
e.printStackTrace(); e.printStackTrace();
return ResponseUtil.badArgumentValue(); return ResponseUtil.badArgumentValue();
} }
@ExceptionHandler(HttpMessageNotReadableException.class) @ExceptionHandler(HttpMessageNotReadableException.class)
@ResponseBody @ResponseBody
public Object httpMessageNotReadableHandler(HttpMessageNotReadableException e){ public Object badArgumentHandler(HttpMessageNotReadableException e){
e.printStackTrace(); e.printStackTrace();
return ResponseUtil.badArgumentValue(); return ResponseUtil.badArgumentValue();
} }
@ExceptionHandler(ValidationException.class) @ExceptionHandler(ValidationException.class)
@ResponseBody @ResponseBody
public Object handle(ValidationException e) { public Object badArgumentHandler(ValidationException e) {
e.printStackTrace(); e.printStackTrace();
if(e instanceof ConstraintViolationException){ if(e instanceof ConstraintViolationException){
ConstraintViolationException exs = (ConstraintViolationException) e; ConstraintViolationException exs = (ConstraintViolationException) e;
...@@ -57,7 +63,7 @@ public class GlobalExceptionHandler { ...@@ -57,7 +63,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class) @ExceptionHandler(Exception.class)
@ResponseBody @ResponseBody
public Object exceptionHandler(Exception e){ public Object seriousHandler(Exception e){
e.printStackTrace(); e.printStackTrace();
return ResponseUtil.serious(); return ResponseUtil.serious();
} }
......
...@@ -58,7 +58,7 @@ public class QiniuStorage implements Storage { ...@@ -58,7 +58,7 @@ public class QiniuStorage implements Storage {
} }
/** /**
* 阿里云OSS对象存储简单上传实现 * 七牛云OSS对象存储简单上传实现
*/ */
@Override @Override
public void store(InputStream inputStream, long contentLength, String contentType, String keyName) { public void store(InputStream inputStream, long contentLength, String contentType, String keyName) {
......
...@@ -21,7 +21,6 @@ public class StorageAutoConfiguration { ...@@ -21,7 +21,6 @@ public class StorageAutoConfiguration {
@Bean @Bean
public StorageService storageService() { public StorageService storageService() {
StorageService storageService = new StorageService(); StorageService storageService = new StorageService();
Map<String, Storage> supportedStorage = new HashMap<String, Storage>(3);
String active = this.properties.getActive(); String active = this.properties.getActive();
storageService.setActive(active); storageService.setActive(active);
if(active.equals("local")){ if(active.equals("local")){
...@@ -34,7 +33,7 @@ public class StorageAutoConfiguration { ...@@ -34,7 +33,7 @@ public class StorageAutoConfiguration {
storageService.setStorage(tencentStorage()); storageService.setStorage(tencentStorage());
} }
else if(active.equals("qiniu")){ else if(active.equals("qiniu")){
storageService.setStorage(tencentStorage()); storageService.setStorage(qiniuStorage());
} }
else{ else{
throw new RuntimeException("当前存储模式 " + active + " 不支持"); throw new RuntimeException("当前存储模式 " + active + " 不支持");
......
...@@ -14,6 +14,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -14,6 +14,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -140,6 +141,7 @@ public class WxCartController { ...@@ -140,6 +141,7 @@ public class WxCartController {
cart.setSpecifications(product.getSpecifications()); cart.setSpecifications(product.getSpecifications());
cart.setUserId(userId); cart.setUserId(userId);
cart.setChecked(true); cart.setChecked(true);
cart.setAddTime(LocalDateTime.now());
cartService.add(cart); cartService.add(cart);
} else { } else {
//取得规格的信息,判断规格库存 //取得规格的信息,判断规格库存
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment