From 35a9faeb6a5a9fa3ed4eae52f8a4e0d83f780a5e Mon Sep 17 00:00:00 2001 From: hejinbo Date: Fri, 17 Nov 2023 17:49:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeptIdentifyController.java | 54 ++++++-- .../wisdomarbitrate/domain/DeptIdentify.java | 2 +- .../wisdomarbitrate/domain/SealManage.java | 6 + .../wisdomarbitrate/domain/vo/SealListVO.java | 2 + .../mapper/TemplateManageMapper.java | 16 +++ .../service/IDeptIdentifyService.java | 12 +- .../service/impl/DeptIdentifyServiceImpl.java | 121 +++++++++++++++--- .../wisdomarbitrate/DeptIdentifyMapper.xml | 1 + .../wisdomarbitrate/TemplateManageMapper.xml | 80 ++++++++++++ 9 files changed, 265 insertions(+), 29 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/TemplateManageMapper.java create mode 100644 ruoyi-system/src/main/resources/mapper/wisdomarbitrate/TemplateManageMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java index d5b9ec7..11684e5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java @@ -104,10 +104,10 @@ public class DeptIdentifyController extends BaseController { * @return */ @GetMapping("/sealList") - public TableDataInfo getSealList( DeptIdentify deptIdentify){ + public TableDataInfo getSealList( DeptIdentify deptIdentify ){ startPage(); - List list = deptIdentifyService.getSealList(deptIdentify); - return getDataTable(list); + List sealList = deptIdentifyService.getSealList(deptIdentify); + return getDataTable(sealList); } /** @@ -123,14 +123,44 @@ public class DeptIdentifyController extends BaseController { return deptIdentifyService.updateSealLockStatus(sealManage); } -// /** -// * 新增模板 -// * @param deptIdentify -// * @return -// */ -// @PostMapping("/insert") -// public AjaxResult insertDeptIdentify(@RequestBody DeptIdentify deptIdentify){ -// return deptIdentifyService.insertDeptIdentify(deptIdentify); -// } + /** + * 新增模板 + * @param templateManage + * @return + */ + @PostMapping("/insertTemplate") + public AjaxResult insertTemplate(@RequestBody TemplateManage templateManage,@RequestParam("file") MultipartFile file){ + return deptIdentifyService.insertTemplate(templateManage,file); + } + /** + * 修改模板 + * @param templateManage + * @return + */ + @PostMapping("/updateTemplate") + public AjaxResult updateTemplate(@RequestBody TemplateManage templateManage,@RequestParam("file") MultipartFile file){ + return deptIdentifyService.updateTemplate(templateManage,file); + } + /** + * 删除模板 + * @param id + * @return + */ + @DeleteMapping("/deleteTemplate") + public AjaxResult deleteTemplate(Long id){ + return deptIdentifyService.deleteTemplate(id); + } + + /** + * 根据机构id查询模板 + * @param deptIdentify + * @return + */ + @GetMapping("/getTemplate") + public TableDataInfo getTemplateList( DeptIdentify deptIdentify){ + startPage(); + List sealList = deptIdentifyService.getTemplateList(deptIdentify); + return getDataTable(sealList); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java index 22b369e..815bcb3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.Date; @Data -public class DeptIdentify extends BaseEntity { +public class DeptIdentify extends BaseEntity { private static final long serialVersionUID = 1L; /** ID */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/SealManage.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/SealManage.java index 06a5b62..3b835d8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/SealManage.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/SealManage.java @@ -39,4 +39,10 @@ public class SealManage extends BaseEntity { * 印章使用状态(0禁用,1启用) */ private Integer isUse; + + /** + * 附件路径 + */ + private String annexPath; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java index 1a0f3fa..785e10a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java @@ -1,5 +1,7 @@ package com.ruoyi.wisdomarbitrate.domain.vo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; @Data diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/TemplateManageMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/TemplateManageMapper.java new file mode 100644 index 0000000..1789a90 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/TemplateManageMapper.java @@ -0,0 +1,16 @@ +package com.ruoyi.wisdomarbitrate.mapper; + +import com.ruoyi.wisdomarbitrate.domain.SealManage; +import com.ruoyi.wisdomarbitrate.domain.TemplateManage; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface TemplateManageMapper { + List selectTemplateList(TemplateManage templateManage); + + int insertTemplateManage(TemplateManage templateManage); + + int updateTemplateManage(TemplateManage templateManage); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java index 3b0db23..3a66b94 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.SealManage; +import com.ruoyi.wisdomarbitrate.domain.TemplateManage; import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO; import org.springframework.web.multipart.MultipartFile; @@ -24,7 +25,7 @@ public interface IDeptIdentifyService { AjaxResult receiveNotify(String body); - List getSealList(DeptIdentify deptIdentify); + List getSealList(DeptIdentify deptIdentify); AjaxResult updateSealLockStatus(SealManage sealManage); @@ -34,4 +35,13 @@ public interface IDeptIdentifyService { AjaxResult deleteDeptIdentify(Long id); AjaxResult updateDeptIdentify(DeptIdentify deptIdentify); + + AjaxResult insertTemplate(TemplateManage templateManage , MultipartFile file); + + AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file); + + AjaxResult deleteTemplate(Long id); + + List getTemplateList(DeptIdentify deptIdentify); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java index 538994f..c7167d0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.wisdomarbitrate.service.impl; import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.ruoyi.common.config.RuoYiConfig; @@ -17,12 +19,15 @@ import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.wisdomarbitrate.domain.CaseAttach; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.SealManage; +import com.ruoyi.wisdomarbitrate.domain.TemplateManage; import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO; import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper; import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper; import com.ruoyi.wisdomarbitrate.mapper.SealManageMapper; +import com.ruoyi.wisdomarbitrate.mapper.TemplateManageMapper; import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService; import com.ruoyi.wisdomarbitrate.utils.SignAward; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -33,6 +38,9 @@ import java.io.IOException; import java.time.LocalDate; import java.util.*; +import static com.ruoyi.common.utils.PageUtils.startPage; +import static com.ruoyi.common.utils.SecurityUtils.getUsername; + @Service public class DeptIdentifyServiceImpl implements IDeptIdentifyService { @@ -46,6 +54,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { private SysDeptMapper sysDeptMapper; @Autowired private SysUserMapper sysUserMapper; + @Autowired + private TemplateManageMapper templateManageMapper; @Override @@ -252,21 +262,15 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { } @Override - public List getSealList(DeptIdentify deptIdentify) { + public List getSealList(DeptIdentify deptIdentify) { if (deptIdentify.getId() == null) { return null; } SealManage sealManage = new SealManage(); sealManage.setIdentifyId(deptIdentify.getId()); List selectSealList = sealManageMapper.selectSealList(sealManage); - List sealListVOS = new ArrayList<>(); if (selectSealList != null && selectSealList.size() > 0) { for (SealManage sealManage1 : selectSealList) { - SealListVO sealListVO = new SealListVO(); - sealListVO.setId(sealManage1.getId()); - sealListVO.setSealId(sealManage1.getSealId()); - sealListVO.setSealName(sealManage1.getSealName()); - sealListVO.setSealStatus(sealManage1.getSealStatus()); Integer annexId = sealManage1.getAnnexId(); if (annexId != null) { //根据附件id查询路径 @@ -276,17 +280,13 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { int startIndex = annexName.indexOf(prefix); startIndex += prefix.length(); String annexPath = "/uploadPath" + annexName.substring(startIndex); - sealListVO.setAnnexPath(annexPath); - sealListVO.setAnnexType(caseAttach.getAnnexType()); + sealManage1.setAnnexPath(annexPath); } else { - sealListVO.setAnnexPath(null); - sealListVO.setAnnexType(null); + sealManage1.setAnnexPath(null); } - sealListVO.setIsUse(sealManage1.getIsUse()); - sealListVOS.add(sealListVO); } } - return sealListVOS; + return selectSealList; } @Override @@ -374,6 +374,91 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { return null; } + @Override + public AjaxResult insertTemplate(TemplateManage templateManage , MultipartFile file) { + //参数校验 + if (templateManage.getIdentifyId() == null || file == null || templateManage.getTemName() == null){ + return AjaxResult.error("请检查参数是否完整"); + } + if (templateManage.getTemType() == null){ + templateManage.setTemType(1); //默认模板类型为1(裁决书) + } + try { + String filePath = RuoYiConfig.getUploadPath(); + // 上传 + String fileName = FileUploadUtils.upload(filePath, file); + String prefix = "/profile"; + int startIndex = fileName.indexOf(prefix); + startIndex += prefix.length(); + String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex); + templateManage.setTemOrigPath(annexPath); + String format = getFileExtension(fileName); + templateManage.setTemFormat(format); + templateManage.setCreateBy(getUsername()); + int i = templateManageMapper.insertTemplateManage(templateManage); + if (i>0){ + return AjaxResult.success("新增成功"); + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + @Override + public AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file) { + Long id = templateManage.getId(); + if (id == null) { + return AjaxResult.error(); + } + try { + String filePath = RuoYiConfig.getUploadPath(); + // 上传 + String fileName = FileUploadUtils.upload(filePath, file); + String prefix = "/profile"; + int startIndex = fileName.indexOf(prefix); + startIndex += prefix.length(); + String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex); + templateManage.setTemOrigPath(annexPath); + String format = getFileExtension(fileName); + templateManage.setTemFormat(format); + templateManage.setUpdateBy(getUsername()); + int i = templateManageMapper.updateTemplateManage(templateManage); + if (i>0){ + return AjaxResult.success("修改成功"); + } + } catch (IOException e) { + e.printStackTrace(); + } + return AjaxResult.error(); + } + + @Override + public AjaxResult deleteTemplate(Long id) { + TemplateManage templateManage = new TemplateManage(); + templateManage.setId(id); + templateManage.setDelFlag(2); + int i = templateManageMapper.updateTemplateManage(templateManage); + if (i > 0) { + return AjaxResult.success("删除成功"); + } + return AjaxResult.error(); + } + + @Override + public List getTemplateList(DeptIdentify deptIdentify) { + if (deptIdentify.getId() == null) { + return null; + } + TemplateManage templateManage = new TemplateManage(); + templateManage.setIdentifyId(deptIdentify.getId()); + List templateManages = templateManageMapper.selectTemplateList(templateManage); + if (templateManages != null && templateManages.size() > 0) { + return templateManages; + } + return null; + } + private String generateUniqueUsername() { final Random random = new Random(); final Set generatedUsernames = new HashSet<>(); @@ -387,5 +472,11 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { } } } - + private String getFileExtension(String fileName) { + int lastDotIndex = fileName.lastIndexOf("."); + if (lastDotIndex > 0 && lastDotIndex < fileName.length() - 1) { + return fileName.substring(lastDotIndex + 1); + } + return ""; + } } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml index 8c2d2be..a98d019 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml @@ -83,6 +83,7 @@ update dept_identify identify_date = #{identifyDate}, + identify_name = #{identifyName}, is_use = #{isUse}, identify_status = #{identifyStatus}, org_id = #{orgId}, diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/TemplateManageMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/TemplateManageMapper.xml new file mode 100644 index 0000000..288f270 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/TemplateManageMapper.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + insert into template_manage( + identify_id, + tem_name, + tem_type, + tem_format, + tem_orig_path, + tem_revis_path, + create_by, + del_flag,create_time + )values( + #{identifyId}, + #{sealName}, + #{temType}, + #{temFormat}, + #{temOrigPath}, + #{temRevisPath}, + #{createBy}, + 0,sysdate() + ) + + + + update template_manage + + identify_id = #{identifyId}, + tem_name = #{temName}, + tem_type = #{temType}, + tem_format = #{temFormat}, + tem_orig_path = #{temOrigPath}, + del_flag = #{delFlag}, + tem_revis_path = #{temRevisPath}, + update_by = #{updateBy}, + update_time = sysdate() + + + + AND id = #{id} + + + + + + + + \ No newline at end of file