Compare commits

..

No commits in common. '80248d648950fb7ce7dae78cb36bfd704f797f6f' and 'd9381a470a629dd552ca53f5027f10ee28b5ae88' have entirely different histories.

  1. 11
      src/main/java/com/biutag/supervision/config/FastDFSConfig.java
  2. 5
      src/main/java/com/biutag/supervision/mapper/Report/ReportProjectMapper.java
  3. 3
      src/main/java/com/biutag/supervision/pojo/vo/entryWindow/EntryWindowVo.java
  4. 6
      src/main/java/com/biutag/supervision/pojo/vo/warning/WarningProblemExcelVo.java
  5. 30
      src/main/java/com/biutag/supervision/service/FileService.java
  6. 3
      src/main/java/com/biutag/supervision/service/Report/ReportProjectService.java
  7. 29
      src/main/java/com/biutag/supervision/service/Warning/impl/WarningBusinessServiceImpl.java
  8. 12
      src/main/resources/mapper/ReportProjectMapper.xml

11
src/main/java/com/biutag/supervision/config/FastDFSConfig.java

@ -2,12 +2,10 @@ package com.biutag.supervision.config;
import com.github.tobato.fastdfs.domain.conn.TrackerConnectionManager; import com.github.tobato.fastdfs.domain.conn.TrackerConnectionManager;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Slf4j
@ComponentScan("com.github.tobato.fastdfs") @ComponentScan("com.github.tobato.fastdfs")
@Configuration @Configuration
public class FastDFSConfig { public class FastDFSConfig {
@ -17,13 +15,6 @@ public class FastDFSConfig {
@PostConstruct @PostConstruct
public void init() { public void init() {
try { trackerConnectionManager.initTracker();
trackerConnectionManager.initTracker();
log.info("FastDFS Tracker初始化完成: trackerList={}", trackerConnectionManager.getTrackerList());
} catch (RuntimeException e) {
log.error("FastDFS Tracker初始化失败: trackerList={}, exceptionType={}, message={}",
trackerConnectionManager.getTrackerList(), e.getClass().getName(), e.getMessage(), e);
throw e;
}
} }
} }

5
src/main/java/com/biutag/supervision/mapper/Report/ReportProjectMapper.java

@ -22,10 +22,7 @@ public interface ReportProjectMapper extends BaseMapper<ReportProject> {
Page<EntryWindowVo> queryPage(@Param("page") Page<ReportProject> page, @Param(Constants.WRAPPER) QueryWrapper<ReportProject> queryWrapper); Page<EntryWindowVo> queryPage(@Param("page") Page<ReportProject> page, @Param(Constants.WRAPPER) QueryWrapper<ReportProject> queryWrapper);
Page<EntryWindowVo> queryPageWarning(@Param("page") Page<ReportProject> page, Page<EntryWindowVo> queryPageWarning(@Param("page") Page<ReportProject> page, @Param(Constants.WRAPPER) QueryWrapper<ReportProject> queryWrapper,String warningState);
@Param(Constants.WRAPPER) QueryWrapper<ReportProject> queryWrapper,
@Param("warningState") String warningState,
@Param("userId") String userId);
Page<ConditionVo> queryPageCondition(@Param("page") Page<ReportProject> page,@Param(Constants.WRAPPER)QueryWrapper<ReportProject> queryWrapper); Page<ConditionVo> queryPageCondition(@Param("page") Page<ReportProject> page,@Param(Constants.WRAPPER)QueryWrapper<ReportProject> queryWrapper);

3
src/main/java/com/biutag/supervision/pojo/vo/entryWindow/EntryWindowVo.java

@ -16,9 +16,6 @@ public class EntryWindowVo extends ReportProject {
private String warningId; private String warningId;
@Schema(description = "当前用户待审批的预警流程id")
private String flowId;
private String warningState; private String warningState;
//预警问题数 //预警问题数
private Long warningContent; private Long warningContent;

6
src/main/java/com/biutag/supervision/pojo/vo/warning/WarningProblemExcelVo.java

@ -12,12 +12,6 @@ public class WarningProblemExcelVo {
@ExcelProperty(value = "项目名称") @ExcelProperty(value = "项目名称")
private String reportName; private String reportName;
@ExcelProperty(value = "审计单位")
private String auditUnitStr;
@ExcelProperty(value = "项目单位")
private String projectUnitStr;
@ExcelProperty(value = "预警类型") @ExcelProperty(value = "预警类型")
private String type; private String type;

30
src/main/java/com/biutag/supervision/service/FileService.java

@ -6,13 +6,10 @@ import cn.hutool.http.HttpUtil;
import com.biutag.supervision.mapper.FileBase64Mapper; import com.biutag.supervision.mapper.FileBase64Mapper;
import com.biutag.supervision.pojo.entity.FileBase64; import com.biutag.supervision.pojo.entity.FileBase64;
import com.biutag.supervision.util.ImgUtils; import com.biutag.supervision.util.ImgUtils;
import com.github.tobato.fastdfs.domain.conn.TrackerConnectionManager;
import com.github.tobato.fastdfs.domain.fdfs.StorePath; import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient; import com.github.tobato.fastdfs.service.FastFileStorageClient;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -21,19 +18,12 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Base64; import java.util.Base64;
@Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
public class FileService { public class FileService {
private static final String STORAGE_GROUP = "group1";
private final FastFileStorageClient fastFileStorageClient; private final FastFileStorageClient fastFileStorageClient;
private final TrackerConnectionManager trackerConnectionManager;
private final Environment environment;
private final FileBase64Mapper fileBase64Mapper; private final FileBase64Mapper fileBase64Mapper;
@Value("${fdfs.preview-url}") @Value("${fdfs.preview-url}")
@ -44,24 +34,8 @@ public class FileService {
} }
public String upload(InputStream is, long size, String fileExtName) { public String upload(InputStream is, long size, String fileExtName) {
long startTime = System.currentTimeMillis(); StorePath storePath = fastFileStorageClient.uploadFile("group1", is, size, fileExtName);
String activeProfiles = String.join(",", environment.getActiveProfiles()); return "/" + storePath.getFullPath();
log.info("FastDFS上传开始: activeProfiles={}, trackerList={}, group={}, fileSize={}, fileExtName={}",
activeProfiles, trackerConnectionManager.getTrackerList(), STORAGE_GROUP, size, fileExtName);
try {
StorePath storePath = fastFileStorageClient.uploadFile(STORAGE_GROUP, is, size, fileExtName);
String filePath = "/" + storePath.getFullPath();
log.info("FastDFS上传成功: activeProfiles={}, trackerList={}, group={}, filePath={}, elapsedMs={}",
activeProfiles, trackerConnectionManager.getTrackerList(), STORAGE_GROUP, filePath,
System.currentTimeMillis() - startTime);
return filePath;
} catch (RuntimeException e) {
log.error("FastDFS上传失败: activeProfiles={}, trackerList={}, group={}, fileSize={}, fileExtName={}, " +
"elapsedMs={}, exceptionType={}, message={}",
activeProfiles, trackerConnectionManager.getTrackerList(), STORAGE_GROUP, size, fileExtName,
System.currentTimeMillis() - startTime, e.getClass().getName(), e.getMessage(), e);
throw e;
}
} }
public String uploadBase64(String base64, String originalFilename) { public String uploadBase64(String base64, String originalFilename) {

3
src/main/java/com/biutag/supervision/service/Report/ReportProjectService.java

@ -98,8 +98,7 @@ public class ReportProjectService extends ServiceImpl<ReportProjectMapper, Repor
} }
public Page<EntryWindowVo> getPageWarning(Page<ReportProject> page, QueryWrapper<ReportProject> lambdaQueryWrapper, String warningState) { public Page<EntryWindowVo> getPageWarning(Page<ReportProject> page, QueryWrapper<ReportProject> lambdaQueryWrapper, String warningState) {
UserAuth user = UserContextHolder.getCurrentUser(); return baseMapper.queryPageWarning(page, lambdaQueryWrapper, warningState);
return baseMapper.queryPageWarning(page, lambdaQueryWrapper, warningState, user.getUserName());
} }
/** /**

29
src/main/java/com/biutag/supervision/service/Warning/impl/WarningBusinessServiceImpl.java

@ -118,7 +118,6 @@ public class WarningBusinessServiceImpl implements WarningBusinessService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(WarningSaveRequest request) { public void save(WarningSaveRequest request) {
UserAuth user = UserContextHolder.getCurrentUser(); UserAuth user = UserContextHolder.getCurrentUser();
validateWarningHandler(request.getReportId(), user);
// 更新项目监督信息(由后端自动获取) // 更新项目监督信息(由后端自动获取)
ReportProject project = new ReportProject(); ReportProject project = new ReportProject();
@ -136,7 +135,6 @@ public class WarningBusinessServiceImpl implements WarningBusinessService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void submit(WarningSubmitRequest request) { public void submit(WarningSubmitRequest request) {
UserAuth user = UserContextHolder.getCurrentUser(); UserAuth user = UserContextHolder.getCurrentUser();
validateWarningHandler(request.getReportId(), user);
// 1. 更新项目监督信息(由后端自动获取) // 1. 更新项目监督信息(由后端自动获取)
ReportProject project = new ReportProject(); ReportProject project = new ReportProject();
@ -187,7 +185,6 @@ public class WarningBusinessServiceImpl implements WarningBusinessService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void end(WarningEndRequest request) { public void end(WarningEndRequest request) {
UserAuth user = UserContextHolder.getCurrentUser(); UserAuth user = UserContextHolder.getCurrentUser();
validateWarningHandler(request.getReportId(), user);
// 1. 更新项目状态(由后端自动获取预警监督人和时间) // 1. 更新项目状态(由后端自动获取预警监督人和时间)
ReportProject project = new ReportProject(); ReportProject project = new ReportProject();
@ -465,8 +462,6 @@ public class WarningBusinessServiceImpl implements WarningBusinessService {
WarningProblemExcelVo vo = new WarningProblemExcelVo(); WarningProblemExcelVo vo = new WarningProblemExcelVo();
vo.setReportId(record.getId()); vo.setReportId(record.getId());
vo.setReportName(record.getReportName()); vo.setReportName(record.getReportName());
vo.setAuditUnitStr(record.getAuditUnitStr());
vo.setProjectUnitStr(record.getProjectUnitStr());
vo.setType(content.getType()); vo.setType(content.getType());
vo.setTitle(content.getTitle()); vo.setTitle(content.getTitle());
vo.setContent(content.getContent()); vo.setContent(content.getContent());
@ -599,30 +594,6 @@ public class WarningBusinessServiceImpl implements WarningBusinessService {
return flows.isEmpty() ? null : flows.get(0).getId(); return flows.isEmpty() ? null : flows.get(0).getId();
} }
/**
* 校验当前用户是否为预警待办处理人
* 首次预警没有待处理流程时允许操作存在待处理流程时仅允许对应处理人操作
*/
private void validateWarningHandler(String reportId, UserAuth user) {
List<ReportFlow> pendingFlows = flowMapper.selectList(
new LambdaQueryWrapper<ReportFlow>()
.eq(ReportFlow::getReportId, reportId)
.eq(ReportFlow::getType, "warning")
.eq(ReportFlow::getApproverState, FlowStateEnum.Start.getLabel())
.orderByDesc(ReportFlow::getAreportTime)
.last("LIMIT 1")
);
if (pendingFlows.isEmpty()) {
return;
}
ReportFlow pendingFlow = pendingFlows.get(0);
if (!StrUtil.equals(user.getUserName(), pendingFlow.getApproverId())) {
String handler = StrUtil.isBlank(pendingFlow.getApprover()) ? "其他人员" : pendingFlow.getApprover();
throw new RuntimeException("该项目当前由" + handler + "处理,请勿重复操作");
}
}
/** /**
* 保存预警内容 * 保存预警内容
*/ */

12
src/main/resources/mapper/ReportProjectMapper.xml

@ -102,17 +102,7 @@
</select> </select>
<select id="queryPageWarning" resultType="com.biutag.supervision.pojo.vo.entryWindow.EntryWindowVo"> <select id="queryPageWarning" resultType="com.biutag.supervision.pojo.vo.entryWindow.EntryWindowVo">
SELECT p.*, SELECT p.*
(
SELECT f.id
FROM report_flow f
WHERE f.report_id = p.id
AND f.type = 'warning'
AND f.approver_state = 'start'
AND f.approver_id = #{userId}
ORDER BY f.areport_time DESC
LIMIT 1
) AS flowId
FROM report_project p FROM report_project p
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
GROUP BY p.id GROUP BY p.id

Loading…
Cancel
Save