第三方接口接入

调整h5页面部分接口
This commit is contained in:
tangcy 2026-03-24 20:26:26 +08:00
parent 10d5c071c9
commit 987ea0ce0c
21 changed files with 661 additions and 127 deletions

View File

@ -32,11 +32,10 @@ public class ConstructionIssueFeedbackController extends BaseController {
private IConstructionIssueFeedbackService constructionIssueFeedbackService;
/**
* 查询施工问题反馈列表施工方查监理确认的问题监理查全部
* 查询施工问题反馈列表
* 支持按项目ID来源状态筛选
*/
@Operation(summary = "查询施工问题反馈列表")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:list')")
@GetMapping("/list")
public TableDataInfo list(ConstructionIssueFeedback query) {
startPage();
@ -48,27 +47,25 @@ public class ConstructionIssueFeedbackController extends BaseController {
* 获取施工问题反馈详情
*/
@Operation(summary = "获取施工问题反馈详情")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:query')")
@GetMapping("/{id}")
public AjaxResult getInfo(@Parameter(description = "反馈ID") @PathVariable("id") Long id) {
public AjaxResult getInfo(@Parameter(description = "反馈 ID") @PathVariable("id") Long id) {
return success(constructionIssueFeedbackService.selectConstructionIssueFeedbackById(id));
}
/**
* 获取施工问题反馈详情级联整改记录
* 统计项目待整改问题数量
*/
@Operation(summary = "获取施工问题反馈详情(含整改记录)")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:query')")
@GetMapping("/{id}/detail")
public AjaxResult getDetailWithRectifications(@Parameter(description = "反馈ID") @PathVariable("id") Long id) {
return success(constructionIssueFeedbackService.selectDetailWithRectifications(id));
@Operation(summary = "统计项目待整改问题数量")
@GetMapping("/pendingCount/{projectId}")
public AjaxResult pendingCount(@Parameter(description = "项目 ID") @PathVariable("projectId") Long projectId) {
int count = constructionIssueFeedbackService.countPendingByProjectId(projectId);
return success(count);
}
/**
* 监理人工提交现场问题检测名称描述问题照片URL等
* 监理人工提交现场问题检测名称描述问题照片 URL
*/
@Operation(summary = "监理人工提交现场问题")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:add')")
@Log(title = "施工问题反馈", businessType = BusinessType.INSERT)
@PostMapping("/manual")
public AjaxResult manualSubmit(@Validated @RequestBody ConstructionIssueFeedback feedback) {
@ -79,7 +76,6 @@ public class ConstructionIssueFeedbackController extends BaseController {
* 更新施工问题反馈如状态待处理/已处理/已关闭
*/
@Operation(summary = "更新施工问题反馈")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:edit')")
@Log(title = "施工问题反馈", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult update(@Validated @RequestBody ConstructionIssueFeedback feedback) {

View File

@ -3,6 +3,7 @@ package com.admin.contractor.controller;
import com.admin.contractor.domain.ConstructionIssueRectification;
import com.admin.contractor.domain.dto.RectificationReviewDTO;
import com.admin.contractor.domain.dto.RectificationSubmitDTO;
import com.admin.contractor.domain.vo.RectificationDetailVO;
import com.admin.contractor.domain.vo.RectificationPendingVO;
import com.admin.contractor.service.IConstructionIssueRectificationService;
import com.ruoyi.common.core.web.controller.BaseController;
@ -34,22 +35,11 @@ public class ConstructionIssueRectificationController extends BaseController {
@Autowired
private IConstructionIssueRectificationService rectificationService;
/**
* 施工单位暂存整改草稿
*/
@Operation(summary = "暂存整改草稿(施工单位)")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:edit')")
@Log(title = "施工问题整改", businessType = BusinessType.UPDATE)
@PostMapping("/saveDraft")
public AjaxResult saveDraft(@Validated @RequestBody RectificationSubmitDTO dto) {
return toAjax(rectificationService.saveDraft(dto));
}
/**
* 施工单位提交整改
*/
@Operation(summary = "提交整改(施工单位)")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:edit')")
@Log(title = "施工问题整改", businessType = BusinessType.UPDATE)
@PostMapping("/submit")
public AjaxResult submitRectification(@Validated @RequestBody RectificationSubmitDTO dto) {
@ -57,21 +47,19 @@ public class ConstructionIssueRectificationController extends BaseController {
}
/**
* 按问题反馈ID查询整改列表含草稿已提交施工方/监理查看
* 按问题反馈 ID 获取问题数据级联整改表数据
*/
@Operation(summary = "按问题反馈ID查询整改列表")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:query')")
@GetMapping("/list/{feedbackId}")
public AjaxResult listByFeedbackId(@Parameter(description = "问题反馈ID") @PathVariable("feedbackId") Long feedbackId) {
List<ConstructionIssueRectification> list = rectificationService.listByFeedbackId(feedbackId);
return success(list);
@Operation(summary = "按问题反馈 ID 获取问题数据")
@GetMapping("/detail/{feedbackId}")
public AjaxResult getDetailByFeedbackId(@Parameter(description = "问题反馈 ID") @PathVariable("feedbackId") Long feedbackId) {
RectificationDetailVO detail = rectificationService.getDetailByFeedbackId(feedbackId);
return success(detail);
}
/**
* 施工单位查询整改记录按项目ID联查 cons_issue_r / cons_issue_fb
* 施工单位查询整改记录按项目 ID 联查 cons_issue_rf / cons_issue_fb
*/
@Operation(summary = "施工单位查询整改记录(按项目)")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:query')")
@Operation(summary = "施工单位查询整改记录按项目id")
@GetMapping("/listByProject/{projectId}")
public TableDataInfo listByProjectId(@Parameter(description = "项目ID") @PathVariable("projectId") Long projectId) {
startPage();
@ -80,22 +68,21 @@ public class ConstructionIssueRectificationController extends BaseController {
}
/**
* 监理待复核整改列表问题+整改摘要
* 按项目ID查询整改记录级联问题反馈
*/
@Operation(summary = "待复核整改列表(监理)")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:list')")
@GetMapping("/pendingReview")
public TableDataInfo pendingReview() {
@Operation(summary = "按项目ID查询整改记录含问题反馈")
@GetMapping("/listDetailByProject/{projectId}")
public TableDataInfo listDetailByProjectId(@Parameter(description = "项目ID") @PathVariable("projectId") Long projectId) {
startPage();
List<RectificationPendingVO> list = rectificationService.listPendingReview();
List<RectificationDetailVO> list = rectificationService.listDetailByProjectId(projectId);
return getDataTable(list);
}
/**
* 监理提交复核结果整改到位/整改未到位未到位需重新整改
*/
@Operation(summary = "提交整改复核结果(监理)")
@PreAuthorize("@ss.hasPermi('contractor:constructionIssue:edit')")
@Log(title = "施工问题整改复核", businessType = BusinessType.UPDATE)
@PostMapping("/review")
public AjaxResult submitReview(@Validated @RequestBody RectificationReviewDTO dto) {

View File

@ -0,0 +1,60 @@
package com.admin.contractor.controller;
import com.admin.contractor.domain.dto.ThirdPartyDeductionDTO;
import com.admin.contractor.service.IThirdPartyService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 第三方接口Controller
* 提供调用第三方电力系统接口的能力
*
* @author ruoyi
*/
@Tag(name = "第三方接口调用")
@RestController
@RequestMapping("/thirdParty")
public class ThirdPartyController extends BaseController {
@Autowired
private IThirdPartyService thirdPartyService;
/**
* 获取第三方系统Token
*/
@Operation(summary = "获取第三方系统Token")
@PostMapping("/getToken")
public AjaxResult getToken(
@Parameter(description = "用户名") @RequestParam String username,
@Parameter(description = "密码") @RequestParam String password) {
String token = thirdPartyService.getThirdPartyToken(username, password);
if (token != null) {
return success(token);
}
return error("获取Token失败");
}
/**
* 调用第三方扣分上报接口
*/
@Operation(summary = "调用第三方扣分上报接口")
@PostMapping("/callDeduction")
public AjaxResult callDeduction(@Validated @RequestBody ThirdPartyDeductionDTO dto) {
return thirdPartyService.callThirdPartyDeduction(dto);
}
/**
* 调用第三方获取企业评分接口
*/
@Operation(summary = "调用第三方获取企业评分接口")
@PostMapping("/callGetCompanyScore")
public AjaxResult callGetCompanyScore(@Parameter(description = "企业ID") @RequestParam Long companyId) {
return thirdPartyService.callThirdPartyGetCompanyScore(companyId);
}
}

View File

@ -53,9 +53,9 @@ public class VideoStreamDetectionController extends BaseController {
@PreAuthorize("@ss.hasPermi('contractor:videoDetection:list')")
@GetMapping("/allRecords")
public TableDataInfo allRecords(
@Parameter(description = "项目ID") @RequestParam(required = false) String projectId,
@Parameter(description = "项目 ID") @RequestParam(required = false) String projectId,
@Parameter(description = "帧时间戳") @RequestParam(required = false) Long frameTimestamp,
@Parameter(description = "报警类型(detect_type)") @RequestParam(required = false) Integer detectType) {
@Parameter(description = "报警类型 (detect_type)") @RequestParam(required = false) Integer detectType) {
startPage();
VideoStreamDetection query = new VideoStreamDetection();
query.setProjectId(projectId);
@ -65,6 +65,30 @@ public class VideoStreamDetectionController extends BaseController {
return getDataTable(list);
}
/**
* 查询已复核的视频推送记录review_status 1 2
*/
@Operation(summary = "查询已复核视频推送记录")
@PreAuthorize("@ss.hasPermi('contractor:videoDetection:list')")
@GetMapping("/reviewedRecords")
public TableDataInfo reviewedRecords(
@Parameter(description = "项目 ID") @RequestParam(required = false) String projectId,
@Parameter(description = "复核状态 (1 合格 2 不合格reviewed 表示已复核)") @RequestParam(required = false) String reviewStatus,
@Parameter(description = "报警类型 (detect_type)") @RequestParam(required = false) Integer detectType,
@Parameter(description = "帧时间戳") @RequestParam(required = false) Long frameTimestamp) {
startPage();
VideoStreamDetection query = new VideoStreamDetection();
query.setProjectId(projectId);
query.setReviewStatus(reviewStatus);
query.setDetectType(detectType);
query.setFrameTimestamp(frameTimestamp);
List<VideoStreamDetection> list = videoStreamDetectionService.listReviewedRecords(query);
return getDataTable(list);
}
/**
* 获取视频检测详情
*/
@Operation(summary = "获取视频检测详情")
@PreAuthorize("@ss.hasPermi('contractor:videoDetection:query')")
@GetMapping("/{id}")

View File

@ -0,0 +1,48 @@
package com.admin.contractor.domain.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 第三方扣分上报DTO
*
* @author ruoyi
*/
@Data
@Schema(description = "第三方扣分上报")
public class ThirdPartyDeductionDTO {
@Schema(description = "扣分配置ID", example = "47")
private Long backConfigId;
@Schema(description = "风险等级(高、中、低)", example = "")
private String description;
@Schema(description = "项目ID", example = "116")
private Long projectId;
@Schema(description = "异常原因描述", example = "异常原因描述")
private String reason;
@Schema(description = "状态(0=未处理, 1=处理中, 2=已处理)", example = "2")
private Integer status;
@Schema(description = "第三方ID", example = "1111")
private Long thirdId;
@Schema(description = "预警时间,格式: yyyy-MM-dd HH:mm:ss", example = "2026-03-12 17:26:23")
private String wainTime;
@Schema(description = "处理时间,格式: yyyy-MM-dd HH:mm:ss", example = "2026-03-13 17:26:23")
private String handTime;
@Schema(description = "完成时间,格式: yyyy-MM-dd HH:mm:ss", example = "2026-03-14 17:26:23")
private String finishTime;
@Schema(description = "图片路径(URL)")
private String pictureUrl;
@Schema(description = "视频路径 (URL)")
private String videoUrl;
}

View File

@ -0,0 +1,22 @@
package com.admin.contractor.domain.vo;
import com.admin.contractor.domain.ConstructionIssueFeedback;
import com.admin.contractor.domain.ConstructionIssueRectification;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 整改记录详情VO级联问题反馈
*
* @author ruoyi
*/
@Data
@Schema(description = "整改记录详情(含问题反馈)")
public class RectificationDetailVO {
@Schema(description = "问题反馈信息")
private ConstructionIssueFeedback feedback;
@Schema(description = "整改记录信息")
private ConstructionIssueRectification rectification;
}

View File

@ -40,7 +40,12 @@ public interface ConstructionIssueFeedbackMapper {
List<Long> selectIdsByProjectIds(@Param("projectIds") Long[] projectIds);
/**
* 根据项目ID列表批量删除反馈级联删除工作计划时使用
* 根据项目 ID 列表批量删除反馈级联删除工作计划时使用
*/
int deleteByProjectIds(@Param("projectIds") Long[] projectIds);
/**
* 统计指定项目的待整改问题数量status=0,3 待处理和审核不通过
*/
int countPendingByProjectId(@Param("projectId") Long projectId);
}

View File

@ -1,6 +1,7 @@
package com.admin.contractor.mapper;
import com.admin.contractor.domain.ConstructionIssueRectification;
import com.admin.contractor.domain.vo.RectificationDetailVO;
import com.admin.contractor.domain.vo.RectificationPendingVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -18,25 +19,34 @@ public interface ConstructionIssueRectificationMapper {
ConstructionIssueRectification selectConstructionIssueRectificationById(Long id);
/**
* 按反馈ID查询整改列表含草稿已提交按创建时间倒序
* 按反馈 ID 查询整改列表含草稿已提交按创建时间倒序
*/
List<ConstructionIssueRectification> selectByFeedbackId(@Param("feedbackId") Long feedbackId);
/**
* 按反馈ID查询最新草稿status=0用于暂存覆盖
* 按问题反馈 ID 获取问题数据级联整改表数据
*/
RectificationDetailVO selectDetailByFeedbackId(@Param("feedbackId") Long feedbackId);
/**
* 按反馈 ID 查询最新草稿status=0用于暂存覆盖
*/
ConstructionIssueRectification selectDraftByFeedbackId(@Param("feedbackId") Long feedbackId);
/**
* 待监理复核的整改列表feedback.status=1 rectification.status=1 review_result is null联查反馈摘要
*/
List<RectificationPendingVO> selectPendingReviewList();
/**
* 施工单位查询整改记录根据项目ID联查 cons_issue_fb.project_id
*/
List<ConstructionIssueRectification> selectByProjectId(@Param("projectId") Long projectId);
/**
* 根据项目 ID 查询整改详情列表含问题反馈信息
*/
List<RectificationDetailVO> selectDetailByProjectId(@Param("projectId") Long projectId);
int insertConstructionIssueRectification(ConstructionIssueRectification record);
int updateConstructionIssueRectification(ConstructionIssueRectification record);

View File

@ -31,6 +31,11 @@ public interface VideoStreamDetectionMapper {
*/
List<VideoStreamDetection> selectAllPushRecords(VideoStreamDetection query);
/**
* 查询已复核的视频推送记录review_status 1 2
*/
List<VideoStreamDetection> selectReviewedRecords(VideoStreamDetection query);
/**
* 更新复核结果
*/

View File

@ -1,7 +1,6 @@
package com.admin.contractor.service;
import com.admin.contractor.domain.ConstructionIssueFeedback;
import com.admin.contractor.domain.vo.ConstructionIssueFeedbackDetailVO;
import java.util.List;
@ -17,11 +16,6 @@ public interface IConstructionIssueFeedbackService {
*/
ConstructionIssueFeedback selectConstructionIssueFeedbackById(Long id);
/**
* 根据ID查询详情级联整改记录
*/
ConstructionIssueFeedbackDetailVO selectDetailWithRectifications(Long feedbackId);
/**
* 按条件查询列表施工方/监理查询监理确认的问题
*/
@ -36,4 +30,9 @@ public interface IConstructionIssueFeedbackService {
* 更新状态施工方处理/关闭等
*/
int updateConstructionIssueFeedback(ConstructionIssueFeedback feedback);
/**
* 统计指定项目的待整改问题数量status=0 待处理
*/
int countPendingByProjectId(Long projectId);
}

View File

@ -3,7 +3,7 @@ package com.admin.contractor.service;
import com.admin.contractor.domain.ConstructionIssueRectification;
import com.admin.contractor.domain.dto.RectificationReviewDTO;
import com.admin.contractor.domain.dto.RectificationSubmitDTO;
import com.admin.contractor.domain.vo.RectificationPendingVO;
import com.admin.contractor.domain.vo.RectificationDetailVO;
import java.util.List;
@ -15,10 +15,6 @@ import java.util.List;
*/
public interface IConstructionIssueRectificationService {
/**
* 施工单位暂存整改草稿
*/
int saveDraft(RectificationSubmitDTO dto);
/**
* 施工单位提交整改
@ -26,19 +22,25 @@ public interface IConstructionIssueRectificationService {
int submitRectification(RectificationSubmitDTO dto);
/**
* 按反馈ID查询整改列表含草稿已提交
* 按反馈 ID 查询整改列表含草稿已提交
*/
List<ConstructionIssueRectification> listByFeedbackId(Long feedbackId);
/**
* 施工单位查询整改记录按项目ID联查 cons_issue_fb.project_id
* 按问题反馈 ID 获取问题数据级联整改表数据
*/
RectificationDetailVO getDetailByFeedbackId(Long feedbackId);
/**
* 施工单位查询整改记录按项目 ID联查 cons_issue_fb.project_id
*/
List<ConstructionIssueRectification> listByProjectId(Long projectId);
/**
* 监理待复核整改列表问题+整改摘要
* 按项目ID查询整改记录级联问题反馈
*/
List<RectificationPendingVO> listPendingReview();
List<RectificationDetailVO> listDetailByProjectId(Long projectId);
/**
* 监理提交复核结果整改到位/整改未到位未到位需重新整改

View File

@ -0,0 +1,37 @@
package com.admin.contractor.service;
import com.admin.contractor.domain.dto.ThirdPartyDeductionDTO;
import com.ruoyi.common.core.web.domain.AjaxResult;
/**
* 第三方接口Service接口
*
* @author ruoyi
*/
public interface IThirdPartyService {
/**
* 获取第三方系统Token
*
* @param username 用户名
* @param password 密码
* @return Token
*/
String getThirdPartyToken(String username, String password);
/**
* 调用第三方扣分上报接口
*
* @param dto 扣分上报数据
* @return 调用结果
*/
AjaxResult callThirdPartyDeduction(ThirdPartyDeductionDTO dto);
/**
* 调用第三方获取企业评分接口
*
* @param companyId 企业ID
* @return 企业评分信息
*/
AjaxResult callThirdPartyGetCompanyScore(Long companyId);
}

View File

@ -32,7 +32,12 @@ public interface IVideoStreamDetectionService {
List<VideoStreamDetection> listAllPushRecords(VideoStreamDetection query);
/**
* 根据ID获取视频检测详情
* 查询已复核的视频推送记录review_status 1 2
*/
List<VideoStreamDetection> listReviewedRecords(VideoStreamDetection query);
/**
* 根据 ID 获取视频检测详情
*/
VideoStreamDetection selectVideoStreamDetectionById(Long id);

View File

@ -1,8 +1,6 @@
package com.admin.contractor.service.impl;
import com.admin.contractor.domain.ConstructionIssueFeedback;
import com.admin.contractor.domain.ConstructionIssueRectification;
import com.admin.contractor.domain.vo.ConstructionIssueFeedbackDetailVO;
import com.admin.contractor.mapper.ConstructionIssueFeedbackMapper;
import com.admin.contractor.mapper.ConstructionIssueRectificationMapper;
import com.admin.contractor.service.IConstructionIssueFeedbackService;
@ -34,18 +32,6 @@ public class ConstructionIssueFeedbackServiceImpl implements IConstructionIssueF
return constructionIssueFeedbackMapper.selectConstructionIssueFeedbackById(id);
}
@Override
public ConstructionIssueFeedbackDetailVO selectDetailWithRectifications(Long feedbackId) {
ConstructionIssueFeedback feedback = constructionIssueFeedbackMapper.selectConstructionIssueFeedbackById(feedbackId);
if (feedback == null) {
return null;
}
ConstructionIssueFeedbackDetailVO vo = new ConstructionIssueFeedbackDetailVO();
vo.setFeedback(feedback);
List<ConstructionIssueRectification> rectifications = constructionIssueRectificationMapper.selectByFeedbackId(feedbackId);
vo.setRectifications(rectifications);
return vo;
}
@Override
public List<ConstructionIssueFeedback> selectConstructionIssueFeedbackList(ConstructionIssueFeedback query) {
@ -73,4 +59,9 @@ public class ConstructionIssueFeedbackServiceImpl implements IConstructionIssueF
feedback.setUpdateBy(SecurityUtils.getUsername());
return constructionIssueFeedbackMapper.updateConstructionIssueFeedback(feedback);
}
@Override
public int countPendingByProjectId(Long projectId) {
return constructionIssueFeedbackMapper.countPendingByProjectId(projectId);
}
}

View File

@ -4,6 +4,7 @@ import com.admin.contractor.domain.ConstructionIssueFeedback;
import com.admin.contractor.domain.ConstructionIssueRectification;
import com.admin.contractor.domain.dto.RectificationReviewDTO;
import com.admin.contractor.domain.dto.RectificationSubmitDTO;
import com.admin.contractor.domain.vo.RectificationDetailVO;
import com.admin.contractor.domain.vo.RectificationPendingVO;
import com.admin.contractor.mapper.ConstructionIssueFeedbackMapper;
import com.admin.contractor.mapper.ConstructionIssueRectificationMapper;
@ -14,7 +15,6 @@ import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
@ -31,37 +31,6 @@ public class ConstructionIssueRectificationServiceImpl implements IConstructionI
@Autowired
private ConstructionIssueFeedbackMapper feedbackMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public int saveDraft(RectificationSubmitDTO dto) {
if (dto.getFeedbackId() == null) {
throw new ServiceException("问题反馈ID不能为空");
}
ConstructionIssueFeedback feedback = feedbackMapper.selectConstructionIssueFeedbackById(dto.getFeedbackId());
if (feedback == null) {
throw new ServiceException("问题反馈不存在");
}
if (!"0".equals(feedback.getStatus()) && !"3".equals(feedback.getStatus())) {
throw new ServiceException("仅待处理或复核不通过的问题可暂存整改");
}
String username = SecurityUtils.getUsername();
ConstructionIssueRectification draft = rectificationMapper.selectDraftByFeedbackId(dto.getFeedbackId());
if (draft != null) {
draft.setRectificationDesc(dto.getRectificationDesc());
draft.setRectificationPhotoUrls(dto.getRectificationPhotoUrls());
draft.setRectificationTime(dto.getRectificationTime());
draft.setUpdateBy(username);
return rectificationMapper.updateConstructionIssueRectification(draft);
}
ConstructionIssueRectification record = new ConstructionIssueRectification();
record.setFeedbackId(dto.getFeedbackId());
record.setRectificationDesc(dto.getRectificationDesc());
record.setRectificationPhotoUrls(dto.getRectificationPhotoUrls());
record.setRectificationTime(dto.getRectificationTime());
record.setStatus("0"); // 草稿
record.setCreateBy(username);
return rectificationMapper.insertConstructionIssueRectification(record);
}
@Override
@Transactional(rollbackFor = Exception.class)
@ -118,16 +87,22 @@ public class ConstructionIssueRectificationServiceImpl implements IConstructionI
return rectificationMapper.selectByFeedbackId(feedbackId);
}
@Override
public RectificationDetailVO getDetailByFeedbackId(Long feedbackId) {
return rectificationMapper.selectDetailByFeedbackId(feedbackId);
}
@Override
public List<ConstructionIssueRectification> listByProjectId(Long projectId) {
return rectificationMapper.selectByProjectId(projectId);
}
@Override
public List<RectificationPendingVO> listPendingReview() {
return rectificationMapper.selectPendingReviewList();
public List<RectificationDetailVO> listDetailByProjectId(Long projectId) {
return rectificationMapper.selectDetailByProjectId(projectId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int submitReview(RectificationReviewDTO dto) {
@ -144,10 +119,7 @@ public class ConstructionIssueRectificationServiceImpl implements IConstructionI
if (rect == null) {
throw new ServiceException("整改记录不存在");
}
if (!"1".equals(rect.getStatus())) {
throw new ServiceException("仅已提交的整改可复核");
}
if (StringUtils.isNotEmpty(rect.getReviewResult())) {
if (!"0".equals(rect.getReviewResult())) {
throw new ServiceException("该整改已复核");
}
String username = SecurityUtils.getUsername();

View File

@ -0,0 +1,112 @@
package com.admin.contractor.service.impl;
import com.admin.contractor.domain.dto.ThirdPartyDeductionDTO;
import com.admin.contractor.service.IThirdPartyService;
import com.admin.contractor.utils.ThirdPartyHttpClient;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.web.domain.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 第三方接口Service实现
*
* @author ruoyi
*/
@Slf4j
@Service
public class ThirdPartyServiceImpl implements IThirdPartyService {
@Autowired
private ThirdPartyHttpClient thirdPartyHttpClient;
private static final ObjectMapper objectMapper = new ObjectMapper();
/**
* 获取第三方系统Token
*
* @param username 用户名
* @param password 密码
* @return Token
*/
@Override
public String getThirdPartyToken(String username, String password) {
log.info("获取第三方Token: username={}", username);
return thirdPartyHttpClient.getToken(username, password);
}
/**
* 调用第三方扣分上报接口
*
* @param dto 扣分上报数据
* @return 调用结果
*/
@Override
public AjaxResult callThirdPartyDeduction(ThirdPartyDeductionDTO dto) {
try {
log.info("调用第三方扣分上报接口thirdId={}, projectId={}", dto.getThirdId(), dto.getProjectId());
// 获取 Token
String token = getThirdPartyToken("admin", "admin123456");
if (token == null) {
return AjaxResult.error("获取第三方 Token 失败");
}
// 转换 DTO JSON 字符串
String requestBody = objectMapper.writeValueAsString(dto);
// 调用第三方接口
String response = thirdPartyHttpClient.submitDeduction(token, requestBody);
if (response == null) {
return AjaxResult.error("调用第三方扣分上报接口失败");
}
// 检查业务返回码
JsonNode jsonNode = objectMapper.readTree(response);
if (jsonNode.has("code") && jsonNode.get("code").asInt() != 200) {
String message = jsonNode.has("message") ? jsonNode.get("message").asText() : "业务处理失败";
log.warn("第三方扣分上报业务失败:{}", message);
return AjaxResult.error("扣分上报失败:" + message);
}
log.info("第三方扣分上报成功");
return AjaxResult.success("扣分上报成功", response);
} catch (Exception e) {
log.error("调用第三方扣分上报接口异常", e);
return AjaxResult.error("调用第三方扣分上报接口异常:" + e.getMessage());
}
}
/**
* 调用第三方获取企业评分接口
*
* @param companyId 企业ID
* @return 企业评分信息
*/
@Override
public AjaxResult callThirdPartyGetCompanyScore(Long companyId) {
try {
log.info("调用第三方获取企业评分接口: companyId={}", companyId);
// 获取Token
String token = getThirdPartyToken("admin", "admin123456");
if (token == null) {
return AjaxResult.error("获取第三方Token失败");
}
// 调用第三方接口
String response = thirdPartyHttpClient.getCompanyScore(token, companyId);
if (response == null) {
return AjaxResult.error("调用第三方获取企业评分接口失败");
}
log.info("获取企业评分成功: {}", response);
return AjaxResult.success("获取企业评分成功", response);
} catch (Exception e) {
log.error("调用第三方获取企业评分接口异常", e);
return AjaxResult.error("调用第三方获取企业评分接口异常: " + e.getMessage());
}
}
}

View File

@ -90,6 +90,11 @@ public class VideoStreamDetectionServiceImpl implements IVideoStreamDetectionSer
return videoStreamDetectionMapper.selectAllPushRecords(query);
}
@Override
public List<VideoStreamDetection> listReviewedRecords(VideoStreamDetection query) {
return videoStreamDetectionMapper.selectReviewedRecords(query);
}
@Override
public VideoStreamDetection selectVideoStreamDetectionById(Long id) {
return videoStreamDetectionMapper.selectVideoStreamDetectionById(id);

View File

@ -0,0 +1,170 @@
package com.admin.contractor.utils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
/**
* 第三方接口客户端工具类
* 用于调用第三方电力系统接口
*
* @author ruoyi
*/
@Slf4j
@Component
public class ThirdPartyHttpClient {
private static final String BASE_URL = "http://1.13.245.108/trainCore";
private static final HttpClient httpClient = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
private static final ObjectMapper objectMapper = new ObjectMapper();
/**
* 获取第三方系统的Token
*
* @param username 用户名
* @param password 密码
* @return Token字符串
*/
public String getToken(String username, String password) {
try {
String loginUrl = BASE_URL + "/login/getToken";
String requestBody = String.format("{\"username\":\"%s\",\"password\":\"%s\"}", username, password);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(loginUrl))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.timeout(Duration.ofSeconds(10))
.build();
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) {
log.info("获取第三方Token成功");
// 根据实际响应格式解析Token
return parseToken(response.body());
} else {
log.error("获取第三方Token失败状态码: {}", response.statusCode());
return null;
}
} catch (Exception e) {
log.error("获取第三方Token异常", e);
return null;
}
}
/**
* 调用第三方扣分上报接口
*
* @param token 认证 Token
* @param requestBody 请求体 JSON 字符串
* @return 响应结果
*/
public String submitDeduction(String token, String requestBody) {
try {
String deductionUrl = BASE_URL + "/thirdParty/deduction";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(deductionUrl))
.header("Content-Type", "application/json")
.header("Authorization", token) // 添加 Bearer 前缀
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.timeout(Duration.ofSeconds(10))
.build();
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) {
// 检查业务返回码
JsonNode jsonNode = objectMapper.readTree(response.body());
if (jsonNode.has("code") && jsonNode.get("code").asInt() != 200) {
log.error("第三方扣分上报业务失败,业务码:{}, 消息:{}",
jsonNode.get("code").asInt(),
jsonNode.has("message") ? jsonNode.get("message").asText() : "未知错误");
return response.body(); // 返回原始响应让上层处理
}
log.info("第三方扣分上报成功");
return response.body();
} else {
log.error("第三方扣分上报失败HTTP 状态码:{}", response.statusCode());
return null;
}
} catch (Exception e) {
log.error("第三方扣分上报异常", e);
return null;
}
}
/**
* 调用第三方获取企业评分接口
*
* @param token 认证Token
* @param companyId 企业ID
* @return 响应结果
*/
public String getCompanyScore(String token, Long companyId) {
try {
String scoreUrl = BASE_URL + "/thirdParty/getCompanyScore?companyId=" + companyId;
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(scoreUrl))
.header("Content-Type", "application/json")
.header("Authorization", token) // 添加 Bearer 前缀
.POST(HttpRequest.BodyPublishers.ofString(""))
.timeout(Duration.ofSeconds(10))
.build();
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) {
log.info("获取企业评分成功companyId: {}", companyId);
return response.body();
} else {
log.error("获取企业评分失败,状态码: {}", response.statusCode());
return null;
}
} catch (Exception e) {
log.error("获取企业评分异常", e);
return null;
}
}
/**
* 从响应体中解析Token
* 根据实际的第三方响应格式调整
*
* @param responseBody 响应体
* @return Token
*/
private String parseToken(String responseBody) {
try {
// 响应格式{"code":200,"message":"操作成功","data":{"token":"eyJhbGci..."}}
var jsonNode = objectMapper.readTree(responseBody);
if (jsonNode.has("data") && !jsonNode.get("data").isNull()) {
JsonNode dataNode = jsonNode.get("data");
// 如果 data 是对象且包含 token 字段
if (dataNode.has("token")) {
return dataNode.get("token").asText();
}
// 如果 data 直接就是 token 字符串
if (dataNode.isValueNode()) {
return dataNode.asText();
}
}
log.error("无法从响应中解析出 Token: {}", responseBody);
return null;
} catch (Exception e) {
log.error("解析Token异常", e);
return responseBody;
}
}
}

View File

@ -26,7 +26,7 @@
<select id="selectConstructionIssueFeedbackById" resultMap="ConstructionIssueFeedbackResult">
select * from cons_issue_fb
where id = #{id} and del_flag = '0'
where id = #{id}
</select>
<select id="selectConstructionIssueFeedbackList" parameterType="com.admin.contractor.domain.ConstructionIssueFeedback" resultMap="ConstructionIssueFeedbackResult">
@ -83,4 +83,9 @@
</foreach>
</delete>
<select id="countPendingByProjectId" resultType="int">
select count(1) from cons_issue_fb
where project_id = #{projectId} and status in (0,3)
</select>
</mapper>

View File

@ -35,6 +35,44 @@
<result property="createTime" column="r_create_time" />
</resultMap>
<resultMap id="RectificationDetailVOResult" type="com.admin.contractor.domain.vo.RectificationDetailVO">
<association property="rectification" javaType="com.admin.contractor.domain.ConstructionIssueRectification">
<id property="id" column="id" />
<result property="feedbackId" column="feedback_id" />
<result property="rectificationDesc" column="rectification_desc" />
<result property="rectificationPhotoUrls" column="rectification_photo_urls" />
<result property="rectificationTime" column="rectification_time" />
<result property="status" column="status" />
<result property="reviewResult" column="review_result" />
<result property="reviewComment" column="review_comment" />
<result property="reviewPhotoUrls" column="review_photo_urls" />
<result property="reviewBy" column="review_by" />
<result property="reviewTime" column="review_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</association>
<association property="feedback" javaType="com.admin.contractor.domain.ConstructionIssueFeedback">
<id property="id" column="fb_id" />
<result property="projectId" column="project_id" />
<result property="sourceType" column="source_type" />
<result property="videoDetectionId" column="video_detection_id" />
<result property="detectionName" column="detection_name" />
<result property="description" column="description" />
<result property="problemPhotoUrl" column="problem_photo_url" />
<result property="attachmentUrls" column="attachment_urls" />
<result property="status" column="fb_status" />
<result property="submitBy" column="submit_by" />
<result property="submitTime" column="submit_time" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="fb_create_by" />
<result property="createTime" column="fb_create_time" />
<result property="updateBy" column="fb_update_by" />
<result property="updateTime" column="fb_update_time" />
</association>
</resultMap>
<select id="selectConstructionIssueRectificationById" resultMap="ConstructionIssueRectificationResult">
select * from cons_issue_rf where id = #{id}
</select>
@ -45,26 +83,38 @@
order by create_time desc
</select>
<select id="selectDetailByFeedbackId" resultMap="RectificationDetailVOResult">
select r.*, f.id as fb_id, f.project_id, f.source_type, f.video_detection_id, f.detection_name,
f.description, f.problem_photo_url, f.attachment_urls, f.status as fb_status,
f.submit_by, f.submit_time, f.del_flag, f.create_by as fb_create_by,
f.create_time as fb_create_time, f.update_by as fb_update_by, f.update_time as fb_update_time
from cons_issue_rf r
inner join cons_issue_fb f on r.feedback_id = f.id
where f.id = #{feedbackId} and r.review_result = 0
order by r.create_time desc
</select>
<select id="selectDraftByFeedbackId" resultMap="ConstructionIssueRectificationResult">
select * from cons_issue_rf
where feedback_id = #{feedbackId} and status = '0'
order by create_time desc limit 1
</select>
<select id="selectPendingReviewList" resultMap="RectificationPendingVOResult">
select r.id as rectification_id, r.feedback_id, r.rectification_desc, r.rectification_photo_urls,
r.rectification_time, r.create_time as r_create_time,
f.detection_name, f.description, f.problem_photo_url, f.submit_time
from cons_issue_rf r
inner join cons_issue_fb f on r.feedback_id = f.id and f.del_flag = '0' and f.status = '1'
where r.status = '1' and (r.review_result is null or r.review_result = '')
order by r.create_time desc
</select>
<select id="selectByProjectId" parameterType="long" resultMap="ConstructionIssueRectificationResult">
select r.*
from cons_issue_rf r
inner join cons_issue_fb f on r.feedback_id = f.id and f.del_flag = '0'
inner join cons_issue_fb f on r.feedback_id = f.id
where f.project_id = #{projectId}
order by r.create_time desc
</select>
<select id="selectDetailByProjectId" parameterType="long" resultMap="RectificationDetailVOResult">
select r.*, f.id as fb_id, f.project_id, f.source_type, f.video_detection_id, f.detection_name,
f.description, f.problem_photo_url, f.attachment_urls, f.status as fb_status,
f.submit_by, f.submit_time, f.del_flag, f.create_by as fb_create_by,
f.create_time as fb_create_time, f.update_by as fb_update_by, f.update_time as fb_update_time
from cons_issue_rf r
inner join cons_issue_fb f on r.feedback_id = f.id
where f.project_id = #{projectId}
order by r.create_time desc
</select>

View File

@ -71,6 +71,35 @@
order by v.create_time desc
</select>
<select id="selectReviewedRecords" parameterType="com.admin.contractor.domain.VideoStreamDetection" resultMap="VideoStreamDetectionResult">
select
v.id, v.stream_id, v.project_id, v.frame_timestamp, v.name, v.label, v.need_alert,
v.box_json, v.confidence, v.tag, v.detect_type, v.img_url, v.video_url, v.is_first,
v.review_status, v.review_by, v.review_time, v.create_time
from cons_video_detection v
where 1 = 1
<if test="projectId != null and projectId != ''">
and v.project_id = #{projectId}
</if>
<if test="reviewStatus != null and reviewStatus != ''">
<choose>
<when test="reviewStatus == 'reviewed'">
and v.review_status in ('1', '2')
</when>
<otherwise>
and v.review_status = #{reviewStatus}
</otherwise>
</choose>
</if>
<if test="detectType != null">
and v.detect_type = #{detectType}
</if>
<if test="frameTimestamp != null">
and v.frame_timestamp &gt;= #{frameTimestamp}
</if>
order by v.create_time desc
</select>
<update id="updateReview">
update cons_video_detection
set review_status = #{reviewStatus}, review_by = #{reviewBy}, review_time = now()