Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
7abb47d30c
  1. 4
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  2. 4
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  3. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/WtSpBasicController.java
  4. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpAllocationMapper.xml
  5. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml
  6. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpWarehouseInMapper.xml
  7. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpWarehouseOutMapper.xml
  8. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpTotalMapper.xml
  9. 7
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java
  10. 22
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java
  11. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  12. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml
  13. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java
  14. 7
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  15. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java
  16. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java
  17. 86
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java
  18. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java
  19. 391
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  20. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java
  21. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java
  22. 63
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/QdnHomeController.java
  23. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java
  24. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java
  25. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java
  26. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java
  27. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaService.java
  28. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HomeService.java
  29. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java
  30. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java
  31. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java
  32. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java
  33. 186
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  34. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaServiceImpl.java
  35. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  36. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  37. 19
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  38. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java
  39. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  40. 24
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  41. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  42. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java
  43. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java
  44. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java
  45. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/ImsDeptServiceImpl.java
  46. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  47. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  48. 5
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java

4
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -76,7 +76,6 @@ public interface IEmInfoClient {
String GET_EM_INFO_BY_DEPT = API_PREFIX + "/getEmInfoByDept";
String GET_EM_INFO_BY_NAME = API_PREFIX + "/getEmInfoByName";
String GET_EM_INFO_BY_EM_CODE = API_PREFIX + "/getEmInfoByEmCode";
String GET_EM_INFO_TREE_BY_EM_CODE = API_PREFIX + "/getEmInfoTreeByEmCode";
String UPDATE_BY_EM_CODE = API_PREFIX + "/updateByEmCode";
String UPDATE_BATCH_EM_STATE = API_PREFIX + "/updateBachEmState";
String GET_CHILDREN_BY_EM_CODE = API_PREFIX + "/getChildrenByEmCode";
@ -115,9 +114,6 @@ public interface IEmInfoClient {
@GetMapping(GET_EM_INFO_BY_EM_CODES)
R<List<EmInfoEntity>> getEmInfoByEmCodes(@RequestParam("emCodes") List<String> emCodes);
@GetMapping(GET_EM_INFO_TREE_BY_EM_CODE)
R<List<EmInfoEntity>> getEmInfoTreeByEmCode(@RequestParam("emCode") String emCode);
@PostMapping(GET_EM_INFO_UNIT_COUNT_BY_DEPT)
R<Integer> getEmInfoUnitCountByDept(@RequestParam("list") List<Long> list);

4
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -54,10 +54,6 @@ public class IEmInfoClientBack implements IEmInfoClient {
return R.data(new ArrayList<>());
}
@Override
public R<List<EmInfoEntity>> getEmInfoTreeByEmCode(String emCode) {
return R.data(new ArrayList<>());
}
@Override
public R<Integer> getEmInfoUnitCountByDept(List<Long> depts) {

2
hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/WtSpBasicController.java

@ -191,7 +191,7 @@ public class WtSpBasicController extends BladeController {
@ApiOperation(value = "导入台账填写Excel")
@RequestMapping(value = "/importExcel", method = {RequestMethod.POST})
public R importExcel( @RequestParam MultipartFile file) throws Exception {
System.out.println(11);
// System.out.println(11);
return SP_BASICService.importExcel(file);
}

2
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpAllocationMapper.xml

@ -46,7 +46,7 @@
wt_sp_allocation wa
JOIN wt_sp_warehouse sw ON wa.OUT_WAREHOUSE_ID = sw.id
<if test="params.code!=null and params.code!=''">
and wa.code = #{params.code}
and wa.code like concat('%',#{params.code},'%')
</if>
<if test="params.status!=null">
and wa.status = #{params.status}

2
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml

@ -47,7 +47,7 @@
wt_sp_receive wr
JOIN wt_sp_warehouse sw ON wr.STORAGE_ROOM = sw.id
<if test="params.code!=null and params.code!=''">
and wr.code = #{params.code}
and wr.code like concat('%',#{params.code},'%')
</if>
<if test="params.createUser!=null">
and wr.CREATE_USER = #{params.createUser}

2
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpWarehouseInMapper.xml

@ -47,7 +47,7 @@
wt_sp_warehouse_in wi
JOIN wt_sp_warehouse sw ON wi.STORAGE_ROOM = sw.id
<if test="params.code!=null and params.code!=''">
and wi.code = #{params.code}
and wi.code like concat('%',#{params.code},'%')
</if>
<if test="params.type!=null">
and wi.type = #{params.type}

2
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpWarehouseOutMapper.xml

@ -47,7 +47,7 @@
wt_sp_warehouse_out wo
JOIN wt_sp_warehouse sw ON wo.STORAGE_ROOM = sw.id
<if test="params.code!=null and params.code!=''">
and wo.code = #{params.code}
and wo.code like concat('%',#{params.code},'%')
</if>
<if test="params.type!=null">
and wo.type = #{params.type}

2
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpTotalMapper.xml

@ -71,7 +71,7 @@
join wt_sp_management sm on sb.MANAGEMENT_ID = sm.id
where st.IS_DELETED = 0
<if test="params.code!=null and params.code!=''">
and sb.code = #{params.code}
and sb.code like concat('%',#{params.code},'%')
</if>
<if test="params.name!=null and params.name!=''">
and sb.NAME like concat('%',#{params.name},'%')

7
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java

@ -15,7 +15,6 @@ import com.hnac.hzims.spare.vo.WtSpBasicVO;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.launch.constant.FlowConstant;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
@ -23,9 +22,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.IDictBizClient;
import org.springblade.system.feign.ISysClient;
@ -34,14 +31,12 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 服务实现类
@ -236,7 +231,7 @@ public class SpReceiveServiceImpl extends BaseServiceImpl<SpReceiveMapper, SpRec
if(null!=receiveVO.getUserName()){
R<User> user = userClient.userByAccount(bladeUser.getTenantId(),receiveVO.getUserName());
if(null!=user){
if(null!=user.getData().getId()){
if(null!=user.getData()){
params.put("createUser",user.getData().getId());
}else{
return page.setRecords(result);

22
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java

@ -15,7 +15,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.spare.entity.*;
import com.hnac.hzims.spare.enume.WarehouseInType;
@ -551,9 +550,12 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
}
List entityList = excelToolListener.getDataList();
List<WtSpBasicEntity> data = new ArrayList<>();
List<WtSpBasicEntity> error = new ArrayList<>();
error = JSONArray.parseArray(JSON.toJSONString(entityList), WtSpBasicEntity.class).stream()
.filter(entity -> Func.isEmpty(entity.getName())).collect(Collectors.toList());
data = JSONArray.parseArray(JSON.toJSONString(entityList), WtSpBasicEntity.class).stream()
.filter(entity -> Func.isNotEmpty(entity.getName())).collect(Collectors.toList());
Assert.isTrue(CollectionUtil.isNotEmpty(data), () -> {
Assert.isTrue(CollectionUtil.isEmpty(error), () -> {
throw new ServiceException("填入工器具编码不能为空");
});
// List<WtSpBasicEntity> data = ExcelImportUtil.importExcel(file.getInputStream(), WtSpBasicEntity.class, params);
@ -565,15 +567,15 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
Integer counter = 2;
//数据校验
R<String> r = this.validExcel(libraryExcel, codeList, counter);
if (r == null && r.getCode() == 500) {
if (r.getMsg()!=null|| !r.isSuccess()) {
return r;
}
}
boolean flag = this.saveBatch(data);
return R.status(flag);
} catch (Exception ex) {
throw new RuntimeException( ex);
// String.format("导入数据异常!"),
log.error("导入数据异常:", ex);
throw new ServiceException(ex.getMessage());
}
}
@ -610,14 +612,14 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
if (StringUtils.isBlank(libraryExcel.getBrand())) {
errors.add("物品品牌不能为空");
}
if (StringUtils.isBlank(libraryExcel.getSpecifications())) {
errors.add("规格型号不能为空");
}
// if (StringUtils.isBlank(libraryExcel.getSpecifications())) {
// errors.add("规格型号不能为空");
// }
if (StringUtils.isBlank(libraryExcel.getParameter())) {
errors.add("物品类别代码不能为空");
} else {
if (!list.contains(libraryExcel.getParameter())) {
errors.add("物品类别代码不规范");
errors.add("物品类别代码不规范(请参考填写模板)");
} else {
//物品类别代码规范的情况下,把managerID写入
WtSpManagementEntity wtSpManagementeExcelEntity = wtSpManagementMapper.selectOne(new LambdaQueryWrapper<WtSpManagementEntity>() {{
@ -651,7 +653,7 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
if (CollectionUtils.isEmpty(errors)) {
return R.success("OK");
} else {
return R.data(500, errors, String.format("第%s行导入异常", counter));
return R.fail(String.format("第%s行导入异常!", counter)+"原因可能是:"+errors);
}
}

10
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -144,14 +144,4 @@ public class EmInfoClient implements IEmInfoClient {
return R.data(service.list(wrapper).stream().map(EmInfoEntity::getNumber).distinct().collect(Collectors.toList()));
}
/**
*
* @param emCode
* @return
*/
@GetMapping(value = GET_EM_INFO_TREE_BY_EM_CODE)
@Override
public R<List<EmInfoEntity>> getEmInfoTreeByEmCode(String emCode) {
return R.data(service.getEmInfoTreeByEmCode(emCode));
}
}

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml

@ -117,7 +117,7 @@
</select>
<select id="getMaxEmIndexByPid" resultType="java.lang.Integer">
select max(em_index) from hzims_em_info where DEPARTMENT = #{department} and em_grade = #{emGrade}
select max(em_index) from hzims_em_info where DEPARTMENT = #{department} and em_grade = #{emGrade} and is_deleted = 0
</select>
<select id="getSparePart" resultType="com.hnac.hzims.equipment.vo.SparePartVO">

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java

@ -60,8 +60,6 @@ public interface IEmInfoService extends BaseService<EmInfoEntity> {
EmInfoEntity getEmInfoByEmCode(String emCode);
List<EmInfoEntity> getEmInfoTreeByEmCode(String emCode);
void loadEmInfo();
List<EminfoAndEmParamVo> getEmInfoAndParamRedis();

7
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -311,12 +311,6 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
return this.baseMapper.selectEmInfoByEmCode(emCode);
}
@Override
public List<EmInfoEntity> getEmInfoTreeByEmCode(String emCode) {
return null;
}
/**
* 把设备信息及装机容量ctpt从Redis 取出来
*/
@ -552,6 +546,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
if (deviceResult.getCode() == 200 && Func.isNotEmpty(deviceResult.getData())) {
List<DeviceChildrenVO> deviceChildrenList = deviceResult.getData();
childrenMap = deviceChildrenList.stream().collect(Collectors.toMap(DeviceChildrenVO::getSignage, Function.identity()));
log.warn("设备信息查询巡检内容关联采集点信息:" + childrenMap);
}
// 拼接采集点到设备巡检内容

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

@ -952,7 +952,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
}
return R.success("暂无数据,请稍后重试");
}
return R.fail("智能诊断接口异常,请联系管理员");
return R.fail(fdpHttpResponseVo.getMessage());
}

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

@ -241,7 +241,7 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe
}
R<Dept> dept = sysClient.getDept(deptId);
if(dept.isSuccess() && ObjectUtil.isNotEmpty(dept.getData())){
R<List<User>> parents = userClient.userByDeptId("200000",deptId);
R<List<User>> parents = userClient.userByDeptId("200000",dept.getData().getParentId());
if(parents.isSuccess() && CollectionUtil.isNotEmpty(parents.getData())){
users.addAll(parents.getData());
}

86
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java

@ -5,6 +5,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.census.service.TargetService;
import com.hnac.hzims.operational.census.vo.*;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import io.swagger.annotations.Api;
@ -33,15 +34,19 @@ public class TargetController {
@ApiOperation("装机容量统计:区分填报/接入站点")
@PostMapping("/installed-capacity")
@ApiOperationSupport(order = 1)
public R installedCapacity(@RequestParam(value = "stationName",required = false) String stationName,@RequestParam(value = "type") Integer type) {
return R.data(service.installedCapacity(stationName,type));
public R<IPage<InstalledCapacityVo>> installedCapacity(Query query,
@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type) {
return R.data(service.installedCapacity(Condition.getPage(query),stationName,type));
}
@ApiOperation("发电量统计:区分填报/接入站点")
@PostMapping("/electric-generation")
@ApiOperationSupport(order = 2)
public R electricGeneration(@RequestParam(value = "stationName",required = false) String stationName,@RequestParam(value = "type") Integer type) {
return R.data(service.electricGeneration(stationName,type));
public R<IPage<ElectricGenerationVo>> electricGeneration(Query query,
@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type) {
return R.data(service.electricGeneration(Condition.getPage(query),stationName,type));
}
@ -49,8 +54,10 @@ public class TargetController {
@ApiOperation("计划发电量/实际发电量统计:区分填报/接入站点")
@PostMapping("/complete-generation")
@ApiOperationSupport(order = 3)
public R completeGeneration(@RequestParam(value = "stationName",required = false) String stationName,@RequestParam(value = "type") Integer type) {
return R.data(service.completeGeneration(stationName,type));
public R<IPage<CompleteGenerationVo>> completeGeneration(Query query,
@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type) {
return R.data(service.completeGeneration(Condition.getPage(query),stationName,type));
}
@ -58,16 +65,20 @@ public class TargetController {
@ApiOperation("两票统计:区分填报/平台业务数据")
@PostMapping("/complete-ticket")
@ApiOperationSupport(order = 4)
public R completeTicket(@RequestParam(value = "areaName",required = false) String areaName,@RequestParam(value = "type") Integer type) {
return R.data(service.completeTicket(areaName,type));
public R<IPage<CompleteTicketVo>> completeTicket(Query query,
@RequestParam(value = "areaName",required = false) String areaName,
@RequestParam(value = "type") Integer type) {
return R.data(service.completeTicket(Condition.getPage(query),areaName,type));
}
@ApiLog
@ApiOperation("缺陷率统计:区分填报/平台业务数据")
@GetMapping("/complete-defect")
@ApiOperationSupport(order = 5)
public R completeDefect(@RequestParam(value = "areaName",required = false) String areaName,@RequestParam(value = "type") Integer type) {
return R.data(service.defect(areaName,type));
public R<IPage<CompleteDefectVo>> completeDefect(Query query,
@RequestParam(value = "areaName",required = false) String areaName,
@RequestParam(value = "type") Integer type) {
return R.data(service.defect(Condition.getPage(query),areaName,type));
}
@ -75,15 +86,20 @@ public class TargetController {
@ApiOperation("上线率/Fa投入条数统计")
@GetMapping("/complete-other")
@ApiOperationSupport(order = 6)
public R completeOther(@RequestParam(value = "stationName",required = false) String stationName,@RequestParam(value = "type") Integer type,@RequestParam(value = "queryType") Integer queryType) {
return R.data(service.completeOther(stationName,type,queryType));
public R<IPage<CompleteOtherVo>> completeOther(Query query,
@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type,
@RequestParam(value = "queryType") Integer queryType) {
return R.data(service.completeOther(Condition.getPage(query),stationName,type,queryType));
}
@ApiLog
@ApiOperation("日常维护统计")
@GetMapping("/routine-maintenance")
@ApiOperationSupport(order = 7)
public R<IPage<OperMaintenanceTaskVO>> routineMaintenance(OperMaintenanceTaskDTO params,Query query,Integer type) {
public R<IPage<OperMaintenanceTaskVO>> routineMaintenance(OperMaintenanceTaskDTO params,
Query query,
Integer type) {
return service.routineMaintenance(params,query,type);
}
@ -92,7 +108,9 @@ public class TargetController {
@ApiOperation("检修任务统计")
@GetMapping("/examine-repair")
@ApiOperationSupport(order = 8)
public R<IPage<OperAccessTaskVO>> examineRepair(OperAccessTaskDTO params, Query query, Integer type) {
public R<IPage<OperAccessTaskVO>> examineRepair(OperAccessTaskDTO params,
Query query,
Integer type) {
return service.examineRepair(params, query,type);
}
@ -101,16 +119,21 @@ public class TargetController {
@ApiOperation("检修卡统计")
@GetMapping("/examineCard")
@ApiOperationSupport(order = 9)
public R examineCard(@RequestParam(value = "stationName",required = false) String stationName,@RequestParam(value = "type") Integer type) {
return R.data(service.examineCard(stationName,type));
public R<IPage<ExamineCardVo>> examineCard(Query query,
@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type) {
return R.data(service.examineCard(Condition.getPage(query),stationName,type));
}
@ApiLog
@ApiOperation("设备统计")
@GetMapping("/device-classify")
@ApiOperationSupport(order = 10)
public R deviceClassify(@RequestParam(value = "stationName",required = false) String stationName, @RequestParam(value = "deptId",required = false) Long deptId,@RequestParam(value="status")Integer status) {
return R.data(service.deviceClassify(stationName,deptId,status));
public R<IPage<DeviceClassifyVo>> deviceClassify(Query query,
@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "deptId",required = false) Long deptId,
@RequestParam(value="status")Integer status) {
return R.data(service.deviceClassify(Condition.getPage(query),stationName,deptId,status));
}
@ -118,31 +141,42 @@ public class TargetController {
@ApiOperation("水电集团、区域指标关联")
@GetMapping("/hydropower-target")
@ApiOperationSupport(order = 11)
public R hydropowerTarget(@RequestParam(value = "stationName",required = false) String stationName, @RequestParam(value = "deptId",required = false) Long deptId,@RequestParam(value = "target") Integer target) {
return R.data(service.hydropowerTarget(stationName,deptId,target));
public R<IPage<HydropowerTargetVo>> hydropowerTarget(Query query,
@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "deptId",required = false) Long deptId,
@RequestParam(value = "target") Integer target) {
return R.data(service.hydropowerTarget(Condition.getPage(query),stationName,deptId,target));
}
@ApiLog
@ApiOperation("水利集团、区域指标关联")
@GetMapping("/water-target")
@ApiOperationSupport(order = 12)
public R waterTarget(@RequestParam(value = "stationName",required = false) String stationName, @RequestParam(value = "deptId",required = false) Long deptId,@RequestParam(value = "target") Integer target) {
return R.data(service.waterTarget(stationName,deptId,target));
public R<IPage<WaterTargetVo>> waterTarget(Query query,
@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "deptId",required = false) Long deptId,
@RequestParam(value = "target") Integer target) {
return R.data(service.waterTarget(Condition.getPage(query),stationName,deptId,target));
}
@ApiLog
@ApiOperation("光伏集团、区域指标关联")
@GetMapping("/photovoltaic-target")
@ApiOperationSupport(order = 13)
public R photovoltaicTarget(@RequestParam(value = "stationName",required = false) String stationName, @RequestParam(value = "deptId",required = false) Long deptId,@RequestParam(value = "target") Integer target) {
return R.data(service.photovoltaicTarget(stationName,deptId,target));
public R<IPage<PhotovoTargetVo>> photovoltaicTarget(Query query,
@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "deptId",required = false) Long deptId,
@RequestParam(value = "target") Integer target) {
return R.data(service.photovoltaicTarget(Condition.getPage(query),stationName,deptId,target));
}
@ApiLog
@ApiOperation("集团当班数据")
@GetMapping("/duty-group")
@ApiOperationSupport(order = 14)
public R dutygroup(@RequestParam(value = "areaName",required = false) String areaName,@RequestParam(value = "type") Long type) {
return R.data(service.dutyGroup(areaName,type));
public R<IPage<DutyGroupVo>> dutygroup(Query query,
@RequestParam(value = "areaName",required = false) String areaName,
@RequestParam(value = "type") Long type) {
return R.data(service.dutyGroup(Condition.getPage(query),areaName,type));
}
}

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java

@ -19,25 +19,25 @@ import java.util.List;
public interface TargetService {
// 获取站点装机容量
List<InstalledCapacityVo> installedCapacity(String stationName,Integer type);
IPage<InstalledCapacityVo> installedCapacity(IPage<InstalledCapacityVo> page,String stationName,Integer type);
// 发电量统计
List<ElectricGenerationVo> electricGeneration(String stationName,Integer type);
IPage<ElectricGenerationVo> electricGeneration(IPage<ElectricGenerationVo> page,String stationName,Integer type);
// 计划发电量/实际发电量统计
List<CompleteGenerationVo> completeGeneration(String stationName,Integer type);
IPage<CompleteGenerationVo> completeGeneration(IPage<CompleteGenerationVo> page,String stationName,Integer type);
// 两票统计
List<CompleteTicketVo> completeTicket(String areaName,Integer type);
IPage<CompleteTicketVo> completeTicket(IPage<CompleteTicketVo> page,String areaName,Integer type);
// 缺陷率统计
List<CompleteDefectVo> defect(String areaName, Integer type);
IPage<CompleteDefectVo> defect(IPage<CompleteDefectVo> page,String areaName, Integer type);
// 检修卡统计
List<ExamineCardVo> examineCard(String stationName, Integer type);
IPage<ExamineCardVo> examineCard(IPage<ExamineCardVo> page,String stationName, Integer type);
// 设备在线率/Fa投入条数统计
List<CompleteOtherVo> completeOther(String stationName, Integer type,Integer queryType);
IPage<CompleteOtherVo> completeOther(IPage<CompleteOtherVo> page,String stationName, Integer type,Integer queryType);
// 日常维护统计
R<IPage<OperMaintenanceTaskVO>> routineMaintenance(OperMaintenanceTaskDTO params, Query query, Integer type);
@ -46,20 +46,17 @@ public interface TargetService {
R<IPage<OperAccessTaskVO>> examineRepair(OperAccessTaskDTO params, Query query, Integer type);
// 设备分类统计
List<DeviceClassifyVo> deviceClassify(String stationName, Long deptId,Integer status);
IPage<DeviceClassifyVo> deviceClassify(IPage<DeviceClassifyVo> page,String stationName, Long deptId,Integer status);
// 水电指标关联数据
List<HydropowerTargetVo> hydropowerTarget(String stationName, Long deptId,Integer target);
IPage<HydropowerTargetVo> hydropowerTarget(IPage<HydropowerTargetVo> page,String stationName, Long deptId,Integer target);
// 水利指标关联数据
List<WaterTargetVo> waterTarget(String stationName, Long deptId,Integer target);
IPage<WaterTargetVo> waterTarget(IPage<WaterTargetVo> page,String stationName, Long deptId,Integer target);
// 光伏指标关联数据
List<PhotovoTargetVo> photovoltaicTarget(String stationName, Long deptId, Integer target);
// 集团设备
List<DeviceGroupVo> deviceGroup(String areaName);
IPage<PhotovoTargetVo> photovoltaicTarget(IPage<PhotovoTargetVo> page,String stationName, Long deptId, Integer target);
// 集团工作牌/操作票
List<DutyGroupVo> dutyGroup(String areaName, Long type);
IPage<DutyGroupVo> dutyGroup(IPage<DutyGroupVo> page,String areaName, Long type);
}

391
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -118,21 +118,21 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<InstalledCapacityVo> installedCapacity(String stationName,Integer type) {
public IPage<InstalledCapacityVo> installedCapacity(IPage<InstalledCapacityVo> page,String stationName,Integer type) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, type);
wappers.eq(StationEntity::getServeType,2);
//wappers.eq(StationEntity::getServeType,2);
if(!StringUtils.isEmpty(stationName)){
wappers.like(StationEntity::getName,stationName);
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
// 设备
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList();
return stations.stream().map(station->{
List<InstalledCapacityVo> capacitys = stations.stream().map(station->{
InstalledCapacityVo item = new InstalledCapacityVo();
item.setStationName(station.getName());
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device->device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
@ -149,6 +149,9 @@ public class TargetServiceImpl implements TargetService {
item.setDetail(String.join("|",details));
return item;
}).filter(capacity->Math.abs(capacity.getInstalledCapacity()) > 0).collect(Collectors.toList());
page.setTotal(capacitys.size());
page.setRecords(capacitys.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -156,26 +159,27 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<ElectricGenerationVo> electricGeneration(String stationName,Integer type) {
public IPage<ElectricGenerationVo> electricGeneration(IPage<ElectricGenerationVo> page,String stationName,Integer type) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, type);
wappers.eq(StationEntity::getServeType,2);
//wappers.eq(StationEntity::getServeType,2);
if(!StringUtils.isEmpty(stationName)){
wappers.like(StationEntity::getName,stationName);
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
List<ElectricGenerationVo> electrics;
// 填报数据
if(HomePageConstant.HYDROPOWER.equals(type)){
// 设备指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if(CollectionUtils.isEmpty(targets)){
return new ArrayList<>();
return page;
}
return stations.stream().map(station->{
electrics = stations.stream().map(station->{
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(device->device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
@ -192,49 +196,52 @@ public class TargetServiceImpl implements TargetService {
item.setDetail(String.join("|",details));
return item;
}).filter(generate->Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList());
}else if(HomePageConstant.PHOTOVOLTAIC.equals(type)){
}else if(HomePageConstant.PHOTOVOLTAIC.equals(type)) {
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key);
if(CollectionUtil.isEmpty(targets)){
return new ArrayList<>();
if (CollectionUtil.isEmpty(targets)) {
return page;
}
return stations.stream().map(station->{
electrics = stations.stream().map(station -> {
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
List<PhotovoltaicTargetVo> stationTargets = targets.stream().filter(device->device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationTargets)){
List<PhotovoltaicTargetVo> stationTargets = targets.stream().filter(device -> device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(stationTargets)) {
item.setElectricGeneration(0.0);
item.setDetail("站点暂无发电");
return item;
}
// 年发电量
double sum = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).mapToDouble(PhotovoltaicTargetVo::getGenerationYear).sum();
double sum = targets.stream().filter(target -> target.getDeptId().equals(station.getRefDept())).mapToDouble(PhotovoltaicTargetVo::getGenerationYear).sum();
item.setElectricGeneration(sum);
// 发电量详情
List<String> details = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).map(target-> "[" + Optional.ofNullable(target.getDeviceCode()).orElse("填报电量") + " " + target.getGenerationYear() +"kWh]").collect(Collectors.toList());
item.setDetail(String.join("|",details));
List<String> details = targets.stream().filter(target -> target.getDeptId().equals(station.getRefDept())).map(target -> "[" + Optional.ofNullable(target.getDeviceCode()).orElse("填报电量") + " " + target.getGenerationYear() + "kWh]").collect(Collectors.toList());
item.setDetail(String.join("|", details));
return item;
}).filter(generate->Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList());
}).filter(generate -> Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList());
}else{
// 查询填报数据
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
);
electrics = stations.stream().map(station -> {
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setElectricGeneration(0.0);
}else{
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
}
item.setDetail("站点为填报数据,暂无设备装机发电量信息!");
return item;
}).collect(Collectors.toList());
}
// 查询填报数据
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
);
return stations.stream().map(station -> {
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setElectricGeneration(0.0);
}else{
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
}
item.setDetail("站点为填报数据,暂无设备装机发电量信息!");
return item;
}).collect(Collectors.toList());
page.setTotal(electrics.size());
page.setRecords(electrics.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -242,27 +249,28 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<CompleteGenerationVo> completeGeneration(String stationName,Integer type) {
public IPage<CompleteGenerationVo> completeGeneration(IPage<CompleteGenerationVo> page,String stationName,Integer type) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, type);
wappers.eq(StationEntity::getServeType,2);
//wappers.eq(StationEntity::getServeType,2);
if(!StringUtils.isEmpty(stationName)){
wappers.like(StationEntity::getName,stationName);
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
List<CompleteGenerationVo> generations;
if(HomePageConstant.HYDROPOWER.equals(type)){
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy"));
// 设备指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if(CollectionUtils.isEmpty(targets)){
return new ArrayList<>();
return page;
}
return stations.stream().map(station->{
generations = stations.stream().map(station->{
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
@ -303,9 +311,9 @@ public class TargetServiceImpl implements TargetService {
// 设备指标数据
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key);
if(CollectionUtils.isEmpty(targets)){
return new ArrayList<>();
return page;
}
return stations.stream().map(station->{
generations = stations.stream().map(station->{
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
List<PhotovoltaicTargetVo> stationTargets = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
@ -336,28 +344,32 @@ public class TargetServiceImpl implements TargetService {
}
return item;
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList());
}else{
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
);
generations = stations.stream().map(station -> {
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setPlanGeneration(0.0);
item.setRealityGeneration(0.0);
item.setCompleteRate(0.0);
}else{
item.setPlanGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPlannedPowerYear());
item.setRealityGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
item.setCompleteRate(Double.valueOf(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerRateYear()));
}
return item;
}).collect(Collectors.toList());
}
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
);
return stations.stream().map(station -> {
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setPlanGeneration(0.0);
item.setRealityGeneration(0.0);
item.setCompleteRate(0.0);
}else{
item.setPlanGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPlannedPowerYear());
item.setRealityGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
item.setCompleteRate(Double.valueOf(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerRateYear()));
}
return item;
}).collect(Collectors.toList());
page.setTotal(generations.size());
page.setRecords(generations.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -365,10 +377,13 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<CompleteTicketVo> completeTicket(String areaName,Integer type) {
public IPage<CompleteTicketVo> completeTicket(IPage<CompleteTicketVo> page,String areaName,Integer type) {
// 光伏/风电双票填报数据
if(HomePageConstant.WIND_POWER.equals(type) || HomePageConstant.PHOTOVOLTAIC.equals(type)){
return this.getcompleteFillTicket(areaName,type);
List<CompleteTicketVo> completes = this.getcompleteFillTicket(areaName,type);
page.setTotal(completes.size());
page.setRecords(completes.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
// 平台业务数据
List<Integer> types;
@ -379,7 +394,7 @@ public class TargetServiceImpl implements TargetService {
}
List<Dept> areas = this.areas(types);
if(CollectionUtils.isEmpty(areas)){
return new ArrayList<>();
return page;
}
// 开始时间
LocalDate firstDay = LocalDate.now().withDayOfYear(1);
@ -388,26 +403,46 @@ public class TargetServiceImpl implements TargetService {
ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(areas.size(), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
//监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(areas.size());
List<CompleteTicketVo> completeTickets = new ArrayList<>();
List<CompleteTicketVo> completes = new ArrayList<>();
exe.execute(()-> {
for (Dept dept: areas) {
// 双票
DoublePassRateVO doublePass = ticketInfoAllClient.getDoublePassRate(Collections.singletonList(dept.getId()), firstDateTime, LocalDateTime.now());
CompleteTicketVo completeTicketVo = new CompleteTicketVo();
if (ObjectUtil.isEmpty(doublePass)) {
completeTicketVo.setAreaName(dept.getDeptName());
completeTicketVo.setTicketCount("0");
completeTicketVo.setCompleteCount("0");
completeTicketVo.setCompleteRate("0.0");
} else {
completeTicketVo.setAreaName(dept.getDeptName());
completeTicketVo.setTicketCount(doublePass.getDoubleTicketCount().toString());
completeTicketVo.setCompleteCount(doublePass.getDoubleTicketPassCount().toString());
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate());
if(!StringUtil.isEmpty(areaName)){
for (Dept dept: areas.stream().filter(area->area.getDeptName().equals(areaName)).collect(Collectors.toList())) {
// 双票
DoublePassRateVO doublePass = ticketInfoAllClient.getDoublePassRate(Collections.singletonList(dept.getId()), firstDateTime, LocalDateTime.now());
CompleteTicketVo completeTicketVo = new CompleteTicketVo();
if (ObjectUtil.isEmpty(doublePass)) {
completeTicketVo.setAreaName(dept.getDeptName());
completeTicketVo.setTicketCount("0");
completeTicketVo.setCompleteCount("0");
completeTicketVo.setCompleteRate("0.0");
} else {
completeTicketVo.setAreaName(dept.getDeptName());
completeTicketVo.setTicketCount(doublePass.getDoubleTicketCount().toString());
completeTicketVo.setCompleteCount(doublePass.getDoubleTicketPassCount().toString());
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate());
}
completes.add(completeTicketVo);
}
}else{
for (Dept dept: areas) {
// 双票
DoublePassRateVO doublePass = ticketInfoAllClient.getDoublePassRate(Collections.singletonList(dept.getId()), firstDateTime, LocalDateTime.now());
CompleteTicketVo completeTicketVo = new CompleteTicketVo();
if (ObjectUtil.isEmpty(doublePass)) {
completeTicketVo.setAreaName(dept.getDeptName());
completeTicketVo.setTicketCount("0");
completeTicketVo.setCompleteCount("0");
completeTicketVo.setCompleteRate("0.0");
} else {
completeTicketVo.setAreaName(dept.getDeptName());
completeTicketVo.setTicketCount(doublePass.getDoubleTicketCount().toString());
completeTicketVo.setCompleteCount(doublePass.getDoubleTicketPassCount().toString());
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate());
}
completes.add(completeTicketVo);
}
completeTickets.add(completeTicketVo);
countDownLatch.countDown();
}
countDownLatch.countDown();
});
// 等待所有线程执行完成
try {
@ -417,7 +452,9 @@ public class TargetServiceImpl implements TargetService {
Thread.currentThread().interrupt();
}
exe.shutdown();
return completeTickets.stream().filter(complete->Math.abs(Integer.parseInt(complete.getTicketCount())) > 0 || Math.abs(Integer.parseInt(complete.getCompleteCount())) > 0).collect(Collectors.toList());
page.setTotal(completes.size());
page.setRecords(completes.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -454,7 +491,7 @@ public class TargetServiceImpl implements TargetService {
private List<CompleteTicketVo> getcompleteFillTicket(String stationName, Integer type) {
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType, type)
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
//.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.like(StationEntity::getName,stationName));
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
@ -488,19 +525,20 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<CompleteDefectVo> defect(String areaName, Integer type) {
public IPage<CompleteDefectVo> defect(IPage<CompleteDefectVo> page,String areaName, Integer type) {
if(HomePageConstant.DISTRIBUTION_NETWORK.equals(type)){
return this.getFillDefect(areaName,type);
List<CompleteDefectVo> defects = this.getFillDefect(areaName,type);
page.setTotal(defects.size());
page.setRecords(defects.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
}
// 获取区域机构
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE);
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(MapUtils.isEmpty(areas)){
return new ArrayList<>();
return page;
}
List<Dept> depts = areas.keySet().stream().filter(dept -> StringUtils.isEmpty(areaName) || dept.getDeptName().contains(areaName)).collect(Collectors.toList());
if(CollectionUtils.isEmpty(depts)){
return new ArrayList<>();
return page;
}
String startTime = this.getFristDayByYear();
String endTime = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
@ -534,7 +572,9 @@ public class TargetServiceImpl implements TargetService {
Thread.currentThread().interrupt();
}
exe.shutdown();
return completeDefects;
page.setTotal(completeDefects.size());
page.setRecords(completeDefects.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
@ -545,7 +585,7 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<ExamineCardVo> examineCard(String stationName, Integer type) {
public IPage<ExamineCardVo> examineCard(IPage<ExamineCardVo> page,String stationName, Integer type) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, type);
@ -555,7 +595,7 @@ public class TargetServiceImpl implements TargetService {
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
// 查询检修卡
String startTime = this.getFristDayByYear();
@ -566,19 +606,22 @@ public class TargetServiceImpl implements TargetService {
.le(OverEntity::getCreateTime,endTime)
);
if(CollectionUtils.isEmpty(overs)){
return new ArrayList<>();
return page;
}
List<OverDetailsEntity> overDetails = overDetailsService.list(Wrappers.<OverDetailsEntity>lambdaQuery()
.in(OverDetailsEntity::getOverId,overs.stream().map(OverEntity::getId).collect(Collectors.toList()))
);
return overs.stream().collect(Collectors.groupingBy(OverEntity::getCreateDept)).entrySet().stream().map(entry->{
List<ExamineCardVo> cards = overs.stream().collect(Collectors.groupingBy(OverEntity::getCreateDept)).entrySet().stream().map(entry->{
ExamineCardVo examineCard = new ExamineCardVo();
examineCard.setStationName(stations.stream().filter(station -> station.getRefDept().equals(entry.getKey())).collect(Collectors.toList()).get(0).getName());
examineCard.setCardTotal(entry.getValue().stream().mapToDouble(over-> Double.parseDouble(over.getTotalPrice().toString())).sum());
examineCard.setCardCount(overDetails.stream().filter(detail-> entry.getValue().stream().map(OverEntity::getId).collect(Collectors.toList()).contains(detail.getOverId())).mapToInt(OverDetailsEntity::getQuantity).sum());
return examineCard;
}).collect(Collectors.toList());
page.setTotal(cards.size());
page.setRecords(cards.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -589,7 +632,7 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<CompleteOtherVo> completeOther(String stationName, Integer type, Integer queryType) {
public IPage<CompleteOtherVo> completeOther(IPage<CompleteOtherVo> page,String stationName, Integer type, Integer queryType) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, type);
@ -599,7 +642,7 @@ public class TargetServiceImpl implements TargetService {
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
// 查询设备在线率/Fa投入条数
String startTime = this.getFristDayByYear();
@ -610,9 +653,9 @@ public class TargetServiceImpl implements TargetService {
.le(OtherEntity::getCreateTime,endTime)
);
if(CollectionUtils.isEmpty(others)){
return new ArrayList<>();
return page;
}
return others.stream().collect(Collectors.groupingBy(OtherEntity::getCreateDept)).entrySet().stream().map(entry -> {
List<CompleteOtherVo> records = others.stream().collect(Collectors.groupingBy(OtherEntity::getCreateDept)).entrySet().stream().map(entry -> {
CompleteOtherVo other = new CompleteOtherVo();
other.setStationName(stations.stream().filter(station -> station.getRefDept().equals(entry.getKey())).collect(Collectors.toList()).get(0).getName());
if(CensusConstant.QUERY_TYPE_DEFAULT.equals(queryType)){
@ -622,6 +665,9 @@ public class TargetServiceImpl implements TargetService {
}
return other;
}).collect(Collectors.toList());
page.setTotal(records.size());
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -678,12 +724,12 @@ public class TargetServiceImpl implements TargetService {
@Override
public R<IPage<OperMaintenanceTaskVO>> routineMaintenance(OperMaintenanceTaskDTO params, Query query, Integer type) {
// 获取区域机构
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE);
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(MapUtils.isEmpty(areas)){
return null;
}
// 查询日常维护任务
params.setDeptIds(areas.entrySet().stream().map(entry->entry.getKey().getId()).collect(Collectors.toList()));
params.setDeptIds(areas.keySet().stream().map(Dept::getId).collect(Collectors.toList()));
return maintenanceTaskService.list(params,query);
}
@ -697,12 +743,12 @@ public class TargetServiceImpl implements TargetService {
@Override
public R<IPage<OperAccessTaskVO>> examineRepair(OperAccessTaskDTO params, Query query, Integer type) {
// 获取区域机构
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE);
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(MapUtils.isEmpty(areas)){
return null;
}
// 查询检修任务
params.setDeptIds(areas.keySet().stream().map(key-> key.getId()).collect(Collectors.toList()));
params.setDeptIds(areas.keySet().stream().map(Dept::getId).collect(Collectors.toList()));
return accessTaskService.list(params,query);
}
@ -713,7 +759,7 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<DeviceClassifyVo> deviceClassify(String stationName, Long deptId,Integer status) {
public IPage<DeviceClassifyVo> deviceClassify(IPage<DeviceClassifyVo> page,String stationName, Long deptId,Integer status) {
// 获取区域设备统计
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_key);
List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT);
@ -722,21 +768,21 @@ public class TargetServiceImpl implements TargetService {
//根据用户权限获取机构
R<List<Dept>> result = sysClient.getDeptByCurrentUser();
if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData())) {
return new ArrayList<>();
return page;
}
// 站点
List<StationEntity> stations = stationService.getStationList(result.getData(),deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stations = stationService.getStationList(result.getData(),deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
List<Long> detpIds = stations.stream().filter(o-> StringUtils.isEmpty(stationName) || o.getName().contains(stationName)).map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtils.isEmpty(detpIds)){
return new ArrayList<>();
return page;
}
// 设备
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList();
if(CollectionUtils.isEmpty(devices)){
return new ArrayList<>();
return page;
}
// 获取设备集合
List<DeviceClassifyVo> deviceClassifys = devices.stream().filter(device->detpIds.contains(device.getCreateDept())).sorted(Comparator.comparing(EminfoAndEmParamVo::getCreateDept)).map(device -> {
@ -754,11 +800,16 @@ public class TargetServiceImpl implements TargetService {
}
return deviceClassify;
}).filter(deviceClass -> StringUtils.isEmpty(stationName) || deviceClass.getStationName().contains(stationName)).collect(Collectors.toList());
List<DeviceClassifyVo> records = new ArrayList<>();
// 状态过滤
if(ObjectUtil.isEmpty(status)){
return deviceClassifys.stream().sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList());
records = deviceClassifys.stream().sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList());
}else{
records = deviceClassifys.stream().filter(o->o.getDeviceStatus().equals(status)).sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList());
}
return deviceClassifys.stream().filter(o->o.getDeviceStatus().equals(status)).sorted(Comparator.comparing(DeviceClassifyVo::getDeviceStatus)).collect(Collectors.toList());
page.setTotal(records.size());
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -768,7 +819,7 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<HydropowerTargetVo> hydropowerTarget(String stationName, Long deptId,Integer target) {
public IPage<HydropowerTargetVo> hydropowerTarget(IPage<HydropowerTargetVo> page,String stationName, Long deptId,Integer target) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, HomePageConstant.HYDROPOWER);
@ -781,13 +832,13 @@ public class TargetServiceImpl implements TargetService {
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
// 功率
if(HomePageConstant.POWER.equals(target)){
// 实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
return stations.stream().map(station->{
List<HydropowerTargetVo> records = stations.stream().map(station->{
HydropowerTargetVo hydropower = new HydropowerTargetVo();
hydropower.setStationName(station.getName());
if(CollectionUtil.isEmpty(reals)){
@ -797,11 +848,14 @@ public class TargetServiceImpl implements TargetService {
}
return hydropower;
})/*.filter(hydropower -> Math.abs(hydropower.getPower()) > 0)*/.sorted(Comparator.comparing(HydropowerTargetVo::getPower).reversed()).collect(Collectors.toList());
page.setTotal(records.size());
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
// 指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
// 发电量
return stations.stream().map(station->{
List<HydropowerTargetVo> records = stations.stream().map(station->{
HydropowerTargetVo hydropowerTarget = new HydropowerTargetVo();
hydropowerTarget.setStationName(station.getName());
if(CollectionUtils.isEmpty(targets)){
@ -823,6 +877,9 @@ public class TargetServiceImpl implements TargetService {
}
return hydropowerTarget;
})/*.filter(hydropower -> Math.abs(hydropower.getElectric()) > 0)*/.sorted(Comparator.comparing(HydropowerTargetVo::getElectric).reversed()).collect(Collectors.toList());
page.setTotal(records.size());
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -832,7 +889,7 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<WaterTargetVo> waterTarget(String stationName, Long deptId,Integer target) {
public IPage<WaterTargetVo> waterTarget(IPage<WaterTargetVo> page,String stationName, Long deptId,Integer target) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.in(StationEntity::getType, HomePageConstant.waterList);
@ -846,12 +903,12 @@ public class TargetServiceImpl implements TargetService {
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
// 负荷
if(HomePageConstant.LOADING.equals(target)){
List<WaterPumpRealVo> pumps = (List<WaterPumpRealVo>) redisTemplate.opsForValue().get(load_waterpump_real_key);
return stations.stream().map(station->{
List<WaterTargetVo> records = stations.stream().map(station->{
WaterTargetVo water = new WaterTargetVo();
water.setStationName(station.getName());
if(CollectionUtil.isEmpty(pumps)){
@ -862,10 +919,13 @@ public class TargetServiceImpl implements TargetService {
water.setLoad(Optional.ofNullable(use).orElse(0.0));
return water;
})/*.filter(water -> Math.abs(water.getLoad()) > 0)*/.sorted(Comparator.comparing(WaterTargetVo::getLoad).reversed()).collect(Collectors.toList());
page.setTotal(records.size());
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
// 用电量
List<WaterPumpTargetVo> targets = (List<WaterPumpTargetVo>) redisTemplate.opsForValue().get(load_waterpump_target_key);
return stations.stream().map(station->{
List<WaterTargetVo> records = stations.stream().map(station->{
WaterTargetVo water = new WaterTargetVo();
water.setStationName(station.getName());
if(CollectionUtil.isEmpty(targets)){
@ -887,10 +947,13 @@ public class TargetServiceImpl implements TargetService {
}
return water;
})/*.filter(water -> Math.abs(water.getUse()) > 0)*/.sorted(Comparator.comparing(WaterTargetVo::getUse).reversed()).collect(Collectors.toList());
page.setTotal(records.size());
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
@Override
public List<PhotovoTargetVo> photovoltaicTarget(String stationName, Long deptId, Integer target) {
public IPage<PhotovoTargetVo> photovoltaicTarget(IPage<PhotovoTargetVo> page,String stationName, Long deptId, Integer target) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, HomePageConstant.PHOTOVOLTAIC);
@ -904,13 +967,13 @@ public class TargetServiceImpl implements TargetService {
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
// 负荷
if(HomePageConstant.LOADING.equals(target)){
// 实时数据
List<PhotovoltaicRealVo> reals = (List<PhotovoltaicRealVo>) redisTemplate.opsForValue().get(load_photovoltaic_real_key);
return stations.stream().map(station->{
List<PhotovoTargetVo> records = stations.stream().map(station->{
PhotovoTargetVo photovo = new PhotovoTargetVo();
photovo.setStationName(station.getName());
if(CollectionUtil.isEmpty(reals)){
@ -920,10 +983,13 @@ public class TargetServiceImpl implements TargetService {
}
return photovo;
})/*.filter(photovoltaic -> Math.abs(photovoltaic.getLoad()) > 0)*/.sorted(Comparator.comparing(PhotovoTargetVo::getLoad).reversed()).collect(Collectors.toList());
page.setTotal(records.size());
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
// 发电量
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key);
return stations.stream().map(station->{
List<PhotovoTargetVo> records = stations.stream().map(station->{
PhotovoTargetVo photovo = new PhotovoTargetVo();
photovo.setStationName(station.getName());
if(CollectionUtil.isEmpty(targets)){
@ -945,61 +1011,9 @@ public class TargetServiceImpl implements TargetService {
}
return photovo;
})/*.filter(photovo -> Math.abs(photovo.getGenerate()) > 0)*/.sorted(Comparator.comparing(PhotovoTargetVo::getGenerate).reversed()).collect(Collectors.toList());
}
/**
* 集团设备统计
* @param areaName
* @return
*/
@Override
public List<DeviceGroupVo> deviceGroup(String areaName) {
// 获取区域机构
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE);
if(MapUtils.isEmpty(areas)){
return null;
}
// 获取设备
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList();
// 获取设备状态
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_key);
List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT);
List<String> overhaultList = deviceClassifyMap.get(HomePageConstant.OVERHAUL);
List<String> runtList = deviceClassifyMap.get(HomePageConstant.RUN);
return areas.entrySet().stream().map(entry->{
DeviceGroupVo group = new DeviceGroupVo();
group.setDeptId(entry.getKey().getId());
group.setAreaName(entry.getKey().getDeptName());
if(CollectionUtils.isEmpty(devices)){
group.setFaultCount(0L);
group.setOverhaultCount(0L);
group.setRunCount(0L);
group.setReserveCount(0L);
return group;
}
List<String> numbers = devices.stream().filter(device-> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(device.getCreateDept())).map(EminfoAndEmParamVo::getEmCode).collect(Collectors.toList());
// 故障
if(CollectionUtils.isEmpty(faultList)){
group.setFaultCount(0L);
}else{
group.setFaultCount(numbers.stream().filter(number -> faultList.contains(number)).count());
}
// 检修
if(CollectionUtils.isEmpty(overhaultList)){
group.setFaultCount(0L);
}else{
group.setFaultCount(numbers.stream().filter(number -> overhaultList.contains(number)).count());
}
// 运行
if(CollectionUtils.isEmpty(runtList)){
group.setFaultCount(0L);
}else{
group.setFaultCount(numbers.stream().filter(number -> runtList.contains(number)).count());
}
// 备用
group.setReserveCount(numbers.size() - group.getFaultCount() - group.getOverhaultCount() - group.getRunCount());
return group;
}).collect(Collectors.toList());
page.setTotal(records.size());
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -1009,15 +1023,15 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<DutyGroupVo> dutyGroup(String areaName, Long type) {
public IPage<DutyGroupVo> dutyGroup(IPage<DutyGroupVo> page,String areaName, Long type) {
// 获取区域机构
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE);
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(MapUtils.isEmpty(areas)){
return null;
return page;
}
// redis中取区域数据
List<AreaDutyVo> areaDutyVoList = (List<AreaDutyVo>) redisTemplate.opsForValue().get(areaDutyInfoKey);
return areas.keySet().stream().filter(stationEntities -> StringUtil.isEmpty(areaName) || stationEntities.getDeptName().contains(areaName)).map(stationEntities -> {
List<DutyGroupVo> records = areas.keySet().stream().filter(stationEntities -> StringUtil.isEmpty(areaName) || stationEntities.getDeptName().contains(areaName)).map(stationEntities -> {
DutyGroupVo duty = new DutyGroupVo();
duty.setDeptId(stationEntities.getId());
duty.setAreaName(stationEntities.getDeptName());
@ -1043,6 +1057,9 @@ public class TargetServiceImpl implements TargetService {
}
return duty;
}).collect(Collectors.toList());
page.setTotal(records.size());
page.setRecords(records.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**

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

@ -64,7 +64,7 @@ public class CentralMonitorServiceImpl implements CentralMonitorService {
return null;
}
List<Long> deptIdList = R.getData().stream().map(Dept::getId).collect(Collectors.toList());
List<StationEntity> list = stationService.getStationType(null, Collections.singletonList(HomePageConstant.HYDROPOWER), deptIdList);
List<StationEntity> list = stationService.getStationType(null, Collections.singletonList(HomePageConstant.HYDROPOWER), deptIdList,true);
if (CollectionUtil.isEmpty(list)) {
return null;
}

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

@ -61,7 +61,7 @@ public class HzimsDataServiceImpl implements HzimsDataService {
throw new ServiceException("暂无区域数据!");
}
List<Integer> types = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE);
Map<Dept, List<StationEntity>> map = areaService.getAuthArea(result.getData(), null, types, HomePageConstant.HYDROPOWER_SERVETYPE);
Map<Dept, List<StationEntity>> map = areaService.getAuthArea(result.getData(), null, types, HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (MapUtils.isEmpty(map)) {
throw new ServiceException("暂无区域数据!");

63
hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/QdnHomeController.java

@ -0,0 +1,63 @@
package com.hnac.hzims.operational.ecology.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.main.service.HomeService;
import com.hnac.hzims.operational.main.service.HydropowerService;
import com.hnac.hzims.operational.main.service.ISideHustleService;
import com.hnac.hzims.operational.main.vo.HydropowerScoreVo;
import com.hnac.hzims.operational.main.vo.MapMarkerVo;
import com.hnac.hzims.operational.main.vo.StationCountVo;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author ysj
*/
@Api(tags = {"黔东南首页"})
@RestController
@AllArgsConstructor
@RequestMapping("/QDN")
public class QdnHomeController extends BladeController {
private final HomeService homeService;
private final ISideHustleService regionService;
private final HydropowerService hydropowerService;
@ApiLog
@ApiOperation("首页站点数量")
@GetMapping("/count")
@ApiOperationSupport(order = 1)
public R<List<StationCountVo>> count() {
return R.data(homeService.count(false));
}
@ApiLog
@ApiOperation("水电站集团/区域指标")
@GetMapping("/KPIs")
@ApiOperationSupport(order = 1)
public R<HydropowerScoreVo> KPIs(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(hydropowerService.KPIs(deptId,false));
}
@ApiLog
@ApiOperation("获取地图标记")
@GetMapping("/getMapMarker")
@ApiOperationSupport(order = 6)
public R<List<MapMarkerVo>> getMapMarker(@ApiParam(value = "区域机构ID") Long deptId, @RequestParam(value ="types") List<Integer> types) {
return R.data(regionService.getMapMarker(deptId,types,false));
}
}

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java

@ -19,6 +19,7 @@ import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -42,7 +43,6 @@ public class AreaMonthReportController extends BladeController {
@NotNull
private final IAreaMonthReportService service;
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key";
@ApiLog
@ApiOperationSupport(order = 1)
@ -126,13 +126,17 @@ public class AreaMonthReportController extends BladeController {
@ApiParam(value = "站点Id", required = true) Long deptId,@ApiParam(value = "月报类型", required = true) Long type) {
HashMap<String, Object> map = new HashMap<>();
if (Func.isEmpty(year)||Func.isEmpty(deptId)||Func.isEmpty(month)||year==0||deptId==0||month==0){
return R.fail("传入格式不对,请重新导出");
}
String deptName="";
if (type==1){
service.exportHydropowerStationMonthReport(response, map,year,month,deptId);
service.exportHydropowerStationMonthReport(response, map,year,month,deptId,deptName);
//word模板相对路径、word生成路径、word生成的文件名称、数据源
}
XWPFDocument xwpfDocument = WordUtils.exportWordV2("template/waterMonReport.docx", map);
// 下载导出
String filename = "(" + year+"年"+month+"月"+ ")水电站月报";
String filename = "(" + year+"年"+month+"月"+ ")"+deptName+"水电站月报";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java

@ -33,7 +33,7 @@ public class HomeController extends BladeController {
@GetMapping("/count")
@ApiOperationSupport(order = 1)
public R<List<StationCountVo>> count() {
return R.data(service.count());
return R.data(service.count(true));
}
@ApiLog

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java

@ -33,7 +33,7 @@ public class HydropowerController extends BladeController {
@GetMapping("/KPIs")
@ApiOperationSupport(order = 1)
public R<HydropowerScoreVo> KPIs(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(service.KPIs(deptId));
return R.data(service.KPIs(deptId,true));
}
@ApiLog

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java

@ -74,7 +74,7 @@ public class SideHustleController extends BladeController {
@GetMapping("/getMapMarker")
@ApiOperationSupport(order = 6)
public R<List<MapMarkerVo>> getMapMarker(@ApiParam(value = "区域机构ID") Long deptId,@RequestParam(value ="types") List<Integer> types) {
return R.data(regionService.getMapMarker(deptId,types));
return R.data(regionService.getMapMarker(deptId,types,true));
}
@ApiLog

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaService.java

@ -12,8 +12,8 @@ import java.util.Map;
public interface AreaService {
// 获取权限区域
Map<Dept, List<StationEntity>> getAuthArea(List<Dept> list,Long deptId,List<Integer> typeList,Integer serveType);
Map<Dept, List<StationEntity>> getAuthArea(List<Dept> list,Long deptId,List<Integer> typeList,Integer serveType,boolean make);
// 获取用户权限区域
Map<Dept, List<StationEntity>> areaOrStaion(Long deptId, List<Integer> types);
Map<Dept, List<StationEntity>> areaOrStaion(Long deptId, List<Integer> types,boolean make);
}

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

@ -13,7 +13,7 @@ public interface HomeService {
void loadHomeTarget(String param);
List<StationCountVo> count();
List<StationCountVo> count(boolean make);
List<TargetVo> target(Integer type);

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

@ -22,7 +22,7 @@ public interface HydropowerService {
List<HydropowerStationVo> webStationList(Long deptId);
HydropowerScoreVo KPIs(Long deptId);
HydropowerScoreVo KPIs(Long deptId,boolean make);
List<AreaScaleVo> proportion(Long deptId);

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

@ -18,5 +18,5 @@ public interface IAreaMonthReportService {
R export(HttpServletResponse response, String date);
R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month,Long deptId);
R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month,Long deptId,String name);
}

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

@ -26,7 +26,7 @@ public interface ISideHustleService {
List<OldAreaScaleVo> areaScale(Long deptId);
List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types);
List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types,boolean make);
List<PlanGenerationEntity> getStaionPlanPower(Map<Dept, List<StationEntity>> map);
}

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java

@ -119,7 +119,7 @@ public class AppHomeServiceImpl implements IAppHomeService {
return null;
}
// 站点列表
List<StationEntity> list = stationService.getStationList(R.getData(),deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),null);
List<StationEntity> list = stationService.getStationList(R.getData(),deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),null,true);
if(CollectionUtil.isEmpty(list)){
return null;
}
@ -351,7 +351,7 @@ public class AppHomeServiceImpl implements IAppHomeService {
@Override
public List<AppStationAreaVo> appStationList(Long deptId) {
// 获取区域或者站点map结构
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER));
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),true);
if(MapUtils.isEmpty(map)){
return null;
}

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

@ -48,6 +48,7 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.jfree.data.category.DefaultCategoryDataset;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
@ -81,6 +82,7 @@ import java.util.stream.Collectors;
/**
* 区域月报实现类
* @author ysj
*/
@Service
@RequiredArgsConstructor
@ -185,7 +187,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
ServletOutputStream outputStream = null;
ServletOutputStream outputStream;
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8"));
@ -202,9 +204,9 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
return R.data("success");
}
@Override
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId) {
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId,String name) {
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()!=null){
if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()==null){
return R.fail("用户权限查询失败");
}
R<String> deptNameR = sysClient.getDeptName(deptId);
@ -212,26 +214,32 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
return R.fail("暂无该机构");
}
String deptName = deptNameR.getData();
// 赋值给导出表格名称
name=deptName;
R<List<Dept>> deptR = sysClient.getDeptByType("200000", deptId, 4);
if (!deptR.isSuccess() || deptR.getData() == null) {
return R.fail("该机构不包含水站信息");
}
List<Dept> deptList = deptR.getData().stream().filter(s -> s.getStationId() != null).collect(Collectors.toList());
if (deptList == null) {
return R.fail("该机构不包含水站信息");
}
List<Long> deptByUser = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList());
List<Long> deptByUser = deptByCurrentUser.getData().stream().map(Dept::getId).collect(Collectors.toList());
if (!deptByUser.contains(deptId)){
return R.fail("该用户不包含该机构权限,请申请权限再试");
}
List<Long> deptIds = deptList.stream().map(s -> s.getId()).collect(Collectors.toList());
List<Long> deptIds = deptList.stream().map(Dept::getId).collect(Collectors.toList());
List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.in(StationEntity::getRefDept, deptIds)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER));
Integer commissionTime = stationEntityList.stream().map(s -> {
Duration dur = Duration.between(s.getCommissionTime(), LocalDateTime.now());
return (int) dur.toDays();}).reduce(Integer::max).get();
List<Long> stationIds = stationEntityList.stream().map(s -> s.getId()).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(stationEntityList)) {
Integer commissionTime = stationEntityList.stream().map(s -> {
Duration dur = Duration.between(s.getCommissionTime(), LocalDateTime.now());
return (int) dur.toDays();
}).reduce(Integer::max).get();
map.put("commissionTime", commissionTime.toString());
}else {
map.put("commissionTime", 0);
}
List<Long> stationIds = Optional.ofNullable(stationEntityList)
.orElse(new ArrayList<>()).stream().map(BaseEntity::getId).collect(Collectors.toList());
//其它普通数据
map.put("year", year);
Integer yearBefore = year - 1;
@ -240,7 +248,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
Integer monthBefore = month - 1;
map.put("monthBefore", monthBefore);
// map.put("date", date);
map.put("commissionTime", commissionTime.toString());
map.put("stationName", deptName);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
map.put("writeTime", simpleDateFormat.format(new Date()));
@ -295,7 +303,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
//装机容量占比图
ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 500, 400);
map.put("capacityProportionChart", capacityProportionChart);
//各发电站发电量环比图+表格数据组装
//各发电站发电量环比图+表格数据组装
List<MonPowerPercentageVo> powerPercentageVoList = getMonPowerPercentageVos(year, month, deptList, deptIds, stationEntityList, stationIds, yearBefore, monthBefore);
// getPowerData(deptList, yearStart, yearEnd, yearBeforeStart, yearBeforeEnd, monthStart, monthEnd, beforeMonthStart, beforeMonthEnd, monthStartBeforeYear, monthEndBeforeYear, devices, planYearData, powerPercentageVoList);
// 各发电站发电量环比图数据组装
@ -312,38 +320,34 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ImageEntity powerChainHistogram = JFreeUtil.iCreateBarChart(powerTitle, powerDomainAxis, powerRangeAxis, powerDataset, 500, 400);
map.put("powerChainHistogram", powerChainHistogram);
//柱状图下添加的表格
if (powerPercentageVoList != null) {
ArrayList<HashMap<String, String>> powerMap = new ArrayList<>(powerPercentageVoList.size());
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) {
HashMap<String, String> power = new HashMap<>();
power.put("name", monPowerPercentageVo.getDeptName());
power.put("monthBefore", monPowerPercentageVo.getPowerMonBefore()+"MW");
power.put("month",monPowerPercentageVo.getPowerMon()+"MW");
powerMap.add(power);
}
map.put("power", powerMap);
ArrayList<HashMap<String, String>> powerMap = new ArrayList<>(powerPercentageVoList.size());
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) {
HashMap<String, String> power = new HashMap<>();
power.put("name", monPowerPercentageVo.getDeptName());
power.put("monthBefore", monPowerPercentageVo.getPowerMonBefore()+"MW");
power.put("month",monPowerPercentageVo.getPowerMon()+"MW");
powerMap.add(power);
}
map.put("power", powerMap);
//表格总计
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null, Arrays.asList(deptId.toString()), year.toString());
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, Arrays.asList(deptId.toString()), year + "-" + month);
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null, Collections.singletonList(deptId.toString()), year.toString());
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, Collections.singletonList(deptId.toString()), year + "-" + month);
getTabelSum(deptId, powerPercentageVoList, planYearAll, planMonAll, map);
//发电情况统计表数据
if (powerPercentageVoList != null) {
ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size());
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) {
HashMap<String, String> temp = new HashMap<>(8);
temp.put("name", monPowerPercentageVo.getDeptName());
temp.put("powerMonBefore", String.valueOf(monPowerPercentageVo.getPowerMonYearBefore()));
temp.put("powerYearBefore", String.valueOf(monPowerPercentageVo.getPowerYearBefore()));
temp.put("mon", String.valueOf(monPowerPercentageVo.getPowerMon()));
temp.put("year", String.valueOf(monPowerPercentageVo.getPowerYear()));
temp.put("monPercentage", monPowerPercentageVo.getPowerMonPercentage() * 100 + "%");
temp.put("yearPercentage", monPowerPercentageVo.getPowerYearPercentage() * 100 + "%");
temp.put("plan", monPowerPercentageVo.getPlanPercentage() * 100 + "%");
list.add(temp);
}
map.put("powerGeneration", list);
ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size());
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) {
HashMap<String, String> temp = new HashMap<>(8);
temp.put("name", monPowerPercentageVo.getDeptName());
temp.put("powerMonBefore", String.valueOf(monPowerPercentageVo.getPowerMonYearBefore()));
temp.put("powerYearBefore", String.valueOf(monPowerPercentageVo.getPowerYearBefore()));
temp.put("mon", String.valueOf(monPowerPercentageVo.getPowerMon()));
temp.put("year", String.valueOf(monPowerPercentageVo.getPowerYear()));
temp.put("monPercentage", monPowerPercentageVo.getPowerMonPercentage() * 100 + "%");
temp.put("yearPercentage", monPowerPercentageVo.getPowerYearPercentage() * 100 + "%");
temp.put("plan", monPowerPercentageVo.getPlanPercentage() * 100 + "%");
list.add(temp);
}
map.put("powerGeneration", list);
//本月缺陷
@ -355,11 +359,10 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
wrapper.in(OperPhenomenonEntity::getCreateDept, deptIds);
List<OperPhenomenonEntity> monPhenomenonList = operPhenomenonService.list(wrapper);
monPhenomenonList = monPhenomenonList.stream().filter(s -> s.getDefectLevel() != null).collect(Collectors.toList());
List<OperPhenomenonEntity> monConclusionList = monPhenomenonList.stream().filter(s -> s.getConclusionStatus().equals("1")).collect(Collectors.toList());
List<OperPhenomenonEntity> monConclusionList = monPhenomenonList.stream().filter(s -> "1".equals(s.getConclusionStatus())).collect(Collectors.toList());
// 只填写二类及以上缺陷
List<OperPhenomenonEntity> monConclusionListBy = monConclusionList.stream().filter(s -> !s.getDefectGrading().equals("1")).collect(Collectors.toList());
List<OperPhenomenonEntity> monConclusionListBy = monConclusionList.stream().filter(s -> !"1".equals(s.getDefectGrading())).sorted(Comparator.comparing(OperPhenomenonEntity::getCreateDept).reversed().thenComparing(OperPhenomenonEntity::getDefectGrading)).collect(Collectors.toList());
// 各电站缺陷处理统计表
monConclusionListBy.stream().sorted(Comparator.comparing(OperPhenomenonEntity::getCreateDept).reversed().thenComparing(OperPhenomenonEntity::getDefectGrading));
ArrayList<HashMap<String, String>> checkList = new ArrayList<>();
for (OperPhenomenonEntity operPhenomenonEntity : monConclusionListBy) {
Long createDept = operPhenomenonEntity.getCreateDept();
@ -371,13 +374,13 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
HashMap<String, String> temp = new HashMap<>();
temp.put("name", createDeptName.getData());
String checkLevel="";
if(operPhenomenonEntity.getDefectGrading().equals("1")) {
if("1".equals(operPhenomenonEntity.getDefectGrading())) {
checkLevel="Ⅰ级缺陷";
}
if(operPhenomenonEntity.getDefectGrading().equals("2") ){
if("2".equals(operPhenomenonEntity.getDefectGrading()) ){
checkLevel="Ⅱ级缺陷";
}
if(operPhenomenonEntity.getDefectGrading().equals("3") ){
if("3".equals(operPhenomenonEntity.getDefectGrading()) ){
checkLevel="Ⅲ级缺陷";
}
temp.put("level", checkLevel);
@ -390,7 +393,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
checkList.add(temp);
}
map.put("checkList", checkList);
//各电站缺陷统计表
//各电站缺陷统计表
//本年缺陷
LambdaQueryWrapper<OperPhenomenonEntity> wrapperYear = Wrappers.lambdaQuery();
wrapperYear.ge(OperPhenomenonEntity::getCreateTime, yearStart);
@ -400,7 +403,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
wrapperYear.in(OperPhenomenonEntity::getCreateDept, deptIds);
List<OperPhenomenonEntity> yearPhenomenonEntities = operPhenomenonService.list(wrapperYear);
yearPhenomenonEntities = yearPhenomenonEntities.stream().filter(s -> StringUtil.isNotBlank(s.getDefectGrading())).filter(s -> ObjectUtil.isNotEmpty(s.getCreateDept())).collect(Collectors.toList());
List<OperPhenomenonEntity> yearConclusionList = yearPhenomenonEntities.stream().filter(s -> s.getConclusionStatus().equals("1")).collect(Collectors.toList());
List<OperPhenomenonEntity> yearConclusionList = yearPhenomenonEntities.stream().filter(s -> "1".equals(s.getConclusionStatus())).collect(Collectors.toList());
ArrayList<HashMap<String, String>> checkStatistics = new ArrayList<>();
List<CheckChartVo> checkChartRes = new ArrayList<>();
@ -423,14 +426,14 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
for (Map.Entry<Long, Map<String, List<OperPhenomenonEntity>>> deptMapEntry : phenomenonMap.entrySet()) {
R<String> deptName1 = sysClient.getDeptName(deptMapEntry.getKey());
for (Map.Entry<String, List<OperPhenomenonEntity>> levelList : deptMapEntry.getValue().entrySet()) {
Integer findShortagesYear = levelList.getValue().size();
Integer shortagesYear = yearConclusionList.stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).collect(Collectors.toList()).size();
Double shortagesRate = 0d;
int findShortagesYear = levelList.getValue().size();
int shortagesYear = (int) yearConclusionList.stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).count();
double shortagesRate = 0d;
if (findShortagesYear != 0 && shortagesYear != 0) {
shortagesRate = BigDecimal.valueOf(shortagesYear).divide(BigDecimal.valueOf(findShortagesYear), 2, BigDecimal.ROUND_UP).doubleValue();
}
Integer findShortagesMon = Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).collect(Collectors.toList()).size();
Integer shortagesMon = Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).collect(Collectors.toList()).size();
Integer findShortagesMon = (int) Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).count();
Integer shortagesMon = (int) Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).count();
CheckChartVo checkChartVo = new CheckChartVo(deptName1.getData(), levelList.getKey(), findShortagesMon, shortagesMon, findShortagesYear, shortagesYear, shortagesRate);
checkChartRes.add(checkChartVo);
}
@ -438,14 +441,14 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 总计
Map<String, List<OperPhenomenonEntity>> levelPhenomenonList = yearPhenomenonEntities.stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getDefectGrading));
for (Map.Entry<String, List<OperPhenomenonEntity>> levelPhenomenon : levelPhenomenonList.entrySet()) {
Integer findShortagesYear = levelPhenomenon.getValue().size();
Integer shortagesYear = Optional.ofNullable(yearConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).collect(Collectors.toList()).size();
Double shortagesRate = 0d;
int findShortagesYear = levelPhenomenon.getValue().size();
int shortagesYear = (int) Optional.ofNullable(yearConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).count();
double shortagesRate = 0d;
if (findShortagesYear != 0 && shortagesYear != 0) {
shortagesRate = BigDecimal.valueOf(shortagesYear).divide(BigDecimal.valueOf(findShortagesYear), 2, BigDecimal.ROUND_UP).doubleValue();
}
Integer findShortagesMon = Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).collect(Collectors.toList()).size();
Integer shortagesMon = Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).collect(Collectors.toList()).size();
Integer findShortagesMon = (int) Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).count();
Integer shortagesMon = (int) Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).count();
CheckChartVo checkChartVo = new CheckChartVo("总计", levelPhenomenon.getKey(), findShortagesMon, shortagesMon, findShortagesYear, shortagesYear, shortagesRate);
checkChartRes.add(checkChartVo);
}
@ -454,13 +457,13 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
HashMap<String, String> temp = new HashMap<>();
temp.put("deptName", checkChartRe.getDeptName());
String checkLevel=null;
if(checkChartRe.getCheckLevel().equals("1")) {
if("1".equals(checkChartRe.getCheckLevel())) {
checkLevel="Ⅰ级缺陷";
}
if(checkChartRe.getCheckLevel().equals("2")) {
if("2".equals(checkChartRe.getCheckLevel())) {
checkLevel="Ⅱ级缺陷";
}
if(checkChartRe.getCheckLevel().equals("3")) {
if("3".equals(checkChartRe.getCheckLevel())) {
checkLevel="Ⅲ级缺陷";
}
temp.put("checkLevel", checkLevel);
@ -504,23 +507,23 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
.filter(s -> s.getType().equals(value.getType())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(yearTicketCollect)) {
//年合格率和数量
Integer count = yearTicketCollect.size();
int count = yearTicketCollect.size();
ticketChartCell.setTicketYear(count);
List<Long> ticketIds = yearTicketCollect.stream().map(s -> s.getId()).collect(Collectors.toList());
List<Long> ticketIds = yearTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds);
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) {
Double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketYeaPercr(ticketYearPerc);
}
}
if (CollectionUtils.isNotEmpty(monthTicketCollect)) {
//月合格率和数量
Integer count = monthTicketCollect.size();
int count = monthTicketCollect.size();
ticketChartCell.setTicketMon(count);
List<Long> monthTicketIds = monthTicketCollect.stream().map(s -> s.getId()).collect(Collectors.toList());
List<Long> monthTicketIds = monthTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds);
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) {
Double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketMonPerc(ticketMonthPerc);
}
}
@ -534,23 +537,23 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
.filter(s -> s.getTicketType().equals(value.getType())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(yearOperateCollect)) {
//年合格率和数量
Integer count = yearOperateCollect.size();
int count = yearOperateCollect.size();
ticketChartCell.setTicketYear(count);
List<Long> ticketIds = yearOperateCollect.stream().map(s -> s.getId()).collect(Collectors.toList());
List<Long> ticketIds = yearOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds);
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) {
Double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketYeaPercr(ticketYearPerc);
}
}
if (CollectionUtils.isNotEmpty(monthOperateCollect)) {
//月合格率和数量
Integer count = monthOperateCollect.size();
int count = monthOperateCollect.size();
ticketChartCell.setTicketMon(count);
List<Long> monthTicketIds = monthOperateCollect.stream().map(s -> s.getId()).collect(Collectors.toList());
List<Long> monthTicketIds = monthOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds);
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) {
Double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketMonPerc(ticketMonthPerc);
}
}
@ -622,7 +625,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
}
private List<MonPowerPercentageVo> getMonPowerPercentageVos(Integer year, Integer month, List<Dept> deptList, List<Long> deptIds, List<StationEntity> stationEntityList, List<Long> stationIds, Integer yearBefore, Integer monthBefore) {
List<String> deptIdsString = deptIds.stream().map(s -> String.valueOf(s)).collect(Collectors.toList());
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString());
List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>();
//水电站,光伏站和带代运维数据近三年数据
@ -632,23 +635,22 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
String monStart = TimeUtils.getMon(year, month);
String monStartYearBefore = TimeUtils.getMon(yearBefore, month);
String monStartMonBefore = TimeUtils.getMon(year, monthBefore);
// 格式:站点-日期-发电量
for (Map.Entry<Long, Map<String, Float>> deviceMap : powerMapThree.entrySet()) {
String deptNameByKey = "";
String deptNameByKey;
if (stationIds.contains(deviceMap.getKey())) {
MonPowerPercentageVo powerVo = new MonPowerPercentageVo();
powerVo.setDeptId(deviceMap.getKey());
List<StationEntity> collect = stationEntityList.stream().filter(s -> deviceMap.getKey().equals(s.getId())).collect(Collectors.toList());
if (collect!=null) {
Long dept = collect.get(0).getRefDept();
List<Dept> dep = deptList.stream().filter(s -> dept.equals(s.getId())).collect(Collectors.toList());
deptNameByKey=dep.get(0).getDeptName();
}
Long dept = collect.get(0).getRefDept();
List<Dept> dep = deptList.stream().filter(s -> dept.equals(s.getId())).collect(Collectors.toList());
deptNameByKey=dep.get(0).getDeptName();
powerVo.setDeptName(deptNameByKey);
BigDecimal powerYear = new BigDecimal(0);
BigDecimal powerYearBefore = new BigDecimal(0);
BigDecimal powerMonth = new BigDecimal(0);
BigDecimal powerMonthBefore = new BigDecimal(0);
BigDecimal powerMonthYearBefore = new BigDecimal(0);
BigDecimal powerYear;
BigDecimal powerYearBefore;
BigDecimal powerMonth;
BigDecimal powerMonthBefore;
BigDecimal powerMonthYearBefore;
Double planGeneration = 0d;
List<PlanGenerationEntity> planGenerationById = planYearData.stream().filter(s -> collect.get(0).getRefDept().equals(s.getStationDeptId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(planGenerationById)) {
@ -717,7 +719,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<AnalyseDataTaosVO> analyseData = analyseDataService.periodTargetData(yearStart, yearEnd, 3, EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION);
if (CollectionUtil.isNotEmpty(analyseData)) {
BigDecimal yearPower = analyseData.stream().filter(ktv -> ktv.getVal() != null)
.map(ktv -> BigDecimal.valueOf(Double.valueOf(ktv.getVal())))
.map(ktv -> BigDecimal.valueOf(Double.parseDouble(ktv.getVal())))
.reduce(BigDecimal.ZERO, BigDecimal::add);
powerYear = powerYear.add(yearPower);
}
@ -725,7 +727,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<AnalyseDataTaosVO> analyseDataYearBefore = analyseDataService.periodTargetData(yearBeforeStart, yearBeforeEnd, 3, EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION);
if (CollectionUtil.isNotEmpty(analyseDataYearBefore)) {
BigDecimal powerBefore = analyseDataYearBefore.stream().filter(ktv -> ktv.getVal() != null)
.map(ktv -> BigDecimal.valueOf(Double.valueOf(ktv.getVal())))
.map(ktv -> BigDecimal.valueOf(Double.parseDouble(ktv.getVal())))
.reduce(BigDecimal.ZERO, BigDecimal::add);
powerYearBefore = powerYearBefore.add(powerBefore);
}
@ -733,7 +735,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<AnalyseDataTaosVO> analyseDataMonth = analyseDataService.periodTargetData(monthStart, monthEnd, 3, EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION);
if (CollectionUtil.isNotEmpty(analyseDataMonth)) {
BigDecimal powerBefore = analyseDataMonth.stream().filter(ktv -> ktv.getVal() != null)
.map(ktv -> BigDecimal.valueOf(Double.valueOf(ktv.getVal())))
.map(ktv -> BigDecimal.valueOf(Double.parseDouble(ktv.getVal())))
.reduce(BigDecimal.ZERO, BigDecimal::add);
powerMonth = powerMonth.add(powerBefore);
}
@ -741,7 +743,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<AnalyseDataTaosVO> analyseDataMonthBefore = analyseDataService.periodTargetData(beforeMonthStart, beforeMonthEnd, 3, EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION);
if (CollectionUtil.isNotEmpty(analyseDataMonthBefore)) {
BigDecimal powerBefore = analyseDataMonthBefore.stream().filter(ktv -> ktv.getVal() != null)
.map(ktv -> BigDecimal.valueOf(Double.valueOf(ktv.getVal())))
.map(ktv -> BigDecimal.valueOf(Double.parseDouble(ktv.getVal())))
.reduce(BigDecimal.ZERO, BigDecimal::add);
powerMonthBefore = powerMonthBefore.add(powerBefore);
}
@ -749,7 +751,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<AnalyseDataTaosVO> analyseDataMonthBeforeYear = analyseDataService.periodTargetData(monthStartBeforeYear, monthEndBeforeYear, 3, EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION);
if (CollectionUtil.isNotEmpty(analyseDataMonthBeforeYear)) {
BigDecimal powerBefore = analyseDataMonthBeforeYear.stream().filter(ktv -> ktv.getVal() != null)
.map(ktv -> BigDecimal.valueOf(Double.valueOf(ktv.getVal())))
.map(ktv -> BigDecimal.valueOf(Double.parseDouble(ktv.getVal())))
.reduce(BigDecimal.ZERO, BigDecimal::add);
powerMonthYearBefore = powerMonthYearBefore.add(powerBefore);
}
@ -1118,7 +1120,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
return;
}
// 查询所有服务类型——"运维服务"、站点类型——"水电站"
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), null);
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), null,true);
if (CollectionUtil.isEmpty(stationList)) {
return;
}

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

@ -44,7 +44,7 @@ public class AreaServiceImpl implements AreaService {
* @return Map<Dept, List<StationEntity>>
*/
@Override
public Map<Dept, List<StationEntity>> getAuthArea(List<Dept> list,Long deptId, List<Integer> typeList, Integer serveType) {
public Map<Dept, List<StationEntity>> getAuthArea(List<Dept> list,Long deptId, List<Integer> typeList, Integer serveType,boolean make) {
// 未传入机构列表,使用用户权限机构过滤
if(CollectionUtil.isEmpty(list)){
R<List<Dept>> R = sysClient.getDeptByCurrentUser();
@ -54,7 +54,7 @@ public class AreaServiceImpl implements AreaService {
list = R.getData();
}
// 根据参数查询有效站点
List<StationEntity> stationList = stationService.getStationList(list,deptId,typeList,serveType);
List<StationEntity> stationList = stationService.getStationList(list,deptId,typeList,serveType,make);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
@ -98,7 +98,7 @@ public class AreaServiceImpl implements AreaService {
* @return
*/
@Override
public Map<Dept, List<StationEntity>> areaOrStaion(Long deptId,List<Integer> types) {
public Map<Dept, List<StationEntity>> areaOrStaion(Long deptId,List<Integer> types,boolean make) {
//根据用户权限获取机构
R<List<Dept>> R = sysClient.getDeptByCurrentUser();
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) {
@ -124,7 +124,7 @@ public class AreaServiceImpl implements AreaService {
Dept dept = list.get(0);
// 机构为站点 key-站点机构 value-站点
if(HomePageConstant.AREA.equals(dept.getDeptCategory())){
List<StationEntity> stationList = stationService.getStationList(R.getData(),dept.getId(),types,HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stationList = stationService.getStationList(R.getData(),dept.getId(),types,HomePageConstant.HYDROPOWER_SERVETYPE,make);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
@ -141,6 +141,6 @@ public class AreaServiceImpl implements AreaService {
return map;
}
}
return this.getAuthArea(R.getData(),deptId,types,HomePageConstant.HYDROPOWER_SERVETYPE);
return this.getAuthArea(R.getData(),deptId,types,HomePageConstant.HYDROPOWER_SERVETYPE,make);
}
}

20
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java

@ -136,7 +136,7 @@ public class HomePageServiceImpl implements IHomePageService {
List<Integer> storage = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.WATER_CONSERVANCY,HomePageConstant.PUMPING,HomePageConstant.GATE, HomePageConstant.ENERGY_STORAGE,
HomePageConstant.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE);
// 站点查询
List<StationEntity> stationList = stationService.getStationType(serveType, storage, null);
List<StationEntity> stationList = stationService.getStationType(serveType, storage, null,true);
// 站点根据type类型分组
Map<Integer, List<StationEntity>> stationGrpMap = stationList.stream().collect(Collectors.groupingBy(StationEntity::getType));
// 遍历分组之后的站点信息
@ -240,7 +240,7 @@ public class HomePageServiceImpl implements IHomePageService {
@Override
public void loadPowerData(String param,List<Integer> types, Integer serveType, int year) {
// 站点查询
List<StationEntity> stationList = stationService.getStationType(serveType, types, null);
List<StationEntity> stationList = stationService.getStationType(serveType, types, null,true);
// 设备信息
List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList();
// 开始时间
@ -351,7 +351,7 @@ public class HomePageServiceImpl implements IHomePageService {
List<Integer> storage = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE, HomePageConstant.ENERGY_STORAGE,
HomePageConstant.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE);
// 查询站点
List<StationEntity> stationEntityList = stationService.getStationList(R.getData(),deptId,storage,serveType);
List<StationEntity> stationEntityList = stationService.getStationList(R.getData(),deptId,storage,serveType,true);
List<OldStationCountVo> list = new ArrayList<>();
storage.forEach(item->{
if(HomePageConstant.PUMPING.equals(item) || HomePageConstant.GATE.equals(item)){
@ -516,7 +516,7 @@ public class HomePageServiceImpl implements IHomePageService {
return null;
}
// 查询站点
List<StationEntity> stationList = stationService.getStationList(R.getData(),deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stationList = stationService.getStationList(R.getData(),deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
@ -624,7 +624,7 @@ public class HomePageServiceImpl implements IHomePageService {
}
List<Integer> storage = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.PHOTOVOLTAIC);
// 查询站点数据
List<StationEntity> stationEntityList = stationService.getStationList(R.getData(),deptId, storage,HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stationEntityList = stationService.getStationList(R.getData(),deptId, storage,HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(CollectionUtil.isEmpty(stationEntityList)){
return null;
}
@ -819,7 +819,7 @@ public class HomePageServiceImpl implements IHomePageService {
private Map<Integer, List<Long>> getStorageMap(List<Dept> all,Integer serveType) {
Map<Integer, List<Long>> map = new HashMap<>();
// 储能
List<StationEntity> energy = this.stationService.getStationType(serveType,Collections.singletonList(HomePageConstant.ENERGY_STORAGE),null);
List<StationEntity> energy = this.stationService.getStationType(serveType,Collections.singletonList(HomePageConstant.ENERGY_STORAGE),null,true);
if(CollectionUtil.isNotEmpty(energy)){
List<Long> refDeptList = energy.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(refDeptList)){
@ -827,7 +827,7 @@ public class HomePageServiceImpl implements IHomePageService {
}
}
// 水利
List<StationEntity> water = this.stationService.getStationType(serveType,HomePageConstant.waterList,null);
List<StationEntity> water = this.stationService.getStationType(serveType,HomePageConstant.waterList,null,true);
if(CollectionUtil.isNotEmpty(water)){
List<Long> refDeptList = water.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(refDeptList)){
@ -1526,7 +1526,7 @@ public class HomePageServiceImpl implements IHomePageService {
OldHydropowerScoreVo hydropowerScoreVo = new OldHydropowerScoreVo();
hydropowerScoreVo.setDepartId(key);
// 站点查询
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), value);
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), value,true);
if (CollectionUtil.isEmpty(stationList)) {
return;
}
@ -2074,7 +2074,7 @@ public class HomePageServiceImpl implements IHomePageService {
getChildDept(departList, dept.getId(), list);
}
});
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), list);
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), list,true);
if (CollectionUtil.isEmpty(stationList)) {
return null;
}
@ -2160,7 +2160,7 @@ public class HomePageServiceImpl implements IHomePageService {
if (CollectionUtil.isEmpty(deptList)) {
return null;
}
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), deptList);
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), deptList,true);
if (CollectionUtil.isEmpty(deptList)) {
return null;
}

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

@ -137,9 +137,13 @@ public class HomeServiceImpl implements HomeService {
* @return
*/
@Override
public List<StationCountVo> count() {
public List<StationCountVo> count(boolean make) {
// 查询全部站点
List<StationEntity> stations = stationService.list();
LambdaQueryWrapper<StationEntity> wrapper = Wrappers.<StationEntity>lambdaQuery();
if(make){
wrapper.ne(StationEntity::getStatus,2);
}
List<StationEntity> stations = stationService.list(wrapper);
List<StationCountVo> counts = new ArrayList<>();
HomePageConstant.SERVETYPE_LIST.forEach(serve ->counts.addAll(HomePageConstant.HOME_TYPES.stream().map(type -> {
StationCountVo count = new StationCountVo();

19
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -40,6 +40,7 @@ import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient;
import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.sun.org.apache.xpath.internal.operations.NotEquals;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
@ -257,7 +258,7 @@ public class HydropowerServiceImpl implements HydropowerService {
@Override
public void loadPowerData(String param, List<Integer> types, Integer serveType, int year) {
// 站点查询
List<StationEntity> stationList = stationService.getStationType(serveType, types, null);
List<StationEntity> stationList = stationService.getStationType(serveType, types, null,true);
// 设备信息
List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList();
// 开始时间
@ -942,7 +943,7 @@ public class HydropowerServiceImpl implements HydropowerService {
*/
@Override
public List<HydropowerStationVo> webStationList(Long deptId) {
List<StationEntity> stations = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE,Collections.singletonList(HomePageConstant.HYDROPOWER),null);
List<StationEntity> stations = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE,Collections.singletonList(HomePageConstant.HYDROPOWER),null,true);
if(CollectionUtil.isEmpty(stations)){
return null;
}
@ -1002,9 +1003,9 @@ public class HydropowerServiceImpl implements HydropowerService {
* @return
*/
@Override
public HydropowerScoreVo KPIs(Long deptId) {
public HydropowerScoreVo KPIs(Long deptId,boolean make) {
// 查询水电站站点
List<StationEntity> stations = this.getStations(deptId);
List<StationEntity> stations = this.getStations(deptId,make);
if (CollectionUtil.isEmpty(stations)) {
return new HydropowerScoreVo();
}
@ -1076,7 +1077,7 @@ public class HydropowerServiceImpl implements HydropowerService {
@Override
public List<AreaScaleVo> proportion(Long deptId) {
// 获取区域或者站点map结构
Map<Dept,List<StationEntity>> areas = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER));
Map<Dept,List<StationEntity>> areas = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),true);
if(MapUtils.isEmpty(areas)){
return null;
}
@ -1169,7 +1170,7 @@ public class HydropowerServiceImpl implements HydropowerService {
* @param deptId
* @return
*/
private List<StationEntity> getStations(Long deptId) {
private List<StationEntity> getStations(Long deptId,boolean make) {
List<UserDeptEntity> configs = userDeptService.list(new LambdaQueryWrapper<UserDeptEntity>(){{
eq(UserDeptEntity::getUserId, AuthUtil.getUserId());
}});
@ -1179,7 +1180,7 @@ public class HydropowerServiceImpl implements HydropowerService {
eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE);
}});
}
return stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.HYDROPOWER), HomePageConstant.HYDROPOWER_SERVETYPE);
return stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.HYDROPOWER), HomePageConstant.HYDROPOWER_SERVETYPE,make);
}
/**
@ -1265,7 +1266,7 @@ public class HydropowerServiceImpl implements HydropowerService {
if(CollectionUtil.isNotEmpty(gourps)){
return gourps;
}
Map<Dept,List<StationEntity>> areas = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER));
Map<Dept,List<StationEntity>> areas = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),true);
if(MapUtils.isEmpty(areas)) {
return new ArrayList<>();
}
@ -1532,7 +1533,7 @@ public class HydropowerServiceImpl implements HydropowerService {
@Override
public List<AppHydropowerStationVo> area(Long deptId) {
// 查询水电站站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.HYDROPOWER), null);
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.HYDROPOWER), null,true);
if (CollectionUtil.isEmpty(stations)) {
return new ArrayList<>();
}

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

@ -194,7 +194,7 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl<MainWorkBenchMappe
List<Integer> storage = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.WATER_CONSERVANCY,HomePageConstant.PUMPING,HomePageConstant.GATE, HomePageConstant.ENERGY_STORAGE,
HomePageConstant.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE);
// 查询站点
List<StationEntity> stationEntityList = stationService.getStationList(list,null,storage,null);
List<StationEntity> stationEntityList = stationService.getStationList(list,null,storage,null,true);
if(CollectionUtil.isEmpty(stationEntityList)){
return null;
}

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java

@ -660,7 +660,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
*/
private List<EminfoAndEmParamVo> getPhotovoltaicDevice() {
// 光伏站点
List<StationEntity> stations = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), null);
List<StationEntity> stations = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), null,true);
if (CollectionUtil.isEmpty(stations)) {
return null;
}
@ -683,7 +683,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
@Override
public PhotovoltaicKPIsVo KPIs(Long deptId) {
// 查询光伏站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (CollectionUtil.isEmpty(stations)) {
return new PhotovoltaicKPIsVo();
}
@ -786,7 +786,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
@Override
public List<GenerationVo> generation(Long deptId, String type) {
// 查询光伏站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (CollectionUtil.isEmpty(stations)) {
return new ArrayList<>();
}
@ -896,7 +896,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
@Override
public List<PhotovoltaicSubordinateVo> subordinate(Long deptId) {
// 获取区域或者站点map结构
Map<Dept, List<StationEntity>> map = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC));
Map<Dept, List<StationEntity>> map = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC),true);
if (MapUtils.isEmpty(map)) {
return new ArrayList<>();
}
@ -1043,7 +1043,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
@Override
public PhotovoltaicSubordinateAppVo app_subordinate(Long deptId) {
// 查询光伏站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (CollectionUtil.isEmpty(stations)) {
return new PhotovoltaicSubordinateAppVo();
}
@ -1053,7 +1053,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
// 指标数据
List<PhotovoltaicTargetVo> deviceTargets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key);
// 获取区域或者站点map结构
Map<Dept, List<StationEntity>> map = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC));
Map<Dept, List<StationEntity>> map = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC),true);
// 集团/省子公司名称
this.subordinateDept(subordinate,deptId);
// 区域数据
@ -1300,7 +1300,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
@Override
public List<PhotovoltaicLoadGenerateVo> app_load_generate(Long deptId, String type, String queryType) {
// 查询光伏站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC), HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (CollectionUtil.isEmpty(stations)) {
return new ArrayList<>();
}

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

@ -165,7 +165,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) {
return;
}
Map<Dept,List<StationEntity>> map = areaService.getAuthArea(R.getData(),null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE);
Map<Dept,List<StationEntity>> map = areaService.getAuthArea(R.getData(),null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (MapUtils.isEmpty(map)) {
return;
}
@ -829,7 +829,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
return null;
}
// 确定获取数据区域
Map<Dept,List<StationEntity>> map = areaService.getAuthArea(null,deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE);
Map<Dept,List<StationEntity>> map = areaService.getAuthArea(null,deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (MapUtils.isEmpty(map)) {
return null;
}
@ -845,7 +845,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
@Override
public List<AreaPowerScaleVo> areaPowerScale(Long deptId) {
// 获取区域或者站点map结构
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER));
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),true);
if(MapUtils.isEmpty(map)){
return null;
}
@ -879,7 +879,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
@Override
public List<OldAreaScaleVo> areaScale(Long deptId) {
// 获取区域或者站点map结构
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER));
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),true);
if(MapUtils.isEmpty(map)){
return null;
}
@ -943,12 +943,12 @@ public class SideHustleServiceImpl implements ISideHustleService {
* @return
*/
@Override
public List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types) {
public List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types,boolean make) {
if(CollectionUtil.isEmpty(types)){
types = Collections.singletonList(HomePageConstant.HYDROPOWER);
}
// 获取集团/区域map结构数据
Map<Dept, List<StationEntity>> deptMap = areaService.areaOrStaion(deptId,types);
Map<Dept, List<StationEntity>> deptMap = areaService.areaOrStaion(deptId,types,make);
if (MapUtils.isEmpty(deptMap)) {
return null;
}
@ -962,6 +962,9 @@ public class SideHustleServiceImpl implements ISideHustleService {
if(ObjectUtil.isEmpty(station)){
return;
}
if(make && 2 == station.getStatus()){
return;
}
vo.setDataOrigin(station.getDataOrigin());
vo.setLttd(station.getLttd());
vo.setLgtd(station.getLgtd());
@ -1200,7 +1203,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
List<String> runtList = deviceClassifyMap.get(HomePageConstant.RUN);
// 获取部门
Map<Dept, List<StationEntity>> deptMap = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER));
Map<Dept, List<StationEntity>> deptMap = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),true);
if (MapUtils.isEmpty(deptMap)) {
return null;
}
@ -1428,7 +1431,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
// 实际发电量
Map<Long, Map<String, Float>> powerMap = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
// 确定获取数据区域
Map<Dept,List<StationEntity>> map = areaService.getAuthArea(null,deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE);
Map<Dept,List<StationEntity>> map = areaService.getAuthArea(null,deptId,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (MapUtils.isEmpty(map)) {
return null;
}
@ -1478,6 +1481,9 @@ public class SideHustleServiceImpl implements ISideHustleService {
float power = 0f;
// 遍历累计当月所有站点实际发电量
for(Map<String,Float> item : list){
if(ObjectUtil.isEmpty(item.get(mon))){
continue;
}
power += item.get(mon);
}
return power;
@ -1664,6 +1670,6 @@ public class SideHustleServiceImpl implements ISideHustleService {
* @return
*/
private List<StationEntity> getStation(List<Integer> singletonList, List<Long> childDeptIdList) {
return stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE,singletonList,childDeptIdList);
return stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE,singletonList,childDeptIdList,true);
}
}

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

@ -327,7 +327,7 @@ public class WaterServiceImpl implements IWaterService {
*/
private List<HzimsAnalyzeModelStationEntity> getModelStationList() {
// 水利站点(All)
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, null, null);
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, null, null,true);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
@ -827,7 +827,7 @@ public class WaterServiceImpl implements IWaterService {
@Override
public WaterConservancyVo waterConservancy(Long deptId) {
// 查询水利站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, HomePageConstant.waterList, HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stations = stationService.getHomeStationList(deptId, HomePageConstant.waterList, HomePageConstant.HYDROPOWER_SERVETYPE,true);
if (CollectionUtil.isEmpty(stations)) {
return new WaterConservancyVo();
}
@ -888,7 +888,7 @@ public class WaterServiceImpl implements IWaterService {
public List<WaterDetailsVo> waterDetails(Long deptId) {
// 获取区域map : key-区域机构 value-水利站点集合
// 获取区域或者站点map结构
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,HomePageConstant.waterList);
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,HomePageConstant.waterList,true);
if(MapUtils.isEmpty(map)){
return null;
}
@ -933,7 +933,7 @@ public class WaterServiceImpl implements IWaterService {
@Override
public List<WaterRankingVo> waterUseEleRanking(Long deptId) {
// 获取区域map : key-区域机构 value-水利站点集合
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,HomePageConstant.waterList);
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,HomePageConstant.waterList,true);
if(MapUtils.isEmpty(map)){
return null;
}
@ -1002,7 +1002,7 @@ public class WaterServiceImpl implements IWaterService {
return null;
}
// 获取水利站点
List<StationEntity> stationList = stationService.getStationList(R.getData(),deptId,HomePageConstant.waterList,HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stationList = stationService.getStationList(R.getData(),deptId,HomePageConstant.waterList,HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
@ -1062,7 +1062,7 @@ public class WaterServiceImpl implements IWaterService {
return null;
}
// 获取水利站点
List<StationEntity> stationList = stationService.getStationList(R.getData(),deptId,HomePageConstant.waterList,HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stationList = stationService.getStationList(R.getData(),deptId,HomePageConstant.waterList,HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(CollectionUtil.isEmpty(stationList)){
return null;
}

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

@ -108,7 +108,7 @@ public class WindHomeServiceImpl implements WindHomeService {
@Override
public WindScoreVo KPIs(Long deptId) {
// 查询风电站
List<StationEntity> stations = stationService.getHomeStationList(deptId,Collections.singletonList(HomePageConstant.WIND_POWER),HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stations = stationService.getHomeStationList(deptId,Collections.singletonList(HomePageConstant.WIND_POWER),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(CollectionUtil.isEmpty(stations)){
return new WindScoreVo();
}
@ -209,7 +209,7 @@ public class WindHomeServiceImpl implements WindHomeService {
*/
@Override
public List<WindSubordinateVo> subordinate(Long deptId) {
Map<Dept, List<StationEntity>> areas = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.WIND_POWER));
Map<Dept, List<StationEntity>> areas = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.WIND_POWER),true);
if (MapUtils.isEmpty(areas)) {
return new ArrayList<>();
}
@ -351,7 +351,7 @@ public class WindHomeServiceImpl implements WindHomeService {
@Override
public List<WindAreaVo> app_area(Long deptId) {
// 区域数据查询
Map<Dept, List<StationEntity>> areas = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.WIND_POWER));
Map<Dept, List<StationEntity>> areas = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.WIND_POWER),true);
if (MapUtils.isEmpty(areas)) {
return new ArrayList<>();
}
@ -482,7 +482,7 @@ public class WindHomeServiceImpl implements WindHomeService {
private void windFill(WindAreaDutyVo areaDuty,Long deptId) {
// 查询站点
List<StationEntity> stations = stationService.getHomeStationList(deptId,Collections.singletonList(HomePageConstant.WIND_POWER),HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stations = stationService.getHomeStationList(deptId,Collections.singletonList(HomePageConstant.WIND_POWER),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(CollectionUtil.isEmpty(stations)){
return;
}
@ -797,7 +797,7 @@ public class WindHomeServiceImpl implements WindHomeService {
* @param subordinate
*/
private void stations(WindSubordinateAppVo subordinate) {
List<StationEntity> stations = stationService.getHomeStationList(subordinate.getDeptId(),Collections.singletonList(HomePageConstant.WIND_POWER),HomePageConstant.HYDROPOWER_SERVETYPE);
List<StationEntity> stations = stationService.getHomeStationList(subordinate.getDeptId(),Collections.singletonList(HomePageConstant.WIND_POWER),HomePageConstant.HYDROPOWER_SERVETYPE,true);
if(CollectionUtil.isEmpty(stations)){
return;
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java

@ -207,7 +207,7 @@ public class StationController extends BladeController {
@ApiOperationSupport(order = 91)
@ApiOperation(value = "获取首页站点列表", notes = "")
public R<List<StationEntity>> getHomeStationList(@RequestParam(value = "deptId", required = false) Long deptId, @RequestParam(value = "types", required = false) List<Integer> types, @RequestParam(value = "serveType", required = false) Integer serveType) {
return R.data(stationService.getHomeStationList(deptId, types, serveType));
return R.data(stationService.getHomeStationList(deptId, types, serveType,true));
}
@ApiLog

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java

@ -98,13 +98,13 @@ public interface IStationService extends BaseService<StationEntity> {
List<StationEntity> getStationByInCode(List<String> codes);
List<StationEntity> getStationType(Integer serveType,List<Integer> typeList,List<Long> departIdList);
List<StationEntity> getStationType(Integer serveType,List<Integer> typeList,List<Long> departIdList,boolean make);
List<StationEntity> getStationByServerTypeAndIsType(Integer serverType,Boolean isType);
List<StationEntity> getStationList(List<Dept> authList, Long deptId, List<Integer> types, Integer serveType);
List<StationEntity> getStationList(List<Dept> authList, Long deptId, List<Integer> types, Integer serveType,boolean make);
List<StationEntity> getHomeStationList(Long deptId, List<Integer> types, Integer serveType);
List<StationEntity> getHomeStationList(Long deptId, List<Integer> types, Integer serveType,boolean make);
List<Long> getRefDeptByCodes(List<String> list,String type);

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/ImsDeptServiceImpl.java

@ -208,7 +208,7 @@ public class ImsDeptServiceImpl extends ServiceImpl<ImsDeptMapper, ImsDeptEntity
if(HomePageConstant.WATER_CONSERVANCY.equals(stationType)){
type = HomePageConstant.waterList;
}
List<StationEntity> stationEntityList = stationService.getStationType(serveType, type ,value);
List<StationEntity> stationEntityList = stationService.getStationType(serveType, type ,value,true);
if(CollectionUtil.isEmpty(stationEntityList)){
return null;
}
@ -333,7 +333,7 @@ public class ImsDeptServiceImpl extends ServiceImpl<ImsDeptMapper, ImsDeptEntity
if(HomePageConstant.WATER_CONSERVANCY.equals(typeArea)){
type = HomePageConstant.waterList;
}
List<StationEntity> stationEntityList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, type ,value);
List<StationEntity> stationEntityList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, type ,value,true);
if(CollectionUtil.isEmpty(stationEntityList)){
return null;
}

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -450,7 +450,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
}
@Override
public List<StationEntity> getStationType(Integer serveType, List<Integer> typeList, List<Long> departIdList) {
public List<StationEntity> getStationType(Integer serveType, List<Integer> typeList, List<Long> departIdList,boolean make) {
return this.list(new LambdaQueryWrapper<StationEntity>() {{
eq(StationEntity::getIsDeleted, 0);
if (ObjectUtil.isNotEmpty(serveType)) {
@ -462,6 +462,9 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
if (CollectionUtil.isNotEmpty(departIdList)) {
in(StationEntity::getRefDept, departIdList);
}
if (make) {
ne(StationEntity::getStatus, 2);
}
}});
}
@ -486,7 +489,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
* @return
*/
@Override
public List<StationEntity> getStationList(List<Dept> authList, Long deptId, List<Integer> types, Integer servrType) {
public List<StationEntity> getStationList(List<Dept> authList, Long deptId, List<Integer> types, Integer servrType,boolean make) {
Dept dept;
if (null == deptId) {
// 最小类型机构
@ -513,7 +516,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
refDepList = this.getStationDeptList(authList, dept.getId(), new ArrayList<>());
}
// 获取水利站点(过滤其他站点类型)
return this.getWaterList(refDepList, types, servrType);
return this.getWaterList(refDepList, types, servrType,make);
}
/**
@ -545,12 +548,12 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
* @param refDepList
* @return
*/
private List<StationEntity> getWaterList(List<Long> refDepList, List<Integer> types, Integer servrType) {
private List<StationEntity> getWaterList(List<Long> refDepList, List<Integer> types, Integer servrType,boolean make) {
if (CollectionUtil.isEmpty(refDepList)) {
return null;
}
// 查询水利站点,过滤其他类型站点
return this.getStationType(servrType, types, refDepList);
return this.getStationType(servrType, types, refDepList,make);
}
@ -563,12 +566,12 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
* @return
*/
@Override
public List<StationEntity> getHomeStationList(Long deptId, List<Integer> types, Integer serveType) {
public List<StationEntity> getHomeStationList(Long deptId, List<Integer> types, Integer serveType,boolean make) {
R<List<Dept>> result = sysClient.getDeptByCurrentUser();
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
return null;
}
return this.getStationList(result.getData(), deptId, types, serveType);
return this.getStationList(result.getData(), deptId, types, serveType,make);
}
@Override

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

@ -729,7 +729,9 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
BladeUser bladeUser = AuthUtil.getUser();
List<Long> createDept = userClient.getDataScope(bladeUser.getUserId());
log.info("================================================================");
log.info("获取权限Id =======================> ", createDept);
log.info("================================================================");
StandardTicketInfoDto standardTicketInfoDto = new StandardTicketInfoDto();
BeanUtils.copyProperties(ticketCountQueryVo, standardTicketInfoDto);
LambdaQueryWrapper<StandardTicketInfoEntity> queryWrapper = this.getQueryWrapper(standardTicketInfoDto);

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

@ -405,7 +405,8 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
* @param user
* @return
*/
private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) {
private List<TicketCount>
getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) {
List<StandardTicketInfoEntity> ticketInfoEntities =
standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType, dateTime);
if (CollectionUtils.isEmpty(ticketInfoEntities)) {
@ -459,6 +460,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList);
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1);
evaluateEntityLambdaQueryWrapper.groupBy(TicketInfoEvaluateEntity::getTicketId);
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper);
ticketCount.setTicketProportionNum(evaluateEntities.size());
@ -549,6 +551,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl<TicketCountMapper, T
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList);
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1);
evaluateEntityLambdaQueryWrapper.groupBy(TicketInfoEvaluateEntity::getTicketId);
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper);
ticketCount.setTicketProportionNum(evaluateEntities.size());

Loading…
Cancel
Save