0b6b9df7 康伟

kangwei:备统计分析功能调试

       设备统计详情接口
       设备完好率详情接口
       维护维修费用
       维护维修费用详情接口
1 个父辈 0cd11034
......@@ -364,18 +364,19 @@ public class JSUtils {
public static String quoteEach(String str,String splitStr) {
if( str != null && str.length() > 0 ){
String[] items = str.split(splitStr);
StringBuilder sb = new StringBuilder();
String result = "";
for (int i = 0; i < items.length; i++) {
if (i > 0) {
sb.append(", ");
if(StringUtils.isNotEmpty(items[i])){
if(result.length()>0) result +=",";
result += "'"+items[i]+"'";
}
sb.append('\'').append(items[i]).append('\'');
}
return sb.toString();
return result;
}
return str;
}
/***
* 计算时间的前几个月的月份
* @param month
......@@ -395,7 +396,15 @@ public class JSUtils {
}
public static void main(String[] args) {
System.out.println(getMonthBytime(-12,"2024-12"));
//System.out.println(getMonthBytime(-12,"2024-12"));
String str = "11,22,33,44";
System.out.println(quoteEach(str,",") );
str = ",11,,33,44";
System.out.println(quoteEach(str,",") );
str = ",11,22,33,44,,";
System.out.println(quoteEach(str,",") );
str = "11,,,44";
System.out.println(quoteEach(str,",") );
}
/* ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
......
package com.skua.modules.material.controller;
import com.alibaba.fastjson.JSON;
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.core.api.vo.Result;
import com.skua.core.aspect.AutoLogAspect;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.core.util.DateUtils;
import com.skua.modules.erp.entity.ApproveRecord;
import com.skua.modules.erp.entity.ErpSettlement;
import com.skua.modules.erp.vo.PurchaseContractVO;
import com.skua.modules.common.service.ICommonSqlService;
import com.skua.modules.material.entity.MaterialInfo;
import com.skua.modules.material.entity.MaterialInfoHandleRecord;
import com.skua.modules.material.entity.MaterialInformation;
import com.skua.modules.material.service.IMaterialInfoHandleRecordService;
import com.skua.modules.material.service.IMaterialInfoService;
import com.skua.modules.material.vo.MaterialInfoStatisticsVO;
......@@ -39,13 +36,10 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.*;
/**
......@@ -66,6 +60,8 @@ public class MaterialInfoController {
private IMaterialInfoHandleRecordService materialInfoHandleRecordService;
@Resource
private ISysDepartService departService;
@Autowired
private ICommonSqlService commonSqlService;
/**
* 分页列表查询
......@@ -106,6 +102,8 @@ public class MaterialInfoController {
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<MaterialInfo>> result = new Result<IPage<MaterialInfo>>();
Page<MaterialInfo> page = new Page<MaterialInfo>(pageNo, pageSize);
QueryWrapper<MaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
......@@ -117,6 +115,33 @@ public class MaterialInfoController {
return result;
}
@AutoLog(value = "厂区资料管理-上级制度")
@ApiOperation(value = "厂区资料管理-上级制度", notes = "厂区资料管理-上级制度")
@GetMapping(value = "/superiorList")
public Result<IPage<MaterialInfo>> querySuperiorList(MaterialInfo materialInfo,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<MaterialInfo>> result = new Result<IPage<MaterialInfo>>();
Page<MaterialInfo> page = new Page<MaterialInfo>(pageNo, pageSize);
QueryWrapper<MaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
String sql = "SELECT CONCAT(a.parent_id ,',' ,b.parent_id) FROM sys_depart a";
sql += "LEFT JOIN sys_depart b ON a.parent_id = b.id WHERE a.id = '"+BaseContextHandler.getRealDepartId()+"'";
String departIds = commonSqlService.queryForString( sql );
departIds = JSUtils.quoteEach(departIds,",");
if(StringUtils.isNotEmpty(departIds)){
queryWrapper.in("depart_id", departIds);
}
// QueryWrapper<MaterialInfo> queryWrapper = getMaterialInfoQueryWrapper(materialInfo);
queryWrapper.orderByDesc("create_time");
IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "厂区资料管理-待审核列表")
@ApiOperation(value = "厂区资料管理-待审核列表", notes = "厂区资料管理-待审核列表")
@GetMapping(value = "/unAuditList")
......
......@@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.modules.equipment.dto.ReportStatisticsDTO;
import com.skua.modules.equipment.service.IProductionEquipmentService;
import com.skua.modules.equipment.vo.*;
import com.skua.modules.system.service.ISysDepartService;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -26,12 +30,15 @@ import java.util.Map;
public class EquipmentCenterController {
@Autowired
private IProductionEquipmentService iProductionEquipmentService;
@Autowired
private ISysDepartService departService;
@AutoLog(value = "设备中心-顶部总览")
@ApiOperation(value = "设备中心-顶部总览", notes = "设备中心-顶部总览")
@GetMapping(value = "/topOverview")
public Result<ProductionEquipmentVO> topOverview(ReportStatisticsDTO reportStatisticsDTO) {
Result<ProductionEquipmentVO> result = new Result<ProductionEquipmentVO>();
setDepartIds(reportStatisticsDTO);
ProductionEquipmentVO productionEquipmentVO = iProductionEquipmentService.getProductionEquipmentVO(reportStatisticsDTO);
result.setResult(productionEquipmentVO);
return result;
......@@ -42,6 +49,7 @@ public class EquipmentCenterController {
@GetMapping(value = "/equipmentStatistics")
public Result<FaultStatisticsVO> equipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) {
Result<FaultStatisticsVO> result = new Result<>();
setDepartIds(reportStatisticsDTO);
FaultStatisticsVO equipmentStatistics = iProductionEquipmentService.getEquipmentStatistics(reportStatisticsDTO);
result.setResult(equipmentStatistics);
result.setSuccess(true);
......@@ -56,17 +64,34 @@ public class EquipmentCenterController {
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>();
Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize);
setDepartIds(reportStatisticsDTO);
pageList = iProductionEquipmentService.getEquipmentStatisticsDetails(pageList, reportStatisticsDTO);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "设备中心-设备统计详情(新)")
@ApiOperation(value = "设备中心-设备统计详情(新)", notes = "设备中心-设备统计详情(新)")
@GetMapping(value = "/equipmentStatisticsDetailsNew")
public Result<IPage<EquipmentStatisticsCountVO>> equipmentStatisticsDetailsNew(ReportStatisticsDTO reportStatisticsDTO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Result<IPage<EquipmentStatisticsCountVO>> result = new Result<IPage<EquipmentStatisticsCountVO>>();
Page<EquipmentStatisticsCountVO> page = new Page<EquipmentStatisticsCountVO>(pageNo, pageSize);
setDepartIds(reportStatisticsDTO);//设置departIds
IPage<EquipmentStatisticsCountVO> pageList =iProductionEquipmentService.getEquipmentStatisticsDetailsNew(page, reportStatisticsDTO);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "设备中心-设备状态")
@ApiOperation(value = "设备中心-设备状态", notes = "设备中心-设备状态")
@GetMapping(value = "/equipmentState")
public Result<List<TOPTenVO>> equipmentState(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<TOPTenVO>> result = new Result<>();
setDepartIds(reportStatisticsDTO);
List<TOPTenVO> equipmentState = iProductionEquipmentService.getEquipmentState(reportStatisticsDTO);
result.setSuccess(true);
result.setResult(equipmentState);
......@@ -81,6 +106,7 @@ public class EquipmentCenterController {
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>();
Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize);
setDepartIds(reportStatisticsDTO);
pageList = iProductionEquipmentService.getEquipmentStateDetails(pageList, reportStatisticsDTO);
result.setSuccess(true);
result.setResult(pageList);
......@@ -92,6 +118,7 @@ public class EquipmentCenterController {
@GetMapping(value = "/equipmentIntactRate")
public Result<List<ContrastVO>> equipmentIntactRate(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
setDepartIds(reportStatisticsDTO);
List<ContrastVO> equipmentIntactRate = iProductionEquipmentService.getEquipmentIntactRate(reportStatisticsDTO);
result.setSuccess(true);
result.setResult(equipmentIntactRate);
......@@ -103,17 +130,30 @@ public class EquipmentCenterController {
@GetMapping(value = "/equipmentIntactRateDetails")
public Result<List<Map>> equipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<Map>> result = new Result<List<Map>>();
setDepartIds(reportStatisticsDTO);
List<Map> equipmentIntactRateDetails = iProductionEquipmentService.getEquipmentIntactRateDetails(reportStatisticsDTO);
result.setResult(equipmentIntactRateDetails);
result.setSuccess(true);
return result;
}
@AutoLog(value = "设备中心-设备完好率详情(新)")
@ApiOperation(value = "设备中心-设备完好率详情(新)", notes = "设备中心-设备完好率详情(新)")
@GetMapping(value = "/equipmentIntactRateDetailsNew")
public Result<List<Map>> equipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<Map>> result = new Result<List<Map>>();
setDepartIds(reportStatisticsDTO);
List<Map> equipmentIntactRateDetails = iProductionEquipmentService.getEquipmentIntactRateDetailsNew(reportStatisticsDTO);
result.setResult(equipmentIntactRateDetails);
result.setSuccess(true);
return result;
}
@AutoLog(value = "设备中心-MTTR&MTBF")
@ApiOperation(value = "设备中心-MTTR&MTBF", notes = "设备中心-MTTR&MTBF")
@GetMapping(value = "/equipmentMF")
public Result<List<ContrastVO>> equipmentMF(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
setDepartIds(reportStatisticsDTO);
List<ContrastVO> equipmentMF = iProductionEquipmentService.getEquipmentMF(reportStatisticsDTO);
result.setResult(equipmentMF);
result.setSuccess(true);
......@@ -125,6 +165,7 @@ public class EquipmentCenterController {
@GetMapping(value = "/equipmentMFDetails")
public Result<List<Map>> equipmentMFDetails(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<Map>> result = new Result<List<Map>>();
setDepartIds(reportStatisticsDTO);
List<Map> equipmentMFDetails = iProductionEquipmentService.getEquipmentMFDetails(reportStatisticsDTO);
result.setResult(equipmentMFDetails);
result.setSuccess(true);
......@@ -136,6 +177,7 @@ public class EquipmentCenterController {
@GetMapping(value = "/maintainCompleteRate")
public Result<List<ContrastVO>> maintainCompleteRate(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
setDepartIds(reportStatisticsDTO);
List<ContrastVO> maintainCompleteRate = iProductionEquipmentService.getMaintainCompleteRate(reportStatisticsDTO);
result.setResult(maintainCompleteRate);
result.setSuccess(true);
......@@ -147,6 +189,7 @@ public class EquipmentCenterController {
@GetMapping(value = "/maintainCompleteRateDetails")
public Result<List<Map>> maintainCompleteRateDetails(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<Map>> result = new Result<>();
setDepartIds(reportStatisticsDTO);
List<Map> maintainCompleteRateDetails = iProductionEquipmentService.getMaintainCompleteRateDetails(reportStatisticsDTO);
result.setResult(maintainCompleteRateDetails);
result.setSuccess(true);
......@@ -158,6 +201,7 @@ public class EquipmentCenterController {
@GetMapping(value = "/maintainRepairCost")
public Result<List<ContrastVO>> maintainRepairCost(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
setDepartIds(reportStatisticsDTO);
List<ContrastVO> maintainCompleteRate = iProductionEquipmentService.getContrastCost(reportStatisticsDTO);
result.setResult(maintainCompleteRate);
result.setSuccess(true);
......@@ -169,9 +213,24 @@ public class EquipmentCenterController {
@GetMapping(value = "/maintainRepairCostDetails")
public Result<List<Map>> maintainRepairCostDetails(ReportStatisticsDTO reportStatisticsDTO) {
Result<List<Map>> result = new Result<>();
setDepartIds(reportStatisticsDTO);
List<Map> contrastCostDetails = iProductionEquipmentService.getContrastCostDetails(reportStatisticsDTO);
result.setResult(contrastCostDetails);
result.setSuccess(true);
return result;
}
/***
* 设置查询条件的departIds属性
* @param reportStatisticsDTO
*/
private void setDepartIds(ReportStatisticsDTO reportStatisticsDTO){
String departIds = null;
if (StringUtils.isNotEmpty(reportStatisticsDTO.getFactoryId())) {
departIds = departService.getChildDepartId(reportStatisticsDTO.getFactoryId());
}else{
departIds = BaseContextHandler.getDeparts();
}
reportStatisticsDTO.setDepartIds(JSUtils.quoteEach(departIds,","));
}
}
......
package com.skua.modules.equipment.dto;
import com.skua.modules.equipment.vo.IndexVO;
import com.skua.tool.util.DateUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
......@@ -46,7 +48,22 @@ public class ReportStatisticsDTO {
List<IndexVO> outOfGinseng;
@ApiModelProperty(value = "时间")
private String time;
@ApiModelProperty(value = "部门集合")
private String departIds;
@ApiModelProperty(value = "1总公司2分公司3厂站")
private Integer isCompany;
public String getTime() {
if(StringUtils.isEmpty(time)){//判断time如果为空,获取starttime的年份数据,否则获取当前年
if( StringUtils.isNotEmpty(startTime) ){
time = DateUtils.getDateYear(startTime)+"";
}else{
time = DateUtils.getCurrentYear()+"";
}
}
return time;
}
}
......
package com.skua.modules.equipment.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.equipment.dto.ReportStatisticsDTO;
import com.skua.modules.equipment.entity.SysUser;
import com.skua.modules.equipment.pojo.Equipment;
import com.skua.modules.equipment.vo.EquipmentNewMaintenancePlanVO;
import com.skua.modules.equipment.vo.EquipmentStatisticsCountVO;
import com.skua.modules.equipment.vo.ProportionStatisticsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -34,7 +38,8 @@ public interface ProductionEquipmentMapper {
//获取维修费用
Double getRepairCost(@Param("startTime") String startTime, @Param("endTime") String endTime);
//获取维修费用 2024-1227 获取维修费用:来源维修表
// Double getRepairNewCost( @Param("departIds") String departIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
//获取维护任务数量 status 1:已完成 0:未完成
Integer getTaskNum(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("status") Integer status);
......@@ -56,6 +61,8 @@ public interface ProductionEquipmentMapper {
//厂获取生产设备总台数详情
List<EquipmentNewMaintenancePlanVO> getEquipmentStatisticsDetailsFactory(ReportStatisticsDTO reportStatisticsDTO);
//厂获取生产设备总台数详情(新)
IPage<EquipmentStatisticsCountVO> getEquipmentStatisticsDetailsNew(Page<EquipmentStatisticsCountVO> page, @Param("param") ReportStatisticsDTO reportStatisticsDTO);
//总公司获取等级分类
List<Map> getLevelByHeadquarters(ReportStatisticsDTO reportStatisticsDTO);
......@@ -141,10 +148,10 @@ public interface ProductionEquipmentMapper {
List<Map> getOneYearCompleteYearOnYearRate();
//半年维修维护费用对比
List<Map> getHalfIntactContrastCost();
List<Map> getHalfIntactContrastCost(@Param("departIds") String departIds);
//一年维修维护费用对比
List<Map> getOneYearContrastCost();
List<Map> getOneYearContrastCost(@Param("departIds") String departIds);
//总公司获取停机时间
List<Map> getDownTimeByMonthHeadquarters(ReportStatisticsDTO reportStatisticsDTO);
......@@ -180,4 +187,8 @@ public interface ProductionEquipmentMapper {
List<Map>getRepairCostByHeadquarters(ReportStatisticsDTO reportStatisticsDTO);
List<Map>getRepairCostByBranchOffice(ReportStatisticsDTO reportStatisticsDTO);
List<Map>getRepairCostByFactory(ReportStatisticsDTO reportStatisticsDTO);
//设备中心-维护维修费用详情
List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO);
//设备完好率详情(新)
List<Map> getEquipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO);
}
......
......@@ -107,39 +107,60 @@
and #{endTime}
</if>
</select>
<select id="getEquipmentStatisticsDetailsNew" resultType="com.skua.modules.equipment.vo.EquipmentStatisticsCountVO">
select d.depart_name , d.id 'depart_id',
ifnull(ccc.category_value1 , 0 ) category_value1,
ifnull(ccc.category_value2 , 0 ) category_value2,
ifnull(ccc.category_value3 , 0 ) category_value3
from sys_depart d
left join (
select bbb.depart_id,
ifnull((CASE WHEN equipment_level = '2421538a0286b491ffb863db92fe6cbf' THEN bbb.hour END),0) 'category_value1',
ifnull((CASE WHEN equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c' THEN bbb.hour END),0) 'category_value2',
ifnull((CASE WHEN equipment_level = 'a64bfc58110d2c105a6026e8bd02c232' THEN bbb.hour END),0) 'category_value3'
from (
select ei.depart_id , ei.equipment_level , ifnull(COUNT( ei.id ),0) AS'hour' from equipment_info ei
where 1=1
<if test="param.startTime != null ">
and ei.create_time &gt;= #{param.startTime}
</if>
<if test="param.endTime != null ">
and ei.create_time &lt;= #{param.endTime}
</if>
<if test="param.departIds != null ">
and ei.depart_id in(${param.departIds})
</if>
group by ei.depart_id , ei.equipment_level
)bbb group by bbb.depart_id
)ccc on ccc.depart_id = d.id
where d.depart_type = 1
<if test="param.departIds != null ">
and d.id in (${param.departIds})
</if>
order by ccc.category_value1 desc
</select>
<select id="getLevelByTime" resultType="com.skua.modules.equipment.vo.ProportionStatisticsVO"
parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO">
SELECT
t1.des as category,
t1.equipmentNum as hour,
CONCAT( ROUND( IFNULL( t1.equipmentNum, 0 ) / t2.equipmentTotal, 3 )* 100, '%' ) AS proportion
FROM
(
SELECT
sdi.item_text AS des,
COUNT( ei.id ) AS equipmentNum
FROM
equipment_info ei
LEFT JOIN sys_dict_item sdi ON sdi.item_value = ei.equipment_level
WHERE
sdi.dict_id = '77c2f3bd6d16dec67f2ea11d84b6000e'
<if test="endTime !=null and endTime !=''">
AND ei.create_time &lt;= #{endTime}
select aaa.item_text as category, ifnull(COUNT( ei.id ),0) AS'hour' from equipment_info ei
left join (
select t.item_value , t.item_text from sys_dict_item t where t.dict_id in (select id from sys_dict where dict_code = 'equipment-equipment_level')
) aaa on aaa.item_value = ei.equipment_level
where 1=1
<if test="startTime != null ">
and ei.create_time &gt;= #{startTime}
</if>
GROUP BY
ei.equipment_level
) t1,(
SELECT
count( 1 ) AS equipmentTotal
FROM
equipment_info
WHERE
1=1
<if test="endTime !=null and endTime !=''">
AND create_time &lt;= #{endTime}
<if test="endTime != null ">
and ei.create_time &lt;= #{endTime}
</if>
) t2
<if test="departIds != null ">
and ei.depart_id in(${departIds})
</if>
group by ei.equipment_level
</select>
<select id="getTypeByTime" parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO"
resultType="com.skua.modules.equipment.vo.ProportionStatisticsVO">
......@@ -793,7 +814,7 @@
FROM
equipment_maintain_task emt LEFT JOIN equipment_task_cost etc ON etc.task_id=emt.id
WHERE
LEFT ( emt.maintain_time, 7 ) = t.MONTH AND emt.del_flag = 0
LEFT ( emt.maintain_time, 7 ) = t.MONTH AND emt.del_flag = 0 and emt.depart_id in(${departIds})
) AS maintainCost,
(
SELECT
......@@ -802,7 +823,7 @@
equipment_repair er
WHERE
LEFT ( er.create_time, 7 ) = t.MONTH
AND er.del_flag = 1
AND er.del_flag = 1 and er.depart_id in(${departIds})
) AS repairCost
FROM
(
......@@ -824,7 +845,7 @@
FROM
equipment_maintain_task emt LEFT JOIN equipment_task_cost etc ON etc.task_id=emt.id
WHERE
LEFT ( emt.maintain_time, 7 ) = t.MONTH AND emt.del_flag = 0
LEFT ( emt.maintain_time, 7 ) = t.MONTH AND emt.del_flag = 0 and emt.depart_id in(${departIds})
) AS maintainCost,
(
SELECT
......@@ -833,7 +854,7 @@
equipment_repair er
WHERE
LEFT ( er.create_time, 7 ) = t.MONTH
AND er.del_flag = 1
AND er.del_flag = 1 and er.depart_id in(${departIds})
) AS repairCost
FROM
(
......@@ -847,6 +868,45 @@
MONTH DESC
) AS t
</select>
<!--维护维修费用详情 -->
<select id="getContrastCostDetails" resultType="java.util.Map">
select d.id depart_id , d.depart_name ,ifnull(aaa.maintainCost,0) maintainCost,ifnull(bbb.repairCost,0) repairCost from sys_depart d
left join (
SELECT emt.depart_id , IFNULL(sum(etc.material_cost+etc.maintenance_cost+etc.labor_cost+etc.machinery_cost+etc.service_cost+etc.wastage_cost+etc.other_cost),0) maintainCost
FROM equipment_maintain_task emt LEFT JOIN equipment_task_cost etc ON etc.task_id=emt.id
WHERE emt.del_flag = 0 and emt.maintain_time &gt;= #{startTime} and emt.maintain_time &lt;= #{endTime}
group by emt.depart_id
) aaa on aaa.depart_id = d.id
left join (
SELECT er.depart_id, IFNULL(SUM(er.total_cost),0) repairCost
FROM equipment_repair er
WHERE er.del_flag = 1 and er.create_time &gt;= #{startTime} and er.create_time &lt;= #{endTime}
group by er.depart_id
)bbb on bbb.depart_id = d.id
where d.depart_type = 1
and d.id in (${departIds})
</select>
<!-- 设备完好率详情(新)-->
<select id="getEquipmentIntactRateDetailsNew" resultType="java.util.Map">
select d.id depart_id , d.depart_name ,round(ifnull(aaa.intact,0),2) 'intact', round(ifnull(bbb.percentage,0),2) 'percentage' from sys_depart d
left join (
SELECT er.depart_id ,ifnull(( COUNT(id)*30 - IFNULL( SUM( UNIX_TIMESTAMP( reality_maintenance_end_time )- UNIX_TIMESTAMP( repair_date ) )/ 60 / 60 / 24, 0 ) ) *100/ (COUNT(id)*30) , 0) 'intact'
FROM equipment_repair er
WHERE er.del_flag = 1 and er.create_time &gt;= #{startTime} and er.create_time &lt;= #{endTime}
group by er.depart_id
) aaa on aaa.depart_id = d.id
left join (
SELECT er.depart_id , ifnull(( COUNT(id)*30 - IFNULL( SUM( UNIX_TIMESTAMP( reality_maintenance_end_time )- UNIX_TIMESTAMP( repair_date ) )/ 60 / 60 / 24, 0 ) ) *100/ (COUNT(id)*30) , 0) 'percentage'
FROM equipment_repair er
WHERE er.del_flag = 1 and er.create_time &gt;= #{startTime} and er.create_time &lt;= #{endTime}
group by er.depart_id
)bbb on bbb.depart_id = d.id
where d.depart_type = 1 and d.id in (${departIds})
order by aaa.intact desc
</select>
<select id="getDownTimeByMonthHeadquarters" resultType="java.util.Map"
parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO">
SELECT sd1.depart_name AS departName,sd1.id as departId,
......@@ -1117,6 +1177,8 @@
GROUP BY
sd1.id
</select>
<select id="getMaintainCostByHeadquarters" parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO"
resultType="java.util.Map">
SELECT
......
package com.skua.modules.equipment.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.equipment.dto.ReportStatisticsDTO;
import com.skua.modules.equipment.vo.*;
......@@ -19,6 +20,7 @@ import java.util.Map;
*</pre>
***************************/
public interface IProductionEquipmentService {
//设备中心-顶部总览
ProductionEquipmentVO getProductionEquipmentVO(ReportStatisticsDTO reportStatisticsDTO);
//设备统计
......@@ -27,6 +29,9 @@ public interface IProductionEquipmentService {
//设备统计详情
Page<EquipmentNewMaintenancePlanVO> getEquipmentStatisticsDetails(Page<EquipmentNewMaintenancePlanVO> pageList, ReportStatisticsDTO reportStatisticsDTO);
//设备统计详情(new)
IPage<EquipmentStatisticsCountVO> getEquipmentStatisticsDetailsNew(Page<EquipmentStatisticsCountVO> pageList, ReportStatisticsDTO reportStatisticsDTO);
//获取设备状态
List<TOPTenVO> getEquipmentState(ReportStatisticsDTO reportStatisticsDTO);
......@@ -38,6 +43,8 @@ public interface IProductionEquipmentService {
//设备完好率详情
List<Map> getEquipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO);
List<Map> getEquipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO);
//MF
List<ContrastVO> getEquipmentMF(ReportStatisticsDTO reportStatisticsDTO);
......
package com.skua.modules.equipment.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @auther kangwei
* @create 2024-12-27-15:32
*/
@Data
@ApiModel(value = "设备统计数量对象", description = "设备统计数量对象")
public class EquipmentStatisticsCountVO {
@ApiModelProperty(value = "厂站名称")
private String departName;
@ApiModelProperty(value = "厂站编号")
private String departId;
@ApiModelProperty(value = "分类1数量")
private String categoryValue1;
@ApiModelProperty(value = "分类2数量")
private String categoryValue2;
@ApiModelProperty(value = "分类3数量")
private String categoryValue3;
}
......@@ -20,7 +20,7 @@ public class ProportionStatisticsVO {
//类别
private String category;
//占比
private String proportion;
private String proportion = "0%";
// 小时
private String hour;
//设备中心的设备统计用
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!