人员文件上传展示慢问题
This commit is contained in:
parent
e63a183aba
commit
9ce8c9756c
|
|
@ -9,6 +9,7 @@ import com.bonus.common.core.web.controller.BaseController;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.file.ResourceFileVo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
|
|
@ -118,6 +119,17 @@ public class PersonMgeController extends BaseController {
|
|||
return service.selectCertificateById(memberId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件地址
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getFileUrl")
|
||||
@SysLog(title = "人员管理", businessType = OperaType.DELETE, logType = 0, module = "基础管理->人员管理", details = "获取文件地址")
|
||||
public AjaxResult getFileUrl(@RequestBody ResourceFileVo dto) {
|
||||
return service.getFileUrl(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改证书
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.bracelet.vo.PersonVo;
|
||||
import com.bonus.common.entity.file.ResourceFileVo;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -93,6 +94,15 @@ public interface IPersonMgeService {
|
|||
public AjaxResult updateCertificate(@RequestPart(value = "highfile") MultipartFile[] highfile, @RequestPart(value = "electfile") MultipartFile[] electfile,
|
||||
@RequestPart(value = "elsefile") MultipartFile[] elsefile, @RequestBody Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 获取文件地址
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult getFileUrl(ResourceFileVo dto);
|
||||
|
||||
/**
|
||||
* 获取人员导出数据
|
||||
* @param dto
|
||||
|
|
|
|||
|
|
@ -864,7 +864,12 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
PersonVo vo = mapper.selectCertificateById(memberId);
|
||||
if (ObjectUtil.isNotEmpty(vo)) {
|
||||
List<ResourceFileVo> list = mapper.selectCertificateFile(memberId);
|
||||
getImageFile(list);
|
||||
getImageFileTwo(list);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getFileType()==0){
|
||||
list.get(i).setBast64Image(null);
|
||||
}
|
||||
}
|
||||
highImgList = list.stream().filter(bracelet -> (bracelet.getSourceImagType() == 2)).collect(Collectors.toList());
|
||||
electricianImgList = list.stream().filter(bracelet -> (bracelet.getSourceImagType() == 3)).collect(Collectors.toList());
|
||||
elseImgList = list.stream().filter(bracelet -> (bracelet.getSourceImagType() == 4)).collect(Collectors.toList());
|
||||
|
|
@ -879,6 +884,24 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getFileUrl(ResourceFileVo dto) {
|
||||
try {
|
||||
R<SysFile> result = remoteFileService.getImgBase64(dto.getFilePath(), SecurityConstants.INNER);
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
||||
String jsonString = JSON.toJSONString(result.getData());
|
||||
JSONObject item = JSON.parseObject(jsonString);
|
||||
String base64 = item.getString("url");
|
||||
dto.setBast64Image(base64);
|
||||
}
|
||||
return AjaxResult.success(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("文件下载错误", e);
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片查询
|
||||
*
|
||||
|
|
@ -900,6 +923,23 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
|
||||
}
|
||||
|
||||
public void getImageFileTwo(List<ResourceFileVo> list) {
|
||||
if (com.bonus.common.core.utils.StringUtils.isNotEmpty(list)) {
|
||||
list.forEach(file -> {
|
||||
if(file.getFileType()!=0){
|
||||
R<SysFile> result = remoteFileService.getImgBase64(file.getFilePath(), SecurityConstants.INNER);
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
||||
String jsonString = JSON.toJSONString(result.getData());
|
||||
JSONObject item = JSON.parseObject(jsonString);
|
||||
String base64 = item.getString("url");
|
||||
file.setBast64Image(base64);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AjaxResult updateCertificate(MultipartFile[] highfile, MultipartFile[] electfile, MultipartFile[] elsefile, Long id) {
|
||||
String delFileId = null;
|
||||
CertificateVo vo = new CertificateVo();
|
||||
|
|
|
|||
Loading…
Reference in New Issue