|
@@ -16,8 +16,6 @@ import com.goafanti.common.dao.JtCommodityCommentMapper;
|
|
|
import com.goafanti.common.dao.JtConsultOrderMapper;
|
|
import com.goafanti.common.dao.JtConsultOrderMapper;
|
|
|
import com.goafanti.common.dao.JtOrderMapper;
|
|
import com.goafanti.common.dao.JtOrderMapper;
|
|
|
import com.goafanti.common.model.JtCommodityComment;
|
|
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.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
@@ -37,8 +35,10 @@ public class CommentServiceImpl extends BaseMybatisDao<JtCommodityCommentMapper>
|
|
|
String id=UUID.randomUUID().toString();
|
|
String id=UUID.randomUUID().toString();
|
|
|
String uid=TokenManager.getUserId();
|
|
String uid=TokenManager.getUserId();
|
|
|
// String uid="1180fa62-7c42-44be-bc41-5583814d69f4";
|
|
// String uid="1180fa62-7c42-44be-bc41-5583814d69f4";
|
|
|
- JtOrder jtOrder= new JtOrder();
|
|
|
|
|
|
|
|
|
|
|
|
+ //注释掉必须购买才能评价的条件
|
|
|
|
|
+ /*
|
|
|
|
|
+ JtOrder jtOrder= new JtOrder();
|
|
|
if (commentInput.getType()==0){
|
|
if (commentInput.getType()==0){
|
|
|
jtOrder=jtOrderMapper.selectByPrimaryKey(commentInput.getOrderNo());
|
|
jtOrder=jtOrderMapper.selectByPrimaryKey(commentInput.getOrderNo());
|
|
|
if(jtOrder==null || jtOrder.getBuyerId()==null || !jtOrder.getBuyerId().equals(uid))return -1;
|
|
if(jtOrder==null || jtOrder.getBuyerId()==null || !jtOrder.getBuyerId().equals(uid))return -1;
|
|
@@ -46,8 +46,8 @@ public class CommentServiceImpl extends BaseMybatisDao<JtCommodityCommentMapper>
|
|
|
if (commentInput.getType()==1){
|
|
if (commentInput.getType()==1){
|
|
|
JtConsultOrder jtConsultOrder=jtConsultOrderMapper.selectByPrimaryKey(commentInput.getOrderNo());
|
|
JtConsultOrder jtConsultOrder=jtConsultOrderMapper.selectByPrimaryKey(commentInput.getOrderNo());
|
|
|
if(jtConsultOrder==null || jtConsultOrder.getBuyerId()==null || !jtConsultOrder.getBuyerId().equals(uid))return -1;
|
|
if(jtConsultOrder==null || jtConsultOrder.getBuyerId()==null || !jtConsultOrder.getBuyerId().equals(uid))return -1;
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }*/
|
|
|
|
|
+
|
|
|
|
|
|
|
|
JtCommodityComment jtCommodityComment=new JtCommodityComment();
|
|
JtCommodityComment jtCommodityComment=new JtCommodityComment();
|
|
|
jtCommodityComment.setCommodityId(commentInput.getCommodityId());
|
|
jtCommodityComment.setCommodityId(commentInput.getCommodityId());
|
|
@@ -55,9 +55,14 @@ public class CommentServiceImpl extends BaseMybatisDao<JtCommodityCommentMapper>
|
|
|
jtCommodityComment.setCreateTime(new Date());
|
|
jtCommodityComment.setCreateTime(new Date());
|
|
|
jtCommodityComment.setId(id);
|
|
jtCommodityComment.setId(id);
|
|
|
jtCommodityComment.setIp(ip);
|
|
jtCommodityComment.setIp(ip);
|
|
|
- jtCommodityComment.setOrderNo(commentInput.getOrderNo());
|
|
|
|
|
jtCommodityComment.setStar(commentInput.getStar());
|
|
jtCommodityComment.setStar(commentInput.getStar());
|
|
|
|
|
+
|
|
|
|
|
+ //用户id和订单id如果不存在(匿名评论)
|
|
|
|
|
+ uid = null == uid ? "" : uid;
|
|
|
|
|
+ commentInput.setOrderNo( null == commentInput.getOrderNo()? "" : commentInput.getOrderNo());
|
|
|
|
|
+
|
|
|
jtCommodityComment.setUid(uid);
|
|
jtCommodityComment.setUid(uid);
|
|
|
|
|
+ jtCommodityComment.setOrderNo(commentInput.getOrderNo());
|
|
|
jtCommodityCommentMapper.insert(jtCommodityComment);
|
|
jtCommodityCommentMapper.insert(jtCommodityComment);
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|