Merge pull request 'development' (#3) from development into master
Reviewed-on: http://pms.dtyx.net:3000/cuizhibin/znpt-backend/pulls/3
This commit is contained in:
commit
1232ed4eac
|
@ -0,0 +1,24 @@
|
|||
package com.dite.znpt.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
/**
|
||||
* @author hedechao
|
||||
* @date 2025/8/11 11:02
|
||||
* @Description: 形变配置线程
|
||||
*/
|
||||
@Configuration
|
||||
public class TaskConfig {
|
||||
@Bean("clearanceExecutor") // 方法返回的对象会被注册成 Bean,名字叫 clearanceExecutor
|
||||
public ThreadPoolTaskExecutor clearanceExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(2); // 核心线程数
|
||||
executor.setMaxPoolSize(4); // 最大线程数
|
||||
executor.setQueueCapacity(100); // 队列容量
|
||||
executor.setThreadNamePrefix("clearance-"); // 线程名前缀
|
||||
executor.initialize(); // 初始化
|
||||
return executor;
|
||||
}
|
||||
}
|
|
@ -177,6 +177,15 @@ public class EquipmentEntity extends AuditableEntity implements Serializable {
|
|||
@ApiModelProperty("发票状态")
|
||||
private String invoiceStatus;
|
||||
|
||||
@ApiModelProperty("采购状态,NOT_STARTED-未开始,PENDING_APPROVAL-待审批,APPROVED-已通过,REJECTED-已拒绝,COMPLETED-已完成")
|
||||
private String procurementStatus;
|
||||
|
||||
@ApiModelProperty("收货状态,NOT_RECEIVED-未收货,PARTIALLY_RECEIVED-部分收货,RECEIVED-已收货")
|
||||
private String receiptStatus;
|
||||
|
||||
@ApiModelProperty("支付状态,NOT_PAID-未支付,PARTIALLY_PAID-部分支付,PAID-已支付")
|
||||
private String paymentStatus;
|
||||
|
||||
@ApiModelProperty("附件")
|
||||
private String attachments;
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.dite.znpt.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("expense_type")
|
||||
@ApiModel(value="ExpenseTypeEntity对象", description="支出类型表")
|
||||
public class ExpenseTypeEntity {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer Id;
|
||||
|
||||
@ApiModelProperty("支出类型名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("父级id")
|
||||
private Integer parentId;
|
||||
}
|
|
@ -89,7 +89,7 @@ public class ProjectEntity extends AuditableEntity implements Serializable {
|
|||
@ExcelProperty("项目规模")
|
||||
@ApiModelProperty("项目规模")
|
||||
@TableField("scale")
|
||||
private String scale;
|
||||
private Integer scale;
|
||||
|
||||
@ExcelProperty("总工期,单位天")
|
||||
@ApiModelProperty("总工期,单位天")
|
||||
|
|
|
@ -85,5 +85,13 @@ public class ProjectTaskEntity extends AuditableEntity implements Serializable {
|
|||
@ApiModelProperty("项目id")
|
||||
@TableField("project_id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("任务规模")
|
||||
@TableField("scales")
|
||||
private Integer scales;
|
||||
|
||||
@ApiModelProperty("已完成数")
|
||||
@TableField("finished")
|
||||
private Integer finished;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
package com.dite.znpt.domain.entity;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 视频监测信息
|
||||
*/
|
||||
@ApiModel(description="视频监测信息")
|
||||
@Schema(description="视频监测信息")
|
||||
@Data
|
||||
@TableName(value = "video_monitor")
|
||||
public class VideoMonitorEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 视频id
|
||||
*/
|
||||
@TableId(value = "video_id", type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value="视频id")
|
||||
@Schema(description="视频id")
|
||||
private String videoId;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@TableField(value = "project_id")
|
||||
@ApiModelProperty(value="项目id")
|
||||
@Schema(description="项目id")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 机组id
|
||||
*/
|
||||
@TableField(value = "turbine_id")
|
||||
@ApiModelProperty(value="机组id")
|
||||
@Schema(description="机组id")
|
||||
private String turbineId;
|
||||
|
||||
/**
|
||||
* 视频名称
|
||||
*/
|
||||
@TableField(value = "video_name")
|
||||
@ApiModelProperty(value="视频名称")
|
||||
@Schema(description="视频名称")
|
||||
private String videoName;
|
||||
|
||||
/**
|
||||
* 视频路径
|
||||
*/
|
||||
@TableField(value = "video_path")
|
||||
@ApiModelProperty(value="视频路径")
|
||||
@Schema(description="视频路径")
|
||||
private String videoPath;
|
||||
|
||||
/**
|
||||
* 0 正常 1 已删除
|
||||
*/
|
||||
@TableField(value = "is_deleted")
|
||||
@ApiModelProperty(value="0 正常 1 已删除")
|
||||
@Schema(description="0 正常 1 已删除")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 0 待审核 1 已上线 2 下线
|
||||
*/
|
||||
@TableField(value = "`status`")
|
||||
@ApiModelProperty(value="0 待审核 1 已上线 2 下线")
|
||||
@Schema(description="0 待审核 1 已上线 2 下线")
|
||||
private Byte status;
|
||||
|
||||
/**
|
||||
* 预处理后的视频路径
|
||||
*/
|
||||
@TableField(value = "pre_image_path")
|
||||
@ApiModelProperty(value="预处理后的视频路径")
|
||||
@Schema(description="预处理后的视频路径")
|
||||
private String preImagePath;
|
||||
|
||||
/**
|
||||
* 是否处理,默认0
|
||||
*/
|
||||
@TableField(value = "pre_treatment")
|
||||
@ApiModelProperty(value="是否处理,默认0")
|
||||
@Schema(description="是否处理,默认0")
|
||||
private Boolean preTreatment;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(value = "update_by")
|
||||
@ApiModelProperty(value="修改人")
|
||||
@Schema(description="修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time",fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value="创建时间")
|
||||
@Schema(description="创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(value = "create_by")
|
||||
@ApiModelProperty(value="创建人")
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value="修改时间")
|
||||
@Schema(description="修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 风速
|
||||
*/
|
||||
@TableField(value = "wind_speed")
|
||||
@ApiModelProperty(value="风速")
|
||||
@Schema(description="风速")
|
||||
private String windSpeed;
|
||||
|
||||
/**
|
||||
* 转速
|
||||
*/
|
||||
@TableField(value = "rpm")
|
||||
@ApiModelProperty(value="转速")
|
||||
@Schema(description="转速")
|
||||
private String rpm;
|
||||
|
||||
/**
|
||||
* 检测类型
|
||||
*/
|
||||
@TableField(value = "`type`")
|
||||
@ApiModelProperty(value="检测类型")
|
||||
@Schema(description="检测类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 业务扩展字段
|
||||
*/
|
||||
@TableField(value = "extra",typeHandler = JacksonTypeHandler.class)
|
||||
@ApiModelProperty(value="业务扩展字段")
|
||||
@Schema(description="业务扩展字段")
|
||||
private JSONObject extra;
|
||||
|
||||
/**
|
||||
* 上传时间
|
||||
*/
|
||||
@TableField(value = "upload_time")
|
||||
@ApiModelProperty(value="上传时间")
|
||||
@Schema(description="上传时间")
|
||||
private Date uploadTime;
|
||||
}
|
|
@ -43,6 +43,9 @@ public class EquipmentApprovalListReq implements Serializable {
|
|||
@ApiModelProperty("当前页码")
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty("当前页码 - 与前端保持一致")
|
||||
private Integer pageNum;
|
||||
|
||||
@ApiModelProperty("每页大小")
|
||||
private Integer pageSize;
|
||||
|
||||
|
|
|
@ -154,6 +154,18 @@ public class EquipmentResp implements Serializable {
|
|||
@ApiModelProperty("总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty("采购状态,NOT_STARTED-未开始,PENDING_APPROVAL-待审批,APPROVED-已通过,REJECTED-已拒绝,COMPLETED-已完成")
|
||||
private String procurementStatus;
|
||||
|
||||
@ApiModelProperty("收货状态,NOT_RECEIVED-未收货,PARTIALLY_RECEIVED-部分收货,RECEIVED-已收货")
|
||||
private String receiptStatus;
|
||||
|
||||
@ApiModelProperty("支付状态,NOT_PAID-未支付,PARTIALLY_PAID-部分支付,PAID-已支付")
|
||||
private String paymentStatus;
|
||||
|
||||
@ApiModelProperty("审批状态,PENDING-待审批,APPROVED-已通过,REJECTED-已拒绝")
|
||||
private String approvalStatus;
|
||||
|
||||
// 移除备用状态字段,使用现有的 location_status 字段
|
||||
// @ApiModelProperty("备用状态")
|
||||
// private String spareStatus;
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 甘特图查询请求类
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "GanttChartReq", description = "甘特图查询请求")
|
||||
public class GanttChartReq {
|
||||
|
||||
@ApiModelProperty("项目ID")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("任务组ID")
|
||||
private String taskGroupId;
|
||||
|
||||
@ApiModelProperty("任务状态")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("负责人ID")
|
||||
private String mainUserId;
|
||||
|
||||
@ApiModelProperty("开始时间范围-开始")
|
||||
private LocalDate startDateFrom;
|
||||
|
||||
@ApiModelProperty("开始时间范围-结束")
|
||||
private LocalDate startDateTo;
|
||||
|
||||
@ApiModelProperty("结束时间范围-开始")
|
||||
private LocalDate endDateFrom;
|
||||
|
||||
@ApiModelProperty("结束时间范围-结束")
|
||||
private LocalDate endDateTo;
|
||||
|
||||
@ApiModelProperty("是否包含已完成任务")
|
||||
private Boolean includeCompleted = true;
|
||||
|
||||
@ApiModelProperty("是否只显示逾期任务")
|
||||
private Boolean overdueOnly = false;
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 甘特图数据响应类
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "GanttChartResp", description = "甘特图数据响应")
|
||||
public class GanttChartResp {
|
||||
|
||||
@ApiModelProperty("任务ID")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty("任务名称")
|
||||
private String taskName;
|
||||
|
||||
@ApiModelProperty("任务编号")
|
||||
private String taskCode;
|
||||
|
||||
@ApiModelProperty("上级任务ID")
|
||||
private String parentTaskId;
|
||||
|
||||
@ApiModelProperty("任务组ID")
|
||||
private String taskGroupId;
|
||||
|
||||
@ApiModelProperty("任务组名称")
|
||||
private String taskGroupName;
|
||||
|
||||
@ApiModelProperty("计划开始时间")
|
||||
private LocalDate planStartDate;
|
||||
|
||||
@ApiModelProperty("计划结束时间")
|
||||
private LocalDate planEndDate;
|
||||
|
||||
@ApiModelProperty("实际开始时间")
|
||||
private LocalDate actualStartDate;
|
||||
|
||||
@ApiModelProperty("实际结束时间")
|
||||
private LocalDate actualEndDate;
|
||||
|
||||
@ApiModelProperty("任务状态:0未开始,1进行中,2已结束")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("任务状态描述")
|
||||
private String statusDesc;
|
||||
|
||||
@ApiModelProperty("是否逾期:0未逾期,1已逾期")
|
||||
private Integer overdueStatus;
|
||||
|
||||
@ApiModelProperty("任务负责人ID")
|
||||
private String mainUserId;
|
||||
|
||||
@ApiModelProperty("任务负责人姓名")
|
||||
private String mainUserName;
|
||||
|
||||
@ApiModelProperty("任务参与人")
|
||||
private String userIds;
|
||||
|
||||
@ApiModelProperty("任务参与人姓名列表")
|
||||
private List<String> participantNames;
|
||||
|
||||
@ApiModelProperty("进度百分比")
|
||||
private Integer progress;
|
||||
|
||||
@ApiModelProperty("任务层级")
|
||||
private Integer level;
|
||||
|
||||
@ApiModelProperty("任务在时间轴上的位置(天数)")
|
||||
private Integer position;
|
||||
|
||||
@ApiModelProperty("任务持续时间(天数)")
|
||||
private Integer duration;
|
||||
|
||||
@ApiModelProperty("子任务列表")
|
||||
private List<GanttChartResp> children;
|
||||
|
||||
@ApiModelProperty("任务备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("项目ID")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.dite.znpt.util.ValidationGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@ApiModel("项目初始化任务请求参数")
|
||||
public class ProjectInitTaskReq {
|
||||
@ApiModelProperty("任务名称")
|
||||
private String taskName;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "项目任务编号不能为空")
|
||||
@Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 100, message = "项目任务编号长度不能超过100字符")
|
||||
@ApiModelProperty("项目任务编号")
|
||||
private String taskCode;
|
||||
|
||||
@NotNull(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "计划开始时间不能为空")
|
||||
@ApiModelProperty("计划开始时间")
|
||||
private LocalDate planStartDate;
|
||||
|
||||
@NotNull(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "计划结束时间不能为空")
|
||||
@ApiModelProperty("计划结束时间")
|
||||
private LocalDate planEndDate;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "任务组id不能为空")
|
||||
@Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 32, message = "任务组id长度不能超过32字符")
|
||||
@ApiModelProperty("任务组id")
|
||||
private String taskGroupId;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "任务负责人id不能为空")
|
||||
@Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 100, message = "任务负责人id长度不能超过100字符")
|
||||
@ApiModelProperty("任务负责人id")
|
||||
private String mainUserId;
|
||||
|
||||
@ApiModelProperty("任务规模")
|
||||
private Integer scales;
|
||||
}
|
|
@ -17,20 +17,29 @@ import java.util.List;
|
|||
@ApiModel(value="ProjectKanbanDataResp对象", description="项目看板数据响应")
|
||||
public class ProjectKanbanDataResp {
|
||||
|
||||
@ApiModelProperty("待施工项目列表")
|
||||
@ApiModelProperty("未开工项目列表")
|
||||
private List<ProjectKanbanItem> pendingProjects;
|
||||
|
||||
@ApiModelProperty("施工中项目列表")
|
||||
@ApiModelProperty("筹备中项目列表")
|
||||
private List<ProjectKanbanItem> preparingProjects;
|
||||
|
||||
@ApiModelProperty("开工中项目列表")
|
||||
private List<ProjectKanbanItem> inProgressProjects;
|
||||
|
||||
@ApiModelProperty("暂停中项目列表")
|
||||
private List<ProjectKanbanItem> suspendedProjects;
|
||||
|
||||
@ApiModelProperty("已完工项目列表")
|
||||
private List<ProjectKanbanItem> completedProjects;
|
||||
|
||||
@ApiModelProperty("已审核项目列表")
|
||||
private List<ProjectKanbanItem> auditedProjects;
|
||||
@ApiModelProperty("验收中项目列表")
|
||||
private List<ProjectKanbanItem> acceptanceProjects;
|
||||
|
||||
@ApiModelProperty("已验收项目列表")
|
||||
private List<ProjectKanbanItem> acceptedProjects;
|
||||
@ApiModelProperty("回款中项目列表")
|
||||
private List<ProjectKanbanItem> collectionProjects;
|
||||
|
||||
@ApiModelProperty("已结算项目列表")
|
||||
private List<ProjectKanbanItem> settledProjects;
|
||||
|
||||
@Data
|
||||
@ApiModel(value="ProjectKanbanItem对象", description="项目看板项目项")
|
||||
|
|
|
@ -19,17 +19,26 @@ public class ProjectKanbanStatsResp {
|
|||
@ApiModelProperty("待施工项目数")
|
||||
private Long pendingProjectCount;
|
||||
|
||||
@ApiModelProperty("施工中项目数")
|
||||
@ApiModelProperty("筹备中项目数")
|
||||
private Long preparingProjectCount;
|
||||
|
||||
@ApiModelProperty("开工中项目数")
|
||||
private Long inProgressProjectCount;
|
||||
|
||||
@ApiModelProperty("暂停中项目数")
|
||||
private Long suspendedProjectCount;
|
||||
|
||||
@ApiModelProperty("已完工项目数")
|
||||
private Long completedProjectCount;
|
||||
|
||||
@ApiModelProperty("已审核项目数")
|
||||
private Long auditedProjectCount;
|
||||
@ApiModelProperty("验收中项目数")
|
||||
private Long acceptanceProjectCount;
|
||||
|
||||
@ApiModelProperty("已验收项目数")
|
||||
private Long acceptedProjectCount;
|
||||
@ApiModelProperty("回款中项目数")
|
||||
private Long collectionProjectCount;
|
||||
|
||||
@ApiModelProperty("已结算项目数")
|
||||
private Long settledProjectCount;
|
||||
|
||||
@ApiModelProperty("总机组数")
|
||||
private Long totalTurbineCount;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.dite.znpt.domain.entity.ProjectTaskEntity;
|
||||
import com.dite.znpt.util.ValidationGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
@ -10,6 +11,7 @@ import javax.validation.constraints.Size;
|
|||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
|
@ -31,7 +33,6 @@ public class ProjectReq implements Serializable {
|
|||
@ApiModelProperty("项目来源")
|
||||
private String projectOrigin;
|
||||
|
||||
@NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "项目预算不能为空")
|
||||
@ApiModelProperty("项目预算")
|
||||
private Integer projectBudget;
|
||||
|
||||
|
@ -77,9 +78,8 @@ public class ProjectReq implements Serializable {
|
|||
@ApiModelProperty("检查单位联系电话")
|
||||
private String inspectionPhone;
|
||||
|
||||
@Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 20, message = "项目规模长度不能超过20字符")
|
||||
@ApiModelProperty("项目规模")
|
||||
private String scale;
|
||||
private Integer scale;
|
||||
|
||||
@ApiModelProperty("总工期,单位天")
|
||||
private Integer duration;
|
||||
|
@ -127,4 +127,7 @@ public class ProjectReq implements Serializable {
|
|||
|
||||
@ApiModelProperty("其他杂费")
|
||||
private Double othersCost;
|
||||
|
||||
@ApiModelProperty("项目初始任务")
|
||||
private List<ProjectInitTaskReq> tasks;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
|
@ -45,5 +46,8 @@ public class ProjectResp extends ProjectReq implements Serializable {
|
|||
|
||||
@ApiModelProperty("状态:0待施工,1施工中,2已完工,3已审核,4已验收")
|
||||
private String statusLabel;
|
||||
|
||||
@ApiModelProperty("任务列表")
|
||||
private List<ProjectTaskResp> taskList;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 收货请求参数(扩展版,包含完整设备信息)
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-01-08
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "收货请求参数", description = "收货请求参数,包含收货信息和设备信息")
|
||||
public class ReceiptRequest {
|
||||
|
||||
@ApiModelProperty("设备序列号(收货时自动生成)")
|
||||
private String equipmentSn;
|
||||
|
||||
@ApiModelProperty("库存条码(收货时自动生成)")
|
||||
private String inventoryBarcode;
|
||||
|
||||
// 收货特有信息
|
||||
@NotBlank(message = "收货时间不能为空")
|
||||
@ApiModelProperty("收货时间")
|
||||
private String receiptTime;
|
||||
|
||||
@NotBlank(message = "收货人不能为空")
|
||||
@ApiModelProperty("收货人")
|
||||
private String receiptPerson;
|
||||
|
||||
@NotNull(message = "收货数量不能为空")
|
||||
@ApiModelProperty("收货数量")
|
||||
private Integer receiptQuantity;
|
||||
|
||||
@ApiModelProperty("收货备注")
|
||||
private String receiptRemark;
|
||||
|
||||
@NotBlank(message = "外观检查结果不能为空")
|
||||
@ApiModelProperty("外观检查结果")
|
||||
private String appearanceCheck;
|
||||
|
||||
@NotBlank(message = "功能测试结果不能为空")
|
||||
@ApiModelProperty("功能测试结果")
|
||||
private String functionTest;
|
||||
|
||||
@NotBlank(message = "包装完整性不能为空")
|
||||
@ApiModelProperty("包装完整性")
|
||||
private String packageIntegrity;
|
||||
|
||||
@NotBlank(message = "配件完整性不能为空")
|
||||
@ApiModelProperty("配件完整性")
|
||||
private String accessoryIntegrity;
|
||||
|
||||
@NotBlank(message = "检查结果不能为空")
|
||||
@ApiModelProperty("检查结果")
|
||||
private String checkResult;
|
||||
|
||||
@ApiModelProperty("检查备注")
|
||||
private String checkRemark;
|
||||
|
||||
@NotBlank(message = "入库位置不能为空")
|
||||
@ApiModelProperty("入库位置")
|
||||
private String storageLocation;
|
||||
|
||||
@NotBlank(message = "库管员不能为空")
|
||||
@ApiModelProperty("库管员")
|
||||
private String storageManager;
|
||||
|
||||
// 设备基本信息(从采购数据继承)
|
||||
@ApiModelProperty("设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
@ApiModelProperty("设备型号")
|
||||
private String equipmentModel;
|
||||
|
||||
@ApiModelProperty("设备类型")
|
||||
private String equipmentType;
|
||||
|
||||
@ApiModelProperty("品牌")
|
||||
private String brand;
|
||||
|
||||
@ApiModelProperty("配置规格/参数")
|
||||
private String specification;
|
||||
|
||||
@ApiModelProperty("资产编号")
|
||||
private String assetCode;
|
||||
|
||||
// 采购信息(从采购数据继承)
|
||||
@ApiModelProperty("采购订单号")
|
||||
private String purchaseOrder;
|
||||
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
@ApiModelProperty("采购价格")
|
||||
private BigDecimal purchasePrice;
|
||||
|
||||
@ApiModelProperty("采购时间")
|
||||
private String purchaseTime;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
// 入库信息
|
||||
@ApiModelProperty("入库时间")
|
||||
private String inStockTime;
|
||||
|
||||
@ApiModelProperty("物理位置")
|
||||
private String physicalLocation;
|
||||
|
||||
@ApiModelProperty("位置状态")
|
||||
private String locationStatus;
|
||||
|
||||
@ApiModelProperty("负责人")
|
||||
private String responsiblePerson;
|
||||
|
||||
// 状态信息
|
||||
@ApiModelProperty("设备状态")
|
||||
private String equipmentStatus;
|
||||
|
||||
@ApiModelProperty("使用状态")
|
||||
private String useStatus;
|
||||
|
||||
@ApiModelProperty("健康状态")
|
||||
private String healthStatus;
|
||||
|
||||
@ApiModelProperty("收货状态")
|
||||
private String receiptStatus;
|
||||
|
||||
// 其他管理信息
|
||||
@ApiModelProperty("折旧方法")
|
||||
private String depreciationMethod;
|
||||
|
||||
@ApiModelProperty("折旧年限")
|
||||
private Integer depreciationYears;
|
||||
|
||||
@ApiModelProperty("残值")
|
||||
private BigDecimal salvageValue;
|
||||
|
||||
@ApiModelProperty("当前净值")
|
||||
private BigDecimal currentNetValue;
|
||||
|
||||
// 系统字段
|
||||
@ApiModelProperty("创建时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private String updateTime;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author wangna
|
||||
* @date 2025/08/05
|
||||
* @Description: 团队成员更新请求类(用于更新操作,移除必填验证)
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="TeamMemberUpdateReq对象", description="团队成员更新请求类")
|
||||
public class TeamMemberUpdateReq implements Serializable {
|
||||
|
||||
@ApiModelProperty("项目ID")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("机组ID(可选)")
|
||||
private String turbineId;
|
||||
|
||||
@ApiModelProperty("任务组ID(可选)")
|
||||
private String taskGroupId;
|
||||
|
||||
@ApiModelProperty("任务ID(可选)")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("项目角色类型:PROJECT_MANAGER-项目经理,SAFETY_OFFICER-安全员,QUALITY_OFFICER-质量员,CONSTRUCTOR-施工人员,TEAM_LEADER-施工组长")
|
||||
private String roleType;
|
||||
|
||||
@ApiModelProperty("具体岗位代码(如:GROUND_SERVICE-地勤,DRIVER-司机,ASCENDING-登高等)")
|
||||
private String jobCode;
|
||||
|
||||
@ApiModelProperty("岗位描述")
|
||||
private String jobDesc;
|
||||
|
||||
@ApiModelProperty("加入时间")
|
||||
private LocalDate joinDate;
|
||||
|
||||
@ApiModelProperty("离开时间")
|
||||
private LocalDate leaveDate;
|
||||
|
||||
@ApiModelProperty("状态:ACTIVE-在职,INACTIVE-离职,PENDING-待入职")
|
||||
private String status = "ACTIVE";
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("用户电话")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("用户邮箱")
|
||||
private String email;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hedechao
|
||||
* @date 2025/8/8 09:10
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("视频列表查询实体")
|
||||
public class VideoReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 771014582625089979L;
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
@ApiModelProperty("视频类型")
|
||||
private String[] type;
|
||||
@ApiModelProperty("机组id")
|
||||
private String turbineId;
|
||||
@ApiModelProperty("是否已审核,0未审核,1已审核")
|
||||
private Boolean State;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 支付状态枚举
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-01-08
|
||||
*/
|
||||
@Getter
|
||||
public enum PaymentStatusEnum {
|
||||
NOT_PAID("NOT_PAID", "未支付"),
|
||||
PARTIALLY_PAID("PARTIALLY_PAID", "部分支付"),
|
||||
PAID("PAID", "已支付");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
PaymentStatusEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static PaymentStatusEnum getByCode(String code) {
|
||||
for (PaymentStatusEnum e : PaymentStatusEnum.values()) {
|
||||
if (e.code.equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
PaymentStatusEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> listAll() {
|
||||
List<JSONObject> list = new ArrayList<>(PaymentStatusEnum.values().length);
|
||||
for (PaymentStatusEnum e : PaymentStatusEnum.values()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -15,11 +15,14 @@ import java.util.List;
|
|||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ProjectStatusEnum {
|
||||
PENDING(0, "待施工"),
|
||||
IN_PROGRESS(1, "施工中"),
|
||||
COMPLETED(2, "已完工"),
|
||||
AUDITED(3, "已审核"),
|
||||
ACCEPTED(4, "已验收");
|
||||
PENDING(0, "未开工"),
|
||||
PREPARING(1, "筹备中"),
|
||||
IN_PROGRESS(2, "开工中"),
|
||||
SUSPENDED(3, "暂停中"),
|
||||
COMPLETED(4, "已完工"),
|
||||
IN_ACCEPTANCE(5, "验收中"),
|
||||
IN_COLLECTION(6, "回款中"),
|
||||
SETTLED(7, "已结算");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收货状态枚举
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-01-08
|
||||
*/
|
||||
@Getter
|
||||
public enum ReceiptStatusEnum {
|
||||
NOT_RECEIVED("NOT_RECEIVED", "未收货"),
|
||||
PARTIALLY_RECEIVED("PARTIALLY_RECEIVED", "部分收货"),
|
||||
RECEIVED("RECEIVED", "已收货");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
ReceiptStatusEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static ReceiptStatusEnum getByCode(String code) {
|
||||
for (ReceiptStatusEnum e : ReceiptStatusEnum.values()) {
|
||||
if (e.code.equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
ReceiptStatusEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> listAll() {
|
||||
List<JSONObject> list = new ArrayList<>(ReceiptStatusEnum.values().length);
|
||||
for (ReceiptStatusEnum e : ReceiptStatusEnum.values()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public enum VideoMonitorEnum {
|
||||
CLEARANCE("clearance","净空监测"),
|
||||
DEFORMATION("deformation","形变监测");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
VideoMonitorEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static VideoMonitorEnum getByCode(String code) {
|
||||
for (VideoMonitorEnum e : VideoMonitorEnum.values()) {
|
||||
if (e.code.equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
VideoMonitorEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> listAll() {
|
||||
List<JSONObject> list = new ArrayList<>(UserStatusEnum.values().length);
|
||||
for (VideoMonitorEnum e : VideoMonitorEnum.values()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -17,13 +17,34 @@ public interface BusinessDataFileMapper {
|
|||
// 新增文件预览方法
|
||||
|
||||
|
||||
public List<BusinessDataFileEntity> List(@Param("folderId") Long folderId, @Param("fileName") String fileName);
|
||||
void delete(@Param("fileId") Long fileId,@Param("folderId") Long folderId);
|
||||
// public List<BusinessDataFileEntity> List(@Param("folderId") Long folderId, @Param("fileName") String fileName);
|
||||
|
||||
public List<BusinessDataFileEntity> List(
|
||||
@Param("folderId") Long folderId,
|
||||
@Param("fileName") String fileName,
|
||||
@Param("sortField") String sortField,
|
||||
@Param("sortOrder") String sortOrder);
|
||||
void delete(@Param("fileId") Long fileId,
|
||||
@Param("folderId") Long folderId);
|
||||
|
||||
void add(BusinessDataFileEntity businessDataFileEntity);
|
||||
|
||||
String getPath(Long fileId);
|
||||
|
||||
// 在接口中添加重命名方法
|
||||
void reName(@Param("fileId") Long fileId, @Param("newFileName") String newFileName, @Param("newFilePath") String newFilePath);
|
||||
void reName(@Param("fileId") Long fileId,
|
||||
@Param("newFileName") String newFileName,
|
||||
@Param("newFilePath") String newFilePath);
|
||||
|
||||
// // 批量更新文件路径
|
||||
// void updateFilePathByFolderId(
|
||||
// @Param("folderId") Long folderId,
|
||||
// @Param("newFolderPath") String newFolderPath,
|
||||
// @Param("separator") String separator);
|
||||
|
||||
// 批量更新子文件夹下文件的路径
|
||||
void updateSubFilePaths(@Param("oldParentPath1") String oldParentPath1,
|
||||
@Param("newParentPath1") String newParentPath1,
|
||||
@Param("oldParentPath2") String oldParentPath2
|
||||
);
|
||||
}
|
||||
|
|
|
@ -29,4 +29,12 @@ public interface BusinessDataMapper {
|
|||
void reName(BusinessDataEntity businessDataEntity);
|
||||
|
||||
public List<BusinessDataEntity> ListWithCondition(@Param("folderName") String folderName);
|
||||
|
||||
// 批量更新子文件夹路径
|
||||
void updateSubFolderPaths(@Param("oldParentPath1") String oldParentPath,
|
||||
@Param("newParentPath1") String newParentPath,
|
||||
@Param("processedOldParentPath") String processedOldParentPath,
|
||||
@Param("processedNewParentPath") String processedNewParentPath,
|
||||
@Param("folderId") Long folderId
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.ExpenseTypeEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExpenseTypeMapper extends BaseMapper<ExpenseTypeEntity> {
|
||||
List<ExpenseTypeEntity> search(String key);
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.dite.znpt.domain.entity.ProjectTaskEntity;
|
||||
import com.dite.znpt.domain.vo.ProjectTaskListReq;
|
||||
import com.dite.znpt.domain.vo.ProjectTaskResp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -13,6 +14,7 @@ import java.util.List;
|
|||
* @date 2025/06/24 16:44
|
||||
* @Description: 项目任务信息表数据库访问层
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProjectTaskMapper extends BaseMapper<ProjectTaskEntity> {
|
||||
List<ProjectTaskResp> queryBySelective(ProjectTaskListReq projectTaskReq);
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.VideoMonitorEntity;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface VideoMonitorEntityMapper extends BaseMapper<VideoMonitorEntity> {
|
||||
List<VideoMonitorEntity> selectAllByProjectIdAndPartId(@Param("projectId") String projectId, @Param("partId") String partId);
|
||||
|
||||
int batchInsert(@Param("list") List<VideoMonitorEntity> list);
|
||||
}
|
|
@ -9,13 +9,16 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
|
||||
@ApiOperation("商务资料文件service")
|
||||
@Service
|
||||
public interface BusinessDataFileService {
|
||||
|
||||
// @ApiOperation("分页查询文件")
|
||||
// PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName);
|
||||
@ApiOperation("分页查询文件")
|
||||
PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName);
|
||||
PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName, String sortField, String sortOrder);
|
||||
|
||||
@ApiOperation("删除文件")
|
||||
Result delete(@RequestParam(value = "fileId", required = false) Long fileId,@RequestParam(value = "foldelId", required = false) Long folderId);
|
||||
|
@ -38,4 +41,11 @@ public interface BusinessDataFileService {
|
|||
|
||||
@ApiOperation("预览文件")
|
||||
void preview(Long fileId, HttpServletResponse response);
|
||||
|
||||
// @ApiOperation("批量更新文件路径")
|
||||
// public void updateFilePathByFolderId(Long folderId, String newFolderPath);
|
||||
|
||||
@ApiOperation("批量更新子文件夹下文件的路径")
|
||||
void updateSubFilePaths(String oldParentPath, String newParentPath);
|
||||
|
||||
}
|
||||
|
|
|
@ -15,4 +15,6 @@ public interface BusinessDataService {
|
|||
Result delete(Long folderId);
|
||||
Result reName(Long folderId, String newName);
|
||||
|
||||
void updateSubFolderPaths(String oldParentPath1, String newParentPath1, Long folderId);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.dite.znpt.domain.entity.EquipmentEntity;
|
|||
import com.dite.znpt.domain.vo.EquipmentListReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentReq;
|
||||
import com.dite.znpt.domain.vo.EquipmentResp;
|
||||
import com.dite.znpt.domain.vo.ReceiptRequest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -53,6 +54,11 @@ public interface EquipmentService extends IService<EquipmentEntity> {
|
|||
*/
|
||||
Object getProcurementStats();
|
||||
|
||||
/**
|
||||
* 确认收货并自动入库
|
||||
*/
|
||||
void receiveGoodsAndStockIn(String equipmentId, ReceiptRequest req);
|
||||
|
||||
/**
|
||||
* 导出采购记录
|
||||
*/
|
||||
|
@ -72,4 +78,19 @@ public interface EquipmentService extends IService<EquipmentEntity> {
|
|||
* 修改设备采购记录
|
||||
*/
|
||||
void updateProcurement(String equipmentId, EquipmentReq req);
|
||||
|
||||
/**
|
||||
* 分页查询设备盘库记录
|
||||
*/
|
||||
IPage<EquipmentResp> inventoryPage(EquipmentListReq req);
|
||||
|
||||
/**
|
||||
* 执行设备盘库
|
||||
*/
|
||||
void executeInventory(String equipmentId, String inventoryResult, String remark);
|
||||
|
||||
/**
|
||||
* 批量执行设备盘库
|
||||
*/
|
||||
void batchExecuteInventory(List<String> equipmentIds, String inventoryResult, String remark);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
/**
|
||||
* 设备状态更新服务接口
|
||||
* 用于处理设备审批后的状态更新,避免循环依赖
|
||||
*
|
||||
* @author Bear.G
|
||||
* @date 2025/1/8/周三 17:50
|
||||
*/
|
||||
public interface EquipmentStatusUpdateService {
|
||||
|
||||
/**
|
||||
* 更新设备采购状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param status 新状态
|
||||
*/
|
||||
void updateProcurementStatus(String equipmentId, String status);
|
||||
|
||||
/**
|
||||
* 更新设备借用状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param status 新状态
|
||||
*/
|
||||
void updateBorrowStatus(String equipmentId, String status);
|
||||
|
||||
/**
|
||||
* 更新设备归还状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param status 新状态
|
||||
*/
|
||||
void updateReturnStatus(String equipmentId, String status);
|
||||
|
||||
/**
|
||||
* 更新设备位置状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param locationStatus 新位置状态
|
||||
*/
|
||||
void updateLocationStatus(String equipmentId, String locationStatus);
|
||||
|
||||
/**
|
||||
* 更新设备使用状态
|
||||
*
|
||||
* @param equipmentId 设备ID
|
||||
* @param useStatus 新使用状态
|
||||
*/
|
||||
void updateUseStatus(String equipmentId, String useStatus);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.ExpenseTypeEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExpenseTypeService extends IService<ExpenseTypeEntity> {
|
||||
List<ExpenseTypeEntity> search(String key);
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.dite.znpt.domain.vo.GanttChartReq;
|
||||
import com.dite.znpt.domain.vo.GanttChartResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 甘特图服务接口
|
||||
*/
|
||||
public interface GanttChartService {
|
||||
|
||||
/**
|
||||
* 获取项目甘特图数据
|
||||
*
|
||||
* @param req 查询条件
|
||||
* @return 甘特图数据列表
|
||||
*/
|
||||
List<GanttChartResp> getGanttChartData(GanttChartReq req);
|
||||
|
||||
/**
|
||||
* 获取项目甘特图统计信息
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return 统计信息
|
||||
*/
|
||||
Object getGanttChartStatistics(String projectId);
|
||||
|
||||
/**
|
||||
* 获取项目甘特图时间轴信息
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return 时间轴信息
|
||||
*/
|
||||
Object getGanttChartTimeline(String projectId);
|
||||
|
||||
/**
|
||||
* 更新任务进度
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @param progress 进度百分比
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateTaskProgress(String taskId, Integer progress);
|
||||
|
||||
/**
|
||||
* 拖拽更新任务时间
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @param startDate 开始时间
|
||||
* @param endDate 结束时间
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateTaskTime(String taskId, String startDate, String endDate);
|
||||
}
|
|
@ -27,6 +27,11 @@ public interface ProjectMemberService extends IService<ProjectMemberEntity> {
|
|||
*/
|
||||
ProjectMemberResp updateTeamMember(String memberId, TeamMemberReq req);
|
||||
|
||||
/**
|
||||
* 更新团队成员信息(使用更新专用请求类)
|
||||
*/
|
||||
ProjectMemberResp updateTeamMember(String memberId, TeamMemberUpdateReq req);
|
||||
|
||||
/**
|
||||
* 删除团队成员(支持单个或批量删除)
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
import com.dite.znpt.domain.entity.VideoMonitorEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 视频信息 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hdc
|
||||
* @since 2025-08-07
|
||||
*/
|
||||
public interface VideoMonitorService extends IService<VideoMonitorEntity> {
|
||||
/**
|
||||
* 批量上传视频
|
||||
*/
|
||||
List<VideoMonitorEntity> uploadBatch(String projectId,
|
||||
String partId,
|
||||
String type,
|
||||
MultipartFile[] files) throws IOException;
|
||||
|
||||
/**
|
||||
* 单文件上传
|
||||
*/
|
||||
VideoMonitorEntity upload(String projectId,
|
||||
String partId,
|
||||
String type,
|
||||
MultipartFile file) throws IOException;
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
*/
|
||||
PageResult<VideoMonitorEntity> page(Integer pageNo,
|
||||
Integer pageSize,
|
||||
String projectId,
|
||||
String partId);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
List<VideoMonitorEntity> list(String projectId, String partId);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
void delete(String videoId);
|
||||
|
||||
/**
|
||||
* 下载/播放
|
||||
*/
|
||||
void download(String videoId, HttpServletResponse response) throws IOException;
|
||||
|
||||
}
|
|
@ -52,18 +52,37 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService {
|
|||
private BusinessDataService businessDataService;
|
||||
|
||||
|
||||
@ApiOperation("分页查询文件")
|
||||
@Override
|
||||
public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId, fileName);
|
||||
Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list;
|
||||
PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
|
||||
return pageBean;
|
||||
}
|
||||
// @ApiOperation("分页查询文件")
|
||||
// @Override
|
||||
// public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName) {
|
||||
// PageHelper.startPage(page, pageSize);
|
||||
// List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId, fileName);
|
||||
// Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list;
|
||||
// PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
|
||||
// return pageBean;
|
||||
// }
|
||||
// @ApiOperation("分页查询文件")
|
||||
// @Override
|
||||
// public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName, String sortField, String sortOrder) {
|
||||
// PageHelper.startPage(page, pageSize);
|
||||
// List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId, fileName, sortField, sortOrder);
|
||||
// Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list;
|
||||
// PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
|
||||
// return pageBean;
|
||||
// }
|
||||
@ApiOperation("分页查询文件")
|
||||
@Override
|
||||
public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName, String sortField, String sortOrder) {
|
||||
PageHelper.startPage(page, pageSize);
|
||||
List<BusinessDataFileEntity> list = businessDataFileMapper.List(folderId, fileName, sortField, sortOrder);
|
||||
Page<BusinessDataFileEntity> p = (Page<BusinessDataFileEntity>) list;
|
||||
PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
|
||||
return pageBean;
|
||||
}
|
||||
@ApiOperation("删除文件")
|
||||
public Result delete(Long fileId, Long folderId) {
|
||||
//删除数据库数据
|
||||
//删除文件夹时候,调用这个方法,才会删除所有文件的数据库数据,
|
||||
// 至于具体文件,不用在这个方法删除
|
||||
if (folderId != null){
|
||||
businessDataFileMapper.delete(null,folderId);
|
||||
return Result.okM("删除成功");
|
||||
|
@ -137,8 +156,11 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService {
|
|||
}
|
||||
|
||||
// 构建新文件路径
|
||||
// 获取父目录
|
||||
String parentPath = oldFile.getParent();
|
||||
// 获取文件扩展名
|
||||
String fileExtension = "";
|
||||
// 获取文件名(不包含扩展名)
|
||||
String fileNameWithoutExt = newFileName;
|
||||
|
||||
// 获取原文件扩展名
|
||||
|
@ -228,7 +250,7 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService {
|
|||
byte[] bytes = file.getBytes();
|
||||
String uploadDir = businessDataService.getPath(folderId);
|
||||
|
||||
File uploadedFile = new File(uploadDir + "\\" + file.getOriginalFilename());
|
||||
File uploadedFile = new File(uploadDir + File.separator + file.getOriginalFilename());
|
||||
if (uploadedFile.exists()) {
|
||||
return Result.error("文件已存在");
|
||||
}
|
||||
|
@ -238,12 +260,11 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService {
|
|||
BusinessDataFileEntity fileEntity = new BusinessDataFileEntity();
|
||||
fileEntity.setFolderId(folderId);
|
||||
fileEntity.setFileName(file.getOriginalFilename());
|
||||
fileEntity.setFilePath(uploadDir + "\\" + file.getOriginalFilename());
|
||||
fileEntity.setFilePath(uploadDir + File.separator + file.getOriginalFilename());
|
||||
fileEntity.setFileType(file.getContentType());
|
||||
fileEntity.setFileSize(file.getSize()/1024);
|
||||
fileEntity.setUploadTime(new Date());
|
||||
fileEntity.setUploaderId(loginIdAsLong);
|
||||
System.out.println(uploadDir + "\\" + file.getOriginalFilename());
|
||||
add(fileEntity);
|
||||
|
||||
return Result.okM("上传成功");
|
||||
|
@ -527,4 +548,21 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService {
|
|||
}
|
||||
}
|
||||
|
||||
// @ApiOperation("批量更新文件路径")
|
||||
// @Override
|
||||
// public void updateFilePathByFolderId(Long folderId, String newFolderPath) {
|
||||
// businessDataFileMapper.updateFilePathByFolderId(folderId, newFolderPath, File.separator);
|
||||
// }
|
||||
|
||||
@ApiOperation("批量更新子文件夹下文件的路径")
|
||||
@Override
|
||||
public void updateSubFilePaths(String oldParentPath1, String newParentPath1) {
|
||||
// 处理路径中的分隔符,如果是反斜杠则替换为双反斜杠
|
||||
String oldParentPath2 = oldParentPath1;
|
||||
if ("\\".equals(File.separator)) {
|
||||
oldParentPath2 = oldParentPath1.replace("\\", "\\\\");
|
||||
}
|
||||
businessDataFileMapper.updateSubFilePaths(oldParentPath1, newParentPath1, oldParentPath2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class BusinessDataServiceImpl implements BusinessDataService {
|
|||
}
|
||||
|
||||
// 文件夹名称前置一个/
|
||||
String folderName1 = "/" + folderName;
|
||||
String folderName1 = File.separator + folderName;
|
||||
// 目标文件夹
|
||||
File targetDir = Paths.get(businessDataPath, folderName1).toFile();
|
||||
if (parentId != 0L) {
|
||||
|
@ -147,23 +147,37 @@ public class BusinessDataServiceImpl implements BusinessDataService {
|
|||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量更新子文件夹路径")
|
||||
@Override
|
||||
public void updateSubFolderPaths(String oldParentPath1, String newParentPath1,Long folderId) {
|
||||
// 处理路径中的分隔符,如果是反斜杠则替换为双反斜杠
|
||||
String processedOldParentPath = oldParentPath1;
|
||||
String processedNewParentPath = newParentPath1;
|
||||
if ("\\".equals(File.separator)) {
|
||||
processedOldParentPath = oldParentPath1.replace("\\", "\\\\");
|
||||
processedNewParentPath = newParentPath1.replace("\\", "\\\\");
|
||||
}
|
||||
|
||||
businessDataMapper.updateSubFolderPaths(oldParentPath1,newParentPath1,processedOldParentPath, processedNewParentPath, folderId);
|
||||
}
|
||||
@ApiOperation("重命名文件夹")
|
||||
@Override
|
||||
public Result reName(Long folderId, String newName) {
|
||||
// 获取文件夹路径
|
||||
String folderPath = businessDataMapper.getPath(folderId);
|
||||
String newPath = folderPath.substring(0, folderPath.lastIndexOf('\\')) + "\\" + newName;
|
||||
//
|
||||
// //想命名的原文件的路径
|
||||
// File file = new File("f:/a/a.xlsx");
|
||||
// //将原文件更改为f:\a\b.xlsx,其中路径是必要的。注意
|
||||
// file.renameTo(new File("f:/a/b.xlsx"));
|
||||
// 想命名的原文件夹的路径
|
||||
String newPath = folderPath.substring(0, folderPath.lastIndexOf(File.separator)) + File.separator + newName;
|
||||
|
||||
// 重命名物理文件夹
|
||||
File file1 = new File(folderPath);
|
||||
// 将原文件夹更改为A,其中路径是必要的。注意
|
||||
file1.renameTo(new File(newPath));
|
||||
boolean renameSuccess = file1.renameTo(new File(newPath));
|
||||
|
||||
if (!renameSuccess) {
|
||||
return Result.error("文件夹重命名失败");
|
||||
}
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 更新文件夹信息
|
||||
BusinessDataEntity businessDataEntity = new BusinessDataEntity(
|
||||
folderId,
|
||||
newName,
|
||||
|
@ -174,6 +188,21 @@ public class BusinessDataServiceImpl implements BusinessDataService {
|
|||
null,
|
||||
newPath);
|
||||
businessDataMapper.reName(businessDataEntity);
|
||||
|
||||
// // 批量更新该文件夹下所有文件的路径
|
||||
// businessDataFileService.updateFilePathByFolderId(folderId, newPath);
|
||||
|
||||
|
||||
String folderPath1 = folderPath+File.separator;
|
||||
String newPath1 = newPath+File.separator;
|
||||
|
||||
// 批量更新子文件夹下所有文件的路径
|
||||
businessDataFileService.updateSubFilePaths(folderPath1, newPath1);
|
||||
// 批量更新子文件夹的路径
|
||||
updateSubFolderPaths(folderPath1, newPath1,folderId);
|
||||
|
||||
return Result.okM("重命名成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.dite.znpt.domain.entity.VideoMonitorEntity;
|
||||
import com.dite.znpt.enums.FilePathEnum;
|
||||
import com.dite.znpt.util.PythonUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class ClearanceTask implements Runnable {
|
||||
|
||||
private final String videoAbsolutePath; // 上传后的完整磁盘路径
|
||||
private final String outputDir; // 结果目录
|
||||
private final String videoId; // 数据库主键,用于更新状态
|
||||
private final VideoMonitorServiceImpl service;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// 1. 调用 Python(阻塞,但跑在子线程)
|
||||
PythonUtil.runClearance(videoAbsolutePath,outputDir);
|
||||
// 2. 更新数据库:status = 已完成 / 预处理成功
|
||||
VideoMonitorEntity update = new VideoMonitorEntity();
|
||||
update.setVideoId(videoId);
|
||||
update.setPreTreatment(true); // 或自定义状态字段
|
||||
update.setPreImagePath(FilePathEnum.VIDEO.getFileDownPath(outputDir));
|
||||
File resultFile = new File(outputDir, "results.json");
|
||||
if (!resultFile.exists()) {
|
||||
throw new IllegalStateException("results.json 不存在");
|
||||
}
|
||||
String jsonStr = FileUtil.readString(resultFile, StandardCharsets.UTF_8);
|
||||
|
||||
// 3. 转成 hutool 的 JSONObject(对应 MySQL 的 JSON 字段)
|
||||
JSONObject jsonObj = JSONUtil.parseObj(jsonStr);
|
||||
update.setExtra(jsonObj);
|
||||
service.updateById(update);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 失败时可将 status 置为失败
|
||||
VideoMonitorEntity update = new VideoMonitorEntity();
|
||||
update.setVideoId(videoId);
|
||||
update.setStatus((byte) -1); // 自定义失败码
|
||||
service.updateById(update);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,10 @@ import com.dite.znpt.domain.vo.EquipmentApprovalReq;
|
|||
import com.dite.znpt.domain.vo.EquipmentApprovalResp;
|
||||
import com.dite.znpt.domain.vo.EquipmentProcurementApplyReq;
|
||||
import com.dite.znpt.service.EquipmentApprovalService;
|
||||
import com.dite.znpt.service.EquipmentStatusUpdateService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import com.dite.znpt.websocket.SimpleWebSocketHandler;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -34,13 +37,22 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
|
||||
@Resource
|
||||
private EquipmentApprovalMapper equipmentApprovalMapper;
|
||||
|
||||
@Resource
|
||||
private EquipmentStatusUpdateService equipmentStatusUpdateService;
|
||||
|
||||
@Override
|
||||
public IPage<EquipmentApprovalResp> getPendingApprovals(EquipmentApprovalListReq req) {
|
||||
// 创建分页对象,处理null值
|
||||
Integer pageNum = req.getPage() != null ? req.getPage() : 1;
|
||||
log.info("开始执行待审批设备分页查询,请求参数: {}", req);
|
||||
|
||||
// 获取分页参数
|
||||
Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1;
|
||||
Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10;
|
||||
Page<EquipmentApprovalEntity> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize);
|
||||
|
||||
// 使用分页插件
|
||||
PageUtil.startPage();
|
||||
|
||||
LambdaQueryWrapper<EquipmentApprovalEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(EquipmentApprovalEntity::getApprovalStatus, "PENDING");
|
||||
|
@ -48,17 +60,38 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
// 添加查询条件
|
||||
addQueryConditions(wrapper, req);
|
||||
|
||||
IPage<EquipmentApprovalEntity> result = equipmentApprovalMapper.selectPage(page, wrapper);
|
||||
// 执行查询
|
||||
List<EquipmentApprovalEntity> approvalList = equipmentApprovalMapper.selectList(wrapper);
|
||||
|
||||
return convertToRespPage(result);
|
||||
// 转换为响应对象
|
||||
List<EquipmentApprovalResp> respList = approvalList.stream()
|
||||
.map(this::convertToResp)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取分页信息
|
||||
PageInfo<EquipmentApprovalEntity> pageInfo = new PageInfo<>(approvalList);
|
||||
|
||||
log.info("待审批设备分页查询完成,共查询 {} 条记录,当前页码: {}, 总页码: {}", pageInfo.getTotal(), pageInfo.getPageNum(), pageInfo.getPages());
|
||||
|
||||
// 创建响应分页对象
|
||||
Page<EquipmentApprovalResp> result = new Page<>(pageNum, pageSize, pageInfo.getTotal());
|
||||
result.setRecords(respList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<EquipmentApprovalResp> getApprovedApprovals(EquipmentApprovalListReq req) {
|
||||
// 创建分页对象,处理null值
|
||||
Integer pageNum = req.getPage() != null ? req.getPage() : 1;
|
||||
log.info("开始执行已审批设备分页查询,请求参数: {}", req);
|
||||
|
||||
// 获取分页参数
|
||||
Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1;
|
||||
Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10;
|
||||
Page<EquipmentApprovalEntity> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize);
|
||||
|
||||
// 使用分页插件
|
||||
PageUtil.startPage();
|
||||
|
||||
LambdaQueryWrapper<EquipmentApprovalEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(EquipmentApprovalEntity::getApprovalStatus, "APPROVED", "REJECTED");
|
||||
|
@ -66,9 +99,24 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
// 添加查询条件
|
||||
addQueryConditions(wrapper, req);
|
||||
|
||||
IPage<EquipmentApprovalEntity> result = equipmentApprovalMapper.selectPage(page, wrapper);
|
||||
// 执行查询
|
||||
List<EquipmentApprovalEntity> approvalList = equipmentApprovalMapper.selectList(wrapper);
|
||||
|
||||
return convertToRespPage(result);
|
||||
// 转换为响应对象
|
||||
List<EquipmentApprovalResp> respList = approvalList.stream()
|
||||
.map(this::convertToResp)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取分页信息
|
||||
PageInfo<EquipmentApprovalEntity> pageInfo = new PageInfo<>(approvalList);
|
||||
|
||||
log.info("已审批设备分页查询完成,共查询 {} 条记录,当前页码: {}, 总页码: {}", pageInfo.getTotal(), pageInfo.getPageNum(), pageInfo.getPages());
|
||||
|
||||
// 创建响应分页对象
|
||||
Page<EquipmentApprovalResp> result = new Page<>(pageNum, pageSize, pageInfo.getTotal());
|
||||
result.setRecords(respList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -85,6 +133,21 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
entity.setApprovalComment(req.getApprovalComment());
|
||||
|
||||
equipmentApprovalMapper.updateById(entity);
|
||||
|
||||
// 审批通过后,更新设备状态
|
||||
try {
|
||||
if ("PROCUREMENT".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateProcurementStatus(entity.getEquipmentId(), "APPROVED");
|
||||
} else if ("BORROW".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateBorrowStatus(entity.getEquipmentId(), "APPROVED");
|
||||
} else if ("RETURN".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateReturnStatus(entity.getEquipmentId(), "APPROVED");
|
||||
}
|
||||
log.info("设备状态更新成功,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId);
|
||||
} catch (Exception e) {
|
||||
log.error("设备状态更新失败,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId, e);
|
||||
// 不抛出异常,避免影响审批流程
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,6 +164,21 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
entity.setApprovalComment(req.getApprovalComment());
|
||||
|
||||
equipmentApprovalMapper.updateById(entity);
|
||||
|
||||
// 审批拒绝后,更新设备状态
|
||||
try {
|
||||
if ("PROCUREMENT".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateProcurementStatus(entity.getEquipmentId(), "REJECTED");
|
||||
} else if ("BORROW".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateBorrowStatus(entity.getEquipmentId(), "REJECTED");
|
||||
} else if ("RETURN".equals(entity.getBusinessType())) {
|
||||
equipmentStatusUpdateService.updateReturnStatus(entity.getEquipmentId(), "REJECTED");
|
||||
}
|
||||
log.info("设备状态更新成功,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId);
|
||||
} catch (Exception e) {
|
||||
log.error("设备状态更新失败,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId, e);
|
||||
// 不抛出异常,避免影响审批流程
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -262,6 +340,15 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
// 保存到数据库
|
||||
equipmentApprovalMapper.insert(entity);
|
||||
|
||||
// 更新设备采购状态 - 新增逻辑
|
||||
try {
|
||||
equipmentStatusUpdateService.updateProcurementStatus(req.getEquipmentId(), "PENDING_APPROVAL");
|
||||
log.info("设备采购状态更新成功,设备ID: {}", req.getEquipmentId());
|
||||
} catch (Exception e) {
|
||||
log.error("设备采购状态更新失败,设备ID: {}", req.getEquipmentId(), e);
|
||||
// 不抛出异常,避免影响审批流程
|
||||
}
|
||||
|
||||
// 发送通知 - 使用日志记录,后续可以扩展为WebSocket通知
|
||||
log.info("采购申请提交成功,设备名称: {}, 申请人: {}",
|
||||
req.getEquipmentName(), getCurrentUserName());
|
||||
|
@ -279,16 +366,147 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
|
||||
log.info("采购申请提交成功,审批ID: {}", entity.getApprovalId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备采购状态
|
||||
*/
|
||||
private void updateEquipmentProcurementStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("准备更新设备采购状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
|
||||
// 这里可以添加具体的更新逻辑
|
||||
// 例如:equipmentMapper.updateProcurementStatus(equipmentId, status);
|
||||
// 由于循环依赖问题,建议通过事件机制或异步处理来避免循环依赖
|
||||
|
||||
// 暂时记录日志,后续可以通过以下方式实现:
|
||||
// 1. 使用Spring事件机制
|
||||
// 2. 使用异步处理
|
||||
// 3. 重构服务架构避免循环依赖
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备采购状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 审批通过后更新设备状态
|
||||
*/
|
||||
private void updateEquipmentStatusAfterApproval(EquipmentApprovalEntity entity) {
|
||||
if (entity == null || entity.getEquipmentId() == null) {
|
||||
log.warn("审批实体或设备ID为空,跳过状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("审批通过后更新设备状态,设备ID: {}, 业务类型: {}", entity.getEquipmentId(), entity.getBusinessType());
|
||||
|
||||
// 根据业务类型更新不同的设备状态
|
||||
if ("PROCUREMENT".equals(entity.getBusinessType())) {
|
||||
// 采购审批通过,更新设备状态为已采购
|
||||
updateEquipmentProcurementStatus(entity.getEquipmentId(), "APPROVED");
|
||||
} else if ("BORROW".equals(entity.getBusinessType())) {
|
||||
// 借用审批通过,更新设备状态为已借用
|
||||
updateEquipmentBorrowStatus(entity.getEquipmentId(), "APPROVED");
|
||||
} else if ("RETURN".equals(entity.getBusinessType())) {
|
||||
// 归还审批通过,更新设备状态为已归还
|
||||
updateEquipmentReturnStatus(entity.getEquipmentId(), "APPROVED");
|
||||
}
|
||||
|
||||
log.info("设备状态更新成功,设备ID: {}", entity.getEquipmentId());
|
||||
} catch (Exception e) {
|
||||
log.error("审批通过后更新设备状态失败,设备ID: {}", entity.getEquipmentId(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批拒绝后更新设备状态
|
||||
*/
|
||||
private void updateEquipmentStatusAfterRejection(EquipmentApprovalEntity entity) {
|
||||
if (entity == null || entity.getEquipmentId() == null) {
|
||||
log.warn("审批实体或设备ID为空,跳过状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("审批拒绝后更新设备状态,设备ID: {}, 业务类型: {}", entity.getEquipmentId(), entity.getBusinessType());
|
||||
|
||||
// 根据业务类型更新不同的设备状态
|
||||
if ("PROCUREMENT".equals(entity.getBusinessType())) {
|
||||
// 采购审批拒绝,更新设备状态为审批拒绝
|
||||
updateEquipmentProcurementStatus(entity.getEquipmentId(), "REJECTED");
|
||||
} else if ("BORROW".equals(entity.getBusinessType())) {
|
||||
// 借用审批拒绝,更新设备状态为借用拒绝
|
||||
updateEquipmentBorrowStatus(entity.getEquipmentId(), "REJECTED");
|
||||
} else if ("RETURN".equals(entity.getBusinessType())) {
|
||||
// 归还审批拒绝,更新设备状态为归还拒绝
|
||||
updateEquipmentReturnStatus(entity.getEquipmentId(), "REJECTED");
|
||||
}
|
||||
|
||||
log.info("设备状态更新成功,设备ID: {}", entity.getEquipmentId());
|
||||
} catch (Exception e) {
|
||||
log.error("审批拒绝后更新设备状态失败,设备ID: {}", entity.getEquipmentId(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备借用状态
|
||||
*/
|
||||
private void updateEquipmentBorrowStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过借用状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("准备更新设备借用状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
// 这里可以添加具体的更新逻辑
|
||||
// 例如:equipmentMapper.updateBorrowStatus(equipmentId, status);
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备借用状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备归还状态
|
||||
*/
|
||||
private void updateEquipmentReturnStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过归还状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("准备更新设备归还状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
// 这里可以添加具体的更新逻辑
|
||||
// 例如:equipmentMapper.updateReturnStatus(equipmentId, status);
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备归还状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<EquipmentApprovalResp> getMyProcurementApplications(EquipmentApprovalListReq req) {
|
||||
log.info("开始获取我的采购申请,请求参数: {}", req);
|
||||
|
||||
// 创建分页对象
|
||||
Integer pageNum = req.getPage() != null ? req.getPage() : 1;
|
||||
// 创建分页对象 - 使用pageNum保持一致性
|
||||
Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1;
|
||||
Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10;
|
||||
Page<EquipmentApprovalEntity> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize);
|
||||
|
||||
LambdaQueryWrapper<EquipmentApprovalEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 只查询当前用户的申请
|
||||
|
@ -300,6 +518,8 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
|
||||
IPage<EquipmentApprovalEntity> result = equipmentApprovalMapper.selectPage(page, wrapper);
|
||||
|
||||
log.info("我的采购申请分页查询完成,共查询 {} 条记录,当前页码: {}, 总页码: {}", result.getTotal(), result.getCurrent(), result.getPages());
|
||||
|
||||
return convertToRespPage(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,14 +16,20 @@ import com.dite.znpt.enums.LocationStatusEnum;
|
|||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.EquipmentMapper;
|
||||
import com.dite.znpt.service.EquipmentService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import com.dite.znpt.domain.vo.ReceiptRequest;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -38,10 +44,14 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
public IPage<EquipmentResp> page(EquipmentListReq req) {
|
||||
log.info("开始执行设备分页查询,请求参数: {}", req);
|
||||
|
||||
// 创建分页对象,处理null值
|
||||
Integer pageNum = req.getPage() != null ? req.getPage() : (req.getPageNum() != null ? req.getPageNum() : 1);
|
||||
// 获取分页参数
|
||||
Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1;
|
||||
Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10;
|
||||
Page<EquipmentEntity> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize);
|
||||
|
||||
// 使用分页插件
|
||||
PageUtil.startPage();
|
||||
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -117,9 +127,14 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
log.info("添加物理位置查询条件: {}", req.getPhysicalLocation());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getSupplierName())) {
|
||||
queryWrapper.like(EquipmentEntity::getSupplierName, req.getSupplierName());
|
||||
log.info("添加供应商名称查询条件: {}", req.getSupplierName());
|
||||
if (StringUtils.hasText(req.getUsingDepartment())) {
|
||||
queryWrapper.like(EquipmentEntity::getUsingDepartment, req.getUsingDepartment());
|
||||
log.info("添加使用部门查询条件: {}", req.getUsingDepartment());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getPurchaseOrder())) {
|
||||
queryWrapper.like(EquipmentEntity::getPurchaseOrder, req.getPurchaseOrder());
|
||||
log.info("添加采购订单查询条件: {}", req.getPurchaseOrder());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getMaintenancePerson())) {
|
||||
|
@ -127,40 +142,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
log.info("添加维护人员查询条件: {}", req.getMaintenancePerson());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getInventoryBarcode())) {
|
||||
queryWrapper.like(EquipmentEntity::getInventoryBarcode, req.getInventoryBarcode());
|
||||
log.info("添加库存条码查询条件: {}", req.getInventoryBarcode());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getAssetRemark())) {
|
||||
queryWrapper.like(EquipmentEntity::getAssetRemark, req.getAssetRemark());
|
||||
log.info("添加资产备注查询条件: {}", req.getAssetRemark());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 新增字段查询条件
|
||||
if (StringUtils.hasText(req.getUsingDepartment())) {
|
||||
queryWrapper.like(EquipmentEntity::getUsingDepartment, req.getUsingDepartment());
|
||||
log.info("添加使用部门/人查询条件: {}", req.getUsingDepartment());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getInvoice())) {
|
||||
queryWrapper.like(EquipmentEntity::getInvoice, req.getInvoice());
|
||||
log.info("添加发票查询条件: {}", req.getInvoice());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getBarcode())) {
|
||||
queryWrapper.like(EquipmentEntity::getBarcode, req.getBarcode());
|
||||
log.info("添加条码查询条件: {}", req.getBarcode());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getImporter())) {
|
||||
queryWrapper.like(EquipmentEntity::getImporter, req.getImporter());
|
||||
log.info("添加导入人查询条件: {}", req.getImporter());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 新增采购相关字段查询条件
|
||||
if (StringUtils.hasText(req.getAccountNumber())) {
|
||||
queryWrapper.like(EquipmentEntity::getAccountNumber, req.getAccountNumber());
|
||||
log.info("添加次户号查询条件: {}", req.getAccountNumber());
|
||||
|
@ -270,88 +251,15 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
|
||||
log.info("总共添加了 {} 个查询条件", conditionCount);
|
||||
|
||||
// 排序处理
|
||||
// 处理排序
|
||||
if (StringUtils.hasText(req.getOrderBy())) {
|
||||
String orderBy = req.getOrderBy();
|
||||
String orderDirection = "desc".equalsIgnoreCase(req.getOrderDirection()) ? "desc" : "asc";
|
||||
|
||||
switch (orderBy.toLowerCase()) {
|
||||
case "equipment_name":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentName);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentName);
|
||||
}
|
||||
break;
|
||||
case "equipment_sn":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentSn);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentSn);
|
||||
}
|
||||
break;
|
||||
case "asset_code":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getAssetCode);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getAssetCode);
|
||||
}
|
||||
break;
|
||||
case "equipment_type":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentType);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentType);
|
||||
}
|
||||
break;
|
||||
case "equipment_status":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getEquipmentStatus);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getEquipmentStatus);
|
||||
}
|
||||
break;
|
||||
case "brand":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getBrand);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getBrand);
|
||||
}
|
||||
break;
|
||||
case "responsible_person":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getResponsiblePerson);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getResponsiblePerson);
|
||||
}
|
||||
break;
|
||||
case "purchase_time":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getPurchaseTime);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getPurchaseTime);
|
||||
}
|
||||
break;
|
||||
case "purchase_price":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getTotalPrice);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getTotalPrice);
|
||||
}
|
||||
break;
|
||||
case "update_time":
|
||||
if ("desc".equals(orderDirection)) {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getUpdateTime);
|
||||
} else {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getUpdateTime);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// 默认按创建时间倒序
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getCreateTime);
|
||||
break;
|
||||
if ("asc".equalsIgnoreCase(req.getOrderDirection())) {
|
||||
queryWrapper.orderByAsc(EquipmentEntity::getCreateTime);
|
||||
log.info("使用升序排序: {}", req.getOrderBy());
|
||||
} else {
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getCreateTime);
|
||||
log.info("使用降序排序: {}", req.getOrderBy());
|
||||
}
|
||||
log.info("添加排序条件: {} {}", orderBy, orderDirection);
|
||||
} else {
|
||||
// 默认按创建时间倒序
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getCreateTime);
|
||||
|
@ -360,18 +268,23 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
|
||||
log.info("执行分页查询,SQL条件: {}", queryWrapper.getTargetSql());
|
||||
|
||||
// 执行分页查询
|
||||
IPage<EquipmentEntity> equipmentPage = this.page(page, queryWrapper);
|
||||
|
||||
log.info("查询完成,总记录数: {}, 当前页记录数: {}", equipmentPage.getTotal(), equipmentPage.getRecords().size());
|
||||
// 执行查询
|
||||
List<EquipmentEntity> equipmentList = this.list(queryWrapper);
|
||||
|
||||
log.info("查询完成,当前页记录数: {}, 总记录数: {}",
|
||||
equipmentList.size());
|
||||
|
||||
// 转换为响应对象
|
||||
List<EquipmentResp> equipmentRespList = equipmentPage.getRecords().stream()
|
||||
List<EquipmentResp> equipmentRespList = equipmentList.stream()
|
||||
.map(this::convertToResp)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 创建响应分页对象
|
||||
Page<EquipmentResp> respPage = new Page<>(equipmentPage.getCurrent(), equipmentPage.getSize(), equipmentPage.getTotal());
|
||||
// 获取分页信息 - 使用正确的实体类型
|
||||
PageInfo<EquipmentEntity> pageInfo = new PageInfo<>(equipmentList);
|
||||
|
||||
log.info("获取总数: {}", pageInfo.getTotal());
|
||||
// 创建响应分页对象 - 使用正确的分页参数
|
||||
Page<EquipmentResp> respPage = new Page<>(pageNum, pageSize, pageInfo.getTotal());
|
||||
respPage.setRecords(equipmentRespList);
|
||||
|
||||
return respPage;
|
||||
|
@ -562,6 +475,18 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
resp.setInventoryBasis(entity.getInventoryBasis());
|
||||
resp.setDynamicRecord(entity.getDynamicRecord());
|
||||
|
||||
// 设置采购状态字段
|
||||
resp.setProcurementStatus(entity.getProcurementStatus());
|
||||
|
||||
// 设置收货状态和支付状态字段
|
||||
resp.setReceiptStatus(entity.getReceiptStatus());
|
||||
resp.setPaymentStatus(entity.getPaymentStatus());
|
||||
|
||||
// 设置审批状态(根据采购状态推断)
|
||||
// 这里需要注入 EquipmentApprovalService 来获取审批状态
|
||||
// 暂时根据采购状态推断,后续通过关联查询获取
|
||||
resp.setApprovalStatus(getApprovalStatus(entity.getEquipmentId(), entity.getProcurementStatus()));
|
||||
|
||||
// 新增字段转换
|
||||
resp.setUsingDepartment(entity.getUsingDepartment());
|
||||
resp.setBorrowingTime(entity.getBorrowingTime());
|
||||
|
@ -588,16 +513,48 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备的审批状态
|
||||
*/
|
||||
private String getApprovalStatus(String equipmentId, String procurementStatus) {
|
||||
try {
|
||||
// 根据采购状态推断审批状态
|
||||
if (procurementStatus == null) {
|
||||
return "PENDING_APPROVAL";
|
||||
}
|
||||
|
||||
switch (procurementStatus) {
|
||||
case "PENDING_APPROVAL":
|
||||
return "PENDING";
|
||||
case "APPROVED":
|
||||
return "APPROVED";
|
||||
case "REJECTED":
|
||||
return "REJECTED";
|
||||
case "COMPLETED":
|
||||
return "APPROVED"; // 已完成表示之前已审批通过
|
||||
default:
|
||||
return "PENDING_APPROVAL";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取设备审批状态失败,设备ID: {}, 错误: {}", equipmentId, e.getMessage());
|
||||
return "PENDING_APPROVAL"; // 出错时返回待审批状态
|
||||
}
|
||||
}
|
||||
|
||||
// 采购管理相关方法实现
|
||||
@Override
|
||||
public IPage<EquipmentResp> procurementPage(EquipmentListReq req) {
|
||||
log.info("开始执行设备采购记录分页查询,请求参数: {}", req);
|
||||
|
||||
// 创建分页对象,处理null值
|
||||
Integer pageNum = req.getPage() != null ? req.getPage() : (req.getPageNum() != null ? req.getPageNum() : 1);
|
||||
// 获取分页参数
|
||||
Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1;
|
||||
Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10;
|
||||
Page<EquipmentEntity> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize);
|
||||
|
||||
// 使用分页插件
|
||||
PageUtil.startPage();
|
||||
|
||||
// 构建查询条件,参考设备分页查询的逻辑
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -621,14 +578,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
log.info("添加设备状态查询条件: {}", req.getEquipmentStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentSn())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentSn, req.getEquipmentSn());
|
||||
log.info("添加设备序列号查询条件: {}", req.getEquipmentSn());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getAssetCode())) {
|
||||
queryWrapper.like(EquipmentEntity::getAssetCode, req.getAssetCode());
|
||||
log.info("添加资产编号查询条件: {}", req.getAssetCode());
|
||||
if (StringUtils.hasText(req.getEquipmentModel())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentModel, req.getEquipmentModel());
|
||||
log.info("添加设备型号查询条件: {}", req.getEquipmentModel());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getBrand())) {
|
||||
|
@ -636,19 +588,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
log.info("添加品牌查询条件: {}", req.getBrand());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getLocationStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getLocationStatus, req.getLocationStatus());
|
||||
log.info("添加位置状态查询条件: {}", req.getLocationStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getHealthStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getHealthStatus, req.getHealthStatus());
|
||||
log.info("添加健康状态查询条件: {}", req.getHealthStatus());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getResponsiblePerson())) {
|
||||
queryWrapper.like(EquipmentEntity::getResponsiblePerson, req.getResponsiblePerson());
|
||||
log.info("添加负责人查询条件: {}", req.getResponsiblePerson());
|
||||
if (StringUtils.hasText(req.getSupplierName())) {
|
||||
queryWrapper.like(EquipmentEntity::getSupplierName, req.getSupplierName());
|
||||
log.info("添加供应商名称查询条件: {}", req.getSupplierName());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getPhysicalLocation())) {
|
||||
|
@ -656,16 +598,24 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
log.info("添加物理位置查询条件: {}", req.getPhysicalLocation());
|
||||
conditionCount++;
|
||||
}
|
||||
|
||||
// 添加采购相关的搜索条件
|
||||
if (StringUtils.hasText(req.getUsingDepartment())) {
|
||||
queryWrapper.like(EquipmentEntity::getUsingDepartment, req.getUsingDepartment());
|
||||
log.info("添加使用部门查询条件: {}", req.getUsingDepartment());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getResponsiblePerson())) {
|
||||
queryWrapper.like(EquipmentEntity::getResponsiblePerson, req.getResponsiblePerson());
|
||||
log.info("添加负责人查询条件: {}", req.getResponsiblePerson());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getPurchaseOrder())) {
|
||||
queryWrapper.like(EquipmentEntity::getPurchaseOrder, req.getPurchaseOrder());
|
||||
log.info("添加采购订单查询条件: {}", req.getPurchaseOrder());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getSupplierName())) {
|
||||
queryWrapper.like(EquipmentEntity::getSupplierName, req.getSupplierName());
|
||||
log.info("添加供应商查询条件: {}", req.getSupplierName());
|
||||
if (StringUtils.hasText(req.getMaintenancePerson())) {
|
||||
queryWrapper.like(EquipmentEntity::getMaintenancePerson, req.getMaintenancePerson());
|
||||
log.info("添加维护人员查询条件: {}", req.getMaintenancePerson());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getAccountNumber())) {
|
||||
|
@ -688,6 +638,11 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
log.info("添加总价查询条件: {}", req.getTotalPrice());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentSn())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentSn, req.getEquipmentSn());
|
||||
log.info("添加设备序列号查询条件: {}", req.getEquipmentSn());
|
||||
conditionCount++;
|
||||
}
|
||||
if (StringUtils.hasText(req.getInventoryBasis())) {
|
||||
queryWrapper.like(EquipmentEntity::getInventoryBasis, req.getInventoryBasis());
|
||||
log.info("添加盘点依据查询条件: {}", req.getInventoryBasis());
|
||||
|
@ -699,25 +654,34 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
conditionCount++;
|
||||
}
|
||||
|
||||
// 添加采购状态查询条件 - 确保查询有采购状态的设备
|
||||
queryWrapper.isNotNull(EquipmentEntity::getProcurementStatus);
|
||||
log.info("添加采购状态查询条件: 不为空");
|
||||
conditionCount++;
|
||||
|
||||
log.info("总共添加了 {} 个查询条件", conditionCount);
|
||||
|
||||
// 按采购时间倒序排列
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getPurchaseTime);
|
||||
|
||||
// 执行查询
|
||||
IPage<EquipmentEntity> result = this.page(page, queryWrapper);
|
||||
List<EquipmentEntity> equipmentList = this.list(queryWrapper);
|
||||
|
||||
// 转换为响应对象
|
||||
List<EquipmentResp> records = result.getRecords().stream()
|
||||
List<EquipmentResp> records = equipmentList.stream()
|
||||
.map(this::convertToResp)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 创建新的分页结果
|
||||
Page<EquipmentResp> respPage = new Page<>(result.getCurrent(), result.getSize(), result.getTotal());
|
||||
respPage.setRecords(records);
|
||||
// 获取分页信息 - 使用正确的实体类型
|
||||
PageInfo<EquipmentEntity> pageInfo = new PageInfo<>(equipmentList);
|
||||
|
||||
log.info("设备采购记录分页查询完成,总记录数: {}", result.getTotal());
|
||||
return respPage;
|
||||
log.info("设备采购分页查询完成,共查询 {} 条记录,当前页码: {}, 总页码: {}", pageInfo.getTotal(), pageInfo.getPageNum(), pageInfo.getPages());
|
||||
|
||||
// 创建响应分页对象 - 使用正确的分页参数
|
||||
Page<EquipmentResp> result = new Page<>(pageNum, pageSize, pageInfo.getTotal());
|
||||
result.setRecords(records);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -750,11 +714,12 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateProcurement(String equipmentId, EquipmentReq req) {
|
||||
log.info("开始修改设备采购记录,设备ID: {}, 请求参数: {}", equipmentId, req);
|
||||
// 实现更新设备采购记录的逻辑
|
||||
log.info("更新设备采购记录,设备ID: {}, 请求参数: {}", equipmentId, req);
|
||||
|
||||
// 检查设备是否存在
|
||||
EquipmentEntity existingEntity = this.getById(equipmentId);
|
||||
if (existingEntity == null) {
|
||||
// 验证设备是否存在
|
||||
EquipmentEntity existingEquipment = this.getById(equipmentId);
|
||||
if (existingEquipment == null) {
|
||||
throw new ServiceException("设备不存在");
|
||||
}
|
||||
|
||||
|
@ -774,7 +739,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
entity.setEquipmentId(equipmentId);
|
||||
this.updateById(entity);
|
||||
|
||||
log.info("设备采购记录修改成功,设备ID: {}", equipmentId);
|
||||
log.info("设备采购记录更新成功,设备ID: {}", equipmentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -810,4 +775,199 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
log.info("采购统计信息获取完成,总金额: {}, 供应商数: {}, 设备数: {}", totalAmount, supplierCount, equipmentCount);
|
||||
return stats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<EquipmentResp> inventoryPage(EquipmentListReq req) {
|
||||
log.info("开始执行设备盘库分页查询,请求参数: {}", req);
|
||||
|
||||
// 获取分页参数
|
||||
Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1;
|
||||
Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10;
|
||||
|
||||
log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize);
|
||||
|
||||
// 使用分页插件
|
||||
PageUtil.startPage();
|
||||
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<EquipmentEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
// 添加搜索条件
|
||||
if (StringUtils.hasText(req.getEquipmentName())) {
|
||||
queryWrapper.like(EquipmentEntity::getEquipmentName, req.getEquipmentName());
|
||||
}
|
||||
if (StringUtils.hasText(req.getEquipmentType())) {
|
||||
queryWrapper.eq(EquipmentEntity::getEquipmentType, req.getEquipmentType());
|
||||
}
|
||||
if (StringUtils.hasText(req.getAssetCode())) {
|
||||
queryWrapper.like(EquipmentEntity::getAssetCode, req.getAssetCode());
|
||||
}
|
||||
if (StringUtils.hasText(req.getBrand())) {
|
||||
queryWrapper.like(EquipmentEntity::getBrand, req.getBrand());
|
||||
}
|
||||
if (StringUtils.hasText(req.getLocationStatus())) {
|
||||
queryWrapper.eq(EquipmentEntity::getLocationStatus, req.getLocationStatus());
|
||||
}
|
||||
if (StringUtils.hasText(req.getResponsiblePerson())) {
|
||||
queryWrapper.like(EquipmentEntity::getResponsiblePerson, req.getResponsiblePerson());
|
||||
}
|
||||
if (StringUtils.hasText(req.getInventoryBarcode())) {
|
||||
queryWrapper.like(EquipmentEntity::getInventoryBarcode, req.getInventoryBarcode());
|
||||
}
|
||||
|
||||
// 按创建时间倒序排列
|
||||
queryWrapper.orderByDesc(EquipmentEntity::getCreateTime);
|
||||
|
||||
// 执行查询
|
||||
IPage<EquipmentEntity> page = this.page(new Page<>(pageNum, pageSize), queryWrapper);
|
||||
|
||||
// 转换为响应对象
|
||||
IPage<EquipmentResp> result = page.convert(this::convertToResp);
|
||||
|
||||
log.info("设备盘库分页查询完成,总记录数: {}, 当前页记录数: {}", result.getTotal(), result.getRecords().size());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeInventory(String equipmentId, String inventoryResult, String remark) {
|
||||
log.info("执行设备盘库,设备ID: {}, 盘点结果: {}, 备注: {}", equipmentId, inventoryResult, remark);
|
||||
|
||||
// 验证设备是否存在
|
||||
EquipmentEntity equipment = this.getById(equipmentId);
|
||||
if (equipment == null) {
|
||||
throw new ServiceException("设备不存在");
|
||||
}
|
||||
|
||||
// 更新盘点状态
|
||||
EquipmentEntity updateEquipment = new EquipmentEntity();
|
||||
updateEquipment.setEquipmentId(equipmentId);
|
||||
updateEquipment.setInventoryTimeStatus1(LocalDateTime.now().toString() + "_" + inventoryResult);
|
||||
updateEquipment.setDynamicRecord(remark);
|
||||
|
||||
// 保存更新
|
||||
boolean success = this.updateById(updateEquipment);
|
||||
if (!success) {
|
||||
throw new ServiceException("执行设备盘库失败");
|
||||
}
|
||||
|
||||
log.info("设备盘库执行成功,设备ID: {}", equipmentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchExecuteInventory(List<String> equipmentIds, String inventoryResult, String remark) {
|
||||
log.info("批量执行设备盘库,设备ID列表: {}, 盘点结果: {}, 备注: {}", equipmentIds, inventoryResult, remark);
|
||||
|
||||
if (equipmentIds == null || equipmentIds.isEmpty()) {
|
||||
throw new ServiceException("设备ID列表不能为空");
|
||||
}
|
||||
|
||||
// 批量更新盘点状态
|
||||
List<EquipmentEntity> updateList = equipmentIds.stream()
|
||||
.map(equipmentId -> {
|
||||
EquipmentEntity equipment = new EquipmentEntity();
|
||||
equipment.setEquipmentId(equipmentId);
|
||||
equipment.setInventoryTimeStatus1(LocalDateTime.now().toString() + "_" + inventoryResult);
|
||||
equipment.setDynamicRecord(remark);
|
||||
return equipment;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 批量更新
|
||||
boolean success = this.updateBatchById(updateList);
|
||||
if (!success) {
|
||||
throw new ServiceException("批量执行设备盘库失败");
|
||||
}
|
||||
|
||||
log.info("批量设备盘库执行成功,处理设备数量: {}", equipmentIds.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void receiveGoodsAndStockIn(String equipmentId, ReceiptRequest req) {
|
||||
log.info("开始处理设备收货和入库,设备ID: {}", equipmentId);
|
||||
log.info("收货请求数据: {}", req);
|
||||
|
||||
// 1. 查找采购记录
|
||||
EquipmentEntity procurementRecord = this.getById(equipmentId);
|
||||
if (procurementRecord == null) {
|
||||
throw new ServiceException("采购记录不存在");
|
||||
}
|
||||
|
||||
log.info("找到采购记录: {}", procurementRecord);
|
||||
|
||||
// 2. 更新现有设备记录(而不是创建新记录)
|
||||
EquipmentEntity equipment = new EquipmentEntity();
|
||||
equipment.setEquipmentId(equipmentId);
|
||||
|
||||
// 设置收货相关信息
|
||||
if (StringUtils.hasText(req.getReceiptTime())) {
|
||||
try {
|
||||
equipment.setInStockTime(LocalDateTime.parse(req.getReceiptTime().replace(" ", "T")));
|
||||
} catch (Exception e) {
|
||||
log.warn("解析收货时间失败,使用当前时间: {}", req.getReceiptTime());
|
||||
equipment.setInStockTime(LocalDateTime.now());
|
||||
}
|
||||
} else {
|
||||
equipment.setInStockTime(LocalDateTime.now());
|
||||
}
|
||||
|
||||
// 设置收货状态为已收货
|
||||
equipment.setReceiptStatus("RECEIVED");
|
||||
|
||||
// 设置采购状态为已完成(而不是已收货)
|
||||
equipment.setProcurementStatus("COMPLETED");
|
||||
|
||||
// 设置设备状态为库存中
|
||||
equipment.setLocationStatus("in_stock");
|
||||
equipment.setUseStatus("0"); // 空闲中
|
||||
|
||||
// 设置其他收货相关字段
|
||||
if (StringUtils.hasText(req.getStorageLocation())) {
|
||||
equipment.setPhysicalLocation(req.getStorageLocation());
|
||||
}
|
||||
if (StringUtils.hasText(req.getStorageManager())) {
|
||||
equipment.setResponsiblePerson(req.getStorageManager());
|
||||
}
|
||||
|
||||
// 记录收货人信息到资产备注中
|
||||
if (StringUtils.hasText(req.getReceiptPerson())) {
|
||||
String currentRemark = procurementRecord.getAssetRemark();
|
||||
String receiptInfo = String.format("收货人:%s,收货时间:%s",
|
||||
req.getReceiptPerson(),
|
||||
req.getReceiptTime() != null ? req.getReceiptTime() : LocalDateTime.now().toString());
|
||||
|
||||
if (StringUtils.hasText(currentRemark)) {
|
||||
equipment.setAssetRemark(currentRemark + ";" + receiptInfo);
|
||||
} else {
|
||||
equipment.setAssetRemark(receiptInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置设备序列号(如果收货时生成了新的)
|
||||
if (StringUtils.hasText(req.getEquipmentSn())) {
|
||||
equipment.setEquipmentSn(req.getEquipmentSn());
|
||||
}
|
||||
|
||||
// 设置库存条码
|
||||
if (StringUtils.hasText(req.getInventoryBarcode())) {
|
||||
equipment.setInventoryBarcode(req.getInventoryBarcode());
|
||||
}
|
||||
|
||||
// 设置更新时间和操作人
|
||||
equipment.setUpdateTime(LocalDateTime.now());
|
||||
equipment.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
|
||||
log.info("准备更新设备记录,设备ID: {}, 收货状态: {}, 采购状态: {}",
|
||||
equipmentId, equipment.getReceiptStatus(), equipment.getProcurementStatus());
|
||||
|
||||
// 3. 更新设备记录
|
||||
boolean updateResult = this.updateById(equipment);
|
||||
if (!updateResult) {
|
||||
throw new ServiceException("更新设备记录失败");
|
||||
}
|
||||
|
||||
log.info("设备收货和入库成功,设备ID: {}, 收货状态: {}, 采购状态: {}",
|
||||
equipmentId, equipment.getReceiptStatus(), equipment.getProcurementStatus());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.dite.znpt.domain.entity.EquipmentEntity;
|
||||
import com.dite.znpt.mapper.EquipmentMapper;
|
||||
import com.dite.znpt.service.EquipmentStatusUpdateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 设备状态更新服务实现类
|
||||
* 使用MyBatis Plus来更新设备状态,避免循环依赖
|
||||
*
|
||||
* @author Bear.G
|
||||
* @date 2025/1/8/周三 17:50
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EquipmentStatusUpdateServiceImpl implements EquipmentStatusUpdateService {
|
||||
|
||||
@Resource
|
||||
private EquipmentMapper equipmentMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateProcurementStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过采购状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备采购状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
|
||||
// 使用MyBatis Plus的LambdaUpdateWrapper来更新设备状态
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
|
||||
// 根据状态设置相应的字段
|
||||
if ("APPROVED".equals(status)) {
|
||||
// 审批通过:设置采购状态为已通过,位置状态为库存中,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getProcurementStatus, "APPROVED");
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "in_stock");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getInStockTime, LocalDateTime.now());
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备采购审批通过,设置状态为已通过");
|
||||
} else if ("REJECTED".equals(status)) {
|
||||
// 审批拒绝:设置采购状态为已拒绝,位置状态为未入库,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getProcurementStatus, "REJECTED");
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "not_in_stock");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备采购审批拒绝,设置状态为已拒绝");
|
||||
} else if ("PENDING_APPROVAL".equals(status) || "PENDING".equals(status)) {
|
||||
// 待审批:设置采购状态为待审批,位置状态为待审批,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getProcurementStatus, "PENDING_APPROVAL");
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "pending_approval");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备采购申请提交,设置状态为待审批");
|
||||
} else if ("COMPLETED".equals(status)) {
|
||||
// 采购完成:设置采购状态为已完成,位置状态为库存中,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getProcurementStatus, "COMPLETED");
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "in_stock");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getInStockTime, LocalDateTime.now());
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备采购完成,设置状态为已完成");
|
||||
}
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备采购状态更新成功,设备ID: {}, 新状态: {}, 影响行数: {}", equipmentId, status, updateCount);
|
||||
} else {
|
||||
log.warn("设备采购状态更新失败,设备ID: {}, 新状态: {}, 可能设备不存在", equipmentId, status);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备采购状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateBorrowStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过借用状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备借用状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
|
||||
if ("APPROVED".equals(status)) {
|
||||
// 借用审批通过:设置位置状态为外借中,使用状态为使用中
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "borrowed");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "1");
|
||||
updateWrapper.set(EquipmentEntity::getBorrowingTime, LocalDateTime.now());
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备借用审批通过,设置状态为外借中");
|
||||
} else if ("REJECTED".equals(status)) {
|
||||
// 借用审批拒绝:保持原有状态
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备借用审批拒绝,保持原有状态");
|
||||
}
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备借用状态更新成功,设备ID: {}, 新状态: {}, 影响行数: {}", equipmentId, status, updateCount);
|
||||
} else {
|
||||
log.warn("设备借用状态更新失败,设备ID: {}, 新状态: {}, 可能设备不存在", equipmentId, status);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备借用状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateReturnStatus(String equipmentId, String status) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过归还状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备归还状态,设备ID: {}, 新状态: {}", equipmentId, status);
|
||||
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
|
||||
if ("APPROVED".equals(status)) {
|
||||
// 归还审批通过:设置位置状态为库存中,使用状态为空闲中
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, "in_stock");
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, "0");
|
||||
updateWrapper.set(EquipmentEntity::getReturnTime, LocalDateTime.now());
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备归还审批通过,设置状态为库存中");
|
||||
} else if ("REJECTED".equals(status)) {
|
||||
// 归还审批拒绝:保持原有状态
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
log.info("设备归还审批拒绝,保持原有状态");
|
||||
}
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备归还状态更新成功,设备ID: {}, 新状态: {}, 影响行数: {}", equipmentId, status, updateCount);
|
||||
} else {
|
||||
log.warn("设备归还状态更新失败,设备ID: {}, 新状态: {}, 可能设备不存在", equipmentId, status);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备归还状态失败,设备ID: {}, 状态: {}", equipmentId, status, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateLocationStatus(String equipmentId, String locationStatus) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过位置状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备位置状态,设备ID: {}, 新位置状态: {}", equipmentId, locationStatus);
|
||||
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
updateWrapper.set(EquipmentEntity::getLocationStatus, locationStatus);
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备位置状态更新成功,设备ID: {}, 新位置状态: {}, 影响行数: {}", equipmentId, locationStatus, updateCount);
|
||||
} else {
|
||||
log.warn("设备位置状态更新失败,设备ID: {}, 新位置状态: {}, 可能设备不存在", equipmentId, locationStatus);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备位置状态失败,设备ID: {}, 位置状态: {}", equipmentId, locationStatus, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateUseStatus(String equipmentId, String useStatus) {
|
||||
if (equipmentId == null || equipmentId.trim().isEmpty()) {
|
||||
log.warn("设备ID为空,跳过使用状态更新");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("开始更新设备使用状态,设备ID: {}, 新使用状态: {}", equipmentId, useStatus);
|
||||
|
||||
LambdaUpdateWrapper<EquipmentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId);
|
||||
updateWrapper.set(EquipmentEntity::getUseStatus, useStatus);
|
||||
updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now());
|
||||
|
||||
// 执行更新
|
||||
int updateCount = equipmentMapper.update(null, updateWrapper);
|
||||
if (updateCount > 0) {
|
||||
log.info("设备使用状态更新成功,设备ID: {}, 新使用状态: {}, 影响行数: {}", equipmentId, useStatus, updateCount);
|
||||
} else {
|
||||
log.warn("设备使用状态更新失败,设备ID: {}, 新使用状态: {}, 可能设备不存在", equipmentId, useStatus);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备使用状态失败,设备ID: {}, 使用状态: {}", equipmentId, useStatus, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,8 +50,13 @@ public class EquipmentUseRecordServiceImpl extends ServiceImpl<EquipmentUseRecor
|
|||
|
||||
@Override
|
||||
public List<EquipmentUseRecordResp> page(EquipmentUseRecordListReq req) {
|
||||
// 使用分页插件
|
||||
PageUtil.startPage();
|
||||
return this.list(req);
|
||||
|
||||
// 执行查询
|
||||
List<EquipmentUseRecordResp> result = this.list(req);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import com.dite.znpt.mapper.ExpenseTypeMapper;
|
||||
import com.dite.znpt.domain.entity.ExpenseTypeEntity;
|
||||
import com.dite.znpt.service.ExpenseTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ExpenseTypeServiceImpl extends ServiceImpl<ExpenseTypeMapper, ExpenseTypeEntity> implements ExpenseTypeService {
|
||||
@Override
|
||||
public List<ExpenseTypeEntity> search(String key) {
|
||||
return this.baseMapper.search(key);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,486 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.dite.znpt.domain.entity.ProjectTaskEntity;
|
||||
import com.dite.znpt.domain.entity.UserEntity;
|
||||
import com.dite.znpt.domain.vo.GanttChartReq;
|
||||
import com.dite.znpt.domain.vo.GanttChartResp;
|
||||
import com.dite.znpt.mapper.ProjectTaskMapper;
|
||||
import com.dite.znpt.service.GanttChartService;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 甘特图服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GanttChartServiceImpl implements GanttChartService {
|
||||
|
||||
private final ProjectTaskMapper projectTaskMapper;
|
||||
private final UserService userService;
|
||||
|
||||
@Override
|
||||
public List<GanttChartResp> getGanttChartData(GanttChartReq req) {
|
||||
// 查询所有任务
|
||||
QueryWrapper<ProjectTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
if (StrUtil.isNotBlank(req.getProjectId())) {
|
||||
queryWrapper.eq("project_id", req.getProjectId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getTaskGroupId())) {
|
||||
queryWrapper.eq("task_group_id", req.getTaskGroupId());
|
||||
}
|
||||
if (req.getStatus() != null) {
|
||||
queryWrapper.eq("status", req.getStatus());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getMainUserId())) {
|
||||
queryWrapper.eq("main_user_id", req.getMainUserId());
|
||||
}
|
||||
if (req.getStartDateFrom() != null) {
|
||||
queryWrapper.ge("plan_start_date", req.getStartDateFrom());
|
||||
}
|
||||
if (req.getStartDateTo() != null) {
|
||||
queryWrapper.le("plan_start_date", req.getStartDateTo());
|
||||
}
|
||||
if (req.getEndDateFrom() != null) {
|
||||
queryWrapper.ge("plan_end_date", req.getEndDateFrom());
|
||||
}
|
||||
if (req.getEndDateTo() != null) {
|
||||
queryWrapper.le("plan_end_date", req.getEndDateTo());
|
||||
}
|
||||
if (req.getOverdueOnly() != null && req.getOverdueOnly()) {
|
||||
queryWrapper.eq("overdue_status", 1);
|
||||
}
|
||||
if (req.getIncludeCompleted() != null && !req.getIncludeCompleted()) {
|
||||
queryWrapper.ne("status", 2);
|
||||
}
|
||||
|
||||
queryWrapper.orderByAsc("plan_start_date");
|
||||
|
||||
List<ProjectTaskEntity> taskList = projectTaskMapper.selectList(queryWrapper);
|
||||
|
||||
// 获取用户信息
|
||||
final Set<String> userIds = new HashSet<>();
|
||||
taskList.forEach(task -> {
|
||||
if (StrUtil.isNotBlank(task.getMainUserId())) {
|
||||
userIds.add(task.getMainUserId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(task.getUserIds())) {
|
||||
userIds.addAll(Arrays.asList(task.getUserIds().split(",")));
|
||||
}
|
||||
});
|
||||
|
||||
final Map<String, UserEntity> userMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(userIds)) {
|
||||
List<UserEntity> users = userService.listByIds(userIds);
|
||||
userMap.putAll(users.stream().collect(Collectors.toMap(UserEntity::getUserId, user -> user)));
|
||||
}
|
||||
|
||||
// 批量获取项目时间范围,避免重复查询
|
||||
final Map<String, LocalDate> projectStartDates = new HashMap<>();
|
||||
if (StrUtil.isNotBlank(req.getProjectId())) {
|
||||
// 如果指定了项目ID,直接获取该项目的时间范围
|
||||
LocalDate projectStart = getProjectStartDate(req.getProjectId());
|
||||
projectStartDates.put(req.getProjectId(), projectStart);
|
||||
} else {
|
||||
// 如果没有指定项目ID,获取所有相关项目的时间范围
|
||||
Set<String> projectIds = taskList.stream()
|
||||
.map(ProjectTaskEntity::getProjectId)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (String projectId : projectIds) {
|
||||
LocalDate projectStart = getProjectStartDate(projectId);
|
||||
projectStartDates.put(projectId, projectStart);
|
||||
}
|
||||
}
|
||||
|
||||
// 转换为甘特图数据
|
||||
List<GanttChartResp> ganttData = taskList.stream().map(task -> {
|
||||
GanttChartResp resp = BeanUtil.copyProperties(task, GanttChartResp.class);
|
||||
|
||||
// 设置状态描述
|
||||
switch (task.getStatus()) {
|
||||
case 0:
|
||||
resp.setStatusDesc("未开始");
|
||||
break;
|
||||
case 1:
|
||||
resp.setStatusDesc("进行中");
|
||||
break;
|
||||
case 2:
|
||||
resp.setStatusDesc("已结束");
|
||||
break;
|
||||
default:
|
||||
resp.setStatusDesc("未知");
|
||||
}
|
||||
|
||||
// 设置负责人姓名
|
||||
if (StrUtil.isNotBlank(task.getMainUserId()) && userMap.containsKey(task.getMainUserId())) {
|
||||
resp.setMainUserName(userMap.get(task.getMainUserId()).getName());
|
||||
}
|
||||
|
||||
// 设置参与人姓名列表
|
||||
if (StrUtil.isNotBlank(task.getUserIds())) {
|
||||
List<String> participantNames = Arrays.stream(task.getUserIds().split(","))
|
||||
.filter(userId -> userMap.containsKey(userId))
|
||||
.map(userId -> userMap.get(userId).getName())
|
||||
.collect(Collectors.toList());
|
||||
resp.setParticipantNames(participantNames);
|
||||
}
|
||||
|
||||
// 计算进度(这里可以根据实际业务逻辑调整)
|
||||
if (task.getStatus() == 2) {
|
||||
resp.setProgress(100);
|
||||
} else if (task.getStatus() == 1) {
|
||||
resp.setProgress(50); // 默认进度,实际应该从数据库字段获取
|
||||
} else {
|
||||
resp.setProgress(0);
|
||||
}
|
||||
|
||||
// 计算任务在时间轴上的位置和持续时间
|
||||
LocalDate projectStart = projectStartDates.get(task.getProjectId());
|
||||
if (projectStart != null && task.getPlanStartDate() != null) {
|
||||
int position = (int) ChronoUnit.DAYS.between(projectStart, task.getPlanStartDate());
|
||||
resp.setPosition(position);
|
||||
}
|
||||
|
||||
// 计算任务持续时间
|
||||
if (task.getPlanStartDate() != null && task.getPlanEndDate() != null) {
|
||||
int duration = (int) ChronoUnit.DAYS.between(task.getPlanStartDate(), task.getPlanEndDate()) + 1;
|
||||
resp.setDuration(duration);
|
||||
} else {
|
||||
resp.setDuration(1); // 默认持续1天
|
||||
}
|
||||
|
||||
return resp;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 构建树形结构
|
||||
return buildTreeStructure(ganttData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGanttChartStatistics(String projectId) {
|
||||
QueryWrapper<ProjectTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("project_id", projectId);
|
||||
|
||||
List<ProjectTaskEntity> taskList = projectTaskMapper.selectList(queryWrapper);
|
||||
|
||||
Map<String, Object> statistics = new HashMap<>();
|
||||
statistics.put("totalTasks", taskList.size());
|
||||
statistics.put("notStarted", (int) taskList.stream().filter(task -> task.getStatus() == 0).count());
|
||||
statistics.put("inProgress", (int) taskList.stream().filter(task -> task.getStatus() == 1).count());
|
||||
statistics.put("completed", (int) taskList.stream().filter(task -> task.getStatus() == 2).count());
|
||||
statistics.put("overdue", (int) taskList.stream().filter(task -> task.getOverdueStatus() == 1).count());
|
||||
|
||||
// 计算总体进度
|
||||
if (taskList.size() > 0) {
|
||||
final double avgProgress = taskList.stream()
|
||||
.mapToInt(task -> {
|
||||
if (task.getStatus() == 2) return 100;
|
||||
else if (task.getStatus() == 1) return 50;
|
||||
else return 0;
|
||||
})
|
||||
.average()
|
||||
.orElse(0.0);
|
||||
statistics.put("overallProgress", Math.round(avgProgress));
|
||||
} else {
|
||||
statistics.put("overallProgress", 0);
|
||||
}
|
||||
|
||||
return statistics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGanttChartTimeline(String projectId) {
|
||||
if (StrUtil.isBlank(projectId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LocalDate projectStartDate = getProjectStartDate(projectId);
|
||||
LocalDate projectEndDate = getProjectEndDate(projectId);
|
||||
|
||||
Map<String, Object> timeline = new HashMap<>();
|
||||
timeline.put("projectId", projectId);
|
||||
timeline.put("startDate", projectStartDate);
|
||||
timeline.put("endDate", projectEndDate);
|
||||
timeline.put("totalDays", ChronoUnit.DAYS.between(projectStartDate, projectEndDate) + 1);
|
||||
|
||||
// 计算时间轴上的关键时间点(比如每周、每月)
|
||||
List<Map<String, Object>> timePoints = new ArrayList<>();
|
||||
LocalDate currentDate = projectStartDate;
|
||||
|
||||
while (!currentDate.isAfter(projectEndDate)) {
|
||||
Map<String, Object> timePoint = new HashMap<>();
|
||||
timePoint.put("date", currentDate);
|
||||
timePoint.put("dayOfWeek", currentDate.getDayOfWeek().getDisplayName(java.time.format.TextStyle.SHORT, java.util.Locale.CHINESE));
|
||||
timePoint.put("isWeekend", currentDate.getDayOfWeek().getValue() >= 6);
|
||||
timePoints.add(timePoint);
|
||||
|
||||
currentDate = currentDate.plusDays(1);
|
||||
}
|
||||
|
||||
timeline.put("timePoints", timePoints);
|
||||
|
||||
return timeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTaskProgress(String taskId, Integer progress) {
|
||||
ProjectTaskEntity task = projectTaskMapper.selectById(taskId);
|
||||
if (task == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 更新进度
|
||||
// 这里需要根据实际业务逻辑添加进度字段
|
||||
// task.setProgress(progress);
|
||||
|
||||
// 根据进度更新状态
|
||||
if (progress >= 100) {
|
||||
task.setStatus(2); // 已完成
|
||||
task.setActualEndDate(LocalDate.now());
|
||||
} else if (progress > 0) {
|
||||
task.setStatus(1); // 进行中
|
||||
if (task.getActualStartDate() == null) {
|
||||
task.setActualStartDate(LocalDate.now());
|
||||
}
|
||||
}
|
||||
|
||||
return projectTaskMapper.updateById(task) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTaskTime(String taskId, String startDate, String endDate) {
|
||||
ProjectTaskEntity task = projectTaskMapper.selectById(taskId);
|
||||
if (task == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate newStartDate = null;
|
||||
LocalDate newEndDate = null;
|
||||
|
||||
try {
|
||||
if (StrUtil.isNotBlank(startDate)) {
|
||||
newStartDate = LocalDate.parse(startDate, formatter);
|
||||
}
|
||||
if (StrUtil.isNotBlank(endDate)) {
|
||||
newEndDate = LocalDate.parse(endDate, formatter);
|
||||
}
|
||||
} catch (DateTimeParseException e) {
|
||||
return false; // 日期格式错误
|
||||
}
|
||||
|
||||
// 验证时间约束
|
||||
if (!validateTaskTimeConstraints(task, newStartDate, newEndDate)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 更新任务时间
|
||||
if (newStartDate != null) {
|
||||
task.setPlanStartDate(newStartDate);
|
||||
}
|
||||
if (newEndDate != null) {
|
||||
task.setPlanEndDate(newEndDate);
|
||||
}
|
||||
|
||||
// 更新逾期状态
|
||||
updateOverdueStatus(task);
|
||||
|
||||
return projectTaskMapper.updateById(task) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建树形结构
|
||||
*/
|
||||
private List<GanttChartResp> buildTreeStructure(List<GanttChartResp> allTasks) {
|
||||
final Map<String, GanttChartResp> taskMap = allTasks.stream()
|
||||
.collect(Collectors.toMap(GanttChartResp::getTaskId, task -> task));
|
||||
|
||||
final List<GanttChartResp> rootTasks = new ArrayList<>();
|
||||
|
||||
for (GanttChartResp task : allTasks) {
|
||||
if (StrUtil.isBlank(task.getParentTaskId())) {
|
||||
// 根任务
|
||||
task.setLevel(0);
|
||||
rootTasks.add(task);
|
||||
} else {
|
||||
// 子任务
|
||||
GanttChartResp parentTask = taskMap.get(task.getParentTaskId());
|
||||
if (parentTask != null) {
|
||||
task.setLevel(parentTask.getLevel() + 1);
|
||||
if (parentTask.getChildren() == null) {
|
||||
parentTask.setChildren(new ArrayList<>());
|
||||
}
|
||||
parentTask.getChildren().add(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rootTasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目开始时间
|
||||
* 从项目任务中计算最早的计划开始时间作为项目开始时间
|
||||
*/
|
||||
private LocalDate getProjectStartDate(String projectId) {
|
||||
if (StrUtil.isBlank(projectId)) {
|
||||
return LocalDate.now().minusDays(30); // 默认值
|
||||
}
|
||||
|
||||
// 查询项目中所有任务的计划开始时间,取最早的时间
|
||||
QueryWrapper<ProjectTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("project_id", projectId)
|
||||
.isNotNull("plan_start_date")
|
||||
.orderByAsc("plan_start_date")
|
||||
.last("LIMIT 1");
|
||||
|
||||
ProjectTaskEntity earliestTask = projectTaskMapper.selectOne(queryWrapper);
|
||||
|
||||
if (earliestTask != null && earliestTask.getPlanStartDate() != null) {
|
||||
return earliestTask.getPlanStartDate();
|
||||
}
|
||||
|
||||
// 如果没有找到有效的开始时间,返回当前时间减去30天作为默认值
|
||||
return LocalDate.now().minusDays(30);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目结束时间
|
||||
* 从项目任务中计算最晚的计划结束时间作为项目结束时间
|
||||
*/
|
||||
private LocalDate getProjectEndDate(String projectId) {
|
||||
if (StrUtil.isBlank(projectId)) {
|
||||
return LocalDate.now().plusDays(30); // 默认值
|
||||
}
|
||||
|
||||
// 查询项目中所有任务的计划结束时间,取最晚的时间
|
||||
QueryWrapper<ProjectTaskEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("project_id", projectId)
|
||||
.isNotNull("plan_end_date")
|
||||
.orderByDesc("plan_end_date")
|
||||
.last("LIMIT 1");
|
||||
|
||||
ProjectTaskEntity latestTask = projectTaskMapper.selectOne(queryWrapper);
|
||||
|
||||
if (latestTask != null && latestTask.getPlanEndDate() != null) {
|
||||
return latestTask.getPlanEndDate();
|
||||
}
|
||||
|
||||
// 如果没有找到有效的结束时间,返回当前时间加上30天作为默认值
|
||||
return LocalDate.now().plusDays(30);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目时间范围
|
||||
* 返回项目的开始时间和结束时间
|
||||
*/
|
||||
private Map<String, LocalDate> getProjectTimeRange(String projectId) {
|
||||
Map<String, LocalDate> timeRange = new HashMap<>();
|
||||
timeRange.put("startDate", getProjectStartDate(projectId));
|
||||
timeRange.put("endDate", getProjectEndDate(projectId));
|
||||
return timeRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取项目时间范围
|
||||
* 通过一次查询获取多个项目的时间范围,提高性能
|
||||
*/
|
||||
private Map<String, Map<String, LocalDate>> getBatchProjectTimeRanges(Set<String> projectIds) {
|
||||
Map<String, Map<String, LocalDate>> timeRanges = new HashMap<>();
|
||||
|
||||
for (String projectId : projectIds) {
|
||||
Map<String, LocalDate> timeRange = getProjectTimeRange(projectId);
|
||||
timeRanges.put(projectId, timeRange);
|
||||
}
|
||||
|
||||
return timeRanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算任务进度
|
||||
*/
|
||||
private Integer calculateProgress(ProjectTaskEntity task) {
|
||||
if (task.getStatus() == 2) return 100; // 已完成
|
||||
else if (task.getStatus() == 1) return 50; // 进行中
|
||||
else return 0; // 未开始
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算任务持续时间
|
||||
*/
|
||||
private Integer calculateDuration(ProjectTaskEntity task) {
|
||||
if (task.getPlanStartDate() != null && task.getPlanEndDate() != null) {
|
||||
return (int) ChronoUnit.DAYS.between(task.getPlanStartDate(), task.getPlanEndDate()) + 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算任务在时间轴上的位置
|
||||
*/
|
||||
private Integer calculatePosition(ProjectTaskEntity task) {
|
||||
LocalDate projectStart = getProjectStartDate(task.getProjectId());
|
||||
if (task.getPlanStartDate() != null && projectStart != null) {
|
||||
return (int) ChronoUnit.DAYS.between(projectStart, task.getPlanStartDate());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证任务时间约束
|
||||
*/
|
||||
private boolean validateTaskTimeConstraints(ProjectTaskEntity task,
|
||||
LocalDate newStartDate,
|
||||
LocalDate newEndDate) {
|
||||
// 验证子任务不能早于父任务开始
|
||||
if (StrUtil.isNotBlank(task.getParentTaskId())) {
|
||||
ProjectTaskEntity parentTask = projectTaskMapper.selectById(task.getParentTaskId());
|
||||
if (parentTask != null && newStartDate != null) {
|
||||
if (newStartDate.isBefore(parentTask.getPlanStartDate())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 验证结束时间不能早于开始时间
|
||||
if (newStartDate != null && newEndDate != null) {
|
||||
if (newEndDate.isBefore(newStartDate)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新逾期状态
|
||||
*/
|
||||
private void updateOverdueStatus(ProjectTaskEntity task) {
|
||||
if (task.getPlanEndDate() != null &&
|
||||
task.getPlanEndDate().isBefore(LocalDate.now()) &&
|
||||
task.getStatus() != 2) {
|
||||
task.setOverdueStatus(1); // 标记为逾期
|
||||
} else {
|
||||
task.setOverdueStatus(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
@ -18,6 +19,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -188,6 +190,14 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
ProjectMemberEntity entity = new ProjectMemberEntity();
|
||||
BeanUtil.copyProperties(req, entity);
|
||||
|
||||
// 设置创建和更新信息
|
||||
String currentUserId = StpUtil.getLoginIdAsString();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
entity.setCreateBy(currentUserId);
|
||||
entity.setCreateTime(now);
|
||||
entity.setUpdateBy(currentUserId);
|
||||
entity.setUpdateTime(now);
|
||||
|
||||
// 保存到数据库
|
||||
this.save(entity);
|
||||
|
||||
|
@ -208,6 +218,85 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
|
||||
// 更新成员信息
|
||||
BeanUtil.copyProperties(req, existingMember);
|
||||
|
||||
// 设置更新信息
|
||||
existingMember.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
existingMember.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
this.updateById(existingMember);
|
||||
|
||||
// 返回更新后的成员信息
|
||||
return getTeamMemberById(memberId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectMemberResp updateTeamMember(String memberId, TeamMemberUpdateReq req) {
|
||||
// 验证成员是否存在
|
||||
ProjectMemberEntity existingMember = this.getById(memberId);
|
||||
if (existingMember == null) {
|
||||
throw new ServiceException("项目成员不存在");
|
||||
}
|
||||
|
||||
// 更新成员信息 - 只更新非空字段,保留原有值
|
||||
if (StrUtil.isNotBlank(req.getTurbineId())) {
|
||||
existingMember.setTurbineId(req.getTurbineId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getTaskGroupId())) {
|
||||
existingMember.setTaskGroupId(req.getTaskGroupId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getTaskId())) {
|
||||
existingMember.setTaskId(req.getTaskId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getRoleType())) {
|
||||
existingMember.setRoleType(req.getRoleType());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getJobCode())) {
|
||||
existingMember.setJobCode(req.getJobCode());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getJobDesc())) {
|
||||
existingMember.setJobDesc(req.getJobDesc());
|
||||
}
|
||||
if (req.getJoinDate() != null) {
|
||||
existingMember.setJoinDate(req.getJoinDate());
|
||||
}
|
||||
if (req.getLeaveDate() != null) {
|
||||
existingMember.setLeaveDate(req.getLeaveDate());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getStatus())) {
|
||||
existingMember.setStatus(req.getStatus());
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getRemark())) {
|
||||
existingMember.setRemark(req.getRemark());
|
||||
}
|
||||
|
||||
// 验证关联数据是否存在(只验证非空字段)
|
||||
validateUpdateTeamMemberRequest(req, existingMember);
|
||||
|
||||
// 如果更新了用户信息(电话或邮箱),同时更新用户表
|
||||
if (StrUtil.isNotBlank(req.getPhone()) || StrUtil.isNotBlank(req.getEmail())) {
|
||||
UserEntity user = userService.getById(existingMember.getUserId());
|
||||
if (user != null) {
|
||||
boolean needUpdateUser = false;
|
||||
if (StrUtil.isNotBlank(req.getPhone())) {
|
||||
user.setMobile(req.getPhone());
|
||||
needUpdateUser = true;
|
||||
}
|
||||
if (StrUtil.isNotBlank(req.getEmail())) {
|
||||
user.setEmail(req.getEmail());
|
||||
needUpdateUser = true;
|
||||
}
|
||||
if (needUpdateUser) {
|
||||
user.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
userService.updateById(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置更新信息
|
||||
existingMember.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
existingMember.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
this.updateById(existingMember);
|
||||
|
||||
// 返回更新后的成员信息
|
||||
|
@ -271,6 +360,64 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证更新团队成员请求参数(只验证非空字段)
|
||||
*/
|
||||
private void validateUpdateTeamMemberRequest(TeamMemberReq req, ProjectMemberEntity existingMember) {
|
||||
// 验证机组是否存在(如果指定了机组)
|
||||
if (StrUtil.isNotBlank(req.getTurbineId())) {
|
||||
TurbineEntity turbine = turbineService.getById(req.getTurbineId());
|
||||
if (turbine == null) {
|
||||
throw new ServiceException("机组不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证任务组是否存在(如果指定了任务组)
|
||||
if (StrUtil.isNotBlank(req.getTaskGroupId())) {
|
||||
ProjectTaskGroupEntity taskGroup = projectTaskGroupService.getById(req.getTaskGroupId());
|
||||
if (taskGroup == null) {
|
||||
throw new ServiceException("任务组不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证任务是否存在(如果指定了任务)
|
||||
if (StrUtil.isNotBlank(req.getTaskId())) {
|
||||
ProjectTaskEntity task = projectTaskService.getById(req.getTaskId());
|
||||
if (task == null) {
|
||||
throw new ServiceException("任务不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证更新团队成员请求参数(只验证非空字段)
|
||||
*/
|
||||
private void validateUpdateTeamMemberRequest(TeamMemberUpdateReq req, ProjectMemberEntity existingMember) {
|
||||
// 验证机组是否存在(如果指定了机组)
|
||||
if (StrUtil.isNotBlank(req.getTurbineId())) {
|
||||
TurbineEntity turbine = turbineService.getById(req.getTurbineId());
|
||||
if (turbine == null) {
|
||||
throw new ServiceException("机组不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证任务组是否存在(如果指定了任务组)
|
||||
if (StrUtil.isNotBlank(req.getTaskGroupId())) {
|
||||
ProjectTaskGroupEntity taskGroup = projectTaskGroupService.getById(req.getTaskGroupId());
|
||||
if (taskGroup == null) {
|
||||
throw new ServiceException("任务组不存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证任务是否存在(如果指定了任务)
|
||||
if (StrUtil.isNotBlank(req.getTaskId())) {
|
||||
ProjectTaskEntity task = projectTaskService.getById(req.getTaskId());
|
||||
if (task == null) {
|
||||
throw new ServiceException("任务不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据成员ID获取成员信息
|
||||
*/
|
||||
|
@ -286,10 +433,17 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
|
||||
// 查询并返回单个成员信息
|
||||
List<ProjectMemberResp> list = this.baseMapper.queryTeamMembers(query);
|
||||
return list.stream()
|
||||
.filter(member -> member.getMemberId().equals(memberId))
|
||||
ProjectMemberResp member = list.stream()
|
||||
.filter(m -> m.getMemberId().equals(memberId))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (member != null) {
|
||||
// 丰富成员信息
|
||||
enrichMemberInfo(CollUtil.toList(member));
|
||||
}
|
||||
|
||||
return member;
|
||||
}
|
||||
|
||||
// ========================== 项目看板相关方法实现 ==========================
|
||||
|
@ -300,11 +454,14 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
|
||||
// 统计项目数量
|
||||
resp.setTotalProjectsCount(projectService.count());
|
||||
resp.setPendingProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 0).count());
|
||||
resp.setInProgressProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 1).count());
|
||||
resp.setCompletedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 2).count());
|
||||
resp.setAuditedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 3).count());
|
||||
resp.setAcceptedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 4).count());
|
||||
resp.setPendingProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 0).count()); // 未开工
|
||||
resp.setPreparingProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 1).count()); // 筹备中
|
||||
resp.setInProgressProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 2).count()); // 开工中
|
||||
resp.setSuspendedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 3).count()); // 暂停中
|
||||
resp.setCompletedProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 4).count()); // 已完工
|
||||
resp.setAcceptanceProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 5).count()); // 验收中
|
||||
resp.setCollectionProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 6).count()); // 回款中
|
||||
resp.setSettledProjectCount(projectService.lambdaQuery().eq(ProjectEntity::getStatus, 7).count()); // 已结算
|
||||
|
||||
// 统计机组数量
|
||||
resp.setTotalTurbineCount(turbineService.count());
|
||||
|
@ -336,11 +493,14 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
|
|||
ProjectKanbanDataResp resp = new ProjectKanbanDataResp();
|
||||
|
||||
// 获取各状态的项目列表
|
||||
resp.setPendingProjects(getProjectKanbanItems(0));
|
||||
resp.setInProgressProjects(getProjectKanbanItems(1));
|
||||
resp.setCompletedProjects(getProjectKanbanItems(2));
|
||||
resp.setAuditedProjects(getProjectKanbanItems(3));
|
||||
resp.setAcceptedProjects(getProjectKanbanItems(4));
|
||||
resp.setPendingProjects(getProjectKanbanItems(0)); // 未开工
|
||||
resp.setPreparingProjects(getProjectKanbanItems(1)); // 筹备中
|
||||
resp.setInProgressProjects(getProjectKanbanItems(2)); // 开工中
|
||||
resp.setSuspendedProjects(getProjectKanbanItems(3)); // 暂停中
|
||||
resp.setCompletedProjects(getProjectKanbanItems(4)); // 已完工
|
||||
resp.setAcceptanceProjects(getProjectKanbanItems(5)); // 验收中
|
||||
resp.setCollectionProjects(getProjectKanbanItems(6)); // 回款中
|
||||
resp.setSettledProjects(getProjectKanbanItems(7)); // 已结算
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.ContractEntity;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.domain.entity.ProjectTaskEntity;
|
||||
import com.dite.znpt.domain.entity.UserEntity;
|
||||
import com.dite.znpt.domain.vo.ProjectListReq;
|
||||
import com.dite.znpt.domain.vo.ProjectListResp;
|
||||
import com.dite.znpt.domain.vo.ProjectReq;
|
||||
import com.dite.znpt.domain.vo.ProjectResp;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import com.dite.znpt.enums.ProjectStatusEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.ContractMapper;
|
||||
import com.dite.znpt.mapper.ProjectMapper;
|
||||
import com.dite.znpt.service.ProjectService;
|
||||
import com.dite.znpt.service.UserService;
|
||||
import com.dite.znpt.service.ProjectTaskService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -40,6 +44,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
|
|||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private ProjectTaskService projectTaskService;
|
||||
@Autowired
|
||||
private ContractMapper contractMapper;
|
||||
|
||||
/**
|
||||
* 功能描述:查询项目信息列表
|
||||
*
|
||||
|
@ -109,10 +119,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
|
|||
constructorName.append(userIdMap.get(id).getName()).append(StrUtil.COMMA);
|
||||
}
|
||||
});
|
||||
constructorName.deleteCharAt(constructorName.lastIndexOf(StrUtil.COMMA));
|
||||
if(!constructorName.isEmpty()){
|
||||
constructorName.deleteCharAt(constructorName.lastIndexOf(StrUtil.COMMA));
|
||||
}
|
||||
resp.setConstructorName(constructorName.toString());
|
||||
}
|
||||
}
|
||||
List<ProjectTaskEntity> tmp = projectTaskService.list(new QueryWrapper<ProjectTaskEntity>().eq("project_id", projectId));
|
||||
List<ProjectTaskResp> list1 = new ArrayList<>();
|
||||
for (ProjectTaskEntity item : tmp) {
|
||||
ProjectTaskResp taskResp = BeanUtil.copyProperties(item, ProjectTaskResp.class);
|
||||
list1.add(taskResp);
|
||||
}
|
||||
resp.setTaskList(list1);
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
@ -128,6 +147,20 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
|
|||
public void save(ProjectReq req) {
|
||||
ProjectEntity entity = Converts.INSTANCE.toProjectEntity(req);
|
||||
this.save(entity);
|
||||
QueryWrapper<ContractEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("code", req.getProjectOrigin());
|
||||
ContractEntity contractEntity = contractMapper.selectOne(queryWrapper);
|
||||
contractEntity.setContractStatus("施工中");
|
||||
contractMapper.updateById(contractEntity);
|
||||
for (ProjectInitTaskReq taskReq : req.getTasks()) {
|
||||
ProjectTaskEntity taskEntity = BeanUtil.copyProperties(taskReq, ProjectTaskEntity.class);
|
||||
if (taskEntity.getScales() == null) {
|
||||
taskEntity.setScales(entity.getScale());
|
||||
}
|
||||
taskEntity.setProjectId(entity.getProjectId());
|
||||
taskEntity.setFinished(0);
|
||||
projectTaskService.save(taskEntity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.domain.entity.AttachInfoEntity;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.domain.entity.ProjectTaskEntity;
|
||||
import com.dite.znpt.domain.vo.ProjectTaskListReq;
|
||||
import com.dite.znpt.domain.vo.ProjectTaskReq;
|
||||
|
@ -18,6 +19,7 @@ import com.dite.znpt.domain.vo.ProjectTaskStartReq;
|
|||
import com.dite.znpt.enums.AttachBusinessTypeEnum;
|
||||
import com.dite.znpt.enums.ProjectTaskStateEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.ProjectMapper;
|
||||
import com.dite.znpt.mapper.ProjectTaskGroupMapper;
|
||||
import com.dite.znpt.mapper.ProjectTaskMapper;
|
||||
import com.dite.znpt.service.AttachInfoService;
|
||||
|
|
|
@ -206,7 +206,7 @@ public class TurbineServiceImpl extends ServiceImpl<TurbineMapper, TurbineEntity
|
|||
if (turbine == null) {
|
||||
return;
|
||||
}
|
||||
if (turbine.getStatus() == ProjectStatusEnum.AUDITED.getCode()) {
|
||||
if (turbine.getStatus() == ProjectStatusEnum.PREPARING.getCode()) {
|
||||
return;
|
||||
}
|
||||
List<TurbineStatusResp> turbineStatusList = jobService.calCrewStatus(ListUtil.of(turbineId));
|
||||
|
@ -234,7 +234,7 @@ public class TurbineServiceImpl extends ServiceImpl<TurbineMapper, TurbineEntity
|
|||
&& status4.contains(turbineStatusVo.getAntiThunderWorkStatus())
|
||||
&& status4.contains(turbineStatusVo.getSummaryWorkStatus())) {
|
||||
// 全部审批已审批
|
||||
turbine.setStatus(ProjectStatusEnum.AUDITED.getCode());
|
||||
turbine.setStatus(ProjectStatusEnum.PREPARING.getCode());
|
||||
} else if (status2.contains(turbineStatusVo.getInWorkStatus())
|
||||
|| status2.contains(turbineStatusVo.getOutWorkStatus())
|
||||
|| status2.contains(turbineStatusVo.getAntiThunderWorkStatus())
|
||||
|
@ -267,12 +267,12 @@ public class TurbineServiceImpl extends ServiceImpl<TurbineMapper, TurbineEntity
|
|||
if (!statusList.contains(ProjectStatusEnum.PENDING.getCode()) &&
|
||||
!statusList.contains(ProjectStatusEnum.IN_PROGRESS.getCode())) {
|
||||
status = ProjectStatusEnum.COMPLETED.getCode();
|
||||
// 如果机组列表没有状态为 待施工、施工中、已完工 的则项目 已审核
|
||||
// 如果机组列表没有状态为 待施工、施工中、已完工 的则项目 筹备中
|
||||
if (!statusList.contains(ProjectStatusEnum.COMPLETED.getCode())) {
|
||||
status = ProjectStatusEnum.AUDITED.getCode();
|
||||
// 如果机组列表没有状态为 待施工、施工中、已完工、已审核 的则项目 已验收
|
||||
if (!statusList.contains(ProjectStatusEnum.AUDITED.getCode())) {
|
||||
status = ProjectStatusEnum.ACCEPTED.getCode();
|
||||
status = ProjectStatusEnum.PREPARING.getCode();
|
||||
// 如果机组列表没有状态为 待施工、施工中、已完工、筹备中 的则项目 验收中
|
||||
if (!statusList.contains(ProjectStatusEnum.PREPARING.getCode())) {
|
||||
status = ProjectStatusEnum.IN_ACCEPTANCE.getCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
import com.dite.znpt.domain.entity.VideoMonitorEntity;
|
||||
import com.dite.znpt.enums.FilePathEnum;
|
||||
import com.dite.znpt.enums.VideoMonitorEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.VideoMonitorEntityMapper;
|
||||
import com.dite.znpt.service.ProjectService;
|
||||
import com.dite.znpt.service.TurbineService;
|
||||
import com.dite.znpt.service.VideoMonitorService;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.rmi.ServerException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 视频信息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hdc
|
||||
* @since 2025-08-07
|
||||
*/
|
||||
@Service
|
||||
public class VideoMonitorServiceImpl extends ServiceImpl<VideoMonitorEntityMapper, VideoMonitorEntity> implements VideoMonitorService {
|
||||
@Resource
|
||||
private TurbineService turbineService;
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
@Resource(name = "clearanceExecutor")
|
||||
private ThreadPoolTaskExecutor clearanceExecutor;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<VideoMonitorEntity> uploadBatch(String projectId,
|
||||
String turbineId,
|
||||
String type,
|
||||
MultipartFile[] files) throws IOException {
|
||||
if (files == null || files.length == 0) {
|
||||
throw new ServiceException("上传文件为空");
|
||||
}
|
||||
if (Objects.isNull(projectService.detail(projectId))) {
|
||||
throw new ServiceException(Message.PROJECT_ID_IS_NOT_EXIST);
|
||||
}
|
||||
if (StrUtil.isNotBlank(turbineId) && turbineService.getById(turbineId) == null) {
|
||||
throw new ServiceException(Message.PART_ID_IS_NOT_EXIST);
|
||||
}
|
||||
String userId = StpUtil.getLoginIdAsString();
|
||||
String dateStr = DateUtil.today();
|
||||
String storeDir = FilePathEnum.VIDEO.getFileAbsolutePathPrefix()
|
||||
+ projectId;
|
||||
if (!turbineId.isEmpty() )
|
||||
storeDir+=File.separator+turbineId+ File.separator + dateStr;
|
||||
else
|
||||
storeDir+=File.separator + dateStr;
|
||||
|
||||
FileUtil.mkdir(storeDir);
|
||||
|
||||
List<VideoMonitorEntity> list = Lists.newArrayList();
|
||||
|
||||
for (MultipartFile file : files) {
|
||||
String original = file.getOriginalFilename();
|
||||
String suffix = FileUtil.extName(original);
|
||||
if (suffix != null && !suffix.equals("mp4")) throw new ServerException("非视频文件");
|
||||
String uuid = IdUtil.simpleUUID();
|
||||
String fileName = uuid + StrUtil.DOT + suffix;
|
||||
String absolutePath = storeDir + File.separator + fileName;
|
||||
|
||||
File dest = new File(absolutePath);
|
||||
file.transferTo(dest);
|
||||
|
||||
VideoMonitorEntity entity = new VideoMonitorEntity();
|
||||
entity.setVideoId(uuid);
|
||||
entity.setProjectId(projectId);
|
||||
entity.setTurbineId(turbineId);
|
||||
entity.setVideoName(original);
|
||||
entity.setVideoPath(FilePathEnum.VIDEO.getFileDownPath(absolutePath));
|
||||
entity.setType(type);
|
||||
entity.setStatus((byte) 0); // 待审核
|
||||
entity.setPreTreatment(false);
|
||||
entity.setIsDeleted(false);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setUploadTime(new Date());
|
||||
entity.setUpdateBy(userId);
|
||||
entity.setCreateBy(userId);
|
||||
list.add(entity);
|
||||
if (type.equals(VideoMonitorEnum.CLEARANCE.getCode()))
|
||||
clearanceExecutor.execute(
|
||||
new ClearanceTask(absolutePath, storeDir+File.separator+ type+File.separator+uuid, uuid, this)
|
||||
);
|
||||
else if (type.equals(VideoMonitorEnum.DEFORMATION.getCode())) {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
|
||||
saveBatch(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VideoMonitorEntity upload(String projectId,
|
||||
String partId,
|
||||
String type,
|
||||
MultipartFile file) throws IOException {
|
||||
return uploadBatch(projectId, partId, type, new MultipartFile[]{file}).get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<VideoMonitorEntity> page(Integer pageNo,
|
||||
Integer pageSize,
|
||||
String projectId,
|
||||
String partId) {
|
||||
LambdaQueryWrapper<VideoMonitorEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(StrUtil.isNotBlank(projectId),VideoMonitorEntity::getProjectId, projectId)
|
||||
.eq(StrUtil.isNotBlank(partId), VideoMonitorEntity::getTurbineId, partId)
|
||||
.orderByDesc(VideoMonitorEntity::getCreateTime);
|
||||
Page<VideoMonitorEntity> page = page(Page.of(pageNo, pageSize), wrapper);
|
||||
return PageResult.ok(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VideoMonitorEntity> list(String projectId, String partId) {
|
||||
return lambdaQuery()
|
||||
.eq(StrUtil.isNotBlank(projectId),VideoMonitorEntity::getProjectId, projectId)
|
||||
.eq(StrUtil.isNotBlank(partId), VideoMonitorEntity::getTurbineId, partId)
|
||||
.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(String videoId) {
|
||||
VideoMonitorEntity entity = getById(videoId);
|
||||
if (Objects.isNull(entity)) {
|
||||
throw new ServiceException("视频不存在");
|
||||
}
|
||||
entity.setIsDeleted(true);
|
||||
entity.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
updateById(entity);
|
||||
// 物理删除文件
|
||||
FileUtil.del(FilePathEnum.VIDEO.getFileAbsolutePath(entity.getVideoPath()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(String videoId, HttpServletResponse response) throws IOException {
|
||||
VideoMonitorEntity entity = getById(videoId);
|
||||
if (entity == null || Boolean.TRUE.equals(entity.getIsDeleted())) {
|
||||
throw new ServiceException("视频不存在或已删除");
|
||||
}
|
||||
File file = new File(FilePathEnum.VIDEO.getFileAbsolutePath(entity.getVideoPath()));
|
||||
if (!file.exists()) {
|
||||
throw new ServiceException("视频文件不存在");
|
||||
}
|
||||
response.setContentType("video/mp4");
|
||||
response.setHeader("Content-Disposition",
|
||||
"inline; filename=" + URLEncoder.encode(entity.getVideoName(), StandardCharsets.UTF_8));
|
||||
FileUtil.writeToStream(file, response.getOutputStream());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.dite.znpt.util;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author hedechao
|
||||
* @Date 2025/8/11 09:04
|
||||
* @Description: 形变python脚本执行工具
|
||||
*/
|
||||
public class PythonUtil {
|
||||
/**
|
||||
* 调用叶片净空计算脚本
|
||||
*
|
||||
* @param videoPath 待检测视频路径
|
||||
* @throws IOException 如果启动进程失败
|
||||
* @throws InterruptedException 如果等待进程完成被中断
|
||||
*/
|
||||
public static void runClearance(
|
||||
String videoPath,
|
||||
String outputPath
|
||||
) throws IOException, InterruptedException {
|
||||
String pyScriptPath=SpringUtil.getBean(Environment.class).getProperty("pyScript.clearance");
|
||||
String modelPath=SpringUtil.getBean(Environment.class).getProperty("model.tip-hub");
|
||||
// 1. 构造命令
|
||||
ProcessBuilder pb = new ProcessBuilder(
|
||||
"python", // 也可以是 python3 / 绝对路径
|
||||
pyScriptPath,
|
||||
"--video_path=" + videoPath,
|
||||
"--model_path=" + modelPath,
|
||||
"--output_dir=" + outputPath
|
||||
);
|
||||
|
||||
// 2. 把子进程的标准输出 / 错误流重定向到 Java 控制台(可选)
|
||||
pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
|
||||
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||
|
||||
// 3. 启动进程并等待完成
|
||||
Process process = pb.start();
|
||||
int exitCode = process.waitFor();
|
||||
if (exitCode != 0) {
|
||||
throw new RuntimeException("脚本返回非 0 状态码: " + exitCode);
|
||||
}
|
||||
|
||||
System.out.println("净空计算完成,结果已保存到: " + outputPath);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.BusinessDataFileMapper">
|
||||
<!-- <select id="List" resultType="com.dite.znpt.domain.entity.BusinessDataFileEntity">-->
|
||||
<!-- select * from business_data_part_file-->
|
||||
<!-- <where>-->
|
||||
<!-- <if test="folderId != null">-->
|
||||
<!-- and folder_id = #{folderId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="fileName != null and fileName != ''">-->
|
||||
<!-- and file_name like concat('%', #{fileName}, '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- </select>-->
|
||||
<!-- <select id="List" resultType="com.dite.znpt.domain.entity.BusinessDataFileEntity">-->
|
||||
<!-- select * from business_data_part_file-->
|
||||
<!-- <where>-->
|
||||
<!-- <if test="folderId != null">-->
|
||||
<!-- and folder_id = #{folderId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="fileName != null and fileName != ''">-->
|
||||
<!-- and file_name like concat('%', #{fileName}, '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- <choose>-->
|
||||
<!-- <when test="sortField != null and sortField != '' and sortOrder != null and sortOrder != ''">-->
|
||||
<!-- order by ${sortField} ${sortOrder}-->
|
||||
<!-- </when>-->
|
||||
<!-- <otherwise>-->
|
||||
<!-- order by upload_time desc-->
|
||||
<!-- </otherwise>-->
|
||||
<!-- </choose>-->
|
||||
<!-- </select>-->
|
||||
<select id="List" resultType="com.dite.znpt.domain.entity.BusinessDataFileEntity">
|
||||
select * from business_data_part_file
|
||||
<where>
|
||||
|
@ -11,6 +41,24 @@
|
|||
and file_name like concat('%', #{fileName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sortField != null and sortField != '' and sortOrder != null and sortOrder != ''">
|
||||
<choose>
|
||||
<when test="sortField == 'file_name'">
|
||||
order by convert(file_name using gbk) ${sortOrder}
|
||||
</when>
|
||||
<when test="sortField == 'file_type'">
|
||||
order by convert(file_type using gbk) ${sortOrder}
|
||||
</when>
|
||||
<otherwise>
|
||||
order by ${sortField} ${sortOrder}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
<otherwise>
|
||||
order by upload_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<delete id="delete" parameterType="com.dite.znpt.domain.entity.BusinessDataFileEntity" >
|
||||
delete from business_data_part_file
|
||||
|
@ -46,5 +94,20 @@
|
|||
</set>
|
||||
where file_id = #{fileId}
|
||||
</update>
|
||||
|
||||
<!-- <!– 批量更新文件路径 –>-->
|
||||
<!-- <update id="updateFilePathByFolderId">-->
|
||||
<!-- update business_data_part_file-->
|
||||
<!-- set file_path = concat(#{newFolderPath}, #{separator}, file_name)-->
|
||||
<!-- where folder_id = #{folderId}-->
|
||||
<!-- </update>-->
|
||||
|
||||
<!-- 批量更新子文件夹下文件的路径 -->
|
||||
<update id="updateSubFilePaths">
|
||||
update business_data_part_file
|
||||
set file_path = replace(file_path, #{oldParentPath1}, #{newParentPath1})
|
||||
where file_path like concat(#{oldParentPath2}, '%')
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -51,5 +51,14 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 批量更新子文件夹路径 -->
|
||||
<update id="updateSubFolderPaths">
|
||||
update business_data_part
|
||||
set folder_path = replace(folder_path, #{oldParentPath1}, #{newParentPath1}),
|
||||
update_time = now()
|
||||
where folder_path like concat(#{processedOldParentPath}, '%')
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.ExpenseTypeMapper">
|
||||
<select id="search" resultType="com.dite.znpt.domain.entity.ExpenseTypeEntity">
|
||||
SELECT * FROM expense_type WHERE name LIKE CONCAT('%', #{key}, '%')
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.VideoMonitorEntityMapper">
|
||||
<resultMap id="BaseResultMap" type="com.dite.znpt.domain.entity.VideoMonitorEntity">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table video_monitor-->
|
||||
<id column="video_id" property="videoId" />
|
||||
<result column="project_id" property="projectId" />
|
||||
<result column="turbine_id" property="turbineId" />
|
||||
<result column="video_name" property="videoName" />
|
||||
<result column="video_path" property="videoPath" />
|
||||
<result column="is_deleted" property="isDeleted" />
|
||||
<result column="status" property="status" />
|
||||
<result column="pre_image_path" property="preImagePath" />
|
||||
<result column="pre_treatment" property="preTreatment" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="wind_speed" property="windSpeed" />
|
||||
<result column="rpm" property="rpm" />
|
||||
<result column="type" property="type" />
|
||||
<result column="extra" property="extra" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
|
||||
<result column="upload_time" property="uploadTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
video_id, project_id, part_id, video_name, video_path, is_deleted, `status`, pre_image_path,
|
||||
pre_treatment, update_by, create_time, create_by, update_time, wind_speed, rpm, `type`,
|
||||
extra, upload_time
|
||||
</sql>
|
||||
<select id="selectAllByProjectIdAndPartId" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from video_monitor
|
||||
where project_id=#{projectId,jdbcType=VARCHAR} and part_id=#{partId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<insert id="batchInsert" keyColumn="video_id" keyProperty="videoId" parameterType="map" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into video_monitor
|
||||
(project_id, part_id, video_name, video_path, is_deleted, `status`, pre_image_path,
|
||||
pre_treatment, update_by, create_time, create_by, update_time, wind_speed, rpm,
|
||||
`type`, extra, upload_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.projectId}, #{item.turbineId}, #{item.videoName}, #{item.videoPath}, #{item.isDeleted},
|
||||
#{item.status}, #{item.preImagePath}, #{item.preTreatment}, #{item.updateBy}, #{item.createTime},
|
||||
#{item.createBy}, #{item.updateTime}, #{item.windSpeed}, #{item.rpm}, #{item.type},
|
||||
#{item.extra}, #{item.uploadTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
|
@ -43,15 +43,26 @@ public class BusinessDataFileController {
|
|||
@Resource
|
||||
private BusinessDataFileMapper businessDataFileMapper;
|
||||
|
||||
@ApiOperation(value = "分页查询文件", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public Result pageSelect(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(defaultValue = "0") Long folderId,
|
||||
@RequestParam(required = false) String fileName) {
|
||||
PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName);
|
||||
return Result.ok(pageBean);
|
||||
}
|
||||
// @ApiOperation(value = "分页查询文件", httpMethod = "GET")
|
||||
// @GetMapping("/list")
|
||||
// public Result pageSelect(@RequestParam(defaultValue = "1") Integer page,
|
||||
// @RequestParam(defaultValue = "10") Integer pageSize,
|
||||
// @RequestParam(defaultValue = "0") Long folderId,
|
||||
// @RequestParam(required = false) String fileName) {
|
||||
// PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName);
|
||||
// return Result.ok(pageBean);
|
||||
// }
|
||||
@ApiOperation(value = "分页查询文件", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public Result pageSelect(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(defaultValue = "0") Long folderId,
|
||||
@RequestParam(required = false) String fileName,
|
||||
@RequestParam(required = false) String sortField,
|
||||
@RequestParam(required = false) String sortOrder) {
|
||||
PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName, sortField, sortOrder);
|
||||
return Result.ok(pageBean);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "增加文件")
|
||||
@PostMapping("/add")
|
||||
|
|
|
@ -15,6 +15,8 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import com.dite.znpt.domain.vo.ReceiptRequest;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -103,9 +105,50 @@ public class EquipmentController {
|
|||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页查询设备盘库记录", httpMethod = "GET")
|
||||
@GetMapping("/inventory/page")
|
||||
public PageResult<EquipmentResp> inventoryPage(EquipmentListReq req) {
|
||||
log.info("=== 设备盘库记录查询接口被调用 ===");
|
||||
log.info("接收到的请求参数: {}", req);
|
||||
|
||||
IPage<EquipmentResp> page = equipmentService.inventoryPage(req);
|
||||
return PageResult.ok(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "执行设备盘库", httpMethod = "POST")
|
||||
@PostMapping("/inventory/{equipmentId}")
|
||||
public Result<?> executeInventory(
|
||||
@PathVariable String equipmentId,
|
||||
@RequestParam String inventoryResult,
|
||||
@RequestParam(required = false) String remark) {
|
||||
equipmentService.executeInventory(equipmentId, inventoryResult, remark);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量执行设备盘库", httpMethod = "POST")
|
||||
@PostMapping("/inventory/batch")
|
||||
public Result<?> batchExecuteInventory(
|
||||
@RequestParam List<String> equipmentIds,
|
||||
@RequestParam String inventoryResult,
|
||||
@RequestParam(required = false) String remark) {
|
||||
equipmentService.batchExecuteInventory(equipmentIds, inventoryResult, remark);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取采购统计信息", httpMethod = "GET")
|
||||
@GetMapping("/procurement/stats")
|
||||
public Result<?> getProcurementStats(){
|
||||
return Result.ok(equipmentService.getProcurementStats());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "确认收货并自动入库", httpMethod = "POST")
|
||||
@PostMapping("/procurement/receipt/{equipmentId}")
|
||||
public Result<?> receiveGoods(@PathVariable String equipmentId, @Validated @RequestBody ReceiptRequest req) {
|
||||
log.info("=== 设备收货接口被调用 ===");
|
||||
log.info("设备ID: {}", equipmentId);
|
||||
log.info("收货数据: {}", req);
|
||||
|
||||
equipmentService.receiveGoodsAndStockIn(equipmentId, req);
|
||||
return Result.ok("收货成功,设备已自动入库");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
import cn.hutool.core.io.LimitedInputStream;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.entity.ExpenseTypeEntity;
|
||||
import com.dite.znpt.service.ExpenseTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "支出类型信息")
|
||||
@RestController
|
||||
@RequestMapping("/expenseType")
|
||||
public class ExpenseTypeController {
|
||||
@Resource
|
||||
private ExpenseTypeService expenseTypeService;
|
||||
|
||||
@GetMapping("")
|
||||
@ApiOperation(value = "查询一级支出类型", httpMethod = "GET")
|
||||
public Result<List<ExpenseTypeEntity>> list() {
|
||||
QueryWrapper<ExpenseTypeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.isNull("parent_id");
|
||||
List<ExpenseTypeEntity> list = expenseTypeService.list(queryWrapper);
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("/{pid}")
|
||||
@ApiOperation(value = "查询二级支出类型", httpMethod = "GET")
|
||||
public Result<List<ExpenseTypeEntity>> list2(@PathVariable Integer pid) {
|
||||
QueryWrapper<ExpenseTypeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("parent_id", pid);
|
||||
List<ExpenseTypeEntity> list = expenseTypeService.list(queryWrapper);
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
@PostMapping("")
|
||||
@ApiOperation(value = "新增支出类型", httpMethod = "POST")
|
||||
public Result<Boolean> save(@RequestBody ExpenseTypeEntity expenseTypeEntity) {
|
||||
boolean b = expenseTypeService.save(expenseTypeEntity);
|
||||
return Result.ok(b);
|
||||
}
|
||||
|
||||
@PutMapping("")
|
||||
@ApiOperation(value = "更新支出类型", httpMethod = "PUT")
|
||||
public Result<Boolean> update(@RequestBody ExpenseTypeEntity expenseTypeEntity) {
|
||||
boolean b = expenseTypeService.updateById(expenseTypeEntity);
|
||||
return Result.ok(b);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation(value = "删除支出类型", httpMethod = "DELETE")
|
||||
public Result<Boolean> delete(@PathVariable Integer id) {
|
||||
boolean b = expenseTypeService.removeById(id);
|
||||
return Result.ok(b);
|
||||
}
|
||||
|
||||
@GetMapping("search/{key}")
|
||||
@ApiOperation(value = "查询支出类型", httpMethod = "GET")
|
||||
public Result<List<ExpenseTypeEntity>> search(@PathVariable String key) {
|
||||
List<ExpenseTypeEntity> list = expenseTypeService.search(key);
|
||||
return Result.ok(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.vo.GanttChartReq;
|
||||
import com.dite.znpt.domain.vo.GanttChartResp;
|
||||
import com.dite.znpt.service.GanttChartService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 甘特图控制器
|
||||
*/
|
||||
@Api(tags = "甘特图管理")
|
||||
@RestController
|
||||
@RequestMapping("/gantt-chart")
|
||||
public class GanttChartController {
|
||||
|
||||
@Resource
|
||||
private GanttChartService ganttChartService;
|
||||
|
||||
@ApiOperation(value = "获取项目甘特图数据", httpMethod = "GET")
|
||||
@GetMapping("/data")
|
||||
public Result<List<GanttChartResp>> getGanttChartData(GanttChartReq req) {
|
||||
List<GanttChartResp> data = ganttChartService.getGanttChartData(req);
|
||||
return Result.ok(data);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取项目甘特图统计信息", httpMethod = "GET")
|
||||
@GetMapping("/statistics/{projectId}")
|
||||
public Result<Object> getGanttChartStatistics(@PathVariable String projectId) {
|
||||
Object statistics = ganttChartService.getGanttChartStatistics(projectId);
|
||||
return Result.ok(statistics);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取项目甘特图时间轴信息", httpMethod = "GET")
|
||||
@GetMapping("/timeline/{projectId}")
|
||||
public Result<Object> getGanttChartTimeline(@PathVariable String projectId) {
|
||||
Object timeline = ganttChartService.getGanttChartTimeline(projectId);
|
||||
return Result.ok(timeline);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新任务进度", httpMethod = "PUT")
|
||||
@PutMapping("/progress/{taskId}")
|
||||
public Result<Boolean> updateTaskProgress(@PathVariable String taskId, @RequestParam Integer progress) {
|
||||
boolean success = ganttChartService.updateTaskProgress(taskId, progress);
|
||||
return Result.ok(success);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "拖拽更新任务时间", httpMethod = "PUT")
|
||||
@PutMapping("/time/{taskId}")
|
||||
public Result<Boolean> updateTaskTime(@PathVariable String taskId,
|
||||
@RequestParam(required = false) String startDate,
|
||||
@RequestParam(required = false) String endDate) {
|
||||
boolean success = ganttChartService.updateTaskTime(taskId, startDate, endDate);
|
||||
return Result.ok(success);
|
||||
}
|
||||
}
|
|
@ -4,9 +4,11 @@ package com.dite.znpt.web.controller;
|
|||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import com.dite.znpt.domain.entity.ContractEntity;
|
||||
import com.dite.znpt.domain.entity.EquipmentEntity;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.service.ContractService;
|
||||
import com.dite.znpt.service.EquipmentService;
|
||||
import com.dite.znpt.service.ProjectService;
|
||||
import com.dite.znpt.domain.Result;
|
||||
|
@ -38,6 +40,9 @@ public class ProjectController {
|
|||
@Resource
|
||||
private EquipmentService equipmentService;
|
||||
|
||||
@Resource
|
||||
private ContractService contractService;
|
||||
|
||||
@ApiOperation(value = "分页查询项目信息列表", httpMethod = "GET")
|
||||
@GetMapping("/page")
|
||||
public PageResult<ProjectListResp> page(ProjectListReq req) {
|
||||
|
@ -112,4 +117,13 @@ public class ProjectController {
|
|||
queryWrapper.eq("project_id", projectId);
|
||||
return Result.ok(equipmentService.list(queryWrapper));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询未立项的合同列表", httpMethod = "GET")
|
||||
@GetMapping("/contracts")
|
||||
public Result<List<ContractEntity>> contracts() {
|
||||
QueryWrapper<ContractEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("contract_status", "未立项");
|
||||
return Result.ok(contractService.list(queryWrapper));
|
||||
}
|
||||
|
||||
}
|
|
@ -45,7 +45,7 @@ public class ProjectMemberController {
|
|||
@PutMapping("/team-member/{memberId}")
|
||||
public Result<ProjectMemberResp> updateTeamMember(
|
||||
@PathVariable String memberId,
|
||||
@Valid @RequestBody TeamMemberReq req) {
|
||||
@RequestBody TeamMemberUpdateReq req) {
|
||||
return Result.ok(projectMemberService.updateTeamMember(memberId, req));
|
||||
}
|
||||
|
||||
|
|
|
@ -118,10 +118,14 @@ public class ProjectTaskController {
|
|||
@GetMapping("/{projectId}/tasks")
|
||||
public Result<ProjectTasksDetailResp> getTaskByProjectId(@PathVariable String projectId) {
|
||||
ProjectTasksDetailResp resp = new ProjectTasksDetailResp();
|
||||
resp.setTotal(0);
|
||||
resp.setFinished(0);
|
||||
resp.setProjectName(projectService.getById(projectId).getProjectName());
|
||||
resp.setList(projectTaskService.getTaskByProjectId(projectId));
|
||||
resp.setTotal(resp.getList().size());
|
||||
resp.setFinished((int) resp.getList().stream().filter(projectTaskResp -> projectTaskResp.getStatus() == 2).count());
|
||||
for (ProjectTaskResp projectTaskResp : resp.getList()) {
|
||||
resp.setTotal(resp.getTotal() + projectTaskResp.getScales());
|
||||
resp.setFinished(resp.getFinished() + projectTaskResp.getFinished());
|
||||
}
|
||||
return Result.ok(resp);
|
||||
}
|
||||
}
|
|
@ -79,5 +79,13 @@ public class UserController {
|
|||
userService.deleteById(userId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据姓名模糊查询用户", httpMethod = "GET")
|
||||
@GetMapping("/searchByName")
|
||||
public PageResult<UserListResp> searchByName(@RequestParam String name) {
|
||||
UserListReq req = new UserListReq();
|
||||
req.setName(name);
|
||||
return PageResult.ok(userService.list(req));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.entity.VideoMonitorEntity;
|
||||
import com.dite.znpt.service.VideoMonitorService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hedechao
|
||||
* @date 2025/8/8 17:15
|
||||
* @Description:
|
||||
*/
|
||||
@Api(tags = "视频监测")
|
||||
@RestController
|
||||
@RequestMapping("/video-monitor")
|
||||
@RequiredArgsConstructor
|
||||
public class VideoMonitorController {
|
||||
@Resource
|
||||
VideoMonitorService videoService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
public PageResult<VideoMonitorEntity> page(@RequestParam(defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam String projectId,
|
||||
@RequestParam(required = false) String turbineId) {
|
||||
return videoService.page(pageNo, pageSize, projectId, turbineId);
|
||||
}
|
||||
|
||||
@ApiOperation("列表查询")
|
||||
@GetMapping("/list")
|
||||
public Result<List<VideoMonitorEntity>> list(@RequestParam(required = false) String projectId,
|
||||
@RequestParam(required = false) String turbineId) {
|
||||
return Result.ok(videoService.list(projectId, turbineId));
|
||||
}
|
||||
|
||||
@ApiOperation("批量上传")
|
||||
@PostMapping("/{projectId}/upload-batch")
|
||||
public Result<List<VideoMonitorEntity>> uploadBatch(@PathVariable String projectId,
|
||||
@RequestParam(required = false) String turbineId,
|
||||
@RequestParam String type,
|
||||
@RequestParam("files") MultipartFile[] files) throws IOException {
|
||||
return Result.ok(videoService.uploadBatch(projectId, turbineId, type, files));
|
||||
}
|
||||
|
||||
@ApiOperation("单文件上传")
|
||||
@PostMapping("/{projectId}/upload")
|
||||
public Result<VideoMonitorEntity> upload(@PathVariable String projectId,
|
||||
@RequestParam(required = false) String turbineId,
|
||||
@RequestParam String type,
|
||||
@RequestParam("file") MultipartFile file) throws IOException {
|
||||
return Result.ok(videoService.upload(projectId, turbineId, type, file));
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{videoId}")
|
||||
public Result<?> delete(@PathVariable String videoId) {
|
||||
videoService.delete(videoId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("下载/播放")
|
||||
@GetMapping("/download/{videoId}")
|
||||
public void download(@PathVariable String videoId, HttpServletResponse response) throws IOException {
|
||||
videoService.download(videoId, response);
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ spring:
|
|||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://39.99.201.243:3306/znpt_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://39.99.201.243:3306/test01?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: BUw8YW6%@^8q
|
||||
druid:
|
||||
|
|
Loading…
Reference in New Issue