Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -16,6 +16,7 @@ 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.util.WaterMarkUtil;
|
||||
import com.adc.da.report.vo.ChangeUploaderVo;
|
||||
import com.adc.da.report.vo.ReportQueryVo;
|
||||
import com.adc.da.report.vo.ReportVo;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
@@ -38,6 +39,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.*;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLEncoder;
|
||||
@@ -186,6 +188,18 @@ public class ReportManageConroller {
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改上传人
|
||||
* @param changeUploaderVo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation("修改上传人")
|
||||
@PostMapping("/changeUploader")
|
||||
public ResponseMessage changeUploader(@Valid @RequestBody ChangeUploaderVo changeUploaderVo) {
|
||||
return reportService.changeUploader(changeUploaderVo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.adc.da.report.service;
|
||||
|
||||
import com.adc.da.report.eo.ReportEntity;
|
||||
import com.adc.da.report.vo.ChangeUploaderVo;
|
||||
import com.adc.da.report.vo.ReportQueryVo;
|
||||
import com.adc.da.report.vo.ReportVo;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
@@ -78,5 +79,20 @@ public interface IReportService {
|
||||
*/
|
||||
Boolean isAllowDownload(String userId, String repostId);
|
||||
|
||||
/**
|
||||
* 判断用户是否允许修改上传人
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return 是否有修改上传人的权限
|
||||
*/
|
||||
Boolean isAllowChangeUploader(String userId);
|
||||
|
||||
void addOrUpdate(ReportEntity reportEntity);
|
||||
|
||||
/**
|
||||
* 更改上传人
|
||||
* @param changeUploaderVo
|
||||
* @return
|
||||
*/
|
||||
ResponseMessage changeUploader(ChangeUploaderVo changeUploaderVo);
|
||||
}
|
||||
|
||||
+44
-15
@@ -7,18 +7,20 @@ import com.adc.da.report.constant.ReportConstants;
|
||||
import com.adc.da.report.dao.mysql.FileDao;
|
||||
import com.adc.da.report.dao.mysql.ReportDao;
|
||||
import com.adc.da.report.dao.mysql.ReportLabelDao;
|
||||
import com.adc.da.report.dao.mysql.ReportUserDao;
|
||||
import com.adc.da.report.eo.*;
|
||||
import com.adc.da.report.service.*;
|
||||
import com.adc.da.report.util.*;
|
||||
import com.adc.da.report.vo.ChangeUploaderVo;
|
||||
import com.adc.da.report.vo.ReportDetailVo;
|
||||
import com.adc.da.report.vo.ReportQueryVo;
|
||||
import com.adc.da.report.vo.ReportVo;
|
||||
import com.adc.da.sys.dao.mysql.RoleEODao;
|
||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||
import com.adc.da.sys.entity.MenuEO;
|
||||
import com.adc.da.sys.entity.OrgEO;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.sys.service.MenuEOService;
|
||||
import com.adc.da.sys.service.OrgEOService;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
@@ -28,7 +30,7 @@ import com.adc.da.util.utils.StringUtils;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -68,9 +70,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
@Resource
|
||||
private ReportDao reportDao;
|
||||
|
||||
@Resource
|
||||
private ReportUserDao reportUserDao;
|
||||
|
||||
@Resource
|
||||
private ReportLabelDao reportLabelDao;
|
||||
|
||||
@@ -122,9 +121,12 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
|
||||
@Resource
|
||||
private OrgEOService orgEOService;
|
||||
|
||||
@Resource
|
||||
private ILogService logService;
|
||||
|
||||
@Resource
|
||||
private MenuEOService menuEOService;
|
||||
|
||||
@Override
|
||||
public void addOrUpdate(ReportEntity reportEntity) {
|
||||
@@ -165,6 +167,20 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseMessage changeUploader(ChangeUploaderVo changeUploaderVo) {
|
||||
//判断当前登陆人是否有权限更改上传人
|
||||
if (!this.isAllowChangeUploader(UserUtils.getUserId())) {
|
||||
return Result.error("无权限更改上传人");
|
||||
}
|
||||
//更改上传人
|
||||
LambdaUpdateWrapper<ReportEntity> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(ReportEntity::getId, changeUploaderVo.getReportIds());
|
||||
wrapper.set(ReportEntity::getCreateUserId, changeUploaderVo.getUserId());
|
||||
update(wrapper);
|
||||
return Result.success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或编辑报告
|
||||
*
|
||||
@@ -174,6 +190,7 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Deprecated
|
||||
public String insert(ReportEntity entity, List<String> labelList,
|
||||
List<String> reportPreviewUserIdList,
|
||||
List<String> reportPreviewAndDownloadUserIdList) throws IOException {
|
||||
@@ -236,10 +253,10 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
});
|
||||
|
||||
} else {
|
||||
entity.setUpdateDate(format.format(new Date()));
|
||||
reportDao.updateById(entity);
|
||||
reportUserDao.delete(new QueryWrapper<ReportUserEntity>()
|
||||
.eq("reportId", entity.getId()));
|
||||
// entity.setUpdateDate(format.format(new Date()));
|
||||
// reportDao.updateById(entity);
|
||||
// reportUserDao.delete(new QueryWrapper<ReportUserEntity>()
|
||||
// .eq("reportId", entity.getId()));
|
||||
|
||||
//修改报表标签关系表(先删后增)
|
||||
iReportLabelService.deleteReportLabelByReportId(new String[]{entity.getId()});
|
||||
@@ -540,9 +557,9 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
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());
|
||||
// List<String> userIdList = reportUserDao.selectList(
|
||||
// new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
|
||||
// .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
|
||||
});
|
||||
return list;
|
||||
}
|
||||
@@ -623,13 +640,25 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
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());
|
||||
// List<String> userIdList = reportUserDao.selectList(
|
||||
// new QueryWrapper<ReportUserEntity>().eq("reportId", c.getId()))
|
||||
// .stream().map(ReportUserEntity::getUserId).collect(Collectors.toList());
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isAllowChangeUploader(String userId) {
|
||||
//找出对应的权限id
|
||||
List<MenuEO> menuEOS = menuEOService.listMenuEOByUserId(userId);
|
||||
for (MenuEO menuEO : menuEOS) {
|
||||
if ("修改上传人".equals(menuEO.getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isAllowDownload(String userId, String reportId) {
|
||||
//校验权限
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.adc.da.report.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: CaiHaohan
|
||||
* @Date: 2023/5/22 11:03
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class ChangeUploaderVo {
|
||||
|
||||
/**
|
||||
* 报告ids
|
||||
*/
|
||||
@NotEmpty
|
||||
private List<String> reportIds;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@NotBlank
|
||||
private String userId;
|
||||
|
||||
}
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
<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
|
||||
where del_flag='0'
|
||||
<if test="usid !='' and usid !=null">
|
||||
and t2.userId=#{usid}
|
||||
@@ -55,13 +54,11 @@
|
||||
pa.user_id
|
||||
FROM
|
||||
TT_REPORT_MANAGE eo
|
||||
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
|
||||
LEFT JOIN power_apply pa ON pa.report_id = eo.id
|
||||
LEFT JOIN ts_user u on u.USID = eo.createUserId
|
||||
WHERE
|
||||
eo.DEL_FLAG = 0
|
||||
<if test="pageVO.usid !='' and pageVO.usid != null">
|
||||
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)
|
||||
@@ -120,7 +117,6 @@
|
||||
TT_REPORT_MANAGE eo
|
||||
LEFT JOIN ts_report_content rc ON eo.id = rc.report_id
|
||||
LEFT JOIN ts_user tu ON tu.USID = eo.createUserId
|
||||
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
|
||||
LEFT JOIN (SELECT report_id, COUNT(id) AS thumbUp FROM report_log_book WHERE type = 3 GROUP BY report_id) AS thumbUpCount ON eo.id = thumbUpCount.report_id
|
||||
LEFT JOIN (SELECT report_id, COUNT(id) AS clicks FROM report_log_book WHERE type = 1 GROUP BY report_id) AS clicksCount ON eo.id = clicksCount.report_id
|
||||
LEFT JOIN (SELECT report_id, COUNT(id) AS download FROM report_log_book WHERE type = 2 GROUP BY report_id) AS downloadCount ON eo.id = downloadCount.report_id
|
||||
@@ -185,11 +181,14 @@
|
||||
t.maincontent,
|
||||
t.confidentialLevel,
|
||||
t.privacyLevel,
|
||||
t.createUserId,
|
||||
tu.USNAME AS createUserName,
|
||||
IF(bpn.id is null,1,
|
||||
IF(bpn.SUBMIT_STATUS = 1,0,1)
|
||||
) as isAct
|
||||
FROM `tt_report_manage` AS t
|
||||
LEFT JOIN bus_process_name as bpn on bpn.data_id = t.id and bpn.prc_type = '5'
|
||||
LEFT JOIN ts_user as tu ON tu.USID = t.createUserId
|
||||
WHERE t.del_flag = 0
|
||||
<!--报表名称搜索-->
|
||||
<if test="Vo.name != null and Vo.name != ''">
|
||||
|
||||
Reference in New Issue
Block a user