工程管理
This commit is contained in:
parent
062655df96
commit
fdb391f5cf
|
|
@ -16,6 +16,10 @@ public class SysMenu {
|
|||
|
||||
private boolean isLast;
|
||||
|
||||
private String menuAuth;
|
||||
|
||||
private String icon;
|
||||
|
||||
private List<SysMenu> childer;
|
||||
|
||||
public boolean isLast() {
|
||||
|
|
@ -50,6 +54,22 @@ public class SysMenu {
|
|||
this.url = url;
|
||||
}
|
||||
|
||||
public String getMenuAuth() {
|
||||
return menuAuth;
|
||||
}
|
||||
|
||||
public void setMenuAuth(String menuAuth) {
|
||||
this.menuAuth = menuAuth;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public List<SysMenu> getChilder() {
|
||||
return childer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,5 +15,6 @@ public class ProDto {
|
|||
@ApiModelProperty(value = "工程ID")
|
||||
private String proId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "1.图片 2.平面图")
|
||||
private String fileType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.securitycontrol.entity.system.base.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -90,6 +92,22 @@ public class ProVo {
|
|||
@ApiModelProperty(value = "类型")
|
||||
private boolean flag;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String delFiles;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<FileData> fileData;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<Integer> fileType;
|
||||
|
||||
@Data
|
||||
public static class FileData{
|
||||
private String fileId;
|
||||
private String base64Url;
|
||||
private String fileSourceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件限制
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
package com.securitycontrol.entity.system.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-12-9:29
|
||||
* @version:1.0
|
||||
* @description:文件资源-vo
|
||||
*/
|
||||
@Data
|
||||
public class ResourceFileVo {
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private String resourceId;
|
||||
|
||||
@ApiModelProperty(value = "文件类型 0 文件 1图片")
|
||||
private Integer fileType;
|
||||
|
||||
@ApiModelProperty(value = "文件id/路径")
|
||||
private String fileId;
|
||||
|
||||
@ApiModelProperty(value = "文件后缀")
|
||||
private String fileSuffix;
|
||||
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty(value = "业务id")
|
||||
private String sourceId;
|
||||
|
||||
@ApiModelProperty(value = "业务类型")
|
||||
private String sourceType;
|
||||
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer delFlag;
|
||||
|
||||
@ApiModelProperty(value = "上传时间")
|
||||
private String updateTime;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.securitycontrol.entity.system.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -13,8 +14,14 @@ import lombok.Data;
|
|||
public class SelectVo {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "建管单位orgID")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String orgId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class MyFilter implements Filter {
|
|||
}
|
||||
}
|
||||
|
||||
public static final String[] EXCLUDE_URLS = {"/sys/pro/addPro"};
|
||||
public static final String[] EXCLUDE_URLS = {"/sys/pro/addPro","/sys/pro/editPro"};
|
||||
|
||||
public boolean isFileUpload(HttpServletRequest request) {
|
||||
for (String excludeUrl : EXCLUDE_URLS) {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor {
|
|||
// IResourceService resourceService = (IResourceService) AdapterFactory.getInstance(Constants.CLASS_RESOURCE);
|
||||
|
||||
|
||||
public static final String[] EXCLUDE_URLS = {"/sys/pro/addPro"};
|
||||
public static final String[] EXCLUDE_URLS = {"/sys/pro/addPro","/sys/pro/editPro"};
|
||||
|
||||
public boolean isFileUpload(HttpServletRequest request) {
|
||||
for (String excludeUrl : EXCLUDE_URLS) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import java.nio.charset.StandardCharsets;
|
|||
public class DownLoadFileController {
|
||||
|
||||
@GetMapping("proFile")
|
||||
@Log(title = "基础管理", menu = "基础管理->工程管理", grade = OperationType.DOWNLOAD_BUSINESS, details = "工程模板下载", type = "业务日志")
|
||||
public void downLoadExcelModel2(HttpServletRequest request, HttpServletResponse response) {
|
||||
InputStream inputStream = null;
|
||||
ServletOutputStream servletOutputStream = null;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.securitycontrol.common.core.web.domain.AjaxResult;
|
|||
import com.securitycontrol.common.core.web.page.TableDataInfo;
|
||||
import com.securitycontrol.common.log.annotation.Log;
|
||||
import com.securitycontrol.common.log.enums.OperationType;
|
||||
import com.securitycontrol.common.security.utils.XssRequestWrapper;
|
||||
import com.securitycontrol.entity.system.base.dto.ProDto;
|
||||
import com.securitycontrol.entity.system.base.dto.ProGxPlanDto;
|
||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||
|
|
@ -13,12 +12,9 @@ import com.securitycontrol.system.base.service.IProService;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -53,10 +49,7 @@ public class ProController extends BaseController {
|
|||
@ApiOperation(value = "修改工程")
|
||||
@PostMapping("editPro")
|
||||
@Log(title = "基础管理", menu = "基础管理->工程管理", grade = OperationType.UPDATE_BUSINESS, details = "修改工程", type = "业务日志")
|
||||
public AjaxResult editPro(HttpServletRequest request, @RequestParam(value = "file[]", required = false) MultipartFile[] files, @RequestParam(value = "type[]", required = false) int[] types) {
|
||||
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
|
||||
MultipartHttpServletRequest multiReq = multipartResolver.resolveMultipart(request);
|
||||
String params = multiReq.getParameter("params");
|
||||
public AjaxResult editPro(HttpServletRequest request, @RequestParam(value = "file[]", required = false) MultipartFile[] files, @RequestParam(value = "type[]", required = false) int[] types,String params) {
|
||||
return service.addOrUpdatePro(files,types,params);
|
||||
}
|
||||
|
||||
|
|
@ -79,4 +72,10 @@ public class ProController extends BaseController {
|
|||
public AjaxResult delProGxPlan(ProGxPlanDto dto) {
|
||||
return service.delProGxPlan(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工程图片/平面图预览")
|
||||
@GetMapping("viewProFile")
|
||||
public AjaxResult viewProFile(ProDto dto) {
|
||||
return service.viewProFile(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.securitycontrol.common.core.web.domain.AjaxResult;
|
|||
import com.securitycontrol.entity.system.dto.MenuDto;
|
||||
import com.securitycontrol.system.base.service.ISelectService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
|
@ -47,5 +48,9 @@ public class SelectController extends BaseController {
|
|||
return service.getDictList(code);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "建管单位下拉选")
|
||||
@GetMapping("getBuildLists")
|
||||
public AjaxResult getBuildLists(){
|
||||
return service.getBuildLists();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.securitycontrol.system.base.mapper;
|
|||
import com.securitycontrol.entity.system.base.dto.ProDto;
|
||||
import com.securitycontrol.entity.system.base.dto.ProGxPlanDto;
|
||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -70,10 +71,41 @@ public interface IProMapper {
|
|||
|
||||
/**
|
||||
* 删除工程工序计划
|
||||
*
|
||||
* @param dto
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/11 14:47
|
||||
*/
|
||||
void delProGxPlan(ProGxPlanDto dto);
|
||||
|
||||
/**
|
||||
* 保存文件资源
|
||||
*
|
||||
* @param vo
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/12 9:27
|
||||
*/
|
||||
void addFiles(ResourceFileVo vo);
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param fileId
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/12 10:32
|
||||
*/
|
||||
void delFile(String fileId);
|
||||
|
||||
/**
|
||||
* 获取工程图片/平面图
|
||||
* @param proId
|
||||
* @return List<ResourceFileVo>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/12 10:55
|
||||
*/
|
||||
List<ResourceFileVo> getFiles(String proId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public interface ISelectMapper {
|
|||
|
||||
/**
|
||||
* 菜单树
|
||||
*
|
||||
* @return List<TreeNode>
|
||||
* @description
|
||||
* @author cwchen
|
||||
|
|
@ -48,8 +49,18 @@ public interface ISelectMapper {
|
|||
|
||||
/**
|
||||
* 查询字典下拉选
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
List<TreeNode> getDictList(@Param("code") String code);
|
||||
|
||||
/**
|
||||
* 建管单位下拉选
|
||||
* @return List<SelectVo>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/12 11:24
|
||||
*/
|
||||
List<SelectVo> getBuildLists();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ public interface IProService {
|
|||
|
||||
/**
|
||||
* 新增/修改工程
|
||||
*
|
||||
* @param files
|
||||
* @param types
|
||||
* @param params
|
||||
|
|
@ -72,4 +73,12 @@ public interface IProService {
|
|||
*/
|
||||
AjaxResult delProGxPlan(ProGxPlanDto dto);
|
||||
|
||||
/**
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/12 13:11
|
||||
*/
|
||||
AjaxResult viewProFile(ProDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ public interface ISelectService {
|
|||
|
||||
/**
|
||||
* 角色下拉选
|
||||
*
|
||||
* @return AjaxResult
|
||||
* @description 角色下拉选
|
||||
* @author cwchen
|
||||
|
|
@ -32,8 +33,9 @@ public interface ISelectService {
|
|||
|
||||
/**
|
||||
* 菜单树
|
||||
* @return AjaxResult
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description 菜单树
|
||||
* @author cwchen
|
||||
* @date 2024/2/26 13:33
|
||||
|
|
@ -43,8 +45,18 @@ public interface ISelectService {
|
|||
/**
|
||||
* 查询字典集合
|
||||
* code 上级节点编码 null市查询全部
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getDictList(String code);
|
||||
|
||||
/**
|
||||
* 建管单位下拉选
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/12 11:23
|
||||
*/
|
||||
AjaxResult getBuildLists();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,24 +2,27 @@ package com.securitycontrol.system.base.service.impl;
|
|||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.securitycontrol.common.core.utils.StringUtils;
|
||||
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.common.security.utils.ValidatorsUtils;
|
||||
import com.securitycontrol.entity.system.base.dto.ProDto;
|
||||
import com.securitycontrol.entity.system.base.dto.ProGxPlanDto;
|
||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import com.securitycontrol.system.base.mapper.IProMapper;
|
||||
import com.securitycontrol.system.base.service.IProService;
|
||||
import com.securitycontrol.system.mongodb.service.FileUploadService;
|
||||
import com.securitycontrol.system.mongodb.util.MongodbFileUtil;
|
||||
import com.securitycontrol.system.mongodb.vo.FileExportVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
|
|
@ -37,6 +40,9 @@ public class ProServiceImpl implements IProService {
|
|||
@Resource(name = "ValidatorsUtils")
|
||||
private ValidatorsUtils validatorsUtils;
|
||||
|
||||
@Resource(name = "fileMongoServiceImpl")
|
||||
private FileUploadService mongoService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<ProVo> getProLists(ProDto dto) {
|
||||
|
|
@ -53,21 +59,64 @@ public class ProServiceImpl implements IProService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addOrUpdatePro(MultipartFile[] files, int[] types, String params) {
|
||||
List<FileExportVo> fileExportVos = null;
|
||||
try {
|
||||
ProVo vo = JSON.parseObject(params, ProVo.class);
|
||||
String validResult = validatorsUtils.valid(vo, ProVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
String proId = UUID.randomUUID().toString().replace("-", "");
|
||||
if (StringUtils.isBlank(vo.getProId())) {
|
||||
if (files == null || types == null) {
|
||||
return AjaxResult.error("图片未上传");
|
||||
}
|
||||
vo.setType(1);
|
||||
vo.setProId(UUID.randomUUID().toString().replace("-", ""));
|
||||
vo.setProId(proId);
|
||||
} else {
|
||||
vo.setType(2);
|
||||
if (StringUtils.isNotEmpty(vo.getDelFiles())) {
|
||||
String[] delFiles = vo.getDelFiles().split(",");
|
||||
for (String fileId : delFiles) {
|
||||
mapper.delFile(fileId);
|
||||
mongoService.removeFile(fileId);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 上传文件
|
||||
if (files != null && types != null) {
|
||||
List<MultipartFile> multipartFiles = Arrays.asList(files);
|
||||
fileExportVos = mongoService.uploadFiles(multipartFiles);
|
||||
for (int i = 0; i < fileExportVos.size(); i++) {
|
||||
FileExportVo item = fileExportVos.get(i);
|
||||
int type = types[i];
|
||||
if (item != null) {
|
||||
ResourceFileVo fileVo = new ResourceFileVo();
|
||||
String resourceId = UUID.randomUUID().toString().replace("-", "");
|
||||
fileVo.setResourceId(resourceId);
|
||||
fileVo.setFileType(1);
|
||||
fileVo.setFileId(item.getFileId());
|
||||
fileVo.setFileSuffix(item.getSuffix());
|
||||
fileVo.setFileName(item.getFileName());
|
||||
fileVo.setSourceId(vo.getType() == 1 ? proId : vo.getProId());
|
||||
fileVo.setUpdateTime(DateTimeHelper.getNowTime());
|
||||
fileVo.setSourceType(type == 1 ? "工程图片" : "工程平面图");
|
||||
mapper.addFiles(fileVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 保存工程数据
|
||||
mapper.addOrUpdatePro(vo);
|
||||
} catch (Exception e) {
|
||||
log.error("新增/修改工程", e);
|
||||
// 删除文件
|
||||
if (CollectionUtils.isNotEmpty(fileExportVos)) {
|
||||
fileExportVos.forEach(item -> {
|
||||
if (item != null) {
|
||||
mongoService.removeFile(item.getFileId());
|
||||
}
|
||||
});
|
||||
}
|
||||
//手动回滚异常
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
|
|
@ -79,6 +128,20 @@ public class ProServiceImpl implements IProService {
|
|||
public AjaxResult getProById(ProDto dto) {
|
||||
ProVo vo = new ProVo();
|
||||
vo = mapper.getProById(dto);
|
||||
List<ResourceFileVo> resourceFileVos = mapper.getFiles(vo.getProId());
|
||||
if(CollectionUtils.isNotEmpty(resourceFileVos)){
|
||||
List<ProVo.FileData> list = new ArrayList<>();
|
||||
for (ResourceFileVo fileVo : resourceFileVos) {
|
||||
FileExportVo fileExportVo = mongoService.downloadFile(fileVo.getFileId());
|
||||
String base64 = MongodbFileUtil.getBase64(fileExportVo);
|
||||
ProVo.FileData fileData = new ProVo.FileData();
|
||||
fileData.setFileId(fileVo.getFileId());
|
||||
fileData.setBase64Url(base64);
|
||||
fileData.setFileSourceType(fileVo.getSourceType());
|
||||
list.add(fileData);
|
||||
}
|
||||
vo.setFileData(list);
|
||||
}
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +151,7 @@ public class ProServiceImpl implements IProService {
|
|||
try {
|
||||
mapper.delPro(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("删除工程",e);
|
||||
log.error("删除工程", e);
|
||||
//手动回滚异常
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
|
|
@ -101,10 +164,30 @@ public class ProServiceImpl implements IProService {
|
|||
try {
|
||||
mapper.delProGxPlan(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("删除工程工序计划",e);
|
||||
log.error("删除工程工序计划", e);
|
||||
//手动回滚异常
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult viewProFile(ProDto dto) {
|
||||
List<ProVo.FileData> list = new ArrayList<>();
|
||||
List<ResourceFileVo> resourceFileVos = mapper.getFiles(dto.getProId());
|
||||
if(CollectionUtils.isNotEmpty(resourceFileVos)){
|
||||
for (ResourceFileVo fileVo : resourceFileVos) {
|
||||
if(Objects.equals(dto.getFileType(),fileVo.getSourceType())){
|
||||
FileExportVo fileExportVo = mongoService.downloadFile(fileVo.getFileId());
|
||||
String base64 = MongodbFileUtil.getBase64(fileExportVo);
|
||||
ProVo.FileData fileData = new ProVo.FileData();
|
||||
fileData.setFileId(fileVo.getFileId());
|
||||
fileData.setBase64Url(base64);
|
||||
fileData.setFileSourceType(fileVo.getSourceType());
|
||||
list.add(fileData);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,4 +95,11 @@ public class SelectServiceImpl implements ISelectService {
|
|||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getBuildLists() {
|
||||
List<SelectVo> list = new ArrayList<>();
|
||||
list = mapper.getBuildLists();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
package com.securitycontrol.system.mongodb.util;
|
||||
|
||||
import com.securitycontrol.system.mongodb.service.FileUploadService;
|
||||
import com.securitycontrol.system.mongodb.vo.FileExportVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.util.Base64Util;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
|
|
@ -12,6 +16,7 @@ import javax.annotation.Resource;
|
|||
* @version:1.0
|
||||
* @description:mongodb文件上传-工具类
|
||||
*/
|
||||
@Slf4j
|
||||
public class MongodbFileUtil {
|
||||
|
||||
@Resource(name = "fileMongoServiceImpl")
|
||||
|
|
@ -19,4 +24,26 @@ public class MongodbFileUtil {
|
|||
|
||||
@Autowired
|
||||
private Base64Util base64Util;
|
||||
|
||||
/**
|
||||
* 获取文件的base64地址
|
||||
* @param vo
|
||||
* @return String
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/12 11:00
|
||||
*/
|
||||
public static String getBase64(FileExportVo vo) {
|
||||
try {
|
||||
byte[] bytes = vo.getData();
|
||||
if (!Objects.isNull(bytes)) {
|
||||
String suffix = vo.getSuffix().replace(".", "");
|
||||
return "data:image/" + suffix + ";base64," + Base64Utils.encodeToString(bytes);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("byte流转base64", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
where su.user_id=#{userId}
|
||||
</select>
|
||||
<select id="getAllMenuList" resultType="com.securitycontrol.system.api.domain.decision.SysMenu">
|
||||
select sm.menu_url url,sm.menu_id menuId,sm.menu_name menuName,sm.menu_logo
|
||||
select sm.menu_url url,sm.menu_id menuId,sm.menu_name menuName,sm.menu_logo AS icon,sm.menu_auth AS menuAuth
|
||||
FROM sys_user su
|
||||
left join sys_role_menu srm on srm .role_id=su.role_id
|
||||
left join sys_menu sm on sm.menu_id=srm.menu_id and sm.del_flag=0 and (sm.menu_type=0 or sm.menu_type=1)
|
||||
|
|
|
|||
|
|
@ -75,13 +75,43 @@
|
|||
WHERE pro_id = #{proId}
|
||||
</if>
|
||||
</insert>
|
||||
<!--保存文件资源-->
|
||||
<insert id="addFiles">
|
||||
INSERT INTO tb_resource_file
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="resourceId != null and resourceId != ''">id,</if>
|
||||
<if test="fileType != null">file_type,</if>
|
||||
<if test="fileId != null and fileId!=''">file_id,</if>
|
||||
<if test="fileSuffix != null and fileSuffix!=''">file_suffix,</if>
|
||||
<if test="fileName != null and fileName!=''">file_name,</if>
|
||||
<if test="sourceId != null and sourceId!=''">source_id,</if>
|
||||
<if test="sourceType != null and sourceType!=''">source_type,</if>
|
||||
del_flag,
|
||||
<if test="updateTime != null and updateTime!=''">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="resourceId != null and resourceId != ''">#{resourceId},</if>
|
||||
<if test="fileType != null">#{fileType},</if>
|
||||
<if test="fileId != null and fileId!=''">#{fileId},</if>
|
||||
<if test="fileSuffix != null and fileSuffix!=''">#{fileSuffix},</if>
|
||||
<if test="fileName != null and fileName!=''">#{fileName},</if>
|
||||
<if test="sourceId != null and sourceId!=''">#{sourceId},</if>
|
||||
<if test="sourceType != null and sourceType!=''">#{sourceType},</if>
|
||||
1,
|
||||
<if test="updateTime != null and updateTime!=''">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<!--删除工程-->
|
||||
<delete id="delPro">
|
||||
|
||||
</delete>
|
||||
<!--删除工程工序计划-->
|
||||
<delete id="delProGxPlan">
|
||||
DELETE FROM tb_gx_plan WHERE
|
||||
# DELETE FROM tb_gx_plan WHERE
|
||||
</delete>
|
||||
<!--删除文件-->
|
||||
<delete id="delFile">
|
||||
DELETE FROM tb_resource_file WHERE file_id = #{fileId}
|
||||
</delete>
|
||||
|
||||
<!--获取工程列表-->
|
||||
|
|
@ -132,5 +162,13 @@
|
|||
tp.start_time AS startTime,
|
||||
tp.end_time AS endTime
|
||||
FROM tb_project tp
|
||||
WHERE pro_id = #{proId}
|
||||
</select>
|
||||
<!--获取工程图片/平面图-->
|
||||
<select id="getFiles" resultType="com.securitycontrol.entity.system.vo.ResourceFileVo">
|
||||
SELECT id AS resourceId,
|
||||
file_id AS fileId,
|
||||
CASE source_type WHEN '工程图片' THEN '1' WHEN '工程平面图' THEN '2' END AS sourceType
|
||||
FROM tb_resource_file WHERE source_id = #{proId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -37,4 +37,10 @@
|
|||
</if>
|
||||
ORDER BY dict_sort desc
|
||||
</select>
|
||||
<!--建管单位下拉选-->
|
||||
<select id="getBuildLists" resultType="com.securitycontrol.entity.system.vo.SelectVo">
|
||||
SELECT city_name AS name,
|
||||
org_id AS orgId
|
||||
FROM sys_build
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue