Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
39dc80e072
  1. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/DeviceVo.java
  2. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java
  3. 64
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java
  4. 18
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/WindVo.java
  5. 1
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  6. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/EquipmentStateCountVo.java
  7. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WaterLevelVo.java
  8. 64
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindScoreVo.java
  9. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ReportServiceImpl.java
  10. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java
  11. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  12. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java
  13. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  14. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java
  15. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/SolveController.java
  16. 69
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/WindController.java
  17. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.java
  18. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.xml
  19. 23
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/WindService.java
  20. 93
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java
  21. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/WindWrapper.java
  22. 37
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WindHomeController.java
  23. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/WindHomeService.java
  24. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  25. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  26. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  27. 21
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java
  28. 28
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java
  29. 42
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/TicketCount.java
  30. 153
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/handler/TicketCountSheetWriteHandler.java
  31. 20
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java
  32. 232
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java
  33. 157
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/ticket/TicketCountResponseVo.java
  34. 16
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/ticket/TicketCountVo.java
  35. 7
      hzims-service/ticket/src/main/resources/db/2.0.0.sql

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/DeviceVo.java

@ -36,4 +36,7 @@ public class DeviceVo {
@ApiModelProperty(value = "建议有功调整")
private Double adjust;
@ApiModelProperty(value = "排序")
private Integer ord;
}

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java

@ -1,6 +1,5 @@
package com.hnac.hzims.operational.ecology.vo;
import com.hnac.hzims.operational.main.vo.WaterLevelVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -25,6 +24,9 @@ public class StationVo {
@ApiModelProperty(value = "水位")
private Double damWater;
@ApiModelProperty(value = "下泄流量")
private Double dischargeFlow;
@ApiModelProperty(value = "设备集合")
private List<DeviceVo> devices;

64
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java

@ -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;
}

18
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/WindVo.java

@ -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;
}

1
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java

@ -162,6 +162,7 @@ public interface HomePageConstant {
// 水利-站点实时属性名称
String FRONT_WATER_LEVEL = "front_water_level"; // 前水位
String REAR_WATER_LEVEL = "rear_water_level"; // 后水位
String DISCHARGE_FLOW = "discharge_flow"; // 下泄流量
// 水电站实时属性名称
String HYDROPOWER_GENERATE_POWER = "generation_capacity"; // 发电量

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/EquipmentStateCountVo.java

@ -6,6 +6,9 @@ import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "站点设备统计对象")
public class EquipmentStateCountVo {
@ -34,6 +37,9 @@ public class EquipmentStateCountVo {
@ApiModelProperty(value = "备用数量")
private Long backupCount;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "设备")
private List<DeviceVo> deviceVoList;
}

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WaterLevelVo.java

