Commit 8a1444e4 authored by wuwz's avatar wuwz

评论添加,app标签查询

parent 62dcbd8f
...@@ -4,6 +4,8 @@ package com.github.wxiaoqi.security.admin.dto; ...@@ -4,6 +4,8 @@ package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.PageParam; import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
...@@ -18,4 +20,6 @@ public class AppraiseLabeInfoDTO extends PageParam { ...@@ -18,4 +20,6 @@ public class AppraiseLabeInfoDTO extends PageParam {
private Integer type; private Integer type;
private Integer enable; private Integer enable;
private List<Integer>types;
} }
...@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.dto; ...@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.PageParam; import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data; import lombok.Data;
import javax.persistence.Column;
import java.util.List; import java.util.List;
/** /**
...@@ -40,4 +41,12 @@ public class UserCommentFindDTO extends PageParam{ ...@@ -40,4 +41,12 @@ public class UserCommentFindDTO extends PageParam{
private Integer companyId; private Integer companyId;
private Integer isDesc; private Integer isDesc;
private String orderNo;
private String appraiseJson;
private Integer point;
private Integer isAnonymous;
} }
...@@ -42,10 +42,10 @@ public class AppraiseLabelInfo implements Serializable { ...@@ -42,10 +42,10 @@ public class AppraiseLabelInfo implements Serializable {
private Integer point; private Integer point;
/** /**
* 1-全部,2-房车,3-机车,4-游艇,5豪车 * 0-全部,1-房车,2-机车,3-游艇,4豪车
*/ */
@Column(name = "type") @Column(name = "type")
@ApiModelProperty(value = "1-全部,2-房车,3-机车,4-游艇,5豪车") @ApiModelProperty(value = "0-全部,1-房车,2-机车,3-游艇,4豪车")
private Integer type; private Integer type;
/** /**
...@@ -90,5 +90,6 @@ public class AppraiseLabelInfo implements Serializable { ...@@ -90,5 +90,6 @@ public class AppraiseLabelInfo implements Serializable {
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer sort; private Integer sort;
@Column(name = "tag_type")
private Integer tagType;
} }
package com.github.wxiaoqi.security.admin.entity; package com.github.wxiaoqi.security.admin.entity;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -7,6 +8,7 @@ import lombok.NoArgsConstructor; ...@@ -7,6 +8,7 @@ import lombok.NoArgsConstructor;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author libin * @author libin
...@@ -96,4 +98,31 @@ public class UserComment { ...@@ -96,4 +98,31 @@ public class UserComment {
@Transient @Transient
private Integer isCompany; private Integer isCompany;
/**
* 订单编号
*/
@Column(name = "order_no")
private String orderNo;
/**
* 评论详情
*/
@Column(name = "appraise_json")
private String appraiseJson;
/**
* 评价总分
*/
@Column(name = "point")
private Integer point;
/**
* 是否匿名0-不匿名,1-匿名
*/
@Column(name = "is_anonymous")
private Integer isAnonymous;
@Transient
private List<JSONObject> jsonList;
} }
package com.github.wxiaoqi.security.admin.biz; package com.github.wxiaoqi.security.admin.biz;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO; import com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO;
...@@ -138,5 +141,26 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{ ...@@ -138,5 +141,26 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{
return dataVO; return dataVO;
} }
/**
* 处理维度
* 总分
* @param userComment
*/
public void saveComment(UserComment userComment){
JSONArray jsonArray = JSONArray.parseArray(userComment.getAppraiseJson());
if(jsonArray == null || jsonArray.size() == 0){
throw new BaseException("评论维度不能为空", ResultCode.FAILED_CODE);
}
Integer point = 0;
//处理维度和总分
//[{"id":1,"name":"配送标签","point":10,"star":1},{"id":2,"name":"配送标签","point":20,"star":2}]
for(int i =0 ;i <jsonArray.size(); i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
point += jsonObject.getInteger("point");
}
userComment.setPoint(point);
addOrUpd(userComment);
}
} }
...@@ -95,5 +95,18 @@ public class AppUserCommentController extends BaseController<UserCommentBiz> { ...@@ -95,5 +95,18 @@ public class AppUserCommentController extends BaseController<UserCommentBiz> {
} }
@PostMapping("saveComment")
@ApiModelProperty("评论")
public ObjectRestResponse saveComment(@RequestBody UserComment userComment) {
userComment.setUserId(getCurrentUserIdInt());
baseBiz.saveComment(userComment);
return ObjectRestResponse.succ();
}
@GetMapping("app/unauth/selectCommentList")
@ApiModelProperty("列表")
@IgnoreUserToken
public ObjectRestResponse selectCommentList(UserCommentFindDTO commentFindDTO) {
return ObjectRestResponse.succ( baseBiz.selectList(commentFindDTO));
}
} }
package com.github.wxiaoqi.security.admin.rest; package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.dto.AppraiseLabeInfoDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.admin.biz.AppraiseLabelInfoBiz; import com.github.wxiaoqi.security.admin.biz.AppraiseLabelInfoBiz;
import com.github.wxiaoqi.security.admin.entity.AppraiseLabelInfo; import com.github.wxiaoqi.security.admin.entity.AppraiseLabelInfo;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -11,4 +15,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -11,4 +15,9 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("app/appraiseLabelInfo") @RequestMapping("app/appraiseLabelInfo")
public class AppraiseLabelInfoController extends BaseController<AppraiseLabelInfoBiz, AppraiseLabelInfo> { public class AppraiseLabelInfoController extends BaseController<AppraiseLabelInfoBiz, AppraiseLabelInfo> {
@GetMapping("tag/selectList")
@ApiModelProperty("标签列表")
public ObjectRestResponse applySelectList(AppraiseLabeInfoDTO appraiseLabeInfoDTO) {
return baseBiz.selectList(appraiseLabeInfoDTO);
}
} }
\ No newline at end of file
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
<if test="enable != null"> <if test="enable != null">
AND a.enable = #{enable} AND a.enable = #{enable}
</if> </if>
<if test="types != null and types.size() > 0">
and a.type in
<foreach collection="types" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by a.upd_time DESC order by a.upd_time DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment