|
|
@@ -4,16 +4,21 @@ import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.goafanti.comment.bo.CommentInput;
|
|
|
+import com.goafanti.comment.controller.UserCommentController;
|
|
|
+import com.goafanti.comment.service.CommentService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.CertifyApiController;
|
|
|
import com.goafanti.order.enums.CommodityType;
|
|
|
+import com.goafanti.order.service.JtOrderService;
|
|
|
import com.goafanti.order.service.OrderService;
|
|
|
|
|
|
@RestController
|
|
|
@@ -22,6 +27,10 @@ public class AppOrderController extends CertifyApiController{
|
|
|
|
|
|
@Resource
|
|
|
private OrderService orderServiceImpl;
|
|
|
+ @Resource
|
|
|
+ private CommentService commentService;
|
|
|
+ @Resource
|
|
|
+ private JtOrderService jtOrderService;
|
|
|
/**
|
|
|
* 进入添加意向订单
|
|
|
* @param commodityId 商品编号
|
|
|
@@ -253,4 +262,46 @@ public class AppOrderController extends CertifyApiController{
|
|
|
orderServiceImpl.updateConfirmRefund(orderNo,confirm);
|
|
|
return res;
|
|
|
}
|
|
|
+ /*
|
|
|
+ * userType-----0-购买者 1-出售者 2-管理员
|
|
|
+ *
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/list",method = RequestMethod.GET)
|
|
|
+ public Result getMyJtOrderList(Integer orderType,String orderNo,String startCreateDate,String endCreateDate,String sellerName,String buyerName,String commodityName,Integer userType,Integer pageNo,Integer pageSize) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(userType==null || userType>1 || userType<0) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","用户类型错误"));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ result.setData(jtOrderService.searchOrderList(orderType,orderNo, startCreateDate, endCreateDate, sellerName, buyerName, commodityName, userType, pageNo, pageSize));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 新增评价
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/apply", method = RequestMethod.POST)
|
|
|
+ public Result addNewComment(HttpServletRequest request,CommentInput commentInput) {
|
|
|
+ Result result=new Result();
|
|
|
+ String ip=UserCommentController.getClientIp(request);
|
|
|
+ if(StringUtils.isBlank(commentInput.getCommodityId())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"商品id为空","商品id"));return result;
|
|
|
+ }
|
|
|
+ if(commentInput.getStar()==null || commentInput.getStar()<0 || commentInput.getStar()>5) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","评分"));return result;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(commentInput.getOrderNo())) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单编号"));return result;
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(commentInput.getContent()) || commentInput.getContent().length()>512) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","内容限制1-512字符"));return result;
|
|
|
+ }
|
|
|
+ int res=commentService.addNewComment(commentInput,ip);
|
|
|
+ if(res ==-1) {
|
|
|
+ result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","提交失败"));return result;
|
|
|
+ }
|
|
|
+ result.setData(res);
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|