[修改] 草稿功能开发,及部分bug修改

This commit is contained in:
bupengxiang
2023-04-27 17:23:48 +08:00
parent 774c70c3c8
commit 78bfd21522
10 changed files with 219 additions and 18 deletions
@@ -96,6 +96,21 @@ public class ReportManageConroller {
return Result.success(list);
}
/**
* 报告管理列表
* @param vo
* @return
* @throws Exception
*/
@ApiOperation("报告管理列表")
@PostMapping("/reportManagerPage")
public ResponseMessage reportManagerPage(@RequestBody ReportQueryVo vo) throws Exception {
IPage<ReportVo> list = reportService.reportManagerPage(vo);
return Result.success(list);
}
/**
* 报告列表
* @param vo
@@ -36,4 +36,6 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
IPage<ReportVo> getAddReportPage(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo);
IPage<ReportVo> page(IPage<ReportEntity> page,@Param("pageVO") ReportQueryVo vo,@Param("idSet")Set<String> idSet);
IPage<ReportVo> reportManagerPage(IPage<ReportEntity> page,@Param("pageVO") ReportQueryVo vo,@Param("idSet")Set<String> idSet);
}
@@ -51,4 +51,6 @@ public interface IReportService {
IPage<ReportVo> addReportPage(ReportQueryVo vo) throws Exception;
IPage<ReportVo> page(ReportQueryVo vo);
IPage<ReportVo> reportManagerPage(ReportQueryVo vo);
}
@@ -105,7 +105,7 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
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);
@@ -448,6 +448,79 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
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.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1));
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;
}
/**
* 创建htmlstring
*
@@ -190,12 +190,8 @@
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} )
</if>
<if test="pageVO.name !='' and pageVO.name != null">
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
@@ -250,9 +246,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 +267,54 @@
#{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
eo.updateDate DESC
</select>
<select id="reportManagerPage" resultType="com.adc.da.report.vo.ReportVo">
SELECT
eo.id,
eo.NAME,
eo.keycontent,
eo.maincontent,
eo.DEPARTMENT,
eo.YEAR,
eo.fileid,
eo.confidentialLevel,
eo.privacyLevel,
pa.report_id,
pa.user_id,
pa.power
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
WHERE
eo.DEL_FLAG = 0
and eo.createUserId = #{pageVO.usid}
<if test="pageVO.name !='' and pageVO.name != null">
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
</if>
<if test="pageVO.keyContent !='' and pageVO.keyContent != null">
and keycontent like CONCAT(CONCAT('%',#{pageVO.keyContent}),'%')
</if>
<!--年份搜索-->
<if test="pageVO.year != null and pageVO.year.size() > 0">
and year in
<foreach collection="pageVO.year" item="year" open="(" separator="," close=")">
#{year}
</foreach>
</if>
<if test="pageVO.ids != null and pageVO.ids.size() > 0">
and eo.id in
<foreach collection="pageVO.ids" item="id" open="(" separator="," close=")">
@@ -291,7 +332,6 @@
eo.id
ORDER BY
eo.updateDate DESC
</select>
</mapper>
@@ -95,7 +95,7 @@ public class TodoTaskController {
private IBusProcessEntrustService iBusProcessEntrustService;
@Resource
private IBusProcessApproveService iBusProcessApproveService;
private IBusProcessApproveService ibusProcessApproveService;
@Resource
private BusProcessApproveMapper busProcessApproveMapper;
@@ -265,7 +265,7 @@ public class TodoTaskController {
busProcessApprove.setPrcId(task.getProcessInstanceId());
busProcessApprove.setCreateDate(new Date());
busProcessApprove.setFromValsJson(busMes.getSubmitJson());
iBusProcessApproveService.save(busProcessApprove);
ibusProcessApproveService.save(busProcessApprove);
if (StringUtils.isNotEmpty(dataJson)){
//根据业务情况 对业务数据进行saveOrupdate
activitDefineService.saveOrUpdateDate(busMes.getPrcType(),dataJson, task.getId(),task.getProcessInstanceId());
@@ -384,6 +384,40 @@ public class TodoTaskController {
return Result.success(busProcessNewVO);
}
/**
* @param dataId
* @param prcType
*/
@ApiOperation(value = "草稿详情")
@GetMapping("/queryDetailByDataId")
public ResponseMessage queryDetailByDataId(@RequestParam("dataId") String dataId,
@RequestParam("prcType")String prcType,
@RequestParam(value = "prcId",required = false)String prcId) {
// 查找详细业务数据
BusProcessNewVO busProcessNewVO = this.queryDetailDateByDataId(dataId, prcType);
//审批数据
BusProcessApprove busProcessApprove = new BusProcessApprove();
if(StringUtils.isNotEmpty(prcId)){
List<BusProcessApprove> busProcessApproves = busProcessApproveMapper.selectEoByPrcIdAndTask(prcId);
busProcessApprove = busProcessApproves.get(0);
}else {
busProcessApprove = busProcessApproveMapper.selectEoByDataId(dataId);
}
busProcessNewVO.setSubmitJson(busProcessApprove.getFromValsJson());
return Result.success(busProcessNewVO);
}
private BusProcessNewVO queryDetailDateByDataId(String dataId, String prcType) {
BusProcessNewVO busProcessNewVO = new BusProcessNewVO();
if ("1".equals(prcType)){
List<PowerApplyActPageVO> powerApplyActs = powerApplyActDao.selectListBydataId(dataId);
String string = JSONArray.toJSONString(powerApplyActs);
//去对应的 数据表查数据
busProcessNewVO.setDataJson(string);
}
return busProcessNewVO;
}
private BusProcessNewVO queryDetailDate(BusProcessNew busProcessNew, String prcType) {
BusProcessNewVO busProcessNewVO = new BusProcessNewVO();
BeanUtils.copyProperties(busProcessNew,busProcessNewVO);
@@ -406,7 +440,9 @@ public class TodoTaskController {
@PostMapping("/saveTaskFirst")
public Wrapper<String> saveTaskFirst(@RequestBody ApproveDataVO approveDataVO) {
String dataJson = approveDataVO.getDataJson();
String submitJson = approveDataVO.getSubmitJson();
String saveId = null;
String dataId = null;
if (approveDataVO.getId() != null && !approveDataVO.getId().equals("")) {
saveId = approveDataVO.getId();
@@ -418,8 +454,14 @@ public class TodoTaskController {
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
if (list != null && list.size() > 0) {
BusProcessName busProcessName = list.get(0);
busProcessName.setPrcName(approveDataVO.getPrcName());
busProcessName.setSubmitStatus(SubmitStatusEnum.DRAFT.getValue());
if (StringUtils.isNotEmpty(dataJson)){
//根据业务情况 对业务数据进行saveOrupdate
dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson, null,
null);
busProcessName.setDataId(dataId);
}
iBusProcessNameService.saveOrUpdate(busProcessName);
}
} else {
@@ -428,11 +470,12 @@ public class TodoTaskController {
BusProcessName busProcessName = new BusProcessName();
if (StringUtils.isNotEmpty(dataJson)) {
//根据业务情况 对业务数据进行saveOrupdate
String dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson,
dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson,
approveDataVO.getTaskId(),"");
busProcessName.setDataId(dataId);
}
busProcessName.setPrcType(approveDataVO.getPrcType());
busProcessName.setPrcName(approveDataVO.getPrcName());
busProcessName.setCreatUser(approveDataVO.getCreateUser());
busProcessName.setCreatTime(time);
busProcessName.setCreatUserName(approveDataVO.getCreateUserName());
@@ -444,10 +487,21 @@ public class TodoTaskController {
queryWrapper.eq("PRC_TYPE", approveDataVO.getPrcType());
queryWrapper.eq("CREAT_USER", approveDataVO.getCreateUser());
BusProcessName one = iBusProcessNameService.getOne(queryWrapper);
saveId = one.getId();
}
//存储审批数据
if (StringUtils.isNotEmpty(submitJson)){
BusProcessApprove busProcessApprove = busProcessApproveMapper.selectEoByDataId(dataId);
if (busProcessApprove == null){
busProcessApprove = new BusProcessApprove();
busProcessApprove.setDataId(dataId);
busProcessApprove.setCreateDate(new Date());
busProcessApprove.setCreateUserId(approveDataVO.getCreateUser());
}
busProcessApprove.setFromValsJson(submitJson);
ibusProcessApproveService.saveOrUpdate(busProcessApprove);
}
return WrapMapper.ok(saveId);
}
@@ -476,7 +530,7 @@ public class TodoTaskController {
*/
@ApiOperation(value = "查询草稿")
@PostMapping("/queryTaskDraft")
public List<BusProcessName> queryTaskDraft(@RequestBody TaskCommonQuery taskCommonQuery) {
public ResponseMessage queryTaskDraft(@RequestBody TaskCommonQuery taskCommonQuery) {
QueryWrapper<BusProcessName> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CREAT_USER", taskCommonQuery.getUserId());
if (taskCommonQuery.getPrcNum() != null && !taskCommonQuery.getPrcNum().equals("")) {
@@ -493,8 +547,14 @@ public class TodoTaskController {
queryWrapper.lambda().eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.DRAFT.getValue());
queryWrapper.orderByDesc("CREAT_TIME");
Page page = new Page();
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
return list;
List<BusProcessName> reList = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
page.setList(reList);
page.setPageNo(taskCommonQuery.getCurrent());
page.setPageSize(taskCommonQuery.getSize());
page.setCount((long) list.size());
return Result.success(page);
}
@ApiOperation(value = "查询流程是否结束", notes = "查询流程是否结束")
@@ -44,4 +44,7 @@ public class BusProcessApprove {
@TableField("FROM_VALS_JSON")
private String fromValsJson;
@TableField("DATA_ID")
private String dataId;
}
@@ -19,4 +19,5 @@ public interface BusProcessApproveMapper extends BaseMapper<BusProcessApprove> {
List<BusProcessApprove> selectEoByPrcIdAndTask(@Param("prcId") String prcId);
BusProcessApprove selectEoByDataId(@Param("dataId") String dataId);
}
@@ -32,4 +32,6 @@ public class ApproveDataVO {
private String dept;
private String prcName;
}
@@ -6,4 +6,7 @@
select * from bus_process_approve where prc_id = #{prcId}
Order by CREATE_DATE desc
</select>
<select id="selectEoByDataId" resultType="com.adc.da.wkflow.business_main.entity.BusProcessApprove">
select * from bus_process_approve where data_id =#{dataId}
</select>
</mapper>