Merge remote-tracking branch 'origin/development' into development
This commit is contained in:
commit
f8503e3382
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -45,10 +45,10 @@ public class ContractEntity extends AuditableEntity implements Serializable {
|
|||
@TableField("code")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("项目id")
|
||||
@ApiModelProperty("项目id")
|
||||
@TableField("project_id")
|
||||
private String projectId;
|
||||
@ExcelProperty("项目名称")
|
||||
@ApiModelProperty("项目名称")
|
||||
@TableField("project_name")
|
||||
private String projectName;
|
||||
|
||||
@ExcelProperty("业务员id")
|
||||
@ApiModelProperty("业务员id")
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -32,8 +32,8 @@ public class ContractListReq implements Serializable {
|
|||
@ApiModelProperty("合同编号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("业务员id")
|
||||
private String salespersonId;
|
||||
|
|
|
@ -31,8 +31,8 @@ public class ContractReq implements Serializable {
|
|||
@ApiModelProperty("合同编号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("业务员id")
|
||||
private String salespersonId;
|
||||
|
|
|
@ -18,9 +18,6 @@ import java.math.BigDecimal;
|
|||
@ApiModel("合同响应实体")
|
||||
public class ContractResp extends ContractEntity {
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("业务员姓名")
|
||||
private String salespersonName;
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ public class EquipmentApprovalListReq implements Serializable {
|
|||
@ApiModelProperty("当前页码")
|
||||
private Integer page;
|
||||
|
||||
@ApiModelProperty("当前页码 - 与前端保持一致")
|
||||
private Integer pageNum;
|
||||
|
||||
@ApiModelProperty("每页大小")
|
||||
private Integer pageSize;
|
||||
|
||||
|
|
|
@ -38,4 +38,7 @@ public class ProjectInitTaskReq {
|
|||
@Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 100, message = "任务负责人id长度不能超过100字符")
|
||||
@ApiModelProperty("任务负责人id")
|
||||
private String mainUserId;
|
||||
|
||||
@ApiModelProperty("任务规模")
|
||||
private Integer scales;
|
||||
}
|
||||
|
|
|
@ -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,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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -72,4 +72,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,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;
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,15 +4,18 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.domain.entity.ContractEntity;
|
||||
import com.dite.znpt.domain.entity.ContractSettlementEntity;
|
||||
import com.dite.znpt.domain.vo.ContractListReq;
|
||||
import com.dite.znpt.domain.vo.ContractReq;
|
||||
import com.dite.znpt.domain.vo.ContractResp;
|
||||
import com.dite.znpt.enums.ContractStatusEnum;
|
||||
import com.dite.znpt.mapper.ContractMapper;
|
||||
import com.dite.znpt.service.ContractService;
|
||||
import com.dite.znpt.service.ContractSettlementService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -25,6 +28,8 @@ import java.util.List;
|
|||
@RequiredArgsConstructor
|
||||
public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEntity> implements ContractService {
|
||||
|
||||
private final ContractSettlementService contractSettlementService;
|
||||
|
||||
/**
|
||||
* 功能描述:查询合同列表
|
||||
*
|
||||
|
@ -96,9 +101,10 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
|
|||
* @date 2025/07/21 20:29
|
||||
**/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteById(String contractId) {
|
||||
// todo 校验
|
||||
removeById(contractId);
|
||||
contractSettlementService.lambdaUpdate().eq(ContractSettlementEntity::getContractId, contractId).remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,9 @@ 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;
|
||||
|
@ -41,10 +43,16 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
|
||||
@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");
|
||||
|
@ -52,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");
|
||||
|
@ -70,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
|
||||
|
@ -456,11 +500,13 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService {
|
|||
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<>();
|
||||
|
||||
// 只查询当前用户的申请
|
||||
|
@ -472,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,6 +16,8 @@ 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;
|
||||
|
@ -38,10 +40,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 +123,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 +138,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 +247,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 +264,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;
|
||||
|
@ -597,10 +506,14 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
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<>();
|
||||
|
@ -624,14 +537,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())) {
|
||||
|
@ -639,19 +547,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())) {
|
||||
|
@ -659,16 +557,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())) {
|
||||
|
@ -691,6 +597,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());
|
||||
|
@ -713,19 +624,23 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
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)
|
||||
|
@ -758,11 +673,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("设备不存在");
|
||||
}
|
||||
|
||||
|
@ -782,7 +698,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||
entity.setEquipmentId(equipmentId);
|
||||
this.updateById(entity);
|
||||
|
||||
log.info("设备采购记录修改成功,设备ID: {}", equipmentId);
|
||||
log.info("设备采购记录更新成功,设备ID: {}", equipmentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -818,4 +734,110 @@ 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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,9 +3,11 @@ 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;
|
||||
|
@ -16,12 +18,14 @@ import com.dite.znpt.domain.vo.ProjectReq;
|
|||
import com.dite.znpt.domain.vo.ProjectResp;
|
||||
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;
|
||||
|
||||
|
@ -47,6 +51,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
|
|||
|
||||
@Resource
|
||||
private ProjectTaskService projectTaskService;
|
||||
@Autowired
|
||||
private ContractMapper contractMapper;
|
||||
|
||||
/**
|
||||
* 功能描述:查询项目信息列表
|
||||
*
|
||||
|
@ -135,9 +142,18 @@ 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("contract_code", req.getProjectOrigin());
|
||||
ContractEntity contractEntity = contractMapper.selectOne(queryWrapper);
|
||||
contractEntity.setProjectId(entity.getProjectId());
|
||||
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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -3,22 +3,22 @@
|
|||
<mapper namespace="com.dite.znpt.mapper.ContractMapper">
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
a.contract_id, a.customer, a.code, a.project_id,
|
||||
a.contract_id, a.customer, a.code, a.project_name,
|
||||
a.salesperson_id, a.department_id, a.sign_date, a.duration,
|
||||
a.type, a.product_service, a.payment_date, a.payment_address,
|
||||
a.amount, a.account_number, a.notes, a.contract_status,
|
||||
a.create_time, a.create_by, a.update_time, a.update_by
|
||||
a.type, a.product_service, a.payment_date, a.performance_deadline,
|
||||
a.payment_address, a.amount, a.account_number, a.notes,
|
||||
a.contract_status, a.contract_text, a.create_time, a.create_by,
|
||||
a.update_time, a.update_by
|
||||
</sql>
|
||||
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.ContractResp">
|
||||
select
|
||||
<include refid="Base_Column_List"/>,
|
||||
u.name as salespersonName, d.dept_name as salespersonDeptName,
|
||||
p.project_name, (select sum(cs.amount) from contract_settlement cs where a.contract_id=cs.contract_id) as settlementAmount
|
||||
(select sum(cs.amount) from contract_settlement cs where a.contract_id=cs.contract_id) as settlementAmount
|
||||
from contract a
|
||||
left join user u on a.salesperson_id = u.user_id
|
||||
left join dept d on a.department_id=d.dept_id
|
||||
left join project p on a.project_id=p.project_id
|
||||
<where>
|
||||
<if test="contractId != null and contractId != ''">
|
||||
and a.contract_id like concat ('%', #{contractId}, '%')
|
||||
|
@ -29,8 +29,8 @@
|
|||
<if test="code != null and code != ''">
|
||||
and a.code like concat ('%', #{code}, '%')
|
||||
</if>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
and a.project_id like concat ('%', #{projectId}, '%')
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and a.project_name like concat ('%', #{projectName}, '%')
|
||||
</if>
|
||||
<if test="salespersonId != null and salespersonId != ''">
|
||||
and a.salesperson_id like concat ('%', #{salespersonId}, '%')
|
||||
|
@ -56,13 +56,13 @@
|
|||
<if test="accountNumber != null and accountNumber != ''">
|
||||
and a.account_number like concat ('%', #{accountNumber}, '%')
|
||||
</if>
|
||||
<if test="notes != null">
|
||||
and a.notes = #{notes}
|
||||
<if test="notes != null and notes != ''">
|
||||
and a.notes like concat ('%', #{notes}, '%')
|
||||
</if>
|
||||
<if test="contractStatus != null and contractStatus != ''">
|
||||
and a.contract_status like concat ('%', #{contractStatus}, '%')
|
||||
</if>
|
||||
<if test="contractText != null">
|
||||
<if test="contractText != null and contractText != ''">
|
||||
and a.contract_text like concat ('%', #{contractText}, '%')
|
||||
</if>
|
||||
</where>
|
||||
|
|
|
@ -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>
|
|
@ -15,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -103,6 +104,36 @@ 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(){
|
||||
|
|
|
@ -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.isNull("project_id");
|
||||
return Result.ok(contractService.list(queryWrapper));
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue