From e899d2709f21b322232fb64778fef296233be3f0 Mon Sep 17 00:00:00 2001 From: fei <791364011@qq.com> Date: 星期一, 25 八月 2025 14:39:41 +0800 Subject: [PATCH] 修改了代码 --- archiveManager/pom.xml | 30 archiveManager/src/main/java/com/ruoyi/domain/ArchiveProjectName.java | 64 + archiveManager/src/main/java/com/ruoyi/domain/vo/AnalysisResult.java | 15 archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java | 164 ++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchivePlaceNameController.java | 114 +++ archiveManager/src/main/java/com/ruoyi/service/impl/ArchivePlaceNameServiceImpl.java | 157 ++++ archiveManager/src/main/java/com/ruoyi/domain/ArchivePlaceName.java | 87 ++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiverecordstouserController.java | 14 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java | 10 archiveManager/src/main/java/com/ruoyi/mapper/ArchivePlaceNameMapper.java | 20 archiveManager/src/main/java/com/ruoyi/service/IArchiverecordstouserService.java | 3 pom.xml | 7 archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java | 28 archiveManager/src/main/java/com/ruoyi/service/IArchiveProjectNameService.java | 60 + archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java | 26 ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 21 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveProjectNameController.java | 116 +++ archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java | 19 archiveManager/src/main/java/com/ruoyi/domain/ArchiveRecords.java | 15 archiveManager/src/main/java/com/ruoyi/service/IArchivePlaceNameService.java | 69 + archiveManager/src/main/java/com/ruoyi/service/impl/ArchiverecordstouserServiceImpl.java | 9 archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java | 72 + ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java | 63 + archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java | 42 archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveProjectNameServiceImpl.java | 116 +++ ruoyi-admin/pom.xml | 34 archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java | 18 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java | 37 ruoyi-admin/src/main/resources/application.yml | 2 archiveManager/src/main/java/com/ruoyi/mapper/ArchiveProjectNameMapper.java | 9 archiveManager/src/main/java/com/ruoyi/util/ErrorcodeExceptionextends.java | 22 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java | 511 ++++++++++++++ ruoyi-admin/src/main/resources/application-druid.yml | 4 archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java | 5 archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveCategoryServiceImpl.java | 15 archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java | 54 + archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java | 33 archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java | 60 + 38 files changed, 2,093 insertions(+), 52 deletions(-) diff --git a/archiveManager/pom.xml b/archiveManager/pom.xml index a9e76c6..bf20a81 100644 --- a/archiveManager/pom.xml +++ b/archiveManager/pom.xml @@ -48,6 +48,36 @@ <groupId>com.ruoyi</groupId> <artifactId>ruoyi-system</artifactId> </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <scope>provided</scope> + </dependency> + <!-- 绯婃秱宸ュ叿鍖呬娇鐢ㄧ敓鎴愪簩缁寸爜--> + <dependency> + <groupId>cn.hutool</groupId> + <artifactId>hutool-all</artifactId> + <version>5.5.9</version> + </dependency> + <dependency> + <groupId>com.google.zxing</groupId> + <artifactId>core</artifactId> + <version>3.3.3</version> + </dependency> + + + <dependency> + <groupId>net.sf.barcode4j</groupId> + <artifactId>barcode4j</artifactId> + <version>2.1</version> + </dependency> + <dependency> + <groupId>com.itextpdf</groupId> + <artifactId>itextpdf</artifactId> + <version>5.5.13</version> + <scope>compile</scope> + </dependency> + </dependencies> </project> \ No newline at end of file diff --git a/archiveManager/src/main/java/com/ruoyi/domain/ArchivePlaceName.java b/archiveManager/src/main/java/com/ruoyi/domain/ArchivePlaceName.java new file mode 100644 index 0000000..fae1c67 --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/domain/ArchivePlaceName.java @@ -0,0 +1,87 @@ +package com.ruoyi.domain; + + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +import java.util.Date; + +/** + * 銆愯濉啓鍔熻兘鍚嶇О銆戝璞� archive_place_name + * + * @author ruoyi + * @date 2025-08-08 + */ +public class ArchivePlaceName extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 涓婚敭 */ + + /** $column.columnComment */ + @TableId(type = IdType.AUTO) + private Long id; + + /** 瀵瑰簲鐨勫尯鍙� */ + @Excel(name = "瀵瑰簲鐨勫尯鍙�") + private String nnumber; + + @Override + public Date getCreateTime() { + return createTime; + } + + @Override + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + private Date createTime; + /** 瀵瑰簲鐨勫尯鍚嶇О */ + @Excel(name = "瀵瑰簲鐨勫尯鍚嶇О") + private String name; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setNnumber(String nnumber) + { + this.nnumber = nnumber; + } + + public String getNnumber() + { + return nnumber; + } + + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("nnumber", getNnumber()) + .append("name", getName()) + .toString(); + } +} diff --git a/archiveManager/src/main/java/com/ruoyi/domain/ArchiveProjectName.java b/archiveManager/src/main/java/com/ruoyi/domain/ArchiveProjectName.java new file mode 100644 index 0000000..82155c3 --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/domain/ArchiveProjectName.java @@ -0,0 +1,64 @@ +package com.ruoyi.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +import java.util.Date; + +/** + * 銆愯濉啓鍔熻兘鍚嶇О銆戝璞� archive_project_name + * + * @author ruoyi + * @date 2025-08-08 + */ +public class ArchiveProjectName extends BaseEntity +{ + private static final long serialVersionUID = 1L; + /** $column.columnComment */ + @TableId(type = IdType.AUTO) + private Long id; + + @Excel(name = "椤圭洰鍚嶇О") + private String name; + private Date createTime; + + @Override + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getCreateTime() { + return createTime; + } + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("name", getName()) + .toString(); + } +} diff --git a/archiveManager/src/main/java/com/ruoyi/domain/ArchiveRecords.java b/archiveManager/src/main/java/com/ruoyi/domain/ArchiveRecords.java index 78bbbc7..b9bc66f 100644 --- a/archiveManager/src/main/java/com/ruoyi/domain/ArchiveRecords.java +++ b/archiveManager/src/main/java/com/ruoyi/domain/ArchiveRecords.java @@ -34,6 +34,17 @@ @Excel(name = "鍙戦棶鍙�") private String inquiryNumber; + public String getEveryProjectName() { + return everyProjectName; + } + + public void setEveryProjectName(String everyProjectName) { + this.everyProjectName = everyProjectName; + } + + @Excel(name = "姣忎釜妗堝嵎灞炰簬鐨勯」鐩悕绉�") + + private String everyProjectName; /** 妗堝嵎棰樺悕 */ @Excel(name = "妗堝嵎棰樺悕") private String caseTitle; @@ -103,6 +114,8 @@ private String remarks; + + /** 鍘嗗彶鐩稿叧鍙戞枃鍙� */ @Excel(name = "鍘嗗彶鐩稿叧鍙戞枃鍙�") private String historicalReferenceNumber; @@ -114,6 +127,8 @@ private String archiveRecordsId; @TableField(exist = false) + + // private String archiveStatus private Long userId; @Override diff --git a/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java b/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java index 5206ff0..0585726 100644 --- a/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java +++ b/archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java @@ -25,17 +25,28 @@ /** $column.columnComment */ @TableId(type = IdType.AUTO) private Long materialId; + @Excel(name = "鏂囦欢鏉愭枡搴忓彿") + private Long fileNumber; + + public Long getFileNumber() { + return fileNumber; + } + + public void setFileNumber(Long fileNumber) { + this.fileNumber = fileNumber; + } /** $column.columnComment */ - @Excel(name = "鏂囦欢缂栦换鑰�") + @Excel(name = "缂栦换鑰�") private String creator; /** $column.columnComment */ - @Excel(name = "鏂囦欢鎻愬悕") + @Excel(name = "鏂囦欢棰樺悕") private String title; /** $column.columnComment */ - @Excel(name = "鏃ユ湡") + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd") private Date date; /** $column.columnComment */ @@ -104,7 +115,7 @@ /** $column.columnComment */ @Excel(name = "澶у皬") - private Long fileSize; + private Double fileSize; /** $column.columnComment */ @Excel(name = "闄勪欢鍙婂巻鍙插彂鏂囧彿") @@ -115,15 +126,30 @@ private String remarks; /** $column.columnComment */ - @Excel(name = "${comment}") private Date createdAt; /** $column.columnComment */ - @Excel(name = "${comment}") private Date updatedAt; + private String fileStyle; + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + + private String url; private Long recordId; + + public String getFileStyle() { + return fileStyle; + } + + public void setFileStyle(String fileStyle) { + this.fileStyle = fileStyle; + } public Long getRecordId() { return recordId; @@ -333,12 +359,12 @@ return height; } - public void setFileSize(Long fileSize) + public void setFileSize(Double fileSize) { this.fileSize = fileSize; } - public Long getFileSize() + public Double getFileSize() { return fileSize; } diff --git a/archiveManager/src/main/java/com/ruoyi/domain/vo/AnalysisResult.java b/archiveManager/src/main/java/com/ruoyi/domain/vo/AnalysisResult.java new file mode 100644 index 0000000..0fd8c5a --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/domain/vo/AnalysisResult.java @@ -0,0 +1,15 @@ +package com.ruoyi.domain.vo; + +import lombok.Data; + +@Data +public class AnalysisResult { + + private String everyProjectName; + + private Long cnt ; + + private Long unfinished; + + private Long finished; +} diff --git a/archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java b/archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java new file mode 100644 index 0000000..2bdfc18 --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/domain/vo/ArchiveInfoVo.java @@ -0,0 +1,54 @@ +package com.ruoyi.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +@Data +public class ArchiveInfoVo { + + + /** 妗f鍙� */ + @Excel(name = "妗f鍙�") + private String recordId; + /** 妗f绠�(瀹�)鍙� */ + @Excel(name = "妗f绠�(瀹�)鍙�") + private String archiveRoomNumber; + /** 缂╁井鍙� */ + @Excel(name = "缂╁井鍙�") + private String microfilmNumber; + /** 鍙戦棶鍙� */ + @Excel(name = "鍙戞枃鍙�") + private String inquiryNumber; + + + + /** 妗堝嵎棰樺悕 */ + @Excel(name = "妗堝嵎棰樺悕") + private String caseTitle; + + + + /** 缂栧埗鏃ユ湡 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "缂栧埗鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd") + private Date preparationDate; + /** 缂栧埗鍗曚綅 */ + @Excel(name = "缂栧埗鍗曚綅") + private String preparationUnit; + + /** 淇濈鏈熼檺 */ + @Excel(name = "淇濈鏈熼檺") + private String retentionPeriod; + + /** 瀵嗙骇 */ + @Excel(name = "瀵嗙骇") + private String securityClassification; + + + + + +} diff --git a/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java new file mode 100644 index 0000000..ee6d185 --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java @@ -0,0 +1,28 @@ +package com.ruoyi.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +@Data +public class DocumentMaterialsVo { + @Excel(name = "缂栦换鑰�") + private String creator; + @Excel(name = "鏂囦欢棰樺悕") + + private String title; + + @JsonFormat(pattern = "yyyy-MM-dd") + + @Excel(name = "鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd") + + private Date date; + @Excel(name = "椤靛彿") + + private Long pageNumber; + @Excel(name = "澶囨敞") + + private String remarks; +} diff --git a/archiveManager/src/main/java/com/ruoyi/mapper/ArchivePlaceNameMapper.java b/archiveManager/src/main/java/com/ruoyi/mapper/ArchivePlaceNameMapper.java new file mode 100644 index 0000000..55e36b8 --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/mapper/ArchivePlaceNameMapper.java @@ -0,0 +1,20 @@ +package com.ruoyi.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.domain.ArchivePlaceName; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 銆愯濉啓鍔熻兘鍚嶇О銆慚apper鎺ュ彛 + * + * @author ruoyi + * @date 2025-08-08 + */ +@Mapper +public interface ArchivePlaceNameMapper extends BaseMapper<ArchivePlaceName> +{ + +} diff --git a/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveProjectNameMapper.java b/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveProjectNameMapper.java new file mode 100644 index 0000000..c278c81 --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveProjectNameMapper.java @@ -0,0 +1,9 @@ +package com.ruoyi.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.domain.ArchiveProjectName; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ArchiveProjectNameMapper extends BaseMapper<ArchiveProjectName> { +} diff --git a/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java b/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java index d26677a..13d8b96 100644 --- a/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java +++ b/archiveManager/src/main/java/com/ruoyi/mapper/ArchiveRecordsMapper.java @@ -3,10 +3,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + import com.ruoyi.domain.ArchiveRecords; +import com.ruoyi.domain.vo.AnalysisResult; +import com.ruoyi.domain.vo.ArchiveInfoVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; + +import java.util.List; @Mapper public interface ArchiveRecordsMapper extends BaseMapper<ArchiveRecords> { @@ -14,9 +19,9 @@ @Select({ "<script>", - "SELECT c.*,a.archive_records_id,b.user_id FROM archiverecordstouser a inner join sys_user b ON a.user_id = b.user_id right join archive_records c on c.record_id=a.archive_records_id ${ew.customSqlSegment} ", + "SELECT c.*,a.archive_records_id,b.user_id, if(a.user_id=#{userId}, TRUE, FALSE) as tst FROM archiverecordstouser a inner join sys_user b ON a.user_id = b.user_id right join archive_records c on c.record_id=a.archive_records_id ${ew.customSqlSegment} ", "<if test= \"userId !=1 \">", - "order by a.user_id desc", + "order by tst desc", "</if>", "</script>" }) @@ -25,4 +30,14 @@ @Select("select max(id) from archive_records") Long findMaxId(); + @Select("UPDATE `archivesys`.`archive_records` SET `inquiry_number` = '', `case_title` = NULL, `public_attribute` = NULL, `preparation_unit` = NULL, `preparation_date` = NULL, `retention_period` = NULL, `security_classification` = NULL, `page_count` = NULL, `filing_number` = NULL, `construction_unit` = NULL, `construction_address` = NULL, `project_name` = '', `project_number` = NULL, `scanning_company` = NULL, `archive_room_number` = NULL, `microfilm_number` = NULL, `remarks` = NULL, `historical_reference_number` = NULL, `record_status` = NULL, `every_project_name` = NULL WHERE `id` = #{id}") + Long updateAllInfoById(@Param("id") Long id); + + @Select("select record_id,archive_room_number,microfilm_number,inquiry_number,case_title,preparation_date,preparation_unit,retention_period,security_classification from archive_records where id=#{id}") + ArchiveInfoVo findByRecordId(@Param("id") Long id); + + @Select("SELECT every_project_name, count(*) as cnt, (select count(*) from archive_records as ac where ac.every_project_name=ar.every_project_name and record_status='鏈綍鍏�') as unfinished,\n" + + "(select count(*) from archive_records as ac where ac.every_project_name=ar.every_project_name and record_status='褰曞叆瀹屾垚') as finished \n" + + " from archive_records as ar GROUP BY every_project_name") + List<AnalysisResult> statisticAyasis(); } diff --git a/archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java b/archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java index 3ce0637..ec7c9ba 100644 --- a/archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java +++ b/archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java @@ -2,8 +2,34 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.domain.DocumentMaterials; +import com.ruoyi.domain.vo.DocumentMaterialsVo; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; @Mapper public interface DocumentMaterialsMapper extends BaseMapper<DocumentMaterials> { + + @Select("update document_materials SET url = #{url},file_number=#{fileNumber},page_order=#{pageOrder},width=#{width},height=#{height},file_size=#{fileSize}, format=#{format} where page_number = #{pageNumber}") + Long updateInfoByPageNumber(@Param("pageNumber") Long pageNumber,@Param("fileNumber") Long fileNumber,@Param("pageOrder") Long pageOrder,@Param("width") int width, @Param("height") int height, @Param("fileSize") Double fileSize,@Param("url") String url,@Param("format") String format); + + + //鏍规嵁棰樺悕鎷垮埌鏈�澶х殑pageOrder + @Select("select count(*) from document_materials where title=#{title} and page_number<#{pageNumber} and stage=#{stage}") + Long getMaxPageOrder(@Param("title")String title,@Param("pageNumber") Long pageNumber,@Param("stage") String stage); + + //璁$畻鏂囦欢鐨勫簭鍙� + @Select("select count(distinct(title))-1 from document_materials where page_number<=#{pageNumber}") + Long getFileNumber(@Param("pageNumber") Long pageNumber); + + //鏌ヨ鍗峰唴鐩綍 + @Select("select creator,title, date, page_number,remarks from document_materials\n" + + "WHERE page_number IN (\n" + + " SELECT MIN(page_number)\n" + + " FROM document_materials where record_id=#{recordId}\n" + + " GROUP BY stage, title\n" + + ") order by page_number ;") + List<DocumentMaterialsVo> getArchiveMatInfo(@Param("recordId") String recordId); } diff --git a/archiveManager/src/main/java/com/ruoyi/service/IArchivePlaceNameService.java b/archiveManager/src/main/java/com/ruoyi/service/IArchivePlaceNameService.java new file mode 100644 index 0000000..320656d --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/service/IArchivePlaceNameService.java @@ -0,0 +1,69 @@ +package com.ruoyi.service; + + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.domain.ArchiveCategory; +import com.ruoyi.domain.ArchivePlaceName; + +import java.util.List; + +/** + * 銆愯濉啓鍔熻兘鍚嶇О銆慡ervice鎺ュ彛 + * + * @author ruoyi + * @date 2025-08-08 + */ +public interface IArchivePlaceNameService +{ + + + AjaxResult selectDataList(ArchivePlaceName archivePlaceName, Integer pageNum, Integer pageSize); + + /** + * 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param id 銆愯濉啓鍔熻兘鍚嶇О銆戜富閿� + * @return 銆愯濉啓鍔熻兘鍚嶇О銆� + */ + public ArchivePlaceName selectArchivePlaceNameById(Long id); + + /** + * 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆戝垪琛� + * + * @param archivePlaceName 銆愯濉啓鍔熻兘鍚嶇О銆� + * @return 銆愯濉啓鍔熻兘鍚嶇О銆戦泦鍚� + */ + public List<ArchivePlaceName> selectArchivePlaceNameList(ArchivePlaceName archivePlaceName); + + /** + * 鏂板銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param archivePlaceName 銆愯濉啓鍔熻兘鍚嶇О銆� + * @return 缁撴灉 + */ + public int insertArchivePlaceName(ArchivePlaceName archivePlaceName); + + /** + * 淇敼銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param archivePlaceName 銆愯濉啓鍔熻兘鍚嶇О銆� + * @return 缁撴灉 + */ + public int updateArchivePlaceName(ArchivePlaceName archivePlaceName); + + /** + * 鎵归噺鍒犻櫎銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param ids 闇�瑕佸垹闄ょ殑銆愯濉啓鍔熻兘鍚嶇О銆戜富閿泦鍚� + * @return 缁撴灉 + */ + public int deleteArchivePlaceNameByIds(Long[] ids); + + /** + * 鍒犻櫎銆愯濉啓鍔熻兘鍚嶇О銆戜俊鎭� + * + * @param id 銆愯濉啓鍔熻兘鍚嶇О銆戜富閿� + * @return 缁撴灉 + */ + public int deleteArchivePlaceNameById(Long id); +} diff --git a/archiveManager/src/main/java/com/ruoyi/service/IArchiveProjectNameService.java b/archiveManager/src/main/java/com/ruoyi/service/IArchiveProjectNameService.java new file mode 100644 index 0000000..6659c4c --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/service/IArchiveProjectNameService.java @@ -0,0 +1,60 @@ +package com.ruoyi.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.domain.ArchivePlaceName; +import com.ruoyi.domain.ArchiveProjectName; + +import java.util.List; + +public interface IArchiveProjectNameService { + + AjaxResult selectDataList(ArchiveProjectName archiveProjectName, Integer pageNum, Integer pageSize); + + /** + * 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param id 銆愯濉啓鍔熻兘鍚嶇О銆戜富閿� + * @return 銆愯濉啓鍔熻兘鍚嶇О銆� + */ + public ArchiveProjectName selectArchiveProjectNameById(Long id); + + /** + * 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆戝垪琛� + * + * @param archiveProjectName 銆愯濉啓鍔熻兘鍚嶇О銆� + * @return 銆愯濉啓鍔熻兘鍚嶇О銆戦泦鍚� + */ + public List<ArchiveProjectName> selectArchiveProjectNameList(ArchiveProjectName archiveProjectName); + + /** + * 鏂板銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param archiveProjectName 銆愯濉啓鍔熻兘鍚嶇О銆� + * @return 缁撴灉 + */ + public int insertArchiveProjectName(ArchiveProjectName archiveProjectName); + + /** + * 淇敼銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param archiveProjectName 銆愯濉啓鍔熻兘鍚嶇О銆� + * @return 缁撴灉 + */ + public int updateArchiveProjectName(ArchiveProjectName archiveProjectName); + + /** + * 鎵归噺鍒犻櫎銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param ids 闇�瑕佸垹闄ょ殑銆愯濉啓鍔熻兘鍚嶇О銆戜富閿泦鍚� + * @return 缁撴灉 + */ + public int deleteArchiveProjectNameByIds(Long[] ids); + + /** + * 鍒犻櫎銆愯濉啓鍔熻兘鍚嶇О銆戜俊鎭� + * + * @param id 銆愯濉啓鍔熻兘鍚嶇О銆戜富閿� + * @return 缁撴灉 + */ + public int deleteArchiveProjectNameById(Long id); +} diff --git a/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java b/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java index 079abe1..a491de2 100644 --- a/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java +++ b/archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java @@ -2,6 +2,11 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ArchiveRecords; +import com.ruoyi.domain.vo.AnalysisResult; +import com.ruoyi.domain.vo.ArchiveInfoVo; +import org.apache.ibatis.annotations.Param; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -64,4 +69,17 @@ * @return 缁撴灉 */ public int deleteArchiveRecordsById(Long id); + + + ArchiveInfoVo selectByRecordId(Long id); + + + + @Transactional + public AjaxResult importExcel(MultipartFile file) ; + + + + List<AnalysisResult> statisticAya(); + } diff --git a/archiveManager/src/main/java/com/ruoyi/service/IArchiverecordstouserService.java b/archiveManager/src/main/java/com/ruoyi/service/IArchiverecordstouserService.java index ea60c0d..400661b 100644 --- a/archiveManager/src/main/java/com/ruoyi/service/IArchiverecordstouserService.java +++ b/archiveManager/src/main/java/com/ruoyi/service/IArchiverecordstouserService.java @@ -25,6 +25,9 @@ */ public Archiverecordstouser selectArchiverecordstouserById(Long id); + + + public boolean selectArchiveRecordUsers(String recordId); /** * 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆戝垪琛� * diff --git a/archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java b/archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java index a47faf7..3077fe9 100644 --- a/archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java +++ b/archiveManager/src/main/java/com/ruoyi/service/IDocumentMaterialsService.java @@ -3,6 +3,8 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.Archiverecordstouser; import com.ruoyi.domain.DocumentMaterials; +import com.ruoyi.domain.vo.DocumentMaterialsVo; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -56,4 +58,7 @@ * @return 缁撴灉 */ public int deleteDocumentMaterialsByMaterialId(String materialId); + public Long getFiNum(Long pageNumber); + public int updateByPageNumber(Long pageNumber,Long fileNumber, int wid, int hei, double sz,String url,String format); + public List<DocumentMaterialsVo> findArchMInfo(String recordId); } diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveCategoryServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveCategoryServiceImpl.java index da6f49e..13610b0 100644 --- a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveCategoryServiceImpl.java +++ b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveCategoryServiceImpl.java @@ -46,20 +46,7 @@ LambdaQueryWrapper<ArchiveCategory> lqw = new LambdaQueryWrapper<>(); lqw.like(!StringUtils.isEmpty(archiveRecords.getNumb()), ArchiveCategory::getNumb, archiveRecords.getNumb()) .like(!StringUtils.isEmpty(archiveRecords.getNname()), ArchiveCategory::getNname, archiveRecords.getNname()); -// lqw.like(!StringUtils.isEmpty(archiveRecords.getProjectName()), ArchiveRecords::getProjectName, archiveRecords.getProjectName()) -// .like(!StringUtils.isEmpty(archiveRecords.getFilingNumber()), ArchiveRecords::getFilingNumber, archiveRecords.getFilingNumber()) -// .like(!StringUtils.isEmpty(archiveRecords.getArchiveRoomNumber()), ArchiveRecords::getArchiveRoomNumber, archiveRecords.getArchiveRoomNumber()) -// .like(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId, archiveRecords.getRecordId()); -// // .like(!StringUtils.isEmpty(zfProperty.getLocation()), ZfProperty::getLocation, zfProperty.getLocation()) -// .like(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder()) -// .like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress()) -// .like(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark()) -// .eq(zfProperty.getFamilyId()!=null,ZfProperty::getFamilyId,zfProperty.getFamilyId()) -// .in(ZfProperty::getFamilyId,familyIdList) -// .eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime()) -// .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime()); -// lqw.orderByDesc(ZfProperty::getCreateTime); - // lqw.orderByDesc(ArchiveRecords::isOwnData); + lqw.orderByDesc(ArchiveCategory::getCtime); System.out.println("ssssssssssssddd0000000000000000"); return lqw; diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchivePlaceNameServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchivePlaceNameServiceImpl.java new file mode 100644 index 0000000..c19a644 --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchivePlaceNameServiceImpl.java @@ -0,0 +1,157 @@ +package com.ruoyi.service.impl; + + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.MapUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.domain.ArchiveCategory; +import com.ruoyi.domain.ArchivePlaceName; + +import com.ruoyi.service.IArchivePlaceNameService; + +import org.springframework.stereotype.Service; + +import com.ruoyi.mapper.ArchivePlaceNameMapper; +@Service +public class ArchivePlaceNameServiceImpl extends ServiceImpl<ArchivePlaceNameMapper, ArchivePlaceName> implements IArchivePlaceNameService { + private LambdaQueryWrapper<ArchivePlaceName> buildCondition(ArchivePlaceName archivePlaceName){ + LambdaQueryWrapper<ArchivePlaceName> lqw = new LambdaQueryWrapper<>(); + lqw.like(!StringUtils.isEmpty(archivePlaceName.getName()), ArchivePlaceName::getName, archivePlaceName.getName()) + .like(!StringUtils.isEmpty(archivePlaceName.getNnumber()), ArchivePlaceName::getNnumber, archivePlaceName.getNnumber()); + lqw.orderByDesc(ArchivePlaceName::getCreateTime); + System.out.println("ssssssssssssddd0000000000000000"); + return lqw; + + } + + @Override + public AjaxResult selectDataList(ArchivePlaceName archivePlaceName, Integer pageNum, Integer pageSize) { + LambdaQueryWrapper<ArchivePlaceName> lqw = buildCondition(archivePlaceName); + + + Page<ArchivePlaceName> zfClanPage = new Page<>(pageNum, pageSize); + Page<ArchivePlaceName> pageResult = page(zfClanPage, lqw); + + List<ArchivePlaceName> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹� + + + + // List<ArchiveRecords> beanRecords = list(lqw); + // log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords); + // return markOwnData(familyId, fatherFaId, motherFaId, beanRecords); + HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords); + + + return AjaxResult.success(data); + } + + /** + * 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param id 銆愯濉啓鍔熻兘鍚嶇О銆戜富閿� + * @return 銆愯濉啓鍔熻兘鍚嶇О銆� + */ + @Override + public ArchivePlaceName selectArchivePlaceNameById(Long id) + { + LambdaQueryWrapper<ArchivePlaceName> lqw = new LambdaQueryWrapper<>(); + lqw.eq(id!=null, ArchivePlaceName::getId, id); + List<ArchivePlaceName> records = list(lqw); + if(!records.isEmpty()) + return records.get(0); + else + return null; + } + + /** + * 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆戝垪琛� + * + * @param archivePlaceName 銆愯濉啓鍔熻兘鍚嶇О銆� + * @return 銆愯濉啓鍔熻兘鍚嶇О銆� + */ + @Override + public List<ArchivePlaceName> selectArchivePlaceNameList(ArchivePlaceName archivePlaceName) + { + LambdaQueryWrapper<ArchivePlaceName> lambdaQueryWrapper = buildCondition(archivePlaceName); + List<ArchivePlaceName> beanRecords = list(lambdaQueryWrapper); + System.out.println(beanRecords.size()); + return beanRecords; + } + + /** + * 鏂板銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param archivePlaceName 銆愯濉啓鍔熻兘鍚嶇О銆� + * @return 缁撴灉 + */ + @Override + public int insertArchivePlaceName(ArchivePlaceName archivePlaceName) + { + LocalDateTime time = LocalDateTime.now(); + + Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); + archivePlaceName.setCreateTime(date); + boolean res = this.save(archivePlaceName); + if(res) + return 1; + else + return 0; + + } + + /** + * 淇敼銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param archivePlaceName 銆愯濉啓鍔熻兘鍚嶇О銆� + * @return 缁撴灉 + */ + @Override + public int updateArchivePlaceName(ArchivePlaceName archivePlaceName) + { + boolean result = updateById(archivePlaceName); + if(result) + return 1; + else + return 0; + } + + /** + * 鎵归噺鍒犻櫎銆愯濉啓鍔熻兘鍚嶇О銆� + * + * @param ids 闇�瑕佸垹闄ょ殑銆愯濉啓鍔熻兘鍚嶇О銆戜富閿� + * @return 缁撴灉 + */ + @Override + public int deleteArchivePlaceNameByIds(Long[] ids) + { + if (this.removeByIds(Arrays.asList(ids))) { + return 1; + } + else + return 0; + + } + + /** + * 鍒犻櫎銆愯濉啓鍔熻兘鍚嶇О銆戜俊鎭� + * + * @param id 銆愯濉啓鍔熻兘鍚嶇О銆戜富閿� + * @return 缁撴灉 + */ + @Override + public int deleteArchivePlaceNameById(Long id) + { + return 0; + } +} diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveProjectNameServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveProjectNameServiceImpl.java new file mode 100644 index 0000000..f45a3a7 --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveProjectNameServiceImpl.java @@ -0,0 +1,116 @@ +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.MapUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.domain.ArchiveCategory; +import com.ruoyi.domain.ArchivePlaceName; +import com.ruoyi.domain.ArchiveProjectName; + +import com.ruoyi.mapper.ArchiveProjectNameMapper; +import com.ruoyi.service.IArchiveProjectNameService; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +@Service +public class ArchiveProjectNameServiceImpl extends ServiceImpl<ArchiveProjectNameMapper, ArchiveProjectName> implements IArchiveProjectNameService { + + private LambdaQueryWrapper<ArchiveProjectName> buildCondition(ArchiveProjectName archiveProjectName){ + LambdaQueryWrapper<ArchiveProjectName> lqw = new LambdaQueryWrapper<>(); + lqw.like(!StringUtils.isEmpty(archiveProjectName.getName()), ArchiveProjectName::getName, archiveProjectName.getName()); + lqw.orderByDesc(ArchiveProjectName::getCreateTime); + System.out.println("ssssssssssssddd0000000000000000"); + return lqw; + + } + + + @Override + public AjaxResult selectDataList(ArchiveProjectName archiveProjectName, Integer pageNum, Integer pageSize) { + LambdaQueryWrapper<ArchiveProjectName> lqw = buildCondition(archiveProjectName); + + + Page<ArchiveProjectName> zfClanPage = new Page<>(pageNum, pageSize); + Page<ArchiveProjectName> pageResult = page(zfClanPage, lqw); + + List<ArchiveProjectName> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹� + + + + // List<ArchiveRecords> beanRecords = list(lqw); + // log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords); + // return markOwnData(familyId, fatherFaId, motherFaId, beanRecords); + HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords); + + + return AjaxResult.success(data); + } + + + @Override + public ArchiveProjectName selectArchiveProjectNameById(Long id) { + LambdaQueryWrapper<ArchiveProjectName> lqw = new LambdaQueryWrapper<>(); + System.out.println(id); + lqw.eq(id!=null, ArchiveProjectName::getId, id); + List<ArchiveProjectName> records = list(lqw); + if(!records.isEmpty()) + return records.get(0); + else + return null; + } + + @Override + public List<ArchiveProjectName> selectArchiveProjectNameList(ArchiveProjectName archiveProjectName) { + LambdaQueryWrapper<ArchiveProjectName> lambdaQueryWrapper = buildCondition(archiveProjectName); + List<ArchiveProjectName> beanRecords = list(lambdaQueryWrapper); + System.out.println(beanRecords.size()); + return beanRecords; + } + + @Override + public int insertArchiveProjectName(ArchiveProjectName archiveProjectName) { + LocalDateTime time = LocalDateTime.now(); + + Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); + archiveProjectName.setCreateTime(date); + boolean res = this.save(archiveProjectName); + if(res) + return 1; + else + return 0; + } + + @Override + public int updateArchiveProjectName(ArchiveProjectName archiveProjectName) { + boolean result = updateById(archiveProjectName); + if(result) + return 1; + else + return 0; + } + + @Override + public int deleteArchiveProjectNameByIds(Long[] ids) { + if (this.removeByIds(Arrays.asList(ids))) { + return 1; + } + else + return 0; + + } + + @Override + public int deleteArchiveProjectNameById(Long id) { + return 0; + } +} diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java index 4036f57..94c8977 100644 --- a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java +++ b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java @@ -11,13 +11,17 @@ import com.ruoyi.common.utils.MapUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ArchiveRecords; import com.ruoyi.domain.Archiverecordstouser; +import com.ruoyi.domain.vo.AnalysisResult; +import com.ruoyi.domain.vo.ArchiveInfoVo; import com.ruoyi.mapper.ArchiveRecordsMapper; import com.ruoyi.mapper.ArchiverecordstouserMapper; import com.ruoyi.service.IArchiveRecordsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; /** * 妗f璁板綍Service涓氬姟灞傚鐞� @@ -166,6 +170,10 @@ Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); archiveRecords.setCreateTime(date); + + + archiveRecords.setRecordStatus("鏈綍鍏�"); + // archiveRecords boolean res = this.save(archiveRecords); if(res) return 1; @@ -198,11 +206,13 @@ @Override public int deleteArchiveRecordsByIds(Long[] ids) { - if (this.removeByIds(Arrays.asList(ids))) { - return 1; + Long res = 0L; + for(Long id: ids) + { + this.baseMapper.updateAllInfoById(id); + } - else - return 0; + return 1; } /** @@ -216,4 +226,58 @@ { return 0; } + + @Override + public ArchiveInfoVo selectByRecordId(Long id) { + return this.baseMapper.findByRecordId(id); + } + + @Override + public AjaxResult importExcel(MultipartFile file) { + ExcelUtil<ArchiveRecords> util = new ExcelUtil<>(ArchiveRecords.class); + List<ArchiveRecords> dataList = null; + try { + dataList = util.importExcel(file.getInputStream()); + } catch (Exception e) { + throw new RuntimeException("娌℃湁鎸夌収瑙勫垯瀵煎叆鏁版嵁"); + } + + assert dataList != null; + + for (ArchiveRecords archiveRecords : dataList) { + // physcialService.mySave(physcial); + this.mySave(archiveRecords); + } + + return AjaxResult.success(); + } + + @Override + public List<AnalysisResult> statisticAya() { + return this.baseMapper.statisticAyasis(); + } + + + public AjaxResult mySave(ArchiveRecords archiveRecords) { + + + //妫�鏌ユ槸鍚︽湁閲嶅鏁版嵁鎻掑叆 + LambdaQueryWrapper<ArchiveRecords> lqw = new LambdaQueryWrapper<>(); + lqw.eq(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId,archiveRecords.getRecordId()); + List<ArchiveRecords> list = list(lqw); + if (list.size() > 0) { + // throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁"); + //濡傛灉鏈夐噸澶嶆暟鎹紝鍒欐牴鎹畆ecordId杩涜鏁版嵁淇敼 + this.baseMapper.update(archiveRecords, lqw); + return AjaxResult.success(); + } + else { + if (save(archiveRecords)) { + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + } } diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiverecordstouserServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiverecordstouserServiceImpl.java index 49a9bac..aa4d0cb 100644 --- a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiverecordstouserServiceImpl.java +++ b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiverecordstouserServiceImpl.java @@ -68,6 +68,7 @@ ur.setArchiveRecordsId(recordId); ur.setUserId(userId); list.add(ur); + break; } boolean res = this.saveBatch(list); if(res) @@ -117,6 +118,14 @@ } @Override + public boolean selectArchiveRecordUsers(String recordId) { + LambdaQueryWrapper<Archiverecordstouser> lqw = new LambdaQueryWrapper<>(); + lqw.eq(!StringUtils.isEmpty(recordId),Archiverecordstouser::getArchiveRecordsId, recordId); + List<Archiverecordstouser> lis = list(lqw); + return !lis.isEmpty(); + } + + @Override public List<Archiverecordstouser> selectArchiverecordstouserList(Archiverecordstouser archiverecordstouser) { return null; } diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java b/archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java new file mode 100644 index 0000000..794a26d --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/service/impl/BarcodeService.java @@ -0,0 +1,33 @@ +package com.ruoyi.service.impl; + +import org.krysalis.barcode4j.impl.code128.Code128Bean; +import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider; +import org.springframework.stereotype.Service; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +@Service + +public class BarcodeService { + public byte[] generateBarcodeImage(String barcodeText) { + try { + Code128Bean barcodeGenerator = new Code128Bean(); + final int dpi = 160; + barcodeGenerator.setModuleWidth(0.21); + barcodeGenerator.doQuietZone(false); + + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BitmapCanvasProvider canvas = new BitmapCanvasProvider( + outputStream, "image/png", dpi, BufferedImage.TYPE_BYTE_BINARY, false, 0); + + barcodeGenerator.generateBarcode(canvas, barcodeText); + canvas.finish(); + + return outputStream.toByteArray(); + } catch (IOException e) { + throw new RuntimeException("Error generating barcode", e); + } + } +} diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java index 7b2d06f..09cd41f 100644 --- a/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java +++ b/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java @@ -11,17 +11,17 @@ import com.ruoyi.domain.ArchiveRecords; import com.ruoyi.domain.Archiverecordstouser; import com.ruoyi.domain.DocumentMaterials; +import com.ruoyi.domain.vo.DocumentMaterialsVo; import com.ruoyi.mapper.DocumentMaterialsMapper; import com.ruoyi.service.IArchiveCategoryService; import com.ruoyi.service.IDocumentMaterialsService; +import com.ruoyi.util.ErrorcodeExceptionextends; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.time.ZoneId; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; +import java.util.*; + @Service public class DocumentMaterialsServiceImpl extends ServiceImpl<DocumentMaterialsMapper, DocumentMaterials> implements IDocumentMaterialsService { private LambdaQueryWrapper<DocumentMaterials> buildCondition(DocumentMaterials documentMaterials){ @@ -50,7 +50,8 @@ // .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime()); // lqw.orderByDesc(ZfProperty::getCreateTime); // lqw.orderByDesc(ArchiveRecords::isOwnData) - lqw.orderByDesc(DocumentMaterials::getCreatedAt); + lqw.orderByAsc(DocumentMaterials::getPageNumber); + System.out.println("ssssssssssssddd0000000000000000"); return lqw; @@ -65,7 +66,7 @@ List<DocumentMaterials> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹� - + System.out.println(beanRecords); // beanRecords.forEach(record -> { // if (record.getUserId() != null) { // SysUser user = userMapper.selectUserById(record.getUserId()); @@ -99,7 +100,6 @@ public List<DocumentMaterials> selectDocumentMaterialsList(DocumentMaterials documentMaterials) { LambdaQueryWrapper<DocumentMaterials> lambdaQueryWrapper = buildCondition(documentMaterials); List<DocumentMaterials> beanRecords = list(lambdaQueryWrapper); - return beanRecords; } @@ -109,7 +109,20 @@ Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); documentMaterials.setCreatedAt(date); - boolean res = this.save(documentMaterials); + System.out.println(documentMaterials.getFileStyle()); + System.out.println(documentMaterials.getPageNumber()); +// if(documentMaterials.getPageNumber()==null) +// { +// documentMaterials.setPageNumber(-1L); +// } + boolean res = false; + try { + res = this.save(documentMaterials); + + } catch (Exception e) { + System.out.println(e); + throw new ErrorcodeExceptionextends(500, "鍚屼竴涓鍗峰唴锛屼笉鍏佽椤电爜閲嶅锛�"); + } if(res) return 1; else @@ -139,4 +152,35 @@ public int deleteDocumentMaterialsByMaterialId(String materialId) { return 0; } + + @Override + public Long getFiNum(Long pageNumber) { + return this.baseMapper.getFileNumber(pageNumber); + } + + @Override + public int updateByPageNumber(Long pageNumber, Long fileNumber, int width, int height, double fileSize, String url, String format) { + //鏍规嵁pageNumber鎷垮埌title锛岀劧鍚庤绠梡ageOrder + LambdaQueryWrapper<DocumentMaterials> lqw = new LambdaQueryWrapper<>(); + lqw.eq(pageNumber!=null, DocumentMaterials::getPageNumber, pageNumber); + List<DocumentMaterials> records = list(lqw); + + Long pageOrder = 1L; + if(pageNumber.equals(1)) + pageOrder = 1L; + else { + Long maxPOrder = this.baseMapper.getMaxPageOrder(records.get(0).getTitle(), pageNumber, records.get(0).getStage()); + if (maxPOrder != null) + pageOrder = maxPOrder + 1; + } + + this.baseMapper.updateInfoByPageNumber(pageNumber, fileNumber,pageOrder, width, height, fileSize, url,format); + + return 0; + } + + @Override + public List<DocumentMaterialsVo> findArchMInfo(String recordId) { + return this.baseMapper.getArchiveMatInfo(recordId); + } } diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java b/archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java new file mode 100644 index 0000000..723b026 --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/service/impl/pdfGenerateService.java @@ -0,0 +1,164 @@ +package com.ruoyi.service.impl; + +import cn.hutool.extra.qrcode.QrCodeUtil; +import cn.hutool.extra.qrcode.QrConfig; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; +import com.itextpdf.text.*; +import com.itextpdf.text.Font; +import com.itextpdf.text.Image; +import com.itextpdf.text.Rectangle; +import com.itextpdf.text.pdf.BaseFont; +import com.itextpdf.text.pdf.PdfPCell; +import com.itextpdf.text.pdf.PdfPTable; +import com.itextpdf.text.pdf.PdfWriter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; + +@Service +public class pdfGenerateService { + @Autowired + private BarcodeService barcodeService; + //鐢熶骇浜岀淮鐮� + public byte[] createQrCodeN(String content, int width, int height) throws IOException { + QrConfig config = new QrConfig(width, height); + + config.setMargin(3); + // 楂樼籂閿欑骇鍒� + config.setErrorCorrection(ErrorCorrectionLevel.H); + // 璁剧疆鍓嶆櫙鑹诧紝鏃簩缁寸爜棰滆壊锛堣嚜琛岄�夋嫨棰滆壊淇敼锛� + config.setForeColor(new Color(11, 11, 11).getRGB()); +// 璁剧疆鑳屾櫙鑹诧紙鐏拌壊锛夐渶瑕佽儗鏅壊鏃跺�欐墦寮�閾炬帴 + config.setBackColor(new Color(242,242,242).getRGB()); + + + BufferedImage bufferedImage = QrCodeUtil.generate(// + content, //浜岀淮鐮佸唴瀹� + config + ); + System.out.println(bufferedImage); + System.out.println("---02340230949394"); + ByteArrayOutputStream os = new ByteArrayOutputStream(); + ImageIO.write(bufferedImage, "jpg", os); + + +// ImageIO.write(bufferedImage, "jpg", new File("outputImage.jpg")); + + return os.toByteArray(); + } + + + public void generatePdf(String pdfPath) throws IOException, DocumentException { + + Document document = new Document(); + PdfWriter.getInstance(document, new FileOutputStream(pdfPath)); + document.open(); + + String [] tits = {"妗� 鍙�:","妗f棣�(瀹�)鍙�:","缂� 寰� 鍙�: ","鍙� 鏂� 鍙�:", + "妗� 鍗� 棰� 鍚�:","缂� 鍒� 鏃� 鏈�:","缂� 鍒� 鍗� 浣�:","淇� 绠� 鏈� 闄�:","瀵� 绾�:"}; + String [] cons = {"D3.4.1-05-2024-0002","","","绌楄鍒掕祫婧愬缓璇併��2024銆�2033鍙�","骞垮窞甯傝嚜鏉ユ按鏈夐檺鍏徃鐧戒簯鍖烘睙楂橀晣姹熼珮闀囨斂搴滆タ渚с�佹睙搴滆矾鍖椾晶鐧戒簯鍖烘睙楂橀晣姹熼珮闀囨斂搴滆タ渚с�佹睙搴滆矾鍖椾晶鏂拌渚涙按绠″伐绋�","2024-04-23","骞垮窞甯傝鍒掑拰鑷劧璧勬簮灞�鐧戒簯鍖哄垎灞�","姘镐箙",""}; + + //鎶婂浘鐗囧姞鍏ュ埌pdf褰撲腑 + Image img = Image.getInstance(createQrCodeN(cons[0], 80, 80)); + // 璁剧疆鍥剧墖鍦≒DF涓殑浣嶇疆锛堝彲閫夛級 +// img.setAbsolutePosition(100, 100); + // 灏嗗浘鐗囨坊鍔犲埌PDF鏂囨。涓� + PdfPCell pdfPCell = new PdfPCell(img); + pdfPCell.setBorder(Rectangle.NO_BORDER); // 绉婚櫎鍗曞厓鏍艰竟妗� + + pdfPCell.setMinimumHeight(80); + pdfPCell.setUseAscender(true); // 璁剧疆鍙互灞呬腑 + pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); // 璁剧疆姘村钩灞呬腑 + pdfPCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); // 璁剧疆鍨傜洿灞呬腑 + pdfPCell.setColspan(2); + pdfPCell.setPaddingBottom(30); + +// 鍒涘缓琛ㄦ牸骞惰缃垪瀹芥瘮渚� + float[] columnWidths = {35f, 65f}; // 绗竴鍒�30%锛岀浜屽垪70% + PdfPTable table = new PdfPTable(columnWidths); +// PdfPTable table = new PdfPTable(2); + table.setWidthPercentage(80); // 澧炲ぇ琛ㄦ牸瀹藉害鐧惧垎姣� + table.setHorizontalAlignment(Element.ALIGN_LEFT); // 璁剧疆琛ㄦ牸鏁翠綋灞呬腑 + table.setSpacingBefore(30f); // 璁剧疆琛ㄦ牸鍓嶉棿璺� + table.setSpacingAfter(90f); // 璁剧疆琛ㄦ牸鍚庨棿璺� + + +// PdfPTable table1 = new PdfPTable(1); +// table1.setWidthPercentage(90); // 澧炲ぇ琛ㄦ牸瀹藉害鐧惧垎姣� +// table1.setHorizontalAlignment(Element.ALIGN_LEFT); // 璁剧疆琛ㄦ牸鏁翠綋灞呬腑 +// table1.setSpacingBefore(10f); // 璁剧疆琛ㄦ牸鍓嶉棿璺� +// table1.setSpacingAfter(10f); // 璁剧疆琛ㄦ牸鍚庨棿璺� + table.addCell(pdfPCell); +// document.add(table1); + // 璁剧疆涓枃瀛椾綋 + + BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); + Font chineseFont = new Font(bfChinese, 16, Font.BOLD); + Font chineseFont1 = new Font(bfChinese, 10, Font.BOLD); + + // 娣诲姞妗e彿 + // 娣诲姞甯︿笅鍒掔嚎鐨勬。鍙� + + + + for(int i = 0; i < tits.length; i++) { + // 浣跨敤PdfPTable瀹炵幇绮剧‘瀵归綈 + + // 绗竴琛岋細妗e彿 + PdfPCell labelCell1 = new PdfPCell(new Phrase(tits[i], chineseFont)); + labelCell1.setHorizontalAlignment(Element.ALIGN_RIGHT); // 璁剧疆鍙冲榻� + + labelCell1.setBorder(Rectangle.NO_BORDER); +// PdfPCell valueCell1 = new PdfPCell(new Phrase(cons[i], chineseFont)); +// valueCell1.setBorder(Rectangle.NO_BORDER); + labelCell1.setMinimumHeight(30); + labelCell1.setPaddingTop(10f); // 涓婂唴杈硅窛10鍗曚綅 + labelCell1.setPaddingBottom(10f); // 涓嬪唴杈硅窛10鍗曚綅 + labelCell1.setPaddingLeft(15f); // 宸﹀唴杈硅窛15鍗曚綅 + labelCell1.setPaddingRight(15f); // 鍙冲唴杈硅窛15鍗曚綅 + + + PdfPCell valueCell1 = new PdfPCell(new Phrase(cons[i], chineseFont)); + valueCell1.setBorder(Rectangle.NO_BORDER); + valueCell1.setUseBorderPadding(true); + valueCell1.setBorderWidthBottom(0.5f); // 璁剧疆搴曢儴杈规浣滀负涓嬪垝绾� + valueCell1.setMinimumHeight(30); + valueCell1.setPaddingTop(10f); // 涓婂唴杈硅窛10鍗曚綅 + valueCell1.setPaddingBottom(10f); // 涓嬪唴杈硅窛10鍗曚綅 + valueCell1.setPaddingLeft(15f); // 宸﹀唴杈硅窛15鍗曚綅 + valueCell1.setPaddingRight(15f); // 鍙冲唴杈硅窛15鍗曚綅 + table.addCell(labelCell1); + table.addCell(valueCell1); + + if(i==3) + { + //澧炲姞閭d釜鏉″舰鐮� + byte [] bas = barcodeService.generateBarcodeImage(cons[0]); + + Image img1= Image.getInstance(bas); + + PdfPCell pdfPCell1 = new PdfPCell(img1); + pdfPCell1.setBorder(Rectangle.NO_BORDER); // 绉婚櫎鍗曞厓鏍艰竟妗� + + pdfPCell1.setMinimumHeight(40); + pdfPCell1.setUseAscender(true); // 璁剧疆鍙互灞呬腑 + pdfPCell1.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); // 璁剧疆姘村钩灞呬腑 + pdfPCell1.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); // 璁剧疆鍨傜洿灞呬腑 + pdfPCell1.setColspan(2); + pdfPCell1.setPaddingBottom(20); + pdfPCell1.setPaddingTop(20); + table.addCell(pdfPCell1); + } + + + } + document.add(table); // 绌鸿 + + // 鍏抽棴鏂囨。 + document.close(); + } +} diff --git a/archiveManager/src/main/java/com/ruoyi/util/ErrorcodeExceptionextends.java b/archiveManager/src/main/java/com/ruoyi/util/ErrorcodeExceptionextends.java new file mode 100644 index 0000000..e59307b --- /dev/null +++ b/archiveManager/src/main/java/com/ruoyi/util/ErrorcodeExceptionextends.java @@ -0,0 +1,22 @@ +package com.ruoyi.util; + +import lombok.Data; + +@Data +public class ErrorcodeExceptionextends extends RuntimeException +{ + private Integer code; + private String message; + + + + public ErrorcodeExceptionextends(Integer code,String msg) + { + this.message = msg; + this.code = code; + } + public ErrorcodeExceptionextends(String msg) { + super(msg); + this.message = msg; + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5fe3278..1c48606 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,12 @@ <!-- 渚濊禆澹版槑 --> <dependencyManagement> <dependencies> - + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + <optional>true</optional> + <scope>true</scope> + </dependency> <!-- 瑕嗙洊SpringFramework鐨勪緷璧栭厤缃�--> <dependency> <groupId>org.springframework</groupId> diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 6543111..0f95f2c 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -18,17 +18,41 @@ <dependencies> <!-- spring-boot-devtools --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-devtools</artifactId> - <optional>true</optional> <!-- 琛ㄧず渚濊禆涓嶄細浼犻�� --> - </dependency> +<!-- <dependency>--> +<!-- <groupId>org.springframework.boot</groupId>--> +<!-- <artifactId>spring-boot-devtools</artifactId>--> +<!-- <optional>true</optional> <!– 琛ㄧず渚濊禆涓嶄細浼犻�� –>--> +<!-- </dependency>--> <!-- swagger3--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> </dependency> + <!--瀵煎嚭pdf--> + <!--excel杞琾df--> + <!-- For Maven --> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi</artifactId> + <version>4.1.2</version> + </dependency> + + <dependency> + <groupId>com.itextpdf</groupId> + <artifactId>itextpdf</artifactId> + <version>5.5.13</version> + </dependency> + <dependency> + <groupId>com.lowagie</groupId> + <artifactId>itext</artifactId> + <version>2.1.7</version> + </dependency> + <dependency> + <groupId>com.itextpdf</groupId> + <artifactId>itext-asian</artifactId> + <version>5.2.0</version> + </dependency> <!-- 闃叉杩涘叆swagger椤甸潰鎶ョ被鍨嬭浆鎹㈤敊璇紝鎺掗櫎3.0.0涓殑寮曠敤锛屾墜鍔ㄥ鍔�1.6.2鐗堟湰 --> <dependency> diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchivePlaceNameController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchivePlaceNameController.java new file mode 100644 index 0000000..fd69270 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchivePlaceNameController.java @@ -0,0 +1,114 @@ +package com.ruoyi.web.controller.archive; + + + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.domain.ArchivePlaceName; +import com.ruoyi.service.IArchivePlaceNameService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; + +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM; +import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; + +/** + * 銆愯濉啓鍔熻兘鍚嶇О銆慍ontroller + * + * @author ruoyi + * @date 2025-08-08 + */ +@RestController +@RequestMapping("/system/placeName") +public class ArchivePlaceNameController extends BaseController +{ + @Autowired + private IArchivePlaceNameService archivePlaceNameService; + + /** + * 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆戝垪琛� + */ + @PreAuthorize("@ss.hasPermi('system:placeName:list')") + @GetMapping("/list") + public AjaxResult list(ArchivePlaceName archivePlaceName) + { + Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return archivePlaceNameService.selectDataList(archivePlaceName, pageNum, pageSize); + + } + + /** + * 瀵煎嚭銆愯濉啓鍔熻兘鍚嶇О銆戝垪琛� + */ + @PreAuthorize("@ss.hasPermi('system:name:export')") + @Log(title = "銆愯濉啓鍔熻兘鍚嶇О銆�", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ArchivePlaceName archivePlaceName) + { + List<ArchivePlaceName> list = archivePlaceNameService.selectArchivePlaceNameList(archivePlaceName); + ExcelUtil<ArchivePlaceName> util = new ExcelUtil<ArchivePlaceName>(ArchivePlaceName.class); + util.exportExcel(response, list, "銆愯濉啓鍔熻兘鍚嶇О銆戞暟鎹�"); + } + + /** + * 鑾峰彇銆愯濉啓鍔熻兘鍚嶇О銆戣缁嗕俊鎭� + */ + @PreAuthorize("@ss.hasPermi('system:name:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(archivePlaceNameService.selectArchivePlaceNameById(id)); + } + + /** + * 鏂板銆愯濉啓鍔熻兘鍚嶇О銆� + */ + @PreAuthorize("@ss.hasPermi('system:name:add')") + @Log(title = "銆愯濉啓鍔熻兘鍚嶇О銆�", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ArchivePlaceName archivePlaceName) + { + return toAjax(archivePlaceNameService.insertArchivePlaceName(archivePlaceName)); + } + + /** + * 淇敼銆愯濉啓鍔熻兘鍚嶇О銆� + */ + @PreAuthorize("@ss.hasPermi('system:name:edit')") + @Log(title = "銆愯濉啓鍔熻兘鍚嶇О銆�", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ArchivePlaceName archivePlaceName) + { + return toAjax(archivePlaceNameService.updateArchivePlaceName(archivePlaceName)); + } + + /** + * 鍒犻櫎銆愯濉啓鍔熻兘鍚嶇О銆� + */ + @PreAuthorize("@ss.hasPermi('system:name:remove')") + @Log(title = "銆愯濉啓鍔熻兘鍚嶇О銆�", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(archivePlaceNameService.deleteArchivePlaceNameByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveProjectNameController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveProjectNameController.java new file mode 100644 index 0000000..bce72ca --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveProjectNameController.java @@ -0,0 +1,116 @@ +package com.ruoyi.web.controller.archive; + + + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.domain.ArchivePlaceName; +import com.ruoyi.domain.ArchiveProjectName; +import com.ruoyi.service.IArchiveProjectNameService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; + +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM; +import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; + +/** + * 銆愯濉啓鍔熻兘鍚嶇О銆慍ontroller + * + * @author ruoyi + * @date 2025-08-08 + */ +@RestController +@RequestMapping("/system/projectName") +public class ArchiveProjectNameController extends BaseController +{ + @Autowired + private IArchiveProjectNameService archiveProjectNameService; + + /** + * 鏌ヨ銆愯濉啓鍔熻兘鍚嶇О銆戝垪琛� + */ + @PreAuthorize("@ss.hasPermi('system:projectName:list')") + @GetMapping("/list") + public AjaxResult list(ArchiveProjectName archiveProjectName) + { + Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return archiveProjectNameService.selectDataList(archiveProjectName, pageNum, pageSize); + + } + + /** + * 瀵煎嚭銆愯濉啓鍔熻兘鍚嶇О銆戝垪琛� + */ + @PreAuthorize("@ss.hasPermi('system:projectName:export')") + @Log(title = "銆愯濉啓鍔熻兘鍚嶇О銆�", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ArchiveProjectName archiveProjectName) + { + List<ArchiveProjectName> list = archiveProjectNameService.selectArchiveProjectNameList(archiveProjectName); + ExcelUtil<ArchiveProjectName> util = new ExcelUtil<ArchiveProjectName>(ArchiveProjectName.class); + util.exportExcel(response, list, "銆愯濉啓鍔熻兘鍚嶇О銆戞暟鎹�"); + } + + /** + * 鑾峰彇銆愯濉啓鍔熻兘鍚嶇О銆戣缁嗕俊鎭� + */ + @PreAuthorize("@ss.hasPermi('system:projectName:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(archiveProjectNameService.selectArchiveProjectNameById(id)); + } + + /** + * 鏂板銆愯濉啓鍔熻兘鍚嶇О銆� + */ + @PreAuthorize("@ss.hasPermi('system:projectName:add')") + @Log(title = "銆愯濉啓鍔熻兘鍚嶇О銆�", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ArchiveProjectName archiveProjectName) + { + System.out.println("------"); + return toAjax(archiveProjectNameService.insertArchiveProjectName(archiveProjectName)); + } + + /** + * 淇敼銆愯濉啓鍔熻兘鍚嶇О銆� + */ + @PreAuthorize("@ss.hasPermi('system:projectName:edit')") + @Log(title = "銆愯濉啓鍔熻兘鍚嶇О銆�", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ArchiveProjectName archiveProjectName) + { + return toAjax(archiveProjectNameService.updateArchiveProjectName(archiveProjectName)); + } + + /** + * 鍒犻櫎銆愯濉啓鍔熻兘鍚嶇О銆� + */ + @PreAuthorize("@ss.hasPermi('system:projectName:remove')") + @Log(title = "銆愯濉啓鍔熻兘鍚嶇О銆�", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(archiveProjectNameService.deleteArchiveProjectNameByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java index 79a8a12..14c340f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java @@ -3,20 +3,17 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.domain.ArchiveRecords; +import com.ruoyi.framework.config.ServerConfig; import com.ruoyi.service.IArchiveRecordsService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -24,6 +21,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM; import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; @@ -40,6 +38,21 @@ { @Autowired private IArchiveRecordsService archiveRecordsService; + + + + /** + * 鏌ヨ妗f瀹屾垚鎯呭喌 + */ + @PreAuthorize("@ss.hasPermi('system:records:list')") + @GetMapping("/analysisRes") + public AjaxResult analysis() + { + System.out.println("009099"); + return new AjaxResult(200, "鏌ヨ鎴愬姛", archiveRecordsService.statisticAya()); + } + + /** * 鏌ヨ妗f璁板綍鍒楄〃 @@ -123,4 +136,12 @@ { return toAjax(archiveRecordsService.deleteArchiveRecordsByIds(ids)); } + @PreAuthorize("@ss.hasPermi('system:records:edit')") + @Log(title = "妗f璁板綍瀵煎叆", businessType = BusinessType.IMPORT) + @PostMapping("/importData") + public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception + { + return archiveRecordsService.importExcel(file); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiverecordstouserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiverecordstouserController.java index 2ab71be..132c6f0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiverecordstouserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiverecordstouserController.java @@ -3,8 +3,11 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.domain.Archiverecordstouser; import com.ruoyi.service.IArchiverecordstouserService; import org.springframework.security.access.prepost.PreAuthorize; @@ -24,6 +27,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM; import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; @@ -54,6 +58,9 @@ return toAjax(0); } } + //鍒ゆ柇鏄惁鎺堟潈缁欏埆浜轰簡 + if(archiverecordstouserService.selectArchiveRecordUsers(recordId)) + return toAjax(0); archiverecordstouserService.insertRecordToUsers(recordId, userIds); return toAjax(200); } @@ -142,4 +149,11 @@ { return toAjax(archiverecordstouserService.queryArchiverecordstouserByRecordId(recordId, userId)); } + + + + + + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java index ca90495..81cfc31 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java @@ -2,12 +2,18 @@ +import java.awt.image.BufferedImage; import java.util.List; +import javax.imageio.ImageIO; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.domain.DocumentMaterials; +import com.ruoyi.framework.config.ServerConfig; import com.ruoyi.service.IDocumentMaterialsService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -26,6 +32,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM; import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; @@ -40,6 +47,9 @@ @RequestMapping("/system/materials") public class DocumentMaterialsController extends BaseController { + @Autowired + private ServerConfig serverConfig; + @Autowired private IDocumentMaterialsService documentMaterialsService; @@ -87,7 +97,9 @@ @PostMapping public AjaxResult add(@RequestBody DocumentMaterials documentMaterials) { - return toAjax(documentMaterialsService.insertDocumentMaterials(documentMaterials)); + int res = documentMaterialsService.insertDocumentMaterials(documentMaterials); + System.out.println(res+"][[[[[[[[[[[[[[[[[["); + return toAjax(res); } /** @@ -113,4 +125,53 @@ { return toAjax(documentMaterialsService.deleteDocumentMaterialsByMaterialIds(materialIds)); } + + + @PostMapping("/upload") + public AjaxResult uploadFile(MultipartFile file) throws Exception + { + // System.out.println("sdfd9999999999999999999999999999999"); + try + { + //鏍规嵁鏂囦欢鍚嶇О锛岀劧鍚庝慨鏀瑰搴旀暟鎹殑url + String fname = file.getOriginalFilename(); + +// System.out.println(fname); + // 涓婁紶鏂囦欢璺緞 + String filePath = RuoYiConfig.getUploadPath(); +// System.out.println(filePath); + // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + AjaxResult ajax = AjaxResult.success(); + //鍒嗗壊鏂囦欢鍚� + String [] nams = fname.split("\\."); + Long nam = Long.parseLong(nams[0]); + //鏂囦欢鍚嶇О + String pname = nams[1]; + ajax.put("url", url); + //鎷垮埌鍥惧儚灞炴�� + BufferedImage bufferedImage = ImageIO.read(file.getInputStream()); + int wid = bufferedImage.getWidth(); + int hei = bufferedImage.getHeight(); + double sz = Double.parseDouble(String.format("%.2f", file.getSize()*1.0/1024)); + System.out.println(wid+":"+hei+":"+sz); + //璁$畻fileNumber + Long fileNumber = documentMaterialsService.getFiNum(nam); + //鎻掑叆鏁版嵁搴撳搴旂殑url褰撲腑 + documentMaterialsService.updateByPageNumber(nam, fileNumber,wid, hei, sz, fileName, pname); +// System.out.println(url); +// System.out.println(fileName); + ajax.put("fileName", fileName); +// System.out.println(FileUtils.getName(fileName)); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } + catch (Exception e) + { + System.out.println(e); + return AjaxResult.error(e.getMessage()); + } + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java new file mode 100644 index 0000000..40d7f56 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java @@ -0,0 +1,511 @@ +package com.ruoyi.web.controller.archive; + +import com.itextpdf.text.*; +import com.itextpdf.text.Font; +import com.itextpdf.text.pdf.BaseFont; +import com.itextpdf.text.pdf.PdfPCell; +import com.itextpdf.text.pdf.PdfPTable; +import com.itextpdf.text.pdf.PdfWriter; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.domain.DocumentMaterials; +import com.ruoyi.domain.vo.ArchiveInfoVo; +import com.ruoyi.domain.vo.DocumentMaterialsVo; +import com.ruoyi.framework.web.domain.server.Sys; +import com.ruoyi.service.IArchiveRecordsService; +import com.ruoyi.service.IDocumentMaterialsService; +import com.ruoyi.service.impl.BarcodeService; +import com.ruoyi.service.impl.pdfGenerateService; +import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellUtil; +import org.apache.poi.xssf.usermodel.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.lang.reflect.Field; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Path; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import static org.apache.poi.hssf.usermodel.HSSFCell.*; + +@RestController +@RequestMapping("/system/archiveAllExport") +public class archiveAllExportController { + + @Autowired + private pdfGenerateService pdfGenerateService; + @Autowired + private BarcodeService barcodeService; + @Autowired + private IDocumentMaterialsService documentMaterialsService; + + @Autowired + private IArchiveRecordsService iArchiveRecordsService; + /** + * 鎵撳寘涓嬭浇 + * @param response + * @param + */ + @PostMapping("/export") + + public void packDownload(HttpServletResponse response, Long id) throws Exception { + // 鑾峰彇鏂囦欢鐨勪繚瀛樹綅缃�,璇诲彇鏁版嵁搴�, + DocumentMaterials documentMaterials = new DocumentMaterials(); + documentMaterials.setRecordId(id); + List<DocumentMaterials> docs = documentMaterialsService.selectDocumentMaterialsList(documentMaterials); + List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString()); + ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(id); + + List<String> paths = new ArrayList<>(); +// System.out.println(docs); + if (docs.size() == 1) { // 鐩存帴涓嬭浇 + String filePath = paths.get(0); + filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/"); + + File file = new File(filePath); + if (!file.exists()) { + throw new Exception("鏂囦欢涓嶅瓨鍦�"); + } + String suffix = filePath.substring(filePath.lastIndexOf(".")); + // 杈撳嚭鏂囦欢娴� + writeFileToRes(response, "user" + "-" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + suffix, file); + } else { // 鍘嬬缉涔嬪悗鍦ㄨ繘琛屼笅杞� + //鍘嬬缉鍖呭悕绉帮紙浼氭嫾涓婂綋鍓嶆椂闂达級 + System.out.println(90); + String datumName = "user"; + //鍘嬬缉鏂囦欢 + List<String> filePathList = paths; + File file = compressedFileToZip(docs, dsvs, aIV); + System.out.println(file.getName()); + //杈撳嚭鏂囦欢娴� + writeFileToRes(response, file.getName(), file); + //鍒犻櫎鍘嬬缉鍖� + if(file.exists()){ + file.delete(); + } + } + } + // 杈撳嚭鏂囦欢娴佸埌response + private void writeFileToRes(HttpServletResponse response, String fileName, File file) throws IOException { + + + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); + String filePath = RuoYiConfig.getDownloadPath() + fileName; + + + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, realFileName); + FileUtils.writeBytes(filePath, response.getOutputStream()); + // FileInputStream inputStream = new FileInputStream(file); +// //1.璁剧疆鏂囦欢ContentType绫诲瀷锛岃繖鏍疯缃紝浼氳嚜鍔ㄥ垽鏂笅杞芥枃浠剁被鍨�. +// response.setContentType("application/octet-stream"); +// //2.璁剧疆鏂囦欢澶达細鏈�鍚庝竴涓弬鏁版槸璁剧疆涓嬭浇鏂囦欢鍚� +// response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); +// response.addHeader("Content-Length", "" + file.length()); +// +// //3.閫氳繃response鑾峰彇ServletOutputStream瀵硅薄(out) +// ServletOutputStream out = response.getOutputStream(); +// +// int b = 0; +// byte[] buffer = new byte[1024]; +// while (b != -1) { +// b = inputStream.read(buffer); +// //4.鍐欏埌杈撳嚭娴�(out)涓� +// out.write(buffer, 0, b); +// } +// out.flush(); +// out.close(); +// inputStream.close(); + } + public String frontCompWithZore(int formatLength,int formatNumber){ + /** + * 0 鎸囧墠闈㈣ˉ鍏呴浂 + * formatLength 瀛楃鎬婚暱搴︿负 formatLength + * inputNumber 鏍煎紡鍖栨暟瀛� + * d 浠h〃涓烘鏁般�� + */ + String newString = String.format("%0"+formatLength+"d", formatNumber); + return newString; + } + + private void handleXSSFImages(XSSFSheet sheet, Document pdfDoc) throws Exception { + XSSFDrawing drawing = sheet.getDrawingPatriarch(); + if (drawing == null) return; + + for (XSSFShape shape : drawing.getShapes()) { + if (shape instanceof XSSFPicture) { + XSSFPicture pic = (XSSFPicture)shape; + XSSFClientAnchor anchor = pic.getPreferredSize(); + + // 鑾峰彇鍥剧墖鏁版嵁 + byte[] bytes = pic.getPictureData().getData(); + Image pdfImage = Image.getInstance(bytes); + + // 璁剧疆鍥剧墖浣嶇疆鍜屽ぇ灏� + float imageWidth = pdfImage.getWidth(); + float imageHeight = pdfImage.getHeight(); + float scale = Math.min( + (PageSize.A4.getWidth() - 100) / imageWidth, + (PageSize.A4.getHeight() - 100) / imageHeight + ); + pdfImage.scaleAbsolute(imageWidth * scale, imageHeight * scale); + + // 娣诲姞鍥剧墖鍒癙DF + pdfDoc.add(pdfImage); + pdfDoc.add(Chunk.NEWLINE); + } + } + } + + + + + private static String getCellValue(Cell cell,FormulaEvaluator evaluator) { + // System.out.println(cell); + if (cell == null) return ""; + CellValue cellValue = evaluator.evaluate(cell); + if(cellValue==null) + return ""; + // System.out.println(cellValue.getCellType()); + switch (cellValue.getCellType()) { + case STRING: + return cell.getStringCellValue(); + case NUMERIC: + // 鑾峰彇鏁板�煎苟杞负鏁村瀷 + double numericValue = cell.getNumericCellValue(); + // 鍒ゆ柇鏄惁涓烘暣鏁� + if (numericValue == (int)numericValue) { + if((int)numericValue==0) + return ""; + else + return String.valueOf((int)numericValue); + } else { + return String.valueOf(numericValue); // 鎴栬�呮牴鎹渶瑕佽繑鍥炲洓鑸嶄簲鍏ョ殑鏁村瀷 + } + + case BOOLEAN: + return String.valueOf(cell.getBooleanCellValue()); + case FORMULA: + + return cell.getCellFormula()+""; + case BLANK: + return ""; + default: + return ""; + } + } + private int getRealLastCellNum(Row row) { + int lastCellNum = 0; + for (int i = 0; i < row.getLastCellNum(); i++) { + Cell cell = row.getCell(i); + if (cell != null && cell.getCellType() != CellType.BLANK) { + lastCellNum = i + 1; + } + } + return lastCellNum; + } + + + + + private PdfPCell ImageSet(int high) throws Exception { + // byte[] fileByte = toByteArray("D:\\project\\archive\\download\\12.jpg"); +// +// +// FileInputStream fis = new FileInputStream("D:\\project\\archive\\download\\56.png"); +// byte[] imageBytes = new byte[fis.available()]; +// fis.read(imageBytes); +// fis.close(); +// Jpeg jpeg = new Jpeg(imageBytes); +// jpeg.scaleAbsolute(70, 50); + byte[] imageBytes = barcodeService.generateBarcodeImage("D3.4.1-05-2024-0002"); +// 鍔犺浇PNG鍥剧墖 + Image img = Image.getInstance(imageBytes); + // 璁剧疆鍥剧墖鍦≒DF涓殑浣嶇疆锛堝彲閫夛級 + img.setAbsolutePosition(100, 700); + // 灏嗗浘鐗囨坊鍔犲埌PDF鏂囨。涓� + PdfPCell pdfPCell = new PdfPCell(img); + pdfPCell.setMinimumHeight(high); + pdfPCell.setUseAscender(true); // 璁剧疆鍙互灞呬腑 + pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); // 璁剧疆姘村钩灞呬腑 + pdfPCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); // 璁剧疆鍨傜洿灞呬腑 + return pdfPCell; + } + + + // 鍘嬬缉鏂囦欢 + private File compressedFileToZip(List<DocumentMaterials> docs, List<DocumentMaterialsVo> dsvs, ArchiveInfoVo aIV) throws Exception { + //鍘嬬缉鍖呭叿浣撳悕绉帮紙鎷兼帴鏃堕棿鎴抽槻姝㈤噸鍚嶏級 + String datumName = ""; + String zipFileName = datumName + "-" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".zip"; + //鐢熸垚鍘嬬缉鍖呭瓨鍌ㄥ湴鍧�锛堟渶鍚庝細鍒犳帀锛� + String fileZip = RuoYiConfig.getProfile() + "/download/" + zipFileName; + OutputStream os=null; + ZipOutputStream zos = null ; + System.out.println("==============_______________"); + File file = new File(fileZip); + try { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + os=new FileOutputStream(file); + //鍘嬬缉鏂囦欢 + zos = new ZipOutputStream(os); + + //pdf鐩綍灏侀潰 + String pdfPathF = "07-鍗烽潰灏侀潰.pdf"; + pdfGenerateService.generatePdf(pdfPathF); + // 2. 鍘嬬缉PDF鍒癦IP鏂囦欢 + // 娣诲姞PDF鏂囦欢鍒癦IP + ZipEntry zipEntry = new ZipEntry(pdfPathF); + zos.putNextEntry(zipEntry); + + // 璇诲彇PDF鏂囦欢鍐呭骞跺啓鍏IP + try (FileInputStream fis = new FileInputStream(pdfPathF)) { + byte[] buffer = new byte[1024]; + int len; + while ((len = fis.read(buffer)) > 0) { + zos.write(buffer, 0, len); + } + } + //excel 鍗峰唴灏侀潰瀵煎嚭zip + ZipEntry entryiv = new ZipEntry("鍗峰唴灏侀潰" + ".xls"); + ExcelUtil<ArchiveInfoVo> utilsv = new ExcelUtil<ArchiveInfoVo>(ArchiveInfoVo.class); + + zos.putNextEntry(entryiv); + ByteOutputStream boss = new ByteOutputStream(); + List<ArchiveInfoVo> aivs = new ArrayList<>(); + aivs.add(aIV); + utilsv.byteOutputStreamExcel(boss, aivs,"Date List", ""); + boss.writeTo(zos); + //鍐欏叆鐢靛瓙鐩綍 xsxl + + ZipEntry entry = new ZipEntry("鐢靛瓙鏂囦欢鐩綍" + ".xls"); + ExcelUtil<DocumentMaterials> util = new ExcelUtil<DocumentMaterials>(DocumentMaterials.class); + + zos.putNextEntry(entry); + ByteOutputStream bos = new ByteOutputStream(); + util.byteOutputStreamExcel(bos, docs,"Date List", ""); + bos.writeTo(zos); + + //鎷垮埌鍗峰唴鐩綍鐨別xcel + ZipEntry entr = new ZipEntry("鍗峰唴鐩綍" + ".xls"); + ExcelUtil<DocumentMaterialsVo> util1 = new ExcelUtil<DocumentMaterialsVo>(DocumentMaterialsVo.class); + System.out.println(dsvs); + zos.putNextEntry(entr); + ByteOutputStream bos1 = new ByteOutputStream(); + util1.byteOutputStreamExcel(bos1, dsvs,"Date List", ""); + bos1.writeTo(zos); + //鎶奺xcel杞负pdf + + + try { + // 1. 璇诲彇Excel鏂囦欢 + String excelPath = RuoYiConfig.getProfile() + "/download/"+"鍗峰収鐩綍.xls"; + String pdfPath = RuoYiConfig.getProfile() + "/download/"+"1.pdf"; + + Workbook workbook = WorkbookFactory.create(new File(excelPath)); + FileOutputStream fos = new FileOutputStream(pdfPath); + FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); + + + // 鑾峰彇绗竴涓伐浣滆〃 + Sheet sheet = workbook.getSheetAt(1); + + // 鍒涘缓PDF鏂囨。瀵硅薄 + Document document = new Document(PageSize.A2, 50, 50, 50, 50); + + // 鍒涘缓PDF杈撳嚭娴� + PdfWriter writer = PdfWriter.getInstance(document, fos); + // 4. 澶勭悊宸ヤ綔琛ㄤ腑鐨勫浘鐗� + if (workbook instanceof XSSFWorkbook) { + handleXSSFImages((XSSFSheet)sheet, document); + } + // 鎵撳紑PDF鏂囨。 + document.open(); + + // 鍒涘缓PDF琛ㄦ牸瀵硅薄 + System.out.println(sheet.getRow(0).getLastCellNum()+"--00"); + PdfPTable table = new PdfPTable(sheet.getRow(0).getLastCellNum()); + table.setHeaderRows(1); + + // 璁剧疆琛ㄦ牸瀹藉害 + table.setWidthPercentage(100); + + // 璁剧疆琛ㄦ牸鏍囬 + Paragraph title = new Paragraph(sheet.getSheetName(), new Font(BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED), 16, Font.BOLD)); + title.setAlignment(Element.ALIGN_CENTER); + document.add(title); + // System.out.println(sheet.) + // 娣诲姞琛ㄦ牸鍐呭 + for (Row row : sheet) { + { + if (row == null) continue; + System.out.println(getRealLastCellNum(row)+"---987"); +// if(row.getRowNum()==0) +// continue; + if(row.getRowNum()==2) + { + PdfPCell pdfCell = ImageSet(100); + pdfCell.setColspan(7); + pdfCell.setRowspan(3); + pdfCell.setBorderWidth(1f); + pdfCell.setBorderColor(BaseColor.BLACK); + pdfCell.setPadding(5f); + pdfCell.setHorizontalAlignment(Element.ALIGN_CENTER); + pdfCell.setVerticalAlignment(Element.ALIGN_MIDDLE); + table.addCell(pdfCell); + System.out.println("{{{{{{{{{{{{{"); + continue; + } + for (int i = 0; i < 7; i++) + { + + Cell cell = row.getCell(i); + if(row.getRowNum()==3) + { + PdfPCell pdfCell = new PdfPCell(new Paragraph("鍗峰唴鐩綍", new Font(BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED), 12))); + pdfCell.setColspan(7); + pdfCell.setBorderWidth(1f); + pdfCell.setBorderColor(BaseColor.BLACK); + pdfCell.setPadding(5f); + pdfCell.setHorizontalAlignment(Element.ALIGN_CENTER); + pdfCell.setVerticalAlignment(Element.ALIGN_MIDDLE); + table.addCell(pdfCell); + System.out.println("{{{{{{{{{{{{{"); + break; + } + if(cell==null) { + + table.addCell(""); + continue; + } + PdfPCell pdfCell = new PdfPCell(new Paragraph(getCellValue(cell, evaluator), new Font(BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED), 12))); + + if(row.getRowNum()!=1) { + pdfCell.setBorderWidth(1f); + pdfCell.setBorderColor(BaseColor.BLACK); + pdfCell.setPadding(5f); + pdfCell.setHorizontalAlignment(Element.ALIGN_CENTER); + pdfCell.setVerticalAlignment(Element.ALIGN_MIDDLE); + } + if (cell.getRowIndex() == 5) { + pdfCell.setBackgroundColor(BaseColor.LIGHT_GRAY); + } + + table.addCell(pdfCell); + + } + } + } + + // 娣诲姞琛ㄦ牸鍒癙DF鏂囨。 + table.setSpacingBefore(20f); + table.setSpacingAfter(20f); + table.setKeepTogether(true); + document.add(table); + + // 鍏抽棴PDF鏂囨。 + document.close(); + + + + + + } catch (Exception e) { + e.printStackTrace(); + } + boolean res = true; + + byte[] buf = new byte[1024]; + for (DocumentMaterials dc : docs) { + String filePath = dc.getUrl(); + filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/"); + + System.out.println(filePath); + File tempFile = new File(filePath); + //鍦ㄥ帇缂╁寘涓坊鍔犳枃浠跺す + if(res) { + zos.putNextEntry(new ZipEntry("01-鐢宠鏉愭枡/")); + zos.putNextEntry(new ZipEntry("02-鍔炴杩囩▼鏉愭枡/")); + zos.putNextEntry(new ZipEntry("03-缁撹鎬ф枃浠�/")); + zos.putNextEntry(new ZipEntry("04-鍏朵粬鏉愭枡/")); + zos.putNextEntry(new ZipEntry("05-妗f鍙樻洿鏉愭枡/")); + zos.putNextEntry(new ZipEntry("06-涓氬姟鏁版嵁/")); + res = false; + } + //寰楀埌鏂囦欢鍚峟rontCompWithZore(4, dc.get)+ + String fname = frontCompWithZore(4, dc.getFileNumber().intValue())+"-"+dc.getTitle()+"-"+frontCompWithZore(4,dc.getPageNumber().intValue())+"." + +dc.getUrl().split("\\.")[1]; + if(dc.getStage().equals("01-鐢宠鏉愭枡")) + zos.putNextEntry(new ZipEntry("01-鐢宠鏉愭枡/"+fname)); + else if(dc.getStage().equals("02-鍔炴杩囩▼鏉愭枡")) + zos.putNextEntry(new ZipEntry("02-鍔炴杩囩▼鏉愭枡/"+fname)); + else if(dc.getStage().equals("03-缁撹鎬ф枃浠�")) + zos.putNextEntry(new ZipEntry("03-缁撹鎬ф枃浠�/"+fname)); + else if(dc.getStage().equals("04-鍏朵粬鏉愭枡")) { + zos.putNextEntry(new ZipEntry("04-鍏朵粬鏉愭枡/" + fname)); + } + else if(dc.getStage().equals("05-妗f鍙樻洿鏉愭枡")) + zos.putNextEntry(new ZipEntry("05-妗f鍙樻洿鏉愭枡/"+fname)); + else if(dc.getStage().equals("06-涓氬姟鏁版嵁")) + zos.putNextEntry(new ZipEntry("06-涓氬姟鏁版嵁/"+fname)); + else + zos.putNextEntry(new ZipEntry(fname)); + + + + int len; + FileInputStream in = new FileInputStream(tempFile); + while ((len = in.read(buf)) != -1){ + zos.write(buf, 0, len); + } + // zos.putNextEntry(new ZipEntry("04-鍏朵粬鏉愭枡")); + zos.closeEntry(); + in.close(); + } + + } catch (Exception e) { + e.printStackTrace(); + System.out.println(e.toString()); + throw new Exception("鏂囦欢鎵撳寘:"+e.getMessage()); + }finally { + //鍏抽棴娴� + if(zos != null){ + try { + zos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + //鍏抽棴娴� + if(os!= null){ + try { + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return file; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index f75721e..1be851e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -4,6 +4,8 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.framework.web.domain.server.Sys; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,6 +31,7 @@ @RequestMapping("/common") public class CommonController { + private static final Logger log = LoggerFactory.getLogger(CommonController.class); @Autowired @@ -74,6 +77,7 @@ @PostMapping("/upload") public AjaxResult uploadFile(MultipartFile file) throws Exception { + // System.out.println("sdfd9999999999999999999999999999999"); try { // 涓婁紶鏂囦欢璺緞 @@ -100,18 +104,23 @@ @PostMapping("/uploads") public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception { + System.out.println("2334994343"); try { // 涓婁紶鏂囦欢璺緞 String filePath = RuoYiConfig.getUploadPath(); + System.out.println(filePath); List<String> urls = new ArrayList<String>(); List<String> fileNames = new ArrayList<String>(); List<String> newFileNames = new ArrayList<String>(); List<String> originalFilenames = new ArrayList<String>(); for (MultipartFile file : files) { + // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О String fileName = FileUploadUtils.upload(filePath, file); + System.out.println(fileName); + String url = serverConfig.getUrl() + fileName; urls.add(url); fileNames.add(fileName); @@ -127,6 +136,7 @@ } catch (Exception e) { + System.out.println(e); return AjaxResult.error(e.getMessage()); } } diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index dc35ce2..c753da2 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -1,5 +1,9 @@ # 鏁版嵁婧愰厤缃� spring: + devtools: + restart: + enabled: true #璁剧疆寮�鍚儹閮ㄧ讲 + additional-paths: src/main/java #閲嶅惎鐩綍 datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 3ae1770..dfbfeb9 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -7,7 +7,7 @@ # 鐗堟潈骞翠唤 copyrightYear: 2025 # 鏂囦欢璺緞 绀轰緥锛� Windows閰嶇疆D:/ruoyi/uploadPath锛孡inux閰嶇疆 /home/ruoyi/uploadPath锛� - profile: D:/ruoyi/uploadPath + profile: D:/project/archive # 鑾峰彇ip鍦板潃寮�鍏� addressEnabled: false # 楠岃瘉鐮佺被鍨� math 鏁板瓧璁$畻 char 瀛楃楠岃瘉 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index c4191ef..726f14b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -24,6 +24,8 @@ import java.util.UUID; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; + +import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.reflect.FieldUtils; @@ -205,6 +207,25 @@ { this.clazz = clazz; } + public void byteOutputStreamExcel(ByteOutputStream byteOutputStream, List<T> list, String sheetName, String title) { + this.init(list, sheetName, title,Type.EXPORT); + try { + writeSheet(); + wb.write(byteOutputStream); + + + + + + + + + } catch (Exception e) { + log.error("瀵煎嚭Excel寮傚父{}", e.getMessage()); + } finally { + IOUtils.closeQuietly(wb); + } + } /** * 浠呭湪Excel涓樉绀哄垪灞炴�� -- Gitblit v1.9.1