代码提交
This commit is contained in:
parent
9d750f10d6
commit
6c7048cb95
|
@ -135,10 +135,15 @@ public class EntityDataUserVo {
|
|||
private String professionalTitle;
|
||||
|
||||
/**
|
||||
* 职称
|
||||
* 验证码key
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 文件信息
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.kening.vordm.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springblade.core.redis.serializer.ProtoStuffSerializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
|
||||
/**
|
||||
* @author wanghongqing
|
||||
|
@ -12,4 +15,9 @@ import org.springframework.context.annotation.Configuration;
|
|||
@ComponentScan({"org.springblade", "com.kening.vordm"})
|
||||
@MapperScan({"org.springblade.**.mapper.**", "com.kening.**.mapper.**"})
|
||||
public class VoRdmConfig {
|
||||
|
||||
@Bean
|
||||
public RedisSerializer<Object> redisSerializer() {
|
||||
return new ProtoStuffSerializer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @date 2023/3/31 11:10
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/captcha")
|
||||
@RequestMapping("/ui/captcha")
|
||||
@RequiredArgsConstructor
|
||||
@Api(value = "验证码校验接口", tags = "验证码校验")
|
||||
public class CaptchaController extends BladeController {
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import com.kening.vordm.entity.EntityData;
|
||||
import com.kening.vordm.vo.EntityDataUserVo;
|
||||
import com.kening.vordm.vo.UserTenantVo;
|
||||
import org.springblade.core.tool.api.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -28,5 +29,5 @@ public interface EntityDataService extends IService<EntityData> {
|
|||
* Resource upload 上传实体信息
|
||||
* @return
|
||||
*/
|
||||
Boolean saveEntityData(EntityDataUserVo entityDataUserVo);
|
||||
R saveEntityData(EntityDataUserVo entityDataUserVo);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,12 @@ import com.kening.vordm.vo.EntityDataUserVo;
|
|||
import com.kening.vordm.vo.UserTenantVo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.cache.CacheNames;
|
||||
import org.springblade.core.oss.MinioTemplate;
|
||||
import org.springblade.core.oss.model.BladeFile;
|
||||
import org.springblade.core.redis.cache.BladeRedis;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -36,6 +40,11 @@ public class EntityDataServiceImpl extends ServiceImpl<EntityDataMapper, EntityD
|
|||
|
||||
private GuestInfoMapper guestInfoMapper;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
private final BladeRedis bladeRedis;
|
||||
|
||||
/**
|
||||
* 对象存储模块
|
||||
*/
|
||||
|
@ -56,19 +65,24 @@ public class EntityDataServiceImpl extends ServiceImpl<EntityDataMapper, EntityD
|
|||
return this.baseMapper.getEntityDataSourceOrganization();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean saveEntityData(EntityDataUserVo entityDataUserVo) {
|
||||
public R saveEntityData(EntityDataUserVo entityDataUserVo) {
|
||||
//创建实体数据
|
||||
EntityData entityData = new EntityData();
|
||||
|
||||
//路径拼接
|
||||
List<String> link = new ArrayList<>();
|
||||
//文件大小
|
||||
List<Long> size = new ArrayList<>();
|
||||
//文件数据
|
||||
List<MultipartFile> filesArray = entityDataUserVo.getFilesArray();
|
||||
filesArray.stream().forEach(files->{
|
||||
BladeFile bladeFile = minioTemplate.putFile(files);
|
||||
//获取文件大小
|
||||
Long fileSize = files.getSize();
|
||||
link.add(bladeFile.getLink());
|
||||
size.add(fileSize);
|
||||
});
|
||||
|
||||
//判断上传用户是否存在
|
||||
|
@ -91,15 +105,16 @@ public class EntityDataServiceImpl extends ServiceImpl<EntityDataMapper, EntityD
|
|||
entityData.setUploaderId(guestInfo1.getId());
|
||||
}
|
||||
|
||||
Long sum = size.stream().reduce(Long::sum).orElse(0L);
|
||||
//实体数据
|
||||
entityData.setTitle(entityDataUserVo.getTitle());
|
||||
entityData.setSize(entityDataUserVo.getSize());
|
||||
entityData.setSize(sum);
|
||||
entityData.setLink(StringUtils.join(link,","));
|
||||
entityData.setDisasterId(entityDataUserVo.getDisasterId());
|
||||
entityData.setUploadTime(new Date());
|
||||
entityData.setRemark(entityDataUserVo.getRemark());
|
||||
entityData.setSourceOrganization(entityDataUserVo.getOrganization());
|
||||
return this.baseMapper.insert(entityData)>1;
|
||||
return R.status(this.baseMapper.insert(entityData)>0);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue