/** * 更新商品评论 * * @return */ @Action( value = "updateGoodsComment", results = {@Result(name = "json", type = "json")}) public String updateGoodsComment() { if (StringUtils.isBlank(this.getCommentid())) { return "json"; } bean = this.getGoodsCommentTService().findGoodsCommentById(this.getCommentid()); bean.setReplyorcommentusername(this.getReplyorcommentusername()); bean.setReplyorcommentuserid(BaseTools.adminCreateId()); bean.setCommentcontent(this.getCommentcontent()); bean.setScore(this.getScore()); this.getGoodsCommentTService().updateGoodsComment(bean); // this.setSucflag(true); return "json"; }
/** * 处理商品评论迭代 * * @param gct */ public void ProcessGoodsCommentList(List<GoodsCommentT> gct) { total = this.getGoodsCommentTService().countfindAllGoodsComment(); for (Iterator<GoodsCommentT> it = gct.iterator(); it.hasNext(); ) { GoodsCommentT gctt = (GoodsCommentT) it.next(); gctt.setState(StaticKey.DataShowState.getName(gctt.getState())); Map<String, Object> cellMap = new HashMap<String, Object>(); cellMap.put("id", gctt.getGoodsid()); cellMap.put( "cell", new Object[] { gctt.getGoodsname(), gctt.getState(), "<a id='showgoodscomment' href='goodscommentlistment.jsp?operate=edit&goodsname=" + gctt.getGoodsname() + "&goodsid=" + gctt.getGoodsid() + "' name='showgoodscomment'>[查看详细]</a>" }); rows.add(cellMap); } }
/** * 单个商品评论 * * @param gct */ public void ProcessGoodsCommentListByGoodsid(List<GoodsCommentT> gct) { total = this.getGoodsCommentTService().countfindAllGoodsComment(); for (Iterator<GoodsCommentT> it = gct.iterator(); it.hasNext(); ) { GoodsCommentT gctt = (GoodsCommentT) it.next(); gctt.setState(StaticKey.DataShowState.getName(gctt.getState())); if (gctt.getVirtualadd().equals(StaticKey.COMMENT_VIRTUALADD_ONE_NUM)) { gctt.setVirtualadd(StaticKey.COMMENT_VIRTULADD); } else { gctt.setVirtualadd(StaticKey.COMMENT_NOTVIRTULADD); } if (gctt.getReplyorcomment().equals(StaticKey.COMMENT_REPLY_ONE_NUM)) { gctt.setReplyorcomment(StaticKey.COMMENT_REPLY_ONE); } else { gctt.setReplyorcomment(StaticKey.COMMENT_REPLY_TWO); } Map<String, Object> cellMap = new HashMap<String, Object>(); cellMap.put("id", gctt.getCommentid()); cellMap.put( "cell", new Object[] { gctt.getCommentcontent(), gctt.getReplyorcommentusername(), gctt.getScore(), gctt.getReplyorcomment(), gctt.getVirtualadd(), gctt.getState(), BaseTools.formateDbDate(gctt.getPosttime()), "<a id='goodscommentdetail' href='goodscommentdetail.jsp?operate=editdetail&commentid=" + gctt.getCommentid() + "' name='goodscommentdetail'>[编辑]</a>" }); rows.add(cellMap); } }
/** * 增加虚拟评论 * * @return */ @Action( value = "addvirtualGoodsComment", results = {@Result(name = "json", type = "json")}) public String addvirtualGoodsComment() { if (StringUtils.isBlank(this.getGoodsid())) { return "json"; } GoodsCommentT gct = new GoodsCommentT(); gct.setCommentid(this.getSerial().Serialid(Serial.GOODSCOMMENT)); gct.setGoodsid(this.getGoodsid().trim()); gct.setGoodsname(this.getGoodsname().trim()); gct.setReplyorcommentusername(this.getReplyorcommentusername()); gct.setReplyorcommentuserid(BaseTools.adminCreateId()); gct.setPosttime(BaseTools.systemtime()); gct.setCommentcontent(this.getCommentcontent()); gct.setScore(this.getScore()); gct.setState(StaticKey.COMMENT_STATE_ONE_NUM); gct.setReplyorcomment(StaticKey.COMMENT_REPLY_TWO_NUM); gct.setReplyid(StaticKey.COMMENT_DEFAULT_REPLYID); gct.setEmailable(StaticKey.COMMENT_EMAILABLE_ONE_NUM); gct.setVirtualadd(StaticKey.COMMENT_VIRTUALADD_ONE_NUM); this.getGoodsCommentTService().save(gct); this.setSucflag(true); return "json"; }