|
|
@@ -16,6 +16,7 @@ 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.utils.StringUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
@@ -57,10 +58,19 @@ public class CommentServiceImpl extends BaseMybatisDao<JtCommodityCommentMapper>
|
|
|
jtCommodityComment.setIp(ip);
|
|
|
jtCommodityComment.setStar(commentInput.getStar());
|
|
|
|
|
|
- //用户id和订单id如果不存在(匿名评论)
|
|
|
- uid = null == uid ? "" : uid;
|
|
|
- commentInput.setOrderNo( null == commentInput.getOrderNo()? "" : commentInput.getOrderNo());
|
|
|
-
|
|
|
+ //用户id或者订单id如果不存在(匿名评论)
|
|
|
+ if(StringUtils.isBlank(commentInput.getOrderNo())){
|
|
|
+ commentInput.setOrderNo("");
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(uid)){
|
|
|
+ commentInput.setOrderNo("");
|
|
|
+ //查看当前ip的游客名称和游客最大名称
|
|
|
+ uid = jtCommodityCommentMapper.getUidByIp(ip);
|
|
|
+ if(StringUtils.isBlank(uid)){
|
|
|
+ int c = Integer.parseInt(jtCommodityCommentMapper.getMaxNameUid()) + 1;
|
|
|
+ uid = "游客" + String.format("%03d", c);
|
|
|
+ }
|
|
|
+ }
|
|
|
jtCommodityComment.setUid(uid);
|
|
|
jtCommodityComment.setOrderNo(commentInput.getOrderNo());
|
|
|
jtCommodityCommentMapper.insert(jtCommodityComment);
|
|
|
@@ -95,6 +105,15 @@ public class CommentServiceImpl extends BaseMybatisDao<JtCommodityCommentMapper>
|
|
|
params.put("id", id);
|
|
|
return (Pagination<CommentDetailResult>) findPage("selectExpertsCommentList", "selectExpertsCommentCount", params, pageNo, pageSize);
|
|
|
}
|
|
|
+
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @Override
|
|
|
+ public Pagination<CommentDetailResult> searchUnlandedCommentList(
|
|
|
+ String commodityId, Integer pageNo, Integer pageSize) {
|
|
|
+ Map<String, Object>params=new HashMap<>();
|
|
|
+ params.put("commodityId", commodityId);
|
|
|
+ return (Pagination<CommentDetailResult>) findPage("searchUnlandedCommentByCommodityId", "searchCommentCountByCommodityId", params, pageNo, pageSize);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|