Commit bddbfd40 authored by wujiang's avatar wujiang

添加逆变器接口

parent 3b1ce52c
package com.yeejoin.amos.boot.module.hygf.api.util;
import java.util.Calendar;
import java.util.Date;
public class TimeUtil {
public static long getStartTimeOfDay(Date day) {
Calendar todayStart = Calendar.getInstance();
todayStart.setTime(day);
todayStart.set(Calendar.HOUR_OF_DAY, 0);
todayStart.set(Calendar.MINUTE, 0);
todayStart.set(Calendar.SECOND, 0);
todayStart.set(Calendar.MILLISECOND, 0);
return todayStart.getTime().getTime();
}
public static long getEndTimeOfDay(Date day) {
Calendar todayEnd = Calendar.getInstance();
todayEnd.set(Calendar.HOUR_OF_DAY, 23);
todayEnd.set(Calendar.MINUTE, 59);
todayEnd.set(Calendar.SECOND, 59);
todayEnd.set(Calendar.MILLISECOND, 999);
return todayEnd.getTime().getTime();
}
}
...@@ -24,6 +24,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -24,6 +24,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpCollectorHistoryDto; import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpCollectorHistoryDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpCollectorHistory;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpCollectorHistoryServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpCollectorHistoryServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -66,7 +67,8 @@ public class TdHygfJpCollectorHistoryController extends BaseController { ...@@ -66,7 +67,8 @@ public class TdHygfJpCollectorHistoryController extends BaseController {
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘采集器历史表", notes = "根据sequenceNbr更新户用光伏监盘采集器历史表") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘采集器历史表", notes = "根据sequenceNbr更新户用光伏监盘采集器历史表")
public ResponseModel<TdHygfJpCollectorHistoryDto> updateBySequenceNbrTdHygfJpCollectorHistory(@RequestBody TdHygfJpCollectorHistoryDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<TdHygfJpCollectorHistoryDto> updateBySequenceNbrTdHygfJpCollectorHistory(
@RequestBody TdHygfJpCollectorHistoryDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(tdHygfJpCollectorHistoryServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(tdHygfJpCollectorHistoryServiceImpl.updateWithModel(model));
} }
...@@ -125,8 +127,8 @@ public class TdHygfJpCollectorHistoryController extends BaseController { ...@@ -125,8 +127,8 @@ public class TdHygfJpCollectorHistoryController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘采集器历史表列表全部数据查询", notes = "户用光伏监盘采集器历史表列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "户用光伏监盘采集器历史表列表全部数据查询", notes = "户用光伏监盘采集器历史表列表全部数据查询")
@GetMapping(value = "/list/day") @GetMapping(value = "/list/day")
public ResponseModel<List<TdHygfJpCollectorHistoryDto>> dayList(@RequestParam(value = "id") long id, public ResponseModel<List<TdHygfJpCollectorHistory>> dayList(@RequestParam(value = "id") long id,
@RequestParam(value = "day") @DateTimeFormat() Date day) { @RequestParam(value = "day") @DateTimeFormat() Date day) {
return ResponseHelper.buildResponse(tdHygfJpCollectorHistoryServiceImpl.dayList(id,day)); return ResponseHelper.buildResponse(tdHygfJpCollectorHistoryServiceImpl.dayList(id, day));
} }
} }
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.RequestParam;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHistoryServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInvertorElecHistoryDto; import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInvertorElecHistoryDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInvertorElecHistory;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHistoryServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* 户用光伏监盘逆变器电能历史表 * 户用光伏监盘逆变器电能历史表
...@@ -54,7 +67,8 @@ public class TdHygfJpInvertorElecHistoryController extends BaseController { ...@@ -54,7 +67,8 @@ public class TdHygfJpInvertorElecHistoryController extends BaseController {
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘逆变器电能历史表", notes = "根据sequenceNbr更新户用光伏监盘逆变器电能历史表") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘逆变器电能历史表", notes = "根据sequenceNbr更新户用光伏监盘逆变器电能历史表")
public ResponseModel<TdHygfJpInvertorElecHistoryDto> updateBySequenceNbrTdHygfJpInvertorElecHistory(@RequestBody TdHygfJpInvertorElecHistoryDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<TdHygfJpInvertorElecHistoryDto> updateBySequenceNbrTdHygfJpInvertorElecHistory(
@RequestBody TdHygfJpInvertorElecHistoryDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(tdHygfJpInvertorElecHistoryServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(tdHygfJpInvertorElecHistoryServiceImpl.updateWithModel(model));
} }
...@@ -112,10 +126,9 @@ public class TdHygfJpInvertorElecHistoryController extends BaseController { ...@@ -112,10 +126,9 @@ public class TdHygfJpInvertorElecHistoryController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器电能历史表列表全部数据查询", notes = "户用光伏监盘逆变器电能历史表列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器电能历史表列表全部数据查询", notes = "户用光伏监盘逆变器电能历史表列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list/day")
public ResponseModel<List<TdHygfJpInvertorElecHistoryDto>> selectForList( public ResponseModel<List<TdHygfJpInvertorElecHistory>> dayList(@RequestParam(value = "id") long id,
@RequestParam(value = "type") String type) { @RequestParam(value = "day") @DateTimeFormat() Date day) {
return ResponseHelper return ResponseHelper.buildResponse(tdHygfJpInvertorElecHistoryServiceImpl.dayList(id, day));
.buildResponse(tdHygfJpInvertorElecHistoryServiceImpl.queryForTdHygfJpInvertorElecHistoryList());
} }
} }
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpCollectorHistoryDto; import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpCollectorHistoryDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpCollectorHistory; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpCollectorHistory;
import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpCollectorHistoryService; import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpCollectorHistoryService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpCollectorHistoryMapper; import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpCollectorHistoryMapper;
import com.yeejoin.amos.boot.module.hygf.api.util.TimeUtil;
/** /**
* 户用光伏监盘采集器历史表服务实现类 * 户用光伏监盘采集器历史表服务实现类
...@@ -25,6 +27,10 @@ import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpCollectorHis ...@@ -25,6 +27,10 @@ import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpCollectorHis
public class TdHygfJpCollectorHistoryServiceImpl public class TdHygfJpCollectorHistoryServiceImpl
extends BaseService<TdHygfJpCollectorHistoryDto, TdHygfJpCollectorHistory, TdHygfJpCollectorHistoryMapper> extends BaseService<TdHygfJpCollectorHistoryDto, TdHygfJpCollectorHistory, TdHygfJpCollectorHistoryMapper>
implements ITdHygfJpCollectorHistoryService { implements ITdHygfJpCollectorHistoryService {
@Autowired
private JpCollectorServiceImpl jpCollectorServiceImpl;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -36,9 +42,16 @@ public class TdHygfJpCollectorHistoryServiceImpl ...@@ -36,9 +42,16 @@ public class TdHygfJpCollectorHistoryServiceImpl
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<TdHygfJpCollectorHistoryDto> dayList(long id, Date day) { public List<TdHygfJpCollectorHistory> dayList(long id, Date day) {
LambdaQueryWrapper<TdHygfJpCollectorHistory> warpper = new LambdaQueryWrapper<>(); JpCollector collector = jpCollectorServiceImpl.getById(id);
warpper.between(TdHygfJpCollectorHistory::getTime, day, warpper); if (collector != null) {
return this.queryForList("", false); LambdaQueryChainWrapper<TdHygfJpCollectorHistory> warpper = this.lambdaQuery()
.between(TdHygfJpCollectorHistory::getTime, TimeUtil.getStartTimeOfDay(day),
TimeUtil.getEndTimeOfDay(day))
.eq(TdHygfJpCollectorHistory::getSnCode, collector.getSnCode())
.eq(TdHygfJpCollectorHistory::getThirdStationId, collector.getThirdStationId());
return this.baseMapper.selectList(warpper);
}
return new ArrayList<>();
} }
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInvertorElecHistory; import java.util.ArrayList;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInvertorElecHistoryMapper; import java.util.Date;
import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpInvertorElecHistoryService; import java.util.List;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInvertorElecHistoryDto;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInvertorElecHistoryDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpCollectorHistory;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInvertorElecHistory;
import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpInvertorElecHistoryService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInvertorElecHistoryMapper;
import com.yeejoin.amos.boot.module.hygf.api.util.TimeUtil;
/** /**
* 户用光伏监盘逆变器电能历史表服务实现类 * 户用光伏监盘逆变器电能历史表服务实现类
...@@ -16,18 +25,34 @@ import java.util.List; ...@@ -16,18 +25,34 @@ import java.util.List;
* @date 2023-09-19 * @date 2023-09-19
*/ */
@Service @Service
public class TdHygfJpInvertorElecHistoryServiceImpl extends BaseService<TdHygfJpInvertorElecHistoryDto,TdHygfJpInvertorElecHistory,TdHygfJpInvertorElecHistoryMapper> implements ITdHygfJpInvertorElecHistoryService { public class TdHygfJpInvertorElecHistoryServiceImpl extends
BaseService<TdHygfJpInvertorElecHistoryDto, TdHygfJpInvertorElecHistory, TdHygfJpInvertorElecHistoryMapper>
implements ITdHygfJpInvertorElecHistoryService {
@Autowired
private JpInverterServiceImpl jpInvertorServiceImpl;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<TdHygfJpInvertorElecHistoryDto> queryForTdHygfJpInvertorElecHistoryPage(Page<TdHygfJpInvertorElecHistoryDto> page) { public Page<TdHygfJpInvertorElecHistoryDto> queryForTdHygfJpInvertorElecHistoryPage(
Page<TdHygfJpInvertorElecHistoryDto> page) {
return this.queryForPage(page, null, false); return this.queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<TdHygfJpInvertorElecHistoryDto> queryForTdHygfJpInvertorElecHistoryList() { public List<TdHygfJpInvertorElecHistory> dayList(long id, Date day) {
return this.queryForList("" , false); JpInverter invertor = jpInvertorServiceImpl.getById(id);
if (invertor != null) {
LambdaQueryChainWrapper<TdHygfJpInvertorElecHistory> warpper = this.lambdaQuery()
.between(TdHygfJpInvertorElecHistory::getTime, TimeUtil.getStartTimeOfDay(day),
TimeUtil.getEndTimeOfDay(day))
.eq(TdHygfJpInvertorElecHistory::getSnCode, invertor.getSnCode())
.eq(TdHygfJpInvertorElecHistory::getThirdStationId, invertor.getThirdStationId());
return this.baseMapper.selectList(warpper);
}
return new ArrayList<>();
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment