Commit 7eef80bd by songyinghui

feature: 评论用户头像

parent 8ce5d908
......@@ -15,7 +15,9 @@ import com.gic.content.api.qdto.comment.ListMobileCommentQDTO;
import com.gic.content.api.qdto.comment.SaveCommentQDTO;
import com.gic.content.api.service.ContentMaterialCommentApiService;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.enums.HaobanClerkTypeEnum;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.web.qo.content.comment.CommentCountQO;
import com.gic.haoban.manage.web.qo.content.comment.CommentInfoVO;
......@@ -51,6 +53,8 @@ public class CommentController {
@Autowired
private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private StaffApiService staffApiService;
/**
* 评论总数(包含子评论)
......@@ -140,10 +144,19 @@ public class CommentController {
clerkIds.add(saveCommentQO.getReplyClerkId());
}
Map<String, StaffClerkRelationDTO> clerkInfoMap = this.getClerkInfoMap(saveCommentQO.getWxEnterpriseId(), clerkIds);
List<String> staffIds = new ArrayList<>();
for (StaffClerkRelationDTO value : clerkInfoMap.values()) {
staffIds.add(value.getStaffId());
}
Map<String, StaffDTO> staffDTOMap = this.queryStaffInfoMap(staffIds);
StaffClerkRelationDTO staffClerkRelationDTO = clerkInfoMap.get(saveCommentQO.getClerkId());
saveCommentQDTO.setUserType(UserTypeEnum.CLERK.value);
if (staffClerkRelationDTO != null) {
saveCommentQDTO.setUserCode(staffClerkRelationDTO.getClerkCode());
StaffDTO staffDTO = staffDTOMap.get(staffClerkRelationDTO.getStaffId());
if (staffDTO != null) {
saveCommentQDTO.setUserHeadImage(staffDTO.getHeadImg());
}
if (HaobanClerkTypeEnum.AREA_MANAGER.getCode().equals(staffClerkRelationDTO.getClerkType())) {
saveCommentQDTO.setUserType(UserTypeEnum.AREA_MANAGER.value);
}else {
......@@ -153,6 +166,10 @@ public class CommentController {
staffClerkRelationDTO = clerkInfoMap.get(saveCommentQO.getReplyClerkId());
if (staffClerkRelationDTO != null) {
saveCommentQDTO.setReplyUserCode(staffClerkRelationDTO.getClerkCode());
StaffDTO staffDTO = staffDTOMap.get(staffClerkRelationDTO.getStaffId());
if (staffDTO != null) {
saveCommentQDTO.setReplyUserHeadImage(staffDTO.getHeadImg());
}
if (HaobanClerkTypeEnum.AREA_MANAGER.getCode().equals(staffClerkRelationDTO.getClerkType())) {
saveCommentQDTO.setReplyUserType(UserTypeEnum.AREA_MANAGER.value);
}else {
......@@ -177,4 +194,12 @@ public class CommentController {
.stream()
.collect(Collectors.toMap(StaffClerkRelationDTO::getClerkId, Function.identity(), (v1, v2) -> v1));
}
public Map<String, StaffDTO> queryStaffInfoMap(List<String> staffIds) {
List<StaffDTO> staffDTOS = staffApiService.listByIds(staffIds);
return staffDTOS
.stream()
.collect(Collectors.toMap(StaffDTO::getStaffId, Function.identity(), (v1, v2) -> v1));
}
}
......@@ -50,4 +50,9 @@ public class SaveCommentQO implements Serializable {
* 企业ID
*/
private String enterpriseId;
/**
* 成员id
*/
private String staffId;
}
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