修改记录查询
This commit is contained in:
@@ -5,8 +5,6 @@ package com.zt.plat.module.qms.resource.record.constant;
|
||||
*/
|
||||
public class RecordConstants {
|
||||
|
||||
public static final String SUPER_ADMIN = "ytjyAdmin"; // 超级管理员 标识
|
||||
|
||||
/**
|
||||
* 权限目标类型
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.zt.plat.module.qms.resource.record.controller.admin.recordapply;
|
||||
|
||||
import com.zt.plat.framework.common.biz.system.permission.PermissionCommonApi;
|
||||
import com.zt.plat.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
||||
import com.zt.plat.framework.security.core.LoginUser;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.zt.plat.module.qms.resource.record.controller.admin.recordassign.vo.RecordAssignRespVO;
|
||||
import com.zt.plat.module.qms.resource.record.dal.dataobject.recordassign.RecordAssignDO;
|
||||
import com.zt.plat.module.qms.resource.record.service.recordassign.RecordAssignService;
|
||||
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||
import com.zt.plat.module.system.api.dept.dto.DeptRespDTO;
|
||||
@@ -21,9 +18,11 @@ import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.CURRENT_USER_COMPANY_NOT_EXISTS;
|
||||
@@ -43,10 +42,6 @@ public class CommonRecordController {
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
|
||||
@Resource
|
||||
private PermissionCommonApi permissionCommonApi;
|
||||
|
||||
@Resource
|
||||
private RecordAssignService recordAssignService;
|
||||
|
||||
@@ -64,7 +59,7 @@ public class CommonRecordController {
|
||||
@GetMapping("/user-assign-list")
|
||||
@Operation(summary = "获取当前用户所在公司的所有部门,以及分发号")
|
||||
public CommonResult<List<RecordAssignRespVO>> getUserAssignList() {
|
||||
CommonResult<List<AdminUserRespDTO>> deptList = this.getUserList();
|
||||
CommonResult<List<AdminUserRespDTO>> deptList = this.getUserList(null);
|
||||
if (ObjectUtils.isEmpty(deptList)) return CommonResult.success(new ArrayList<>());
|
||||
List<AdminUserRespDTO> data = deptList.getData();
|
||||
List<Long> deptIds = data.stream().map(AdminUserRespDTO::getId).toList();
|
||||
@@ -129,30 +124,24 @@ public class CommonRecordController {
|
||||
@GetMapping("/user-list")
|
||||
@Operation(summary = "获得当前公司下面的所有用户")
|
||||
//@PreAuthorize("@ss.hasPermission('qms:record-relation:query')")
|
||||
public CommonResult<List<AdminUserRespDTO>> getUserList() {
|
||||
public CommonResult<List<AdminUserRespDTO>> getUserList(@RequestParam(name = "deptIds", required = false) String deptIdsList) {
|
||||
log.info("deptIdsList:{}", deptIdsList); // "1,2,3,4,5"
|
||||
// 字符串转换成 list<Long> 列表
|
||||
List<Long> deptIds = new ArrayList<>();
|
||||
if (!ObjectUtils.isEmpty(deptIdsList)) {
|
||||
deptIds = Arrays.stream(deptIdsList.split(",")).map(Long::parseLong).toList();
|
||||
}
|
||||
CommonResult<List<AdminUserRespDTO>> userDataList;
|
||||
CommonResult<List<DeptRespDTO>> deptList = this.getDeptList();
|
||||
List<DeptRespDTO> data = deptList.getData();
|
||||
// 获取部门的所有id
|
||||
List<Long> deptIds = new ArrayList<>();
|
||||
data.forEach(deptRespDTO -> {
|
||||
deptIds.add(deptRespDTO.getId());
|
||||
});
|
||||
|
||||
if (ObjectUtils.isEmpty(deptIds)) {
|
||||
for (DeptRespDTO item : data) {
|
||||
deptIds.add(item.getId());
|
||||
}
|
||||
}
|
||||
userDataList = adminUserApi.getUserListByDeptIds(deptIds);
|
||||
return userDataList;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/test")
|
||||
@Operation(summary = "获得当前公司下面的所有用户")
|
||||
//@PreAuthorize("@ss.hasPermission('qms:record-relation:query')")
|
||||
public CommonResult<DeptDataPermissionRespDTO> test() {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
Long userId = loginUser.getId();
|
||||
CommonResult<Boolean> booleanCommonResult = permissionCommonApi.hasAnyPermissions(userId,"read");
|
||||
log.info("booleanCommonResult:{}", booleanCommonResult.getData());
|
||||
CommonResult<DeptDataPermissionRespDTO> ytjyAdmin = permissionCommonApi.getDeptDataPermissionWithRoleCodes(userId, "11");
|
||||
|
||||
return ytjyAdmin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@@ -99,7 +100,8 @@ public class RecordRecordPageReqVO extends PageParam {
|
||||
private Integer collectionFlag;
|
||||
|
||||
@Schema(description = "审批状态,需要走流程的审批状态")
|
||||
private String ApplyStatus;
|
||||
@Dict(dicCode = "flow_status")
|
||||
private String applyStatus;
|
||||
|
||||
@Schema(description = "流程实例Id")
|
||||
private String flowInstanceId;
|
||||
@@ -116,4 +118,7 @@ public class RecordRecordPageReqVO extends PageParam {
|
||||
|
||||
private String appraisalFlag;
|
||||
|
||||
// ===========扩展字段==========
|
||||
private List<Long> categoryIds;
|
||||
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class RecordRecordRespVO {
|
||||
|
||||
@Schema(description = "审批状态,需要走流程的审批状态")
|
||||
@Dict(dicCode = "flow_status")
|
||||
private String ApplyStatus;
|
||||
private String applyStatus;
|
||||
|
||||
@Schema(description = "流程实例Id")
|
||||
private String flowInstanceId;
|
||||
@@ -168,8 +168,8 @@ public class RecordRecordRespVO {
|
||||
// @Schema(description = "文件提交流程实例ID")
|
||||
// private String flowInstanceId;
|
||||
|
||||
@Schema(description = "文件提交业务状态")
|
||||
@Dict(dicCode = "flow_status")
|
||||
private String applyBusinessStatus;
|
||||
// @Schema(description = "文件提交业务状态")
|
||||
// @Dict(dicCode = "flow_status")
|
||||
// private String applyBusinessStatus;
|
||||
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class RecordRecordSaveReqVO {
|
||||
private Integer cancelFlag;
|
||||
|
||||
@Schema(description = "审批状态,需要走流程的审批状态")
|
||||
private String ApplyStatus;
|
||||
private String applyStatus;
|
||||
|
||||
@Schema(description = "流程实例Id")
|
||||
private String flowInstanceId;
|
||||
|
||||
@@ -132,7 +132,7 @@ public class RecordRecordDO extends BusinessBaseDO {
|
||||
* 审批状态,需要走流程的审批状态
|
||||
*/
|
||||
@TableField("APL_STS")
|
||||
private String ApplyStatus;
|
||||
private String applyStatus;
|
||||
/**
|
||||
* 流程实例Id
|
||||
*/
|
||||
|
||||
@@ -52,52 +52,11 @@ public interface RecordRecordMapper extends BaseMapperX<RecordRecordDO> {
|
||||
.orderByDesc(RecordRecordDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 多表关联分页查询:recordRecord、recordApplyDetail、recordApply
|
||||
* 关联关系:recordRecord.id = recordApplyDetail.documentId
|
||||
* recordApplyDetail.applyId = recordApply.id
|
||||
*/
|
||||
// IPage<RecordRecordDO> selectRecordWithApplyPage(Page<RecordRecordSaveReqVO> page, @Param("reqVO") RecordRecordPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 文件评审分页查询:关联查询 recordApply、recordApplyDetail、recordRecord
|
||||
* 查询条件:recordApply 的 businessType = '文件评审'
|
||||
*/
|
||||
// @Select("SELECT DISTINCT trr.* FROM t_rcd_rcd trr " +
|
||||
// "INNER JOIN t_rcd_apl_dtl trad ON trr.ID = trad.DOC_ID " +
|
||||
// "INNER JOIN t_rcd_apl tra ON trad.APL_ID = tra.ID " +
|
||||
// "WHERE tra.BSN_TP = #{businessType} " +
|
||||
// "ORDER BY trr.ID DESC " +
|
||||
// "LIMIT #{offset}, #{pageSize}")
|
||||
// List<RecordApplyJoinPageVO> selectRecordReviewPage(String businessType, int offset, int pageSize);
|
||||
IPage<RecordRecordDO> getEffectRecordPage(Page<RecordRecordSaveReqVO> page,
|
||||
RecordRecordPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获取文件评审总数
|
||||
*/
|
||||
// @Select("SELECT COUNT(DISTINCT trr.ID) FROM t_rcd_rcd trr " +
|
||||
// "INNER JOIN t_rcd_apl_dtl trad ON trr.ID = trad.DOC_ID " +
|
||||
// "INNER JOIN t_rcd_apl tra ON trad.APL_ID = tra.ID " +
|
||||
// "WHERE tra.BSN_TP = #{businessType}")
|
||||
// Long selectRecordReviewCount(String businessType);
|
||||
|
||||
/**
|
||||
* 通过 idPath 模糊查询 关联的文件记录
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
// IPage<RecordRecordDO> selectRecordByIdPathLike(Page<RecordRecordSaveReqVO> page,
|
||||
// @Param("reqVO") RecordRecordPageReqVO reqVO,
|
||||
// @Param("pathList") List<String> pathList);
|
||||
// IPage<RecordRecordDO> getNotSubmitEffectRecordPage(Page<RecordRecordSaveReqVO> page, @Param("reqVO") RecordRecordPageReqVO reqVO);
|
||||
|
||||
IPage<RecordRecordDO> getSubmitEffectRecordPage(Page<RecordRecordSaveReqVO> page,
|
||||
RecordRecordPageReqVO reqVO,
|
||||
List<Long> categoryIds);
|
||||
|
||||
// IPage<RecordRecordDO> getEffectiveRecordBySubmitFlagPage(Page<RecordRecordSaveReqVO> page, @Param("reqVO") RecordRecordPageReqVO reqVO);
|
||||
|
||||
IPage<RecordRecordDO> getNotSubmitEffectRecordPage(Page<RecordRecordSaveReqVO> page, @Param("reqVO") RecordRecordPageReqVO reqVO, List<Long> categoryIds);
|
||||
|
||||
// TODO
|
||||
// List<RecordRecordDO> selectViewApplyRecordList(@Param("pageReqVO") RecordRecordPageReqVO pageReqVO);
|
||||
}
|
||||
@@ -401,7 +401,7 @@ public class RecordApplyServiceImpl implements RecordApplyService, BMPCallbackIn
|
||||
public boolean justifyRecordApply(RecordRecordDO recordDO) {
|
||||
Integer recordStatus = recordDO.getRecordStatus();
|
||||
if (recordStatus != null && recordStatus == 1)
|
||||
throw exception(RECORD_APPLY_NOT_EXISTS, "文件已提交,无法提交申请");
|
||||
throw exception0(RECORD_APPLY_NOT_EXISTS.getCode(), "文件已提交,无法提交申请");
|
||||
RecordCategoryDO recordCategory = recordCategoryService.getRecordCategory(recordDO.getCategoryId());
|
||||
// 获取分类的根分类Id
|
||||
String idPath = recordCategory.getIdPath();
|
||||
@@ -800,12 +800,10 @@ public class RecordApplyServiceImpl implements RecordApplyService, BMPCallbackIn
|
||||
LocalDateTime endDate = applyDetailDO.getEndDate();
|
||||
if (!ObjectUtils.isEmpty(saveFlag)) {
|
||||
permissionDO.setSaveFlag(saveFlag);
|
||||
permissionDO.setSaveEndDate(endDate);
|
||||
}else {
|
||||
permissionDO.setExpirationDate(endDate);
|
||||
// permissionDO.setSaveEndDate(endDate);
|
||||
}
|
||||
List<RecordPermissionDO> permissionDOList = new ArrayList<>();
|
||||
|
||||
permissionDO.setExpirationDate(endDate); // 过期效期
|
||||
permissionDO.setPermission(RecordConstants.PermissionType.VIEW); // 可查看
|
||||
permissionDO.setSourceType(RecordConstants.PermissionSourceType.RECORD); // 记录权限
|
||||
permissionDO.setSourceId(applyDetailDO.getDocumentId()); // 文件Id
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.security.core.LoginUser;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.zt.plat.module.qms.core.aspect.annotation.QmsPermission;
|
||||
import com.zt.plat.module.qms.enums.QmsPermissionConstant;
|
||||
import com.zt.plat.module.qms.resource.record.constant.RecordConstants;
|
||||
import com.zt.plat.module.qms.resource.record.controller.admin.recordpermission.vo.RecordPermissionPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.record.controller.admin.recordpermission.vo.RecordPermissionRespVO;
|
||||
@@ -200,7 +201,7 @@ public class RecordPermissionServiceImpl implements RecordPermissionService {
|
||||
public boolean judgeIsSuperAdmin() {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
Long userId = loginUser.getId();
|
||||
CommonResult<Boolean> booleanCommonResult = permissionCommonApi.hasAnyRoles(userId, RecordConstants.SUPER_ADMIN);
|
||||
CommonResult<Boolean> booleanCommonResult = permissionCommonApi.hasAnyRoles(userId, QmsPermissionConstant.ADMIN_ROLE);
|
||||
log.info("booleanCommonResult:{}", booleanCommonResult.getData());
|
||||
return booleanCommonResult.getData();
|
||||
}
|
||||
@@ -315,9 +316,9 @@ public class RecordPermissionServiceImpl implements RecordPermissionService {
|
||||
log.info("[withdrawPermissionJob] 开始执行文件记录生效状态更新任务");
|
||||
try {
|
||||
Integer expireJob = expireDateExpireJob();
|
||||
Integer saved = saveEndDateExpireJob();
|
||||
log.info("[withdrawPermissionJob] 任务执行成功,共更新 {} 条记录", expireJob + saved);
|
||||
XxlJobHelper.handleSuccess(String.format("任务执行成功,共更新 %d 条记录", expireJob + saved));
|
||||
// Integer saved = saveEndDateExpireJob();
|
||||
log.info("[withdrawPermissionJob] 任务执行成功,共更新 {} 条记录", expireJob);
|
||||
XxlJobHelper.handleSuccess(String.format("任务执行成功,共更新 %d 条记录", expireJob));
|
||||
} catch (Exception e) {
|
||||
log.error("[withdrawPermissionJob] 任务执行失败:{}", e.getMessage(), e);
|
||||
throw e;
|
||||
|
||||
@@ -542,16 +542,17 @@ public class RecordRecordServiceImpl implements RecordRecordService {
|
||||
*
|
||||
* @param submitFlag
|
||||
* @param pageReqVO
|
||||
* @param categoryIds
|
||||
* @return
|
||||
*/
|
||||
public PageResult<RecordRecordDO> selectEffectRecordList(int submitFlag, RecordRecordPageReqVO pageReqVO, List<Long> categoryIds) {
|
||||
public PageResult<RecordRecordDO> selectEffectRecordList(int submitFlag, RecordRecordPageReqVO pageReqVO) {
|
||||
Page<RecordRecordSaveReqVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
if (submitFlag == 1) { // 不需要提交数据
|
||||
IPage<RecordRecordDO> recordRecordDOPageResult = recordRecordMapper.getNotSubmitEffectRecordPage(page, pageReqVO, categoryIds);
|
||||
pageReqVO.setSubmitFlag(1);
|
||||
IPage<RecordRecordDO> recordRecordDOPageResult = recordRecordMapper.getEffectRecordPage(page, pageReqVO);
|
||||
return new PageResult<>(recordRecordDOPageResult.getRecords(), recordRecordDOPageResult.getTotal());
|
||||
} else { // 需要提交数据
|
||||
IPage<RecordRecordDO> submitEffectRecordPage = recordRecordMapper.getSubmitEffectRecordPage(page, pageReqVO, categoryIds);
|
||||
pageReqVO.setSubmitFlag(0);
|
||||
IPage<RecordRecordDO> submitEffectRecordPage = recordRecordMapper.getEffectRecordPage(page, pageReqVO);
|
||||
return new PageResult<>(submitEffectRecordPage.getRecords(), submitEffectRecordPage.getTotal());
|
||||
}
|
||||
}
|
||||
@@ -584,6 +585,8 @@ public class RecordRecordServiceImpl implements RecordRecordService {
|
||||
String customConfig = categoryDO.getCustomConfig();
|
||||
String appraisalFlag = pageReqVO.getAppraisalFlag();
|
||||
|
||||
pageReqVO.setCategoryIds(categoryIds);
|
||||
|
||||
// 判断是否需要提交(json)
|
||||
Integer submitFlag = 0;
|
||||
if (!ObjectUtils.isEmpty(customConfig)) {
|
||||
@@ -599,11 +602,11 @@ public class RecordRecordServiceImpl implements RecordRecordService {
|
||||
|
||||
// 查询有效,或者提交审批完成,将来生效的记录 (recordStatus = 1 or (applyStatus = 'completed' and now() > effectiveDate))
|
||||
// 需要评审,且需要提交的数据
|
||||
return selectEffectRecordList(submitFlag, pageReqVO, categoryIds);
|
||||
return selectEffectRecordList(submitFlag, pageReqVO);
|
||||
}
|
||||
|
||||
// 通用查询,查询,有效,或将来有效的记录
|
||||
return selectEffectRecordList(submitFlag, pageReqVO, categoryIds);
|
||||
return selectEffectRecordList(submitFlag, pageReqVO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user