Merge remote-tracking branch 'origin/master'
| | |
| | | selectSql.append(result.getSelectSql()); |
| | | } else { |
| | | selectSql.append(result.getSelectSql()); |
| | | selectSql.append(", "); |
| | | selectSql.append(indItem.getTimeLabel()); |
| | | selectSql.append(" data_time"); |
| | | } |
| | | selectSql.append(", "); |
| | | selectSql.append(indItem.getTimeLabel()); |
| | | selectSql.append(" data_time"); |
| | | result.setSelectSql(selectSql.toString()); |
| | | |
| | | // 拼接WHERE |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * InfluxDB操作类 |
| | |
| | | private int rawOffset = TimeZone.getDefault().getRawOffset(); |
| | | |
| | | private int pas_ms = 1000; |
| | | |
| | | private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | @Resource |
| | | private InfluxDBService influxDBService; |
| | | |
| | | @Override |
| | | public void syncWriteFloatValue(String pointNo, String dataValue, long time) { |
| | |
| | | for (FluxRecord record : records) { |
| | | Map<String, Object> dataIem = new HashMap<>(2); |
| | | dataIem.put(VALUE, record.getValueByKey("_value")); |
| | | dataIem.put(TIME, sdf.format(Date.from(record.getTime()))); |
| | | dataIem.put(TIME, DateUtils.format(Date.from(record.getTime()), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); |
| | | dataList.add(dataIem); |
| | | } |
| | | } |
| | |
| | | @Operation(summary = "获取最后预测值") |
| | | Map<String, BigDecimal> getPredictLastValue(@RequestBody PredictLastValueReqVO reqVO); |
| | | |
| | | @GetMapping("/predict-data/electric") |
| | | @Operation(summary = "电力功率因数预测结果查询") |
| | | Map<String,List<Object[]>> getElectricPredictData(String itemCode); |
| | | |
| | | @GetMapping("/schedule-data/last") |
| | | @Operation(summary = "调度模型最新结果查询") |
| | | List<StScheduleRecordVO> getLastScheduleData(@RequestParam("scheduleCode") String scheduleCode,@RequestParam("limit") Integer limit); |
| | | |
| | | @GetMapping("/machineRealTimeStatus") |
| | | @Operation(summary = "发电机组实时状态查询") |
| | | List<Map<String, Object>> getRealTimeStatus(@RequestBody List<Map<String, Object>> machines); |
| | | |
| | | @PostMapping("/predict-data/itemNo") |
| | | @Operation(summary = "查询时间范围内预测结果") |
| | | Map<String,List<Object[]>> getPredictDataItemNo(@RequestBody PreDataItemNoReqVO reqVO); |
| | | |
| | | @GetMapping(PREFIX + "/electricityPrice/list") |
| | | @Operation(summary = "电价时段配置列表") |
| | | List<ElectricityPriceSegmentedDTO> getElectricityPriceList(@RequestParam("year") String year, @RequestParam("time") String time); |
| | | |
| | | @PostMapping(PREFIX + "/electricityPrice/create") |
| | | @Operation(summary = "添加电价时段配置列表") |
| | | Boolean createElectricityPrice(@RequestBody List<ElectricityPriceSegmentedDTO> list); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mcs.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author Jay |
| | | * @description: 电价分段数据 |
| | | **/ |
| | | @Data |
| | | public class ElectricityPriceSegmentedDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | private String id; |
| | | |
| | | private String iTimeId; |
| | | |
| | | private String recId; |
| | | |
| | | /** |
| | | * 能介编号 |
| | | */ |
| | | private String mediaId; |
| | | |
| | | private String refMediaId; |
| | | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * 年份 |
| | | */ |
| | | private String year; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | private Date updateTime; |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | @Schema(description = "对象") |
| | | private String obj; |
| | | |
| | | @Schema(description = "类型(alarm:预警,suggest:建议)") |
| | | private String type; |
| | | |
| | | @Schema(description = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | |
| | | @Schema(description = "对象集合") |
| | | private List<String> objList; |
| | | |
| | | } |
| | |
| | | alter table t_mm_predict_alarm_config add column `cul_lower` decimal(10, 4) COMMENT '累计值下限'; |
| | | |
| | | alter table t_st_schedule_scheme modify column `trigger_condition` varchar(50) COMMENT '触发条件' |
| | | |
| | | |
| | | CREATE TABLE `t_electricity_price_segmented` ( |
| | | `id` varchar(36) NOT NULL COMMENT 'ID', |
| | | `i_time_id` varchar(36) DEFAULT NULL, |
| | | `rec_id` varchar(36) DEFAULT NULL, |
| | | `media_id` varchar(36) DEFAULT NULL COMMENT '能介编号', |
| | | `ref_media_id` varchar(20) DEFAULT NULL, |
| | | `start_time` datetime NULL DEFAULT NULL COMMENT '开始时间', |
| | | `end_time` datetime NULL DEFAULT NULL COMMENT '结束时间', |
| | | `year` varchar(26) DEFAULT NULL, |
| | | `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', |
| | | `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | INDEX `ind_i_time_id`(`i_time_id` ASC) USING BTREE |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='电价时段配置数据'; |
| | |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mpk.service.ChartParamService; |
| | | import com.iailab.module.model.mpk.service.ChartService; |
| | | import com.iailab.module.model.mpk.service.ElectricityPriceSegmentedService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private InfluxDBService influxDBService; |
| | | |
| | | @Autowired |
| | | private ElectricityPriceSegmentedService electricityPriceSegmentedService; |
| | | |
| | | private int HOUR_MINS = 60; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String,List<Object[]>> getElectricPredictData(String itemCode) { |
| | | ItemVO predictItem = mmPredictItemService.getItemByItemNo(itemCode); |
| | | if (null == predictItem) { |
| | | return new HashMap<>(); |
| | | } |
| | | List<Integer> resultIndexs = new ArrayList<>(); |
| | | resultIndexs.add(0); |
| | | resultIndexs.add(1); |
| | | resultIndexs.add(2); |
| | | List<MmItemOutputEntity> outPuts = mmItemOutputService.getByItemid(predictItem.getId(),"predictValues",resultIndexs); |
| | | if (CollectionUtils.isEmpty(outPuts)) { |
| | | return new HashMap<>(); |
| | | } |
| | | InfluxModelResultByOutPutIdsPOJO pojo = new InfluxModelResultByOutPutIdsPOJO(); |
| | | pojo.setOutPutIds(outPuts.stream().map(MmItemOutputEntity::getId).collect(Collectors.toList())); |
| | | pojo.setType(DataTypeEnum.FLOAT.getCode()); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictItem.getLastTime()); |
| | | calendar.add(Calendar.DAY_OF_YEAR, 7); |
| | | Map<String, List<InfluxModelResultVO>> outPutDatas = influxDBService.queryModelResultsByOutPutIds(pojo, predictItem.getLastTime(), calendar.getTime()); |
| | | Map<String,List<Object[]>> result = new HashMap<>(outPuts.size()); |
| | | for (MmItemOutputEntity outPut : outPuts) { |
| | | String outPutId = outPut.getId(); |
| | | if (outPutDatas.containsKey(outPutId)) { |
| | | List<InfluxModelResultVO> influxModelResultVOS = outPutDatas.get(outPutId); |
| | | result.put(null == outPut.getResultIndex() ? outPut.getResultstr() : outPut.getResultstr()+"_"+outPut.getResultIndex(),influxModelResultVOS.stream().map(e -> { |
| | | Object[] values = new Object[2]; |
| | | values[0] = DateUtils.format(Date.from(e.getTimestamp()), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | values[1] = Double.valueOf(e.getValue().toString()); |
| | | return values; |
| | | }).collect(Collectors.toList())); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<StScheduleRecordVO> getLastScheduleData(String scheduleCode, Integer limit) { |
| | | if (StringUtils.isBlank(scheduleCode)) { |
| | | return null; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getRealTimeStatus(List<Map<String, Object>> machines) { |
| | | List<String> pointNos = new ArrayList<>(16); |
| | | for (Map<String, Object> machine : machines) { |
| | | List<String> list = (List<String>) machine.get("pointNos"); |
| | | pointNos.addAll(list); |
| | | } |
| | | Map<String, Object> pointValues = dataPointApi.queryPointsRealValue(pointNos); |
| | | List<Map<String, Object>> results = new ArrayList<>(); |
| | | for (Map<String, Object> machine : machines) { |
| | | List<String> pointNoList = (List<String>) machine.get("pointNos"); |
| | | if (!pointValues.containsKey(pointNoList.get(0)) || !pointValues.containsKey(pointNoList.get(1))) { |
| | | machine.put("status",false); |
| | | machine.put("num",0); |
| | | results.add(machine); |
| | | continue; |
| | | } |
| | | Double PValue = Double.valueOf(pointValues.get(pointNoList.get(0)).toString()); |
| | | Double QValue = Double.valueOf(pointValues.get(pointNoList.get(1)).toString()); |
| | | Double cos = calculateCos(PValue, QValue); |
| | | if (cos.equals(0.0)) { |
| | | machine.put("status",false); |
| | | machine.put("num",0); |
| | | }else { |
| | | machine.put("status",true); |
| | | machine.put("num",cos); |
| | | } |
| | | results.add(machine); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, List<Object[]>> getPredictDataItemNo(PreDataItemNoReqVO reqVO) { |
| | | if (StringUtils.isBlank(reqVO.getItemNo()) || null == reqVO.getStartTime() || null == reqVO.getEndTime()) { |
| | | if (StringUtils.isBlank(reqVO.getItemNo())) { |
| | | return new HashMap<>(); |
| | | } |
| | | ItemVO predictItem = mmPredictItemService.getItemByItemNo(reqVO.getItemNo()); |
| | | if (null == predictItem) { |
| | | return new HashMap<>(); |
| | | } |
| | | |
| | | // 默认开始时间:运行时间 |
| | | if (null == reqVO.getStartTime()) { |
| | | reqVO.setStartTime(predictItem.getLastTime()); |
| | | } |
| | | // 默认结束时间:运行时间+预测长度*粒度 |
| | | if (null == reqVO.getEndTime()) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictItem.getLastTime()); |
| | | calendar.add(Calendar.SECOND,predictItem.getPredictLength() * predictItem.getGranularity()); |
| | | reqVO.setEndTime(calendar.getTime()); |
| | | } |
| | | |
| | | List<String> itemNos = new ArrayList<String>(){{ |
| | | add(reqVO.getItemNo()); |
| | | }}; |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<ElectricityPriceSegmentedDTO> getElectricityPriceList(String year, String time) { |
| | | return electricityPriceSegmentedService.getElectricityPriceList(year, time); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean createElectricityPrice(List<ElectricityPriceSegmentedDTO> list) { |
| | | electricityPriceSegmentedService.deleteByITimeId(list.get(0).getITimeId()); |
| | | list.forEach(dto -> electricityPriceSegmentedService.create(dto)); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 计算功率因数 p²/(根号:p²+Q²) |
| | | **/ |
| | |
| | | return CommonResult.success(data); |
| | | } |
| | | |
| | | @GetMapping("/predict-data/electric") |
| | | @Operation(summary = "电力功率因数预测结果查询") |
| | | public CommonResult<Map<String,List<Object[]>>> getElectricPredictData(@RequestParam String itemCode) { |
| | | Map<String,List<Object[]>> data = mcsApi.getElectricPredictData(itemCode); |
| | | return CommonResult.success(data); |
| | | } |
| | | @GetMapping("/schedule-data/last") |
| | | @Operation(summary = "调度模型最新结果查询") |
| | | public CommonResult<List<StScheduleRecordVO>> getLastScheduleData(@RequestParam String scheduleCode, @RequestParam Integer limit) { |
| | |
| | | return CommonResult.success(result); |
| | | } |
| | | |
| | | @PostMapping("/machineRealTimeStatus") |
| | | @Operation(summary = "发电机组实时状态查询") |
| | | CommonResult<List<Map<String, Object>>> getRealTimeStatus(@RequestBody List<Map<String, Object>> machines) { |
| | | return CommonResult.success(mcsApi.getRealTimeStatus(machines)); |
| | | } |
| | | |
| | | @PostMapping("/predict-data/itemNo") |
| | | @Operation(summary = "查询时间范围内预测结果") |
| | | CommonResult<Map<String,List<Object[]>>> getPredictDataItemNo(@RequestBody PreDataItemNoReqVO reqVO) { |
| | | return CommonResult.success(mcsApi.getPredictDataItemNo(reqVO)); |
| | | } |
| | | |
| | | @GetMapping("/electricityPrice/list") |
| | | @Operation(summary = "电价表") |
| | | public CommonResult<List<ElectricityPriceSegmentedDTO>> getElectricityPriceList(@RequestParam("year") String year, @RequestParam("time") String time) { |
| | | List<ElectricityPriceSegmentedDTO> electricityPriceSegmentedList = mcsApi.getElectricityPriceList(year, time); |
| | | return CommonResult.success(electricityPriceSegmentedList); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.dao; |
| | | |
| | | import com.iailab.framework.common.dao.BaseDao; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.model.mpk.entity.ElectricityPriceSegmentedEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @description: |
| | | * @author: dzd |
| | | * @date: 2024/11/5 11:19 |
| | | **/ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ElectricityPriceSegmentedDao extends BaseDao<ElectricityPriceSegmentedEntity> { |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author Jay |
| | | * @description: 电价分段数据 |
| | | **/ |
| | | @Data |
| | | public class ElectricityPriceSegmentedDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | private String id; |
| | | |
| | | private String iTimeId; |
| | | |
| | | private String recId; |
| | | |
| | | /** |
| | | * 能介编号 |
| | | */ |
| | | private String mediaId; |
| | | |
| | | private String refMediaId; |
| | | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * 年份 |
| | | */ |
| | | private String year; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author Jay |
| | | * @description: 电价分段数据 |
| | | **/ |
| | | @Data |
| | | @TableName("t_electricity_price_segmented") |
| | | public class ElectricityPriceSegmentedEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId |
| | | private String id; |
| | | |
| | | private String iTimeId; |
| | | |
| | | private String recId; |
| | | |
| | | /** |
| | | * 能介编号 |
| | | */ |
| | | private String mediaId; |
| | | |
| | | private String refMediaId; |
| | | |
| | | /** |
| | | * 年份 |
| | | */ |
| | | private String year; |
| | | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.service; |
| | | |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.module.model.api.mcs.dto.ElectricityPriceSegmentedDTO; |
| | | import com.iailab.module.model.mpk.entity.ElectricityPriceSegmentedEntity; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @description: |
| | | * @author: dzd |
| | | * @date: 2024/11/5 11:20 |
| | | **/ |
| | | public interface ElectricityPriceSegmentedService { |
| | | |
| | | PageData<ElectricityPriceSegmentedDTO> page(Map<String, Object> params); |
| | | |
| | | void create(ElectricityPriceSegmentedDTO entity); |
| | | |
| | | void update(ElectricityPriceSegmentedEntity entity); |
| | | |
| | | ElectricityPriceSegmentedEntity get(String id); |
| | | |
| | | void delete(String id); |
| | | |
| | | void deleteByITimeId(String iTimeId); |
| | | |
| | | List<ElectricityPriceSegmentedDTO> getElectricityPriceList(String year, String time); |
| | | |
| | | List<ElectricityPriceSegmentedDTO> getElectricityPriceListByTime(ElectricityPriceSegmentedDTO dto); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.service.impl; |
| | | |
| | | import com.alibaba.nacos.common.utils.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.model.api.mcs.dto.ElectricityPriceSegmentedDTO; |
| | | import com.iailab.module.model.mpk.dao.ElectricityPriceSegmentedDao; |
| | | import com.iailab.module.model.mpk.entity.ElectricityPriceSegmentedEntity; |
| | | import com.iailab.module.model.mpk.service.ElectricityPriceSegmentedService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @description: |
| | | * @author: dzd |
| | | * @date: 2024/11/5 11:21 |
| | | **/ |
| | | @Slf4j |
| | | @Service |
| | | public class ElectricityPriceSegmentedServiceImpl extends BaseServiceImpl<ElectricityPriceSegmentedDao, ElectricityPriceSegmentedEntity> implements ElectricityPriceSegmentedService { |
| | | |
| | | @Override |
| | | public PageData<ElectricityPriceSegmentedDTO> page(Map<String, Object> params) { |
| | | IPage<ElectricityPriceSegmentedEntity> page = baseDao.selectPage( |
| | | getPage(params, "create_time", false), |
| | | getWrapper(params) |
| | | ); |
| | | |
| | | return getPageData(page, ElectricityPriceSegmentedDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public void create(ElectricityPriceSegmentedDTO dto) { |
| | | ElectricityPriceSegmentedEntity entity = ConvertUtils.sourceToTarget(dto, ElectricityPriceSegmentedEntity.class); |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | entity.setCreateTime(new Date()); |
| | | baseDao.insert(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(ElectricityPriceSegmentedEntity dto) { |
| | | ElectricityPriceSegmentedEntity entity = ConvertUtils.sourceToTarget(dto, ElectricityPriceSegmentedEntity.class); |
| | | entity.setUpdateTime(new Date()); |
| | | baseDao.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public ElectricityPriceSegmentedEntity get(String id) { |
| | | return baseDao.selectById(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | baseDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByITimeId(String iTimeId) { |
| | | QueryWrapper<ElectricityPriceSegmentedEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq(StringUtils.isNotBlank(iTimeId), "i_time_id", iTimeId); |
| | | baseDao.delete(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<ElectricityPriceSegmentedDTO> getElectricityPriceList(String year, String time) { |
| | | List<ElectricityPriceSegmentedDTO> result = new ArrayList<>(); |
| | | QueryWrapper<ElectricityPriceSegmentedEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq(StringUtils.isNotBlank(year), "year", year) |
| | | .orderByDesc( "create_time"); |
| | | List<ElectricityPriceSegmentedEntity> list = baseDao.selectList(wrapper); |
| | | if(CollectionUtils.isNotEmpty(list)){ |
| | | String itimeId = list.get(0).getITimeId(); |
| | | QueryWrapper<ElectricityPriceSegmentedEntity> wrapper1 = new QueryWrapper<>(); |
| | | wrapper1.eq(StringUtils.isNotBlank(itimeId), "i_time_id", itimeId) |
| | | .apply(StringUtils.isNotBlank(time),"TIME(start_time) <= TIME({0})", time) |
| | | .apply(StringUtils.isNotBlank(time),"TIME(end_time) > TIME({0})", time) |
| | | .orderByDesc( "create_time"); |
| | | result = ConvertUtils.sourceToTarget(baseDao.selectList(wrapper1), ElectricityPriceSegmentedDTO.class); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<ElectricityPriceSegmentedDTO> getElectricityPriceListByTime(ElectricityPriceSegmentedDTO dto) { |
| | | String startTime = DateUtils.format(dto.getStartTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | String endTime = DateUtils.format(dto.getEndTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("startTime", startTime); |
| | | params.put("endTime", endTime); |
| | | List<ElectricityPriceSegmentedEntity> list = baseDao.selectList(getWrapper(params)); |
| | | return ConvertUtils.sourceToTarget(list, ElectricityPriceSegmentedDTO.class); |
| | | } |
| | | |
| | | private QueryWrapper<ElectricityPriceSegmentedEntity> getWrapper(Map<String, Object> params) { |
| | | String startTime = (String) params.get("startTime"); |
| | | String endTime = (String) params.get("endTime"); |
| | | |
| | | QueryWrapper<ElectricityPriceSegmentedEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq(StringUtils.isNotBlank(startTime), "start_time", startTime) |
| | | .eq(StringUtils.isNotBlank(endTime), "end_time", endTime); |
| | | return wrapper; |
| | | } |
| | | } |
| | |
| | | - t_chart |
| | | - t_mpk_pack |
| | | - t_mm_item_status |
| | | - t_electricity_price_segmented |
| | | app: |
| | | app-key: model |
| | | app-secret: 85b0df7edc3df3611913df34ed695011 |
| | |
| | | <select id="getLastScheduleResult" resultType="com.iailab.module.model.api.mdk.dto.StScheduleRecordVO"> |
| | | SELECT t2.* FROM t_st_schedule_scheme t1 LEFT JOIN t_st_schedule_record t2 on t1.id = t2.scheme_id |
| | | WHERE t1.`code` = #{scheduleCode} AND result_code = "100" |
| | | ORDER BY t2.schedule_time desc |
| | | ORDER BY t2.schedule_time desc,create_time desc |
| | | LIMIT #{limit} |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="params.obj != null and params.obj != ''"> |
| | | and t.obj = #{params.obj} |
| | | </if> |
| | | <if test="params.type != null and params.type != ''"> |
| | | and t.type = #{params.type} |
| | | </if> |
| | | <if test="params.startTime != null"> |
| | | and t.time >= #{params.startTime} |
| | | </if> |
| | | <if test="params.endTime != null"> |
| | | and t.time <= #{params.endTime} |
| | | </if> |
| | | <if test="params.objList != null"> |
| | | and t.obj in |
| | | <foreach collection="params.objList" item="item" open="(" close=")" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | order by t.time desc |
| | | |
| | |
| | | <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Job 定时任务相关 --> |
| | | <dependency> |
| | | <groupId>com.iailab</groupId> |
| | | <artifactId>iailab-common-job</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 消息队列相关 --> |
| | | <dependency> |
| | | <groupId>com.iailab</groupId> |
| | |
| | | kafka: |
| | | bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔 |
| | | |
| | | --- #################### 定时任务相关配置 #################### |
| | | xxl: |
| | | job: |
| | | admin: |
| | | addresses: http://172.16.8.100:9090/xxl-job-admin # 调度中心部署跟地址 |
| | | |
| | | --- #################### 服务保障相关配置 #################### |
| | | |
| | | # Lock4j 配置项 |
| | |
| | | base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator |
| | | exposure: |
| | | include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 |
| | | |
| | | # Spring Boot Admin 配置项 |
| | | spring: |
| | | boot: |
| | | admin: |
| | | # Spring Boot Admin Client 客户端的相关配置 |
| | | client: |
| | | instance: |
| | | service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME] |
| | | # Spring Boot Admin Server 服务端的相关配置 |
| | | context-path: /admin # 配置 Spring |
| | | |
| | | --- #################### 微信公众号、小程序相关配置 #################### |
| | | wx: |
| | | mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档 |
| | | # app-id: wx041349c6f39b268b |
| | | # secret: 5abee519483bc9f8cb37ce280e814bd0 |
| | | app-id: wx5b23ba7a5589ecbb # 测试号 |
| | | secret: 2a7b3b20c537e52e74afd395eb85f61f |
| | | # 存储配置,解决 AccessToken 的跨节点的共享 |
| | | config-storage: |
| | | type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取 |
| | | key-prefix: wx # Redis Key 的前缀 |
| | | http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台 |
| | | miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档 |
| | | # appid: wx62056c0d5e8db250 |
| | | # secret: 333ae72f41552af1e998fe1f54e1584a |
| | | appid: wx63c280fe3248a3e7 # wenhualian的接口测试号 |
| | | secret: 6f270509224a7ae1296bbf1c8cb97aed |
| | | config-storage: |
| | | type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取 |
| | | key-prefix: wa # Redis Key 的前缀 |
| | | http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台 |
| | | |
| | | --- #################### 平台相关配置 #################### |
| | | |
| | |
| | | demo: false # 开启演示模式 |
| | | captcha: |
| | | enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试 |
| | | |
| | | justauth: |
| | | enabled: true |
| | | type: |
| | | DINGTALK: # 钉钉 |
| | | client-id: dingvrnreaje3yqvzhxg |
| | | client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI |
| | | ignore-check-redirect-uri: true |
| | | WECHAT_ENTERPRISE: # 企业微信 |
| | | client-id: wwd411c69a39ad2e54 |
| | | client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw |
| | | agent-id: 1000004 |
| | | ignore-check-redirect-uri: true |
| | | # noinspection SpringBootApplicationYaml |
| | | WECHAT_MINI_APP: # 微信小程序 |
| | | client-id: ${wx.miniapp.appid} |
| | | client-secret: ${wx.miniapp.secret} |
| | | ignore-check-redirect-uri: true |
| | | ignore-check-state: true # 微信小程序,不会使用到 state,所以不进行校验 |
| | | WECHAT_MP: # 微信公众号 |
| | | client-id: ${wx.mp.app-id} |
| | | client-secret: ${wx.mp.secret} |
| | | ignore-check-redirect-uri: true |
| | | cache: |
| | | type: REDIS |
| | | prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: |
| | | timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 |
| | |
| | | listener: |
| | | missing-topics-fatal: false # 消费监听接口监听的主题不存在时,默认会报错。所以通过设置为 false ,解决报错 |
| | | |
| | | --- #################### 定时任务相关配置 #################### |
| | | |
| | | xxl: |
| | | job: |
| | | executor: |
| | | appname: ${spring.application.name} # 执行器 AppName |
| | | logpath: @log.path@/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径 |
| | | accessToken: default_token # 执行器通讯TOKEN |
| | | |
| | | --- #################### 验证码相关配置 #################### |
| | | |
| | | aj: |