增加上传附件临时接口
continuous-integration/drone/push Build is passing Details

飞书小程序
YXY 1 year ago
parent 9f78aced9a
commit 46108e6703

@ -104,7 +104,7 @@ public class LarkActiveController extends BaseController {
* *
*/ */
@PostMapping("/uploadActiveFile") @PostMapping("/uploadActiveFile")
public ResponseVo<LarkUserActiveRelatoin> uploadActiveFile(@RequestParam("file") MultipartFile file,@RequestParam("userName")String userName,@RequestParam("larkActiveName") String larkActiveName,@RequestParam("companyName") String companyName) { public ResponseVo<LarkUserActiveRelatoin> uploadActiveFile(@RequestParam("file") MultipartFile file, @RequestParam("userName") String userName, @RequestParam("larkActiveName") String larkActiveName, @RequestParam("companyName") String companyName) {
LarkActiveUserRelationRequest request = new LarkActiveUserRelationRequest(); LarkActiveUserRelationRequest request = new LarkActiveUserRelationRequest();
request.setFile(file); request.setFile(file);
request.setUserName(userName); request.setUserName(userName);
@ -113,6 +113,14 @@ public class LarkActiveController extends BaseController {
return larkUserActiveRelatoinService.commitFile(request); return larkUserActiveRelatoinService.commitFile(request);
} }
/**
*
*/
@PostMapping("/uploadActiveFile2")
public ResponseVo<LarkUserActiveRelatoin> uploadActiveFile2(@RequestBody LarkActiveUserRelationRequest request) {
return larkUserActiveRelatoinService.commitFile(request);
}
/** /**
* *
*/ */
@ -167,8 +175,8 @@ public class LarkActiveController extends BaseController {
.autoCloseStream(Boolean.TRUE) .autoCloseStream(Boolean.TRUE)
.sheet("sheetName") .sheet("sheetName")
.doWrite(Arrays.asList(larkActiveCountVo)); .doWrite(Arrays.asList(larkActiveCountVo));
}catch (Exception e){ } catch (Exception e) {
log.info("导出信息错误",e); log.info("导出信息错误", e);
} }
} }

@ -60,7 +60,7 @@ public class LarkUserActiveInviteRelatoinServiceImpl implements ILarkUserActiveI
List<LarkInviteVo> result = larkUserActiveInviteRelatoins.stream().map(r -> { List<LarkInviteVo> result = larkUserActiveInviteRelatoins.stream().map(r -> {
LarkInviteVo larkInviteVo = new LarkInviteVo(); LarkInviteVo larkInviteVo = new LarkInviteVo();
larkInviteVo.setUrl(r.getInviteUserName()); larkInviteVo.setUrl(r.getInviteUserName());
larkInviteVo.setUrl(r.getInviteUserName()); larkInviteVo.setText(r.getUserName());
LarkActiveInviteStageEnum inviteStageEnum = LarkActiveInviteStageEnum.getByCode(r.getInviteStage()); LarkActiveInviteStageEnum inviteStageEnum = LarkActiveInviteStageEnum.getByCode(r.getInviteStage());
larkInviteVo.setType(inviteStageEnum != null ? inviteStageEnum.getType() : "primary"); larkInviteVo.setType(inviteStageEnum != null ? inviteStageEnum.getType() : "primary");

@ -152,13 +152,6 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi
@Override @Override
public ResponseVo<LarkUserActiveRelatoin> commitFile(LarkActiveUserRelationRequest request) { public ResponseVo<LarkUserActiveRelatoin> commitFile(LarkActiveUserRelationRequest request) {
MultipartFile multipartFile = request.getFile();
File file = FileUtils.multipartFile2File(multipartFile);
String name = file.getName();
String[] split = name.split("\\.");
String key = String.format("%s_%s", split[0], System.currentTimeMillis());
split[0] = key;
key = String.join(".", split);
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 new ResponseVo();
@ -170,8 +163,17 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi
} }
Integer totalCount = userActiveCount(relatoin) + 1; Integer totalCount = userActiveCount(relatoin) + 1;
LarkActive larkActive = larkActiveMapper.selectLarkActiveById(relatoin.getActiveId()); LarkActive larkActive = larkActiveMapper.selectLarkActiveById(relatoin.getActiveId());
MultipartFile multipartFile = request.getFile();
if (multipartFile != null) {
File file = FileUtils.multipartFile2File(multipartFile);
String name = file.getName();
String[] split = name.split("\\.");
String key = String.format("%s_%s", split[0], System.currentTimeMillis());
split[0] = key;
key = String.join(".", split);
cosHelper.upload(BUCKET_NAME, key, file); cosHelper.upload(BUCKET_NAME, key, file);
buildUserActiveImage(relatoin, key); buildUserActiveImage(relatoin, key);
}
if (totalCount >= larkActive.getActiveImageCount()) { if (totalCount >= larkActive.getActiveImageCount()) {
relatoin.setActiveStage(LarkActiveStageEnum.ADJUST.getCode()); relatoin.setActiveStage(LarkActiveStageEnum.ADJUST.getCode());
larkUserActiveRelatoinMapper.updateLarkUserActiveRelatoin(relatoin); larkUserActiveRelatoinMapper.updateLarkUserActiveRelatoin(relatoin);

@ -103,6 +103,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
, "/lark/active/queryActive" , "/lark/active/queryActive"
, "/lark/active/getAcitveByName" , "/lark/active/getAcitveByName"
, "/lark/active/uploadActiveFile" , "/lark/active/uploadActiveFile"
, "/lark/active/uploadActiveFile2"
, "/lark/active/queryCompleteActiveList" , "/lark/active/queryCompleteActiveList"
, "/lark/active/queryMyCompleteActiveList" , "/lark/active/queryMyCompleteActiveList"
, "/lark/active/queryInviteUserList" , "/lark/active/queryInviteUserList"

Loading…
Cancel
Save