施工单位界面,创建工作计划工作票出入证接口对接
This commit is contained in:
parent
4ef0ff2324
commit
87f206af7f
|
|
@ -1,6 +1,7 @@
|
|||
package com.admin.contractor.controller;
|
||||
|
||||
import com.admin.contractor.domain.AccessPermit;
|
||||
import com.admin.contractor.domain.VehicleInfo;
|
||||
import com.admin.contractor.service.IAccessPermitService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -105,4 +106,28 @@ public class AccessPermitController extends BaseController {
|
|||
public AjaxResult submit(@Parameter(description = "出入证ID") @PathVariable("permitId") Long permitId) {
|
||||
return toAjax(accessPermitService.submitAccessPermit(permitId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加车辆到出入证
|
||||
*/
|
||||
@Operation(summary = "添加车辆到出入证")
|
||||
@PreAuthorize("@ss.hasPermi('contractor:accessPermit:edit')")
|
||||
@Log(title = "出入证车辆管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/{permitId}/vehicle")
|
||||
public AjaxResult addVehicle(@Parameter(description = "出入证ID") @PathVariable("permitId") Long permitId,
|
||||
@Validated @RequestBody VehicleInfo vehicleInfo) {
|
||||
return toAjax(accessPermitService.addVehicle(permitId, vehicleInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 从出入证删除车辆
|
||||
*/
|
||||
@Operation(summary = "从出入证删除车辆")
|
||||
@PreAuthorize("@ss.hasPermi('contractor:accessPermit:edit')")
|
||||
@Log(title = "出入证车辆管理", businessType = BusinessType.UPDATE)
|
||||
@DeleteMapping("/{permitId}/vehicle/{licensePlate}")
|
||||
public AjaxResult removeVehicle(@Parameter(description = "出入证ID") @PathVariable("permitId") Long permitId,
|
||||
@Parameter(description = "车牌号") @PathVariable("licensePlate") String licensePlate) {
|
||||
return toAjax(accessPermitService.removeVehicle(permitId, licensePlate));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,4 +110,28 @@ public class WorkPlanController extends BaseController {
|
|||
public AjaxResult submit(@Parameter(description = "项目ID") @PathVariable("projectId") Long projectId) {
|
||||
return toAjax(workPlanService.submitWorkPlan(projectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批工作计划(通过)
|
||||
*/
|
||||
@Operation(summary = "审批工作计划(通过)")
|
||||
@PreAuthorize("@ss.hasPermi('contractor:workPlan:approve')")
|
||||
@Log(title = "工作计划审批", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/approve/{projectId}")
|
||||
public AjaxResult approve(@Parameter(description = "项目ID") @PathVariable("projectId") Long projectId,
|
||||
@Parameter(description = "审批意见") @RequestParam(required = false) String approvalComment) {
|
||||
return toAjax(workPlanService.approveWorkPlan(projectId, approvalComment));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批工作计划(驳回)
|
||||
*/
|
||||
@Operation(summary = "审批工作计划(驳回)")
|
||||
@PreAuthorize("@ss.hasPermi('contractor:workPlan:approve')")
|
||||
@Log(title = "工作计划审批", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/reject/{projectId}")
|
||||
public AjaxResult reject(@Parameter(description = "项目ID") @PathVariable("projectId") Long projectId,
|
||||
@Parameter(description = "审批意见") @RequestParam(required = false) String approvalComment) {
|
||||
return toAjax(workPlanService.rejectWorkPlan(projectId, approvalComment));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.admin.contractor.controller;
|
|||
|
||||
import com.admin.contractor.domain.WorkTicket;
|
||||
import com.admin.contractor.service.IWorkTicketService;
|
||||
import com.admin.property.service.IPcRiskProjectService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
|
@ -30,6 +31,9 @@ public class WorkTicketController extends BaseController {
|
|||
@Autowired
|
||||
private IWorkTicketService workTicketService;
|
||||
|
||||
@Autowired(required = false)
|
||||
private IPcRiskProjectService pcRiskProjectService;
|
||||
|
||||
/**
|
||||
* 查询工作票申请列表
|
||||
*/
|
||||
|
|
@ -70,7 +74,21 @@ public class WorkTicketController extends BaseController {
|
|||
@Log(title = "工作票申请", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody WorkTicket workTicket) {
|
||||
return toAjax(workTicketService.insertWorkTicket(workTicket));
|
||||
int rows = workTicketService.insertWorkTicket(workTicket);
|
||||
if (rows > 0) {
|
||||
// 如果传入了球机申请单ID,创建成功后绑定工作票ID
|
||||
if (workTicket.getCameraApplicationId() != null && pcRiskProjectService != null) {
|
||||
try {
|
||||
pcRiskProjectService.updateWorkTicketId(workTicket.getCameraApplicationId(), workTicket.getTicketId());
|
||||
} catch (Exception e) {
|
||||
// 绑定失败不影响工作票创建,但需要记录日志
|
||||
// 可以后续通过其他方式补偿绑定
|
||||
return error("工作票创建成功,但绑定球机申请单失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
return success(workTicket.getTicketId());
|
||||
}
|
||||
return error("新增工作票申请失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -116,4 +134,28 @@ public class WorkTicketController extends BaseController {
|
|||
public AjaxResult submit(@Parameter(description = "工作票ID") @PathVariable("ticketId") Long ticketId) {
|
||||
return toAjax(workTicketService.submitWorkTicket(ticketId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批工作票(通过/已签发)
|
||||
*/
|
||||
@Operation(summary = "审批工作票(通过)")
|
||||
@PreAuthorize("@ss.hasPermi('contractor:workTicket:approve')")
|
||||
@Log(title = "工作票审批", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/approve/{ticketId}")
|
||||
public AjaxResult approve(@Parameter(description = "工作票ID") @PathVariable("ticketId") Long ticketId,
|
||||
@Parameter(description = "审核意见") @RequestParam(required = false) String reviewComment) {
|
||||
return toAjax(workTicketService.approveWorkTicket(ticketId, reviewComment));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批工作票(驳回)
|
||||
*/
|
||||
@Operation(summary = "审批工作票(驳回)")
|
||||
@PreAuthorize("@ss.hasPermi('contractor:workTicket:approve')")
|
||||
@Log(title = "工作票审批", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/reject/{ticketId}")
|
||||
public AjaxResult reject(@Parameter(description = "工作票ID") @PathVariable("ticketId") Long ticketId,
|
||||
@Parameter(description = "审核意见") @RequestParam(required = false) String reviewComment) {
|
||||
return toAjax(workTicketService.rejectWorkTicket(ticketId, reviewComment));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,4 +17,7 @@ public class VehicleInfo {
|
|||
|
||||
@Schema(description = "车辆类型")
|
||||
private String vehicleType;
|
||||
|
||||
@Schema(description = "是否被选中(用于业主签发出入证时选择车辆)")
|
||||
private Boolean selected;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,9 +72,24 @@ public class WorkPlan extends BaseEntity {
|
|||
@Schema(description = "项目状态:0草稿,1已提交,2进行中,3已完成,4已取消")
|
||||
private String projectStatus;
|
||||
|
||||
@Schema(description = "审批状态:0待审核,1已通过,2已驳回")
|
||||
private String approvalStatus;
|
||||
|
||||
@Schema(description = "审批人")
|
||||
private String approver;
|
||||
|
||||
@Schema(description = "审批时间")
|
||||
private String approvalTime;
|
||||
|
||||
@Schema(description = "审批意见")
|
||||
private String approvalComment;
|
||||
|
||||
@Schema(description = "当前进度(百分比)")
|
||||
private Integer currentProgress;
|
||||
|
||||
@Schema(description = "草稿状态显示文字(不映射到数据库,用于前端显示)")
|
||||
private String draftStatusText;
|
||||
|
||||
@Schema(description = "删除标志(0代表存在 2代表删除)")
|
||||
private String delFlag;
|
||||
|
||||
|
|
|
|||
|
|
@ -87,4 +87,22 @@ public interface WorkPlanMapper {
|
|||
* @return 项目列表(包含关联信息)
|
||||
*/
|
||||
List<WorkPlan> selectProjectFullProcessList(WorkPlan workPlan);
|
||||
|
||||
/**
|
||||
* 更新项目状态和审批状态
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param projectStatus 项目状态
|
||||
* @param approvalStatus 审批状态
|
||||
* @param approver 审批人
|
||||
* @param approvalTime 审批时间
|
||||
* @param approvalComment 审批意见
|
||||
* @return 结果
|
||||
*/
|
||||
int updateProjectStatusAndApproval(@Param("projectId") Long projectId,
|
||||
@Param("projectStatus") String projectStatus,
|
||||
@Param("approvalStatus") String approvalStatus,
|
||||
@Param("approver") String approver,
|
||||
@Param("approvalTime") String approvalTime,
|
||||
@Param("approvalComment") String approvalComment);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.admin.contractor.service;
|
||||
|
||||
import com.admin.contractor.domain.AccessPermit;
|
||||
import com.admin.contractor.domain.VehicleInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -66,4 +67,22 @@ public interface IAccessPermitService {
|
|||
* @return 结果
|
||||
*/
|
||||
int submitAccessPermit(Long permitId);
|
||||
|
||||
/**
|
||||
* 添加车辆到出入证
|
||||
*
|
||||
* @param permitId 出入证ID
|
||||
* @param vehicleInfo 车辆信息
|
||||
* @return 结果
|
||||
*/
|
||||
int addVehicle(Long permitId, VehicleInfo vehicleInfo);
|
||||
|
||||
/**
|
||||
* 从出入证删除车辆
|
||||
*
|
||||
* @param permitId 出入证ID
|
||||
* @param licensePlate 车牌号
|
||||
* @return 结果
|
||||
*/
|
||||
int removeVehicle(Long permitId, String licensePlate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,4 +74,22 @@ public interface IWorkPlanService {
|
|||
* @return 项目列表(包含关联信息)
|
||||
*/
|
||||
List<WorkPlan> selectProjectFullProcessList(WorkPlan workPlan);
|
||||
|
||||
/**
|
||||
* 审批工作计划(通过)
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param approvalComment 审批意见
|
||||
* @return 结果
|
||||
*/
|
||||
int approveWorkPlan(Long projectId, String approvalComment);
|
||||
|
||||
/**
|
||||
* 审批工作计划(驳回)
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param approvalComment 审批意见
|
||||
* @return 结果
|
||||
*/
|
||||
int rejectWorkPlan(Long projectId, String approvalComment);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,4 +74,22 @@ public interface IWorkTicketService {
|
|||
* @return 结果
|
||||
*/
|
||||
int submitWorkTicket(Long ticketId);
|
||||
|
||||
/**
|
||||
* 审批工作票(通过/已签发)
|
||||
*
|
||||
* @param ticketId 工作票ID
|
||||
* @param reviewComment 审核意见
|
||||
* @return 结果
|
||||
*/
|
||||
int approveWorkTicket(Long ticketId, String reviewComment);
|
||||
|
||||
/**
|
||||
* 审批工作票(驳回)
|
||||
*
|
||||
* @param ticketId 工作票ID
|
||||
* @param reviewComment 审核意见
|
||||
* @return 结果
|
||||
*/
|
||||
int rejectWorkTicket(Long ticketId, String reviewComment);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.admin.contractor.service.impl;
|
||||
|
||||
import com.admin.contractor.domain.AccessPermit;
|
||||
import com.admin.contractor.domain.VehicleInfo;
|
||||
import com.admin.contractor.mapper.AccessPermitMapper;
|
||||
import com.admin.contractor.mapper.WorkPlanMapper;
|
||||
import com.admin.contractor.service.IAccessPermitService;
|
||||
|
|
@ -19,6 +20,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 出入证申请Service业务层处理
|
||||
|
|
@ -193,10 +195,24 @@ public class AccessPermitServiceImpl implements IAccessPermitService {
|
|||
private void parseJsonFields(AccessPermit accessPermit) {
|
||||
try {
|
||||
if (StringUtils.isNotEmpty(accessPermit.getVehicleInfo())) {
|
||||
accessPermit.setVehicleList(objectMapper.readValue(
|
||||
List<com.admin.contractor.domain.VehicleInfo> vehicleList = objectMapper.readValue(
|
||||
accessPermit.getVehicleInfo(),
|
||||
new TypeReference<List<com.admin.contractor.domain.VehicleInfo>>() {}
|
||||
));
|
||||
);
|
||||
// 确保所有车辆都有 selected 字段
|
||||
if (vehicleList != null) {
|
||||
for (com.admin.contractor.domain.VehicleInfo vehicle : vehicleList) {
|
||||
if (vehicle.getSelected() == null) {
|
||||
// 如果出入证已签发,车辆都是已选中的;否则默认为未选中
|
||||
if ("1".equals(accessPermit.getStatus())) {
|
||||
vehicle.setSelected(true);
|
||||
} else {
|
||||
vehicle.setSelected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
accessPermit.setVehicleList(vehicleList);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(accessPermit.getAttachmentUrls())) {
|
||||
accessPermit.setAttachmentList(java.util.Arrays.asList(accessPermit.getAttachmentUrls().split(",")));
|
||||
|
|
@ -273,4 +289,125 @@ public class AccessPermitServiceImpl implements IAccessPermitService {
|
|||
String dateStr = sdf.format(new Date());
|
||||
return "AC" + dateStr + System.currentTimeMillis() % 10000;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加车辆到出入证
|
||||
*
|
||||
* @param permitId 出入证ID
|
||||
* @param vehicleInfo 车辆信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int addVehicle(Long permitId, VehicleInfo vehicleInfo) {
|
||||
if (permitId == null) {
|
||||
throw new ServiceException("出入证ID不能为空");
|
||||
}
|
||||
if (vehicleInfo == null) {
|
||||
throw new ServiceException("车辆信息不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(vehicleInfo.getLicensePlate())) {
|
||||
throw new ServiceException("车牌号不能为空");
|
||||
}
|
||||
|
||||
// 查询出入证
|
||||
AccessPermit permit = accessPermitMapper.selectAccessPermitById(permitId);
|
||||
if (permit == null) {
|
||||
throw new ServiceException("出入证申请不存在");
|
||||
}
|
||||
|
||||
// 解析现有车辆列表
|
||||
List<VehicleInfo> vehicleList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(permit.getVehicleInfo())) {
|
||||
try {
|
||||
vehicleList = objectMapper.readValue(
|
||||
permit.getVehicleInfo(),
|
||||
new TypeReference<List<VehicleInfo>>() {}
|
||||
);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("车辆信息格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 检查车牌号是否已存在
|
||||
boolean exists = vehicleList.stream()
|
||||
.anyMatch(v -> vehicleInfo.getLicensePlate().equals(v.getLicensePlate()));
|
||||
if (exists) {
|
||||
throw new ServiceException("该车牌号已存在");
|
||||
}
|
||||
|
||||
// 添加新车辆,确保 selected 为 false(承包商添加的车辆默认未选中)
|
||||
if (vehicleInfo.getSelected() == null) {
|
||||
vehicleInfo.setSelected(false);
|
||||
}
|
||||
vehicleList.add(vehicleInfo);
|
||||
|
||||
// 更新车辆信息
|
||||
try {
|
||||
permit.setVehicleInfo(objectMapper.writeValueAsString(vehicleList));
|
||||
permit.setUpdateBy(SecurityUtils.getUsername());
|
||||
return accessPermitMapper.updateAccessPermit(permit);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("保存车辆信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从出入证删除车辆
|
||||
*
|
||||
* @param permitId 出入证ID
|
||||
* @param licensePlate 车牌号
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int removeVehicle(Long permitId, String licensePlate) {
|
||||
if (permitId == null) {
|
||||
throw new ServiceException("出入证ID不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(licensePlate)) {
|
||||
throw new ServiceException("车牌号不能为空");
|
||||
}
|
||||
|
||||
// 查询出入证
|
||||
AccessPermit permit = accessPermitMapper.selectAccessPermitById(permitId);
|
||||
if (permit == null) {
|
||||
throw new ServiceException("出入证申请不存在");
|
||||
}
|
||||
|
||||
// 解析现有车辆列表
|
||||
List<VehicleInfo> vehicleList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(permit.getVehicleInfo())) {
|
||||
try {
|
||||
vehicleList = objectMapper.readValue(
|
||||
permit.getVehicleInfo(),
|
||||
new TypeReference<List<VehicleInfo>>() {}
|
||||
);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("车辆信息格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 删除指定车牌号的车辆
|
||||
List<VehicleInfo> updatedList = vehicleList.stream()
|
||||
.filter(v -> !licensePlate.equals(v.getLicensePlate()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (updatedList.size() == vehicleList.size()) {
|
||||
throw new ServiceException("未找到该车牌号的车辆");
|
||||
}
|
||||
|
||||
// 更新车辆信息
|
||||
try {
|
||||
if (updatedList.isEmpty()) {
|
||||
permit.setVehicleInfo(null);
|
||||
} else {
|
||||
permit.setVehicleInfo(objectMapper.writeValueAsString(updatedList));
|
||||
}
|
||||
permit.setUpdateBy(SecurityUtils.getUsername());
|
||||
return accessPermitMapper.updateAccessPermit(permit);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("删除车辆信息失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ public class WorkPlanServiceImpl implements IWorkPlanService {
|
|||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Autowired
|
||||
private com.admin.contractor.mapper.WorkTicketMapper workTicketMapper;
|
||||
|
||||
@Autowired
|
||||
private com.admin.property.mapper.PcRiskProjectMapper pcRiskProjectMapper;
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
/**
|
||||
|
|
@ -47,6 +53,8 @@ public class WorkPlanServiceImpl implements IWorkPlanService {
|
|||
if (workPlan != null) {
|
||||
// 查询作业班成员用户信息
|
||||
loadSysUsers(workPlan);
|
||||
// 设置草稿状态显示文字
|
||||
setDraftStatusText(workPlan);
|
||||
}
|
||||
return workPlan;
|
||||
}
|
||||
|
|
@ -89,9 +97,10 @@ public class WorkPlanServiceImpl implements IWorkPlanService {
|
|||
@Override
|
||||
public List<WorkPlan> selectWorkPlanList(WorkPlan workPlan) {
|
||||
List<WorkPlan> list = workPlanMapper.selectWorkPlanList(workPlan);
|
||||
// 加载作业班成员信息
|
||||
// 加载作业班成员信息和草稿状态显示文字
|
||||
for (WorkPlan plan : list) {
|
||||
loadSysUsers(plan);
|
||||
setDraftStatusText(plan);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
@ -113,6 +122,10 @@ public class WorkPlanServiceImpl implements IWorkPlanService {
|
|||
if (StringUtils.isEmpty(workPlan.getProjectStatus())) {
|
||||
workPlan.setProjectStatus("0");
|
||||
}
|
||||
// 默认审批状态为空(草稿状态不需要审批)
|
||||
if (StringUtils.isEmpty(workPlan.getApprovalStatus())) {
|
||||
workPlan.setApprovalStatus(null);
|
||||
}
|
||||
// 默认进度为0
|
||||
if (workPlan.getCurrentProgress() == null) {
|
||||
workPlan.setCurrentProgress(0);
|
||||
|
|
@ -232,7 +245,93 @@ public class WorkPlanServiceImpl implements IWorkPlanService {
|
|||
if (workPlan == null) {
|
||||
throw new ServiceException("工作计划不存在");
|
||||
}
|
||||
return workPlanMapper.updateProjectStatus(projectId, "1"); // 已提交
|
||||
if (!"0".equals(workPlan.getProjectStatus())) {
|
||||
throw new ServiceException("只能提交草稿状态的工作计划");
|
||||
}
|
||||
// 更新状态为已提交,审批状态为待审核(0)
|
||||
return workPlanMapper.updateProjectStatusAndApproval(projectId, "1", "0", null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置草稿状态显示文字
|
||||
* 如果是草稿状态,根据工作票和球机申领表是否创建来判断显示文字
|
||||
*/
|
||||
private void setDraftStatusText(WorkPlan workPlan) {
|
||||
if (workPlan != null) {
|
||||
if ("0".equals(workPlan.getProjectStatus())) {
|
||||
// 草稿状态:检查工作票和球机申领表是否创建
|
||||
com.admin.contractor.domain.WorkTicket workTicket = workTicketMapper.selectWorkTicketByProjectId(workPlan.getProjectId());
|
||||
boolean hasWorkTicket = workTicket != null;
|
||||
|
||||
// 检查球机申领表是否创建
|
||||
com.admin.property.domain.PcRiskProject query = new com.admin.property.domain.PcRiskProject();
|
||||
query.setProjectId(workPlan.getProjectId());
|
||||
List<com.admin.property.domain.PcRiskProject> cameraApps = pcRiskProjectMapper.selectPcRiskProjectList(query);
|
||||
boolean hasCameraApp = cameraApps != null && !cameraApps.isEmpty();
|
||||
|
||||
// 根据创建情况设置显示文字
|
||||
if (!hasWorkTicket) {
|
||||
workPlan.setDraftStatusText("待填工作票");
|
||||
} else if (!hasCameraApp) {
|
||||
workPlan.setDraftStatusText("待申领监控球机");
|
||||
} else {
|
||||
workPlan.setDraftStatusText("草稿");
|
||||
}
|
||||
} else if ("1".equals(workPlan.getProjectStatus())) {
|
||||
// 已提交状态:将审批状态转换为文字返回到draftStatusText字段
|
||||
String approvalStatus = workPlan.getApprovalStatus();
|
||||
if (approvalStatus != null) {
|
||||
switch (approvalStatus) {
|
||||
case "0":
|
||||
workPlan.setDraftStatusText("待审核");
|
||||
break;
|
||||
case "1":
|
||||
workPlan.setDraftStatusText("已通过");
|
||||
break;
|
||||
case "2":
|
||||
workPlan.setDraftStatusText("已驳回");
|
||||
break;
|
||||
default:
|
||||
workPlan.setDraftStatusText("待审核");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
workPlan.setDraftStatusText("待审核");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int approveWorkPlan(Long projectId, String approvalComment) {
|
||||
WorkPlan workPlan = workPlanMapper.selectWorkPlanById(projectId);
|
||||
if (workPlan == null) {
|
||||
throw new ServiceException("工作计划不存在");
|
||||
}
|
||||
if (!"0".equals(workPlan.getApprovalStatus())) {
|
||||
throw new ServiceException("只能审批待审核状态的工作计划");
|
||||
}
|
||||
String approver = SecurityUtils.getUsername();
|
||||
String approvalTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
// 审批通过,更新审批状态为1(已通过),项目状态改为进行中
|
||||
return workPlanMapper.updateProjectStatusAndApproval(projectId, "2", "1", approver, approvalTime, approvalComment);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int rejectWorkPlan(Long projectId, String approvalComment) {
|
||||
WorkPlan workPlan = workPlanMapper.selectWorkPlanById(projectId);
|
||||
if (workPlan == null) {
|
||||
throw new ServiceException("工作计划不存在");
|
||||
}
|
||||
if (!"0".equals(workPlan.getApprovalStatus())) {
|
||||
throw new ServiceException("只能审批待审核状态的工作计划");
|
||||
}
|
||||
String approver = SecurityUtils.getUsername();
|
||||
String approvalTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
// 审批驳回,更新审批状态为2(已驳回),项目状态改回草稿
|
||||
return workPlanMapper.updateProjectStatusAndApproval(projectId, "0", "2", approver, approvalTime, approvalComment);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.admin.contractor.service.impl;
|
||||
|
||||
import com.admin.contractor.domain.WorkTicket;
|
||||
import com.admin.contractor.domain.WorkPlan;
|
||||
import com.admin.contractor.mapper.WorkPlanMapper;
|
||||
import com.admin.contractor.mapper.WorkTicketMapper;
|
||||
import com.admin.contractor.service.IWorkTicketService;
|
||||
|
|
@ -171,6 +172,68 @@ public class WorkTicketServiceImpl implements IWorkTicketService {
|
|||
return workTicketMapper.updateTicketStatus(ticketId, "1", null, null); // 待审核状态
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批工作票(通过/已签发)
|
||||
*
|
||||
* @param ticketId 工作票ID
|
||||
* @param reviewComment 审核意见
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int approveWorkTicket(Long ticketId, String reviewComment) {
|
||||
WorkTicket ticket = workTicketMapper.selectWorkTicketById(ticketId);
|
||||
if (ticket == null) {
|
||||
throw new ServiceException("工作票申请不存在");
|
||||
}
|
||||
if (!"1".equals(ticket.getStatus())) {
|
||||
throw new ServiceException("只能审批待审核状态的工作票申请");
|
||||
}
|
||||
// 检查工作计划的审批状态,必须审批通过才能审批工作票
|
||||
if (ticket.getProjectId() != null) {
|
||||
WorkPlan workPlan = workPlanMapper.selectWorkPlanById(ticket.getProjectId());
|
||||
if (workPlan == null) {
|
||||
throw new ServiceException("关联的工作计划不存在");
|
||||
}
|
||||
if (!"1".equals(workPlan.getApprovalStatus())) {
|
||||
throw new ServiceException("工作计划审批未通过,无法审批工作票申请");
|
||||
}
|
||||
}
|
||||
String reviewer = SecurityUtils.getUsername();
|
||||
return workTicketMapper.updateTicketStatus(ticketId, "2", reviewer, reviewComment); // 已签发
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批工作票(驳回)
|
||||
*
|
||||
* @param ticketId 工作票ID
|
||||
* @param reviewComment 审核意见
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int rejectWorkTicket(Long ticketId, String reviewComment) {
|
||||
WorkTicket ticket = workTicketMapper.selectWorkTicketById(ticketId);
|
||||
if (ticket == null) {
|
||||
throw new ServiceException("工作票申请不存在");
|
||||
}
|
||||
if (!"1".equals(ticket.getStatus())) {
|
||||
throw new ServiceException("只能审批待审核状态的工作票申请");
|
||||
}
|
||||
// 检查工作计划的审批状态,必须审批通过才能审批工作票
|
||||
if (ticket.getProjectId() != null) {
|
||||
WorkPlan workPlan = workPlanMapper.selectWorkPlanById(ticket.getProjectId());
|
||||
if (workPlan == null) {
|
||||
throw new ServiceException("关联的工作计划不存在");
|
||||
}
|
||||
if (!"1".equals(workPlan.getApprovalStatus())) {
|
||||
throw new ServiceException("工作计划审批未通过,无法审批工作票申请");
|
||||
}
|
||||
}
|
||||
String reviewer = SecurityUtils.getUsername();
|
||||
return workTicketMapper.updateTicketStatus(ticketId, "3", reviewer, reviewComment); // 已驳回
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理JSON字段
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.admin.owner.controller;
|
||||
|
||||
import com.admin.contractor.domain.AccessPermit;
|
||||
import com.admin.contractor.domain.VehicleInfo;
|
||||
import com.admin.contractor.domain.WorkTicket;
|
||||
import com.admin.owner.service.IAccessPermitIssuanceService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
|
|
@ -95,4 +96,26 @@ public class AccessPermitIssuanceController extends BaseController {
|
|||
public AjaxResult cancel(@Parameter(description = "出入证ID") @PathVariable("permitId") Long permitId) {
|
||||
return toAjax(accessPermitIssuanceService.cancelAccessPermit(permitId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目已添加的车辆列表
|
||||
*/
|
||||
@Operation(summary = "查询项目已添加的车辆列表", description = "查询某个项目下所有出入证已添加的车辆列表(去重)")
|
||||
@PreAuthorize("@ss.hasPermi('owner:accessPermitIssuance:query')")
|
||||
@GetMapping("/project/{projectId}/vehicles")
|
||||
public AjaxResult getProjectVehicles(@Parameter(description = "项目ID") @PathVariable("projectId") Long projectId) {
|
||||
List<VehicleInfo> vehicles = accessPermitIssuanceService.getProjectVehicles(projectId);
|
||||
return success(vehicles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询出入证已添加的车辆列表
|
||||
*/
|
||||
@Operation(summary = "查询出入证已添加的车辆列表", description = "查询指定出入证已添加的车辆列表")
|
||||
@PreAuthorize("@ss.hasPermi('owner:accessPermitIssuance:query')")
|
||||
@GetMapping("/{permitId}/vehicles")
|
||||
public AjaxResult getPermitVehicles(@Parameter(description = "出入证ID") @PathVariable("permitId") Long permitId) {
|
||||
List<VehicleInfo> vehicles = accessPermitIssuanceService.getPermitVehicles(permitId);
|
||||
return success(vehicles);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.admin.owner.service;
|
||||
|
||||
import com.admin.contractor.domain.AccessPermit;
|
||||
import com.admin.contractor.domain.VehicleInfo;
|
||||
import com.admin.contractor.domain.WorkTicket;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -59,4 +60,20 @@ public interface IAccessPermitIssuanceService {
|
|||
* @return 结果
|
||||
*/
|
||||
int cancelAccessPermit(Long permitId);
|
||||
|
||||
/**
|
||||
* 查询项目已添加的车辆列表
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return 车辆列表
|
||||
*/
|
||||
List<VehicleInfo> getProjectVehicles(Long projectId);
|
||||
|
||||
/**
|
||||
* 查询出入证已添加的车辆列表
|
||||
*
|
||||
* @param permitId 出入证ID
|
||||
* @return 车辆列表
|
||||
*/
|
||||
List<VehicleInfo> getPermitVehicles(Long permitId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ public class AccessPermitIssuanceServiceImpl implements IAccessPermitIssuanceSer
|
|||
@Autowired
|
||||
private IWorkTicketService workTicketService;
|
||||
|
||||
@Autowired
|
||||
private com.admin.contractor.mapper.WorkPlanMapper workPlanMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
|
|
@ -122,6 +125,15 @@ public class AccessPermitIssuanceServiceImpl implements IAccessPermitIssuanceSer
|
|||
accessPermit.setVehicleList(existingPermit.getVehicleList());
|
||||
accessPermit.setSysUserIds(existingPermit.getSysUserIds());
|
||||
accessPermit.setSysUserList(existingPermit.getSysUserList());
|
||||
|
||||
// 确保车辆列表中的 selected 字段有默认值
|
||||
if (accessPermit.getVehicleList() != null) {
|
||||
for (VehicleInfo vehicle : accessPermit.getVehicleList()) {
|
||||
if (vehicle.getSelected() == null) {
|
||||
vehicle.setSelected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return accessPermit;
|
||||
|
|
@ -150,6 +162,18 @@ public class AccessPermitIssuanceServiceImpl implements IAccessPermitIssuanceSer
|
|||
throw new ServiceException("作业班成员不能为空");
|
||||
}
|
||||
|
||||
// 检查工作计划的审批状态,必须审批通过才能签发出入证
|
||||
com.admin.contractor.domain.WorkPlan workPlan = workPlanMapper.selectWorkPlanById(accessPermit.getProjectId());
|
||||
if (workPlan == null) {
|
||||
throw new ServiceException("关联的工作计划不存在");
|
||||
}
|
||||
if (!"1".equals(workPlan.getApprovalStatus())) {
|
||||
throw new ServiceException("工作计划审批未通过,无法签发出入证");
|
||||
}
|
||||
|
||||
// 处理车辆选择逻辑
|
||||
processVehicleSelection(accessPermit);
|
||||
|
||||
// 处理JSON字段
|
||||
processJsonFields(accessPermit);
|
||||
// 处理作业班成员用户ID
|
||||
|
|
@ -232,6 +256,105 @@ public class AccessPermitIssuanceServiceImpl implements IAccessPermitIssuanceSer
|
|||
return accessPermitMapper.updatePermitStatus(permitId, "2", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理车辆选择逻辑
|
||||
* 合并已添加的车辆和业主选择的车辆,更新 selected 状态
|
||||
*/
|
||||
private void processVehicleSelection(AccessPermit accessPermit) {
|
||||
if (accessPermit.getPermitId() != null) {
|
||||
// 如果出入证已存在,需要合并已添加的车辆和选中的车辆
|
||||
AccessPermit existingPermit = accessPermitMapper.selectAccessPermitById(accessPermit.getPermitId());
|
||||
if (existingPermit != null && StringUtils.isNotEmpty(existingPermit.getVehicleInfo())) {
|
||||
try {
|
||||
// 解析已存在的车辆列表
|
||||
List<VehicleInfo> existingVehicles = objectMapper.readValue(
|
||||
existingPermit.getVehicleInfo(),
|
||||
new TypeReference<List<VehicleInfo>>() {}
|
||||
);
|
||||
|
||||
// 获取业主选择的车辆列表
|
||||
List<VehicleInfo> selectedVehicles = accessPermit.getVehicleList();
|
||||
if (selectedVehicles == null) {
|
||||
selectedVehicles = new ArrayList<>();
|
||||
}
|
||||
|
||||
// 创建车牌号到选中状态的映射
|
||||
java.util.Map<String, Boolean> selectedMap = new java.util.HashMap<>();
|
||||
for (VehicleInfo vehicle : selectedVehicles) {
|
||||
if (vehicle.getLicensePlate() != null) {
|
||||
// 如果车辆有 selected 字段,使用它;否则默认为 true(业主选择的车辆)
|
||||
selectedMap.put(vehicle.getLicensePlate(),
|
||||
vehicle.getSelected() != null ? vehicle.getSelected() : true);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新已存在车辆的 selected 状态
|
||||
for (VehicleInfo existingVehicle : existingVehicles) {
|
||||
Boolean isSelected = selectedMap.get(existingVehicle.getLicensePlate());
|
||||
if (isSelected != null) {
|
||||
existingVehicle.setSelected(isSelected);
|
||||
} else {
|
||||
// 如果不在选中的列表中,保持原有状态或设为 false
|
||||
if (existingVehicle.getSelected() == null) {
|
||||
existingVehicle.setSelected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 添加新选择的车辆(不在已存在列表中的)
|
||||
for (VehicleInfo selectedVehicle : selectedVehicles) {
|
||||
if (selectedVehicle.getLicensePlate() != null) {
|
||||
boolean exists = existingVehicles.stream()
|
||||
.anyMatch(v -> selectedVehicle.getLicensePlate().equals(v.getLicensePlate()));
|
||||
if (!exists) {
|
||||
// 新车辆,确保 selected 为 true
|
||||
if (selectedVehicle.getSelected() == null) {
|
||||
selectedVehicle.setSelected(true);
|
||||
}
|
||||
existingVehicles.add(selectedVehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 签发出入证时,只保存选中的车辆(selected=true)
|
||||
List<VehicleInfo> finalVehicles = existingVehicles.stream()
|
||||
.filter(v -> Boolean.TRUE.equals(v.getSelected()))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
|
||||
accessPermit.setVehicleList(finalVehicles);
|
||||
} catch (Exception e) {
|
||||
// 如果解析失败,使用提交的车辆列表
|
||||
// 确保所有车辆 selected 为 true
|
||||
if (accessPermit.getVehicleList() != null) {
|
||||
for (VehicleInfo vehicle : accessPermit.getVehicleList()) {
|
||||
if (vehicle.getSelected() == null) {
|
||||
vehicle.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 出入证存在但没有车辆信息,使用提交的车辆列表
|
||||
if (accessPermit.getVehicleList() != null) {
|
||||
for (VehicleInfo vehicle : accessPermit.getVehicleList()) {
|
||||
if (vehicle.getSelected() == null) {
|
||||
vehicle.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 创建新出入证,使用提交的车辆列表,确保所有车辆 selected 为 true
|
||||
if (accessPermit.getVehicleList() != null) {
|
||||
for (VehicleInfo vehicle : accessPermit.getVehicleList()) {
|
||||
if (vehicle.getSelected() == null) {
|
||||
vehicle.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理JSON字段
|
||||
*/
|
||||
|
|
@ -334,4 +457,137 @@ public class AccessPermitIssuanceServiceImpl implements IAccessPermitIssuanceSer
|
|||
String dateStr = sdf.format(new Date());
|
||||
return "AC" + dateStr + System.currentTimeMillis() % 10000;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目已添加的车辆列表
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return 车辆列表(包含 selected 状态)
|
||||
*/
|
||||
@Override
|
||||
public List<VehicleInfo> getProjectVehicles(Long projectId) {
|
||||
if (projectId == null) {
|
||||
throw new ServiceException("项目ID不能为空");
|
||||
}
|
||||
|
||||
// 查询该项目的出入证(优先查询待审核状态的出入证)
|
||||
AccessPermit query = new AccessPermit();
|
||||
query.setProjectId(projectId);
|
||||
List<AccessPermit> permits = accessPermitMapper.selectAccessPermitList(query);
|
||||
|
||||
// 优先从待审核状态的出入证中获取车辆信息
|
||||
List<VehicleInfo> allVehicles = new ArrayList<>();
|
||||
java.util.Map<String, VehicleInfo> vehicleMap = new java.util.HashMap<>();
|
||||
|
||||
// 先处理待审核状态的出入证(这些包含所有已添加的车辆)
|
||||
for (AccessPermit permit : permits) {
|
||||
if ("0".equals(permit.getStatus()) && StringUtils.isNotEmpty(permit.getVehicleInfo())) {
|
||||
try {
|
||||
List<VehicleInfo> vehicles = objectMapper.readValue(
|
||||
permit.getVehicleInfo(),
|
||||
new TypeReference<List<VehicleInfo>>() {}
|
||||
);
|
||||
if (vehicles != null) {
|
||||
for (VehicleInfo vehicle : vehicles) {
|
||||
if (vehicle.getLicensePlate() != null) {
|
||||
// 如果车辆不存在,或者当前车辆的 selected 状态更明确,则更新
|
||||
if (!vehicleMap.containsKey(vehicle.getLicensePlate())) {
|
||||
// 确保 selected 字段有默认值
|
||||
if (vehicle.getSelected() == null) {
|
||||
vehicle.setSelected(false);
|
||||
}
|
||||
vehicleMap.put(vehicle.getLicensePlate(), vehicle);
|
||||
} else {
|
||||
// 如果已存在,保留 selected=true 的状态
|
||||
VehicleInfo existing = vehicleMap.get(vehicle.getLicensePlate());
|
||||
if (Boolean.TRUE.equals(vehicle.getSelected())) {
|
||||
existing.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 忽略解析错误
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果待审核状态的出入证中没有车辆,则从其他状态的出入证中获取
|
||||
if (vehicleMap.isEmpty()) {
|
||||
for (AccessPermit permit : permits) {
|
||||
if (StringUtils.isNotEmpty(permit.getVehicleInfo())) {
|
||||
try {
|
||||
List<VehicleInfo> vehicles = objectMapper.readValue(
|
||||
permit.getVehicleInfo(),
|
||||
new TypeReference<List<VehicleInfo>>() {}
|
||||
);
|
||||
if (vehicles != null) {
|
||||
for (VehicleInfo vehicle : vehicles) {
|
||||
if (vehicle.getLicensePlate() != null && !vehicleMap.containsKey(vehicle.getLicensePlate())) {
|
||||
// 已签发出入证中的车辆都是已选中的
|
||||
if (vehicle.getSelected() == null) {
|
||||
vehicle.setSelected(true);
|
||||
}
|
||||
vehicleMap.put(vehicle.getLicensePlate(), vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 忽略解析错误
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allVehicles.addAll(vehicleMap.values());
|
||||
return allVehicles;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询出入证已添加的车辆列表
|
||||
*
|
||||
* @param permitId 出入证ID
|
||||
* @return 车辆列表(包含 selected 状态)
|
||||
*/
|
||||
@Override
|
||||
public List<VehicleInfo> getPermitVehicles(Long permitId) {
|
||||
if (permitId == null) {
|
||||
throw new ServiceException("出入证ID不能为空");
|
||||
}
|
||||
|
||||
AccessPermit permit = accessPermitMapper.selectAccessPermitById(permitId);
|
||||
if (permit == null) {
|
||||
throw new ServiceException("出入证不存在");
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(permit.getVehicleInfo())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
try {
|
||||
List<VehicleInfo> vehicles = objectMapper.readValue(
|
||||
permit.getVehicleInfo(),
|
||||
new TypeReference<List<VehicleInfo>>() {}
|
||||
);
|
||||
|
||||
// 确保所有车辆都有 selected 字段
|
||||
if (vehicles != null) {
|
||||
for (VehicleInfo vehicle : vehicles) {
|
||||
if (vehicle.getSelected() == null) {
|
||||
// 如果出入证已签发,车辆都是已选中的;否则默认为未选中
|
||||
if ("1".equals(permit.getStatus())) {
|
||||
vehicle.setSelected(true);
|
||||
} else {
|
||||
vehicle.setSelected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vehicles != null ? vehicles : new ArrayList<>();
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("车辆信息格式错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ public class PcCameraAllocationController extends BaseController {
|
|||
|
||||
@Operation(summary = "项目分配详情(查看分配详情)")
|
||||
@PreAuthorize("@ss.hasPermi('property:camera:alloc:query')")
|
||||
@GetMapping("/listByProject/{projectId}")
|
||||
public AjaxResult listByProject(@PathVariable Long projectId) {
|
||||
List<PcCameraAlloc> list = bizService.selectAllocListByProjectId(projectId);
|
||||
@GetMapping("/listByProject/{applicationId}")
|
||||
public AjaxResult listByProject(@PathVariable Long applicationId) {
|
||||
List<PcCameraAlloc> list = bizService.selectAllocListByProjectId(applicationId);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ public class PcRiskProjectController extends BaseController {
|
|||
/** 查询球机申领详情 */
|
||||
@Operation(summary = "球机申领详情", description = "根据ID查询申领详情")
|
||||
@PreAuthorize("@ss.hasPermi('property:cameraApplication:query')")
|
||||
@GetMapping("/{projectId}")
|
||||
public AjaxResult getInfo(@PathVariable Long projectId) {
|
||||
return success(pcRiskProjectService.selectPcRiskProjectById(projectId));
|
||||
@GetMapping("/{applicationId}")
|
||||
public AjaxResult getInfo(@PathVariable Long applicationId) {
|
||||
return success(pcRiskProjectService.selectPcRiskProjectById(applicationId));
|
||||
}
|
||||
|
||||
/** 创建球机申领 */
|
||||
@Operation(summary = "创建球机申领", description = "根据工作票ID创建移动监控球机申领")
|
||||
@Operation(summary = "创建球机申领", description = "创建工作票时创建移动监控球机申领(工作票ID可选,需传入计划ID)")
|
||||
@PreAuthorize("@ss.hasPermi('property:cameraApplication:add')")
|
||||
@Log(title = "移动监控球机申领", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
|
|
@ -52,30 +52,34 @@ public class PcRiskProjectController extends BaseController {
|
|||
@Parameter(description = "申领数据")
|
||||
@RequestBody PcRiskProject project) {
|
||||
project.setCreateBy(getUsername());
|
||||
return toAjax(pcRiskProjectService.insertPcRiskProject(project));
|
||||
int rows = pcRiskProjectService.insertPcRiskProject(project);
|
||||
if (rows > 0) {
|
||||
return success(project.getApplicationId());
|
||||
}
|
||||
return error("创建球机申领失败");
|
||||
}
|
||||
|
||||
/** 修改球机申领 */
|
||||
@Operation(summary = "修改球机申领", description = "根据ID修改申领信息")
|
||||
@PreAuthorize("@ss.hasPermi('property:cameraApplication:edit')")
|
||||
@Log(title = "移动监控球机申领", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{projectId}")
|
||||
@PutMapping("/{applicationId}")
|
||||
public AjaxResult edit(
|
||||
@Parameter(description = "申领ID")
|
||||
@PathVariable Long projectId,
|
||||
@PathVariable Long applicationId,
|
||||
@Parameter(description = "修改后的申领数据")
|
||||
@RequestBody PcRiskProject project) {
|
||||
project.setUpdateBy(getUsername());
|
||||
return toAjax(pcRiskProjectService.updatePcRiskProject(projectId, project));
|
||||
return toAjax(pcRiskProjectService.updatePcRiskProject(applicationId, project));
|
||||
}
|
||||
|
||||
/** 删除球机申领 */
|
||||
@Operation(summary = "删除球机申领", description = "根据ID删除申领")
|
||||
@PreAuthorize("@ss.hasPermi('property:cameraApplication:remove')")
|
||||
@Log(title = "移动监控球机申领", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{projectIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] projectIds) {
|
||||
return toAjax(pcRiskProjectService.deletePcRiskProjectByIds(projectIds));
|
||||
@DeleteMapping("/{applicationIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] applicationIds) {
|
||||
return toAjax(pcRiskProjectService.deletePcRiskProjectByIds(applicationIds));
|
||||
}
|
||||
|
||||
/** 根据工作票ID获取工作计划信息(用于创建申领时预填充数据) */
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class ProjectCompletionReviewController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('property:project:onSiteReview')")
|
||||
@PutMapping("/onSiteReview")
|
||||
public AjaxResult onSiteReview(
|
||||
@RequestParam Long projectId,
|
||||
@RequestParam Long applicationId,
|
||||
@RequestParam String onSiteReviewStatus,
|
||||
@RequestParam String onSiteReviewImages,
|
||||
@RequestParam Integer workContentCompleteRate,
|
||||
|
|
@ -44,12 +44,12 @@ public class ProjectCompletionReviewController extends BaseController {
|
|||
@RequestParam String reviewComments) {
|
||||
|
||||
// 先检查监理复核状态,确保复核通过
|
||||
PcRiskProject project = pcRiskProjectService.selectPcRiskProjectById(projectId);
|
||||
PcRiskProject project = pcRiskProjectService.selectPcRiskProjectById(applicationId);
|
||||
if (project == null || !"复核通过".equals(project.getSupervisionReviewStatus())) {
|
||||
return AjaxResult.error("监理复核未通过,无法进行现场复核");
|
||||
}
|
||||
|
||||
return toAjax(pcRiskProjectService.onSiteReview(projectId, onSiteReviewStatus, onSiteReviewImages, workContentCompleteRate, siteCleaningCondition, reviewComments));
|
||||
return toAjax(pcRiskProjectService.onSiteReview(applicationId, onSiteReviewStatus, onSiteReviewImages, workContentCompleteRate, siteCleaningCondition, reviewComments));
|
||||
}
|
||||
|
||||
/** 最终审核提交 */
|
||||
|
|
@ -57,14 +57,14 @@ public class ProjectCompletionReviewController extends BaseController {
|
|||
@PreAuthorize("@ss.hasPermi('property:project:finalAudit')")
|
||||
@PutMapping("/finalAudit")
|
||||
public AjaxResult finalAudit(
|
||||
@RequestParam Long projectId) {
|
||||
@RequestParam Long applicationId) {
|
||||
|
||||
// 先检查现场复核是否已完成
|
||||
PcRiskProject project = pcRiskProjectService.selectPcRiskProjectById(projectId);
|
||||
PcRiskProject project = pcRiskProjectService.selectPcRiskProjectById(applicationId);
|
||||
if (project == null || !"已复核".equals(project.getOnSiteReviewStatus())) {
|
||||
return AjaxResult.error("现场复核未完成,无法进行最终审核");
|
||||
}
|
||||
|
||||
return toAjax(pcRiskProjectService.finalAudit(projectId));
|
||||
return toAjax(pcRiskProjectService.finalAudit(applicationId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ import java.util.Date;
|
|||
public class PcCameraAlloc extends BaseEntity {
|
||||
|
||||
private Long allocId;
|
||||
private Long projectId;
|
||||
@Schema(description = "球机申领单ID(关联 pc_risk_project.application_id)")
|
||||
private Long applicationId;
|
||||
private Long cameraId;
|
||||
|
||||
private Date allocTime;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ public class PcCameraReturn extends BaseEntity {
|
|||
@Schema(description = "分配记录ID")
|
||||
private Long allocId;
|
||||
|
||||
@Schema(description = "项目ID")
|
||||
private Long projectId;
|
||||
@Schema(description = "球机申领单ID(关联 pc_risk_project.application_id)")
|
||||
private Long applicationId;
|
||||
|
||||
@Schema(description = "球机ID")
|
||||
private Long cameraId;
|
||||
|
|
|
|||
|
|
@ -10,29 +10,8 @@ import lombok.EqualsAndHashCode;
|
|||
@Schema(description = "移动监控球机申领")
|
||||
public class PcRiskProject extends BaseEntity {
|
||||
|
||||
@Schema(description = "申领ID")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "项目名称(从工作计划获取)")
|
||||
private String projectName;
|
||||
|
||||
@Schema(description = "项目编号")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "施工单位")
|
||||
private String constructionUnit;
|
||||
|
||||
@Schema(description = "作业地点(从工作计划获取)")
|
||||
private String workLocation;
|
||||
|
||||
@Schema(description = "作业开始时间(从工作计划获取)")
|
||||
private String workStart;
|
||||
|
||||
@Schema(description = "作业结束时间(从工作计划获取)")
|
||||
private String workEnd;
|
||||
|
||||
@Schema(description = "风险类型(从工作票获取)")
|
||||
private String riskType;
|
||||
@Schema(description = "申领ID(球机申领单ID)")
|
||||
private Long applicationId;
|
||||
|
||||
@Schema(description = "申领数量(必填)")
|
||||
private Integer needCameraCnt;
|
||||
|
|
@ -49,8 +28,31 @@ public class PcRiskProject extends BaseEntity {
|
|||
@Schema(description = "关联工作票ID")
|
||||
private Long workTicketId;
|
||||
|
||||
@Schema(description = "关联工作计划ID")
|
||||
private Long planId;
|
||||
@Schema(description = "关联工作计划ID(关联 work_plan.project_id)")
|
||||
private Long projectId;
|
||||
|
||||
// ========== 以下字段通过关联查询获取,不映射到数据库 ==========
|
||||
|
||||
@Schema(description = "项目名称(从工作计划获取,不映射到数据库)")
|
||||
private String projectName;
|
||||
|
||||
@Schema(description = "项目编号(从工作计划获取,不映射到数据库)")
|
||||
private String projectCode;
|
||||
|
||||
@Schema(description = "施工单位(从工作计划获取,不映射到数据库)")
|
||||
private String constructionUnit;
|
||||
|
||||
@Schema(description = "作业地点(从工作计划获取,不映射到数据库)")
|
||||
private String workLocation;
|
||||
|
||||
@Schema(description = "作业开始时间(从工作计划获取,不映射到数据库)")
|
||||
private String workStart;
|
||||
|
||||
@Schema(description = "作业结束时间(从工作计划获取,不映射到数据库)")
|
||||
private String workEnd;
|
||||
|
||||
@Schema(description = "风险类型(从工作票获取,不映射到数据库)")
|
||||
private String riskType;
|
||||
|
||||
@Schema(description = "分配状态:0待分配,1已分配")
|
||||
private String allocStatus;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import java.util.List;
|
|||
@Schema(description = "确认分配球机请求")
|
||||
public class PcCameraAllocConfirmDTO {
|
||||
|
||||
@Schema(description = "项目ID")
|
||||
private Long projectId;
|
||||
@Schema(description = "球机申领单ID(关联 pc_risk_project.application_id)")
|
||||
private Long applicationId;
|
||||
|
||||
@Schema(description = "选中的球机ID列表")
|
||||
private List<Long> cameraIds;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import java.util.List;
|
|||
@Schema(description = "回收确认提交请求")
|
||||
public class PcCameraReturnSubmitDTO {
|
||||
|
||||
@Schema(description = "项目ID")
|
||||
private Long projectId;
|
||||
@Schema(description = "球机申领单ID(关联 pc_risk_project.application_id)")
|
||||
private Long applicationId;
|
||||
|
||||
@Schema(description = "回收球机ID列表")
|
||||
private List<Long> cameraIds;
|
||||
|
|
|
|||
|
|
@ -9,18 +9,18 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface PcCameraAllocMapper {
|
||||
|
||||
List<PcCameraAlloc> selectAllocListByProjectId(@Param("projectId") Long projectId);
|
||||
List<PcCameraAlloc> selectAllocListByProjectId(@Param("applicationId") Long applicationId);
|
||||
|
||||
/** 高风险项目分配页:项目列表(带过滤) */
|
||||
List<PcCameraAlloc> selectRiskProjectAllocList(PcCameraAlloc query);
|
||||
|
||||
int insertBatch(@Param("list") List<PcCameraAlloc> list);
|
||||
|
||||
int updateAllocStatusByProject(@Param("projectId") Long projectId, @Param("allocStatus") String allocStatus);
|
||||
int updateAllocStatusByProject(@Param("applicationId") Long applicationId, @Param("allocStatus") String allocStatus);
|
||||
|
||||
PcCameraAlloc selectActiveAlloc(@Param("projectId") Long projectId, @Param("cameraId") Long cameraId);
|
||||
PcCameraAlloc selectActiveAlloc(@Param("applicationId") Long applicationId, @Param("cameraId") Long cameraId);
|
||||
|
||||
List<PcCameraAlloc> selectAllocatedByProject(@Param("projectId") Long projectId);
|
||||
List<PcCameraAlloc> selectAllocatedByProject(@Param("applicationId") Long applicationId);
|
||||
|
||||
int updateAllocStatusByIds(@Param("allocIds") List<Long> allocIds, @Param("allocStatus") String allocStatus);
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface PcRiskProjectMapper {
|
||||
|
||||
PcRiskProject selectPcRiskProjectById(@Param("projectId") Long projectId);
|
||||
PcRiskProject selectPcRiskProjectById(@Param("applicationId") Long applicationId);
|
||||
|
||||
List<PcRiskProject> selectPcRiskProjectList(PcRiskProject query);
|
||||
|
||||
|
|
@ -17,9 +17,9 @@ public interface PcRiskProjectMapper {
|
|||
|
||||
int updatePcRiskProject(PcRiskProject entity);
|
||||
|
||||
int deletePcRiskProjectByIds(@Param("projectIds") Long[] projectIds);
|
||||
int deletePcRiskProjectByIds(@Param("applicationIds") Long[] applicationIds);
|
||||
|
||||
int updateAllocStatus(@Param("projectId") Long projectId,
|
||||
int updateAllocStatus(@Param("applicationId") Long applicationId,
|
||||
@Param("allocStatus") String allocStatus);
|
||||
|
||||
/** 完工复核管理列表 */
|
||||
|
|
@ -29,6 +29,10 @@ public interface PcRiskProjectMapper {
|
|||
int updateProjectStatus(PcRiskProject entity);
|
||||
|
||||
/** 仅更新监理复核状态(如果监理系统回写用得到,可选) */
|
||||
int updateSupervisionReviewStatus(@Param("projectId") Long projectId,
|
||||
int updateSupervisionReviewStatus(@Param("applicationId") Long applicationId,
|
||||
@Param("supervisionReviewStatus") String supervisionReviewStatus);
|
||||
|
||||
/** 更新工作票ID(工作票创建后绑定) */
|
||||
int updateWorkTicketId(@Param("applicationId") Long applicationId,
|
||||
@Param("workTicketId") Long workTicketId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public interface IPcCameraBizService {
|
|||
List<PcCameraLedger> selectAvailableCameras(PcCameraLedger query);
|
||||
|
||||
/** 项目分配详情 */
|
||||
List<PcCameraAlloc> selectAllocListByProjectId(Long projectId);
|
||||
List<PcCameraAlloc> selectAllocListByProjectId(Long applicationId);
|
||||
|
||||
/** 确认分配(项目 -> 多台球机) */
|
||||
int confirmAllocate(PcCameraAllocConfirmDTO dto);
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@ import java.util.List;
|
|||
|
||||
public interface IPcRiskProjectService {
|
||||
|
||||
PcRiskProject selectPcRiskProjectById(Long projectId);
|
||||
PcRiskProject selectPcRiskProjectById(Long applicationId);
|
||||
|
||||
List<PcRiskProject> selectPcRiskProjectList(PcRiskProject project);
|
||||
|
||||
int insertPcRiskProject(PcRiskProject project);
|
||||
|
||||
int updatePcRiskProject(Long projectId, PcRiskProject project);
|
||||
int updatePcRiskProject(Long applicationId, PcRiskProject project);
|
||||
|
||||
int deletePcRiskProjectByIds(Long[] projectIds);
|
||||
int deletePcRiskProjectByIds(Long[] applicationIds);
|
||||
|
||||
/**
|
||||
* 根据工作票ID获取工作计划信息(用于创建申领时预填充数据)
|
||||
|
|
@ -26,13 +26,21 @@ public interface IPcRiskProjectService {
|
|||
|
||||
public List<PcRiskProject> selectProjectCompletionReviewList(PcRiskProject pcRiskProject);
|
||||
|
||||
public int onSiteReview( Long projectId,
|
||||
public int onSiteReview( Long applicationId,
|
||||
String onSiteReviewStatus,
|
||||
String onSiteReviewImages,
|
||||
Integer workContentCompleteRate,
|
||||
String siteCleaningCondition,
|
||||
String reviewComments);
|
||||
|
||||
public int finalAudit(Long projectId);
|
||||
public int finalAudit(Long applicationId);
|
||||
|
||||
/**
|
||||
* 更新工作票ID(工作票创建后绑定)
|
||||
* @param applicationId 球机申领单ID
|
||||
* @param workTicketId 工作票ID
|
||||
* @return 结果
|
||||
*/
|
||||
int updateWorkTicketId(Long applicationId, Long workTicketId);
|
||||
|
||||
}
|
||||
|
|
@ -44,18 +44,18 @@ public class PcCameraBizServiceImpl implements IPcCameraBizService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<PcCameraAlloc> selectAllocListByProjectId(Long projectId) {
|
||||
return allocMapper.selectAllocListByProjectId(projectId);
|
||||
public List<PcCameraAlloc> selectAllocListByProjectId(Long applicationId) {
|
||||
return allocMapper.selectAllocListByProjectId(applicationId);
|
||||
}
|
||||
|
||||
/** ① 确认分配 */
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int confirmAllocate(PcCameraAllocConfirmDTO dto) {
|
||||
if (dto.getProjectId() == null) throw new ServiceException("projectId不能为空");
|
||||
if (dto.getApplicationId() == null) throw new ServiceException("applicationId不能为空");
|
||||
if (dto.getCameraIds() == null || dto.getCameraIds().isEmpty()) throw new ServiceException("cameraIds不能为空");
|
||||
|
||||
PcRiskProject project = projectMapper.selectPcRiskProjectById(dto.getProjectId());
|
||||
PcRiskProject project = projectMapper.selectPcRiskProjectById(dto.getApplicationId());
|
||||
if (project == null) throw new ServiceException("项目不存在或已删除");
|
||||
|
||||
Date allocTime = dto.getAllocTime() != null ? dto.getAllocTime() : new Date();
|
||||
|
|
@ -86,11 +86,11 @@ public class PcCameraBizServiceImpl implements IPcCameraBizService {
|
|||
List<PcCameraAlloc> inserts = new ArrayList<>();
|
||||
for (Long cameraId : cameraIds) {
|
||||
// 防重复(同项目同球机唯一键也能兜底)
|
||||
PcCameraAlloc exists = allocMapper.selectActiveAlloc(dto.getProjectId(), cameraId);
|
||||
PcCameraAlloc exists = allocMapper.selectActiveAlloc(dto.getApplicationId(), cameraId);
|
||||
if (exists != null) throw new ServiceException("重复分配:项目已存在该球机记录,cameraId=" + cameraId);
|
||||
|
||||
PcCameraAlloc a = new PcCameraAlloc();
|
||||
a.setProjectId(dto.getProjectId());
|
||||
a.setApplicationId(dto.getApplicationId());
|
||||
a.setCameraId(cameraId);
|
||||
a.setAllocTime(allocTime);
|
||||
a.setAllocBy(allocBy);
|
||||
|
|
@ -103,12 +103,12 @@ public class PcCameraBizServiceImpl implements IPcCameraBizService {
|
|||
int rows = allocMapper.insertBatch(inserts);
|
||||
|
||||
// 如果已满足需分配数量,则项目状态置为已分配(你也可以改成“分配中/部分分配”)
|
||||
int allocatedCount = allocMapper.selectAllocatedByProject(dto.getProjectId()).size();
|
||||
int allocatedCount = allocMapper.selectAllocatedByProject(dto.getApplicationId()).size();
|
||||
int need = project.getNeedCameraCnt() == null ? 0 : project.getNeedCameraCnt();
|
||||
if (need > 0 && allocatedCount >= need) {
|
||||
projectMapper.updateAllocStatus(dto.getProjectId(), "1");
|
||||
projectMapper.updateAllocStatus(dto.getApplicationId(), "1");
|
||||
} else {
|
||||
projectMapper.updateAllocStatus(dto.getProjectId(), "0");
|
||||
projectMapper.updateAllocStatus(dto.getApplicationId(), "0");
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ public class PcCameraBizServiceImpl implements IPcCameraBizService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int submitReturn(PcCameraReturnSubmitDTO dto) {
|
||||
if (dto.getProjectId() == null) throw new ServiceException("projectId不能为空");
|
||||
if (dto.getApplicationId() == null) throw new ServiceException("applicationId不能为空");
|
||||
if (dto.getCameraIds() == null || dto.getCameraIds().isEmpty()) throw new ServiceException("cameraIds不能为空");
|
||||
if (dto.getAppearanceIntegrity() == null || dto.getAppearanceIntegrity().isEmpty()) throw new ServiceException("appearanceIntegrity不能为空");
|
||||
if (dto.getFunctionalTestResult() == null || dto.getFunctionalTestResult().isEmpty()) throw new ServiceException("functionalTestResult不能为空");
|
||||
|
|
@ -141,7 +141,7 @@ public class PcCameraBizServiceImpl implements IPcCameraBizService {
|
|||
List<Long> cameraIds = dto.getCameraIds().stream().distinct().collect(Collectors.toList());
|
||||
|
||||
// 找到对应的 alloc 记录(必须是已分配状态)
|
||||
List<PcCameraAlloc> allocated = allocMapper.selectAllocatedByProject(dto.getProjectId());
|
||||
List<PcCameraAlloc> allocated = allocMapper.selectAllocatedByProject(dto.getApplicationId());
|
||||
Map<Long, PcCameraAlloc> allocByCamera = allocated.stream()
|
||||
.collect(Collectors.toMap(PcCameraAlloc::getCameraId, x -> x, (a,b)->a));
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ public class PcCameraBizServiceImpl implements IPcCameraBizService {
|
|||
PcCameraAlloc a = allocByCamera.get(cameraId);
|
||||
PcCameraReturn r = new PcCameraReturn();
|
||||
r.setAllocId(a.getAllocId());
|
||||
r.setProjectId(dto.getProjectId());
|
||||
r.setApplicationId(dto.getApplicationId());
|
||||
r.setCameraId(cameraId);
|
||||
r.setAppearanceIntegrity(dto.getAppearanceIntegrity());
|
||||
r.setFunctionalTestResult(dto.getFunctionalTestResult());
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.admin.property.mapper.PcRiskProjectMapper;
|
|||
import com.admin.property.service.IPcRiskProjectService;
|
||||
import com.admin.contractor.domain.WorkTicket;
|
||||
import com.admin.contractor.domain.WorkPlan;
|
||||
import com.admin.contractor.service.IWorkTicketService;
|
||||
import com.admin.contractor.mapper.WorkTicketMapper;
|
||||
import com.admin.contractor.service.IWorkPlanService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -23,7 +23,7 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
private final PcRiskProjectMapper pcRiskProjectMapper;
|
||||
|
||||
@Autowired
|
||||
private IWorkTicketService workTicketService;
|
||||
private WorkTicketMapper workTicketMapper;
|
||||
|
||||
@Autowired
|
||||
private IWorkPlanService workPlanService;
|
||||
|
|
@ -33,8 +33,8 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PcRiskProject selectPcRiskProjectById(Long projectId) {
|
||||
return pcRiskProjectMapper.selectPcRiskProjectById(projectId);
|
||||
public PcRiskProject selectPcRiskProjectById(Long applicationId) {
|
||||
return pcRiskProjectMapper.selectPcRiskProjectById(applicationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -46,9 +46,6 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
@Transactional
|
||||
public int insertPcRiskProject(PcRiskProject project) {
|
||||
// 验证必填字段
|
||||
if (project.getWorkTicketId() == null) {
|
||||
throw new ServiceException("工作票ID不能为空");
|
||||
}
|
||||
if (project.getNeedCameraCnt() == null || project.getNeedCameraCnt() <= 0) {
|
||||
throw new ServiceException("申领数量必须大于0");
|
||||
}
|
||||
|
|
@ -62,8 +59,9 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
throw new ServiceException("联系方式不能为空");
|
||||
}
|
||||
|
||||
// 根据工作票ID获取工作票信息
|
||||
WorkTicket workTicket = workTicketService.selectWorkTicketById(project.getWorkTicketId());
|
||||
// 如果传入了工作票ID,验证工作票信息
|
||||
if (project.getWorkTicketId() != null) {
|
||||
WorkTicket workTicket = workTicketMapper.selectWorkTicketById(project.getWorkTicketId());
|
||||
if (workTicket == null) {
|
||||
throw new ServiceException("工作票不存在");
|
||||
}
|
||||
|
|
@ -84,16 +82,18 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
if (workPlan == null) {
|
||||
throw new ServiceException("工作计划不存在");
|
||||
}
|
||||
|
||||
// 从工作计划填充数据
|
||||
project.setPlanId(workPlan.getProjectId());
|
||||
project.setProjectName(workPlan.getProjectName());
|
||||
project.setProjectCode(workPlan.getProjectCode());
|
||||
project.setConstructionUnit(workPlan.getConstructionUnitName());
|
||||
project.setWorkLocation(workPlan.getWorkLocation());
|
||||
project.setWorkStart(workPlan.getWorkStartTime());
|
||||
project.setWorkEnd(workPlan.getWorkEndTime());
|
||||
project.setRiskType(workTicket.getRiskType());
|
||||
project.setProjectId(workPlan.getProjectId());
|
||||
} else {
|
||||
// 如果没有工作票ID,必须传入 projectId
|
||||
if (project.getProjectId() == null) {
|
||||
throw new ServiceException("工作计划ID不能为空(工作票未创建时需要传入)");
|
||||
}
|
||||
// 验证工作计划是否存在
|
||||
WorkPlan workPlan = workPlanService.selectWorkPlanById(project.getProjectId());
|
||||
if (workPlan == null) {
|
||||
throw new ServiceException("工作计划不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 设置默认状态
|
||||
if (StringUtils.isEmpty(project.getAllocStatus())) {
|
||||
|
|
@ -105,15 +105,15 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updatePcRiskProject(Long projectId, PcRiskProject project) {
|
||||
project.setProjectId(projectId);
|
||||
public int updatePcRiskProject(Long applicationId, PcRiskProject project) {
|
||||
project.setApplicationId(applicationId);
|
||||
return pcRiskProjectMapper.updatePcRiskProject(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int deletePcRiskProjectByIds(Long[] projectIds) {
|
||||
return pcRiskProjectMapper.deletePcRiskProjectByIds(projectIds);
|
||||
public int deletePcRiskProjectByIds(Long[] applicationIds) {
|
||||
return pcRiskProjectMapper.deletePcRiskProjectByIds(applicationIds);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -124,14 +124,14 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int onSiteReview(Long projectId,
|
||||
public int onSiteReview(Long applicationId,
|
||||
String onSiteReviewStatus,
|
||||
String onSiteReviewImages,
|
||||
Integer workContentCompleteRate,
|
||||
String siteCleaningCondition,
|
||||
String reviewComments) {
|
||||
// 查询项目
|
||||
PcRiskProject project = pcRiskProjectMapper.selectPcRiskProjectById(projectId);
|
||||
PcRiskProject project = pcRiskProjectMapper.selectPcRiskProjectById(applicationId);
|
||||
if (project == null) {
|
||||
throw new ServiceException("项目不存在");
|
||||
}
|
||||
|
|
@ -161,8 +161,8 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int finalAudit(Long projectId) {
|
||||
PcRiskProject project = pcRiskProjectMapper.selectPcRiskProjectById(projectId);
|
||||
public int finalAudit(Long applicationId) {
|
||||
PcRiskProject project = pcRiskProjectMapper.selectPcRiskProjectById(applicationId);
|
||||
if (project == null || !"已复核".equals(project.getOnSiteReviewStatus())) {
|
||||
throw new ServiceException("现场复核未完成,无法进行最终审核");
|
||||
}
|
||||
|
|
@ -178,8 +178,8 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
|
||||
@Override
|
||||
public PcRiskProject getWorkPlanInfoByTicketId(Long ticketId) {
|
||||
// 根据工作票ID获取工作票信息
|
||||
WorkTicket workTicket = workTicketService.selectWorkTicketById(ticketId);
|
||||
// 根据工作票ID获取工作票信息(直接使用 Mapper,避免循环依赖)
|
||||
WorkTicket workTicket = workTicketMapper.selectWorkTicketById(ticketId);
|
||||
if (workTicket == null) {
|
||||
throw new ServiceException("工作票不存在");
|
||||
}
|
||||
|
|
@ -201,10 +201,11 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
throw new ServiceException("工作计划不存在");
|
||||
}
|
||||
|
||||
// 构建返回对象,包含从工作计划获取的信息
|
||||
// 构建返回对象,包含从工作计划获取的信息(用于前端预填充)
|
||||
PcRiskProject result = new PcRiskProject();
|
||||
result.setWorkTicketId(ticketId);
|
||||
result.setPlanId(workPlan.getProjectId());
|
||||
result.setProjectId(workPlan.getProjectId());
|
||||
// 以下字段用于前端预填充,实际保存时不会存储到数据库
|
||||
result.setProjectName(workPlan.getProjectName());
|
||||
result.setProjectCode(workPlan.getProjectCode());
|
||||
result.setConstructionUnit(workPlan.getConstructionUnitName());
|
||||
|
|
@ -213,22 +214,41 @@ public class PcRiskProjectServiceImpl implements IPcRiskProjectService {
|
|||
result.setWorkEnd(workPlan.getWorkEndTime());
|
||||
result.setRiskType(workTicket.getRiskType());
|
||||
|
||||
// 格式化作业周期(用于前端显示)
|
||||
if (StringUtils.isNotEmpty(workPlan.getWorkStartTime()) &&
|
||||
StringUtils.isNotEmpty(workPlan.getWorkEndTime())) {
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat displaySdf = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
Date startDate = sdf.parse(workPlan.getWorkStartTime());
|
||||
Date endDate = sdf.parse(workPlan.getWorkEndTime());
|
||||
String workPeriod = displaySdf.format(startDate) + " - " + displaySdf.format(endDate);
|
||||
// 可以将格式化后的周期存储在备注或其他字段中,或者前端自己格式化
|
||||
} catch (Exception e) {
|
||||
// 解析失败时使用原始值
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateWorkTicketId(Long applicationId, Long workTicketId) {
|
||||
// 验证球机申请单是否存在
|
||||
PcRiskProject project = pcRiskProjectMapper.selectPcRiskProjectById(applicationId);
|
||||
if (project == null) {
|
||||
throw new ServiceException("球机申请单不存在");
|
||||
}
|
||||
|
||||
// 验证工作票是否存在(直接使用 Mapper,避免循环依赖)
|
||||
WorkTicket workTicket = workTicketMapper.selectWorkTicketById(workTicketId);
|
||||
if (workTicket == null) {
|
||||
throw new ServiceException("工作票不存在");
|
||||
}
|
||||
|
||||
// 验证工作票是否需要申领球机
|
||||
if (!"1".equals(workTicket.getNeedMonitoringCamera())) {
|
||||
throw new ServiceException("该工作票不需要申领移动监控球机");
|
||||
}
|
||||
|
||||
// 验证是否为高风险作业项
|
||||
if (StringUtils.isEmpty(workTicket.getRiskType()) ||
|
||||
(!workTicket.getRiskType().contains("高等风险") && !workTicket.getRiskType().contains("危险"))) {
|
||||
throw new ServiceException("只有涉及高风险作业项的工作票才能绑定球机申领");
|
||||
}
|
||||
|
||||
// 验证工作计划是否匹配
|
||||
if (project.getProjectId() != null && !project.getProjectId().equals(workTicket.getProjectId())) {
|
||||
throw new ServiceException("工作票所属项目与球机申请单关联的项目不匹配");
|
||||
}
|
||||
|
||||
return pcRiskProjectMapper.updateWorkTicketId(applicationId, workTicketId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<!-- 分配详情:按项目查 -->
|
||||
<select id="selectAllocListByProjectId" resultType="com.admin.property.domain.PcCameraAlloc">
|
||||
select a.alloc_id as allocId,
|
||||
a.project_id as projectId,
|
||||
a.application_id as applicationId,
|
||||
a.camera_id as cameraId,
|
||||
a.alloc_time as allocTime,
|
||||
a.alloc_by as allocBy,
|
||||
|
|
@ -18,14 +18,14 @@
|
|||
from pc_camera_alloc a
|
||||
left join pc_camera_ledger l on l.camera_id = a.camera_id and l.del_flag='0'
|
||||
where a.del_flag='0'
|
||||
and a.project_id = #{projectId}
|
||||
and a.application_id = #{applicationId}
|
||||
order by a.alloc_id desc
|
||||
</select>
|
||||
|
||||
<!-- 分配页:高风险项目列表(项目维度展示 + 需要字段) -->
|
||||
<select id="selectRiskProjectAllocList" resultType="com.admin.property.domain.PcCameraAlloc">
|
||||
select
|
||||
p.project_id as projectId,
|
||||
p.application_id as applicationId,
|
||||
p.project_name as projectName,
|
||||
p.construction_unit as constructionUnit,
|
||||
p.work_location as workLocation,
|
||||
|
|
@ -46,27 +46,27 @@
|
|||
<if test="allocStatus != null and allocStatus != ''">
|
||||
and p.alloc_status = #{allocStatus}
|
||||
</if>
|
||||
order by p.project_id desc
|
||||
order by p.application_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertBatch">
|
||||
insert into pc_camera_alloc(project_id, camera_id, alloc_time, alloc_by, alloc_note, alloc_status, del_flag, create_by, create_time, update_by, update_time)
|
||||
insert into pc_camera_alloc(application_id, camera_id, alloc_time, alloc_by, alloc_note, alloc_status, del_flag, create_by, create_time, update_by, update_time)
|
||||
values
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.projectId}, #{it.cameraId}, #{it.allocTime}, #{it.allocBy}, #{it.allocNote}, #{it.allocStatus}, '0', #{it.createBy}, now(), #{it.updateBy}, now())
|
||||
(#{it.applicationId}, #{it.cameraId}, #{it.allocTime}, #{it.allocBy}, #{it.allocNote}, #{it.allocStatus}, '0', #{it.createBy}, now(), #{it.updateBy}, now())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateAllocStatusByProject">
|
||||
update pc_camera_alloc
|
||||
set alloc_status=#{allocStatus}, update_time=now()
|
||||
where del_flag='0' and project_id=#{projectId}
|
||||
where del_flag='0' and application_id=#{applicationId}
|
||||
</update>
|
||||
|
||||
<select id="selectActiveAlloc" resultType="com.admin.property.domain.PcCameraAlloc">
|
||||
select alloc_id as allocId, project_id as projectId, camera_id as cameraId, alloc_status as allocStatus
|
||||
from pc_camera_alloc
|
||||
where del_flag='0' and project_id=#{projectId} and camera_id=#{cameraId}
|
||||
where del_flag='0' and application_id=#{applicationId} and camera_id=#{cameraId}
|
||||
order by alloc_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
<select id="selectAllocatedByProject" resultType="com.admin.property.domain.PcCameraAlloc">
|
||||
select alloc_id as allocId, project_id as projectId, camera_id as cameraId
|
||||
from pc_camera_alloc
|
||||
where del_flag='0' and project_id=#{projectId} and alloc_status='1'
|
||||
where del_flag='0' and application_id=#{applicationId} and alloc_status='1'
|
||||
</select>
|
||||
|
||||
<update id="updateAllocStatusByIds">
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
select
|
||||
null as returnId,
|
||||
null as allocId,
|
||||
a.project_id as projectId,
|
||||
a.application_id as applicationId,
|
||||
null as cameraId,
|
||||
null as appearanceIntegrity,
|
||||
null as functionalTestResult,
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
p.work_location as workLocation
|
||||
from pc_camera_alloc a
|
||||
left join pc_camera_ledger l on l.camera_id = a.camera_id and l.del_flag='0'
|
||||
left join pc_risk_project p on p.project_id = a.project_id and p.del_flag='0'
|
||||
left join pc_risk_project p on p.application_id = a.application_id and p.del_flag='0'
|
||||
where a.del_flag='0'
|
||||
and a.alloc_status='1'
|
||||
and l.status='1'
|
||||
|
|
@ -51,14 +51,14 @@
|
|||
<if test="workLocation != null and workLocation != ''">
|
||||
and p.work_location like concat('%', #{workLocation}, '%')
|
||||
</if>
|
||||
group by a.project_id, p.project_name, p.construction_unit, p.work_location
|
||||
order by MAX(a.alloc_time) desc, a.project_id desc
|
||||
group by a.application_id, p.project_name, p.construction_unit, p.work_location
|
||||
order by MAX(a.alloc_time) desc, a.application_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectAuditPendingList" resultType="com.admin.property.domain.PcCameraReturn">
|
||||
select r.return_id as returnId,
|
||||
r.alloc_id as allocId,
|
||||
r.project_id as projectId,
|
||||
r.application_id as applicationId,
|
||||
r.camera_id as cameraId,
|
||||
r.appearance_integrity as appearanceIntegrity,
|
||||
r.functional_test_result as functionalTestResult,
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
p.work_location as workLocation
|
||||
from pc_camera_return r
|
||||
left join pc_camera_ledger l on l.camera_id=r.camera_id and l.del_flag='0'
|
||||
left join pc_risk_project p on p.project_id=r.project_id and p.del_flag='0'
|
||||
left join pc_risk_project p on p.application_id=r.application_id and p.del_flag='0'
|
||||
where r.del_flag='0' and r.audit_status='0'
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and p.project_name like concat('%', #{projectName}, '%')
|
||||
|
|
@ -87,11 +87,11 @@
|
|||
|
||||
<insert id="insertBatch">
|
||||
insert into pc_camera_return(
|
||||
alloc_id, project_id, camera_id, appearance_integrity, functional_test_result, return_by, return_time, photo_urls, remark,
|
||||
alloc_id, application_id, camera_id, appearance_integrity, functional_test_result, return_by, return_time, photo_urls, remark,
|
||||
audit_status, del_flag, create_by, create_time, update_by, update_time
|
||||
) values
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.allocId}, #{it.projectId}, #{it.cameraId}, #{it.appearanceIntegrity}, #{it.functionalTestResult}, #{it.returnBy}, #{it.returnTime},
|
||||
(#{it.allocId}, #{it.applicationId}, #{it.cameraId}, #{it.appearanceIntegrity}, #{it.functionalTestResult}, #{it.returnBy}, #{it.returnTime},
|
||||
#{it.photoUrls}, #{it.remark}, #{it.auditStatus}, '0', #{it.createBy}, now(), #{it.updateBy}, now())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
select
|
||||
r.return_id as returnId,
|
||||
r.alloc_id as allocId,
|
||||
r.project_id as projectId,
|
||||
r.application_id as applicationId,
|
||||
r.camera_id as cameraId,
|
||||
r.appearance_integrity as appearanceIntegrity,
|
||||
r.functional_test_result as functionalTestResult,
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
select
|
||||
r.return_id as returnId,
|
||||
r.alloc_id as allocId,
|
||||
r.project_id as projectId,
|
||||
r.application_id as applicationId,
|
||||
r.camera_id as cameraId,
|
||||
r.appearance_integrity as appearanceIntegrity,
|
||||
r.functional_test_result as functionalTestResult,
|
||||
|
|
|
|||
|
|
@ -6,14 +6,7 @@
|
|||
|
||||
<!-- ✅ 补全复核/审核字段映射(不然业务判断会拿到null) -->
|
||||
<resultMap id="PcRiskProjectMap" type="com.admin.property.domain.PcRiskProject">
|
||||
<id property="projectId" column="project_id"/>
|
||||
<result property="projectName" column="project_name"/>
|
||||
<result property="projectCode" column="project_code"/>
|
||||
<result property="constructionUnit" column="construction_unit"/>
|
||||
<result property="workLocation" column="work_location"/>
|
||||
<result property="workStart" column="work_start"/>
|
||||
<result property="workEnd" column="work_end"/>
|
||||
<result property="riskType" column="risk_type"/>
|
||||
<id property="applicationId" column="application_id"/>
|
||||
<result property="needCameraCnt" column="need_camera_cnt"/>
|
||||
<result property="allocStatus" column="alloc_status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
|
|
@ -23,12 +16,21 @@
|
|||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
|
||||
<!-- 球机申领相关字段 -->
|
||||
<!-- 球机申领核心字段 -->
|
||||
<result property="installationLocation" column="installation_location"/>
|
||||
<result property="contactPerson" column="contact_person"/>
|
||||
<result property="contactPhone" column="contact_phone"/>
|
||||
<result property="workTicketId" column="work_ticket_id"/>
|
||||
<result property="planId" column="project_id"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
|
||||
<!-- 关联查询字段(从 work_plan 和 work_ticket 获取,不映射到数据库) -->
|
||||
<result property="projectName" column="project_name"/>
|
||||
<result property="projectCode" column="project_code"/>
|
||||
<result property="constructionUnit" column="construction_unit"/>
|
||||
<result property="workLocation" column="work_location"/>
|
||||
<result property="workStart" column="work_start"/>
|
||||
<result property="workEnd" column="work_end"/>
|
||||
<result property="riskType" column="risk_type"/>
|
||||
|
||||
<!-- 复核/审核/归档字段 -->
|
||||
<result property="supervisionReviewStatus" column="supervision_review_status"/>
|
||||
|
|
@ -44,57 +46,134 @@
|
|||
<!-- ===================== 基础CRUD ===================== -->
|
||||
|
||||
<select id="selectPcRiskProjectById" resultMap="PcRiskProjectMap">
|
||||
select * from pc_risk_project
|
||||
where project_id = #{projectId} and del_flag = '0'
|
||||
select
|
||||
r.application_id,
|
||||
r.need_camera_cnt,
|
||||
r.installation_location,
|
||||
r.contact_person,
|
||||
r.contact_phone,
|
||||
r.work_ticket_id,
|
||||
r.project_id,
|
||||
r.alloc_status,
|
||||
r.del_flag,
|
||||
r.remark,
|
||||
r.create_by,
|
||||
r.create_time,
|
||||
r.update_by,
|
||||
r.update_time,
|
||||
r.supervision_review_status,
|
||||
r.on_site_review_status,
|
||||
r.final_audit_status,
|
||||
r.project_status,
|
||||
r.on_site_review_images,
|
||||
r.work_content_complete_rate,
|
||||
r.site_cleaning_condition,
|
||||
r.review_comments,
|
||||
-- 从工作计划关联查询
|
||||
wp.project_name,
|
||||
wp.project_code,
|
||||
wp.construction_unit_name as construction_unit,
|
||||
wp.work_location,
|
||||
wp.work_start_time as work_start,
|
||||
wp.work_end_time as work_end,
|
||||
-- 从工作票关联查询
|
||||
wt.risk_type
|
||||
from pc_risk_project r
|
||||
left join work_plan wp on wp.project_id = r.project_id and wp.del_flag = '0'
|
||||
left join work_ticket wt on wt.ticket_id = r.work_ticket_id and wt.del_flag = '0'
|
||||
where r.application_id = #{applicationId} and r.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectPcRiskProjectList" resultMap="PcRiskProjectMap">
|
||||
select * from pc_risk_project
|
||||
where del_flag = '0'
|
||||
select
|
||||
r.application_id,
|
||||
r.need_camera_cnt,
|
||||
r.installation_location,
|
||||
r.contact_person,
|
||||
r.contact_phone,
|
||||
r.work_ticket_id,
|
||||
r.project_id,
|
||||
r.alloc_status,
|
||||
r.del_flag,
|
||||
r.remark,
|
||||
r.create_by,
|
||||
r.create_time,
|
||||
r.update_by,
|
||||
r.update_time,
|
||||
r.supervision_review_status,
|
||||
r.on_site_review_status,
|
||||
r.final_audit_status,
|
||||
r.project_status,
|
||||
r.on_site_review_images,
|
||||
r.work_content_complete_rate,
|
||||
r.site_cleaning_condition,
|
||||
r.review_comments,
|
||||
-- 从工作计划关联查询
|
||||
wp.project_name,
|
||||
wp.project_code,
|
||||
wp.construction_unit_name as construction_unit,
|
||||
wp.work_location,
|
||||
wp.work_start_time as work_start,
|
||||
wp.work_end_time as work_end,
|
||||
-- 从工作票关联查询
|
||||
wt.risk_type
|
||||
from pc_risk_project r
|
||||
left join work_plan wp on wp.project_id = r.project_id and wp.del_flag = '0'
|
||||
left join work_ticket wt on wt.ticket_id = r.work_ticket_id and wt.del_flag = '0'
|
||||
where r.del_flag = '0'
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and project_name like concat('%', #{projectName}, '%')
|
||||
and wp.project_name like concat('%', #{projectName}, '%')
|
||||
</if>
|
||||
<if test="projectCode != null and projectCode != ''">
|
||||
and project_code like concat('%', #{projectCode}, '%')
|
||||
and wp.project_code like concat('%', #{projectCode}, '%')
|
||||
</if>
|
||||
<if test="constructionUnit != null and constructionUnit != ''">
|
||||
and construction_unit like concat('%', #{constructionUnit}, '%')
|
||||
and wp.construction_unit_name like concat('%', #{constructionUnit}, '%')
|
||||
</if>
|
||||
<if test="workLocation != null and workLocation != ''">
|
||||
and work_location like concat('%', #{workLocation}, '%')
|
||||
and wp.work_location like concat('%', #{workLocation}, '%')
|
||||
</if>
|
||||
<if test="allocStatus != null and allocStatus != ''">
|
||||
and alloc_status = #{allocStatus}
|
||||
and r.alloc_status = #{allocStatus}
|
||||
</if>
|
||||
order by project_id desc
|
||||
order by r.application_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPcRiskProject" useGeneratedKeys="true" keyProperty="projectId">
|
||||
<insert id="insertPcRiskProject" useGeneratedKeys="true" keyProperty="applicationId">
|
||||
insert into pc_risk_project(
|
||||
project_name, project_code, construction_unit, work_location,
|
||||
work_start, work_end, risk_type, need_camera_cnt, alloc_status,
|
||||
installation_location, contact_person, contact_phone,
|
||||
work_ticket_id, project_id,
|
||||
remark, del_flag, create_by, create_time, update_by, update_time
|
||||
need_camera_cnt,
|
||||
installation_location,
|
||||
contact_person,
|
||||
contact_phone,
|
||||
work_ticket_id,
|
||||
project_id,
|
||||
alloc_status,
|
||||
remark,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
) values (
|
||||
#{projectName}, #{projectCode}, #{constructionUnit}, #{workLocation},
|
||||
#{workStart}, #{workEnd}, #{riskType}, #{needCameraCnt}, #{allocStatus},
|
||||
#{installationLocation}, #{contactPerson}, #{contactPhone},
|
||||
#{workTicketId}, #{planId},
|
||||
#{remark}, '0', #{createBy}, now(), #{updateBy}, now()
|
||||
#{needCameraCnt},
|
||||
#{installationLocation},
|
||||
#{contactPerson},
|
||||
#{contactPhone},
|
||||
#{workTicketId},
|
||||
#{projectId},
|
||||
#{allocStatus},
|
||||
#{remark},
|
||||
'0',
|
||||
#{createBy},
|
||||
now(),
|
||||
#{updateBy},
|
||||
now()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePcRiskProject">
|
||||
update pc_risk_project
|
||||
set project_name=#{projectName},
|
||||
project_code=#{projectCode},
|
||||
construction_unit=#{constructionUnit},
|
||||
work_location=#{workLocation},
|
||||
work_start=#{workStart},
|
||||
work_end=#{workEnd},
|
||||
risk_type=#{riskType},
|
||||
need_camera_cnt=#{needCameraCnt},
|
||||
set need_camera_cnt=#{needCameraCnt},
|
||||
alloc_status=#{allocStatus},
|
||||
installation_location=#{installationLocation},
|
||||
contact_person=#{contactPerson},
|
||||
|
|
@ -102,15 +181,15 @@
|
|||
remark=#{remark},
|
||||
update_by=#{updateBy},
|
||||
update_time=now()
|
||||
where project_id=#{projectId} and del_flag='0'
|
||||
where application_id=#{applicationId} and del_flag='0'
|
||||
</update>
|
||||
|
||||
<update id="deletePcRiskProjectByIds">
|
||||
update pc_risk_project
|
||||
set del_flag='2',
|
||||
update_time=now()
|
||||
where project_id in
|
||||
<foreach collection="projectIds" item="id" open="(" close=")" separator=",">
|
||||
where application_id in
|
||||
<foreach collection="applicationIds" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
|
@ -119,39 +198,73 @@
|
|||
update pc_risk_project
|
||||
set alloc_status = #{allocStatus},
|
||||
update_time = now()
|
||||
where project_id = #{projectId} and del_flag='0'
|
||||
where application_id = #{applicationId} and del_flag='0'
|
||||
</update>
|
||||
|
||||
<!-- ===================== 完工复核管理 ===================== -->
|
||||
|
||||
<select id="selectProjectCompletionReviewList" resultMap="PcRiskProjectMap">
|
||||
select * from pc_risk_project
|
||||
where del_flag='0'
|
||||
select
|
||||
r.application_id,
|
||||
r.need_camera_cnt,
|
||||
r.installation_location,
|
||||
r.contact_person,
|
||||
r.contact_phone,
|
||||
r.work_ticket_id,
|
||||
r.project_id,
|
||||
r.alloc_status,
|
||||
r.del_flag,
|
||||
r.remark,
|
||||
r.create_by,
|
||||
r.create_time,
|
||||
r.update_by,
|
||||
r.update_time,
|
||||
r.supervision_review_status,
|
||||
r.on_site_review_status,
|
||||
r.final_audit_status,
|
||||
r.project_status,
|
||||
r.on_site_review_images,
|
||||
r.work_content_complete_rate,
|
||||
r.site_cleaning_condition,
|
||||
r.review_comments,
|
||||
-- 从工作计划关联查询
|
||||
wp.project_name,
|
||||
wp.project_code,
|
||||
wp.construction_unit_name as construction_unit,
|
||||
wp.work_location,
|
||||
wp.work_start_time as work_start,
|
||||
wp.work_end_time as work_end,
|
||||
-- 从工作票关联查询
|
||||
wt.risk_type
|
||||
from pc_risk_project r
|
||||
left join work_plan wp on wp.project_id = r.project_id and wp.del_flag = '0'
|
||||
left join work_ticket wt on wt.ticket_id = r.work_ticket_id and wt.del_flag = '0'
|
||||
where r.del_flag='0'
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and project_name like concat('%', #{projectName}, '%')
|
||||
and wp.project_name like concat('%', #{projectName}, '%')
|
||||
</if>
|
||||
<if test="constructionUnit != null and constructionUnit != ''">
|
||||
and construction_unit like concat('%', #{constructionUnit}, '%')
|
||||
and wp.construction_unit_name like concat('%', #{constructionUnit}, '%')
|
||||
</if>
|
||||
<if test="workLocation != null and workLocation != ''">
|
||||
and work_location like concat('%', #{workLocation}, '%')
|
||||
and wp.work_location like concat('%', #{workLocation}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 复核/审核/归档筛选 -->
|
||||
<if test="supervisionReviewStatus != null and supervisionReviewStatus != ''">
|
||||
and supervision_review_status = #{supervisionReviewStatus}
|
||||
and r.supervision_review_status = #{supervisionReviewStatus}
|
||||
</if>
|
||||
<if test="onSiteReviewStatus != null and onSiteReviewStatus != ''">
|
||||
and on_site_review_status = #{onSiteReviewStatus}
|
||||
and r.on_site_review_status = #{onSiteReviewStatus}
|
||||
</if>
|
||||
<if test="finalAuditStatus != null and finalAuditStatus != ''">
|
||||
and final_audit_status = #{finalAuditStatus}
|
||||
and r.final_audit_status = #{finalAuditStatus}
|
||||
</if>
|
||||
<if test="projectStatus != null and projectStatus != ''">
|
||||
and project_status = #{projectStatus}
|
||||
and r.project_status = #{projectStatus}
|
||||
</if>
|
||||
|
||||
order by project_id desc
|
||||
order by r.application_id desc
|
||||
</select>
|
||||
|
||||
<!-- ✅ 状态更新:一定要把监理字段也带上,否则你“必须监理通过才能下一步”的判断没法落库 -->
|
||||
|
|
@ -170,7 +283,7 @@
|
|||
|
||||
update_by = #{updateBy},
|
||||
update_time = now()
|
||||
where project_id = #{projectId} and del_flag = '0'
|
||||
where application_id = #{applicationId} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<!-- 可选:仅更新监理复核状态(监理系统回写/人工回写时更方便) -->
|
||||
|
|
@ -178,7 +291,15 @@
|
|||
update pc_risk_project
|
||||
set supervision_review_status = #{supervisionReviewStatus},
|
||||
update_time = now()
|
||||
where project_id = #{projectId} and del_flag = '0'
|
||||
where application_id = #{applicationId} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<!-- 更新工作票ID(工作票创建后绑定) -->
|
||||
<update id="updateWorkTicketId">
|
||||
update pc_risk_project
|
||||
set work_ticket_id = #{workTicketId},
|
||||
update_time = now()
|
||||
where application_id = #{applicationId} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@
|
|||
<result property="workType" column="work_type" />
|
||||
<result property="riskLevel" column="risk_level" />
|
||||
<result property="projectStatus" column="project_status" />
|
||||
<result property="approvalStatus" column="approval_status" />
|
||||
<result property="approver" column="approver" />
|
||||
<result property="approvalTime" column="approval_time" />
|
||||
<result property="approvalComment" column="approval_comment" />
|
||||
<result property="currentProgress" column="current_progress" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="remark" column="remark" />
|
||||
|
|
@ -77,14 +81,16 @@
|
|||
longitude, latitude, work_start_time, work_end_time,
|
||||
supervisor_id, supervisor_name, supervisor_position, team_members,
|
||||
construction_unit_id, construction_unit_name, work_type, risk_level,
|
||||
project_status, current_progress, remark, del_flag,
|
||||
project_status, approval_status, approver, approval_time, approval_comment,
|
||||
current_progress, remark, del_flag,
|
||||
create_by, create_time
|
||||
)values(
|
||||
#{projectCode}, #{projectName}, #{workLocation}, #{workLocationDetail},
|
||||
#{longitude}, #{latitude}, #{workStartTime}, #{workEndTime},
|
||||
#{supervisorId}, #{supervisorName}, #{supervisorPosition}, #{sysUsers},
|
||||
#{constructionUnitId}, #{constructionUnitName}, #{workType}, #{riskLevel},
|
||||
#{projectStatus}, #{currentProgress}, #{remark}, '0',
|
||||
#{projectStatus}, #{approvalStatus}, #{approver}, #{approvalTime}, #{approvalComment},
|
||||
#{currentProgress}, #{remark}, '0',
|
||||
#{createBy}, now()
|
||||
)
|
||||
</insert>
|
||||
|
|
@ -109,6 +115,10 @@
|
|||
<if test="workType != null">work_type = #{workType},</if>
|
||||
<if test="riskLevel != null">risk_level = #{riskLevel},</if>
|
||||
<if test="projectStatus != null and projectStatus != ''">project_status = #{projectStatus},</if>
|
||||
<if test="approvalStatus != null and approvalStatus != ''">approval_status = #{approvalStatus},</if>
|
||||
<if test="approver != null">approver = #{approver},</if>
|
||||
<if test="approvalTime != null">approval_time = #{approvalTime},</if>
|
||||
<if test="approvalComment != null">approval_comment = #{approvalComment},</if>
|
||||
<if test="currentProgress != null">current_progress = #{currentProgress},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
|
|
@ -142,6 +152,18 @@
|
|||
where project_id = #{projectId}
|
||||
</update>
|
||||
|
||||
<!-- 更新项目状态和审批状态 -->
|
||||
<update id="updateProjectStatusAndApproval">
|
||||
update work_plan
|
||||
set project_status = #{projectStatus},
|
||||
approval_status = #{approvalStatus},
|
||||
<if test="approver != null and approver != ''">approver = #{approver},</if>
|
||||
<if test="approvalTime != null and approvalTime != ''">approval_time = #{approvalTime},</if>
|
||||
<if test="approvalComment != null">approval_comment = #{approvalComment},</if>
|
||||
update_time = now()
|
||||
where project_id = #{projectId}
|
||||
</update>
|
||||
|
||||
<!-- 项目全流程状态总览查询(包含关联信息) -->
|
||||
<select id="selectProjectFullProcessList" parameterType="com.admin.contractor.domain.WorkPlan" resultMap="WorkPlanResult">
|
||||
select
|
||||
|
|
@ -164,6 +186,10 @@
|
|||
wp.work_type,
|
||||
wp.risk_level,
|
||||
wp.project_status,
|
||||
wp.approval_status,
|
||||
wp.approver,
|
||||
wp.approval_time,
|
||||
wp.approval_comment,
|
||||
wp.current_progress,
|
||||
wp.remark,
|
||||
wp.del_flag,
|
||||
|
|
|
|||
Loading…
Reference in New Issue