调解系统tkmybatis逆向生成代码
This commit is contained in:
+655
@@ -0,0 +1,655 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.dept.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.FileTransformation;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
||||
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.exception.EsignDemoException;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SealUtil;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.template.TemplateFatchRule;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.template.FatchRuleMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.template.TemplateManageMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.dept.IDeptIdentifyService;
|
||||
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
||||
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 com.ruoyi.wisdomarbitrate.mapper.template.TemplateFatchRuleMapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.ruoyi.common.utils.PageUtils.startPage;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
@Service
|
||||
public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
||||
|
||||
@Autowired
|
||||
private DeptIdentifyMapper deptIdentifyMapper;
|
||||
@Autowired
|
||||
private MsCaseAttachMapper msCaseAttachMapper;
|
||||
@Autowired
|
||||
private SealManageMapper sealManageMapper;
|
||||
@Autowired
|
||||
private SysDeptMapper sysDeptMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private TemplateManageMapper templateManageMapper;
|
||||
@Autowired
|
||||
private SysUserPostMapper sysUserPostMapper;
|
||||
@Autowired
|
||||
private TemplateFatchRuleMapper templateFatchRuleMapper;
|
||||
@Autowired
|
||||
private FatchRuleMapper fatchRuleMapper;
|
||||
@Autowired
|
||||
private SysDictDataMapper dictDataMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
|
||||
return deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException {
|
||||
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
DeptIdentify deptIdentifynew = new DeptIdentify();
|
||||
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
|
||||
Gson gson = new Gson();
|
||||
DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
|
||||
EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
|
||||
JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
|
||||
int code = signUrlJsonObject.get("code").getAsInt();
|
||||
if (code == 0) {
|
||||
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
|
||||
String url = signUrlData.get("authUrl").getAsString();
|
||||
//获取本次认证授权流程ID
|
||||
String authFlowId = signUrlData.get("authFlowId").getAsString();
|
||||
deptIdentify.setAuthFlowId(authFlowId);
|
||||
deptIdentifynew.setIdentifyUrl(url);
|
||||
deptIdentify.setIdentifyDate(new Date());
|
||||
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
|
||||
}
|
||||
}
|
||||
return deptIdentifynew;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult enableDept(DeptIdentify deptIdentify) {
|
||||
//参数校验
|
||||
if (deptIdentify.getId() == null) {
|
||||
return AjaxResult.error("请检查参数");
|
||||
}
|
||||
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
|
||||
Integer identifyStatus = deptIdentifyselect.getIdentifyStatus();
|
||||
if (identifyStatus != 1) {
|
||||
return AjaxResult.error("这个认证数据未进行认证,不能启用");
|
||||
}
|
||||
deptIdentifyselect.setIsUse(1);
|
||||
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
|
||||
if (i > 0) {
|
||||
//把其他认证数据置为未使用
|
||||
DeptIdentify deptIdentify2 = new DeptIdentify();
|
||||
deptIdentify2.setIsUse(1);
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify2);
|
||||
for (DeptIdentify deptIdentify3 : deptIdentifies) {
|
||||
if (deptIdentify3.equals(deptIdentifyselect)) {
|
||||
continue;
|
||||
}
|
||||
deptIdentify3.setIsUse(0);
|
||||
deptIdentifyMapper.updateDeptIdentify(deptIdentify3);
|
||||
}
|
||||
return AjaxResult.success("启用成功");
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult sealUpload(Long id, String sealName, MultipartFile file) {
|
||||
try {
|
||||
if (file.isEmpty()) {
|
||||
return AjaxResult.error("请选择要上传的文件");
|
||||
}
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
DeptIdentify deptIdentify = new DeptIdentify();
|
||||
deptIdentify.setId(id);
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
||||
for (DeptIdentify identify : deptIdentifies) {
|
||||
//先判断企业用户是否授予资源管理权限
|
||||
String authFlowId = identify.getAuthFlowId();
|
||||
if (authFlowId == null) {
|
||||
return AjaxResult.error("改机构尚未认证,不能上传自定义公章");
|
||||
}
|
||||
EsignHttpResponse response1 = SealUtil.queryAuthProcess(authFlowId);
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
|
||||
int authorizedStatus = jsonObject1.getJSONObject("data").getIntValue("authorizedStatus");
|
||||
if (authorizedStatus == 1) {//授权流程状态 0流程过期失效 1已授权 2授权中 3审批未通过
|
||||
String prefix = "/profile";
|
||||
int startIndex = fileName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
|
||||
//创建机构图片印章
|
||||
//String annexPath = "D:\\develop\\2.jpg";
|
||||
|
||||
EsignHttpResponse response = SignAward.createOrgByImage(identify, sealName, annexPath);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
|
||||
int code = jsonObject.getIntValue("code");
|
||||
if (code == 0) { //业务码,0表示成功,非0表示异常。
|
||||
String sealId = jsonObject.getJSONObject("data").getString("sealId");
|
||||
//保存到表里
|
||||
SealManage sealManage = new SealManage();
|
||||
sealManage.setIdentifyId(identify.getId());
|
||||
sealManage.setSealName(sealName);
|
||||
sealManage.setSealId(sealId);
|
||||
sealManage.setSealStatus(0); //默认为未审核
|
||||
sealManage.setIsUse(0); //默认为禁用
|
||||
int i = sealManageMapper.insertSealManage(sealManage);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("上传成功");
|
||||
}
|
||||
}
|
||||
return AjaxResult.error(jsonObject.getString("message"));
|
||||
}
|
||||
return AjaxResult.error("企业用户未授予资源管理权限");
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (EsignDemoException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult receiveNotify(String body) {
|
||||
/* 请求Body数据格式如下:
|
||||
{
|
||||
"action":"SEAL_AUDIT",
|
||||
"auditStatus":1,
|
||||
"psnId":"c7e00294**41e7",
|
||||
"rejectReason":"",
|
||||
"sealBizType":"COMMON",
|
||||
"sealId":"af80ba0f-xx-xx-xx-a2da292d7f7f",
|
||||
"sealName":"赵四的图片印章",
|
||||
"statusDescription":"通过"
|
||||
}*/
|
||||
//解析body数据
|
||||
try {
|
||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||
String action = jsonObject.getString("action");
|
||||
if (action.equals("SEAL_AUDIT")) { //SEAL_AUDIT表示图片印章审核结果通知
|
||||
String auditStatus = jsonObject.getString("auditStatus");
|
||||
if (auditStatus.equals("1")) { //图片印章审核结果 1通过 ,0驳回
|
||||
//审核通过,拿到印章id和机构账号ID
|
||||
String orgId = jsonObject.getString("orgId");
|
||||
String sealId = jsonObject.getString("sealId");
|
||||
//查询指定印章详情(机构)
|
||||
EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId);
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(response.getBody());
|
||||
if (jsonObject1.getIntValue("code") == 0) { //业务码,0表示成功,非0表示异常。
|
||||
int sealStatus = jsonObject1.getJSONObject("data").getIntValue("sealStatus");
|
||||
if (sealStatus == 1) { //印章状态 1已启用,2待审核,3审核不通过,4 挂起
|
||||
String sealImageDownloadUrl = jsonObject1.getString("sealImageDownloadUrl");
|
||||
LocalDate now = LocalDate.now();
|
||||
String year = Integer.toString(now.getYear());
|
||||
String month = String.format("%02d", now.getMonthValue());
|
||||
String day = String.format("%02d", now.getDayOfMonth());
|
||||
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
|
||||
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||
String savePath = "/home/ruoyi/uploadPath/upload/";
|
||||
// 创建日期目录
|
||||
File saveFolder = new File(saveFolderPath);
|
||||
if (!saveFolder.exists()) {
|
||||
saveFolder.mkdirs();
|
||||
}
|
||||
String resultFilePath = saveFolderPath + "/" + fileName;
|
||||
File resultFilePathFile = new File(resultFilePath);
|
||||
if (!resultFilePathFile.exists()) {
|
||||
resultFilePathFile.createNewFile();
|
||||
}
|
||||
boolean downLoadFile = FileTransformation.downLoadFileByUrl(sealImageDownloadUrl, resultFilePath);
|
||||
if (downLoadFile) {
|
||||
CaseAttach caseAttach = new CaseAttach();
|
||||
caseAttach.setAnnexType(10); //10代表印章图片
|
||||
caseAttach.setAnnexPath(savePath);
|
||||
caseAttach.setAnnexName(saveName);
|
||||
int i1 = msCaseAttachMapper.save(caseAttach);
|
||||
if (i1 > 0) {
|
||||
//将附件id保存到公章管理表里
|
||||
Integer annexId1 = caseAttach.getAnnexId();
|
||||
SealManage sealManage = new SealManage();
|
||||
sealManage.setSealId(sealId);
|
||||
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
|
||||
if (selectSealList != null && selectSealList.size() > 0) {
|
||||
SealManage sealManage1 = selectSealList.get(0);
|
||||
sealManage1.setAnnexId(annexId1);
|
||||
sealManage1.setSealStatus(1); //启用
|
||||
sealManageMapper.updateSealManage(sealManage1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (EsignDemoException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new AjaxResult(200, "success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SealManage> getSealList(DeptIdentify deptIdentify) {
|
||||
if (deptIdentify.getId() == null) {
|
||||
return null;
|
||||
}
|
||||
SealManage sealManage = new SealManage();
|
||||
sealManage.setIdentifyId(deptIdentify.getId());
|
||||
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
|
||||
if (selectSealList != null && selectSealList.size() > 0) {
|
||||
for (SealManage sealManage1 : selectSealList) {
|
||||
Integer annexId = sealManage1.getAnnexId();
|
||||
if (annexId != null) {
|
||||
//根据附件id查询路径
|
||||
CaseAttach caseAttach = msCaseAttachMapper.queryAnnexById(annexId);
|
||||
String annexName = caseAttach.getAnnexName();
|
||||
String prefix = "/profile";
|
||||
int startIndex = annexName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
||||
sealManage1.setAnnexPath(annexPath);
|
||||
} else {
|
||||
sealManage1.setAnnexPath(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return selectSealList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateSealLockStatus(SealManage sealManage) {
|
||||
sealManageMapper.updateSealManage(sealManage);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult insertDeptIdentify(DeptIdentify deptIdentify) {
|
||||
//参数校验
|
||||
String identifyName = deptIdentify.getIdentifyName();
|
||||
if (identifyName == null) {
|
||||
AjaxResult.error("请检查参数是否完整");
|
||||
}
|
||||
Integer identifyType = deptIdentify.getIdentifyType();
|
||||
if (identifyType == null) {
|
||||
deptIdentify.setIdentifyType(1); // 设置机构默认为仲裁机构
|
||||
}
|
||||
deptIdentify.setIdentifyStatus(0); //设置认证状态默认为未认证
|
||||
deptIdentify.setIsUse(0); //设置机构默认为未启用
|
||||
//将机构名称保存到部门表里
|
||||
SysDept sysDept = new SysDept();
|
||||
sysDept.setDeptName(identifyName);
|
||||
sysDept.setParentId(0L);
|
||||
sysDept.setDeptType(1);
|
||||
int i1 = sysDeptMapper.insertDept(sysDept);
|
||||
if (i1 > 0) {
|
||||
/* //将经办人信息存入到用户表里
|
||||
Long deptId = sysDept.getDeptId();
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setDeptId(deptId);
|
||||
sysUser.setUserName(deptIdentify.getOperUserName());
|
||||
sysUser.setNickName(operName);
|
||||
sysUser.setPhonenumber(operPhone);
|
||||
SysUser sysUser1 = sysUserMapper.selectUserByUserName(deptIdentify.getOperUserName());
|
||||
if (sysUser1== null) {
|
||||
sysUserMapper.insertUser(sysUser);
|
||||
}
|
||||
Long userId = sysUser.getUserId();
|
||||
deptIdentify.setDeptId(deptId);
|
||||
deptIdentify.setUserId(userId);
|
||||
List<SysUserPost> sysUserPosts = new ArrayList<>();
|
||||
SysUserPost sysUserPost = new SysUserPost();
|
||||
sysUserPost.setUserId(userId);
|
||||
sysUserPost.setPostId(5L);
|
||||
sysUserPosts.add(sysUserPost);
|
||||
sysUserPostMapper.batchUserPost(sysUserPosts);*/
|
||||
Long deptId = sysDept.getDeptId();
|
||||
deptIdentify.setDeptId(deptId);
|
||||
}
|
||||
|
||||
int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult deleteDeptIdentify(Long id) {
|
||||
DeptIdentify deptIdentify = new DeptIdentify();
|
||||
deptIdentify.setId(id);
|
||||
deptIdentify.setDelFlag(2);
|
||||
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
|
||||
if (i > 0) {
|
||||
//删除部门表数据
|
||||
sysDeptMapper.deleteDeptById(id);
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateDeptIdentify(DeptIdentify deptIdentify) {
|
||||
Long id = deptIdentify.getId();
|
||||
if (id == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
DeptIdentify deptIdentifyNew = new DeptIdentify();
|
||||
deptIdentifyNew.setId(id);
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentifyNew);
|
||||
if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
||||
DeptIdentify deptIdentify1 = deptIdentifies.get(0);
|
||||
if (deptIdentify1.getIdentifyStatus() == 1) {
|
||||
return AjaxResult.error("已认证的机构不允许修改");
|
||||
}
|
||||
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
|
||||
if (i > 0) {
|
||||
//修改部门表数据
|
||||
SysDept sysDept = new SysDept();
|
||||
sysDept.setDeptId(deptIdentify1.getDeptId());
|
||||
sysDept.setDeptName(deptIdentify.getIdentifyName());
|
||||
sysDeptMapper.updateDept(sysDept);
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
}
|
||||
|
||||
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 = "uploadPath" + fileName.substring(startIndex);
|
||||
templateManage.setTemOrigPath(annexPath);
|
||||
String format = getFileExtension(fileName);
|
||||
templateManage.setTemFormat(format);
|
||||
String subFileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
||||
templateManage.setFileName(subFileName);
|
||||
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 {
|
||||
if (file != null && file.getSize() > 0) {
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String prefix = "/profile";
|
||||
int startIndex = fileName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "uploadPath" + fileName.substring(startIndex);
|
||||
templateManage.setTemOrigPath(annexPath);
|
||||
String subFileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
||||
templateManage.setFileName(subFileName);
|
||||
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<TemplateManage> getTemplateList(DeptIdentify deptIdentify) {
|
||||
TemplateManage templateManage = new TemplateManage();
|
||||
templateManage.setIdentifyId(deptIdentify.getId());
|
||||
List<TemplateManage> templateManages = templateManageMapper.selectTemplateList(templateManage);
|
||||
if (templateManages != null && templateManages.size() > 0) {
|
||||
for (TemplateManage manage : templateManages) {
|
||||
//根据机构id查询机构名称
|
||||
Long identifyId = manage.getIdentifyId();
|
||||
if (identifyId != null) {
|
||||
deptIdentify.setId(identifyId);
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
||||
manage.setIdentifyName(deptIdentifies.get(0).getIdentifyName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return templateManages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectPostUserByDeptId(DeptIdentify deptIdentify) {
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
||||
deptIdentify = deptIdentifies.get(0);
|
||||
if (deptIdentify.getDeptId() != null) {
|
||||
//默认查询经办人的
|
||||
Long roleId = 106L;
|
||||
List<SysUser> sysUserList = sysUserMapper.selectRoleUserByDeptId(deptIdentify.getDeptId(), roleId);
|
||||
return sysUserList;
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult bindHandler(DeptIdentify deptIdentify) {
|
||||
if (deptIdentify.getId() == null || deptIdentify.getUserId() == null) {
|
||||
return AjaxResult.error("请检查参数是否完整");
|
||||
}
|
||||
//根据userid查询用户信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(deptIdentify.getUserId());
|
||||
if (sysUser != null) {
|
||||
deptIdentify.setOperName(sysUser.getNickName());
|
||||
deptIdentify.setOperPhone(sysUser.getPhonenumber());
|
||||
deptIdentify.setOperUserName(sysUser.getUserName());
|
||||
deptIdentify.setUserId(deptIdentify.getUserId());
|
||||
//更新
|
||||
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("绑定成功");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FatchRule> getFatchRuleByTemplateid(TemplateManage templateManage) {
|
||||
|
||||
FatchRule fatchRule = new FatchRule();
|
||||
fatchRule.setTemplateId(templateManage.getId());
|
||||
return fatchRuleMapper.selectFatchRuleList(fatchRule);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult saveFatchRules(TemplateManage templateManage) {
|
||||
TemplateFatchRule templateFatchRule = new TemplateFatchRule();
|
||||
templateFatchRule.setTemplateId(templateManage.getId());
|
||||
templateFatchRuleMapper.deleteTemplateFatchRule(templateManage.getId());
|
||||
|
||||
List<FatchRule> fatchRules = templateManage.getFatchRules();
|
||||
|
||||
Map<Object, Long> columnmap = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumn(), Collectors.counting()));
|
||||
Stream<Object> columnStream = columnmap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey());
|
||||
List<String> strlist1 = new ArrayList<>();
|
||||
columnStream.forEach(column -> {
|
||||
strlist1.add(column.toString());
|
||||
});
|
||||
if(strlist1!=null&&strlist1.size()>0){
|
||||
throw new ServiceException("字段' " + String.join(",", strlist1) + " '重复");
|
||||
}
|
||||
|
||||
Map<Object, Long> columnNamemap = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumnName(), Collectors.counting()));
|
||||
Stream<Object> columnNameStream = columnNamemap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey());
|
||||
List<String> strlist2 = new ArrayList<>();
|
||||
columnNameStream.forEach(column -> {
|
||||
strlist2.add(column.toString());
|
||||
});
|
||||
if(strlist2!=null&&strlist2.size()>0){
|
||||
throw new ServiceException("字段' " + String.join(",", strlist2) + " '重复");
|
||||
}
|
||||
|
||||
if(fatchRules!=null&&fatchRules.size()>0){
|
||||
for (FatchRule fatchRule : fatchRules) {
|
||||
//保存抓取规则数据
|
||||
fatchRuleMapper.insertFatchRule(fatchRule);
|
||||
//保存模板抓取规则关联关系
|
||||
Long fatchRuleId = fatchRule.getId();
|
||||
if(fatchRuleId!=null){
|
||||
templateFatchRule.setFatchRuleId(fatchRuleId);
|
||||
templateFatchRuleMapper.insertTemplateFatchRule(templateFatchRule);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FatchRule> selectColumnandComment() {
|
||||
List<FatchRule> fatchRules = new ArrayList<>();
|
||||
FatchRule fatchRuleselect = new FatchRule();
|
||||
fatchRuleselect.setDatabaseName("test_smart_arbitration");
|
||||
fatchRules = fatchRuleMapper.selectColumnandComment(fatchRuleselect);
|
||||
return fatchRules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FatchRule selectColumnbycomment(FatchRule fatchRule) {
|
||||
fatchRule.setDatabaseName("test_smart_arbitration");
|
||||
FatchRule fatchRulesel = fatchRuleMapper.selectColumnbycomment(fatchRule);
|
||||
return fatchRulesel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模板id查询模板字段列表
|
||||
* @param templateManage
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FatchRule> getTemplateInfoById(TemplateManage templateManage) {
|
||||
FatchRule fatchRule = new FatchRule();
|
||||
fatchRule.setTemplateId(templateManage.getId());
|
||||
List<FatchRule> fatchRuleList = fatchRuleMapper.selectFatchRuleList(fatchRule);
|
||||
if(CollectionUtil.isEmpty(fatchRuleList)){
|
||||
fatchRuleList=new ArrayList<>();
|
||||
}
|
||||
List<String> columnNameList = fatchRuleList.stream().map(FatchRule::getColumnName).collect(Collectors.toList());
|
||||
// 在系统表中查询案件内置字段
|
||||
SysDictData sysDictData = new SysDictData();
|
||||
sysDictData.setDictType("case_built_type");
|
||||
List<SysDictData> dictDataList = dictDataMapper.selectDictDataList(sysDictData);
|
||||
if(CollectionUtil.isNotEmpty(dictDataList)){
|
||||
for (SysDictData dictData : dictDataList) {
|
||||
if(StrUtil.isEmpty(dictData.getDictLabel())||columnNameList.contains(dictData.getDictLabel())){
|
||||
continue;
|
||||
}
|
||||
FatchRule rule=new FatchRule();
|
||||
rule.setColumn(dictData.getDictValue());
|
||||
rule.setColumnName(dictData.getDictLabel());
|
||||
fatchRuleList.add(rule);
|
||||
}
|
||||
}
|
||||
|
||||
return fatchRuleList;
|
||||
}
|
||||
|
||||
private String getFileExtension(String fileName) {
|
||||
int lastDotIndex = fileName.lastIndexOf(".");
|
||||
if (lastDotIndex > 0 && lastDotIndex < fileName.length() - 1) {
|
||||
return fileName.substring(lastDotIndex + 1);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.mscase;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseLogRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICaseLogRecordService {
|
||||
|
||||
|
||||
List<CaseLogRecord> selectCaseLogRecordList(CaseLogRecord caseLogRecord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.mscase;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MsCaseLogRecordService {
|
||||
|
||||
|
||||
List<MsCaseLogRecord> selectCaseLogRecordList(MsCaseLogRecord caseLogRecord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.mscase;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.ReservedConferenceVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -41,10 +41,10 @@ public interface VideoService {
|
||||
|
||||
/**
|
||||
* 根据html字符串转pdf并和案件关联
|
||||
* @param reservedConferenceVO
|
||||
* @param msReservedConferenceVO
|
||||
* @return
|
||||
*/
|
||||
AjaxResult htmlToPDF(ReservedConferenceVO reservedConferenceVO);
|
||||
AjaxResult htmlToPDF(MsReservedConferenceVO msReservedConferenceVO);
|
||||
|
||||
/**
|
||||
* 根据案件id和类型查询附件
|
||||
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.mscase.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseLogRecord;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.mscase.CaseLogRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.mscase.ICaseLogRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class CaseLogRecordServiceImpl implements ICaseLogRecordService {
|
||||
@Autowired
|
||||
private CaseLogRecordMapper caseLogRecordMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CaseLogRecord> selectCaseLogRecordList(CaseLogRecord caseLogRecord) {
|
||||
List<CaseLogRecord> records = caseLogRecordMapper.selectCaseLogRecordList(caseLogRecord);
|
||||
if(CollectionUtil.isNotEmpty(records)){
|
||||
records.forEach(record->{
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
String caseNodeTime="";
|
||||
if(record.getCaseNodeTime()!=null){
|
||||
caseNodeTime= DateUtil.format(record.getCaseNodeTime(), DatePattern.NORM_DATETIME_FORMATTER);
|
||||
}
|
||||
|
||||
contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("(").append(record.getCreateBy()).append(")").append("于").append(caseNodeTime);
|
||||
if(StrUtil.isNotEmpty(record.getContent())){
|
||||
contentBuilder.append(record.getContent());
|
||||
}
|
||||
if(StrUtil.isNotEmpty(record.getNotes())){
|
||||
contentBuilder.append(",").append(record.getNotes());
|
||||
}
|
||||
record.setContent(contentBuilder.toString());
|
||||
|
||||
});
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.mscase.impl;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseLogRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseLogRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class MsCaseLogRecordServiceImpl implements MsCaseLogRecordService {
|
||||
@Autowired
|
||||
private MsCaseLogRecordMapper caseLogRecordMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<MsCaseLogRecord> selectCaseLogRecordList(MsCaseLogRecord caseLogRecord) {
|
||||
List<MsCaseLogRecord> records = caseLogRecordMapper.select(caseLogRecord);
|
||||
return records;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user