合并分支 'lixuetao' 到 'master'

Lixuetao

查看合并请求 faw-report-library/faw-report-library-boot!6
This commit is contained in:
李雪涛
2023-05-15 18:15:13 +08:00
31 changed files with 244 additions and 81 deletions
@@ -25,6 +25,7 @@ public class secrecyDDLTimer {
@Autowired @Autowired
ReportDao reportDao; ReportDao reportDao;
// @Scheduled(cron="0 0 0 * * *")
@Scheduled(cron="0 0/10 * * * ?") @Scheduled(cron="0 0/10 * * * ?")
public void timingOpen() { public void timingOpen() {
log.info("**********************保密到期定时任务开始**********************"); log.info("**********************保密到期定时任务开始**********************");
@@ -1,11 +1,11 @@
package com.adc.da.report.aspect; package com.adc.da.report.aspect;
import com.adc.da.login.util.CommonUtils; import com.adc.da.login.util.CommonUtils;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.annotation.ReportLog; import com.adc.da.report.annotation.ReportLog;
import com.adc.da.report.eo.LogEntity; import com.adc.da.report.eo.LogEntity;
import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.service.ILogService; import com.adc.da.report.service.ILogService;
import com.adc.da.report.vo.ReportVo;
import com.adc.da.sys.entity.UserEO;
import com.adc.da.util.http.ResponseMessage; import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.utils.StringUtils; import com.adc.da.util.utils.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -13,16 +13,14 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import javax.annotation.Resource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional;
/** /**
* @Author doudxw * @Author doudxw
@@ -64,9 +62,7 @@ public class ReportLogAspect {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LogEntity entity = new LogEntity(); LogEntity entity = new LogEntity();
String account = Optional.ofNullable(CommonUtils.getUserInfo()).orElse(new UserEO()).getAccount(); entity.setAccount(UserUtils.getUser().getAccount());
account = StringUtils.isEmpty(account) ? "未知用户" : account;
entity.setAccount(account);
entity.setClassName(cs.getName()); entity.setClassName(cs.getName());
entity.setOperateTime(format.format(new Date())); entity.setOperateTime(format.format(new Date()));
entity.setMethod(name); entity.setMethod(name);
@@ -74,11 +70,11 @@ public class ReportLogAspect {
entity.setUsid(CommonUtils.getUserId()); entity.setUsid(CommonUtils.getUserId());
//新增或者编辑操作 //新增或者编辑操作
if ("新增或编辑".equals(description)) { if ("新增或编辑".equals(description)) {
Map<String, String> map = (Map<String, String>) returnValue.getData(); ReportEntity reportEntity = (ReportEntity) returnValue.getData();
String reportName = map.get("reportName"); String reportName = reportEntity.getName();
entity.setReportName(reportName); entity.setReportName(reportName);
ReportVo vo = (ReportVo) args[0]; ReportEntity vo = (ReportEntity) args[0];
if (StringUtils.isNotEmpty(vo.getId())) { if (StringUtils.isEmpty(vo.getId())) {
entity.setDescription("新增"); entity.setDescription("新增");
} else { } else {
entity.setDescription("编辑"); entity.setDescription("编辑");
@@ -31,4 +31,24 @@ public class PowerApplyConstants {
* 总监levelId值 暂定 <=0.5 * 总监levelId值 暂定 <=0.5
*/ */
public static final Double DIRECTOR_LEVEL = 0.5; public static final Double DIRECTOR_LEVEL = 0.5;
/**
* 有预览和下载全部报告权限的levelId
*/
public static final Double SPECIAL_LEVEL_ONE = 1.0;
/**
* 有预览和下载全部报告权限的levelId
*/
public static final Double SPECIAL_LEVEL_TWO = 2.0;
/**
* 有预览和下载全部报告权限的levelId
*/
public static final Double SPECIAL_LEVEL_THREE = 3.0;
/**
* 有预览和下载全部报告权限的levelId
*/
public static final Double SPECIAL_LEVEL_FOUL = 4.0;
} }
@@ -6,9 +6,11 @@ import com.adc.da.report.annotation.ReportLog;
import com.adc.da.report.dao.mysql.ReportDao; import com.adc.da.report.dao.mysql.ReportDao;
import com.adc.da.report.dao.mysql.ReportLogBookDao; import com.adc.da.report.dao.mysql.ReportLogBookDao;
import com.adc.da.report.eo.FileEntity; import com.adc.da.report.eo.FileEntity;
import com.adc.da.report.eo.LogEntity;
import com.adc.da.report.eo.ReportEntity; import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.eo.ReportLogBook; import com.adc.da.report.eo.ReportLogBook;
import com.adc.da.report.service.IFileService; import com.adc.da.report.service.IFileService;
import com.adc.da.report.service.ILogService;
import com.adc.da.report.service.IReportService; import com.adc.da.report.service.IReportService;
import com.adc.da.report.util.LocalFileUtil; import com.adc.da.report.util.LocalFileUtil;
import com.adc.da.report.util.OSSClientUtil; import com.adc.da.report.util.OSSClientUtil;
@@ -90,6 +92,8 @@ public class ReportManageConroller {
@Resource @Resource
private WaterMarkUtil waterMarkUtil; private WaterMarkUtil waterMarkUtil;
@Resource
private ILogService logService;
/** /**
* 新增或编辑报告 * 新增或编辑报告
* 弃用 * 弃用
@@ -124,11 +128,12 @@ public class ReportManageConroller {
*/ */
@ApiOperation("新增或编辑报告") @ApiOperation("新增或编辑报告")
@PostMapping("/saveOrUpdate") @PostMapping("/saveOrUpdate")
// @ReportLog(description = "新增或编辑") @ReportLog(description = "新增或编辑")
public ResponseMessage saveOrUpdate(@RequestBody ReportEntity reportEntity) throws IOException { public ResponseMessage saveOrUpdate(@RequestBody ReportEntity reportEntity) throws IOException {
ReportEntity re = new ReportEntity();
reportService.addOrUpdate(reportEntity); BeanUtils.copyProperties(reportEntity,re);
return Result.success(); reportService.addOrUpdate(re);
return Result.success(reportEntity);
} }
/** /**
* 判断报告名称是否被占用 * 判断报告名称是否被占用
@@ -534,9 +539,26 @@ public class ReportManageConroller {
reportLog.setUpdateTime(new Date()); reportLog.setUpdateTime(new Date());
reportLog.setUserId(UserUtils.getUserId()); reportLog.setUserId(UserUtils.getUserId());
reportLogBookDao.insert(reportLog); reportLogBookDao.insert(reportLog);
//报告日志管理
ReportEntity reportEntity = reportDao.selectById(repostId);
reportLog(reportEntity.getName(),"下载");
} }
} }
public void reportLog(String reportName,String desc){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LogEntity entity = new LogEntity();
entity.setAccount(UserUtils.getUser().getAccount());
entity.setClassName("com.adc.da.report.controller.ReportManageConroller");
entity.setOperateTime(format.format(new Date()));
entity.setMethod("downloadPic");
entity.setUsid(UserUtils.getUserId());
entity.setReportName(reportName);
entity.setDescription(desc);
logService.insert(entity);
}
/** /**
* 权限审批流程 添加报告按钮 可添加的报告 * 权限审批流程 添加报告按钮 可添加的报告
@@ -70,8 +70,14 @@ public class IReportContentServiceImpl extends ServiceImpl<ReportContentDao, Rep
//解析出内容 //解析出内容
String content = FileContentUtil.readFileContent(file); String content = FileContentUtil.readFileContent(file);
//将内容存入 //将内容存入
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, content); ReportContentEntity reportContent = query().eq("report_id", reportId).one();
save(reportContentEntity); if (reportContent == null) {
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, content);
save(reportContentEntity);
} else {
reportContent.setReportContent(content);
saveOrUpdate(reportContent);
}
//将文件删除 //将文件删除
outputStream.close(); outputStream.close();
FileUtil.deleteFile(path); FileUtil.deleteFile(path);
@@ -16,8 +16,10 @@ import com.adc.da.report.vo.ReportQueryVo;
import com.adc.da.report.vo.ReportVo; import com.adc.da.report.vo.ReportVo;
import com.adc.da.sys.dao.mysql.RoleEODao; import com.adc.da.sys.dao.mysql.RoleEODao;
import com.adc.da.sys.dao.mysql.UserEODao; import com.adc.da.sys.dao.mysql.UserEODao;
import com.adc.da.sys.entity.OrgEO;
import com.adc.da.sys.entity.RoleEO; import com.adc.da.sys.entity.RoleEO;
import com.adc.da.sys.entity.UserEO; import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.service.OrgEOService;
import com.adc.da.util.http.ResponseMessage; import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result; import com.adc.da.util.http.Result;
import com.adc.da.util.utils.CollectionUtils; import com.adc.da.util.utils.CollectionUtils;
@@ -118,6 +120,10 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
@Resource @Resource
private UserEODao userEODao; private UserEODao userEODao;
@Resource
private OrgEOService orgEOService;
@Resource
private ILogService logService;
@Override @Override
@@ -213,9 +219,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
}); });
} }
//插入报表内容表
iReportContentService.insertReportContent(entity.getId(), entity.getFileId());
CommonUtils.threadPoolExecutor().execute(() -> { CommonUtils.threadPoolExecutor().execute(() -> {
//生成html //生成html
try { try {
@@ -353,6 +356,10 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
log.info(key + "已经删除"); log.info(key + "已经删除");
nameList.add(entity.getName()); nameList.add(entity.getName());
} }
//删除报告内容表中的记录
LambdaQueryWrapper<ReportContentEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.in(ReportContentEntity::getReportId, idList);
iReportContentService.remove(wrapper);
return nameList; return nameList;
} }
@@ -454,7 +461,8 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
//用户级别 //用户级别
double level = Double.parseDouble(levelId); double level = Double.parseDouble(levelId);
//总监拥有全部报告的预览和下载权力 //总监拥有全部报告的预览和下载权力
if (level <= DIRECTOR_LEVEL) { if (level == SPECIAL_LEVEL_ONE || level == SPECIAL_LEVEL_TWO ||
level == SPECIAL_LEVEL_THREE || level == SPECIAL_LEVEL_FOUL) {
list.getRecords().forEach(reportVo -> { list.getRecords().forEach(reportVo -> {
reportVo.setPower(PREVIEW_DOWNLOAD); reportVo.setPower(PREVIEW_DOWNLOAD);
}); });
@@ -466,7 +474,7 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
powerList.add(PREVIEW); powerList.add(PREVIEW);
powerList.add(DOWNLOAD); powerList.add(DOWNLOAD);
LambdaQueryWrapper<PowerApply> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PowerApply> wrapper = new LambdaQueryWrapper<>();
wrapper.in(PowerApply::getReportId, list.getRecords().stream().map(ReportVo::getId).collect(Collectors.toList())); wrapper.in(CollectionUtils.isNotEmpty(list.getRecords()) ,PowerApply::getReportId, list.getRecords().stream().map(ReportVo::getId).collect(Collectors.toList()));
wrapper.in(PowerApply::getPower, powerList); wrapper.in(PowerApply::getPower, powerList);
wrapper.eq(PowerApply::getUserId, UserUtils.getUserId()); wrapper.eq(PowerApply::getUserId, UserUtils.getUserId());
wrapper.eq(PowerApply::getDelFlag, 0); wrapper.eq(PowerApply::getDelFlag, 0);
@@ -477,25 +485,23 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
//设置权限 //设置权限
list.getRecords().forEach(reportVo -> { list.getRecords().forEach(reportVo -> {
//无权限要求的报告自带预览权限
if (reportVo.getConfidentialLevel().equals(PUBLIC_REPORT) &&
reportVo.getPrivacyLevel().equals(NO_USER_PRIVACY_INVOLVED)) {
reportVo.setPower(PREVIEW);
} else {
reportVo.setPower(NONE);
}
List<PowerApply> powerApplies = reportPowerMap.get(reportVo.getId()); List<PowerApply> powerApplies = reportPowerMap.get(reportVo.getId());
if (powerApplies != null) { if (powerApplies != null) {
if (powerApplies.size() == 1) { //只有当PA表只有一条申请的权限且并不是公开表的时候才给权限
if (powerApplies.size() == 1 && reportVo.getPower().equals(NONE)) {
reportVo.setPower(powerApplies.get(0).getPower()); reportVo.setPower(powerApplies.get(0).getPower());
} else { } else {
reportVo.setPower(PREVIEW_DOWNLOAD); reportVo.setPower(PREVIEW_DOWNLOAD);
} }
} }
//只有用户没有权限的时候才给默认权限
if (reportVo.getPower() == null) {
//其余人员只能预览公开报告(涉密等级:公开(内部公开)、隐私等级:不涉及用户隐私)
if (reportVo.getConfidentialLevel().equals(PUBLIC_REPORT) &&
reportVo.getPrivacyLevel().equals(NO_USER_PRIVACY_INVOLVED)) {
reportVo.setPower(PREVIEW);
} else {
reportVo.setPower(NONE);
}
}
//如果上传人是自己也有预览下载权限 //如果上传人是自己也有预览下载权限
if (UserUtils.getUserId().equals(reportVo.getCreateUserId())) { if (UserUtils.getUserId().equals(reportVo.getCreateUserId())) {
reportVo.setPower(PREVIEW_DOWNLOAD); reportVo.setPower(PREVIEW_DOWNLOAD);
@@ -627,7 +633,8 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
//总监(levelId) //总监(levelId)
UserEO userEo = userEODao.selectById(userId); UserEO userEo = userEODao.selectById(userId);
Double levelId = Double.parseDouble(userEo.getLevelId() == null ? "1.0" : userEo.getLevelId()); Double levelId = Double.parseDouble(userEo.getLevelId() == null ? "1.0" : userEo.getLevelId());
if (levelId <= DIRECTOR_LEVEL) { if (levelId.equals(SPECIAL_LEVEL_ONE) || levelId.equals(SPECIAL_LEVEL_TWO) ||
levelId.equals(SPECIAL_LEVEL_THREE) || levelId.equals(SPECIAL_LEVEL_FOUL)) {
return true; return true;
} }
//本人 //本人
@@ -671,6 +678,15 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
@Override @Override
public ResponseMessage reportDetail(String reportId) { public ResponseMessage reportDetail(String reportId) {
ReportDetailVo reportDetailVo = reportDao.reportDetail(reportId); ReportDetailVo reportDetailVo = reportDao.reportDetail(reportId);
//设置部门名称
String department = reportDetailVo.getDepartment();
String[] idArray = department.split(",");
List<OrgEO> orgEOList = orgEOService.query().in("ID", idArray).list();
if (CollectionUtils.isNotEmpty(orgEOList)) {
String departmentName = orgEOList.stream().map(OrgEO::getOrgName).collect(Collectors.joining(","));
reportDetailVo.setDepartmentName(departmentName);
}
//设置标签列表 //设置标签列表
LambdaQueryWrapper<ReportLabelEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ReportLabelEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ReportLabelEntity::getReportId, reportId); wrapper.eq(ReportLabelEntity::getReportId, reportId);
@@ -708,9 +724,24 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
reportDetailVo.setDownPower(1); reportDetailVo.setDownPower(1);
} }
} }
//报告日志管理
reportLog(reportDetailVo.getName(),"预览");
return Result.success(reportDetailVo); return Result.success(reportDetailVo);
} }
public void reportLog(String reportName,String desc){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LogEntity entity = new LogEntity();
entity.setAccount(UserUtils.getUser().getAccount());
entity.setClassName("com.adc.da.report.service.impl.IReportServiceImpl");
entity.setOperateTime(format.format(new Date()));
entity.setMethod("reportDetail");
entity.setUsid(UserUtils.getUserId());
entity.setReportName(reportName);
entity.setDescription(desc);
logService.insert(entity);
}
/** /**
* 创建htmlstring * 创建htmlstring
* *
@@ -2,11 +2,14 @@ package com.adc.da.report.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.PowerApplyDao; import com.adc.da.report.dao.mysql.PowerApplyDao;
import com.adc.da.report.dao.mysql.ReportDao; import com.adc.da.report.dao.mysql.ReportDao;
import com.adc.da.report.dao.mysql.TtReportManageActDao; import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.eo.LogEntity;
import com.adc.da.report.eo.ReportEntity; import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.eo.TtReportManageAct; import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.service.ILogService;
import com.adc.da.report.service.IReportContentService; import com.adc.da.report.service.IReportContentService;
import com.adc.da.report.service.ITtReportManageActService; import com.adc.da.report.service.ITtReportManageActService;
import com.adc.da.report.vo.DeleteParamRequestVO; import com.adc.da.report.vo.DeleteParamRequestVO;
@@ -22,7 +25,9 @@ import org.springframework.util.ObjectUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -38,6 +43,9 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
@Autowired @Autowired
ReportDao reportDao; ReportDao reportDao;
@Resource
private ILogService logService;
@Autowired @Autowired
PowerApplyDao powerApplyDao; PowerApplyDao powerApplyDao;
@@ -128,25 +136,42 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
@Override @Override
public void saveOrUpdataReport(TtReportManageAct ttReportManageAct) { public void saveOrUpdataReport(TtReportManageAct ttReportManageAct) {
//插入报表内容表 ReportEntity reportEntity = reportDao.selectById(ttReportManageAct.getDataId());
if (reportEntity == null){
//保存报告
reportDao.saveReportAct(ttReportManageAct);
reportLog(ttReportManageAct.getName(),"新增");
}else {
//更改
ReportEntity reportEntity1 = new ReportEntity();
BeanUtil.copyProperties(ttReportManageAct,reportEntity1);
reportEntity1.setId(ttReportManageAct.getDataId());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
reportEntity1.setCreateDate(sdf.format(ttReportManageAct.getCreateDate()));
reportEntity1.setUpdateDate(sdf.format(ttReportManageAct.getUpdateDate()));
reportDao.updateById(reportEntity1);
reportLog(reportEntity.getName(),"修改");
}
try { try {
iReportContentService.insertReportContent(ttReportManageAct.getDataId(), ttReportManageAct.getFileId()); iReportContentService.insertReportContent(ttReportManageAct.getDataId(), ttReportManageAct.getFileId());
log.info("抽取报告内容"); log.info("抽取报告内容");
} catch (IOException e) { } catch (IOException e) {
log.error("获取报告内容失败", e); log.error("获取报告内容失败", e);
} }
ReportEntity reportEntity = reportDao.selectById(ttReportManageAct.getDataId());
if (reportEntity == null){
//保存报告
reportDao.saveReportAct(ttReportManageAct);
}else {
//更改
ReportEntity reportEntity1 = new ReportEntity();
BeanUtil.copyProperties(ttReportManageAct,reportEntity1);
reportEntity1.setId(ttReportManageAct.getDataId());
reportDao.updateById(reportEntity);
}
} }
public void reportLog(String reportName,String desc){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LogEntity entity = new LogEntity();
entity.setAccount(UserUtils.getUser().getAccount());
entity.setClassName("com.adc.da.report.service.impl.ITtReportManageActServiceImpl");
entity.setOperateTime(format.format(new Date()));
entity.setMethod("saveOrUpdataReport");
entity.setUsid(UserUtils.getUserId());
entity.setReportName(reportName);
entity.setDescription(desc);
logService.insert(entity);
}
} }
@@ -1,6 +1,7 @@
package com.adc.da.report.service.impl; package com.adc.da.report.service.impl;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.PowerApplyActDao; import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.eo.PowerApplyAct; import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.service.IPowerApplyActService; import com.adc.da.report.service.IPowerApplyActService;
@@ -71,6 +72,8 @@ public class IpowerApplyActServiceImpl extends ServiceImpl<PowerApplyActDao, Pow
*/ */
public void saveOrUpdateSingle(PowerApplyAct powerApplyAct) { public void saveOrUpdateSingle(PowerApplyAct powerApplyAct) {
if (StringUtils.isEmpty(powerApplyAct.getId())) { if (StringUtils.isEmpty(powerApplyAct.getId())) {
powerApplyAct.setCreateUserId(UserUtils.getUserId());
powerApplyAct.setUserId(UserUtils.getUserId());
baseMapper.insert(powerApplyAct); baseMapper.insert(powerApplyAct);
} else { } else {
baseMapper.updateById(powerApplyAct); baseMapper.updateById(powerApplyAct);
@@ -38,16 +38,6 @@ public class ReportCommentVo {
*/ */
private String userName; private String userName;
/**
* 部门id
*/
private String orgId;
/**
* 部门名
*/
private String orgName;
/** /**
* 评论 * 评论
*/ */
@@ -174,7 +174,7 @@
</select> </select>
<select id="reportManagerPage" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo"> <select id="reportManagerPage" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
SELECT SELECT DISTINCT
t.id, t.id,
t.year, t.year,
t.name, t.name,
@@ -282,7 +282,6 @@
rm.keycontent AS keycontent, rm.keycontent AS keycontent,
rm.maincontent AS maincontent, rm.maincontent AS maincontent,
rm.department AS department, rm.department AS department,
org.org_name as departmentName,
rm.`year` AS `year`, rm.`year` AS `year`,
rm.fileId AS fileId, rm.fileId AS fileId,
f.file_name as fileName, f.file_name as fileName,
@@ -10,16 +10,14 @@
ruc.user_id AS userId, ruc.user_id AS userId,
u.USNAME AS userName, u.USNAME AS userName,
ruc.comment AS comment, ruc.comment AS comment,
ruc.create_time AS createTime, ruc.create_time AS createTime
o.ORG_NAME AS orgName
FROM FROM
`ts_report_user_comment` AS ruc `ts_report_user_comment` AS ruc
INNER JOIN ts_user AS u ON u.USID = ruc.user_id INNER JOIN ts_user AS u ON u.USID = ruc.user_id
LEFT JOIN tr_user_org AS uo ON uo.USER_ID = ruc.user_id
LEFT JOIN ts_org AS o ON uo.ORG_ID = o.ID
WHERE WHERE
ruc.del_flag = 0 ruc.del_flag = 0
AND AND
ruc.report_id = #{dto.reportId} ruc.report_id = #{dto.reportId}
ORDER BY ruc.create_time DESC
</select> </select>
</mapper> </mapper>
@@ -5,6 +5,7 @@ import com.adc.da.excel.poi.excel.ExcelImportUtil;
import com.adc.da.excel.poi.excel.entity.ImportParams; import com.adc.da.excel.poi.excel.entity.ImportParams;
import com.adc.da.sys.constant.SysConstants; import com.adc.da.sys.constant.SysConstants;
import com.adc.da.sys.dao.mysql.UserOrgEODao; import com.adc.da.sys.dao.mysql.UserOrgEODao;
import com.adc.da.sys.entity.OrgEO;
import com.adc.da.sys.entity.UserEO; import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.entity.UserOrgEO; import com.adc.da.sys.entity.UserOrgEO;
import com.adc.da.sys.service.iservice.IUserEoService; import com.adc.da.sys.service.iservice.IUserEoService;
@@ -240,4 +241,13 @@ public class UserEOController extends BaseController<UserEO> {
} }
@ApiOperation(value = "查询自己领导")
@GetMapping("getOwnLeader")
public ResponseMessage getOwnLeader(String userId){
UserEO userEoById = userEOService.getUserEoById(userId);
List<OrgEO> orgEOList = userEoById.getOrgEOList();
List<UserEO> leaderList = userEOService.getOwnLeader(orgEOList);
return Result.success(leaderList);
}
} }
@@ -1,5 +1,6 @@
package com.adc.da.sys.dao.mysql; package com.adc.da.sys.dao.mysql;
import com.adc.da.sys.entity.OrgEO;
import com.adc.da.sys.entity.UserEO; import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.vo.UserVO; import com.adc.da.sys.vo.UserVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -44,4 +45,6 @@ public interface UserEODao extends BaseMapper<UserEO> {
UserEO getUserEoById(@Param("usid") String usid); UserEO getUserEoById(@Param("usid") String usid);
UserEO selectUserByIdNodel(String userId); UserEO selectUserByIdNodel(String userId);
List<UserEO> getOwnLeader(@Param("Vo") List<OrgEO> orgEOList);
} }
@@ -149,4 +149,6 @@ public class UserEO extends BaseEntity implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String roleId; private String roleId;
@TableField("EMPLOYEE_TYPE_ID")
private String employeeTypeId;
} }
@@ -5,10 +5,7 @@ import com.adc.da.sys.constant.UserBelongEnum;
import com.adc.da.sys.dao.mysql.UserEODao; import com.adc.da.sys.dao.mysql.UserEODao;
import com.adc.da.sys.dao.mysql.UserOrgEODao; import com.adc.da.sys.dao.mysql.UserOrgEODao;
import com.adc.da.sys.dao.mysql.UserRoleEODao; import com.adc.da.sys.dao.mysql.UserRoleEODao;
import com.adc.da.sys.entity.RoleEO; import com.adc.da.sys.entity.*;
import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.entity.UserOrgEO;
import com.adc.da.sys.entity.UserRoleEO;
import com.adc.da.sys.service.iservice.IUserEoService; import com.adc.da.sys.service.iservice.IUserEoService;
import com.adc.da.sys.util.EncryptUtil; import com.adc.da.sys.util.EncryptUtil;
import com.adc.da.sys.vo.UserImportVO; import com.adc.da.sys.vo.UserImportVO;
@@ -335,6 +332,11 @@ public class UserEOServiceImpl implements IUserEoService {
return dao.selectUserByIdNodel(userId); return dao.selectUserByIdNodel(userId);
} }
@Override
public List<UserEO> getOwnLeader(List<OrgEO> orgEOList) {
return dao.getOwnLeader(orgEOList);
}
void checkExcel(List<UserImportVO> list) { void checkExcel(List<UserImportVO> list) {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
throw new AdcDaBaseException("数据不能为空"); throw new AdcDaBaseException("数据不能为空");
@@ -1,5 +1,6 @@
package com.adc.da.sys.service.iservice; package com.adc.da.sys.service.iservice;
import com.adc.da.sys.entity.OrgEO;
import com.adc.da.sys.entity.UserEO; import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.vo.UserImportVO; import com.adc.da.sys.vo.UserImportVO;
import com.adc.da.sys.vo.UserVO; import com.adc.da.sys.vo.UserVO;
@@ -67,4 +68,6 @@ public interface IUserEoService {
* @return * @return
*/ */
UserEO getUserByIdNodel(String userId); UserEO getUserByIdNodel(String userId);
List<UserEO> getOwnLeader(List<OrgEO> orgEOList);
} }
@@ -55,4 +55,5 @@ public class UserVO {
*/ */
private List<OrgEO> orgEOList = new ArrayList(); private List<OrgEO> orgEOList = new ArrayList();
private String employeeTypeId;
} }
@@ -48,9 +48,13 @@
<select id="selectCountByOrgCode" resultType="java.lang.Long"> <select id="selectCountByOrgCode" resultType="java.lang.Long">
select count(1) from TS_ORG select count(1) from TS_ORG
<where> <where>
status = 1
<if test="pageVO.orgCode != null and pageVO.orgCode != ''"> <if test="pageVO.orgCode != null and pageVO.orgCode != ''">
and org_code = #{pageVO.orgCode} and org_code = #{pageVO.orgCode}
</if> </if>
<if test="pageVO.id != null and pageVO.id != ''">
and id != #{pageVO.id}
</if>
</where> </where>
</select> </select>
</mapper> </mapper>
@@ -256,6 +256,17 @@
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="getOwnLeader" resultType="com.adc.da.sys.entity.UserEO">
select u.* from ts_user u
LEFT JOIN tr_user_org uo on u.usid = uo.USER_ID
<where>
uo.org_id in
<foreach collection="Vo" item="item" open="(" separator="," close=")">
#{item.Id}
</foreach>
and (u.level_id=5 or u.level_id=9) and u.employee_type_id = 1
</where>
</select>
</mapper> </mapper>
@@ -48,9 +48,13 @@
<select id="selectCountByOrgCode" resultType="java.lang.Long"> <select id="selectCountByOrgCode" resultType="java.lang.Long">
select count(1) from TS_ORG select count(1) from TS_ORG
<where> <where>
status = 1
<if test="pageVO.orgCode != null and pageVO.orgCode != ''"> <if test="pageVO.orgCode != null and pageVO.orgCode != ''">
and org_code = #{pageVO.orgCode} and org_code = #{pageVO.orgCode}
</if> </if>
<if test="pageVO.id != null and pageVO.id != ''">
and id != #{pageVO.id}
</if>
</where> </where>
</select> </select>
</mapper> </mapper>
@@ -33,6 +33,7 @@ import java.text.SimpleDateFormat;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
@Api(tags = "流程明细管理") @Api(tags = "流程明细管理")
@@ -76,7 +77,8 @@ public class TaskController {
List<Map<String,Object>> list = ActivitiTools.turnHistoricTaskInstance(list2); List<Map<String,Object>> list = ActivitiTools.turnHistoricTaskInstance(list2);
List<Map<String, Object>> relistMap = new ArrayList<>(); List<Map<String, Object>> relistMap = new ArrayList<>();
for (Map<String, Object> historicTaskInstance : list) { for (int j = 0; j < list.size(); j++) {
Map<String, Object> historicTaskInstance = list.get(j);
// 获取办理的历史信息 // 获取办理的历史信息
if(historicTaskInstance.get("assignee") == null) { if(historicTaskInstance.get("assignee") == null) {
String taskId = historicTaskInstance.get("id").toString(); String taskId = historicTaskInstance.get("id").toString();
@@ -120,19 +122,42 @@ public class TaskController {
map.put("prcType",one.getPrcType()); map.put("prcType",one.getPrcType());
map.put("prcName",one.getPrcName()); map.put("prcName",one.getPrcName());
map.put("prcNum",one.getPrcNum()); map.put("prcNum",one.getPrcNum());
Date createTime = busProcessEntrust.getCreateTime(); Date createTime1 = busProcessEntrust.getCreateTime();
LocalDateTime dt = LocalDateTime.ofInstant(busProcessEntrust.getCreateTime().toInstant(), ZoneId.systemDefault());
String createTime = dt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
map.put("createTime",createTime); map.put("createTime",createTime);
map.put("approvalOpinion",busProcessEntrust.getApprovalOpinion()); map.put("approvalOpinion",busProcessEntrust.getApprovalOpinion());
if (i+1 != EOS.size()){ if (i+1 != EOS.size()){
BusProcessEntrust busProcessEntrust1 = EOS.get(i + 1); BusProcessEntrust busProcessEntrust1 = EOS.get(i + 1);
Date endTime = busProcessEntrust1.getCreateTime(); LocalDateTime en =
LocalDateTime.ofInstant(busProcessEntrust1.getCreateTime().toInstant(), ZoneId.systemDefault());
String endTime = en.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
map.put("endTime",endTime); map.put("endTime",endTime);
//long approvalTime = disposeApprovalTime(createTime,endTime); LocalDateTime startDateTime =
LocalDateTime startDateTime = LocalDateTime.ofInstant(createTime.toInstant(), ZoneId.systemDefault()); LocalDateTime.ofInstant(busProcessEntrust1.getCreateTime().toInstant(),
LocalDateTime endDateTime = LocalDateTime.ofInstant(endTime.toInstant(), ZoneId.systemDefault()); ZoneId.systemDefault());
LocalDateTime endDateTime = LocalDateTime.ofInstant(busProcessEntrust1.getCreateTime().toInstant(), ZoneId.systemDefault());
long days = Duration.between(startDateTime.toLocalDate().atStartOfDay(), endDateTime.toLocalDate().atStartOfDay()).toDays() + 1; long days = Duration.between(startDateTime.toLocalDate().atStartOfDay(), endDateTime.toLocalDate().atStartOfDay()).toDays() + 1;
historicTaskInstance.put("approvalTime",days + ""); map.put("approvalTime",days + "");
}else { }else {
if (j+1<list.size()){
Map<String, Object> stringObjectMap = list.get(j + 1);
Object create = stringObjectMap.get("createTime");
if(create!=null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date endTime = sdf.parse((String)create);
LocalDateTime en =
LocalDateTime.ofInstant(endTime.toInstant(), ZoneId.systemDefault());
String endTimestr = en.format(DateTimeFormatter.ofPattern("yyyy-MM-dd " +
"HH:mm:ss"));
map.put("endTime",endTimestr);
LocalDateTime startDateTime = LocalDateTime.ofInstant(createTime1.toInstant()
, ZoneId.systemDefault());
LocalDateTime endDateTime = LocalDateTime.ofInstant(endTime.toInstant(), ZoneId.systemDefault());
long days = Duration.between(startDateTime.toLocalDate().atStartOfDay(), endDateTime.toLocalDate().atStartOfDay()).toDays() + 1;
map.put("approvalTime",days + "");
}
}
QueryWrapper<BusProcessApprove> datasQueryWrapper = new QueryWrapper<>(); QueryWrapper<BusProcessApprove> datasQueryWrapper = new QueryWrapper<>();
datasQueryWrapper.lambda().eq(BusProcessApprove::getTaskId,historicTaskInstance.get("id")); datasQueryWrapper.lambda().eq(BusProcessApprove::getTaskId,historicTaskInstance.get("id"));
List<BusProcessApprove> approveList = iBusProcessApproveService.list(datasQueryWrapper); List<BusProcessApprove> approveList = iBusProcessApproveService.list(datasQueryWrapper);
@@ -921,8 +921,11 @@ public class TodoTaskController {
queryWrapper.orderByDesc("CREAT_TIME"); queryWrapper.orderByDesc("CREAT_TIME");
queryWrapper.isNotNull("PRC_ID"); queryWrapper.isNotNull("PRC_ID");
queryWrapper.isNotNull("PRC_NUM"); queryWrapper.isNotNull("PRC_NUM");
queryWrapper.lambda().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.SUBMIT.getValue()) queryWrapper.and((wrapper)->{
.or().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue()); wrapper.lambda().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.SUBMIT.getValue())
.or().
eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue());
});
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper); List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
Page page = new Page(); Page page = new Page();
@@ -1109,9 +1112,11 @@ public class TodoTaskController {
if (taskCommonQuery.getPrcType() != null && !taskCommonQuery.getPrcType().equals("")) { if (taskCommonQuery.getPrcType() != null && !taskCommonQuery.getPrcType().equals("")) {
queryWrapper.eq("PRC_TYPE", taskCommonQuery.getPrcType()); queryWrapper.eq("PRC_TYPE", taskCommonQuery.getPrcType());
} }
queryWrapper.and((wrapper)->{
queryWrapper.lambda().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.SUBMIT.getValue()) wrapper.lambda().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.SUBMIT.getValue())
.or().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue()); .or().
eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue());
});
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper); List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -54,6 +55,7 @@ public class BusProcessEntrust implements Serializable {
private String prcName; private String prcName;
@TableField("CREATE_TIME") @TableField("CREATE_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime = new Date(System.currentTimeMillis());; private Date createTime = new Date(System.currentTimeMillis());;
@TableField("VALID_FLAG") @TableField("VALID_FLAG")