模板管理优化
This commit is contained in:
+9
-5
@@ -1,7 +1,6 @@
|
||||
package com.ruoyi.wisdomarbitrate.domain.dto.template;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -13,6 +12,14 @@ public class TemplateManage extends BaseEntity {
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 附件id
|
||||
*/
|
||||
private Long fileId;
|
||||
/**
|
||||
* 附件ids
|
||||
*/
|
||||
private List<Long> annexIds;
|
||||
|
||||
/**
|
||||
* 机构关联id
|
||||
@@ -44,10 +51,7 @@ public class TemplateManage extends BaseEntity {
|
||||
* 修订后模板路径
|
||||
*/
|
||||
private String temRevisPath;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 机构关联id
|
||||
*/
|
||||
|
||||
+4
-1
@@ -5,7 +5,6 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@@ -20,6 +19,10 @@ public class MsCaseApplicationReq {
|
||||
* 模板id
|
||||
*/
|
||||
private String templateId;
|
||||
/**
|
||||
* 模板附件id
|
||||
*/
|
||||
private Long fileId;
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
|
||||
+7
@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.mapper.dept;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,4 +18,10 @@ public interface DeptIdentifyMapper {
|
||||
|
||||
int updateDeptIdentify(DeptIdentify deptIdentify);
|
||||
|
||||
/**
|
||||
* 根据机构id查询名称
|
||||
* @param identifyId
|
||||
* @return
|
||||
*/
|
||||
String selectById(@Param("id") Long identifyId);
|
||||
}
|
||||
|
||||
+57
@@ -21,4 +21,61 @@ public interface TemplateManageMapper {
|
||||
* @return
|
||||
*/
|
||||
TemplateManage selectByType(@Param("type") int type);
|
||||
|
||||
/**
|
||||
* 批量修改
|
||||
* @param templateManage
|
||||
* @return
|
||||
*/
|
||||
int updateByIds(TemplateManage templateManage);
|
||||
|
||||
/**
|
||||
* 新增模板附件表
|
||||
* @param templateManage
|
||||
* @return
|
||||
*/
|
||||
int insertTemplateManageFile(TemplateManage templateManage);
|
||||
|
||||
/**
|
||||
* 删除模板
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteTemplateManage(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 根据id修改附件表
|
||||
* @param templateManage
|
||||
*/
|
||||
void updateFileByIds(@Param("manage") TemplateManage templateManage);
|
||||
|
||||
/**
|
||||
* 根据条件删除附件
|
||||
* @param id
|
||||
* @param annexIds
|
||||
*/
|
||||
void deleteTemplateManageFileById(@Param("id")Long id, @Param("fileIds")List<Long> annexIds);
|
||||
|
||||
/**
|
||||
* 根据模板id和类型查询
|
||||
* @param templateId
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
TemplateManage selectByIdAndType(@Param("templateId")Long templateId, @Param("type")Integer code);
|
||||
|
||||
/**
|
||||
* 根据附件id查询
|
||||
* @param templateId
|
||||
* @return
|
||||
*/
|
||||
|
||||
TemplateManage selectFileById(@Param("fileId") Long templateId);
|
||||
|
||||
/**
|
||||
* 根据模板id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<TemplateManage> selectTemplateListById(@Param("id")Long id);
|
||||
}
|
||||
|
||||
+18
-2
@@ -9,6 +9,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public interface IDeptIdentifyService {
|
||||
@@ -37,9 +38,9 @@ public interface IDeptIdentifyService {
|
||||
|
||||
AjaxResult updateDeptIdentify(DeptIdentify deptIdentify);
|
||||
|
||||
AjaxResult insertTemplate(TemplateManage templateManage , MultipartFile file);
|
||||
AjaxResult insertTemplate(TemplateManage templateManage );
|
||||
|
||||
AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file);
|
||||
AjaxResult updateTemplate(TemplateManage templateManage);
|
||||
|
||||
AjaxResult deleteTemplate(Long id);
|
||||
|
||||
@@ -62,4 +63,19 @@ public interface IDeptIdentifyService {
|
||||
* @return
|
||||
*/
|
||||
List<FatchRule> getTemplateInfoById(TemplateManage templateManage);
|
||||
|
||||
/**
|
||||
* 上传附件
|
||||
* @param file
|
||||
* @param annexType
|
||||
* @return
|
||||
*/
|
||||
AjaxResult uploadFile(MultipartFile file, Integer annexType) throws IOException;
|
||||
|
||||
/**
|
||||
* 根据模板id查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getTemplateDetail(Long id);
|
||||
}
|
||||
|
||||
+72
-45
@@ -13,10 +13,12 @@ import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.enums.AnnexTypeEnum;
|
||||
import com.ruoyi.common.enums.TemplateTypeEnum;
|
||||
import com.ruoyi.common.exception.EsignDemoException;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SealUtil;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
|
||||
@@ -41,6 +43,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -73,6 +76,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
||||
private SysDictDataMapper dictDataMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
|
||||
@@ -405,70 +409,41 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@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);
|
||||
|
||||
templateManage.setTemOrigPath(fileName);
|
||||
String format = getFileExtension(fileName);
|
||||
templateManage.setTemFormat(format);
|
||||
templateManage.setFileName(file.getOriginalFilename());
|
||||
public AjaxResult insertTemplate(TemplateManage templateManage) {
|
||||
templateManage.setCreateBy(getUsername());
|
||||
int i = templateManageMapper.insertTemplateManage(templateManage);
|
||||
templateManage.setId(templateManage.getId());
|
||||
templateManageMapper.updateFileByIds(templateManage);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file) {
|
||||
public AjaxResult updateTemplate(TemplateManage templateManage) {
|
||||
Long id = templateManage.getId();
|
||||
if (id == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
try {
|
||||
if (file != null && file.getSize() > 0) {
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
templateManage.setTemOrigPath(fileName);
|
||||
templateManage.setFileName(file.getOriginalFilename());
|
||||
String format = getFileExtension(fileName);
|
||||
templateManage.setTemFormat(format);
|
||||
}
|
||||
templateManage.setUpdateBy(getUsername());
|
||||
int i = templateManageMapper.updateTemplateManage(templateManage);
|
||||
// 先删除附件
|
||||
if(CollectionUtil.isNotEmpty(templateManage.getAnnexIds())) {
|
||||
templateManageMapper.deleteTemplateManageFileById(id, templateManage.getAnnexIds());
|
||||
// 修改附件表
|
||||
templateManageMapper.updateFileByIds(templateManage);
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult deleteTemplate(Long id) {
|
||||
TemplateManage templateManage = new TemplateManage();
|
||||
templateManage.setId(id);
|
||||
templateManage.setDelFlag(2);
|
||||
int i = templateManageMapper.updateTemplateManage(templateManage);
|
||||
int i = templateManageMapper.deleteTemplateManage(id);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
@@ -620,6 +595,58 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
||||
|
||||
return fatchRuleList;
|
||||
}
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult uploadFile(MultipartFile file, Integer annexType) throws IOException {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
TemplateManage templateManage=new TemplateManage();
|
||||
templateManage.setTemOrigPath(fileName);
|
||||
String format = getFileExtension(fileName);
|
||||
templateManage.setTemFormat(format);
|
||||
templateManage.setFileName(file.getOriginalFilename());
|
||||
templateManage.setTemType(annexType);
|
||||
int i = templateManageMapper.insertTemplateManageFile(templateManage);
|
||||
if(i<1){
|
||||
return AjaxResult.error("上传失败");
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("annexId", templateManage.getFileId());
|
||||
ajax.put("annexType", annexType);
|
||||
ajax.put("url", fileName);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getTemplateDetail(Long id) {
|
||||
List<TemplateManage> list = templateManageMapper.selectTemplateListById(id);
|
||||
if(CollectionUtil.isEmpty(list)){
|
||||
return AjaxResult.error("模板不存在");
|
||||
}
|
||||
Map<Integer, TemplateManage> manageMap = list.stream().collect(Collectors.toMap(TemplateManage::getTemType, Function.identity(), (oldValue, newValue) -> newValue));
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("id",id);
|
||||
ajax.put("identifyId",list.get(0).getIdentifyId());
|
||||
if(list.get(0).getIdentifyId()!=null) {
|
||||
// 查询机构名称
|
||||
|
||||
ajax.put("identifyName", deptIdentifyMapper.selectById(list.get(0).getIdentifyId()));
|
||||
}
|
||||
ajax.put("temName",list.get(0).getTemName());
|
||||
// 调节申请书
|
||||
ajax.put("applicationFile",manageMap.get(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()));
|
||||
// 和解协议
|
||||
ajax.put("agreementFile",manageMap.get(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode()));
|
||||
// 调解书
|
||||
ajax.put("bookFile",manageMap.get(TemplateTypeEnum.MEDIATE_BOOK.getCode()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
private String getFileExtension(String fileName) {
|
||||
int lastDotIndex = fileName.lastIndexOf(".");
|
||||
|
||||
+13
-16
@@ -14,6 +14,7 @@ import com.ruoyi.common.core.domain.entity.*;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.enums.AnnexTypeEnum;
|
||||
import com.ruoyi.common.enums.MediatorTypeEnum;
|
||||
import com.ruoyi.common.enums.TemplateTypeEnum;
|
||||
import com.ruoyi.common.enums.YesOrNoEnum;
|
||||
import com.ruoyi.common.exception.EsignDemoException;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
@@ -293,12 +294,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) {
|
||||
affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", ""));
|
||||
}
|
||||
|
||||
msCaseAffiliateMapper.insert(affiliate);
|
||||
// 查询调解申请书模板id
|
||||
TemplateManage templateManage=templateManageMapper.selectByType(2);
|
||||
if(templateManage!=null) {
|
||||
// 批量生成调解申请书
|
||||
// 批量生成调解申请书
|
||||
MsCaseApplicationReq req = new MsCaseApplicationReq();
|
||||
req.setCaseFlowId(caseFlow.getId());
|
||||
if(!caseApplication.isImportFlag()) {
|
||||
@@ -308,11 +305,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
req.setBatchNumber(caseApplication.getBatchNumber());
|
||||
}
|
||||
// 生成调解申请书
|
||||
req.setTemplateId(String.valueOf(templateManage.getId()));
|
||||
req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode());
|
||||
// todo 部署放开
|
||||
// caseApplicationService.generateApplication(req);
|
||||
|
||||
}
|
||||
caseApplicationService.generateApplication(req);
|
||||
|
||||
// 保存案件附件
|
||||
|
||||
@@ -637,7 +632,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
@Override
|
||||
public AjaxResult generateApplication(MsCaseApplicationReq req) {
|
||||
// 根据模板id查询申请书
|
||||
TemplateManage templateManage=templateManageMapper.selectById(req.getTemplateId());
|
||||
if(req.getTemplateId()==null || req.getTemplateType()==null){
|
||||
return AjaxResult.error("模板id不能为空");
|
||||
}
|
||||
TemplateManage templateManage=templateManageMapper.selectByIdAndType(Long.valueOf(req.getTemplateId()),req.getTemplateType());
|
||||
if(templateManage==null||StrUtil.isEmpty(templateManage.getTemOrigPath())){
|
||||
throw new ServiceException("未找到模板");
|
||||
}
|
||||
@@ -879,12 +877,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
}
|
||||
// 给申请人被申请人发送短信
|
||||
// 被申请人发送短信
|
||||
if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
|
||||
String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
|
||||
// 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
|
||||
// todo 发送申请人注册小程序短信
|
||||
Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()});
|
||||
String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件已经受理,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信";
|
||||
// 给被申请人发送案件受理短信 2068468 待缴费通知 尊敬的用户,您编号为{1}的案件已经受理,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信
|
||||
Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2068468", affiliate.getRespondentPhone(), new String[]{ application.getCaseNum()});
|
||||
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getRespondentPhone(), new Date(), sendContent);
|
||||
if (smsFlag) {
|
||||
@@ -1281,7 +1278,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
}
|
||||
String templateId = String.valueOf(application.getTemplateId());
|
||||
req.setTemplateId(templateId);
|
||||
req.setTemplateType(1);
|
||||
req.setTemplateType(TemplateTypeEnum.MEDIATE_BOOK.getCode());
|
||||
AjaxResult result = generateApplication(req);
|
||||
if (result != null && result.isSuccess()) {
|
||||
List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());
|
||||
|
||||
+1
-1
@@ -374,7 +374,7 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
|
||||
boolean isSecretaryRole=false;
|
||||
if(CollectionUtil.isNotEmpty(roles)){
|
||||
for (SysRole role : roles) {
|
||||
if("法律顾问".equals(role.getRoleName()) || "秘书".equals(role.getRoleName())){
|
||||
if("调解员".equals(role.getRoleName())){
|
||||
isSecretaryRole=true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user