update 更改模块名称
This commit is contained in:
+281
@@ -0,0 +1,281 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.compare.entity.SarFileCompareDetailVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareInfo;
|
||||
import com.jero.modules.compare.service.ISarFileCompareInfoService;
|
||||
import com.jero.modules.docTranslation.enums.ReleaseConditionEnum;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "文档对比信息表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareInfo")
|
||||
@Slf4j
|
||||
public class SarFileCompareInfoController extends JeroController<SarFileCompareInfo, ISarFileCompareInfoService> {
|
||||
@Autowired
|
||||
private ISarFileCompareInfoService sarFileCompareInfoService;
|
||||
@Autowired
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-分页列表查询")
|
||||
@ApiOperation(value = "文档对比信息表-分页列表查询", notes = "文档对比信息表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut,
|
||||
@RequestParam(name = "serialNumber", defaultValue = "") String serialNumber,
|
||||
@RequestParam(name = "title", defaultValue = "") String title,
|
||||
@RequestParam(name = "releaseState", defaultValue = "") String releaseState,
|
||||
HttpServletRequest req) {
|
||||
LambdaQueryWrapper<SarFileCompareInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
queryWrapper.and(LambdaQueryWrapper -> LambdaQueryWrapper.eq(SarFileCompareInfo::getCreateBy, sysUser.getUsername()).or().eq(SarFileCompareInfo::getReleaseState, ReleaseConditionEnum.PUBLISHED.getValue()));
|
||||
if (MyStringUtils.isNotBlank(serialNumber)) {
|
||||
String finalSerialNumber = serialNumber.replace("%", "\\%");;
|
||||
queryWrapper.and(LambdaQueryWrapper -> LambdaQueryWrapper.like(SarFileCompareInfo::getSerialNumberLeft, finalSerialNumber).or().like(SarFileCompareInfo::getSerialNumberRight, finalSerialNumber));
|
||||
|
||||
}
|
||||
if (MyStringUtils.isNotBlank(title)) {
|
||||
String finalTitle = title.replace("%", "\\%");
|
||||
queryWrapper.and(i -> i.like(SarFileCompareInfo::getTitleLeft, finalTitle).or().like(SarFileCompareInfo::getTitleRight, finalTitle));
|
||||
}
|
||||
if (MyStringUtils.isNotBlank(releaseState)) {
|
||||
queryWrapper.and(LambdaQueryWrapper -> LambdaQueryWrapper.eq(SarFileCompareInfo::getReleaseState, releaseState));
|
||||
}
|
||||
queryWrapper.orderByDesc(SarFileCompareInfo::getCreateTime);
|
||||
Page<SarFileCompareInfo> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SarFileCompareInfo> pageList = sarFileCompareInfoService.page(page, queryWrapper);
|
||||
for (SarFileCompareInfo info : pageList.getRecords()) {
|
||||
info.setReleaseStateTitle(ReleaseConditionEnum.getTextByValue(info.getReleaseState(), cut));
|
||||
info.setFileTypeLeft(getFileTypeText(info.getFileTypeLeft(), cut));
|
||||
info.setFileTypeRight(getFileTypeText(info.getFileTypeRight(), cut));
|
||||
}
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
private String getFileTypeText(String fileType, String cut) {
|
||||
OnlCgformField fileTypeField = this.onlCgformFieldService.queryById(fileType);
|
||||
if (ObjectUtil.isNotEmpty(fileTypeField)) {
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
return fileTypeField.getDbFieldTxt();
|
||||
} else {
|
||||
return fileTypeField.getDbFieldEnName();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-列表查询")
|
||||
@ApiOperation(value = "文档对比信息表-列表查询", notes = "文档对比信息表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareInfo>> queryList() {
|
||||
List<SarFileCompareInfo> list = sarFileCompareInfoService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-添加")
|
||||
@ApiOperation(value = "文档对比信息表-添加", notes = "文档对比信息表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareInfo sarFileCompareInfo) {
|
||||
sarFileCompareInfoService.add(sarFileCompareInfo);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-编辑")
|
||||
@ApiOperation(value = "文档对比信息表-编辑", notes = "文档对比信息表-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareInfo sarFileCompareInfo) {
|
||||
sarFileCompareInfoService.editById(sarFileCompareInfo);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-通过id删除")
|
||||
@ApiOperation(value = "文档对比信息表-通过id删除", notes = "文档对比信息表-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sarFileCompareInfoService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-批量删除")
|
||||
@ApiOperation(value = "文档对比信息表-批量删除", notes = "文档对比信息表-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sarFileCompareInfoService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-通过id查询")
|
||||
@ApiOperation(value = "文档对比信息表-通过id查询", notes = "文档对比信息表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SarFileCompareInfo sarFileCompareInfo = sarFileCompareInfoService.queryById(id);
|
||||
if (sarFileCompareInfo == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sarFileCompareInfo
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SarFileCompareInfo sarFileCompareInfo) {
|
||||
return super.exportXls(request, sarFileCompareInfo, SarFileCompareInfo.class, "文档对比信息表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SarFileCompareInfo.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发起文档对比
|
||||
*
|
||||
* @param json
|
||||
* @return 对比详情ID
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-发起文档对比")
|
||||
@ApiOperation(value = "文档对比信息表-发起文档对比", notes = "文档对比信息表-发起文档对比")
|
||||
@RequestMapping(value = "/fullTextComparison", method = RequestMethod.POST)
|
||||
public Result<?> fullTextComparison(@RequestBody JSONObject json) {
|
||||
try {
|
||||
String leftStandard = json.get("leftStandard").toString();
|
||||
String rightStandard = json.get("rightStandard").toString();
|
||||
String remark = "";
|
||||
if (json.get("remark") != null) {
|
||||
remark = json.get("remark").toString();
|
||||
}
|
||||
String InfoId = sarFileCompareInfoService.fullTextComparison(leftStandard, rightStandard, remark);
|
||||
return Result.OK(InfoId);
|
||||
} catch (Exception ex) {
|
||||
log.error("发起文档对比失败:" + ex.getMessage());
|
||||
return Result.OK("发起文档对比失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改发布状态
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-更改发布状态")
|
||||
@ApiOperation(value = "文档对比信息表-更改发布状态", notes = "文档对比信息表-更改发布状态")
|
||||
@RequestMapping(value = "/changeState", method = RequestMethod.POST)
|
||||
public Result<?> changeState(@Validated @RequestBody SarFileCompareInfo sarFileCompareInfo) {
|
||||
SarFileCompareInfo info = sarFileCompareInfoService.queryById(sarFileCompareInfo.getId());
|
||||
if (ReleaseConditionEnum.DRAFT.getValue().equals(sarFileCompareInfo.getReleaseState())) {
|
||||
info.setReleaseState(ReleaseConditionEnum.PUBLISHED.getValue());
|
||||
} else {
|
||||
info.setReleaseState(ReleaseConditionEnum.DRAFT.getValue());
|
||||
}
|
||||
sarFileCompareInfoService.editById(info);
|
||||
return Result.OK("更改成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 求对比详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-请求对比详情")
|
||||
@ApiOperation(value = "文档对比信息表-请求对比详情", notes = "文档对比信息表-请求对比详情")
|
||||
@RequestMapping(value = "/getComparisonDetail", method = RequestMethod.POST)
|
||||
public Result<?> getComparisonDetail(@RequestBody JSONObject json) {
|
||||
SarFileCompareDetailVO sarFileCompareDetailVO = sarFileCompareInfoService.getComparisonDetail(json.get("id").toString());
|
||||
return Result.OK(sarFileCompareDetailVO);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档对比信息表-编辑全文评论")
|
||||
@ApiOperation(value = "文档对比信息表-编辑全文评论", notes = "文档对比信息表-编辑全文评论")
|
||||
@PostMapping(value = "/editComments")
|
||||
public Result<?> editComments(@Validated @RequestBody SarFileCompareInfo sarFileCompareInfo) {
|
||||
SarFileCompareInfo info = sarFileCompareInfoService.getById(sarFileCompareInfo.getId());
|
||||
info.setComments(sarFileCompareInfo.getComments());
|
||||
sarFileCompareInfoService.editById(info);
|
||||
return Result.OK("编辑评论成功!");
|
||||
}
|
||||
|
||||
}
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItemComment;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResultVO;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemCommentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "文档对比信息条款评论表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareItemComment")
|
||||
@Slf4j
|
||||
public class SarFileCompareItemCommentController extends JeroController<SarFileCompareItemComment, ISarFileCompareItemCommentService> {
|
||||
@Autowired
|
||||
private ISarFileCompareItemCommentService sarFileCompareItemCommentService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-分页列表查询")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-分页列表查询", notes = "文档对比信息条款评论表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SarFileCompareItemComment sarFileCompareItemComment,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SarFileCompareItemComment> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareItemComment, req.getParameterMap());
|
||||
Page<SarFileCompareItemComment> page = new Page<SarFileCompareItemComment>(pageNo, pageSize);
|
||||
IPage<SarFileCompareItemComment> pageList = sarFileCompareItemCommentService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-列表查询")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-列表查询", notes = "文档对比信息条款评论表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareItemComment>> queryList() {
|
||||
List<SarFileCompareItemComment> list = sarFileCompareItemCommentService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-添加")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-添加", notes = "文档对比信息条款评论表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
sarFileCompareItemCommentService.add(sarFileCompareItemComment);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 一致评估
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "一致评估")
|
||||
@ApiOperation(value = "一致评估", notes = "一致评估")
|
||||
@PostMapping(value = "/consensusAssessment")
|
||||
public Result<?> consensusAssessment(@Validated @RequestBody SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
sarFileCompareItemCommentService.consensusAssessment(sarFileCompareItemComment);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-编辑")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-编辑", notes = "文档对比信息条款评论表-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
sarFileCompareItemCommentService.editById(sarFileCompareItemComment);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-通过id删除")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-通过id删除", notes = "文档对比信息条款评论表-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sarFileCompareItemCommentService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-批量删除")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-批量删除", notes = "文档对比信息条款评论表-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sarFileCompareItemCommentService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-通过id查询")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-通过id查询", notes = "文档对比信息条款评论表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SarFileCompareItemComment sarFileCompareItemComment = sarFileCompareItemCommentService.queryById(id);
|
||||
if (sarFileCompareItemComment == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareItemComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询对比结果
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-查询对比结果")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-查询对比结果", notes = "文档对比信息条款评论表-查询对比结果")
|
||||
@GetMapping(value = "/queryCompareResult")
|
||||
public Result<SarFileCompareResultVO> queryCompareResult(@RequestParam(name = "infoId", required = true) String infoId,
|
||||
@RequestParam(name = "comment", required = false) String comment) {
|
||||
SarFileCompareResultVO res = sarFileCompareItemCommentService.queryCompareResult(infoId,comment);
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档对比信息条款评论表-导出结果")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-导出结果", notes = "文档对比信息条款评论表-导出结果")
|
||||
@GetMapping(value = "/exportResXls")
|
||||
public void exportResXls(@RequestParam(name = "infoId", required = true) String infoId,
|
||||
@RequestParam(name = "selectIds", required = true) String selectIds,
|
||||
@RequestParam(name = "includeComments", required = true) boolean includeComments,
|
||||
@RequestParam(name = "cut", required = true) String cut,
|
||||
HttpServletResponse response,HttpServletRequest request,
|
||||
@RequestParam(name = "comment", required = false) String comment) {
|
||||
sarFileCompareItemCommentService.exportResXls(request,response, infoId, selectIds, includeComments, cut,comment);
|
||||
}
|
||||
|
||||
}
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItem;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="文档对比信息条款表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareItem")
|
||||
@Slf4j
|
||||
public class SarFileCompareItemController extends JeroController<SarFileCompareItem, ISarFileCompareItemService> {
|
||||
@Autowired
|
||||
private ISarFileCompareItemService sarFileCompareItemService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-分页列表查询")
|
||||
@ApiOperation(value="文档对比信息条款表-分页列表查询", notes="文档对比信息条款表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SarFileCompareItem sarFileCompareItem,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SarFileCompareItem> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareItem, req.getParameterMap());
|
||||
Page<SarFileCompareItem> page = new Page<SarFileCompareItem>(pageNo, pageSize);
|
||||
IPage<SarFileCompareItem> pageList = sarFileCompareItemService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-列表查询")
|
||||
@ApiOperation(value="文档对比信息条款表-列表查询", notes="文档对比信息条款表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareItem>> queryList() {
|
||||
List<SarFileCompareItem> list = sarFileCompareItemService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-添加")
|
||||
@ApiOperation(value="文档对比信息条款表-添加", notes="文档对比信息条款表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareItem sarFileCompareItem) {
|
||||
sarFileCompareItemService.add(sarFileCompareItem);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-编辑")
|
||||
@ApiOperation(value="文档对比信息条款表-编辑", notes="文档对比信息条款表-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareItem sarFileCompareItem) {
|
||||
sarFileCompareItemService.editById(sarFileCompareItem);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-通过id删除")
|
||||
@ApiOperation(value="文档对比信息条款表-通过id删除", notes="文档对比信息条款表-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sarFileCompareItemService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-批量删除")
|
||||
@ApiOperation(value="文档对比信息条款表-批量删除", notes="文档对比信息条款表-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sarFileCompareItemService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-通过id查询")
|
||||
@ApiOperation(value="文档对比信息条款表-通过id查询", notes="文档对比信息条款表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SarFileCompareItem sarFileCompareItem = sarFileCompareItemService.queryById(id);
|
||||
if(sarFileCompareItem==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sarFileCompareItem
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SarFileCompareItem sarFileCompareItem) {
|
||||
return super.exportXls(request, sarFileCompareItem, SarFileCompareItem.class, "文档对比信息条款表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SarFileCompareItem.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 条款对比高亮
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-条款对比高亮")
|
||||
@ApiOperation(value="文档对比信息条款表-条款对比高亮", notes="文档对比信息条款表-条款对比高亮")
|
||||
@GetMapping(value = "/clauseComparison")
|
||||
public Result<?> clauseComparison(@RequestParam(name="leftId",required=true) String leftId,
|
||||
@RequestParam(name="rightId",required=true) String rightId) {
|
||||
List<String> res = sarFileCompareItemService.clauseComparison(leftId,rightId);
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.compare.entity.SarFileCompareMenu;
|
||||
import com.jero.modules.compare.service.ISarFileCompareMenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="文档对比信息目录表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareMenu")
|
||||
@Slf4j
|
||||
public class SarFileCompareMenuController extends JeroController<SarFileCompareMenu, ISarFileCompareMenuService> {
|
||||
@Autowired
|
||||
private ISarFileCompareMenuService sarFileCompareMenuService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-分页列表查询")
|
||||
@ApiOperation(value="文档对比信息目录表-分页列表查询", notes="文档对比信息目录表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SarFileCompareMenu sarFileCompareMenu,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SarFileCompareMenu> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareMenu, req.getParameterMap());
|
||||
Page<SarFileCompareMenu> page = new Page<SarFileCompareMenu>(pageNo, pageSize);
|
||||
IPage<SarFileCompareMenu> pageList = sarFileCompareMenuService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-列表查询")
|
||||
@ApiOperation(value="文档对比信息目录表-列表查询", notes="文档对比信息目录表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareMenu>> queryList() {
|
||||
List<SarFileCompareMenu> list = sarFileCompareMenuService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-添加")
|
||||
@ApiOperation(value="文档对比信息目录表-添加", notes="文档对比信息目录表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareMenu sarFileCompareMenu) {
|
||||
sarFileCompareMenuService.add(sarFileCompareMenu);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-编辑")
|
||||
@ApiOperation(value="文档对比信息目录表-编辑", notes="文档对比信息目录表-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareMenu sarFileCompareMenu) {
|
||||
sarFileCompareMenuService.editById(sarFileCompareMenu);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-通过id删除")
|
||||
@ApiOperation(value="文档对比信息目录表-通过id删除", notes="文档对比信息目录表-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sarFileCompareMenuService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-批量删除")
|
||||
@ApiOperation(value="文档对比信息目录表-批量删除", notes="文档对比信息目录表-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sarFileCompareMenuService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-通过id查询")
|
||||
@ApiOperation(value="文档对比信息目录表-通过id查询", notes="文档对比信息目录表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SarFileCompareMenu sarFileCompareMenu = sarFileCompareMenuService.queryById(id);
|
||||
if(sarFileCompareMenu==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sarFileCompareMenu
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SarFileCompareMenu sarFileCompareMenu) {
|
||||
return super.exportXls(request, sarFileCompareMenu, SarFileCompareMenu.class, "文档对比信息目录表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SarFileCompareMenu.class);
|
||||
}
|
||||
|
||||
}
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComment;
|
||||
import com.jero.modules.compare.service.ISarFileCompareResCommentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "文档对比信息结果评论表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareResComment")
|
||||
@Slf4j
|
||||
public class SarFileCompareResCommentController extends JeroController<SarFileCompareResComment, ISarFileCompareResCommentService> {
|
||||
@Autowired
|
||||
private ISarFileCompareResCommentService sarFileCompareResCommentService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-分页列表查询")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-分页列表查询", notes = "文档对比信息结果评论表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SarFileCompareResComment sarFileCompareResComment,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SarFileCompareResComment> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareResComment, req.getParameterMap());
|
||||
Page<SarFileCompareResComment> page = new Page<SarFileCompareResComment>(pageNo, pageSize);
|
||||
IPage<SarFileCompareResComment> pageList = sarFileCompareResCommentService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-列表查询")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-列表查询", notes = "文档对比信息结果评论表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareResComment>> queryList() {
|
||||
List<SarFileCompareResComment> list = sarFileCompareResCommentService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-添加")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-添加", notes = "文档对比信息结果评论表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareResComment sarFileCompareResComment) {
|
||||
sarFileCompareResCommentService.add(sarFileCompareResComment);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-编辑")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-编辑", notes = "文档对比信息结果评论表-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareResComment sarFileCompareResComment) {
|
||||
sarFileCompareResCommentService.editById(sarFileCompareResComment);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-通过id删除")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-通过id删除", notes = "文档对比信息结果评论表-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sarFileCompareResCommentService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-批量删除")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-批量删除", notes = "文档对比信息结果评论表-批量删除")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sarFileCompareResCommentService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-通过id查询")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-通过id查询", notes = "文档对比信息结果评论表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SarFileCompareResComment sarFileCompareResComment = sarFileCompareResCommentService.queryById(id);
|
||||
if (sarFileCompareResComment == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareResComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sarFileCompareResComment
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SarFileCompareResComment sarFileCompareResComment) {
|
||||
return super.exportXls(request, sarFileCompareResComment, SarFileCompareResComment.class, "文档对比信息结果评论表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SarFileCompareResComment.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据infoId查询列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-根据infoId查询列表")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-根据infoId查询列表", notes = "文档对比信息结果评论表-根据infoId查询列表")
|
||||
@GetMapping(value = "/queryListByInfoId")
|
||||
public Result<List<SarFileCompareResComVO>> queryListByInfoId(@RequestParam(name = "id", required = true) String id,
|
||||
@RequestParam(name = "str") String str) {
|
||||
List<SarFileCompareResComVO> list = sarFileCompareResCommentService.queryListByInfoId(id, str);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SarFileCompareDetailVO {
|
||||
|
||||
private String InfoId;
|
||||
private String serialNumberLeft;
|
||||
private String fileNameLeft;
|
||||
private String serialNumberRight;
|
||||
private String fileNameRight;
|
||||
private String remark;
|
||||
private String comments;
|
||||
private List<SarFileCompareMenuVo> menuLeft;
|
||||
private List<SarFileCompareItem> textLeft;
|
||||
private List<SarFileCompareMenuVo> menuRight;
|
||||
private List<SarFileCompareItem> textRight;
|
||||
|
||||
public String getInfoId() {
|
||||
return InfoId;
|
||||
}
|
||||
|
||||
public void setInfoId(String infoId) {
|
||||
InfoId = infoId;
|
||||
}
|
||||
|
||||
public String getSerialNumberLeft() {
|
||||
return serialNumberLeft;
|
||||
}
|
||||
|
||||
public void setSerialNumberLeft(String serialNumberLeft) {
|
||||
this.serialNumberLeft = serialNumberLeft;
|
||||
}
|
||||
|
||||
public String getFileNameLeft() {
|
||||
return fileNameLeft;
|
||||
}
|
||||
|
||||
public void setFileNameLeft(String fileNameLeft) {
|
||||
this.fileNameLeft = fileNameLeft;
|
||||
}
|
||||
|
||||
public String getSerialNumberRight() {
|
||||
return serialNumberRight;
|
||||
}
|
||||
|
||||
public void setSerialNumberRight(String serialNumberRight) {
|
||||
this.serialNumberRight = serialNumberRight;
|
||||
}
|
||||
|
||||
public String getFileNameRight() {
|
||||
return fileNameRight;
|
||||
}
|
||||
|
||||
public void setFileNameRight(String fileNameRight) {
|
||||
this.fileNameRight = fileNameRight;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public List<SarFileCompareItem> getTextLeft() {
|
||||
return textLeft;
|
||||
}
|
||||
|
||||
public void setTextLeft(List<SarFileCompareItem> textLeft) {
|
||||
this.textLeft = textLeft;
|
||||
}
|
||||
|
||||
public void addTextLeft(SarFileCompareItem text) {
|
||||
if (this.textLeft == null) {
|
||||
this.textLeft = new ArrayList<>();
|
||||
}
|
||||
this.textLeft.add(text);
|
||||
}
|
||||
|
||||
public List<SarFileCompareItem> getTextRight() {
|
||||
return textRight;
|
||||
}
|
||||
|
||||
public void setTextRight(List<SarFileCompareItem> textRight) {
|
||||
this.textRight = textRight;
|
||||
}
|
||||
|
||||
public void addTextRight(SarFileCompareItem text) {
|
||||
if (this.textRight == null) {
|
||||
this.textRight = new ArrayList<>();
|
||||
}
|
||||
this.textRight.add(text);
|
||||
}
|
||||
|
||||
public List<SarFileCompareMenuVo> getMenuLeft() {
|
||||
return menuLeft;
|
||||
}
|
||||
|
||||
public void setMenuLeft(List<SarFileCompareMenuVo> menuLeft) {
|
||||
this.menuLeft = menuLeft;
|
||||
}
|
||||
|
||||
public void addMenuLeft(SarFileCompareMenuVo menu) {
|
||||
if (this.menuLeft == null) {
|
||||
this.menuLeft = new ArrayList<>();
|
||||
}
|
||||
this.menuLeft.add(menu);
|
||||
}
|
||||
|
||||
public List<SarFileCompareMenuVo> getMenuRight() {
|
||||
return menuRight;
|
||||
}
|
||||
|
||||
public void setMenuRight(List<SarFileCompareMenuVo> menuRight) {
|
||||
this.menuRight = menuRight;
|
||||
}
|
||||
|
||||
public void addMenuRight(SarFileCompareMenuVo menu) {
|
||||
if (this.menuRight == null) {
|
||||
this.menuRight = new ArrayList<>();
|
||||
}
|
||||
this.menuRight.add(menu);
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
public class SarFileCompareExcelMergeCell {
|
||||
|
||||
Integer leftStart;
|
||||
Integer leftEnd;
|
||||
Integer rightStart;
|
||||
Integer rightEnd;
|
||||
|
||||
public Integer getLeftStart() {
|
||||
return leftStart;
|
||||
}
|
||||
|
||||
public void setLeftStart(Integer leftStart) {
|
||||
this.leftStart = leftStart;
|
||||
}
|
||||
|
||||
public Integer getLeftEnd() {
|
||||
return leftEnd;
|
||||
}
|
||||
|
||||
public void setLeftEnd(Integer leftEnd) {
|
||||
this.leftEnd = leftEnd;
|
||||
}
|
||||
|
||||
public Integer getRightStart() {
|
||||
return rightStart;
|
||||
}
|
||||
|
||||
public void setRightStart(Integer rightStart) {
|
||||
this.rightStart = rightStart;
|
||||
}
|
||||
|
||||
public Integer getRightEnd() {
|
||||
return rightEnd;
|
||||
}
|
||||
|
||||
public void setRightEnd(Integer rightEnd) {
|
||||
this.rightEnd = rightEnd;
|
||||
}
|
||||
|
||||
public SarFileCompareExcelMergeCell() {
|
||||
}
|
||||
|
||||
public SarFileCompareExcelMergeCell(Integer leftStart, Integer leftEnd, Integer rightStart, Integer rightEnd) {
|
||||
this.leftStart = leftStart;
|
||||
this.leftEnd = leftEnd;
|
||||
this.rightStart = rightStart;
|
||||
this.rightEnd = rightEnd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_info")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_info对象", description="文档对比信息表")
|
||||
public class SarFileCompareInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档1*/
|
||||
@Excel(name = "文档1", width = 15)
|
||||
@ApiModelProperty(value = "文档1")
|
||||
private String fileIdLeft;
|
||||
|
||||
/**文档key1*/
|
||||
@Excel(name = "文档key1", width = 15)
|
||||
@ApiModelProperty(value = "文档key1")
|
||||
private String fileKeyLeft;
|
||||
|
||||
/**编号1*/
|
||||
@Excel(name = "编号1", width = 15)
|
||||
@ApiModelProperty(value = "编号1")
|
||||
private String serialNumberLeft;
|
||||
|
||||
/**标题1*/
|
||||
@Excel(name = "标题1", width = 15)
|
||||
@ApiModelProperty(value = "标题1")
|
||||
private String titleLeft;
|
||||
|
||||
/**文本状态1*/
|
||||
@Excel(name = "文本状态1", width = 15)
|
||||
@ApiModelProperty(value = "文本状态1")
|
||||
private String fileTypeLeft;
|
||||
|
||||
/**文件名称1*/
|
||||
@Excel(name = "文件名称1", width = 15)
|
||||
@ApiModelProperty(value = "文件名称1")
|
||||
private String fileNameLeft;
|
||||
|
||||
/**文档2*/
|
||||
@Excel(name = "文档2", width = 15)
|
||||
@ApiModelProperty(value = "文档2")
|
||||
private String fileIdRight;
|
||||
|
||||
/**文档key2*/
|
||||
@Excel(name = "文档key2", width = 15)
|
||||
@ApiModelProperty(value = "文档key2")
|
||||
private String fileKeyRight;
|
||||
|
||||
/**编号2*/
|
||||
@Excel(name = "编号2", width = 15)
|
||||
@ApiModelProperty(value = "编号2")
|
||||
private String serialNumberRight;
|
||||
|
||||
/**标题2*/
|
||||
@Excel(name = "标题2", width = 15)
|
||||
@ApiModelProperty(value = "标题2")
|
||||
private String titleRight;
|
||||
|
||||
/**文本状态2*/
|
||||
@Excel(name = "文本状态2", width = 15)
|
||||
@ApiModelProperty(value = "文本状态2")
|
||||
private String fileTypeRight;
|
||||
|
||||
/**文件名称2*/
|
||||
@Excel(name = "文件名称2", width = 15)
|
||||
@ApiModelProperty(value = "文件名称2")
|
||||
private String fileNameRight;
|
||||
|
||||
/**发布状态*/
|
||||
@Excel(name = "发布状态", width = 15)
|
||||
@ApiModelProperty(value = "发布状态")
|
||||
private String releaseState;
|
||||
|
||||
/**发布状态-翻译后*/
|
||||
@TableField(exist = false)
|
||||
private String releaseStateTitle;
|
||||
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**评论*/
|
||||
@Excel(name = "评论", width = 15)
|
||||
@ApiModelProperty(value = "评论")
|
||||
private String comments;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-06
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_item")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_item对象", description="文档对比信息条款表")
|
||||
public class SarFileCompareItem implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档对比信息id*/
|
||||
@Excel(name = "文档对比信息id", width = 15)
|
||||
@ApiModelProperty(value = "文档对比信息id")
|
||||
private String infoId;
|
||||
|
||||
/**目录id*/
|
||||
@Excel(name = "目录id", width = 15)
|
||||
@ApiModelProperty(value = "目录id")
|
||||
private String menuId;
|
||||
|
||||
/**条款名称*/
|
||||
@Excel(name = "条款名称", width = 15)
|
||||
@ApiModelProperty(value = "条款名称")
|
||||
private String itemsName;
|
||||
|
||||
/**条款编号*/
|
||||
@Excel(name = "条款编号", width = 15)
|
||||
@ApiModelProperty(value = "条款编号")
|
||||
private String itemsNum;
|
||||
|
||||
/**条款正文*/
|
||||
@Excel(name = "条款正文", width = 15)
|
||||
@ApiModelProperty(value = "条款正文")
|
||||
private String itemsText;
|
||||
|
||||
/**条款展示编号*/
|
||||
@Excel(name = "条款展示编号", width = 15)
|
||||
@ApiModelProperty(value = "条款展示编号")
|
||||
private Integer itemsDisplayNum;
|
||||
|
||||
/**对应相似条目*/
|
||||
@Excel(name = "对应相似条目", width = 15)
|
||||
@ApiModelProperty(value = "对应相似条目")
|
||||
private Integer targetStand;
|
||||
|
||||
/**条款位置*/
|
||||
@Excel(name = "条款位置", width = 15)
|
||||
@ApiModelProperty(value = "条款位置")
|
||||
private String leftOrRight;
|
||||
|
||||
/**是否被评论(0或1)*/
|
||||
@Excel(name = "是否被评论(0或1)", width = 15)
|
||||
@ApiModelProperty(value = "是否被评论(0或1)")
|
||||
private Integer reviewed;
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
/**
|
||||
* 对比条目评论信息展示
|
||||
*/
|
||||
public class SarFileCompareItemComVO {
|
||||
private String id;
|
||||
private String itemsNameLeft;
|
||||
private String itemsNumLeft;
|
||||
private String itemsTextLeft;
|
||||
private String itemsNameRight;
|
||||
private String itemsNumRight;
|
||||
private String itemsTextRight;
|
||||
private String comment;
|
||||
|
||||
public SarFileCompareItemComVO() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getItemsNameLeft() {
|
||||
return itemsNameLeft;
|
||||
}
|
||||
|
||||
public void setItemsNameLeft(String itemsNameLeft) {
|
||||
this.itemsNameLeft = itemsNameLeft;
|
||||
}
|
||||
|
||||
public String getItemsNumLeft() {
|
||||
return itemsNumLeft;
|
||||
}
|
||||
|
||||
public void setItemsNumLeft(String itemsNumLeft) {
|
||||
this.itemsNumLeft = itemsNumLeft;
|
||||
}
|
||||
|
||||
public String getItemsTextLeft() {
|
||||
return itemsTextLeft;
|
||||
}
|
||||
|
||||
public void setItemsTextLeft(String itemsTextLeft) {
|
||||
this.itemsTextLeft = itemsTextLeft;
|
||||
}
|
||||
|
||||
public String getItemsNameRight() {
|
||||
return itemsNameRight;
|
||||
}
|
||||
|
||||
public void setItemsNameRight(String itemsNameRight) {
|
||||
this.itemsNameRight = itemsNameRight;
|
||||
}
|
||||
|
||||
public String getItemsNumRight() {
|
||||
return itemsNumRight;
|
||||
}
|
||||
|
||||
public void setItemsNumRight(String itemsNumRight) {
|
||||
this.itemsNumRight = itemsNumRight;
|
||||
}
|
||||
|
||||
public String getItemsTextRight() {
|
||||
return itemsTextRight;
|
||||
}
|
||||
|
||||
public void setItemsTextRight(String itemsTextRight) {
|
||||
this.itemsTextRight = itemsTextRight;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_item_comment")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_item_comment对象", description="文档对比信息条款评论表")
|
||||
public class SarFileCompareItemComment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档对比信息id*/
|
||||
@Excel(name = "文档对比信息id", width = 15)
|
||||
@ApiModelProperty(value = "文档对比信息id")
|
||||
private String infoId;
|
||||
|
||||
/**条款id左*/
|
||||
@Excel(name = "条款id左", width = 15)
|
||||
@ApiModelProperty(value = "条款id左")
|
||||
private String itemsIdLeft;
|
||||
|
||||
/**条款id右*/
|
||||
@Excel(name = "条款id右", width = 15)
|
||||
@ApiModelProperty(value = "条款id右")
|
||||
private String itemsIdRight;
|
||||
|
||||
/**评论*/
|
||||
@Excel(name = "评论", width = 15)
|
||||
@ApiModelProperty(value = "评论")
|
||||
private String comment;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_menu")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_menu对象", description="文档对比信息目录表")
|
||||
public class SarFileCompareMenu implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**目录ID*/
|
||||
@Excel(name = "目录ID", width = 15)
|
||||
@ApiModelProperty(value = "目录ID")
|
||||
private String menuId;
|
||||
|
||||
/**信息ID*/
|
||||
@Excel(name = "信息ID", width = 15)
|
||||
@ApiModelProperty(value = "信息ID")
|
||||
private String infoId;
|
||||
|
||||
/**目录名称*/
|
||||
@Excel(name = "目录名称", width = 15)
|
||||
@ApiModelProperty(value = "目录名称")
|
||||
private String name;
|
||||
|
||||
/**父级目录ID*/
|
||||
@Excel(name = "父级目录ID", width = 15)
|
||||
@ApiModelProperty(value = "父级目录ID")
|
||||
private String parentId;
|
||||
|
||||
/**排序序号*/
|
||||
@Excel(name = "排序序号", width = 15)
|
||||
@ApiModelProperty(value = "排序序号")
|
||||
private Integer displaySeq;
|
||||
|
||||
/**目录位置*/
|
||||
@Excel(name = "目录位置", width = 15)
|
||||
@ApiModelProperty(value = "目录位置")
|
||||
private String leftOrRight;
|
||||
|
||||
/**条款名称*/
|
||||
@Excel(name = "条款名称", width = 15)
|
||||
@ApiModelProperty(value = "条款名称")
|
||||
private String itemName;
|
||||
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
|
||||
public SarFileCompareMenu(String id, String createBy, Date createTime, String updateBy, Date updateTime, String sysOrgCode, String menuId, String infoId, String name, String parentId, Integer displaySeq, String leftOrRight, String itemName, String remarks) {
|
||||
this.id = id;
|
||||
this.createBy = createBy;
|
||||
this.createTime = createTime;
|
||||
this.updateBy = updateBy;
|
||||
this.updateTime = updateTime;
|
||||
this.sysOrgCode = sysOrgCode;
|
||||
this.menuId = menuId;
|
||||
this.infoId = infoId;
|
||||
this.name = name;
|
||||
this.parentId = parentId;
|
||||
this.displaySeq = displaySeq;
|
||||
this.leftOrRight = leftOrRight;
|
||||
this.itemName = itemName;
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public SarFileCompareMenu() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SarFileCompareMenuVo extends SarFileCompareMenu {
|
||||
private String key;
|
||||
private String title;
|
||||
|
||||
private List<SarFileCompareMenuVo> children;
|
||||
|
||||
public SarFileCompareMenuVo(SarFileCompareMenu menu) {
|
||||
super();
|
||||
this.setId(menu.getId());
|
||||
this.setCreateBy(menu.getCreateBy());
|
||||
this.setCreateTime(menu.getCreateTime());
|
||||
this.setUpdateBy(menu.getUpdateBy());
|
||||
this.setUpdateTime(menu.getUpdateTime());
|
||||
this.setSysOrgCode(menu.getSysOrgCode());
|
||||
this.setMenuId(menu.getMenuId());
|
||||
this.setInfoId(menu.getInfoId());
|
||||
this.setName(menu.getName());
|
||||
this.setParentId(menu.getParentId());
|
||||
this.setDisplaySeq(menu.getDisplaySeq());
|
||||
this.setLeftOrRight(menu.getLeftOrRight());
|
||||
this.setItemName(menu.getItemName());
|
||||
this.setKey(menu.getId());
|
||||
this.setTitle(menu.getName());
|
||||
if(MyStringUtils.isNoneBlank(menu.getItemName())){
|
||||
this.setTitle(menu.getName() + menu.getItemName());
|
||||
}
|
||||
this.setRemarks(menu.getRemarks());
|
||||
}
|
||||
|
||||
public List<SarFileCompareMenuVo> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SarFileCompareMenuVo> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public void addChild(SarFileCompareMenuVo child) {
|
||||
if (null == this.children) {
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
children.add(child);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SarFileCompareResComVO {
|
||||
private String id;
|
||||
private String name;
|
||||
private String createTime;
|
||||
private String content;
|
||||
private List<SarFileCompareResComVO> resComVoList;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public List<SarFileCompareResComVO> getResComVoList() {
|
||||
return resComVoList;
|
||||
}
|
||||
|
||||
public void setResComVoList(List<SarFileCompareResComVO> resComVoList) {
|
||||
this.resComVoList = resComVoList;
|
||||
}
|
||||
|
||||
public void addResComVo(SarFileCompareResComVO resComVo) {
|
||||
if (null == this.resComVoList) {
|
||||
this.resComVoList = new ArrayList<>();
|
||||
}
|
||||
this.resComVoList.add(resComVo);
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_res_comment")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_res_comment对象", description="文档对比信息结果评论表")
|
||||
public class SarFileCompareResComment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档对比信息id*/
|
||||
@Excel(name = "文档对比信息id", width = 15)
|
||||
@ApiModelProperty(value = "文档对比信息id")
|
||||
private String infoId;
|
||||
|
||||
/**回复评论ID*/
|
||||
@Excel(name = "回复评论ID", width = 15)
|
||||
@ApiModelProperty(value = "回复评论ID")
|
||||
private String parentId;
|
||||
|
||||
/**评论*/
|
||||
@Excel(name = "评论", width = 15)
|
||||
@ApiModelProperty(value = "评论")
|
||||
private String comment;
|
||||
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SarFileCompareResultVO {
|
||||
|
||||
private String infoId;
|
||||
private String serialNumberLeft;
|
||||
private String fileNameLeft;
|
||||
private String fileIdLeft;
|
||||
private String serialNumberRight;
|
||||
private String fileNameRight;
|
||||
private String fileIdRight;
|
||||
private List<SarFileCompareItemComVO> resList;
|
||||
private String comments;
|
||||
|
||||
public SarFileCompareResultVO() {
|
||||
}
|
||||
|
||||
public String getInfoId() {
|
||||
return infoId;
|
||||
}
|
||||
|
||||
public void setInfoId(String infoId) {
|
||||
this.infoId = infoId;
|
||||
}
|
||||
|
||||
public String getSerialNumberLeft() {
|
||||
return serialNumberLeft;
|
||||
}
|
||||
|
||||
public void setSerialNumberLeft(String serialNumberLeft) {
|
||||
this.serialNumberLeft = serialNumberLeft;
|
||||
}
|
||||
|
||||
public String getFileNameLeft() {
|
||||
return fileNameLeft;
|
||||
}
|
||||
|
||||
public void setFileNameLeft(String fileNameLeft) {
|
||||
this.fileNameLeft = fileNameLeft;
|
||||
}
|
||||
|
||||
public String getSerialNumberRight() {
|
||||
return serialNumberRight;
|
||||
}
|
||||
|
||||
public void setSerialNumberRight(String serialNumberRight) {
|
||||
this.serialNumberRight = serialNumberRight;
|
||||
}
|
||||
|
||||
public String getFileNameRight() {
|
||||
return fileNameRight;
|
||||
}
|
||||
|
||||
public void setFileNameRight(String fileNameRight) {
|
||||
this.fileNameRight = fileNameRight;
|
||||
}
|
||||
|
||||
public List<SarFileCompareItemComVO> getResList() {
|
||||
return resList;
|
||||
}
|
||||
|
||||
public void setResList(List<SarFileCompareItemComVO> resList) {
|
||||
this.resList = resList;
|
||||
}
|
||||
|
||||
public void addRes(SarFileCompareItemComVO item) {
|
||||
if (this.resList == null) {
|
||||
this.resList = new ArrayList<>();
|
||||
}
|
||||
this.resList.add(item);
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public String getFileIdLeft() {
|
||||
return fileIdLeft;
|
||||
}
|
||||
|
||||
public void setFileIdLeft(String fileIdLeft) {
|
||||
this.fileIdLeft = fileIdLeft;
|
||||
}
|
||||
|
||||
public String getFileIdRight() {
|
||||
return fileIdRight;
|
||||
}
|
||||
|
||||
public void setFileIdRight(String fileIdRight) {
|
||||
this.fileIdRight = fileIdRight;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.jero.modules.compare.enums;
|
||||
|
||||
public enum AssessConsistencyEnum {
|
||||
|
||||
SAME("一致"),
|
||||
DIFFERENT("差异");
|
||||
|
||||
private String value;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
AssessConsistencyEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareInfo;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareInfoMapper extends BaseMapper<SarFileCompareInfo> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItemComment;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareItemCommentMapper extends BaseMapper<SarFileCompareItemComment> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItem;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareItemMapper extends BaseMapper<SarFileCompareItem> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareMenu;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareMenuMapper extends BaseMapper<SarFileCompareMenu> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComment;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareResCommentMapper extends BaseMapper<SarFileCompareResComment> {
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?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.jero.modules.compare.mapper.SarFileCompareInfoMapper">
|
||||
<resultMap id="SarFileCompareInfoResultMap" type="com.jero.modules.compare.entity.SarFileCompareInfo">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="file_id_left" property="fileIdLeft" />
|
||||
<result column="file_key_left" property="fileKeyLeft" />
|
||||
<result column="serial_number_left" property="serialNumberLeft" />
|
||||
<result column="title_left" property="titleLeft" />
|
||||
<result column="file_type_left" property="fileTypeLeft" />
|
||||
<result column="file_name_left" property="fileNameLeft" />
|
||||
<result column="file_id_right" property="fileIdRight" />
|
||||
<result column="file_key_right" property="fileKeyRight" />
|
||||
<result column="serial_number_right" property="serialNumberRight" />
|
||||
<result column="title_right" property="titleRight" />
|
||||
<result column="file_type_right" property="fileTypeRight" />
|
||||
<result column="file_name_right" property="fileNameRight" />
|
||||
<result column="release_state" property="releaseState" />
|
||||
<result column="remark" property="remark" />
|
||||
<result column="comments" property="comments" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?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.jero.modules.compare.mapper.SarFileCompareItemCommentMapper">
|
||||
<resultMap id="SarFileCompareItemCommentResultMap" type="com.jero.modules.compare.entity.SarFileCompareItemComment">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="info_id" property="infoId" />
|
||||
<result column="items_id_left" property="itemsIdLeft" />
|
||||
<result column="items_id_right" property="itemsIdRight" />
|
||||
<result column="comment" property="comment" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?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.jero.modules.compare.mapper.SarFileCompareItemMapper">
|
||||
<resultMap id="SarFileCompareItemResultMap" type="com.jero.modules.compare.entity.SarFileCompareItem">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="info_id" property="infoId" />
|
||||
<result column="menu_id" property="menuId" />
|
||||
<result column="items_name" property="itemsName" />
|
||||
<result column="items_num" property="itemsNum" />
|
||||
<result column="items_text" property="itemsText" />
|
||||
<result column="items_display_num" property="itemsDisplayNum" />
|
||||
<result column="target_stand" property="targetStand" />
|
||||
<result column="left_or_right" property="leftOrRight" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?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.jero.modules.compare.mapper.SarFileCompareMenuMapper">
|
||||
<resultMap id="SarFileCompareMenuResultMap" type="com.jero.modules.compare.entity.SarFileCompareMenu">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="menu_id" property="menuId" />
|
||||
<result column="info_id" property="infoId" />
|
||||
<result column="name" property="name" />
|
||||
<result column="parent_id" property="parentId" />
|
||||
<result column="display_seq" property="displaySeq" />
|
||||
<result column="left_or_right" property="leftOrRight" />
|
||||
<result column="item_name" property="itemName" />
|
||||
<result column="remarks" property="remarks" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?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.jero.modules.compare.mapper.SarFileCompareResCommentMapper">
|
||||
<resultMap id="SarFileCompareResCommentResultMap" type="com.jero.modules.compare.entity.SarFileCompareResComment">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="info_id" property="infoId" />
|
||||
<result column="parent_id" property="parentId" />
|
||||
<result column="comment" property="comment" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareDetailVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareInfoService extends IService<SarFileCompareInfo> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareInfo sarFileCompareInfo);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareInfo sarFileCompareInfo);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareInfo queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareInfo> queryList();
|
||||
|
||||
/**
|
||||
* 发起全文对比
|
||||
*
|
||||
* @param leftStandard
|
||||
* @param rightStandard
|
||||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
String fullTextComparison(String leftStandard, String rightStandard, String remark) throws Exception;
|
||||
|
||||
/**
|
||||
* 求对比详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareDetailVO getComparisonDetail(String id);
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItemComment;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResultVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareItemCommentService extends IService<SarFileCompareItemComment> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareItemComment sarFileCompareItemComment);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareItemComment sarFileCompareItemComment);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareItemComment queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareItemComment> queryList();
|
||||
|
||||
SarFileCompareResultVO queryCompareResult(String infoId,String comment);
|
||||
|
||||
void exportResXls(HttpServletRequest request,HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut,String comment);
|
||||
|
||||
void consensusAssessment(SarFileCompareItemComment sarFileCompareItemComment);
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItem;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareItemService extends IService<SarFileCompareItem> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareItem sarFileCompareItem);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareItem sarFileCompareItem);
|
||||
|
||||
/**
|
||||
* 标记被评论过
|
||||
* @param id
|
||||
*/
|
||||
void updateReviewedById(String id);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareItem queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareItem> queryList();
|
||||
|
||||
List<SarFileCompareItem> queryListByInfoId(String infoId);
|
||||
|
||||
Map<String, SarFileCompareItem> queryMapByInfoId(String infoId);
|
||||
|
||||
List<String> clauseComparison(String lid,String rid);
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareMenuService extends IService<SarFileCompareMenu> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareMenu sarFileCompareMenu);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareMenu sarFileCompareMenu);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareMenu queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareMenu> queryList();
|
||||
|
||||
|
||||
List<SarFileCompareMenu> queryListByInfoId(String infoId);
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareResCommentService extends IService<SarFileCompareResComment> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareResComment sarFileCompareResComment);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareResComment sarFileCompareResComment);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareResComment queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareResComment> queryList();
|
||||
|
||||
List<SarFileCompareResComVO> queryListByInfoId(String id, String str);
|
||||
|
||||
}
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.compare.entity.*;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareInfoMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareInfoService;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
||||
import com.jero.modules.compare.service.ISarFileCompareMenuService;
|
||||
import com.jero.modules.compare.utils.CompHanLPUtils;
|
||||
import com.jero.modules.compare.utils.CompareConst;
|
||||
import com.jero.modules.docTranslation.enums.ReleaseConditionEnum;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitMenuEO;
|
||||
import com.jero.modules.split.service.IFileSplitItemsEOService;
|
||||
import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||
import com.jero.modules.split.service.ISarFileSplitMenuEOService;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SarFileCompareInfoServiceImpl extends ServiceImpl<SarFileCompareInfoMapper, SarFileCompareInfo> implements ISarFileCompareInfoService {
|
||||
|
||||
@Autowired
|
||||
private ISarFileSplitMenuEOService sarFileSplitMenuEOService;
|
||||
|
||||
@Autowired
|
||||
private IFileSplitItemsEOService sarFileSplitItemsEOService;
|
||||
|
||||
@Autowired
|
||||
private ISarFileSplitInfoService sarFileSplitInfoEOService;
|
||||
|
||||
@Autowired
|
||||
private ISarFileCompareItemService sarFileCompareItemService;
|
||||
|
||||
@Autowired
|
||||
private ISarFileCompareMenuService sarFileCompareMenuService;
|
||||
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareInfo sarFileCompareInfo) {
|
||||
Date now = new Date();
|
||||
sarFileCompareInfo.setCreateTime(now);
|
||||
sarFileCompareInfo.setUpdateTime(now);
|
||||
save(sarFileCompareInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareInfo sarFileCompareInfo) {
|
||||
Date now = new Date();
|
||||
sarFileCompareInfo.setUpdateTime(now);
|
||||
saveOrUpdate(sarFileCompareInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareInfo queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareInfo> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 全文对比
|
||||
*
|
||||
* @param leftStandard
|
||||
* @param rightStandard
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String fullTextComparison(String leftStandard, String rightStandard, String remark) throws Exception {
|
||||
SarFileCompareInfo sfcInfo = addStandCompareHis(leftStandard, rightStandard, remark);
|
||||
//文档对比信息目录
|
||||
List<SarFileSplitMenuEO> leftMenuEOList = sarFileSplitMenuEOService.queryByInfoId(leftStandard);
|
||||
Map<String, SarFileCompareMenu> leftMenuMap = wrapperMenuMap(leftMenuEOList, sfcInfo.getId(), CompareConst.POS_LEFT);
|
||||
sarFileCompareMenuService.saveBatch(leftMenuMap.values());
|
||||
List<SarFileSplitMenuEO> rightMenuEOList = sarFileSplitMenuEOService.queryByInfoId(rightStandard);
|
||||
Map<String, SarFileCompareMenu> rightMenuMap = wrapperMenuMap(rightMenuEOList, sfcInfo.getId(), CompareConst.POS_RIGHT);
|
||||
sarFileCompareMenuService.saveBatch(rightMenuMap.values());
|
||||
//文档对比信息条款
|
||||
List<SarFileSplitItemsEO> leftItemEOList = sarFileSplitItemsEOService.selectByInfoId(leftStandard);
|
||||
List<SarFileCompareItem> leftItemList = wrapperItemList(leftItemEOList, sfcInfo.getId(), leftMenuMap, CompareConst.POS_LEFT);
|
||||
List<SarFileSplitItemsEO> rightItemEOList = sarFileSplitItemsEOService.selectByInfoId(rightStandard);
|
||||
List<SarFileCompareItem> rightItemList = wrapperItemList(rightItemEOList, sfcInfo.getId(), rightMenuMap, CompareConst.POS_RIGHT);
|
||||
|
||||
if (!leftItemList.isEmpty() && !rightItemList.isEmpty()) {
|
||||
//双重循环找到相似度最高的条款做关联
|
||||
for (int i = 0; i < leftItemList.size(); i++) {
|
||||
String leftTxt = leftItemList.get(i).getItemsText();
|
||||
//初始化 假设未找到相似条目
|
||||
leftItemList.get(i).setTargetStand(-1);
|
||||
//定义初始化的相似度
|
||||
double compareSimilarity = 0.0;
|
||||
if (null != leftTxt && !leftTxt.isEmpty()) {
|
||||
for (int j = 0; j < rightItemList.size(); j++) {
|
||||
if(null == rightItemList.get(j).getTargetStand()){
|
||||
rightItemList.get(j).setTargetStand(-1);
|
||||
}
|
||||
String rightTxt = rightItemList.get(j).getItemsText();
|
||||
if (null != rightTxt && !rightTxt.isEmpty()) {
|
||||
double similarity = CompHanLPUtils.findSimilarity(leftTxt.trim(), rightTxt.trim());
|
||||
//如果相似度超过0.6 并且该相似度比之前的相似度还高,那么该条款目前相似度最高
|
||||
if (similarity >= 0.6 && compareSimilarity < similarity) {
|
||||
compareSimilarity = similarity;
|
||||
leftItemList.get(i).setTargetStand(j);
|
||||
}
|
||||
}
|
||||
if (j >= rightItemList.size() - 1) {
|
||||
int ts = leftItemList.get(i).getTargetStand();
|
||||
if (ts > -1) {
|
||||
rightItemList.get(ts).setTargetStand(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sarFileCompareItemService.saveBatch(leftItemList);
|
||||
sarFileCompareItemService.saveBatch(rightItemList);
|
||||
return sfcInfo.getId();
|
||||
}
|
||||
|
||||
|
||||
private Map<String, SarFileCompareMenu> wrapperMenuMap(List<SarFileSplitMenuEO> list, String infoId, String leftOrRight) {
|
||||
Map<String, SarFileCompareMenu> resMap = new HashMap<>();
|
||||
for (SarFileSplitMenuEO meo : list) {
|
||||
SarFileCompareMenu sfcMenu = new SarFileCompareMenu();
|
||||
sfcMenu.setInfoId(infoId);
|
||||
sfcMenu.setMenuId(meo.getId());
|
||||
sfcMenu.setName(meo.getName());
|
||||
sfcMenu.setItemName(meo.getItemName());
|
||||
sfcMenu.setParentId(meo.getPId());
|
||||
sfcMenu.setDisplaySeq(meo.getDisplaySeq().intValue());
|
||||
sfcMenu.setRemarks(meo.getRemarks());
|
||||
sfcMenu.setLeftOrRight(leftOrRight);
|
||||
resMap.put(sfcMenu.getMenuId(), sfcMenu);
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
|
||||
private List<SarFileCompareItem> wrapperItemList(List<SarFileSplitItemsEO> list, String infoId, Map<String, SarFileCompareMenu> menuMap, String leftOrRight) {
|
||||
List<SarFileCompareItem> resList = new ArrayList<>();
|
||||
for (SarFileSplitItemsEO itemsEO : list) {
|
||||
SarFileCompareItem item = new SarFileCompareItem();
|
||||
item.setInfoId(infoId);
|
||||
item.setItemsName(itemsEO.getItemsName());
|
||||
item.setMenuId(itemsEO.getMenuId());
|
||||
item.setItemsNum(itemsEO.getItemsNum());
|
||||
item.setItemsText(itemsEO.getItermsConditions());
|
||||
SarFileCompareMenu menu = menuMap.get(itemsEO.getMenuId());
|
||||
if (menu != null) {
|
||||
item.setItemsDisplayNum(menu.getDisplaySeq());
|
||||
}
|
||||
item.setLeftOrRight(leftOrRight);
|
||||
item.setReviewed(CompareConst.NO_REVIEWED);
|
||||
resList.add(item);
|
||||
}
|
||||
Collections.sort(resList, Comparator.comparingInt(SarFileCompareItem::getItemsDisplayNum));
|
||||
return resList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存比对历史
|
||||
*
|
||||
* @param leftStandId
|
||||
* @param rightStandId
|
||||
* @param remark
|
||||
* @throws Exception
|
||||
*/
|
||||
public SarFileCompareInfo addStandCompareHis(String leftStandId, String rightStandId, String remark) throws Exception {
|
||||
SarFileSplitInfoEO leftInfo = sarFileSplitInfoEOService.queryById(leftStandId);
|
||||
SarFileSplitInfoEO rightInfo = sarFileSplitInfoEOService.queryById(rightStandId);
|
||||
//保存标准比对历史表数据
|
||||
SarFileCompareInfo sarFileCompareInfo = new SarFileCompareInfo();
|
||||
String id = UUID.randomUUID().toString();
|
||||
sarFileCompareInfo.setId(id);
|
||||
sarFileCompareInfo.setFileIdLeft(leftInfo.getFileId());
|
||||
// 处理文档库id字段 根据编号和标题查询
|
||||
List<Map<String, Object>> bussDocumentLibraryEOList = bussDocumentLibraryEOService.getListBySerialNumber(leftInfo.getSerialNumber());
|
||||
if (CollectionUtil.isNotEmpty(bussDocumentLibraryEOList)) {
|
||||
sarFileCompareInfo.setFileKeyLeft(bussDocumentLibraryEOList.get(0).get("id").toString());
|
||||
}
|
||||
sarFileCompareInfo.setFileNameLeft(leftInfo.getFileName());
|
||||
sarFileCompareInfo.setTitleLeft(leftInfo.getTitle());
|
||||
sarFileCompareInfo.setFileTypeLeft(leftInfo.getFileType());
|
||||
sarFileCompareInfo.setSerialNumberLeft(leftInfo.getSerialNumber());
|
||||
|
||||
sarFileCompareInfo.setFileIdRight(rightInfo.getFileId());
|
||||
// 处理文档库id字段 根据编号和标题查询
|
||||
List<Map<String, Object>> bussDocumentLibraryEOList1 = bussDocumentLibraryEOService.getListBySerialNumber(rightInfo.getSerialNumber());
|
||||
if (CollectionUtil.isNotEmpty(bussDocumentLibraryEOList1)) {
|
||||
sarFileCompareInfo.setFileKeyRight(bussDocumentLibraryEOList1.get(0).get("id").toString());
|
||||
}
|
||||
sarFileCompareInfo.setFileKeyRight(rightInfo.getConnectId());
|
||||
sarFileCompareInfo.setFileNameRight(rightInfo.getFileName());
|
||||
sarFileCompareInfo.setFileTypeRight(rightInfo.getFileType());
|
||||
sarFileCompareInfo.setTitleRight(rightInfo.getTitle());
|
||||
sarFileCompareInfo.setSerialNumberRight(rightInfo.getSerialNumber());
|
||||
|
||||
sarFileCompareInfo.setReleaseState(ReleaseConditionEnum.DRAFT.getValue());
|
||||
sarFileCompareInfo.setRemark(remark);
|
||||
this.add(sarFileCompareInfo);
|
||||
return sarFileCompareInfo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SarFileCompareDetailVO getComparisonDetail(String id) {
|
||||
SarFileCompareDetailVO sfVo = new SarFileCompareDetailVO();
|
||||
SarFileCompareInfo sfcInfo = this.queryById(id);
|
||||
sfVo.setInfoId(id);
|
||||
sfVo.setFileNameLeft(sfcInfo.getFileNameLeft());
|
||||
sfVo.setFileNameRight(sfcInfo.getFileNameRight());
|
||||
sfVo.setSerialNumberLeft(sfcInfo.getSerialNumberLeft());
|
||||
sfVo.setSerialNumberRight(sfcInfo.getSerialNumberRight());
|
||||
sfVo.setRemark(sfcInfo.getRemark());
|
||||
sfVo.setComments(sfcInfo.getComments());
|
||||
List<SarFileCompareMenu> menuList = sarFileCompareMenuService.queryListByInfoId(id);
|
||||
for (SarFileCompareMenu menu : menuList) {
|
||||
if (MyStringUtils.isBlank(menu.getParentId()) || "General catalogue".equals(menu.getName()) || "General Catalogue".equals(menu.getName())) {
|
||||
if (menu.getLeftOrRight().equals(CompareConst.POS_LEFT)) {
|
||||
SarFileCompareMenuVo menuLeft = new SarFileCompareMenuVo(menu);
|
||||
menuLeft.setChildren(getMenuChildren(menuList, CompareConst.POS_LEFT, menuLeft.getMenuId()));
|
||||
sfVo.addMenuLeft(menuLeft);
|
||||
} else if (menu.getLeftOrRight().equals(CompareConst.POS_RIGHT)) {
|
||||
SarFileCompareMenuVo menuRight = new SarFileCompareMenuVo(menu);
|
||||
menuRight.setChildren(getMenuChildren(menuList, CompareConst.POS_RIGHT, menuRight.getMenuId()));
|
||||
sfVo.addMenuRight(menuRight);
|
||||
}
|
||||
}
|
||||
if (sfVo.getMenuRight() != null && sfVo.getMenuRight().size() > 0 && sfVo.getMenuLeft() != null && sfVo.getMenuLeft().size() > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<SarFileCompareItem> itemList = sarFileCompareItemService.queryListByInfoId(id);
|
||||
for (SarFileCompareItem item : itemList) {
|
||||
if (item.getLeftOrRight().equals(CompareConst.POS_LEFT)) {
|
||||
sfVo.addTextLeft(item);
|
||||
} else if (item.getLeftOrRight().equals(CompareConst.POS_RIGHT)) {
|
||||
sfVo.addTextRight(item);
|
||||
}
|
||||
}
|
||||
return sfVo;
|
||||
}
|
||||
|
||||
private List<SarFileCompareMenuVo> getMenuChildren(List<SarFileCompareMenu> menuList, String leftOrRight, String pid) {
|
||||
List<SarFileCompareMenuVo> list = new ArrayList<>();
|
||||
for (SarFileCompareMenu menu : menuList) {
|
||||
if (menu.getLeftOrRight().equals(leftOrRight) && menu.getParentId() != null && menu.getParentId().equals(pid)) {
|
||||
SarFileCompareMenuVo menuVO = new SarFileCompareMenuVo(menu);
|
||||
menuVO.setChildren(getMenuChildren(menuList, leftOrRight, menuVO.getMenuId()));
|
||||
list.add(menuVO);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+673
@@ -0,0 +1,673 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import com.aliyuncs.utils.IOUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import com.jero.modules.compare.entity.*;
|
||||
import com.jero.modules.compare.enums.AssessConsistencyEnum;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareItemCommentMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareInfoService;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemCommentService;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
||||
import com.jero.modules.compare.utils.ConvertHtml2Excel;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.common.usermodel.HyperlinkType;
|
||||
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
|
||||
import org.apache.poi.hssf.usermodel.HSSFFont;
|
||||
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCompareItemCommentMapper, SarFileCompareItemComment> implements ISarFileCompareItemCommentService {
|
||||
|
||||
@Autowired
|
||||
private ISarFileCompareInfoService sarFileCompareInfoServiceImpl;
|
||||
|
||||
@Autowired
|
||||
private ISarFileCompareItemService SarFileCompareItemServiceImpl;
|
||||
|
||||
@Value("${jero.path.upload}")
|
||||
private String filePath;
|
||||
@Value("${jero.path.uploadCos}")
|
||||
private String filePathCos;
|
||||
@Value("${jero.splitUrl}")
|
||||
private String splitUrl;
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
Date now = new Date();
|
||||
sarFileCompareItemComment.setCreateTime(now);
|
||||
sarFileCompareItemComment.setUpdateTime(now);
|
||||
save(sarFileCompareItemComment);
|
||||
String itemIdLeft = sarFileCompareItemComment.getItemsIdLeft();
|
||||
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdLeft());
|
||||
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdRight());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
SarFileCompareItemComment ic = queryById(sarFileCompareItemComment.getId());
|
||||
Date now = new Date();
|
||||
ic.setUpdateTime(now);
|
||||
ic.setComment(sarFileCompareItemComment.getComment());
|
||||
saveOrUpdate(ic);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
//删除时需要判断左侧跟右侧是否还有评论,如果没有,将对应的reviewed改为0
|
||||
String itemsIdLeft;
|
||||
String itemsIdRight;
|
||||
SarFileCompareItemComment sarFileCompareItemComment = queryById(id);
|
||||
itemsIdLeft = sarFileCompareItemComment.getItemsIdLeft();
|
||||
itemsIdRight = sarFileCompareItemComment.getItemsIdRight();
|
||||
removeById(id);
|
||||
|
||||
QueryWrapper<SarFileCompareItemComment> left = new QueryWrapper<>();
|
||||
left.eq("items_id_left", itemsIdLeft);
|
||||
if (baseMapper.selectCount(left) == 0) {
|
||||
SarFileCompareItem sarFileCompareItem = SarFileCompareItemServiceImpl.queryById(itemsIdLeft);
|
||||
sarFileCompareItem.setReviewed(0);
|
||||
SarFileCompareItemServiceImpl.saveOrUpdate(sarFileCompareItem);
|
||||
}
|
||||
QueryWrapper<SarFileCompareItemComment> right = new QueryWrapper<>();
|
||||
right.eq("items_id_right", itemsIdRight);
|
||||
if (baseMapper.selectCount(right) == 0) {
|
||||
SarFileCompareItem sarFileCompareItem = SarFileCompareItemServiceImpl.queryById(itemsIdRight);
|
||||
sarFileCompareItem.setReviewed(0);
|
||||
SarFileCompareItemServiceImpl.saveOrUpdate(sarFileCompareItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareItemComment queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareItemComment> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SarFileCompareResultVO queryCompareResult(String infoId,String comment) {
|
||||
SarFileCompareResultVO resultVO = new SarFileCompareResultVO();
|
||||
SarFileCompareInfo sfcInfo = sarFileCompareInfoServiceImpl.queryById(infoId);
|
||||
resultVO.setInfoId(infoId);
|
||||
resultVO.setSerialNumberLeft(sfcInfo.getSerialNumberLeft());
|
||||
resultVO.setFileNameLeft(sfcInfo.getFileNameLeft());
|
||||
resultVO.setFileIdLeft(sfcInfo.getFileIdLeft());
|
||||
resultVO.setSerialNumberRight(sfcInfo.getSerialNumberRight());
|
||||
resultVO.setFileNameRight(sfcInfo.getFileNameRight());
|
||||
resultVO.setFileIdRight(sfcInfo.getFileIdRight());
|
||||
resultVO.setComments(sfcInfo.getComments());
|
||||
|
||||
List<SarFileCompareItemComment> list = queryListByInfoId(infoId,comment);
|
||||
Map<String, SarFileCompareItem> sfcItemMap = SarFileCompareItemServiceImpl.queryMapByInfoId(infoId);
|
||||
for (SarFileCompareItemComment sfcItemCom : list) {
|
||||
SarFileCompareItemComVO itemComVO = new SarFileCompareItemComVO();
|
||||
itemComVO.setId(sfcItemCom.getId());
|
||||
itemComVO.setComment(sfcItemCom.getComment());
|
||||
String itemIdLeft = sfcItemCom.getItemsIdLeft();
|
||||
if (!MyStringUtils.isEmpty(itemIdLeft)) {
|
||||
SarFileCompareItem sfcItem = sfcItemMap.get(itemIdLeft);
|
||||
if (null != sfcItem) {
|
||||
itemComVO.setItemsNameLeft(sfcItem.getItemsName());
|
||||
itemComVO.setItemsNumLeft(sfcItem.getItemsNum());
|
||||
itemComVO.setItemsTextLeft(sfcItem.getItemsText());
|
||||
}
|
||||
}
|
||||
String itemIdRight = sfcItemCom.getItemsIdRight();
|
||||
if (!MyStringUtils.isEmpty(itemIdRight)) {
|
||||
SarFileCompareItem sfcItem = sfcItemMap.get(itemIdRight);
|
||||
if (null != sfcItem) {
|
||||
itemComVO.setItemsNameRight(sfcItem.getItemsName());
|
||||
itemComVO.setItemsNumRight(sfcItem.getItemsNum());
|
||||
itemComVO.setItemsTextRight(sfcItem.getItemsText());
|
||||
}
|
||||
}
|
||||
resultVO.addRes(itemComVO);
|
||||
}
|
||||
return resultVO;
|
||||
|
||||
}
|
||||
|
||||
public List<SarFileCompareItemComment> queryListByInfoId(String infoId,String comment) {
|
||||
LambdaQueryWrapper<SarFileCompareItemComment> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (ObjectUtils.isNotEmpty(comment)) {
|
||||
if (AssessConsistencyEnum.SAME.getValue().equals(comment)) {
|
||||
queryWrapper.eq(SarFileCompareItemComment::getComment, comment);
|
||||
} else if (AssessConsistencyEnum.DIFFERENT.getValue().equals(comment)) {
|
||||
queryWrapper.ne(SarFileCompareItemComment::getComment, AssessConsistencyEnum.SAME.getValue());
|
||||
}
|
||||
}
|
||||
queryWrapper.eq(SarFileCompareItemComment::getInfoId, infoId);
|
||||
queryWrapper.orderBy(true, true, SarFileCompareItemComment::getCreateTime);
|
||||
List<SarFileCompareItemComment> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportResXls(HttpServletRequest request,HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut,String comment) {
|
||||
List<SarFileCompareItemComment> list = null;
|
||||
if (includeComments && MyStringUtils.isEmpty(selectIds)) {
|
||||
//只导出全文评论的情况
|
||||
list = new ArrayList<>();
|
||||
} else {
|
||||
LambdaQueryWrapper<SarFileCompareItemComment> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareItemComment::getInfoId, infoId);
|
||||
if (!MyStringUtils.isEmpty(selectIds)) {
|
||||
queryWrapper.in(SarFileCompareItemComment::getId, Arrays.asList(selectIds.split(",")));
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(comment)) {
|
||||
if (AssessConsistencyEnum.SAME.getValue().equals(comment)) {
|
||||
queryWrapper.eq(SarFileCompareItemComment::getComment, comment);
|
||||
} else if (AssessConsistencyEnum.DIFFERENT.getValue().equals(comment)) {
|
||||
queryWrapper.ne(SarFileCompareItemComment::getComment, AssessConsistencyEnum.SAME.getValue());
|
||||
}
|
||||
}
|
||||
queryWrapper.orderBy(true, true, SarFileCompareItemComment::getCreateTime);
|
||||
list = this.list(queryWrapper);
|
||||
}
|
||||
Map<String, SarFileCompareItem> sfcItemMap = SarFileCompareItemServiceImpl.queryMapByInfoId(infoId);
|
||||
|
||||
SarFileCompareInfo sarFileCompareInfo = sarFileCompareInfoServiceImpl.queryById(infoId);
|
||||
|
||||
OutputStream os = null;
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
log.info("-------------- workbook创建成功 -----------------");
|
||||
//在本地创建图片文件夹
|
||||
log.info("-------------- 在本地创建图片文件夹 -----------------");
|
||||
String dir = filePath + File.separator + UUID.randomUUID().toString().replace("-", "");
|
||||
File dirFile = new File(dir);
|
||||
if (dirFile.exists()){
|
||||
dirFile.delete();
|
||||
}
|
||||
dirFile.mkdirs();
|
||||
log.info("-------------- 文件夹创建成功:"+ dirFile.getAbsolutePath() +" -----------------");
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String fileName = "导出对比结果 " + sdf.format(new Date()) + ".xlsx";
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
|
||||
response.setContentType("application/force-download");
|
||||
//创建工作表对象
|
||||
String sheetName = "对比结果";
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
sheetName = "对比结果";
|
||||
} else {
|
||||
sheetName = "Comparing results";
|
||||
}
|
||||
Sheet sheet = workbook.createSheet(sheetName);
|
||||
HSSFPatriarch patriarch = (HSSFPatriarch) sheet.createDrawingPatriarch();
|
||||
// 创建头部
|
||||
String header = "";
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
header = "所选标准,条款号,条款名称,条款内容,所选标准,条款号,条款名称,条款内容,评论";
|
||||
} else {
|
||||
header = "Selected Standard,Number,Title,Content,Selected Standard,Number,Title,Content,Comment";
|
||||
}
|
||||
int[] columnWidth = {5000,5000, 5000, 10000, 5000,5000, 5000, 10000, 10000};
|
||||
CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象
|
||||
cellStyle.setAlignment(HorizontalAlignment.LEFT);
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
cellStyle.setWrapText(true);
|
||||
Row rowHeader = sheet.createRow(0);//开始创建标题行
|
||||
if (MyStringUtils.isNotBlank(header)) {
|
||||
String[] headerArr = header.split(",");
|
||||
for (int i = 0; i < headerArr.length; i++) {
|
||||
rowHeader.createCell(i).setCellValue(headerArr[i]);
|
||||
sheet.setColumnWidth(i, columnWidth[i]);
|
||||
}
|
||||
}
|
||||
//超链接样式
|
||||
CellStyle cellStyleLink =workbook.createCellStyle();
|
||||
HSSFFont font = ((HSSFWorkbook) workbook).createFont();
|
||||
font.setColor(HSSFColor.HSSFColorPredefined.LIGHT_BLUE.getIndex());
|
||||
cellStyleLink.setFont(font);
|
||||
cellStyleLink.setWrapText(true);
|
||||
int i = 1;
|
||||
//记录需要合并的单元格
|
||||
List<SarFileCompareExcelMergeCell> mergeCells = new ArrayList<>();
|
||||
for (SarFileCompareItemComment itemComment : list) {
|
||||
SarFileCompareExcelMergeCell sarFileCompareExcelMergeCell = new SarFileCompareExcelMergeCell();
|
||||
String[] leftSplit = null;
|
||||
String[] rightSplit = null;
|
||||
Row row = sheet.createRow(i);
|
||||
row.createCell(0).setCellValue(sarFileCompareInfo == null ? "" : sarFileCompareInfo.getTitleLeft() + " " + sarFileCompareInfo.getFileNameLeft());
|
||||
row.createCell(4).setCellValue(sarFileCompareInfo == null ? "" : sarFileCompareInfo.getTitleRight() + " " + sarFileCompareInfo.getFileNameRight());
|
||||
String itemIdLeft = itemComment.getItemsIdLeft();
|
||||
if (!MyStringUtils.isEmpty(itemIdLeft)) {
|
||||
SarFileCompareItem itemLeft = sfcItemMap.get(itemIdLeft);
|
||||
if (null != itemLeft) {
|
||||
row.createCell(1).setCellValue(itemLeft.getItemsNum());
|
||||
row.createCell(2).setCellValue(itemLeft.getItemsName());
|
||||
String text = itemLeft.getItemsText();
|
||||
if (MyStringUtils.isNotEmpty(text)){
|
||||
log.info("-------------- 开始开始拆分左侧图片、文字、表格 :" + text + "-----------------");
|
||||
String rowDataAndPath = getSplitContent(request, text);
|
||||
log.info("-------------- 左侧图片、文字、表格 拆分成功 :"+ rowDataAndPath +"-----------------");
|
||||
leftSplit = rowDataAndPath.split("---");
|
||||
if (leftSplit.length > 1) {
|
||||
for (int j = 0; j < leftSplit.length; j++) {
|
||||
if (ObjectUtils.isNotEmpty(leftSplit[j])) {
|
||||
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
||||
if (j > 0) {
|
||||
Row row2 = sheet.getRow(j + i);
|
||||
if (ObjectUtils.isEmpty(row2)) {
|
||||
row2 = sheet.createRow(j + i);
|
||||
}
|
||||
log.info("-------------- 开始开始处理左侧图片、表格 -----------------");
|
||||
handleSpecificData(workbook, dir, patriarch, cellStyleLink, byteArrayOut, row2, i, j, leftSplit[j], 3);
|
||||
log.info("-------------- 左侧图片、表格 处理成功 -----------------");
|
||||
} else {
|
||||
log.info("-------------- 开始开始处理左侧图片、表格 -----------------");
|
||||
handleSpecificData(workbook, dir, patriarch, cellStyleLink, byteArrayOut, row, i, j, leftSplit[j], 3);
|
||||
log.info("-------------- 左侧图片、表格 处理成功 -----------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
sarFileCompareExcelMergeCell.setLeftStart(i);
|
||||
sarFileCompareExcelMergeCell.setLeftEnd(i + leftSplit.length - 1);
|
||||
sarFileCompareExcelMergeCell.setRightStart(0);
|
||||
sarFileCompareExcelMergeCell.setRightEnd(0);
|
||||
mergeCells.add(sarFileCompareExcelMergeCell);
|
||||
} else {
|
||||
row.createCell(3).setCellValue(rowDataAndPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String itemIdRight = itemComment.getItemsIdRight();
|
||||
if (!MyStringUtils.isEmpty(itemIdRight)) {
|
||||
SarFileCompareItem itemRight = sfcItemMap.get(itemIdRight);
|
||||
if (null != itemRight) {
|
||||
row.createCell(5).setCellValue(itemRight.getItemsNum());
|
||||
row.createCell(6).setCellValue(itemRight.getItemsName());
|
||||
String text = itemRight.getItemsText();
|
||||
if (MyStringUtils.isNotEmpty(text)) {
|
||||
log.info("-------------- 开始开始拆分右侧图片、文字、表格 :"+ text +" -----------------");
|
||||
String rowDataAndPath = getSplitContent(request, text);
|
||||
log.info("-------------- 右侧图片、文字、表格 拆分成功 :"+ rowDataAndPath +" -----------------");
|
||||
rightSplit = rowDataAndPath.split("---");
|
||||
if (rightSplit.length > 1) {
|
||||
for (int j = 0; j < rightSplit.length; j++) {
|
||||
if (ObjectUtils.isNotEmpty(rightSplit[j])) {
|
||||
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
||||
if (j > 0) {
|
||||
Row row2 = sheet.getRow(j + i);
|
||||
if (ObjectUtils.isEmpty(row2)) {
|
||||
row2 = sheet.createRow(j + i);
|
||||
}
|
||||
log.info("-------------- 开始处理右侧图片、表格 -----------------");
|
||||
handleSpecificData(workbook, dir, patriarch, cellStyleLink, byteArrayOut, row2, i, j, rightSplit[j], 7);
|
||||
log.info("-------------- 右侧图片、表格 处理成功 -----------------");
|
||||
} else {
|
||||
log.info("-------------- 开始处理右侧图片、表格 -----------------");
|
||||
handleSpecificData(workbook, dir, patriarch, cellStyleLink, byteArrayOut, row, i, j, rightSplit[j], 7);
|
||||
log.info("-------------- 右侧图片、表格 处理成功 -----------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
sarFileCompareExcelMergeCell.setRightStart(i);
|
||||
sarFileCompareExcelMergeCell.setRightEnd(i + rightSplit.length - 1);
|
||||
mergeCells.add(sarFileCompareExcelMergeCell);
|
||||
} else {
|
||||
row.createCell(7).setCellValue(rowDataAndPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
row.createCell(8).setCellValue(itemComment.getComment());
|
||||
row.setRowStyle(cellStyle);
|
||||
for (int j = 0; j < 9; j++) {
|
||||
Cell cell = row.getCell(j);
|
||||
if (null != cell) {
|
||||
cell.setCellStyle(cellStyle);
|
||||
}
|
||||
}
|
||||
int left_length = ObjectUtils.isEmpty(leftSplit) ? 0 : leftSplit.length;
|
||||
int right_length = ObjectUtils.isEmpty(rightSplit) ? 0 : rightSplit.length;
|
||||
i = left_length > right_length ? i + left_length : i + right_length;
|
||||
}
|
||||
if (includeComments || MyStringUtils.isEmpty(selectIds)) {
|
||||
Row row = sheet.createRow(i);
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
row.createCell(0).setCellValue("全文评论");
|
||||
} else {
|
||||
row.createCell(0).setCellValue("The full text comments");
|
||||
}
|
||||
//合并单元格
|
||||
CellRangeAddress rangeAddress = new CellRangeAddress(row.getRowNum(), row.getRowNum(), 1, 6);
|
||||
sheet.addMergedRegion(rangeAddress);
|
||||
SarFileCompareInfo compareInfo = sarFileCompareInfoServiceImpl.queryById(infoId);
|
||||
row.createCell(1).setCellValue(compareInfo.getComments());
|
||||
row.getCell(1).setCellStyle(cellStyle);
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(mergeCells)) {
|
||||
log.info("-------------- 开始处理需要合并的单元格 -----------------");
|
||||
Set<SarFileCompareExcelMergeCell> mergeCellSet = new HashSet<>(mergeCells);
|
||||
for (SarFileCompareExcelMergeCell mergeCell : mergeCellSet) {
|
||||
Integer leftCount = 0;
|
||||
if (ObjectUtils.isNotEmpty(mergeCell.getLeftEnd())&&ObjectUtils.isNotEmpty(mergeCell.getLeftStart())) {
|
||||
leftCount = mergeCell.getLeftEnd() - mergeCell.getLeftStart() + 1;
|
||||
}
|
||||
Integer rightCount = 0;
|
||||
if (ObjectUtils.isNotEmpty(mergeCell.getRightEnd())&&ObjectUtils.isNotEmpty(mergeCell.getRightStart())) {
|
||||
rightCount = mergeCell.getRightEnd() - mergeCell.getRightStart() + 1;
|
||||
}
|
||||
Integer start = leftCount - rightCount >= 0 ? mergeCell.getLeftStart() : mergeCell.getRightStart();
|
||||
log.info("-------------- 合并开始行数:" + start + " -----------------");
|
||||
Integer end = leftCount - rightCount >= 0 ? mergeCell.getLeftEnd() : mergeCell.getRightEnd();
|
||||
log.info("-------------- 合并结束行数: " + end + " -----------------");
|
||||
//合并
|
||||
if (ObjectUtils.isNotEmpty(start)&&ObjectUtils.isNotEmpty(end)) {
|
||||
CellRangeAddress region0 = new CellRangeAddress(start, end, 0, 0);
|
||||
sheet.addMergedRegion(region0);
|
||||
CellRangeAddress region1 = new CellRangeAddress(start, end, 1, 1);
|
||||
sheet.addMergedRegion(region1);
|
||||
CellRangeAddress region2 = new CellRangeAddress(start, end, 2, 2);
|
||||
sheet.addMergedRegion(region2);
|
||||
CellRangeAddress region4 = new CellRangeAddress(start, end, 4, 4);
|
||||
sheet.addMergedRegion(region4);
|
||||
CellRangeAddress region5 = new CellRangeAddress(start, end, 5, 5);
|
||||
sheet.addMergedRegion(region5);
|
||||
CellRangeAddress region6 = new CellRangeAddress(start, end, 6, 6);
|
||||
sheet.addMergedRegion(region6);
|
||||
CellRangeAddress region7 = new CellRangeAddress(start, end, 8, 8);
|
||||
sheet.addMergedRegion(region7);
|
||||
}
|
||||
|
||||
}
|
||||
log.info("-------------- 单元格合并成功 -----------------");
|
||||
}
|
||||
|
||||
|
||||
os = response.getOutputStream();
|
||||
workbook.write(os);
|
||||
os.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("下载文件失败");
|
||||
} else {
|
||||
throw new JeroBootException("Failed to download file");
|
||||
}
|
||||
} finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理图片跟表格类型的数据
|
||||
* @param workbook
|
||||
* @param dir
|
||||
* @param patriarch
|
||||
* @param cellStyleLink
|
||||
* @param byteArrayOut
|
||||
* @param row
|
||||
* @param i
|
||||
* @param j
|
||||
* @param text
|
||||
* @param cellNum
|
||||
* @throws IOException
|
||||
*/
|
||||
private void handleSpecificData(Workbook workbook, String dir, HSSFPatriarch patriarch, CellStyle cellStyleLink, ByteArrayOutputStream byteArrayOut, Row row, int i, int j, String text, int cellNum) throws IOException {
|
||||
if (text.contains("/upFiles")) {
|
||||
row.setHeight((short) 3000); //设置行高
|
||||
//先将图片下载到本地
|
||||
log.info("-------------------------将图片下载到本地文件夹中----------------------------");
|
||||
String fileLastName = text.substring(text.lastIndexOf("/") + 1);
|
||||
if (MinioUtil.doesObjectExist(text)) {
|
||||
try (InputStream in = MinioUtil.download(text)) {
|
||||
copyFile2(in, dir + File.separator + fileLastName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
File file = new File(dir + File.separator + fileLastName);
|
||||
log.info("-------------------------图片下载成功:"+ file.getAbsolutePath() +"----------------------------");
|
||||
if (file.exists()) {
|
||||
log.info("-------------------------将图片插入excel指定单元格中----------------------------");
|
||||
BufferedImage bufferImg = ImageIO.read(file);
|
||||
//获取文件后缀
|
||||
String fileName = file.getName();
|
||||
String formatName = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
//如果是jpg或者是jpeg,需要重画一下,否则会变色
|
||||
if (formatName.equalsIgnoreCase("jpg") || formatName.equalsIgnoreCase("jpeg")) { //重画一下,要么会变色
|
||||
BufferedImage tag;
|
||||
tag = new BufferedImage(bufferImg.getWidth(), bufferImg.getHeight(), BufferedImage.TYPE_INT_BGR);
|
||||
Graphics g = tag.getGraphics();
|
||||
g.drawImage(bufferImg, 0, 0, null); // 绘制缩小后的图
|
||||
g.dispose();
|
||||
bufferImg = tag;
|
||||
}
|
||||
ImageIO.write(bufferImg, formatName, byteArrayOut);
|
||||
//anchor主要用于设置图片的属性
|
||||
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 200, (short) cellNum, j + i, (short) cellNum, j + i);
|
||||
patriarch.createPicture(anchor, workbook.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
|
||||
log.info("-------------------------将图片插入成功----------------------------");
|
||||
}
|
||||
} else {
|
||||
Cell cell = row.createCell(cellNum);
|
||||
if (text.contains("<table")) {
|
||||
log.info("-------------------------开始处理表格----------------------------");
|
||||
tableAssociate(workbook, cellStyleLink, cell, text);
|
||||
log.info("-------------------------表格处理完毕----------------------------");
|
||||
} else {
|
||||
cell.setCellValue(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前excel中新开sheet生成表格,并在指定单元格用超链接关联
|
||||
* @param workbook
|
||||
* @param cellStyleLink
|
||||
* @param cell
|
||||
* @param tableHtml
|
||||
*/
|
||||
private void tableAssociate(Workbook workbook, CellStyle cellStyleLink, Cell cell, String tableHtml) {
|
||||
cell.setCellValue("点击查看详情");
|
||||
//新开sheet生成表格
|
||||
log.info("-------------------------开始生成表格----------------------------");
|
||||
if (StringUtils.isNotEmpty(tableHtml) && tableHtml.indexOf("<tbody>") < 0) {
|
||||
if (tableHtml.indexOf("<thead>") < 0) {
|
||||
tableHtml = tableHtml.replaceFirst("<tr>", "<tbody><tr>");
|
||||
tableHtml = tableHtml.replaceFirst("</table>", "</tbody></table>");
|
||||
} else {
|
||||
tableHtml = tableHtml.replaceFirst("</thead>", "</thead><tbody>");
|
||||
tableHtml = tableHtml.replaceFirst("</table>", "</tbody></table>");
|
||||
}
|
||||
}
|
||||
String cnt = "\n";
|
||||
tableHtml = tableHtml.replaceAll("<[\\s]*?br[^>]*?>|<[\\s]*?\\/[\\s]*?br[\\s]*?>", cnt);
|
||||
String tableSheetName = "表格" + System.currentTimeMillis();
|
||||
ConvertHtml2Excel.table2Excel(tableHtml, (HSSFWorkbook) workbook, tableSheetName);
|
||||
log.info("-------------------------表格生产完毕----------------------------");
|
||||
//添加超链接
|
||||
log.info("-------------------------开始添加超链接---------------------------");
|
||||
CreationHelper createHelper = workbook.getCreationHelper();
|
||||
Hyperlink hyperlink1 = createHelper.createHyperlink(HyperlinkType.DOCUMENT);
|
||||
String tableName = "#\'" + tableSheetName + "\'!A1";
|
||||
hyperlink1.setAddress(tableName);
|
||||
cell.setHyperlink(hyperlink1);// 链接
|
||||
cell.setCellStyle(cellStyleLink);
|
||||
log.info("-------------------------超链接添加完毕---------------------------");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文字、图片、表格分割后的内容
|
||||
* @param request
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
private String getSplitContent(HttpServletRequest request, String text) {
|
||||
text = text.replace("<p>", "").replace("</p>", "\r\n");
|
||||
//分割图片
|
||||
log.info("-------------------------开始分割文字与图片---------------------------");
|
||||
splitImg(text, request.getSession());
|
||||
log.info("-------------------------文字与图片分割完毕---------------------------");
|
||||
//分割表格
|
||||
log.info("-------------------------从剩余文字中开始分割表格---------------------------");
|
||||
String txtAndImg = (String) request.getSession().getAttribute("txtAndImg");
|
||||
txtAndImg = txtAndImg.replaceAll("table", "replaceTable");
|
||||
splitTable(txtAndImg, request.getSession());
|
||||
log.info("-------------------------表格分割完毕---------------------------");
|
||||
return (String) request.getSession().getAttribute("textAndTableAndImg");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分割表格
|
||||
* @param textAndImg
|
||||
* @param session
|
||||
*/
|
||||
private void splitTable(String textAndImg,HttpSession session) {
|
||||
if (textAndImg.contains("<replaceTable")) {
|
||||
String left = textAndImg.substring(0, textAndImg.indexOf("<replaceTable"));
|
||||
String right = textAndImg.substring(textAndImg.indexOf("/replaceTable>") + 14);
|
||||
String table = textAndImg.substring(textAndImg.indexOf("<replaceTable"), textAndImg.indexOf("/replaceTable>")+14);
|
||||
table = table.replaceAll("replaceTable", "table");
|
||||
textAndImg = left + "---" + table + "---" + right;
|
||||
splitTable(textAndImg, session);
|
||||
} else {
|
||||
session.setAttribute("textAndTableAndImg", textAndImg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分割图片
|
||||
* @param text
|
||||
* @param session
|
||||
* @return
|
||||
*/
|
||||
private void splitImg(String text,HttpSession session) {
|
||||
if (text.contains("<img")) {
|
||||
String txtLeft = text.substring(0, text.indexOf("<img"));
|
||||
String txtRight = text.substring(text.indexOf("g\">") + 3);
|
||||
String img = text.substring(text.indexOf("<img"), text.indexOf("g\">"));
|
||||
String path = img.substring(img.lastIndexOf("=") + 1)+"g";
|
||||
text = txtLeft + "---" + path + "---" + txtRight;
|
||||
splitImg(text, session);
|
||||
} else {
|
||||
session.setAttribute("txtAndImg", text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 一致评估
|
||||
* @param sarFileCompareItemComment
|
||||
*/
|
||||
@Override
|
||||
public void consensusAssessment(SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
Date now = new Date();
|
||||
sarFileCompareItemComment.setCreateTime(now);
|
||||
sarFileCompareItemComment.setUpdateTime(now);
|
||||
sarFileCompareItemComment.setComment("一致");
|
||||
save(sarFileCompareItemComment);
|
||||
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdLeft());
|
||||
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdRight());
|
||||
}
|
||||
|
||||
public void copyFile2(InputStream in, String destPath) throws IOException {
|
||||
BufferedInputStream bis = new BufferedInputStream(in);
|
||||
BufferedOutputStream bos =
|
||||
new BufferedOutputStream(Files.newOutputStream(Paths.get(destPath),
|
||||
StandardOpenOption.CREATE,
|
||||
StandardOpenOption.TRUNCATE_EXISTING,
|
||||
StandardOpenOption.WRITE));
|
||||
// 打开输入流
|
||||
// FileInputStream fis = new FileInputStream(srcPath);
|
||||
// 打开输出流
|
||||
// FileOutputStream fos = new FileOutputStream(destPath);
|
||||
// 读取和写入信息
|
||||
byte[] bytes = new byte[1024 * 1024];
|
||||
int len;
|
||||
while ((len = bis.read(bytes)) > 0) {
|
||||
bos.write(bytes, 0, len);
|
||||
}
|
||||
// 关闭流 先开后关 后开先关
|
||||
// 先开后关,先开的输入流,再开的输出流,那么应该先关输出流,再关输入流
|
||||
// 先关外层,再关内层。如BufferedInputStream包装了一个FileInputStream,那么先关BufferedInputStream,再关FileInputStream。
|
||||
bos.close(); // 后开先关
|
||||
bis.close(); // 先开后关
|
||||
}
|
||||
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItem;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareItemMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
||||
import com.jero.modules.compare.utils.CompareConst;
|
||||
import com.jero.modules.compare.utils.DiffUtils;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SarFileCompareItemServiceImpl extends ServiceImpl<SarFileCompareItemMapper, SarFileCompareItem> implements ISarFileCompareItemService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareItem sarFileCompareItem) {
|
||||
Date now = new Date();
|
||||
sarFileCompareItem.setCreateTime(now);
|
||||
sarFileCompareItem.setUpdateTime(now);
|
||||
save(sarFileCompareItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareItem sarFileCompareItem) {
|
||||
Date now = new Date();
|
||||
sarFileCompareItem.setUpdateTime(now);
|
||||
saveOrUpdate(sarFileCompareItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateReviewedById(String id) {
|
||||
if (!MyStringUtils.isEmpty(id)) {
|
||||
SarFileCompareItem item = getById(id);
|
||||
if (null != item && item.getReviewed() == CompareConst.NO_REVIEWED) {
|
||||
item.setReviewed(CompareConst.REVIEWED);
|
||||
editById(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareItem queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareItem> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileCompareItem> queryListByInfoId(String infoId) {
|
||||
LambdaQueryWrapper<SarFileCompareItem> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareItem::getInfoId, infoId);
|
||||
queryWrapper.orderBy(true, true, SarFileCompareItem::getItemsDisplayNum);
|
||||
List<SarFileCompareItem> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, SarFileCompareItem> queryMapByInfoId(String infoId) {
|
||||
Map<String, SarFileCompareItem> resMap = new HashMap<String, SarFileCompareItem>();
|
||||
List<SarFileCompareItem> list = queryListByInfoId(infoId);
|
||||
for (SarFileCompareItem item : list) {
|
||||
resMap.put(item.getId(), item);
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> clauseComparison(String lid, String rid) {
|
||||
SarFileCompareItem leftItem = this.queryById(lid);
|
||||
SarFileCompareItem rightItem = this.queryById(rid);
|
||||
DiffUtils dmp = new DiffUtils();
|
||||
List<String> htmlDiffStr = dmp.getHtmlDiffStr(leftItem.getItemsText(), rightItem.getItemsText());
|
||||
return htmlDiffStr;
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.compare.entity.SarFileCompareMenu;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareMenuMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareMenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SarFileCompareMenuServiceImpl extends ServiceImpl<SarFileCompareMenuMapper, SarFileCompareMenu> implements ISarFileCompareMenuService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareMenu sarFileCompareMenu) {
|
||||
Date now = new Date();
|
||||
sarFileCompareMenu.setCreateTime(now);
|
||||
sarFileCompareMenu.setUpdateTime(now);
|
||||
save(sarFileCompareMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareMenu sarFileCompareMenu) {
|
||||
Date now = new Date();
|
||||
sarFileCompareMenu.setUpdateTime(now);
|
||||
saveOrUpdate(sarFileCompareMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareMenu queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareMenu> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SarFileCompareMenu> queryListByInfoId(String infoId) {
|
||||
LambdaQueryWrapper<SarFileCompareMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareMenu::getInfoId, infoId);
|
||||
queryWrapper.orderBy(true,true,SarFileCompareMenu::getDisplaySeq);
|
||||
List<SarFileCompareMenu> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComment;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareResCommentMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareResCommentService;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SarFileCompareResCommentServiceImpl extends ServiceImpl<SarFileCompareResCommentMapper, SarFileCompareResComment> implements ISarFileCompareResCommentService {
|
||||
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareResComment sarFileCompareResComment) {
|
||||
Date now = new Date();
|
||||
sarFileCompareResComment.setCreateTime(now);
|
||||
sarFileCompareResComment.setUpdateTime(now);
|
||||
save(sarFileCompareResComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareResComment sarFileCompareResComment) {
|
||||
Date now = new Date();
|
||||
sarFileCompareResComment.setUpdateTime(now);
|
||||
saveOrUpdate(sarFileCompareResComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareResComment queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareResComment> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
public List<SarFileCompareResComVO> queryListByInfoId(String id) {
|
||||
LambdaQueryWrapper<SarFileCompareResComment> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareResComment::getInfoId, id);
|
||||
queryWrapper.orderBy(true, true, SarFileCompareResComment::getCreateTime);
|
||||
List<SarFileCompareResComVO> resList = new ArrayList<>();
|
||||
List<SarFileCompareResComment> list = this.list(queryWrapper);
|
||||
for (SarFileCompareResComment rc : list) {
|
||||
if (MyStringUtils.isEmpty(rc.getParentId())) {
|
||||
SarFileCompareResComVO resComVO = wrapperSarFileCompareResComVO(rc);
|
||||
for (SarFileCompareResComment rc1 : list) {
|
||||
if (!MyStringUtils.isEmpty(rc1.getParentId()) && rc1.getParentId().equals(resComVO.getId())) {
|
||||
resComVO.addResComVo(wrapperSarFileCompareResComVO(rc1));
|
||||
}
|
||||
}
|
||||
resList.add(resComVO);
|
||||
}
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
private SarFileCompareResComVO wrapperSarFileCompareResComVO(SarFileCompareResComment rc) {
|
||||
SarFileCompareResComVO resComVO = new SarFileCompareResComVO();
|
||||
resComVO.setId(rc.getId());
|
||||
resComVO.setName(rc.getCreateBy());
|
||||
resComVO.setCreateTime(sdf.format(rc.getCreateTime()));
|
||||
resComVO.setContent(rc.getComment());
|
||||
return resComVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileCompareResComVO> queryListByInfoId(String id, String str) {
|
||||
if (MyStringUtils.isBlank(str)) {
|
||||
return queryListByInfoId(id);
|
||||
}
|
||||
LambdaQueryWrapper<SarFileCompareResComment> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareResComment::getInfoId, id);
|
||||
queryWrapper.like(SarFileCompareResComment::getComment, str);
|
||||
queryWrapper.orderBy(true, true, SarFileCompareResComment::getCreateTime);
|
||||
List<SarFileCompareResComment> list = this.list(queryWrapper);
|
||||
Map<String, SarFileCompareResComVO> resCommentMap = new HashMap<>();
|
||||
List<SarFileCompareResComment> subList = new ArrayList<>();
|
||||
//先找到一级评论
|
||||
for (SarFileCompareResComment rc : list) {
|
||||
if (MyStringUtils.isEmpty(rc.getParentId())) {
|
||||
resCommentMap.put(rc.getId(), wrapperSarFileCompareResComVO(rc));
|
||||
} else {
|
||||
subList.add(rc);
|
||||
}
|
||||
}
|
||||
//把回复评论放进一级评论下,没有一级评论要查出来放上
|
||||
for (SarFileCompareResComment rc : subList) {
|
||||
if (resCommentMap.keySet().contains(rc.getParentId())) {
|
||||
resCommentMap.get(rc.getParentId()).addResComVo(wrapperSarFileCompareResComVO(rc));
|
||||
} else {
|
||||
SarFileCompareResComment prc = this.queryById(rc.getParentId());
|
||||
SarFileCompareResComVO prcVo = wrapperSarFileCompareResComVO(prc);
|
||||
prcVo.addResComVo(wrapperSarFileCompareResComVO(rc));
|
||||
resCommentMap.put(prcVo.getId(), prcVo);
|
||||
}
|
||||
}
|
||||
return Lists.newArrayList(resCommentMap.values());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
package com.jero.modules.compare.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.extra.tokenizer.Result;
|
||||
import cn.hutool.extra.tokenizer.TokenizerEngine;
|
||||
import cn.hutool.extra.tokenizer.TokenizerUtil;
|
||||
import cn.hutool.extra.tokenizer.Word;
|
||||
import cn.hutool.extra.tokenizer.engine.hanlp.HanLPEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.jieba.JiebaEngine;
|
||||
import com.hankcs.hanlp.HanLP;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.wltea.analyzer.core.IKSegmenter;
|
||||
import org.wltea.analyzer.core.Lexeme;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class CompHanLPUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 通过Ik 进行将句子分词
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
public static Vector<String> participleIk(String text) {
|
||||
//对输入进行分词
|
||||
Vector<String> str = new Vector<>();
|
||||
try {
|
||||
StringReader reader = new StringReader(text);
|
||||
//当为true时,分词器进行最大词长切分
|
||||
IKSegmenter ik = new IKSegmenter(reader, true);
|
||||
Lexeme lexeme = null;
|
||||
while ((lexeme = ik.next()) != null) {
|
||||
str.add(lexeme.getLexemeText());
|
||||
}
|
||||
if (str.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
//分词后
|
||||
log.info("str分词后:" + str);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 结巴分词
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
public static Vector<String> participleJieBa(String text) {
|
||||
JiebaEngine engine = new JiebaEngine();
|
||||
Result results = engine.parse(text);
|
||||
//输出:这 两个 方法 的 区别 在于 返回 值
|
||||
String result = CollUtil.join((Iterator<Word>) results, ",");
|
||||
return new Vector<>(Arrays.asList(result.split(",")));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 中文分词
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
public static Vector<String> participleChinese(String text) {
|
||||
//自动根据用户引入的分词库的jar来自动选择使用的引擎
|
||||
TokenizerEngine engine = TokenizerUtil.createEngine();
|
||||
//解析文本
|
||||
//String text = "这两个方法的区别在于返回值";
|
||||
Result results = engine.parse(text);
|
||||
//输出:这 两个 方法 的 区别 在于 返回 值
|
||||
String result = CollUtil.join((Iterator<Word>) results, ",");
|
||||
return new Vector<>(Arrays.asList(result.split(",")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 采用 HanLP 进行自定义分词
|
||||
*/
|
||||
public static Vector<String> participleHanLP(String text) {
|
||||
TokenizerEngine engine = new HanLPEngine();
|
||||
//解析文本
|
||||
//String text = "这两个方法的区别在于返回值";
|
||||
Result results = engine.parse(text);
|
||||
//输出:这 两个 方法 的 区别 在于 返回 值
|
||||
String result = CollUtil.join((Iterator<Word>) results, ",");
|
||||
return new Vector<>(Arrays.asList(result.split(",")));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Java利用hanlp完成语句相似度分析
|
||||
*
|
||||
* @param sentenceOne
|
||||
* @param sentenceTwo
|
||||
* @return
|
||||
*/
|
||||
public static double findSimilarity(String sentenceOne, String sentenceTwo) {
|
||||
List<String> sentOneWords = getSplitWords(sentenceOne);
|
||||
List<String> sentTwoWords = getSplitWords(sentenceTwo);
|
||||
List<String> allWords = mergeList(sentOneWords, sentTwoWords);
|
||||
int[] statisticOne = statistic(allWords, sentOneWords);
|
||||
int[] statisticTwo = statistic(allWords, sentTwoWords);
|
||||
double dividend = 0;
|
||||
double divisor1 = 0;
|
||||
double divisor2 = 0;
|
||||
int length = statisticOne.length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
dividend += statisticOne[i] * statisticTwo[i];
|
||||
divisor1 += Math.pow(statisticOne[i], 2);
|
||||
divisor2 += Math.pow(statisticTwo[i], 2);
|
||||
}
|
||||
return dividend / (Math.sqrt(divisor1) * Math.sqrt(divisor2));
|
||||
}
|
||||
|
||||
|
||||
private static int[] statistic(List<String> allWords, List<String> sentWords) {
|
||||
int[] result = new int[allWords.size()];
|
||||
int size = allWords.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
result[i] = Collections.frequency(sentWords, allWords.get(i));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 去重
|
||||
*
|
||||
* @param listOne
|
||||
* @param listTwo
|
||||
* @return
|
||||
*/
|
||||
private static List<String> mergeList(List<String> listOne, List<String> listTwo) {
|
||||
List<String> result = new ArrayList<>();
|
||||
result.addAll(listOne);
|
||||
result.addAll(listTwo);
|
||||
return result.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 过滤标签
|
||||
*
|
||||
* @param sentence
|
||||
* @return
|
||||
*/
|
||||
private static List<String> getSplitWords(String sentence) {
|
||||
// 去除掉html标签
|
||||
sentence = Jsoup.parse(sentence.replace(" ", "")).body().text();
|
||||
// 标点符号会被单独分为一个Term,去除之
|
||||
return HanLP.segment(sentence).stream().map(a -> a.word).filter(s -> !"`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、? ".contains(s)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String str1 = "6转向系\n" +
|
||||
"6.1汽车(三轮汽车除外)的方向盘应设置于左侧,其他机动车的方向盘不得设置于右侧;专项作业车、教练车按需要可设置左右两个方向盘。有驾驶室的正三轮摩托车如使用方向盘转向,则方向盘中心立柱距车辆纵向中心平面的水平距离应小于等于200 mm;其他摩托车不得使用方向盘转向。\n" +
|
||||
"6.2机动车的方向盘(或方向把)应转动灵活,操纵方便,无卡滞现象。机动车应设置转向限位装置。转向系统在任何操作位置上,不得与其他部件有干涉现象。\n" +
|
||||
"6.3机动车(摩托车、三轮汽车、手扶拖拉机运输机组除外)正常行驶时,转向轮转向后应有一定的回正能力(允许有残余角),以使机动车具有稳定的直线行驶能力。\n" +
|
||||
"6.4机动车方向盘的最大自由转动量应小于或等于:\n" +
|
||||
"a) 最大设计车速大于或等于100 km/h 的机动车:15°\n" +
|
||||
"b) 三轮汽车:35°;\n" +
|
||||
"c) 其他机动车:25° 。\n" +
|
||||
"6.5汽车(三轮汽车除外)应具有适度的不足转向特性。\n" +
|
||||
"6.6三轮汽车、摩托车的转向轮向左或向右转角应小于等于:\n" +
|
||||
"a)\t三轮汽车、三轮摩托车、正三轮轻便摩托车:45°;\n" +
|
||||
"6)\t\t两轮普通摩托车、两轮轻便摩托车:48°。\n" +
|
||||
"6.6机动车在平坦、硬实、干燥和清洁的道路上行驶不应跑偏,其方向盘(或方向把)不应有摆振、路感不灵或其他异常现象。\n" +
|
||||
"6.8机动车在平坦、硬实、干燥和清洁的水泥或沥青道路上行驶,以10 km/h的速度在5 s之内沿螺旋线从直线行驶过渡到外圆直径为25 m的车辆通道圆行驶,施加于方向盘外缘的最大切向力应小于等于245 N。\n" +
|
||||
"6.9专用校车应采用转向助力装置;其他机动车转向轴最大设计轴荷大于4 000 kg时,也应采用转向助力装置。装有转向助力装置的机动车,转向时其转向助力功能不得出现时有时无的现象,且转向助力装置失效时仍应具有用方向盘控制机动车的能力。装有电动转向助力装置的汽车,在产品使用说明书规定的正常使用状态下,应保证转向助力装置的电能供应。\n" +
|
||||
"6.10汽车和汽车列车(不计具有作业功能的专用装置的突出部分)、轮式拖拉机运输机组应能在同一个车辆通道圆内通过,车辆通道圆的外圆直径认为25.00 m,车辆通道圆的内圆直径D2为10.60 m。 汽车和汽车列车、轮式拖拉机运输机组由直线行驶过渡到上述圆周运动时,任何部分超出直线行驶时的 车辆外侧面垂直面的值(外摆值)应小于等于0.80 m(对铰接客车和铰接式无轨电车外摆值应小于等于 1.20 m),其试验方法见GB 1589。\n" +
|
||||
"6.11汽车(三轮汽车除外)的车轮定位应与该车型的技术要求一致。对前轴采用非独立悬架的汽车(前轴采用双转向轴时除外),其转向轮的横向侧滑量,用侧滑台检验时侧滑量值应在±5 m/km之间。\n" +
|
||||
"6.12转向节及臂,转向横、直拉杆及球销不得有裂纹和损伤,并且转向球销不应松旷。对机动车进行改装或修理时横、直拉杆不得拼焊。\n" +
|
||||
"6.13三轮汽车、摩托车的前减振器、上下联板和方向把不应有变形和裂损。\n";
|
||||
String str2 = "6转向系\n" +
|
||||
"6.1汽车(三轮汽车除外)的方向盘应设置于左侧,其他机动车的方向盘不应设置于右侧;专项作业车、教练车按需要可设置左右两个方向盘。装有两个后轮、有驾驶室的正三轮摩托车如使用方向盘转向,则方向盘中心立柱距车辆纵向中心平面的水平距离应小于或等于200 mm ;其他摩托车不应使用方向盘转向。\n" +
|
||||
"6.2机动车的方向盘(或方向把)应转动灵活,无卡滞现象。机动车应设置转向限位装置。转向系统在任何操作位置上,不应与其他部件有干涉现象。\n" +
|
||||
"6.3机动车(摩托车、三轮汽车、手扶拖拉机运输机组除外〉正常行驶时,转向轮转向后应有一定的回正能力(允许有残余角),以使机动车具有稳定的直线行驶能力0\n" +
|
||||
"6.4机动车方向盘的最大自由转动量应小于或等于:\n" +
|
||||
"a) 最大设计车速大于或等于100 km/h 的机动车:15°\n" +
|
||||
"b) 三轮汽车:35°;\n" +
|
||||
"c) 其他机动车:25° 。\n" +
|
||||
"6.5汽车(三轮汽车除外)应具有适度的不足转向特性。\n" +
|
||||
"6.6三轮汽车、摩托车的转向轮向左或向右转角应小于或等于:\n" +
|
||||
"a) 三轮汽车、三轮摩托车、正三轮轻便摩托车:45°;\n" +
|
||||
"b)两轮普通摩托车、两轮轻便摩托车:48°0\n" +
|
||||
"6.7机动车在平坦、硬实、干燥和清洁的道路上行驶不应跑偏,其方向盘(或方向把)不应有摆振等异常现象。\n" +
|
||||
"6.8机动车在平坦、硬实、干燥和清洁的水泥或沥青道路上行驶,以10 km/h 的速度在5 s 之内沿螺旋线从直线行驶过渡到外圆直径为25m 的车辆通道圆行驶,施加于方向盘外缘的最大切向力应小于或等于245 N。\n" +
|
||||
"6.9汽车(三轮汽车除外)的车轮定位应与该车型的技术要求一致。对前轴采用非独立悬架的汽车(前轴采用双转向轴时除外),其转向轮的横向侧滑量,用侧滑台检验时侧滑量值应小于或等于5 m/km。\n" +
|
||||
"6.10 专用校车应采用转向助力装置;其他机动车转向轴最大设计轴荷大于4 000 kg 时,也应采用转向助力装置。装有转向助力装置的机动车,转向时其转向助力功能不应出现时有时无的现象,且转向助力装置失效时仍应具有用方向盘控制机动车的能力。\n" +
|
||||
"6.11转向节及臂,转向横、直拉杆及球销应连接可靠,且不应有裂纹和损伤,并且转向球销不应松旷。对机动车进行改装或修理时横、直拉杆不应拼焊。\n" +
|
||||
"6.12三轮汽车、摩托车的前减振器、上下联板和方向把不应有变形和裂损。";
|
||||
String str3 = "\n" +
|
||||
"5车辆识别代号的标示位置\n" +
|
||||
"5.1每辆车辆都应具有唯一的车辆识别代号,并永久保持地标示在车辆上,同一车辆上标示的所有的 车辆识别代号的字码构成与排列顺序应相同。除第9章规定的情况外,不得对已标示的车辆识别代号 进行变更。\n" +
|
||||
"5.2车辆应在产品标牌上标示车辆识别代号(L1、L3类车辆可除外),产品标牌的型式、标示位置、标示要求应符合GB/T 18411的规定。\n" +
|
||||
"5.3车辆应至少有一个车辆识别代号直接打刻在车架(无车架的车辆为车身主要承载且不能拆卸的部件)能防止锈烛、磨损的部位上。其中:\n" +
|
||||
"a)\tM1类车辆的车辆识别代号应打刻在发动机舱内能防止替换的车辆结构件上,或打刻在车门 立柱上,如受结构限制没有打刻空间时也可打刻在右侧除行李舱外的车辆其他结构件上;\n" +
|
||||
"b)\t最大设计总质量大于或等于12000 kg的货车及所有牵引杆挂车,车辆识别代号应打刻在右前轮纵向中心线前端纵梁外侧,如受结构限制也可打刻在右前轮纵向中心线附近纵梁外侧;\n" +
|
||||
"c)\t半挂车和中置轴挂车的车辆识别代号应打刻在右前支腿前端纵梁外侧(无纵梁车辆除外);\n" +
|
||||
"d)\t其他汽车和无纵梁挂车的车辆识别代号应打刻在车辆右侧前部的车辆结构件上,如受结构限 制也可打刻在右侧其他车辆结构件上。\n" +
|
||||
"打刻车辆识别代号的部件不应采用打磨、挖补、垫片、凿改、重新涂漆(设计和制造上为保护打刻的 车辆识别代号而采取涂漆工艺的情形除外)等方式处理,从上(前)方观察时,打刻区域周边足够大面积 的表面不应有任何覆盖物,如有覆盖物,该覆盖物的表面应明确标示“车辆识别代号”或“VIN”字样,且覆盖物在不使用任何专用工具的情况下能直接取下(或揭开)及复原,以方便地观察到足够大的包括打刻区域的表面。\n" +
|
||||
"注1:打刻区域周边足够大面积的表面(足够大的包括打刻区域的表面)是指打刻车辆识别代号的部件的全部表面,但所暴露表面能满足查看打刻车辆识别代号的部件有无挖补、重新焊接、粘贴等痕迹的需要时,也应视为满足要求。\n" +
|
||||
"注2:对摩托车,打刻的车辆识别代号在不举升车辆的情形下可观察、拓印的,视为满足要求。\n" +
|
||||
"打刻的车辆识别代号从上(前)方应易于观察、拓印,对于汽车和挂车还应能拍照。\n" +
|
||||
"5.4具有电子控制单元的汽车,其至少有一个电子控制单元应不可篡改地存储车辆识别代号。\n" +
|
||||
"5.5 M1、N1类车辆应在靠近风窗立柱的位置标示车辆识别代号,该车辆识别代号在白天不需移动任何部件从车外即能清晰识读。\n" +
|
||||
"5.6除按照5.2、5.3、5.4、5.5规定标示车辆识别代号之外,类车辆还应在行李舱的易见部位标示车辆识别代号;且若车辆制造厂选取车辆识别代号作为车辆及部件识别标记的标识信息,还应按照GB 30509的规定,标示车辆识别代号。\n" +
|
||||
"5.7除按照5.2、5.3、5.4规定标示车辆识别代号之外,最大设计总质量大于或等于12000 kg的栏板式、仓栅式、自卸式、罐式货车及最大设计总质量大于或等于10000 kg的栏板式、仓栅式、自卸式、罐式挂车还应在其货箱或常压罐体(或设计和制造上固定在货箱或常压罐体上且用于与车架连接的结构件)上打刻至少两个车辆识别代号。打刻的车辆识别代号应位于货箱(常压罐体)左、右两侧或前端面且易于拍照;且若打刻在货箱(常压罐体)左、右两侧时,打刻的车辆识别代号距货箱(常压罐体)前端面的距离应小于或等于1 000 mm,若打刻在左、右两侧连接结构件时应尽量靠近货箱(常压罐体)前端面。\n" +
|
||||
"5.8车辆制造厂应至少在一种随车文件中标示车辆识别代号。";
|
||||
|
||||
String str4 = "\n" +
|
||||
"5.3车辆的驱动\n" +
|
||||
"5.3.1车辆不应靠自身动力驱动。\n" +
|
||||
"5.3.2在碰撞瞬间,车辆应不冉承受任何附加转向或驱动装置的作用。\n" +
|
||||
"5.3.3车辆到达壁障的路线在横向任一方向偏离理论轨迹均不应超过150 mm。\n" +
|
||||
"5.4 试验速度\n" +
|
||||
"在碰撞瞬间,车辆速度应为504 km/h。如果试验在更高的碰撞速度下进行并且车辆符合要求,也认为试验合格。\n" +
|
||||
"5.5对前排座椅假人的测量\n" +
|
||||
"5.5.1为确定性能指标必需的所有测量,均应采用符合附录D要求的测量系统。\n" +
|
||||
"5.5.2不同的参数应通过具备下列CFC(通道的频率等级)的独立数据通道来记录。\n" +
|
||||
"5.5.2.1对假人头部的测量\n" +
|
||||
"重心处的加速度(a)由加速度的二维分量计算得出。加速度分量测量时,CFC为1000。\n" +
|
||||
"5.5.2.2对假人颈部的测量\n" +
|
||||
"5.5.2.2.1在头颈连接处测量的轴向张力和前后剪切力,CFC为1000。\n" +
|
||||
"5.5.2.2.2在头颈连接处测量的对Y轴的弯矩,CFC为600。\n" +
|
||||
"5.5.2.3对假人胸部的测量\n" +
|
||||
"胸部变形测量时,CFC为180。\n" +
|
||||
"5.5.2.4对假人大腿的测量\n" +
|
||||
"轴向压缩力测量时,CFC为600。";
|
||||
|
||||
|
||||
double similarity = CompHanLPUtils.findSimilarity(str1, str2);
|
||||
NumberFormat nf = NumberFormat.getPercentInstance();
|
||||
nf.setMaximumIntegerDigits(2);//小数点前保留几位
|
||||
nf.setMinimumFractionDigits(2);// 小数点后保留几位
|
||||
String similarityDegree = nf.format(similarity);
|
||||
System.out.println(similarityDegree);
|
||||
System.out.println("======================================================");
|
||||
double similarity1 = CompHanLPUtils.findSimilarity(str1, str3);
|
||||
System.out.println(similarity1);
|
||||
|
||||
System.out.println("======================================================");
|
||||
double similarity2 = CompHanLPUtils.findSimilarity(str1, str4);
|
||||
System.out.println(similarity2);
|
||||
|
||||
|
||||
System.out.println("======================================================");
|
||||
double similarity3 = CompHanLPUtils.findSimilarity(str3, str4);
|
||||
System.out.println(similarity3);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.jero.modules.compare.utils;
|
||||
|
||||
public class CompareConst {
|
||||
/**
|
||||
* 在对比列表左侧
|
||||
*/
|
||||
public static String POS_LEFT = "LEFT";
|
||||
/**
|
||||
* 在对比列表右侧
|
||||
*/
|
||||
public static String POS_RIGHT = "RIGHT";
|
||||
|
||||
/**
|
||||
* 对比条目没有被评论
|
||||
*/
|
||||
public static int NO_REVIEWED = 0;
|
||||
/**
|
||||
* 对比条目已被评论
|
||||
*/
|
||||
public static int REVIEWED = 1;
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package com.jero.modules.compare.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.CellUtil;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/****
|
||||
* html转excel
|
||||
* @author user
|
||||
*
|
||||
*/
|
||||
public class ConvertHtml2Excel {
|
||||
/**
|
||||
* html表格转excel
|
||||
*
|
||||
* @param tableHtml 如
|
||||
* <table>
|
||||
* ..
|
||||
* </table>
|
||||
* @return
|
||||
*/
|
||||
public static void table2Excel(String tableHtml, HSSFWorkbook wb,String tableSheetName) {
|
||||
HSSFSheet sheet = wb.createSheet(tableSheetName);
|
||||
List<CrossRangeCellMeta> crossRowEleMetaLs = new ArrayList<CrossRangeCellMeta>();
|
||||
int rowIndex = 0;
|
||||
try {
|
||||
Document data = DocumentHelper.parseText(tableHtml);
|
||||
// 生成表头
|
||||
Element thead = data.getRootElement().element("thead");
|
||||
HSSFCellStyle titleStyle = getTitleStyle(wb);
|
||||
int ls=0;//列数
|
||||
if (thead != null) {
|
||||
List<Element> trLs = thead.elements("tr");
|
||||
for (Element trEle : trLs) {
|
||||
HSSFRow row = sheet.createRow(rowIndex);
|
||||
List<Element> thLs = trEle.elements("th");
|
||||
ls=thLs.size();
|
||||
makeRowCell(thLs, rowIndex, row, 0, titleStyle, crossRowEleMetaLs);
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
// 生成表体
|
||||
Element tbody = data.getRootElement().element("tbody");
|
||||
HSSFCellStyle contentStyle = getContentStyle(wb);
|
||||
if (tbody != null) {
|
||||
List<Element> trLs = tbody.elements("tr");
|
||||
for (Element trEle : trLs) {
|
||||
HSSFRow row = sheet.createRow(rowIndex);
|
||||
List<Element> thLs = trEle.elements("th");
|
||||
int cellIndex = makeRowCell(thLs, rowIndex, row, 0, titleStyle, crossRowEleMetaLs);
|
||||
List<Element> tdLs = trEle.elements("td");
|
||||
makeRowCell(tdLs, rowIndex, row, cellIndex, contentStyle, crossRowEleMetaLs);
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
// 合并表头
|
||||
for (CrossRangeCellMeta crcm : crossRowEleMetaLs) {
|
||||
sheet.addMergedRegion(new CellRangeAddress(crcm.getFirstRow(), crcm.getLastRow(), crcm.getFirstCol(), crcm.getLastCol()));
|
||||
setRegionStyle(sheet, new CellRangeAddress(crcm.getFirstRow(), crcm.getLastRow(), crcm.getFirstCol(), crcm.getLastCol()),contentStyle);
|
||||
}
|
||||
for(int i=0;i<ls;i++){
|
||||
sheet.autoSizeColumn(i, true);//设置列宽
|
||||
}
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产行内容
|
||||
*
|
||||
* @return 最后一列的cell index
|
||||
*/
|
||||
/**
|
||||
* @param tdLs th或者td集合
|
||||
* @param rowIndex 行号
|
||||
* @param row POI行对象
|
||||
* @param startCellIndex
|
||||
* @param cellStyle 样式
|
||||
* @param crossRowEleMetaLs 跨行元数据集合
|
||||
* @return
|
||||
*/
|
||||
private static int makeRowCell(List<Element> tdLs, int rowIndex, HSSFRow row, int startCellIndex, HSSFCellStyle cellStyle,
|
||||
List<CrossRangeCellMeta> crossRowEleMetaLs) {
|
||||
int i = startCellIndex;
|
||||
for (int eleIndex = 0; eleIndex < tdLs.size(); i++, eleIndex++) {
|
||||
int captureCellSize = getCaptureCellSize(rowIndex, i, crossRowEleMetaLs);
|
||||
while (captureCellSize > 0) {
|
||||
for (int j = 0; j < captureCellSize; j++) {// 当前行跨列处理(补单元格)
|
||||
row.createCell(i);
|
||||
i++;
|
||||
}
|
||||
captureCellSize = getCaptureCellSize(rowIndex, i, crossRowEleMetaLs);
|
||||
}
|
||||
Element thEle = tdLs.get(eleIndex);
|
||||
String val = thEle.getTextTrim();
|
||||
if (StringUtils.isBlank(val)) {
|
||||
Element e = thEle.element("a");
|
||||
if (e != null) {
|
||||
val = e.getTextTrim();
|
||||
}
|
||||
}
|
||||
HSSFCell c = row.createCell(i);
|
||||
if (NumberUtils.isNumber(val)) {
|
||||
c.setCellValue(Double.parseDouble(val));
|
||||
c.setCellType(CellType.NUMERIC);
|
||||
} else {
|
||||
c.setCellValue(val);
|
||||
}
|
||||
int rowSpan = NumberUtils.toInt(thEle.attributeValue("rowspan"), 1);
|
||||
int colSpan = NumberUtils.toInt(thEle.attributeValue("colspan"), 1);
|
||||
c.setCellStyle(cellStyle);
|
||||
if (rowSpan > 1 || colSpan > 1) { // 存在跨行或跨列
|
||||
crossRowEleMetaLs.add(new CrossRangeCellMeta(rowIndex, i, rowSpan, colSpan));
|
||||
}
|
||||
if (colSpan > 1) {// 当前行跨列处理(补单元格)
|
||||
for (int j = 1; j < colSpan; j++) {
|
||||
i++;
|
||||
row.createCell(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置合并单元格的边框样式
|
||||
*
|
||||
* @param sheet
|
||||
* @param region
|
||||
* @param cs
|
||||
*/
|
||||
public static void setRegionStyle(HSSFSheet sheet, CellRangeAddress region, HSSFCellStyle cs) {
|
||||
for (int i = region.getFirstRow(); i <= region.getLastRow(); i++) {
|
||||
Row row = CellUtil.getRow(i, sheet);
|
||||
for (int j = region.getFirstColumn(); j <= region.getLastColumn(); j++) {
|
||||
Cell cell = CellUtil.getCell(row, (short) j);
|
||||
cell.setCellStyle(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得因rowSpan占据的单元格
|
||||
*
|
||||
* @param rowIndex 行号
|
||||
* @param colIndex 列号
|
||||
* @param crossRowEleMetaLs 跨行列元数据
|
||||
* @return 当前行在某列需要占据单元格
|
||||
*/
|
||||
private static int getCaptureCellSize(int rowIndex, int colIndex, List<CrossRangeCellMeta> crossRowEleMetaLs) {
|
||||
int captureCellSize = 0;
|
||||
for (CrossRangeCellMeta crossRangeCellMeta : crossRowEleMetaLs) {
|
||||
if (crossRangeCellMeta.getFirstRow() < rowIndex && crossRangeCellMeta.getLastRow() >= rowIndex) {
|
||||
if (crossRangeCellMeta.getFirstCol() <= colIndex && crossRangeCellMeta.getLastCol() >= colIndex) {
|
||||
captureCellSize = crossRangeCellMeta.getLastCol() - colIndex + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return captureCellSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得标题样式
|
||||
*
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle getTitleStyle(HSSFWorkbook workbook) {
|
||||
short titlebackgroundcolor = HSSFColor.HSSFColorPredefined.GREY_25_PERCENT.getIndex();
|
||||
short fontSize = 12;
|
||||
String fontName = "宋体";
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
style.setBorderLeft(BorderStyle.THIN);//左边框
|
||||
style.setBorderTop(BorderStyle.THIN);//上边框
|
||||
style.setBorderRight(BorderStyle.THIN);//右边框
|
||||
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
style.setFillForegroundColor(titlebackgroundcolor);// 背景色
|
||||
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setFontName(fontName);
|
||||
font.setFontHeightInPoints(fontSize);
|
||||
font.setBold(true);
|
||||
style.setFont(font);
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得内容样式
|
||||
*
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle getContentStyle(HSSFWorkbook wb) {
|
||||
short fontSize = 12;
|
||||
String fontName = "宋体";
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
HSSFFont font = wb.createFont();
|
||||
font.setFontName(fontName);
|
||||
font.setFontHeightInPoints(fontSize);
|
||||
style.setFont(font);
|
||||
style.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
|
||||
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jero.modules.compare.utils;
|
||||
|
||||
public class CrossRangeCellMeta {
|
||||
|
||||
public CrossRangeCellMeta(int firstRowIndex, int firstColIndex, int rowSpan, int colSpan) {
|
||||
super();
|
||||
this.firstRowIndex = firstRowIndex;
|
||||
this.firstColIndex = firstColIndex;
|
||||
this.rowSpan = rowSpan;
|
||||
this.colSpan = colSpan;
|
||||
}
|
||||
|
||||
private int firstRowIndex;
|
||||
private int firstColIndex;
|
||||
private int rowSpan;// 跨越行数
|
||||
private int colSpan;// 跨越列数
|
||||
|
||||
public int getFirstRow() {
|
||||
return firstRowIndex;
|
||||
}
|
||||
|
||||
public int getLastRow() {
|
||||
return firstRowIndex + rowSpan - 1;
|
||||
}
|
||||
|
||||
public int getFirstCol() {
|
||||
return firstColIndex;
|
||||
}
|
||||
|
||||
public int getLastCol() {
|
||||
return firstColIndex + colSpan - 1;
|
||||
}
|
||||
|
||||
public int getColSpan(){
|
||||
return colSpan;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+21
@@ -0,0 +1,21 @@
|
||||
package com.jero.modules.compare.utils.treeTool;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* List 排序 Comparator
|
||||
* @author david
|
||||
*/
|
||||
public class OrdNamComparator implements Comparator<TreeNode> {
|
||||
|
||||
@Override
|
||||
public int compare(TreeNode t1, TreeNode t2) {
|
||||
if (t1.getOrderNum() > t2.getOrderNum()) {
|
||||
return 1;
|
||||
}
|
||||
if (t1.getOrderNum() < t2.getOrderNum()) {
|
||||
return -1;
|
||||
}
|
||||
return t1.getNodeName().compareTo(t2.getNodeName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.jero.modules.compare.utils.treeTool;
|
||||
|
||||
import com.jero.modules.compare.utils.treeTool.annotation.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 构建树形建构
|
||||
*
|
||||
* @author David
|
||||
*/
|
||||
public class Tree<T> {
|
||||
/**
|
||||
* 用于存放treeNode的Map
|
||||
*/
|
||||
private LinkedHashMap<String, TreeNode> treeNodesMap = new LinkedHashMap<>();
|
||||
/**
|
||||
* 用于存放treeNode的list
|
||||
*/
|
||||
private List<TreeNode> treeNodesList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
public Tree(List<T> list) {
|
||||
initTreeNodeMap(list);
|
||||
initTreeNodeList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将List对象数据转为TreeNodeMap
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
private void initTreeNodeMap(List<T> list) {
|
||||
TreeNode treeNode;
|
||||
for (Object item : list) {
|
||||
treeNode = new TreeNode();
|
||||
treeNode.setNodeId(getFieldValue(item, "TreeNodeId"));
|
||||
treeNode.setNodeName(getFieldValue(item, "TreeNodeName"));
|
||||
treeNode.setParentNodeId(getFieldValue(item, "TreeNodeParentId"));
|
||||
if(StringUtils.isEmpty(getFieldValue(item, "TreeNodeLevel"))) {
|
||||
treeNode.setLevel(0);
|
||||
} else {
|
||||
treeNode.setLevel(Integer.parseInt(getFieldValue(item, "TreeNodeLevel")));
|
||||
}
|
||||
if(StringUtils.isEmpty(getFieldValue(item, "TreeNodeOrder"))) {
|
||||
treeNode.setOrderNum(0);
|
||||
} else {
|
||||
treeNode.setOrderNum(Integer.parseInt(getFieldValue(item, "TreeNodeOrder")));
|
||||
}
|
||||
treeNode.setLastNodeNum(1);
|
||||
treeNode.setData(item);
|
||||
treeNodesMap.put(treeNode.getNodeId(), treeNode);
|
||||
}
|
||||
Iterator<TreeNode> iterator = treeNodesMap.values().iterator();
|
||||
TreeNode parentTreeNode;
|
||||
while (iterator.hasNext()) {
|
||||
treeNode = iterator.next();
|
||||
if (StringUtils.isEmpty(treeNode.getParentNodeId())) {
|
||||
continue;
|
||||
}
|
||||
parentTreeNode = treeNodesMap.get(treeNode.getParentNodeId());
|
||||
if (parentTreeNode != null) {
|
||||
treeNode.setParent(parentTreeNode);
|
||||
parentTreeNode.addChild(treeNode);
|
||||
// 按照orderNum排序
|
||||
Collections.sort(parentTreeNode.getChildren(), new OrdNamComparator());
|
||||
// 判断这个节点是否是最子节点
|
||||
if (treeNode.getChildren().size() == 0) {
|
||||
treeNode.setLastNode(true);
|
||||
}
|
||||
// 计算每一个节点的最子节点的数量
|
||||
List<TreeNode> children = parentTreeNode.getChildren();
|
||||
if (children.size() > 0) {
|
||||
int sum = 0;
|
||||
for (TreeNode treeNode2 : children) {
|
||||
sum += treeNode2.getLastNodeNum();
|
||||
}
|
||||
parentTreeNode.setLastNodeNum(sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getFieldValue(Object obj, String type) {
|
||||
Class clz = obj.getClass();
|
||||
Field[] fields = clz.getDeclaredFields();
|
||||
String value = null;
|
||||
try {
|
||||
for(Field field : fields){
|
||||
field.setAccessible(true);
|
||||
switch (type){
|
||||
case "TreeNodeId":
|
||||
if(field.isAnnotationPresent(TreeNodeId.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
case "TreeNodeParentId":
|
||||
if(field.isAnnotationPresent(TreeNodeParentId.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
case "TreeNodeName":
|
||||
if(field.isAnnotationPresent(TreeNodeName.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
case "TreeNodeOrder":
|
||||
if(field.isAnnotationPresent(TreeNodeOrder.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
case "TreeNodeLevel":
|
||||
if(field.isAnnotationPresent(TreeNodeLevel.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据treeNodesMap转为treeNodesList
|
||||
*/
|
||||
private void initTreeNodeList() {
|
||||
if (treeNodesList.size() > 0) {
|
||||
return;
|
||||
}
|
||||
if (treeNodesMap.size() == 0) {
|
||||
return;
|
||||
}
|
||||
Iterator<TreeNode> iterator = treeNodesMap.values().iterator();
|
||||
TreeNode treeNode;
|
||||
while (iterator.hasNext()) {
|
||||
treeNode = iterator.next();
|
||||
if (treeNode.getParent() == null) {
|
||||
this.treeNodesList.add(treeNode);
|
||||
this.treeNodesList.addAll(treeNode.getAllChildren());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<TreeNode> getTree() {
|
||||
return this.treeNodesList;
|
||||
}
|
||||
|
||||
public List<TreeNode> getRoot() {
|
||||
List<TreeNode> rootList = new ArrayList<>();
|
||||
if (this.treeNodesList.size() > 0) {
|
||||
for (TreeNode node : treeNodesList) {
|
||||
if (node.getParent() == null) {
|
||||
rootList.add(node);
|
||||
Collections.sort(rootList, new OrdNamComparator());
|
||||
}
|
||||
}
|
||||
}
|
||||
return rootList;
|
||||
}
|
||||
|
||||
public TreeNode getTreeNode(String nodeId) {
|
||||
return this.treeNodesMap.get(nodeId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.jero.modules.compare.utils.treeTool;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author David
|
||||
*/
|
||||
public class TreeNode {
|
||||
|
||||
/**
|
||||
* 树节点ID
|
||||
*/
|
||||
@JSONField(ordinal = 1)
|
||||
private String nodeId;
|
||||
/**
|
||||
* 树节点名称
|
||||
*/
|
||||
@JSONField(ordinal = 2)
|
||||
private String nodeName;
|
||||
/**
|
||||
* 父节点ID
|
||||
*/
|
||||
@JSONField(ordinal = 3)
|
||||
private String parentNodeId;
|
||||
/**
|
||||
* 节点在树中的排序号
|
||||
*/
|
||||
@JSONField(ordinal = 4)
|
||||
private int orderNum;
|
||||
/**
|
||||
* 节点所在的层级
|
||||
*/
|
||||
@JSONField(ordinal = 5)
|
||||
private int level;
|
||||
/**
|
||||
* 最子节点的数量
|
||||
*/
|
||||
@JSONField(ordinal = 6)
|
||||
private int lastNodeNum;
|
||||
|
||||
/**
|
||||
* 是否是最子节点
|
||||
*/
|
||||
@JSONField(ordinal = 7)
|
||||
private boolean lastNode;
|
||||
|
||||
private Object data;
|
||||
|
||||
/**
|
||||
* 当前节点的儿子节点
|
||||
*/
|
||||
@JSONField(ordinal = 8)
|
||||
private List<TreeNode> children = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 当前节点的完整路径
|
||||
*/
|
||||
@JSONField(ordinal = 9)
|
||||
private String completeName;
|
||||
|
||||
/**
|
||||
* 当前节点的父级节点
|
||||
* 转json的时候忽略此属性,因为此属性到前端无作用
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private TreeNode parent;
|
||||
|
||||
/**
|
||||
* 当前节点的子孙节点
|
||||
* 转json的时候忽略此属性,因为此属性到前端无作用
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private List<TreeNode> allChildren = new ArrayList<>();
|
||||
|
||||
private int standFlag;
|
||||
|
||||
public TreeNode(TreeNode obj) {
|
||||
this.orderNum = obj.getOrderNum();
|
||||
this.level = obj.getLevel();
|
||||
this.lastNodeNum = obj.getLastNodeNum();
|
||||
}
|
||||
|
||||
public TreeNode() {
|
||||
}
|
||||
|
||||
public void addChild(TreeNode treeNode) {
|
||||
this.children.add(treeNode);
|
||||
}
|
||||
|
||||
public void removeChild(TreeNode treeNode) {
|
||||
this.children.remove(treeNode);
|
||||
}
|
||||
|
||||
public String getNodeId() {
|
||||
return nodeId;
|
||||
}
|
||||
|
||||
public void setNodeId(String nodeId) {
|
||||
this.nodeId = nodeId;
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public String getParentNodeId() {
|
||||
return parentNodeId;
|
||||
}
|
||||
|
||||
public void setParentNodeId(String parentNodeId) {
|
||||
this.parentNodeId = parentNodeId;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public TreeNode getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(TreeNode parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List<TreeNode> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<TreeNode> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public int getOrderNum() {
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(int orderNum) {
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
public int getLastNodeNum() {
|
||||
return lastNodeNum;
|
||||
}
|
||||
|
||||
public void setLastNodeNum(int lastNodeNum) {
|
||||
this.lastNodeNum = lastNodeNum;
|
||||
}
|
||||
|
||||
public boolean isLastNode() {
|
||||
return lastNode;
|
||||
}
|
||||
|
||||
public void setLastNode(boolean lastNode) {
|
||||
this.lastNode = lastNode;
|
||||
}
|
||||
|
||||
public List<TreeNode> getAllChildren() {
|
||||
if (this.allChildren.isEmpty()) {
|
||||
for (TreeNode treeNode : this.children) {
|
||||
this.allChildren.add(treeNode);
|
||||
this.allChildren.addAll(treeNode.getAllChildren());
|
||||
}
|
||||
}
|
||||
return this.allChildren;
|
||||
}
|
||||
|
||||
public String getCompleteName() {
|
||||
return completeName;
|
||||
}
|
||||
|
||||
public void setCompleteName(String completeName) {
|
||||
this.completeName = completeName;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getStandFlag() {
|
||||
return standFlag;
|
||||
}
|
||||
|
||||
public void setStandFlag(int standFlag) {
|
||||
this.standFlag = standFlag;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeId {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeLevel {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeName {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeOrder {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeParentId {
|
||||
}
|
||||
Reference in New Issue
Block a user