|
|
@ -1,12 +1,11 @@
|
|
|
|
package com.ruoyi.flyingbook.service.impl;
|
|
|
|
package com.ruoyi.flyingbook.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.qcloud.cos.model.PutObjectResult;
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
import com.ruoyi.common.enums.FlagStatus;
|
|
|
|
import com.ruoyi.common.enums.FlagStatus;
|
|
|
|
import com.ruoyi.common.enums.LarkActiveEnum;
|
|
|
|
import com.ruoyi.common.enums.LarkActiveEnum;
|
|
|
|
import com.ruoyi.common.enums.LarkActiveStageEnum;
|
|
|
|
import com.ruoyi.common.enums.LarkActiveStageEnum;
|
|
|
|
import com.ruoyi.common.enums.LarkUserTypeEnum;
|
|
|
|
import com.ruoyi.common.enums.LarkUserTypeEnum;
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.utils.file.FileUtils;
|
|
|
|
|
|
|
|
import com.ruoyi.flyingbook.CosHelper.CosHelper;
|
|
|
|
import com.ruoyi.flyingbook.CosHelper.CosHelper;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkActive;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkActive;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkLoginLog;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkLoginLog;
|
|
|
@ -14,7 +13,6 @@ import com.ruoyi.flyingbook.domain.LarkUserActiveImage;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkUserActiveRelatoin;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkUserActiveRelatoin;
|
|
|
|
import com.ruoyi.flyingbook.domain.edi.ResponseVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.edi.ResponseVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveCountVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveCountVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveRequest;
|
|
|
|
|
|
|
|
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveUserRelationRequest;
|
|
|
|
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveUserRelationRequest;
|
|
|
|
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.larkactive.LarkActiveVo;
|
|
|
|
import com.ruoyi.flyingbook.mapper.LarkActiveMapper;
|
|
|
|
import com.ruoyi.flyingbook.mapper.LarkActiveMapper;
|
|
|
@ -22,18 +20,20 @@ import com.ruoyi.flyingbook.mapper.LarkLoginLogMapper;
|
|
|
|
import com.ruoyi.flyingbook.mapper.LarkUserActiveImageMapper;
|
|
|
|
import com.ruoyi.flyingbook.mapper.LarkUserActiveImageMapper;
|
|
|
|
import com.ruoyi.flyingbook.mapper.LarkUserActiveRelatoinMapper;
|
|
|
|
import com.ruoyi.flyingbook.mapper.LarkUserActiveRelatoinMapper;
|
|
|
|
import com.ruoyi.flyingbook.service.ILarkUserActiveRelatoinService;
|
|
|
|
import com.ruoyi.flyingbook.service.ILarkUserActiveRelatoinService;
|
|
|
|
|
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedOutputStream;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -152,6 +152,44 @@ public class LarkUserActiveRelatoinServiceImpl implements ILarkUserActiveRelatoi
|
|
|
|
return new ResponseVo(request.getCurrentPage(), request.getPageSize(), null, count);
|
|
|
|
return new ResponseVo(request.getCurrentPage(), request.getPageSize(), null, count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private File base642File(String base64){
|
|
|
|
|
|
|
|
File file = null;
|
|
|
|
|
|
|
|
if(base64.contains("data:image")){
|
|
|
|
|
|
|
|
base64 = base64.substring(base64.indexOf(",")+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BufferedOutputStream bos = null;
|
|
|
|
|
|
|
|
FileOutputStream fos = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
base64 = base64.toString().replace("\r\n", "");
|
|
|
|
|
|
|
|
//创建文件目录
|
|
|
|
|
|
|
|
String prefix=".jpg";
|
|
|
|
|
|
|
|
file = File.createTempFile(IdUtil.randomUUID(), prefix);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] bytes = Base64.decodeBase64(base64);
|
|
|
|
|
|
|
|
fos = new FileOutputStream(file);
|
|
|
|
|
|
|
|
bos = new BufferedOutputStream(fos);
|
|
|
|
|
|
|
|
bos.write(bytes);
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}finally {
|
|
|
|
|
|
|
|
if (bos != null) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
bos.close();
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fos != null) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
fos.close();
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return file;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ResponseVo<LarkUserActiveRelatoin> commitFile(LarkActiveUserRelationRequest request) {
|
|
|
|
public ResponseVo<LarkUserActiveRelatoin> commitFile(LarkActiveUserRelationRequest request) {
|
|
|
|
List<LarkActive> larkActives = larkActiveMapper.selectLarkActiveByName(request.getLarkActiveName(), FlagStatus.OK.getCode());
|
|
|
|
List<LarkActive> larkActives = larkActiveMapper.selectLarkActiveByName(request.getLarkActiveName(), FlagStatus.OK.getCode());
|
|
|
@ -165,9 +203,8 @@ 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 (StringUtils.isNotBlank(request.getImageBase64())) {
|
|
|
|
if (multipartFile != null) {
|
|
|
|
File file = base642File(request.getImageBase64());
|
|
|
|
File file = FileUtils.multipartFile2File(multipartFile);
|
|
|
|
|
|
|
|
String name = file.getName();
|
|
|
|
String name = file.getName();
|
|
|
|
String[] split = name.split("\\.");
|
|
|
|
String[] split = name.split("\\.");
|
|
|
|
String key = String.format("%s_%s", split[0], System.currentTimeMillis());
|
|
|
|
String key = String.format("%s_%s", split[0], System.currentTimeMillis());
|
|
|
|