yang_shj
1 year ago
14 changed files with 334 additions and 4 deletions
@ -0,0 +1,64 @@
|
||||
package com.hnac.hzims.operational.fill.entity; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.tenant.mp.TenantEntity; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@TableName("hzims_fill_wind") |
||||
@ApiModel(value="WindEntity", description="风电填报数据对象") |
||||
public class WindEntity extends TenantEntity implements Serializable { |
||||
|
||||
@ApiModelProperty("站点编号") |
||||
private String stationCode; |
||||
|
||||
@ApiModelProperty("站点名称") |
||||
private String stationName; |
||||
|
||||
@ApiModelProperty("填报日期") |
||||
private String fillDate; |
||||
|
||||
@ApiModelProperty("计划发电量") |
||||
private Double plan; |
||||
|
||||
@ApiModelProperty("发电量") |
||||
private Double power; |
||||
|
||||
@ApiModelProperty("平均风速: m/s") |
||||
private Double speed; |
||||
|
||||
@ApiModelProperty("上网电量") |
||||
private Double surfPower; |
||||
|
||||
@ApiModelProperty("下网电量") |
||||
private Double belowPower; |
||||
|
||||
@ApiModelProperty("可用时长") |
||||
private Double available; |
||||
|
||||
@ApiModelProperty("综合用电量") |
||||
private Double comprehensivePower; |
||||
|
||||
@ApiModelProperty("峰值功率") |
||||
private Double peakPower; |
||||
|
||||
@ApiModelProperty("故障时长: 单位-小时") |
||||
private Double faultHours; |
||||
|
||||
@ApiModelProperty("短期预测准确率") |
||||
private Double accuracy; |
||||
|
||||
@ApiModelProperty("超短准确率") |
||||
private Double ultraShortAccuracy; |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.hnac.hzims.operational.fill.vo; |
||||
|
||||
import com.hnac.hzims.operational.fill.entity.GenerateEntity; |
||||
import com.hnac.hzims.operational.fill.entity.WindEntity; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Data |
||||
public class WindVo extends WindEntity { |
||||
|
||||
@ApiModelProperty("用户名称") |
||||
private String userName; |
||||
|
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.hnac.hzims.operational.fill.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; |
||||
import com.hnac.hzims.common.logs.enums.BusinessType; |
||||
import com.hnac.hzims.common.logs.enums.OperatorType; |
||||
import com.hnac.hzims.operational.fill.entity.WindEntity; |
||||
import com.hnac.hzims.operational.fill.service.WindService; |
||||
import com.hnac.hzims.operational.fill.vo.QueryVo; |
||||
import com.hnac.hzims.operational.fill.vo.WindVo; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.log.annotation.ApiLog; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/wind") |
||||
@Api(value = "风电填报", tags = "风电填报") |
||||
public class WindController extends BladeController { |
||||
|
||||
private final WindService service; |
||||
|
||||
/** |
||||
* 新增 |
||||
*/ |
||||
@PostMapping("/saveOrUpdate") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "新增", notes = "传入WindEntity对象") |
||||
public R saveOrUpdate(@RequestBody WindEntity entity) { |
||||
return R.status(service.saveUpdate(entity)); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@PostMapping("/remove") |
||||
@ApiOperationSupport(order = 2) |
||||
@ApiOperation(value = "逻辑删除", notes = "传入id字符串以逗号分隔") |
||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
||||
return R.status(service.deleteLogic(Func.toLongList(ids))); |
||||
} |
||||
|
||||
/** |
||||
* 分页 |
||||
*/ |
||||
@ApiLog |
||||
@GetMapping("/list") |
||||
@ApiOperationSupport(order = 4) |
||||
@OperationAnnotation(moduleName = "数据填报", |
||||
title = "风电填报数据查询",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, |
||||
action = "分页") |
||||
@ApiOperation(value = "分页", notes = "查询条件::startTime,endTime,stationCode") |
||||
public R<IPage<WindVo>> list(QueryVo filter, Query query) { |
||||
return service.pageCondition(filter, query); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.hnac.hzims.operational.fill.mapper; |
||||
|
||||
import com.hnac.hzims.operational.fill.entity.GenerateEntity; |
||||
import com.hnac.hzims.operational.fill.entity.WindEntity; |
||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface WindMapper extends UserDataScopeBaseMapper<WindEntity> { |
||||
|
||||
} |
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.hnac.hzims.operational.fill.mapper.WindMapper"> |
||||
|
||||
|
||||
</mapper> |
@ -0,0 +1,23 @@
|
||||
package com.hnac.hzims.operational.fill.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzims.operational.fill.entity.GenerateEntity; |
||||
import com.hnac.hzims.operational.fill.entity.WindEntity; |
||||
import com.hnac.hzims.operational.fill.vo.GenerateVo; |
||||
import com.hnac.hzims.operational.fill.vo.QueryVo; |
||||
import com.hnac.hzims.operational.fill.vo.WindVo; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface WindService extends BaseService<WindEntity> { |
||||
|
||||
// 分页查询发电量填报数据
|
||||
R<IPage<WindVo>> pageCondition(QueryVo filter, Query query); |
||||
|
||||
// 新增/修改发电量填报数据
|
||||
boolean saveUpdate(WindEntity entity); |
||||
} |
@ -0,0 +1,93 @@
|
||||
package com.hnac.hzims.operational.fill.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.hnac.hzims.operational.fill.entity.GenerateEntity; |
||||
import com.hnac.hzims.operational.fill.entity.WindEntity; |
||||
import com.hnac.hzims.operational.fill.mapper.GenerateMapper; |
||||
import com.hnac.hzims.operational.fill.mapper.WindMapper; |
||||
import com.hnac.hzims.operational.fill.service.GenerateService; |
||||
import com.hnac.hzims.operational.fill.service.WindService; |
||||
import com.hnac.hzims.operational.fill.vo.GenerateVo; |
||||
import com.hnac.hzims.operational.fill.vo.QueryVo; |
||||
import com.hnac.hzims.operational.fill.vo.WindVo; |
||||
import com.hnac.hzims.operational.fill.wrapper.GenerateWrapper; |
||||
import com.hnac.hzims.operational.main.vo.GenerationPowerVo; |
||||
import com.hnac.hzims.operational.main.vo.PowerMonthVo; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.log.exception.ServiceException; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.core.tool.utils.DateUtil; |
||||
import org.springblade.core.tool.utils.ObjectUtil; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Calendar; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @author ysj |
||||
* @date 2023/04/10 11:16:07 |
||||
* @version 4.0.0 |
||||
*/ |
||||
@Slf4j |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class WindServiceImpl extends BaseServiceImpl<WindMapper, WindEntity> implements WindService { |
||||
|
||||
/** |
||||
* 分页查询风电填报数据 |
||||
* @param filter |
||||
* @param query |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public R<IPage<WindVo>> pageCondition(QueryVo filter, Query query) { |
||||
QueryWrapper<WindEntity> queryWrapper = new QueryWrapper<WindEntity>() {{ |
||||
if(!StringUtil.isEmpty(filter.getStationCode())){ |
||||
eq("STATION_CODE",filter.getStationCode()); |
||||
} |
||||
if(!ObjectUtil.isEmpty(filter.getDate())){ |
||||
likeRight("FILL_DATE",filter.getDate()); |
||||
} |
||||
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){ |
||||
eq("DATA_ORIGIN",filter.getDataOrigin()); |
||||
} |
||||
orderByDesc("create_time"); |
||||
}}; |
||||
IPage pages = super.page(Condition.getPage(query), queryWrapper); |
||||
List list = GenerateWrapper.build().listVO(pages.getRecords()); |
||||
return R.data(pages.setRecords(list)); |
||||
} |
||||
|
||||
/** |
||||
* 新增/修改发电量填报数据 |
||||
* @param entity |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public boolean saveUpdate(WindEntity entity) { |
||||
// 查询是否存在历史记录
|
||||
WindEntity query = this.getOne(new LambdaQueryWrapper<WindEntity>(){{ |
||||
eq(WindEntity::getStationCode, entity.getStationCode()); |
||||
eq(WindEntity::getFillDate,entity.getFillDate()); |
||||
}}); |
||||
if(ObjectUtil.isNotEmpty(query) && (ObjectUtil.isEmpty(entity.getId()) || !entity.getId().equals(query.getId()))){ |
||||
throw new ServiceException("日期已经存在填报数据!"); |
||||
} |
||||
if(ObjectUtil.isEmpty(query)){ |
||||
return this.save(entity); |
||||
} |
||||
return this.updateById(entity); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.hnac.hzims.operational.fill.wrapper; |
||||
|
||||
import com.hnac.hzims.operational.fill.entity.WindEntity; |
||||
import com.hnac.hzims.operational.fill.vo.WindVo; |
||||
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||
import org.springblade.core.tool.utils.BeanUtil; |
||||
import org.springblade.core.tool.utils.ObjectUtil; |
||||
import org.springblade.system.user.cache.UserCache; |
||||
import org.springblade.system.user.entity.User; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public class WindWrapper extends BaseEntityWrapper<WindEntity, WindVo> { |
||||
|
||||
public static WindWrapper build() { |
||||
return new WindWrapper(); |
||||
} |
||||
|
||||
@Override |
||||
public WindVo entityVO(WindEntity entity) { |
||||
WindVo vo = BeanUtil.copy(entity, WindVo.class); |
||||
User createUser = UserCache.getUser(entity.getCreateUser()); |
||||
if(ObjectUtil.isEmpty(createUser)){ |
||||
return vo; |
||||
} |
||||
assert vo != null; |
||||
vo.setUserName(createUser.getName()); |
||||
return vo; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue