Merge branch 'master' into lixuetao

# Conflicts:
#	adc-da-report/src/main/java/com/adc/da/report/dao/mysql/PowerApplyActDao.java
This commit is contained in:
bupengxiang
2023-05-04 16:34:39 +08:00
47 changed files with 1119 additions and 487 deletions
@@ -2,8 +2,10 @@ package com.adc.da.report.controller;
import com.adc.da.report.eo.PowerApply;
import com.adc.da.report.service.IPowerApplyActService;
import com.adc.da.report.service.IPowerApplyService;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyActPageVO;
import com.adc.da.report.vo.PowerApplyPageVO;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result;
@@ -32,6 +34,9 @@ public class PowerApplyController {
@Autowired
private IPowerApplyService powerApplyService;
@Autowired
private IPowerApplyActService iPowerApplyActService;
/**
* @param powerApplyPageVO
* @return com.adc.da.util.http.ResponseMessage
@@ -107,7 +112,7 @@ public class PowerApplyController {
* @date 2023-04-23
* @description 根据id或id数组进行删除
*/
@DeleteMapping("/delete")
@PostMapping("/delete")
@ApiOperation(value = "单条/批量删除数据")
public ResponseMessage delete(@RequestBody DeleteParamRequestVO deleteParamRequestVO){
@@ -115,4 +120,20 @@ public class PowerApplyController {
powerApplyService.deleteById(deleteParamRequestVO);
return Result.success();
}
/**
* @param deleteParamRequestVO
* @return com.adc.da.util.http.ResponseMessage
* @author bu
* @date 2023-04-23
* @description 根据id或id数组进行删除
*/
@PostMapping("/deleteAct")
@ApiOperation(value = "单条/批量删除数据")
public ResponseMessage deleteAct(@RequestBody PowerApplyActPageVO powerApplyActPageVO){
//单条/批量删除数据
iPowerApplyActService.deleteByListPower(powerApplyActPageVO);
return Result.success();
}
}
@@ -1,10 +1,12 @@
package com.adc.da.report.controller;
import com.adc.da.report.annotation.ReportLog;
import com.adc.da.report.dao.mysql.ReportDao;
import com.adc.da.report.eo.FileEntity;
import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.service.IFileService;
import com.adc.da.report.service.IReportService;
import com.adc.da.report.util.LocalFileUtil;
import com.adc.da.report.util.OSSClientUtil;
import com.adc.da.report.util.ObsBootUtil;
import com.adc.da.report.vo.ReportQueryVo;
@@ -26,6 +28,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -62,9 +65,14 @@ public class ReportManageConroller {
@Autowired
private ObsBootUtil obsBootUtil;
@Autowired
private LocalFileUtil localFileUtil;
@Value("${uploadType}")
private String uploadType;
@Autowired
private ReportDao reportDao;
/**
* 新增或编辑报告
@@ -74,28 +82,37 @@ public class ReportManageConroller {
@ApiOperation("新增或编辑报告")
@PostMapping("/add")
@ReportLog(description = "新增或编辑")
public ResponseMessage add(@RequestBody ReportVo vo) {
public ResponseMessage add(@RequestBody ReportVo vo) throws IOException {
Map<String, Object> map = new HashMap<>();
ReportEntity entity = new ReportEntity();
BeanUtils.copyProperties(vo, entity);
/**
* 名称不能重复
*/
long count = reportDao.selectByidAndName(entity);
if (count>0){
return Result.error("报告名称已存在");
}
String name = reportService.insert(entity, vo.getLabelList());
Map<String, Object> map = new HashMap<>();
map.put("reportName", name);
return Result.success(map);
}
/**
* 报告列表
* 报告管理列表
* @param vo
* @return
* @throws Exception
*/
@ApiOperation("报告列表")
@PostMapping("/list")
public ResponseMessage list(@RequestBody ReportQueryVo vo) throws Exception {
IPage<ReportVo> list = reportService.list(vo);
@ApiOperation("报告管理列表")
@PostMapping("/reportManagerPage")
public ResponseMessage reportManagerPage(@RequestBody ReportQueryVo vo) throws Exception {
IPage<ReportVo> list = reportService.reportManagerPage(vo);
return Result.success(list);
}
/**
* 报告列表
* @param vo
@@ -109,19 +126,6 @@ public class ReportManageConroller {
return Result.success(list);
}
/**
* 报告列表(带权限验证)
* @param vo
* @return
* @throws Exception
*/
@ApiOperation("报告列表(带权限)")
@PostMapping("/list-auth")
public ResponseMessage listWithAuth(@RequestBody ReportQueryVo vo) throws Exception {
IPage<ReportVo> list = reportService.list(vo);
return Result.success(list);
}
/**
* 删除报告
* @param ids id
@@ -174,7 +178,17 @@ public class ReportManageConroller {
stringRedisTemplate.boundValueOps("1121212").set("1212");
}
@ApiOperation("testPath")
@GetMapping("/testPath")
@Deprecated
public ResponseMessage testPath() throws URISyntaxException {
HashMap<String, String> pathMap = new HashMap<>();
String jarPath = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile().getPath();
String property = System.getProperty("user.dir");
pathMap.put("jarpath", jarPath);
pathMap.put("propertyPath", property);
return Result.success(pathMap);
}
/**
* 上传文件
@@ -209,10 +223,12 @@ public class ReportManageConroller {
try{
String result="";
// 上传方式:阿里云:alioss 华为云:hwobs
if (uploadType.equals("hwobs")){
if ("hwobs".equals(uploadType)){
result = obsBootUtil.upload(file, fileName);
}else if (uploadType.equals("alioss")){
}else if ("alioss".equals(uploadType)) {
result = ossClientUtil.uploadFile2OSS(file.getInputStream(),fileName);
}else if ("local".equals(uploadType)) {
localFileUtil.saveFile(file.getInputStream(), fileName);
}
resultMap.put("key", date + num);
resultMap.put("value", path + "//" + fileName);
@@ -324,10 +340,12 @@ public class ReportManageConroller {
response.setContentType("application/x-download");
// File file = new File(uploadFile, entity.getSavePath());
// 上传方式:阿里云:alioss 华为云:hwobs
if (uploadType.equals("hwobs")){
if ("hwobs".equals(uploadType)){
obsBootUtil.downFile(entity.getSavePath(), response);
}else if (uploadType.equals("alioss")){
}else if ("alioss".equals(uploadType)){
ossClientUtil.downloadFileFromOSS(entity.getSavePath(),response);
}else if ("local".equals(uploadType)){
localFileUtil.downFile(entity.getSavePath(), response);
}
} catch (Exception ex) {
@@ -348,4 +366,16 @@ public class ReportManageConroller {
return Result.success(reportVoIPage);
}
/**
* 判断报告是否在流程中
* @return
* @throws ParseException
*/
@ApiOperation("判断报告是否在流程中")
@PostMapping("/isAct")
public ResponseMessage isAct(@RequestBody ReportQueryVo vo) throws Exception {
List<String> act = reportService.isAct(vo);
return Result.success(act);
}
}
@@ -47,4 +47,7 @@ public interface PowerApplyActDao extends BaseMapper<PowerApplyAct> {
List<PowerApplyActPageVO> selectListBydataId(@Param("dataId")String dataId);
List<PowerApplyActPageVO> selectListBydataIdNodel(@Param("dataId")String dataId);
int batchDel(@Param("ids") List<String> ids);
}
@@ -0,0 +1,18 @@
package com.adc.da.report.dao.mysql;
import com.adc.da.report.eo.ReportContentEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author ThinkBook
* @description 针对表【ts_report_content】的数据库操作Mapper
* @createDate 2023-04-27 11:48:22
* @Entity com.adc.da.report.eo.ReportContentEntity
*/
public interface ReportContentDao extends BaseMapper<ReportContentEntity> {
}
@@ -24,16 +24,39 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
* @param idSet
* @return
*/
IPage<ReportVo> list(IPage page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
IPage<ReportVo> list(IPage<ReportEntity> page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
/**
* 报告日期列表
*
* @param usid
* @return
*/
List<String> getReportDateList(@Param("usid")String usid);
List<String> getReportDateList(@Param("usid") String usid);
IPage<ReportVo> getAddReportPage(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo);
IPage<ReportVo> page(IPage<ReportEntity> page,@Param("pageVO") ReportQueryVo vo);
/**
* 报告列表
*
* @param page
* @param vo
* @param idSet
* @return
*/
IPage<ReportVo> page(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
/**
* 报告列表
*
* @param page
* @param vo
* @param idSet
* @return
*/
IPage<ReportVo> reportManagerPage(IPage<ReportEntity> page, @Param("Vo") ReportQueryVo vo, @Param("idSet") Set<String> idSet);
List<String> isAct(@Param("Vo") ReportQueryVo vo);
long selectByidAndName(@Param("Vo")ReportEntity entity);
}
@@ -0,0 +1,46 @@
package com.adc.da.report.eo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
*
* @author Caihaohan
* @TableName ts_report_content
*/
@TableName(value ="ts_report_content")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class ReportContentEntity implements Serializable {
/**
* 主键id
*/
@TableId(value = "id",type = IdType.INPUT)
private String id;
/**
* 报告id
*/
@TableField(value = "report_id")
private String reportId;
/**
* 文件内容
*/
@TableField(value = "report_content")
private String reportContent;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
@@ -1,7 +1,6 @@
package com.adc.da.report.service;
import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyActPageVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -48,11 +47,11 @@ public interface IPowerApplyActService {
/**
* @param deleteParamVO
* @param powerApplyActPageVO
* @return void
* @author bu
* @date 2023-04-23
* @description 根据id或id数组进行删除
*/
public void deleteById(DeleteParamRequestVO deleteParamVO);
public void deleteByListPower(PowerApplyActPageVO powerApplyActPageVO);
}
@@ -1,6 +1,7 @@
package com.adc.da.report.service;
import com.adc.da.report.eo.PowerApply;
import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyPageVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -55,4 +56,6 @@ public interface IPowerApplyService {
* @description 根据id或id数组进行删除
*/
public void deleteById(DeleteParamRequestVO deleteParamVO);
void saveBatch(List<PowerApplyAct> powerApplyActs);
}
@@ -0,0 +1,24 @@
package com.adc.da.report.service;
import com.adc.da.report.eo.ReportContentEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* @author ThinkBook
* @description 针对表【ts_report_content】的数据库操作Service
* @createDate 2023-04-27 11:48:22
*/
public interface IReportContentService extends IService<ReportContentEntity> {
/**
* 插入报告内容表
*
* @param reportId 报告id
* @param fileId 文件id
*/
void insertReportContent(String reportId, String fileId) throws IOException;
}
@@ -5,6 +5,7 @@ import com.adc.da.report.vo.ReportQueryVo;
import com.adc.da.report.vo.ReportVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.io.IOException;
import java.util.List;
/**
@@ -20,14 +21,7 @@ public interface IReportService {
* @param labelList
* @return 报告名称
*/
String insert(ReportEntity entity, List<String> labelList);
/**
* 报告列表展示
* @param vo
* @return
*/
IPage<ReportVo> list(ReportQueryVo vo) throws Exception;
String insert(ReportEntity entity, List<String> labelList) throws IOException;
/**
* 删除报告
@@ -51,4 +45,8 @@ public interface IReportService {
IPage<ReportVo> addReportPage(ReportQueryVo vo) throws Exception;
IPage<ReportVo> page(ReportQueryVo vo);
IPage<ReportVo> reportManagerPage(ReportQueryVo vo);
List<String> isAct(ReportQueryVo vo);
}
@@ -0,0 +1,82 @@
package com.adc.da.report.service.impl;
import com.adc.da.report.dao.mysql.FileDao;
import com.adc.da.report.eo.FileEntity;
import com.adc.da.report.util.FileContentUtil;
import com.adc.da.report.util.LocalFileUtil;
import com.adc.da.report.util.OSSClientUtil;
import com.adc.da.report.util.ObsBootUtil;
import com.adc.da.util.utils.FileUtil;
import com.adc.da.util.utils.UUID;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.report.eo.ReportContentEntity;
import com.adc.da.report.service.IReportContentService;
import com.adc.da.report.dao.mysql.ReportContentDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* @author Caihaohan
* @description 针对表【ts_report_content】的数据库操作Service实现
* @createDate 2023-04-27 11:48:22
*/
@Service
@Slf4j
public class IReportContentServiceImpl extends ServiceImpl<ReportContentDao, ReportContentEntity>
implements IReportContentService {
@Value("${uploadFile}")
private String uploadFile;
@Value("${uploadType}")
private String uploadType;
@Resource
private OSSClientUtil ossClientUtil;
@Resource
private ObsBootUtil obsBootUtil;
@Resource
private LocalFileUtil localFileUtil;
@Resource
private FileDao fileDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void insertReportContent(String reportId, String fileId) throws IOException {
//获取文件
FileEntity fileEntity = fileDao.selectById(fileId);
String path = uploadFile + fileEntity.getSavePath();
FileOutputStream outputStream = new FileOutputStream(path);
// 上传方式:阿里云:alioss 华为云:hwobs
if ("hwobs".equals(uploadType)) {
obsBootUtil.getFileFromOBS(fileEntity.getSavePath(), outputStream);
} else if ("alioss".equals(uploadType)) {
ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream);
} else if ("local".equals(uploadType)) {
localFileUtil.getFileFromLocal(fileEntity.getSavePath(), outputStream);
}
File file = new File(path);
//解析出内容
String content = FileContentUtil.readFileContent(file);
//将内容存入
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, content);
save(reportContentEntity);
//将文件删除
FileUtil.deleteFile(path);
}
}
@@ -11,6 +11,7 @@ import com.adc.da.report.eo.FileEntity;
import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.eo.ReportLabelEntity;
import com.adc.da.report.eo.ReportUserEntity;
import com.adc.da.report.service.IReportContentService;
import com.adc.da.report.service.IReportLabelService;
import com.adc.da.report.service.IReportService;
import com.adc.da.report.service.ITreeLabelService;
@@ -37,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -90,6 +92,12 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
@Autowired
private RoleEODao roleEODao;
@Resource
private IReportContentService iReportContentService;
@Autowired
private LocalFileUtil localFileUtil;
/**
* 新增或编辑报告
*
@@ -99,13 +107,13 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
*/
@Override
@Transactional(rollbackFor = Exception.class)
public String insert(ReportEntity entity, List<String> labelList) {
public String insert(ReportEntity entity, List<String> labelList) throws IOException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (StringUtils.isEmpty(entity.getId())) {
entity.setId(UUID.randomUUID10());
entity.setCreateDate(format.format(new Date()));
entity.setCreateUserId(CommonUtils.getUserId());
entity.setCreateUserId(UserUtils.getUserId());
entity.setDelFlag("0");
entity.setUpdateDate(format.format(new Date()));
reportDao.insert(entity);
@@ -124,6 +132,9 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
reportLabelDao.insert(reportLabelEntity);
});
//插入报表内容表
iReportContentService.insertReportContent(entity.getId() ,entity.getFileId());
CommonUtils.threadPoolExecutor().execute(() -> {
//生成html
try {
@@ -185,85 +196,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
return entity.getName();
}
/**
* 报告列表
*
* @param vo
* @return
* @throws Exception
*/
@Override
public IPage<ReportVo> list(ReportQueryVo vo) throws Exception {
IPage<ReportEntity> page = new Page<>();
page.setCurrent(vo.getPageNo());
page.setSize(vo.getPageSize());
//判断是不是管理员
boolean admin = CommonUtils.isAdmin();
if (admin) {
vo.setUsid(null);
} else {
vo.setUsid(CommonUtils.getUserId());
}
//按照labelId筛选
Set<String> idSet = new HashSet<>();
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1));
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
reportLabelEntities.forEach(reportLabelEntity -> {
idSet.add(reportLabelEntity.getReportId());
});
}
// TODO ES模糊查询
IPage<ReportVo> list = reportDao.list(page, vo, idSet);
//获取所有报告的labelId
list.getRecords().forEach((reportVo) -> {
reportVo.setLabelList(findLabelList(reportVo.getId()));
});
list.getRecords().forEach(c -> {
FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
if (StringUtils.isEmpty(fileEntity.getFileType())) {
c.setFileType(null);
}
//ppt文件
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("1");
}
//excel文件
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("2");
}
//pdf文件
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("3");
}
//word文件
else {
c.setFileType("4");
}
//文件大小
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
c.setFileName(fileEntity.getFileName());
List<String> userIdList = reportUserDao.selectList(
new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
.stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
c.setReportUserIdList(userIdList);
});
return list;
}
/**
* 找出报告的所有标签中最长的那条路径
*
@@ -283,6 +215,9 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
labelList = labelList.stream()
.sorted(Comparator.comparingInt(List<String>::size).reversed())
.collect(Collectors.toList());
if (labelList.size() == 0){
return null;
}
return labelList.get(0);
}
@@ -391,11 +326,154 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
vo.setUsid(UserUtils.getUserId());
}
IPage<ReportVo> list = reportDao.page(page, vo);
//按照labelId筛选
Set<String> idSet = new HashSet<>();
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId());
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
reportLabelEntities.forEach(reportLabelEntity -> {
idSet.add(reportLabelEntity.getReportId());
});
idSet.add("1");
}
IPage<ReportVo> list = reportDao.page(page, vo,idSet);
//获取所有报告的labelId
list.getRecords().forEach((reportVo) -> {
reportVo.setLabelList(findLabelList(reportVo.getId()));
});
list.getRecords().forEach(c -> {
FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
if (StringUtils.isEmpty(fileEntity.getFileType())) {
c.setFileType(null);
}
//ppt文件
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("1");
}
//excel文件
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("2");
}
//pdf文件
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("3");
}
//word文件
else {
c.setFileType("4");
}
//文件大小
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
c.setFileName(fileEntity.getFileName());
List<String> userIdList = reportUserDao.selectList(
new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
.stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
c.setReportUserIdList(userIdList);
});
return list;
}
@Override
public IPage<ReportVo> reportManagerPage(ReportQueryVo vo) {
IPage<ReportEntity> page = new Page<>();
page.setCurrent(vo.getPageNo());
page.setSize(vo.getPageSize());
//判断是不是管理员
boolean admin = false;
List<RoleEO> roleEOList = roleEODao.selectByuserId(UserUtils.getUserId());
for (RoleEO roleEO : roleEOList) {
if ("管理员".equals(roleEO.getName())){
admin= !admin;
}
}
if (admin) {
vo.setUsid(null);
} else {
vo.setUsid(UserUtils.getUserId());
}
//按照labelId筛选
Set<String> idSet = new HashSet<>();
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
reportLabelEntityWrapper.in(ReportLabelEntity::getLabelId, vo.getLabelId());
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
reportLabelEntities.forEach(reportLabelEntity -> {
idSet.add(reportLabelEntity.getReportId());
});
idSet.add("1");
}
IPage<ReportVo> list = reportDao.reportManagerPage(page, vo, idSet);
//获取所有报告的labelId
list.getRecords().forEach((reportVo) -> {
reportVo.setLabelList(findLabelList(reportVo.getId()));
});
list.getRecords().forEach(c -> {
FileEntity fileEntity = Optional.ofNullable(fileDao.selectById(c.getFileId())).orElse(new FileEntity());
if (StringUtils.isEmpty(fileEntity.getFileType())) {
c.setFileType(null);
}
//ppt文件
else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("1");
}
//excel文件
else if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType()) ||
ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("2");
}
//pdf文件
else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
c.setFileType("3");
}
//word文件
else {
c.setFileType("4");
}
//文件大小
c.setFileSize(StringUtils.isNotEmpty(fileEntity.getFileSize())
? String.valueOf(Integer.parseInt(fileEntity.getFileSize()) / 1024) + "kb" : "0kb");
c.setFileName(fileEntity.getFileName());
List<String> userIdList = reportUserDao.selectList(
new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
.stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
c.setReportUserIdList(userIdList);
});
return list;
}
@Override
public List<String> isAct(ReportQueryVo vo) {
boolean flag = false;
//判断是不是管理员
boolean admin = false;
List<RoleEO> roleEOList = roleEODao.selectByuserId(UserUtils.getUserId());
for (RoleEO roleEO : roleEOList) {
if ("管理员".equals(roleEO.getName())){
admin= !admin;
}
}
if (admin) {
vo.setUsid(null);
} else {
vo.setUsid(UserUtils.getUserId());
}
List<String> act = baseMapper.isAct(vo);
return act;
}
/**
* 创建htmlstring
*
@@ -408,44 +486,30 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
String path = uploadFile + fileEntity.getSavePath();
FileOutputStream outputStream = new FileOutputStream(path);
// 上传方式:阿里云:alioss 华为云:hwobs
if (uploadType.equals("hwobs")) {
if ("hwobs".equals(uploadType)) {
obsBootUtil.getFileFromOBS(fileEntity.getSavePath(), outputStream);
} else if (uploadType.equals("alioss")) {
} else if ("alioss".equals(uploadType)) {
ossClientUtil.getFileFromOSS(fileEntity.getSavePath(), outputStream);
} else if ("local".equals(uploadType)) {
localFileUtil.getFileFromLocal(fileEntity.getSavePath(), outputStream);
}
String html = null;
switch (fileEntity.getFileType()) {
//03excel
case "xls":
html = ExcelUtil.excel03Html(new FileInputStream(path));
break;
//07excel
case "xlsx":
html = ExcelUtil.excel07Html(new FileInputStream(path));
break;
//03word
case "doc":
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
break;
//07word
case "docx":
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
break;
//03ppt
case "ppt":
html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress);
break;
//07ppt
case "pptx":
html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress);
break;
//pdf
case "pdf":
html = PdfUtil.pdfStreamToPng(new FileInputStream(path), uploadFile, ipAddress);
break;
default:
break;
if (ReportConstants.FILE_EXTENSIONS_XLS.equalsIgnoreCase(fileEntity.getFileType())) {
html = ExcelUtil.excel03Html(new FileInputStream(path));
} else if (ReportConstants.FILE_EXTENSIONS_XLSX.equalsIgnoreCase(fileEntity.getFileType())) {
html = ExcelUtil.excel07Html(new FileInputStream(path));
} else if (ReportConstants.FILE_EXTENSIONS_DOC.equalsIgnoreCase(fileEntity.getFileType())) {
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
} else if (ReportConstants.FILE_EXTENSIONS_DOCX.equalsIgnoreCase(fileEntity.getFileType())) {
html = WordUtil.doc2pdf(new FileInputStream(path), uploadFile, ipAddress);
} else if (ReportConstants.FILE_EXTENSIONS_PPT.equalsIgnoreCase(fileEntity.getFileType())) {
html = PptUtil.doPpt2003toImage(new FileInputStream(path), uploadFile, ipAddress);
} else if (ReportConstants.FILE_EXTENSIONS_PPTX.equalsIgnoreCase(fileEntity.getFileType())) {
html = PptUtil.doPpt2007toImage(new FileInputStream(path), uploadFile, ipAddress);
} else if (ReportConstants.FILE_EXTENSIONS_PDF.equalsIgnoreCase(fileEntity.getFileType())) {
html = PdfUtil.pdfStreamToPng(new FileInputStream(path), uploadFile, ipAddress);
}
FileUtil.deleteFile(path);
return html;
@@ -4,7 +4,6 @@ package com.adc.da.report.service.impl;
import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.service.IPowerApplyActService;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyActPageVO;
import com.adc.da.util.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -12,9 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
/**
@@ -81,32 +78,21 @@ public class IpowerApplyActServiceImpl extends ServiceImpl<PowerApplyActDao, Pow
}
/**
* @param deleteParamVO
* @param powerApplyActPageVO
* @return void
* @author bu
* @date 2023-04-23
* @description 根据id或id数组进行删除
*/
public void deleteById(DeleteParamRequestVO deleteParamVO) {
if (ObjectUtils.isEmpty(deleteParamVO)) {
return;
}
List<String> ids = new ArrayList<>();
if (!ObjectUtils.isEmpty(deleteParamVO.getId())) {
ids.add(deleteParamVO.getId());
}
if (!ObjectUtils.isEmpty(deleteParamVO.getIds())) {
ids.addAll(deleteParamVO.getIds());
}
if (ObjectUtils.isEmpty(deleteParamVO)) {
return;
}
LambdaQueryWrapper<PowerApplyAct> wrapper = new LambdaQueryWrapper<>();
wrapper.in(PowerApplyAct::getId,ids);
PowerApplyAct powerApplyAct = new PowerApplyAct();
powerApplyAct.setDelFlag(1);
baseMapper.update(powerApplyAct,wrapper);
public void deleteByListPower(PowerApplyActPageVO powerApplyActPageVO) {
List<PowerApplyAct> powerApplyList = powerApplyActPageVO.getPowerApplyList();
for (PowerApplyAct powerApplyAct : powerApplyList) {
LambdaQueryWrapper<PowerApplyAct> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PowerApplyAct::getPrcId,powerApplyAct.getPrcId());
wrapper.eq(PowerApplyAct::getReportId,powerApplyAct.getReportId());
powerApplyAct.setDelFlag(1);
baseMapper.update(powerApplyAct,wrapper);
}
}
@@ -1,8 +1,10 @@
package com.adc.da.report.service.impl;
import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.dao.mysql.PowerApplyDao;
import com.adc.da.report.eo.PowerApply;
import com.adc.da.report.eo.PowerApplyAct;
import com.adc.da.report.service.IPowerApplyService;
import com.adc.da.report.vo.DeleteParamRequestVO;
import com.adc.da.report.vo.PowerApplyPageVO;
@@ -11,11 +13,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author bu
@@ -27,6 +31,10 @@ import java.util.List;
@Service
public class IpowerApplyServiceImpl extends ServiceImpl<PowerApplyDao, PowerApply> implements IPowerApplyService {
@Autowired
private PowerApplyActDao powerApplyActDao;
/**
* @param powerApplyPageVO
* @return <com.adc.da.report.entity.PowerApply>
@@ -109,5 +117,12 @@ public class IpowerApplyServiceImpl extends ServiceImpl<PowerApplyDao, PowerAppl
baseMapper.update(powerApply,wrapper);
}
@Override
public void saveBatch(List<PowerApplyAct> powerApplyActs) {
baseMapper.saveBatch(powerApplyActs);
List<String> ids = powerApplyActs.stream().map(a -> a.getId()).collect(Collectors.toList());
powerApplyActDao.batchDel(ids);
}
}
@@ -0,0 +1,86 @@
package com.adc.da.report.util;
import com.adc.da.util.exception.AdcDaBaseException;
import com.obs.services.exception.ObsException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
/**
* @author Caihaohan
*/
@Slf4j
@Component
public class LocalFileUtil {
@Value("${uploadFile}")
private String uploadFile;
@Value("${localFilePath}")
private String localFilePath;
public void saveFile(InputStream fileInputStream, String fileName) throws IOException {
String path = localFilePath + fileName;
FileOutputStream fileOutputStream = new FileOutputStream(path);
byte[] buffer = new byte[1024];
int length;
while ((length = fileInputStream.read(buffer)) > 0) {
fileOutputStream.write(buffer, 0, length);
}
fileInputStream.close();
fileOutputStream.close();
}
public void getFileFromLocal(String savePath, FileOutputStream outputStream) throws IOException {
// 创建源文件对象
File sourceFile = new File(localFilePath, savePath);
// 如果源文件不存在,则抛出异常
if (!sourceFile.exists()) {
throw new IOException("Source file does not exist.");
}
// 创建输入流
FileInputStream inputStream = new FileInputStream(sourceFile);
// 创建缓冲区
byte[] buffer = new byte[1024];
int bytesRead;
// 从输入流读取数据,并写入输出流
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
// 关闭输入流和输出流
inputStream.close();
outputStream.close();
}
public void downFile(String savePath, HttpServletResponse response) throws IOException {
String filePath = uploadFile + savePath;
//复制到本地
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
getFileFromLocal(savePath, fileOutputStream);
//将文件写到response中
try (InputStream objectContent = Files.newInputStream(Paths.get(filePath))) {
byte[] bt = new byte[1024 * 1024];
int len = 0;
while ((len = objectContent.read(bt)) != -1) {
response.getOutputStream().write(bt, 0, len);
}
} catch (ObsException | IOException oe) {
throw new AdcDaBaseException("获取本地文件失败");
} finally {
// 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。
response.getOutputStream().close();
}
}
}
@@ -0,0 +1,72 @@
package com.adc.da.report.util;
import java.util.ArrayList;
import java.util.List;
/**
* 分页工具类
*
* @author 程序员小强
*/
public class PageUtils {
/**
* 默认第一页
*/
private static final int PAGE = 1;
/**
* 默认一页10条
*/
private static final int PAGE_SIZE = 10;
public static Integer getStartRow(Integer pageNo, Integer pageSize) {
if (null == pageNo) {
pageNo = PAGE;
}
if (null == pageSize) {
pageSize = PAGE_SIZE;
}
return pageSize * (pageNo - 1);
}
public static Integer getOffset(Integer pageSize) {
if (null == pageSize) {
pageSize = PAGE_SIZE;
}
return pageSize;
}
/**
* list分页
*
* @param list
* @param pageNo
* @param pageSize
*/
public static <T> List<T> listPage(List<T> list, Integer pageNo, Integer pageSize) {
if (null == list || list.isEmpty()) {
return list;
}
if (null == pageNo) {
pageNo = PAGE;
}
if (null == pageSize) {
pageSize = PAGE_SIZE;
}
int totalCount = list.size();
pageNo = pageNo - 1;
int fromIndex = pageNo * pageSize;
if (fromIndex > totalCount) {
return new ArrayList<>(0);
}
int toIndex = ((pageNo + 1) * pageSize);
if (toIndex > totalCount) {
toIndex = totalCount;
}
return list.subList(fromIndex, toIndex);
}
}
@@ -4,6 +4,8 @@ import com.adc.da.util.utils.UUID;
import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import sun.misc.BASE64Encoder;
import javax.imageio.ImageIO;
@@ -14,28 +16,37 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
@Component
public class PdfUtil {
private PdfUtil(){
throw new IllegalStateException("Utility class");
private static String uploadType;
@Value("${uploadType}")
public void setUploadType(String uploadType) {
PdfUtil.uploadType = uploadType;
}
private PdfUtil() {
}
/**
* 截取pdf成图片
*
* @param inputStream
* @param targetPath
* @param ipAddress
* @return
*/
public static String pdfStreamToPng( InputStream inputStream,String targetPath,String ipAddress) {
public static String pdfStreamToPng(InputStream inputStream, String targetPath, String ipAddress) {
try(PDDocument doc=PDDocument.load( inputStream)) {
try (PDDocument doc = PDDocument.load(inputStream)) {
PDFRenderer renderer = new PDFRenderer(doc);
List<String> list=new ArrayList<>();
List<String> list = new ArrayList<>();
int pageCount = doc.getNumberOfPages();
BufferedImage image = null;
log.info("开始时间"+System.currentTimeMillis());
log.info("开始时间" + System.currentTimeMillis());
String fileName = UUID.randomUUID10();
for (int i = 0; i < pageCount; i++) {
image = renderer.renderImage(i, 2.0f);
@@ -46,32 +57,31 @@ public class PdfUtil {
imOut = ImageIO.createImageOutputStream(bs);
ImageIO.write(image, "png", imOut);
try(ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bs.toByteArray());){
File ff=new File(targetPath+"/"+fileName);
if(!ff.exists()){
try (ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bs.toByteArray());) {
File ff = new File(targetPath + "/" + fileName);
if (!ff.exists()) {
ff.mkdirs();
}
File uploadFile = new File(targetPath+"/"+fileName+"/"+i+".png");
try(FileOutputStream fops = new FileOutputStream(uploadFile);){
File uploadFile = new File(targetPath + "/" + fileName + "/" + i + ".png");
try (FileOutputStream fops = new FileOutputStream(uploadFile);) {
fops.write(readInputStream(byteInputStream));
}
catch (Exception e){
log.error(e.getMessage(),e);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
list.add(ipAddress+"api/home/pic"+"/"+fileName+"/"+i+".png");
}
catch (Exception e){
list.add(ipAddress + "api/home/pic" + "/" + fileName + "/" + i + ".png");
} catch (Exception e) {
}
}
log.info("结束时间"+System.currentTimeMillis());
log.info("结束时间" + System.currentTimeMillis());
String htmlByBase64 = createHtmlByImg(list);
String htmlByBase64 = createHtmlByImg(list);
return htmlByBase64;
} catch (Exception e) {
log.error(e.getMessage(),e);
log.error(e.getMessage(), e);
return "";
}
}
@@ -88,15 +98,15 @@ public class PdfUtil {
buffer.append("<style>\r\n");
buffer.append(".preview-img {background-color:#fff; text-align:center; width:100%; max-width:100%;margin-top:6px;}\r\n");
buffer.append("</style>\r\n");
for(int i=0;i<baseList.size();i++){
buffer.append("<img class ='preview-img' src="+baseList.get(i)+" />");
for (int i = 0; i < baseList.size(); i++) {
buffer.append("<img class ='preview-img' src=" + baseList.get(i) + " />");
}
buffer.append("</body></html>");
try {
return buffer.toString();
} catch (Exception e) {
log.error(e.getMessage(),e);
log.error(e.getMessage(), e);
return "";
}
@@ -109,7 +119,7 @@ public class PdfUtil {
public static byte[] readInputStream(InputStream inStream) throws Exception {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024*1024];
byte[] buffer = new byte[1024 * 1024];
int len = 0;
while ((len = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, len);
@@ -1,5 +1,6 @@
package com.adc.da.report.vo;
import com.adc.da.report.eo.PowerApplyAct;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -16,6 +17,7 @@ import java.util.List;
public class PowerApplyActPageVO extends BasePageVO {
private String id;
/**
* 流程id
*/
@@ -137,4 +139,6 @@ public class PowerApplyActPageVO extends BasePageVO {
private String fileSize;
private String name;
private List<PowerApplyAct> powerApplyList;
}
@@ -47,6 +47,7 @@ public class ReportQueryVo {
private String usid;
private List<String> ids;
//
// private List<String> noIds;
@@ -60,6 +60,13 @@
(#{item.id}, #{item.prcId}, #{item.taskId}, #{item.dataId}, #{item.reportId}, #{item.power}, #{item.applyReason}, #{item.userId}, #{item.createUserId}, #{item.createDate}, #{item.updateDate}, #{item.updateUserId}, #{item.delFlag})
</foreach>
</insert>
<update id="batchDel">
UPDATE power_apply_act set del_flag = 1
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<!-- 根据查询VO进行分页查询 -->
@@ -97,6 +104,13 @@
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel
from <include refid="TableName"/> a
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
where a.data_id = #{dataId} and a.del_flag = 0
</select>
<select id="selectListBydataIdNodel" resultType="com.adc.da.report.vo.PowerApplyActPageVO">
select a.*,
rep.name,rep.keycontent,rep.maincontent,rep.DEPARTMENT,rep.year,rep.fileid,rep.confidentialLevel,rep.privacyLevel
from <include refid="TableName"/> a
left join TT_REPORT_MANAGE rep on a.report_id = rep.id
where a.data_id = #{dataId}
</select>
</mapper>
@@ -2,162 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.report.dao.mysql.ReportDao">
<!-- <select id="list" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">-->
<!-- select t1.id,t1.labelOneId,t1.labelTwoId,t1.labelThreeId,t1.labelOneName,t1.labelTwoName,t1.labelThreeName,t1.name,t1.year,t1.keyContent,t1.mainContent-->
<!-- ,t1.department,date_format(t1.updateDate,'%Y-%m-%d') createDate,t1.fileId-->
<!-- from(-->
<!-- (-->
<!-- select distinct b1.*,(case when b3.name is null then '-' else b3.name end) labelOneName-->
<!-- ,(case when b4.name is null then '-' else b4.name end) labelTwoName-->
<!-- ,(case when b5.name is null then '-' else b5.name end) labelThreeName from-->
<!-- (select * from TT_REPORT_MANAGE )b1-->
<!-- left join TR_REPORT_USER b2 on b1.id=b2.reportId-->
<!-- left join TS_LABEL b3 on b1.labelOneId=b3.id-->
<!-- left join TS_LABEL b4 on b1.labelTwoId=b4.id-->
<!-- left join TS_LABEL b5 on b1.labelThreeId=b5.id-->
<!-- where b1.del_flag='0' and(b3.name is null or b4.name is null or b5.name is null )-->
<!-- &lt;!&ndash;文本搜索&ndash;&gt;-->
<!-- <if test="Vo.keyContent !=null and Vo.keyContent !=''">-->
<!-- and (b1.name like "%"#{Vo.keyContent}"%" or b1.keycontent like "%"#{Vo.keyContent}"%"-->
<!-- or b1.maincontent like "%"#{Vo.keyContent}"%" or b1.department like "%"#{Vo.keyContent}"%")-->
<!-- </if>-->
<!-- &lt;!&ndash;年份搜索&ndash;&gt;-->
<!-- <if test="Vo.year !=null and Vo.year.size() >0">-->
<!-- and b1.year in-->
<!-- <foreach collection="Vo.year" item="year" open="(" separator="," close=")">-->
<!-- #{year}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- &lt;!&ndash;标签搜索&ndash;&gt;-->
<!-- <if test="Vo.labelOneId !=null and Vo.labelOneId.size() >0">-->
<!-- and b1.labelOneId in-->
<!-- <foreach collection="Vo.labelOneId" item="labelOneId" open="(" separator="," close=")">-->
<!-- #{labelOneId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.labelTwoId !=null and Vo.labelTwoId.size() >0">-->
<!-- and b1.labelTwoId in-->
<!-- <foreach collection="Vo.labelTwoId" item="labelTwoId" open="(" separator="," close=")">-->
<!-- #{labelTwoId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.labelThreeId !=null and Vo.labelThreeId.size() >0">-->
<!-- and b1.labelThreeId in-->
<!-- <foreach collection="Vo.labelThreeId" item="labelThreeId" open="(" separator="," close=")">-->
<!-- #{labelThreeId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.usid !=null and Vo.usid !=''">-->
<!-- and b2.userId=#{Vo.usid}-->
<!-- </if>-->
<!-- ORDER BY updateDate desc limit 999999999-->
<!-- )-->
<!-- UNION ALL-->
<!-- (select distinct a1.* ,a3.name labelOneName,a4.name labelTwoName,a5.name labelThreeName from(select * from TT_REPORT_MANAGE ) a1-->
<!-- left join TR_REPORT_USER a2 on a1.id=a2.reportId-->
<!-- left join TS_LABEL a3 on a1.labelOneId=a3.id-->
<!-- left join TS_LABEL a4 on a1.labelTwoId=a4.id-->
<!-- left join TS_LABEL a5 on a1.labelThreeId=a5.id-->
<!-- where a1.del_flag='0' and (a3.name is not null and a4.name is not null and a5.name is not null )-->
<!-- &lt;!&ndash;文本搜索&ndash;&gt;-->
<!-- <if test="Vo.keyContent !=null and Vo.keyContent !=''">-->
<!-- and (a1.name like "%"#{Vo.keyContent}"%" or a1.keycontent like "%"#{Vo.keyContent}"%"-->
<!-- or a1.maincontent like "%"#{Vo.keyContent}"%" or a1.department like "%"#{Vo.keyContent}"%" )-->
<!-- </if>-->
<!-- &lt;!&ndash;年份搜索&ndash;&gt;-->
<!-- <if test="Vo.year !=null and Vo.year.size >0">-->
<!-- and a1.year in-->
<!-- <foreach collection="Vo.year" item="year" open="(" separator="," close=")">-->
<!-- #{year}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- &lt;!&ndash;标签搜索&ndash;&gt;-->
<!-- <if test="Vo.labelOneId !=null and Vo.labelOneId.size() >0">-->
<!-- and a1.labelOneId in-->
<!-- <foreach collection="Vo.labelOneId" item="labelOneId" open="(" separator="," close=")">-->
<!-- #{labelOneId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.labelTwoId !=null and Vo.labelTwoId.size() >0">-->
<!-- and a1.labelTwoId in-->
<!-- <foreach collection="Vo.labelTwoId" item="labelTwoId" open="(" separator="," close=")">-->
<!-- #{labelTwoId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.labelThreeId !=null and Vo.labelThreeId.size() >0">-->
<!-- and a1.labelThreeId in-->
<!-- <foreach collection="Vo.labelThreeId" item="labelThreeId" open="(" separator="," close=")">-->
<!-- #{labelThreeId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="Vo.usid !=null and Vo.usid !=''">-->
<!-- and a2.userId=#{Vo.usid}-->
<!-- </if>-->
<!-- ORDER BY updateDate desc limit 999999999)-->
<!-- )t1-->
<!-- </select>-->
<select id="list" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
SELECT DISTINCT t.id, t.year, t.name, t.keycontent, t.fileId, t.createDate, t.department, t.maincontent,
t.confidentialLevel, t.privacyLevel
FROM `tt_report_manage` AS t
INNER JOIN ts_report_label AS trl ON t.id = trl.report_id
WHERE 1 = 1
<!--报表名称搜索-->
<if test="Vo.name != null and Vo.name != ''">
and t.name like "%"#{Vo.name}"%"
</if>
<!--年份搜索-->
<if test="Vo.year != null and Vo.year.size() > 0">
and t.year in
<foreach collection="Vo.year" item="year" open="(" separator="," close=")">
#{year}
</foreach>
</if>
<!--id搜索-->
<if test="idSet !=null and idSet.size() > 0">
and t.id in
<foreach collection="idSet" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--id搜索-->
<if test="Vo.ids !=null and Vo.ids.size() > 0">
and Vo.ids in
<foreach collection="Vo.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--用户搜索-->
<if test="Vo.usid != null and Vo.usid != ''">
and t.userId=#{Vo.usid}
</if>
ORDER BY updateDate desc
</select>
<select id="getReportDateList" parameterType="string" resultType="string">
select distinct year from TT_REPORT_MANAGE t1
left join TR_REPORT_USER t2 on t1.id=t2.reportId
@@ -190,12 +34,10 @@
WHERE
eo.DEL_FLAG = 0
<if test="pageVO.usid !='' and pageVO.usid != null">
and ru.userId != #{pageVO.usid}
</if>
<if test="pageVO.usid !='' and pageVO.usid != null">
and eo.id not in (
SELECT tt.report_id from power_apply tt WHERE tt.user_id = #{pageVO.usid}
)
AND eo.id NOT IN ( SELECT ru.reportId FROM tr_report_user ru WHERE ru.userId = #{pageVO.usid} )
AND eo.id NOT IN ( SELECT tt.report_id FROM power_apply tt WHERE tt.user_id = #{pageVO.usid} )
AND eo.id NOT IN (SELECT tt.report_id FROM power_apply_act tt LEFT JOIN bus_process_name pro on tt.prc_id = pro.PRC_ID WHERE tt.user_id = #{pageVO.usid} and
del_flag != 1 and pro.SUBMIT_STATUS = 1)
</if>
<if test="pageVO.name !='' and pageVO.name != null">
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
@@ -224,6 +66,7 @@
</select>
<select id="page" resultType="com.adc.da.report.vo.ReportVo">
SELECT
@@ -241,6 +84,7 @@
pa.power
FROM
TT_REPORT_MANAGE eo
INNER JOIN ts_report_label AS trl ON eo.id = trl.report_id
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
LEFT JOIN power_apply pa ON pa.report_id = eo.id
WHERE
@@ -250,9 +94,6 @@
or eo.id in (
SELECT tt.report_id from power_apply tt WHERE tt.user_id = #{pageVO.usid})
)
</if>
<if test="pageVO.usid !='' and pageVO.usid != null">
</if>
<if test="pageVO.name !='' and pageVO.name != null">
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
@@ -274,6 +115,13 @@
#{id}
</foreach>
</if>
<!--id搜索-->
<if test="idSet !=null and idSet.size() > 0">
and eo.id in
<foreach collection="idSet" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
GROUP BY
eo.id
ORDER BY
@@ -281,4 +129,80 @@
</select>
<select id="reportManagerPage" parameterType="com.adc.da.report.vo.ReportQueryVo" resultType="com.adc.da.report.vo.ReportVo">
SELECT DISTINCT
trl.report_id AS id,
t.year,
t.name,
t.keycontent,
t.fileId,
t.createDate,
t.department,
t.maincontent,
t.confidentialLevel,
t.privacyLevel
FROM `tt_report_manage` AS t
INNER JOIN ts_report_label AS trl ON t.id = trl.report_id
WHERE t.del_flag = 0
<!--报表名称搜索-->
<if test="Vo.name != null and Vo.name != ''">
and t.name like CONCAT(CONCAT('%',#{Vo.name}),'%')
</if>
<!--年份搜索-->
<if test="Vo.year != null and Vo.year.size() > 0">
and t.year in
<foreach collection="Vo.year" item="year" open="(" separator="," close=")">
#{year}
</foreach>
</if>
<!--id搜索-->
<if test="idSet !=null and idSet.size() > 0">
and t.id in
<foreach collection="idSet" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--id搜索-->
<if test="Vo.ids !=null and Vo.ids.size() > 0">
and t.id in
<foreach collection="Vo.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--用户搜索-->
<if test="Vo.usid != null and Vo.usid != ''">
and t.createUserId=#{Vo.usid}
</if>
ORDER BY updateDate desc
</select>
<select id="isAct" resultType="java.lang.String">
SELECT rep.name FROM power_apply_act tt
LEFT JOIN bus_process_name pro on tt.prc_id = pro.PRC_ID
LEFT JOIN tt_report_manage rep on tt.report_id = rep.id
WHERE tt.user_id = #{Vo.usid} and tt.del_flag != 1 and
pro.SUBMIT_STATUS = 1
and tt.report_id in
<foreach collection="Vo.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
GROUP BY rep.id;
</select>
<select id="selectByidAndName" resultType="java.lang.Long">
select count(1) from tt_report_manage rep
<where>
rep.Name = #{Vo.name}
and rep.del_flag = 0
<if test="Vo.id != null and Vo.id != ''">
and rep.id != #{Vo.id}
</if>
</where>
</select>
</mapper>