feat:qms阶段性提交
This commit is contained in:
@@ -87,6 +87,11 @@ public interface BusinessAssayTaskDetailMapper extends BaseMapperX<BusinessAssay
|
|||||||
return selectList(new LambdaQueryWrapperX<BusinessAssayTaskDetailDO>()
|
return selectList(new LambdaQueryWrapperX<BusinessAssayTaskDetailDO>()
|
||||||
.eqIfPresent(BusinessAssayTaskDetailDO::getBusinessAssayTaskId, businessAssayTaskId));
|
.eqIfPresent(BusinessAssayTaskDetailDO::getBusinessAssayTaskId, businessAssayTaskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Long selectCountByBusinessAssayTaskId(Long businessAssayTaskId) {
|
||||||
|
return selectCount(new LambdaQueryWrapperX<BusinessAssayTaskDetailDO>()
|
||||||
|
.eqIfPresent(BusinessAssayTaskDetailDO::getBusinessAssayTaskId, businessAssayTaskId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物理批量删除删除
|
* 物理批量删除删除
|
||||||
|
|||||||
@@ -74,12 +74,19 @@ public interface BusinessSubParentSampleAssessmentProjectMapper extends BaseMapp
|
|||||||
return selectList(new LambdaQueryWrapper<BusinessSubParentSampleAssessmentProjectDO>()
|
return selectList(new LambdaQueryWrapper<BusinessSubParentSampleAssessmentProjectDO>()
|
||||||
.eq(BusinessSubParentSampleAssessmentProjectDO::getConfigAssayMethodId, configAssayMethodId));
|
.eq(BusinessSubParentSampleAssessmentProjectDO::getConfigAssayMethodId, configAssayMethodId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default List<BusinessSubParentSampleAssessmentProjectDO> selectByBusinessSubParentSampleAssessmentIdAndDictionaryProjectIds(Long businessSubParentSampleAssessmentId, List<Long> recheckDictionaryProjectIdList) {
|
default List<BusinessSubParentSampleAssessmentProjectDO> selectByBusinessSubParentSampleAssessmentIdAndDictionaryProjectIds(Long businessSubParentSampleAssessmentId, List<Long> recheckDictionaryProjectIdList) {
|
||||||
return selectList(new LambdaQueryWrapper<BusinessSubParentSampleAssessmentProjectDO>()
|
return selectList(new LambdaQueryWrapper<BusinessSubParentSampleAssessmentProjectDO>()
|
||||||
.eq(BusinessSubParentSampleAssessmentProjectDO::getBusinessSubParentSampleAssessmentId, businessSubParentSampleAssessmentId)
|
.eq(BusinessSubParentSampleAssessmentProjectDO::getBusinessSubParentSampleAssessmentId, businessSubParentSampleAssessmentId)
|
||||||
.in(BusinessSubParentSampleAssessmentProjectDO::getDictionaryProjectId, recheckDictionaryProjectIdList));
|
.in(BusinessSubParentSampleAssessmentProjectDO::getDictionaryProjectId, recheckDictionaryProjectIdList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<BusinessSubParentSampleAssessmentProjectDO> selectByBusinessSubParentSampleAssessmentId(Long businessSubParentSampleAssessmentId) {
|
||||||
|
return selectList(new LambdaQueryWrapper<BusinessSubParentSampleAssessmentProjectDO>()
|
||||||
|
.eq(BusinessSubParentSampleAssessmentProjectDO::getBusinessSubParentSampleAssessmentId, businessSubParentSampleAssessmentId));
|
||||||
|
}
|
||||||
|
|
||||||
List<NoReportSubParentSampleAssessmentRespVO> selectNoReportSubParentSampleAssessment(@Param("reqVO") BusinessSubParentSampleAssessmentGroupReqVO reqVO);
|
List<NoReportSubParentSampleAssessmentRespVO> selectNoReportSubParentSampleAssessment(@Param("reqVO") BusinessSubParentSampleAssessmentGroupReqVO reqVO);
|
||||||
|
|
||||||
|
|||||||
@@ -759,8 +759,8 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果为自动上报
|
//如果为自动上报, 并且上报状态为待上报的
|
||||||
if (QmsCommonConstant.AUTOMATIC.equals(configSubSampleMethodDO.getResultTreatmentWay())) {
|
if (QmsCommonConstant.AUTOMATIC.equals(configSubSampleMethodDO.getResultTreatmentWay()) && QmsCommonConstant.ASMT_PENDING_REPORT.equals(businessSubSampleAssessmentDO.getReportedStatus())) {
|
||||||
automaticBusinessSubSampleIdList.add(businessSubSampleId);
|
automaticBusinessSubSampleIdList.add(businessSubSampleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1366,10 +1366,22 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
|
|||||||
businessAssayTaskDataDO.setExternalInfomation(JSON.toJSONString(businessAssayTaskDataExternalInfomation));
|
businessAssayTaskDataDO.setExternalInfomation(JSON.toJSONString(businessAssayTaskDataExternalInfomation));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//任务id
|
||||||
|
Long businessAssayTaskId = businessAssayTaskDetailList.stream().map(m -> m.getBusinessAssayTaskId()).distinct().findFirst().orElse(null);
|
||||||
|
//查询任务下的明细
|
||||||
|
Long taskCount = businessAssayTaskDetailMapper.selectCountByBusinessAssayTaskId(businessAssayTaskId);
|
||||||
|
if (businessAssayTaskDetailList.size() == taskCount.intValue()) {//如果回退所有样品,则作废任务
|
||||||
|
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId);
|
||||||
|
businessAssayTaskDO.setTaskAssignStatus(QmsCommonConstant.VOID);
|
||||||
|
|
||||||
|
businessAssayTaskMapper.updateById(businessAssayTaskDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
//明细处理
|
||||||
if (CollUtil.isNotEmpty(businessAssayTaskDetailList)) {
|
if (CollUtil.isNotEmpty(businessAssayTaskDetailList)) {
|
||||||
businessAssayTaskDetailMapper.updateBatch(businessAssayTaskDetailList);
|
businessAssayTaskDetailMapper.updateBatch(businessAssayTaskDetailList);
|
||||||
}
|
}
|
||||||
|
//任务明细处理
|
||||||
if (CollUtil.isNotEmpty(businessAssayTaskDataDOList)) {
|
if (CollUtil.isNotEmpty(businessAssayTaskDataDOList)) {
|
||||||
businessAssayTaskDataMapper.updateBatch(businessAssayTaskDataDOList);
|
businessAssayTaskDataMapper.updateBatch(businessAssayTaskDataDOList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,9 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
|||||||
noReportSubParentSampleAssessmentMap.put(businessSubParentSampleAssessmentProjectDO.getSimpleName(), assessmentValue);
|
noReportSubParentSampleAssessmentMap.put(businessSubParentSampleAssessmentProjectDO.getSimpleName(), assessmentValue);
|
||||||
businessSubParentSampleAssessmentProjectIds.append(businessSubParentSampleAssessmentProjectDO.getId()).append(",");
|
businessSubParentSampleAssessmentProjectIds.append(businessSubParentSampleAssessmentProjectDO.getId()).append(",");
|
||||||
}
|
}
|
||||||
businessSubParentSampleAssessmentProjectIds.delete(businessSubParentSampleAssessmentProjectIds.length() -1, businessSubParentSampleAssessmentProjectIds.length());
|
if (businessSubParentSampleAssessmentProjectIds.length() > 0) {
|
||||||
|
businessSubParentSampleAssessmentProjectIds.delete(businessSubParentSampleAssessmentProjectIds.length() -1, businessSubParentSampleAssessmentProjectIds.length());
|
||||||
|
}
|
||||||
noReportSubParentSampleAssessmentMap.put("businessSubParentSampleAssessmentProjectIds", businessSubParentSampleAssessmentProjectIds.toString());
|
noReportSubParentSampleAssessmentMap.put("businessSubParentSampleAssessmentProjectIds", businessSubParentSampleAssessmentProjectIds.toString());
|
||||||
noReportSubParentSampleAssessmentMap.put("businessSubParentSampleAssessmentId", noReportSubParentSampleAssessmentRespVO.getBusinessSubParentSampleAssessmentId());
|
noReportSubParentSampleAssessmentMap.put("businessSubParentSampleAssessmentId", noReportSubParentSampleAssessmentRespVO.getBusinessSubParentSampleAssessmentId());
|
||||||
dataList.add(noReportSubParentSampleAssessmentMap);
|
dataList.add(noReportSubParentSampleAssessmentMap);
|
||||||
@@ -341,15 +343,15 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
|||||||
BusinessSubParentSampleAssessmentDO olBusinessSubParentSampleAssessmentDO = businessSubParentSampleAssessmentMapper.selectById(reqVO.getBusinessSubParentSampleAssessmentId());
|
BusinessSubParentSampleAssessmentDO olBusinessSubParentSampleAssessmentDO = businessSubParentSampleAssessmentMapper.selectById(reqVO.getBusinessSubParentSampleAssessmentId());
|
||||||
|
|
||||||
//查询分样主样判定
|
//查询分样主样判定
|
||||||
BusinessSubParentSampleAssessmentDO businessSubParentSampleAssessmentDO = businessSubParentSampleAssessmentMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(reqVO.getBusinessSubParentSampleId(), reqVO.getConfigAssayMethodId());
|
//BusinessSubParentSampleAssessmentDO businessSubParentSampleAssessmentDO = businessSubParentSampleAssessmentMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(reqVO.getBusinessSubParentSampleId(), reqVO.getConfigAssayMethodId());
|
||||||
if (businessSubParentSampleAssessmentDO == null) {
|
if (olBusinessSubParentSampleAssessmentDO == null) {
|
||||||
throw new ServiceException(1_032_050_000, "结果报送数据未找到");
|
throw new ServiceException(1_032_050_000, "结果报送数据未找到");
|
||||||
}
|
}
|
||||||
|
|
||||||
//复检的检测项目
|
//复检的检测项目
|
||||||
List<RecheckSubSampleParentMethodRespVO> recheckProjectList = reqVO.getRecheckProjectList();
|
List<RecheckSubSampleParentMethodRespVO> recheckProjectList = reqVO.getRecheckProjectList();
|
||||||
List<Long> recheckDictionaryProjectIdList = recheckProjectList.stream().map(m -> m.getDictionaryProjectId()).collect(Collectors.toList());
|
List<Long> recheckDictionaryProjectIdList = recheckProjectList.stream().map(m -> m.getDictionaryProjectId()).collect(Collectors.toList());
|
||||||
List<BusinessSubParentSampleAssessmentProjectDO> businessSubParentSampleAssessmentProjectDOList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleAssessmentIdAndDictionaryProjectIds(businessSubParentSampleAssessmentDO.getId(), recheckDictionaryProjectIdList);
|
List<BusinessSubParentSampleAssessmentProjectDO> businessSubParentSampleAssessmentProjectDOList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleAssessmentIdAndDictionaryProjectIds(olBusinessSubParentSampleAssessmentDO.getId(), recheckDictionaryProjectIdList);
|
||||||
for (BusinessSubParentSampleAssessmentProjectDO businessSubParentSampleAssessmentProjectDO : businessSubParentSampleAssessmentProjectDOList) {
|
for (BusinessSubParentSampleAssessmentProjectDO businessSubParentSampleAssessmentProjectDO : businessSubParentSampleAssessmentProjectDOList) {
|
||||||
businessSubParentSampleAssessmentProjectDO.setIsReported(QmsCommonConstant.NO);
|
businessSubParentSampleAssessmentProjectDO.setIsReported(QmsCommonConstant.NO);
|
||||||
businessSubParentSampleAssessmentProjectDO.setAssessmentStatus(QmsCommonConstant.VOID);
|
businessSubParentSampleAssessmentProjectDO.setAssessmentStatus(QmsCommonConstant.VOID);
|
||||||
@@ -410,7 +412,8 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
|||||||
newBusinessSubSampleParentRetestDOList.add(businessSubSampleParentRetestDO );
|
newBusinessSubSampleParentRetestDOList.add(businessSubSampleParentRetestDO );
|
||||||
}
|
}
|
||||||
|
|
||||||
BusinessSubSampleAssessmentDO newBusinessSubSampleAssessmentDO = newSubSampleAssessmentDOList.stream().filter(f -> f.getBusinessSubParentSampleAssessmentId().equals(businessSubParentSampleAssessmentDO.getId())).findFirst().orElse(null);
|
Long newBusinessSubParentSampleAssessmentId = newBusinessSubParentSampleAssessmentDO.getId();
|
||||||
|
BusinessSubSampleAssessmentDO newBusinessSubSampleAssessmentDO = newSubSampleAssessmentDOList.stream().filter(f -> f.getBusinessSubParentSampleAssessmentId().equals(newBusinessSubParentSampleAssessmentId)).findFirst().orElse(null);
|
||||||
if (newBusinessSubSampleAssessmentDO == null) {
|
if (newBusinessSubSampleAssessmentDO == null) {
|
||||||
newBusinessSubSampleAssessmentDO = new BusinessSubSampleAssessmentDO();
|
newBusinessSubSampleAssessmentDO = new BusinessSubSampleAssessmentDO();
|
||||||
newBusinessSubSampleAssessmentDO.setId(IdWorker.getId());
|
newBusinessSubSampleAssessmentDO.setId(IdWorker.getId());
|
||||||
@@ -493,6 +496,11 @@ public class SampleResultReportingServiceImpl implements SampleResultReportingSe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<BusinessSubParentSampleAssessmentProjectDO> allBusinessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleAssessmentId(olBusinessSubParentSampleAssessmentDO.getId());
|
||||||
|
if (allBusinessSubParentSampleAssessmentProjectList.size() == businessSubParentSampleAssessmentProjectDOList.size()) {//如果复测项目都全部完成,则删除旧的结果报送
|
||||||
|
businessSubParentSampleAssessmentMapper.deleteById(olBusinessSubParentSampleAssessmentDO.getId());
|
||||||
|
}
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(businessSubParentSampleAssessmentProjectDOList)) {
|
if (CollUtil.isNotEmpty(businessSubParentSampleAssessmentProjectDOList)) {
|
||||||
businessSubParentSampleAssessmentProjectMapper.updateBatch(businessSubParentSampleAssessmentProjectDOList);
|
businessSubParentSampleAssessmentProjectMapper.updateBatch(businessSubParentSampleAssessmentProjectDOList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,227 +1,226 @@
|
|||||||
package com.zt.plat.module.qms.framework.datapermission;
|
//package com.zt.plat.module.qms.framework.datapermission;
|
||||||
|
//
|
||||||
import cn.hutool.core.collection.CollUtil;
|
//import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
//import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.handler.MultiDataPermissionHandler;
|
//import com.alibaba.fastjson.JSONObject;
|
||||||
import com.zt.plat.framework.common.biz.system.permission.PermissionCommonApi;
|
//import com.baomidou.mybatisplus.extension.plugins.handler.MultiDataPermissionHandler;
|
||||||
import com.zt.plat.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO;
|
//import com.zt.plat.framework.common.biz.system.permission.PermissionCommonApi;
|
||||||
import com.zt.plat.framework.common.enums.UserTypeEnum;
|
//import com.zt.plat.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO;
|
||||||
import com.zt.plat.framework.common.util.collection.CollectionUtils;
|
//import com.zt.plat.framework.common.enums.UserTypeEnum;
|
||||||
import com.zt.plat.framework.common.util.json.JsonUtils;
|
//import com.zt.plat.framework.common.util.collection.CollectionUtils;
|
||||||
import com.zt.plat.framework.mybatis.core.util.MyBatisUtils;
|
//import com.zt.plat.framework.common.util.json.JsonUtils;
|
||||||
import com.zt.plat.framework.security.core.LoginUser;
|
//import com.zt.plat.framework.mybatis.core.util.MyBatisUtils;
|
||||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
//import com.zt.plat.framework.security.core.LoginUser;
|
||||||
//import com.zt.plat.module.qms.core.aspect.annotation.QmsPermission;
|
//import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.zt.plat.framework.tenant.core.context.DeptContextHolder;
|
////import com.zt.plat.module.qms.core.aspect.annotation.QmsPermission;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import com.zt.plat.framework.tenant.core.context.DeptContextHolder;
|
||||||
import net.sf.jsqlparser.expression.Alias;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import net.sf.jsqlparser.expression.Expression;
|
//import net.sf.jsqlparser.expression.Alias;
|
||||||
import net.sf.jsqlparser.expression.LongValue;
|
//import net.sf.jsqlparser.expression.Expression;
|
||||||
import net.sf.jsqlparser.expression.NullValue;
|
//import net.sf.jsqlparser.expression.LongValue;
|
||||||
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
//import net.sf.jsqlparser.expression.NullValue;
|
||||||
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
//import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||||
import net.sf.jsqlparser.expression.operators.relational.*;
|
//import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
||||||
import net.sf.jsqlparser.schema.Column;
|
//import net.sf.jsqlparser.expression.operators.relational.*;
|
||||||
import net.sf.jsqlparser.schema.Table;
|
//import net.sf.jsqlparser.schema.Column;
|
||||||
import net.sf.jsqlparser.statement.select.ParenthesedSelect;
|
//import net.sf.jsqlparser.schema.Table;
|
||||||
import net.sf.jsqlparser.statement.select.PlainSelect;
|
//import net.sf.jsqlparser.statement.select.ParenthesedSelect;
|
||||||
import net.sf.jsqlparser.statement.select.SelectItem;
|
//import net.sf.jsqlparser.statement.select.PlainSelect;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import net.sf.jsqlparser.statement.select.SelectItem;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
import java.util.ArrayList;
|
//
|
||||||
import java.util.Arrays;
|
//import java.util.ArrayList;
|
||||||
import java.util.List;
|
//import java.util.Arrays;
|
||||||
import java.util.Set;
|
//import java.util.List;
|
||||||
|
//import java.util.Set;
|
||||||
import static java.util.Collections.singletonList;
|
//
|
||||||
|
//import static java.util.Collections.singletonList;
|
||||||
|
//
|
||||||
/*
|
//
|
||||||
* QMS权限处理
|
///*
|
||||||
* 1、只能查看自己创建的数据
|
//* QMS权限处理
|
||||||
* 2、部门领导可查看本部门数据
|
//* 1、只能查看自己创建的数据
|
||||||
* 3、模块管理员可查看本模块数据
|
//* 2、部门领导可查看本部门数据
|
||||||
*
|
//* 3、模块管理员可查看本模块数据
|
||||||
* */
|
//*
|
||||||
@Component
|
//* */
|
||||||
@Slf4j
|
//@Component
|
||||||
public class QMSMultiDataPermissionHandler implements MultiDataPermissionHandler {
|
//@Slf4j
|
||||||
|
//public class QMSMultiDataPermissionHandler implements MultiDataPermissionHandler {
|
||||||
@Autowired private PermissionCommonApi permissionApi;
|
//
|
||||||
/**
|
// @Autowired private PermissionCommonApi permissionApi;
|
||||||
* LoginUser 的 Context 缓存 Key
|
// /**
|
||||||
*/
|
// * LoginUser 的 Context 缓存 Key
|
||||||
protected static final String QMS_PERMISSION_CONTEXT_KEY = "QMS_DATA_PERMISSION";
|
// */
|
||||||
static final Expression EXPRESSION_NULL = new NullValue();
|
// protected static final String QMS_PERMISSION_CONTEXT_KEY = "QMS_DATA_PERMISSION";
|
||||||
public static final String SYSTEM_USERS = "system_users";
|
// static final Expression EXPRESSION_NULL = new NullValue();
|
||||||
private static final String SYSTEM_USER_DEPT = "system_user_dept";
|
// public static final String SYSTEM_USERS = "system_users";
|
||||||
private static final String DEPT_COLUMN_NAME = "dept_id";
|
// private static final String SYSTEM_USER_DEPT = "system_user_dept";
|
||||||
private static final String USER_COLUMN_NAME = "user_id";
|
// private static final String DEPT_COLUMN_NAME = "dept_id";
|
||||||
|
// private static final String USER_COLUMN_NAME = "user_id";
|
||||||
@Override
|
//
|
||||||
public Expression getSqlSegment(Table table, Expression where, String mappedStatementId) {
|
// @Override
|
||||||
log.error("QMSMultiDataPermissionHandler: Expression={}", where);
|
// public Expression getSqlSegment(Table table, Expression where, String mappedStatementId) {
|
||||||
|
// log.error("QMSMultiDataPermissionHandler: Expression={}", where);
|
||||||
//获取注解
|
//
|
||||||
if(!QMSPermissionContextHolder.shouldExecute())
|
// //获取注解
|
||||||
return null;
|
// if(!QMSPermissionContextHolder.shouldExecute())
|
||||||
try{
|
// return null;
|
||||||
Expression expression = buildExpression(table, where);
|
// try{
|
||||||
return expression;
|
// Expression expression = buildExpression(table, where);
|
||||||
}catch (Exception e){
|
// return expression;
|
||||||
log.error("QMSMultiDataPermissionHandler: Expression={}", where);
|
// }catch (Exception e){
|
||||||
}finally {
|
// log.error("QMSMultiDataPermissionHandler: Expression={}", where);
|
||||||
QMSPermissionContextHolder.clear();
|
// }finally {
|
||||||
}
|
// QMSPermissionContextHolder.clear();
|
||||||
return EXPRESSION_NULL;
|
// }
|
||||||
}
|
// return EXPRESSION_NULL;
|
||||||
|
// }
|
||||||
/*
|
//
|
||||||
* 构建权限sql*/
|
// /*
|
||||||
private Expression buildExpression(Table table, Expression where) {
|
// * 构建权限sql*/
|
||||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
// private Expression buildExpression(Table table, Expression where) {
|
||||||
if (loginUser == null) {
|
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
return EXPRESSION_NULL;
|
// if (loginUser == null) {
|
||||||
}
|
// return EXPRESSION_NULL;
|
||||||
//管理员用户,不进行权限处理
|
// }
|
||||||
if (ObjectUtil.notEqual(loginUser.getUserType(), UserTypeEnum.ADMIN.getValue())) {
|
// //管理员用户,不进行权限处理
|
||||||
return null;
|
// if (ObjectUtil.notEqual(loginUser.getUserType(), UserTypeEnum.ADMIN.getValue())) {
|
||||||
}
|
// return null;
|
||||||
String deptIdCol = QMSPermissionContextHolder.getDeptIdColumn(); //部门id列
|
// }
|
||||||
String userIdCol = QMSPermissionContextHolder.getUserIdColumn(); //人员id列
|
// String deptIdCol = QMSPermissionContextHolder.getDeptIdColumn(); //部门id列
|
||||||
String deptDataRoleCodes = QMSPermissionContextHolder.getDeptDataRoleCode(); //部门数据权限角色。具有该角色,然后按角色的权限属性判断。从而获得人员允许查看的部门数据
|
// String userIdCol = QMSPermissionContextHolder.getUserIdColumn(); //人员id列
|
||||||
String moduleDataRoleCodes = QMSPermissionContextHolder.getModuleDataRoleCodes(); //模块数据权限角色。
|
// String deptDataRoleCodes = QMSPermissionContextHolder.getDeptDataRoleCode(); //部门数据权限角色。具有该角色,然后按角色的权限属性判断。从而获得人员允许查看的部门数据
|
||||||
String custom = QMSPermissionContextHolder.getCustom(); //todo 自定义权限
|
// String moduleDataRoleCodes = QMSPermissionContextHolder.getModuleDataRoleCodes(); //模块数据权限角色。
|
||||||
|
// String custom = QMSPermissionContextHolder.getCustom(); //todo 自定义权限
|
||||||
List<String> allRoleCode = new ArrayList<>();
|
//
|
||||||
if(!ObjectUtil.isEmpty(deptDataRoleCodes)){
|
// List<String> allRoleCode = new ArrayList<>();
|
||||||
allRoleCode.addAll(Arrays.asList(deptDataRoleCodes.split( ",")));
|
// if(!ObjectUtil.isEmpty(deptDataRoleCodes)){
|
||||||
}
|
// allRoleCode.addAll(Arrays.asList(deptDataRoleCodes.split( ",")));
|
||||||
if(!ObjectUtil.isEmpty(moduleDataRoleCodes)){
|
// }
|
||||||
allRoleCode.addAll(Arrays.asList(moduleDataRoleCodes.split( ",")));
|
// if(!ObjectUtil.isEmpty(moduleDataRoleCodes)){
|
||||||
}
|
// allRoleCode.addAll(Arrays.asList(moduleDataRoleCodes.split( ",")));
|
||||||
//查询角色
|
// }
|
||||||
|
// String roleCodes = CollUtil.join(allRoleCode, ",");
|
||||||
String tableName = MyBatisUtils.getTableName(table);
|
// String tableName = MyBatisUtils.getTableName(table);
|
||||||
Alias tableAlias = table.getAlias();
|
// Alias tableAlias = table.getAlias();
|
||||||
DeptDataPermissionRespDTO qmsDataPermission = loginUser.getContext(QMS_PERMISSION_CONTEXT_KEY, DeptDataPermissionRespDTO.class);
|
// DeptDataPermissionRespDTO qmsDataPermission = loginUser.getContext(QMS_PERMISSION_CONTEXT_KEY, DeptDataPermissionRespDTO.class);
|
||||||
if(qmsDataPermission == null){
|
// if(qmsDataPermission == null){
|
||||||
try{
|
// try{
|
||||||
// DeptContextHolder.setRoleCodeList(allRoleCode);
|
// qmsDataPermission = permissionApi.getDeptDataPermissionWithRoleCodes(loginUser.getId(), roleCodes).getCheckedData();
|
||||||
qmsDataPermission = permissionApi.getDeptDataPermission(loginUser.getId()).getCheckedData();
|
// }catch (Exception e){
|
||||||
}catch (Exception e){
|
// log.error("[getExpression][LoginUser({}) 获取角色权限为 null]", JsonUtils.toJsonString(loginUser));
|
||||||
log.error("[getExpression][LoginUser({}) 获取角色权限为 null]", JsonUtils.toJsonString(loginUser));
|
// log.error("", e);
|
||||||
log.error("", e);
|
// }finally {
|
||||||
}finally {
|
|
||||||
// DeptContextHolder.clearRoleCodeList();
|
// DeptContextHolder.clearRoleCodeList();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (qmsDataPermission == null) {
|
// if (qmsDataPermission == null) {
|
||||||
log.error("[getExpression][LoginUser({}) 获取数据权限为 null]", JsonUtils.toJsonString(loginUser));
|
// log.error("[getExpression][LoginUser({}) 获取数据权限为 null]", JsonUtils.toJsonString(loginUser));
|
||||||
throw new NullPointerException(String.format("LoginUser(%d) Table(%s/%s) 未返回数据权限", loginUser.getId(), tableName, tableAlias.getName()));
|
// throw new NullPointerException(String.format("LoginUser(%d) Table(%s/%s) 未返回数据权限", loginUser.getId(), tableName, tableAlias.getName()));
|
||||||
}
|
// }
|
||||||
// 添加到上下文中,避免重复计算
|
// // 添加到上下文中,避免重复计算
|
||||||
loginUser.setContext(QMS_PERMISSION_CONTEXT_KEY, qmsDataPermission);
|
// loginUser.setContext(QMS_PERMISSION_CONTEXT_KEY, qmsDataPermission);
|
||||||
}
|
// }
|
||||||
Long ctxDeptId = DeptContextHolder.getDeptId();
|
// Long ctxDeptId = DeptContextHolder.getDeptId();
|
||||||
// 计算有效的部门与自查标记:当存在上下文部门且未被忽略时,强制仅使用该部门,以避免默认全量或空权限分支
|
// // 计算有效的部门与自查标记:当存在上下文部门且未被忽略时,强制仅使用该部门,以避免默认全量或空权限分支
|
||||||
Set<Long> effectiveDeptIds = qmsDataPermission.getDeptIds();
|
// Set<Long> effectiveDeptIds = qmsDataPermission.getDeptIds();
|
||||||
Boolean effectiveSelf = qmsDataPermission.getSelf();
|
// Boolean effectiveSelf = qmsDataPermission.getSelf();
|
||||||
if (!DeptContextHolder.shouldIgnore() && ctxDeptId != null && ctxDeptId > 0L) {
|
// if (!DeptContextHolder.shouldIgnore() && ctxDeptId != null && ctxDeptId > 0L) {
|
||||||
effectiveDeptIds = CollUtil.newHashSet(ctxDeptId);
|
// effectiveDeptIds = CollUtil.newHashSet(ctxDeptId);
|
||||||
}
|
// }
|
||||||
// 情况一:仅当不存在上下文部门时,且 ALL 可查看全部,才无需拼接条件;若存在上下文部门则仍需基于该部门过滤
|
// // 情况一:仅当不存在上下文部门时,且 ALL 可查看全部,才无需拼接条件;若存在上下文部门则仍需基于该部门过滤
|
||||||
if (ctxDeptId == null && qmsDataPermission.getAll()) {
|
// if (ctxDeptId == null && qmsDataPermission.getAll()) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 情况二:仅在有效部门集合为空且不可查看自己时,才认为无权限;若上下文提供部门,则跳过该兜底
|
// // 情况二:仅在有效部门集合为空且不可查看自己时,才认为无权限;若上下文提供部门,则跳过该兜底
|
||||||
if (CollUtil.isEmpty(effectiveDeptIds) && Boolean.FALSE.equals(effectiveSelf)) {
|
// if (CollUtil.isEmpty(effectiveDeptIds) && Boolean.FALSE.equals(effectiveSelf)) {
|
||||||
return new EqualsTo(null, null); // WHERE null = null,可以保证返回的数据为空
|
// return new EqualsTo(null, null); // WHERE null = null,可以保证返回的数据为空
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 情况三,拼接 Dept 和 Company User 的条件,最后组合
|
// // 情况三,拼接 Dept 和 Company User 的条件,最后组合
|
||||||
Expression deptExpression = buildDeptExpression(tableName, deptIdCol, tableAlias, effectiveDeptIds);
|
// Expression deptExpression = buildDeptExpression(tableName, deptIdCol, tableAlias, effectiveDeptIds);
|
||||||
Expression userExpression = buildUserExpression(tableName, userIdCol, tableAlias, effectiveSelf, loginUser.getId());
|
// Expression userExpression = buildUserExpression(tableName, userIdCol, tableAlias, effectiveSelf, loginUser.getId());
|
||||||
if (deptExpression == null && userExpression == null) {
|
// if (deptExpression == null && userExpression == null) {
|
||||||
// TODO:获得不到条件的时候,暂时不抛出异常,而是不返回数据
|
// // TODO:获得不到条件的时候,暂时不抛出异常,而是不返回数据
|
||||||
log.warn("[getExpression][LoginUser({}) Table({}/{}) DeptDataPermission({}) 构建的条件为空]",
|
// log.warn("[getExpression][LoginUser({}) Table({}/{}) DeptDataPermission({}) 构建的条件为空]",
|
||||||
JsonUtils.toJsonString(loginUser), tableName, tableAlias, JsonUtils.toJsonString(qmsDataPermission));
|
// JsonUtils.toJsonString(loginUser), tableName, tableAlias, JsonUtils.toJsonString(qmsDataPermission));
|
||||||
// throw new NullPointerException(String.format("LoginUser(%d) Table(%s/%s) 构建的条件为空",
|
//// throw new NullPointerException(String.format("LoginUser(%d) Table(%s/%s) 构建的条件为空",
|
||||||
// loginUser.getId(), tableName, tableAlias.getName()));
|
//// loginUser.getId(), tableName, tableAlias.getName()));
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
if (deptExpression == null) {
|
// if (deptExpression == null) {
|
||||||
return userExpression;
|
// return userExpression;
|
||||||
}
|
// }
|
||||||
if (userExpression == null) {
|
// if (userExpression == null) {
|
||||||
return deptExpression;
|
// return deptExpression;
|
||||||
}
|
// }
|
||||||
// 目前,如果有指定部门 + 可查看自己,采用 OR 条件。即,WHERE (dept_id IN ? OR user_id = ?)
|
// // 目前,如果有指定部门 + 可查看自己,采用 OR 条件。即,WHERE (dept_id IN ? OR user_id = ?)
|
||||||
return new ParenthesedExpressionList(new OrExpression(deptExpression, userExpression));
|
// return new ParenthesedExpressionList(new OrExpression(deptExpression, userExpression));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private Expression buildDeptExpression(String tableName, String columnName, Alias tableAlias, Set<Long> deptIds) {
|
// private Expression buildDeptExpression(String tableName, String columnName, Alias tableAlias, Set<Long> deptIds) {
|
||||||
// 特殊处理:system_users 表没有 dept_id 字段,已经迁移到了 user_dept 表
|
// // 特殊处理:system_users 表没有 dept_id 字段,已经迁移到了 user_dept 表
|
||||||
if (SYSTEM_USERS.equals(tableName)) {
|
// if (SYSTEM_USERS.equals(tableName)) {
|
||||||
// system_users 走 exists 子查询 user_dept
|
// // system_users 走 exists 子查询 user_dept
|
||||||
if (CollUtil.isEmpty(deptIds)) {
|
// if (CollUtil.isEmpty(deptIds)) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
// 构造 exists (select 1 from user_dept where user_dept.user_id = system_users.id and user_dept.dept_id in (...))
|
// // 构造 exists (select 1 from user_dept where user_dept.user_id = system_users.id and user_dept.dept_id in (...))
|
||||||
PlainSelect plainSelect = new PlainSelect();
|
// PlainSelect plainSelect = new PlainSelect();
|
||||||
plainSelect.setSelectItems(singletonList(new SelectItem<>(new LongValue(1))));
|
// plainSelect.setSelectItems(singletonList(new SelectItem<>(new LongValue(1))));
|
||||||
Table userDept = new Table(SYSTEM_USER_DEPT);
|
// Table userDept = new Table(SYSTEM_USER_DEPT);
|
||||||
// 使用 user 表别名避免语法错误
|
// // 使用 user 表别名避免语法错误
|
||||||
Table user = new Table(tableAlias == null ? tableName : tableAlias.getName());
|
// Table user = new Table(tableAlias == null ? tableName : tableAlias.getName());
|
||||||
plainSelect.setFromItem(userDept);
|
// plainSelect.setFromItem(userDept);
|
||||||
// where user_dept.user_id = system_users.id and user_dept.dept_id in (...)
|
// // where user_dept.user_id = system_users.id and user_dept.dept_id in (...)
|
||||||
Column userDeptUserIdCol = new Column(userDept, USER_COLUMN_NAME);
|
// Column userDeptUserIdCol = new Column(userDept, USER_COLUMN_NAME);
|
||||||
Column systemUsersIdCol = new Column(user, "id");
|
// Column systemUsersIdCol = new Column(user, "id");
|
||||||
EqualsTo userIdEquals = new EqualsTo(userDeptUserIdCol, systemUsersIdCol);
|
// EqualsTo userIdEquals = new EqualsTo(userDeptUserIdCol, systemUsersIdCol);
|
||||||
Column userDeptDeptIdCol = new Column(userDept, DEPT_COLUMN_NAME);
|
// Column userDeptDeptIdCol = new Column(userDept, DEPT_COLUMN_NAME);
|
||||||
InExpression deptIn = new InExpression(userDeptDeptIdCol, new ParenthesedExpressionList<>(new ExpressionList<>(CollectionUtils.convertList(deptIds, LongValue::new))));
|
// InExpression deptIn = new InExpression(userDeptDeptIdCol, new ParenthesedExpressionList<>(new ExpressionList<>(CollectionUtils.convertList(deptIds, LongValue::new))));
|
||||||
Expression whereExp = new AndExpression(userIdEquals, deptIn);
|
// Expression whereExp = new AndExpression(userIdEquals, deptIn);
|
||||||
plainSelect.setWhere(whereExp);
|
// plainSelect.setWhere(whereExp);
|
||||||
//
|
// //
|
||||||
ParenthesedSelect parenthesedSelect = new ParenthesedSelect();
|
// ParenthesedSelect parenthesedSelect = new ParenthesedSelect();
|
||||||
parenthesedSelect.setSelect(plainSelect);
|
// parenthesedSelect.setSelect(plainSelect);
|
||||||
// 构建 exists 表达式
|
// // 构建 exists 表达式
|
||||||
ExistsExpression existsExpr = new ExistsExpression();
|
// ExistsExpression existsExpr = new ExistsExpression();
|
||||||
existsExpr.setRightExpression(parenthesedSelect);
|
// existsExpr.setRightExpression(parenthesedSelect);
|
||||||
return existsExpr;
|
// return existsExpr;
|
||||||
}
|
// }
|
||||||
if (StrUtil.isEmpty(columnName)) {
|
// if (StrUtil.isEmpty(columnName)) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
// 如果为空,则无条件
|
// // 如果为空,则无条件
|
||||||
if (CollUtil.isEmpty(deptIds)) {
|
// if (CollUtil.isEmpty(deptIds)) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
// 拼接条件
|
// // 拼接条件
|
||||||
return new InExpression(MyBatisUtils.buildColumn(tableName, tableAlias, columnName),
|
// return new InExpression(MyBatisUtils.buildColumn(tableName, tableAlias, columnName),
|
||||||
// Parenthesis 的目的,是提供 (1,2,3) 的 () 左右括号
|
// // Parenthesis 的目的,是提供 (1,2,3) 的 () 左右括号
|
||||||
new ParenthesedExpressionList(new ExpressionList<LongValue>(CollectionUtils.convertList(deptIds, LongValue::new))));
|
// new ParenthesedExpressionList(new ExpressionList<LongValue>(CollectionUtils.convertList(deptIds, LongValue::new))));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private Expression buildUserExpression(String tableName, String columnName, Alias tableAlias, Boolean self, Long userId) {
|
// private Expression buildUserExpression(String tableName, String columnName, Alias tableAlias, Boolean self, Long userId) {
|
||||||
// 如果不查看自己,则无需作为条件
|
// // 如果不查看自己,则无需作为条件
|
||||||
if (Boolean.FALSE.equals(self)) {
|
// if (Boolean.FALSE.equals(self)) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
if (StrUtil.isEmpty(columnName)) {
|
// if (StrUtil.isEmpty(columnName)) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
// 拼接条件
|
// // 拼接条件
|
||||||
return new EqualsTo(MyBatisUtils.buildColumn(tableName, tableAlias, columnName), new LongValue(userId));
|
// return new EqualsTo(MyBatisUtils.buildColumn(tableName, tableAlias, columnName), new LongValue(userId));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* */
|
// * */
|
||||||
private DeptDataPermissionRespDTO getQmsDataPermission(){
|
// private DeptDataPermissionRespDTO getQmsDataPermission(){
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,42 +1,42 @@
|
|||||||
package com.zt.plat.module.qms.framework.mybatis;
|
//package com.zt.plat.module.qms.framework.mybatis;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.DataPermissionInterceptor;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
|
|
||||||
import com.zt.plat.module.qms.framework.datapermission.QMSMultiDataPermissionHandler;
|
|
||||||
import jakarta.annotation.PostConstruct;
|
|
||||||
import org.aspectj.lang.annotation.After;
|
|
||||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
//@Configuration
|
|
||||||
public class QMSDataPermissionConfig implements SmartInitializingSingleton {
|
|
||||||
@Autowired
|
|
||||||
private MybatisPlusInterceptor mybatisPlusInterceptor;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private QMSMultiDataPermissionHandler qmsMultiDataPermissionHandler;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterSingletonsInstantiated() {
|
|
||||||
List<InnerInterceptor> interceptors = mybatisPlusInterceptor.getInterceptors();
|
|
||||||
// 避免重复注册
|
|
||||||
boolean exists = interceptors.stream()
|
|
||||||
.filter(i -> i instanceof DataPermissionInterceptor)
|
|
||||||
.map(i -> (DataPermissionInterceptor) i)
|
|
||||||
.anyMatch(i -> i.getDataPermissionHandler() == qmsMultiDataPermissionHandler);
|
|
||||||
if (!exists) {
|
|
||||||
mybatisPlusInterceptor.addInnerInterceptor(new DataPermissionInterceptor(qmsMultiDataPermissionHandler));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @PostConstruct
|
|
||||||
// public void addDataPermissionInterceptor() {
|
|
||||||
//
|
//
|
||||||
|
//
|
||||||
|
//import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
//import com.baomidou.mybatisplus.extension.plugins.inner.DataPermissionInterceptor;
|
||||||
|
//import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
|
||||||
|
//import com.zt.plat.module.qms.framework.datapermission.QMSMultiDataPermissionHandler;
|
||||||
|
//import jakarta.annotation.PostConstruct;
|
||||||
|
//import org.aspectj.lang.annotation.After;
|
||||||
|
//import org.springframework.beans.factory.SmartInitializingSingleton;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
//@Configuration
|
||||||
|
//public class QMSDataPermissionConfig implements SmartInitializingSingleton {
|
||||||
|
// @Autowired
|
||||||
|
// private MybatisPlusInterceptor mybatisPlusInterceptor;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private QMSMultiDataPermissionHandler qmsMultiDataPermissionHandler;
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void afterSingletonsInstantiated() {
|
||||||
|
// List<InnerInterceptor> interceptors = mybatisPlusInterceptor.getInterceptors();
|
||||||
|
// // 避免重复注册
|
||||||
|
// boolean exists = interceptors.stream()
|
||||||
|
// .filter(i -> i instanceof DataPermissionInterceptor)
|
||||||
|
// .map(i -> (DataPermissionInterceptor) i)
|
||||||
|
// .anyMatch(i -> i.getDataPermissionHandler() == qmsMultiDataPermissionHandler);
|
||||||
|
// if (!exists) {
|
||||||
|
// mybatisPlusInterceptor.addInnerInterceptor(new DataPermissionInterceptor(qmsMultiDataPermissionHandler));
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
}
|
//// @PostConstruct
|
||||||
|
//// public void addDataPermissionInterceptor() {
|
||||||
|
////
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.zt.plat.module.qms.resource.clientManage.controller.admin;
|
package com.zt.plat.module.qms.resource.clientManage.controller.admin;
|
||||||
|
|
||||||
|
import com.zt.plat.module.infra.api.file.FileApi;
|
||||||
|
import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
|
||||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementPageReqVO;
|
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementRespVO;
|
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementRespVO;
|
||||||
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementSaveReqVO;
|
import com.zt.plat.module.qms.resource.clientManage.controller.vo.VersionManagementSaveReqVO;
|
||||||
@@ -54,6 +56,9 @@ public class VersionManagementController extends AbstractFileUploadController im
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private VersionManagementService systemVersionManagementService;
|
private VersionManagementService systemVersionManagementService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FileApi fileApi;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建客户端版本管理")
|
@Operation(summary = "创建客户端版本管理")
|
||||||
@@ -138,6 +143,14 @@ public class VersionManagementController extends AbstractFileUploadController im
|
|||||||
String log = "";
|
String log = "";
|
||||||
if (pageResult.getList().size() != 0) {
|
if (pageResult.getList().size() != 0) {
|
||||||
VersionManagementDO versionManagementDO = pageResult.getList().get(0);
|
VersionManagementDO versionManagementDO = pageResult.getList().get(0);
|
||||||
|
//处理文件下载url
|
||||||
|
Long fileId = Long.parseLong(versionManagementDO.getDownloadId());
|
||||||
|
CommonResult<FileRespDTO> fileRet = fileApi.getFileInfo(fileId);
|
||||||
|
FileRespDTO file = fileRet.getData();
|
||||||
|
if(fileRet.isSuccess() && file != null) {
|
||||||
|
versionManagementDO.setDownloadUrl(file.getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
version = versionManagementDO.getCurrentVersion();
|
version = versionManagementDO.getCurrentVersion();
|
||||||
minVersion = versionManagementDO.getMinimumVersion();
|
minVersion = versionManagementDO.getMinimumVersion();
|
||||||
url = versionManagementDO.getDownloadUrl();
|
url = versionManagementDO.getDownloadUrl();
|
||||||
@@ -165,6 +178,13 @@ public class VersionManagementController extends AbstractFileUploadController im
|
|||||||
return CommonResult.error(400, "没有可更新版本");
|
return CommonResult.error(400, "没有可更新版本");
|
||||||
}
|
}
|
||||||
VersionManagementDO versionManagementDO = pageResult.getList().get(0);
|
VersionManagementDO versionManagementDO = pageResult.getList().get(0);
|
||||||
|
//处理文件下载url
|
||||||
|
Long fileId = Long.parseLong(versionManagementDO.getDownloadId());
|
||||||
|
CommonResult<FileRespDTO> fileRet = fileApi.getFileInfo(fileId);
|
||||||
|
FileRespDTO file = fileRet.getData();
|
||||||
|
if(fileRet.isSuccess() && file != null) {
|
||||||
|
versionManagementDO.setDownloadUrl(file.getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
return success(BeanUtils.toBean(versionManagementDO, VersionManagementRespVO.class));
|
return success(BeanUtils.toBean(versionManagementDO, VersionManagementRespVO.class));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface DeviceInfomationMapper extends BaseMapperX<DeviceInfomationDO> {
|
public interface DeviceInfomationMapper extends BaseMapperX<DeviceInfomationDO> {
|
||||||
|
|
||||||
@QmsPermission(deptDataRoleCodes = "")
|
@QmsPermission(deptDataRoleCodes = "ytjyDeptAndSub", moduleDataRoleCodes = "qms_device_manager")
|
||||||
default PageResult<DeviceInfomationDO> selectPage(DeviceInfomationPageReqVO reqVO) {
|
default PageResult<DeviceInfomationDO> selectPage(DeviceInfomationPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<DeviceInfomationDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<DeviceInfomationDO>()
|
||||||
.eqIfPresent(DeviceInfomationDO::getProductId, reqVO.getProductId())
|
.eqIfPresent(DeviceInfomationDO::getProductId, reqVO.getProductId())
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
AND tcam.ASY_DEPT_ID = tbssag.ASY_DEPT_ID
|
AND tcam.ASY_DEPT_ID = tbssag.ASY_DEPT_ID
|
||||||
WHERE
|
WHERE
|
||||||
tbssa.DELETED = 0
|
tbssa.DELETED = 0
|
||||||
|
AND tbspsa.DELETED = 0
|
||||||
AND tbssa.RPOD_STS = 'reported'
|
AND tbssa.RPOD_STS = 'reported'
|
||||||
AND tbspsa.IS_RPOD = 0
|
AND tbspsa.IS_RPOD = 0
|
||||||
<if test="reqVO.configAssayMethodName != null and reqVO.configAssayMethodName != ''">
|
<if test="reqVO.configAssayMethodName != null and reqVO.configAssayMethodName != ''">
|
||||||
|
|||||||
Reference in New Issue
Block a user