大屏添加接口

This commit is contained in:
cwchen 2023-12-21 13:26:41 +08:00
parent 2f6f9ec862
commit f689436364
7 changed files with 89 additions and 3 deletions

View File

@ -645,6 +645,16 @@ public class DateTimeHelper {
return sdf.format(afterDate);
}
public static String getTimeAfterThirtyDay() {
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //制定日期格式
Calendar c=Calendar.getInstance();
Date date=new Date();
c.setTime(date);
c.add(Calendar.MONTH,1); //将当前日期加一个月
String validityDate=df.format(c.getTime()); //返回String型的时间
return validityDate;
}
/**
* 获取时间戳
*/
@ -741,8 +751,10 @@ public class DateTimeHelper {
}
public static void main(String[] args) {
System.err.println(getFisrtDayOfMonth(2023,11));
System.err.println(getLastDayOfMonth(2023,11));
// System.err.println(getFisrtDayOfMonth(2023,11));
// System.err.println(getLastDayOfMonth(2023,11));
System.err.println(getTimeAfterThirtyDay());
System.err.println(getNowTime());
}
/**

View File

@ -83,4 +83,9 @@ public class LargeScreenController extends BaseController {
return service.getCarUseByMonth();
}
@Log(title = "检修预警", businessType = BusinessType.QUERY)
@PostMapping("getMaintenanceWarning")
public AjaxResult getMaintenanceWarning() {
return service.getMaintenanceWarning();
}
}

View File

@ -0,0 +1,23 @@
package com.bonus.sgzb.largeScreen.domain;
import lombok.Data;
/**
* @author 10488
* 检修预警-vo
*/
@Data
public class MaintenanceWarningVo {
/** 机具名称*/
private String machineName;
/** 机具编号*/
private String maCode;
/** 规格型号*/
private String typeName;
/** 下次检修日期*/
private String nextCheckTime;
}

View File

@ -92,4 +92,13 @@ public interface LargeScreenMapper {
* @date 2023/12/15 18:57
*/
List<ScrapAnalysisVo> getTotalOwnership(ParamsDto dto);
/**
* @param dto
* @return List<MaintenanceWarningVo>
* @description 检修预警
* @author cwchen
* @date 2023/12/21 9:53
*/
List<MaintenanceWarningVo> getMaintenanceWarning(ParamsDto dto);
}

View File

@ -88,4 +88,12 @@ public interface ILargeScreenService {
* @date 2023/12/13 15:40
*/
AjaxResult getCarUseByMonth();
/**
* @return AjaxResult
* @description 检修预警
* @author cwchen
* @date 2023/12/21 9:42
*/
AjaxResult getMaintenanceWarning();
}

View File

@ -103,7 +103,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
* @author cwchen
* @date 2023/12/15 19:33
*/
public TotalOwnershipVo countNum(String maType,String maTypeName) {
public TotalOwnershipVo countNum(String maType, String maTypeName) {
TotalOwnershipVo vo = new TotalOwnershipVo();
ParamsDto dto = new ParamsDto();
dto.setMaType(maType);
@ -317,6 +317,20 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
list.add(carUseVo6);
return AjaxResult.success(list);
}
@Override
public AjaxResult getMaintenanceWarning() {
List<MaintenanceWarningVo> list = new ArrayList<>();
try {
ParamsDto dto = new ParamsDto();
dto.setStartDate(DateTimeHelper.getNowTime());
dto.setEndDate(DateTimeHelper.getTimeAfterThirtyDay());
list = mapper.getMaintenanceWarning(dto);
} catch (Exception e) {
log.error("检修预警-查询失败",e);
}
return AjaxResult.success(list);
}
}

View File

@ -347,4 +347,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</if>
</select>
<!--检修预警-->
<select id="getMaintenanceWarning" resultType="com.bonus.sgzb.largeScreen.domain.MaintenanceWarningVo">
SELECT mm.ma_code AS maCode,
a.typeName,
a.typeName2 AS machineName,
mm.next_check_time
FROM ma_machine mm
LEFT JOIN (
SELECT mt.type_id,mt.type_name AS typeName,mt2.type_name AS typeName2
FROM ma_type mt
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id AND mt2.`level` = '3'
WHERE mt.`level` = '4'
)a ON mm.type_id = a.type_id
WHERE mm.next_check_time BETWEEN #{startDate} AND #{endDate}
</select>
</mapper>