59 changed files with 2084 additions and 89 deletions
@ -0,0 +1,144 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 档案管理表 档案管理表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-07-06 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ArchivesDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 档号 |
||||
|
*/ |
||||
|
private String archivesNum; |
||||
|
|
||||
|
/** |
||||
|
* 文号 |
||||
|
*/ |
||||
|
private String docNum; |
||||
|
|
||||
|
/** |
||||
|
* 题名 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 归档日期 |
||||
|
*/ |
||||
|
private String archiveTime; |
||||
|
|
||||
|
/** |
||||
|
* 页数 |
||||
|
*/ |
||||
|
private Integer pageSize; |
||||
|
|
||||
|
/** |
||||
|
* 责任人 |
||||
|
*/ |
||||
|
private String responsible; |
||||
|
|
||||
|
/** |
||||
|
* 归属部门 |
||||
|
*/ |
||||
|
private String dept; |
||||
|
|
||||
|
/** |
||||
|
* 归属部门ID |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门名称 |
||||
|
*/ |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门ID |
||||
|
*/ |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门名称 |
||||
|
*/ |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门ID |
||||
|
*/ |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0-否,1-是 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 回显部门 |
||||
|
*/ |
||||
|
private List<String> allDeptIdsShow; |
||||
|
|
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.elink.esua.epdc.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author: songyunpeng |
||||
|
* @Date: 2020/7/4 17:066 |
||||
|
* @Description: 批量导入档案错误反馈 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpdcArchivesErroyResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 5643743407138967806L; |
||||
|
|
||||
|
/** |
||||
|
* 错误数据行数 |
||||
|
*/ |
||||
|
private String erroLine; |
||||
|
|
||||
|
/** |
||||
|
* 错误数据信息 |
||||
|
*/ |
||||
|
private String errorInfo; |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
package com.elink.esua.epdc.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.Min; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 档案管理 归属部门 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ArchiveDeptFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 页码 |
||||
|
*/ |
||||
|
@Min(value = 1, message = "页码必须大于0") |
||||
|
private Integer pageIndex; |
||||
|
|
||||
|
/** |
||||
|
* 页容量 |
||||
|
*/ |
||||
|
@Min(value = 1, message = "页容量必须大于0") |
||||
|
private Integer pageSize; |
||||
|
|
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.elink.esua.epdc.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.Min; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 档案列表 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ArchiveFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 页码 |
||||
|
*/ |
||||
|
@Min(value = 1, message = "页码必须大于0") |
||||
|
private Integer pageIndex; |
||||
|
|
||||
|
/** |
||||
|
* 页容量 |
||||
|
*/ |
||||
|
@Min(value = 1, message = "页容量必须大于0") |
||||
|
private Integer pageSize; |
||||
|
|
||||
|
/** |
||||
|
* 部门ID |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
|
||||
|
/** |
||||
|
* 搜索内容 |
||||
|
*/ |
||||
|
private String searchContent; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.elink.esua.epdc.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 档案管理 归属部门 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ArchiveDeptResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 部门名称 |
||||
|
*/ |
||||
|
private String dept; |
||||
|
|
||||
|
/** |
||||
|
* 部门ID |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
|
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
package com.elink.esua.epdc.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 档案详情 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ArchiveDetailResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 档号 |
||||
|
*/ |
||||
|
private String archivesNum; |
||||
|
|
||||
|
/** |
||||
|
* 文号 |
||||
|
*/ |
||||
|
private String docNum; |
||||
|
|
||||
|
/** |
||||
|
* 题名 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 归档日期 |
||||
|
*/ |
||||
|
private Date archiveTime; |
||||
|
|
||||
|
/** |
||||
|
* 页数 |
||||
|
*/ |
||||
|
private Integer pageSize; |
||||
|
|
||||
|
/** |
||||
|
* 责任人 |
||||
|
*/ |
||||
|
private String responsible; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package com.elink.esua.epdc.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 档案列表 |
||||
|
* |
||||
|
* @author songyunpeng |
||||
|
* @since v1.0.0 2020-05-20 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ArchiveResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 档案ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 档号 |
||||
|
*/ |
||||
|
private String archivesNum; |
||||
|
|
||||
|
/** |
||||
|
* 题名 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 归档时间 |
||||
|
*/ |
||||
|
private String archiveTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
package com.elink.esua.epdc.config; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.io.*; |
||||
|
|
||||
|
/** |
||||
|
* 接收文件转化File |
||||
|
* Created by liuhongwei on 2019/6/21. |
||||
|
*/ |
||||
|
public class StreamUtils { |
||||
|
|
||||
|
|
||||
|
|
||||
|
public static File conversionFile(MultipartFile file){ |
||||
|
|
||||
|
File toFile =null; |
||||
|
InputStream ins = null; |
||||
|
try { |
||||
|
// 转化字节流
|
||||
|
ins = file.getInputStream(); |
||||
|
// 获取文件名字
|
||||
|
toFile = new File(file.getOriginalFilename()); |
||||
|
// 字节转化文件
|
||||
|
inputStreamToFile(ins, toFile); |
||||
|
ins.close(); |
||||
|
} catch (IOException e) { |
||||
|
new RenException(500,"文件转化失败"); |
||||
|
} |
||||
|
return toFile; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 流转化 |
||||
|
* @param ins file |
||||
|
* @return |
||||
|
* @author liuhongwei |
||||
|
* @date 2019/6/14 14:07 |
||||
|
*/ |
||||
|
public static void inputStreamToFile(InputStream ins, File file) { |
||||
|
try { |
||||
|
OutputStream os = new FileOutputStream(file); |
||||
|
int bytesRead = 0; |
||||
|
byte[] buffer = new byte[8192]; |
||||
|
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { |
||||
|
os.write(buffer, 0, bytesRead); |
||||
|
} |
||||
|
os.close(); |
||||
|
ins.close(); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,119 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.archives.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.dto.ArchivesDTO; |
||||
|
import com.elink.esua.epdc.modules.archives.excel.ArchivesExcel; |
||||
|
import com.elink.esua.epdc.modules.archives.service.ArchivesService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 档案管理表 档案管理表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-07-06 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("archives") |
||||
|
public class ArchivesController { |
||||
|
|
||||
|
@Autowired |
||||
|
private ArchivesService archivesService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<ArchivesDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<ArchivesDTO> page = archivesService.listPage(params); |
||||
|
return new Result<PageData<ArchivesDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<ArchivesDTO> get(@PathVariable("id") String id){ |
||||
|
ArchivesDTO data = archivesService.get(id); |
||||
|
return new Result<ArchivesDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody ArchivesDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
archivesService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody ArchivesDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
archivesService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
archivesService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<ArchivesDTO> list = archivesService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, ArchivesExcel.class); |
||||
|
} |
||||
|
/*** |
||||
|
* 导出模板 |
||||
|
* @param params |
||||
|
* @param response |
||||
|
* @return void |
||||
|
* @author songyunpeng |
||||
|
* @date 2020/11/1 17:14 |
||||
|
*/ |
||||
|
@GetMapping("exportMoudle") |
||||
|
public void exportMoudle(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<ArchivesExcel> list = archivesService.exportMoudle(); |
||||
|
ExcelUtils.exportExcelToTarget(response, "档案模板", list, ArchivesExcel.class); |
||||
|
} |
||||
|
|
||||
|
/*** |
||||
|
* 批量导入 |
||||
|
* @param file |
||||
|
* @return java.lang.String |
||||
|
* @author songyunpeng |
||||
|
* @date 2020/10/24 14:55 |
||||
|
*/ |
||||
|
@PostMapping("importExcel") |
||||
|
public Result importExcel(@RequestParam("file") MultipartFile file,String deptId) { |
||||
|
return archivesService.insertArchivesList(file,deptId); |
||||
|
} |
||||
|
} |
@ -0,0 +1,66 @@ |
|||||
|
package com.elink.esua.epdc.modules.archives.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.form.ArchiveDeptFormDTO; |
||||
|
import com.elink.esua.epdc.dto.form.ArchiveFormDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveDetailResultDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveResultDTO; |
||||
|
import com.elink.esua.epdc.modules.archives.service.ArchivesService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author songyunpeng |
||||
|
* @Description 小程序端接口 |
||||
|
* @create 2020-07-07 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("archive") |
||||
|
public class EpdcAppArchivesController { |
||||
|
|
||||
|
@Autowired |
||||
|
private ArchivesService archivesService; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description 获取有档案的归属部门列表 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/7 |
||||
|
* @Param [formDTO] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO>> |
||||
|
**/ |
||||
|
@GetMapping("depts") |
||||
|
public Result<List<ArchiveDeptResultDTO>> listArchiveDeptInfo(@RequestBody ArchiveDeptFormDTO formDTO) { |
||||
|
return archivesService.listArchiveDeptInfo(formDTO); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description 获取档案列表 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/7 |
||||
|
* @Param [formDTO] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO>> |
||||
|
**/ |
||||
|
@GetMapping("list") |
||||
|
public Result<List<ArchiveResultDTO>> listArchivesInfo(@RequestBody ArchiveFormDTO formDTO) { |
||||
|
return archivesService.listArchivesInfo(formDTO); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description 获取档案详情 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/7 |
||||
|
* @Param [formDTO] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO>> |
||||
|
**/ |
||||
|
@GetMapping("detail/{id}") |
||||
|
public Result<ArchiveDetailResultDTO> getArchiveDetail(@PathVariable("id") String id) { |
||||
|
return archivesService.getArchiveDetail(id); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.archives.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.dto.ArchivesDTO; |
||||
|
import com.elink.esua.epdc.dto.form.ArchiveDeptFormDTO; |
||||
|
import com.elink.esua.epdc.dto.form.ArchiveFormDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveDetailResultDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveResultDTO; |
||||
|
import com.elink.esua.epdc.modules.archives.entity.ArchivesEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 档案管理表 档案管理表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-07-06 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ArchivesDao extends BaseDao<ArchivesEntity> { |
||||
|
/** |
||||
|
* @Description pc分页列表 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/6 |
||||
|
* @Param [params] |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.ArchivesDTO> |
||||
|
**/ |
||||
|
List<ArchivesDTO> getArchivesPageFromPc(Map<String, Object> params); |
||||
|
/** |
||||
|
* @Description 根据档号和ID判断是否存在 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/6 |
||||
|
* @Param [s, archivesNum] |
||||
|
* @return boolean |
||||
|
**/ |
||||
|
boolean getArchivesDTOByArchivesNum(String id, String archivesNum); |
||||
|
/** |
||||
|
* @Description 获取有档案的归属部门列表 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/7 |
||||
|
* @Param [formDTO] |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO> |
||||
|
**/ |
||||
|
List<ArchiveDeptResultDTO> selectListArchiveDeptInfo(ArchiveDeptFormDTO formDTO); |
||||
|
/** |
||||
|
* @Description 根据部门和搜索内容获取 档案列表 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/7 |
||||
|
* @Param [formDTO] |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.result.ArchiveResultDTO> |
||||
|
**/ |
||||
|
List<ArchiveResultDTO> selectListArchiveInfo(ArchiveFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* @Description 获取详情 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/7 |
||||
|
* @Param [formDTO] |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.result.ArchiveResultDTO> |
||||
|
**/ |
||||
|
ArchiveDetailResultDTO selectArchiveDetailInfo(String id); |
||||
|
} |
@ -0,0 +1,103 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.archives.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 档案管理表 档案管理表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-07-06 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("epdc_archives") |
||||
|
public class ArchivesEntity extends BaseEpdcEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 档号 |
||||
|
*/ |
||||
|
private String archivesNum; |
||||
|
|
||||
|
/** |
||||
|
* 文号 |
||||
|
*/ |
||||
|
private String docNum; |
||||
|
|
||||
|
/** |
||||
|
* 题名 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 归档日期 |
||||
|
*/ |
||||
|
private String archiveTime; |
||||
|
|
||||
|
/** |
||||
|
* 页数 |
||||
|
*/ |
||||
|
private Integer pageSize; |
||||
|
|
||||
|
/** |
||||
|
* 责任人 |
||||
|
*/ |
||||
|
private String responsible; |
||||
|
|
||||
|
/** |
||||
|
* 归属部门 |
||||
|
*/ |
||||
|
private String dept; |
||||
|
|
||||
|
/** |
||||
|
* 归属部门ID |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门名称 |
||||
|
*/ |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门ID |
||||
|
*/ |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门名称 |
||||
|
*/ |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门ID |
||||
|
*/ |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.archives.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* 档案管理表 档案管理表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-07-06 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ArchivesExcel { |
||||
|
|
||||
|
@Excel(name = "序号") |
||||
|
private String num; |
||||
|
|
||||
|
@Excel(name = "档号") |
||||
|
private String archivesNum; |
||||
|
|
||||
|
@Excel(name = "文号") |
||||
|
private String docNum; |
||||
|
|
||||
|
@Excel(name = "责任人") |
||||
|
private String responsible; |
||||
|
|
||||
|
@Excel(name = "题名") |
||||
|
private String title; |
||||
|
|
||||
|
@Excel(name = "日期") |
||||
|
private String archiveTime; |
||||
|
|
||||
|
@Excel(name = "页数") |
||||
|
private Integer pageSize; |
||||
|
|
||||
|
@Excel(name = "备注") |
||||
|
private String remark; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.archives.redis; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 档案管理表 档案管理表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-07-06 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class ArchivesRedis { |
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
public void delete(Object[] ids) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void set(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String get(String id){ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,151 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.archives.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.ArchivesDTO; |
||||
|
import com.elink.esua.epdc.dto.form.ArchiveDeptFormDTO; |
||||
|
import com.elink.esua.epdc.dto.form.ArchiveFormDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveDetailResultDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveResultDTO; |
||||
|
import com.elink.esua.epdc.modules.archives.entity.ArchivesEntity; |
||||
|
import com.elink.esua.epdc.modules.archives.excel.ArchivesExcel; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 档案管理表 档案管理表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-07-06 |
||||
|
*/ |
||||
|
public interface ArchivesService extends BaseService<ArchivesEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<ArchivesDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-07-06 |
||||
|
*/ |
||||
|
PageData<ArchivesDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<ArchivesDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-07-06 |
||||
|
*/ |
||||
|
List<ArchivesDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return ArchivesDTO |
||||
|
* @author generator |
||||
|
* @date 2020-07-06 |
||||
|
*/ |
||||
|
ArchivesDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-07-06 |
||||
|
*/ |
||||
|
void save(ArchivesDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-07-06 |
||||
|
*/ |
||||
|
void update(ArchivesDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-07-06 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
/** |
||||
|
* @Description 前端分页 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/6 |
||||
|
* @Param [params] |
||||
|
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.ArchivesDTO> |
||||
|
**/ |
||||
|
PageData<ArchivesDTO> listPage(Map<String, Object> params); |
||||
|
/** |
||||
|
* @Description 导出模板 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/6 |
||||
|
* @Param [] |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.ArchivesDTO> |
||||
|
**/ |
||||
|
List<ArchivesExcel> exportMoudle(); |
||||
|
/** |
||||
|
* @Description 批量导入 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/6 |
||||
|
* @Param [file] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
**/ |
||||
|
Result insertArchivesList(MultipartFile file, String deptId); |
||||
|
/** |
||||
|
* @Description 获取有档案的归属部门列表 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/7 |
||||
|
* @Param [formDTO] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO>> |
||||
|
**/ |
||||
|
Result<List<ArchiveDeptResultDTO>> listArchiveDeptInfo(ArchiveDeptFormDTO formDTO); |
||||
|
/** |
||||
|
* @Description 获取档案列表 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/7 |
||||
|
* @Param [formDTO] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO>> |
||||
|
**/ |
||||
|
Result<List<ArchiveResultDTO>> listArchivesInfo(ArchiveFormDTO formDTO); |
||||
|
/** |
||||
|
* @Description 获取档案详情 |
||||
|
* @Author songyunpeng |
||||
|
* @Date 2020/7/7 |
||||
|
* @Param [id] |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.result.ArchiveDetailResultDTO> |
||||
|
**/ |
||||
|
Result<ArchiveDetailResultDTO> getArchiveDetail(String id); |
||||
|
} |
@ -0,0 +1,347 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.archives.service.impl; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.ExcelImportUtil; |
||||
|
import cn.afterturn.easypoi.excel.entity.ImportParams; |
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.config.StreamUtils; |
||||
|
import com.elink.esua.epdc.dto.ArchivesDTO; |
||||
|
import com.elink.esua.epdc.dto.EpdcArchivesErroyResultDTO; |
||||
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
||||
|
import com.elink.esua.epdc.dto.form.ArchiveDeptFormDTO; |
||||
|
import com.elink.esua.epdc.dto.form.ArchiveFormDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveDetailResultDTO; |
||||
|
import com.elink.esua.epdc.dto.result.ArchiveResultDTO; |
||||
|
import com.elink.esua.epdc.modules.archives.dao.ArchivesDao; |
||||
|
import com.elink.esua.epdc.modules.archives.entity.ArchivesEntity; |
||||
|
import com.elink.esua.epdc.modules.archives.excel.ArchivesExcel; |
||||
|
import com.elink.esua.epdc.modules.archives.redis.ArchivesRedis; |
||||
|
import com.elink.esua.epdc.modules.archives.service.ArchivesService; |
||||
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.io.File; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 档案管理表 档案管理表 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2020-07-06 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ArchivesServiceImpl extends BaseServiceImpl<ArchivesDao, ArchivesEntity> implements ArchivesService { |
||||
|
|
||||
|
@Autowired |
||||
|
private ArchivesRedis archivesRedis; |
||||
|
|
||||
|
@Autowired |
||||
|
private AdminFeignClient adminFeignClient; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<ArchivesDTO> page(Map<String, Object> params) { |
||||
|
IPage<ArchivesEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, ArchivesDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ArchivesDTO> list(Map<String, Object> params) { |
||||
|
List<ArchivesEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, ArchivesDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<ArchivesEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<ArchivesEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ArchivesDTO get(String id) { |
||||
|
ArchivesEntity entity = baseDao.selectById(id); |
||||
|
ArchivesDTO archivesDTO = ConvertUtils.sourceToTarget(entity, ArchivesDTO.class); |
||||
|
if(archivesDTO.getAllDeptIds().indexOf(",")!=-1){ |
||||
|
archivesDTO.setAllDeptIdsShow(Arrays.asList(entity.getAllDeptIds().split(","))); |
||||
|
} |
||||
|
return archivesDTO; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(ArchivesDTO dto) { |
||||
|
//获取部门信息
|
||||
|
if(dto.getDeptId() == null){ |
||||
|
throw new RenException("归属部门不能为空"); |
||||
|
} |
||||
|
Result<ParentAndAllDeptDTO> parentAndAllDept = adminFeignClient.getParentAndAllDept(dto.getDeptId()); |
||||
|
if(!parentAndAllDept.success() || parentAndAllDept.getData() == null){ |
||||
|
throw new RenException("获取归属部门信息失败"); |
||||
|
} |
||||
|
//判断档号
|
||||
|
if(baseDao.getArchivesDTOByArchivesNum("",dto.getArchivesNum())){ |
||||
|
throw new RenException("档号不能重复"); |
||||
|
} |
||||
|
//判断日期
|
||||
|
if(dto.getArchiveTime().length()!=4 && dto.getArchiveTime().length()!=6 && dto.getArchiveTime().length()!=8) { |
||||
|
throw new RenException("日期格式错误"); |
||||
|
} |
||||
|
ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDept.getData(); |
||||
|
dto.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds()); |
||||
|
dto.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames()); |
||||
|
dto.setParentDeptIds(parentAndAllDeptDTO.getParentDeptIds()); |
||||
|
dto.setParentDeptNames(parentAndAllDeptDTO.getParentDeptNames()); |
||||
|
dto.setDept(parentAndAllDeptDTO.getGrid()); |
||||
|
ArchivesEntity entity = ConvertUtils.sourceToTarget(dto, ArchivesEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(ArchivesDTO dto) { |
||||
|
//获取部门信息
|
||||
|
if(dto.getDeptId() == null){ |
||||
|
throw new RenException("归属部门不能为空"); |
||||
|
} |
||||
|
Result<ParentAndAllDeptDTO> parentAndAllDept = adminFeignClient.getParentAndAllDept(dto.getDeptId()); |
||||
|
if(!parentAndAllDept.success() || parentAndAllDept.getData() == null){ |
||||
|
throw new RenException("获取归属部门信息失败"); |
||||
|
} |
||||
|
//判断档号
|
||||
|
if(baseDao.getArchivesDTOByArchivesNum(dto.getId(),dto.getArchivesNum())){ |
||||
|
throw new RenException("档号不能重复"); |
||||
|
} |
||||
|
//判断日期
|
||||
|
if(dto.getArchiveTime().length()!=4 && dto.getArchiveTime().length()!=6 && dto.getArchiveTime().length()!=8) { |
||||
|
throw new RenException("日期格式错误"); |
||||
|
} |
||||
|
ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDept.getData(); |
||||
|
dto.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds()); |
||||
|
dto.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames()); |
||||
|
dto.setParentDeptIds(parentAndAllDeptDTO.getParentDeptIds()); |
||||
|
dto.setParentDeptNames(parentAndAllDeptDTO.getParentDeptNames()); |
||||
|
dto.setDept(parentAndAllDeptDTO.getGrid()); |
||||
|
ArchivesEntity entity = ConvertUtils.sourceToTarget(dto, ArchivesEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageData<ArchivesDTO> listPage(Map<String, Object> params) { |
||||
|
//处理param
|
||||
|
IPage<ArchivesDTO> page = getPage(params); |
||||
|
List<ArchivesDTO> list = baseDao.getArchivesPageFromPc(params); |
||||
|
return new PageData<>(list, page.getTotal()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ArchivesExcel> exportMoudle() { |
||||
|
List<ArchivesExcel> archivesDTOArrayList = new ArrayList<>(); |
||||
|
ArchivesExcel archivesDTO = new ArchivesExcel(); |
||||
|
archivesDTO.setArchivesNum("XXX"); |
||||
|
archivesDTO.setNum("1"); |
||||
|
archivesDTO.setDocNum("XXX"); |
||||
|
archivesDTO.setTitle("XXX"); |
||||
|
archivesDTO.setArchiveTime("20200102"); |
||||
|
archivesDTO.setPageSize(1); |
||||
|
archivesDTO.setRemark("XXX"); |
||||
|
archivesDTO.setResponsible("XXX"); |
||||
|
archivesDTOArrayList.add(archivesDTO); |
||||
|
return archivesDTOArrayList; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public Result insertArchivesList(MultipartFile file, String deptId) { |
||||
|
if(StringUtils.isBlank(deptId)){ |
||||
|
throw new RenException("归属部门不能为空"); |
||||
|
} |
||||
|
Result<ParentAndAllDeptDTO> parentAndAllDept = adminFeignClient.getParentAndAllDept(Long.parseLong(deptId)); |
||||
|
if(!parentAndAllDept.success() || parentAndAllDept.getData() == null){ |
||||
|
throw new RenException("获取归属部门信息失败"); |
||||
|
} |
||||
|
ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDept.getData(); |
||||
|
File f = StreamUtils.conversionFile(file); |
||||
|
ImportParams importParams = new ImportParams(); |
||||
|
try { |
||||
|
List<ArchivesExcel> archivesExcelList = ExcelImportUtil.importExcel(f, ArchivesExcel.class, importParams); |
||||
|
// 校验数据
|
||||
|
List<EpdcArchivesErroyResultDTO> epdcArchivesErroyResultDTOS = this.checkExcel(archivesExcelList); |
||||
|
if(epdcArchivesErroyResultDTOS.size()>0){ |
||||
|
return new Result().ok(epdcArchivesErroyResultDTOS); |
||||
|
} |
||||
|
saveList(archivesExcelList,parentAndAllDeptDTO); |
||||
|
for (ArchivesExcel archivesExcel : archivesExcelList) { |
||||
|
System.out.println("从Excel导入数据到数据库的详细为 :{}" + JSON.toJSONString(archivesExcel)); |
||||
|
} |
||||
|
System.out.println("从Excel导入数据一共 {} 行 " + archivesExcelList.size()); |
||||
|
} catch (Exception e1) { |
||||
|
throw new RuntimeException("导入失败:{}" + e1.getMessage()); |
||||
|
} |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<List<ArchiveDeptResultDTO>> listArchiveDeptInfo(ArchiveDeptFormDTO formDTO) { |
||||
|
int pageIndex = (formDTO.getPageIndex() - NumConstant.ONE) * formDTO.getPageSize(); |
||||
|
formDTO.setPageIndex(pageIndex); |
||||
|
|
||||
|
List<ArchiveDeptResultDTO> listArchiveDeptInfo = this.baseDao.selectListArchiveDeptInfo(formDTO); |
||||
|
return new Result().ok(listArchiveDeptInfo); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<List<ArchiveResultDTO>> listArchivesInfo(ArchiveFormDTO formDTO) { |
||||
|
int pageIndex = (formDTO.getPageIndex() - NumConstant.ONE) * formDTO.getPageSize(); |
||||
|
formDTO.setPageIndex(pageIndex); |
||||
|
|
||||
|
List<ArchiveResultDTO> listArchiveInfo = this.baseDao.selectListArchiveInfo(formDTO); |
||||
|
return new Result().ok(listArchiveInfo); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<ArchiveDetailResultDTO> getArchiveDetail(String id) { |
||||
|
ArchiveDetailResultDTO archiveDetailResultDTO = this.baseDao.selectArchiveDetailInfo(id); |
||||
|
return new Result<ArchiveDetailResultDTO>().ok(archiveDetailResultDTO); |
||||
|
} |
||||
|
|
||||
|
/*** |
||||
|
* 批量添加档案 |
||||
|
* @return java.lang.String |
||||
|
* @author songyunpeng |
||||
|
* @date 2020/7/6 10:25 |
||||
|
*/ |
||||
|
private void saveList(List<ArchivesExcel> partyList, ParentAndAllDeptDTO parentAndAllDeptDTO) { |
||||
|
List<ArchivesEntity> archivesEntityList = new ArrayList<>(); |
||||
|
for(ArchivesExcel archivesExcel : partyList){ |
||||
|
|
||||
|
ArchivesEntity archivesEntity = ConvertUtils.sourceToTarget(archivesExcel, ArchivesEntity.class); |
||||
|
if(archivesExcel.getArchiveTime().length()!=4 && archivesExcel.getArchiveTime().length()!=6 && archivesExcel.getArchiveTime().length()!=8) { |
||||
|
throw new RenException("日期格式错误"); |
||||
|
} |
||||
|
archivesEntity.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds()); |
||||
|
archivesEntity.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames()); |
||||
|
archivesEntity.setParentDeptIds(parentAndAllDeptDTO.getParentDeptIds()); |
||||
|
archivesEntity.setParentDeptNames(parentAndAllDeptDTO.getParentDeptNames()); |
||||
|
archivesEntity.setDept(parentAndAllDeptDTO.getGrid()); |
||||
|
archivesEntity.setDeptId(parentAndAllDeptDTO.getGridId()); |
||||
|
archivesEntityList.add(archivesEntity); |
||||
|
} |
||||
|
insertBatch(archivesEntityList); |
||||
|
} |
||||
|
|
||||
|
/*** |
||||
|
* 校验excel表格数据 |
||||
|
* @return java.lang.String |
||||
|
* @author songyunpeng |
||||
|
* @date 2020/7/6 10:25 |
||||
|
*/ |
||||
|
private List<EpdcArchivesErroyResultDTO> checkExcel(List<ArchivesExcel> archivesList) { |
||||
|
List<ArchivesEntity> archivesEntityList = baseDao.selectList(new QueryWrapper<ArchivesEntity>()); |
||||
|
List<EpdcArchivesErroyResultDTO> errorLineinfoList=new ArrayList<>(); |
||||
|
EpdcArchivesErroyResultDTO errorLineinfoDto; |
||||
|
for (int i = 0; i < archivesList.size(); i++) { |
||||
|
ArchivesExcel archivesExcel = archivesList.get(i); |
||||
|
//档号
|
||||
|
String archivesNum = archivesExcel.getArchivesNum(); |
||||
|
//题名
|
||||
|
String title = archivesExcel.getTitle(); |
||||
|
//归档日期
|
||||
|
String archiveTime = archivesExcel.getArchiveTime(); |
||||
|
//页数
|
||||
|
Integer pageSize = archivesExcel.getPageSize(); |
||||
|
//责任人
|
||||
|
String responsible=archivesExcel.getResponsible(); |
||||
|
if (StringUtils.isBlank(archivesNum)) { |
||||
|
errorLineinfoDto=new EpdcArchivesErroyResultDTO(); |
||||
|
errorLineinfoDto.setErroLine((i+2)+""); |
||||
|
errorLineinfoDto.setErrorInfo("档号为空"); |
||||
|
errorLineinfoList.add(errorLineinfoDto); |
||||
|
} |
||||
|
if (StringUtils.isBlank(responsible)) { |
||||
|
errorLineinfoDto=new EpdcArchivesErroyResultDTO(); |
||||
|
errorLineinfoDto.setErroLine((i+2)+""); |
||||
|
errorLineinfoDto.setErrorInfo("责任人为空"); |
||||
|
errorLineinfoList.add(errorLineinfoDto); |
||||
|
} |
||||
|
if (StringUtils.isBlank(title)) { |
||||
|
errorLineinfoDto=new EpdcArchivesErroyResultDTO(); |
||||
|
errorLineinfoDto.setErroLine((i+2)+""); |
||||
|
errorLineinfoDto.setErrorInfo("题名为空"); |
||||
|
errorLineinfoList.add(errorLineinfoDto); |
||||
|
} |
||||
|
if(StringUtils.isBlank(archiveTime)){ |
||||
|
errorLineinfoDto=new EpdcArchivesErroyResultDTO(); |
||||
|
errorLineinfoDto.setErroLine((i+2)+""); |
||||
|
errorLineinfoDto.setErrorInfo("日期为空"); |
||||
|
errorLineinfoList.add(errorLineinfoDto); |
||||
|
} |
||||
|
if(StringUtils.isNotBlank(archiveTime) && archiveTime.length()!=4 && archiveTime.length()!=6 && archiveTime.length()!=8){ |
||||
|
errorLineinfoDto=new EpdcArchivesErroyResultDTO(); |
||||
|
errorLineinfoDto.setErroLine((i+2)+""); |
||||
|
errorLineinfoDto.setErrorInfo("日期格式不正确"); |
||||
|
errorLineinfoList.add(errorLineinfoDto); |
||||
|
} |
||||
|
if (pageSize == null) { |
||||
|
errorLineinfoDto=new EpdcArchivesErroyResultDTO(); |
||||
|
errorLineinfoDto.setErroLine((i+2)+""); |
||||
|
errorLineinfoDto.setErrorInfo("页数为空"); |
||||
|
errorLineinfoList.add(errorLineinfoDto); |
||||
|
} |
||||
|
for (ArchivesEntity item:archivesEntityList) { |
||||
|
if(StringUtils.isNotBlank(item.getArchivesNum())&&item.getArchivesNum().equals(archivesNum)){ |
||||
|
errorLineinfoDto=new EpdcArchivesErroyResultDTO(); |
||||
|
errorLineinfoDto.setErroLine((i+2)+""); |
||||
|
errorLineinfoDto.setErrorInfo("档号已存在"); |
||||
|
errorLineinfoList.add(errorLineinfoDto); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return errorLineinfoList; |
||||
|
} |
||||
|
} |
@ -0,0 +1,112 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.elink.esua.epdc.modules.archives.dao.ArchivesDao"> |
||||
|
|
||||
|
<resultMap type="com.elink.esua.epdc.modules.archives.entity.ArchivesEntity" id="archivesMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="archivesNum" column="ARCHIVES_NUM"/> |
||||
|
<result property="docNum" column="DOC_NUM"/> |
||||
|
<result property="title" column="TITLE"/> |
||||
|
<result property="archiveTime" column="ARCHIVE_TIME"/> |
||||
|
<result property="pageSize" column="PAGE_SIZE"/> |
||||
|
<result property="responsible" column="RESPONSIBLE"/> |
||||
|
<result property="dept" column="DEPT"/> |
||||
|
<result property="deptId" column="DEPT_ID"/> |
||||
|
<result property="remark" column="REMARK"/> |
||||
|
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/> |
||||
|
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/> |
||||
|
<result property="allDeptIds" column="ALL_DEPT_IDS"/> |
||||
|
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
<select id="getArchivesPageFromPc" resultType="com.elink.esua.epdc.dto.ArchivesDTO"> |
||||
|
select |
||||
|
ID, |
||||
|
ARCHIVES_NUM, |
||||
|
DOC_NUM, |
||||
|
TITLE, |
||||
|
ARCHIVE_TIME, |
||||
|
PAGE_SIZE, |
||||
|
RESPONSIBLE, |
||||
|
DEPT, |
||||
|
DEPT_ID, |
||||
|
REMARK, |
||||
|
PARENT_DEPT_NAMES, |
||||
|
PARENT_DEPT_IDS, |
||||
|
ALL_DEPT_IDS, |
||||
|
ALL_DEPT_NAMES, |
||||
|
DEL_FLAG, |
||||
|
REVISION, |
||||
|
CREATED_BY, |
||||
|
CREATED_TIME, |
||||
|
UPDATED_BY, |
||||
|
UPDATED_TIME |
||||
|
from epdc_archives ea |
||||
|
WHERE |
||||
|
ea.DEL_FLAG = '0' |
||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> |
||||
|
AND ea.ARCHIVE_TIME BETWEEN #{startTime} AND #{endTime} |
||||
|
</if> |
||||
|
<if test="deptId != null and deptId != ''"> |
||||
|
AND find_in_set(#{deptId},ea.ALL_DEPT_IDS) |
||||
|
</if> |
||||
|
<if test="title != null and title != ''"> |
||||
|
AND ea.TITLE like concat('%', #{title}, '%') |
||||
|
</if> |
||||
|
<if test="responsible != null and responsible != ''"> |
||||
|
AND ea.RESPONSIBLE like concat('%', #{responsible}, '%') |
||||
|
</if> |
||||
|
order by CREATED_TIME desc,ARCHIVE_TIME desc |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
<select id="getArchivesDTOByArchivesNum" resultType="java.lang.Boolean"> |
||||
|
select count(id) from epdc_archives where DEL_FLAG ='0' |
||||
|
<if test="id!=null and id!=''"> |
||||
|
and ID != #{id} |
||||
|
</if> |
||||
|
and ARCHIVES_NUM = #{archivesNum} |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
<select id="selectListArchiveDeptInfo" resultType="com.elink.esua.epdc.dto.result.ArchiveDeptResultDTO"> |
||||
|
select DEPT,DEPT_ID from epdc_archives where DEL_FLAG = '0' group by DEPT_ID LIMIT #{pageIndex},#{pageSize} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectListArchiveInfo" resultType="com.elink.esua.epdc.dto.result.ArchiveResultDTO"> |
||||
|
select |
||||
|
ID,ARCHIVES_NUM,TITLE,ARCHIVE_TIME |
||||
|
from epdc_archives |
||||
|
where DEL_FLAG = '0' |
||||
|
<if test="searchContent != null and searchContent != ''"> |
||||
|
AND title like concat('%', #{searchContent}, '%') |
||||
|
</if> |
||||
|
<if test="deptId != null and deptId != ''"> |
||||
|
AND DEPT_ID = #{deptId} |
||||
|
</if> |
||||
|
order by ARCHIVE_TIME desc |
||||
|
LIMIT #{pageIndex},#{pageSize} |
||||
|
</select> |
||||
|
<select id="selectArchiveDetailInfo" resultType="com.elink.esua.epdc.dto.result.ArchiveDetailResultDTO"> |
||||
|
select |
||||
|
ID, |
||||
|
ARCHIVES_NUM, |
||||
|
DOC_NUM, |
||||
|
TITLE, |
||||
|
ARCHIVE_TIME, |
||||
|
PAGE_SIZE, |
||||
|
RESPONSIBLE, |
||||
|
REMARK |
||||
|
from epdc_archives |
||||
|
WHERE |
||||
|
DEL_FLAG = '0' and id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue