【需求】设备故障分析接口完善

dev
zengchenxi 6 months ago
parent f6e3339966
commit 7d8defe6e6

@ -1,33 +1,30 @@
package com.chanko.yunxi.mes.module.biz.controller.admin.scequipment; package com.chanko.yunxi.mes.module.biz.controller.admin.scequipment;
import org.springframework.web.bind.annotation.*; import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam; import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils;
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.chanko.yunxi.mes.module.biz.controller.admin.scequipment.vo.*; import com.chanko.yunxi.mes.module.biz.controller.admin.scequipment.vo.*;
import com.chanko.yunxi.mes.module.biz.dal.dataobject.scequipment.ScEquipmentDO; import com.chanko.yunxi.mes.module.biz.dal.dataobject.scequipment.ScEquipmentDO;
import com.chanko.yunxi.mes.module.biz.dal.mysql.scequipment.ScEquipmentMapper;
import com.chanko.yunxi.mes.module.biz.service.scequipment.ScEquipmentService; import com.chanko.yunxi.mes.module.biz.service.scequipment.ScEquipmentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 数采设备表") @Tag(name = "管理后台 - 数采设备表")
@RestController @RestController
@ -37,6 +34,8 @@ public class ScEquipmentController {
@Resource @Resource
private ScEquipmentService scEquipmentService; private ScEquipmentService scEquipmentService;
@Resource
private ScEquipmentMapper scEquipmentMapper;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建数采设备表") @Operation(summary = "创建数采设备表")
@ -92,4 +91,18 @@ public class ScEquipmentController {
BeanUtils.toBean(list, ScEquipmentRespVO.class)); BeanUtils.toBean(list, ScEquipmentRespVO.class));
} }
@GetMapping("/down-time")
@Operation(summary = "查询停机时间信息")
@PreAuthorize("@ss.hasPermission('biz:sc-equipment:query')")
public CommonResult<List<ScDashboardResVO>> getDownTimeInfo(@Valid ScDashboardReqVO reqVO) {
return success(scEquipmentMapper.getDownTimeInfo(reqVO));
}
@GetMapping("/fault-time")
@Operation(summary = "查询停机时间信息")
@PreAuthorize("@ss.hasPermission('biz:sc-equipment:query')")
public CommonResult<List<ScDashboardResVO>> getFaultTimeInfo(@Valid ScDashboardReqVO reqVO) {
return success(scEquipmentMapper.getFaultTimeInfo(reqVO));
}
} }

@ -0,0 +1,27 @@
package com.chanko.yunxi.mes.module.biz.controller.admin.scequipment.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* @author chenxi
* @date 2024-05-09 16:36
*/
@Data
public class ScDashboardReqVO {
@Schema(description = "设备id")
@NotNull(message = "设备id 不能为空")
private Long id;
@Schema(description = "开始日期")
@NotNull(message = "开始日期 不能为空")
private LocalDateTime startTime;
@Schema(description = "结束日期")
@NotNull(message = "结束日期 不能为空")
private LocalDateTime endTime;
}

@ -0,0 +1,21 @@
package com.chanko.yunxi.mes.module.biz.controller.admin.scequipment.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @author chenxi
* @date 2024-05-09 16:37
*/
@Data
public class ScDashboardResVO {
@Schema(description = "日期")
private LocalDateTime date;
@Schema(description = "时间")
private BigDecimal time;
}

