diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/archives/service/impl/ArchivesServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/archives/service/impl/ArchivesServiceImpl.java index e05a2d75..733538d2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/archives/service/impl/ArchivesServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/archives/service/impl/ArchivesServiceImpl.java @@ -155,32 +155,7 @@ public class ArchivesServiceImpl implements ArchivesService { */ @Override public List getDetailsList(ArchivesDetails archivesDetails) { - List list = archivesMapper.selectDetailsList(archivesDetails); - if (CollectionUtils.isNotEmpty(list)) { - for (ArchivesDetails details : list) { - if ((StringUtils.isNotBlank(details.getDocUrl())) && StringUtils.isNotBlank(details.getDocName())) { - if (details.getDocUrl().startsWith("http") && details.getUpdateBy() == null) { - String originalPath = details.getDocName(); - // 找到最后一个 '/' 字符的位置 - int lastSlashIndex = originalPath.lastIndexOf('/'); - // 从最后一个 '/' 字符之后提取文件名 - String fileName = originalPath.substring(lastSlashIndex + 1); - // 找到 '.png' 的位置 - int dotIndex = fileName.lastIndexOf('.'); - // 找到倒数第二个 '_' 的位置 - int underscoreIndex = fileName.lastIndexOf('_', dotIndex - 1); - // 截取文件名部分(不包含后缀和多余部分) - String namePart = fileName.substring(0, underscoreIndex); - // 截取后缀部分 - String suffix = fileName.substring(dotIndex); - // 拼接最终的文件名 - String extractedFileName = namePart + suffix; - details.setDocName(extractedFileName); - } - } - } - } - return list; + return archivesMapper.selectDetailsList(archivesDetails); } /** @@ -341,22 +316,6 @@ public class ArchivesServiceImpl implements ArchivesService { for (FileInfo fileInfo : fileInfos) { String fileUrl = fileInfo.getFilePath(); String originalPath = fileInfo.getFileName(); - if (fileInfo.getUpdateBy() == null) { - // 找到最后一个 '/' 字符的位置 - int lastSlashIndex = originalPath.lastIndexOf('/'); - // 从最后一个 '/' 字符之后提取文件名 - String fileName = originalPath.substring(lastSlashIndex + 1); - // 找到 '.png' 的位置 - int dotIndex = fileName.lastIndexOf('.'); - // 找到倒数第二个 '_' 的位置 - int underscoreIndex = fileName.lastIndexOf('_', dotIndex - 1); - // 截取文件名部分(不包含后缀和多余部分) - String namePart = fileName.substring(0, underscoreIndex); - // 截取后缀部分 - String suffix = fileName.substring(dotIndex); - // 拼接最终的文件名 - originalPath = namePart + suffix; - } if (!isValidFileExtension(originalPath)) { // 可以根据业务需求添加默认文件类型或进行其他处理 if (originalPath.lastIndexOf('.') == -1) { @@ -419,7 +378,7 @@ public class ArchivesServiceImpl implements ArchivesService { */ private boolean isValidFileExtension(String originalPath) { // 定义一个正则表达式,匹配常见的文件扩展名 - String regex = ".*\\.(png|pdf|jpg|jpeg|txt|docx|xlsx|xls|ppt|pptx|zip)$"; + String regex = ".*\\.(bmp|gif|jpg|jpeg|png|svg|doc|docx|xls|xlsx|csv|ppt|pptx|html|htm|txt|rar|zip|gz|bz2|mp4|avi|rmvb|pdf)$"; return Pattern.matches(regex, originalPath); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java index 4296caea..ed6f8b7a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/ComplexQueryController.java @@ -8,6 +8,7 @@ import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.basic.domain.*; +import com.bonus.material.basic.domain.vo.MaTypeSelectInfo; import com.bonus.material.basic.service.ComplexQueryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -398,4 +399,31 @@ public class ComplexQueryController extends BaseController { util.exportExcel(response, list, "综合查询--机具出库查询"); } + /** + * 修试查询--一机一档案查询 + * @param bean + * @return + */ + @ApiOperation(value = "修试查询--一机一档案查询") + @GetMapping("/getMaTypeSelectList") + public AjaxResult getMaTypeSelectList(MaTypeSelectInfo bean) { + Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + List list = complexQueryService.getMaTypeSelectList(bean); + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); + } + + /** + * 导出修试查询--一机一档案查询 + * @param response + * @param bean + */ + @ApiOperation("导出一机一档案查询") + @PostMapping("/exportMaTypeSelectList") + public void exportMaTypeSelectList(HttpServletResponse response, MaTypeSelectInfo bean) + { + List list = complexQueryService.getMaTypeSelectList(bean); + ExcelUtil util = new ExcelUtil<>(MaTypeSelectInfo.class); + util.exportExcel(response, list, "修试查询--导出一机一档案查询"); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/vo/MaTypeSelectInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/vo/MaTypeSelectInfo.java new file mode 100644 index 00000000..7abc6a3b --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/vo/MaTypeSelectInfo.java @@ -0,0 +1,96 @@ +package com.bonus.material.basic.domain.vo; + +import com.bonus.common.core.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 修试查询-一机一档案查询 + * @Author ma_sh + * @create 2025/4/2 10:22 + */ +@Data +public class MaTypeSelectInfo { + + /** ID */ + private Long id; + + @ApiModelProperty(value = "协议号") + @Excel(name = "协议号") + private String agreementCode; + + @ApiModelProperty(value = "单位id") + private Long unitId; + + @ApiModelProperty(value = "单位名称") + @Excel(name = "单位名称") + private String bmUnitName; + + @ApiModelProperty(value="工程id") + private Long proId; + + @ApiModelProperty(value="工程名称") + @Excel(name = "工程名称") + private String bmProName; + + @ApiModelProperty(value = "类型名称") + @Excel(name = "类型名称") + private String typeName; + + @ApiModelProperty(value = "规格型号") + @Excel(name = "规格型号") + private String typeModelName; + + @ApiModelProperty(value = "计量单位") + private String unitName; + + @ApiModelProperty(value = "设备编码") + @Excel(name = "设备编码") + private String maCode; + + @ApiModelProperty(value = "单号") + @Excel(name = "单号") + private String code; + + @ApiModelProperty(value = "操作人") + @Excel(name = "操作人") + private String createBy; + + @ApiModelProperty(value = "操作日期") + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "操作日期", dateFormat = "yyyy-MM-dd", width = 20) + private Date createTime; + + @ApiModelProperty(value = "操作类型") + @Excel(name = "操作类型") + private String operationType; + + @ApiModelProperty(value = "操作信息") + @Excel(name = "操作信息") + private String operationInfo; + + @ApiModelProperty(value="开始时间") + private String startTime; + + @ApiModelProperty(value="结束时间") + private String endTime; + + @ApiModelProperty(value="关键字") + private String keyWord; + + @ApiModelProperty(value="任务类型") + private int taskType; + + @ApiModelProperty(value="任务id") + private Long taskId; + + @ApiModelProperty(value="类型id") + private Long typeId; + + @ApiModelProperty(value="机具id") + private Long maId; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/ComplexQueryMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/ComplexQueryMapper.java index 1ff55c8d..bfdaccb0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/ComplexQueryMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/ComplexQueryMapper.java @@ -1,6 +1,7 @@ package com.bonus.material.basic.mapper; import com.bonus.material.basic.domain.*; +import com.bonus.material.basic.domain.vo.MaTypeSelectInfo; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -123,4 +124,25 @@ public interface ComplexQueryMapper { * @return */ List getScrapAuditList(ScrapAuditInfo bean); + + /** + * 修试查询--一机一档案查询 + * @param bean + * @return + */ + List getMaTypeSelectList(MaTypeSelectInfo bean); + + /** + * 根据id查询单位、工程及协议信息 + * @param dto + * @return + */ + MaTypeSelectInfo selectUnitAndProAndAgreementInfo(MaTypeSelectInfo dto); + + /** + * 查询收费配件信息 + * @param dto + * @return + */ + String getPartInfoList(MaTypeSelectInfo dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/ComplexQueryService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/ComplexQueryService.java index f995ddc2..626ec9a7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/ComplexQueryService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/ComplexQueryService.java @@ -1,6 +1,7 @@ package com.bonus.material.basic.service; import com.bonus.material.basic.domain.*; +import com.bonus.material.basic.domain.vo.MaTypeSelectInfo; import java.util.List; @@ -101,4 +102,11 @@ public interface ComplexQueryService { * @return */ List getScrapAuditList(ScrapAuditInfo bean); + + /** + * 修试查询--一机一档案查询 + * @param bean + * @return + */ + List getMaTypeSelectList(MaTypeSelectInfo bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/ComplexQueryServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/ComplexQueryServiceImpl.java index 898bf8aa..0c5ec2d2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/ComplexQueryServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/ComplexQueryServiceImpl.java @@ -5,6 +5,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.common.utils.StringUtils; import com.bonus.common.biz.enums.MaTypeManageTypeEnum; import com.bonus.material.basic.domain.*; +import com.bonus.material.basic.domain.vo.MaTypeSelectInfo; import com.bonus.material.basic.mapper.ComplexQueryMapper; import com.bonus.material.basic.service.ComplexQueryService; import lombok.extern.slf4j.Slf4j; @@ -503,4 +504,69 @@ public class ComplexQueryServiceImpl implements ComplexQueryService { return complexQueryMapper.getScrapAuditList(bean); } + /** + * 修试查询--一机一档案查询 + * @param bean + * @return + */ + @Override + public List getMaTypeSelectList(MaTypeSelectInfo bean) { + List recordList = complexQueryMapper.getMaTypeSelectList(bean); + List list = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(recordList)) { + for (MaTypeSelectInfo dto : recordList) { + if (StringUtils.isNotBlank(dto.getMaCode())) { + String[] split = dto.getMaCode().split(","); + if (split.length > 1) { + for (String code : split) { + MaTypeSelectInfo newRecord = new MaTypeSelectInfo(); + BeanUtils.copyProperties(dto, newRecord); + newRecord.setMaCode(code); + list.add(newRecord); + } + } else { + list.add(dto); + } + } else { + list.add(dto); + } + // 领用申请 + if (dto.getTaskType() == 19) { + // 根据id查询单位、工程及协议信息 + MaTypeSelectInfo vo = complexQueryMapper.selectUnitAndProAndAgreementInfo(dto); + if (vo != null) { + dto.setAgreementCode(StringUtils.isNotBlank(vo.getAgreementCode()) ? vo.getAgreementCode() : ""); + dto.setBmUnitName(StringUtils.isNotBlank(vo.getBmUnitName()) ? vo.getBmUnitName() : ""); + dto.setBmProName(StringUtils.isNotBlank(vo.getBmProName()) ? vo.getBmProName() : ""); + } + } + // 查询收费配件信息 + if (dto.getTaskType() == 4) { + String result = complexQueryMapper.getPartInfoList(dto); + if (StringUtils.isNotBlank(result)) { + dto.setOperationInfo(result); + } + } + } + } + // 根据关键字搜索查询 + if (CollectionUtils.isNotEmpty(list)) { + if (StringUtils.isNotBlank(bean.getKeyWord())) { + String keyWord = bean.getKeyWord(); + return list.stream().filter(item -> { + return (StringUtils.isNotBlank(item.getMaCode()) && item.getMaCode().contains(keyWord)) || + (StringUtils.isNotBlank(item.getTypeName()) && item.getTypeName().contains(keyWord)) || + (StringUtils.isNotBlank(item.getTypeModelName()) && item.getTypeModelName().contains(keyWord)) || + (StringUtils.isNotBlank(item.getAgreementCode()) && item.getAgreementCode().contains(keyWord)) || + (StringUtils.isNotBlank(item.getBmUnitName()) && item.getBmUnitName().contains(keyWord)) || + (StringUtils.isNotBlank(item.getBmProName()) && item.getBmProName().contains(keyWord)) || + (StringUtils.isNotBlank(item.getCode()) && item.getCode().contains(keyWord)) || + (StringUtils.isNotBlank(item.getCreateBy()) && item.getCreateBy().contains(keyWord)) || + (StringUtils.isNotBlank(item.getOperationInfo()) && item.getOperationInfo().contains(keyWord)) || + (StringUtils.isNotBlank(item.getOperationType()) && item.getOperationType().contains(keyWord)); + }).collect(Collectors.toList()); + } + } + return list; + } } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml index d8669273..2f0e7ddc 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/ComplexQueryMapper.xml @@ -277,7 +277,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0' LEFT JOIN tm_task tt ON bs.task_id = tt.task_id - WHERE bs.in_num != 0 and bs.result_msg = '操作成功' + WHERE bs.in_num != 0 and (bs.result_msg = '操作成功' OR bs.result_msg = '入库成功') and ( CASE @@ -894,5 +894,277 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP BY mm.ma_code ,mt.type_id + + + + +