Commit 71d34d89 authored by hezhen's avatar hezhen

123

parent ac026b0c
...@@ -16,7 +16,7 @@ public class UserCommentFindDTO extends PageParam{ ...@@ -16,7 +16,7 @@ public class UserCommentFindDTO extends PageParam{
private Integer parentId; private Integer parentId;
private Integer soureId; private String soureId;
private Integer rootParentId; private Integer rootParentId;
...@@ -37,5 +37,7 @@ public class UserCommentFindDTO extends PageParam{ ...@@ -37,5 +37,7 @@ public class UserCommentFindDTO extends PageParam{
private Integer commentId; private Integer commentId;
private Integer companyId;
private Integer isDesc; private Integer isDesc;
} }
package com.github.wxiaoqi.security.admin.biz; package com.github.wxiaoqi.security.admin.biz;
import cn.hutool.json.JSONUtil;
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.CompanyInfoFindDTO;
import com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO; import com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO;
import com.github.wxiaoqi.security.admin.entity.*; import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.mapper.CompanyInfoMapper;
import com.github.wxiaoqi.security.admin.mapper.UserCommentMapper; import com.github.wxiaoqi.security.admin.mapper.UserCommentMapper;
import com.github.wxiaoqi.security.admin.vo.UserCommentVo; import com.github.wxiaoqi.security.admin.vo.UserCommentVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.universal.dto.SendMsgDTO;
import com.xxfc.platform.universal.feign.MQSenderFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.ADMIN_TOPIC;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.KEY_CORPORATION_UPD;
@Service @Service
@Slf4j @Slf4j
...@@ -116,6 +104,18 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{ ...@@ -116,6 +104,18 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{
} }
public void setParamByVehicle(UserCommentFindDTO userCommentFindDTO){
UserComment comment = selectById(userCommentFindDTO.getCommentId());
if (comment != null ){
userCommentFindDTO.setSoureId(comment.getSoureId());
userCommentFindDTO.setIsShow(1);
userCommentFindDTO.setIsDesc(1);
userCommentFindDTO.setUserId(comment.getUserId());
}
}
public List<UserCommentVo> getListByToUserId(UserCommentFindDTO commentFindDTO){ public List<UserCommentVo> getListByToUserId(UserCommentFindDTO commentFindDTO){
return mapper.selectListByToUserId(commentFindDTO); return mapper.selectListByToUserId(commentFindDTO);
...@@ -124,8 +124,17 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{ ...@@ -124,8 +124,17 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{
public PageDataVO<UserCommentVo> selectListV2(UserCommentFindDTO userCommentFindDTO){ public PageDataVO<UserCommentVo> selectListV2(UserCommentFindDTO userCommentFindDTO){
PageHelper.startPage(userCommentFindDTO.getPage(), userCommentFindDTO.getLimit()); PageHelper.startPage(userCommentFindDTO.getPage(), userCommentFindDTO.getLimit());
Integer commentId = userCommentFindDTO.getCommentId() == null ? 0 : userCommentFindDTO.getCommentId();
if (commentId > 0){
setParamByVehicle(userCommentFindDTO);
}
PageInfo<UserCommentVo> pageInfo = new PageInfo<>(getList(userCommentFindDTO)); PageInfo<UserCommentVo> pageInfo = new PageInfo<>(getList(userCommentFindDTO));
PageDataVO<UserCommentVo> dataVO = PageDataVO.pageInfo(pageInfo); PageDataVO<UserCommentVo> dataVO = PageDataVO.pageInfo(pageInfo);
List<UserCommentVo> list = dataVO.getData();
if (CollectionUtils.isNotEmpty(list)){
list.sort(Comparator.comparing(UserCommentVo::getId));
dataVO.setData(list);
}
return dataVO; return dataVO;
} }
......
...@@ -60,6 +60,13 @@ public class AppUserCommentController extends BaseController<UserCommentBiz> { ...@@ -60,6 +60,13 @@ public class AppUserCommentController extends BaseController<UserCommentBiz> {
@ApiModelProperty("列表") @ApiModelProperty("列表")
public ObjectRestResponse selectListByToUserId(UserCommentFindDTO commentFindDTO) { public ObjectRestResponse selectListByToUserId(UserCommentFindDTO commentFindDTO) {
commentFindDTO.setUserId(getCurrentUserIdInt()); commentFindDTO.setUserId(getCurrentUserIdInt());
Integer isGoods = commentFindDTO.getIsGoods() == null ? 0 : commentFindDTO.getIsGoods();
if (isGoods == 2 && (commentFindDTO.getCompanyId() == null || commentFindDTO.getCompanyId() == 0)){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
commentFindDTO.setCompanyId(companyIds.get(0));
}
}
return ObjectRestResponse.succ( baseBiz.selectListByToUserId(commentFindDTO)); return ObjectRestResponse.succ( baseBiz.selectListByToUserId(commentFindDTO));
} }
...@@ -74,5 +81,19 @@ public class AppUserCommentController extends BaseController<UserCommentBiz> { ...@@ -74,5 +81,19 @@ public class AppUserCommentController extends BaseController<UserCommentBiz> {
} }
@GetMapping("selectListByCommentId")
@ApiModelProperty("列表")
public ObjectRestResponse selectListByCommentId(UserCommentFindDTO commentFindDTO) {
if (commentFindDTO.getCompanyId() == null || commentFindDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
commentFindDTO.setCompanyId(companyIds.get(0));
}
}
commentFindDTO.setIsGoods(2);
return ObjectRestResponse.succ( baseBiz.selectListV2(commentFindDTO));
}
} }
...@@ -10,12 +10,17 @@ ...@@ -10,12 +10,17 @@
d1.headimgurl as headimgurl, d1.headimgurl as headimgurl,
IFNULL(d2.realname,d2.nickname) as toUserName, IFNULL(d2.realname,d2.nickname) as toUserName,
d2.headimgurl as toHeadimgurl, d2.headimgurl as toHeadimgurl,
b.`name`as companyName b.`name`as companyName,
b.`company_pic`as companyPic
FROM user_comment c FROM user_comment c
LEFT JOIN app_user_detail d1 ON c.user_id=d1.userid LEFT JOIN app_user_detail d1 ON c.user_id=d1.userid
LEFT JOIN app_user_detail d2 ON c.to_user_id=d2.userid LEFT JOIN app_user_detail d2 ON c.to_user_id=d2.userid
LEFT JOIN branch_company b ON c.company_id=b.id LEFT JOIN branch_company b ON c.company_id=b.id
<where> <where>
c.is_del = 0
<if test="isGoods != null and isGoods == 2 ">
AND ( c.user_id = #{userId} or (c.to_user_id = #{userId} and c.company_id = #{companyId} ))
</if>
<if test="soureId != null "> <if test="soureId != null ">
AND c.soure_id=#{soureId} AND c.soure_id=#{soureId}
</if> </if>
...@@ -66,12 +71,17 @@ ...@@ -66,12 +71,17 @@
<choose> <choose>
<when test="isGoods != null and isGoods == 1"> <when test="isGoods != null and isGoods == 1">
and to_user_id=#{userId} and to_user_id=#{userId}
GROUP BY soure_id,to_user_id )
</when>
<when test="isGoods != null and isGoods == 2">
and company_id = 0 and soure_user_id=#{companyId}
GROUP BY soure_id,user_id )
</when> </when>
<otherwise> <otherwise>
and ((soure_type =1 and soure_user_id=#{userId} and parent_id = 0) or to_user_id=#{userId}) and ((soure_type =1 and soure_user_id=#{userId} and parent_id = 0) or to_user_id=#{userId})
GROUP BY soure_id,to_user_id )
</otherwise> </otherwise>
</choose> </choose>
GROUP BY soure_id,to_user_id )
) c ) c
LEFT JOIN branch_company b ON c.company_id=b.id LEFT JOIN branch_company b ON c.company_id=b.id
LEFT JOIN app_user_detail d ON c.user_id=d.userid LEFT JOIN app_user_detail d ON c.user_id=d.userid
......
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