ca152b2d 康伟

kangwei:设备月报完善搜索接口

          设备统计及分析--- 设备状态接口
1 个父辈 b80ca998
正在显示 15 个修改的文件 包含 187 行增加30 行删除
......@@ -21,6 +21,7 @@ import java.util.Date;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.safe.service.IDangerLevelManageService;
import com.skua.modules.safe.vo.DangerLevelManageVO;
import lombok.extern.slf4j.Slf4j;
......@@ -57,6 +58,8 @@ public class DangerInspectionRecordController {
@Autowired
private IDangerInspectionRecordService inspectionRecordService ;//巡检对象
@Autowired
private IDangerLevelManageService dangerLevelManageService;
/**
* <pre>
* 分页列表查询
......@@ -99,6 +102,10 @@ public class DangerInspectionRecordController {
if(StringUtils.isNotBlank(dangerInspectionRecord.getEndTime())){
queryWrapper.le("report_date", dangerInspectionRecord.getEndTime() ) ;
}
//风险区域位置、风险等级(搜索条件也加)
if(StringUtils.isNotBlank(dangerInspectionRecord.getDangerLevel())){
queryWrapper.eq("danger_level", dangerInspectionRecord.getDangerLevel() ) ;
}
queryWrapper.orderByAsc("depart_id");
queryWrapper.orderByAsc("equipInfoId");
IPage<DangerInspectionRecord> pageList = dangerInspectionRecordService.page(page, queryWrapper);
......@@ -114,6 +121,11 @@ public class DangerInspectionRecordController {
public Result<DangerInspectionRecord> add(@RequestBody DangerInspectionRecord dangerInspectionRecord) {
Result<DangerInspectionRecord> result = new Result<DangerInspectionRecord>();
try {
DangerLevelManage dangerLevelManage = dangerLevelManageService.queryById(dangerInspectionRecord.getDangerId());
if(dangerLevelManage != null ){
dangerInspectionRecord.setDangerName(dangerLevelManage.getDangerName() );
dangerInspectionRecord.setDangerLevel(dangerLevelManage.getDangerLevel() ) ;
}
dangerInspectionRecordService.save(dangerInspectionRecord);
result.success("添加成功!");
} catch (Exception e) {
......@@ -140,6 +152,12 @@ public class DangerInspectionRecordController {
if(dangerInspectionRecordEntity==null) {
result.error500("未找到对应实体");
}else {
DangerLevelManage dangerLevelManage = dangerLevelManageService.queryById(dangerInspectionRecord.getDangerId());
if(dangerLevelManage != null ){
dangerInspectionRecord.setDangerName(dangerLevelManage.getDangerName() );
dangerInspectionRecord.setDangerLevel(dangerLevelManage.getDangerLevel() ) ;
}
boolean ok = dangerInspectionRecordService.updateById(dangerInspectionRecord);
//TODO 返回false说明什么?
if(ok) {
......
......@@ -77,7 +77,10 @@ public class APPDangerInspectionRecordController {
if(StringUtils.isNotBlank(dangerInspectionRecord.getStatus())){
queryWrapper.eq("status", dangerInspectionRecord.getStatus() ) ;
}
//风险区域位置、风险等级(搜索条件也加)
if(StringUtils.isNotBlank(dangerInspectionRecord.getDangerLevel())){
queryWrapper.eq("danger_level", dangerInspectionRecord.getDangerLevel() ) ;
}
queryWrapper.orderByDesc("report_date");
// queryWrapper.eq("report_user", BaseContextHandler.getUserId());
IPage<DangerInspectionRecord> pageList = dangerInspectionRecordService.page(page, queryWrapper);
......
......@@ -37,12 +37,12 @@ public class DangerInspectionRecord {
@Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name")
private String departId;
/**风险等级编号*/
@Excel(name = "风险等级编号", width = 15)
@ApiModelProperty(value = "风险等级编号")
@Excel(name = "风险区域名称编号", width = 15)
@ApiModelProperty(value = "风险区域名称编号")
private String dangerId;
/**风险等级编号*/
@Excel(name = "风险等级名称", width = 15)
@ApiModelProperty(value = "风险等级名称")
@Excel(name = "风险区域名称", width = 15)
@ApiModelProperty(value = "风险区域名称")
private String dangerName;
@Excel(name = "关联设备", width = 15)
......@@ -114,7 +114,8 @@ public class DangerInspectionRecord {
@ApiModelProperty(value = "条件:结束时间")
private String endTime;
@ApiModelProperty(value = "风险等级")
@Dict(dicCode = "dangerLevel")
private String dangerLevel;
}
......
......@@ -46,6 +46,9 @@ public class DangerInspectionRecordVO {
@ApiModelProperty(value = "风险等级名称")
private String dangerName;
@ApiModelProperty(value = "风险等级")
private String dangerLevel;
@ApiModelProperty(value = "巡检状态(1:开始,2:结束)")
private String status;
......
......@@ -179,7 +179,7 @@ public class EquipmentStatisticsController {
}
@ApiOperation(value = "A类设备运行-设备运行时长列表", notes = "A类设备运行-设备运行时长列表")
@ApiOperation(value = "A类设备运行-设备运行时长--详情列表", notes = "A类设备运行-设备运行时长--详情列表")
@GetMapping(value = "/equipmentOperationRecordList")
public Result<List<Map<String, Object>>> equipmentOperationRecordDetail(String departId,String equipmentId, String startTime, String endTime) {
Result<List<Map<String, Object>>> result = new Result<>();
......
......@@ -55,7 +55,7 @@ public class EquipmentRepairReportController {
}
@AutoLog(value = "维修维护报表-维修工单列表")
@ApiOperation(value = "维修维护报表-维修工单列表", notes = "维修维护报表-维修工单列表")
@ApiOperation(value = "维修维护报表-维护工单列表", notes = "维修维护报表-维护工单列表")
@GetMapping(value = "/maintainTaskList")
public Result<IPage<EquipmentMaintainTaskForm>> maintainTaskList(EquipmentMaintainTaskForm maintainTaskForm,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
......
......@@ -76,4 +76,6 @@ public interface EquipmentMaintainTaskMapper extends BaseMapper<EquipmentMaintai
* @return
*/
List<EquipmentMaintainTaskForm> queryMaintainTaskFormByList(EquipmentMaintainTaskForm maintainTaskForm);
IPage<EquipmentMaintainTaskForm> queryMaintainTaskFormByPage(Page<EquipmentMaintainTaskForm> page, @Param("param") EquipmentMaintainTaskForm maintainTaskForm);
}
......
......@@ -50,6 +50,8 @@ public interface EquipmentRepairMapper extends BaseMapper<EquipmentRepair> {
*/
List<Map<String, Object>> queryStatistics(@Param(value = "equipmentRepairVO")EquipmentRepairVO equipmentRepairVO);
List<EquipmentRepairForm> queryRepairFormByPage(Page<EquipmentRepairForm> page,@Param("param") EquipmentRepairForm equipmentRepairForm);
/**
* 维修维护报表-维修工单列表
* @param equipmentRepairForm
......
......@@ -201,10 +201,51 @@
</select>
<!-- 维修维护报表-维修工单列表 -->
<select id="queryMaintainTaskFormByPage" resultType="com.skua.modules.equipment.vo.EquipmentMaintainTaskForm">
select aaa.* from (
select t.depart_id, d.depart_name, ei.equipment_name, ec.id 'equipment_category_id', ec.des 'equipment_category', emp.maintenance_type, di.item_text 'maintenance_type_name', t.maintain_plan_name ,
DATE_FORMAT(emp.start_time,'%Y-%m-%d') start_time ,DATE_FORMAT(emp.end_time,'%Y-%m-%d') end_time,u.realname 'maintenanceUser' , ems.maintenance_content
from equipment_maintain_task t
left join sys_depart d on d.id = t.depart_id
left join equipment_maintain_plan emp on t.plan_id = emp.id
left join sys_dict_item di on di.item_value = emp.maintenance_type
left join sys_user u on u.id = t.maintainer_id
LEFT JOIN equipment_maintain_plan_standard eps ON eps.plan_id = emp.id
LEFT JOIN equipment_maintain_standard ems ON ems.id = eps.standard_id
left join equipment_info ei on ei.id = t.equipment_id
left join equipment_category ec on ei.equipment_type = ec.id
)aaa
<where>
<if test=" param.departId != null and param.departId !=''">
and aaa.depart_id = #{param.departId}
</if>
<if test=" param.departIds != null and param.departIds !=''">
and aaa.depart_id in(${param.departIds})
</if>
<if test=" param.equipmentCategory != null and param.equipmentCategory !=''">
and aaa.equipment_category_id = #{param.equipmentCategory}
</if>
<if test=" param.maintenanceType != null and param.maintenanceType !=''">
and aaa.maintenance_type = #{param.maintenanceType}
</if>
<if test=" param.startTime != null and param.startTime !=''">
and DATE_FORMAT(aaa.start_time,'%Y-%m-%d') &gt;= #{param.startTime}
</if>
<if test=" param.endTime != null and param.endTime !=''">
and DATE_FORMAT(aaa.end_time,'%Y-%m-%d') &lt;= #{param.endTime}
</if>
</where>
order by aaa.end_time desc
</select>
<select id="queryMaintainTaskFormByList" resultType="com.skua.modules.equipment.vo.EquipmentMaintainTaskForm">
select aaa.* from (
select t.depart_id, ei.equipment_name, ec.id 'equipment_category_id', ec.des 'equipment_category', emp.maintenance_type, di.item_text 'maintenance_type_name', t.maintain_plan_name , emp.start_time ,emp.end_time,u.realname 'maintenanceUser' , ems.maintenance_content
select t.depart_id, d.depart_name, ei.equipment_name, ec.id 'equipment_category_id', ec.des 'equipment_category', emp.maintenance_type, di.item_text 'maintenance_type_name', t.maintain_plan_name , DATE_FORMAT(emp.start_time,'%Y-%m-%d') start_time ,DATE_FORMAT(emp.end_time,'%Y-%m-%d') end_time,u.realname 'maintenanceUser' , ems.maintenance_content
from equipment_maintain_task t
left join sys_depart d on d.id = t.depart_id
left join equipment_maintain_plan emp on t.plan_id = emp.id
left join sys_dict_item di on di.item_value = emp.maintenance_type
left join sys_user u on u.id = t.maintainer_id
......@@ -226,11 +267,11 @@
<if test="maintenanceType != null and maintenanceType !=''">
and aaa.maintenance_type = #{maintenanceType}
</if>
<if test="startTime != null and startTime !=''">
and aaa.start_time &gt;= #{startTime}
<if test=" param.startTime != null and param.startTime !=''">
and DATE_FORMAT(aaa.start_time,'%Y-%m-%d') &gt;= #{param.startTime}
</if>
<if test="endTime != null and endTime !=''">
and aaa.end_time &lt;= #{endTime}
<if test=" param.endTime != null and param.endTime !=''">
and DATE_FORMAT(aaa.end_time,'%Y-%m-%d') &lt;= #{param.endTime}
</if>
</where>
......
......@@ -115,19 +115,84 @@
group by a.finish_flag
</select>
<!-- 维修维护报表-维修工单列表 -->
<select id="queryRepairFormByPage" resultType="com.skua.modules.equipment.vo.EquipmentRepairForm">
select aaa.* from (
select
er.depart_id ,d.depart_name,ei.id 'infoId',er.finish_flag,
ei.equipment_name , ei.equipment_type 'equipment_category_id', ec.des 'equipment_category', di.item_text 'maintenance_type',
ifnull(u.realname,'-') 'maintenance_user',
er.repair_date,er.fault_reason,er.is_stop,er.reality_maintenance_start_time,er.reality_maintenance_end_time,
ifnull(EXTRACT(HOUR FROM (er.reality_maintenance_end_time - er.repair_date)),0) AS stopTime,
ifnull(er.fault_library_id,'-') 'repair_content'
from equipment_repair er
left join sys_depart d on er.depart_id = d.id
left join equipment_info ei on ei.id = er.info_id
left join equipment_category ec on ei.equipment_type = ec.id
left join sys_user u on er.maintenance_user = u.id
left join sys_dict_item di on di.item_value = er.maintenance_type
)aaa
<where>
<if test="param.departId != null and param.departId !=''">
and aaa.depart_id = #{param.departId}
</if>
<if test="param.departIds != null and param.departIds !=''">
and aaa.depart_id in(${param.departIds})
</if>
<!--<if test="param.startTime != null and param.startTime !=''">
and aaa.repair_date &gt;= #{param.startTime}
</if>
<if test="param.departIds != null and param.departIds !=''">
and aaa.repair_date &lt;= #{param.endTime}
</if>-->
<if test="param.finishFlag != null and param.finishFlag !=''">
and aaa.finish_flag in (${param.finishFlag})
</if>
<!-- 维修维护报表-维修工单列表 -->
<select id="queryRepairFormList" resultType="com.skua.modules.equipment.vo.EquipmentMaintainTaskForm">
<if test="param.repairDate != null and param.repairDate !=''">
and DATE_FORMAT(aaa.repair_date,'%Y-%m-%d') = #{param.repairDate}
</if>
<if test="param.realityMaintenanceEndTime != null and param.realityMaintenanceEndTime !=''">
and aaa.reality_maintenance_end_time = #{param.realityMaintenanceEndTime}
</if>
<if test="param.repairDate_begin != null and param.repairDate_begin !=''">
and DATE_FORMAT(aaa.repair_date,'%Y-%m-%d') &gt;= #{param.repairDate_begin}
</if>
<if test="param.repairDate_end != null and param.repairDate_end !=''">
and DATE_FORMAT(aaa.repair_date,'%Y-%m-%d') &lt;= #{param.repairDate_end}
</if>
<if test=" param.realityMaintenanceEndTime_begin != null and param.realityMaintenanceEndTime_begin !=''">
and DATE_FORMAT(aaa.reality_maintenance_end_time,'%Y-%m-%d') &gt;= #{param.realityMaintenanceEndTime_begin}
</if>
<if test=" param.realityMaintenanceEndTime_end != null and param.realityMaintenanceEndTime_end !=''">
and DATE_FORMAT(aaa.reality_maintenance_end_time,'%Y-%m-%d') &lt;= #{param.realityMaintenanceEndTime_end}
</if>
<if test="param.equipmentCategory != null and param.equipmentCategory !=''">
and aaa.equipment_category_id = #{param.equipmentCategory}
</if>
<if test="param.maintenanceType != null and param.maintenanceType !=''">
and aaa.maintenance_type = #{param.maintenanceType}
</if>
</where>
order by aaa.repair_date desc
</select>
<select id="queryRepairFormList" resultType="com.skua.modules.equipment.vo.EquipmentRepairForm">
select aaa.* from (
select
er.depart_id ,
ei.equipment_name , ec.des 'equipment_category', di.item_text 'maintenance_type',
er.depart_id ,d.depart_name,ei.id 'infoId',er.finish_flag,
ei.equipment_name , ei.equipment_type 'equipment_category_id', ec.des 'equipment_category', di.item_text 'maintenance_type',
ifnull(u.realname,'-') 'maintenance_user',
er.repair_date,er.fault_reason,er.is_stop,er.reality_maintenance_start_time,er.reality_maintenance_end_time,
ifnull(EXTRACT(HOUR FROM (er.reality_maintenance_end_time - er.repair_date)),0) AS stopTime,
ifnull(er.fault_library_id,'-') 'repair_content'
from equipment_repair er
left join sys_depart d on er.depart_id = d.id
left join equipment_info ei on ei.id = er.info_id
left join equipment_category ec on ei.equipment_type = ec.id
left join sys_user u on er.maintenance_user = u.id
......
......@@ -365,9 +365,7 @@ public class EquipmentMaintainTaskServiceImpl extends ServiceImpl<EquipmentMaint
* @return
*/
public IPage<EquipmentMaintainTaskForm> queryMaintainTaskFormByPage(Page<EquipmentMaintainTaskForm> page, EquipmentMaintainTaskForm maintainTaskForm){
List<EquipmentMaintainTaskForm> dataList = this.baseMapper.queryMaintainTaskFormByList(maintainTaskForm);
page.setRecords(dataList);
return page;
return this.baseMapper.queryMaintainTaskFormByPage(page,maintainTaskForm);
}
/**
* 列表
......
......@@ -303,7 +303,7 @@ public class EquipmentRepairServiceImpl extends ServiceImpl<EquipmentRepairMappe
*/
public IPage<EquipmentRepairForm> queryRepairFormByPage(Page<EquipmentRepairForm> page, EquipmentRepairForm equipmentRepairForm){
List<EquipmentRepairForm> dataList = this.baseMapper.queryRepairFormList(equipmentRepairForm);
List<EquipmentRepairForm> dataList = this.baseMapper.queryRepairFormByPage(page,equipmentRepairForm);
page.setRecords(dataList);
return page;
}
......
......@@ -14,6 +14,7 @@ import com.skua.modules.equipment.vo.*;
import com.skua.tool.util.DateUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -39,6 +40,8 @@ import java.util.*;
public class ProductionEquipmentServiceImpl implements IProductionEquipmentService {
@Autowired
private ProductionEquipmentMapper productionEquipmentMapper;
@Autowired
private ICommonSqlService commonSqlService;
private static final String MONTH_START = "-01 00:00:00";
private static final String MONTH_END = "-31 23:59:59";
......@@ -436,7 +439,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
@Override
public List<TOPTenVO> getEquipmentState(ReportStatisticsDTO reportStatisticsDTO) {
List<TOPTenVO> list = new ArrayList<>();
TOPTenVO topTenVO = new TOPTenVO();
/* TOPTenVO topTenVO = new TOPTenVO();
reportStatisticsDTO.setEquipmentType("wxdd");
Integer equipmentStatus = productionEquipmentMapper.getEquipmentStatus(reportStatisticsDTO);
topTenVO.setFactoryName("待修");
......@@ -447,7 +450,22 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
Integer equipmentStatus1 = productionEquipmentMapper.getEquipmentStatus(reportStatisticsDTO);
topTenVO1.setFactoryName("在修");
topTenVO1.setNum(equipmentStatus1.toString());
list.add(topTenVO1);
list.add(topTenVO1);*/
String sql = "select count(1) from equipment_repair where del_flag = 1 AND finish_flag = 'djx' AND create_time >='"+reportStatisticsDTO.getStartTime()+"' AND create_time >='"+reportStatisticsDTO.getEndTime()+"'";
if(StringUtils.isNotEmpty(reportStatisticsDTO.getDepartIds() )){
sql += " and depart_id in("+JSUtils.quoteEach(reportStatisticsDTO.getDepartIds(),",")+") ";
}
String dx_num = commonSqlService.queryForString(sql);//待修
sql = "select count(1) from equipment_repair where del_flag = 1 AND finish_flag in ('sbzx','wwwx') AND create_time >='"+reportStatisticsDTO.getStartTime()+"' AND create_time >='"+reportStatisticsDTO.getEndTime()+"'";
if(StringUtils.isNotEmpty(reportStatisticsDTO.getDepartIds() )){
sql += " and depart_id in("+JSUtils.quoteEach(reportStatisticsDTO.getDepartIds(),",")+") ";
}
String zx_num = commonSqlService.queryForString(sql);//在修
list.add(new TOPTenVO("待修",dx_num));
list.add(new TOPTenVO("在修",zx_num));
return list;
}
......
package com.skua.modules.equipment.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.skua.core.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -45,6 +46,7 @@ public class EquipmentMaintainTaskForm {
@Excel(name = "维护保养类型", width = 15)
@ApiModelProperty(value = "维护保养类型")
@Dict(dicCode = "maintenance_type")
private String maintenanceType;
@Excel(name = "设备分类名称", width = 15)
......@@ -60,14 +62,10 @@ public class EquipmentMaintainTaskForm {
private String maintenanceContent;
@ApiModelProperty(value = "计划开始时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
private String startTime;
@ApiModelProperty(value = "计划结束时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
private String endTime;
@Excel(name = "停机时间(H)", width = 15)
@ApiModelProperty(value = "停机时间")
......
......@@ -21,4 +21,12 @@ public class TOPTenVO {
@ApiModelProperty(value = "对应值")
private String num;
private String typeId;
public TOPTenVO() {
}
public TOPTenVO(String factoryName, String num) {
this.factoryName = factoryName;
this.num = num;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!