Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -65,7 +65,7 @@ rocketmq:
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://172.16.46.63:30082/xxl-job-admin # 调度中心部署跟地址
|
||||
addresses: http://192.168.26.116:888/xxl-job-admin # 调度中心部署跟地址
|
||||
|
||||
# Lock4j 配置项
|
||||
lock4j:
|
||||
|
||||
@@ -97,7 +97,8 @@ easy-trans:
|
||||
xxl:
|
||||
job:
|
||||
executor:
|
||||
appname: ${spring.application.name} # 执行器 AppName
|
||||
# appname: ${spring.application.name} # 执行器 AppName
|
||||
appname: xxl-job-executor-sample # 执行器 AppName
|
||||
logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
|
||||
accessToken: default_token # 执行器通讯TOKEN
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zt.plat.module.qms.resource.record.controller.admin.recordrecord;
|
||||
|
||||
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.common.service.BusinessFileService;
|
||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementRespVO;
|
||||
import com.zt.plat.module.qms.resource.record.constant.RecordConstants;
|
||||
@@ -14,6 +16,9 @@ import com.zt.plat.module.qms.resource.record.controller.admin.recordrecord.vo.R
|
||||
import com.zt.plat.module.qms.resource.record.dal.dataobject.recordpermission.RecordPermissionDO;
|
||||
import com.zt.plat.module.qms.resource.record.service.recordcategory.RecordCategoryService;
|
||||
import com.zt.plat.module.qms.resource.record.service.recordpermission.RecordPermissionService;
|
||||
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||
import com.zt.plat.module.system.api.dept.dto.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -42,10 +47,12 @@ import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.RECORD_PERMISSION_NOT_ALLOW;
|
||||
|
||||
import com.zt.plat.module.qms.resource.record.dal.dataobject.recordrecord.RecordRecordDO;
|
||||
import com.zt.plat.module.qms.resource.record.service.recordrecord.RecordRecordService;
|
||||
|
||||
@Slf4j
|
||||
@Tag(name = "管理后台 - 文件、模板、记录")
|
||||
@RestController
|
||||
@RequestMapping("/qms/resource/record-record")
|
||||
@@ -69,6 +76,43 @@ public class RecordRecordController extends AbstractFileUploadController impleme
|
||||
@Resource
|
||||
private BusinessFileService businessFileService;
|
||||
|
||||
// @Resource
|
||||
// private DeptApi deptApi;
|
||||
|
||||
// @GetMapping("/deptList")
|
||||
// @Operation(summary = "获得文件记录关系")
|
||||
//@PreAuthorize("@ss.hasPermission('qms:record-relation:query')")
|
||||
// public CommonResult<List<DeptRespDTO>> getRecordRelation() {
|
||||
// // 获取当前部门的所有子部门
|
||||
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// Long visitCompanyId = loginUser.getVisitCompanyId();
|
||||
// log.info("visitCompanyId:{}", visitCompanyId);
|
||||
// Long deptId = loginUser.getVisitDeptId();
|
||||
// DeptListReqDTO dto = new DeptListReqDTO();
|
||||
// List<String> deptIds = new ArrayList<>();
|
||||
// deptIds.add(deptId.toString());
|
||||
// dto.setIds(deptIds);
|
||||
// CommonResult<List<DeptDetailRespDTO>> deptList = deptApi.getDeptList(dto);
|
||||
// log.info("deptList:{}", deptList);
|
||||
// // 获取当前所属公司下面的所有的部门
|
||||
// if (visitCompanyId != null) {
|
||||
//// return deptApi.getChildDeptList(visitCompanyId);
|
||||
// CommonResult<List<DeptSimpleRespDTO>> allCompanyList = deptApi.getAllCompanyList();
|
||||
// log.info("allCompanyList:{}", allCompanyList);
|
||||
// DeptSimpleRespDTO deptSimpleRespDTO = allCompanyList.getData().get(0);
|
||||
// deptSimpleRespDTO.getIsCompany();
|
||||
// log.info("deptSimpleRespDTO:{}", deptSimpleRespDTO);
|
||||
// CommonResult<List<DeptRespDTO>> childDeptList = deptApi.getChildDeptList(deptId);
|
||||
// log.info("childDeptList:{}", childDeptList);
|
||||
// CommonResult<Set<CompanyDeptInfoRespDTO>> companyDeptInfoListByUserId = deptApi.getCompanyDeptInfoListByUserId(loginUser.getId());
|
||||
// log.info("companyDeptInfoListByUserId:{}", companyDeptInfoListByUserId);
|
||||
// return childDeptList;
|
||||
// }
|
||||
// Long visitDeptId = loginUser.getVisitDeptId();
|
||||
// if (visitDeptId == null) return CommonResult.error(RECORD_PERMISSION_NOT_ALLOW.getCode(), "用户部门不存在");
|
||||
// return deptApi.getChildDeptList(visitDeptId);
|
||||
// }
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建文件、模板、记录->分类明细")
|
||||
@@ -151,5 +195,25 @@ public class RecordRecordController extends AbstractFileUploadController impleme
|
||||
return success(BeanUtils.toBean(result, RecordRecordRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
// 已由 XXL-Job 定时任务(updateRecordStatusJob)驱动,此接口保留用于手动触发/测试
|
||||
@GetMapping("/timing-updateRecordStatus")
|
||||
@Operation(summary = "定时更新文件、模板、记录状态")
|
||||
//@PreAuthorize("@ss.hasPermission('qms:record-record:update')")
|
||||
public CommonResult<Boolean> timingUpdateRecordStatus() {
|
||||
recordRecordService.updateRecordStatus();
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过定时任务,判断文件是否到期(到期自动作废)
|
||||
* @return
|
||||
*/
|
||||
// 已由 XXL-Job 定时任务(XXX)驱动,此接口保留用于手动触发/测试
|
||||
// @GetMapping("/timing-updateRecordStatus")
|
||||
// @Operation(summary = "定时更新文件、模板、记录状态")
|
||||
// //@PreAuthorize("@ss.hasPermission('qms:record-record:update')")
|
||||
// public CommonResult<Boolean> timingUpdateRecordStatus() {
|
||||
// recordRecordService.updateRecordStatus();
|
||||
// return success(true);
|
||||
// }
|
||||
}
|
||||
@@ -109,6 +109,6 @@ public class RecordRecordPageReqVO extends PageParam {
|
||||
@Schema(description = "是否查询历史数据")
|
||||
private Integer isQueryHistory; // 1-查询,0-不查询
|
||||
|
||||
private String ew;
|
||||
private String appraisalFlag;
|
||||
|
||||
}
|
||||
@@ -176,6 +176,7 @@ public class RecordRecordRespVO {
|
||||
private String flowInstanceId;
|
||||
|
||||
@Schema(description = "文件提交业务状态")
|
||||
@Dict(dicCode = "flow_status")
|
||||
private String applyBusinessStatus;
|
||||
|
||||
}
|
||||
@@ -91,6 +91,14 @@ public interface RecordRecordMapper extends BaseMapperX<RecordRecordDO> {
|
||||
@Param("userId") Long userId,
|
||||
@Param("userDepts") List<Long> userDepts);
|
||||
|
||||
/**
|
||||
* 通过 idPath 模糊查询 关联的文件记录
|
||||
* @param pathList
|
||||
* @return
|
||||
*/
|
||||
List<RecordRecordDO> selectRecordByIdPathLike(@Param("reqVO") RecordRecordPageReqVO reqVO,
|
||||
@Param("pathList") List<String> pathList);
|
||||
|
||||
// TODO
|
||||
// List<RecordRecordDO> selectViewApplyRecordList(@Param("pageReqVO") RecordRecordPageReqVO pageReqVO);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.zt.plat.module.qms.resource.record.job;
|
||||
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import com.zt.plat.module.qms.resource.record.service.recordrecord.RecordRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 文件记录相关定时任务
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class RecordRecordJob {
|
||||
|
||||
@Autowired
|
||||
private RecordRecordService recordRecordService;
|
||||
|
||||
/**
|
||||
* 定时更新文件记录生效状态
|
||||
* 检测 effectiveDate <= 当前时间 且 recordStatus != 1 的记录,将其更新为已生效(recordStatus = 1)
|
||||
*
|
||||
* JobHandler 名称: updateRecordStatusJob
|
||||
* 推荐 Cron: 0 0 0 * * ?(每天零点执行)
|
||||
*/
|
||||
@XxlJob("updateRecordStatusJob")
|
||||
public void updateRecordStatusJob() {
|
||||
log.info("[updateRecordStatusJob] 开始执行文件记录生效状态更新任务");
|
||||
try {
|
||||
Integer updateCount = recordRecordService.updateRecordStatus();
|
||||
log.info("[updateRecordStatusJob] 任务执行成功,共更新 {} 条记录", updateCount);
|
||||
XxlJobHelper.handleSuccess(String.format("任务执行成功,共更新 %d 条记录", updateCount));
|
||||
} catch (Exception e) {
|
||||
log.error("[updateRecordStatusJob] 任务执行失败:{}", e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,6 +56,7 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static cn.hutool.json.XMLTokener.entity;
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*;
|
||||
@@ -186,7 +187,8 @@ public class RecordApplyServiceImpl implements RecordApplyService, BMPCallbackIn
|
||||
recordApply.setApplyUserName(nickName);
|
||||
Long visitDeptId = loginUser.getVisitDeptId();
|
||||
// 获取当前用户所在的部门
|
||||
if (ObjectUtils.isEmpty(visitDeptId)) throw exception0(RECORD_APPLY_NOT_EXISTS.getCode(),"获取当前部门信息失败");
|
||||
if (ObjectUtils.isEmpty(visitDeptId))
|
||||
throw exception0(RECORD_APPLY_NOT_EXISTS.getCode(), "获取当前部门信息失败");
|
||||
recordApply.setApplyDepartmentId(visitDeptId);
|
||||
recordApply.setApplyDepartmentName(loginUser.getVisitDeptName());
|
||||
|
||||
@@ -527,7 +529,12 @@ public class RecordApplyServiceImpl implements RecordApplyService, BMPCallbackIn
|
||||
throw exception(RECORD_APPLY_NOT_EXISTS);
|
||||
RecordCategoryDO category = recordCategoryService.getRecordCategory(Long.valueOf(s));
|
||||
String customConfig = category.getCustomConfig();
|
||||
if (!ObjectUtils.isEmpty(customConfig)) {
|
||||
if (ObjectUtils.isEmpty(customConfig)) { // 空,直接判断是否到生效日期
|
||||
// 判断是否到生效日期
|
||||
RecordRecordDO effectiveRecordRecordDO = isEffective(recordDO);
|
||||
recordRecordService.updateRecordRecordById(effectiveRecordRecordDO);
|
||||
return true;
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.parseObject(customConfig);
|
||||
Integer submitFlag = jsonObject.getInteger("submitFlag");
|
||||
if (submitFlag == 0) {
|
||||
@@ -536,14 +543,31 @@ public class RecordApplyServiceImpl implements RecordApplyService, BMPCallbackIn
|
||||
recordRecordService.updateRecordRecordById(recordDO);
|
||||
return true;
|
||||
} else {
|
||||
// 把状态改为0
|
||||
recordDO.setRecordStatus(0); // 未生效
|
||||
recordRecordService.updateRecordRecordById(recordDO);
|
||||
}
|
||||
// 判断是否到生效日期
|
||||
RecordRecordDO effectiveRecordRecordDO = isEffective(recordDO);
|
||||
recordRecordService.updateRecordRecordById(effectiveRecordRecordDO);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 判断文件记录生效状态
|
||||
public RecordRecordDO isEffective(RecordRecordDO recordDO) {
|
||||
LocalDateTime effectiveDate = recordDO.getEffectiveDate();
|
||||
if (effectiveDate == null) { // 没有生效日期,立即生效
|
||||
recordDO.setRecordStatus(1);
|
||||
} else {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (now.isAfter(effectiveDate) || now.isEqual(effectiveDate)) {
|
||||
recordDO.setRecordStatus(1); // 已生效
|
||||
}
|
||||
// else {
|
||||
// recordDO.setRecordStatus(3); // 待生效
|
||||
// }
|
||||
}
|
||||
return recordDO;
|
||||
}
|
||||
|
||||
public void updateReviewFlag(Long applyId) {
|
||||
// Long[] recordIdS = param.getRecordIdS();
|
||||
List<RecordApplyDetailDO> recordApplyDetailDOS = recordApplyDetailService.selectAllList(applyId);
|
||||
@@ -798,14 +822,16 @@ public class RecordApplyServiceImpl implements RecordApplyService, BMPCallbackIn
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (now.isAfter(effectiveDate) || now.isEqual(effectiveDate)) {
|
||||
entity.setRecordStatus(1); // 已生效
|
||||
} else {
|
||||
entity.setRecordStatus(3); // 待生效
|
||||
}
|
||||
// else {
|
||||
// entity.setRecordStatus(0); // 待生效
|
||||
// }
|
||||
} else {
|
||||
entity.setRecordStatus(1); // 默认已生效
|
||||
}
|
||||
RecordRecordDO effectiveRecordRecordDO = isEffective(entity);
|
||||
// 修改状态
|
||||
recordApplyFlowStatus(entity);
|
||||
recordApplyFlowStatus(effectiveRecordRecordDO);
|
||||
}
|
||||
|
||||
// 评审通过,处理修改修改的文件,走更改申请流程
|
||||
|
||||
@@ -73,4 +73,5 @@ public interface RecordCategoryService {
|
||||
|
||||
List<RecordCategoryRespVO> getReviewRecordList();
|
||||
|
||||
List<RecordCategoryDO> selectCategoryAppraisalList(String appraisalFlag);
|
||||
}
|
||||
@@ -186,6 +186,13 @@ public class RecordCategoryServiceImpl implements RecordCategoryService {
|
||||
return BeanUtils.toBean(recordCategories, RecordCategoryRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecordCategoryDO> selectCategoryAppraisalList(String appraisalFlag) {
|
||||
LambdaQueryWrapper<RecordCategoryDO> queryWrapper = Wrappers.lambdaQuery();
|
||||
queryWrapper.like(RecordCategoryDO::getCustomConfig,"%" + appraisalFlag + "%");
|
||||
return recordCategoryMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateRecordCategory(RecordCategorySaveReqVO updateReqVO) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user