Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -14,7 +14,6 @@ import org.springframework.context.annotation.DependsOn;
|
|||||||
* @date 2022/11/10
|
* @date 2022/11/10
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@DependsOn("proxyMapperRegister")
|
|
||||||
@MapperScan("com.njcn.**.mapper")
|
@MapperScan("com.njcn.**.mapper")
|
||||||
@EnableFeignClients(basePackages = "com.njcn")
|
@EnableFeignClients(basePackages = "com.njcn")
|
||||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||||
|
|||||||
@@ -161,6 +161,9 @@ public class UserReportPO extends BaseEntity {
|
|||||||
@TableField(value = "line_id")
|
@TableField(value = "line_id")
|
||||||
private String lineId;
|
private String lineId;
|
||||||
|
|
||||||
|
@TableField(value = "second_assessment_id")
|
||||||
|
private String secondAssessmentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批状态:1:审批中;2:审批通过;3:审批不通过;4:已取消
|
* 审批状态:1:审批中;2:审批通过;3:审批不通过;4:已取消
|
||||||
*/
|
*/
|
||||||
@@ -176,4 +179,5 @@ public class UserReportPO extends BaseEntity {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.njcn.common.pojo.constant.PatternRegex;
|
|||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.FileUtil;
|
import com.njcn.common.utils.FileUtil;
|
||||||
import com.njcn.device.pms.utils.PubUtil;
|
import com.njcn.device.pms.utils.PubUtil;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
@@ -63,6 +64,7 @@ import com.njcn.web.factory.PageFactory;
|
|||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import com.njcn.web.utils.WebUtil;
|
import com.njcn.web.utils.WebUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.BeanWrapper;
|
import org.springframework.beans.BeanWrapper;
|
||||||
@@ -87,6 +89,7 @@ import java.util.stream.Stream;
|
|||||||
* @author clam
|
* @author clam
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, UserReportPO> implements UserReportPOService {
|
public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, UserReportPO> implements UserReportPOService {
|
||||||
@@ -492,9 +495,9 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
|||||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId(userReportQueryParam.getOrgId()).getData();
|
List<String> data = deptFeignClient.getDepSonIdtByDeptId(userReportQueryParam.getOrgId()).getData();
|
||||||
//此处仅查询敏感及重要用户
|
//此处仅查询敏感及重要用户
|
||||||
userReportVOQueryWrapper.and(wrapper ->
|
userReportVOQueryWrapper.and(wrapper ->
|
||||||
wrapper.in("supervision_user_report.create_by", colleaguesIds)
|
wrapper.in("supervision_user_report.create_by", colleaguesIds)
|
||||||
.or()
|
.or()
|
||||||
.in("supervision_user_report.org_id", data)
|
.in("supervision_user_report.org_id", data)
|
||||||
)
|
)
|
||||||
.eq("supervision_user_report.state", DataStateEnum.ENABLE.getCode());
|
.eq("supervision_user_report.state", DataStateEnum.ENABLE.getCode());
|
||||||
if (!allDataFlag) {
|
if (!allDataFlag) {
|
||||||
@@ -1013,19 +1016,35 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
|||||||
params.setHeadRows(1);
|
params.setHeadRows(1);
|
||||||
//标题
|
//标题
|
||||||
params.setTitleRows(1);
|
params.setTitleRows(1);
|
||||||
params.setNeedVerify(true);
|
params.setNeedVerify(false); // 关闭校验,避免校验导致的性能问题
|
||||||
params.setStartSheetIndex(0);
|
params.setStartSheetIndex(0);
|
||||||
params.setSheetNum(1);
|
params.setSheetNum(1);
|
||||||
List<SensitiveReportExcel> sensitiveUserExcels = new ArrayList<>();
|
// 限制最大读取行数,防止Excel模板带下拉列表导致读取大量空行
|
||||||
|
// 如果实际数据超过此限制,需要分批导入或调整此参数
|
||||||
|
params.setReadRows(100); // 最多读取100行数据
|
||||||
|
List<SensitiveReportExcel> sensitiveUserExcels;
|
||||||
try {
|
try {
|
||||||
|
log.info("开始解析 Excel,文件名:{}", file.getOriginalFilename());
|
||||||
ExcelImportResult<SensitiveReportExcel> sensitiveUserExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SensitiveReportExcel.class, params);
|
ExcelImportResult<SensitiveReportExcel> sensitiveUserExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SensitiveReportExcel.class, params);
|
||||||
|
log.info("Excel 解析完成,原始数据行数:{}", sensitiveUserExcelExcelImportResult.getList().size());
|
||||||
//如果存在非法数据,将不合格的数据导出
|
//如果存在非法数据,将不合格的数据导出
|
||||||
if (sensitiveUserExcelExcelImportResult.isVerifyFail()) {
|
if (sensitiveUserExcelExcelImportResult.isVerifyFail()) {
|
||||||
|
log.warn("存在校验失败的数据");
|
||||||
PoiUtil.exportFileByWorkbook(sensitiveUserExcelExcelImportResult.getFailWorkbook(), "非法用户数据.xlsx", response);
|
PoiUtil.exportFileByWorkbook(sensitiveUserExcelExcelImportResult.getFailWorkbook(), "非法用户数据.xlsx", response);
|
||||||
|
return; // 校验失败直接返回
|
||||||
} else {
|
} else {
|
||||||
sensitiveUserExcels = sensitiveUserExcelExcelImportResult.getList();
|
// 过滤掉空行数据(projectName 为空的行)
|
||||||
|
sensitiveUserExcels = sensitiveUserExcelExcelImportResult.getList().stream()
|
||||||
|
.filter(x -> StringUtils.isNotBlank(x.getProjectName()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
log.info("过滤后有效数据:{} 条", sensitiveUserExcels.size());
|
||||||
|
|
||||||
|
if (CollectionUtil.isEmpty(sensitiveUserExcels)) {
|
||||||
|
throw new BusinessException(SupervisionResponseEnum.IMPORT_DEV_DATA_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("导入失败,文件:{}", file.getOriginalFilename(), e);
|
||||||
throw new BusinessException(SupervisionResponseEnum.IMPORT_SENSITIVE_REPORT_ERROR);
|
throw new BusinessException(SupervisionResponseEnum.IMPORT_SENSITIVE_REPORT_ERROR);
|
||||||
}
|
}
|
||||||
//主要非线性设备类型-冀北
|
//主要非线性设备类型-冀北
|
||||||
@@ -1182,7 +1201,7 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
|||||||
lambdaQueryWrapper.eq(UserReportPO::getId,id).eq(UserReportPO::getState,DataStateEnum.ENABLE.getCode());
|
lambdaQueryWrapper.eq(UserReportPO::getId,id).eq(UserReportPO::getState,DataStateEnum.ENABLE.getCode());
|
||||||
UserReportPO userReportPO = this.getById(id);
|
UserReportPO userReportPO = this.getById(id);
|
||||||
if(Objects.nonNull(userReportPO)){
|
if(Objects.nonNull(userReportPO)){
|
||||||
return BeanUtil.copyProperties(userReportPO,UserLedgerVO.class);
|
return BeanUtil.copyProperties(userReportPO,UserLedgerVO.class);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user