Selaa lähdekoodia

提交评价专家、顾问修改

anderx 7 vuotta sitten
vanhempi
commit
7ff2f5711f

+ 11 - 3
src/main/java/com/goafanti/comment/bo/CommentInput.java

@@ -2,9 +2,10 @@ package com.goafanti.comment.bo;
 
 public class CommentInput {
 	private String commodityId;
-private String content;
-private Integer star;
-private String orderNo;
+	private String content;
+	private Integer star;
+	private String orderNo;
+	private Integer type;//项目 0  顾问、专家 1
 public String getCommodityId() {
 	return commodityId;
 }
@@ -30,4 +31,11 @@ public void setOrderNo(String orderNo) {
 	this.orderNo = orderNo;
 }
 
+public Integer getType() {
+	return type;
+}
+public void setType(Integer type) {
+	this.type = type;
+}
+
 }

+ 16 - 2
src/main/java/com/goafanti/comment/service/impl/CommentServiceImpl.java

@@ -13,8 +13,10 @@ import com.goafanti.comment.bo.CommentDetailResult;
 import com.goafanti.comment.bo.CommentInput;
 import com.goafanti.comment.service.CommentService;
 import com.goafanti.common.dao.JtCommodityCommentMapper;
+import com.goafanti.common.dao.JtConsultOrderMapper;
 import com.goafanti.common.dao.JtOrderMapper;
 import com.goafanti.common.model.JtCommodityComment;
+import com.goafanti.common.model.JtConsultOrder;
 import com.goafanti.common.model.JtOrder;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -25,6 +27,8 @@ public class CommentServiceImpl extends BaseMybatisDao<JtCommodityCommentMapper>
 	@Autowired
 	JtCommodityCommentMapper jtCommodityCommentMapper;
 	@Autowired
+	JtConsultOrderMapper	jtConsultOrderMapper;
+	@Autowired
 	JtOrderMapper jtOrderMapper;
 
 	@Override
@@ -33,8 +37,18 @@ public class CommentServiceImpl extends BaseMybatisDao<JtCommodityCommentMapper>
 		String id=UUID.randomUUID().toString();
 		String uid=TokenManager.getUserId();
 //		String uid="1180fa62-7c42-44be-bc41-5583814d69f4";
-		JtOrder jtOrder=jtOrderMapper.selectByPrimaryKey(commentInput.getOrderNo());
-		if(jtOrder==null || jtOrder.getBuyerId()==null || !jtOrder.getBuyerId().equals(uid))return -1;
+		JtOrder jtOrder= new JtOrder(); 
+		
+		if (commentInput.getType()==0){
+			jtOrder=jtOrderMapper.selectByPrimaryKey(commentInput.getOrderNo());
+			if(jtOrder==null || jtOrder.getBuyerId()==null || !jtOrder.getBuyerId().equals(uid))return -1;
+		}
+		if (commentInput.getType()==1){
+			JtConsultOrder jtConsultOrder=jtConsultOrderMapper.selectByPrimaryKey(commentInput.getOrderNo());
+			if(jtConsultOrder==null || jtConsultOrder.getBuyerId()==null || !jtConsultOrder.getBuyerId().equals(uid))return -1;
+		}
+			
+		
 		JtCommodityComment jtCommodityComment=new JtCommodityComment();
 		jtCommodityComment.setCommodityId(commentInput.getCommodityId());
 		jtCommodityComment.setContent(commentInput.getContent());