对比新文件 |
| | |
| | | package com.fengdu.gas.common.enums; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Objects; |
| | | |
| | | public enum EAlarmType { |
| | | ZERO("其他报警",0), |
| | | NOE("一级报警", 1), |
| | | TWO("二级报警", 2); |
| | | |
| | | |
| | | private String desc;//枚举描述 |
| | | private Integer value;//枚举值 |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | /** |
| | | * 构造方法 |
| | | * @param desc 枚举描述 |
| | | * @param value 枚举值 |
| | | */ |
| | | EAlarmType(String desc, Integer value) { |
| | | this.desc = desc; |
| | | this.value = value; |
| | | } |
| | | |
| | | /** |
| | | * 根据值获取枚举 |
| | | * |
| | | * @param value 枚举值 |
| | | * @return |
| | | */ |
| | | public static EAlarmType getByValue(Integer value) { |
| | | return Arrays.stream(EAlarmType.values()) |
| | | .filter(e -> Objects.equals(e.getValue(), value)) |
| | | .findFirst() |
| | | .orElse(null); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "EAlarmType{" + |
| | | "desc='" + desc + '\'' + |
| | | ", value=" + value + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.*; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.time.temporal.TemporalAdjusters; |
| | |
| | | return LocalDate.parse(date); |
| | | } |
| | | /** |
| | | * 两个日期字符串yyyy-MM-dd HH:mm:ss 相差的小时数 |
| | | * @param date1 日期字符串 |
| | | */ |
| | | public static String getDateHoursMinutesSeconds(String date1,String date2) { |
| | | // 定义日期格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | // 解析日期字符串为LocalDateTime对象 |
| | | LocalDateTime dateTime1 = LocalDateTime.parse(date1, formatter); |
| | | LocalDateTime dateTime2 = LocalDateTime.parse(date2, formatter); |
| | | |
| | | // 计算两个日期相差的小时数 |
| | | Duration duration = Duration.between(dateTime1, dateTime2); |
| | | long hours = duration.toHours(); // 获取小时数部分 |
| | | long minutes = duration.toMinutes() % 60; // 获取剩余分钟数部分 |
| | | long seconds = duration.getSeconds() % 60; // 获取剩余秒数部分 |
| | | return hours+"时"+minutes+"分"+seconds+"秒"; |
| | | } |
| | | |
| | | /** |
| | | * 获取LocalDate |
| | | * @param year 年份 |
| | | * @param month 月份 |
对比新文件 |
| | |
| | | package com.fengdu.gas.entity.enums; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Objects; |
| | | |
| | | public enum EWorkType { |
| | | |
| | | WEIHU("维护工单", 1), |
| | | WEIXIU("维修工单", 2); |
| | | private String desc;//枚举描述 |
| | | private Integer value;//枚举值 |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | /** |
| | | * 构造方法 |
| | | * @param desc 枚举描述 |
| | | * @param value 枚举值 |
| | | */ |
| | | private EWorkType(String desc, Integer value) { |
| | | this.desc = desc; |
| | | this.value = value; |
| | | } |
| | | |
| | | /** |
| | | * 根据值获取枚举 |
| | | * |
| | | * @param value 枚举值 |
| | | * @return |
| | | */ |
| | | public static EWorkType getByValue(Integer value) { |
| | | return Arrays.stream(EWorkType.values()) |
| | | .filter(e -> Objects.equals(e.getValue(), value)) |
| | | .findAny() |
| | | .orElse(null); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "EWorkType{" + |
| | | "desc='" + desc + '\'' + |
| | | ", value=" + value + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | @Data |
| | | public class ReqCreateAlarmScheme { |
| | | /** |
| | | * |
| | | */ |
| | | private Long parametersId; |
| | | /** |
| | | * 设备参数code |
| | | */ |
| | | private String columnsCode; |
对比新文件 |
| | |
| | | package com.fengdu.gas.entity.request.datauploadrecord; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ReqGetDataUploadRecord { |
| | | /** |
| | | * 监测点id |
| | | */ |
| | | private Long pointId; |
| | | /** |
| | | * 日期类型(1日 2月 3年) |
| | | */ |
| | | private Integer dateType; |
| | | /** |
| | | * 参数编号 |
| | | */ |
| | | private String columnsCode; |
| | | } |
| | |
| | | * 监控点图片 |
| | | */ |
| | | private String imageRul; |
| | | /** |
| | | * 左边距 |
| | | */ |
| | | private String leftMargin; |
| | | /** |
| | | * 上边距 |
| | | */ |
| | | private String topMargin; |
| | | |
| | | /** |
| | | * 盒子位置(1左 2右) |
| | | */ |
| | | private String boxType; |
| | | } |
| | |
| | | * 监控点图片 |
| | | */ |
| | | private String imageRul; |
| | | /** |
| | | * 左边距 |
| | | */ |
| | | private String leftMargin; |
| | | /** |
| | | * 上边距 |
| | | */ |
| | | private String topMargin; |
| | | /** |
| | | * 盒子位置(1左 2右) |
| | | */ |
| | | private String boxType; |
| | | } |
| | |
| | | */ |
| | | private String top; |
| | | /** |
| | | * 上边距 |
| | | */ |
| | | private String boxType; |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Long facilityId; |
对比新文件 |
| | |
| | | package com.fengdu.gas.entity.response.facility; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class FacilityParameterData { |
| | | /** |
| | | * 监控点id |
| | | */ |
| | | private Long pointId; |
| | | /** |
| | | * 监控点名称 |
| | | */ |
| | | private String pointName; |
| | | /** |
| | | * 设备名称 |
| | | */ |
| | | private String facilityName; |
| | | /** |
| | | * 设备状态 |
| | | */ |
| | | private Integer facilityState; |
| | | /** |
| | | * 设备状态 |
| | | */ |
| | | private String facilityStateName; |
| | | /** |
| | | * 氧化氢 |
| | | */ |
| | | private String hydrogenValue; |
| | | /** |
| | | * 甲烷 |
| | | */ |
| | | private String methaneValue; |
| | | /** |
| | | * 温度 |
| | | */ |
| | | private String temperatureValue; |
| | | } |
对比新文件 |
| | |
| | | package com.fengdu.gas.entity.response.facility; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class FacilityPointCount { |
| | | private String pointName; |
| | | private Integer count; |
| | | } |
对比新文件 |
| | |
| | | package com.fengdu.gas.entity.response.facility; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class FacilityStateData { |
| | | private String typeName; |
| | | private BigDecimal value=BigDecimal.ZERO; |
| | | } |
| | |
| | | */ |
| | | @Data |
| | | public class SearchSendMessageRecord extends SearchBasicDTO { |
| | | |
| | | /** |
| | | * 消息类型(1邮件 2短信) |
| | | */ |
| | | private Integer type; |
| | | } |
| | |
| | | @Autowired |
| | | private TestInfoService service; |
| | | |
| | | /** |
| | | * 测试支付信息 |
| | | * |
| | | * @author lin.liu |
| | | * @date 2021/11/23 |
| | | */ |
| | | @PostMapping(value = "pay") |
| | | public ExecutedResult<String> pay() throws Exception { |
| | | return this.service.testPay(); |
| | | } |
| | | |
| | | /** |
| | | * 测试支付信息 |
| | | * |
| | | * @author lin.liu |
| | | * @date 2021/11/23 |
| | | */ |
| | | @PostMapping(value = "confirmPay") |
| | | public ExecutedResult<String> confirmPay() throws Exception { |
| | | return this.service.confirmPay(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.fengdu.gas.host.controller.visualized; |
| | | |
| | | import com.fengdu.gas.common.ExecutedResult; |
| | | import com.fengdu.gas.entity.response.facility.FacilityParameterData; |
| | | import com.fengdu.gas.entity.response.facility.FacilityPointCount; |
| | | import com.fengdu.gas.entity.response.facility.FacilityStateData; |
| | | import com.fengdu.gas.host.BasicController; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.fengdu.gas.repository.po.WaterFacilityPO; |
| | | import com.fengdu.gas.repository.vo.FacilityAlarmRecordVO; |
| | | import com.fengdu.gas.repository.vo.FacilityRunTimeVO; |
| | | import com.fengdu.gas.repository.vo.UserWorkOrderVO; |
| | | import com.fengdu.gas.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 10000.可视化数据大屏设备管理 |
| | | * 12000.可视化数据大屏设备管理 |
| | | * @author zr |
| | | * @order 10000 |
| | | * @order 12000 |
| | | */ |
| | | @RestController |
| | | @RequestMapping(value = "facilityData") |
| | | public class FacilityDataController extends BasicController { |
| | | /*****************************设备管理**********************************/ |
| | | @Autowired |
| | | private WaterFacilityService waterFacilityService; |
| | | @Autowired |
| | | private FacilityAlarmRecordService facilityAlarmRecordService; |
| | | @Autowired |
| | | private UserWorkOrderService workOrderService; |
| | | @Autowired |
| | | private WaterFacilityParameterService waterFacilityParameterService; |
| | | @Autowired |
| | | private FacilityRunTimeService facilityRunTimeService; |
| | | |
| | | |
| | | /** |
| | | * 设备报警时长 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getAlarmTime") |
| | | public ExecutedResult<List<FacilityAlarmRecordVO>> getAlarmTime() { |
| | | return facilityAlarmRecordService.getAlarmTime(); |
| | | } |
| | | /** |
| | | * 风机管理 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getFacilityFan") |
| | | public ExecutedResult<List<WaterFacilityPO>> getFacilityFan(Integer type) { |
| | | return waterFacilityService.getFacilityFan(type); |
| | | } |
| | | /** |
| | | * 工单处理 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getUserWorkList") |
| | | public ExecutedResult<List<UserWorkOrderVO>> getUserWorkList() { |
| | | return workOrderService.getUserWorkList(); |
| | | } |
| | | /** |
| | | * 设备状态 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getFacilityState") |
| | | public ExecutedResult<List<FacilityStateData>> getFacilityState() { |
| | | return waterFacilityService.getFacilityState(); |
| | | } |
| | | /** |
| | | * 设备实时数据统计 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getDataList") |
| | | public ExecutedResult<List<FacilityParameterData>> getDataList(Long pointId, Integer facilityState) { |
| | | return waterFacilityParameterService.getDataList(pointId,facilityState); |
| | | } |
| | | /** |
| | | * 终端监控分类统计 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getFacilityPointCount") |
| | | public ExecutedResult<List<FacilityPointCount>> getFacilityPointCount() { |
| | | return waterFacilityService.getFacilityPointCount(); |
| | | } |
| | | /** |
| | | * 设备风机运行时长统计 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getFacilityRunTime") |
| | | public ExecutedResult<List<FacilityRunTimeVO>> getFacilityRunTime() { |
| | | return facilityRunTimeService.getFacilityRunTime(); |
| | | } |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 10000.可视化数据大屏首页总览 |
| | | * 11000.可视化数据大屏首页总览 |
| | | * @author zr |
| | | * @order 10000 |
| | | * @order 11000 |
| | | */ |
| | | @RestController |
| | | @RequestMapping(value = "homeData") |
| | |
| | | |
| | | import com.fengdu.gas.common.ExecutedResult; |
| | | import com.fengdu.gas.common.PagerResult; |
| | | import com.fengdu.gas.entity.request.datauploadrecord.ReqGetDataUploadRecord; |
| | | import com.fengdu.gas.entity.response.alarm.FacilityAlarm; |
| | | import com.fengdu.gas.entity.search.SearchFacilityAlarmRecord; |
| | | import com.fengdu.gas.entity.search.SearchSendMessageRecord; |
| | | import com.fengdu.gas.entity.search.SearchUserWorkOrder; |
| | | import com.fengdu.gas.host.BasicController; |
| | | import com.fengdu.gas.repository.vo.FacilityAlarmRecordVO; |
| | | import com.fengdu.gas.repository.vo.UserWorkOrderVO; |
| | | import com.fengdu.gas.repository.po.SendMessageRecordPO; |
| | | import com.fengdu.gas.repository.vo.*; |
| | | import com.fengdu.gas.service.DataUploadRecordService; |
| | | import com.fengdu.gas.service.FacilityAlarmRecordService; |
| | | import com.fengdu.gas.service.SendMessageRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 10000.可视化数据大屏数据统计 |
| | |
| | | public class StatisticsDataController extends BasicController { |
| | | @Autowired |
| | | private FacilityAlarmRecordService facilityAlarmRecordService; |
| | | @PostMapping(value = "getAlarmList") |
| | | @Autowired |
| | | private DataUploadRecordService dataUploadRecordService; |
| | | @Autowired |
| | | private SendMessageRecordService sendMessageRecordService; |
| | | |
| | | /** |
| | | * 报警次数统计 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getAlarmCount") |
| | | public ExecutedResult<List<FacilityAlarm>> getAlarmList(Integer dateType) { |
| | | return facilityAlarmRecordService.getAlarmList(dateType); |
| | | } |
| | | /** |
| | | * 接到报警次数统计 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getAlarmListByPoint") |
| | | public ExecutedResult<List<FacilityAlarmRecordCount>> getAlarmListByPoint() { |
| | | return facilityAlarmRecordService.getAlarmListByPoint(); |
| | | } |
| | | |
| | | /** |
| | | * 查询报警记录 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getAlarmRecord") |
| | | public ExecutedResult<List<FacilityAlarmRecordVO>> getAlarmRecord() { |
| | | return facilityAlarmRecordService.getAlarmRecord(); |
| | | } |
| | | /** |
| | | * 气体浓度检测折线图统计 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getLineChart") |
| | | public ExecutedResult<List<DataUploadRecordDayVO>> getLineChart(@RequestBody ReqGetDataUploadRecord record) { |
| | | return dataUploadRecordService.getLineChart(record); |
| | | } |
| | | /** |
| | | * 短信、邮箱报警记录 |
| | | * @author zr |
| | | */ |
| | | @PostMapping(value = "getMessageList") |
| | | public ExecutedResult<PagerResult<SendMessageRecordVO>> getMessageList(@RequestBody SearchSendMessageRecord request) { |
| | | return sendMessageRecordService.search(request); |
| | | } |
| | | } |
| | |
| | | public List<DataUploadRecordDayPO> getByTime(Long startTime, Long endTime) { |
| | | return DB.getByTime(startTime,endTime); |
| | | } |
| | | |
| | | public List<DataUploadRecordDayPO>getLineChart(Long pointId,String columnsCode,Long beginTime,Long LastTime){ |
| | | return DB.getLineChart(pointId,columnsCode,beginTime,LastTime); |
| | | } |
| | | } |
| | |
| | | public List<DataUploadRecordHourPO> getByTime(Long startTime,Long endTime) { |
| | | return DB.getByTime(startTime,endTime); |
| | | } |
| | | |
| | | public List<DataUploadRecordHourPO>getLineChart(Long pointId,String columnsCode,Long beginTime,Long LastTime){ |
| | | return DB.getLineChart(pointId,columnsCode,beginTime,LastTime); |
| | | } |
| | | } |
| | |
| | | import com.fengdu.gas.entity.dto.*; |
| | | import com.fengdu.gas.entity.enums.*; |
| | | import com.fengdu.gas.repository.BasicMapperImpl; |
| | | import com.fengdu.gas.repository.po.DataUploadRecordDayPO; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | |
| | | public List<DataUploadRecordMonthPO> getListById(List<Long> listId) { |
| | | return super.getList(listId); |
| | | } |
| | | |
| | | public List<DataUploadRecordMonthPO>getLineChart(Long pointId, String columnsCode, Long beginTime, Long LastTime){ |
| | | return DB.getLineChart(pointId,columnsCode,beginTime,LastTime); |
| | | } |
| | | } |
| | |
| | | import com.fengdu.gas.entity.enums.*; |
| | | import com.fengdu.gas.entity.response.alarm.FacilityAlarm; |
| | | import com.fengdu.gas.repository.BasicMapperImpl; |
| | | import com.fengdu.gas.repository.vo.FacilityAlarmRecordCount; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.fengdu.gas.entity.search.SearchFacilityAlarmRecord; |
| | | import com.fengdu.gas.repository.mapper.FacilityAlarmRecordMapper; |
| | | import com.fengdu.gas.repository.po.FacilityAlarmRecordPO; |
| | |
| | | public List<FacilityAlarm> getByDateType(String beginTime,String endTime){ |
| | | return DB.getByDateType(beginTime,endTime); |
| | | } |
| | | public List<FacilityAlarmRecordPO> getGroupList(){ |
| | | return DB.getGroupList(); |
| | | } |
| | | public List<FacilityAlarmRecordCount> getAlarmListByPoint(){ |
| | | return DB.getAlarmListByPoint(); |
| | | } |
| | | } |
| | |
| | | // 非逻辑删除 |
| | | queryWrapper.eq(SendMessageRecordPO::getIsDelete, EYesOrNo.NO.getValue()); |
| | | // 状态 |
| | | //queryWrapper.eq(NumericUtil.tryParseInt(search.getStatus()).compareTo(0) > 0, SendMessageRecordPO::getStatus, search.getStatus()); |
| | | queryWrapper.eq(NumericUtil.tryParseInt(search.getType()).compareTo(0) > 0, SendMessageRecordPO::getType, search.getType()); |
| | | // 状态列表 |
| | | //queryWrapper.in(ListUtil.isNotNullOrEmpty(search.getListStatus()), SendMessageRecordPO::getStatus, search.getListStatus()); |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fengdu.gas.common.ExecutedResult; |
| | | import com.fengdu.gas.common.PagerResult; |
| | | import com.fengdu.gas.common.enums.EYesOrNo; |
| | | import com.fengdu.gas.common.util.*; |
| | | import com.fengdu.gas.entity.dto.*; |
| | | import com.fengdu.gas.entity.enums.*; |
| | | import com.fengdu.gas.entity.response.facility.FacilityPointCount; |
| | | import com.fengdu.gas.repository.BasicMapperImpl; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | |
| | | public List<WaterFacilityPO> getListById(List<Long> listId) { |
| | | return super.getList(listId); |
| | | } |
| | | |
| | | public List<FacilityPointCount> getFacilityPointCount(){ |
| | | return DB.getFacilityPointCount(); |
| | | } |
| | | } |
| | |
| | | import com.fengdu.gas.entity.dto.*; |
| | | import com.fengdu.gas.entity.enums.*; |
| | | import com.fengdu.gas.repository.BasicMapperImpl; |
| | | import com.fengdu.gas.repository.vo.WaterFacilityParameterVO; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | |
| | | public List<WaterFacilityParameterPO> getListById(List<Long> listId) { |
| | | return super.getList(listId); |
| | | } |
| | | |
| | | public List<WaterFacilityParameterVO> getListData(Long pointId, Integer facilityState){ |
| | | return DB.getListData(pointId,facilityState); |
| | | } |
| | | } |
| | |
| | | @Select("SELECT point_id,point_name,facility_id,facility_name,min_value,max_value,avg_value,upload_time FROM data_upload_record_day " + |
| | | " WHERE is_delete=0 AND upload_time BETWEEN #{startTime} AND #{endTime}") |
| | | List<DataUploadRecordDayPO> getByTime(Long startTime, Long endTime); |
| | | |
| | | @Select("SELECT point_name,facility_name,columns_code,min_value,max_value,avg_value,TO_CHAR(TO_TIMESTAMP(upload_date, 'YYYY-MM-DD HH24:MI:SS'), 'DD') AS upload_date\n" + |
| | | " FROM data_upload_record_day \n" + |
| | | " WHERE point_id=#{pointId} and columns_code=#{columnsCode} AND upload_time BETWEEN #{beginTime} AND #{LastTime}") |
| | | List<DataUploadRecordDayPO>getLineChart(Long pointId,String columnsCode,Long beginTime,Long LastTime); |
| | | } |
| | |
| | | @Select("SELECT point_id,point_name,facility_id,facility_name,min_value,max_value,avg_value,upload_time FROM data_upload_record_hour " + |
| | | " WHERE is_delete=0 AND upload_time BETWEEN #{startTime} AND #{endTime}") |
| | | List<DataUploadRecordHourPO> getByTime(Long startTime, Long endTime); |
| | | |
| | | @Select("SELECT point_name,facility_name,columns_code,min_value,max_value,avg_value,TO_CHAR(TO_TIMESTAMP(upload_date, 'YYYY-MM-DD HH24:MI:SS'), 'HH24') AS upload_date\n" + |
| | | " FROM data_upload_record_hour \n" + |
| | | " WHERE point_id=#{pointId} and columns_code=#{columnsCode} AND upload_time BETWEEN #{beginTime} AND #{LastTime}") |
| | | List<DataUploadRecordHourPO>getLineChart(Long pointId,String columnsCode,Long beginTime,Long LastTime); |
| | | } |
| | |
| | | package com.fengdu.gas.repository.mapper; |
| | | |
| | | import com.fengdu.gas.repository.BasicMapper;import com.fengdu.gas.repository.po.DataUploadRecordMonthPO; |
| | | import com.fengdu.gas.repository.BasicMapper; |
| | | import com.fengdu.gas.repository.po.DataUploadRecordDayPO; |
| | | import com.fengdu.gas.repository.po.DataUploadRecordMonthPO; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 数据上报记录-月统计 mapper |
| | | * @author zr |
| | | */ |
| | | public interface DataUploadRecordMonthMapper extends BasicMapper<DataUploadRecordMonthPO> { |
| | | |
| | | @Select("SELECT point_name,facility_name,columns_code,min_value,max_value,avg_value,TO_CHAR(TO_TIMESTAMP(upload_date, 'YYYY-MM-DD HH24:MI:SS'), 'MM') AS upload_date\n" + |
| | | " FROM data_upload_record_month \n" + |
| | | " WHERE point_id=#{pointId} and columns_code=#{columnsCode} AND upload_time BETWEEN #{beginTime} AND #{LastTime}") |
| | | List<DataUploadRecordMonthPO> getLineChart(Long pointId, String columnsCode, Long beginTime, Long LastTime); |
| | | } |
| | |
| | | import com.fengdu.gas.entity.response.alarm.FacilityAlarm; |
| | | import com.fengdu.gas.repository.BasicMapper; |
| | | import com.fengdu.gas.repository.po.FacilityAlarmRecordPO; |
| | | import com.fengdu.gas.repository.vo.FacilityAlarmRecordCount; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 设备报警记录 mapper |
| | |
| | | */ |
| | | public interface FacilityAlarmRecordMapper extends BasicMapper<FacilityAlarmRecordPO> { |
| | | @Select("SELECT description AS NAME ,MIN(min_value) AS minValue ,MAX(max_value) AS maxValue,COUNT(id) AS count FROM facility_alarm_record \n" + |
| | | "WHERE is_delete=0 AND latest_alarm_time BETWEEN #{beginTime} AND #{endTime} '\n" + |
| | | "WHERE is_delete=0 and columns_code is Not NULL AND columns_code<>'' AND latest_alarm_time BETWEEN #{beginTime} AND #{endTime} '\n" + |
| | | "GROUP BY description\n") |
| | | List<FacilityAlarm> getByDateType(String beginTime, String endTime); |
| | | |
| | | @Select("SELECT point_name, COUNT(*) as count FROM facility_alarm_record WHERE is_delete=0 AND latest_alarm_time IS NOT NULL AND latest_alarm_time<>'' and columns_code is Not NULL AND columns_code<>'' GROUP BY point_name ;") |
| | | List<FacilityAlarmRecordCount> getAlarmListByPoint(); |
| | | |
| | | @Select("SELECT facility_id,columns_code,alarm_type,COUNT(*) AS alarm_count FROM facility_alarm_record WHERE is_delete=0 and columns_code is Not NULL AND columns_code<>'' GROUP BY facility_id,columns_code,alarm_type;") |
| | | List<FacilityAlarmRecordPO> getGroupList(); |
| | | } |
| | |
| | | package com.fengdu.gas.repository.mapper; |
| | | |
| | | import com.fengdu.gas.repository.BasicMapper;import com.fengdu.gas.repository.po.WaterFacilityPO; |
| | | import com.fengdu.gas.entity.response.facility.FacilityPointCount; |
| | | import com.fengdu.gas.repository.BasicMapper; |
| | | import com.fengdu.gas.repository.po.WaterFacilityPO; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 设备信息 mapper |
| | | * @author zr |
| | | */ |
| | | public interface WaterFacilityMapper extends BasicMapper<WaterFacilityPO> { |
| | | @Select("SELECT point_name,COUNT(*) FROM water_facility WHERE is_delete=0 GROUP BY point_name") |
| | | List<FacilityPointCount> getFacilityPointCount(); |
| | | } |
| | |
| | | package com.fengdu.gas.repository.mapper; |
| | | |
| | | import com.fengdu.gas.repository.BasicMapper;import com.fengdu.gas.repository.po.WaterFacilityParameterPO; |
| | | import com.fengdu.gas.repository.BasicMapper; |
| | | import com.fengdu.gas.repository.po.WaterFacilityParameterPO; |
| | | import com.fengdu.gas.repository.vo.WaterFacilityParameterVO; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 设备设定参数 mapper |
| | | * @author zr |
| | | */ |
| | | public interface WaterFacilityParameterMapper extends BasicMapper<WaterFacilityParameterPO> { |
| | | |
| | | @Select({ |
| | | "<script>", |
| | | "SELECT a.*,b.facility_state,b.facility_name,b.point_id,b.point_name FROM water_facility_parameter a ", |
| | | "left join water_facility b ON a.facility_id=b.id WHERE a.is_delete=0", |
| | | "<if test= \"pointId!=null and pointId>0 \">", |
| | | "and b.point_id=#{pointId}", |
| | | "</if>", |
| | | "<if test= \"facilityState!=null\">", |
| | | "and b.facility_state=#{facilityState}", |
| | | "</if>", |
| | | "</script>" |
| | | }) |
| | | List<WaterFacilityParameterVO> getListData(Long pointId, Integer facilityState); |
| | | } |
| | |
| | | @TableField(value = "top_margin") |
| | | private String topMargin; |
| | | /** |
| | | * 盒子位置(1左 2右) |
| | | */ |
| | | @TableField(value = "box_type") |
| | | private String boxType; |
| | | /** |
| | | * 监控点图片 |
| | | */ |
| | | @TableField(value = "image_rul") |
对比新文件 |
| | |
| | | package com.fengdu.gas.repository.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class FacilityAlarmRecordCount { |
| | | private String pointName; |
| | | private Integer count; |
| | | } |
| | |
| | | */ |
| | | package com.fengdu.gas.repository.vo; |
| | | |
| | | import com.fengdu.gas.common.enums.EAlarmType; |
| | | import lombok.Data; |
| | | |
| | | import com.fengdu.gas.common.util.LocalDateTimeUtil; |
| | | import com.fengdu.gas.common.util.NumericUtil; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | import com.fengdu.gas.repository.po.FacilityAlarmRecordPO; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Data |
| | | public class FacilityAlarmRecordVO extends FacilityAlarmRecordPO implements BasicVO { |
| | | private String address; |
| | | private String facilityCode; |
| | | |
| | | private String alarmTime; |
| | | |
| | | @Override |
| | | public String getCreateTimeView() { |
| | |
| | | } |
| | | return LocalDateTimeUtil.toFormatFullString(this.getUpdateTime()); |
| | | } |
| | | |
| | | public String getAlarmTypeView() { |
| | | if (Objects.isNull(this.getAlarmType())) { |
| | | return ""; |
| | | } |
| | | return EAlarmType.getByValue(this.getAlarmType()).getDesc(); |
| | | } |
| | | } |
| | |
| | | package com.fengdu.gas.repository.vo; |
| | | |
| | | import com.fengdu.gas.entity.enums.EExecuteType; |
| | | import com.fengdu.gas.entity.enums.EWorkType; |
| | | import lombok.Data; |
| | | |
| | | import com.fengdu.gas.common.util.LocalDateTimeUtil; |
| | |
| | | } |
| | | return EExecuteType.getByValue(this.getExecuteState()).getDesc(); |
| | | } |
| | | public String getTypeView() { |
| | | if (Objects.isNull(this.getType())) { |
| | | return ""; |
| | | } |
| | | return EWorkType.getByValue(this.getExecuteState()).getDesc(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Data |
| | | public class WaterFacilityParameterVO extends WaterFacilityParameterPO implements BasicVO { |
| | | |
| | | private String facilityName; |
| | | private Long pointId; |
| | | private String pointName; |
| | | private Integer facilityState; |
| | | @Override |
| | | public String getCreateTimeView() { |
| | | if (NumericUtil.tryParseLong(this.getCreateTime()).compareTo(0L) > 0) { |
| | |
| | | */ |
| | | @Data |
| | | public class WaterFacilityVO extends WaterFacilityPO implements BasicVO { |
| | | |
| | | private String facilityTypeName; |
| | | @Override |
| | | public String getCreateTimeView() { |
| | | if (NumericUtil.tryParseLong(this.getCreateTime()).compareTo(0L) > 0) { |
| | |
| | | import com.fengdu.gas.common.enums.*; |
| | | import com.fengdu.gas.common.model.Tuple; |
| | | import com.fengdu.gas.common.util.*; |
| | | import com.fengdu.gas.repository.impl.CommonParametersMapperImpl; |
| | | import com.fengdu.gas.repository.po.CommonParametersPO; |
| | | import com.fengdu.gas.repository.vo.UserWorkOrderVO; |
| | | import org.apache.commons.lang3.BooleanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public class AlarmSchemeService extends BaseService { |
| | | @Autowired |
| | | private AlarmSchemeMapperImpl mapper; |
| | | @Autowired |
| | | private CommonParametersMapperImpl commonParametersMapper; |
| | | |
| | | public ExecutedResult<Long> create(ReqCreateAlarmScheme request) { |
| | | public ExecutedResult<Long> create(ReqCreateAlarmScheme request) {; |
| | | CommonParametersPO parametersPO = commonParametersMapper.getById(request.getParametersId()); |
| | | if(Objects.isNull(parametersPO)){ |
| | | return ExecutedResult.failed("参数不存在"); |
| | | } |
| | | // 转换po |
| | | AlarmSchemePO item = CopierUtil.mapTo(request, AlarmSchemePO.class); |
| | | item.setColumnsCode(parametersPO.getMark()); |
| | | item.setColumnsShow(parametersPO.getName()); |
| | | // 设置状态 |
| | | //item.setStatus(EState.NORMAL.getValue()); |
| | | // 设置记录创建时间 |
| | |
| | | import com.fengdu.gas.common.enums.*; |
| | | import com.fengdu.gas.common.model.Tuple; |
| | | import com.fengdu.gas.common.util.*; |
| | | import com.fengdu.gas.entity.request.datauploadrecord.ReqGetDataUploadRecord; |
| | | import com.fengdu.gas.repository.impl.*; |
| | | import com.fengdu.gas.repository.mapper.DataUploadRecordHourMapper; |
| | | import com.fengdu.gas.repository.po.*; |
| | | import com.fengdu.gas.repository.vo.DataUploadRecordDayVO; |
| | | import com.google.gson.JsonElement; |
| | | import com.google.gson.JsonObject; |
| | | import com.google.gson.JsonParser; |
| | |
| | | import com.fengdu.gas.entity.search.SearchDataUploadRecord; |
| | | import com.fengdu.gas.repository.vo.DataUploadRecordVO; |
| | | import com.fengdu.gas.service.convert.DataUploadRecordConvert; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * 数据上报记录 |
| | |
| | | private WaterFacilityParameterMapperImpl waterFacilityParameterMapper; |
| | | private static final Logger DEBUG_LOGGER = LoggerUtil.get(ELogger.DEBUG); |
| | | private static final Logger ERROR_LOGGER = LoggerUtil.get(ELogger.SYS_ERROR); |
| | | |
| | | public ExecutedResult<Long> create(ReqCreateDataUploadRecord request) { |
| | | // 转换po |
| | | DataUploadRecordPO item = DataUploadRecordConvert.INSTANCE.toCreate(request); |
| | |
| | | // } |
| | | // return ExecutedResult.success(); |
| | | // } |
| | | |
| | | /** |
| | | * mqtt收到消息 |
| | | * @param topic 主题 |
| | |
| | | FacilityAlarmRecordPO recordPO=new FacilityAlarmRecordPO(); |
| | | |
| | | } |
| | | |
| | | public ExecutedResult<String> dataUpload(Long startTime, Long endTime, Integer type) { |
| | | List<WaterFacilityPO> facilityPOList = waterFacilityMapper.getList(); |
| | | //获取所有设备参数 |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | return ExecutedResult.success(); |
| | | } |
| | | |
| | | public ExecutedResult<List<DataUploadRecordDayVO>> getLineChart(ReqGetDataUploadRecord record) { |
| | | Long beginTime = 0L; |
| | | Long endTime = 0L; |
| | | List<DataUploadRecordDayVO> data = new ArrayList<>(); |
| | | List<DataUploadRecordDayVO> result = new ArrayList<>(); |
| | | switch (record.getDateType()) { |
| | | case 1: |
| | | beginTime = LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.todayStartTime()).getTime(); |
| | | endTime = LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.todayEndTime()).getTime(); |
| | | if (beginTime > 0 && endTime > 0) { |
| | | List<DataUploadRecordHourPO> lineChart = dataUploadRecordHourMapper.getLineChart(record.getPointId(), record.getColumnsCode(), beginTime, endTime); |
| | | if(ListUtil.isNotNullOrEmpty(lineChart)){ |
| | | data = CopierUtil.mapTo(lineChart, DataUploadRecordDayVO.class); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case 2: |
| | | beginTime = LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.weekStartTime()).getTime(); |
| | | endTime = LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.weekEndTime()).getTime(); |
| | | if (beginTime > 0 && endTime > 0) { |
| | | List<DataUploadRecordDayPO> lineChart = dataUploadRecordDayMapper.getLineChart(record.getPointId(), record.getColumnsCode(), beginTime, endTime); |
| | | if(ListUtil.isNotNullOrEmpty(lineChart)){ |
| | | data = CopierUtil.mapTo(lineChart, DataUploadRecordDayVO.class); |
| | | } |
| | | } |
| | | break; |
| | | case 3: |
| | | beginTime = LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.monthStartTime()).getTime(); |
| | | endTime = LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.monthEndTime()).getTime(); |
| | | if (beginTime > 0 && endTime > 0) { |
| | | List<DataUploadRecordMonthPO> lineChart = dataUploadRecordMonthMapper.getLineChart(record.getPointId(), record.getColumnsCode(), beginTime, endTime); |
| | | if(ListUtil.isNotNullOrEmpty(lineChart)){ |
| | | data = CopierUtil.mapTo(lineChart, DataUploadRecordDayVO.class); |
| | | } |
| | | } |
| | | break; |
| | | case 4: |
| | | beginTime = LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.yearStartTime()).getTime(); |
| | | endTime = LocalDateTimeUtil.getTimeStamp(LocalDateTimeUtils.yearEndTime()).getTime(); |
| | | if (beginTime > 0 && endTime > 0) { |
| | | List<DataUploadRecordMonthPO> lineChart = dataUploadRecordMonthMapper.getLineChart(record.getPointId(), record.getColumnsCode(), beginTime, endTime); |
| | | if(ListUtil.isNotNullOrEmpty(lineChart)){ |
| | | data = CopierUtil.mapTo(lineChart, DataUploadRecordDayVO.class); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | //查询监控点下是否存在多个设备的数据,存在则计算最小、最大、平均值 |
| | | if (ListUtil.isNotNullOrEmpty(data)) { |
| | | Map<String, List<DataUploadRecordDayVO>> collect = data.stream().collect(Collectors.groupingBy(DataUploadRecordDayVO::getUploadDate)); |
| | | for (Map.Entry<String, List<DataUploadRecordDayVO>> map : collect.entrySet()) { |
| | | List<DataUploadRecordDayVO> value = map.getValue(); |
| | | DataUploadRecordDayVO dayVO = new DataUploadRecordDayVO(); |
| | | dayVO.setUploadDate(map.getKey()); |
| | | BigDecimal maxValue = BigDecimal.ZERO; |
| | | BigDecimal minValue = BigDecimal.ZERO; |
| | | BigDecimal avgValue = BigDecimal.ZERO; |
| | | if (value.size() > 1) { |
| | | maxValue = Collections.max(value, Comparator.comparing(DataUploadRecordDayVO::getMaxValue)).getMaxValue(); |
| | | minValue = Collections.min(value, Comparator.comparing(DataUploadRecordDayVO::getMinValue)).getMinValue(); |
| | | BigDecimal sum = maxValue.add(minValue); |
| | | avgValue=sum.divide(new BigDecimal(2)).setScale(2,RoundingMode.DOWN); |
| | | }else { |
| | | maxValue=value.get(0).getMaxValue(); |
| | | minValue=value.get(0).getMinValue(); |
| | | avgValue=value.get(0).getAvgValue(); |
| | | } |
| | | dayVO.setMaxValue(maxValue); |
| | | dayVO.setMinValue(minValue); |
| | | dayVO.setAvgValue(avgValue); |
| | | result.add(dayVO); |
| | | } |
| | | result.sort(Comparator.comparingInt(o -> Integer.parseInt(o.getUploadDate()))); |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | |
| | | public ExecutedResult<List<DataUploadRecordVO>> getList(List<Long> listId) { |
| | | List<DataUploadRecordVO> result = new ArrayList<>(); |
| | | |
| | |
| | | import com.fengdu.gas.common.model.Tuple; |
| | | import com.fengdu.gas.common.util.*; |
| | | import com.fengdu.gas.entity.response.alarm.FacilityAlarm; |
| | | import com.fengdu.gas.repository.impl.WaterFacilityMapperImpl; |
| | | import com.fengdu.gas.repository.po.AlarmSchemePO; |
| | | import com.fengdu.gas.repository.po.WaterFacilityPO; |
| | | import com.fengdu.gas.repository.vo.FacilityAlarmRecordCount; |
| | | import org.apache.commons.lang3.BooleanUtils; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.fengdu.gas.repository.impl.FacilityAlarmRecordMapperImpl; |
| | | import com.fengdu.gas.repository.po.FacilityAlarmRecordPO; |
| | | import com.fengdu.gas.entity.request.facilityalarmrecord.ReqCreateFacilityAlarmRecord; |
| | |
| | | public class FacilityAlarmRecordService extends BaseService { |
| | | @Autowired |
| | | private FacilityAlarmRecordMapperImpl mapper; |
| | | @Autowired |
| | | private WaterFacilityMapperImpl waterFacilityMapper; |
| | | |
| | | public ExecutedResult<Long> create(ReqCreateFacilityAlarmRecord request) { |
| | | // 转换po |
| | |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | |
| | | public ExecutedResult<List<FacilityAlarmRecordVO>> getAlarmTime(){ |
| | | List<FacilityAlarmRecordVO>result=new ArrayList<>(); |
| | | List<FacilityAlarmRecordPO> list = mapper.getList(); |
| | | if(ListUtil.isNotNullOrEmpty(list)){ |
| | | result=CopierUtil.mapTo(list, FacilityAlarmRecordVO.class); |
| | | for(FacilityAlarmRecordVO vo:result){ |
| | | if(StringUtil.isNotNullOrEmpty(vo.getFirstAlarmTime())&&StringUtil.isNotNullOrEmpty(vo.getLatestAlarmTime())){ |
| | | vo.setAlarmTime(LocalDateTimeUtil.getDateHoursMinutesSeconds(vo.getFirstAlarmTime(),vo.getLatestAlarmTime())); |
| | | } |
| | | } |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | // public ExecutedResult<String> stop(Long id) { |
| | | // // 验证记录是否存在 |
| | | // ExecutedResult<FacilityAlarmRecordPO> checkExists = this.check4Id(id); |
| | |
| | | // } |
| | | // return ExecutedResult.success(); |
| | | // } |
| | | |
| | | public ExecutedResult<List<FacilityAlarmRecordCount>> getAlarmListByPoint() { |
| | | List<FacilityAlarmRecordCount> list = mapper.getAlarmListByPoint(); |
| | | return ExecutedResult.success(list); |
| | | } |
| | | public ExecutedResult<List<FacilityAlarmRecordVO>> getAlarmRecord(){ |
| | | List<FacilityAlarmRecordVO> result=new ArrayList<>(); |
| | | List<FacilityAlarmRecordPO> recordPOList = mapper.getList(); |
| | | List<FacilityAlarmRecordPO> list = mapper.getGroupList(); |
| | | if(ListUtil.isNotNullOrEmpty(list)){ |
| | | result=CopierUtil.mapTo(list,FacilityAlarmRecordVO.class); |
| | | for(FacilityAlarmRecordVO vo:result){ |
| | | FacilityAlarmRecordPO recordPO = recordPOList.stream().filter(item -> item.getFacilityId().equals(vo.getFacilityId()) |
| | | && item.getColumnsCode().equals(vo.getColumnsCode()) |
| | | && item.getAlarmType().equals(vo.getAlarmType())).max(Comparator.comparing(FacilityAlarmRecordPO::getLatestAlarmTime)).orElse(null); |
| | | if(Objects.nonNull(recordPO)){ |
| | | vo.setLatestAlarmTime(recordPO.getLatestAlarmTime()); |
| | | vo.setFacilityName(recordPO.getFacilityName()); |
| | | vo.setPointId(recordPO.getPointId()); |
| | | vo.setPointName(recordPO.getPointName()); |
| | | vo.setDescription(recordPO.getDescription()); |
| | | vo.setColumnsName(recordPO.getColumnsName()); |
| | | } |
| | | } |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | public ExecutedResult<List<FacilityAlarmRecordVO>> getList(List<Long> listId) { |
| | | List<FacilityAlarmRecordVO> result = new ArrayList<>(); |
| | | |
| | |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | |
| | | public ExecutedResult<List<FacilityAlarm>> getAlarmList(Integer dateType){ |
| | | List<FacilityAlarm> result=new ArrayList<>(); |
| | | // 处理创建时间范围-查询参数 |
| | |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | |
| | | public ExecutedResult<PagerResult<FacilityAlarmRecordVO>> search(SearchFacilityAlarmRecord search) { |
| | | |
| | | PagerResult<FacilityAlarmRecordPO> pageList = mapper.search(search); |
| | |
| | | } |
| | | return ExecutedResult.success(exists); |
| | | } |
| | | |
| | | protected ExecutedResult<List<FacilityAlarmRecordPO>> check4Id(List<Long> listId) { |
| | | // 从数据库查找设备报警记录 |
| | | List<FacilityAlarmRecordPO> list = mapper.getList(listId); |
| | |
| | | } |
| | | } |
| | | return ExecutedResult.success(list); |
| | | }} |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 测试支付 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ExecutedResult<String> testPay() throws Exception { |
| | | CloseableHttpClient client = HttpClients.createDefault(); |
| | | HttpPost httpPost = new HttpPost("https://test.sumpay.cn/entrance/gateway.htm"); |
| | | List<BasicNameValuePair> pairList = new ArrayList<>(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("service", "fosun.sumpay.api.orderpay.order.apply"); |
| | | map.put("version","1.0"); |
| | | map.put("format","JSON"); |
| | | map.put("app_id",); |
| | | map.put("timestamp","20250313142521"); |
| | | map.put("terminal_type","api"); |
| | | map.put("mer_no", "200102833852");//商户号 |
| | | map.put("account_type", "01");//付款方账户类型 |
| | | map.put("card_no", AES256("6217007200125513450"));//付款方账户号 |
| | | map.put("real_name", AES256("尹勇"));//付款方账户名 |
| | | //map.put("bank_code","");//银行代码 |
| | | //map.put("id_type","1");//证件类型 |
| | | //map.put("id_no",AES256(""));//证件号码 |
| | | //map.put("notify_url");//商户后台通知URL |
| | | map.put("goods_name", Base64("测试001"));//商品名称 |
| | | map.put("goods_num", "1");//商品数量 |
| | | map.put("goods_price", "0.11");//商品价格 |
| | | map.put("goods_type", "1");//商品类型 |
| | | map.put("order_no", "111111111111111");//订单号 |
| | | map.put("order_amount", "0.11");//订单金额 |
| | | map.put("order_time", "20250313142521");//订单时间 |
| | | map.put("currency", "CNY");//币种 |
| | | // map.put("pay_comments");//附言 |
| | | //map.put("remark");//备注字段 |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | for (Map.Entry<String, String> entry : map.entrySet()) { |
| | | map1.put(entry.getKey(), entry.getValue()); |
| | | } |
| | | //map转换字符串&拼接并排序 |
| | | String keyAndValueStr = getKeyAndValueStr(map); |
| | | //签名处理 |
| | | String msg = signMsg(keyAndValueStr, PRIVATE_KEY, PASSWORD, "UTF-8"); |
| | | map1.put("sign_type","CERT"); |
| | | map1.put("sign",msg); |
| | | |
| | | for(String key:map1.keySet()){ |
| | | pairList.add(new BasicNameValuePair(key,map1.get(key))); |
| | | } |
| | | UrlEncodedFormEntity entity = new UrlEncodedFormEntity(pairList, "UTF-8"); |
| | | httpPost.setEntity(entity); |
| | | try { |
| | | // 执行请求并获取响应 |
| | | CloseableHttpResponse response = client.execute(httpPost); |
| | | try { |
| | | if(response.getStatusLine().getStatusCode()== HttpStatus.SC_OK){ |
| | | String data=EntityUtils.toString(response.getEntity(),"UTF-8"); |
| | | System.out.println(data); |
| | | }else { |
| | | throw new RuntimeException("接口连接失败"); |
| | | } |
| | | // 处理响应... |
| | | } finally { |
| | | response.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | client.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return ExecutedResult.success(); |
| | | } |
| | | /** |
| | | * 订单支付确认接口 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ExecutedResult<String> confirmPay() throws Exception { |
| | | CloseableHttpClient client = HttpClients.createDefault(); |
| | | HttpPost httpPost = new HttpPost("https://test.sumpay.cn/entrance/gateway.htm"); |
| | | List<BasicNameValuePair> pairList = new ArrayList<>(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("service", "fosun.sumpay.api.orderpay.order.apply"); |
| | | map.put("version","1.0"); |
| | | map.put("format","JSON"); |
| | | map.put("app_id",); |
| | | map.put("timestamp","20250313142521"); |
| | | map.put("terminal_type","api"); |
| | | map.put("mer_no", "200102833852");//商户号 |
| | | map.put("order_no", "111111111111111");//订单号 |
| | | map.put("serial_no", "");//入账流水号 |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | for (Map.Entry<String, String> entry : map.entrySet()) { |
| | | map1.put(entry.getKey(), entry.getValue()); |
| | | } |
| | | //map转换字符串&拼接并排序 |
| | | String keyAndValueStr = getKeyAndValueStr(map); |
| | | //签名处理 |
| | | String msg = signMsg(keyAndValueStr, PRIVATE_KEY, PASSWORD, "UTF-8"); |
| | | map1.put("sign_type","CERT"); |
| | | map1.put("sign",msg); |
| | | |
| | | for(String key:map1.keySet()){ |
| | | pairList.add(new BasicNameValuePair(key,map1.get(key))); |
| | | } |
| | | UrlEncodedFormEntity entity = new UrlEncodedFormEntity(pairList, "UTF-8"); |
| | | httpPost.setEntity(entity); |
| | | try { |
| | | // 执行请求并获取响应 |
| | | CloseableHttpResponse response = client.execute(httpPost); |
| | | try { |
| | | if(response.getStatusLine().getStatusCode()== HttpStatus.SC_OK){ |
| | | String data=EntityUtils.toString(response.getEntity(),"UTF-8"); |
| | | System.out.println(data); |
| | | }else { |
| | | throw new RuntimeException("接口连接失败"); |
| | | } |
| | | // 处理响应... |
| | | } finally { |
| | | response.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | client.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return ExecutedResult.success(); |
| | | } |
| | | /** |
| | | * 签名处理 |
| | | * @param privateKeyPath:私钥 |
| | |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | |
| | | public ExecutedResult<List<UserWorkOrderVO>> getUserWorkList(){ |
| | | List<UserWorkOrderVO> result = new ArrayList<>(); |
| | | List<UserWorkOrderPO> list = mapper.getList(); |
| | | if(ListUtil.isNotNullOrEmpty(list)){ |
| | | result=CopierUtil.mapTo(list,UserWorkOrderVO.class); |
| | | List<WaterFacilityPO> facilityPOList = waterFacilityMapper.getList(); |
| | | for(UserWorkOrderVO vo:result){ |
| | | WaterFacilityPO waterFacilityPO = facilityPOList.stream().filter(item -> item.getFacilityCode().equals(vo.getFacilityCode())).findFirst().orElse(null); |
| | | if(Objects.nonNull(waterFacilityPO)){ |
| | | vo.setPointName(waterFacilityPO.getPointName()); |
| | | vo.setFacilityName(waterFacilityPO.getFacilityName()); |
| | | } |
| | | } |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | public ExecutedResult<PagerResult<UserWorkOrderVO>> search(SearchUserWorkOrder search) { |
| | | // 处理创建时间范围-查询参数 |
| | | Tuple<String, String> createTimeRange = ParameterUtil.getTimeRange(search.getCreateTimeRange()); |
| | |
| | | package com.fengdu.gas.service; |
| | | |
| | | import com.fengdu.gas.common.*; |
| | | import com.fengdu.gas.common.enums.*; |
| | | import com.fengdu.gas.common.enums.EFacilityState; |
| | | import com.fengdu.gas.common.model.Tuple; |
| | | import com.fengdu.gas.common.util.*; |
| | | import com.fengdu.gas.entity.request.waterfacilityparameter.ReqAddParameter; |
| | | import com.fengdu.gas.entity.response.facility.FacilityParameterData; |
| | | import com.fengdu.gas.repository.impl.WaterFacilityMapperImpl; |
| | | import com.fengdu.gas.repository.impl.WaterMonitoryPointMapperImpl; |
| | | import com.fengdu.gas.repository.po.WaterFacilityPO; |
| | | import org.apache.commons.lang3.BooleanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.fengdu.gas.repository.impl.WaterFacilityParameterMapperImpl; |
| | | import com.fengdu.gas.repository.po.WaterFacilityParameterPO; |
| | | import com.fengdu.gas.entity.request.waterfacilityparameter.ReqCreateWaterFacilityParameter; |
| | |
| | | private WaterFacilityParameterMapperImpl mapper; |
| | | @Autowired |
| | | private WaterFacilityMapperImpl waterFacilityMapper; |
| | | @Autowired |
| | | private WaterMonitoryPointMapperImpl waterMonitoryPointMapper; |
| | | |
| | | public ExecutedResult<String> create(ReqAddParameter request) { |
| | | WaterFacilityPO facilityPO = waterFacilityMapper.get(request.getFacilityId()); |
| | |
| | | return ExecutedResult.failed("编辑[设备设定参数]失败。"); |
| | | } |
| | | return ExecutedResult.success(); |
| | | } |
| | | |
| | | public ExecutedResult<List<FacilityParameterData>> getDataList(Long pointId, Integer facilityState) { |
| | | List<FacilityParameterData> result = new ArrayList<>(); |
| | | List<WaterFacilityPO> facilityPOList = waterFacilityMapper.getList(); |
| | | List<WaterFacilityParameterVO> listData = mapper.getListData(pointId, facilityState); |
| | | if (ListUtil.isNotNullOrEmpty(listData)) { |
| | | Map<Long, List<WaterFacilityParameterVO>> dataMap = listData.stream().collect(Collectors.groupingBy(WaterFacilityParameterVO::getFacilityId)); |
| | | for (Map.Entry<Long, List<WaterFacilityParameterVO>> map : dataMap.entrySet()) { |
| | | WaterFacilityPO facilityPO = facilityPOList.stream().filter(item -> item.getId().equals(map.getKey())).findFirst().orElse(null); |
| | | WaterFacilityParameterVO jw001 = map.getValue().stream().filter(item -> item.getColumnsCode().equals("JW001")).findFirst().orElse(null); |
| | | WaterFacilityParameterVO lhq001 = map.getValue().stream().filter(item -> item.getColumnsCode().equals("LHQ001")).findFirst().orElse(null); |
| | | WaterFacilityParameterVO wd001 = map.getValue().stream().filter(item -> item.getColumnsCode().equals("WD001")).findFirst().orElse(null); |
| | | FacilityParameterData data = new FacilityParameterData(); |
| | | data.setFacilityName(facilityPO.getFacilityName()); |
| | | data.setFacilityState(facilityPO.getFacilityState()); |
| | | data.setFacilityStateName(EFacilityState.getByValue(facilityPO.getFacilityState()).getDesc()); |
| | | data.setPointId(facilityPO.getPointId()); |
| | | data.setPointName(facilityPO.getPointName()); |
| | | if (Objects.nonNull(jw001)) |
| | | data.setMethaneValue(jw001.getColumnValue()); |
| | | if (Objects.nonNull(lhq001)) |
| | | data.setHydrogenValue(lhq001.getColumnValue()); |
| | | if (Objects.nonNull(wd001)) |
| | | data.setTemperatureValue(wd001.getColumnValue()); |
| | | result.add(data); |
| | | } |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | |
| | | public ExecutedResult<WaterFacilityParameterVO> get(Long id) { |
| | |
| | | } |
| | | return ExecutedResult.success(exists); |
| | | } |
| | | |
| | | protected ExecutedResult<List<WaterFacilityParameterPO>> check4Id(List<Long> listId) { |
| | | // 从数据库查找设备设定参数 |
| | | List<WaterFacilityParameterPO> list = mapper.getList(listId); |
| | |
| | | } |
| | | } |
| | | return ExecutedResult.success(list); |
| | | }} |
| | | } |
| | | } |
| | |
| | | */ |
| | | package com.fengdu.gas.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.fengdu.gas.common.*; |
| | | import com.fengdu.gas.common.enums.*; |
| | | import com.fengdu.gas.common.model.Tuple; |
| | | import com.fengdu.gas.common.util.*; |
| | | import com.fengdu.gas.entity.response.facility.FacilityCount; |
| | | import com.fengdu.gas.entity.response.facility.FacilityData; |
| | | import com.fengdu.gas.entity.response.facility.FacilityPointCount; |
| | | import com.fengdu.gas.entity.response.facility.FacilityStateData; |
| | | import com.fengdu.gas.repository.impl.WaterFacilityParameterMapperImpl; |
| | | import com.fengdu.gas.repository.impl.WaterFacilityTypeMapperImpl; |
| | | import com.fengdu.gas.repository.impl.WaterMonitoryPointMapperImpl; |
| | | import com.fengdu.gas.repository.po.WaterFacilityParameterPO; |
| | | import com.fengdu.gas.repository.po.WaterFacilityTypePO; |
| | | import com.fengdu.gas.repository.po.WaterMonitoryPointPO; |
| | | import org.apache.commons.lang3.BooleanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | |
| | | private WaterFacilityParameterMapperImpl waterFacilityParameterMapper; |
| | | @Autowired |
| | | private WaterMonitoryPointMapperImpl waterMonitoryPointMapper; |
| | | @Autowired |
| | | private WaterFacilityTypeMapperImpl waterFacilityTypeMapper; |
| | | |
| | | public ExecutedResult<Long> create(ReqCreateWaterFacility request) { |
| | | WaterMonitoryPointPO pointPO = waterMonitoryPointMapper.getById(request.getPointId()); |
| | | if(Objects.isNull(pointPO)){ |
| | | return ExecutedResult.failed("监测点不存在"); |
| | | } |
| | | // 转换po |
| | | WaterFacilityPO item = CopierUtil.mapTo(request, WaterFacilityPO.class); |
| | | item.setPointId(pointPO.getId()); |
| | | item.setPointName(pointPO.getPointName()); |
| | | // 设置状态 |
| | | //item.setStatus(EState.NORMAL.getValue()); |
| | | // 设置记录创建时间 |
| | |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | |
| | | public ExecutedResult<List<WaterFacilityPO>> getFacilityFan(Integer type){ |
| | | List<WaterFacilityPO>result = new ArrayList<>(); |
| | | if(type!=null){ |
| | | LambdaQueryWrapper<WaterFacilityPO>wrapper=new LambdaQueryWrapper<>(); |
| | | wrapper.eq(WaterFacilityPO::getFacilityFanState,type); |
| | | result= mapper.selectList(wrapper); |
| | | }else { |
| | | result= mapper.getList(); |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | public ExecutedResult<List<FacilityStateData>> getFacilityState(){ |
| | | List<FacilityStateData>result = new ArrayList<>(); |
| | | List<WaterFacilityPO> facilityPOList = mapper.getList(); |
| | | EFacilityState[] values = EFacilityState.values(); |
| | | for(EFacilityState v:values){ |
| | | FacilityStateData stateData=new FacilityStateData(); |
| | | stateData.setTypeName(EFacilityState.getByValue(v.getValue()).getDesc()); |
| | | List<WaterFacilityPO> collect = facilityPOList.stream().filter(item -> item.getFacilityState().equals(v.getValue())).collect(Collectors.toList()); |
| | | if(ListUtil.isNotNullOrEmpty(collect)){ |
| | | BigDecimal bigDecimal = new BigDecimal(collect.size()).divide(new BigDecimal(facilityPOList.size())).setScale(2, RoundingMode.DOWN); |
| | | BigDecimal bigDecimal1 = bigDecimal.multiply(new BigDecimal(100)).setScale(2, RoundingMode.DOWN); |
| | | stateData.setValue(bigDecimal1); |
| | | } |
| | | result.add(stateData); |
| | | } |
| | | return ExecutedResult.success(result); |
| | | } |
| | | public ExecutedResult<List<FacilityPointCount>> getFacilityPointCount(){ |
| | | return ExecutedResult.success(mapper.getFacilityPointCount()); |
| | | } |
| | | public ExecutedResult<List<FacilityData>> getFacilityList() { |
| | | List<FacilityData> result = new ArrayList<>(); |
| | | List<WaterMonitoryPointPO> pointPOList = waterMonitoryPointMapper.getList(); |
| | |
| | | data.setTop(pointPO.getTopMargin()); |
| | | data.setFacilityId(facilityPO.getId()); |
| | | data.setFacilityName(facilityPO.getFacilityName()); |
| | | data.setBoxType(pointPO.getBoxType()); |
| | | data.setFacilityState(EFacilityState.getByValue(facilityPO.getFacilityState()).getDesc()); |
| | | data.setFacilityFanState(EFacilityState.getByValue(facilityPO.getFacilityFanState()).getDesc()); |
| | | List<WaterFacilityParameterPO> poList = parameterPOList.stream().filter(item -> item.getFacilityId().equals(facilityPO.getId())).collect(Collectors.toList()); |
| | |
| | | if (ListUtil.isNotNullOrEmpty(list)) { |
| | | pageList.setLastId(list.get(list.size() - 1).getId()); |
| | | // 转换vo |
| | | List<WaterFacilityTypePO> typePOS = waterFacilityTypeMapper.getList(); |
| | | listVo = WaterFacilityConvert.INSTANCE.toVo(list); |
| | | for(WaterFacilityVO vo:listVo){ |
| | | WaterFacilityTypePO facilityTypePO = typePOS.stream().filter(item -> item.getId().equals(vo.getFacilityType())).findFirst().orElse(null); |
| | | if(Objects.nonNull(facilityTypePO)){ |
| | | vo.setFacilityTypeName(facilityTypePO.getName()); |
| | | } |
| | | } |
| | | } |
| | | PagerResult<WaterFacilityVO> result = new PagerResult<>(pageList.getLimit(), pageList.getPage(), pageList.getTotal(), listVo); |
| | | result.setLastId(pageList.getLastId()); |
| | |
| | | |
| | | public ExecutedResult<Long> create(ReqCreateWaterMonitoryPoint request) { |
| | | // 转换po |
| | | WaterMonitoryPointPO item = WaterMonitoryPointConvert.INSTANCE.toCreate(request); |
| | | WaterMonitoryPointPO item =CopierUtil.mapTo(request, WaterMonitoryPointPO.class); |
| | | // 设置状态 |
| | | //item.setStatus(EState.NORMAL.getValue()); |
| | | // 设置记录创建时间 |
| | |
| | | return ExecutedResult.failed(checkExists.getMsg()); |
| | | } |
| | | // 转换po |
| | | WaterMonitoryPointPO item = WaterMonitoryPointConvert.INSTANCE.toModify(request); |
| | | WaterMonitoryPointPO item = CopierUtil.mapTo(request, WaterMonitoryPointPO.class); |
| | | |
| | | int rowCount = mapper.updateById(item); |
| | | if (rowCount != 1) { |
| | |
| | | if (ListUtil.isNotNullOrEmpty(list)) { |
| | | pageList.setLastId(list.get(list.size() - 1).getId()); |
| | | // 转换vo |
| | | listVo = WaterMonitoryPointConvert.INSTANCE.toVo(list); |
| | | listVo =CopierUtil.mapTo(list, WaterMonitoryPointVO.class); |
| | | } |
| | | PagerResult<WaterMonitoryPointVO> result = new PagerResult<>(pageList.getLimit(), pageList.getPage(), pageList.getTotal(), listVo); |
| | | result.setLastId(pageList.getLastId()); |
对比新文件 |
| | |
| | | { |
| | | "image/jpeg": "jpg", |
| | | "image/jpg": "jpg", |
| | | "image/gif": "gif", |
| | | "image/png": "png", |
| | | "image/bmp": "bmp", |
| | | |
| | | "application/zip": "zip", |
| | | "application/x-rar": "rar", |
| | | "application/x-7z-compressed": "7z", |
| | | "application/x-gzip": "gz", |
| | | "application/x-tar": "tar", |
| | | |
| | | "application/pdf": "pdf", |
| | | |
| | | "application/msword": "doc", |
| | | "application/vnd.ms-excel": "xls", |
| | | "application/vnd.ms-powerpoint": "ppt", |
| | | "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx", |
| | | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx", |
| | | "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx", |
| | | |
| | | "text/markdown": "md", |
| | | "text/plain": "txt" |
| | | } |
| | |
| | | * 只生成以下配置的表 |
| | | */ |
| | | private static final List<String> ONLY_TABLES = Arrays.asList( |
| | | "alarm_scheme" |
| | | "facility_run_time" |
| | | ); |
| | | |
| | | public static void main(String[] args) { |