@ -19,6 +19,9 @@ public class WaterLevelVo {
@ApiModelProperty(value = "闸后水位")
private Double rearWaterLevel;
@ApiModelProperty(value = "下泄流量")
private Double dischargeFlow;
@ApiModelProperty(value = "前水位曲线数据")
private Map<Integer,String> frontCurveMap;

64
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindScoreVo.java

@ -0,0 +1,64 @@
package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "水电站分计对象")
public class WindScoreVo {
@ApiModelProperty(value = "机构Id")
private Long departId;
@ApiModelProperty(value = "机构名称")
private String departName;
@ApiModelProperty(value = "站点数量")
private Integer stationCount;
@ApiModelProperty(value = "总装机容量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double installedCapacity;
@ApiModelProperty(value = "年平均风速")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double capacityRate;
@ApiModelProperty(value = "总有功功率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double load;
@ApiModelProperty(value = "年总发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateYear;
@ApiModelProperty(value = "月总发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateMon;
@ApiModelProperty(value = "日总发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateDay;
@ApiModelProperty(value = "年计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double plan;
@ApiModelProperty(value = "年计划完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double planRate;
@ApiModelProperty(value = "近年发电量集合")
private List<PowerYearVo> powerYearVoList;
@ApiModelProperty(value = "今年计划发电趋势集合")
private List<PowerMonthVo> powerMonthVoList;
}

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ReportServiceImpl.java

@ -488,7 +488,7 @@ public class ReportServiceImpl implements ReportService {
if(ObjectUtil.isEmpty(dept)){
return;
}
R<List<User>> userR = userClient.userListByDeptId(dept.getId());
R<List<User>> userR = userClient.userListByDeptAndChildrenWithAuth(dept.getId());
if(!userR.isSuccess() && CollectionUtil.isEmpty(userR.getData())){
return;
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java

@ -140,7 +140,7 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl<AlarmHandleMapper, A
}
List<User> users = new ArrayList<>();
result.getData().forEach(dept->{
users.addAll(userClient.userListByDeptId(dept.getId()).getData());
users.addAll(userClient.userListByDeptAndChildrenWithAuth(dept.getId()).getData());
});
return users.stream().distinct().collect(Collectors.toList());
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

@ -326,6 +326,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONDEFECTMESSAGE.getDescription());
message.setTaskId(operPhenomenonEntity.getId());
message.setTenantId("200000");
message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
message.setPushType(MessageConstants.IMMEDIATELY);
String countent =
@ -351,6 +352,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
message.setPusherName(user.getName());
}
message.setAccount(userId);
message.setCreateDept(Long.valueOf(user.getDeptId()));
message.setCreateUser(NumberUtils.toLong(userId));
messageClient.sendMessage(message);
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java

@ -60,16 +60,16 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
queryWrapper.like(OperDefectStatisticsEntity::getName, statistics.getName());
}
if (statistics.getConclusionTime() != null) {
queryWrapper.le(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionTime());
queryWrapper.ge(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionTime());
}
if (Func.isNotEmpty(statistics.getConclusionEndTime())) {
queryWrapper.ge(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionEndTime());
queryWrapper.le(OperDefectStatisticsEntity::getConclusionTime, statistics.getConclusionEndTime());
}
if (statistics.getCreateTime() != null) {
queryWrapper.le(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateTime());
queryWrapper.ge(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateTime());
}
if (Func.isNotEmpty(statistics.getCreateEndTime())) {
queryWrapper.ge(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateEndTime());
queryWrapper.le(OperDefectStatisticsEntity::getCreateTime, statistics.getCreateEndTime());
}
if (statistics.getIsDefect() != null) {
queryWrapper.eq(OperDefectStatisticsEntity::getIsDefect, statistics.getIsDefect());

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -3,7 +3,6 @@ package com.hnac.hzims.operational.duty.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.hnac.hzims.monitor.utils.DateUtils;
@ -31,7 +30,6 @@ import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
@ -39,7 +37,6 @@ import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.sql.Time;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -1226,7 +1223,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
@Override
public R getAllPersonInfo(Long deptId) {
R<List<User>> allUserList = userClient.userListByDeptId(deptId);
R<List<User>> allUserList = userClient.userList("200000",deptId);
return allUserList;
}
@ -1394,7 +1391,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
Map<Long, ImsDutyClassEntity> deptDutyClassMap = deptDutyClassList.stream().collect(Collectors.toMap(ImsDutyClassEntity::getId, Function.identity()));
// 获取部门的所有组员
List<User> allUserList = userClient.userListByDeptId(deptId).getData();
List<User> allUserList = userClient.userList("200000",deptId).getData();
Map<Long, String> deptUserMap = allUserList.stream().collect(Collectors.toMap(User::getId, User::getName));
LambdaQueryWrapper<ImsDutyMainEntity> wrapper = new LambdaQueryWrapper<>();
@ -1419,7 +1416,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
for (int i = 1; i <= days; i++) {
String dateStr = getDate(year, month, i);
List<User> restUserList = userClient.userListByDeptId(deptId).getData();
List<User> restUserList = userClient.userList("200000",deptId).getData();
// 获取一天的排班
List<ImsDutyMainEntity> dutyMainDayList = dutyMainList.stream().filter(var -> dateFormat.format(var.getDutyDate()).equals(dateStr)).collect(Collectors.toList());

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java

@ -201,9 +201,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
StationVo station = new StationVo();
station.setStationId(item.getCode());
station.setStationName(item.getName());
station.setDevices(this.devices(item,realList,targetList));
// 实时水位
this.handleWaterLeve(item.getCode(),station);
station.setDevices(this.devices(item,station.getDischargeFlow(),realList,targetList));
// 查询站点模型列表
HzimsAnalyzeModelStationEntity model = modelStationService.getOne(new LambdaQueryWrapper<HzimsAnalyzeModelStationEntity>() {{
eq(HzimsAnalyzeModelStationEntity::getStationId, item.getCode());
@ -221,7 +221,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
* @param station
* @return
*/
private List<DeviceVo> devices(StationEntity station, List<HydropowerUnitRealVo> realList, List<HydropowerUnitTargetVo> targetList) {
private List<DeviceVo> devices(StationEntity station,double dischargeFlow, List<HydropowerUnitRealVo> realList, List<HydropowerUnitTargetVo> targetList) {
if(CollectionUtil.isEmpty(realList) || CollectionUtil.isEmpty(targetList)){
return null;
}
@ -235,16 +235,17 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
// 设备编号
device.setDeviceCode(real.getDeviceCode());
device.setDeviceName(real.getDeviceName());
device.setOrd(real.getOrd());
device.setState(real.getState());
device.setActive(real.getActivePower());
device.setReactive(real.getReactivePower());
device.setDischarge(dischargeFlow);
device.setEcology(0.0);
device.setAdjust(0.0);
device.setDischarge(0.0);
device.setGenerate(0.0);
list.add(device);
}
return list.stream().sorted(Comparator.comparing(DeviceVo::getDeviceCode)).collect(Collectors.toList());
return list.stream().sorted(Comparator.comparing(DeviceVo::getOrd)).collect(Collectors.toList());
}
@ -266,6 +267,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
WaterLevelVo level = validList.get(0);
station.setWater(level.getFrontWaterLevel());
station.setDamWater(level.getFrontWaterLevel());
station.setDischargeFlow(level.getDischargeFlow());
}
/**

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/SolveController.java

@ -22,6 +22,9 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/solve")

69
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/WindController.java

@ -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);
}
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.java

@ -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> {
}

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.xml

@ -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>

23
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/WindService.java

@ -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);
}

93
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java

@ -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);
}
}

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/WindWrapper.java

@ -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;
}
}

37
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WindHomeController.java

@ -0,0 +1,37 @@
package com.hnac.hzims.operational.main.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.main.service.WindHomeService;
import com.hnac.hzims.operational.main.vo.HydropowerScoreVo;
import com.hnac.hzims.operational.main.vo.WindScoreVo;
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.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
*/
@RestController
@RequestMapping("/windHome")
@Api(value = "风电首页", tags = "风电-首页")
@AllArgsConstructor
public class WindHomeController extends BladeController {
private final WindHomeService service;
@ApiLog
@ApiOperation("水电站集团/区域指标")
@GetMapping("/KPIs")
@ApiOperationSupport(order = 1)
public R<WindScoreVo> KPIs(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(service.KPIs(deptId));
}
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/WindHomeService.java

@ -0,0 +1,12 @@
package com.hnac.hzims.operational.main.service;
import com.hnac.hzims.operational.main.vo.WindScoreVo;
/**
* @author ysj
*/
public interface WindHomeService {
WindScoreVo KPIs(Long deptId);
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -583,7 +583,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
if(ObjectUtil.isEmpty(dept)){
return;
}
R<List<User>> userR = userClient.userListByDeptId(dept.getId());
R<List<User>> userR = userClient.userListByDeptAndChildrenWithAuth(dept.getId());
if(!userR.isSuccess() && CollectionUtil.isEmpty(userR.getData())){
return;
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java

@ -1200,6 +1200,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
List<EquipmentStateCountVo> equipmentList = new ArrayList<>();
deptMap.forEach((key, value) -> {
EquipmentStateCountVo equipmentCountVo = new EquipmentStateCountVo();
equipmentCountVo.setSort(key.getSort());
equipmentCountVo.setDeptId(key.getId());
equipmentCountVo.setDeptName(key.getDeptName());
// 根据部门查询设备
@ -1253,7 +1254,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
this.setDeviceInfo(R.getData(), deviceVoList, equipmentCountVo);
equipmentList.add(equipmentCountVo);
});
return equipmentList;
return equipmentList.stream().sorted(Comparator.comparing(EquipmentStateCountVo::getSort)).collect(Collectors.toList());
}
/**

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

@ -220,6 +220,9 @@ public class WaterServiceImpl implements IWaterService {
// 后水位
double rearWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
waterLevelVo.setRearWaterLevel(rearWaterLevel);
// 下泄流量
double dischargeFlow = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.DISCHARGE_FLOW);
waterLevelVo.setDischargeFlow(dischargeFlow);
// 前水位当日曲线
Map<Integer,String> frontCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL);
waterLevelVo.setFrontCurveMap(frontCurveMap);

21
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java

@ -0,0 +1,21 @@
package com.hnac.hzims.operational.main.service.impl;
import com.hnac.hzims.operational.main.service.WindHomeService;
import com.hnac.hzims.operational.main.vo.WindScoreVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class WindHomeServiceImpl implements WindHomeService {
@Override
public WindScoreVo KPIs(Long deptId) {
return null;
}
}

28
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java

@ -1,14 +1,15 @@
package com.hnac.hzims.ticket.twoTicket.controller;
import cn.hutool.http.server.HttpServerResponse;
import com.hnac.hzims.ticket.twoTicket.service.TicketCountService;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountResponseVo;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.time.YearMonth;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 两票统计分析模块
@ -28,6 +29,7 @@ public class TicketCountController {
/**
* 两票生成月报统计
*
* @param dateTime 月份
* @return
*/
@ -38,8 +40,24 @@ public class TicketCountController {
}
/**
* 两票统计分析列表
*/
@GetMapping("/list")
public R list(TicketCountVo ticketCountVo) {
List<TicketCountResponseVo> result = ticketCountService.selectTicketCountLlist(ticketCountVo);
return R.data(result);
}
/**
* 两票统计分析导出
*/
@GetMapping("/export")
public R export(HttpServletResponse response) {
ticketCountService.exportTicketCount(response);
return R.success("导出成功");
}
}

42
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/TicketCount.java

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
import java.time.LocalDateTime;
@ -21,13 +23,7 @@ import java.time.YearMonth;
@Accessors(chain = true)
@EqualsAndHashCode
@TableName("hzims_ticket_count")
public class TicketCount implements Serializable {
/**
* 编号
*/
private Long id;
public class TicketCount extends TenantEntity implements Serializable {
/**
@ -77,36 +73,4 @@ public class TicketCount implements Serializable {
*/
private Integer ticketProportionNum;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 逻辑删除
*/
@TableField(value = "is_deleted")
@TableLogic(value = "0", delval = "1")
private Boolean deleted;
/**
* 创建部门
*/
private String createDept;
/**
* 租户Id
*/
private String tenantId;
}

153
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/handler/TicketCountSheetWriteHandler.java

@ -0,0 +1,153 @@
package com.hnac.hzims.ticket.twoTicket.handler;
import com.alibaba.excel.write.handler.SheetWriteHandler;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.aspectj.bridge.MessageWriter;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/7/6 11:08
*/
public class TicketCountSheetWriteHandler implements SheetWriteHandler {
/**
* Called before create the sheet
*
* @param writeWorkbookHolder
* @param writeSheetHolder
*/
@Override
public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
}
/**
* Called after the sheet is created
*
* @param writeWorkbookHolder
* @param writeSheetHolder
*/
@Override
public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
Workbook workbook = writeWorkbookHolder.getWorkbook();
CellStyle headerStyle = createHeadCellStyle(workbook);
Sheet sheet = workbook.getSheetAt(0);
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
sheet.addMergedRegion(new CellRangeAddress(0, 0, 1, 4));
sheet.addMergedRegion(new CellRangeAddress(0, 0, 5, 8));
sheet.addMergedRegion(new CellRangeAddress(0, 0, 9, 12));
sheet.addMergedRegion(new CellRangeAddress(0, 0, 13, 15));
sheet.setHorizontallyCenter(true);
sheet.setVerticallyCenter(true);
sheet.setDefaultRowHeight((short) 20);
//设置填表日期,填报人,联系方式
Row row1 = sheet.createRow(0);
row1.setHeightInPoints((short) 35);
Cell row1Cell = row1.createCell(0);
row1Cell.setCellValue("站点");
row1Cell.setCellStyle(headerStyle);
// row1.setHeight((short) 500);
Cell cell = row1.createCell(1);
cell.setCellValue("第一种工作票");
cell.setCellStyle(headerStyle);
Cell cell1 = row1.createCell(5);
cell1.setCellValue("第二种工作票");
cell1.setCellStyle(headerStyle);
Cell cell2 = row1.createCell(9);
cell2.setCellValue("机械工作票");
cell2.setCellStyle(headerStyle);
Cell cell3 = row1.createCell(13);
cell3.setCellValue("倒闸操作票");
cell3.setCellStyle(headerStyle);
}
/**
* 创建表头样式
* @param wb
* @return
*/
private static CellStyle createHeadCellStyle(Workbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
cellStyle.setAlignment(HorizontalAlignment.CENTER); //水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直对齐
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cellStyle.setBottomBorderColor(IndexedColors.BLACK.index);
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
Font headerFont = wb.createFont(); // 创建字体样式
headerFont.setBold(true); //字体加粗
headerFont.setFontName("黑体"); // 设置字体类型
headerFont.setFontHeightInPoints((short) 12); // 设置字体大小
cellStyle.setFont(headerFont); // 为标题样式设置字体样式
return cellStyle;
}
/**
* 创建内容样式
* @param wb
* @return
*/
private static CellStyle createContentCellStyle(Workbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setFontHeightInPoints((short) 12);
cellStyle.setFont(font);
return cellStyle;
}
/**
* 创建标题样式
* @param wb
* @return
*/
private static CellStyle createTitleCellStyle(Workbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直对齐
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cellStyle.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());//背景颜色
Font headerFont1 = wb.createFont(); // 创建字体样式
headerFont1.setBold(true); //字体加粗
headerFont1.setFontName("黑体"); // 设置字体类型
headerFont1.setFontHeightInPoints((short) 15); // 设置字体大小
cellStyle.setFont(headerFont1); // 为标题样式设置字体样式
return cellStyle;
}
}

20
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java

@ -1,9 +1,14 @@
package com.hnac.hzims.ticket.twoTicket.service;
import cn.hutool.http.server.HttpServerResponse;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.ticket.twoTicket.entity.TicketCount;
import com.hnac.hzims.ticket.twoTicket.entity.TicketInfoDanger;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountResponseVo;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo;
import org.springblade.core.mp.base.BaseService;
import javax.servlet.http.HttpServletResponse;
import java.time.YearMonth;
import java.util.List;
@ -13,11 +18,24 @@ import java.util.List;
* @Serial 1.0
* @Date 2023/7/3 13:37
*/
public interface TicketCountService extends IService<TicketCount> {
public interface TicketCountService extends BaseService<TicketCount> {
/**
* 两票生成月报统计
*/
void loadMonthReport(String dateTime);
/**
* 两票统计分析列表
* @param ticketCountVo
* @return
*/
List<TicketCountResponseVo> selectTicketCountLlist(TicketCountVo ticketCountVo);
/**
* 两票统计分析导出
* @param response
*/
void exportTicketCount(HttpServletResponse response);
}

232
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java

@ -1,21 +1,38 @@
package com.hnac.hzims.ticket.twoTicket.service.impl;
import cn.hutool.http.server.HttpServerResponse;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
import com.hnac.hzims.ticket.twoTicket.entity.TicketCount;
import com.hnac.hzims.ticket.twoTicket.handler.TicketCountSheetWriteHandler;
import com.hnac.hzims.ticket.twoTicket.mapper.TicketCountMapper;
import com.hnac.hzims.ticket.twoTicket.service.TicketCountService;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountResponseVo;
import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@ -23,10 +40,12 @@ import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
@ -40,7 +59,7 @@ import java.util.stream.Collectors;
@Slf4j
@Service
@RequiredArgsConstructor
public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, TicketCount> implements TicketCountService {
public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, TicketCount> implements TicketCountService {
private final ThreadPoolExecutor executor;
@ -113,15 +132,164 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke
}, executor);
//执行线程操作
CompletableFuture.allOf(ticketCountsCompletableFuture,
oneTicketCompletableFuture,
twoTicketCompletableFuture,
threeTicketCompletableFuture,
standardCompletableFuture)
.get();
CompletableFuture.allOf(ticketCountsCompletableFuture, oneTicketCompletableFuture, twoTicketCompletableFuture, threeTicketCompletableFuture, standardCompletableFuture).get();
}
/**
* 两票统计分析列表
*
* @param ticketCountVo
* @return
*/
@Override
public List<TicketCountResponseVo> selectTicketCountLlist(TicketCountVo ticketCountVo) {
//获取keyword
String keyword = ticketCountVo.getKeyword();
QueryWrapper<TicketCount> ticketCountQueryWrapper = new QueryWrapper<>();
ticketCountQueryWrapper.like(StringUtils.isNotBlank(keyword), "dept_name", keyword);
List<TicketCount> ticketCounts = baseMapper.selectList(ticketCountQueryWrapper);
List<TicketCountResponseVo> result = getTicketCountResponseList(ticketCounts);
return result;
}
/**
* 两票统计分析导出
*
* @param response
*/
@Override
public void exportTicketCount(HttpServletResponse response) {
String fileName = URLEncoder.encode("两票月报分析统计报表.xlsx");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setCharacterEncoding("utf-8");
List<TicketCount> ticketCounts = baseMapper.selectList(null);
List<TicketCountResponseVo> countResponseList = getTicketCountResponseList(ticketCounts);
//导出
//内容样式策略
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
// //垂直居中,水平居中
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
// //设置 自动换行
contentWriteCellStyle.setWrapped(true);
// // 字体策略
// WriteFont contentWriteFont = new WriteFont();
// // 字体大小
// contentWriteFont.setFontHeightInPoints((short) 12);
// contentWriteCellStyle.setWriteFont(contentWriteFont);
// //头策略使用默认
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
//excel如需下载到本地,只需要将response.getOutputStream()换成File即可(注释掉以上response代码)
try {
EasyExcel.write(response.getOutputStream(), TicketCountResponseVo.class)
//设置输出excel版本,不设置默认为xlsx
.excelType(ExcelTypeEnum.XLSX).head(TicketCountResponseVo.class)
//设置拦截器或自定义样式
.registerWriteHandler(new TicketCountSheetWriteHandler())
.registerWriteHandler(new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle))
.sheet("两票月报分析统计报表")
//设置默认样式及写入头信息开始的行数
.useDefaultStyle(true).relativeHeadRowIndex(1)
//这里的addsumColomn方法是个添加合计的方法,可删除
.doWrite(countResponseList);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 列表封装
*
* @param ticketCounts
* @return
*/
private List<TicketCountResponseVo> getTicketCountResponseList(List<TicketCount> ticketCounts) {
//先判断在存储
Map<String, TicketCountResponseVo> map = new HashMap<>();
for (TicketCount ticketCount : ticketCounts) {
String deptName = ticketCount.getDeptName();
if (map.containsKey(deptName)) {
TicketCountResponseVo ticketCountResponseVo = map.get(deptName);
isExistsTicket(ticketCount, ticketCountResponseVo);
map.put(deptName, ticketCountResponseVo);
} else {
TicketCountResponseVo ticketCountResponseVo = new TicketCountResponseVo();
isExistsTicket(ticketCount, ticketCountResponseVo);
map.put(deptName, ticketCountResponseVo);
}
}
//map遍历
List<TicketCountResponseVo> result = new ArrayList<>();
if (MapUtils.isNotEmpty(map)) {
Set<Map.Entry<String, TicketCountResponseVo>> entries = map.entrySet();
for (Map.Entry<String, TicketCountResponseVo> entry : entries) {
TicketCountResponseVo value = entry.getValue();
value.setDeptName(entry.getKey());
result.add(value);
}
}
return result;
}
/**
* 验证是否是是这几种牌局类型
*
* @param ticketCount
* @param ticketCountResponseVo
*/
private void isExistsTicket(TicketCount ticketCount, TicketCountResponseVo ticketCountResponseVo) {
String deptName = ticketCount.getDeptName();
ticketCountResponseVo.setDeptName(deptName);
if ("3".equals(ticketCount.getTicketType())) {
ticketCountResponseVo.setFourTicketNumber(this.getCount(ticketCount.getTicketNumber()));
ticketCountResponseVo.setFourTicketProportionNum(this.getCount(ticketCount.getTicketProportionNum()));
ticketCountResponseVo.setFourTicketCompleteNum(this.getCount(ticketCount.getTicketCompleteNum()));
ticketCountResponseVo.setFourTicketDelayNum(this.getCount(ticketCount.getTicketDelayNum()));
}
if ("6".equals(ticketCount.getTicketType())) {
ticketCountResponseVo.setOneTicketNumber(this.getCount(ticketCount.getTicketNumber()));
ticketCountResponseVo.setOneTicketProportionNum(this.getCount(ticketCount.getTicketProportionNum()));
ticketCountResponseVo.setOneTicketCompleteNum(this.getCount(ticketCount.getTicketCompleteNum()));
ticketCountResponseVo.setOneTicketDelayNum(this.getCount(ticketCount.getTicketDelayNum()));
}
if ("7".equals(ticketCount.getTicketType())) {
ticketCountResponseVo.setTwoTicketNumber(this.getCount(ticketCount.getTicketNumber()));
ticketCountResponseVo.setTwoTicketProportionNum(this.getCount(ticketCount.getTicketProportionNum()));
ticketCountResponseVo.setTwoTicketCompleteNum(this.getCount(ticketCount.getTicketCompleteNum()));
ticketCountResponseVo.setTwoTicketDelayNum(this.getCount(ticketCount.getTicketDelayNum()));
}
if ("8".equals(ticketCount.getTicketType())) {
ticketCountResponseVo.setThreeTicketNumber(this.getCount(ticketCount.getTicketNumber()));
ticketCountResponseVo.setThreeTicketProportionNum(this.getCount(ticketCount.getTicketProportionNum()));
ticketCountResponseVo.setThreeTicketCompleteNum(this.getCount(ticketCount.getTicketCompleteNum()));
ticketCountResponseVo.setThreeTicketDelayNum(this.getCount(ticketCount.getTicketDelayNum()));
}
}
/**
* 验证是否为null
*/
private int getCount(Integer count) {
return count == null ? 0 : count;
}
/**
* 统计操作票功能
*
* @param createDept 所属机构及下属机构
@ -132,17 +300,16 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke
* @return
*/
private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) {
List<StandardTicketInfoEntity> ticketInfoEntities =
standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType);
List<StandardTicketInfoEntity> ticketInfoEntities = standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType);
if (CollectionUtils.isEmpty(ticketInfoEntities)) {
return null;
}
//根据站点分组
Map<Long, List<StandardTicketInfoEntity>> createDeptTickets =
ticketInfoEntities.stream().collect(Collectors.groupingBy(StandardTicketInfoEntity::getCreateDept));
Map<Long, List<StandardTicketInfoEntity>> createDeptTickets = ticketInfoEntities.stream().collect(Collectors.groupingBy(StandardTicketInfoEntity::getCreateDept));
//获取 操作票的id,删除
if (CollectionUtils.isNotEmpty(items)) {
List<Long> collect = items.stream().filter(item -> ticketType.equals(item.getTicketType())).map(TicketCount::getId).collect(Collectors.toList());
List<Long> collect =
items.stream().filter(item -> ticketType.equals(item.getTicketType()) && user.getUserId().equals(item.getCreateUser())).map(TicketCount::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
baseMapper.deleteBatchIds(collect);
}
@ -154,7 +321,8 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke
ticketCount.setDateTime(dateTime);
ticketCount.setDeptId(entry.getKey());
ticketCount.setTenantId(user.getTenantId());
ticketCount.setCreateDept(user.getDeptId());
ticketCount.setCreateDept(Long.valueOf(user.getDeptId()));
ticketCount.setCreateUser(user.getUserId());
//根据id获取部门名称
R<String> deptName = systemClient.getDeptName(entry.getKey());
if (deptName.isSuccess()) {
@ -163,19 +331,16 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke
List<StandardTicketInfoEntity> values = entry.getValue();
ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getTicketType() : ticketType);
//1. 开票数量
List<StandardTicketInfoEntity> ticketNumbers =
values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList());
List<StandardTicketInfoEntity> ticketNumbers = values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList());
ticketCount.setTicketNumber(ticketNumbers.size());
//2. 完成数量
List<StandardTicketInfoEntity> ticketCompleteNums =
values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList());
List<StandardTicketInfoEntity> ticketCompleteNums = values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList());
ticketCount.setTicketCompleteNum(ticketCompleteNums.size());
//3. 延期数据量
ticketCount.setTicketDelayNum(0);
//4. 合格数量
List<Long> ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList());
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper =
new LambdaQueryWrapper<>();
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList);
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1);
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper);
@ -197,8 +362,7 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke
* @return
*/
private List<TicketCount> getTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) {
List<WorkTicketInfoEntity> ticketInfoEntities =
workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType);
List<WorkTicketInfoEntity> ticketInfoEntities = workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType);
if (CollectionUtils.isEmpty(ticketInfoEntities)) {
return null;
}
@ -206,7 +370,8 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke
Map<Long, List<WorkTicketInfoEntity>> createDeptTickets = ticketInfoEntities.stream().collect(Collectors.groupingBy(BaseEntity::getCreateDept));
if (CollectionUtils.isNotEmpty(items)) {
//获取工作票的id,删除
List<Long> collect = items.stream().filter(item -> ticketType.equals(item.getTicketType())).map(TicketCount::getId).collect(Collectors.toList());
List<Long> collect =
items.stream().filter(item -> (ticketType.equals(item.getTicketType()) && user.getUserId().equals(item.getCreateUser()))).map(TicketCount::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
baseMapper.deleteBatchIds(collect);
}
@ -226,23 +391,20 @@ public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, Ticke
List<WorkTicketInfoEntity> values = entry.getValue();
ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getType() : ticketType);
//1. 开票数量
List<WorkTicketInfoEntity> ticketNumbers =
values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList());
List<WorkTicketInfoEntity> ticketNumbers = values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList());
ticketCount.setTicketNumber(ticketNumbers.size());
//2. 完成数量
List<WorkTicketInfoEntity> ticketCompleteNums =
values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList());
List<WorkTicketInfoEntity> ticketCompleteNums = values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList());
ticketCount.setTicketCompleteNum(ticketCompleteNums.size());
ticketCount.setTenantId(user.getTenantId());
ticketCount.setCreateDept(user.getDeptId());
ticketCount.setCreateDept(Long.valueOf(user.getDeptId()));
ticketCount.setCreateUser(user.getUserId());
//3. 延期数据量
List<WorkTicketInfoEntity> ticketDelayNums =
values.stream().filter(item -> "延期".equals(item.getInput())).collect(Collectors.toList());
List<WorkTicketInfoEntity> ticketDelayNums = values.stream().filter(item -> "延期".equals(item.getInput())).collect(Collectors.toList());
ticketCount.setTicketDelayNum(ticketDelayNums.size());
//4. 合格数量
List<Long> ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList());
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper =
new LambdaQueryWrapper<>();
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList);
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1);
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper);

