已重命名1个文件
已修改2个文件
已添加3个文件
已删除5个文件
| | |
| | | private Long id; |
| | | //类型/类别外键 |
| | | private Long equipmentTypeId; |
| | | //类型名称 |
| | | private String equipmentTypeName; |
| | | //名称 |
| | | private String name; |
| | | //单位部门外键 |
| | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getEquipmentTypeName() { |
| | | return equipmentTypeName; |
| | | } |
| | | |
| | | public void setEquipmentTypeName(String equipmentTypeName) { |
| | | this.equipmentTypeName = equipmentTypeName; |
| | | } |
| | | } |
| | |
| | | package com.gkhy.safePlatform.equipment.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService; |
| | | import com.gkhy.safePlatform.equipment.entity.*; |
| | | import com.gkhy.safePlatform.equipment.model.dto.req.*; |
| | | import com.gkhy.safePlatform.equipment.repository.EquipmentTypeMngRepository; |
| | | import com.gkhy.safePlatform.equipment.repository.KeypointEquipmentInfoRepository; |
| | | import com.gkhy.safePlatform.equipment.service.*; |
| | | import org.apache.dubbo.config.annotation.DubboReference; |
| | |
| | | @Autowired |
| | | private EquipmentInfoService equipmentInfoService; |
| | | |
| | | @Autowired |
| | | private EquipmentTypeMngRepository equipmentTypeMngRepository; |
| | | |
| | | @Override |
| | | public ResultVO queryAll(PageQuery<KeypointEquipmentInfoQueryCriteria> pageQuery) { |
| | | Long pageIndex = pageQuery.getPageIndex(); |
| | |
| | | QueryHelpPlus.getPredicate(KeypointEquipmentInfo.class, pageQuery.getSearchParams())); |
| | | List<KeypointEquipmentInfoDto> respList = BeanCopyUtils.copyBeanList(page.getRecords(), KeypointEquipmentInfoDto.class); |
| | | |
| | | Set<Long> collectTypeIdSet = new HashSet(); |
| | | //获取额外信息 |
| | | respList.forEach(f->{ |
| | | //设备保养 |
| | |
| | | List<EquipmentRepairDetail> repairDetailList = equipmentRepairDetailService.queryAll(criteria2); |
| | | f.setRepaireDetailList(repairDetailList); |
| | | |
| | | // --------------------------- 获取设备设施类型管理ID----------------------- |
| | | collectTypeIdSet.add(f.getEquipmentTypeId()); |
| | | |
| | | // --------------------------- 获取部门信息----------------------- |
| | | //收集所用到的部门ID |
| | |
| | | checkDetailList.forEach(info->{info.setTestPersonDepartmentName(depNameMap.get(info.getTestPersonDepartmentId()));}); |
| | | repairDetailList.forEach(info->{info.setRepairPersonDepartmentName(depNameMap.get(info.getRepairPersonDepartmentId()));}); |
| | | }); |
| | | |
| | | |
| | | //获取设备设施类型名称 |
| | | if(!collectTypeIdSet.isEmpty()){ |
| | | List<EquipmentTypeMng> typeMngList = equipmentTypeMngRepository.selectList(new QueryWrapper<EquipmentTypeMng>().in("id",collectTypeIdSet)); |
| | | Map<Long, String> typePool = new HashMap<>(); |
| | | typeMngList.forEach(f->{ |
| | | typePool.put(f.getId(),f.getTypeName()); |
| | | }); |
| | | respList.forEach(f->{ |
| | | f.setEquipmentTypeName(typePool.get(f.getEquipmentTypeId())); |
| | | }); |
| | | } |
| | | |
| | | return new SearchResultVO<>( |
| | | true, |
| | | pageIndex, |
| | |
| | | checkDetailList.forEach(info->{info.setTestPersonDepartmentName(depNameMap.get(info.getTestPersonDepartmentId()));}); |
| | | repairDetailList.forEach(info->{info.setRepairPersonDepartmentName(depNameMap.get(info.getRepairPersonDepartmentId()));}); |
| | | |
| | | EquipmentTypeMng typeMng = equipmentTypeMngRepository.selectOne(new QueryWrapper<EquipmentTypeMng>().eq("id",infoDto.getEquipmentTypeId())); |
| | | if(typeMng != null){ |
| | | infoDto.setEquipmentTypeName(typeMng.getTypeName()); |
| | | } |
| | | return infoDto; |
| | | } |
| | | |
文件名从 safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/minioDemo/config/MinioConfig.java 修改 |
| | |
| | | package com.gkhy.safePlatform.minioDemo.config; |
| | | package com.gkhy.safePlatform.minioFile.config; |
| | | |
| | | import io.minio.MinioClient; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
对比新文件 |
| | |
| | | package com.gkhy.safePlatform.minioFile.controller; |
| | | |
| | | import com.gkhy.safePlatform.minioFile.service.MinioAccessService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping(value = "/minio/file") |
| | | public class MinioController { |
| | | |
| | | @Autowired |
| | | private MinioAccessService minioAccessService; |
| | | |
| | | @RequestMapping(value = "/view",method = RequestMethod.GET) |
| | | public Object viewFile(String obj){ |
| | | return minioAccessService.viewFile(obj); |
| | | } |
| | | |
| | | @RequestMapping(value = "/presign",method = RequestMethod.GET) |
| | | public Object getPresignUrl(String prefixName,String suffixName){ |
| | | return minioAccessService.getPresignUrl(prefixName,suffixName); |
| | | } |
| | | } |
| | | |
对比新文件 |
| | |
| | | package com.gkhy.safePlatform.minioFile.service; |
| | | |
| | | import com.gkhy.safePlatform.minioFile.config.MinioConfig; |
| | | import com.gkhy.safePlatform.minioFile.utils.UUIDUtil; |
| | | import io.minio.GetPresignedObjectUrlArgs; |
| | | import io.minio.MinioClient; |
| | | import io.minio.errors.*; |
| | | import io.minio.http.Method; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.security.InvalidKeyException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | @Service |
| | | public class MinioAccessService { |
| | | |
| | | @Resource |
| | | private MinioConfig minioConfig; |
| | | |
| | | @Autowired |
| | | private MinioClient minioClient; |
| | | |
| | | public String viewFile(String objectName){ |
| | | String url = null; |
| | | try { |
| | | url = minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder() |
| | | .method(Method.GET) |
| | | .bucket(minioConfig.getBucketName()) |
| | | .object(objectName) |
| | | .expiry(60).build()); |
| | | } catch (ErrorResponseException e) { |
| | | e.printStackTrace(); |
| | | } catch (InsufficientDataException e) { |
| | | e.printStackTrace(); |
| | | } catch (InternalException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidResponseException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (XmlParserException e) { |
| | | e.printStackTrace(); |
| | | } catch (ServerException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return url; |
| | | } |
| | | |
| | | public String getPresignUrl(String prefixName ,String suffixName){ |
| | | String uuid= UUIDUtil.initUUID(); |
| | | String objName = prefixName+uuid+suffixName; |
| | | String url = null; |
| | | try { |
| | | Map<String, String> reqParams = new HashMap<>(); |
| | | reqParams.put("response-content-type", "application/json"); |
| | | url = minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder() |
| | | .method(Method.PUT) |
| | | .bucket(minioConfig.getBucketName()) |
| | | .object(objName) |
| | | .expiry(60*2) |
| | | .extraQueryParams(reqParams) |
| | | .build()); |
| | | } catch (ErrorResponseException e) { |
| | | e.printStackTrace(); |
| | | } catch (InsufficientDataException e) { |
| | | e.printStackTrace(); |
| | | } catch (InternalException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidResponseException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (XmlParserException e) { |
| | | e.printStackTrace(); |
| | | } catch (ServerException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return url; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.gkhy.safePlatform.minioFile.utils; |
| | | |
| | | import java.util.UUID; |
| | | |
| | | public class UUIDUtil { |
| | | /** |
| | | * 生成8位UUID |
| | | */ |
| | | public static String initUUID() { |
| | | String[] chars = new String[]{"a", "b", "c", "d", "e", "f", |
| | | "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", |
| | | "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", |
| | | "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", |
| | | "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", |
| | | "W", "X", "Y", "Z"}; |
| | | StringBuffer shortBuffer = new StringBuffer(); |
| | | String uuid = UUID.randomUUID().toString().replace("-", ""); |
| | | for (int i = 0; i < 8; i++) { |
| | | String str = uuid.substring(i * 4, i * 4 + 4); |
| | | int x = Integer.parseInt(str, 16); |
| | | shortBuffer.append(chars[x % 0x3E]); |
| | | } |
| | | return shortBuffer.toString(); |
| | | } |
| | | } |