@ -1,13 +1,18 @@
package com.chanko.yunxi.mes.module.biz.dal.mysql.scequipment; package com.chanko.yunxi.mes.module.biz.dal.mysql.scequipment;
import java.util.*;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.chanko.yunxi.mes.module.biz.controller.admin.scequipment.vo.ScDashboardReqVO;
import com.chanko.yunxi.mes.module.biz.controller.admin.scequipment.vo.ScDashboardResVO;
import com.chanko.yunxi.mes.module.biz.controller.admin.scequipment.vo.ScEquipmentPageReqVO;
import com.chanko.yunxi.mes.module.biz.dal.dataobject.scequipment.ScEquipmentDO; import com.chanko.yunxi.mes.module.biz.dal.dataobject.scequipment.ScEquipmentDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.chanko.yunxi.mes.module.biz.controller.admin.scequipment.vo.*; import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.StatementType;
import java.util.List;
/** /**
* Mapper * Mapper
@ -29,4 +34,11 @@ public interface ScEquipmentMapper extends BaseMapperX<ScEquipmentDO> {
.orderByDesc(ScEquipmentDO::getId)); .orderByDesc(ScEquipmentDO::getId));
} }
@Select("{CALL Down_Time(#{id,jdbcType=INTEGER,mode=IN}, #{startTime,jdbcType=DATE,mode=IN}, #{endTime,jdbcType=DATE,mode=IN},#{date,jdbcType=DATE,mode=OUT},#{time,jdbcType=DECIMAL,mode=OUT})}")
@Options(statementType = StatementType.CALLABLE)
List<ScDashboardResVO> getDownTimeInfo(ScDashboardReqVO reqVO);
@Select("{CALL Down_Time(#{id,jdbcType=INTEGER,mode=IN}, #{startTime,jdbcType=DATE,mode=IN}, #{endTime,jdbcType=DATE,mode=IN},#{time,jdbcType=DECIMAL,mode=OUT},#{date,jdbcType=DATE,mode=OUT})}")
@Options(statementType = StatementType.CALLABLE)
List<ScDashboardResVO> getFaultTimeInfo(ScDashboardReqVO reqVO);
} }

@ -29,7 +29,7 @@ public interface UnqualifiedNotificationMapper extends BaseMapperX<UnqualifiedNo
MPJLambdaWrapperX<UnqualifiedNotificationDO> query = new MPJLambdaWrapperX<>(); MPJLambdaWrapperX<UnqualifiedNotificationDO> query = new MPJLambdaWrapperX<>();
query.selectAll(UnqualifiedNotificationDO.class) query.selectAll(UnqualifiedNotificationDO.class)
.select("d.code as projectCode", "d.project_name as projectName") .select("d.code as projectCode", "d.project_name as projectName")
.select("f.name as projectSubName", "f.code as projectSubCode") .select("f.name as projectSubName", "f.code as projectSubCode", "f.spec")
.select("e.name as customerName") .select("e.name as customerName")
.select("u1.nickname as ownerName", "u2.nickname as creatorName", "u3.nickname as auditorName") .select("u1.nickname as ownerName", "u2.nickname as creatorName", "u3.nickname as auditorName")
.select("h.name as procedureName") .select("h.name as procedureName")
@ -70,7 +70,7 @@ public interface UnqualifiedNotificationMapper extends BaseMapperX<UnqualifiedNo
MPJLambdaWrapper<UnqualifiedNotificationDO> query = new MPJLambdaWrapper<>(); MPJLambdaWrapper<UnqualifiedNotificationDO> query = new MPJLambdaWrapper<>();
query.selectAll(UnqualifiedNotificationDO.class) query.selectAll(UnqualifiedNotificationDO.class)
.select("d.code as projectCode", "d.project_name as projectName") .select("d.code as projectCode", "d.project_name as projectName")
.select("f.name as projectSubName", "f.code as projectSubCode") .select("f.name as projectSubName", "f.code as projectSubCode", "f.spec")
.select("e.name as customerName") .select("e.name as customerName")
.select("u1.nickname as ownerName", "u2.nickname as creatorName", "u3.nickname as auditorName") .select("u1.nickname as ownerName", "u2.nickname as creatorName", "u3.nickname as auditorName")
.select("h.name as procedureName") .select("h.name as procedureName")
@ -95,7 +95,7 @@ public interface UnqualifiedNotificationMapper extends BaseMapperX<UnqualifiedNo
MPJLambdaWrapperX<UnqualifiedNotificationDO> query = new MPJLambdaWrapperX<>(); MPJLambdaWrapperX<UnqualifiedNotificationDO> query = new MPJLambdaWrapperX<>();
query.selectAll(UnqualifiedNotificationDO.class) query.selectAll(UnqualifiedNotificationDO.class)
.select("d.code as projectCode", "d.project_name as projectName") .select("d.code as projectCode", "d.project_name as projectName")
.select("f.name as projectSubName", "f.code as projectSubCode") .select("f.name as projectSubName", "f.code as projectSubCode", "f.spec")
.select("e.name as customerName") .select("e.name as customerName")
.select("i.name as workshopName") .select("i.name as workshopName")
.selectSum(UnqualifiedNotificationDO::getAmount, "statisticAmount") .selectSum(UnqualifiedNotificationDO::getAmount, "statisticAmount")

@ -40,3 +40,13 @@ export const deleteScEquipment = async (id: number) => {
export const exportScEquipment = async (params) => { export const exportScEquipment = async (params) => {
return await request.download({ url: `/biz/sc-equipment/export-excel`, params }) return await request.download({ url: `/biz/sc-equipment/export-excel`, params })
} }
// 查询停机时间信息
export const getDownTimeInfo = async (params) => {
return await request.get({ url: `/biz/sc-equipment/down-time`, params })
}
// 查询故障时间信息
export const getFaultTimeInfo = async (params) => {
return await request.get({ url: `/biz/sc-equipment/fault-time`, params })
}

Loading…
Cancel
Save