157
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/ticket/TicketCountResponseVo.java

@ -0,0 +1,157 @@
package com.hnac.hzims.ticket.twoTicket.vo.ticket;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/7/6 8:02
*/
@Data
@ContentRowHeight(30)
@HeadRowHeight(30)
public class TicketCountResponseVo {
/**
* 站点名称
*/
@ColumnWidth(20)
@ExcelProperty(value = "站点",index = 0)
private String deptName;
/**
* 第一种工作票开票数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "开票数量",index = 1)
private Integer oneTicketNumber = 0;
/**
* 第一种工作票完成数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "完成数量",index = 2)
private Integer oneTicketCompleteNum = 0;
/**
* 第一种工作票延期数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "延期数量",index = 3)
private Integer oneTicketDelayNum = 0;
/**
* 第一种工作票合格数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "合格数量",index = 4)
private Integer oneTicketProportionNum = 0;
/**
* 第二种工作票开票数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "开票数量",index = 5)
private Integer twoTicketNumber = 0;
/**
* 第二种工作票完成数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "完成数量",index = 6)
private Integer twoTicketCompleteNum = 0;
/**
* 第二种工作票延期数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "延期数量",index = 7)
private Integer twoTicketDelayNum = 0;
/**
* 第二种工作票合格数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "合格数量",index = 8)
private Integer twoTicketProportionNum = 0;
/**
* 水力机械工作票开票数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "开票数量",index = 9)
private Integer threeTicketNumber = 0;
/**
* 水力机械工作票完成数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "完成数量",index = 10)
private Integer threeTicketCompleteNum = 0;
/**
* 水力机械工作票延期数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "延期数量",index = 11)
private Integer threeTicketDelayNum = 0;
/**
* 水力机械工作票合格数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "合格数量",index = 12)
private Integer threeTicketProportionNum = 0;
/**
* 操作票开票数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "开票数量",index = 13)
private Integer fourTicketNumber = 0;
/**
* 操作票开票完成数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "完成数量",index = 14)
private Integer fourTicketCompleteNum = 0;
/**
* 操作票延期数量
*/
@ExcelIgnore
private Integer fourTicketDelayNum = 0;
/**
* 操作票作票合格数量
*/
@ColumnWidth(14)
@ExcelProperty(value = "合格数量",index = 15)
private Integer fourTicketProportionNum = 0;
}

16
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/vo/ticket/TicketCountVo.java

@ -0,0 +1,16 @@
package com.hnac.hzims.ticket.twoTicket.vo.ticket;
import lombok.Data;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/7/6 8:04
*/
@Data
public class TicketCountVo {
private String keyword;
}

7
hzims-service/ticket/src/main/resources/db/2.0.0.sql

@ -13,9 +13,12 @@ create table hzims_ticket_count
ticket_proportion_num int null comment '合格数量',
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
is_deleted tinyint(1) default 0 null comment '0',
is_deleted tinyint(1) default 0 null comment '逻辑删除',
tenant_id varchar(12) null comment '租户ID',
create_dept varchar(30) null comment '创建部门'
create_dept varchar(30) null comment '创建部门',
status tinyint null,
create_user bigint not null comment '创建人',
update_user bigint null
)
comment '两票统计分析' row_format = DYNAMIC;

Loading…
Cancel
Save