Merge branch 'dev_2nd_period_test' into 'feature_dev_20221008_TODO'

# Conflicts:
#   jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/ParamsCollectManifestEOMapper.java
#   jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/mapper/xml/ParamsManifestEOMapper.xml
This commit is contained in:
787203167
2022-11-03 14:41:16 +08:00
224 changed files with 15471 additions and 3963 deletions
@@ -19,6 +19,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
@@ -530,6 +531,25 @@ public class ParamsCollectManifestEOController extends JeroController<ParamsColl
paramsCollectManifestEOService.exportAll(paramsCollectManifestVO, response, request);
}
@ApiOperation(value = "参数项收集清单-填写人角色下导出")
@GetMapping(value = "/exportDre")
// @RequiresPermissions("report:detail:export:normal")
public void exportDre(ParamsCollectManifestVO paramsCollectManifestVO,
HttpServletResponse response,
HttpServletRequest request) {
paramsCollectManifestEOService.exportDre(paramsCollectManifestVO, response, request);
}
@AutoLog(value = "参数项收集清单-填写人角色下导入")
@ApiOperation(value = "参数项收集清单-填写人角色下导入")
@PostMapping(value = "/importDre")
// @RequiresPermissions("report:detail:export:normal")
public Result<?> importParamsInfo( MultipartFile file,
@RequestParam(value = "cut") String cut,
@RequestParam(value = "paramsManifestId") String paramsManifestId) throws Exception {
return paramsCollectManifestEOService.importDre(file, cut, paramsManifestId);
}
/**
* 调整责任领域
*
@@ -2,14 +2,17 @@ package com.jero.modules.cert.collect.entity;
import com.baomidou.mybatisplus.annotation.TableField;
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;
/**
@@ -41,6 +44,12 @@ public class ParamsCollectManifestEO extends ParamsCollectManifestBaseEO impleme
@ApiModelProperty(value = "添加标识")
private String addFlag;
/**同步上报库时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "同步上报库时间")
private Date reportTime;
@TableField(exist = false)
private String userTypes;
@@ -1,12 +1,16 @@
package com.jero.modules.cert.collect.entity;
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.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
@@ -22,4 +26,9 @@ import java.io.Serializable;
@ApiModel(value="params_collect_manifest_history对象", description="参数项收集清单历史版本")
public class ParamsCollectManifestHistoryEO extends ParamsCollectManifestBaseEO implements Serializable {
/**同步上报库时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "同步上报库时间")
private Date reportTime;
}
@@ -103,4 +103,10 @@ public class ParamsManifestEO implements Serializable {
@TableField(exist = false)
private String projectName;
//相关项目版本
private String projectVersion;
//说明
private String explanation;
}
@@ -19,11 +19,13 @@ public interface ParamsCollectManifestEOMapper extends BaseMapper<ParamsCollectM
List<ParamsCollectManifestEO> listInfo(@Param("paramsCollectManifestEO") ParamsCollectManifestEO paramsCollectManifestEO);
List<ParamsCollectManifestEO> listInfoOfTodoCenter(@Param("manifestIdList") List<String> manifestIdList);
List<Map<String, Object>> listInfoForExport(@Param("paramsCollectManifestEO") ParamsCollectManifestEO paramsCollectManifestEO);
List<Map<String, Object>> listInfoForExport(@Param("paramsCollectManifestEO") ParamsCollectManifestEO paramsCollectManifestEO, @Param("ids") String ids);
List<ParamsCollectManifestEO> listInfoOfTodoCenter();
// 查询控件类型为 标题的 参数项
List<ParamsCollectManifestEO> listInfoOfTitle(@Param("paramsManifestId") String paramsManifestId);
IPage pageInfo(@Param("page") IPage page, @Param("paramsCollectManifestEO") ParamsCollectManifestEO paramsCollectManifestEO);
}
List<ParamsCollectManifestEO> queryByParamManifestId(@Param("paramsManifestId") String paramsManifestIdString);
}
@@ -30,6 +30,7 @@
<result column="del_flag" property="delFlag" />
<result column="add_flag" property="addFlag" />
<result column="title_default_value" property="titleDefaultValue" />
<result column="report_time" property="reportTime" />
</resultMap>
<sql id="BaseQuerySql">
<where>
@@ -50,7 +51,10 @@
AND duty_territory = #{paramsCollectManifestEO.dutyTerritory}
</if>
<if test="paramsCollectManifestEO.state !=null and paramsCollectManifestEO.state !=''">
AND state = #{paramsCollectManifestEO.state}
AND state in
<foreach collection="paramsCollectManifestEO.state.split(',')" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="paramsCollectManifestEO.paramsManifestId !=null and paramsCollectManifestEO.paramsManifestId !=''">
AND params_manifest_id = #{paramsCollectManifestEO.paramsManifestId}
@@ -92,6 +96,12 @@
select *
from params_collect_manifest
<include refid="BaseQuerySql"/>
<if test="ids !=null and ids !=''">
AND id in
<foreach collection="ids.split(',')" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and control_type != '11'
order by del_flag desc, add_flag desc, change_flag desc, nio_number asc
</select>
@@ -111,4 +121,8 @@
order by del_flag desc, add_flag desc, change_flag desc, nio_number asc
</select>
</mapper>
<select id="queryByParamManifestId" resultMap="ParamsCollectManifestEOResultMap">
select * from params_collect_manifest where params_manifest_id = #{paramsManifestId}
</select>
</mapper>
@@ -27,6 +27,7 @@
<result column="deadline" property="deadline" />
<result column="params_manifest_id" property="paramsManifestId" />
<result column="title_default_value" property="titleDefaultValue" />
<result column="report_time" property="reportTime" />
</resultMap>
<sql id="BaseQuerySql">
<where>
@@ -16,6 +16,8 @@
<result column="params_template_id" property="paramsTemplateId" />
<result column="params_template_publish_version" property="paramsTemplatePublishVersion" />
<result column="params_template_name" property="paramsTemplateName" />
<result column="project_version" property="projectVersion" />
<result column="explanation" property="explanation" />
</resultMap>
<resultMap id="ParamsManifestEOResultMapForCopy" type="com.jero.modules.cert.collect.vo.ParamsManifestVO">
<id column="id" property="id" />
@@ -27,6 +29,8 @@
<result column="params_template_name" property="paramsTemplateName" />
<result column="params_template_id" property="paramsTemplateId" />
<result column="params_template_publish_version" property="paramsTemplatePublishVersion" />
<result column="project_version" property="projectVersion" />
<result column="explanation" property="explanation" />
</resultMap>
<sql id="BaseColumnList">
@@ -43,6 +47,8 @@
pm.project_id as project_id,
pm.params_template_id as params_template_id,
pm.params_template_publish_version as params_template_publish_version,
pm.project_version as project_version,
pm.explanation as explanation,
if (pt.params_template_name is not null, pt.params_template_name, pm.params_template_name) as params_template_name
</sql>
@@ -158,7 +164,7 @@
select tmp_tb.* from(
select
plb.id as project_id,
concat(pni.project_name,'-',pyni.year_name,' ',target_market) as project_name
concat(pni.project_name,'-',pyni.year_name,'-',target_market,'-',project_version) as project_name
from project_library_base plb
left join project_name_info as pni on plb.project_name_id = pni.id
left join project_year_name_info as pyni on plb.year_name_id = pyni.id
@@ -2,11 +2,14 @@ package com.jero.modules.cert.collect.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.common.api.vo.Result;
import com.jero.modules.cert.collect.entity.ParamsCollectManifestEO;
import com.jero.modules.cert.collect.vo.ParamsCollectManifestVO;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -162,6 +165,21 @@ public interface IParamsCollectManifestEOService extends IService<ParamsCollectM
// 全部导出
void exportAll(ParamsCollectManifestVO paramsCollectManifestVO, HttpServletResponse response, HttpServletRequest request);
// 填写人角色下的导出
void exportDre(ParamsCollectManifestVO paramsCollectManifestVO, HttpServletResponse response, HttpServletRequest request);
// 填写人角色下导入
Result<?> importDre(MultipartFile file, String cut, String paramsManifestId) throws IOException;
Result<?> importData(List<Map<String, Object>> dataList,
String unzipfilepath,
String cut,
String paramsManifestId) throws IOException;
// 调整责任领域
List<String> updateBatchDutyTerritory(ParamsCollectManifestVO paramsCollectManifestVO);
//监控参数收集任务的截止时间,并根据时间段发送飞书
void checkDeadline();
}
@@ -524,7 +524,7 @@ public class ParamsCollectManifestHistoryEOServiceImpl extends ServiceImpl<Param
if (Date.class.equals(field.getType())) {
Date date = (Date) o;
String pattern = "";
if ("deadline".equals(varName)) {
if ("deadline".equals(varName) || "reportTime".equals(varName)) {
pattern = "yyyy-MM-dd";
} else {
pattern = "yyyy-MM-dd HH:mm:ss";
@@ -59,6 +59,14 @@ public class ParamsConfigEOServiceImpl extends ServiceImpl<ParamsConfigEOMapper,
public void addBatch(ParamsConfigVO paramsConfigVO) {
String paramsManifestId = paramsConfigVO.getParamsManifestId();
List<ParamsConfigEO> paramsConfigEOList = paramsConfigVO.getParamsConfigEOList();
int count = (int) paramsConfigEOList.stream().map(ParamsConfigEO::getConfigName).distinct().count();
if (count < paramsConfigEOList.size()) {
if (CutEnum.CN.getValue().equals(paramsConfigVO.getCut())) {
throw new JeroBootException("配置名称不能重复!");
} else {
throw new JeroBootException("Configuration Name cannot be duplicated!");
}
}
int ind = 1;
List<ParamsConfigEO> addConfigList = new ArrayList<>(); // 新增的配置
@@ -187,6 +187,8 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
ParamsManifestEO updateEO = new ParamsManifestEO();
updateEO.setId(paramsManifestEO.getId());
updateEO.setTitle(paramsManifestEO.getTitle());
updateEO.setProjectVersion(paramsManifestEO.getProjectVersion());
updateEO.setExplanation(paramsManifestEO.getExplanation());
Date now = new Date();
updateEO.setUpdateTime(now);
return updateById(updateEO);
@@ -691,7 +693,7 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
// 统计清单参数
ParamsCollectManifestEO paramsCollectManifestEO = new ParamsCollectManifestEO();
paramsCollectManifestEO.setParamsManifestId(paramsManifestId);
List<Map<String, Object>> listAll = paramsCollectManifestEOMapper.listInfoForExport(paramsCollectManifestEO);
List<Map<String, Object>> listAll = paramsCollectManifestEOMapper.listInfoForExport(paramsCollectManifestEO, null);
// 循环责任领域,计算每个责任领域中的四种状态数据
for (DictModel item : dutyTerritoryDictList) {
@@ -0,0 +1,30 @@
package com.jero.modules.cert.collect.task;
import com.jero.modules.cert.collect.service.IParamsCollectManifestEOService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class ScheduledTask {
@Autowired
private IParamsCollectManifestEOService paramsCollectManifestEOServicea;
/**
* 监控参数收集任务的截止时间,并根据时间段发送飞书
*/
//@Scheduled(cron = "0 30 14 * * ?")
@Scheduled(cron = "0 0 0 */1 * ?")
public void checkTime() {
log.info("-----checkDeadline-----begin-----------");
paramsCollectManifestEOServicea.checkDeadline();
log.info("-----checkDeadline------end-----------");
}
}
@@ -24,4 +24,10 @@ public class ParamsManifestVO {
private String ids;
private String cut;
private String sourceManifestId;
//相关项目版本
private String projectVersion;
//说明
private String explanation;
}
@@ -1263,6 +1263,9 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
}
List<String> configIdList = Arrays.asList(paramsReportDetailVO.getConfigIds().split(",")); // 需要导出的配置列
List<Map<String, Object>> dataList = paramsReportDetailEOMapper.listInfoForExport(idList, paramsReportDetailVO); // 查询需要导出的数据
dataList = dataList.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(p -> (String) p.get("id")))),
ArrayList::new)); // 去重
List<ParamsReportConfigEO> paramsConfigEOList = paramsReportConfigEOService.queryList(paramsReportDetailVO.getParamsManifestId()); // 查询所有配置列
@@ -70,4 +70,18 @@ public enum ControlTypeEnum {
}
return map;
}
public static Map<String,String> toMapForExport(String cut){
Map<String,String> map = new HashMap<>();
if (CutEnum.CN.getValue().equals(cut)) {
for (ControlTypeEnum controlTypeEnum : ControlTypeEnum.values()) {
map.put(controlTypeEnum.getValue(), controlTypeEnum.getName());
}
} else if (CutEnum.EN.getValue().equals(cut)) {
for (ControlTypeEnum controlTypeEnum : ControlTypeEnum.values()) {
map.put(controlTypeEnum.getValue(), controlTypeEnum.getEnName());
}
}
return map;
}
}
@@ -68,4 +68,18 @@ public enum ControlVerifyEnum {
}
return map;
}
public static Map<String,String> toMapForExport(String cut){
Map<String,String> map = new HashMap<>();
if (CutEnum.CN.getValue().equals(cut)) {
for (ControlVerifyEnum controlVerifyEnum : ControlVerifyEnum.values()) {
map.put(controlVerifyEnum.getValue(), controlVerifyEnum.getName());
}
} else if (CutEnum.EN.getValue().equals(cut)) {
for (ControlVerifyEnum controlVerifyEnum : ControlVerifyEnum.values()) {
map.put(controlVerifyEnum.getValue(), controlVerifyEnum.getEnName());
}
}
return map;
}
}
@@ -62,4 +62,18 @@ public enum ParamsIsMustEnum {
return map;
}
public static Map<String,String> toMapForExport(String cut){
Map<String,String> map = new HashMap<>();
if (CutEnum.CN.getValue().equals(cut)) {
for (ParamsIsMustEnum paramsIsMustEnum : ParamsIsMustEnum.values()) {
map.put(paramsIsMustEnum.getValue(), paramsIsMustEnum.getName());
}
} else if (CutEnum.EN.getValue().equals(cut)) {
for (ParamsIsMustEnum paramsIsMustEnum : ParamsIsMustEnum.values()) {
map.put(paramsIsMustEnum.getValue(), paramsIsMustEnum.getEnName());
}
}
return map;
}
}
@@ -8,8 +8,10 @@ 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;
@@ -78,4 +80,20 @@ public class SarFileCompareResultVO {
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;
}
}
@@ -2,23 +2,26 @@ 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.CutEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.oss.CosBootUtil;
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.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.common.usermodel.HyperlinkType;
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.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -27,6 +30,7 @@ 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;
@@ -34,8 +38,7 @@ import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.List;
/**
* @Description: 文档对比信息条款评论表
@@ -44,6 +47,7 @@ import java.util.regex.Pattern;
* @Version: V1.0
*/
@Service
@Slf4j
public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCompareItemCommentMapper, SarFileCompareItemComment> implements ISarFileCompareItemCommentService {
@Autowired
@@ -100,7 +104,29 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
*/
@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);
}
}
/**
@@ -142,8 +168,10 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
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);
@@ -179,7 +207,11 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
public List<SarFileCompareItemComment> queryListByInfoId(String infoId,String comment) {
LambdaQueryWrapper<SarFileCompareItemComment> queryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtils.isNotEmpty(comment)) {
queryWrapper.eq(SarFileCompareItemComment::getComment, 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);
@@ -200,7 +232,11 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
queryWrapper.in(SarFileCompareItemComment::getId, Arrays.asList(selectIds.split(",")));
}
if (ObjectUtils.isNotEmpty(comment)) {
queryWrapper.eq(SarFileCompareItemComment::getComment, 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);
@@ -211,14 +247,16 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
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";
@@ -253,6 +291,12 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
sheet.setColumnWidth(i, columnWidth[i]);
}
}
//超链接样式
CellStyle cellStyleLink =workbook.createCellStyle();
HSSFFont font = ((HSSFWorkbook) workbook).createFont();
font.setColor(HSSFColor.LIGHT_BLUE.index);
cellStyleLink.setFont(font);
cellStyleLink.setWrapText(true);
int i = 1;
//记录需要合并的单元格
List<SarFileCompareExcelMergeCell> mergeCells = new ArrayList<>();
@@ -270,76 +314,39 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
row.createCell(1).setCellValue(itemLeft.getItemsNum());
row.createCell(2).setCellValue(itemLeft.getItemsName());
String text = itemLeft.getItemsText();
text = text.replace("<p>", "").replace("</p>", "\r\n");
BufferedImage bufferImg = null;
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
addImgdata(text,request.getSession());
String rowDataAndPath = (String) request.getSession().getAttribute("txtAndImg");
leftSplit = rowDataAndPath.split("---");
if (leftSplit.length > 1) {
for (int j = 0; j < leftSplit.length; j++) {
if (j > 0) {
Row row2 = sheet.createRow(j + i);
if (leftSplit[j].contains(".jpg") || leftSplit[j].contains(".png")) {
row2.setHeight((short) 5000); //设置行高
//先将图片下载到本地
String fileLastName = leftSplit[j].substring(leftSplit[j].lastIndexOf("/") + 1);
if (CosBootUtil.doesObjectExist(leftSplit[j])) {
try (InputStream in = CosBootUtil.download(leftSplit[j])) {
copyFile2(in, dir + File.separator + fileLastName);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
if (StringUtils.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("-------------- 左侧图片、表格 处理成功 -----------------");
}
File file = new File(dir + File.separator + fileLastName);
if (file.exists()) {
bufferImg = ImageIO.read(file);
ImageIO.write(bufferImg, "jpg", byteArrayOut);
//anchor主要用于设置图片的属性
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 200, (short) 3, j + i, (short) 3, j + i);
patriarch.createPicture(anchor, workbook.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
}
} else {
row2.createCell(3).setCellValue(leftSplit[j]);
}
} else {
if (leftSplit[j].contains(".jpg") || leftSplit[j].contains(".png")) {
row.setHeight((short) 5000); //设置行高
//先将图片下载到本地
String fileLastName = leftSplit[j].substring(leftSplit[j].lastIndexOf("/") + 1);
if (CosBootUtil.doesObjectExist(leftSplit[j])) {
try (InputStream in = CosBootUtil.download(leftSplit[j])) {
copyFile2(in, dir + File.separator + fileLastName);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
File file = new File(dir + File.separator + fileLastName);
if (file.exists()) {
bufferImg = ImageIO.read(file);
ImageIO.write(bufferImg, "jpg", byteArrayOut);
//anchor主要用于设置图片的属性
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 200, (short) 3, j + i, (short) 3, j + i);
patriarch.createPicture(anchor, workbook.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
}
} else {
row.createCell(3).setCellValue(leftSplit[j]);
}
}
sarFileCompareExcelMergeCell.setLeftStart(i);
sarFileCompareExcelMergeCell.setLeftEnd(i + leftSplit.length - 1);
sarFileCompareExcelMergeCell.setRightStart(0);
sarFileCompareExcelMergeCell.setRightEnd(0);
mergeCells.add(sarFileCompareExcelMergeCell);
} else {
row.createCell(3).setCellValue(rowDataAndPath);
}
sarFileCompareExcelMergeCell.setLeftStart(i);
sarFileCompareExcelMergeCell.setLeftEnd(i + leftSplit.length - 1);
sarFileCompareExcelMergeCell.setRightStart(0);
sarFileCompareExcelMergeCell.setRightEnd(0);
mergeCells.add(sarFileCompareExcelMergeCell);
} else {
row.createCell(3).setCellValue(rowDataAndPath);
}
row.setRowStyle(cellStyle);
}
}
String itemIdRight = itemComment.getItemsIdRight();
@@ -349,84 +356,50 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
row.createCell(5).setCellValue(itemRight.getItemsNum());
row.createCell(6).setCellValue(itemRight.getItemsName());
String text = itemRight.getItemsText();
text = text.replace("<p>", "").replace("</p>", "\r\n");
BufferedImage bufferImg = null;
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
addImgdata(text,request.getSession());
String rowDataAndPath = (String) request.getSession().getAttribute("txtAndImg");
rightSplit = rowDataAndPath.split("---");
if (rightSplit.length > 1) {
for (int j = 0; j < rightSplit.length; j++) {
if (j > 0) {
Row row2 = sheet.createRow(j + i);
if (rightSplit[j].contains(".jpg") || rightSplit[j].contains(".png")) {
row2.setHeight((short) 5000); //设置行高
//先将图片下载到本地
String fileLastName = rightSplit[j].substring(rightSplit[j].lastIndexOf("/") + 1);
if (CosBootUtil.doesObjectExist(rightSplit[j])) {
try (InputStream in = CosBootUtil.download(rightSplit[j])) {
copyFile2(in, dir + File.separator + fileLastName);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
if (StringUtils.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("-------------- 右侧图片、表格 处理成功 -----------------");
}
File file = new File(dir + File.separator + fileLastName);
if (file.exists()) {
bufferImg = ImageIO.read(file);
ImageIO.write(bufferImg, "jpg", byteArrayOut);
//anchor主要用于设置图片的属性
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 200, (short) 3, j + i, (short) 3, j + i);
patriarch.createPicture(anchor, workbook.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
}
} else {
row2.createCell(3).setCellValue(rightSplit[j]);
}
} else {
if (rightSplit[j].contains(".jpg") || rightSplit[j].contains(".png")) {
row.setHeight((short) 5000); //设置行高
//先将图片下载到本地
String fileLastName = rightSplit[j].substring(rightSplit[j].lastIndexOf("/") + 1);
if (CosBootUtil.doesObjectExist(rightSplit[j])) {
try (InputStream in = CosBootUtil.download(rightSplit[j])) {
copyFile2(in, dir + File.separator + fileLastName);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
File file = new File(dir + File.separator + fileLastName);
if (file.exists()) {
bufferImg = ImageIO.read(file);
ImageIO.write(bufferImg, "jpg", byteArrayOut);
//anchor主要用于设置图片的属性
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 200, (short) 3, j + i, (short) 3, j + i);
patriarch.createPicture(anchor, workbook.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
}
} else {
row.createCell(7).setCellValue(rightSplit[j]);
}
}
sarFileCompareExcelMergeCell.setRightStart(i);
sarFileCompareExcelMergeCell.setRightEnd(i + rightSplit.length - 1);
mergeCells.add(sarFileCompareExcelMergeCell);
} else {
row.createCell(7).setCellValue(rowDataAndPath);
}
sarFileCompareExcelMergeCell.setRightStart(i);
sarFileCompareExcelMergeCell.setRightEnd(i + rightSplit.length - 1);
mergeCells.add(sarFileCompareExcelMergeCell);
} else {
row.createCell(7).setCellValue(rowDataAndPath);
}
row.setRowStyle(cellStyle);
}
}
row.createCell(8).setCellValue(itemComment.getComment());
for (int j = 0; j < 7; j++) {
row.setRowStyle(cellStyle);
for (int j = 0; j < 9; j++) {
Cell cell = row.getCell(j);
if (null != cell) {
cell.setCellStyle(cellStyle);
}
}
i = i + leftSplit.length;
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 || StringUtils.isEmpty(selectIds)) {
Row row = sheet.createRow(i);
@@ -443,27 +416,41 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
row.getCell(1).setCellStyle(cellStyle);
}
if (ObjectUtils.isNotEmpty(mergeCells)) {
for (SarFileCompareExcelMergeCell mergeCell : mergeCells) {
Integer leftCount = mergeCell.getLeftEnd() - mergeCell.getLeftStart() + 1;
Integer rightCount = mergeCell.getRightEnd() - mergeCell.getRightStart() + 1;
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 + " -----------------");
//合并
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, 7, 7);
sheet.addMergedRegion(region7);
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("-------------- 单元格合并成功 -----------------");
}
@@ -471,6 +458,7 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
workbook.write(os);
os.flush();
} catch (IOException e) {
e.printStackTrace();
if (CutEnum.CN.getValue().equals(cut)) {
throw new JeroBootException("下载文件失败");
} else {
@@ -482,18 +470,157 @@ public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCom
}
/**
* 提取字符串中<img>标签内容中的图片路径,并重新按顺序拼接
* 处理图片跟表格类型的数据
* @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 (CosBootUtil.doesObjectExist(text)) {
try (InputStream in = CosBootUtil.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 (org.apache.commons.lang.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 void addImgdata(String text,HttpSession session) {
if (text.contains("<") || text.contains(">")) {
String txtLeft = text.substring(0, text.indexOf("<"));
String txtRight = text.substring(text.indexOf(">") + 1);
String img = text.substring(text.indexOf("<"), text.indexOf(">"));
String path = img.substring(img.lastIndexOf("=") + 1, img.lastIndexOf("\""));
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;
addImgdata(text, session);
splitImg(text, session);
} else {
session.setAttribute("txtAndImg", text);
}
@@ -0,0 +1,231 @@
package com.jero.modules.compare.utils;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFCellUtil;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.util.CellRangeAddress;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
/****
* 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(HSSFCell.CELL_TYPE_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++) {
HSSFRow row = HSSFCellUtil.getRow(i, sheet);
for (int j = region.getFirstColumn(); j <= region.getLastColumn(); j++) {
HSSFCell cell = HSSFCellUtil.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.GREY_25_PERCENT.index;
short fontSize = 12;
String fontName = "宋体";
HSSFCellStyle style = workbook.createCellStyle();
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
style.setBorderTop(HSSFCellStyle.BORDER_THIN);//上边框
style.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setFillForegroundColor(titlebackgroundcolor);// 背景色
HSSFFont font = workbook.createFont();
font.setFontName(fontName);
font.setFontHeightInPoints(fontSize);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
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((short) 1);
style.setBorderTop((short) 1);
style.setBorderLeft((short) 1);
style.setBorderRight((short) 1);
HSSFFont font = wb.createFont();
font.setFontName(fontName);
font.setFontHeightInPoints(fontSize);
style.setFont(font);
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);//水平居中
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_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;
}
}
@@ -8,7 +8,7 @@ import org.apache.commons.lang3.StringUtils;
*/
public enum ReleaseConditionEnum {
PUBLISHED("已发布","published","Have published"),
PUBLISHED("已发布","published","Published"),
DRAFT("草稿","draft","Draft"),
;
@@ -90,6 +90,21 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
return Result.OK(infoPage);
}
/**
* 文档翻译调取已入库文件
* @param parameter
* @return
*/
@AutoLog(value = "文档翻译调取已入库文件")
@ApiOperation(value="文档翻译调取已入库文件", notes="文档翻译调取已入库文件")
@PostMapping(value = "/transPageInfo")
@ResponseBody
@RequiresPermissions("documentTranslation:retrieval")
public Result<?> transPageInfo(@RequestBody Map<String,Object> parameter) {
IPage infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter);
return Result.OK(infoPage);
}
/**
* 列表查询
*
@@ -316,7 +316,14 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String contentInfo =content;
String title = content;
//封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, title, content, contentInfo,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList,
title,
content,
contentInfo,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null,
null);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
sendWebsocket(StringUtils.join(serialNumberList, ","), contentInfo);
}
@@ -2201,16 +2208,56 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
+ " technical field you subscribed to, the "
+ href +" has been updated.";
String msgTitle = "The " + technologyTerritoryName + " technical field you subscribed to has been updated";
String hrefYes = category + " " + "<a href='/docManage/library/detail?id=" + idTemp +
"&title=" + title +
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>";
//消息英文--不带标签
String contentNo = "In the "+ technologyTerritoryName
+ " technical field you subscribed to, the "+
category + " " + serialNumber +" has been updated.";;
//消息英文--带标签
String contentYes = "In the "+ technologyTerritoryName
+ " technical field you subscribed to, the "+
category + " " + hrefYes +" has been updated.";;
//消息中文--不带标签
String contentInfoNo = "您所订阅的" + technologyTerritoryName + "技术领域中更新了" + category + " " + serialNumber;;
//消息中文--带标签
String contentInfoYes = "您所订阅的" + technologyTerritoryName + "技术领域中更新了" + category + " " + hrefYes;;
//封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, msgTitle, content, contentInfo,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList,
msgTitle,
contentNo,
contentYes,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentInfoNo,
contentInfoYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
sendWebsocket(idTemp, contentInfo);
//飞书
try {
String contentInfoFeiShu = "In the "+ technologyTerritoryName
+ " technical field you subscribed to, the "
+ serialNumber +" has been updated.";
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFeiShu, MessageTypeEnum.PUSH.getName(), hrefTemp);
+ " technical field you subscribed to, the "+
category + " " + serialNumber +" has been updated.";
String contentInfoFeiShuCn = "您所订阅的" + technologyTerritoryName + "技术领域中更新了" + category + " " + serialNumber;
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(hrefTemp);
feishuMsgVo.setContentEn(contentInfoFeiShu);
feishuMsgVo.setContent(contentInfoFeiShuCn);
iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}), feishuMsgVo);
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFeiShu, MessageTypeEnum.PUSH.getName(), hrefTemp);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
@@ -2980,13 +3027,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if (ObjectUtils.isNotEmpty(value)) {
if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) {
if("1".equals(flag)){
sb.append(dbFieldTxt +" from \""+ value + "\" to \"" + valueTemp + "\",");
sb.append(dbFieldTxt +" was changed from \""+ value + "\" to \"" + valueTemp + "\",");
}else{
sb.append(dbFieldTxt + "由\"" + value + "\"改为\"“" + valueTemp + "\",");
}
} else if (ObjectUtils.isEmpty(valueTemp)) {
if("1".equals(flag)){
sb.append(dbFieldTxt + " from \""+value + "\" to null " + ",");
sb.append(dbFieldTxt + " was changed from \""+value + "\" to null " + ",");
}else{
sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ",");
}
@@ -2994,7 +3041,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
} else {
if (ObjectUtils.isNotEmpty(valueTemp)) {
if("1".equals(flag)){
sb.append(dbFieldTxt + " from null to \"" + valueTemp + "\",");
sb.append(dbFieldTxt + " was changed from null to \"" + valueTemp + "\",");
}else{
sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\",");
}
@@ -3023,13 +3070,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if (fileNameListTemp.size() != 0 && !checkDiffrent) {
if("1".equals(flag)){
//sysUser
sb.append(dbFieldTxt +" from \""+ StringUtils.join(fileNameList, ",") + "\" to \"" + StringUtils.join(fileNameListTemp, ",") + "\",");
sb.append(dbFieldTxt +" was changed from \""+ StringUtils.join(fileNameList, ",") + "\" to \"" + StringUtils.join(fileNameListTemp, ",") + "\",");
}else{
sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为\"" + StringUtils.join(fileNameListTemp, ",") + "\",");
}
} else if (fileNameListTemp.size() == 0) {
if("1".equals(flag)){
sb.append(dbFieldTxt + " from \""+StringUtils.join(fileNameList, ",") + "\" to null " + ",");
sb.append(dbFieldTxt + " was changed from \""+StringUtils.join(fileNameList, ",") + "\" to null " + ",");
}else{
sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为空" + ",");
}
@@ -3038,7 +3085,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
} else {
if (fileNameListTemp.size() != 0) {
if("1".equals(flag)){
sb.append(dbFieldTxt + " from null to \"" + StringUtils.join(fileNameListTemp, ",") + "\",");
sb.append(dbFieldTxt + " was changed from null to \"" + StringUtils.join(fileNameListTemp, ",") + "\",");
}else{
sb.append(dbFieldTxt + "由空改为\"" + StringUtils.join(fileNameListTemp, ",") + "\",");
}
@@ -3059,13 +3106,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if (ObjectUtils.isNotEmpty(value)) {
if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) {
if("1".equals(flag)){
sb.append(dbFieldTxt +" from \""+ value + "\" to \"" + valueTemp + "\",");
sb.append(dbFieldTxt +" was changed from \""+ value + "\" to \"" + valueTemp + "\",");
}else{
sb.append(dbFieldTxt + "由\"" + value + "\"改为\"" + valueTemp + "\",");
}
} else if (ObjectUtils.isEmpty(valueTemp)) {
if("1".equals(flag)){
sb.append(dbFieldTxt + " from \""+value + "\" to null " + ",");
sb.append(dbFieldTxt + " was changed from \""+value + "\" to null " + ",");
}else{
sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ",");
}
@@ -3073,7 +3120,203 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
} else {
if (ObjectUtils.isNotEmpty(valueTemp)) {
if("1".equals(flag)){
sb.append(dbFieldTxt + " from null to \"" + valueTemp + "\",");
sb.append(dbFieldTxt + " was changed from null to \"" + valueTemp + "\",");
}else{
sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\",");
}
}
}
}
}
}
}
}
}
});
return sb;
}
@NotNull
private StringBuilder getUpdateInfoCn(Map<String, Object> map, List<Map<String, Object>> dataList,
List<OnlCgformField> fieldList, List<OnlCgformField> fieldDateList,
List<OnlCgformField> fieldFileList, List<OnlCgformField> fieldPullList,
String cut,String flagTemp) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//调整dataList中map中字段顺序与表单中的一致
Map<String, Object> mapNew = new LinkedHashMap<>();
for (OnlCgformField onlCgformField : fieldList) {
for (Map.Entry<String, Object> entry : dataList.get(0).entrySet()) {
if (onlCgformField.getDbFieldName().equals(entry.getKey())) {
mapNew.put(entry.getKey(), entry.getValue());
break;
}
}
}
dataList.remove(0);
dataList.add(mapNew);
Map<String, Object> mapTemp = new HashMap<>();
mapCopy(map, mapTemp);
//时间类型的字段
List<String> fieldDate = fieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
//文件类型的字段
List<String> fieldFile = fieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
//下拉类型的字段
//过滤出树形字段
List<OnlCgformField> treeFieldList = fieldList.stream()
.filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType()))
.collect(Collectors.toList());
//数据字典
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
//树形数据字典
List<SysCategory> categoryList = sysCategoryService.list();
//下拉选处理数据字典
for (Map.Entry<String, Object> entry : dataList.get(0).entrySet()) {
//下拉选处理数据字典
dictItemCn(sysDictItems, entry, cut, fieldList,flagTemp);
treeDictItemCn(categoryList, entry, treeFieldList, cut,flagTemp);
}
for (Map.Entry<String, Object> entry : mapTemp.entrySet()) {
//下拉选处理数据字典
dictItemCn(sysDictItems, entry, cut, fieldList,flagTemp);
treeDictItemCn(categoryList, entry, treeFieldList, cut,flagTemp);
}
StringBuilder sb = new StringBuilder();
dataList.get(0).entrySet().forEach(entry -> {
String key = entry.getKey();
Object value = entry.getValue();
//字段中文名
List<OnlCgformField> fields = fieldList.stream().filter(e -> e.getDbFieldName().equals(key)).collect(Collectors.toList());
if (fields.size() != 0) {
String dbFieldTxt = fields.get(0).getDbFieldTxt();
if("2".equals(flagTemp)){
dbFieldTxt = fields.get(0).getDbFieldTxt();
}else{
dbFieldTxt = fields.get(0).getDbFieldTxt();
}
dbFieldTxt = "<text class='highlight-class'>" + dbFieldTxt + "</text>";
if (value == null) {
value = "";
}
for (Map.Entry<String, Object> entryTemp : mapTemp.entrySet()) {
String keyTemp = entryTemp.getKey();
Object valueTemp = entryTemp.getValue();
if (valueTemp == null) {
valueTemp = "";
}
if (!"create_time".equals(key) && !"update_time".equals(key)) {
if (key.equals(keyTemp)) {
if (fieldDate.contains(key)) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (ObjectUtils.isNotEmpty(value)) {
value = sdf.format(value);
}
if (ObjectUtils.isNotEmpty(valueTemp)) {
try {
valueTemp = sdf.format(sdf.parse((String) valueTemp));
} catch (ParseException e) {
}
}
//处理时间类型字段
if (ObjectUtils.isNotEmpty(value)) {
if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) {
if("2".equals(flagTemp)){
sb.append(dbFieldTxt + "由\"" + value + "\"改为\"“" + valueTemp + "\",");
}else{
sb.append(dbFieldTxt + "由\"" + value + "\"改为\"“" + valueTemp + "\",");
}
} else if (ObjectUtils.isEmpty(valueTemp)) {
if("2".equals(flagTemp)){
sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ",");
}else{
sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ",");
}
}
} else {
if (ObjectUtils.isNotEmpty(valueTemp)) {
if("2".equals(flagTemp)){
sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\",");
}else{
sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\",");
}
}
}
} else if (fieldFile.contains(key)) {
//处理文件类型字段
List<String> fileNameList = new ArrayList<>();
List<String> fileNameListTemp = new ArrayList<>();
//之前的文件
if (ObjectUtils.isNotEmpty(value)) {
List<OSSFile> fileInfos = iOSSFileService.getFileInfosByConnectId((String) value);
fileNameList = fileInfos.stream().map(OSSFile::getFileName).collect(Collectors.toList());
}
//修改的文件
if (ObjectUtils.isNotEmpty(valueTemp)) {
List<OSSFile> fileInfosTemp = iOSSFileService.getFileInfos((String) valueTemp);
fileNameListTemp = fileInfosTemp.stream().map(OSSFile::getFileName).collect(Collectors.toList());
}
if (ObjectUtils.isNotEmpty(value)) {
boolean checkDiffrent = checkDiffrent(fileNameList, fileNameListTemp);
if (fileNameListTemp.size() != 0 && !checkDiffrent) {
if("2".equals(flagTemp)){
//sysUser
sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为\"" + StringUtils.join(fileNameListTemp, ",") + "\",");
}else{
sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为\"" + StringUtils.join(fileNameListTemp, ",") + "\",");
}
} else if (fileNameListTemp.size() == 0) {
if("2".equals(flagTemp)){
sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为空" + ",");
}else{
sb.append(dbFieldTxt + "由\"" + StringUtils.join(fileNameList, ",") + "\"改为空" + ",");
}
}
} else {
if (fileNameListTemp.size() != 0) {
if("2".equals(flagTemp)){
sb.append(dbFieldTxt + "由空改为\"" + StringUtils.join(fileNameListTemp, ",") + "\",");
}else{
sb.append(dbFieldTxt + "由空改为\"" + StringUtils.join(fileNameListTemp, ",") + "\",");
}
}
}
} else {
// if ("replace_standard".equals(key) || "corresponding_standard".equals(key)) {
// if (ObjectUtils.isNotEmpty(value)) {
// value = getReplaceStandardName(value);
// }
// if (ObjectUtils.isNotEmpty(valueTemp)) {
// valueTemp = getReplaceStandardName(valueTemp);
// }
// }
//其他类型(被代替标准不处理)
if (!"replaced_standard".equals(key)) {
if (ObjectUtils.isNotEmpty(value)) {
if (ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)) {
if("2".equals(flagTemp)){
sb.append(dbFieldTxt + "由\"" + value + "\"改为\"" + valueTemp + "\",");
}else{
sb.append(dbFieldTxt + "由\"" + value + "\"改为\"" + valueTemp + "\",");
}
} else if (ObjectUtils.isEmpty(valueTemp)) {
if("2".equals(flagTemp)){
sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ",");
}else{
sb.append(dbFieldTxt + "由\"" + value + "\"改为空" + ",");
}
}
} else {
if (ObjectUtils.isNotEmpty(valueTemp)) {
if("2".equals(flagTemp)){
sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\",");
}else{
sb.append(dbFieldTxt + "由空改为\"" + valueTemp + "\",");
}
@@ -3114,20 +3357,34 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
List<OnlCgformField> fieldFileList,
List<OnlCgformField> fieldPullList,
String cut) {
List<Map<String, Object>> dataListTemp = new ArrayList<>();
for (Map<String, Object> stringObjectMap : dataList) {
Map<String, Object> mapT = new HashMap<>();
mapCopy(stringObjectMap, mapT);
dataListTemp.add(mapT);
}
String technologyTerritoryNew = (String) dataList.get(0).get("technology_territory");
//1. 处理订阅的发送消息
//修改的内容
String flag ="1";//消息的标识(英文)
StringBuilder sb = getUpdateInfo(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, null,flag);
String flagTemp ="2";//消息的标识(中文--消息采用卡片型式发送, 消息内容包含中英文, 所以此处需要获取消息的中文)
StringBuilder sbCn = getUpdateInfoCn(map, dataListTemp, fieldList, fieldDateList, fieldFileList, fieldPullList, null,flagTemp);
//树形数据字典
List<SysCategory> categoryList = sysCategoryService.list();
String sbStr = "";
if (ObjectUtils.isNotEmpty(sb)) {
sbStr = sb.substring(0, sb.length() - 1);
}
String sbStrCn = "";
if (ObjectUtils.isNotEmpty(sbCn)) {
sbStrCn = sbCn.substring(0, sbCn.length() - 1);
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String serialNumber = (String) dataList.get(0).get("serial_number");
String category = (String)map.get("lei4_bie2");
String categoryCn = (String)map.get("lei4_bie2");
String technologyTerritory = (String) map.get("technology_territory");
if(StringUtils.isNotBlank(category)){
List<SysDictItem> dictItemList = sysDictItemServiceImpl.selectItemsAll();
@@ -3137,21 +3394,20 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
.collect(Collectors.toList());
if(stateDictItemList.size() != 0){
category = stateDictItemList.get(0).getEnName();
categoryCn = stateDictItemList.get(0).getItemText();
}
}else{
category = "";
}
//只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”)
//向订阅领域管理中订阅了该技术领域的人和文档库中订阅了该条文档的人发送消息
// 只有技术领域变更为订阅的技术领域这一种情况发消息, 假如订阅了技术领域A,编辑的文档的技术领域也是A,这时编辑的是其他的字段,这种情况不发消息
Map<String, Object> mapTemp = new HashMap<>();
mapTemp.put("domainId", map.get("technology_territory"));
mapTemp.put("documentId", map.get("id"));
//订阅技术领域的人和订阅该条标准的人
// List<String> userIdList = domainUserRelService.queryDomainUserRelInfo(mapTemp);
//订阅技术领域发消息
List<DomainUserRel> domainUserRelList = domainManageService.list();
// List<String> thirdIdListAll = new ArrayList<>();
// List<String> userListAll = new ArrayList<>();
List<String> thirdIdList = new ArrayList<>();
List<String> userList = new ArrayList<>();
String technologyTerritoryNameEn = "";
@@ -3167,12 +3423,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if(sysUsersFeishu.size() != 0){
thirdIdList = sysUsersFeishu.stream().map(SysUser::getThirdId).collect(Collectors.toList());
userList = sysUsersFeishu.stream().map(SysUser::getId).collect(Collectors.toList());
// if(thirdIdList.size() != 0){
// thirdIdListAll.addAll(thirdIdList);
// }
// if(userList.size() != 0){
// userListAll.addAll(userList);
// }
}
}
if(domainIdList.size() != 0){
@@ -3208,25 +3458,26 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(sysUsers)) {
userIdListUpdate = sysUsers.stream().map(SysUser::getId).collect(Collectors.toList());
userIdListUpdateFeishu = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
// if(userIdListUpdate.size() != 0){
// userListAll.addAll(userIdListUpdate);
// }
// if(userIdListUpdateFeishu.size() != 0){
// thirdIdListAll.addAll(userIdListUpdateFeishu);
// }
}
}
}
//订阅管理
if(thirdIdList.size() != 0){
// thirdIdListAll = thirdIdListAll.stream().distinct().collect(Collectors.toList());
String contentInfoFei = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
category + " " + serialNumber+" has been updated.";
String contentInfoFeiCn = "您所订阅的" + technologyTerritoryNameEn + "技术领域中更新了" + categoryCn + " " + serialNumber;
try {
//跳转文档详情
String url = backUrl + "/docManage/library/detail?id=" + id;
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(url);
feishuMsgVo.setContentEn(contentInfoFei);
feishuMsgVo.setContent(contentInfoFeiCn);
iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}), feishuMsgVo);
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
} catch (IOException e) {
log.error("文档新增飞书消息推送失败");
}
@@ -3243,8 +3494,30 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//您订阅的XXX已被修改
String contentInfo = "In the " + technologyTerritoryNameEn + " technical field you subscribed to," +sysUser.getUsername()+" changed the "+ href + " " + sbStr.toString();
String msgTitle = "The " + technologyTerritoryNameEn + " technical field you subscribed to has been updated";
//消息英文--不带标签
String contentNo = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
category + " " + serialNumber+" has been updated.";;
//消息英文--带标签
String contentYes = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
category + " " + href+" has been updated.";;
//消息中文--不带标签
String contentInfoNo = "您所订阅的" + technologyTerritoryNameEn + "技术领域中更新了" + categoryCn + " " + serialNumber;;
//消息中文--带标签
String contentInfoYes = "您所订阅的" + technologyTerritoryNameEn + "技术领域中更新了" + categoryCn + " " + href;;
// 封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userList, msgTitle, contentInfoFei, contentInfo,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = getSysAnnouncement(userList,
msgTitle,
contentNo,
contentYes,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentInfoNo,
contentInfoYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
sendWebsocket((String) map.get("id"), contentInfo);
}
@@ -3258,27 +3531,61 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
"&title=" + title +
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>";
String content = "";
if (StringUtils.isNotBlank(sbStr.toString())) {
if (StringUtils.isNotBlank(sbStr.toString()) && StringUtils.isNotBlank(sbStrCn)) {
//去掉a标签
sbStr = sbStr.replaceAll("<text class='highlight-class'>", "").replaceAll("</text>", "");
//您订阅的XXX已被修改
content = "In the "+category + " " + serialNumber+" you subscribed to, has been modified,Please pay attention to check.";
String contentInfo = "In the "+category + " " + href+" you subscribed to, "+sysUser.getUsername()+" changed the "+ href + " " + sbStr.toString();
//内容详情--英文(不带标签)
String contentInfoNo = "In the "+category + " " + serialNumber+" you subscribed to, "+ sbStr.toString();
//内容详情--英文(带标签)
String contentInfoYes = "In the "+category + " " + href+" you subscribed to, "+ sbStr.toString();
String msgTitle = serialNumber + " you subscribed to has been updated";
//内容详情-中文(不带标签)
String sbStrCnTemp = sbStrCn.replaceAll("<text class='highlight-class'>", "").replaceAll("</text>", "");
String contentCnNo = "您所订阅的"+categoryCn+serialNumber+","+sbStrCnTemp;
//内容详情--中文(带标签)
String contentInfoCnReplace = sbStrCn.replaceAll("<text class='highlight-class'>","").replaceAll("</text>","");
String contentInfoCnYes ="您所订阅的"+categoryCn+href+","+contentInfoCnReplace;;
//封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdListUpdate, msgTitle, content, contentInfo,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdListUpdate,
msgTitle,
contentInfoNo,
contentInfoYes,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentCnNo,
contentInfoCnYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
sendWebsocket((String) map.get("id"), contentInfo);
sendWebsocket((String) map.get("id"), contentInfoYes);
}
//订阅文档的飞书消息
try {
// String contentInfoFei = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
// category + " " + serialNumber+" has been updated.";
String contentInfoFei = "In the "+category + " " + serialNumber +" you subscribed to, "+sysUser.getUsername()+" changed the " + sbStr.toString();;
//英文消息
String contentInfoFei = "In the "+category + " " + serialNumber +" you subscribed to, "+ sbStr.toString();;
//中文消息
String contentInfoFeiCn ="您所订阅的"+categoryCn+ serialNumber +","+ sbStrCn.toString();;
//跳转文档详情
String url = backUrl + "/docManage/library/detail?id=" + id;
iFeishuService.batchSendMessage(userIdListUpdateFeishu.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
// iFeishuService.batchSendMessage(userIdListUpdateFeishu.toArray(new String[]{}), content, MessageTypeEnum.READ.getName(), url);
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(url);
String replaceAll = contentInfoFei.replaceAll("\"", "<");
feishuMsgVo.setContentEn(replaceAll);
String replaceAllCn = contentInfoFeiCn.replaceAll("<text class='highlight-class'>", "")
.replaceAll("</text>","").replaceAll("\"", "<");
feishuMsgVo.setContent(replaceAllCn);
//
iFeishuService.sendCardMsgDocument(userIdListUpdateFeishu.toArray(new String[]{}), feishuMsgVo);
// String contentInfoFei = "In the "+category + " " + serialNumber +" you subscribed to, "+sysUser.getUsername()+" changed the " + sbStr.toString();;
// //跳转文档详情
// String url = backUrl + "/docManage/library/detail?id=" + id;
// iFeishuService.batchSendMessage(userIdListUpdateFeishu.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
} catch (IOException e) {
log.error("文档新增飞书消息推送失败");
}
@@ -3349,7 +3656,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String contentInfo = "New numbering implemented, please note update status of alternate numbering " + sbStr;
String msgTitle = contentInfo;
//封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, msgTitle, content, contentInfo,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList,
msgTitle,
content,
contentInfo,MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null,
null);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
sendWebsocket(StringUtils.join(serialNumberListTemp, ","), contentInfo);
//飞书
@@ -3377,7 +3690,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String content,
String contentInfo,
String messageType,
String initiator) {
String initiator,
String contentCn,
String contentInfoCn) {
SysAnnouncement sysAnnouncement = new SysAnnouncement();
sysAnnouncement.setInitiator(initiator);
sysAnnouncement.setDelFlag("0");
@@ -3389,6 +3704,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
sysAnnouncement.setTitile(title);
sysAnnouncement.setMsgContent(content);
sysAnnouncement.setMsgContentInfo(contentInfo);
sysAnnouncement.setMsgContentCn(contentCn);
sysAnnouncement.setMsgContentInfoCn(contentInfoCn);
sysAnnouncement.setUserIds(StringUtils.join(userIdList, ","));
return sysAnnouncement;
}
@@ -3932,6 +4249,64 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
}
}
/**
* 用于获取飞书消息中的中文消息
*
* @param sysDictItems
* @param entry
*/
public void dictItemCn(List<SysDictItem> sysDictItems, Map.Entry<String, Object> entry, String cut, List<OnlCgformField> fieldList,String flagTemp) {
//通过dictField判断字段是否为下拉选(不为空则为下拉选)
List<OnlCgformField> onlCgformFieldList = fieldList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList());
//数据字典中文
List<String> dictItemsCh = new ArrayList<>();
List<String> dictItemsEn = new ArrayList<>();
for (OnlCgformField onlCgformField : onlCgformFieldList) {
if (FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformField.getFieldShowType())
|| FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformField.getFieldShowType())) {
String value = (String) entry.getValue();
if (StringUtils.isNotBlank(value) && onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) {
for (String itemValue : value.split(",")) {
//字段的数据字典
List<SysDictItem> dictItemList = sysDictItems.stream()
.filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(onlCgformFieldList.get(0).getDictField()))
.collect(Collectors.toList());
if (dictItemList.size() != 0) {
List<SysDictItem> dictItems = dictItemList.stream()
.filter(e -> itemValue.equals(e.getItemValue()))
.collect(Collectors.toList());
if (dictItems.size() != 0) {
List<String> itemText = new ArrayList<>();
if (CutEnum.CN.getValue().equals(cut)) {
itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList());
} else if(CutEnum.EN.getValue().equals(cut)) {
itemText = dictItems.stream().map(SysDictItem::getEnName).collect(Collectors.toList());
}else if("2".equals(flagTemp)){
itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList());
}
dictItemsCh.addAll(itemText);
dictItemsEn.addAll(itemText);
}
}
}
}
}
}
if (onlCgformFieldList.size() != 0 && StringUtils.isNotBlank(onlCgformFieldList.get(0).getDictField())) {
if(FieldTypeEnum.PULL_SINGLE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType())
|| FieldTypeEnum.PULL_MORE.getValue().equals(onlCgformFieldList.get(0).getFieldShowType())){
if (CutEnum.CN.getValue().equals(cut)) {
entry.setValue(StringUtils.join(dictItemsCh, ","));
} else if(CutEnum.EN.getValue().equals(cut)){
entry.setValue(StringUtils.join(dictItemsEn, ","));
}else if("2".equals(flagTemp)){
entry.setValue(StringUtils.join(dictItemsEn, ","));
}
}
}
}
@Override
@@ -4890,8 +5265,20 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
// String contentInfo = sysUser.getUsername() + " pushed " + StringUtils.join(hrefList, ",") + " to you. Please be reminded to check it out.";
// String title = StringUtils.join(serialNumberList, ",") + " has been pushed to you, please check";
String contentEnNo = sysUser.getUsername() + " shared " + StringUtils.join(serialNumberList, ",") + " with you, please be reminded to check it out.";
String contentInfoEnYes = sysUser.getUsername() + " shared " + StringUtils.join(hrefList, ",") + " with you, please be reminded to check it out.";
String contentInfoCnNo = sysUser.getUsername() + "向您分享了" + StringUtils.join(serialNumberList, ",") + "请查看.";
String contentInfoCnYes = sysUser.getUsername() + "向您分享了" + StringUtils.join(hrefList, ",") + "请查看.";
//封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, title, content, contentInfo,MessageTypeEnum.PUSH.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList,
title,
contentEnNo,
contentInfoEnYes,
MessageTypeEnum.PUSH.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentInfoCnNo,
contentInfoCnYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo);
//飞书
@@ -4906,10 +5293,15 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
});
String contentTemp = sysUser.getUsername() + " shared " + StringUtils.join(list, ",") + " with you, please be reminded to check it out.";
// String contentTemp = sysUser.getUsername() + " pushed " + StringUtils.join(list, ",") + " to you. Please be reminded to check it out.";
// FeishuMsgVo feishuMsgVo = getFeishuMsgVo(MessageTypeEnum.PUSH.getName(),null, contentTemp, encode);
// iFeishuService.sendCardMsg(thirdIdList.toArray(new String[]{}), feishuMsgVo);
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
String contentTempCn = sysUser.getUsername() + "向您分享了" + StringUtils.join(list, ",") + "请查看.";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
feishuMsgVo.setUrl(encode);
feishuMsgVo.setContentEn(contentTemp);
feishuMsgVo.setContent(contentTempCn);
iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}),feishuMsgVo);
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
}
} catch (IOException e) {
log.error("飞书推送失败");
@@ -4956,6 +5348,34 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
}
}
/**
* 用于获取飞书消息中的中文消息
*
* @param categoryList
* @param entry
* @param treeFieldList
* @param cut
*/
public void treeDictItemCn(List<SysCategory> categoryList, Map.Entry<String, Object> entry, List<OnlCgformField> treeFieldList, String cut,String flagTemp) {
List<String> treeFields = treeFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
String key = entry.getKey();
if (treeFields.contains(entry.getKey())) {
String value = StringUtils.valueOf(entry.getValue());
if (StringUtils.isNotBlank(value)) {
List<String> idList = Arrays.asList(value.split(","));
List<SysCategory> sysCategoryList = categoryList.stream().filter(e -> idList.contains(e.getId())).collect(Collectors.toList());
List<String> nameList = sysCategoryList.stream().map(SysCategory::getName).collect(Collectors.toList());
List<String> nameEnList = sysCategoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList());
if (CutEnum.CN.getValue().equals(cut)) {
entry.setValue(StringUtils.join(nameList, ","));
} else if(CutEnum.EN.getValue().equals(cut)){
entry.setValue(StringUtils.join(nameEnList, ","));
}else if("2".equals(flagTemp)){
entry.setValue(StringUtils.join(nameList, ","));
}
}
}
}
@SneakyThrows
@@ -29,6 +29,7 @@ import com.jero.modules.dummy.service.IDummyInventoryInfoEOService;
import com.jero.modules.dummy.service.IDummyReadEOService;
import com.jero.modules.dummy.vo.VirtualCreaterVo;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.system.entity.SysAnnouncement;
@@ -41,6 +42,7 @@ import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -250,10 +252,14 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
@Override
public IPage<DummyInventoryBaseEO> getPageInfo(Page<DummyInventoryBaseEO> page, QueryWrapper<DummyInventoryBaseEO> queryWrapper) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
queryWrapper.and(query->{
query.in("create_by",sysUser.getUsername()).in("state",InventoryStateEnum.DRAFT.getValue())
.or().in("state",InventoryStateEnum.ISSUE.getValue());
});
//系统管理
boolean administrator = sysUserService.isAdministrator();
if(!administrator){
queryWrapper.and(query->{
query.in("create_by",sysUser.getUsername()).in("state",InventoryStateEnum.DRAFT.getValue())
.or().in("state",InventoryStateEnum.ISSUE.getValue());
});
}
// queryWrapper.or(query->{
// query.in("state",InventoryStateEnum.ISSUE.getValue());
// });
@@ -319,19 +325,19 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
DummyInventoryBaseEO baseEO = queryById(dummyInventoryBaseEO.getId());
List<String> createByNameList =new ArrayList<>();
if (StringUtils.isNotBlank(baseEO.getCreateBy())) {
createByNameList = Arrays.asList(baseEO.getCreateBy().split(","));
if (CollectionUtils.isNotEmpty(createByNameList)){
if (!createByNameList.contains(loginUserName)) {
if (CutEnum.CN.getValue().equals(dummyInventoryBaseEO.getCut())) {
throw new JeroBootException("当前用户非创建者,无法发布");
} else {
throw new JeroBootException("The current user is not the creator and cannot be issued.");
}
}
}
}
// if (StringUtils.isNotBlank(baseEO.getCreateBy())) {
// createByNameList = Arrays.asList(baseEO.getCreateBy().split(","));
//
// if (CollectionUtils.isNotEmpty(createByNameList)){
// if (!createByNameList.contains(loginUserName)) {
// if (CutEnum.CN.getValue().equals(dummyInventoryBaseEO.getCut())) {
// throw new JeroBootException("当前用户非创建者,无法发布");
// } else {
// throw new JeroBootException("The current user is not the creator and cannot be issued.");
// }
// }
// }
// }
Date now = new Date();
UpdateWrapper<DummyInventoryBaseEO> baseWrapper=new UpdateWrapper<>();
baseWrapper.set("state",dummyInventoryBaseEO.getState());
@@ -366,6 +372,7 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
List<DummyInventoryInfoEO> dummyInventoryInfoEOList = iDummyInventoryInfoEOService.list(lambdaQueryWrapper);
String contentLog = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + "</br>";
String contentLogFeishu = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + " ";
String contentLogFeishuTemp = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + " ";
if(dummyContentChangeEOList.size() == 0){
//没有添加过需要进行第一次添加
@@ -407,31 +414,83 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
//发消息
int count = 1;
List<String> hrefListAdd = new ArrayList<>();
if(serialNumberAddList.size() != 0){
List<String> hrefList = new ArrayList<>();
for (DummyInventoryInfoEO dummyInventoryInfoEO : collectAdd) {
String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() +
"&title=" + dummyInventoryInfoEO.getTitle() +
"&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>";
hrefList.add(href);
hrefListAdd.add(href);
}
contentLog += count+". New regulations: " + StringUtils.join(hrefList,",") + "</br>";
contentLog += count+". New regulations: " + StringUtils.join(hrefListAdd,",") + "</br>";
contentLogFeishu += count+". New regulations: " + StringUtils.join(serialNumberAddList,",") + " ";
count++;
}
List<String> hrefListDelete = new ArrayList<>();
if(serialNumberDeleteList.size() != 0){
List<String> hrefList = new ArrayList<>();
for (DummyInventoryInfoEO dummyInventoryInfoEO : collectDelete) {
String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() +
"&title=" + dummyInventoryInfoEO.getTitle() +
"&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>";
hrefList.add(href);
hrefListDelete.add(href);
}
contentLog += count + ". Remove regulations: " + StringUtils.join(hrefList,",") + "</br>";
contentLog += count + ". Remove regulations: " + StringUtils.join(hrefListDelete,",") + "</br>";
contentLogFeishu += count + ". Remove regulations: " + StringUtils.join(serialNumberDeleteList,",") + " ";
}
if(serialNumberAddList.size() != 0 || serialNumberDeleteList.size() != 0){
int countNo = 1;
StringBuilder sbContentNo = new StringBuilder();
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
sbContentNo.append(countNo+". New regulations: "+StringUtils.join(serialNumberAddList,",")+", ");
countNo ++;
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
sbContentNo.append(countNo+". Remove regulations: "+StringUtils.join(serialNumberDeleteList,","));
}
int countYes = 1;
StringBuilder sbContentYes = new StringBuilder();
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
sbContentYes.append(countYes+". New regulations: "+StringUtils.join(hrefListAdd,",")+"</br>");
countYes ++;
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
sbContentYes.append(countYes+". Remove regulations: "+StringUtils.join(hrefListDelete,","));
}
//消息英文--不带标签
String contentNo = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + sbContentNo;
//消息英文--带标签
String contentYes = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:"+ "</br>" + sbContentYes;;
int countInfoNo = 1;
StringBuilder sbContentINfoNo = new StringBuilder();
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
sbContentINfoNo.append(countInfoNo+". 新增文档: "+StringUtils.join(serialNumberAddList,",")+", ");
countInfoNo ++;
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
sbContentINfoNo.append(countInfoNo+". 删除文档: "+StringUtils.join(serialNumberDeleteList,","));
}
int countInfoYes = 1;
StringBuilder sbContentInfoYes = new StringBuilder();
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
sbContentInfoYes.append(countInfoYes+". 新增文档: "+StringUtils.join(hrefListAdd,",")+"</br>");
countInfoYes ++;
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
sbContentInfoYes.append(countInfoYes+". 删除文档: "+StringUtils.join(hrefListDelete,","));
}
//消息中文--不带标签
String contentInfoNo = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:"+sbContentINfoNo;
//消息中文--带标签
String contentInfoYes = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:"+"</br>"+sbContentInfoYes;
List<String> userNameList = dummyReadEOService.queryReadUserInfo(dummyInventoryBaseEO.getId());
List<String> thirdIdList = new ArrayList<>();
if(userNameList.size() != 0){
@@ -440,7 +499,14 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
if(userIdList.size() != 0){
//封装消息的实体类
String title = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated.";
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, title, title, contentLog,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
title,
contentNo,
contentYes,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentInfoNo,
contentInfoYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(dummyInventoryBaseEO.getId(), title);
}
@@ -449,7 +515,15 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
if(thirdIdList.size() != 0){
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
try {
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentLogFeishu, MessageTypeEnum.PUSH.getName(), href);
String contentInfoFeiCn = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(href);
feishuMsgVo.setContentEn(contentLogFeishuTemp);
feishuMsgVo.setContent(contentInfoFeiCn);
iFeishuService.sendCardMsgVirtua(thirdIdList.toArray(new String[]{}),feishuMsgVo,serialNumberAddList,serialNumberDeleteList);
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentLogFeishu, MessageTypeEnum.PUSH.getName(), href);
} catch (IOException e) {
e.printStackTrace();
}
@@ -482,7 +556,16 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
String title = "The "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
//Please note that the XX virtual list you subscribed to has been withdrawn.
String contentLog = "Please note that the "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, title, title, contentLog,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
String contentCn = "您订阅的虚拟清单"+ baseEO.getName()+"已被撤回.";
String contentInfoEn = "Please note that the "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
title,
contentInfoEn,
contentInfoEn,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentCn,contentCn);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(dummyInventoryBaseEO.getId(), title);
}
@@ -490,8 +573,15 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
//飞书
if(thirdIdList.size() != 0){
String contentInfoTemp = "Please note that the "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
String contentInfoFeiCn = "您订阅的虚拟清单"+ baseEO.getName()+"已被撤回.";
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoTemp, MessageTypeEnum.PUSH.getName(), href);
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(href);
feishuMsgVo.setContentEn(contentInfoTemp);
feishuMsgVo.setContent(contentInfoFeiCn);
iFeishuService.sendCardMsgVirtua(thirdIdList.toArray(new String[]{}), feishuMsgVo,null,null);
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoTemp, MessageTypeEnum.PUSH.getName(), href);
}
}catch (Exception e){
e.printStackTrace();
@@ -1354,7 +1444,14 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
msgTitle = "The " + baseName + " virtual list you subscribed to has been updated";
//封装消息的实体类
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, msgTitle, content, contentInfo,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
msgTitle,
content,
contentInfo,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null,
null);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(idTemp, contentInfo);
//飞书
@@ -1368,7 +1465,13 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
contentInfo = "Please note that the "+baseName+" virtual list you subscribed to has been withdrawn.";
msgTitle = "The " + baseName + " virtual list you subscribed to has been withdrawn";
//封装消息的实体类
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, msgTitle, content, contentInfo,MessageTypeEnum.READ.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
msgTitle,
content,
contentInfo,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null,null);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(idTemp, contentInfo);
//飞书
@@ -25,6 +25,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
@@ -92,7 +93,11 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
queryWrapper.eq(ExtRepoData::getSupFolder, extRepoData.getSupFolder());
queryWrapper.orderBy(true, false, ExtRepoData::getCreateTime);
IPage<ExtRepoData> pageList = extRepoDataService.page(page, queryWrapper);
ExtRepoDataPage res = new ExtRepoDataPage(extRepoFolderService.haveManageAuth(extRepoData.getSupFolder()), pageList);
//判断当前文件夹或者上级文件夹是否有权限
HttpSession session = req.getSession();
session.setAttribute("haveSuperiorManageAuth", false);
extRepoFolderService.haveSuperiorManageAuth(extRepoData.getSupFolder(),session);
ExtRepoDataPage res = new ExtRepoDataPage((Boolean)session.getAttribute("haveSuperiorManageAuth"), pageList);
return Result.OK(res);
}
@@ -118,9 +123,12 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
@AutoLog(value = "对外报告数据表-添加")
@ApiOperation(value = "对外报告数据表-添加", notes = "对外报告数据表-添加")
@PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody ExtRepoData extRepoData) {
public Result<?> add(@Validated @RequestBody ExtRepoData extRepoData,HttpSession session) {
Result<ExtRepoData> result = new Result();
if (extRepoFolderService.haveManageAuth(extRepoData.getSupFolder())) {
//判断当前文件夹或者上级文件夹是否有权限
session.setAttribute("haveSuperiorManageAuth", false);
extRepoFolderService.haveSuperiorManageAuth(extRepoData.getSupFolder(),session);
if ((Boolean)session.getAttribute("haveSuperiorManageAuth")) {
log.info("对外报告数据表收到文件添加请求,开始处理文件:【" + sdf.format(new Date()) + "】");
int res = extRepoDataService.add(extRepoData);
if (CutEnum.CN.getValue().equals(extRepoData.getCut())) {
@@ -148,11 +156,14 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
@AutoLog(value = "对外报告数据表-编辑")
@ApiOperation(value = "对外报告数据表-编辑", notes = "对外报告数据表-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@Validated @RequestBody ExtRepoData extRepoData) {
public Result<?> edit(@Validated @RequestBody ExtRepoData extRepoData,HttpSession session) {
Result<ExtRepoData> result = new Result();
ExtRepoData erd = extRepoDataService.queryById(extRepoData.getId());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (extRepoFolderService.isManager() || sysUser.getUsername().equals(erd.getCreateBy())) {
//LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//判断当前文件夹或者上级文件夹是否有权限
session.setAttribute("haveSuperiorManageAuth", false);
extRepoFolderService.haveSuperiorManageAuth(erd.getSupFolder(),session);
if (extRepoFolderService.isManager() || (Boolean)session.getAttribute("haveSuperiorManageAuth")) {
extRepoData.setSupFolder(erd.getSupFolder());
extRepoDataService.editById(extRepoData);
if (CutEnum.CN.getValue().equals(extRepoData.getCut())) {
@@ -180,12 +191,15 @@ public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoD
@ApiOperation(value = "对外报告数据表-通过id删除", notes = "对外报告数据表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam("id") String id,
@RequestParam(name = "cut", defaultValue = "cn") String cut) {
@RequestParam(name = "cut", defaultValue = "cn") String cut,HttpSession session) {
Result<ExtRepoData> result = new Result();
ExtRepoData erd = extRepoDataService.queryById(id);
if (null != erd) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (extRepoFolderService.isManager() || sysUser.getUsername().equals(erd.getCreateBy())) {
//LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//判断当前文件夹或者上级文件夹是否有权限
session.setAttribute("haveSuperiorManageAuth", false);
extRepoFolderService.haveSuperiorManageAuth(erd.getSupFolder(),session);
if (extRepoFolderService.isManager() || (Boolean)session.getAttribute("haveSuperiorManageAuth")) {
extRepoDataService.deleteById(id);
CosBootUtil.delete(erd.getFileKey());
if (CutEnum.CN.getValue().equals(cut)) {
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.base.controller.JeroController;
import com.jero.modules.extRepo.entity.ERFTreeDataVO;
import com.jero.modules.extRepo.entity.ExtRepoData;
@@ -49,7 +50,7 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
@GetMapping(value = "/list")
public Result<ERFTreeDataVO> queryList() {
ERFTreeDataVO dataVO = new ERFTreeDataVO();
dataVO.setManager(extRepoFolderService.isManager());
//dataVO.setManager(extRepoFolderService.isManager());
dataVO.setList(extRepoFolderService.queryTreeList());
return Result.OK(dataVO);
}
@@ -66,11 +67,20 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
Result<ExtRepoFolder> result = new Result();
session.setAttribute("haveSuperiorManageAuth", false);
extRepoFolderService.haveSuperiorManageAuth(extRepoFolder.getSupFolder(),session);
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getSupFolder());
extRepoFolderService.haveSuperiorManageAuth(folder.getSupFolder(),session);
//上层是否有权限
boolean boo = (Boolean)session.getAttribute("haveSuperiorManageAuth");
if (boo||extRepoFolderService.haveManageAuth(extRepoFolder.getSupFolder())) {
if (!extRepoFolder.isAddSub()) {
//增加同级文件夹
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getSupFolder());
if (!boo) {
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
throw new JeroBootException("无法创建同级文件夹!请联系管理员!");
} else {
throw new JeroBootException("Unable to create a sibling folder ! Please Contact your administrator !");
}
}
extRepoFolder.setSupFolder(folder.getSupFolder());
}
extRepoFolderService.add(extRepoFolder);
@@ -89,6 +99,41 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
return result;
}
/**
* 是否允许增加同级文件夹
* @param extRepoFolder
* @return
*/
@AutoLog(value = "是否允许增加同级文件夹")
@ApiOperation(value = "是否允许增加同级文件夹", notes = "是否允许增加同级文件夹")
@PostMapping(value = "/isAllowSiblingFolder")
public Result<?> isAllowSiblingFolder(@Validated @RequestBody ExtRepoFolder extRepoFolder,
HttpSession session) {
Result<ExtRepoFolder> result = new Result();
session.setAttribute("haveSuperiorManageAuth", false);
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getId());
extRepoFolderService.haveSuperiorManageAuth(folder.getSupFolder(),session);
//上层是否有权限
boolean boo = (Boolean)session.getAttribute("haveSuperiorManageAuth");
if (boo || extRepoFolderService.haveManageAuth(extRepoFolder.getId())) {
if (!boo) {
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
return result.error500("无法创建同级文件夹!请联系管理员!");
} else {
return result.error500("Unable to create a sibling folder ! Please Contact your administrator !");
}
}
} else {
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
return result.error500("没有权限!");
} else {
return result.error500("You do not have permission !");
}
}
return result.success("");
}
/**
* 编辑
*
@@ -101,7 +146,7 @@ public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtR
public Result<?> edit(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
Result<ExtRepoFolder> result = new Result();
session.setAttribute("haveSuperiorManageAuth", false);
extRepoFolderService.haveSuperiorManageAuth(extRepoFolder.getSupFolder(),session);
extRepoFolderService.haveSuperiorManageAuth(extRepoFolder.getId(),session);
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
extRepoFolderService.editById(extRepoFolder);
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
@@ -56,6 +56,19 @@ public class ERFTreeData implements Comparable<ERFTreeData> {
*/
private String authManageIds = "";
/**
* 是否能点击右键
*/
private boolean isManager;
public boolean isManager() {
return isManager;
}
public void setManager(boolean manager) {
isManager = manager;
}
/**
* 子文件夹
*/
@@ -3,19 +3,19 @@ package com.jero.modules.extRepo.entity;
import java.util.List;
public class ERFTreeDataVO {
boolean isManager;
// boolean isManager;
List<ERFTreeData> list;
public ERFTreeDataVO() {
}
public boolean isManager() {
return isManager;
}
// public boolean isManager() {
// return isManager;
// }
public void setManager(boolean manager) {
isManager = manager;
}
// public void setManager(boolean manager) {
// isManager = manager;
// }
public List<ERFTreeData> getList() {
return list;
@@ -241,18 +241,21 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
List<ERFTreeData> resList = new ArrayList<>();
for (ExtRepoFolder erf : list) {
if (supId.equals(erf.getSupFolder())) {
int childLevel = level + 1;
if (haveViewAuth(erf.getId())) {
ERFTreeData date = new ERFTreeData(erf.getFolderName(), erf.getId(), level, erf.getOrderId());
boolean parentRightClick = haveManageAuth(erf.getId());
if (parentRightClick) {
date.setManager(true);
}
date.setAuthManageIdsName(erf.getAuthManageIdsName());
date.setAuthManageIds(erf.getAuthManageIds());
date.setAuthViewIdsName(erf.getAuthViewIdsName());
date.setAuthViewIds(erf.getAuthViewIds());
date.setChildren(subFolderTree(erf.getId(),new ArrayList<ERFTreeData>(),childLevel));
date.setChildren(subFolderTree(new ArrayList<ERFTreeData>(),date));
date.sortChildren();
resList.add(date);
} else {
resList.addAll(getSubFolder(erf.getId(), list, childLevel));
resList.addAll(getSubFolder(erf.getId(), list, level));
}
}
}
@@ -261,20 +264,36 @@ public class ExtRepoFolderServiceImpl extends ServiceImpl<ExtRepoFolderMapper, E
/**
* 父文件夹有权限则获取其下全部子文件夹
* @param folder
* @param level
* @param childTree
* @param father
* @return
*/
private List<ERFTreeData> subFolderTree(String folder,List<ERFTreeData> childTree,int level) {
int childLevel = level + 1;
List<ExtRepoFolder> listBySupFolder = getListBySupFolder(folder);
private List<ERFTreeData> subFolderTree(List<ERFTreeData> childTree,ERFTreeData father) {
int childLevel = father.getLevel() + 1;
List<ExtRepoFolder> listBySupFolder = getListBySupFolder(father.getKey());
for (ExtRepoFolder extRepoFolder : listBySupFolder) {
ERFTreeData date = new ERFTreeData(extRepoFolder.getFolderName(), extRepoFolder.getId(), childLevel, extRepoFolder.getOrderId());
date.setAuthManageIdsName(extRepoFolder.getAuthManageIdsName());
date.setAuthManageIds(extRepoFolder.getAuthManageIds());
date.setAuthViewIdsName(extRepoFolder.getAuthViewIdsName());
date.setAuthViewIds(extRepoFolder.getAuthViewIds());
date.setChildren(subFolderTree(extRepoFolder.getId(), new ArrayList<ERFTreeData>(),childLevel));
//是否有管理权限
boolean childRightClick = haveManageAuth(extRepoFolder.getId());
if (father.isManager()||childRightClick) {
date.setManager(true);
}
//如果参数为空则延续父文件夹权限,反之用自己的
if (ObjectUtils.isNotEmpty(extRepoFolder.getAuthManageIds()) && ObjectUtils.isNotEmpty(extRepoFolder.getAuthManageIdsName())) {
date.setAuthManageIdsName(extRepoFolder.getAuthManageIdsName());
date.setAuthManageIds(extRepoFolder.getAuthManageIds());
} else {
date.setAuthManageIdsName(father.getAuthManageIdsName());
date.setAuthManageIds(father.getAuthManageIds());
}
if (ObjectUtils.isNotEmpty(extRepoFolder.getAuthViewIds()) && ObjectUtils.isNotEmpty(extRepoFolder.getAuthViewIdsName())) {
date.setAuthViewIdsName(extRepoFolder.getAuthViewIdsName());
date.setAuthViewIds(extRepoFolder.getAuthViewIds());
} else {
date.setAuthViewIdsName(father.getAuthViewIdsName());
date.setAuthViewIds(father.getAuthViewIds());
}
date.setChildren(subFolderTree(new ArrayList<ERFTreeData>(),date));
date.sortChildren();
childTree.add(date);
}
@@ -1,9 +1,11 @@
package com.jero.modules.feishu.service;
import com.alibaba.fastjson.JSONObject;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
@@ -38,6 +40,42 @@ public interface IFeishuService {
*/
String sendCardMsg(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
/**
* 文档库卡片消息
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
String sendCardMsgDocument(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
/**
* 订阅领域(飞书消息)
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
String sendCardMsgTerritory(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
/**
* 预警推送(飞书消息)
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
String sendCardMsgWarn(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
/**
* 虚拟清单(飞书消息)
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
String sendCardMsgVirtua(String[] userIds, FeishuMsgVo feishuMsgVo, List<String> serialNumberAddList,List<String> serialNumberDeleteList) throws IOException;
/**
* 翻译文本
* @param params
@@ -62,4 +100,7 @@ public interface IFeishuService {
* @param split
*/
void sendKnowledgeBaseTypeChargePersonCard(String[] split);
void sendCard(String[] thirdIds, FeishuMsg2Vo feishuMsgVo) throws IOException;
}
@@ -8,6 +8,7 @@ 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.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.problemKnowledgeBase.entity.ProblemKnowledgeBaseClassifyEO;
import com.jero.modules.problemKnowledgeBase.entity.ProblemKnowledgeBaseEO;
@@ -24,6 +25,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -280,6 +282,476 @@ public class FeishuServiceImpl implements IFeishuService {
return tokenJson.get("msg").toString();
}
/**
* 文档库卡片消息
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
public String sendCardMsgDocument(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException {
String token = getTenantAccessToken();
// 设置请求头
Map<String, String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Bearer " + token);
headerMap.put("Content-Type", "application/json; charset=utf-8");
// 示例
StringBuilder contentSb = new StringBuilder();
contentSb.append("{");
contentSb.append("\"elements\": [");
// 内容中文
if (StrUtil.isNotEmpty(feishuMsgVo.getContent())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContent() + "\",");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
contentSb.append("{\"tag\": \"hr\"},");
//内容英文
if (StrUtil.isNotEmpty(feishuMsgVo.getContentEn())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContentEn() + "\",");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
contentSb.append("{");
contentSb.append("\"actions\": [");
contentSb.append("{");
contentSb.append("\"tag\": \"button\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"view\",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("},");
contentSb.append("\"type\": \"primary\",");
contentSb.append("\"url\": \" "+ feishuMsgVo.getUrl() +" \"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"tag\": \"action\"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"header\": {");
contentSb.append("\"template\": \"green\",");
contentSb.append("\"title\": {");
contentSb.append("\"content\": \" " + feishuMsgVo.getTitle() + " \",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("}");
contentSb.append("}");
contentSb.append("}");
JSONObject jsonObject = JSONObject.parseObject(contentSb.toString());
String content = JSONObject.parseObject(
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(0).toString()).get("text").toString())
.get("content").toString();
String contentEn = JSONObject.parseObject(
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(2).toString()).get("text").toString())
.get("content").toString();
JSONObject elementTwo =
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(1).toString());
JSONObject elementFour =
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(3).toString());
//处理内容中的双引号(将尖括号替换成双引号)
JSONObject elementOne = getJsonObject(jsonObject, content);
JSONObject elementThree = getJsonObject(jsonObject, contentEn);
JSONArray jsonArray = new JSONArray();
jsonArray.add(elementOne);
jsonArray.add(elementTwo);
jsonArray.add(elementThree);
jsonArray.add(elementFour);
jsonObject.put("elements",jsonArray);
// 设置请求参数
JSONObject paramsMap = new JSONObject();
paramsMap.put("user_ids", userIds);
paramsMap.put("msg_type", "interactive");
paramsMap.put("card", jsonObject);
// 发送请求给飞书
String response = HttpRequestUtil.getResponseOfPOST(batchSendMessageUrl, headerMap, paramsMap.toJSONString());
// 获取返回结果
JSONObject tokenJson = JSONObject.parseObject(response);
if(!tokenJson.get("code").toString().equals("0")) {
log.error("请求出现异常:" + tokenJson.get("msg") + " " + tokenJson);
}
return tokenJson.get("msg").toString();
}
/**
* 订阅领域(飞书消息)
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
public String sendCardMsgTerritory(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException {
String token = getTenantAccessToken();
// 设置请求头
Map<String, String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Bearer " + token);
headerMap.put("Content-Type", "application/json; charset=utf-8");
// 示例
StringBuilder contentSb = new StringBuilder();
contentSb.append("{");
contentSb.append("\"elements\": [");
// 内容中文
if (StrUtil.isNotEmpty(feishuMsgVo.getContent())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContent() + "\",");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
contentSb.append("{\"tag\": \"hr\"},");
//内容英文
if (StrUtil.isNotEmpty(feishuMsgVo.getContentEn())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContentEn() + "\",");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
contentSb.append("{");
contentSb.append("\"actions\": [");
contentSb.append("{");
contentSb.append("\"tag\": \"button\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"view\",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("},");
contentSb.append("\"type\": \"primary\",");
contentSb.append("\"url\": \" "+ feishuMsgVo.getUrl() +" \"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"tag\": \"action\"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"header\": {");
contentSb.append("\"template\": \"green\",");
contentSb.append("\"title\": {");
contentSb.append("\"content\": \" " + feishuMsgVo.getTitle() + " \",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("}");
contentSb.append("}");
contentSb.append("}");
JSONObject jsonObject = JSONObject.parseObject(contentSb.toString());
// 设置请求参数
JSONObject paramsMap = new JSONObject();
paramsMap.put("user_ids", userIds);
paramsMap.put("msg_type", "interactive");
paramsMap.put("card", jsonObject);
// 发送请求给飞书
String response = HttpRequestUtil.getResponseOfPOST(batchSendMessageUrl, headerMap, paramsMap.toJSONString());
// 获取返回结果
JSONObject tokenJson = JSONObject.parseObject(response);
if(!tokenJson.get("code").toString().equals("0")) {
log.error("请求出现异常:" + tokenJson.get("msg") + " " + tokenJson);
}
return tokenJson.get("msg").toString();
}
/**
* 预警推送(飞书消息)
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
public String sendCardMsgWarn(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException {
String token = getTenantAccessToken();
// 设置请求头
Map<String, String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Bearer " + token);
headerMap.put("Content-Type", "application/json; charset=utf-8");
// 示例
StringBuilder contentSb = new StringBuilder();
contentSb.append("{");
contentSb.append("\"elements\": [");
// 内容中文
if (StrUtil.isNotEmpty(feishuMsgVo.getContent())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContent() + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
// 编号,标题,新车型实施日期,在产车实施日期
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + "编号: " + feishuMsgVo.getRegulationNo() + "\n")
.append("标题: "+feishuMsgVo.getDocumentTitleCn() + "\n");
if (StringUtils.isNotBlank(feishuMsgVo.getNewTypeExecutionDate())) {
contentSb.append("新车型实施日期: " + feishuMsgVo.getNewTypeExecutionDate() + "\n");
} else {
contentSb.append("新车型实施日期: "+ "\n");
}
if (StringUtils.isNotBlank(feishuMsgVo.getNewVehicleExecutionDate())) {
contentSb.append("在产车实施日期: " + feishuMsgVo.getNewVehicleExecutionDate());
} else {
contentSb.append("在产车实施日期: ");
}
contentSb.append("\",");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
contentSb.append("{\"tag\": \"hr\"},");
//内容英文
if (StrUtil.isNotEmpty(feishuMsgVo.getContentEn())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContentEn() + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
// 编号,标题,新车型实施日期,在产车实施日期
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + "Regulation No: " + feishuMsgVo.getRegulationNo() + "\n")
.append("Title: " + feishuMsgVo.getDocumentTitleEn() + "\n");
if (StringUtils.isNotBlank(feishuMsgVo.getNewTypeExecutionDate())) {
contentSb.append("New Type Execution Date: " + feishuMsgVo.getNewTypeExecutionDate() + "\n");
} else {
contentSb.append("New Type Execution Date: "+ "\n");
}
if (StringUtils.isNotBlank(feishuMsgVo.getNewVehicleExecutionDate())) {
contentSb.append("New Vehicle Execution Date: " + feishuMsgVo.getNewVehicleExecutionDate());
} else {
contentSb.append("New Vehicle Execution Date: ");
}
contentSb.append("\",");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
contentSb.append("{");
contentSb.append("\"actions\": [");
contentSb.append("{");
contentSb.append("\"tag\": \"button\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"view\",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("},");
contentSb.append("\"type\": \"primary\",");
contentSb.append("\"url\": \" "+ feishuMsgVo.getUrl() +" \"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"tag\": \"action\"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"header\": {");
contentSb.append("\"template\": \"green\",");
contentSb.append("\"title\": {");
contentSb.append("\"content\": \" " + feishuMsgVo.getTitle() + " \",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("}");
contentSb.append("}");
contentSb.append("}");
JSONObject jsonObject = JSONObject.parseObject(contentSb.toString());
// 设置请求参数
JSONObject paramsMap = new JSONObject();
paramsMap.put("user_ids", userIds);
paramsMap.put("msg_type", "interactive");
paramsMap.put("card", jsonObject);
// 发送请求给飞书
String response = HttpRequestUtil.getResponseOfPOST(batchSendMessageUrl, headerMap, paramsMap.toJSONString());
// 获取返回结果
JSONObject tokenJson = JSONObject.parseObject(response);
if(!tokenJson.get("code").toString().equals("0")) {
log.error("请求出现异常:" + tokenJson.get("msg") + " " + tokenJson);
}
return tokenJson.get("msg").toString();
}
/**
* 虚拟清单发布(飞书消息)
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
public String sendCardMsgVirtua(String[] userIds, FeishuMsgVo feishuMsgVo,
List<String> serialNumberAddList,List<String> serialNumberDeleteList) throws IOException {
String token = getTenantAccessToken();
// 设置请求头
Map<String, String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Bearer " + token);
headerMap.put("Content-Type", "application/json; charset=utf-8");
// 示例
StringBuilder contentSb = new StringBuilder();
contentSb.append("{");
contentSb.append("\"elements\": [");
// 内容中文
if (StrUtil.isNotEmpty(feishuMsgVo.getContent())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContent() + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
int count = 1;
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + count + ". 新增文档: " + StringUtils.join(serialNumberAddList,",") + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
int count = 2;
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + count + ". 删除文档: " + StringUtils.join(serialNumberDeleteList,",") + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
}
contentSb.append("{\"tag\": \"hr\"},");
//内容英文
if (StrUtil.isNotEmpty(feishuMsgVo.getContentEn())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContentEn() + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
if (ObjectUtils.isNotEmpty(serialNumberAddList)) {
int count = 1;
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + count + ". New regulations: " + StringUtils.join(serialNumberAddList,",") + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
}
if (ObjectUtils.isNotEmpty(serialNumberDeleteList)) {
int count = 2;
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + count + ". Remove regulations: " + StringUtils.join(serialNumberDeleteList,",") + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
}
contentSb.append("{");
contentSb.append("\"actions\": [");
contentSb.append("{");
contentSb.append("\"tag\": \"button\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"view\",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("},");
contentSb.append("\"type\": \"primary\",");
contentSb.append("\"url\": \" "+ feishuMsgVo.getUrl() +" \"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"tag\": \"action\"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"header\": {");
contentSb.append("\"template\": \"green\",");
contentSb.append("\"title\": {");
contentSb.append("\"content\": \" " + feishuMsgVo.getTitle() + " \",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("}");
contentSb.append("}");
contentSb.append("}");
JSONObject jsonObject = JSONObject.parseObject(contentSb.toString());
// 设置请求参数
JSONObject paramsMap = new JSONObject();
paramsMap.put("user_ids", userIds);
paramsMap.put("msg_type", "interactive");
paramsMap.put("card", jsonObject);
// 发送请求给飞书
String response = HttpRequestUtil.getResponseOfPOST(batchSendMessageUrl, headerMap, paramsMap.toJSONString());
// 获取返回结果
JSONObject tokenJson = JSONObject.parseObject(response);
if(!tokenJson.get("code").toString().equals("0")) {
log.error("请求出现异常:" + tokenJson.get("msg") + " " + tokenJson);
}
return tokenJson.get("msg").toString();
}
@NotNull
private JSONObject getJsonObject(JSONObject jsonObject, String content) {
String contentReplaceAll = content.replaceAll("<", "\"");
JSONObject jsonObject1 = JSONObject.parseObject(
JSONObject.parseObject(
JSONArray.parseArray(jsonObject.get("elements").toString()).get(0).toString())
.get("text").toString());
jsonObject1.put("content",contentReplaceAll);
JSONObject elementOne =
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(0).toString());
elementOne.put("text",jsonObject1);
return elementOne;
}
/**
* 翻译文本
* 参数:
@@ -674,4 +1146,86 @@ public class FeishuServiceImpl implements IFeishuService {
}
}
/**
* 发送消息
* @param thirdIds
* @param feishuMsgVo
*/
@Override
public void sendCard(String[] thirdIds, FeishuMsg2Vo feishuMsgVo) throws IOException {
String token = getTenantAccessToken();
// 设置请求头
Map<String, String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Bearer " + token);
headerMap.put("Content-Type", "application/json; charset=utf-8");
String sendJson = "{\n" +
" \"config\": {\n" +
" \"wide_screen_mode\": true\n" +
" },\n" +
" \"elements\": [\n" +
" {\n" +
" \"tag\": \"markdown\",\n" +
" \"content\": \"" + feishuMsgVo.getCnContentUpper() + "\"\n" +
" },\n" +
" {\n" +
" \"tag\": \"markdown\",\n" +
" \"content\": \"" + feishuMsgVo.getCnContentLower() + "\"\n" +
" },\n" +
" {\n" +
" \"tag\": \"hr\"\n" +
" },\n" +
" {\n" +
" \"tag\": \"markdown\",\n" +
" \"content\": \"" + feishuMsgVo.getEnContentUpper() + "\"\n" +
" },\n" +
" {\n" +
" \"tag\": \"markdown\",\n" +
" \"content\": \"" + feishuMsgVo.getEnContentLower() + "\"\n" +
" },\n" +
" {\n" +
" \"actions\": [\n" +
" {\n" +
" \"tag\": \"button\",\n" +
" \"text\": {\n" +
" \"content\": \"View\",\n" +
" \"tag\": \"plain_text\"\n" +
" },\n" +
" \"type\": \"primary\",\n" +
" \"url\": \"" + feishuMsgVo.getUrl() + "\"\n" +
" }\n" +
" ],\n" +
" \"tag\": \"action\"\n" +
" }\n" +
" ],\n" +
" \"header\": {\n" +
" \"template\": \"" + feishuMsgVo.getColor() + "\",\n" +
" \"title\": {\n" +
" \"content\": \"" + feishuMsgVo.getTitle() + "\",\n" +
" \"tag\": \"plain_text\"\n" +
" }\n" +
" }\n" +
"}";
JSONObject jsonObject = JSONObject.parseObject(sendJson.toString());
// 设置请求参数
JSONObject paramsMap = new JSONObject();
paramsMap.put("user_ids", thirdIds);
paramsMap.put("msg_type", "interactive");
paramsMap.put("card", jsonObject);
// 发送请求给飞书
String response = HttpRequestUtil.getResponseOfPOST(batchSendMessageUrl, headerMap, paramsMap.toJSONString());
// 获取返回结果
JSONObject tokenJson = JSONObject.parseObject(response);
if (!tokenJson.get("code").toString().equals("0")) {
log.error("请求出现异常:" + tokenJson.get("msg") + " " + tokenJson);
}
}
}
@@ -0,0 +1,20 @@
package com.jero.modules.feishu.vo;
import lombok.Data;
@Data
public class FeishuMsg2Vo {
private String title; //标题
private String color; //颜色
private String enContentUpper; //英文内容上部
private String enContentLower; //英文内容下部
private String cnContentUpper; //中文内容上部
private String cnContentLower; //中文内容下部
private String url; //回调的网址
}
@@ -12,6 +12,8 @@ public class FeishuMsgVo {
private String content; //内容
private String contentEn; //内容英文
private String taskType; //任务类型
private String regulationNo; //法规编号
@@ -26,5 +28,14 @@ public class FeishuMsgVo {
private String assignee; //评估人 适用范围:责任人提交通知发起人(设计符合性,pre-homo符合性,验证符合性)
private String documentTitleCn; //文档标题中文
private String documentTitleEn; //文档标题英文
private String newTypeExecutionDate; //新车型实施日期
private String newVehicleExecutionDate; //在产车实施日期
}
@@ -8,13 +8,16 @@ import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO;
import com.jero.modules.lawsOpinionGather.service.ILawsOpinionGatherEOService;
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.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -37,6 +40,8 @@ import com.jero.common.aspect.annotation.AutoLog;
public class LawsOpinionGatherEOController extends JeroController<LawsOpinionGatherEO, ILawsOpinionGatherEOService> {
@Autowired
private ILawsOpinionGatherEOService lawsOpinionGatherEOService;
@Autowired
private ISysUserService sysUserService;
/**
* 分页列表查询
@@ -57,6 +62,19 @@ public class LawsOpinionGatherEOController extends JeroController<LawsOpinionGat
HttpServletRequest req) {
QueryWrapper<LawsOpinionGatherEO> queryWrapper = QueryGenerator.initQueryWrapper(lawsOpinionGatherEO, req.getParameterMap());
queryWrapper.orderByDesc("start_time");
/**
* 创建查询数据权限,超级管理员可以看到所有的数据,并且能删除,其它用户只能看到自己创建、或自己为评估人的数据。
*/
boolean administrator = this.sysUserService.isAdministrator();
if(!administrator){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//如果不是超级管理员,获取自己所有参与过的法规意见收集
queryWrapper.and(query -> {
query.eq("create_by",currentUser.getUsername());
query.or().like("evaluator_ids",currentUser.getId());
});
}
Page<LawsOpinionGatherEO> page = new Page<LawsOpinionGatherEO>(pageNo, pageSize);
IPage<LawsOpinionGatherEO> pageList = lawsOpinionGatherEOService.page(page, queryWrapper);
this.lawsOpinionGatherEOService.disposeData(pageList.getRecords(),cut);
@@ -122,4 +122,8 @@ public class LawsOpinionGatherEO implements Serializable {
@ApiModelProperty(value = "评估人ids,多个之间使用英文逗号分隔")
private String evaluatorIds;
/**删除标识 true 可以删除,false,没有权限删除**/
@TableField(exist = false)
private boolean deleteFlag = false;
}
@@ -2,6 +2,7 @@ package com.jero.modules.lawsOpinionGather.job;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsOpinionGather.service.ILawsOpinionGatherEOService;
@@ -41,18 +42,45 @@ public class LawsOpinionGatherRemindJob implements Job {
if(CollectionUtils.isNotEmpty(lawsOpinionGatherEOList)){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date currentDate = new Date();
//Date currentDate = new Date();
String now = sdf.format(new Date());
//获取后一天的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,1);
Date nextDay = calendar.getTime();
//Calendar calendar=new GregorianCalendar();
//calendar.setTime(new Date());
//calendar.add(Calendar.DATE,1);
//Date nextDay = calendar.getTime();
String nextDayStr = sdf.format(nextDay);
//String nextDayStr = sdf.format(nextDay);
lawsOpinionGatherEOList.forEach(lawsOpinionGatherEO -> {
if(StringUtils.equals(nextDayStr,sdf.format(lawsOpinionGatherEO.getEndTime()))){
String endTime = sdf.format(lawsOpinionGatherEO.getEndTime());
int days = 0;
try {
days = (int) (sdf.parse(endTime).getTime() - sdf.parse(now).getTime()) / (24 * 60 * 60 * 1000);
} catch (Exception e) {
e.printStackTrace();
throw new JeroBootException("日期转换错误");
}
if (days == 3) {
List<String> userIdList = this.workFlowFeignClient.getLawsOpinionGatherFlowAssigneeList(lawsOpinionGatherEO.getId());
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue());
sendJsonObject.put("lawsOpinionGatherId",lawsOpinionGatherEO.getId());
sendJsonObject.put("userIdList",userIdList);
this.lawsOpinionGatherEOService.workFlowSendMsg(sendJsonObject);
}
} else if (endTime.equals(now)) {
List<String> userIdList = this.workFlowFeignClient.getLawsOpinionGatherFlowAssigneeList(lawsOpinionGatherEO.getId());
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_TODAY_MSG.getValue());
sendJsonObject.put("lawsOpinionGatherId",lawsOpinionGatherEO.getId());
sendJsonObject.put("userIdList",userIdList);
this.lawsOpinionGatherEOService.workFlowSendMsg(sendJsonObject);
}
}
/*if(StringUtils.equals(nextDayStr,sdf.format(lawsOpinionGatherEO.getEndTime()))){
List<String> userIdList = this.workFlowFeignClient.getLawsOpinionGatherFlowAssigneeList(lawsOpinionGatherEO.getId());
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
@@ -62,7 +90,7 @@ public class LawsOpinionGatherRemindJob implements Job {
sendJsonObject.put("userIdList",userIdList);
this.lawsOpinionGatherEOService.workFlowSendMsg(sendJsonObject);
}
}
}*/
});
}
@@ -191,14 +191,23 @@ public class LawsOpinionAssessmentResultEOServiceImpl extends ServiceImpl<LawsOp
this.disposeData(exportData,lawsOpinionAssessmentResultEO,cut);
String lawsOpinionGatherId = (String)params.get("lawsOpinionGatherId");
if(StringUtils.isEmpty(lawsOpinionGatherId)){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
throw new JeroBootException("法规意见收集id为空,请检查!");
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
throw new JeroBootException("The lawsOpinionGatherId is empty, please check!");
}
}
LawsOpinionGatherEO lawsOpinionGatherEO = this.lawsOpinionGatherEOService.queryById(lawsOpinionGatherId);
String title = "";
String fileName = "";
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
title = "相关章节,问题/建议,理由,条款内容,附件,评估人,提出时间";
fileName = "评估结果" + ".xls";
fileName = lawsOpinionGatherEO.getSerialNumber() + " 评估结果" + ".xls";
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
title = "Related section,IssueOrSuggest,Reason,Item Content,Accessory,Evaluator,Submit Date";
fileName = "Evaluation results" + ".xls";
fileName = lawsOpinionGatherEO.getSerialNumber() + " Evaluation results" + ".xls";
}
OutputStream os = null;
@@ -5,8 +5,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
@@ -35,12 +42,15 @@ import com.jero.modules.todoCenter.service.IProcessInfoEOService;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import com.jero.modules.wkflow.feginClient.WorkFlowFeignClient;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.modules.jmreport.common.constant.CommonConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -75,6 +85,10 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
private WorkFlowFeignClient workFlowFeignClient;
@Autowired
private IProcessInfoEOService processInfoEOService;
@Autowired
private IFeishuService feishuService;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
/**
* 保存
@@ -194,6 +208,13 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
lawsOpinionGatherEO.setId(jsonObject.getString("id"));
lawsOpinionGatherEO.setGatherResult(jsonObject.getString("gatherResult"));
this.baseMapper.updateById(lawsOpinionGatherEO);
//飞书
JSONObject sendMsgJson = new JSONObject();
sendMsgJson.put("lawsOpinionGatherId",jsonObject.getString("id"));
sendMsgJson.put("initiatorUserId",jsonObject.getString("initiatorUserId"));
sendMsgJson.put("msgType", MsgTypeEnum.LAWS_OPOMOPM_GATHER_COMPLETE_MSG.getValue());
workFlowSendMsg(sendMsgJson);
}
// 发送消息
@@ -206,6 +227,8 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
@Override
public void disposeData(List<LawsOpinionGatherEO> lawsOpinionGatherEOList,String cut) {
if(CollectionUtils.isNotEmpty(lawsOpinionGatherEOList)){
boolean administrator = this.sysUserService.isAdministrator();
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//树形数据字典
List<SysCategory> technologyTerritoryList = sysCategoryService.list();
lawsOpinionGatherEOList.forEach(lawsOpinionGather -> {
@@ -220,6 +243,10 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
List<OSSFile> opinionArchiveFileList = iOSSFileService.getFileInfosByConnectId(StringUtils.join(lawsOpinionGather.getOpinionArchiveId(), ","));
lawsOpinionGather.setOpinionArchiveFileList(opinionArchiveFileList);
}
//如果当前用户是超级管理员,或是这条数据的创建人,给删除权限。
if(StringUtils.equals(lawsOpinionGather.getCreateBy(),currentUser.getUsername()) || administrator){
lawsOpinionGather.setDeleteFlag(true);
}
});
}
}
@@ -265,51 +292,143 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
}
String lawsOpinionGatherId = jsonObject.getString("lawsOpinionGatherId");
String serialNumber = jsonObject.getString("serialNumber"); //文档库编号
//String serialNumber = jsonObject.getString("serialNumber"); //文档库编号
List<String> userIdList = new ArrayList<>();
String msgContentEN = "";
String msgTitle = "";
//String msgContentEN = "";
//String msgTitle = "";
LawsOpinionGatherEO lawsOpinionGatherEO = queryById(lawsOpinionGatherId);
//英文标题
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(lawsOpinionGatherEO.getStandId());
//Map<String, String> lawsOpinionGatherPrcInfo = this.workFlowFeignClient.getLawsOpinionGatherPrcInfo(lawsOpinionGatherId);
String initiator = "";
String title = MessageType2Enum.REGULATION_OPINION_COLLECTION.getCn() + "/" + MessageType2Enum.REGULATION_OPINION_COLLECTION.getEn();
String endTime = new SimpleDateFormat("yyyy-MM-dd").format(lawsOpinionGatherEO.getEndTime());//截止日期
//String prcNum = lawsOpinionGatherPrcInfo.get("prcNum");
//String prcName = lawsOpinionGatherPrcInfo.get("prcName");
String cnContentUpper = "";
String cnContentLower = "";
String enContentUpper = "";
String enContentLower = "";
if(StringUtils.equals(msgType,MsgTypeEnum.LAWS_OPOMOPM_GATHER_START_MSG.getValue())){
userIdList.addAll(Arrays.asList(jsonObject.getString("evaluatorIds").split(",")));
String endTime = jsonObject.getString("endTime"); //截止日期
msgContentEN = "You recieved the Collection of Legislative Comments of "+serialNumber+" . The due date is "+endTime+". Please check and address it in a timely manner.";
msgTitle = "You have a Collection of Legislative Comments task to complete";
//msgContentEN = "You recieved the Collection of Legislative Comments of "+serialNumber+" . The due date is "+endTime+". Please check and address it in a timely manner.";
//msgTitle = "You have a Collection of Legislative Comments task to complete";
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
initiator = currentUser.getUsername();
cnContentUpper = "您好,请及时查看处理此项任务,谢谢!";
cnContentLower = "编号: " + lawsOpinionGatherEO.getSerialNumber() +
"\n标题: " + lawsOpinionGatherEO.getTitle() +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No: " + lawsOpinionGatherEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}else if(StringUtils.equals(msgType,MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_SUBMIT_MSG.getValue())){
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
userIdList.add(jsonObject.getString("initiatorUserId"));
msgContentEN = currentUser.getUsername() + " has submitted the collection process of Collection of Legislative Comments of "+serialNumber+", please check it in time.";
msgTitle = "You have a Collection of Legislative Comments task completed";
//msgContentEN = currentUser.getUsername() + " has submitted the collection process of Collection of Legislative Comments of "+serialNumber+", please check it in time.";
//msgTitle = "You have a Collection of Legislative Comments task completed";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
}else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_MSG.getValue())){
initiator = currentUser.getUsername();
cnContentUpper = "您好,"+ currentUser.getUsername() +"已提交反馈意见,请查看";
cnContentLower = "编号: " + lawsOpinionGatherEO.getSerialNumber() +
"\n标题: " + lawsOpinionGatherEO.getTitle() +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! "+ currentUser.getUsername() +" has submitted the comments. Please check it";
enContentLower = "Regulation No: " + lawsOpinionGatherEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue())) {
userIdList = (List<String>) jsonObject.get("userIdList");
msgContentEN = "The the Collection of Legislative Comments of "+serialNumber+" will expire tomorrow . Please check and address it in time.";
msgTitle = "You have a Collection of Legislative Comments task to complete";
cnContentUpper = "您好,该任务将于3天后到期,请及时查看处理,谢谢!";
cnContentLower = "编号: " + lawsOpinionGatherEO.getSerialNumber() +
"\n标题: " + lawsOpinionGatherEO.getTitle() +
"\n发起人: 系统通知" ;
enContentUpper = "Hello! This task will expire in 3 days. Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No: " + lawsOpinionGatherEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_TODAY_MSG.getValue())){
userIdList = (List<String>) jsonObject.get("userIdList");
cnContentUpper = "您好,该任务将于今天到期,请尽快查看处理,谢谢!";
cnContentLower = "编号: " + lawsOpinionGatherEO.getSerialNumber() +
"\n标题: " + lawsOpinionGatherEO.getTitle() +
"\n发起人: 系统通知";
enContentUpper = "Hello! This task will expire today. Please check and address the task ASAP. Thank you!";
enContentLower = "Regulation No: " + lawsOpinionGatherEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_COMPLETE_MSG.getValue())) {
userIdList.add((String) jsonObject.get("initiatorUserId"));
cnContentUpper = "您好,该任务已完成,请查看";
cnContentLower = "编号: " + lawsOpinionGatherEO.getSerialNumber() +
"\n标题: " + lawsOpinionGatherEO.getTitle() +
"\n发起人: 系统通知"+
"\n截止时间: " + endTime;
enContentUpper = "Hello! The task is completed. Please check it.";
enContentLower = "Regulation No: " + lawsOpinionGatherEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName() +
"\nDue Date: " + endTime;
}
/*else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_MSG.getValue())){
userIdList = (List<String>) jsonObject.get("userIdList");
//msgContentEN = "The the Collection of Legislative Comments of "+serialNumber+" will expire tomorrow . Please check and address it in time.";
//msgTitle = "You have a Collection of Legislative Comments task to complete";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
}*/
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//飞书跳转链接
String hrefFeishu = backUrl + JumpLinkEnum.TASK_AFFIRM_LINK.getLink();
String hrefFeishu = backUrl + JumpLinkEnum.FGPG_TODO_CENTER_LINK.getLink();
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//系统内部跳转链接
String href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
//String href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsOpinionGatherId,sendMessageMap,null,MessageTypeEnum.COLLECTION_OF_LEGISLATIVE_COMMENTS,initiator);
//SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsOpinionGatherId,sendMessageMap,null,MessageTypeEnum.COLLECTION_OF_LEGISLATIVE_COMMENTS,initiator);
}
@Override
@@ -3,19 +3,26 @@ package com.jero.modules.lawsTechnologyEvaluation.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService;
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.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationFlowDetailEOService;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -40,6 +47,10 @@ import com.jero.common.aspect.annotation.AutoLog;
public class LawsTechnologyEvaluationEOController extends JeroController<LawsTechnologyEvaluationEO, ILawsTechnologyEvaluationEOService> {
@Autowired
private ILawsTechnologyEvaluationEOService lawsTechnologyEvaluationEOService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private ILawsTechnologyEvaluationFlowDetailEOService lawsTechnologyEvaluationFlowDetailEOService;
/**
* 分页列表查询
@@ -60,6 +71,10 @@ public class LawsTechnologyEvaluationEOController extends JeroController<LawsTec
HttpServletRequest req) {
QueryWrapper<LawsTechnologyEvaluationEO> queryWrapper = QueryGenerator.initQueryWrapper(lawsTechnologyEvaluationEO, req.getParameterMap());
queryWrapper.orderByDesc("start_time");
boolean administrator = this.sysUserService.isAdministrator();
if(!administrator){
this.lawsTechnologyEvaluationEOService.createQueryPermission(queryWrapper,lawsTechnologyEvaluationEO,administrator);
}
Page<LawsTechnologyEvaluationEO> page = new Page<LawsTechnologyEvaluationEO>(pageNo, pageSize);
IPage<LawsTechnologyEvaluationEO> pageList = lawsTechnologyEvaluationEOService.page(page, queryWrapper);
this.lawsTechnologyEvaluationEOService.disposeData(pageList.getRecords(),cut);
@@ -149,4 +149,7 @@ public class LawsTechnologyEvaluationEO implements Serializable {
@ApiModelProperty(value = "流程编号")
private String prcNum;
/**删除标识 true 可以删除,false,没有权限删除**/
@TableField(exist = false)
private boolean deleteFlag = false;
}
@@ -2,6 +2,7 @@ package com.jero.modules.lawsTechnologyEvaluation.job;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO;
@@ -52,14 +53,16 @@ public class LawsTechnologyEvaluationRemindJob implements Job {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//获取后一天的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,1);
Date nextDay = calendar.getTime();
//Calendar calendar=new GregorianCalendar();
//calendar.setTime(new Date());
//calendar.add(Calendar.DATE,1);
//Date nextDay = calendar.getTime();
String nextDayStr = sdf.format(nextDay);
//String nextDayStr = sdf.format(nextDay);
String now = sdf.format(new Date());
LawsTechnologyEvaluationEOList.forEach(lawsTechnologyEvaluationEO -> {
if(StringUtils.equals(nextDayStr,sdf.format(lawsTechnologyEvaluationEO.getEndTime()))){
/*if(StringUtils.equals(nextDayStr,sdf.format(lawsTechnologyEvaluationEO.getEndTime()))){
String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> {
boolean flag = false;
@@ -80,6 +83,56 @@ public class LawsTechnologyEvaluationRemindJob implements Job {
this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject);
}
}
}*/
String endTime = sdf.format(lawsTechnologyEvaluationEO.getEndTime());
int days = 0;
try {
days = (int) (sdf.parse(endTime).getTime() - sdf.parse(now).getTime()) / (24 * 60 * 60 * 1000);
} catch (Exception e) {
e.printStackTrace();
throw new JeroBootException("日期转换错误");
}
if (days == 3) {
//到期前3天
String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> {
boolean flag = false;
if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) {
flag = true;
}
return flag;
}).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(actiProcInstIds)){
List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds);
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue());
sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId());
sendJsonObject.put("userIdList",userIdList);
this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject);
}
}
} else if (endTime.equals(now)){
//当天
String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> {
boolean flag = false;
if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) {
flag = true;
}
return flag;
}).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(actiProcInstIds)){
List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds);
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG.getValue());
sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId());
sendJsonObject.put("userIdList",userIdList);
this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject);
}
}
}
});
}
@@ -14,4 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface LawsTechnologyEvaluationFlowDetailEOMapper extends BaseMapper<LawsTechnologyEvaluationFlowDetailEO> {
LawsTechnologyEvaluationFlowDetailEO queryByEvaluationId(@Param("lawsTechnologyEvaluationId") String lawsTechnologyEvaluationId);
}
@@ -14,4 +14,11 @@
<result column="prc_name" property="prcName" />
<result column="evaluator_id" property="evaluatorId" />
</resultMap>
</mapper>
<select id="queryByEvaluationId" resultMap="LawsTechnologyEvaluationFlowDetailEOResultMap">
select * from laws_technology_evaluation_flow_detail where laws_technology_evaluation_id = #{lawsTechnologyEvaluationId}
</select>
</mapper>
@@ -1,6 +1,7 @@
package com.jero.modules.lawsTechnologyEvaluation.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
@@ -92,4 +93,6 @@ public interface ILawsTechnologyEvaluationEOService extends IService<LawsTechnol
void workFlowSendMsg(JSONObject jsonObject);
Result<?> batchCompleteTask(JSONObject jsonObject);
void createQueryPermission(QueryWrapper<LawsTechnologyEvaluationEO> queryWrapper, LawsTechnologyEvaluationEO lawsTechnologyEvaluationEO,boolean administrator);
}
@@ -11,11 +11,13 @@ import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.FileUtils;
import com.jero.common.util.oss.CosBootUtil;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationComplianceResultEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationResultEO;
import com.jero.modules.lawsTechnologyEvaluation.enums.ComplianceResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.mapper.LawsTechnologyEvaluationComplianceResultEOMapper;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationComplianceResultEOService;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationFlowDetailEOService;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationResultEOService;
import com.jero.modules.oss.entity.OSSFile;
@@ -64,6 +66,8 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi
private ILawsTechnologyEvaluationFlowDetailEOService lawsTechnologyEvaluationFlowDetailEOService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private ILawsTechnologyEvaluationEOService lawsTechnologyEvaluationEOService;
/**
* 保存
@@ -173,6 +177,15 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi
Map<String, Object> params) {
String ids = (String)params.get("ids");
String cut = (String)params.get("cut");
String lawsTechnologyEvaluationId = (String)params.get("lawsTechnologyEvaluationId");
if(StringUtils.isEmpty(lawsTechnologyEvaluationId)){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
throw new JeroBootException("法规技术评估id为空,请检查!");
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
throw new JeroBootException("The lawsTechnologyEvaluationId is empty, please check!");
}
}
LawsTechnologyEvaluationEO lawsTechnologyEvaluationEO = this.lawsTechnologyEvaluationEOService.queryById(lawsTechnologyEvaluationId);
if(!StringUtils.isEmpty(ids)){
lawsTechnologyEvaluationComplianceResultEO.setIds(ids);
@@ -187,12 +200,12 @@ public class LawsTechnologyEvaluationComplianceResultEOServiceImpl extends Servi
if(org.apache.commons.lang3.StringUtils.equals(cut, CutEnum.CN.getValue())){
title = "相关章节,问题说明,附件";
bottomTitle = "符合性结果:";
fileName = "评估结果" + ".xls";
fileName = lawsTechnologyEvaluationEO.getSerialNumber() + " 评估结果" + ".xls";
sheetName = "反馈结果";
}else if(org.apache.commons.lang3.StringUtils.equals(cut,CutEnum.EN.getValue())){
title = "Related section,Problem description,Accessory";
bottomTitle = "Compliance results:";
fileName = "Evaluation results" + ".xls";
fileName = lawsTechnologyEvaluationEO.getSerialNumber() + " Evaluation results" + ".xls";
sheetName = "Feedback result";
}
@@ -6,19 +6,22 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.constant.enums.CutEnum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.ModuleEnum;
import com.jero.common.constant.enums.*;
import com.jero.common.exception.JeroBootException;
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.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.enums.FieldTypeEnum;
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO;
import com.jero.modules.lawsTechnologyEvaluation.mapper.LawsTechnologyEvaluationEOMapper;
import com.jero.modules.lawsTechnologyEvaluation.mapper.LawsTechnologyEvaluationFlowDetailEOMapper;
import com.jero.modules.lawsTechnologyEvaluation.service.*;
import com.jero.modules.project.enums.JumpLinkEnum;
import com.jero.modules.project.enums.MsgTypeEnum;
@@ -40,17 +43,21 @@ import com.jero.modules.wkflow.enums.FlowTypeEnum;
import com.jero.modules.wkflow.feginClient.WorkFlowFeignClient;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.shiro.SecurityUtils;
import org.jeecg.modules.jmreport.common.constant.CommonConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -103,6 +110,11 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
@Autowired
private IProcessInfoEOService processInfoEOService;
@Autowired
private IFeishuService feishuService;
@Autowired
private LawsTechnologyEvaluationFlowDetailEOMapper flowDetailEOMapper;
/**
* 保存
*
@@ -239,6 +251,8 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
@Override
public void disposeData(List<LawsTechnologyEvaluationEO> datas, String cut) {
if(CollectionUtils.isNotEmpty(datas)){
boolean administrator = this.sysUserService.isAdministrator();
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<SysCategory> categoryList = sysCategoryService.list();
for (LawsTechnologyEvaluationEO data : datas) {
if(StringUtils.isNotEmpty(data.getEvaluationMethods())){
@@ -254,6 +268,9 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
String name = getTreeName(cut, categoryList, technologyTerritory);
data.setTechnologyTerritoryName(name);
}
if(administrator || StringUtils.equals(data.getCreateBy(),currentUser.getUsername())){
data.setDeleteFlag(true);
}
}
}
}
@@ -602,69 +619,166 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
throw new JeroBootException("发送消息类型不能为空,请检查!");
}
String lawsTechnologyEvaluationId = jsonObject.getString("lawsTechnologyEvaluationId");
String serialNumber = jsonObject.getString("serialNumber"); //文档库编号
//String lawsTechnologyEvaluationId = jsonObject.getString("lawsTechnologyEvaluationId");
//String serialNumber = jsonObject.getString("serialNumber"); //文档库编号
List<String> userIdList = new ArrayList<>();
String msgContentEN = "";
String msgTitle = "";
//String msgContentEN = "";
//String msgTitle = "";
String initiator = "";
String lawsTechnologyEvaluationId = jsonObject.getString("lawsTechnologyEvaluationId");
LawsTechnologyEvaluationEO lawsTechnologyEvaluationEO = queryById(lawsTechnologyEvaluationId);
//LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId);
//String number = flowDetailEO.getPrcNum();
//String name = flowDetailEO.getPrcName();
String endTime = new SimpleDateFormat("yyyy-MM-dd").format(lawsTechnologyEvaluationEO.getEndTime());
//英文标题
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(lawsTechnologyEvaluationEO.getStandId());
String title = MessageType2Enum.REGULATION_TECHNICAL_ASSESSMENT.getCn() + "/" + MessageType2Enum.REGULATION_TECHNICAL_ASSESSMENT.getEn();
String cnContentUpper = "";
String cnContentLower = "";
String enContentUpper = "";
String enContentLower = "";
if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_START_MSG.getValue())){
userIdList.add(jsonObject.getString("evaluationId"));
String endTime = jsonObject.getString("endTime"); //截止日期
//String endTime = jsonObject.getString("endTime"); //截止日期
//您收到GB 7258 的法规技术评估流程任务,请及时查看处理。
msgContentEN = "You recieved the Regulatory and technical assessment of "+serialNumber+" . The due date is "+endTime+". Please check and address it in a timely manner.";
msgTitle = "You have a Regulatory and technical assessment task to complete";
//msgContentEN = "You recieved the Regulatory and technical assessment of "+serialNumber+" . The due date is "+endTime+". Please check and address it in a timely manner.";
//msgTitle = "You have a Regulatory and technical assessment task to complete";
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
initiator = currentUser.getUsername();
cnContentUpper = "您好,请及时查看处理此项任务,谢谢!";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}else if(StringUtils.equals(msgType,MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_ENALUATOR_SUBMIT_MSG.getValue())){
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = this.sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
userIdList.add(jsonObject.getString("initiatorUserId"));
//XXX(人员账号)已提交GB 7258 的法规意见收集流程,请及时查看审核。
msgContentEN = currentUser.getUsername() + " has submitted the collection process of Regulatory and technical assessment of "+serialNumber+", Please check and address it in time.";
msgTitle = "You have a Regulatory and technical assessment task to complete";
//msgContentEN = currentUser.getUsername() + " has submitted the collection process of Regulatory and technical assessment of "+serialNumber+", Please check and address it in time.";
//msgTitle = "You have a Regulatory and technical assessment task to complete";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
initiator = currentUser.getUsername();
cnContentUpper = "您好,"+ currentUser.getUsername() +"已提交评估结果,请审核";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! "+ currentUser.getUsername() +" has submitted the assessment result. Please review it";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_AUDIT_ACCEPTED_MSG.getValue())){
userIdList.add(jsonObject.getString("evaluationId"));
//您提交的GB 7258 的法规技术评估流程已通过。
msgContentEN = "The regulatory and technical assessment process for "+serialNumber+" you submitted has passed.";
msgTitle = "You have a Regulatory and technical assessment task completed";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
//msgContentEN = "The regulatory and technical assessment process for "+serialNumber+" you submitted has passed.";
//msgTitle = "You have a Regulatory and technical assessment task completed";
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = this.sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
initiator = currentUser.getUsername();
cnContentUpper = "您好,您提交的评估结果已通过";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! The assessment result you submitted has passed";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_AUDIT_REJECTED_MSG.getValue())){
userIdList.add(jsonObject.getString("evaluationId"));
//您提交的GB 7258 的法规技术评估流程已被退回,请及时查看处理。
msgContentEN = "The regulatory and technical assessment process of "+serialNumber+" you submitted has been returned, Please check and address it in time.";
msgTitle = "You have a Regulatory and technical assessment task to complete";
//msgContentEN = "The regulatory and technical assessment process of "+serialNumber+" you submitted has been returned, Please check and address it in time.";
//msgTitle = "You have a Regulatory and technical assessment task to complete";
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = this.sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
initiator = currentUser.getUsername();
cnContentUpper = "您好,您提交的评估结果被退回,请及时查看处理";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! The assessment result you submitted has been rejected. Please check and address it in a timely manner";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue())) {
cnContentUpper = "您好,该任务将于3天后到期,请及时查看处理,谢谢!";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: 系统通知";
enContentUpper = "Hello! This task will expire in 3 days. Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
userIdList = (List<String>) jsonObject.get("userIdList");
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
}else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG.getValue())){
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG.getValue())) {
cnContentUpper = "您好,该任务将于今天到期,请尽快查看处理,谢谢!";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: 系统通知";
enContentUpper = "Hello! This task will expire today. Please check and address the task ASAP. Thank you!";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
userIdList = (List<String>) jsonObject.get("userIdList");
} /*else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG.getValue())) {
userIdList = (List<String>) jsonObject.get("userIdList");
//您GB 7258的法规技术评估流程将于明天结束,请及时查看处理
msgContentEN = "The the Regulatory and technical assessment of "+serialNumber+" will expire tomorrow. Please check and address it in time.";
msgTitle = "You have a Regulatory and technical assessment task to complete";
//msgContentEN = "The the Regulatory and technical assessment of "+serialNumber+" will expire tomorrow. Please check and address it in time.";
//msgTitle = "You have a Regulatory and technical assessment task to complete";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
} */
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//飞书跳转链接
String hrefFeishu = backUrl + JumpLinkEnum.TASK_AFFIRM_LINK.getLink();
String hrefFeishu = backUrl + JumpLinkEnum.FGPG_TODO_CENTER_LINK.getLink();
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//系统内部跳转链接
String href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
//String href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsTechnologyEvaluationId,sendMessageMap,null, MessageTypeEnum.REGULATORY_AND_TECHNICAL_ASSESSMENT,initiator);
//SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsTechnologyEvaluationId,sendMessageMap,null, MessageTypeEnum.REGULATORY_AND_TECHNICAL_ASSESSMENT,initiator);
}
@Override
@@ -713,6 +827,31 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
return new Result<>().success("手动结束成功!");
}
@Override
public void createQueryPermission(QueryWrapper<LawsTechnologyEvaluationEO> queryWrapper, LawsTechnologyEvaluationEO lawsTechnologyEvaluationEO,boolean administrator) {
if(!administrator){
//如果不是超级管理员,获取自己创建的和所有参与过的法规技术评估数据。
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<LawsTechnologyEvaluationFlowDetailEO> flowDetailQueryWrap = new QueryWrapper<>();
flowDetailQueryWrap.lambda().eq(LawsTechnologyEvaluationFlowDetailEO::getEvaluatorId,currentUser.getId());
List<LawsTechnologyEvaluationFlowDetailEO> flowDetailEOList = this.lawsTechnologyEvaluationFlowDetailEOService.list(flowDetailQueryWrap);
queryWrapper.and(query -> {
query.eq("create_by",currentUser.getUsername());
if(CollectionUtils.isNotEmpty(flowDetailEOList)){
List<String> lawsTechnologyEvaluationIdList = flowDetailEOList.stream().map(LawsTechnologyEvaluationFlowDetailEO::getLawsTechnologyEvaluationId).distinct().collect(Collectors.toList());
query.or(q -> {
for (String lawsTechnologyEvaluationId : lawsTechnologyEvaluationIdList) {
q.or().like("id",lawsTechnologyEvaluationId);
}
});
}
});
}
}
private String getTreeName(String cut, List<SysCategory> categoryList, List<String> technologyTerritoryList) {
StringBuilder sb = new StringBuilder();
for (String technologyTerritory : technologyTerritoryList) {
@@ -769,20 +908,15 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
countError++;
}
if(StringUtils.isEmpty(itemName)){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
errorMsg += "条款名称不能为空;";
}else if (StringUtils.equals(cut,CutEnum.EN.getValue())){
errorMsg += "Item Name cannot be empty;";
if(StringUtils.isNotEmpty(itemName)){
if(itemName.length() > 100){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
errorMsg += "条款名称长度不能超过100;";
}else if (StringUtils.equals(cut,CutEnum.EN.getValue())){
errorMsg += "Item Name length of the cannot exceed 100;";
}
countError++;
}
countError++;
}else if(itemName.length() > 100){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
errorMsg += "条款名称长度不能超过100;";
}else if (StringUtils.equals(cut,CutEnum.EN.getValue())){
errorMsg += "Item Name length of the cannot exceed 100;";
}
countError++;
}
if(StringUtils.isEmpty(itemContent)){
@@ -255,6 +255,14 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl
public void exportZip(HttpServletResponse response, HttpServletRequest request, LawsTechnologyEvaluationItemResultEO lawsTechnologyEvaluationItemResultEO, Map<String, Object> params) {
String ids = (String)params.get("ids");
String cut = (String)params.get("cut");
String serialNumber = (String)params.get("serialNumber");
if(StringUtils.isEmpty(serialNumber)){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
throw new JeroBootException("编号为空,请检查!");
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
throw new JeroBootException("The serialNumber is empty, please check!");
}
}
QueryWrapper<LawsTechnologyEvaluationItemResultEO> queryWrapper = QueryGenerator.initQueryWrapper(lawsTechnologyEvaluationItemResultEO, request.getParameterMap());
if(StringUtils.isNotEmpty(ids)){
List<String> idList = Arrays.asList(ids.split(","));
@@ -267,10 +275,10 @@ public class LawsTechnologyEvaluationItemResultEOServiceImpl extends ServiceImpl
String fileName = "";
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
title = "条款号,条款名称,条款内容,评估人,评估方式,技术文件名称,章节,符合性结果,意见,附件,反馈时间";
fileName = "条款评估结果" + ".xls";
fileName = serialNumber + " 条款评估结果" + ".xls";
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
title = "Item No.,Item Name,Item Content,Assessor,Evaluation method,Name of technical document,Chapter,Compliance Results,Opinion,Enclosure,Feedback Time";
fileName = "Item Evaluation results" + ".xls";
fileName = serialNumber + " Item Evaluation results" + ".xls";
}
OutputStream os = null;
@@ -13,6 +13,7 @@ import com.jero.modules.problemKnowledgeBase.service.IProblemKnowledgeBaseEOServ
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.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +38,8 @@ import com.jero.common.aspect.annotation.AutoLog;
public class ProblemKnowledgeBaseEOController extends JeroController<ProblemKnowledgeBaseEO, IProblemKnowledgeBaseEOService> {
@Autowired
private IProblemKnowledgeBaseEOService problemKnowledgeBaseEOService;
@Autowired
private ISysUserService sysUserService;
/**
* 分页列表查询
@@ -54,6 +57,11 @@ public class ProblemKnowledgeBaseEOController extends JeroController<ProblemKnow
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
boolean administrator = this.sysUserService.isAdministrator();
//如果当前登录人是超级管理员角色,进入到管理发布页面时,查询所有的数据,其它用户只能查询自己创建的数据。
if(administrator){
problemKnowledgeBaseEO.setCreateBy(null);
}
QueryWrapper<ProblemKnowledgeBaseEO> queryWrapper = QueryGenerator.initQueryWrapper(problemKnowledgeBaseEO, req.getParameterMap());
this.problemKnowledgeBaseEOService.createQueryPermission(queryWrapper,problemKnowledgeBaseEO);
queryWrapper.orderByDesc("create_time");
@@ -1,6 +1,7 @@
package com.jero.modules.problemKnowledgeBase.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -156,7 +157,7 @@ public class ProblemKnowledgeBaseEO implements Serializable {
/**发布日期*/
@Excel(name = "发布日期", width = 15)
@ApiModelProperty(value = "发布日期")
private java.lang.String releaseTime;
private Date releaseTime;
/**点赞总数量*/
@TableField(exist = false)
@@ -195,4 +196,9 @@ public class ProblemKnowledgeBaseEO implements Serializable {
/**附件展示数组*/
@TableField(exist = false)
private List<OSSFile> accessoryFileNameList;
/**发布状态*/
@Excel(name = "发布状态", width = 15)
@ApiModelProperty(value = "发布状态")
private String releaseStatus;
}
@@ -1,29 +1,43 @@
package com.jero.modules.problemKnowledgeBase.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.problemKnowledgeBase.entity.ProblemKnowledgeBaseCommentEO;
import com.jero.modules.problemKnowledgeBase.entity.ProblemKnowledgeBaseEO;
import com.jero.modules.problemKnowledgeBase.mapper.ProblemKnowledgeBaseCommentEOMapper;
import com.jero.modules.problemKnowledgeBase.service.IProblemKnowledgeBaseCommentEOService;
import com.jero.modules.problemKnowledgeBase.service.IProblemKnowledgeBaseEOService;
import com.jero.modules.problemKnowledgeBase.vo.ProblemKnowledgeBaseCommentVO;
import com.jero.modules.project.entity.ProblemKnowledgeBaseReplyEO;
import com.jero.modules.project.service.IProblemKnowledgeBaseReplyEOService;
import com.jero.modules.system.entity.SysAnnouncement;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysAnnouncementService;
import com.jero.modules.system.service.ISysUserService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description: 问题知识库评论表
@@ -37,6 +51,24 @@ public class ProblemKnowledgeBaseCommentEOServiceImpl extends ServiceImpl<Proble
@Autowired
private IProblemKnowledgeBaseReplyEOService problemKnowledgeBaseReplyEOService;
@Autowired
private BussDocumentLibraryEOServiceImpl bussDocumentLibraryEOService;
@Autowired
private ISysUserService sysUserService;
@Resource
private IFeishuService iFeishuService;
@Autowired
private ISysAnnouncementService sysAnnouncementService;
@Autowired
private IProblemKnowledgeBaseEOService problemKnowledgeBaseEOService;
@Value(value = "${jero.backUrl}")
private String backUrl;
/**
* 保存
*
@@ -49,7 +81,45 @@ public class ProblemKnowledgeBaseCommentEOServiceImpl extends ServiceImpl<Proble
problemKnowledgeBaseCommentEO.setCreateTime(now);
problemKnowledgeBaseCommentEO.setUpdateTime(now);
save(problemKnowledgeBaseCommentEO);
}
ProblemKnowledgeBaseEO problemKnowledgeBaseEO = problemKnowledgeBaseEOService.getById(problemKnowledgeBaseCommentEO.getProblemKnowledgeBaseId());
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String createBy = problemKnowledgeBaseEO.getCreateBy();
//自己回复的时候不发消息
// if(!loginUser.getUsername().equals(createBy)){
SysUser sysUser = sysUserService.getUserByName(createBy);
String contentCNNo = "您发布的问题知识库信息"+problemKnowledgeBaseEO.getTitle()+"有新评论,请注意查看.";
String contentENNo = "In the Q&A knowledge "+problemKnowledgeBaseEO.getTitle()+" you created, a new comment has been added. Please be reminded to check it out.";
//发送消息(站内和飞书)
//您发布的问题知识库信息XXXXXXXX有新评论,请注意查看。
//In the Q&A knowledge xxxxxxxx you created, a new comment has been added. Please be reminded to check it out.
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(Arrays.asList(sysUser.getId().split(",")),
"msgTitle",
contentENNo,
contentENNo,
MessageTypeEnum.PUSH.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentCNNo,
contentCNNo);
this.sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(com.jero.modules.system.util.StringUtils.join(sysUser.getThirdId(), ","), sysUser.getThirdId());
String href = backUrl +"/problemknowledgeBase";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
feishuMsgVo.setUrl(href);
feishuMsgVo.setContentEn(contentENNo);
feishuMsgVo.setContent(contentCNNo);
try {
this.iFeishuService.sendCardMsgTerritory(sysUser.getThirdId().split(","), feishuMsgVo);
} catch (IOException e) {
e.printStackTrace();
}
// }
}
/**
* 更新
@@ -18,12 +18,14 @@ import com.jero.modules.document.enums.SearchEnum;
import com.jero.modules.document.utils.ReadPdfUtil;
import com.jero.modules.document.utils.ReadWordUtil;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.message.websocket.WebSocket;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.problemKnowledgeBase.entity.*;
import com.jero.modules.problemKnowledgeBase.enums.CollectStatusEnum;
import com.jero.modules.problemKnowledgeBase.enums.PraiseStatusEnum;
import com.jero.modules.problemKnowledgeBase.enums.ReleaseStatusEnum;
import com.jero.modules.problemKnowledgeBase.enums.ShowPermissionsEnum;
import com.jero.modules.problemKnowledgeBase.mapper.ProblemKnowledgeBaseEOMapper;
import com.jero.modules.problemKnowledgeBase.service.*;
@@ -112,19 +114,23 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
@Override
public void add(ProblemKnowledgeBaseEO problemKnowledgeBaseEO) {
Date now = new Date();
String problemKnowledgeBaseId = UUID.randomUUID().toString().replace("-", "");
problemKnowledgeBaseEO.setId(problemKnowledgeBaseId);
problemKnowledgeBaseEO.setCreateTime(now);
problemKnowledgeBaseEO.setUpdateTime(now);
save(problemKnowledgeBaseEO);
//如果该条问题知识库的展示权限为私密,则创建权限表数据
if(StringUtils.equals(problemKnowledgeBaseEO.getShowPermissions(), ShowPermissionsEnum.PRIVACY.getValue())){
this.batchInsertProblemKnowledgeBaseUserEO(problemKnowledgeBaseEO);
}
/*else {
//如果展示权限是公开,则把该数据插入到搜索中心中。
//如果是已发布,将数据更新到es中。
if(StringUtils.equals(problemKnowledgeBaseEO.getReleaseStatus(), ReleaseStatusEnum.HAVE_RELEASED.getValue())){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
problemKnowledgeBaseEO.setReleaseUserId(currentUser.getId());
problemKnowledgeBaseEO.setReleaseTime(now);
this.addOrUpdateElasticsearch(problemKnowledgeBaseEO);
}*/
this.addOrUpdateElasticsearch(problemKnowledgeBaseEO);
}
save(problemKnowledgeBaseEO);
}
/**
@@ -382,9 +388,9 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
}
if(StringUtils.isNotEmpty(fileText)){
sbEn.append("Accessory File content" + ":" + fileText + " ");
sbEn.append("Attachment" + ":" + fileText + " ");
}else {
sbEn.append("Accessory File content" + ":" + "-- ");
sbEn.append("Attachment" + ":" + "-- ");
}
}
}
@@ -435,15 +441,23 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
public void editById(ProblemKnowledgeBaseEO problemKnowledgeBaseEO) {
Date now = new Date();
problemKnowledgeBaseEO.setUpdateTime(now);
saveOrUpdate(problemKnowledgeBaseEO);
//如果该条问题知识库的展示权限为私密,则创建权限表数据
if(StringUtils.equals(problemKnowledgeBaseEO.getShowPermissions(), ShowPermissionsEnum.PRIVACY.getValue())){
this.batchInsertProblemKnowledgeBaseUserEO(problemKnowledgeBaseEO);
//this.deleteElasticsearchData(problemKnowledgeBaseEO.getId());
}
this.addOrUpdateElasticsearch(problemKnowledgeBaseEO);
//如果是已发布,将数据更新到es中。
if(StringUtils.equals(problemKnowledgeBaseEO.getReleaseStatus(), ReleaseStatusEnum.HAVE_RELEASED.getValue())){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
problemKnowledgeBaseEO.setReleaseUserId(currentUser.getId());
problemKnowledgeBaseEO.setReleaseTime(now);
this.addOrUpdateElasticsearch(problemKnowledgeBaseEO);
}else if(StringUtils.equals(problemKnowledgeBaseEO.getReleaseStatus(), ReleaseStatusEnum.DRAFT.getValue())){
//如果是草稿,将es中的数据删掉。
this.deleteElasticsearchData(problemKnowledgeBaseEO.getId());
}
saveOrUpdate(problemKnowledgeBaseEO);
}
/**
@@ -750,26 +764,32 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
@Override
public void createQueryPermission(QueryWrapper<ProblemKnowledgeBaseEO> queryWrapper,ProblemKnowledgeBaseEO problemKnowledgeBaseEO) {
/**
* 查询权限
* 公开:所有人都可以看到。
* 私密:只有配置了的权限用户可以看到。
* 2022-10-13增加权限,超级管理员可以看到所有的问题知识库数据。
*/
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<ProblemKnowledgeBaseUserEO> userPermissionQueryWrapper = new QueryWrapper<>();
userPermissionQueryWrapper.lambda().eq(ProblemKnowledgeBaseUserEO::getUserId,currentUser.getId());
List<ProblemKnowledgeBaseUserEO> problemKnowledgeBaseUserEOList = problemKnowledgeBaseUserEOService.list(userPermissionQueryWrapper);
boolean administrator = this.sysUserService.isAdministrator();
if(!administrator){
/**
* 查询权限
* 公开:所有人都可以看到。
* 私密:只有配置了的权限用户可以看到。
*/
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<ProblemKnowledgeBaseUserEO> userPermissionQueryWrapper = new QueryWrapper<>();
userPermissionQueryWrapper.lambda().eq(ProblemKnowledgeBaseUserEO::getUserId,currentUser.getId());
List<ProblemKnowledgeBaseUserEO> problemKnowledgeBaseUserEOList = problemKnowledgeBaseUserEOService.list(userPermissionQueryWrapper);
List<String> problemKnowledgeBaseIdList = problemKnowledgeBaseUserEOList.stream().map(ProblemKnowledgeBaseUserEO::getProblemKnowledgeBaseId).distinct().collect(Collectors.toList());
List<String> problemKnowledgeBaseIdList = problemKnowledgeBaseUserEOList.stream().map(ProblemKnowledgeBaseUserEO::getProblemKnowledgeBaseId).distinct().collect(Collectors.toList());
queryWrapper.lambda().and(query -> {
query.eq(ProblemKnowledgeBaseEO::getShowPermissions,ShowPermissionsEnum.OPEN.getValue());
queryWrapper.lambda().and(query -> {
query.eq(ProblemKnowledgeBaseEO::getShowPermissions,ShowPermissionsEnum.OPEN.getValue());
if(CollectionUtils.isNotEmpty(problemKnowledgeBaseIdList)){
query.or(o -> {
o.eq(ProblemKnowledgeBaseEO::getShowPermissions,ShowPermissionsEnum.PRIVACY.getValue());
o.in(ProblemKnowledgeBaseEO::getId,problemKnowledgeBaseIdList);
});
}
});
});
}
String searchStr = problemKnowledgeBaseEO.getSearchStr();
if(StringUtils.isNotEmpty(searchStr)){
@@ -863,13 +883,42 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
String ContentENNo = currentUser.getUsername()+" shared " + problemKnowledgeBaseTitle + " with you.Please be reminded to check it out.";
String ContentInfoENYes = currentUser.getUsername()+" shared " + problemKnowledgeBaseTitle + " with you.Please be reminded to check it out."+ " " + href;
String contentCnNo = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看.";
String contentInfoCnYes = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看"+ " " + href;
//封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, msgTitle, msgContentEN, contentInfo,MessageTypeEnum.PUSH.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList,
msgTitle,
ContentENNo,
ContentInfoENYes,
MessageTypeEnum.PUSH.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentCnNo,
contentInfoCnYes);
this.sysAnnouncementService.saveAnnouncement(sysAnnouncement);
this.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo);
//飞书
try {
this.iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), msgContentEN, MessageTypeEnum.PUSH.getName(), hrefFeishu);
//XXX向您分享了XXXXXXXXX,请查看。
//XXX shared xxxxxxxx with you. Please be reminded to check it out.
String contentInfoFeiCn = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看";
String msgContentENTemp = currentUser.getUsername()+" shared " + problemKnowledgeBaseTitle + " with you.Please be reminded to check it out.";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setContentEn(msgContentENTemp);
feishuMsgVo.setContent(contentInfoFeiCn);
this.iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}), feishuMsgVo);
// this.iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), msgContentEN, MessageTypeEnum.PUSH.getName(), hrefFeishu);
} catch (IOException e) {
log.error("飞书推送失败");
}
@@ -891,7 +940,9 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
String content,
String contentInfo,
String messageType,
String initiator) {
String initiator,
String contentCn,
String contentInfoCn) {
SysAnnouncement sysAnnouncement = new SysAnnouncement();
sysAnnouncement.setInitiator(initiator);
sysAnnouncement.setDelFlag("0");
@@ -903,6 +954,8 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
sysAnnouncement.setMsgContent(content);
sysAnnouncement.setMsgContentInfo(contentInfo);
sysAnnouncement.setUserIds(StringUtils.join(userIdList, ","));
sysAnnouncement.setMsgContentCn(contentCn);
sysAnnouncement.setMsgContentInfoCn(contentInfoCn);
return sysAnnouncement;
}
}
@@ -16,6 +16,7 @@ import com.jero.modules.dummy.entity.DummyInventoryBaseEO;
import com.jero.modules.dummy.service.IDummyInventoryBaseEOService;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.vo.ProjectTaskUrgVo;
import com.jero.modules.system.entity.SysRole;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -456,4 +457,13 @@ public class ProjectLawsInventoryEOController extends JeroController<ProjectLaws
return result;
}
@AutoLog(value = "任务清单催办")
@ApiOperation(value="任务清单催办", notes="任务清单催办")
@PostMapping(value = "/taskUrg")
public Result<?> taskUrg(@RequestBody ProjectTaskUrgVo projectTaskUrgVo) {
return this.projectLawsInventoryEOService.taskUrg(projectTaskUrgVo);
}
}
@@ -1,6 +1,6 @@
package com.jero.modules.project.controller;
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;
@@ -12,7 +12,15 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
@@ -46,8 +54,9 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
@ApiOperation(value="项目库基础表-分页列表查询", notes="项目库基础表-分页列表查询")
@PostMapping(value = "/page")
public Result<?> queryPageList(@RequestBody Map<String,Object> params) {
IPage<ProjectLibraryBase> pageList= projectLibraryBaseService.queryPageList(params);
return Result.OK(params.get("cut").toString(),pageList);
List<ProjectLibraryBase> pageList= projectLibraryBaseService.queryPageList(params);
Page pages = projectLibraryBaseService.getPages(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()), pageList);
return Result.OK(params.get("cut").toString(),pages);
}
/**
@@ -77,6 +86,20 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
projectLibraryBaseService.add(projectLibraryBase);
return Result.OK("添加成功!");
}
/**
* 项目扩展(添加子项目子项目基本信息、相关人员名单、法规/认证任务计划与被扩展项目保持一致)
*
* @param projectLibraryBase
* @return
*/
@AutoLog(value = "项目扩展(添加子项目)")
@ApiOperation(value="项目扩展(添加子项目)", notes="项目扩展(添加子项目)")
@RequiresPermissions("projectLibraryBase:add")
@PostMapping(value = "/addChild")
public Result<?> addChild(@Validated @RequestBody ProjectLibraryBase projectLibraryBase) throws ParseException {
projectLibraryBaseService.addChild(projectLibraryBase);
return Result.OK("添加成功!");
}
/**
* 编辑
@@ -137,7 +160,7 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id,
@RequestParam(name="cut",required=true) String cut) {
List<ProjectLibraryBase> data = projectLibraryBaseService.queryById(id);
List<ProjectLibraryBase> data = projectLibraryBaseService.queryById(id,cut);
if(data==null) {
return Result.error("未找到对应数据");
}
@@ -205,4 +228,45 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
}
/**
* 项目置顶,取消置顶(只置顶主项目)
* @param id
* @param flag 0为置顶, 1为取消置顶
* @return
*/
@AutoLog(value = "项目置顶,取消置顶(只置顶主项目)")
@ApiOperation(value="项目置顶,取消置顶(只置顶主项目)", notes="项目置顶,取消置顶(只置顶主项目)")
@GetMapping(value = "/top")
public Result<?> top(String id,String flag) {
projectLibraryBaseService.top(id,flag);
return Result.OK("编辑成功!");
}
/**
* 获取项目所有的版本(主版本和子版本的集合)
* @param id 项目id
* @return
*/
@AutoLog(value = "获取项目所有的版本(主版本和子版本的集合)")
@ApiOperation(value="获取项目所有的版本(主版本和子版本的集合)", notes="获取项目所有的版本(主版本和子版本的集合)")
@GetMapping(value = "/getVersionsInfo")
public Result<?> getVersionsInfo(String id) {
List<String> versionsInfoList = projectLibraryBaseService.getVersionsInfo(id);
return Result.OK(versionsInfoList);
}
/**
* 版本统计
* @return
*/
@AutoLog(value = "版本统计")
@ApiOperation(value="版本统计)", notes="版本统计")
@PostMapping(value = "/versionStatistics")
public Result<?> versionStatistics(@RequestBody Map<String,Object> params) {
List<ProjectLibraryBase> projectLibraryBasesList = projectLibraryBaseService.versionStatistics(String.valueOf(params.get("id")));
Page pages = projectLibraryBaseService.getPages(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()), projectLibraryBasesList);
return Result.OK(pages);
}
}
@@ -12,7 +12,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.List;
/**
@@ -25,7 +25,7 @@ import java.io.Serializable;
@TableName("project_library_base")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class ProjectLibraryBase implements Serializable {
public class ProjectLibraryBase implements Comparable<ProjectLibraryBase> {
private static final long serialVersionUID = 1L;
/**主键*/
@@ -109,4 +109,36 @@ public class ProjectLibraryBase implements Serializable {
/**目标市场展示名称*/
@TableField(exist = false)
private java.lang.String targetMarketName;
//主项目id parent_id
private String parentId;
//项目版本
private String projectVersion;
//软件版本
private String softwareVersion;
//最后一个版本
@TableField(exist = false)
private String versionLast;
//说明
private String explanation;
//排序(用于项目置顶)
private String sort;
//置顶标识(flag为空的时候为置顶, flag为1的时候取消置顶)
private String flag;
@TableField(exist = false)
private List<ProjectLibraryBase> children;
@Override
public int compareTo(ProjectLibraryBase o) {
return Integer.valueOf(this.projectVersion)-Integer.valueOf(o.projectVersion);//升序
// return o.id-this.id;//降序
}
}
@@ -108,4 +108,6 @@ public class ProjectTaskInventoryFeedbackEO implements Serializable {
@ApiModelProperty(value = "序号")
private String serialNumber;
@TableField(exist = false)
private String userId;
}
@@ -18,6 +18,8 @@ public enum JumpLinkEnum {
VERIFY_AFFIRM_LINK("验证符合性确认链接","3","/ProjectDetails?id=","&type=103"),
DESIGN_AFFIRM_LINK("设计符合性确认链接","4","/ProjectDetails?id=","&type=103"),
TASK_AFFIRM_LINK("任务确认链接","2","/ProcessCenter",""),
FGPG_TODO_CENTER_LINK("法规评估任务待办中心链接","88","/regulatoryAssessmentTasks",""),
XMCS_TODO_CENTER_LINK("项目参数任务待办中心链接","99","/projectParameterTasks",""),
COMPLIANCE_PROCESS_DETAIL_LINK("符合性流程明细页路由","2","/taskListProcess",""),
PROBLEM_KNOWLEDGE_BASE_DETAIL("问题知识库,详情页","","/problemKnowledgeBaseView",""),
@@ -34,12 +34,18 @@ public enum MsgTypeEnum {
LAWS_OPOMOPM_GATHER_START_MSG("法规意见收集发起消息","lawsOpomopmGatherStartMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_SUBMIT_MSG("法规意见收集评估人提交任务消息","lawsOpomopmGatherEnaluatorSubmitMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_MSG("法规意见收集到期前一天消息","lawsOpomopmGatherExpireRemindMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG("法规意见收集到期前三天消息","lawsOpomopmGatherExpireRemindThreeDaysBeforeMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_TODAY_MSG("法规意见收集到期当天消息","lawsOpomopmGatherExpireRemindTodayMsg"),
LAWS_OPOMOPM_GATHER_COMPLETE_MSG("法规意见收集任务完成通知消息","lawsOpomopmGatherCompleteMsg"),
LAWS_TECHNOLOGY_EVALUATION_START_MSG("法规技术评估发起消息","lawsTechnologyEvaluationStartMsg"),
LAWS_TECHNOLOGY_EVALUATION_ENALUATOR_SUBMIT_MSG("法规技术评估,评估人提交任务消息","lawsTechnologyEvaluationEnaluatorSubmitMsg"),
LAWS_TECHNOLOGY_EVALUATION_AUDIT_ACCEPTED_MSG("法规技术评估,发起人审核通过消息","lawsTechnologyEvaluationAuditAcceptedMsg"),
LAWS_TECHNOLOGY_EVALUATION_AUDIT_REJECTED_MSG("法规技术评估,发起人审核拒绝消息","lawsTechnologyEvaluationAuditRejectedMsg"),
LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG("法规技术评估到期前一天消息","lawsTechnologyEvaluationExpireRemindMsg"),
LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG("法规技术评估到期前三天消息","lawsTechnologyEvaluationExpireRemindThreeDaysBeforeMsg"),
LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG("法规技术评估到期当天消息","lawsTechnologyEvaluationExpireRemindTodayMsg"),
;
String name;
@@ -0,0 +1,44 @@
package com.jero.modules.project.enums;
/**
* 任务状态枚举类
*/
public enum TopEnum {
TOP_CANCEL("取消置顶","1"),
;
String name;
String value;
private TopEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static String getTextByValue(String value) {
TopEnum[] values = values();
for (TopEnum taskStatusEnum : values) {
if (taskStatusEnum.value.equals(value)) {
return taskStatusEnum.name;
}
}
return null;
}
}
@@ -1,7 +1,13 @@
package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
@@ -15,8 +21,11 @@ import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@@ -24,6 +33,7 @@ import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -49,16 +59,24 @@ public class InventoryAffirmJob implements Job {
@Autowired
private ProjectYearNameInfoEOMapper projectYearNameInfoEOMapper;
@Autowired
private IFeishuService feishuService;
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
/**
* 清单任务到达截止时间后,给用户发送消息
*/
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("清单确认流程,定时任务开启 =====================================================");
//获取状态为待确认的数据
log.info("清单确认流程,定时任务开启 =====================================================");
/* //获取状态为待确认的数据
QueryWrapper<ProjectLawsInventoryEO> queryWrapperInventory = new QueryWrapper<>();
queryWrapperInventory.lambda().eq(ProjectLawsInventoryEO::getInventoryAffirmStatus, InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue());
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(queryWrapperInventory);
@@ -96,125 +114,269 @@ public class InventoryAffirmJob implements Job {
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
List<String> threeDaysUserIdList = new ArrayList<>();
List<String> currentDaysUserIdList = new ArrayList<>();
Map<String, List<String>> threeDaysMap = new HashMap<>();
Map<String, List<String>> currentDaysMap = new HashMap<>();
Map<String, List<String>> overdueMap = new HashMap<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOList) {
if(StringUtils.equals(projectLibraryBase.getId(),projectLawsInventoryEO.getProjectLibraryId())){
if(projectLawsInventoryEO.getInventoryAffirmDueDate() != null){
//如果清单确认结束日期是当前日期
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))){
List<String> currentDaysUserIdList = new ArrayList<>();
if(StringUtils.isEmpty(projectLawsInventoryEO.getSendMsgFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
currentDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
}
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
currentDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
// currentDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
//}
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
// currentDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
//}
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())||StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
currentDaysUserIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
projectLawsInventoryEO.setSendMsgFlag(SendMsgFlagEnum.FALSE.getValue());
projectLawsInventoryEOMapper.updateById(projectLawsInventoryEO);
}
if (ObjectUtils.isNotEmpty(currentDaysUserIdList)) {
currentDaysMap.put(projectLawsInventoryEO.getId(), currentDaysUserIdList);
}
}
//如果清单确认结束时间是当前系统时间后三天
if(StringUtils.equals(threeDaysStr,sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))){
List<String> threeDaysUserIdList = new ArrayList<>();
if(StringUtils.isEmpty(projectLawsInventoryEO.getSendMsgCurrentFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
threeDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
}
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
threeDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
// threeDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
//}
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
// threeDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
//}
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())||StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
threeDaysUserIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
projectLawsInventoryEO.setSendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue());
projectLawsInventoryEOMapper.updateById(projectLawsInventoryEO);
}
if (ObjectUtils.isNotEmpty(threeDaysUserIdList)) {
threeDaysMap.put(projectLawsInventoryEO.getId(), threeDaysUserIdList);
}
}
//逾期3天、七天、14天
Calendar day3Later=new GregorianCalendar();
day3Later.setTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
day3Later.add(Calendar.DATE,3);
Date overdue3Days = day3Later.getTime();
Calendar day7Later=new GregorianCalendar();
day7Later.setTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
day7Later.add(Calendar.DATE,7);
Date overdue7Days = day7Later.getTime();
Calendar day14Later=new GregorianCalendar();
day14Later.setTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
day14Later.add(Calendar.DATE,14);
Date overdue14Days = day14Later.getTime();
if(StringUtils.equals(sdf.format(overdue3Days),sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))
||StringUtils.equals(sdf.format(overdue7Days),sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))
||StringUtils.equals(sdf.format(overdue14Days),sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))){
List<String> overdueUserIdList = new ArrayList<>();
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())||StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
overdueUserIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
if (ObjectUtils.isNotEmpty(overdueUserIdList)) {
overdueMap.put(projectLawsInventoryEO.getId(), overdueUserIdList);
}
}
}
}
}
if(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
/*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务确认剩余处理时间还有3天,请及时查看处理";*/
//项目名称
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectLibraryBase.getProjectVersion();
if(!threeDaysMap.isEmpty()){
for (String key : threeDaysMap.keySet()) {
List<String> threeDaysUserIdList = threeDaysMap.get(key);
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(threeDaysUserIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务将于3天后到期,请及时查看处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! This task will expire in 3 days. Please check and address it in a timely manner. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
*//*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务确认剩余处理时间还有3天,请及时查看处理";*//*
// XXX .
String msgContentEN = "The remaining processing time for the regulation task confirmation for "
+ projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()+ " "
+ projectLibraryBase.getTargetMarket()
+ " are 3 days. Please check and address it in a timely manner.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
//String msgContentEN = "The remaining processing time for the regulation task confirmation for "
// + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()+ " "
// + projectLibraryBase.getTargetMarket()
// + " are 3 days. Please check and address it in a timely manner.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Regulation Task Confirmation");
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Regulation Task Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
// sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, threeDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, threeDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
if(!currentDaysMap.isEmpty()){
for (String key : currentDaysMap.keySet()) {
List<String> currentDaysUserIdList = currentDaysMap.get(key);
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(currentDaysUserIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务今天即将到期,请尽快查看处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " +projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! This task will expire today. Please check and address the task ASAP. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
/*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务今天即将结束,请及时查看处理*/
String msgContentEN = "The regulation task confirmation for "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " will expire today. Please check and address it in a timely manner.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Regulation Task Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
*//*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务今天即将结束,请及时查看处理*//*
//String msgContentEN = "The regulation task confirmation for "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " will expire today. Please check and address it in a timely manner.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Regulation Task Confirmation");
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, currentDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, currentDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
if(!overdueMap.isEmpty()){
for (String key : overdueMap.keySet()) {
List<String> overdueUserIdList = overdueMap.get(key);
overdueUserIdList = overdueUserIdList.stream().distinct().collect(Collectors.toList());
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(overdueUserIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务已逾期,请尽快处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知" +
"\n截止时间: " + dueDate);
feishuMsgVo.setEnContentUpper("Hello! This task is overdue. Please address it ASAP. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName() +
"\nDue Date: " + dueDate);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.YELLOW.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
}
}
}
}*/
log.info("清单确认流程,定时任务结束 =====================================================");
}
}
@@ -1,7 +1,13 @@
package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.DesignComplianceStatusEnum;
@@ -14,8 +20,11 @@ import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.service.IProjectTaskInventoryEOService;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@@ -23,6 +32,7 @@ import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -53,6 +63,13 @@ public class PrehomoJob implements Job {
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IFeishuService feishuService;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("prehomo流程,定时任务开启 =====================================================");
@@ -60,7 +77,10 @@ public class PrehomoJob implements Job {
//查询出已经启动了prehomo流程的数据。 并且流程没有结束。
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
queryProjectTaskInventoryWrapper.isNotNull("prehomo_p_id");
queryProjectTaskInventoryWrapper.lambda().ne(ProjectTaskInventoryEO::getPrehomoStatus, DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue());
List<String> status = new ArrayList<>();
status.add(DesignComplianceStatusEnum.TO_SUBMIT.getValue());
status.add(DesignComplianceStatusEnum.REVIEW_THE_RETURN.getValue());
queryProjectTaskInventoryWrapper.lambda().in(ProjectTaskInventoryEO::getPrehomoStatus, status);
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper);
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
@@ -81,15 +101,24 @@ public class PrehomoJob implements Job {
Date currentDate = new Date();
//获取后三天前的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,3);
Date threeDays = calendar.getTime();
String threeDaysStr = sdf.format(threeDays);
//两周
Calendar twoWeeksLaterCalendar=new GregorianCalendar();
twoWeeksLaterCalendar.setTime(new Date());
twoWeeksLaterCalendar.add(Calendar.DATE,14);
Date twoWeeksLaterDays = twoWeeksLaterCalendar.getTime();
String twoWeeksLaterDaysStr = sdf.format(twoWeeksLaterDays);
//一周
Calendar oneWeekLaterCalendar=new GregorianCalendar();
oneWeekLaterCalendar.setTime(new Date());
oneWeekLaterCalendar.add(Calendar.DATE,7);
Date oneWeekLaterDays = oneWeekLaterCalendar.getTime();
String oneWeekLaterDaysStr = sdf.format(oneWeekLaterDays);
//当天
String currentDateStr = sdf.format(currentDate);
String msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn();
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
@@ -99,115 +128,234 @@ public class PrehomoJob implements Job {
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) {
List<String> threeDaysUserIdList = new ArrayList<>();
List<String> currentDaysUserIdList = new ArrayList<>();
for (ProjectTaskInventoryEO projectTaskInventoryEO : projectTaskInventoryEOList) {
if(StringUtils.equals(projectTaskInventoryEO.getProjectLawsInventoryId(),projectLawsInventoryEO.getId())){
if(projectLawsInventoryEO.getPrehomoDueDate() != null){
//如果prehomo - 结束日期是当前日期
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){
if(StringUtils.isEmpty(projectTaskInventoryEO.getPrehomoSendMsgFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId());
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getPrehomoInitiatorId());
}
projectTaskInventoryEO.setPrehomoSendMsgFlag(SendMsgFlagEnum.FALSE.getValue());
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
}
//法规中英文
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String LAW_EN = "";
if (ObjectUtils.isEmpty(bussDocumentLibraryEO)) {
LAW_EN = LAW_CN;
} else {
LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
}
List<String> twoWeeksLaterUserIdList = new ArrayList<>();
List<String> oneWeeksLaterUserIdList = new ArrayList<>();
List<String> currentDaysUserIdList = new ArrayList<>();
List<String> dueUserIdList = new ArrayList<>();
if(StringUtils.equals(projectLawsInventoryEO.getProjectLibraryId(),projectLibraryBase.getId())){
if(projectLawsInventoryEO.getPrehomoDueDate() != null){
//如果prehomo - 结束日期是当前日期
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId());
}
//如果prehomo - 结束日期是三天后的日期
if(StringUtils.equals(threeDaysStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){
if(StringUtils.isEmpty(projectTaskInventoryEO.getPrehomoSendMsgCurrentFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
threeDaysUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId());
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){
threeDaysUserIdList.add(projectLawsInventoryEO.getPrehomoInitiatorId());
}
projectTaskInventoryEO.setPrehomoSendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue());
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
}
}
//如果prehomo - 结束日期是两周后的日期
if(StringUtils.equals(twoWeeksLaterDaysStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
twoWeeksLaterUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId());
}
}
//如果prehomo - 结束日期是一周后的日期
if(StringUtils.equals(oneWeekLaterDaysStr,sdf.format(projectLawsInventoryEO.getDesignDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
oneWeeksLaterUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
}
}
//如果prehomo - 逾期后每天通知
if (!StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))&&projectLawsInventoryEO.getDesignDueDate().before(currentDate)) {
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
dueUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
}
}
}
}
if(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
String hrefFeishu = backUrl
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
if (ObjectUtils.isNotEmpty(dueUserIdList)) {
dueUserIdList = dueUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(dueUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务已逾期,请尽快查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知"+
"\n截止时间: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setEnContentUpper("Hello! Your task is overdue. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()+
"\nDue Date: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.YELLOW.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
if (ObjectUtils.isNotEmpty(oneWeeksLaterUserIdList)) {
oneWeeksLaterUserIdList = oneWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(oneWeeksLaterUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务将于7天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 7 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
if(CollectionUtils.isNotEmpty(twoWeeksLaterUserIdList)){
twoWeeksLaterUserIdList = twoWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(twoWeeksLaterUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务将于14天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 14 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的Pre-Homo确认剩余处理时间还有3天,请及时查看处理
//The remaining processing time for the Pre-Homo confirmation of GB 7258 in XXX (project name) is 3 days. Please check and handle it in time.
String msgContentEN = "The remaining processing time for the Pre-Homo confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()+ " "
+ projectLibraryBase.getTargetMarket()
+ " are 3 days. Please check and handle it in time.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//String msgContentEN = "The remaining processing time for the Pre-Homo confirmation of "
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()+ " "
// + projectLibraryBase.getTargetMarket()
// + " are 3 days. Please check and handle it in time.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Pre-Homo Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Pre-Homo Confirmation");
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
//String hrefFeishu = backUrl
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
// + projectLibraryBase.getId()
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
// Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(currentDaysUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务将于今天到期,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will expire today. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的Pre-Homo确认任务今天即将结束,请及时查看处理
//The the Pre-Homo confirmation of GB 7258 in XXX (project name) is coming to an end today. Please check and deal with it in time
String msgContentEN = "The the Pre-Homo confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " will expire today. Please check and address it in time.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//String msgContentEN = "The the Pre-Homo confirmation of "
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " will expire today. Please check and address it in time.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Pre-Homo Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Pre-Homo Confirmation");
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
// String hrefFeishu = backUrl
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
// + projectLibraryBase.getId()
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
}
}
@@ -0,0 +1,268 @@
package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectNameInfoEO;
import com.jero.modules.project.entity.ProjectYearNameInfoEO;
import com.jero.modules.project.enums.InventoryAffirmStatusEnum;
import com.jero.modules.project.enums.JumpLinkEnum;
import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper;
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
public class TaskAffirmJob implements Job {
@Autowired
private ProjectLawsInventoryEOMapper projectLawsInventoryEOMapper;
@Autowired
private ProjectLibraryBaseMapper projectLibraryBaseMapper;
@Autowired
private ProjectNameInfoEOMapper projectNameInfoEOMapper;
@Autowired
private ProjectYearNameInfoEOMapper projectYearNameInfoEOMapper;
@Autowired
private IFeishuService feishuService;
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
/**
* 任务确认流程定时
* @param context
* @throws JobExecutionException
*/
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
log.info("任务确认流程,定时任务开启 =====================================================");
QueryWrapper<ProjectLawsInventoryEO> queryWrapperInventory = new QueryWrapper<>();
queryWrapperInventory.lambda().eq(ProjectLawsInventoryEO::getTaskAffirmStatus, InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue());
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(queryWrapperInventory);
if (ObjectUtils.isNotEmpty(projectLawsInventoryEOList)) {
List<String> projectLibraryIdList = projectLawsInventoryEOList.stream().distinct()
.map(ProjectLawsInventoryEO::getProjectLibraryId).collect(Collectors.toList());
QueryWrapper<ProjectLibraryBase> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(ProjectLibraryBase::getId,projectLibraryIdList);
List<ProjectLibraryBase> projectLibraryBaseList = projectLibraryBaseMapper.selectList(queryWrapper);
if (ObjectUtils.isNotEmpty(projectLibraryBaseList)) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date currentDate = new Date();
//获取后三天前的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,3);
Date threeDays = calendar.getTime();
String threeDaysStr = sdf.format(threeDays);
String currentDateStr = sdf.format(currentDate);
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId, projectLibraryBase.getProjectNameId());
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
QueryWrapper<ProjectYearNameInfoEO> projectYearInfoEOQueryWrapper = new QueryWrapper<>();
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId, projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
Map<String, String> threeDaysMap = new HashMap<>();
Map<String, String> currentDaysMap = new HashMap<>();
Map<String, String> overdueMap = new HashMap<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOList) {
if (StringUtils.equals(projectLibraryBase.getId(), projectLawsInventoryEO.getProjectLibraryId())) {
if (projectLawsInventoryEO.getTaskAffirmDueDate() != null) {
//结束日期是当前日期
if (StringUtils.equals(currentDateStr, sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()))) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
currentDaysMap.put(projectLawsInventoryEO.getId(), projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
//如果清单确认结束时间是当前系统时间后三天
if (StringUtils.equals(threeDaysStr, sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()))) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
threeDaysMap.put(projectLawsInventoryEO.getId(), projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
//逾期3天、七天、14天
Calendar day3Later = new GregorianCalendar();
day3Later.setTime(projectLawsInventoryEO.getTaskAffirmDueDate());
day3Later.add(Calendar.DATE, 3);
Date overdue3Days = day3Later.getTime();
Calendar day7Later = new GregorianCalendar();
day7Later.setTime(projectLawsInventoryEO.getTaskAffirmDueDate());
day7Later.add(Calendar.DATE, 7);
Date overdue7Days = day7Later.getTime();
Calendar day14Later = new GregorianCalendar();
day14Later.setTime(projectLawsInventoryEO.getTaskAffirmDueDate());
day14Later.add(Calendar.DATE, 14);
Date overdue14Days = day14Later.getTime();
if (StringUtils.equals(sdf.format(overdue3Days), sdf.format(currentDate))
|| StringUtils.equals(sdf.format(overdue7Days), sdf.format(currentDate))
|| StringUtils.equals(sdf.format(overdue14Days), sdf.format(currentDate))) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
overdueMap.put(projectLawsInventoryEO.getId(), projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
}
}
}
//飞书跳转链接
String hrefFeishu = backUrl
+ "/projectRegulationTasks";
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
if (!threeDaysMap.isEmpty()) {
for (String key : threeDaysMap.keySet()) {
String[] ids = threeDaysMap.get(key).split(",");
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(Arrays.asList(ids));
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务将于3天后到期,请及时查看处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! This task will expire in 3 days. Please check and address it in a timely manner. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
if (!currentDaysMap.isEmpty()) {
for (String key : currentDaysMap.keySet()) {
String[] ids = currentDaysMap.get(key).split(",");
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(Arrays.asList(ids));
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务今天即将到期,请尽快查看处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! This task will expire today. Please check and address the task ASAP. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
if (!overdueMap.isEmpty()) {
for (String key : overdueMap.keySet()) {
String[] ids = overdueMap.get(key).split(",");
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(Arrays.asList(ids));
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务已逾期,请尽快处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知" +
"\n截止时间: " + dueDate);
feishuMsgVo.setEnContentUpper("Hello! This task is overdue. Please address it ASAP. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName() +
"\nDue Date: " + dueDate);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.YELLOW.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
}
}
}
log.info("任务确认流程,定时任务结束 =====================================================");
}
}
@@ -1,7 +1,13 @@
package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.DesignComplianceStatusEnum;
@@ -13,8 +19,11 @@ import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.service.IProjectTaskInventoryEOService;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@@ -22,6 +31,7 @@ import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -52,13 +62,23 @@ public class VerifyComplianceJob implements Job {
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IFeishuService feishuService;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("验证符合性流程,定时任务开启 =====================================================");
//查询出已经启动了验证符合性流程的数据。 并且流程没有结束。
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
queryProjectTaskInventoryWrapper.isNotNull("verify_p_id");
queryProjectTaskInventoryWrapper.lambda().ne(ProjectTaskInventoryEO::getVerifyStatus, DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue());
List<String> status = new ArrayList<>();
status.add(DesignComplianceStatusEnum.TO_SUBMIT.getValue());
status.add(DesignComplianceStatusEnum.REVIEW_THE_RETURN.getValue());
queryProjectTaskInventoryWrapper.lambda().in(ProjectTaskInventoryEO::getVerifyStatus, status);
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper);
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
@@ -79,15 +99,24 @@ public class VerifyComplianceJob implements Job {
Date currentDate = new Date();
//获取后三天前的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,3);
Date threeDays = calendar.getTime();
String threeDaysStr = sdf.format(threeDays);
//两周
Calendar twoWeeksLaterCalendar=new GregorianCalendar();
twoWeeksLaterCalendar.setTime(new Date());
twoWeeksLaterCalendar.add(Calendar.DATE,14);
Date twoWeeksLaterDays = twoWeeksLaterCalendar.getTime();
String twoWeeksLaterDaysStr = sdf.format(twoWeeksLaterDays);
//一周
Calendar oneWeekLaterCalendar=new GregorianCalendar();
oneWeekLaterCalendar.setTime(new Date());
oneWeekLaterCalendar.add(Calendar.DATE,7);
Date oneWeekLaterDays = oneWeekLaterCalendar.getTime();
String oneWeekLaterDaysStr = sdf.format(oneWeekLaterDays);
//当天
String currentDateStr = sdf.format(currentDate);
String msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
@@ -97,114 +126,235 @@ public class VerifyComplianceJob implements Job {
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) {
List<String> threeDaysUserIdList = new ArrayList<>();
List<String> currentDaysUserIdList = new ArrayList<>();
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
for (ProjectTaskInventoryEO projectTaskInventoryEO : projectTaskInventoryEOList) {
if(StringUtils.equals(projectTaskInventoryEO.getProjectLawsInventoryId(),projectLawsInventoryEO.getId())){
if(projectLawsInventoryEO.getVerifyDueDate() != null){
//如果验证符合性 - 结束日期是当前日期
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
if(StringUtils.isEmpty(projectTaskInventoryEO.getVerifySendMsgFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyInitiatorId());
}
projectTaskInventoryEO.setVerifySendMsgFlag(SendMsgFlagEnum.FALSE.getValue());
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
}
for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) {
//法规中英文
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String LAW_EN = "";
if (ObjectUtils.isEmpty(bussDocumentLibraryEO)) {
LAW_EN = LAW_CN;
} else {
LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
}
List<String> twoWeeksLaterUserIdList = new ArrayList<>();
List<String> oneWeeksLaterUserIdList = new ArrayList<>();
List<String> currentDaysUserIdList = new ArrayList<>();
List<String> dueUserIdList = new ArrayList<>();
if(StringUtils.equals(projectLawsInventoryEO.getProjectLibraryId(),projectLibraryBase.getId())){
if(projectLawsInventoryEO.getVerifyDueDate() != null){
//如果验证符合性 - 结束日期是当前日期
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
}
//如果验证符合性 - 结束日期是三天后的日期
if(StringUtils.equals(threeDaysStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
if(StringUtils.isEmpty(projectTaskInventoryEO.getVerifySendMsgCurrentFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
threeDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){
threeDaysUserIdList.add(projectLawsInventoryEO.getVerifyInitiatorId());
}
projectTaskInventoryEO.setVerifySendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue());
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
}
}
//如果验证符合性 - 结束日期是两周后的日期
if(StringUtils.equals(twoWeeksLaterDaysStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
}
}
//如果验证符合性 - 结束日期是一周后的日期
if(StringUtils.equals(oneWeekLaterDaysStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
oneWeeksLaterUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
}
}
//如果验证符合性 - 逾期后每天通知
if (!StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))&&projectLawsInventoryEO.getVerifyDueDate().before(currentDate)) {
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
dueUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
}
}
}
}
if(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
String hrefFeishu = backUrl
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
if (ObjectUtils.isNotEmpty(dueUserIdList)) {
dueUserIdList = dueUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(dueUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务已逾期,请尽快查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知"+
"\n截止时间: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setEnContentUpper("Hello! Your task is overdue. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()+
"\nDue Date: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.YELLOW.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
if (ObjectUtils.isNotEmpty(oneWeeksLaterUserIdList)) {
oneWeeksLaterUserIdList = oneWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(oneWeeksLaterUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务将于7天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 7 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
if(CollectionUtils.isNotEmpty(twoWeeksLaterUserIdList)){
twoWeeksLaterUserIdList = twoWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(twoWeeksLaterUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务将于14天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 14 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的验证符合性确认剩余处理时间还有3天,请及时查看处理
//The remaining processing time for the Verify compliance confirmation of GB 7258 in XXX (project name) is 3 days. Please check and handle it in time.
String msgContentEN = "The remaining processing time for the validation compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()+ " "
+ projectLibraryBase.getTargetMarket()
+ " are 3 days. Please check and handle it in time.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete";
//String msgContentEN = "The remaining processing time for the validation compliance confirmation of "
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()+ " "
// + projectLibraryBase.getTargetMarket()
// + " are 3 days. Please check and handle it in time.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a validation compliance task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Validation Compliance Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
// FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Validation Compliance Confirmation");
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
//String hrefFeishu = backUrl
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
// + projectLibraryBase.getId()
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(currentDaysUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务将于今天到期,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will expire today. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的验证符合性确认任务今天即将结束,请及时查看处理
//The the Verify compliance confirmation of GB 7258 in XXX (project name) is coming to an end today. Please check and deal with it in time
String msgContentEN = "The the validation compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " will expire today. Please check and address it in time.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete";
//String msgContentEN = "The the validation compliance confirmation of "
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " will expire today. Please check and address it in time.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a validation compliance task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Validation Compliance Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Validation Compliance Confirmation");
// feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
// String hrefFeishu = backUrl
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
// + projectLibraryBase.getId()
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName()
// + "'>" + " View details" + "</a>";
// String contentInfo = msgContentEN + " " + href;
// Map<String,Object> sendMessageMap = new HashMap<>();
// sendMessageMap.put("hrefFeishu",hrefFeishu);
// sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
// projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
}
}
@@ -1,7 +1,13 @@
package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.DesignComplianceStatusEnum;
@@ -13,8 +19,11 @@ import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.service.IProjectTaskInventoryEOService;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@@ -22,6 +31,7 @@ import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -52,13 +62,23 @@ public class designComplianceJob implements Job {
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IFeishuService feishuService;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("设计符合性确认流程,定时任务开启 =====================================================");
//查询出已经启动了设计符合性流程的数据。 并且流程没有结束。
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
queryProjectTaskInventoryWrapper.isNotNull("design_p_id");
queryProjectTaskInventoryWrapper.lambda().ne(ProjectTaskInventoryEO::getDesignStatus, DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue());
List<String> status = new ArrayList<>();
status.add(DesignComplianceStatusEnum.TO_SUBMIT.getValue());
status.add(DesignComplianceStatusEnum.REVIEW_THE_RETURN.getValue());
queryProjectTaskInventoryWrapper.lambda().in(ProjectTaskInventoryEO::getDesignStatus, status);
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper);
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
@@ -79,15 +99,24 @@ public class designComplianceJob implements Job {
Date currentDate = new Date();
//获取后三天前的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,3);
Date threeDays = calendar.getTime();
String threeDaysStr = sdf.format(threeDays);
//两周
Calendar twoWeeksLaterCalendar=new GregorianCalendar();
twoWeeksLaterCalendar.setTime(new Date());
twoWeeksLaterCalendar.add(Calendar.DATE,14);
Date twoWeeksLaterDays = twoWeeksLaterCalendar.getTime();
String twoWeeksLaterDaysStr = sdf.format(twoWeeksLaterDays);
//一周
Calendar oneWeekLaterCalendar=new GregorianCalendar();
oneWeekLaterCalendar.setTime(new Date());
oneWeekLaterCalendar.add(Calendar.DATE,7);
Date oneWeekLaterDays = oneWeekLaterCalendar.getTime();
String oneWeekLaterDaysStr = sdf.format(oneWeekLaterDays);
//当天
String currentDateStr = sdf.format(currentDate);
String msgTitle = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn();
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
@@ -97,109 +126,249 @@ public class designComplianceJob implements Job {
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) {
List<String> threeDaysUserIdList = new ArrayList<>();
//法规中英文
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String LAW_EN = "";
if (ObjectUtils.isEmpty(bussDocumentLibraryEO)) {
LAW_EN = LAW_CN;
} else {
LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
}
List<String> twoWeeksLaterUserIdList = new ArrayList<>();
List<String> oneWeeksLaterUserIdList = new ArrayList<>();
List<String> currentDaysUserIdList = new ArrayList<>();
List<String> dueUserIdList = new ArrayList<>();
for (ProjectTaskInventoryEO projectTaskInventoryEO : projectTaskInventoryEOList) {
if(StringUtils.equals(projectTaskInventoryEO.getProjectLawsInventoryId(),projectLawsInventoryEO.getId())){
//如果设计符合性 - 结束日期是当前日期
if(projectLawsInventoryEO.getDesignDueDate() != null){
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getDesignDueDate()))){
if(StringUtils.isEmpty(projectTaskInventoryEO.getDesignSendMsgFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignInitiatorId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getDesignInitiatorId());
}
projectTaskInventoryEO.setDesignSendMsgFlag(SendMsgFlagEnum.FALSE.getValue());
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
}
if(StringUtils.equals(projectLawsInventoryEO.getProjectLibraryId(),projectLibraryBase.getId())){
//如果设计符合性 - 结束日期是当前日期
if(projectLawsInventoryEO.getDesignDueDate() != null){
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getDesignDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
}
}
//如果设计符合性 - 结束日期是三天后的日期
if(StringUtils.equals(threeDaysStr,sdf.format(projectLawsInventoryEO.getDesignDueDate()))){
if(StringUtils.isEmpty(projectTaskInventoryEO.getDesignSendMsgCurrentFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
threeDaysUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignInitiatorId())){
threeDaysUserIdList.add(projectLawsInventoryEO.getDesignInitiatorId());
}
projectTaskInventoryEO.setDesignSendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue());
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
}
//如果设计符合性 - 结束日期是两周后的日期
if(StringUtils.equals(twoWeeksLaterDaysStr,sdf.format(projectLawsInventoryEO.getDesignDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
twoWeeksLaterUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
}
}
//如果设计符合性 - 结束日期是一周后的日期
if(StringUtils.equals(oneWeekLaterDaysStr,sdf.format(projectLawsInventoryEO.getDesignDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
oneWeeksLaterUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
}
}
//逾期三天、七天、十四天
Calendar due3Days = new GregorianCalendar();
due3Days.setTime(projectLawsInventoryEO.getDesignDueDate());
due3Days.add(Calendar.DATE, 3);
Date overdue3Days = due3Days.getTime();
Calendar due7Days = new GregorianCalendar();
due7Days.setTime(projectLawsInventoryEO.getDesignDueDate());
due7Days.add(Calendar.DATE, 7);
Date overdue7Days = due7Days.getTime();
Calendar due14Days = new GregorianCalendar();
due14Days.setTime(projectLawsInventoryEO.getDesignDueDate());
due14Days.add(Calendar.DATE, 14);
Date overdue14Days = due14Days.getTime();
if (StringUtils.equals(sdf.format(overdue3Days), currentDateStr)
|| StringUtils.equals(sdf.format(overdue7Days), currentDateStr)
|| StringUtils.equals(sdf.format(overdue14Days), currentDateStr)) {
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
dueUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
}
}
}
}
if(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
String hrefFeishu = backUrl
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
if (ObjectUtils.isNotEmpty(dueUserIdList)) {
dueUserIdList = dueUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(dueUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务已逾期,请尽快查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知"+
"\n截止时间: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setEnContentUpper("Hello! Your task is overdue. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()+
"\nDue Date: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.YELLOW.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
if (ObjectUtils.isNotEmpty(oneWeeksLaterUserIdList)) {
oneWeeksLaterUserIdList = oneWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(oneWeeksLaterUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务将于7天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 7 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
if(CollectionUtils.isNotEmpty(twoWeeksLaterUserIdList)){
twoWeeksLaterUserIdList = twoWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(twoWeeksLaterUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务将于14天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 14 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的设计符合性确认剩余处理时间还有3天,请及时查看处理
String msgContentEN = "The remaining processing time for the design compliance confirmation for "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ projectYearNameInfoEO.getYearName()+ " "
+ projectLibraryBase.getTargetMarket()
+ " are 3 days. Please check and address it in a timely manner.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a design compliance task to complete";
//String msgContentEN = "The remaining processing time for the design compliance confirmation for "
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
// + projectYearNameInfoEO.getYearName()+ " "
// + projectLibraryBase.getTargetMarket()
// + " are 3 days. Please check and address it in a timely manner.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a design compliance task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Design Compliance Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Design Compliance Confirmation");
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//飞书跳转链接
String hrefFeishu = backUrl + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType();
//String hrefFeishu = backUrl + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(currentDaysUserIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务将于今天到期,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will expire today. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的设计符合性确认任务今天即将结束,请及时查看处理
String msgContentEN = "The design compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ " will expire today. Please check and address it in time.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a design compliance task to complete";
//String msgContentEN = "The design compliance confirmation of "
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
// + " will expire today. Please check and address it in time.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a design compliance task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Design Compliance Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Design Compliance Confirmation");
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
//String hrefFeishu = backUrl
// + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink()
// + projectLibraryBase.getId()
// + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
}
}
@@ -16,7 +16,9 @@ import java.util.Map;
*/
public interface ProjectLibraryBaseMapper extends BaseMapper<ProjectLibraryBase> {
/**分页列表*/
IPage<ProjectLibraryBase> queryPageList(IPage page, Map<String, Object> params);
List<ProjectLibraryBase> queryPageList(@Param("params") Map<String, Object> params);
List<ProjectLibraryBase> queryMaimList();
// IPage<ProjectLibraryBase> queryPageList(IPage page, Map<String, Object> params);
List<ProjectLibraryBase> getList(@Param("projectLibraryBase") ProjectLibraryBase projectLibraryBase);
@@ -15,13 +15,54 @@
LEFT JOIN project_laws_inventory pli ON ( pli.stand_id = bdl.id )
LEFT JOIN project_task_inventory pti ON ( pli.id = pti.project_laws_inventory_id )
WHERE
(
bdl.id IN ( SELECT DISTINCT stand_id FROM laws_opinion_gather where gather_result = #{params.gatherResult})
OR bdl.id IN ( SELECT DISTINCT stand_id FROM laws_technology_evaluation where flow_status = #{params.flowStatus})
or pti.design_p_id IS NOT NULL
OR pti.prehomo_p_id IS NOT NULL
OR pti.verify_p_id IS NOT NULL
)
<if test="params.isEngineerOrEngineeringInterfacePerson != true">
(
bdl.id IN (
SELECT
DISTINCT stand_id
FROM laws_opinion_gather
where gather_result = #{params.gatherResult}
)
OR bdl.id IN (
SELECT
DISTINCT stand_id
FROM laws_technology_evaluation
where flow_status = #{params.flowStatus}
)
OR pti.design_p_id IS NOT NULL
OR pti.prehomo_p_id IS NOT NULL
OR pti.verify_p_id IS NOT NULL
)
</if>
<!--2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。-->
<if test="params.isEngineerOrEngineeringInterfacePerson == true">
(
bdl.id IN (
SELECT
DISTINCT stand_id
FROM
laws_opinion_gather
where gather_result = #{params.gatherResult} and evaluator_ids like CONCAT(CONCAT('%',#{params.currentUserId}),'%')
)
OR bdl.id IN (
SELECT
DISTINCT stand_id
FROM
laws_technology_evaluation
where flow_status = #{params.flowStatus}
and id in (
select
laws_technology_evaluation_id
from
laws_technology_evaluation_flow_detail
where evaluator_id = #{params.currentUserId}
)
)
OR (pti.design_p_id IS NOT NULL and (pli.design_initiator_id = #{params.currentUserId} or pli.design_duty_id = #{params.currentUserId}))
OR (pti.prehomo_p_id IS NOT NULL and (pli.prehomo_initiator_id = #{params.currentUserId} or pli.prehomo_duty_id = #{params.currentUserId}))
OR (pti.verify_p_id IS NOT NULL and (pli.verify_initiator_id = #{params.currentUserId} or pli.verify_duty_id = #{params.currentUserId}))
)
</if>
${params.condition}
GROUP BY bdl.id
order by bdl.create_time desc
@@ -34,6 +75,12 @@
pli.serial_number as "serialNumber",
pli.title as "title",
pli.project_library_id as "projectLibraryId",
pli.design_initiator_id as "designInitiatorId",
pli.design_duty_id as "designDutyId",
pli.prehomo_initiator_id as "prehomoInitiatorId",
pli.prehomo_duty_id as "prehomoDutyId",
pli.verify_initiator_id as "verifyInitiatorId",
pli.verify_duty_id as "verifyDutyId",
pni.project_name as "projectName",
pni.id as "projectNameId",
pyni.year_name as "yearName",
@@ -80,6 +127,16 @@
#{item}
</foreach>
</if>
<if test="params.isEngineerOrEngineeringInterfacePerson == true">
and(
pli.design_initiator_id = #{params.currentUserId}
or pli.design_duty_id = #{params.currentUserId}
or pli.prehomo_initiator_id = #{params.currentUserId}
or pli.prehomo_duty_id = #{params.currentUserId}
or pli.verify_initiator_id = #{params.currentUserId}
or pli.verify_duty_id = #{params.currentUserId}
)
</if>
order by pli.create_time desc
</select>
@@ -96,16 +153,57 @@
LEFT JOIN project_laws_inventory pli ON ( pli.stand_id = bdl.id )
LEFT JOIN project_task_inventory pti ON ( pli.id = pti.project_laws_inventory_id )
WHERE
<if test="params.isEngineerOrEngineeringInterfacePerson != true">
(
bdl.id IN ( SELECT DISTINCT stand_id FROM laws_opinion_gather)
OR bdl.id IN ( SELECT DISTINCT stand_id FROM laws_technology_evaluation)
or pti.design_p_id IS NOT NULL
OR pti.prehomo_p_id IS NOT NULL
OR pti.verify_p_id IS NOT NULL
bdl.id IN (
SELECT
DISTINCT stand_id
FROM laws_opinion_gather
where gather_result = #{params.gatherResult}
)
<if test="params.condition != '' ">
${params.condition}
</if>
OR bdl.id IN (
SELECT
DISTINCT stand_id
FROM laws_technology_evaluation
where flow_status = #{params.flowStatus}
)
OR pti.design_p_id IS NOT NULL
OR pti.prehomo_p_id IS NOT NULL
OR pti.verify_p_id IS NOT NULL
)
</if>
<!--2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。-->
<if test="params.isEngineerOrEngineeringInterfacePerson == true">
(
bdl.id IN (
SELECT
DISTINCT stand_id
FROM
laws_opinion_gather
where gather_result = #{params.gatherResult} and evaluator_ids like CONCAT(CONCAT('%',#{params.currentUserId}),'%')
)
OR bdl.id IN (
SELECT
DISTINCT stand_id
FROM
laws_technology_evaluation
where flow_status = #{params.flowStatus}
and id in (
select
laws_technology_evaluation_id
from
laws_technology_evaluation_flow_detail
where evaluator_id = #{params.currentUserId}
)
)
OR (pti.design_p_id IS NOT NULL and (pli.design_initiator_id = #{params.currentUserId} or pli.design_duty_id = #{params.currentUserId}))
OR (pti.prehomo_p_id IS NOT NULL and (pli.prehomo_initiator_id = #{params.currentUserId} or pli.prehomo_duty_id = #{params.currentUserId}))
OR (pti.verify_p_id IS NOT NULL and (pli.verify_initiator_id = #{params.currentUserId} or pli.verify_duty_id = #{params.currentUserId}))
)
</if>
<if test="params.condition != '' ">
${params.condition}
</if>
GROUP BY bdl.id
order by bdl.create_time desc
</select>
@@ -80,12 +80,15 @@
or prehomo_flow_task_status =#{ncrTrackVO.inconformity} or prehomo_flow_task_status =#{ncrTrackVO.track}
or verify_flow_task_status =#{ncrTrackVO.inconformity} or verify_flow_task_status =#{ncrTrackVO.track}
)
<if test="ncrTrackVO.userId != null and ncrTrackVO.userId != ''">
and (pli.regulation_owner_id =#{ncrTrackVO.userId}
or pli.homologation_engineer_id =#{ncrTrackVO.userId}
or pli.engineering_interface_person =#{ncrTrackVO.userId}
or ptid.user_id =#{ncrTrackVO.userId}
)
<!--如果当前操作人不是系统管理员角色,查询跟自己相关的数据,如果是系统管理员,查询所有的-->
<if test="ncrTrackVO.administrator == 'false'">
<if test="ncrTrackVO.userId != null and ncrTrackVO.userId != ''">
and (pli.regulation_owner_id =#{ncrTrackVO.userId}
or pli.homologation_engineer_id =#{ncrTrackVO.userId}
or pli.engineering_interface_person =#{ncrTrackVO.userId}
or ptid.user_id =#{ncrTrackVO.userId}
)
</if>
</if>
order by pli.create_time desc
@@ -55,7 +55,10 @@
from
project_laws_inventory
where
project_library_id = #{projectLibraryId}
project_library_id in
<foreach collection="projectLibraryId.split(',')" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
group by inventory_affirm_status
</select>
@@ -67,7 +70,10 @@
from
project_laws_inventory
where
project_library_id = #{projectLibraryId}
project_library_id in
<foreach collection="projectLibraryId.split(',')" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
group by task_affirm_status
</select>
@@ -43,7 +43,13 @@
plb.create_time,
plb.sys_org_code,
plb.update_by,
plb.update_time
plb.update_time,
plb.parent_id,
plb.project_version,
plb.explanation,
plb.software_version,
plb.sort,
plb.flag
from project_library_base as plb
left join project_name_info as pni on plb.project_name_id=pni.id
left join sys_user as studiouser on plb.studio_engineer=studiouser.id
@@ -62,10 +68,10 @@
( pni.project_name like '%1%%' escape '1' or pni.project_name like '%1%%' escape '1')
</when>
<otherwise>
(pni.project_name like concat('%',#{params.projectName},'%') or pyni.year_name like concat('%',#{params.projectName},'%'))
</otherwise>
</choose>
</if>
<!--(pni.project_name like concat('%',#{params.projectName},'%') or pyni.year_name like concat('%',#{params.projectName},'%'))-->
</otherwise>
</choose>
</if>
<!--搜索条件:目标市场-->
<if test="params.targetMarket != null and params.targetMarket != '' ">
@@ -111,8 +117,80 @@
and plb.digital_platform like concat('%',#{params.digitalPlatform},'%')
</if>
</where>
order by plb.create_time desc
order by plb.sort desc, plb.create_time desc
</select>
<select id="queryMaimList" resultType="com.jero.modules.project.entity.ProjectLibraryBase">
<include refid="select_item"/>
<where>
parent_id = '' or parent_id is null
</where>
order by plb.sort desc, plb.create_time desc
</select>
<!-- <select id="queryPageList" resultType="com.jero.modules.project.entity.ProjectLibraryBase">-->
<!-- <include refid="select_item"/>-->
<!-- <where>-->
<!-- <if test="params.projectName != null and params.projectName != ''">-->
<!-- &lt;!&ndash;搜索条件:项目名称,包含%,单独搜索&ndash;&gt;-->
<!-- <choose>-->
<!-- <when test='params.projectName != null and params.projectName != "" and params.projectName.contains("%")'>-->
<!-- ( pni.project_name like '%1%%' escape '1' or pni.project_name like '%1%%' escape '1')-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- (pni.project_name like concat('%',#{params.projectName},'%') or pyni.year_name like concat('%',#{params.projectName},'%'))-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- </if>-->
<!-- &lt;!&ndash;搜索条件:目标市场&ndash;&gt;-->
<!-- <if test="params.targetMarket != null and params.targetMarket != '' ">-->
<!-- and plb.target_market like concat('%',#{params.targetMarket},'%')-->
<!-- </if>-->
<!-- &lt;!&ndash;搜索条件:项目状态&ndash;&gt;-->
<!-- <if test="params.projectStatus != null and params.projectStatus != '' ">-->
<!-- and plb.project_status like concat('%',#{params.projectStatus},'%')-->
<!-- </if>-->
<!-- <if test="params.studioEngineer != null and params.studioEngineer != ''">-->
<!-- &lt;!&ndash;搜索条件:studio工程师,包含%,单独搜索&ndash;&gt;-->
<!-- <choose>-->
<!-- <when test='params.studioEngineer != null and params.studioEngineer != "" and params.studioEngineer.contains("%")'>-->
<!-- and plb.studio_engineer like '%1%%' escape '1'-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- and plb.studio_engineer like concat('%',#{params.studioEngineer},'%')-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- </if>-->
<!-- <if test="params.certificationEngineer != null and params.certificationEngineer != ''">-->
<!-- &lt;!&ndash;搜索条件:认证工程师,包含%,单独搜索&ndash;&gt;-->
<!-- <choose>-->
<!-- <when test='params.certificationEngineer != null and params.certificationEngineer != "" and params.certificationEngineer.contains("%")'>-->
<!-- and plb.certification_engineer like '%1%%' escape '1'-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- and plb.certification_engineer like concat('%',#{params.certificationEngineer},'%')-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- </if>-->
<!-- &lt;!&ndash;搜索条件:车型平台&ndash;&gt;-->
<!-- <if test="params.vehiclePlatform != null and params.vehiclePlatform != '' ">-->
<!-- and plb.vehicle_platform like concat('%',#{params.vehiclePlatform},'%')-->
<!-- </if>-->
<!-- &lt;!&ndash;搜索条件:数字平台&ndash;&gt;-->
<!-- <if test="params.digitalPlatform != null and params.digitalPlatform != '' ">-->
<!-- and plb.digital_platform like concat('%',#{params.digitalPlatform},'%')-->
<!-- </if>-->
<!-- </where>-->
<!-- order by plb.create_time desc-->
<!-- </select>-->
<select id="getList" resultType="com.jero.modules.project.entity.ProjectLibraryBase">
<include refid="select_item"/>
@@ -8,6 +8,7 @@ import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.vo.ProjectTaskUrgVo;
import com.jero.modules.system.entity.SysRole;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
import com.jero.modules.todoCenter.entity.ProcessInfoEO;
@@ -156,4 +157,7 @@ public interface IProjectLawsInventoryEOService extends IService<ProjectLawsInve
void addProcessInfo(ProcessInfoEO processInfoEO, String projectLibraryId, Date endTime);
void addProcessInfoDetail(String processInfoId, List<ProcessInfoDetailEO> processInfoDetailEOList, Date endTime);
Result<?> taskUrg(ProjectTaskUrgVo projectTaskUrgVo);
}
@@ -1,6 +1,6 @@
package com.jero.modules.project.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.project.entity.ProjectLibraryBase;
@@ -26,6 +26,14 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
*/
void add(ProjectLibraryBase projectLibraryBase) throws ParseException;
/**
* 项目扩展(添加子项目-子项目基本信息、相关人员名单、法规/认证任务计划与被扩展项目保持一致)
*
* @param projectLibraryBase
* @return
*/
void addChild(ProjectLibraryBase projectLibraryBase) throws ParseException;
/**
* 更新
*
@@ -56,7 +64,7 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
* @param id
* @return
*/
List<ProjectLibraryBase> queryById(String id);
List<ProjectLibraryBase> queryById(String id,String cut);
/**
* 列表查询
@@ -70,7 +78,8 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
*
* @return
*/
IPage<ProjectLibraryBase> queryPageList(Map<String, Object> params);
List<ProjectLibraryBase> queryPageList(Map<String, Object> params);
// IPage<ProjectLibraryBase> queryPageList(Map<String, Object> params);
/**
* 项目详情-统计接口
@@ -91,4 +100,28 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
void checkData(String id, String cut);
void disposeData(List<ProjectLibraryBase> records,String cut,boolean disposeTargetMarketFlag);
Page getPages(Integer currentPage, Integer pageSize, List<ProjectLibraryBase> list);
/**
* 项目置顶,取消置顶(只置顶主项目)
* @param id
* @param flag 0为置顶, 1为取消置顶
* @return
*/
void top(String id,String flag);
/**
* 获取项目所有的版本(主版本和子版本的集合)
* @param id
* @return
*/
List<String> getVersionsInfo(String id);
/**
* 版本统计
* @param id
* @return
*/
List<ProjectLibraryBase> versionStatistics(String id);
}
@@ -25,6 +25,7 @@ import com.jero.modules.project.service.ILawsComplianceBoardService;
import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.ISysDictItemService;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.system.util.StringUtils;
@@ -68,6 +69,8 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
private ISysDictItemService sysDictItemService;
@Autowired
private ProjectTaskInventoryDetailEOMapper projectTaskInventoryDetailEOMapper;
@Autowired
private ISysUserService sysUserService;
@Override
public IPage queryPageList(Map<String, Object> params) {
@@ -81,6 +84,18 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
//只查询 法规技术评估流程状态、法规意见收集 收集结果 为已完成的数据
params.put("flowStatus", GatherResultEnum.COMPLETED.getValue());
params.put("gatherResult", GatherResultEnum.COMPLETED.getValue());
/**
* 2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。
*/
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean isEngineer = this.sysUserService.isEngineer(currentUser);
boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser);
if(isEngineer || isEngineeringInterfacePerson){
params.put("currentUserId",currentUser.getId());
params.put("isEngineerOrEngineeringInterfacePerson",true);
}
IPage page = new Page(pageNo, pageSize);
IPage infoPage = this.lawsComplianceBoardMapper.queryPageList(page, params);
List records = infoPage.getRecords();
@@ -142,18 +157,28 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
@Override
public JSONObject queryComplianceResultList(Map<String, Object> params) {
/**
* 2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。
*/
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean isEngineer = this.sysUserService.isEngineer(currentUser);
boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser);
if(isEngineer || isEngineeringInterfacePerson){
params.put("currentUserId",currentUser.getId());
params.put("isEngineerOrEngineeringInterfacePerson",true);
}
JSONObject result = new JSONObject();
String id = (String) params.get("id");
String cut = (String) params.get("cut");
List<Map<String,Object>> complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
if(CollectionUtils.isNotEmpty(complianceResultList)){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> projectLawsInventoryIdList = complianceResultList.stream().map(map-> (String) map.get("id")).collect(Collectors.toList());
QueryWrapper<ProjectTaskInventoryDetailEO> taskDetailQueryWrapper = new QueryWrapper<>();
taskDetailQueryWrapper.lambda().in(ProjectTaskInventoryDetailEO::getProjectTaskInventoryId,projectLawsInventoryIdList);
List<ProjectTaskInventoryDetailEO> projectTaskInventoryDetailEOList = this.projectTaskInventoryDetailEOMapper.selectList(taskDetailQueryWrapper);
this.createTaskInventoryEOList(complianceResultList,projectTaskInventoryDetailEOList,currentUser);
this.disposeComplianceResult(complianceResultList,cut);
this.createTaskInventoryEOList(complianceResultList,projectTaskInventoryDetailEOList,currentUser,isEngineer,isEngineeringInterfacePerson);
this.disposeComplianceResult(complianceResultList,cut,isEngineer,isEngineeringInterfacePerson);
}
result.put("complianceResultList",complianceResultList);
@@ -161,6 +186,10 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
QueryWrapper<LawsOpinionGatherEO> opinionGatherEOQueryWrapper = new QueryWrapper<>();
opinionGatherEOQueryWrapper.lambda().eq(LawsOpinionGatherEO::getStandId,id);
opinionGatherEOQueryWrapper.lambda().eq(LawsOpinionGatherEO::getGatherResult,GatherResultEnum.COMPLETED.getValue());
//如果当前登录用户是工程师或工程接口人,只查询自己为评估人的法规意见收集数据。
if(isEngineer || isEngineeringInterfacePerson){
opinionGatherEOQueryWrapper.lambda().like(LawsOpinionGatherEO::getEvaluatorIds,currentUser.getId());
}
int opinionGatherCount = this.lawsOpinionGatherEOService.count(opinionGatherEOQueryWrapper);
result.put("opinionGather",opinionGatherCount);
@@ -168,6 +197,10 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
QueryWrapper<LawsTechnologyEvaluationEO> evaluationEOQueryWrapper = new QueryWrapper<>();
evaluationEOQueryWrapper.lambda().eq(LawsTechnologyEvaluationEO::getStandId,id);
evaluationEOQueryWrapper.lambda().eq(LawsTechnologyEvaluationEO::getFlowStatus,GatherResultEnum.COMPLETED.getValue());
//如果当前登录用户是工程师或工程接口人,只查询自己为评估人的法规技术评估数据。
if(isEngineer || isEngineeringInterfacePerson){
this.lawsTechnologyEvaluationEOService.createQueryPermission(evaluationEOQueryWrapper,null,false);
}
int evaluationCount = this.lawsTechnologyEvaluationEOService.count(evaluationEOQueryWrapper);
result.put("technologyEvaluation",evaluationCount);
return result;
@@ -178,8 +211,14 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
* @param complianceResultList
* @param projectTaskInventoryDetailEOList
* @param currentUser
* @param isEngineer 是否是工程师角色
* @param isEngineeringInterfacePerson 是否是工程接口人角色
*/
private void createTaskInventoryEOList(List<Map<String, Object>> complianceResultList, List<ProjectTaskInventoryDetailEO> projectTaskInventoryDetailEOList, LoginUser currentUser) {
private void createTaskInventoryEOList(List<Map<String, Object>> complianceResultList,
List<ProjectTaskInventoryDetailEO> projectTaskInventoryDetailEOList,
LoginUser currentUser,
boolean isEngineer,
boolean isEngineeringInterfacePerson) {
if(CollectionUtils.isNotEmpty(complianceResultList) && CollectionUtils.isNotEmpty(projectTaskInventoryDetailEOList)){
for (Map<String, Object> complianceResult : complianceResultList) {
String designPid = "";
@@ -199,44 +238,97 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
String verifyTaskStatus = "";
String verifyTaskDefinitionKey = "";
String verifyTaskDetailId = "";
for (ProjectTaskInventoryDetailEO projectTaskInventoryDetail : projectTaskInventoryDetailEOList) {
if(StringUtils.equals(complianceResult.get("id").toString(),projectTaskInventoryDetail.getProjectTaskInventoryId())){
/**
* 查询数据权限,所有用户都是,自己的待办,可以跳转到处理任务详情页进行处理。
* 不是自己的待办,只能跳转到处理任务的详情页。
*/
if(StringUtils.equals(projectTaskInventoryDetail.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue())){
designPid = projectTaskInventoryDetail.getActiProcInstId();
designTaskId = projectTaskInventoryDetail.getTaskId();
designTaskDefinitionKey = projectTaskInventoryDetail.getTaskDefinitionKey();
designTaskDetailId = projectTaskInventoryDetail.getId();
if(StringUtils.equals(currentUser.getId(),projectTaskInventoryDetail.getUserId())){
designTaskStatus = projectTaskInventoryDetail.getStatus();
}else {
designTaskStatus = TaskStatusEnum.SHOW_FLAG.getValue();
//2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。
if((isEngineer || isEngineeringInterfacePerson)){
for (ProjectTaskInventoryDetailEO projectTaskInventoryDetail : projectTaskInventoryDetailEOList) {
if(StringUtils.equals(complianceResult.get("id").toString(),projectTaskInventoryDetail.getProjectTaskInventoryId())){
/**
* 查询数据权限,所有用户都是,自己的待办,可以跳转到处理任务详情页进行处理。
* 不是自己的待办,只能跳转到处理任务的详情页。
*/
if(StringUtils.equals(complianceResult.get("designInitiatorId").toString(),currentUser.getId())
|| StringUtils.equals(complianceResult.get("designDutyId").toString(),currentUser.getId())){
if(StringUtils.equals(projectTaskInventoryDetail.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue())){
designPid = projectTaskInventoryDetail.getActiProcInstId();
designTaskId = projectTaskInventoryDetail.getTaskId();
designTaskDefinitionKey = projectTaskInventoryDetail.getTaskDefinitionKey();
designTaskDetailId = projectTaskInventoryDetail.getId();
if(StringUtils.equals(currentUser.getId(),projectTaskInventoryDetail.getUserId())){
designTaskStatus = projectTaskInventoryDetail.getStatus();
}else {
designTaskStatus = TaskStatusEnum.SHOW_FLAG.getValue();
}
}
}
if(StringUtils.equals(complianceResult.get("prehomoInitiatorId").toString(),currentUser.getId())
|| StringUtils.equals(complianceResult.get("prehomoDutyId").toString(),currentUser.getId())){
if(StringUtils.equals(projectTaskInventoryDetail.getFlowType(),FlowTypeEnum.PREHOMOQRLC.getValue())){
prehomoPid = projectTaskInventoryDetail.getActiProcInstId();
prehomoTaskId = projectTaskInventoryDetail.getTaskId();
prehomoTaskDefinitionKey = projectTaskInventoryDetail.getTaskDefinitionKey();
prehomoTaskDetailId = projectTaskInventoryDetail.getId();
if(StringUtils.equals(currentUser.getId(),projectTaskInventoryDetail.getUserId())){
prehomoTaskStatus = projectTaskInventoryDetail.getStatus();
}else {
prehomoTaskStatus = TaskStatusEnum.SHOW_FLAG.getValue();
}
}
}
if(StringUtils.equals(complianceResult.get("verifyInitiatorId").toString(),currentUser.getId())
|| StringUtils.equals(complianceResult.get("verifyDutyId").toString(),currentUser.getId())){
if(StringUtils.equals(projectTaskInventoryDetail.getFlowType(),FlowTypeEnum.YZFHXSCLC.getValue())){
verifyPid = projectTaskInventoryDetail.getActiProcInstId();
verifyTaskId = projectTaskInventoryDetail.getTaskId();
verifyTaskDefinitionKey = projectTaskInventoryDetail.getTaskDefinitionKey();
verifyTaskDetailId = projectTaskInventoryDetail.getId();
if(StringUtils.equals(currentUser.getId(),projectTaskInventoryDetail.getUserId())){
verifyTaskStatus = projectTaskInventoryDetail.getStatus();
}else {
verifyTaskStatus = TaskStatusEnum.SHOW_FLAG.getValue();
}
}
}
}
if(StringUtils.equals(projectTaskInventoryDetail.getFlowType(),FlowTypeEnum.PREHOMOQRLC.getValue())){
prehomoPid = projectTaskInventoryDetail.getActiProcInstId();
prehomoTaskId = projectTaskInventoryDetail.getTaskId();
prehomoTaskDefinitionKey = projectTaskInventoryDetail.getTaskDefinitionKey();
prehomoTaskDetailId = projectTaskInventoryDetail.getId();
if(StringUtils.equals(currentUser.getId(),projectTaskInventoryDetail.getUserId())){
prehomoTaskStatus = projectTaskInventoryDetail.getStatus();
}else {
prehomoTaskStatus = TaskStatusEnum.SHOW_FLAG.getValue();
}
}else {
for (ProjectTaskInventoryDetailEO projectTaskInventoryDetail : projectTaskInventoryDetailEOList) {
if(StringUtils.equals(complianceResult.get("id").toString(),projectTaskInventoryDetail.getProjectTaskInventoryId())){
/**
* 查询数据权限,所有用户都是,自己的待办,可以跳转到处理任务详情页进行处理。
* 不是自己的待办,只能跳转到处理任务的详情页。
*/
if(StringUtils.equals(projectTaskInventoryDetail.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue())){
designPid = projectTaskInventoryDetail.getActiProcInstId();
designTaskId = projectTaskInventoryDetail.getTaskId();
designTaskDefinitionKey = projectTaskInventoryDetail.getTaskDefinitionKey();
designTaskDetailId = projectTaskInventoryDetail.getId();
if(StringUtils.equals(currentUser.getId(),projectTaskInventoryDetail.getUserId())){
designTaskStatus = projectTaskInventoryDetail.getStatus();
}else {
designTaskStatus = TaskStatusEnum.SHOW_FLAG.getValue();
}
}
}
if(StringUtils.equals(projectTaskInventoryDetail.getFlowType(),FlowTypeEnum.YZFHXSCLC.getValue())){
verifyPid = projectTaskInventoryDetail.getActiProcInstId();
verifyTaskId = projectTaskInventoryDetail.getTaskId();
verifyTaskDefinitionKey = projectTaskInventoryDetail.getTaskDefinitionKey();
verifyTaskDetailId = projectTaskInventoryDetail.getId();
if(StringUtils.equals(currentUser.getId(),projectTaskInventoryDetail.getUserId())){
verifyTaskStatus = projectTaskInventoryDetail.getStatus();
}else {
verifyTaskStatus = TaskStatusEnum.SHOW_FLAG.getValue();
if(StringUtils.equals(projectTaskInventoryDetail.getFlowType(),FlowTypeEnum.PREHOMOQRLC.getValue())){
prehomoPid = projectTaskInventoryDetail.getActiProcInstId();
prehomoTaskId = projectTaskInventoryDetail.getTaskId();
prehomoTaskDefinitionKey = projectTaskInventoryDetail.getTaskDefinitionKey();
prehomoTaskDetailId = projectTaskInventoryDetail.getId();
if(StringUtils.equals(currentUser.getId(),projectTaskInventoryDetail.getUserId())){
prehomoTaskStatus = projectTaskInventoryDetail.getStatus();
}else {
prehomoTaskStatus = TaskStatusEnum.SHOW_FLAG.getValue();
}
}
if(StringUtils.equals(projectTaskInventoryDetail.getFlowType(),FlowTypeEnum.YZFHXSCLC.getValue())){
verifyPid = projectTaskInventoryDetail.getActiProcInstId();
verifyTaskId = projectTaskInventoryDetail.getTaskId();
verifyTaskDefinitionKey = projectTaskInventoryDetail.getTaskDefinitionKey();
verifyTaskDetailId = projectTaskInventoryDetail.getId();
if(StringUtils.equals(currentUser.getId(),projectTaskInventoryDetail.getUserId())){
verifyTaskStatus = projectTaskInventoryDetail.getStatus();
}else {
verifyTaskStatus = TaskStatusEnum.SHOW_FLAG.getValue();
}
}
}
}
@@ -267,10 +359,35 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
}
}
public void disposeComplianceResult(List<Map<String,Object>> complianceResultList,String cut){
public void disposeComplianceResult(List<Map<String,Object>> complianceResultList,String cut,boolean isEngineer,boolean isEngineeringInterfacePerson){
if(CollectionUtils.isNotEmpty(complianceResultList)){
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<SysDictItem> dutyTerritoryDictItemList = sysDictItemService.selectItemsByDictCode("duty_territory");
for (Map<String, Object> complianceResult : complianceResultList) {
if(isEngineer || isEngineeringInterfacePerson){
if(!StringUtils.equals(complianceResult.get("designInitiatorId").toString(),currentUser.getId())
|| !StringUtils.equals(complianceResult.get("designDutyId").toString(),currentUser.getId())){
complianceResult.put("designStatus","");
complianceResult.put("designFlowTaskStatus","");
complianceResult.put("designPId","");
complianceResult.put("designPersonChargeFeedback","");
}
if(!StringUtils.equals(complianceResult.get("prehomoInitiatorId").toString(),currentUser.getId())
&& !StringUtils.equals(complianceResult.get("prehomoDutyId").toString(),currentUser.getId())){
complianceResult.put("prehomoStatus","");
complianceResult.put("prehomoFlowTaskStatus","");
complianceResult.put("prehomoPId","");
complianceResult.put("prehomoPersonChargeFeedback","");
}
if(!StringUtils.equals(complianceResult.get("verifyInitiatorId").toString(),currentUser.getId())
&& !StringUtils.equals(complianceResult.get("verifyDutyId").toString(),currentUser.getId())){
complianceResult.put("verifyStatus","");
complianceResult.put("verifyFlowTaskStatus","");
complianceResult.put("verifyPId","");
complianceResult.put("verifyPersonChargeFeedback","");
}
}
if (complianceResult.get("designStatus") != null) {
String textByValue = DesignComplianceStatusEnum.getTextByValue(complianceResult.get("designStatus").toString(), cut);
complianceResult.put("designStatus_dicText",textByValue);
@@ -342,6 +459,15 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
String condition = this.getConditionStr(params);
params.put("condition",StringUtils.isNotEmpty(condition) ? condition : "");
List<Map<String,Object>> exportData = new ArrayList<>();
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean isEngineer = this.sysUserService.isEngineer(currentUser);
boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser);
if(isEngineer || isEngineeringInterfacePerson){
params.put("currentUserId",currentUser.getId());
params.put("isEngineerOrEngineeringInterfacePerson",true);
}
if(StringUtils.equals(exportAll,"no")){
IPage page = this.queryPageList(params);
exportData = page.getRecords();
@@ -358,7 +484,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
List<Map<String,Object>> complianceResultList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(idList)){
complianceResultList = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
this.disposeComplianceResult(complianceResultList,cut);
this.disposeComplianceResult(complianceResultList,cut,isEngineer,isEngineeringInterfacePerson);
}
String title = "";
@@ -468,8 +594,18 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
@Override
public void exportComplianceResultDetail(HttpServletResponse response, HttpServletRequest request, Map<String, Object> params) {
String cut = (String) params.get("cut");
/**
* 2022-11-01 增加数据权限:如果当前登录用户,是工程师、工程接口人角色,只能查看到跟自己相关的数据。其余角色保留之前的查询结果。
*/
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean isEngineer = this.sysUserService.isEngineer(currentUser);
boolean isEngineeringInterfacePerson = this.sysUserService.isEngineeringInterfacePerson(currentUser);
if(isEngineer || isEngineeringInterfacePerson){
params.put("currentUserId",currentUser.getId());
params.put("isEngineerOrEngineeringInterfacePerson",true);
}
List<Map<String,Object>> exportData = this.lawsComplianceBoardMapper.queryComplianceResultList(params);
this.disposeComplianceResult(exportData,cut);
this.disposeComplianceResult(exportData,cut,isEngineer,isEngineeringInterfacePerson);
String title = "";
String fileName = "";
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
@@ -80,6 +80,11 @@ public class NcrTrackServiceImpl extends ServiceImpl<NcrTrackMapper, NcrTrackVO>
ncrTrackVO.setInconformity(ReviewResultEnum.INCONFORMITY.getValue());
ncrTrackVO.setTrack(ReviewResultEnum.TO_TRACK.getValue());
//如果当前登录用户是系统管理员角色,可以查看所有的数据
boolean administrator = this.sysUserService.isAdministrator();
ncrTrackVO.setAdministrator(administrator ? "true":"false");
List<NcrTrackVO> infoList = ncrTrackMapper.getInfoList(ncrTrackVO);
infoList = infoList.stream().distinct().collect(Collectors.toList());
List<NcrTrackVO> trackVOList = new ArrayList<>();
@@ -1,8 +1,8 @@
package com.jero.modules.project.service.impl;
import cn.hutool.core.lang.func.Func1;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.CutEnum;
@@ -11,9 +11,27 @@ import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.cert.collect.service.IParamsManifestEOService;
import com.jero.modules.enums.DictCodeEnum;
import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.*;
import com.jero.modules.project.mapper.*;
import com.jero.modules.project.entity.ConditionAssessmentEO;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLawsInventoryLogEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectLibraryRoleRelEO;
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
import com.jero.modules.project.entity.ProjectTaskInventoryEO;
import com.jero.modules.project.entity.ProjectTaskPlanning;
import com.jero.modules.project.enums.CertificationProgressEnum;
import com.jero.modules.project.enums.CurrentProjectStatusEnum;
import com.jero.modules.project.enums.DesignComplianceStatusEnum;
import com.jero.modules.project.enums.InventoryAffirmStatusEnum;
import com.jero.modules.project.enums.OperatorTypeEnum;
import com.jero.modules.project.enums.ProjectRoleEnum;
import com.jero.modules.project.enums.TaskAffirmStatusEnum;
import com.jero.modules.project.enums.TopEnum;
import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper;
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper;
import com.jero.modules.project.mapper.ProjectTaskInventoryEOMapper;
import com.jero.modules.project.service.IConditionAssessmentEOService;
import com.jero.modules.project.service.IProjectLibraryBaseService;
import com.jero.modules.project.service.IProjectLibraryRoleRelEOService;
@@ -26,13 +44,16 @@ import com.jero.modules.system.service.ISysDictService;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.system.util.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.shiro.SecurityUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
@@ -40,7 +61,15 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.text.ParseException;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
/**
@@ -131,8 +160,64 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
projectLibraryRoleRelEOService.add(projectLibraryRoleRelEO);
}
/**
* 项目扩展(添加子项目--子项目基本信息、相关人员名单、法规/认证任务计划与被扩展项目保持一致)
* @param projectLibraryBase
* @throws ParseException
*/
@Override
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public void addChild(ProjectLibraryBase projectLibraryBase) throws ParseException {
String id = projectLibraryBase.getId();//主项目id
String projectId = UUID.randomUUID().toString().replace("-", "");
//主表中添加数据
ProjectLibraryBase projectLibraryBaseTemp = this.getById(id);
projectLibraryBaseTemp.setId(projectId);
projectLibraryBaseTemp.setParentId(id);
projectLibraryBaseTemp.setProjectVersion(projectLibraryBase.getProjectVersion());
projectLibraryBaseTemp.setExplanation(projectLibraryBase.getExplanation());
this.save(projectLibraryBaseTemp);
/**检查车型名称id,年款号,目标市场同时存在,报错*/
//相关人员名单中添加数据
List<ProjectRelatedPersonnel> projectRelatedPersonnelList = projectRelatedPersonnelMapper.queryPageList(id,
DictCodeEnum.DUTY_TERRITORY.getValue(),
null,
null,
null,
null);
if(projectRelatedPersonnelList.size() != 0){
for (ProjectRelatedPersonnel projectRelatedPersonnel : projectRelatedPersonnelList) {
projectRelatedPersonnel.setId(UUID.randomUUID().toString().replace("-", ""));
projectRelatedPersonnel.setProjectId(projectId);
}
projectRelatedPersonnelService.saveBatch(projectRelatedPersonnelList);
}
//法规/认证任务计划添加数据 projectTaskPlanningService
LambdaQueryWrapper<ProjectTaskPlanning> wrapper = new LambdaQueryWrapper<>();
wrapper.in(ProjectTaskPlanning::getProjectId,projectLibraryBase.getId());
ProjectTaskPlanning projectTaskPlanning = projectTaskPlanningService.getOne(wrapper);
if(ObjectUtils.isNotEmpty(projectTaskPlanning)){
projectTaskPlanning.setId(UUID.randomUUID().toString().replace("-", ""));
projectTaskPlanning.setProjectId(projectId);
projectTaskPlanningService.add(projectTaskPlanning);
}
//初始化当前项目的studio与项目库 角色关系 projectLibraryRoleRelEOService
LambdaQueryWrapper<ProjectLibraryRoleRelEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(ProjectLibraryRoleRelEO::getProjectLibraryId,projectLibraryBase.getId());
ProjectLibraryRoleRelEO projectLibraryRoleRelEO = projectLibraryRoleRelEOService.getOne(queryWrapper);
if(ObjectUtils.isNotEmpty(projectLibraryRoleRelEO)){
projectLibraryRoleRelEO.setId(UUID.randomUUID().toString().replace("-", ""));
projectLibraryRoleRelEO.setProjectLibraryId(projectId);
projectLibraryRoleRelEOService.add(projectLibraryRoleRelEO);
}
}
/**检查车型名称id,年款号,目标市场,版本同时存在,报错*/
public void checkExitData(ProjectLibraryBase projectLibraryBase){
String projectNameId = projectLibraryBase.getProjectNameId();
String yearNameId = projectLibraryBase.getYearNameId();
@@ -140,7 +225,8 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
QueryWrapper<ProjectLibraryBase> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("project_name_id",projectNameId)
.eq("year_name_id",yearNameId)
.eq("target_market",targetMarket);
.eq("target_market",targetMarket)
.eq("project_version",targetMarket);
if(StringUtils.isNotBlank(projectLibraryBase.getId())){
queryWrapper.ne("id",projectLibraryBase.getId());
}
@@ -253,7 +339,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
public void checkData(String id, String cut) {
//判断该条项目是否是自己创建,如果不是则不能删除
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProjectLibraryBase> projectLibraryBases = this.queryById(id);
List<ProjectLibraryBase> projectLibraryBases = this.queryById(id,null);
if(!loginUser.getUsername().equals(projectLibraryBases.get(0).getCreateBy())){
if(CutEnum.CN.getValue().equals(cut)){
throw new JeroBootException("该条项目非本人创建,不能删除");
@@ -335,12 +421,32 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
* @return
*/
@Override
public List<ProjectLibraryBase> queryById(String id) {
public List<ProjectLibraryBase> queryById(String id,String cut) {
List<ProjectLibraryBase> records = projectLibraryBaseMapper.queryById(id);
disposeData(records,"",false);
//目标市场数据字典
List<DictModel> targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
for(ProjectLibraryBase projectLibraryBase: records){
//历史数据的主版本没有版本号,所以默认给00
if(StringUtils.isBlank(projectLibraryBase.getParentId()) && StringUtils.isBlank(projectLibraryBase.getProjectVersion())){
projectLibraryBase.setProjectVersion("00");
}
//目标市场
Map<String,Object> param = new HashMap<>();
param.put("cut",cut);
String targetMarket = getMarket(param, targetMarketList, projectLibraryBase);
//主项目的版本号
String projectVersion = "";
if(StringUtils.isBlank(projectLibraryBase.getParentId())){
projectVersion = "00";
}else{
projectVersion = projectLibraryBase.getProjectVersion();
}
if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){
projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + "-" + projectLibraryBase.getYearName());
projectLibraryBase.setProjectName(projectLibraryBase.getProjectName()
+ "-" + projectLibraryBase.getYearName()
+ "-" + targetMarket
+ "-" + projectVersion);
}
}
return records;
@@ -363,21 +469,293 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
* @return
*/
@Override
public IPage<ProjectLibraryBase> queryPageList(Map<String,Object> params) {
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
IPage page = new Page(pageNo, pageSize);
IPage<ProjectLibraryBase> result = projectLibraryBaseMapper.queryPageList(page, params);
List<ProjectLibraryBase> records = result.getRecords();
disposeData(records,"",false);
for(ProjectLibraryBase projectLibraryBase: records){
public List<ProjectLibraryBase> queryPageList(Map<String,Object> params) {
List<ProjectLibraryBase> result = projectLibraryBaseMapper.queryPageList(params);
disposeData(result,"",false);
//目标市场
List<DictModel> targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
for(ProjectLibraryBase projectLibraryBase: result){
//目标市场
String targetMarket = getMarket(params, targetMarketList, projectLibraryBase);
//主项目的版本号
String projectVersion = "";
if(StringUtils.isBlank(projectLibraryBase.getParentId())){
projectVersion = "00";
}else{
projectVersion = projectLibraryBase.getProjectVersion();
}
if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){
projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + "-" + projectLibraryBase.getYearName());
projectLibraryBase.setProjectName(projectLibraryBase.getProjectName()
+ "-" + projectLibraryBase.getYearName()
+ "-" + targetMarket
+ "-" + projectVersion);
}
}
return result;
//所有主项目
List<ProjectLibraryBase> projectLibraryBaseListParent = projectLibraryBaseMapper.queryMaimList();
disposeData(projectLibraryBaseListParent,"",false);
for(ProjectLibraryBase projectLibraryBase: projectLibraryBaseListParent){
//目标市场
String targetMarket = getMarket(params, targetMarketList, projectLibraryBase);
//主项目的版本号
String projectVersion = "";
if(StringUtils.isBlank(projectLibraryBase.getParentId())){
projectVersion = "00";
}else{
projectVersion = projectLibraryBase.getProjectVersion();
}
if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){
projectLibraryBase.setProjectName(projectLibraryBase.getProjectName()
+ "-" + projectLibraryBase.getYearName()
+ "-" + targetMarket
+ "-" + projectVersion);
}
}
//项目名称模糊查询特殊处理(因为项目名称是多字段拼接的)
if(ObjectUtils.isNotEmpty(params.get("projectName"))){
result = result.stream().filter(e->e.getProjectName().toLowerCase().contains(String.valueOf(params.get("projectName")).toLowerCase())).collect(Collectors.toList());
}
//处理搜索版本号,(因为列表展示数据是以主项目为主并绑定子项目, 所以搜索的时候只有子项目这种情况需要特殊处理)
List<ProjectLibraryBase> resultNew = getProjectLibraryBases(result, projectLibraryBaseListParent);
//数据组装
// List<ProjectLibraryBase> resultTemp = new LinkedList<>();
// for (ProjectLibraryBase projectLibraryBase : result) {
// if(StringUtils.isBlank(projectLibraryBase.getParentId())){
// resultTemp.add(projectLibraryBase);
// }
// }
for (ProjectLibraryBase projectLibraryBase : resultNew) {
//子项目
List<ProjectLibraryBase> children = result.stream()
.filter(e -> StringUtils.isNotBlank(e.getParentId()) && projectLibraryBase.getId().equals(e.getParentId())).collect(Collectors.toList());
if(children.size() != 0){
//子项目的基础上添加的子项目
List<String> childrenIdList = children.stream().map(ProjectLibraryBase::getId).distinct().collect(Collectors.toList());
List<ProjectLibraryBase> childrenList = result.stream()
.filter(e -> StringUtils.isNotBlank(e.getParentId()) && childrenIdList.contains(e.getParentId())).collect(Collectors.toList());
children.addAll(childrenList);
//按版本排序
Collections.sort(children);
projectLibraryBase.setChildren(children);
//最后一个版本号(主项目和主项目都需要设置)
String versionLast = children.get(children.size() - 1).getProjectVersion();
//主版本设置最后一个版本号(用于项目扩展中的版本号)
projectLibraryBase.setVersionLast(versionLast);
for (ProjectLibraryBase child : children) {
//每个子版本版本设置最后一个版本号(用于项目扩展中的版本号)
child.setVersionLast(versionLast);
}
}
}
return resultNew;
}
@NotNull
private List<ProjectLibraryBase> getProjectLibraryBases(List<ProjectLibraryBase> result, List<ProjectLibraryBase> projectLibraryBaseListParent) {
//result中的主项目以及子项目对应的主项目
List<ProjectLibraryBase> resultParent = new LinkedList<>();
for (ProjectLibraryBase projectLibraryBase : result) {
if(StringUtils.isBlank(projectLibraryBase.getParentId())){
resultParent.add(projectLibraryBase);
}else{
//子项目
List<ProjectLibraryBase> collect = result.stream()
.filter(e -> projectLibraryBase.getId().equals(e.getParentId()))
.collect(Collectors.toList());
if(ObjectUtils.isNotEmpty(collect)){
resultParent.addAll(collect);
}
}
}
//搜索结果中子项目的子项目
List<ProjectLibraryBase> resultChild = new ArrayList<>();
//所有子项目
List<ProjectLibraryBase> childrenListTemp = result.stream().filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList());
List<String> childrenIdListTemp = childrenListTemp.stream().map(ProjectLibraryBase::getId).collect(Collectors.toList());
//子项目的子项目
List<ProjectLibraryBase> collect3 = result.stream().filter(e -> StringUtils.isNotBlank(e.getParentId()) && childrenIdListTemp.contains(e.getParentId())).collect(Collectors.toList());
if(ObjectUtils.isNotEmpty(collect3)){
//子项目的子项目的父id
List<String> childList = collect3.stream().map(ProjectLibraryBase::getParentId).collect(Collectors.toList());
//子项目
resultChild = childrenListTemp.stream().filter(e -> childList.contains(e.getId())).collect(Collectors.toList());
}
//所有的主项目与通过筛选条件查询来的主项目进行过滤
List<ProjectLibraryBase> resultNew = new LinkedList<>();
//主项目
List<ProjectLibraryBase> collect1 = result.stream().filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList());
resultNew.addAll(collect1);
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseListParent) {
//子项目
List<ProjectLibraryBase> collect = result.stream().filter(e -> projectLibraryBase.getId().equals(e.getParentId())).collect(Collectors.toList());
if(ObjectUtils.isNotEmpty(collect)){
resultNew.add(projectLibraryBase);
}
//子项目的子项目
if(ObjectUtils.isNotEmpty(resultChild)){
List<ProjectLibraryBase> collect2 = resultChild.stream().filter(e -> e.getParentId().equals(projectLibraryBase.getId())).collect(Collectors.toList());
if(ObjectUtils.isNotEmpty(collect2)){
resultNew.add(projectLibraryBase);
}
}
}
resultNew = resultNew.stream().distinct().collect(Collectors.toList());
return resultNew;
}
// /**
// * 分页列表查询
// *
// * @return
// */
// @Override
// public List<ProjectLibraryBase> queryPageList(Map<String,Object> params) {
// List<ProjectLibraryBase> result = projectLibraryBaseMapper.queryPageList(params);
// disposeData(result,"",false);
// //目标市场
// List<DictModel> targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
//
// for(ProjectLibraryBase projectLibraryBase: result){
// //目标市场
// String targetMarket = getMarket(params, targetMarketList, projectLibraryBase);
// //主项目的版本号
// String projectVersion = "";
// if(StringUtils.isBlank(projectLibraryBase.getParentId())){
// projectVersion = "00";
// }else{
// projectVersion = projectLibraryBase.getProjectVersion();
// }
// if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){
// projectLibraryBase.setProjectName(projectLibraryBase.getProjectName()
// + "-" + projectLibraryBase.getYearName()
// + "-" + targetMarket
// + "-" + projectVersion);
// }
// }
// //项目名称模糊查询特殊处理(因为项目名称是多字段拼接的)
// if(ObjectUtils.isNotEmpty(params.get("projectName"))){
// result = result.stream().filter(e->e.getProjectName().toLowerCase().contains(String.valueOf(params.get("projectName")).toLowerCase())).collect(Collectors.toList());
// }
// //数据组装
// List<ProjectLibraryBase> resultTemp = new LinkedList<>();
// for (ProjectLibraryBase projectLibraryBase : result) {
// if(StringUtils.isBlank(projectLibraryBase.getParentId())){
// resultTemp.add(projectLibraryBase);
// }
// }
//
// for (ProjectLibraryBase projectLibraryBase : resultTemp) {
// //子项目
// List<ProjectLibraryBase> children = result.stream()
// .filter(e -> StringUtils.isNotBlank(e.getParentId()) && projectLibraryBase.getId().equals(e.getParentId())).collect(Collectors.toList());
// if(children.size() != 0){
// //子项目的基础上添加的子项目
// List<String> childrenIdList = children.stream().map(ProjectLibraryBase::getId).distinct().collect(Collectors.toList());
// List<ProjectLibraryBase> childrenList = result.stream()
// .filter(e -> StringUtils.isNotBlank(e.getParentId()) && childrenIdList.contains(e.getParentId())).collect(Collectors.toList());
// children.addAll(childrenList);
//
// //按版本排序
// Collections.sort(children);
// projectLibraryBase.setChildren(children);
// //最后一个版本号(主项目和主项目都需要设置)
// String versionLast = children.get(children.size() - 1).getProjectVersion();
// //主版本设置最后一个版本号(用于项目扩展中的版本号)
// projectLibraryBase.setVersionLast(versionLast);
// for (ProjectLibraryBase child : children) {
// //每个子版本版本设置最后一个版本号(用于项目扩展中的版本号)
// child.setVersionLast(versionLast);
// }
// }
// }
// return resultTemp;
// }
private String getMarket(Map<String, Object> params, List<DictModel> targetMarketList, ProjectLibraryBase projectLibraryBase) {
List<DictModel> dictModelList = new ArrayList<>();
for (String s : projectLibraryBase.getTargetMarket().split(",")) {
List<DictModel> dictModelListTemp = targetMarketList.stream()
.filter(e -> s.equals(e.getValue())).collect(Collectors.toList());
dictModelList.addAll(dictModelListTemp);
}
String targetMarket = "";
if(dictModelList.size() != 0){
StringBuilder sb = new StringBuilder();
for (DictModel dictModel : dictModelList) {
if(CutEnum.CN.getValue().equals(params.get("cut"))){
sb.append(dictModel.getText()+",");
}else{
sb.append(dictModel.getTextEn()+",");
}
}
if(StringUtils.isNotBlank(sb)){
targetMarket = sb.substring(0,sb.length()-1);
}
}
return targetMarket;
}
public Page getPages(Integer currentPage, Integer pageSize, List<ProjectLibraryBase> list){
Page page =new Page();
if(list==null){
return null;
}
int size = list.size();
if(pageSize > size){
pageSize = size;
}
if(pageSize!=0){
//求出最⼤页数,防⽌currentPage越界
int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1;
if(currentPage > maxPage){
currentPage = maxPage;
}
}
//当前页第⼀条数据的下标
int curIdx = currentPage >1?(currentPage -1)* pageSize :0;
List pageList =new ArrayList();
//将当前页的数据放进pageList
for(int i =0; i < pageSize && curIdx + i < size; i++){
pageList.add(list.get(curIdx + i));
}
page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList);
return page;
}
// /**
// * 分页列表查询
// *
// * @return
// */
// @Override
// public IPage<ProjectLibraryBase> queryPageList(Map<String,Object> params) {
// Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
// Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
// IPage page = new Page(pageNo, pageSize);
// IPage<ProjectLibraryBase> result = projectLibraryBaseMapper.queryPageList(page, params);
// List<ProjectLibraryBase> records = result.getRecords();
// disposeData(records,"",false);
// for(ProjectLibraryBase projectLibraryBase: records){
// if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){
// projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + "-" + projectLibraryBase.getYearName());
// }
// }
// return result;
// }
@Override
public void disposeData(List<ProjectLibraryBase> records,String cut,boolean disposeTargetMarketFlag) {
List<DictModel> targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
@@ -474,7 +852,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
result.put("taskToConfirmMap",taskToConfirmMap);
QueryWrapper<ProjectLawsInventoryEO> lawsInventoryEOQueryWrapper = new QueryWrapper<>();
lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,id);
lawsInventoryEOQueryWrapper.lambda().in(ProjectLawsInventoryEO::getProjectLibraryId,Arrays.asList(id.split(",")));
//lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getInventoryAffirmStatus, InventoryAffirmStatusEnum.ACCEPTED.getValue());
//lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getTaskAffirmStatus, TaskAffirmStatusEnum.ACCEPTED.getValue());
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(lawsInventoryEOQueryWrapper);
@@ -555,6 +933,117 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
return result;
}
// @Override
// public Map<String, Object> getProjectDetailsStatistics(String id) {
// Map<String,Object> result = new HashMap<>();
//
// //当前项目状态
// Map<String,Object> currentProjectStatusMap = new HashMap<>();
// //清单确认
// Map<String,Object> listingToConfirmMap = new HashMap<>();
// //任务确认
// Map<String,Object> taskToConfirmMap = new HashMap<>();
// //设计符合性
// Map<String,Object> designComplianceMap = new HashMap<>();
// //prehomo确认
// Map<String,Object> prehomoMap = new HashMap<>();
// //验证符合性
// Map<String,Object> verifyComplianceMap = new HashMap<>();
// //认证进度
// Map<String,Object> certificationProgressMap = new HashMap<>();
//
// //清单确认统计
// List<Map<String,Object>> listingToConfirmMapList = this.projectLawsInventoryEOMapper.getlistingToConfirmStatistics(id);
// listingToConfirmMap.put("listingToConfirmMapList",listingToConfirmMapList);
// result.put("listingToConfirmMap",listingToConfirmMap);
//
// //任务确认统计
// List<Map<String,Object>> taskToConfirmMapList = this.projectLawsInventoryEOMapper.getTaskToConfirmStatistics(id);
// taskToConfirmMap.put("taskToConfirmMapList",taskToConfirmMapList);
// result.put("taskToConfirmMap",taskToConfirmMap);
//
// QueryWrapper<ProjectLawsInventoryEO> lawsInventoryEOQueryWrapper = new QueryWrapper<>();
// lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,id);
// //lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getInventoryAffirmStatus, InventoryAffirmStatusEnum.ACCEPTED.getValue());
// //lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getTaskAffirmStatus, TaskAffirmStatusEnum.ACCEPTED.getValue());
// List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(lawsInventoryEOQueryWrapper);
// if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){
// List<String> projectLawsInventoryIdList = projectLawsInventoryEOList.stream().distinct().map(ProjectLawsInventoryEO::getId).collect(Collectors.toList());
//
// //当前项目状态统计 获取一个 最差的结果 统计的数据 就是studio看到的数据。
// List<Map<String,Object>> currentProjectStatusMapList = new ArrayList<>();
// CurrentProjectStatusEnum[] values = CurrentProjectStatusEnum.values();
// for (CurrentProjectStatusEnum value : values) {
// Map<String,Object> map = new HashMap<>();
// map.put("color",value.getValue());
// currentProjectStatusMapList.add(map);
// }
// int currentProjectStatusTotal;
// List<ConditionAssessmentEO> projectStatusAssessList = this.conditionAssessmentEOService.getProjectStatusAssessList(projectLawsInventoryIdList);
//
// for (Map<String, Object> map : currentProjectStatusMapList) {
// List<ConditionAssessmentEO> collect = projectStatusAssessList.stream().filter(
// projectStatusAssess -> StringUtils.equals(projectStatusAssess.getConditionAssessment(),map.get("color").toString())
// ).collect(Collectors.toList());
// map.put("conditionAssessmentCount",collect.size());
// }
//
// currentProjectStatusTotal = currentProjectStatusMapList.stream().filter(
// currentProjectStatus -> Integer.parseInt(currentProjectStatus.get("conditionAssessmentCount").toString()) != 0
// ).mapToInt(currentProjectStatus -> Integer.parseInt(currentProjectStatus.get("conditionAssessmentCount").toString())).sum();
//
// currentProjectStatusMap.put("currentProjectStatusMapList",currentProjectStatusMapList);
// currentProjectStatusMap.put("currentProjectStatusTotal",currentProjectStatusTotal);
// result.put("currentProjectStatusMap",currentProjectStatusMap);
//
// //设计符合性
// List<Map<String,Object>> designComplianceMapList = this.projectTaskInventoryEOMapper.getDesignComplianceStatistice(projectLawsInventoryIdList);
// designComplianceMap.put("designComplianceMapList",designComplianceMapList);
// result.put("designComplianceMap",designComplianceMap);
//
// //prehomo确认
// List<Map<String,Object>> prehomoMapList = this.projectTaskInventoryEOMapper.getPrehomoStatistice(projectLawsInventoryIdList);
// prehomoMap.put("prehomoMapList",prehomoMapList);
// result.put("prehomoMap",prehomoMap);
//
// //验证符合性
// List<Map<String,Object>> verifyComplianceMapList = this.projectTaskInventoryEOMapper.getVerifyComplianceStatistice(projectLawsInventoryIdList);
// verifyComplianceMap.put("verifyComplianceMapList",verifyComplianceMapList);
// result.put("verifyComplianceMap",verifyComplianceMap);
//
// //认证进度统计
// int certificationProgressTotal;
// List<Map<String,Object>> certificationProgressMapList = this.projectTaskInventoryEOMapper.getCertificationProgressStatistics(projectLawsInventoryIdList);
// certificationProgressTotal = certificationProgressMapList.stream().filter(
// certificationProgress -> Integer.parseInt(certificationProgress.get("certificationProgressCount").toString()) != 0
// ).mapToInt(certificationProgress -> Integer.parseInt(certificationProgress.get("certificationProgressCount").toString())).sum();
//
// CertificationProgressEnum[] CertificationProgressEnumValues = CertificationProgressEnum.values();
// for (CertificationProgressEnum certificationProgressEnumValue : CertificationProgressEnumValues) {
// boolean flag = true;
// for (Map<String, Object> map : certificationProgressMapList) {
// if(map.get("certificationProgress") != null){
// if(StringUtils.equals(certificationProgressEnumValue.getValue(),map.get("certificationProgress").toString())){
// flag = false;
// break;
// }
// }
// }
// if(flag){
// Map<String,Object> map = new HashMap<>();
// map.put("certificationProgress",certificationProgressEnumValue.getValue());
// map.put("certificationProgressCount",0);
// certificationProgressMapList.add(map);
// }
// }
//
// certificationProgressMap.put("certificationProgressTotal",certificationProgressTotal);
// certificationProgressMap.put("certificationProgressMapList",certificationProgressMapList);
// result.put("certificationProgressMap",certificationProgressMap);
// }
//
// return result;
// }
/**
* 项目详情-统计接口-根据领域分组
@@ -761,6 +1250,64 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
}
}
}
@Override
public void top(String id, String flag) {
ProjectLibraryBase projectLibraryBase = this.getById(id);
//置顶的时候将取消置顶标识传过来即:flag=1
if(TopEnum.TOP_CANCEL.getValue().equals(flag)){
//置顶
LambdaQueryWrapper<ProjectLibraryBase> wrapper = new LambdaQueryWrapper<>();
wrapper.isNotNull(ProjectLibraryBase::getSort).orderByDesc(ProjectLibraryBase::getSort);
List<ProjectLibraryBase> list = this.list(wrapper);
if(list.size() != 0){
String sort = list.get(list.size() - 1).getSort();
int sortTemp = Integer.valueOf(sort) + 1;
projectLibraryBase.setSort(String.valueOf(sortTemp));
}else{
//首个置顶的项目排序为1
projectLibraryBase.setSort("1");
}
projectLibraryBase.setFlag(TopEnum.TOP_CANCEL.getValue());
this.updateById(projectLibraryBase);
}else{
//取消置顶
LambdaUpdateWrapper<ProjectLibraryBase> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(ProjectLibraryBase::getId,id);
updateWrapper.set(ProjectLibraryBase::getSort,null).set(ProjectLibraryBase::getFlag,null);
this.update(projectLibraryBase,updateWrapper);
}
}
@Override
public List<String> getVersionsInfo(String id) {
LambdaUpdateWrapper<ProjectLibraryBase> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(ProjectLibraryBase::getId,id).or().in(ProjectLibraryBase::getParentId,id);
List<ProjectLibraryBase> list = this.list(wrapper);
List<String> result = new ArrayList<>();
if(list.size() != 0){
result = list.stream().map(ProjectLibraryBase::getProjectVersion).collect(Collectors.toList());
Collections.sort(result);
}
return result;
}
/**
* 版本统计
* @param id
* @return
*/
@Override
public List<ProjectLibraryBase> versionStatistics(String id) {
LambdaUpdateWrapper<ProjectLibraryBase> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(ProjectLibraryBase::getId,id).or().in(ProjectLibraryBase::getParentId,id);
List<ProjectLibraryBase> list = this.list(wrapper);
if(list.size() != 0){
Collections.sort(list);
}
return list;
}
}
@@ -14,9 +14,11 @@ import com.jero.common.util.RedisUtil;
import com.jero.common.util.TokenUtils;
import com.jero.modules.dummy.service.impl.DummyInventoryInfoEOServiceImpl;
import com.jero.modules.enums.DictCodeEnum;
import com.jero.modules.ocr.entity.User;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
import com.jero.modules.project.enums.ProjectInventoryFieldEnum;
import com.jero.modules.project.enums.ProjectRoleEnum;
import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper;
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
import com.jero.modules.system.entity.SysDictItem;
@@ -29,6 +31,7 @@ import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.util.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -854,7 +857,10 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
ProjectRelatedPersonnel projectRelatedPersonnel = new ProjectRelatedPersonnel();
//责任领域不能为空
String dutyTerritory = row.getCell(0).toString();
String dutyTerritory = "";
if(ObjectUtils.isNotEmpty(row.getCell(0))){
dutyTerritory = row.getCell(0).toString();
}
if(StringUtils.isNotBlank(dutyTerritory)) {
projectRelatedPersonnel.setDutyTerritory(row.getCell(0).toString());
}else{//责任领域不能为空,报错
@@ -967,6 +973,11 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
*/
@Override
public Result<?> oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut) {
//查询所有的用户
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
wrapper.select(SysUser::getUsername,SysUser::getId);
List<SysUser> userList = sysUserService.list(wrapper);
Result<?> result = new Result<>();
int row=3;
StringBuilder message = new StringBuilder();
@@ -1021,15 +1032,18 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
List<String> lawEngineerNameList = Arrays.asList(projectRelatedPersonnel.getLawEngineerName().split(","));
if (CollectionUtils.isNotEmpty(lawEngineerNameList) && StringUtils.isNotBlank(lawEngineerNameList.get(0))) {
lawEngineerNameList = lawEngineerNameList.stream().distinct().collect(Collectors.toList());
lawEngineerUsers=sysUserService.queryUserIdListByNameList(lawEngineerNameList);
if(lawEngineerUsers.size()!=lawEngineerNameList.size()){
//中英切换提示语
if(CutEnum.CN.getValue().equals(cut)) {
message.append("导入的法规工程师姓名有误,请检查第" + row + "行");
}else{
message.append("The imported law engineer is wrong.Please check line " + row );
}
}
//验证导入的相关人员
lawEngineerUsers = personnelMatch(userList, lawEngineerNameList, message, ProjectRoleEnum.REGULATI_ENGINEER.getValue(), cut, row);
// lawEngineerUsers=sysUserService.queryUserIdListByNameList(lawEngineerNameList);
// if(lawEngineerUsers.size()!=lawEngineerNameList.size()){
// //中英切换提示语
// if(CutEnum.CN.getValue().equals(cut)) {
// message.append("导入的法规工程师姓名有误,请检查第" + row + "行");
// }else{
// message.append("The imported law engineer is wrong.Please check line " + row );
// }
// }
}
if(CollectionUtils.isNotEmpty(lawEngineerUsers)) {
@@ -1055,15 +1069,18 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
List<String> engineeringInterfacePersonNameList = Arrays.asList(projectRelatedPersonnel.getEngineeringInterfacePersonName().split(","));
if (CollectionUtils.isNotEmpty(engineeringInterfacePersonNameList) && StringUtils.isNotBlank(engineeringInterfacePersonNameList.get(0))) {
engineeringInterfacePersonNameList = engineeringInterfacePersonNameList.stream().distinct().collect(Collectors.toList());
engineeringInterfacePersonUsers=sysUserService.queryUserIdListByNameList(engineeringInterfacePersonNameList);
if(engineeringInterfacePersonUsers.size()!=engineeringInterfacePersonNameList.size()){
//中英切换提示语
if(CutEnum.CN.getValue().equals(cut)) {
message.append("导入的工程接口人姓名有误,请检查第" + row + "行");
}else{
message.append("The imported engineering interface person is wrong.Please check line " + row );
}
}
//验证导入的相关人员
engineeringInterfacePersonUsers = personnelMatch(userList, engineeringInterfacePersonNameList, message, ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue(), cut, row);
// engineeringInterfacePersonUsers=sysUserService.queryUserIdListByNameList(engineeringInterfacePersonNameList);
// if(engineeringInterfacePersonUsers.size()!=engineeringInterfacePersonNameList.size()){
// //中英切换提示语
// if(CutEnum.CN.getValue().equals(cut)) {
// message.append("导入的工程接口人姓名有误,请检查第" + row + "行");
// }else{
// message.append("The imported engineering interface person is wrong.Please check line " + row );
// }
// }
}
if(CollectionUtils.isNotEmpty(engineeringInterfacePersonUsers)) {
@@ -1090,8 +1107,13 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
//校验是否为项目基础表设定的认证工程师
List<ProjectRelatedPersonnel> baseCertificationEngineerList = queryCertificationEngineer(projectId);
List<String> baseCertificationEngineerNameList = baseCertificationEngineerList.stream().map(e -> e.getCertificationEngineerName()).collect(Collectors.toList());
//转为小写后在判断
List<String> baseCertificationEngineerNameListTemp = new ArrayList<>();
for (String s : baseCertificationEngineerNameList) {
baseCertificationEngineerNameListTemp.add(s.toLowerCase());
}
for(String certificationEngineerName : certificationEngineerNameList){
if(!baseCertificationEngineerNameList.contains(certificationEngineerName)){
if(!baseCertificationEngineerNameListTemp.contains(certificationEngineerName.toLowerCase())){
//中英切换提示语
if(CutEnum.CN.getValue().equals(cut)) {
message.append("导入的认证工程师姓名不属于该项目,请检查第" + row + "行");
@@ -1101,18 +1123,32 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
break;
}
}
// for(String certificationEngineerName : certificationEngineerNameList){
// if(!baseCertificationEngineerNameList.contains(certificationEngineerName.toLowerCase())){
// //中英切换提示语
// if(CutEnum.CN.getValue().equals(cut)) {
// message.append("导入的认证工程师姓名不属于该项目,请检查第" + row + "行");
// }else {
// message.append("The imported certified engineer name does not belong to this project..Please check line " + row );
// }
// break;
// }
// }
if (CollectionUtils.isNotEmpty(certificationEngineerNameList) && StringUtils.isNotBlank(certificationEngineerNameList.get(0))) {
certificationEngineerNameList = certificationEngineerNameList.stream().distinct().collect(Collectors.toList());
certificationEngineerUsers=sysUserService.queryUserIdListByNameList(certificationEngineerNameList);
if(certificationEngineerUsers.size()!=certificationEngineerNameList.size()){
//中英切换提示语
if(CutEnum.CN.getValue().equals(cut)) {
message.append("导入的认证工程师姓名有误,请检查第" + row + "行");
}else {
message.append("The imported certification engineer is wrong.Please check line " + row );
}
}
//验证导入的相关人员
certificationEngineerUsers = personnelMatch(userList, certificationEngineerNameList, message, ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue(), cut, row);
// certificationEngineerUsers=sysUserService.queryUserIdListByNameList(certificationEngineerNameList);
// if(certificationEngineerUsers.size()!=certificationEngineerNameList.size()){
// //中英切换提示语
// if(CutEnum.CN.getValue().equals(cut)) {
// message.append("导入的认证工程师姓名有误,请检查第" + row + "行");
// }else {
// message.append("The imported certification engineer is wrong.Please check line " + row );
// }
// }
}
if(CollectionUtils.isNotEmpty(certificationEngineerUsers)) {
@@ -1156,6 +1192,66 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
return result;
}
/**
* 验证导入的相关人员
* @param userList 所有的用户
* @param personnelList 相关人员(法规工程师,认证工程师,工程接口人)
* @param message 异常信息拼接
* @param personnelType 人员类型
* @param cut 中英文切换
* @param row 行数
*/
public List<SysUser> personnelMatch(List<SysUser> userList,
List<String> personnelList,
StringBuilder message,
String personnelType,
String cut,
int row){
int count = 0;
//全部转为小写来匹配
List<SysUser> sysUserList = new ArrayList<>();
for (String personnel : personnelList) {
String personnelLower = personnel.toLowerCase();
for (SysUser sysUser : userList) {
String username = sysUser.getUsername();
String usernameLower = username.toLowerCase();
if(personnelLower.equals(usernameLower)){
sysUserList.add(sysUser);
count ++;
}
}
}
if(personnelList.size() != count){
//法规工程师异常提示语
if(ProjectRoleEnum.REGULATI_ENGINEER.getValue().equals(personnelType)){
if(CutEnum.CN.getValue().equals(cut)) {
message.append("导入的工程接口人姓名有误,请检查第" + row + "行");
}else{
message.append("The imported engineering interface person is wrong.Please check line " + row );
}
}
//认证工程师异常提示语
if(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue().equals(personnelType)){
if(CutEnum.CN.getValue().equals(cut)) {
message.append("导入的认证工程师姓名有误,请检查第" + row + "行");
}else {
message.append("The imported certification engineer is wrong.Please check line " + row );
}
}
//工程接口人异常提示语
if(ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue().equals(personnelType)){
if(CutEnum.CN.getValue().equals(cut)) {
message.append("导入的工程接口人姓名有误,请检查第" + row + "行");
}else{
message.append("The imported engineering interface person is wrong.Please check line " + row );
}
}
}else{
return sysUserList;
}
return new ArrayList<>();
}
@Override
public ProjectRelatedPersonnel queryByProjectIdAndDutyTerritory(String projectId, String dutyTerritory) {
LambdaQueryWrapper<ProjectRelatedPersonnel> queryWrapper = new LambdaQueryWrapper<>();
@@ -7,9 +7,15 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.Result;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.JumpLinkEnum;
@@ -32,6 +38,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -71,6 +79,11 @@ public class ProjectTaskInventoryDetailEOServiceImpl extends ServiceImpl<Project
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
@Autowired
private IFeishuService feishuService;
/**
* 保存
*
@@ -341,61 +354,113 @@ public class ProjectTaskInventoryDetailEOServiceImpl extends ServiceImpl<Project
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
String id = UUID.randomUUID().toString().replace("-", "");
//String id = UUID.randomUUID().toString().replace("-", "");
MessageTypeEnum messageTypeEnum = null;
String msgContentEN = "";
//MessageTypeEnum messageTypeEnum = null;
//String msgContentEN = "";
String msgTitle = "";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
String cnContentUpper = "";//中文上部分
String cnContentLower = "";//中文下部分
String enContentUpper = "";//英文上部分
String enContentLower = "";//英文下部分
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
//法规中英文
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//给工程师下发消息
if(org.apache.commons.lang3.StringUtils.equals(projectTaskInventoryDetailEO.getMsgType(), MsgTypeEnum.DESIGN_ISSUE_DRE_MSG.getValue())){
//XXX has distributed the design compliance confirmation process of GB 7258 in XXX (project name) to you. Please check and handle it in time.
msgContentEN = currentUser.getUsername() + " has assigned the design compliance confirmation process of "
+ projectLawsInventoryEO.getSerialNumber() + " in "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " to you. Please check and handle it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a design compliance task to complete";
//msgContentEN = currentUser.getUsername() + " has assigned the design compliance confirmation process of "
// + projectLawsInventoryEO.getSerialNumber() + " in "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " to you. Please check and handle it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a design compliance task to complete";
feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has assigned the task to you. Please check and handle it in time.");
feishuMsgVo.setTaskType("Design Compliance Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has assigned the task to you. Please check and handle it in time.");
//feishuMsgVo.setTaskType("Design Compliance Confirmation");
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ currentUser.getUsername() +"向您分发了该任务,请及时查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getDesignDueDate());
enContentUpper = "Hello! "+ currentUser.getUsername() +" has assigned the task to you. Please check and address the task in a timely manner.";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getDesignDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(org.apache.commons.lang3.StringUtils.equals(projectTaskInventoryDetailEO.getMsgType(), MsgTypeEnum.PREHOMO_ISSUE_DRE_MSG.getValue())){
//XXX has distributed the Pre-Homo confirmation process of GB 7258 in XXX (project name) to you. Please check and handle it in time.
msgContentEN = currentUser.getUsername() + " has assigned the Pre-Homo confirmation process of "
+ projectLawsInventoryEO.getSerialNumber() + " in "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " to you. Please check and handle it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//msgContentEN = currentUser.getUsername() + " has assigned the Pre-Homo confirmation process of "
// + projectLawsInventoryEO.getSerialNumber() + " in "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " to you. Please check and handle it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has assigned the task to you. Please check and handle it in time.");
feishuMsgVo.setTaskType("Pre-Homo Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has assigned the task to you. Please check and handle it in time.");
//feishuMsgVo.setTaskType("Pre-Homo Confirmation");
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ currentUser.getUsername() +"向您分发了该任务,请及时查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate());
enContentUpper = "Hello! "+ currentUser.getUsername() +" has assigned the task to you. Please check and address the task in a timely manner.";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(org.apache.commons.lang3.StringUtils.equals(projectTaskInventoryDetailEO.getMsgType(), MsgTypeEnum.VERIFY_ISSUE_DRE_MSG.getValue())){
//XXX has distributed the Verify compliance confirmation process of GB 7258 in XXX (project name) to you. Please check and handle it in time.
msgContentEN = currentUser.getUsername() + " has assigned the validation compliance confirmation process of "
+ projectLawsInventoryEO.getSerialNumber() + " in "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " to you. Please check and handle it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete";
//msgContentEN = currentUser.getUsername() + " has assigned the validation compliance confirmation process of "
// + projectLawsInventoryEO.getSerialNumber() + " in "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " to you. Please check and handle it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a validation compliance task to complete";
feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has assigned the task to you. Please check and handle it in time.");
feishuMsgVo.setTaskType("Validation Compliance Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has assigned the task to you. Please check and handle it in time.");
//feishuMsgVo.setTaskType("Validation Compliance Confirmation");
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ currentUser.getUsername() +"向您分发了该任务,请及时查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! "+ currentUser.getUsername() +" has assigned the task to you. Please check and address the task in a timely manner.";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
}
if(CollectionUtils.isNotEmpty(userIdList) && org.apache.commons.lang3.StringUtils.isNotEmpty(msgContentEN)){
if(CollectionUtils.isNotEmpty(userIdList) && org.apache.commons.lang3.StringUtils.isNotEmpty(msgTitle)){
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink()
@@ -403,17 +468,36 @@ public class ProjectTaskInventoryDetailEOServiceImpl extends ServiceImpl<Project
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,id,sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,id,sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
userIdList = userIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
}
@@ -6,10 +6,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.Result;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.*;
@@ -24,6 +30,7 @@ import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.entity.SysUserRole;
import com.jero.modules.system.mapper.SysUserMapper;
import com.jero.modules.system.service.ISysUserRoleService;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.wkflow.enums.DesignComplianceNodeEnum;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
@@ -91,6 +98,12 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IFeishuService feishuService;
/**
* 保存
@@ -380,58 +393,116 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
String dreUserIds = jsonObject.getString("dreUserIds"); //dre用户id
userIdList.addAll(Arrays.asList(dreUserIds.split(",")));
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
String msgContentEN = "";
//String msgContentEN = "";
String msgTitle = "";
MessageTypeEnum messageTypeEnum = null;
//MessageTypeEnum messageTypeEnum = null;
String cnContentUpper = "";//中文上部分
String cnContentLower = "";//中文下部分
String enContentUpper = "";//英文上部分
String enContentLower = "";//英文下部分
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
//法规中英文
QueryWrapper<ProjectLawsInventoryEO> projectLawsInventoryEOQueryWrapper = new QueryWrapper<>();
projectLawsInventoryEOQueryWrapper.eq("project_library_id", projectLibraryId).eq("serial_number", serialNumber);
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectOne(projectLawsInventoryEOQueryWrapper);
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(StringUtils.equals(msgType,MsgTypeEnum.DESIGN_REMIND_MSG.getValue())){
//Please check and deal with the design compliance confirmation process of GB 7258 in XXX (project name) in time.
msgContentEN = "Please check and deal with the design compliance confirmation process of "
+ serialNumber + " in "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a design compliance task to complete";
//msgContentEN = "Please check and deal with the design compliance confirmation process of "
// + serialNumber + " in "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a design compliance task to complete";
feishuMsgVo.setContent("Hello! Please address the task ASAP. ");
feishuMsgVo.setTaskType("Design Compliance Confirmation");
feishuMsgVo.setRegulationNo(serialNumber);
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setContent("Hello! Please address the task ASAP. ");
//feishuMsgVo.setTaskType("Design Compliance Confirmation");
//feishuMsgVo.setRegulationNo(serialNumber);
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ currentUser.getUsername() +"向您分发了该任务,请尽快查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getDesignDueDate());
enContentUpper = "Hello! "+ currentUser.getUsername() +" has assigned the task to you. Please check and address the task ASAP";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getDesignDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(StringUtils.equals(msgType,MsgTypeEnum.PREHOMO_REMIND_MSG.getValue())){
//Please check and deal with the Pre-Homo confirmation process of GB 7258 in XXX (project name) in time.
msgContentEN = "Please check and address the Pre-Homo confirmation process of "
+ serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//msgContentEN = "Please check and address the Pre-Homo confirmation process of "
// + serialNumber + " in "+ projectNameInfoEO.getProjectName()
// + " in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
feishuMsgVo.setContent("Hello! Please address the task ASAP. ");
feishuMsgVo.setTaskType("Pre-Homo Confirmation");
feishuMsgVo.setRegulationNo(serialNumber);
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setContent("Hello! Please address the task ASAP. ");
//feishuMsgVo.setTaskType("Pre-Homo Confirmation");
//feishuMsgVo.setRegulationNo(serialNumber);
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ currentUser.getUsername() +"向您分发了该任务,请尽快查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate());
enContentUpper = "Hello! "+ currentUser.getUsername() +" has assigned the task to you. Please check and address the task ASAP";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(StringUtils.equals(msgType,MsgTypeEnum.VERIFY_REMIND_MSG.getValue())){
//Please check and deal with the Verify compliance confirmation process of GB 7258 in XXX (project name) in time.
msgContentEN = "Please check and address the validation compliance confirmation process of "
+ serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete";
//msgContentEN = "Please check and address the validation compliance confirmation process of "
// + serialNumber + " in "+ projectNameInfoEO.getProjectName()
// + " in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a validation compliance task to complete";
feishuMsgVo.setContent("Hello! Please address the task ASAP. ");
feishuMsgVo.setTaskType("Validation Compliance Confirmation");
feishuMsgVo.setRegulationNo(serialNumber);
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setContent("Hello! Please address the task ASAP. ");
//feishuMsgVo.setTaskType("Validation Compliance Confirmation");
//feishuMsgVo.setRegulationNo(serialNumber);
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ currentUser.getUsername() +"向您分发了该任务,请尽快查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! "+ currentUser.getUsername() +" has assigned the task to you. Please check and address the task ASAP";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
}
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgContentEN)){
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgTitle)){
//飞书跳转链接
String hrefFeishu = backUrl
@@ -441,20 +512,40 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
userIdList = userIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
return new Result<>().success("提醒办理成功!");
}
@@ -918,7 +1009,7 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
String personChargeFeedback = "";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dutDateStr = "";
@@ -926,90 +1017,138 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
String msgContentEN = "";
String msgTitle = "";
String cnContentUpper = "";//中文上部分
String cnContentLower = "";//中文下部分
String enContentUpper = "";//英文上部分
String enContentLower = "";//英文下部分
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
if (StringUtils.equals(msgType, MsgTypeEnum.DESIGN_ISSUE_DRE_MSG.getValue())) {
taskKey = DesignComplianceNodeEnum.DRE_DISPOSE.getKey();
//taskKey = DesignComplianceNodeEnum.DRE_DISPOSE.getKey();
if(projectLawsInventoryEO.getDesignDueDate() != null){
dutDateStr = sdf.format(projectLawsInventoryEO.getDesignDueDate());
}
msgContentEN = sysUser.getUsername() + "has assigned the design compliance confirmation process of " + serialNumber + " in "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " to you. Please check and handle it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a design compliance task to complete";
feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has assigned the task to you. Please check and handle it in time.");
feishuMsgVo.setTaskType("Design Compliance Confirmation");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//msgContentEN = sysUser.getUsername() + "has assigned the design compliance confirmation process of " + serialNumber + " in "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " to you. Please check and handle it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a design compliance task to complete";
//feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has assigned the task to you. Please check and handle it in time.");
//feishuMsgVo.setTaskType("Design Compliance Confirmation");
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(StringUtils.equals(msgType, MsgTypeEnum.DESIGN_RETURN_MSG.getValue())){
String designDutyId = jsonObject.getString("designDutyId");//设计符合性流程责任人id
userIdList.add(designDutyId);
taskKey = DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey();
//taskKey = DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey();
if(projectLawsInventoryEO.getDesignDueDate() != null){
dutDateStr = sdf.format(projectLawsInventoryEO.getDesignDueDate());
}
msgTitle = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,该任务被发起人审查退回,请及时查看处理";
cnContentLower = "项目: " + PRN +
"\n法规: " + LAW_CN +
"\n发起人: " + sysUser.getUsername() +
"\n截止时间: " + dutDateStr;
enContentUpper = "Hello! The task has been rejected by initiator after review. Please check and address it in a timely manner";
enContentLower = "Project: " + PRN +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + sysUser.getUsername() +
"\nDue Date: " + dutDateStr;
//msgContentEN = "The design compliance information of " + serialNumber + " in "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " you sumitted has been rejected after review. Please check and address it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a design compliance task to complete";
msgContentEN = "The design compliance information of " + serialNumber + " in "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " you sumitted has been rejected after review. Please check and address it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a design compliance task to complete";
//feishuMsgVo.setContent("Hello! The compliance information you submitted has been rejected after review. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Design Compliance Confirmation");
feishuMsgVo.setContent("Hello! The compliance information you submitted has been rejected after review. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Design Compliance Confirmation");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_RETURN_MSG.getValue())){
String prehomoDutyId = jsonObject.getString("prehomoDutyId");//prehomo流程责任人id
userIdList.add(prehomoDutyId);
taskKey = DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey();
//taskKey = DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey();
if(projectLawsInventoryEO.getPrehomoDueDate() != null){
dutDateStr = sdf.format(projectLawsInventoryEO.getPrehomoDueDate());
}
msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn();
cnContentUpper = "您好,该任务被发起人审查退回,请及时查看处理";
cnContentLower = "项目: " + PRN +
"\n法规: " + LAW_CN +
"\n发起人: " + sysUser.getUsername() +
"\n截止时间: " + dutDateStr;
enContentUpper = "Hello! The task has been rejected by initiator after review. Please check and address it in a timely manner";
enContentLower = "Project: " + PRN +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + sysUser.getUsername() +
"\nDue Date: " + dutDateStr;
msgContentEN = "The Pre-Homo confirmation of " + serialNumber + " in "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " you sumitted has been rejected after review. Please check and address it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//msgContentEN = "The Pre-Homo confirmation of " + serialNumber + " in "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " you sumitted has been rejected after review. Please check and address it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
feishuMsgVo.setContent("Hello! The compliance information you submitted has been rejected after review. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Pre-Homo Confirmation");
//feishuMsgVo.setContent("Hello! The compliance information you submitted has been rejected after review. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Pre-Homo Confirmation");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(StringUtils.equals(msgType, MsgTypeEnum.VERIFY_RETURN_MSG.getValue())){
String verifyDutyId = jsonObject.getString("verifyDutyId");//验证符合性流程责任人id
userIdList.add(verifyDutyId);
taskKey = DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey();
//taskKey = DesignComplianceNodeEnum.THE_RESPONSIBLE_PERSON_HANDLES_THE_TASK.getKey();
if(projectLawsInventoryEO.getVerifyDueDate() != null){
dutDateStr = sdf.format(projectLawsInventoryEO.getVerifyDueDate());
}
msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,该任务被发起人审查退回,请及时查看处理";
cnContentLower = "项目: " + PRN +
"\n法规: " + LAW_CN +
"\n发起人: " + sysUser.getUsername() +
"\n截止时间: " + dutDateStr;
enContentUpper = "Hello! The task has been rejected by initiator after review. Please check and address it in a timely manner";
enContentLower = "Project: " + PRN +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + sysUser.getUsername() +
"\nDue Date: " + dutDateStr;
//msgContentEN = "The validation compliance information of " + serialNumber + " in "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " you sumitted has been rejected after review. Please check and address it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a validation compliance task to complete";
msgContentEN = "The validation compliance information of " + serialNumber + " in "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " you sumitted has been rejected after review. Please check and address it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete";
//feishuMsgVo.setContent("Hello! The compliance information you submitted has been rejected after review. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Validation Compliance Confirmation");
feishuMsgVo.setContent("Hello! The compliance information you submitted has been rejected after review. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Validation Compliance Confirmation");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}
/*55360问题。
feishuMsgVo.setDueDate(dutDateStr);
feishuMsgVo.setInitiator(sysUser.getUsername());
*/
feishuMsgVo.setRegulationNo(serialNumber);
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setRegulationNo(serialNumber);
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
/*//根据流程实例id,查询待办id
@@ -1065,7 +1204,7 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
personChargeFeedback = projectTaskInventoryEO.getVerifyPersonChargeFeedback();
}*/
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgContentEN)){
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgTitle)){
//飞书跳转链接
String hrefFeishu = backUrl
@@ -1075,13 +1214,32 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ projectLibraryBase.getTargetMarket();
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
//String href = "<a href='"
// + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
//飞书跳转链接 拼接跳转至任务详情页参数
/*String hrefFeishu = backUrl
@@ -1133,13 +1291,13 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
+ "&primaryKeyId=" + primaryKeyId
+ "&PersonChargeFeedback=" + personChargeFeedback
+ "'>" + " View details" + "</a>";*/
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,id,sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,id,sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
}
@@ -1,8 +1,14 @@
package com.jero.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.FeedBackHistoryDataStatusEnum;
@@ -24,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -63,6 +70,12 @@ public class ProjectTaskInventoryFeedbackEOServiceImpl extends ServiceImpl<Proje
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
@Autowired
private IFeishuService feishuService;
/**
* 保存
*
@@ -150,56 +163,108 @@ public class ProjectTaskInventoryFeedbackEOServiceImpl extends ServiceImpl<Proje
ProjectYearNameInfoEO projectYearNameInfoEO = this.projectYearNameInfoEOService.getOne(projectYearInfoEOQueryWrapper);
// 飞书消息封装
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has replied to your engineering deliverable information. Please check and address it in a timely manner.");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket());
//feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has replied to your engineering deliverable information. Please check and address it in a timely manner.");
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket());
MessageTypeEnum messageTypeEnum = null;
//MessageTypeEnum messageTypeEnum = null;
//消息内容
String msgContentEN = "";
//String msgContentEN = "";
String msgTitle = "";
String initiatorId = "";
//String initiatorId = "";
String cnContentUpper = "";//中文上部分
String cnContentLower = "";//中文下部分
String enContentUpper = "";//英文上部分
String enContentLower = "";//英文下部分
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBaseInfo.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBaseInfo.getProjectVersion())) ? "00" : projectLibraryBaseInfo.getProjectVersion();
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBaseInfo.getTargetMarket() + "-" + projectVersion;
//法规中英文
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
String flowType = projectTaskInventoryFeedbackEO.getFlowType();
if(StringUtils.equals(flowType,FlowTypeEnum.SJFHXSHLC.getValue())){
msgContentEN = currentUser.getUsername() + " has replied to your engineering deliverable information of "
+ projectLawsInventoryEO.getSerialNumber() + " in "
+ projectNameInfoEO.getProjectName() + " for design compliance confirmation. Please check and address it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
+ ": You have a design compliance task to complete";
//msgContentEN = currentUser.getUsername() + " has replied to your engineering deliverable information of "
// + projectLawsInventoryEO.getSerialNumber() + " in "
// + projectNameInfoEO.getProjectName() + " for design compliance confirmation. Please check and address it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
// + ": You have a design compliance task to complete";
feishuMsgVo.setTaskType("Design Compliance Confirmation");
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getDesignDueDate()));
initiatorId = projectLawsInventoryEO.getDesignInitiatorId();
//feishuMsgVo.setTaskType("Design Compliance Confirmation");
//feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getDesignDueDate()));
//initiatorId = projectLawsInventoryEO.getDesignInitiatorId();
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ currentUser.getUsername() +"回复了您提交的工程交付信息,请及时查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getDesignDueDate());
enContentUpper = "Hello! "+ currentUser.getUsername() +" has replied to your engineering deliverable information. Please check and address the task in a timely manner";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getDesignDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(StringUtils.equals(flowType,FlowTypeEnum.PREHOMOQRLC.getValue())){
msgContentEN = currentUser.getUsername() + " has replied to your engineering deliverable information of "
+ projectLawsInventoryEO.getSerialNumber() + " in "
+ projectNameInfoEO.getProjectName() + " for Pre-Homo compliance confirmation. Please check and address it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//msgContentEN = currentUser.getUsername() + " has replied to your engineering deliverable information of "
// + projectLawsInventoryEO.getSerialNumber() + " in "
// + projectNameInfoEO.getProjectName() + " for Pre-Homo compliance confirmation. Please check and address it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
feishuMsgVo.setTaskType("Pre-Homo Confirmation");
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getPrehomoDueDate()));
initiatorId = projectLawsInventoryEO.getPrehomoInitiatorId();
//feishuMsgVo.setTaskType("Pre-Homo Confirmation");
//feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getPrehomoDueDate()));
//initiatorId = projectLawsInventoryEO.getPrehomoInitiatorId();
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ currentUser.getUsername() +"回复了您提交的工程交付信息,请及时查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate());
enContentUpper = "Hello! "+ currentUser.getUsername() +" has replied to your engineering deliverable information. Please check and address the task in a timely manner";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(StringUtils.equals(flowType,FlowTypeEnum.YZFHXSCLC.getValue())){
msgContentEN = currentUser.getUsername() + " has replied to your engineering deliverable information of "
+ projectLawsInventoryEO.getSerialNumber() + " in "
+ projectNameInfoEO.getProjectName() + " for validation compliance confirmation. Please check and address it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
+ ": You have a validation compliance task to complete";
//msgContentEN = currentUser.getUsername() + " has replied to your engineering deliverable information of "
// + projectLawsInventoryEO.getSerialNumber() + " in "
// + projectNameInfoEO.getProjectName() + " for validation compliance confirmation. Please check and address it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
// + ": You have a validation compliance task to complete";
feishuMsgVo.setTaskType("Validation Compliance Confirmation");
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getVerifyDueDate()));
initiatorId = projectLawsInventoryEO.getVerifyInitiatorId();
//feishuMsgVo.setTaskType("Validation Compliance Confirmation");
//feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getVerifyDueDate()));
//initiatorId = projectLawsInventoryEO.getVerifyInitiatorId();
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ currentUser.getUsername() +"回复了您提交的工程交付信息,请及时查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! "+ currentUser.getUsername() +" has replied to your engineering deliverable information. Please check and address the task in a timely manner";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}
//飞书跳转链接
@@ -209,28 +274,47 @@ public class ProjectTaskInventoryFeedbackEOServiceImpl extends ServiceImpl<Proje
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBaseInfo.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBaseInfo.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBaseInfo.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
String initiator = "";
if(StringUtils.isNotEmpty(initiatorId)){
QueryWrapper<SysUser> queryOneWrapper = new QueryWrapper<>();
queryOneWrapper.lambda().eq(SysUser::getId,initiatorId);
SysUser sysUser = this.sysUserService.getBaseMapper().selectOne(queryOneWrapper);
initiator = sysUser.getUsername();
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
feishuMsgVo.setInitiator(initiator);
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//系统内部跳转链接
//String href = "<a href='"
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBaseInfo.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBaseInfo.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//String initiator = "";
//if(StringUtils.isNotEmpty(initiatorId)){
// QueryWrapper<SysUser> queryOneWrapper = new QueryWrapper<>();
// queryOneWrapper.lambda().eq(SysUser::getId,initiatorId);
// SysUser sysUser = this.sysUserService.getBaseMapper().selectOne(queryOneWrapper);
// initiator = sysUser.getUsername();
//}
//feishuMsgVo.setInitiator(initiator);
//发送消息
SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryBaseInfo.getId(),sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryBaseInfo.getId(),sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
}
}
@@ -286,6 +370,9 @@ public class ProjectTaskInventoryFeedbackEOServiceImpl extends ServiceImpl<Proje
List<ProjectTaskInventoryFeedbackEO> projectTaskInventoryFeedbackEOS = this.baseMapper.selectList(queryWrapper);
if(CollectionUtils.isNotEmpty(projectTaskInventoryFeedbackEOS)){
List<String> idList = projectTaskInventoryFeedbackEOS.stream().distinct().map(ProjectTaskInventoryFeedbackEO::getProjectTaskInventoryId).collect(Collectors.toList());
List<String> userNameList = projectTaskInventoryFeedbackEOS.stream().distinct().map(ProjectTaskInventoryFeedbackEO::getCreateBy).collect(Collectors.toList());
List<SysUser> userList = this.sysUserService.queryUserIdListByNameList(userNameList);
QueryWrapper<ProjectTaskInventoryDetailEO> inventoryDetailEOQueryWrapper = new QueryWrapper<>();
inventoryDetailEOQueryWrapper.lambda().in(ProjectTaskInventoryDetailEO::getId,idList);
List<ProjectTaskInventoryDetailEO> projectTaskInventoryDetailEOList = projectTaskInventoryDetailEOMapper.selectList(inventoryDetailEOQueryWrapper);
@@ -302,6 +389,18 @@ public class ProjectTaskInventoryFeedbackEOServiceImpl extends ServiceImpl<Proje
if(CollectionUtils.isNotEmpty(projectTaskInventoryDetailList)){
projectTaskInventoryFeedbackEO.setStatus(projectTaskInventoryDetailList.get(0).getStatus());
}
if(CollectionUtils.isNotEmpty(userList)){
List<SysUser> userListTemp = userList.stream().filter(user -> {
boolean flag = false;
if(StringUtils.equals(projectTaskInventoryFeedbackEO.getCreateBy(),user.getUsername())){
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(userListTemp)){
projectTaskInventoryFeedbackEO.setUserId(userListTemp.get(0).getId());
}
}
}
}
return projectTaskInventoryFeedbackEOS;
@@ -372,11 +471,11 @@ public class ProjectTaskInventoryFeedbackEOServiceImpl extends ServiceImpl<Proje
}
// 飞书消息封装
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has submitted the engineering deliverable information. Please check and address it in a timely manner.");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket());
//feishuMsgVo.setContent("Hello! " + currentUser.getUsername() + " has submitted the engineering deliverable information. Please check and address it in a timely manner.");
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket());
String initiator = "";
if (StringUtils.isNotEmpty(initiatorId)) {
@@ -385,48 +484,99 @@ public class ProjectTaskInventoryFeedbackEOServiceImpl extends ServiceImpl<Proje
SysUser sysUser = this.sysUserService.getBaseMapper().selectOne(queryOneWrapper);
initiator = sysUser.getUsername();
}
feishuMsgVo.setInitiator(initiator);
//feishuMsgVo.setInitiator(initiator);
MessageTypeEnum messageTypeEnum = null;
//MessageTypeEnum messageTypeEnum = null;
//消息内容
String msgContentEN = "";
//String msgContentEN = "";
String msgTitle = "";
String cnContentUpper = "";//中文上部分
String cnContentLower = "";//中文下部分
String enContentUpper = "";//英文上部分
String enContentLower = "";//英文下部分
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBaseInfo.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBaseInfo.getProjectVersion())) ? "00" : projectLibraryBaseInfo.getProjectVersion();
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBaseInfo.getTargetMarket() + "-" + projectVersion;
//法规中英文
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
String flowType = projectTaskInventoryFeedbackEO.getFlowType();
if(StringUtils.equals(flowType,FlowTypeEnum.SJFHXSHLC.getValue())){
msgContentEN = currentUser.getUsername() + " has submitted the engineering deliverable information of "
+ projectLawsInventoryEO.getSerialNumber() + " in "
+ projectNameInfoEO.getProjectName() + "for design compliance confirmation. Please check and address it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
+ ": You have a design compliance task to complete";
//msgContentEN = currentUser.getUsername() + " has submitted the engineering deliverable information of "
// + projectLawsInventoryEO.getSerialNumber() + " in "
// + projectNameInfoEO.getProjectName() + "for design compliance confirmation. Please check and address it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
// + ": You have a design compliance task to complete";
feishuMsgVo.setTaskType("Design Compliance Confirmation");
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getDesignDueDate()));
//feishuMsgVo.setTaskType("Design Compliance Confirmation");
//feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getDesignDueDate()));
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.DESIGN_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ initiator +"向您提交了工程交付信息,请及时查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getDesignDueDate());
enContentUpper = "Hello! "+ initiator +" has submitted the engineering deliverable information to you. Please check and address the task in a timely manner";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getDesignDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(StringUtils.equals(flowType,FlowTypeEnum.PREHOMOQRLC.getValue())){
msgContentEN = currentUser.getUsername() + " has submitted the engineering deliverable information of "
+ projectLawsInventoryEO.getSerialNumber() + " in "
+ projectNameInfoEO.getProjectName() + " for Pre-Homo confirmation. Please check and address it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//msgContentEN = currentUser.getUsername() + " has submitted the engineering deliverable information of "
// + projectLawsInventoryEO.getSerialNumber() + " in "
// + projectNameInfoEO.getProjectName() + " for Pre-Homo confirmation. Please check and address it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
feishuMsgVo.setTaskType("Pre-Homo Confirmation");
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getPrehomoDueDate()));
//feishuMsgVo.setTaskType("Pre-Homo Confirmation");
//feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getPrehomoDueDate()));
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ initiator +"向您提交了工程交付信息,请及时查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate());
enContentUpper = "Hello! "+ initiator +" has submitted the engineering deliverable information to you. Please check and address the task in a timely manner";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}else if(StringUtils.equals(flowType,FlowTypeEnum.YZFHXSCLC.getValue())){
msgContentEN = currentUser.getUsername() + " has submitted the engineering deliverable information of "
+ projectLawsInventoryEO.getSerialNumber() + " in "
+ projectNameInfoEO.getProjectName() + " for validation compliance confirmation. Please check and address it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
+ ": You have a validation compliance task to complete";
//msgContentEN = currentUser.getUsername() + " has submitted the engineering deliverable information of "
// + projectLawsInventoryEO.getSerialNumber() + " in "
// + projectNameInfoEO.getProjectName() + " for validation compliance confirmation. Please check and address it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBaseInfo.getTargetMarket()
// + ": You have a validation compliance task to complete";
feishuMsgVo.setTaskType("Validation Compliance Confirmation");
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getVerifyDueDate()));
//feishuMsgVo.setTaskType("Validation Compliance Confirmation");
//feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getVerifyDueDate()));
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ initiator +"向您提交了工程交付信息,请及时查看处理";
cnContentLower = "项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! "+ initiator +" has submitted the engineering deliverable information to you. Please check and address the task in a timely manner";
enContentLower = "Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
}
//飞书跳转链接
@@ -436,20 +586,39 @@ public class ProjectTaskInventoryFeedbackEOServiceImpl extends ServiceImpl<Proje
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBaseInfo.getTargetMarket();
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBaseInfo.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBaseInfo.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBaseInfo.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBaseInfo.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryBaseInfo.getId(),sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//SendMessageUtils.sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryBaseInfo.getId(),sendMessageMap, feishuMsgVo, messageTypeEnum,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
}
}
@@ -189,7 +189,7 @@ public class WordUtil {
Drawing drawing = factory.createDrawing();
drawing.getAnchorOrInline().add(inline);
run.getContent().add(drawing);
replaceTextToImage(bm, text, wordMLPackage, bytes);
replaceTextToImage(bm, "\\$\\{" + key + "\\}", text, wordMLPackage, bytes);
}
}
} catch (Exception var17) {
@@ -218,7 +218,7 @@ public class WordUtil {
byte[] bytes = (byte[]) picMap.get("bytes");
for(Text bm : textList) {
if (bm.getValue().equals("${" + key + "}")) {
if (bm.getValue().contains("${" + key + "}")) {
BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes);
Inline inline = imagePart.createImageInline("", "", 0, 1, true);
ObjectFactory factory = new ObjectFactory();
@@ -226,7 +226,7 @@ public class WordUtil {
Drawing drawing = factory.createDrawing();
drawing.getAnchorOrInline().add(inline);
run.getContent().add(drawing);
replaceTextToImage(bm, text, wordMLPackage, bytes);
replaceTextToImage(bm, "\\$\\{" + key + "\\}", text, wordMLPackage, bytes);
}
}
}
@@ -387,7 +387,7 @@ public class WordUtil {
* @throws Exception
* @author liyawei
*/
public static void replaceTextToImage(Text bm, Object object, WordprocessingMLPackage wordMLPackage , byte[] bytes) throws Exception {
public static void replaceTextToImage(Text bm, String key, Object object, WordprocessingMLPackage wordMLPackage , byte[] bytes) throws Exception {
if (wordMLPackage == null) {
return;
}
@@ -423,16 +423,49 @@ public class WordUtil {
BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes);
Inline inline = imagePart.createImageInline("", "", 0, 1, true);
ObjectFactory factory = Context.getWmlObjectFactory();
R run = factory.createR();
// R run = factory.createR();
Drawing drawing = factory.createDrawing();
if(text != null){
Text txt = factory.createText();
txt.setValue(text);
run.getContent().add(txt);
for(int j=0;j<r.getContent().size();j++) {
r.getContent().remove(j);
}
run.getContent().add(drawing);
drawing.getAnchorOrInline().add(inline);
theList.add(rangeStart, run); // 添加图片到原占位符位置
String values = bm.getValue().replaceAll(key,"#");
int length = values.length();
String[] valueStr = new String[length];
for(int v=0; v<length; v++) {
valueStr[v] = values.charAt(v) + "";
}
int index = 0;
for(int k=0;k<valueStr.length;k++){
if(valueStr[k].equals("#")){
if(k>0 && !valueStr[k-1].equals("#")) {
Text txt = factory.createText();
txt.setValue(values.substring(index, k));
r.getContent().add(txt);
}
if (text != null) {
Text txtp = factory.createText();
txtp.setValue(text);
r.getContent().add(txtp);
}
r.getContent().add(drawing);
drawing.getAnchorOrInline().add(inline);
index = k + 1;
}
}
if(!values.endsWith("#")) {
Text txt = factory.createText();
txt.setValue(values.substring(index));
r.getContent().add(txt);
}
theList.add(rangeStart, r); // 添加图片到原占位符位置
} else {
return;
@@ -137,8 +137,8 @@ public class NcrTrackVO implements Serializable {
private String projectTaskInventoryDetailId;
//任务节点定义key
private String taskDefinitionKey;
//是否是系统管理员角色
private String administrator;
@@ -0,0 +1,15 @@
package com.jero.modules.project.vo;
import lombok.Data;
@Data
public class ProjectTaskUrgVo {
private String cut;
private String projectLawsInventoryIds;
private String type;
}
@@ -1,6 +1,7 @@
package com.jero.modules.report.controller;
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;
@@ -62,9 +63,29 @@ public class LawsMonthlyReportWriteEOController extends JeroController<LawsMonth
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
IPage<LawsMonthlyReportWriteEO> pageList = lawsMonthlyReportWriteEOService.getPageInfo(lawsMonthlyReportWriteEO, pageNo,pageSize,req);
return Result.OK(pageList);
List<LawsMonthlyReportWriteEO> listInfo = lawsMonthlyReportWriteEOService.getListInfo(lawsMonthlyReportWriteEO, pageNo, pageSize, req);
Page pages = lawsMonthlyReportWriteEOService.getPages(pageNo, pageSize, listInfo);
return Result.OK(pages);
}
// /**
// * 分页列表查询
// *
// * @param lawsMonthlyReportWriteEO
// * @param pageNo
// * @param pageSize
// * @param req
// * @return
// */
// @AutoLog(value = "月报填写-分页列表查询")
// @ApiOperation(value="月报填写-分页列表查询", notes="月报填写-分页列表查询")
// @GetMapping(value = "/page")
// public Result<?> queryPageList(LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO,
// @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
// @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
// HttpServletRequest req) {
// IPage<LawsMonthlyReportWriteEO> pageList = lawsMonthlyReportWriteEOService.getPageInfo(lawsMonthlyReportWriteEO, pageNo,pageSize,req);
// return Result.OK(pageList);
// }
/**
* 列表查询
@@ -13,7 +13,6 @@ import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -29,7 +28,7 @@ import java.util.List;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="laws_monthly_report_title_template对象", description="月报标题模板")
public class LawsMonthlyReportTitleTemplateEO implements Serializable {
public class LawsMonthlyReportTitleTemplateEO implements Comparable<LawsMonthlyReportTitleTemplateEO> {
private static final long serialVersionUID = 1L;
/**主键*/
@@ -84,4 +83,10 @@ public class LawsMonthlyReportTitleTemplateEO implements Serializable {
@TableField(exist = false)
private String key;
@Override
public int compareTo(LawsMonthlyReportTitleTemplateEO o) {
return this.sort-o.sort;//升序
// return o.id-this.id;//降序
}
}
@@ -116,13 +116,13 @@ public class LawsMonthlyReportWriteEO implements Serializable {
/**适用范围*/
@Excel(name = "适用范围", width = 15)
@ApiModelProperty(value = "适用范围")
@Dict(dicCode ="apply_scope")
@Dict(dicCode ="fa3_gui1_yue4_bao4_-_shi4_yong4_fan4_wei2")
private java.lang.String applyScope;
/**状态*/
@Excel(name = "状态", width = 15)
@ApiModelProperty(value = "状态")
@Dict(dicCode = "state")
@Dict(dicCode = "fa3_gui1_yue4_bao4_tian2_xie3_-_-_zhuang4_tai4")
private java.lang.String state;
/**用法*/
@@ -8,8 +8,9 @@ package com.jero.modules.report.enums;
*/
public enum DictCodeReportEnum {
APPLYCAR("适用车型","car_type"),
APPLYSCOPE("适用范围","apply_scope"),
APPLYSCOPE("适用范围","fa3_gui1_yue4_bao4_-_shi4_yong4_fan4_wei2"),
STATE("状态","state"),
STATE_REPORT("状态","fa3_gui1_yue4_bao4_tian2_xie3_-_-_zhuang4_tai4"),
USEMETHOD("用法","yong4_fa3");
@@ -7,8 +7,8 @@ package com.jero.modules.report.enums;
* @auth zhn
*/
public enum ExportStateEnum {
NOT_EXPORT("未导出","Not export","1"),
HAS_BEEN_EXPORT("已导出","Has been export","2");
NOT_EXPORT("未导出","Not exported","1"),
HAS_BEEN_EXPORT("已导出","Exported","2");
String name;
@@ -1,6 +1,7 @@
package com.jero.modules.report.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.report.entity.LawsMonthlyReportWriteEO;
@@ -72,7 +73,11 @@ public interface ILawsMonthlyReportWriteEOService extends IService<LawsMonthlyRe
* @param req
* @return
*/
IPage<LawsMonthlyReportWriteEO> getPageInfo(LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO,
// IPage<LawsMonthlyReportWriteEO> getPageInfo(LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO,
// Integer pageNo,
// Integer pageSize,
// HttpServletRequest req);
List<LawsMonthlyReportWriteEO> getListInfo(LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO,
Integer pageNo,
Integer pageSize,
HttpServletRequest req);
@@ -82,4 +87,6 @@ public interface ILawsMonthlyReportWriteEOService extends IService<LawsMonthlyRe
LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO);
IPage queryPageDocument(Map<String, Object> parameter);
Page getPages(Integer currentPage, Integer pageSize, List<LawsMonthlyReportWriteEO> list);
}
@@ -60,8 +60,10 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -288,23 +290,60 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
}
@Override
public IPage<LawsMonthlyReportWriteEO> getPageInfo(LawsMonthlyReportWriteEO lawsMonthlyReportWriteEOTemp,
public List<LawsMonthlyReportWriteEO> getListInfo(LawsMonthlyReportWriteEO lawsMonthlyReportWriteEOTemp,
Integer pageNo,
Integer pageSize,
HttpServletRequest req) {
QueryWrapper<LawsMonthlyReportWriteEO> queryWrapper = QueryGenerator.initQueryWrapper(lawsMonthlyReportWriteEOTemp, req.getParameterMap());
queryWrapper.orderByDesc("memories_chapter_one","memories_chapter","create_time");
//新需求月报填写不设置去权限, 所有的人都可以查看--------------------------------------------------------------------------------------
//管理员查看全部数据,其余人只能查看自己的数据
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> rolesList = sysBaseApi.getRolesByUsername(currentUser.getUsername());
if(!rolesList.contains(ProjectRoleEnum.ADMIN.getCode())){
queryWrapper.in("create_by",currentUser.getUsername());
// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// List<String> rolesList = sysBaseApi.getRolesByUsername(currentUser.getUsername());
// if(!rolesList.contains(ProjectRoleEnum.ADMIN.getCode())){
// queryWrapper.in("create_by",currentUser.getUsername());
// }
//-------------------------------------------------------------------------------------
//所有的月报
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOList = this.list(queryWrapper);
//所有月报的一级目录
List<String> oneMenuIdLIst = lawsMonthlyReportWriteEOList.stream().map(LawsMonthlyReportWriteEO::getMemoriesChapterOne).distinct().collect(Collectors.toList());
//月报标题模板
LambdaQueryWrapper<LawsMonthlyReportTitleTemplateEO> wrapperTemp = new LambdaQueryWrapper<>();
wrapperTemp.orderByAsc(LawsMonthlyReportTitleTemplateEO::getSort);
List<LawsMonthlyReportTitleTemplateEO> list = lawsMonthlyReportTitleTemplateEOService.list(wrapperTemp);
//1. 一级目录
List<LawsMonthlyReportTitleTemplateEO> oneList = list.stream().filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList());
oneList = oneList.stream().filter(e -> oneMenuIdLIst.contains(e.getId())).collect(Collectors.toList());
Collections.sort(oneList);//正序排序
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS = new LinkedList<>();
for (LawsMonthlyReportTitleTemplateEO lawsMonthlyReportTitleTemplateEO : oneList) {
String oneId = lawsMonthlyReportTitleTemplateEO.getId();
//一级目录下的二级目录
List<LawsMonthlyReportTitleTemplateEO> twoList = list.stream().filter(e -> StringUtils.isNotBlank(e.getParentId()) && oneId.equals(e.getParentId())).collect(Collectors.toList());
Collections.sort(twoList);//正序排序
//一级目录下的月报
for (LawsMonthlyReportTitleTemplateEO monthlyReportTitleTemplateEO : twoList) {
for (LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO : lawsMonthlyReportWriteEOList) {
if(oneId.equals(lawsMonthlyReportWriteEO.getMemoriesChapterOne()) && monthlyReportTitleTemplateEO.getId().equals(lawsMonthlyReportWriteEO.getMemoriesChapter())){
lawsMonthlyReportWriteEOS.add(lawsMonthlyReportWriteEO);
}
}
}
// List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOListOne = lawsMonthlyReportWriteEOList.stream()
// .filter(e -> oneId.equals(e.getMemoriesChapterOne())).collect(Collectors.toList());
// lawsMonthlyReportWriteEOS.addAll(lawsMonthlyReportWriteEOListOne);
}
Page<LawsMonthlyReportWriteEO> page = new Page<LawsMonthlyReportWriteEO>(pageNo, pageSize);
Page<LawsMonthlyReportWriteEO> pageInfo = this.page(page, queryWrapper);
//法规月报id
List<String> lawsMonthlyReportIdList = pageInfo.getRecords().stream().map(LawsMonthlyReportWriteEO::getId).collect(Collectors.toList());
List<String> userIdList = pageInfo.getRecords().stream().map(LawsMonthlyReportWriteEO::getLawsContact).collect(Collectors.toList());
List<String> lawsMonthlyReportIdList = lawsMonthlyReportWriteEOS.stream().map(LawsMonthlyReportWriteEO::getId).collect(Collectors.toList());
List<String> userIdList = lawsMonthlyReportWriteEOS.stream().map(LawsMonthlyReportWriteEO::getLawsContact).collect(Collectors.toList());
List<String> userIds = new ArrayList<>();
for (String s : userIdList) {
if(StringUtils.isNotBlank(s)){
@@ -343,7 +382,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
}
for (LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO : pageInfo.getRecords()) {
for (LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO : lawsMonthlyReportWriteEOS) {
//处理法规联系人
lawsContact(userList, lawsMonthlyReportWriteEO,lawsMonthlyReportWriteEOTemp.getCut());
//处理章节目录
@@ -398,7 +437,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
}
}
}
return pageInfo;
return lawsMonthlyReportWriteEOS;
}
private void lawsContact(List<LoginUser> userList, LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO,String cut) {
@@ -436,12 +475,14 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
if(StringUtils.isNotBlank(lawsMonthlyReportWriteEO.getIds())){
wrapper.in(LawsMonthlyReportWriteEO::getId,Arrays.asList(lawsMonthlyReportWriteEO.getIds().split(",")));
}
//新需求月报填写不设置权限----------------------------------------------------------------------------------------
//管理员查看全部数据,其余人只能查看自己的数据
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> rolesList = sysBaseApi.getRolesByUsername(currentUser.getUsername());
if(!rolesList.contains(ProjectRoleEnum.ADMIN.getCode())){
wrapper.in(LawsMonthlyReportWriteEO::getCreateBy,currentUser.getUsername());
}
// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// List<String> rolesList = sysBaseApi.getRolesByUsername(currentUser.getUsername());
// if(!rolesList.contains(ProjectRoleEnum.ADMIN.getCode())){
// wrapper.in(LawsMonthlyReportWriteEO::getCreateBy,currentUser.getUsername());
// }
//----------------------------------------------------------------------------------------
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS = this.list(wrapper);
if(lawsMonthlyReportWriteEOS.size() == 0){
@@ -570,10 +611,11 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
/**
*创建word文件
*
* @param path
* @param lawsMonthlyReportWriteEOS 列表数据
* @param lawsMonthlyReportTitleTemplateEOS 章节目录
* @param lawsMonthlyReportWriteEOS 所有月报
* @param lawsMonthlyReportTitleTemplateEOS 二级目录(没有排序)
* @param loginUserList
*/
private void createWord(String path,
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
@@ -722,7 +764,15 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
// }
/**
*
* @param lawsMonthlyReportWriteEOS 月报
* @param lawsMonthlyReportTitleTemplateEOS 二级目录(参数传过来时没有排序)
* @param reportTitleOneList 一级目录(参数传过来时已经进行正序排序)
* @param titleCN
* @param document
* @param cut
*/
private void word(List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS,
List<LawsMonthlyReportTitleTemplateEO> reportTitleOneList,
@@ -739,9 +789,9 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
//标题
WordUtil.exportWord(document, titleCN, null, ParagraphAlignment.CENTER, 0, 14,
false, false, "Blue Sky Noto Regular",null,null,null);
//主要内容
WordUtil.exportWord(document, content, null, ParagraphAlignment.LEFT, 0, 12,
false, true, "Blue Sky Noto Regular",null,null,null);
//主要内容(新需求中去掉此行)
// WordUtil.exportWord(document, content, null, ParagraphAlignment.LEFT, 0, 12,
// false, true, "Blue Sky Noto Regular",null,null,null);
//生成页脚
WordUtil.exportHeardAndFootMain(document,moth);
int oneCount = 1;
@@ -758,12 +808,13 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
}
if(StringUtils.isNotBlank(oneTitle)){
WordUtil.exportWord(document, oneNumber+" "+oneTitle, null, ParagraphAlignment.LEFT,
0, 12, false, true, "Blue Sky Noto Regular","0","一级标题",null);
0, 11, false, true, "Blue Sky Noto Regular","0","一级标题",null);
oneCount++;
}
List<LawsMonthlyReportTitleTemplateEO> reportTitleTwoList = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> e.getParentId().equals(lawsMonthlyReportTitleTemplateEO.getId())).collect(Collectors.toList());
//二级目录按sort正序排序
Collections.sort(reportTitleTwoList);//正序排序
for (LawsMonthlyReportTitleTemplateEO monthlyReportTitleTemplateEO : reportTitleTwoList) {
int reportCount = 1;
@@ -781,7 +832,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
}
if(StringUtils.isNotBlank(twoTitle)){
WordUtil.exportWord(document, twoNumber+" "+twoTitle, null, ParagraphAlignment.LEFT,
2, 12, false, true, "Blue Sky Noto Regular","1","二级标题",null);
6, 11, false, true, "Blue Sky Noto Regular","1","二级标题",null);
twoCount++;
}
@@ -795,7 +846,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
}
if(org.apache.commons.lang3.StringUtils.isNotBlank(reportTitle)){
WordUtil.exportWord(document, reportCount+". "+reportTitle, null, ParagraphAlignment.LEFT,
4, 12, false, false, "Blue Sky Noto Regular","2","三级标题",null);
12, 11, false, false, "Blue Sky Noto Regular","2","三级标题",null);
reportCount++;
}
}
@@ -873,38 +924,221 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
}
}
//封面
//封面(office版本)
private void coverCn(List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
String titleCN,
XWPFDocument document) {
//封面标识
String flag = "cover";
String moth = lawsMonthlyReportWriteEOS.get(0).getMonth().replaceAll("-", "年") + "月";
//标题前面添加一个换行
WordUtil.exportWord(document, "", null, ParagraphAlignment.CENTER, 0, null,
false, false, "Blue Sky Noto Regular",null,null,"break");
titleCN = "\r\n\r\n" + titleCN + "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
//添加标题
WordUtil.exportWord(document, titleCN, null, ParagraphAlignment.CENTER, 0, 18,
false, false, "Blue Sky Noto Regular",null,null,flag);
WordUtil.exportWord(document, moth+"\r\n", null, ParagraphAlignment.CENTER, 0, 12,
false, true, "Blue Sky Noto Regular",null,null,flag);
//标题下面添加9个换行
for (int i = 0; i < 9; i++) {
WordUtil.exportWord(document, "", null, ParagraphAlignment.CENTER, 0, null,
false, false, "Blue Sky Noto Regular",null,null,"break");
}
WordUtil.exportWord(document, moth, null, ParagraphAlignment.CENTER, 0, 12,
false, false, "Blue Sky Noto Regular",null,null,flag);
String year = lawsMonthlyReportWriteEOS.get(0).getMonth().split("-")[0];
String mothNew = lawsMonthlyReportWriteEOS.get(0).getMonth().split("-")[1];
int mothLast = Integer.valueOf(mothNew) - 1;
//添加说明 2022/7/15 至 2022/8/14 期间发布的主要内容
String text = year + "/" + mothLast +"/15 至 "+year+"/"+mothNew+"/14期间发布的主要内容";
WordUtil.exportWord(document, text, null, ParagraphAlignment.CENTER, 0, 11,
false, false, "Blue Sky Noto Regular",null,null,flag);
//添加换行
WordUtil.exportWord(document, "\r\n", null, ParagraphAlignment.CENTER, 0, null,
false, false, null,null,null,flag);
//添加说明 编辑: 整车工程 - 法规与认证&环保与材料科团队
String text1 = "编辑: 整车工程 - 法规与认证&环保与材料科团队";
WordUtil.exportWord(document, text1, null, ParagraphAlignment.CENTER, 0, 11,
false, false, "Blue Sky Noto Regular",null,null,flag);
//添加下一页
document.createParagraph().createRun().addBreak(BreakType.PAGE);
}
//封面
//封面(WPS版本)
// private void coverCn(List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
// String titleCN,
// XWPFDocument document) {
// //封面标识
// String flag = "cover";
// String moth = lawsMonthlyReportWriteEOS.get(0).getMonth().replaceAll("-", "年") + "月";
//
// titleCN = "\r\n\r\n" + titleCN + "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
// WordUtil.exportWord(document, titleCN, null, ParagraphAlignment.CENTER, 0, 18,
// false, false, "Blue Sky Noto Regular",null,null,flag);
// WordUtil.exportWord(document, moth, null, ParagraphAlignment.CENTER, 0, 12,
// false, false, "Blue Sky Noto Regular",null,null,flag);
//
// String year = lawsMonthlyReportWriteEOS.get(0).getMonth().split("-")[0];
// String mothNew = lawsMonthlyReportWriteEOS.get(0).getMonth().split("-")[1];
// int mothLast = Integer.valueOf(mothNew) + 1;
//
// //添加说明 2022/7/15 至 2022/8/14 期间发布的主要内容
// String text = year + "/" + mothNew +"/15 至 "+year+"/"+mothLast+"/14期间发布的主要内容";
// WordUtil.exportWord(document, text, null, ParagraphAlignment.CENTER, 0, 11,
// false, false, "Blue Sky Noto Regular",null,null,flag);
//
// //添加换行
// WordUtil.exportWord(document, "\r\n", null, ParagraphAlignment.CENTER, 0, null,
// false, false, null,null,null,flag);
//
// //添加说明 编辑: 整车工程 - 法规与认证&环保与材料科团队
// String text1 = "编辑: 整车工程 - 法规与认证&环保与材料科团队";
// WordUtil.exportWord(document, text1, null, ParagraphAlignment.CENTER, 0, 11,
// false, false, "Blue Sky Noto Regular",null,null,flag);
//
// //添加下一页
// document.createParagraph().createRun().addBreak(BreakType.PAGE);
// }
//封面(office版本)
private void coverEn(List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
String titleCN,
XWPFDocument document) {
//封面标识
String flag = "cover";
String moth = lawsMonthlyReportWriteEOS.get(0).getMonth().replaceAll("-", "年") + "月";
titleCN = "\r\n\r\n" + titleCN + "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
String year = lawsMonthlyReportWriteEOS.get(0).getMonth().split("-")[0];
String mothNew = lawsMonthlyReportWriteEOS.get(0).getMonth().split("-")[1];
int mothLast = Integer.valueOf(mothNew) - 1;
String moth = mothNew+"/"+year;
String mothNewEn = getMothEn(mothNew);
String mothLastEn = getMothEn(String.valueOf(mothLast));
//标题前面添加一个换行
WordUtil.exportWord(document, "", null, ParagraphAlignment.CENTER, 0, null,
false, false, "Blue Sky Noto Regular",null,null,"break");
//添加标题
WordUtil.exportWord(document, titleCN, null, ParagraphAlignment.CENTER, 0, 18,
false, false, "Blue Sky Noto Regular",null,null,flag);
WordUtil.exportWord(document, moth+"\r\n", null, ParagraphAlignment.CENTER, 0, 12,
false, true, "Blue Sky Noto Regular",null,null,flag);
//标题下面添加8个换行
for (int i = 0; i < 8; i++) {
WordUtil.exportWord(document, "", null, ParagraphAlignment.CENTER, 0, null,
false, false, "Blue Sky Noto Regular",null,null,"break");
}
WordUtil.exportWord(document, moth, null, ParagraphAlignment.CENTER, 0, 12,
false, false, "Blue Sky Noto Regular",null,null,flag);
//添加说明 Update between July 15, 2022 and August 14, 2022
String text = "Update between "+mothLastEn+" 15,"+year+" and "+mothNewEn+" 14,"+year;
WordUtil.exportWord(document, text, null, ParagraphAlignment.CENTER, 0, 11,
false, false, "Blue Sky Noto Regular",null,null,flag);
//添加换行
WordUtil.exportWord(document, "\r\n", null, ParagraphAlignment.CENTER, 0, null,
false, false, null,null,null,flag);
//添加说明 编辑: 整车工程 - 法规与认证&环保与材料科团队
String text1 = "Edit By: Regulation & Homologation, Environmental & Materials Team";
WordUtil.exportWord(document, text1, null, ParagraphAlignment.CENTER, 0, 11,
false, false, "Blue Sky Noto Regular",null,null,flag);
//添加下一页
document.createParagraph().createRun().addBreak(BreakType.PAGE);
}
//封面(WPS版本)
// private void coverEn(List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
// String titleCN,
// XWPFDocument document) {
// //封面标识
// String flag = "cover";
//
// String year = lawsMonthlyReportWriteEOS.get(0).getMonth().split("-")[0];
// String mothNew = lawsMonthlyReportWriteEOS.get(0).getMonth().split("-")[1];
// int mothLast = Integer.valueOf(mothNew) + 1;
// String moth = mothNew+"/"+year;
// String mothNewEn = getMothEn(mothNew);
// String mothLastEn = getMothEn(String.valueOf(mothLast));
//
//// String moth = lawsMonthlyReportWriteEOS.get(0).getMonth().replaceAll("-", "年") + "月";
//
// titleCN = "\r\n\r\n" + titleCN + "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
// WordUtil.exportWord(document, titleCN, null, ParagraphAlignment.CENTER, 0, 18,
// false, false, "Blue Sky Noto Regular",null,null,flag);
// WordUtil.exportWord(document, moth, null, ParagraphAlignment.CENTER, 0, 12,
// false, false, "Blue Sky Noto Regular",null,null,flag);
//
//
//
// //添加说明 Update between July 15, 2022 and August 14, 2022
// String text = "Update between "+mothNewEn+" 15,"+year+" and "+mothLastEn+" 14,"+year;
// WordUtil.exportWord(document, text, null, ParagraphAlignment.CENTER, 0, 11,
// false, false, "Blue Sky Noto Regular",null,null,flag);
//
// //添加换行
// WordUtil.exportWord(document, "\r\n", null, ParagraphAlignment.CENTER, 0, null,
// false, false, null,null,null,flag);
//
// //添加说明 编辑: 整车工程 - 法规与认证&环保与材料科团队
// String text1 = "Edit By: Regulation & Homologation, Environmental & Materials Team";
// WordUtil.exportWord(document, text1, null, ParagraphAlignment.CENTER, 0, 11,
// false, false, "Blue Sky Noto Regular",null,null,flag);
//
// //添加下一页
// document.createParagraph().createRun().addBreak(BreakType.PAGE);
// }
private String getMothEn(String moth){
String result = "";
switch (moth) {
// 心跳检测
case "1":
result = "January";
break;
case "2":
result = "February";
break;
case "3":
result = "March";
break;
case "4":
result = "April";
break;
case "5":
result = "May";
break;
case "6":
result = "June";
break;
case "7":
result = "July";
break;
case "8":
result = "August";
break;
case "9":
result = "September";
break;
case "10":
result = "October";
break;
case "11":
result = "November";
break;
case "12":
result = "December";
break;
default:
break;
}
return result;
}
private void wordContent(List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS,
List<LawsMonthlyReportTitleTemplateEO> reportTitleOneList,
@@ -922,7 +1156,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
// WordUtil.exportHeardAndFoot(document,moth);
//生成页眉页脚
WordUtil.exportHeardAndFoot(document,moth);
WordUtil.exportHeardAndFoot(document,moth,cut);
//生成标题
// WordUtil.exportWord(document, "", null, ParagraphAlignment.CENTER, 0, 18,
// false, true, "Blue Sky Noto Regular",null,null,null);
@@ -949,7 +1183,7 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
}
List<LawsMonthlyReportTitleTemplateEO> reportTitleTwoList = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> e.getParentId().equals(lawsMonthlyReportTitleTemplateEO.getId())).collect(Collectors.toList());
Collections.sort(reportTitleTwoList);//正序排序
for (LawsMonthlyReportTitleTemplateEO monthlyReportTitleTemplateEO : reportTitleTwoList) {
int reportCount = 1;
@@ -1179,4 +1413,32 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
return infoPage;
}
public Page getPages(Integer currentPage, Integer pageSize, List<LawsMonthlyReportWriteEO> list){
Page page =new Page();
if(list==null){
return null;
}
int size = list.size();
if(pageSize > size){
pageSize = size;
}
if(pageSize!=0){
//求出最⼤页数,防⽌currentPage越界
int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1;
if(currentPage > maxPage){
currentPage = maxPage;
}
}
//当前页第⼀条数据的下标
int curIdx = currentPage >1?(currentPage -1)* pageSize :0;
List pageList =new ArrayList();
//将当前页的数据放进pageList
for(int i =0; i < pageSize && curIdx + i < size; i++){
pageList.add(list.get(curIdx + i));
}
page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList);
return page;
}
}
@@ -128,6 +128,10 @@ public class WordUtil {
}
XWPFRun titleParagraphRun = titleParagraph.createRun();
//封面中的换行
if("break".equals(flag)){
titleParagraphRun.addBreak();
}
if (isNewline) {
titleParagraphRun.setText("\r");
} else {
@@ -202,47 +206,9 @@ public class WordUtil {
styles.addStyle(style);
}
// @SneakyThrows
// public static void exportHeardAndFoot(XWPFDocument document){
//// XWPFDocument document = new XWPFDocument();
//
// // create header-footer
// XWPFHeaderFooterPolicy headerFooterPolicy = document.getHeaderFooterPolicy();
// if (headerFooterPolicy == null) headerFooterPolicy = document.createHeaderFooterPolicy();
//
// // create header start
// XWPFHeader header = headerFooterPolicy.createHeader(XWPFHeaderFooterPolicy.DEFAULT);
//
// XWPFParagraph paragraph = header.createParagraph();
// paragraph.setAlignment(ParagraphAlignment.CENTER);
//
// XWPFRun run = paragraph.createRun();
// run.setText("Header");
//
// // create footer start
// XWPFFooter footer = headerFooterPolicy.createFooter(XWPFHeaderFooterPolicy.DEFAULT);
//
// paragraph = footer.createParagraph();
// paragraph.setAlignment(ParagraphAlignment.CENTER);
//
// run = paragraph.createRun();
// run.setText("Footer");
//
// CTSectPr sectPr = document.getDocument().getBody().getSectPr();
// if (sectPr == null) sectPr = document.getDocument().getBody().addNewSectPr();
// CTPageMar pageMar = sectPr.getPgMar();
// if (pageMar == null) pageMar = sectPr.addNewPgMar();
// pageMar.setLeft(BigInteger.valueOf(2000)); //720 TWentieths of an Inch Point (Twips) = 720/20 = 36 pt = 36/72 = 0.5"
// pageMar.setRight(BigInteger.valueOf(720));
// pageMar.setTop(BigInteger.valueOf(1440)); //1440 Twips = 1440/20 = 72 pt = 72/72 = 1"
// pageMar.setBottom(BigInteger.valueOf(1440));
//
// pageMar.setHeader(BigInteger.valueOf(2000)); //45.4 pt * 20 = 908 = 45.4 pt header from top
// pageMar.setFooter(BigInteger.valueOf(568)); //28.4 pt * 20 = 568 = 28.4 pt footer from bottom
//
// }
//主要内容生成页眉页脚(office版本)
@SneakyThrows
public static void exportHeardAndFoot(XWPFDocument document,String month){
public static void exportHeardAndFoot(XWPFDocument document,String month,String cut){
XWPFHeaderFooterPolicy headerFooterPolicy = document.getHeaderFooterPolicy();
if (headerFooterPolicy == null) headerFooterPolicy = document.createHeaderFooterPolicy();
XWPFHeader header = headerFooterPolicy.createHeader(XWPFHeaderFooterPolicy.DEFAULT);
@@ -266,12 +232,22 @@ public class WordUtil {
picture.getCTPicture().getBlipFill().getBlip().setEmbed(blipID);
run.addTab();
is.close();
if(CutEnum.CN.getValue().equals(cut)){
run.setText(" "+month+" (总第 期)");
}else{
String replace = month.replace("年", " ").replace("月", "");
String monthTemp = replace.split(" ")[1]+"/"+replace.split(" ")[0];
run.setText(" "+monthTemp+" (Issue No. )");
}
run.setFontSize(11);
run.setFontFamily("Blue Sky Noto Regular");
}
//页眉第二个段落展示日期------------------------------------------------------------
XWPFParagraph paragraph = header.createParagraph();//创建新的段落
paragraph.setAlignment(ParagraphAlignment.RIGHT);//段落文本的对齐方式
// paragraph.setAlignment(ParagraphAlignment.RIGHT);//段落文本的对齐方式
XWPFRun run = paragraph.createRun();
run.setText(month);
// run.setText(month);
//页脚(三个段落分别展示3个内容)-----------------------------------------------------
XWPFFooter footer = headerFooterPolicy.createFooter(XWPFHeaderFooterPolicy.DEFAULT);
@@ -280,11 +256,15 @@ public class WordUtil {
paragraph.setAlignment(ParagraphAlignment.CENTER);
run = paragraph.createRun();
run.setText("NIO Internal");
run.setFontSize(11);
run.setFontFamily("Blue Sky Standard Regular");
paragraph = footer.createParagraph();
paragraph.setAlignment(ParagraphAlignment.LEFT);
run = paragraph.createRun();
run.setText("NIO.com");
run.setFontSize(11);
run.setFontFamily("Blue Sky Noto Regular");
//生成页码---------------------------------------------------------------------
paragraph = footer.createParagraph();
@@ -306,20 +286,107 @@ public class WordUtil {
CTSectPr sectPr = document.getDocument().getBody().getSectPr();
if (sectPr == null) sectPr = document.getDocument().getBody().addNewSectPr();
//设置页面大小
//设置页面大小(21*29.7)
CTPageSz pgSz = sectPr.addNewPgSz();
pgSz.setW(BigInteger.valueOf(11907));
pgSz.setH(BigInteger.valueOf(16840));
pgSz.setW(BigInteger.valueOf(11905));
pgSz.setH(BigInteger.valueOf(16838));
CTPageMar pageMar = sectPr.getPgMar();
if (pageMar == null) pageMar = sectPr.addNewPgMar();
pageMar.setLeft(BigInteger.valueOf(1803)); //左边距
pageMar.setRight(BigInteger.valueOf(1803));//右边距
pageMar.setLeft(BigInteger.valueOf(1797)); //左边距
pageMar.setRight(BigInteger.valueOf(1797));//右边距
pageMar.setTop(BigInteger.valueOf(1440)); //页眉高度
pageMar.setBottom(BigInteger.valueOf(1440));//页脚高度
pageMar.setHeader(BigInteger.valueOf(500)); //页眉上边框到顶部的距离
pageMar.setFooter(BigInteger.valueOf(800)); //页脚下边框到底部的距离
pageMar.setHeader(BigInteger.valueOf(720)); //页眉上边框到顶部的距离
pageMar.setFooter(BigInteger.valueOf(720)); //页脚下边框到底部的距离
}
//主要内容生成页眉页脚(WPS版本)
// @SneakyThrows
// public static void exportHeardAndFoot(XWPFDocument document,String month){
// XWPFHeaderFooterPolicy headerFooterPolicy = document.getHeaderFooterPolicy();
// if (headerFooterPolicy == null) headerFooterPolicy = document.createHeaderFooterPolicy();
// XWPFHeader header = headerFooterPolicy.createHeader(XWPFHeaderFooterPolicy.DEFAULT);
//
//// String logoFilePath = "/jero-boot/home/weilai.png";
// String logoFilePath = WordUtil.class.getClassLoader().getResource("static/home/weilai.png").getPath();
// //页眉第一个段落展示logo-----------------------------------------------------------------------------------
// if (org.apache.commons.lang3.StringUtils.isNotBlank(logoFilePath)) {
// XWPFParagraph logo = header.createParagraph();
// logo.setAlignment(ParagraphAlignment.LEFT);
// XWPFRun run = logo.createRun();
//
// String imgFile = logoFilePath;
// InputStream is = WordUtil.class.getClassLoader().getResourceAsStream("static/home/weilai.png");
//// InputStream is = new FileInputStream(imgFile);
// XWPFPicture picture = run.addPicture(is, XWPFDocument.PICTURE_TYPE_PNG, imgFile, Units.toEMU(95), Units.toEMU(35));
// String blipID = "";
// for(XWPFPictureData picturedata : header.getAllPackagePictures()) { //这段必须有,不然打开的logo图片不显示
// blipID = header.getRelationId(picturedata);
// }
// picture.getCTPicture().getBlipFill().getBlip().setEmbed(blipID);
// run.addTab();
// is.close();
// run.setText(" "+month);
// run.setFontSize(11);
// run.setFontFamily("Blue Sky Noto Regular");
// }
// //页眉第二个段落展示日期------------------------------------------------------------
// XWPFParagraph paragraph = header.createParagraph();//创建新的段落
//// paragraph.setAlignment(ParagraphAlignment.RIGHT);//段落文本的对齐方式
// XWPFRun run = paragraph.createRun();
//// run.setText(month);
//
// //页脚(三个段落分别展示3个内容)-----------------------------------------------------
// XWPFFooter footer = headerFooterPolicy.createFooter(XWPFHeaderFooterPolicy.DEFAULT);
//
// paragraph = footer.createParagraph();
// paragraph.setAlignment(ParagraphAlignment.CENTER);
// run = paragraph.createRun();
// run.setText("NIO Internal");
// run.setFontSize(11);
// run.setFontFamily("Blue Sky Standard Regular");
//
// paragraph = footer.createParagraph();
// paragraph.setAlignment(ParagraphAlignment.LEFT);
// run = paragraph.createRun();
// run.setText("NIO.com");
// run.setFontSize(11);
// run.setFontFamily("Blue Sky Noto Regular");
//
// //生成页码---------------------------------------------------------------------
// paragraph = footer.createParagraph();
// paragraph.setAlignment(ParagraphAlignment.RIGHT);
// run = paragraph.createRun();
// CTFldChar fldChar = run.getCTR().addNewFldChar();
// fldChar.setFldCharType(STFldCharType.Enum.forString("begin"));
//
// run = paragraph.createRun();
// CTText ctText = run.getCTR().addNewInstrText();
// ctText.setStringValue("PAGE \\* MERGEFORMAT");
// ctText.setSpace(SpaceAttribute.Space.Enum.forString("preserve"));
//
// fldChar = run.getCTR().addNewFldChar();
// fldChar.setFldCharType(STFldCharType.Enum.forString("end"));
// //----------------------------------------------------------------------------
//
//
//
// CTSectPr sectPr = document.getDocument().getBody().getSectPr();
// if (sectPr == null) sectPr = document.getDocument().getBody().addNewSectPr();
// //设置页面大小
// CTPageSz pgSz = sectPr.addNewPgSz();
// pgSz.setW(BigInteger.valueOf(11907));
// pgSz.setH(BigInteger.valueOf(16840));
// CTPageMar pageMar = sectPr.getPgMar();
// if (pageMar == null) pageMar = sectPr.addNewPgMar();
// pageMar.setLeft(BigInteger.valueOf(1803)); //左边距
// pageMar.setRight(BigInteger.valueOf(1803));//右边距
// pageMar.setTop(BigInteger.valueOf(1440)); //页眉高度
// pageMar.setBottom(BigInteger.valueOf(1440));//页脚高度
//
// pageMar.setHeader(BigInteger.valueOf(720)); //页眉上边框到顶部的距离
// pageMar.setFooter(BigInteger.valueOf(720)); //页脚下边框到底部的距离
// }
/**
* 主页面(只有页脚)
@@ -339,7 +406,7 @@ public class WordUtil {
paragraph.setAlignment(ParagraphAlignment.CENTER);
XWPFRun run = paragraph.createRun();
run.setText("NIO Internal");
run.setFontSize(18);
run.setFontSize(12);
run.setFontFamily("Blue Sky Standard Regular");
// run.setFontFamily("Blue Sky Noto Regular");
run.setBold(true);
@@ -349,18 +416,58 @@ public class WordUtil {
if (sectPr == null) sectPr = document.getDocument().getBody().addNewSectPr();
//设置页面大小
CTPageSz pgSz = sectPr.addNewPgSz();
pgSz.setW(BigInteger.valueOf(11907));
pgSz.setH(BigInteger.valueOf(16840));
pgSz.setW(BigInteger.valueOf(11905));
pgSz.setH(BigInteger.valueOf(16838));
CTPageMar pageMar = sectPr.getPgMar();
if (pageMar == null) pageMar = sectPr.addNewPgMar();
pageMar.setLeft(BigInteger.valueOf(1803)); //左边距
pageMar.setRight(BigInteger.valueOf(1803));//右边距
pageMar.setLeft(BigInteger.valueOf(1083)); //左边距
pageMar.setRight(BigInteger.valueOf(1083));//右边距
pageMar.setTop(BigInteger.valueOf(1440)); //页眉高度
pageMar.setBottom(BigInteger.valueOf(1440));//页脚高度
pageMar.setHeader(BigInteger.valueOf(500)); //页眉上边框到顶部的距离
pageMar.setFooter(BigInteger.valueOf(1200)); //页脚下边框到底部的距离
}
// /**
// * 主页面(只有页脚 WPS版本)
// * @param document
// * @param month
// */
// @SneakyThrows
// public static void exportHeardAndFootMain(XWPFDocument document,String month){
// XWPFHeaderFooterPolicy headerFooterPolicy = document.getHeaderFooterPolicy();
// if (headerFooterPolicy == null) headerFooterPolicy = document.createHeaderFooterPolicy();
//// XWPFHeader header = headerFooterPolicy.createHeader(XWPFHeaderFooterPolicy.DEFAULT);
//// XWPFParagraph paragraph = header.createParagraph();//创建新的段落
//// XWPFRun run = paragraph.createRun();
//
// XWPFFooter footer = headerFooterPolicy.createFooter(XWPFHeaderFooterPolicy.DEFAULT);
// XWPFParagraph paragraph = footer.createParagraph();
// paragraph.setAlignment(ParagraphAlignment.CENTER);
// XWPFRun run = paragraph.createRun();
// run.setText("NIO Internal");
// run.setFontSize(18);
// run.setFontFamily("Blue Sky Standard Regular");
//// run.setFontFamily("Blue Sky Noto Regular");
// run.setBold(true);
//
//
// CTSectPr sectPr = document.getDocument().getBody().getSectPr();
// if (sectPr == null) sectPr = document.getDocument().getBody().addNewSectPr();
// //设置页面大小
// CTPageSz pgSz = sectPr.addNewPgSz();
// pgSz.setW(BigInteger.valueOf(11907));
// pgSz.setH(BigInteger.valueOf(16840));
// CTPageMar pageMar = sectPr.getPgMar();
// if (pageMar == null) pageMar = sectPr.addNewPgMar();
// pageMar.setLeft(BigInteger.valueOf(1803)); //左边距
// pageMar.setRight(BigInteger.valueOf(1803));//右边距
// pageMar.setTop(BigInteger.valueOf(1440)); //页眉高度
// pageMar.setBottom(BigInteger.valueOf(1440));//页脚高度
//
// pageMar.setHeader(BigInteger.valueOf(500)); //页眉上边框到顶部的距离
// pageMar.setFooter(BigInteger.valueOf(1200)); //页脚下边框到底部的距离
// }
/**
* 导出工具示例
@@ -447,7 +554,7 @@ public class WordUtil {
String applyScope = lawsMonthlyReportWriteEO.getApplyScope();//适用范围
String state = lawsMonthlyReportWriteEO.getState();//状态
String useMethod = lawsMonthlyReportWriteEO.getUseMethod();//用法
String implementCar = lawsMonthlyReportWriteEO.getImplementCar();//实施车型
// String implementCar = lawsMonthlyReportWriteEO.getImplementCar();//实施车型
String newCarImplementTime = lawsMonthlyReportWriteEO.getNewCarImplementTime();//新车型实施日期
String productionCarImplementTime = lawsMonthlyReportWriteEO.getProductionCarImplementTime();//在产车实施日期
String contentCn = lawsMonthlyReportWriteEO.getContentCn();//主要内容中文
@@ -456,25 +563,25 @@ public class WordUtil {
String workProgressEn = lawsMonthlyReportWriteEO.getWorkProgressEn();//NIO工作进展英文
String lawsContactTemp = lawsMonthlyReportWriteEO.getLawsContact();//法规联系人
String lawsContact = getLawsContact(loginUserList, lawsContactTemp);
if(StringUtils.isNotEmpty(lawsContact)){
List<String> lawsContactList = Arrays.asList(lawsContact.split(","));
if (lawsContactList.size() > 4) {
StringBuilder str = new StringBuilder();
int count = 0;
for (String s : lawsContactList) {
str.append(s + ",");
count++;
if (count % 4 == 0) {
str.append("\n");
}
}
if(str.toString().endsWith("\n")){
lawsContact = str.substring(0,str.length()-2);
}else{
lawsContact = str.substring(0,str.length()-1);
}
}
}
// if(StringUtils.isNotEmpty(lawsContact)){
// List<String> lawsContactList = Arrays.asList(lawsContact.split(","));
// if (lawsContactList.size() > 4) {
// StringBuilder str = new StringBuilder();
// int count = 0;
// for (String s : lawsContactList) {
// str.append(s + ",");
// count++;
// if (count % 4 == 0) {
// str.append("\n");
// }
// }
// if(str.toString().endsWith("\n")){
// lawsContact = str.substring(0,str.length()-2);
// }else{
// lawsContact = str.substring(0,str.length()-1);
// }
// }
// }
String link = lawsMonthlyReportWriteEO.getLink();//链接
String technologyTerritoryName = "";
@@ -494,10 +601,10 @@ public class WordUtil {
//适用车型中文名
String applyCarName = dictItem(sysDictItems, applyCar,cut, DictCodeReportEnum.APPLYCAR.getValue());
String applyScopeName = dictItem(sysDictItems, applyScope,cut, DictCodeReportEnum.APPLYSCOPE.getValue());
String stateName = dictItem(sysDictItems, state,cut, DictCodeReportEnum.STATE.getValue());
String stateName = dictItem(sysDictItems, state,cut, DictCodeReportEnum.STATE_REPORT.getValue());
String useMethodName = dictItem(sysDictItems, useMethod,cut, DictCodeReportEnum.USEMETHOD.getValue());
XWPFTable table = document.createTable(11, 2);
XWPFTable table = document.createTable(10, 2);
//表格属性
CTTblPr tablePr = table.getCTTbl().addNewTblPr();
//固定列宽(英文和数字的时候自动换行)
@@ -527,19 +634,19 @@ public class WordUtil {
//第5行
setCellThree(table,3, "用法",useMethodName,sysDictItems,DictCodeReportEnum.USEMETHOD.getValue());
//第6行
setCell(table,4, "实施车型",implementCar);
// setCell(table,4, "实施车型",implementCar);
//第7行
setCell(table,5, "新车型实施日期",newCarImplementTime);
setCell(table,4, "发布日期",newCarImplementTime);
//第8行
setCell(table,6, "在产车实施日期",productionCarImplementTime);
setCell(table,5, "实施日期",productionCarImplementTime);
//第9行
setCell(table,7, "主要内容",contentCn);
setCell(table,6, "主要内容",contentCn);
//第10行
setCell(table,8, "NIO工作进展",workProgressCn);
setCell(table,7, "NIO工作进展",workProgressCn);
//第11行
setCell(table,9, "法规联系人",lawsContact);
setCell(table,8, "法规联系人",lawsContact);
//第12行
setCell(table,10, "链接",link);
setCell(table,9, "链接",link);
}else{
//第1行
setCell(table,0, "Related Areas",technologyTerritoryName);
@@ -552,19 +659,19 @@ public class WordUtil {
//第5行
setCellThree(table,3,"Usage",useMethodName,sysDictItems,DictCodeReportEnum.APPLYSCOPE.getValue());
//第6行
setCell(table,4,"Implementation Model",implementCar);
// setCell(table,4,"Implementation Model",implementCar);
//第7行
setCell(table,5,"New Type Execution Date",newCarImplementTime);
setCell(table,4,"Release Date",newCarImplementTime);
//第8行
setCell(table,6,"New Vehicle Execution Date",productionCarImplementTime);
setCell(table,5,"Execution Date",productionCarImplementTime);
//第9行
setCell(table,7,"Main Content",contentEn);
setCell(table,6,"Main Content",contentEn);
//第10行
setCell(table,8,"NIO Work Progress",workProgressEn);
setCell(table,7,"NIO Work Progress",workProgressEn);
//第11行
setCell(table,9,"Regulatory Contact",lawsContact);
setCell(table,8,"Regulatory Contact",lawsContact);
//第12行
setCell(table, 10,"Link",link);
setCell(table, 9,"Link",link);
}
// ctTblLayoutType.setType(STTblLayoutType.FIXED);
@@ -1033,7 +1140,7 @@ public class WordUtil {
for (String s : lawsContact.split(",")) {
List<LoginUser> loginUserList = collect.stream().filter(e -> e.getId().equals(s)).collect(Collectors.toList());
if(loginUserList.size() != 0){
sb.append(loginUserList.get(0).getUsername()+",");
sb.append(loginUserList.get(0).getRealname()+",");
}
}
if(com.jero.modules.system.util.StringUtils.isNotBlank(sb)){
@@ -1065,6 +1172,7 @@ public class WordUtil {
ctTc.addNewP() : ctTc.getPArray(0);
//getParagraph(ctP) 获取 XWPFParagraph
XWPFParagraph par = cell.getParagraph(ctP);
par.setAlignment(ParagraphAlignment.LEFT);
//XWPFRun 设置格式
XWPFRun run = par.createRun();
//单元格内容换行
@@ -1102,6 +1210,7 @@ public class WordUtil {
ctTc.addNewP() : ctTc.getPArray(0);
//getParagraph(ctP) 获取 XWPFParagraph
XWPFParagraph par = cell.getParagraph(ctP);
par.setAlignment(ParagraphAlignment.LEFT);
//XWPFRun 设置格式
XWPFRun run = par.createRun();
//单元格内容换行 □ ■
@@ -1129,7 +1238,7 @@ public class WordUtil {
setBlank(text, run, sb, itemText);
}
if("Usage".equals(fieldName)){
String itemText = "Constraint,Recommend,Installation Is Compliant";
String itemText = "Mandatory,Voluntary,Mandatory if fitted";
setBlank(text, run, sb, itemText);
}
}
@@ -1162,75 +1271,75 @@ public class WordUtil {
String blank = "";
switch (value) {
case "M":
blank = " ";
blank = " ";
break;
case "N":
blank = "\r\n";
break;
case "企业":
blank = " ";
blank = " ";
break;
case "整车":
blank = " ";
blank = " ";
break;
case "系统/零部件":
blank = "\r\n";
break;
case "新车型":
blank = " ";
blank = " ";
break;
case "在产车型`":
blank = "";
break;
case "Enterprise":
blank = " ";
blank = " ";
break;
case "Vehicle":
blank = " ";
blank = " ";
break;
case "System/Parts":
blank = "\r\n";
break;
case "New Car Model":
blank = " ";
blank = " ";
break;
case "Models In Production":
blank = "";
break;
case "草稿":
blank = " ";
blank = " ";
break;
case "公示稿":
blank = " ";
blank = " ";
break;
case "发布稿":
blank = "";
break;
case "Draft":
blank = " ";
blank = " ";
break;
case "Public Notice":
blank = " ";
blank = " ";
break;
case "Release":
blank = "";
break;
case "强制":
blank = " ";
blank = " ";
break;
case "推荐":
blank = " ";
blank = " ";
break;
case "安装需符合":
blank = "";
break;
case "Constraint":
blank = " ";
case "Mandatory":
blank = " ";
break;
case "Recommend":
blank = " ";
case "Voluntary":
blank = "\r\n";
break;
case "Installation Is Compliant":
case "Mandatory if fitted":
blank = "";
break;
default:
@@ -576,13 +576,13 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
}
}
//如果value中包含英文单、双引号,替换成中文的。 英文的符号影响到法规技术评估流程了。
if(entry.getValue() != null){
if(StringUtils.contains(entry.getValue().toString(),"'") || StringUtils.contains(entry.getValue().toString(),"\"")){
String key = entry.getKey();
String value = entry.getValue().toString().replaceAll("'", "‘").replaceAll("\"", "”");
record1.put(key,value);
}
}
// if(entry.getValue() != null){
// if(StringUtils.contains(entry.getValue().toString(),"'") || StringUtils.contains(entry.getValue().toString(),"\"")){
// String key = entry.getKey();
// String value = entry.getValue().toString().replaceAll("'", "‘").replaceAll("\"", "”");
// record1.put(key,value);
// }
// }
}
}
// 拼接文件名
@@ -2653,7 +2653,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
for (int j = 0; j < headerArr.length; j++) {
// 条款号和输入框数字类型 列 设置单元格格式为文本
if ("*条款号".equals(headerArr[j]) || "*Item No.".equals(headerArr[j]) || FieldTypeEnum.TEXT_NUMBER.getValue().equals(headerTypeArr[j])) {
if ("条款号".equals(headerArr[j]) || "Item No.".equals(headerArr[j]) || FieldTypeEnum.TEXT_NUMBER.getValue().equals(headerTypeArr[j])) {
sheet.setDefaultColumnStyle(j, cellStyle);
}
row.createCell(j).setCellValue(headerArr[j]);
@@ -3754,7 +3754,26 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
@Override
public int insertForeach(List<SarFileSplitItemsEO> messageList) {
return dao.insertForeach(messageList);
// 解决一次批量插入太多 PacketTooBigException 异常
int total = messageList.size();
int count = 0;
int pageSum = 1;
if(total > 100) {
pageSum = total / 100; // 总页数
if ((total % 100) > 0) {
pageSum += 1;
}
}
List<SarFileSplitItemsEO> subList = new ArrayList<>();
for(int i = 0; i < pageSum; i++) {
int j = i*100+100;
if (i == pageSum -1) {
j = total;
}
subList = messageList.subList(i*100, j);
count += dao.insertForeach(subList);
}
return count;
}
/**
@@ -1784,7 +1784,7 @@ public class FileSplitPdfService {
if(StringUtils.isNotBlank(preName)) {
List<String> nowStartList = fileSpiltService.getNewNowStart(preName);
List<String> subList1 = startDigitList.subList(preNameNum, startDigitList.size()-1);
List<String> subList1 = startDigitList.subList(preNameNum, startDigitList.size());
// 后文有一级以下的标题
for (int i = nowStartList.size() - 1; i >= 1; i--) {
int index1 = subList1.indexOf(nowStartList.get(i));
@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@@ -79,8 +80,26 @@ public class SarFileSplitItemsValEOServiceImpl extends ServiceImpl<SarFileSplitI
@Override
public int insertForeach(List<SarFileSplitItemsValEO> itemValList) {
return dao.insertForeach(itemValList);
// 解决一次批量插入太多 PacketTooBigException 异常
int total = itemValList.size();
int count = 0;
int pageSum = 1;
if(total > 100) {
pageSum = total / 100; // 总页数
if ((total % 100) > 0) {
pageSum += 1;
}
}
List<SarFileSplitItemsValEO> subList = new ArrayList<>();
for(int i = 0; i < pageSum; i++) {
int j = i*100+100;
if (i == pageSum -1) {
j = total;
}
subList = itemValList.subList(i*100, j);
count += dao.insertForeach(subList);
}
return count;
}
}
@@ -13,6 +13,7 @@ import com.jero.modules.document.enums.FieldTypeEnum;
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.system.entity.SysAnnouncement;
import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysDictItem;
@@ -372,7 +373,7 @@ public class LawsWarnService {
thirdIdList.addAll(thirdId);
}
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//查询文档
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMapsAll(documentIds);
List<String> serialNumberList = new ArrayList<>();
@@ -408,29 +409,65 @@ public class LawsWarnService {
"&serial_number=" + map.get("serial_number") + "'" + " target='_blank'>" + map.get("serial_number") + "</a>";
urlList.add(url);
hrefList.add(href+timeContent);
//推送多条时, 每条单独发消息
//编号, 标题, 新车型实施日期, 在产车实施日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String serialNumber = StringUtils.valueOf(map.get("serial_number"));
String titleCn = StringUtils.valueOf(map.get("title"));
String titleEn = StringUtils.valueOf(map.get("title_en"));
String newType = "";
if(ObjectUtils.isNotEmpty(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))){
newType = sdf.format(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"));
}
String newVehicle = "";
if(ObjectUtils.isNotEmpty(map.get("implement_time"))){
newVehicle = sdf.format(map.get("implement_time"));
}
//消息-英文
String contentNo = sysUser.getUsername() +" shared Regulation Early Warning infomation with you, "
+"Regulation No: "+serialNumber+",Title: "+titleEn+",New Type Execution Date: "+newType+",New Vehicle Execution Date: "+newVehicle;
String contentInfoYes = sysUser.getUsername() +" shared Regulation Early Warning infomation with you, "+"</br>"
+"Regulation No: "+href+"</br>"
+"Title: "+titleEn+"</br>"
+"New Type Execution Date: "+newType+"</br>"
+"New Vehicle Execution Date: "+newVehicle;
//消息中文
String contentCnNo = sysUser.getUsername() +"向您分享了法规预警信息, "+"编号: "+serialNumber+",标题: "+titleCn+",新车型实施日期: "+newType+",在产车实施日期: "+newVehicle;
String contentInfoCnYes = sysUser.getUsername() +"向您分享了法规预警信息,"+"</br>"
+"编号: "+href+"</br>"
+"标题: "+titleCn+"</br>"
+"新车型实施日期: "+newType+"</br>"
+"在产车实施日期: "+newVehicle;
//封装消息的实体类
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
null,
contentNo,
contentInfoYes,
MessageTypeEnum.PUSH.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentCnNo,contentInfoCnYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfoCnYes);
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String content = StringUtils.join(serialNumberList, ",") + " has been shared with you, please check.";
//消息详情模板
// XXX has pushed GB 7258 to you as the implementation date of vehicle production is XXXX-XX-XX,
// GB 7258 to you as the implementation date of vehicle production is XXXX-XX-XX, Please be reminded to check it out.
String contentInfo = sysUser.getUsername() + " has pushed " + StringUtils.join(hrefList, ",") + ", Please be reminded to check it out.";
String title = content;
//封装消息的实体类
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, title, content, contentInfo,MessageTypeEnum.PUSH.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo);
//飞书
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (String s : urlList) {
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
String encode = UriEncoder.encode(s);
List<String> list = new ArrayList<>();
mapList.stream().forEach(e->{
if(s.contains((String)e.get("id"))){
String serialNumber = StringUtils.valueOf(e.get("serial_number"));
//封装飞书消息实体类
setFeishuMsgVo(sysUser, sdf, feishuMsgVo, encode, e, serialNumber);
String timeContent = "";
if("1".equals(flag)){
String value = StringUtils.valueOf(e.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"));
@@ -452,15 +489,50 @@ public class LawsWarnService {
list.add(serialNumber + timeContent);
}
});
String contentTemp = sysUser.getUsername() + " has pushed " + StringUtils.join(list, ",") + ", Please be reminded to check it out.";
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
iFeishuService.sendCardMsgWarn(thirdIdList.toArray(new String[]{}), feishuMsgVo);
// String contentTemp = sysUser.getUsername() + " has pushed " + StringUtils.join(list, ",") + ", Please be reminded to check it out.";
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
}
} catch (IOException e) {
e.printStackTrace();
}
bussDocumentLibraryEOService.sendWebsocket(documentIds, contentInfo);
bussDocumentLibraryEOService.sendWebsocket(documentIds, documentIds);
return "推送成功";
}
private void setFeishuMsgVo(LoginUser sysUser, SimpleDateFormat sdf, FeishuMsgVo feishuMsgVo, String encode, Map<String, Object> e, String serialNumber) {
String documentTitleCn = ""; //文档标题
String documentTitleEn = ""; //文档标题
String newTypeExecutionDate = ""; //新车型实施日期
String newVehicleExecutionDate = ""; //在产车实施日期
if(ObjectUtils.isNotEmpty(e.get("title"))){
documentTitleCn = String.valueOf(e.get("title"));
}
if(ObjectUtils.isNotEmpty(e.get("title_en"))){
documentTitleEn = String.valueOf(e.get("title_en"));
}
if(ObjectUtils.isNotEmpty(e.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))){
newTypeExecutionDate = sdf.format(e.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"));
}
if(ObjectUtils.isNotEmpty(e.get("implement_time"))){
newVehicleExecutionDate = sdf.format(e.get("implement_time"));
}
String contentInfoFei = sysUser.getUsername() +" shared Regulation Early Warning infomation with you.";
String contentInfoFeiCn = sysUser.getUsername() +"向您分享了法规预警信息.";
feishuMsgVo.setTitle(MessageTypeEnum.WARN.getNameCn()+"/"+MessageTypeEnum.WARN.getName());
feishuMsgVo.setUrl(encode);
feishuMsgVo.setContentEn(contentInfoFei);
feishuMsgVo.setContent(contentInfoFeiCn);
feishuMsgVo.setRegulationNo(serialNumber);
feishuMsgVo.setNewTypeExecutionDate(newTypeExecutionDate);
feishuMsgVo.setNewVehicleExecutionDate(newVehicleExecutionDate);
feishuMsgVo.setDocumentTitleCn(documentTitleCn);
feishuMsgVo.setDocumentTitleEn(documentTitleEn);
}
// public String warnPullMessage(String departIds, String userIds, String documentIds,String flag) {
// Set<String> allDepartIds = new HashSet<>();
// //查询当前部门下所有部门
@@ -4,6 +4,7 @@ import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
import com.jero.modules.subscribe.service.IOnlCgformSubscribeService;
import com.jero.modules.system.entity.SysAnnouncement;
@@ -123,15 +124,33 @@ public class TimedTaskWarn implements Job {
//当前时间的前12个月
String beforeTimeSixTen = beforeTime(12,xin1Che1Xing2Shi2Shi1Ri4Qi1);
if(currentTime.equals(beforeTimeSix) || currentTime.equals(beforeTimeSixTen) || currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){
//发送站内消息和飞书消息
String format = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1);
String content = "The implementation date of the " + category +" "+ serialNumber
+ " new model you subscribed to is "+format+",please pay attention to check";
String contentInfo = "The implementation date of the " + category +" "+ href
+ " new model you subscribed to is "+format+",please pay attention to check";
String msgTitle = content;
sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList);
// if(currentTime.equals(beforeTimeSix) || currentTime.equals(beforeTimeSixTen) || currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){
// //发送站内消息和飞书消息
// String format = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1);
// String content = "The implementation date of the " + category +" "+ serialNumber
// + " new model you subscribed to is "+format+",please pay attention to check";
// String contentInfo = "The implementation date of the " + category +" "+ href
// + " new model you subscribed to is "+format+",please pay attention to check";
// String msgTitle = content;
// sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList);
// }
if(currentTime.equals(beforeTimeSixTen)){
//发送飞书消息(提前一年)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"1",sdf,href);
}
if(currentTime.equals(beforeTimeSix)){
//发送飞书消息(提前6个月)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"6",sdf,href);
}
if(currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){
//发送飞书消息(当天)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"0",sdf,href);
}
}
@@ -152,27 +171,165 @@ public class TimedTaskWarn implements Job {
String contentInfo = "The implementation date of the " + category +" "+ href
+ " production vehicle you subscribed to is "+format+",please pay attention to check";
String msgTitle = content;
sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList);
// sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList);
}
if(currentTime.equals(beforeTimeSixTen)){
//发送飞书消息(提前一年)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"1",sdf,href);
}
if(currentTime.equals(beforeTimeSix)){
//发送飞书消息(提前6个月)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"6",sdf,href);
}
if(currentTime.equals(implementTimeStr)){
//发送飞书消息(当天)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"0",sdf,href);
}
}
}
}
private void sendMessage(String title, String content,String contentInfo,String contentFeiShu, String url, List<String> userIdList, List<String> thirdIdList) {
//站内消息
//封装消息的实体类
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, title, content, contentInfo,MessageTypeEnum.WARN.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(userIdList, ","), content);
private void sendFeishu(SimpleDateFormat sdf,
BussDocumentLibraryEO bussDocumentLibraryEO,
String url,
List<String> thirdIdList,
String flag) {
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.WARN.getNameCn()+"/"+MessageTypeEnum.WARN.getName());
feishuMsgVo.setUrl(url);
String contentCn = "";
String contentEn = "";
if("1".equals(flag)){
contentCn = "您所订阅的法规将于1年后实施.";
contentEn = "The regulation you subscribed to will be implemented in one year.";
}
if("6".equals(flag)){
contentCn = "您所订阅的法规将于6个月后实施.";
contentEn = "The regulation you subscribed to will be implemented in six months.";
}
if("0".equals(flag)){
contentCn = "您所订阅的法规已实施.";
contentEn = "The regulation you subscribed to is implemented.";
}
feishuMsgVo.setContent(contentCn);
feishuMsgVo.setContentEn(contentEn);
feishuMsgVo.setRegulationNo(bussDocumentLibraryEO.getSerialNumber());
feishuMsgVo.setDocumentTitleCn(bussDocumentLibraryEO.getTitle());
feishuMsgVo.setDocumentTitleEn(bussDocumentLibraryEO.getTitleEn());
if(ObjectUtils.isNotEmpty(bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1())){
feishuMsgVo.setNewTypeExecutionDate(sdf.format(bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1()));
}
if(ObjectUtils.isNotEmpty(bussDocumentLibraryEO.getImplementTime())){
feishuMsgVo.setNewVehicleExecutionDate(sdf.format(bussDocumentLibraryEO.getImplementTime()));
}
//飞书消息
try {
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentFeiShu, MessageTypeEnum.WARN.getName(), url);
iFeishuService.sendCardMsgWarn(thirdIdList.toArray(new String[]{}),feishuMsgVo);
} catch (IOException e) {
e.printStackTrace();
}
}
// private void sendMessage(String title, String content,String contentInfo,String contentFeiShu, String url, List<String> userIdList, List<String> thirdIdList) {
// //站内消息
// //封装消息的实体类
// SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
// title,
// content,
// contentInfo,
// MessageTypeEnum.WARN.getValue(),
// MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
// null,null);
// sysAnnouncementService.saveAnnouncement(sysAnnouncement);
// bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(userIdList, ","), content);
//
//// //飞书消息
//// try {
//// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentFeiShu, MessageTypeEnum.WARN.getName(), url);
//// } catch (IOException e) {
//// e.printStackTrace();
//// }
// }
private void sendMessage(BussDocumentLibraryEO bussDocumentLibraryEO,
List<String> userIdList,
String flag,
SimpleDateFormat sdf,
String href) {
String number = bussDocumentLibraryEO.getSerialNumber();
String title = bussDocumentLibraryEO.getTitle();
String titleEn = bussDocumentLibraryEO.getTitleEn();
Date xin1Che1Xing2Shi2Shi1Ri4Qi1 = bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1();
Date implementTime = bussDocumentLibraryEO.getImplementTime();
String newType = "";
String newVehicle = "";
if(ObjectUtils.isNotEmpty(xin1Che1Xing2Shi2Shi1Ri4Qi1)){
newType = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1);
}
if(ObjectUtils.isNotEmpty(implementTime)){
newVehicle = sdf.format(implementTime);
}
String contentCn = "";
String contentInfoCn = "";
String contentEn = "";
String contentInfoEn = "";
//"</br>"
contentCn = ",编号: "+number
+",标题: "+title
+",新车型实施日期: "+newType
+",在产车实施日期: "+newVehicle;
contentInfoCn = "编号: "+href+"</br>"
+"标题: "+title+"</br>"
+"新车型实施日期: "+newType+"</br>"
+"在产车实施日期: "+newVehicle;
contentEn = ",Regulation No: "+number
+",Title: "+titleEn
+",New Type Execution Date: "+newType
+",New Vehicle Execution Date: "+newVehicle;
contentInfoEn = "Regulation No: "+href+"</br>"
+"Title: "+titleEn+"</br>"
+"New Type Execution Date: "+newType+"</br>"
+"New Vehicle Execution Date: "+newVehicle;
if("1".equals(flag)){
contentCn = "您所订阅的法规将于1年后实施"+contentCn;
contentInfoCn = "您所订阅的法规将于1年后实施"+"</br>"+contentInfoCn;
contentEn = "The regulation you subscribed to will be implemented in one year"+contentEn;
contentInfoEn = "The regulation you subscribed to will be implemented in one year"+"</br>"+contentInfoEn;
}
if("6".equals(flag)){
contentCn = "您所订阅的法规将于6个月后实施"+contentCn;
contentInfoCn = "您所订阅的法规将于6个月后实施"+"</br>"+contentInfoCn;
contentEn = "The regulation you subscribed to will be implemented in six months"+contentEn;
contentInfoEn = "The regulation you subscribed to will be implemented in six months"+"</br>"+contentInfoEn;
}
if("0".equals(flag)){
contentCn = "您所订阅的法规已实施"+contentCn;
contentInfoCn = "您所订阅的法规已实施"+"</br>"+contentInfoCn;
contentEn = "The regulation you subscribed to is implemented"+contentEn;
contentInfoEn = "The regulation you subscribed to is implemented"+"</br>"+contentInfoEn;
}
//封装消息的实体类
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
title,
contentEn,
contentInfoEn,
MessageTypeEnum.WARN.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentCn,contentInfoCn);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(userIdList, ","), contentInfoEn);
}
private String beforeTime (int month,Date date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendarBefore = Calendar.getInstance();
@@ -35,6 +35,7 @@ public class BusMes {
private String handlingTime; // 待办流程-批量办理专用
private String projectLawsInventoryIds; // 待办流程-批量办理专用
private String taskDefinitionKey; // 待办流程-批量办理专用
private String cut;//中英文切换标识
public String getUserId() {
@@ -193,4 +194,12 @@ public class BusMes {
public void setTaskDefinitionKey(String taskDefinitionKey) {
this.taskDefinitionKey = taskDefinitionKey;
}
public String getCut() {
return cut;
}
public void setCut(String cut) {
this.cut = cut;
}
}
@@ -182,6 +182,9 @@ public interface WorkFlowFeignClient {
@RequestMapping(value = "/bat-wkflow/deleteProcessInstanceByPrcIds",method = RequestMethod.GET)
Result<String> deleteProcessInstanceByPrcIds(@RequestParam("prcIds") String prcIds);
@RequestMapping(value = "/bat-wkflow/task/getLawsOpinionGatherPrcInfo",method = RequestMethod.GET)
Map<String,String> getLawsOpinionGatherPrcInfo(@RequestParam("lawsOpinionGatherId") String lawsOpinionGatherId);
/**
* 根据流程类型,查询未完成的流程信息
* @param prcType