评论增加头像和时间

支持图片预览
飞书小程序
YXY 1 year ago
parent 0b0117e6b0
commit 37c4294055

@ -75,7 +75,7 @@ public class CosHelper {
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
HttpMethodName method = HttpMethodName.GET; HttpMethodName method = HttpMethodName.GET;
URL url = cosClient.generatePresignedUrl(bucketName, key, expirationDate, method, headers, params); URL url = cosClient.generatePresignedUrl(bucketName, key, expirationDate, method, headers, params);
System.out.println(url.toString()); return url.toString();
}catch (Exception e){ }catch (Exception e){
log.info("upload file error",e); log.info("upload file error",e);
}finally { }finally {

@ -97,7 +97,7 @@ public class LarkActiveController extends BaseController {
* *
*/ */
@PostMapping("/uploadActiveFile") @PostMapping("/uploadActiveFile")
public ResponseVo<LarkUserActiveRelatoin> uploadActiveFile(@RequestBody LarkActiveUserRelationRequest request) { public ResponseVo<String> uploadActiveFile(@RequestBody LarkActiveUserRelationRequest request) {
return larkUserActiveRelatoinService.commitFile(request); return larkUserActiveRelatoinService.commitFile(request);
} }

@ -15,5 +15,6 @@ public class LarkActiveCommentVo extends LarkUserActiveComment {
private String userName; private String userName;
private String image; private String image;
private String dateStr;
} }

@ -33,7 +33,7 @@ public interface ILarkUserActiveRelatoinService {
public List<LarkUserActiveRelatoin> selectLarkUserActiveRelatoinList(LarkUserActiveRelatoin larkUserActiveRelatoin); public List<LarkUserActiveRelatoin> selectLarkUserActiveRelatoinList(LarkUserActiveRelatoin larkUserActiveRelatoin);
public ResponseVo<LarkUserActiveRelatoin> queryPage(LarkActiveUserRelationRequest request); public ResponseVo<LarkUserActiveRelatoin> queryPage(LarkActiveUserRelationRequest request);
public ResponseVo<LarkUserActiveRelatoin> commitFile(LarkActiveUserRelationRequest request); public ResponseVo<String> commitFile(LarkActiveUserRelationRequest request);
public ResponseVo<LarkUserActiveRelatoin> submit(LarkActiveUserRelationRequest request); public ResponseVo<LarkUserActiveRelatoin> submit(LarkActiveUserRelationRequest request);
/** /**

@ -207,6 +207,7 @@ public class LarkUserActiveCommentServiceImpl implements ILarkUserActiveCommentS
larkActiveCommentVo.setUserName(userInfo.getUserName()); larkActiveCommentVo.setUserName(userInfo.getUserName());
larkActiveCommentVo.setImage(userInfo.getImageUrl()); larkActiveCommentVo.setImage(userInfo.getImageUrl());
larkActiveCommentVo.setRemark(r.getRemark()); larkActiveCommentVo.setRemark(r.getRemark());
larkActiveCommentVo.setDateStr(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,r.getCreateTime()));
} }
return larkActiveCommentVo; return larkActiveCommentVo;
}).collect(Collectors.groupingBy(LarkActiveCommentVo::getRemark)); }).collect(Collectors.groupingBy(LarkActiveCommentVo::getRemark));

@ -195,18 +195,20 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi
} }
@Override @Override
public ResponseVo<LarkUserActiveRelatoin> commitFile(LarkActiveUserRelationRequest request) { public ResponseVo<String> commitFile(LarkActiveUserRelationRequest request) {
ResponseVo responseVo = new ResponseVo();
List<LarkActive> larkActives = larkActiveMapper.selectLarkActiveByName(request.getLarkActiveName(), FlagStatus.OK.getCode()); List<LarkActive> larkActives = larkActiveMapper.selectLarkActiveByName(request.getLarkActiveName(), FlagStatus.OK.getCode());
if (CollectionUtils.isEmpty(larkActives)){ if (CollectionUtils.isEmpty(larkActives)){
return new ResponseVo(); return responseVo;
} }
LarkActive active = larkActives.get(0); LarkActive active = larkActives.get(0);
LarkUserActiveRelatoin relatoin = queryUserActiveRelation(request.getCompanyName(),request.getUserName(), active.getId()); LarkUserActiveRelatoin relatoin = queryUserActiveRelation(request.getCompanyName(),request.getUserName(), active.getId());
if (relatoin == null) { if (relatoin == null) {
return new ResponseVo(); return responseVo;
} }
Integer totalCount = userActiveCount(relatoin,request.getImageBase64()) + 1; Integer totalCount = userActiveCount(relatoin,request.getImageBase64()) + 1;
LarkActive larkActive = larkActiveMapper.selectLarkActiveById(relatoin.getActiveId()); LarkActive larkActive = larkActiveMapper.selectLarkActiveById(relatoin.getActiveId());
String url = null;
if (StringUtils.isNotBlank(request.getImageBase64())) { if (StringUtils.isNotBlank(request.getImageBase64())) {
File file = base642File(request.getImageBase64()); File file = base642File(request.getImageBase64());
String name = file.getName(); String name = file.getName();
@ -216,6 +218,8 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi
key = String.join(".", split); key = String.join(".", split);
cosHelper.upload(BUCKET_NAME, key, file); cosHelper.upload(BUCKET_NAME, key, file);
buildUserActiveImage(relatoin, key,null); buildUserActiveImage(relatoin, key,null);
url = cosHelper.previewUrl(BUCKET_NAME, key);
responseVo.setData(url);
}else { }else {
buildUserActiveImage(relatoin,null, request.getRemark()); buildUserActiveImage(relatoin,null, request.getRemark());
} }
@ -224,7 +228,7 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi
larkUserActiveRelatoinMapper.updateLarkUserActiveRelatoin(relatoin); larkUserActiveRelatoinMapper.updateLarkUserActiveRelatoin(relatoin);
larkUserActiveInviteRelatoinService.inviteSuccess(Arrays.asList(request.getUserName())); larkUserActiveInviteRelatoinService.inviteSuccess(Arrays.asList(request.getUserName()));
} }
return new ResponseVo(); return responseVo;
} }
@Override @Override

Loading…
Cancel
Save