Commit fef5cceb authored by tangwei's avatar tangwei

Merge branch 'developer' into dev0124

# Conflicts: # amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/util/NumberUtil.java
parents 1f15dc31 58f336f5
...@@ -94,8 +94,8 @@ public class AcceptanceDto extends BaseDto { ...@@ -94,8 +94,8 @@ public class AcceptanceDto extends BaseDto {
private Long peasantHouseholdId; private Long peasantHouseholdId;
//验收单id
private Long acceptanceCheckItemId;
} }
...@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; ...@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto; import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AcceptanceMapper extends BaseMapper<BaseEntity> { public interface AcceptanceMapper extends BaseMapper<BaseEntity> {
/** /**
* 分页查询验收列表数据 * 分页查询验收列表数据
...@@ -14,8 +16,8 @@ public interface AcceptanceMapper extends BaseMapper<BaseEntity> { ...@@ -14,8 +16,8 @@ public interface AcceptanceMapper extends BaseMapper<BaseEntity> {
* @param acceptanceDto 查询参数 * @param acceptanceDto 查询参数
* @return 分页结果 * @return 分页结果
*/ */
IPage<AcceptanceDto> page( List<AcceptanceDto> page(
@Param("page") IPage<AcceptanceDto> page,
@Param("param") AcceptanceDto acceptanceDto @Param("param") AcceptanceDto acceptanceDto
); );
} }
...@@ -16,11 +16,14 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> { ...@@ -16,11 +16,14 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
List<PeasantHousehold> selectPeasantHouseholdList(@Param("developerId") Long developerId, List<PeasantHousehold> selectPeasantHouseholdList(@Param("developerId") Long developerId,
@Param("regionalCompaniesSeq")Long regionalCompaniesSeq, @Param("regionalCompaniesSeq")Long regionalCompaniesSeq,
@Param("peasantHouseholdNo")String peasantHouseholdNo, @Param("peasantHouseholdNo")String peasantHouseholdNo,
@Param("ownersName")String ownersName @Param("ownersName")String ownersName,
@Param("ids")String ids
); );
List<PeasantHousehold> selectPeasantHouseholdListsg(@Param("developerId") Long developerId, List<PeasantHousehold> selectPeasantHouseholdListsg(@Param("developerId") Long developerId,
@Param("regionalCompaniesSeq")Long regionalCompaniesSeq, @Param("regionalCompaniesSeq")Long regionalCompaniesSeq,
@Param("peasantHouseholdNo")String peasantHouseholdNo, @Param("peasantHouseholdNo")String peasantHouseholdNo,
@Param("ownersName")String ownersName @Param("ownersName")String ownersName,
@Param("ids")String ids
); );
} }
package com.yeejoin.amos.boot.module.hygf.api.service; package com.yeejoin.amos.boot.module.hygf.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto; import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheckItem; import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheckItem;
...@@ -14,7 +15,7 @@ public interface IAcceptanceService { ...@@ -14,7 +15,7 @@ public interface IAcceptanceService {
* @param acceptanceDto 查询参数 * @param acceptanceDto 查询参数
* @return 分页结果 * @return 分页结果
*/ */
IPage<AcceptanceDto> page(IPage<AcceptanceDto> page, AcceptanceDto acceptanceDto); Page<AcceptanceDto> page(Integer current, Integer size, AcceptanceDto acceptanceDto);
/** /**
* 根据sequenceNbr查询验收详情(线下验收) * 根据sequenceNbr查询验收详情(线下验收)
......
...@@ -41,10 +41,11 @@ public class NumberUtil { ...@@ -41,10 +41,11 @@ public class NumberUtil {
return num; return num;
}else{ }else{
int num = rand.nextInt(9000) + 1; int num = rand.nextInt(9000) + 1;
needQueryResProductList.put("num",num); needQueryResProductList.put("num",num);
return num;
} return num;
}
} }
...@@ -55,13 +56,13 @@ public class NumberUtil { ...@@ -55,13 +56,13 @@ public class NumberUtil {
code= code+ getChineseStr(address.replace("省","") code= code+ getChineseStr(address.replace("省","")
.replace("市","") .replace("市","")
.replace("区","") .replace("区","")
.replace("县","") .replace("县","")
.replace(",","")); .replace(",",""));
code= type+code+dateFormat()+getnum(); code= type+code+dateFormat()+getnum();
return code; return code;
} }
} }
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
bga.next_executor_ids nextExecutorIds, bga.next_executor_ids nextExecutorIds,
bga.next_node_key nextNodeKey, bga.next_node_key nextNodeKey,
(select hygf_acceptance_check_item.sequence_nbr from hygf_acceptance_check_item where hygf_acceptance_check_item.work_order_power_station_id=bga.work_order_power_station_id LIMIT 1) acceptanceCheckItemId,
hygf_work_order.region_company_id regionCompanyId, hygf_work_order.region_company_id regionCompanyId,
ph.regional_companies_code AS regionalCompaniesCode, ph.regional_companies_code AS regionalCompaniesCode,
ph.regional_companies_name AS regionalCompaniesName, ph.regional_companies_name AS regionalCompaniesName,
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
AND hbga.grid_status = #{map.gridStatus} AND hbga.grid_status = #{map.gridStatus}
</if> </if>
<if test="map.gridConnectionTime != null"> <if test="map.gridConnectionTime != null">
AND DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d') = DATE_FORMAT(map.gridConnectionTime, '%Y-%m-%d') AND DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d') = DATE_FORMAT( #{map.gridConnectionTime}, '%Y-%m-%d')
</if> </if>
</where> </where>
ORDER BY hogaa.grid_connection_time desc ,hogaa.rec_date desc ORDER BY hogaa.grid_connection_time desc ,hogaa.rec_date desc
......
...@@ -12,6 +12,10 @@ and hygf_peasant_household.regional_companies_seq=#{regionalCompaniesSeq} ...@@ -12,6 +12,10 @@ and hygf_peasant_household.regional_companies_seq=#{regionalCompaniesSeq}
and hygf_peasant_household.survey_or_not=3 and hygf_peasant_household.sequence_nbr not in and hygf_peasant_household.survey_or_not=3 and hygf_peasant_household.sequence_nbr not in
(select hygf_document_station.station_id from hygf_preparation_money LEFT JOIN hygf_document_station (select hygf_document_station.station_id from hygf_preparation_money LEFT JOIN hygf_document_station
on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nbr where hygf_preparation_money.delivery_state !='已作废' on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nbr where hygf_preparation_money.delivery_state !='已作废'
<if test="ids!=null and ids !=''">
and hygf_document_station.preparation_money_id !=#{ids}
</if>
and hygf_document_station.station_id is not null and hygf_document_station.station_id is not null
) )
<if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''"> <if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''">
...@@ -34,6 +38,10 @@ and hygf_document_station.station_id is not null ...@@ -34,6 +38,10 @@ and hygf_document_station.station_id is not null
and hygf_peasant_household.regional_companies_seq=#{regionalCompaniesSeq} and hygf_peasant_household.regional_companies_seq=#{regionalCompaniesSeq}
and hygf_peasant_household.sequence_nbr not in ( and hygf_peasant_household.sequence_nbr not in (
select hygf_work_order_power_station.peasant_household_id from hygf_work_order_power_station select hygf_work_order_power_station.peasant_household_id from hygf_work_order_power_station
where 1=1
<if test="ids!=null and ids !=''">
and hygf_work_order_power_station.work_order_id !=#{ids}
</if>
) )
<if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''"> <if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''">
and hygf_peasant_household.peasant_household_no like concat(concat("%",#{peasantHouseholdNo}),"%") and hygf_peasant_household.peasant_household_no like concat(concat("%",#{peasantHouseholdNo}),"%")
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto; import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto;
...@@ -32,7 +33,7 @@ public class AcceptanceController extends BaseController { ...@@ -32,7 +33,7 @@ public class AcceptanceController extends BaseController {
@PostMapping(value = "/page") @PostMapping(value = "/page")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "Get", value = "获取验收单列表", notes = "获取验收单列表") @ApiOperation(httpMethod = "Get", value = "获取验收单列表", notes = "获取验收单列表")
public ResponseModel<IPage<AcceptanceDto>> page( public ResponseModel<Page<AcceptanceDto>> page(
@RequestParam(value = "current", required = false, defaultValue = "1") Integer current, @RequestParam(value = "current", required = false, defaultValue = "1") Integer current,
@RequestParam(value = "size", required = false, defaultValue = "20") Integer size, @RequestParam(value = "size", required = false, defaultValue = "20") Integer size,
@RequestBody AcceptanceDto param @RequestBody AcceptanceDto param
...@@ -43,10 +44,8 @@ public class AcceptanceController extends BaseController { ...@@ -43,10 +44,8 @@ public class AcceptanceController extends BaseController {
param.setAmosDealerId(userUnitInformationDto.getAmosDealerId()); param.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
} }
IPage<AcceptanceDto> page = new Page<>(current, size);
page = acceptanceService.page(page, param);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse( acceptanceService.page(current, size, param));
} }
@GetMapping("/acceptance-details") @GetMapping("/acceptance-details")
......
...@@ -289,8 +289,8 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -289,8 +289,8 @@ public class TdHygfJpInverterWarnController extends BaseController {
if (nameMaps.containsKey(map.getThirdStationId())){ if (nameMaps.containsKey(map.getThirdStationId())){
map.setStationName(nameMaps.get(map.getThirdStationId())); map.setStationName(nameMaps.get(map.getThirdStationId()));
} }
map.setTimeLongFormat(TimeUtil String te= map.getTimeLong()!=null?TimeUtil.longFormat(map.getTimeLong()):"";
.longFormat(map.getTimeLong())); map.setTimeLongFormat(te);
} }
result.setTotal(tdHygfJpInverterWarnServiceImpl.selectWarnListTotal(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content)); result.setTotal(tdHygfJpInverterWarnServiceImpl.selectWarnListTotal(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content));
......
...@@ -739,7 +739,7 @@ public class UnitInfoController extends BaseController { ...@@ -739,7 +739,7 @@ public class UnitInfoController extends BaseController {
) { ) {
UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId); UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,null,null); List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,null,null,null);
List<Map<String,Object>> date=new ArrayList<>(); List<Map<String,Object>> date=new ArrayList<>();
if(list!=null){ if(list!=null){
...@@ -763,10 +763,11 @@ public class UnitInfoController extends BaseController { ...@@ -763,10 +763,11 @@ public class UnitInfoController extends BaseController {
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam (value = "size") int size, @RequestParam (value = "size") int size,
@RequestParam (required=false) String peasantHouseholdNo, @RequestParam (required=false) String peasantHouseholdNo,
@RequestParam (required=false) String ownersName @RequestParam (required=false) String ownersName,
@RequestParam (required=false) String ids
) { ) {
return ResponseHelper.buildResponse(unitInfoServiceImpl.getPeasantHouseholdData( unitInfoId,regionalCompaniesSeq, current,size,peasantHouseholdNo,ownersName)); return ResponseHelper.buildResponse(unitInfoServiceImpl.getPeasantHouseholdData( unitInfoId,regionalCompaniesSeq, current,size,peasantHouseholdNo,ownersName,ids));
} }
...@@ -829,11 +830,12 @@ public ResponseModel< List<Map<String,Object>> > getRegionalCompanieByuser( ...@@ -829,11 +830,12 @@ public ResponseModel< List<Map<String,Object>> > getRegionalCompanieByuser(
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam (value = "size") int size, @RequestParam (value = "size") int size,
@RequestParam (required=false) String peasantHouseholdNo, @RequestParam (required=false) String peasantHouseholdNo,
@RequestParam (required=false) String ownersName @RequestParam (required=false) String ownersName,
@RequestParam (required=false) String ids
) { ) {
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto( getUserInfo().getUserId()); UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto( getUserInfo().getUserId());
return ResponseHelper.buildResponse(unitInfoServiceImpl.selectPeasantHouseholdListsg( userUnitInformationDto.getAmosDealerId(),regionalCompaniesSeq, current,size,peasantHouseholdNo,ownersName)); return ResponseHelper.buildResponse(unitInfoServiceImpl.selectPeasantHouseholdListsg( userUnitInformationDto.getAmosDealerId(),regionalCompaniesSeq, current,size,peasantHouseholdNo,ownersName, ids));
} }
} }
...@@ -2,11 +2,15 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl; ...@@ -2,11 +2,15 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.Enum.AcceptanceStatusEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.AcceptanceStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto; import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.StandardDto; import com.yeejoin.amos.boot.module.hygf.api.dto.StandardDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheckItem; import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheckItem;
import com.yeejoin.amos.boot.module.hygf.api.entity.BasicGridAcceptance; import com.yeejoin.amos.boot.module.hygf.api.entity.BasicGridAcceptance;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceCheckItemMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceCheckItemMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BasicGridAcceptanceMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.BasicGridAcceptanceMapper;
...@@ -44,7 +48,7 @@ public class AcceptanceServiceImpl implements IAcceptanceService { ...@@ -44,7 +48,7 @@ public class AcceptanceServiceImpl implements IAcceptanceService {
* @return 分页结果 * @return 分页结果
*/ */
@Override @Override
public IPage<AcceptanceDto> page(IPage<AcceptanceDto> page, AcceptanceDto acceptanceDto) { public Page<AcceptanceDto> page(Integer current, Integer size, AcceptanceDto acceptanceDto) {
if (Objects.nonNull(acceptanceDto)) { if (Objects.nonNull(acceptanceDto)) {
// 处理提交日期 // 处理提交日期
...@@ -57,9 +61,16 @@ public class AcceptanceServiceImpl implements IAcceptanceService { ...@@ -57,9 +61,16 @@ public class AcceptanceServiceImpl implements IAcceptanceService {
} }
} }
} }
IPage<AcceptanceDto> resultPage = acceptanceMapper.page(page, acceptanceDto);
return resultPage; PageHelper.startPage(current, size);
List<AcceptanceDto> resultPage = acceptanceMapper.page(acceptanceDto);
PageInfo<AcceptanceDto> page = new PageInfo(resultPage);
Page<AcceptanceDto> pagenew = new Page<AcceptanceDto>();
pagenew.setCurrent(current);
pagenew.setTotal(page.getTotal());
pagenew.setSize(size);
pagenew.setRecords(page.getList());
return pagenew;
} }
/** /**
......
...@@ -50,14 +50,14 @@ public class BasicGridAcceptanceServiceImpl extends BaseService<BasicGridAccepta ...@@ -50,14 +50,14 @@ public class BasicGridAcceptanceServiceImpl extends BaseService<BasicGridAccepta
PageHelper.startPage(current, size); PageHelper.startPage(current, size);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Date date = null; Date date = null;
if (StringUtils.isNotEmpty(gridConnectionTime)) { // if (StringUtils.isNotEmpty(gridConnectionTime)) {
date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss"); // date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss");
} // }
map.put("projectAddress", projectAddress); map.put("projectAddress", projectAddress);
map.put("powerStationCode", powerStationCode); map.put("powerStationCode", powerStationCode);
map.put("ownersName", ownersName); map.put("ownersName", ownersName);
map.put("gridStatus", gridStatus); map.put("gridStatus", gridStatus);
map.put("gridConnectionTime", date); map.put("gridConnectionTime", gridConnectionTime);
map.put("formType", formType); map.put("formType", formType);
map.put("regionCompanyId", regionCompanyId); map.put("regionCompanyId", regionCompanyId);
map.put("amosDealerId", amosDealerId); map.put("amosDealerId", amosDealerId);
......
...@@ -978,10 +978,11 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -978,10 +978,11 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
int pageNum, int pageNum,
int pageSize, int pageSize,
String peasantHouseholdNo, String peasantHouseholdNo,
String ownersName){ String ownersName,
String ids){
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId); UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,peasantHouseholdNo,ownersName); List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,peasantHouseholdNo,ownersName,ids);
PageInfo<PeasantHousehold> page = new PageInfo(list); PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>(); Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
...@@ -995,9 +996,10 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -995,9 +996,10 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
int pageNum, int pageNum,
int pageSize, int pageSize,
String peasantHouseholdNo, String peasantHouseholdNo,
String ownersName){ String ownersName,
String ids){
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdListsg(unitInfoId,regionalCompaniesSeq,peasantHouseholdNo,ownersName); List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdListsg(unitInfoId,regionalCompaniesSeq,peasantHouseholdNo,ownersName,ids);
PageInfo<PeasantHousehold> page = new PageInfo(list); PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>(); Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
......
...@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO; ...@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*; import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl;
...@@ -77,6 +78,8 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -77,6 +78,8 @@ public class BigScreenAnalyseController extends BaseController {
@Autowired @Autowired
RiskWarningFeign riskWarningFeign; RiskWarningFeign riskWarningFeign;
@Autowired
IPermissionService permissionService;
@Autowired @Autowired
...@@ -107,14 +110,14 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -107,14 +110,14 @@ public class BigScreenAnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图")
@GetMapping(value = "/getHealthListInfo") @GetMapping(value = "/getHealthListInfo")
public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) { public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) {
List<String> gatewayIds = this.getGatewayIds();
if (StrUtil.isNotEmpty(stationCode)) { if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode); StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId(); stationCode = stationBasic.getFanGatewayId();
} }
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthListInfo(areaCode, stationCode); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthListInfo(areaCode, stationCode, gatewayIds);
List<String> time = new ArrayList<>(); List<String> time = new ArrayList<>();
List<String> valueList = new ArrayList<>(); List<String> valueList = new ArrayList<>();
healthListInfo.forEach(item -> { healthListInfo.forEach(item -> {
...@@ -808,7 +811,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper; ...@@ -808,7 +811,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
@GetMapping("/getFullViewRecall") @GetMapping("/getFullViewRecall")
public ResponseModel<Map<String, Object>> getFullViewRecall() { public ResponseModel<Map<String, Object>> getFullViewRecall() {
HashMap<String, Object> resultMapFinally = new HashMap<>(); HashMap<String, Object> resultMapFinally = new HashMap<>();
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo(); List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo();
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
...@@ -825,9 +828,9 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper; ...@@ -825,9 +828,9 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(); List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(gatewayIds);
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(); List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(null);
Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream() Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea, .collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
Collectors.groupingBy(FullViewRecallDataDTO::getStation, Collectors.groupingBy(FullViewRecallDataDTO::getStation,
...@@ -1151,4 +1154,16 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper; ...@@ -1151,4 +1154,16 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/**
* 获取用户权限(此处使用gatewayId)
*
* @return gatewayIds
*/
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableClassificationDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableClassificationDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanPointProcessVariableClassificationServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanPointProcessVariableClassificationServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -18,7 +19,7 @@ import java.util.List; ...@@ -18,7 +19,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* *
* *
* @author system_generator * @author system_generator
* @date 2023-08-15 * @date 2023-08-15
...@@ -31,6 +32,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC ...@@ -31,6 +32,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC
@Autowired @Autowired
IdxBizFanPointProcessVariableClassificationServiceImpl idxBizFanPointProcessVariableClassificationServiceImpl; IdxBizFanPointProcessVariableClassificationServiceImpl idxBizFanPointProcessVariableClassificationServiceImpl;
@Autowired
private IIdxBizTableService idxBizTableService;
/** /**
* 新增 * 新增
* *
...@@ -125,7 +129,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC ...@@ -125,7 +129,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询") @ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/selectParams") @GetMapping(value = "/selectParams")
public ResponseModel<List<Map<String,Object>>> selectParams(String tableName,String column,@RequestParam(required = false) String isFx) { public ResponseModel<List<Map<String,Object>>> selectParams(String tableName,String column,@RequestParam(required = false) String isFx) {
return ResponseHelper.buildResponse(idxBizFanPointProcessVariableClassificationServiceImpl.selectParams(column,tableName,isFx)); // return ResponseHelper.buildResponse(idxBizFanPointProcessVariableClassificationServiceImpl.selectParams(column,tableName,isFx));
List<Map<String, Object>> selectOptions = idxBizTableService.getSelectOptions(tableName, column, null,null, null, isFx);
return ResponseHelper.buildResponse(selectOptions);
} }
} }
...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; ...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRuleSet; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRuleSet;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRuleSet; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRuleSet;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointProcessVariableClassificationMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl;
...@@ -54,6 +55,8 @@ public class IdxBizFanWarningRecordController extends BaseController { ...@@ -54,6 +55,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
@Autowired @Autowired
FanWaringRecordMapper fanWaringRecordMapper; FanWaringRecordMapper fanWaringRecordMapper;
@Autowired
private IPermissionService permissionService;
@Autowired @Autowired
IdxBizFanPointProcessVariableClassificationMapper idxBizFanPointProcessVariableClassificationMapper; IdxBizFanPointProcessVariableClassificationMapper idxBizFanPointProcessVariableClassificationMapper;
...@@ -357,7 +360,8 @@ public class IdxBizFanWarningRecordController extends BaseController { ...@@ -357,7 +360,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> maps = fanWaringRecordMapper.selectFanWarningNum(station); List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> maps = fanWaringRecordMapper.selectFanWarningNum(station, gatewayIds);
Map<String, Map<String, Object>> equipmentNameInfoMap = maps.stream().collect(Collectors.toMap(t -> t.get("EQUIPMENT_NAME").toString(), t -> t)); Map<String, Map<String, Object>> equipmentNameInfoMap = maps.stream().collect(Collectors.toMap(t -> t.get("EQUIPMENT_NAME").toString(), t -> t));
List<Integer> wxList = new ArrayList<>(); List<Integer> wxList = new ArrayList<>();
...@@ -403,8 +407,8 @@ public class IdxBizFanWarningRecordController extends BaseController { ...@@ -403,8 +407,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
@GetMapping(value = "/selectEquipWarningTotal") @GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本") @ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<Map<String, Object>> selectEquipWarningTotal(@RequestParam String STATION, @RequestParam String EQUIPMENTNAME) { public ResponseModel<Map<String, Object>> selectEquipWarningTotal(@RequestParam String STATION, @RequestParam String EQUIPMENTNAME) {
Map<String, Object> maps = fanWaringRecordMapper.selectEquipWarningTotal(STATION, EQUIPMENTNAME); List<String> gatewayIds = this.getGatewayIds();
Map<String, Object> maps = fanWaringRecordMapper.selectEquipWarningTotal(STATION, EQUIPMENTNAME, gatewayIds);
return ResponseHelper.buildResponse(maps); return ResponseHelper.buildResponse(maps);
} }
...@@ -415,11 +419,20 @@ public class IdxBizFanWarningRecordController extends BaseController { ...@@ -415,11 +419,20 @@ public class IdxBizFanWarningRecordController extends BaseController {
Page<FanWarningRecord> page = new Page<>(); Page<FanWarningRecord> page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
List<FanWarningRecord> maps = fanWaringRecordMapper.selectWarningPoint(STATION, EQUIPMENTNAME, (current - 1) * size, size); List<String> gatewayIds = this.getGatewayIds();
List<FanWarningRecord> maps = fanWaringRecordMapper.selectWarningPoint(STATION, EQUIPMENTNAME, (current - 1) * size, size, gatewayIds);
page.setRecords(maps); page.setRecords(maps);
int total = fanWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME); int total = fanWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME);
page.setTotal(total); page.setTotal(total);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
} }
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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 org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "idx业务前置接口")
@RequestMapping(value = "/idx")
public class IdxBizTableController {
@Autowired
IIdxBizTableService idxBizTableService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "分页查询业务事实表的数据", notes = "分页查询业务事实表的数据-IDX前置接口")
@GetMapping(value = "/table/getPage")
public ResponseModel<Page<Map<String, Object>>> getTablePage(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(idxBizTableService.getPage(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "列表下拉框选项数据", notes = "列表下拉框选项数据")
@GetMapping(value = "/select-options")
public ResponseModel<List<Map<String, Object>>> getSelectOptions(
@RequestParam(value = "tableName") String tableName,
@RequestParam(value = "column") String column,
@RequestParam(value = "valueColumn", required = false) String valueColumn,
@RequestParam(value = "conditionColumn", required = false) String conditionColumn,
@RequestParam(value = "conditionValue", required = false) String conditionValue,
@RequestParam(value = "isFx", required = false) String isFx
) {
List<Map<String, Object>> selectOptions = idxBizTableService.getSelectOptions(tableName, column, valueColumn, conditionColumn, conditionValue, isFx);
return ResponseHelper.buildResponse(selectOptions);
}
}
...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.kafka.FanConditionVariablesMessage ...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.kafka.FanConditionVariablesMessage
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -24,10 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -24,10 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.jxiop.biz.kafka.Constant.*; import static com.yeejoin.amos.boot.module.jxiop.biz.kafka.Constant.*;
...@@ -43,6 +41,8 @@ public class KafkaAnalyseController { ...@@ -43,6 +41,8 @@ public class KafkaAnalyseController {
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired
IPermissionService permissionService;
@Autowired @Autowired
IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper; IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper;
...@@ -162,25 +162,26 @@ public class KafkaAnalyseController { ...@@ -162,25 +162,26 @@ public class KafkaAnalyseController {
@ApiOperation(value = "全景诊断回溯") @ApiOperation(value = "全景诊断回溯")
@GetMapping("/getFullViewRecall") @GetMapping("/getFullViewRecall")
public ResponseModel<List<FullViewRecallInfoDTO>> getFullViewRecall(@RequestParam(required = false, value = "analysisType") String analysisType) { public ResponseModel<List<FullViewRecallInfoDTO>> getFullViewRecall(@RequestParam(required = false, value = "analysisType") String analysisType) {
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfoByParam(analysisType); List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfoByParam(analysisType, gatewayIds);
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> equipmentIndexInfo = idxBizFanHealthIndexMapper.getEquipmentIndexInfoByParam(analysisType); List<Map<String, Object>> equipmentIndexInfo = idxBizFanHealthIndexMapper.getEquipmentIndexInfoByParam(analysisType, gatewayIds);
Map<String, Double> equipmentIndexInfoMap = equipmentIndexInfo.stream().collect(Collectors.toMap(t -> t.get("equipmentName").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> equipmentIndexInfoMap = equipmentIndexInfo.stream().collect(Collectors.toMap(t -> t.get("equipmentName").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> subSystemIndexInfo = idxBizFanHealthIndexMapper.getSubSystemIndexInfoByParam(analysisType); List<Map<String, Object>> subSystemIndexInfo = idxBizFanHealthIndexMapper.getSubSystemIndexInfoByParam(analysisType, gatewayIds);
Map<String, Double> subSystemIndexInfoMap = subSystemIndexInfo.stream().collect(Collectors.toMap(t -> t.get("subSystem").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> subSystemIndexInfoMap = subSystemIndexInfo.stream().collect(Collectors.toMap(t -> t.get("subSystem").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameIndexInfo = idxBizFanHealthIndexMapper.getPointNameIndexInfoByParam(analysisType); List<Map<String, Object>> pointNameIndexInfo = idxBizFanHealthIndexMapper.getPointNameIndexInfoByParam(analysisType, gatewayIds);
Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(); List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(gatewayIds);
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(); List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(gatewayIds);
Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream() Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea, .collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
Collectors.groupingBy(FullViewRecallDataDTO::getStation, Collectors.groupingBy(FullViewRecallDataDTO::getStation,
...@@ -384,4 +385,12 @@ public class KafkaAnalyseController { ...@@ -384,4 +385,12 @@ public class KafkaAnalyseController {
return resultDto; return resultDto;
} }
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
} }
...@@ -6,17 +6,10 @@ import java.sql.Timestamp; ...@@ -6,17 +6,10 @@ import java.sql.Timestamp;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.*; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.*;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -114,6 +107,8 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -114,6 +107,8 @@ public class TDBigScreenAnalyseController extends BaseController {
PvWaringRecordMapper pvWaringRecordMapper; PvWaringRecordMapper pvWaringRecordMapper;
@Autowired @Autowired
FanHealthIndexDayMapper fanHealthIndexDayMapper; FanHealthIndexDayMapper fanHealthIndexDayMapper;
@Autowired
IPermissionService permissionService;
@Autowired @Autowired
private IdxBizFanWarningRuleSetServiceImpl idxBizFanWarningRuleSetService; private IdxBizFanWarningRuleSetServiceImpl idxBizFanWarningRuleSetService;
...@@ -921,7 +916,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -921,7 +916,7 @@ public class TDBigScreenAnalyseController extends BaseController {
@GetMapping("/getFullViewRecall") @GetMapping("/getFullViewRecall")
public ResponseModel<Map<String, Object>> getFullViewRecall() { public ResponseModel<Map<String, Object>> getFullViewRecall() {
HashMap<String, Object> resultMapFinally = new HashMap<>(); HashMap<String, Object> resultMapFinally = new HashMap<>();
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo(); List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo();
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors
.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); .toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
...@@ -939,9 +934,9 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -939,9 +934,9 @@ public class TDBigScreenAnalyseController extends BaseController {
.collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), .collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(),
t -> Double.parseDouble(t.get("healthIndex").toString()))); t -> Double.parseDouble(t.get("healthIndex").toString())));
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(); List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(gatewayIds);
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(); List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(null);
Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list
.stream() .stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea, .collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
...@@ -1588,4 +1583,12 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -1588,4 +1583,12 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
} }
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.core.framework.GatewayIdAutowired;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO;
...@@ -71,6 +72,7 @@ public class TdInfoQueryController { ...@@ -71,6 +72,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanHealthIndexInfo") @PostMapping(value = "/getFanHealthIndexInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电") @ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电")
@GatewayIdAutowired
public ResponseModel<Page<FanHealthIndex>> getFanHealthIndexInfo(@RequestBody FanHealthIndexDto dto) throws ParseException { public ResponseModel<Page<FanHealthIndex>> getFanHealthIndexInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) { if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate(); String startDate = dto.getStartDate();
...@@ -138,6 +140,7 @@ public class TdInfoQueryController { ...@@ -138,6 +140,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getPvHealthIndexInfo") @PostMapping(value = "/getPvHealthIndexInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏") @ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏")
@GatewayIdAutowired
public ResponseModel<Page<PvHealthIndex>> getPvHealthIndexInfo(@RequestBody PvHealthIndexDto dto) throws ParseException { public ResponseModel<Page<PvHealthIndex>> getPvHealthIndexInfo(@RequestBody PvHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) { if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate(); String startDate = dto.getStartDate();
...@@ -188,6 +191,7 @@ public class TdInfoQueryController { ...@@ -188,6 +191,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanWarningRecordInfo") @PostMapping(value = "/getFanWarningRecordInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电") @ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电")
@GatewayIdAutowired
public ResponseModel<Page<FanWarningRecord>> getFanWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException { public ResponseModel<Page<FanWarningRecord>> getFanWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) { if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate(); String startDate = dto.getStartDate();
...@@ -237,6 +241,7 @@ public class TdInfoQueryController { ...@@ -237,6 +241,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getPvWarningRecordInfo") @PostMapping(value = "/getPvWarningRecordInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏") @ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏")
@GatewayIdAutowired
public ResponseModel<Page<PvWarningRecord>> getPvWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException { public ResponseModel<Page<PvWarningRecord>> getPvWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) { if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate(); String startDate = dto.getStartDate();
......
package com.yeejoin.amos.boot.module.jxiop.biz.core.framework;
import java.lang.annotation.*;
/**
* @author keyong
* @title: GatewayIdAutowired
* <pre>
* @description: TODO
* </pre>
* @date 2024/1/25 9:39
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface GatewayIdAutowired {
/**
* 是否添加当前登录人的gatewayId为参数进行过滤权限查询
* @return boolean
*/
boolean isNeedGatewayId() default true;
}
package com.yeejoin.amos.boot.module.jxiop.biz.core.framework;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;
/**
* @author keyong
* @title: GatewayIdAutowiredAspect
* <pre>
* @description: TODO
* </pre>
* @date 2024/1/25 10:21
*/
@Component
@Aspect
public class GatewayIdAutowiredAspect {
private static final transient Logger log = LoggerFactory.getLogger(GatewayIdAutowiredAspect.class);
@Autowired
private IPermissionService permissionService;
@Before(value = "@annotation(com.yeejoin.amos.boot.module.jxiop.biz.core.framework.GatewayIdAutowired) && @annotation(gatewayIdAutowired)")
public void doBefore(JoinPoint joinPoint, GatewayIdAutowired gatewayIdAutowired) {
if (gatewayIdAutowired.isNeedGatewayId()) {
try {
//获取入参列表
Object[] args = joinPoint.getArgs();
log.info("args: {}", JSON.toJSONString(args));
//入参判空
if (null == args || args.length == 0) {
log.info("No fields!");
return;
}
// 只有一个参数主要针对@RequestBody,一般只会有一个入参,若遇到多个@RequestParam,需循环处理
if (args.length == 1) {
Object arg = args[0];
List<String> ids = permissionService.getCurrentUserPermissions();
//获取字段域
Field[] fields = arg.getClass().getDeclaredFields();
log.info("getDeclaredFields: {}", JSON.toJSONString(fields));
if (Arrays.stream(fields).noneMatch(item -> "gatewayIds".equals(item.getName()))) {
log.info("No gatewayId field !!!");
return;
}
//入参中有"gatewayIds",获取该字段
Field field = arg.getClass().getDeclaredField("gatewayIds");
//判断是否可使用
boolean accessible = ((!Modifier.isPublic(field.getModifiers())
|| !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible());
//若不可用,则需要进行setAccessible
if (accessible) {
ServletRequestAttributes attributes
= (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// 获取request对象
HttpServletRequest request = attributes.getRequest();
log.info("Method name: {}", request.getRequestURI());
field.setAccessible(true);
//参数替换
field.set(arg, ids);
}
}
// 若是get方法,有多个参数则需要扩展
} catch (Exception e) {
log.error("切面参数设置异常", e);
}
}
}
}
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.dto; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -43,4 +44,5 @@ public class FanHealthIndexDto implements Serializable { ...@@ -43,4 +44,5 @@ public class FanHealthIndexDto implements Serializable {
private String subarray; private String subarray;
private String sortOne; private String sortOne;
private String sortsString; private String sortsString;
private List<String> gatewayIds;
} }
...@@ -45,5 +45,5 @@ public class PvHealthIndexDto { ...@@ -45,5 +45,5 @@ public class PvHealthIndexDto {
private String orderColumns; private String orderColumns;
private String sortOne; private String sortOne;
private String sortsString; private String sortsString;
private List<String> gatewayIds;
} }
...@@ -34,13 +34,13 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -34,13 +34,13 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, String>> getDateInfoBy15(); List<Map<String, String>> getDateInfoBy15();
List<Map<String, String>> getDateInfo(Date startTime, Date endTime); List<Map<String, String>> getDateInfo(Date startTime, Date endTime);
List<Map<String, String>> getHourInfo(Date startTime, Date endTime); List<Map<String, String>> getHourInfo(Date startTime, Date endTime);
List<Map<String, String>> getMomentInfo(Date startTime, Date endTime); List<Map<String, String>> getMomentInfo(Date startTime, Date endTime);
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode, List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode,
@Param("stationCode") String stationCode); @Param("stationCode") String stationCode, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getAllEquipAlarmInfo(@Param("tableName") String tableName); List<Map<String, Object>> getAllEquipAlarmInfo(@Param("tableName") String tableName);
...@@ -100,7 +100,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -100,7 +100,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
String getPointNameByIndexAddress(@Param("varDesc") String varDesc, @Param("tableName") String tableName, String getPointNameByIndexAddress(@Param("varDesc") String varDesc, @Param("tableName") String tableName,
@Param("gatewayId") String gatewayId); @Param("gatewayId") String gatewayId);
List<FullViewRecallDataDTO> getFullViewRecall(); List<FullViewRecallDataDTO> getFullViewRecall(@Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getStationIndexInfo(); List<Map<String, Object>> getStationIndexInfo();
...@@ -110,15 +110,15 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -110,15 +110,15 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getPointNameIndexInfo(); List<Map<String, Object>> getPointNameIndexInfo();
List<Map<String, Object>> getStationIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getStationIndexInfoByParam(@Param("analysisType") String analysisType, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getEquipmentIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getEquipmentIndexInfoByParam(@Param("analysisType") String analysisType, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getSubSystemIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getSubSystemIndexInfoByParam(@Param("analysisType") String analysisType, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getPointNameIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getPointNameIndexInfoByParam(@Param("analysisType") String analysisType, @Param("gatewayIds") List<String> gatewayIds);
List<IdxBizFanHealthLevel> getHealthLevelInfoList(); List<IdxBizFanHealthLevel> getHealthLevelInfoList(@Param("gatewayIds") List<String> gatewayIds);
List<String> getAddressInfo(); List<String> getAddressInfo();
......
package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface IdxBizTableMapper extends BaseMapper {
List<Map<String, Object>> getSelectOptions(
@Param("tableName") String tableName,
@Param("column") String column,
@Param("valueColumn") String valueColumn,
@Param("conditionColumn") String conditionColumn,
@Param("conditionValue") String conditionValue,
@Param("isFx") String isFx,
@Param("gatewayIds") List<String> gatewayIds
);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Map;
public interface IIdxBizTableService {
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
Page<Map<String, Object>> getPage(Map<String, Object> map);
/**
* 获取下拉列表参数
*
* @param tableName 表名
* @param column 列名
* @param valueColumn 数据值列
* @param conditionColumn 条件列名
* @param conditionValue 条件值
* @param isFx 是否是"分析变量"
*/
List<Map<String, Object>> getSelectOptions(String tableName, String column, String valueColumn, String conditionColumn, String conditionValue, String isFx);
}
...@@ -5,4 +5,5 @@ import java.util.List; ...@@ -5,4 +5,5 @@ import java.util.List;
public interface IPermissionService { public interface IPermissionService {
List<String> getCurrentUserPermissions(); List<String> getCurrentUserPermissions();
List<String> getCurrentUserProjectOrgCodes();
} }
...@@ -1666,9 +1666,9 @@ public class CommonServiceImpl { ...@@ -1666,9 +1666,9 @@ public class CommonServiceImpl {
Table healthData = Table.create("healthData"); Table healthData = Table.create("healthData");
healthData.addColumns(DoubleColumn.create("analysisVariable", analysisVariable), DoubleColumn.create("stdDev", stdDev), DoubleColumn.create("centerValue", centerValue), StringColumn.create("ProcessPoint1Id", ProcessPoint1Id), DoubleColumn.create("ProcessPoint1", ProcessPoint1), StringColumn.create("ProcessPoint2Id", ProcessPoint2Id), DoubleColumn.create("ProcessPoint2", ProcessPoint2), StringColumn.create("ProcessPoint3Id", ProcessPoint3Id), DoubleColumn.create("ProcessPoint3", ProcessPoint3), StringColumn.create("analysisVariableId", analysisVariableIds)); healthData.addColumns(DoubleColumn.create("analysisVariable", analysisVariable), DoubleColumn.create("stdDev", stdDev), DoubleColumn.create("centerValue", centerValue), StringColumn.create("ProcessPoint1Id", ProcessPoint1Id), DoubleColumn.create("ProcessPoint1", ProcessPoint1), StringColumn.create("ProcessPoint2Id", ProcessPoint2Id), DoubleColumn.create("ProcessPoint2", ProcessPoint2), StringColumn.create("ProcessPoint3Id", ProcessPoint3Id), DoubleColumn.create("ProcessPoint3", ProcessPoint3), StringColumn.create("analysisVariableId", analysisVariableIds));
logger.info("------------------------------------------开始调用健康指数计算算法开始----------------------------------------"); logger.info("------------------------------------------开始调用风机健康指数计算算法开始----------------------------------------");
logger.info("------------------------------------------调用地址:"+baseUrlZSFX); logger.info("------------------------------------------调用地址:"+baseUrlZSFX);
logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap)); //logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap));
String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body(); String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body();
JSONObject jsonObject = JSON.parseObject(response); JSONObject jsonObject = JSON.parseObject(response);
...@@ -1752,7 +1752,7 @@ public class CommonServiceImpl { ...@@ -1752,7 +1752,7 @@ public class CommonServiceImpl {
try { try {
logger.info("--------------------response: " + response); logger.info("--------------------response: " + response);
logger.info("------------------------------------------调用健康指数计算算法结束----------------------------------------"); logger.info("------------------------------------------调用风机健康指数计算算法结束----------------------------------------");
logger.info("------------------------------------------开始计算预警----------------------------------------"); logger.info("------------------------------------------开始计算预警----------------------------------------");
// healthStatusIndicatorService.healthWarningMinute(calendar, time); // healthStatusIndicatorService.healthWarningMinute(calendar, time);
...@@ -1949,9 +1949,9 @@ public class CommonServiceImpl { ...@@ -1949,9 +1949,9 @@ public class CommonServiceImpl {
Table healthData = Table.create("healthData"); Table healthData = Table.create("healthData");
healthData.addColumns(DoubleColumn.create("analysisVariable", analysisVariable), DoubleColumn.create("stdDev", stdDev), DoubleColumn.create("centerValue", centerValue), StringColumn.create("ProcessPoint1Id", ProcessPoint1Id), DoubleColumn.create("ProcessPoint1", ProcessPoint1), StringColumn.create("ProcessPoint2Id", ProcessPoint2Id), DoubleColumn.create("ProcessPoint2", ProcessPoint2), StringColumn.create("ProcessPoint3Id", ProcessPoint3Id), DoubleColumn.create("ProcessPoint3", ProcessPoint3), StringColumn.create("analysisVariableId", analysisVariableIds)); healthData.addColumns(DoubleColumn.create("analysisVariable", analysisVariable), DoubleColumn.create("stdDev", stdDev), DoubleColumn.create("centerValue", centerValue), StringColumn.create("ProcessPoint1Id", ProcessPoint1Id), DoubleColumn.create("ProcessPoint1", ProcessPoint1), StringColumn.create("ProcessPoint2Id", ProcessPoint2Id), DoubleColumn.create("ProcessPoint2", ProcessPoint2), StringColumn.create("ProcessPoint3Id", ProcessPoint3Id), DoubleColumn.create("ProcessPoint3", ProcessPoint3), StringColumn.create("analysisVariableId", analysisVariableIds));
logger.info("------------------------------------------开始调用健康指数计算算法开始----------------------------------------"); logger.info("------------------------------------------开始调用光伏健康指数计算算法开始----------------------------------------");
logger.info("------------------------------------------调用地址:"+baseUrlZSFX); logger.info("------------------------------------------调用地址:"+baseUrlZSFX);
logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap)); //logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap));
String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body(); String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body();
JSONObject jsonObject = JSON.parseObject(response); JSONObject jsonObject = JSON.parseObject(response);
if (jsonObject.containsKey("indexValue")) { if (jsonObject.containsKey("indexValue")) {
...@@ -2029,7 +2029,7 @@ public class CommonServiceImpl { ...@@ -2029,7 +2029,7 @@ public class CommonServiceImpl {
} }
try { try {
logger.info("--------------------response: " + response); logger.info("--------------------response: " + response);
logger.info("------------------------------------------调用健康指数计算算法结束----------------------------------------"); logger.info("------------------------------------------调用光伏健康指数计算算法结束----------------------------------------");
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -35,13 +35,6 @@ public class IPermissionServiceImpl implements IPermissionService { ...@@ -35,13 +35,6 @@ public class IPermissionServiceImpl implements IPermissionService {
@Autowired @Autowired
private StationBasicMapper stationBasicMapper; private StationBasicMapper stationBasicMapper;
// @Autowired
// public IPermissionServiceImpl(RedisUtils redisUtils, UserEmpowerMapper userEmpowerMapper, StationBasicMapper stationBasicMapper) {
// this.redisUtils = redisUtils;
// this.userEmpowerMapper = userEmpowerMapper;
// this.stationBasicMapper = stationBasicMapper;
// }
@Override @Override
public List<String> getCurrentUserPermissions() { public List<String> getCurrentUserPermissions() {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
...@@ -70,4 +63,33 @@ public class IPermissionServiceImpl implements IPermissionService { ...@@ -70,4 +63,33 @@ public class IPermissionServiceImpl implements IPermissionService {
} }
return result; return result;
} }
@Override
public List<String> getCurrentUserProjectOrgCodes() {
List<String> result = new ArrayList<>();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level").toString();
if (companyLevel.equals("categroy_leve2")) {
return null;
}
if (companyLevel.equals("area")) {
List<StationBasic> stationBasics = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
result = stationBasics.stream().map(StationBasic::getProjectOrgCode).collect(Collectors.toList());
return result;
}
if (companyLevel.equals("station")) {
StationBasic stationBasic = stationBasicMapper.selectOne(new QueryWrapper<StationBasic>().eq("project_org_code", permissionOrgCode));
result.add(stationBasic.getProjectOrgCode());
return result;
}
}
return result;
}
} }
...@@ -73,7 +73,7 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth ...@@ -73,7 +73,7 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
public final DecimalFormat dfSS = new DecimalFormat("0.00"); public final DecimalFormat dfSS = new DecimalFormat("0.00");
public Object getqyt(String type,String address,String statioName,String equipmentName, String arae,String startTime,String endTime){ public Object getqyt(String type,String address,String statioName,String equipmentName, String arae,String startTime,String endTime,List<String> gatewayIds){
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
try { try {
//获取场站网关 //获取场站网关
...@@ -118,7 +118,7 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth ...@@ -118,7 +118,7 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
endTime= sdf.format(currentDayEndTime); endTime= sdf.format(currentDayEndTime);
} }
List<IndicatorData> indicatorDataListActivePowers = new ArrayList<>(); List<IndicatorData> indicatorDataListActivePowers = new ArrayList<>();
indicatorDataListActivePowers= indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(tdid,startTime,endTime); indicatorDataListActivePowers= indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(tdid,startTime,endTime,gatewayIds);
List<String> axisData = new ArrayList<>(); List<String> axisData = new ArrayList<>();
List<String> activePowers = new ArrayList<>(); List<String> activePowers = new ArrayList<>();
for (int i = 0; i < indicatorDataListActivePowers.size(); i++) { for (int i = 0; i < indicatorDataListActivePowers.size(); i++) {
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.feign.IdxFeign;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizTableMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
@Slf4j
public class IdxBizTableServiceImpl implements IIdxBizTableService {
@Autowired
private IPermissionService permissionService;
@Autowired
private IdxBizTableMapper idxBizTableMapper;
@Autowired
private IdxFeign idxFeign;
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
public Page<Map<String, Object>> getPage(Map<String, Object> map) {
List<String> currentUserPermissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(currentUserPermissions)) {
currentUserPermissions = new ArrayList<>();
}
String gatewayIds = String.join(",", currentUserPermissions);
if (!gatewayIds.isEmpty()) {
map.put("GATEWAY_ID", String.format("[%s]", gatewayIds));
}
FeignClientResult<Page<Map<String, Object>>> page = idxFeign.getPage(map);
return page.getResult();
}
/**
* 获取下拉列表参数
*
* @param tableName 表名
* @param column 列名
* @param valueColumn 数据值列
* @param conditionColumn 条件列名
* @param conditionValue 条件值
* @param isFx 是否是"分析变量"
*/
@Override
public List<Map<String, Object>> getSelectOptions(String tableName, String column, String valueColumn, String conditionColumn, String conditionValue, String isFx) {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = new ArrayList<>();
}
return idxBizTableMapper.getSelectOptions(tableName, column, valueColumn, conditionColumn, conditionValue, isFx, permissions);
}
}
...@@ -21,11 +21,14 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> { ...@@ -21,11 +21,14 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " + "<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("equipmentName")String equipmentName,@Param("subSystem")String subSystem,@Param("analysisType")String analysisType,@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("pointName")String pointName, @Param("indexAddress")String indexAddress,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("equipmentName")String equipmentName,@Param("subSystem")String subSystem,@Param("analysisType")String analysisType,@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("pointName")String pointName, @Param("indexAddress")String indexAddress,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop,
@Param("current")Integer current,@Param("size") Integer size); @Param("current")Integer current,@Param("size") Integer size,
@Param("gatewayIds") List<String> gatewayIds
);
@Select("<script>"+ @Select("<script>"+
...@@ -47,9 +50,10 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> { ...@@ -47,9 +50,10 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} AND ts >= TODAY()-8h" + "SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} AND ts >= TODAY()-8h" +
"<if test='area!= null'> AND area = #{area} </if> " + "<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" + "<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" GROUP BY station,health_level order by sort"+ " GROUP BY station,health_level order by sort"+
"</script>") "</script>")
List<Map<String,Object>> selectEquipStatusByStation(@Param("area")String area,@Param("analysisObjType")String analysisObjType,@Param("station")String station); List<Map<String,Object>> selectEquipStatusByStation(@Param("area")String area,@Param("analysisObjType")String analysisObjType,@Param("station")String station, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getHealthInfoByArea(); List<Map<String, Object>> getHealthInfoByArea();
......
...@@ -20,9 +20,10 @@ public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> ...@@ -20,9 +20,10 @@ public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour>
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " + "<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</script>")
List<FanHealthIndexHour> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("current")Integer current,@Param("size") Integer size); List<FanHealthIndexHour> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("current")Integer current,@Param("size") Integer size,@Param("gatewayIds") List<String> gatewayIds);
} }
...@@ -20,9 +20,10 @@ public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMom ...@@ -20,9 +20,10 @@ public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMom
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " + "<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</script>")
List<FanHealthIndexMoment> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("current")Integer current,@Param("size") Integer size); List<FanHealthIndexMoment> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("current")Integer current,@Param("size") Integer size,@Param("gatewayIds") List<String> gatewayIds);
} }
...@@ -14,15 +14,15 @@ import java.util.Map; ...@@ -14,15 +14,15 @@ import java.util.Map;
public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> { public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> {
public List<Map<String,Object>> selectFanWarningNum(String station); public List<Map<String,Object>> selectFanWarningNum(String station, @Param("gatewayIds") List<String> gatewayIds);
public List<FanWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBSYSTEM); public List<FanWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBSYSTEM);
public List<FanWarningRecord> selectWarningPoint(String STATION,String EQUIPMENTNAME,Integer current,Integer size); public List<FanWarningRecord> selectWarningPoint(String STATION,String EQUIPMENTNAME,Integer current,Integer size, @Param("gatewayIds") List<String> gatewayIds);
public int selectWarningPointTotal(String STATION,String EQUIPMENTNAME); public int selectWarningPointTotal(String STATION,String EQUIPMENTNAME);
public Map<String,Object> selectEquipWarningTotal(String STATION,String EQUIPMENTNAME); public Map<String,Object> selectEquipWarningTotal(String STATION,String EQUIPMENTNAME, @Param("gatewayIds") List<String> gatewayIds);
int saveBatchWarningRecords(@Param("list") List<FanWarningRecord> list); int saveBatchWarningRecords(@Param("list") List<FanWarningRecord> list);
......
...@@ -22,6 +22,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { ...@@ -22,6 +22,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</script>")
...@@ -36,7 +37,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { ...@@ -36,7 +37,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Param("startTimeTop") String startTimeTop, @Param("startTimeTop") String startTimeTop,
@Param("endTimeTop")String endTimeTop, @Param("endTimeTop")String endTimeTop,
@Param("equipmentName")String equipmentName @Param("equipmentName")String equipmentName
, @Param("current")Integer current, @Param("size")Integer size); , @Param("current")Integer current, @Param("size")Integer size,@Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+ @Select("<script>"+
...@@ -51,16 +52,18 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { ...@@ -51,16 +52,18 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"</script>") "</script>")
int selectDataTotal(@Param("station")String station,@Param("analysisType")String analysisType,@Param("indexAddress")String indexAddress,@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("analysisObjType")String analysisObjType, @Param("subarray")String subarray, @Param("pointName")String pointName,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("equipmentName")String equipmentName); int selectDataTotal(@Param("station")String station,@Param("analysisType")String analysisType,@Param("indexAddress")String indexAddress,@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("analysisObjType")String analysisObjType, @Param("subarray")String subarray, @Param("pointName")String pointName,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("equipmentName")String equipmentName, @Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+ @Select("<script>"+
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} AND ts >= TODAY()-8h" + "SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} AND ts >= TODAY()-8h" +
"<if test='area!= null'> AND area = #{area} </if> " + "<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" + "<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" GROUP BY station,health_level order by sort"+ " GROUP BY station,health_level order by sort"+
"</script>") "</script>")
List<Map<String,Object>> selectEquipStatusByStationPv(@Param("area")String area, @Param("analysisObjType")String analysisObjType, @Param("station")String station); List<Map<String,Object>> selectEquipStatusByStationPv(@Param("area")String area, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+ @Select("<script>"+
...@@ -68,8 +71,9 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { ...@@ -68,8 +71,9 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='station!= null'>AND station = #{station} </if>" + "<if test='station!= null'>AND station = #{station} </if>" +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if>" + "<if test='subarray!= null'>AND subarray = #{subarray} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" GROUP BY station,health_level,equipment_name order by sort"+ " GROUP BY station,health_level,equipment_name order by sort"+
"</script>") "</script>")
List<Map<String,Object>> selectEquipStatusByEquipment(@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("equipmentName")String equipmentName, @Param("subarray") String subarray); List<Map<String,Object>> selectEquipStatusByEquipment(@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("equipmentName")String equipmentName, @Param("subarray") String subarray, @Param("gatewayIds") List<String> gatewayIds);
} }
...@@ -21,11 +21,12 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> { ...@@ -21,11 +21,12 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</script>")
List<PvHealthIndexHour> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop List<PvHealthIndexHour> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop
, @Param("current")Integer current, @Param("size")Integer size); , @Param("current")Integer current, @Param("size")Integer size,@Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+ @Select("<script>"+
"SELECT count(1)" + "SELECT count(1)" +
" FROM analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" + " FROM analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
...@@ -38,7 +39,8 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> { ...@@ -38,7 +39,8 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"</script>") "</script>")
int selectDataTotal(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop); int selectDataTotal(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("gatewayIds") List<String> gatewayIds);
} }
...@@ -21,11 +21,12 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen ...@@ -21,11 +21,12 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</script>")
List<PvHealthIndexMoment> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop List<PvHealthIndexMoment> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop
, @Param("current")Integer current, @Param("size")Integer size);; , @Param("current")Integer current, @Param("size")Integer size,@Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+ @Select("<script>"+
"SELECT count(1)" + "SELECT count(1)" +
...@@ -39,7 +40,8 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen ...@@ -39,7 +40,8 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"</script>") "</script>")
int selectDataTotal(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop); int selectDataTotal(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("gatewayIds") List<String> gatewayIds);
} }
...@@ -15,12 +15,12 @@ public interface PvWaringRecordMapper extends BaseMapper<PvWarningRecord> { ...@@ -15,12 +15,12 @@ public interface PvWaringRecordMapper extends BaseMapper<PvWarningRecord> {
public List<PvWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBARRAY); public List<PvWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBARRAY);
public List<Map<String,Object>> selectFanWarningNum(String station); public List<Map<String,Object>> selectFanWarningNum(String station, @Param("gatewayIds") List<String> gatewayIds);
List<PvWarningRecord> selectWarningPoint(String STATION, String EQUIPMENTNAME, String SUBARRAY,Integer current,Integer size); List<PvWarningRecord> selectWarningPoint(String STATION, String EQUIPMENTNAME, String SUBARRAY,Integer current,Integer size, @Param("gatewayIds") List<String> gatewayIds);
int selectWarningPointTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY); int selectWarningPointTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY, @Param("gatewayIds") List<String> gatewayIds);
Map<String, Object> selectEquipWarningTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY); Map<String, Object> selectEquipWarningTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY, @Param("gatewayIds") List<String> gatewayIds);
List<PvWarningRecord> getInfoByPage(@Param("dto") FanHealthIndexDto dto); List<PvWarningRecord> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
......
...@@ -48,8 +48,8 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> { ...@@ -48,8 +48,8 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
List<IndicatorData> selectByIndexNameAndDate(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId, @Param("date") String date, @Param("limitNum") Integer limitNum); List<IndicatorData> selectByIndexNameAndDate(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId, @Param("date") String date, @Param("limitNum") Integer limitNum);
@Select("select `value_f` as valueF, created_time from iot_data.indicator_data where id =#{id} and ts >= #{startTime} and ts <= #{endTime} ") // @Select("select `value_f` as valueF, created_time from iot_data.indicator_data where id =#{id} and ts >= #{startTime} and ts <= #{endTime} ")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("id") String id, @Param("startTime") String startTime, @Param("endTime") String endTime); List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("id") String id, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayIds") List<String> gatewayIds);
@Select("select `value`,`value_f`, address, gateway_id from iot_data.indicator_data where ts > NOW()-10m and gateway_id = #{gatewayId}") @Select("select `value`,`value_f`, address, gateway_id from iot_data.indicator_data where ts > NOW()-10m and gateway_id = #{gatewayId}")
List<IndicatorData> selectDataByGatewayIdAndAddress(@Param("gatewayId") String gatewayId); List<IndicatorData> selectDataByGatewayIdAndAddress(@Param("gatewayId") String gatewayId);
......
...@@ -90,7 +90,7 @@ spring.db3.datasource.password=taosdata ...@@ -90,7 +90,7 @@ spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
# 分析专用td数据库 analyse_data # ����ר��td���ݿ� analyse_data
#spring.db4.datasource.type: com.alibaba.druid.pool.DruidDataSource #spring.db4.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db4.datasource.url=jdbc:TAOS-RS://10.20.0.203:6041/analysis_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true spring.db4.datasource.url=jdbc:TAOS-RS://10.20.0.203:6041/analysis_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db4.datasource.username=root spring.db4.datasource.username=root
...@@ -181,19 +181,19 @@ spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.Str ...@@ -181,19 +181,19 @@ spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.Str
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.listener.ack-mode=manual_immediate spring.kafka.listener.ack-mode=manual_immediate
spring.kafka.listener.type=batch spring.kafka.listener.type=batch
#一次拉取数量 && 线程数量 ����ȡ���� && �߳�����
spring.kafka.consumer.max-poll-records=30 spring.kafka.consumer.max-poll-records=30
#spring.kafka.consumer.fetch-max-wait= 10000 #spring.kafka.consumer.fetch-max-wait= 10000
#当前时间向前偏移月数 向历史偏移月数 #��ǰʱ����ǰƫ������ ����ʷƫ������
last.month.num = 12 last.month.num = 12
#相关性 算法调用 #����� �㷨����
base.url.XGX=http://139.9.171.247:8052/intelligent-analysis/correlation base.url.XGX=http://139.9.171.247:8052/intelligent-analysis/correlation
#工况划分 算法调用地 #�������� �㷨���õ�ַ
base.url.GKHF=http://139.9.171.247:8052/intelligent-analysis/working-condition-division base.url.GKHF=http://139.9.171.247:8052/intelligent-analysis/working-condition-division
#相关性 算法调用 #����� �㷨����
base.url.ZXZ=http://139.9.171.247:8052/intelligent-analysis/central-value base.url.ZXZ=http://139.9.171.247:8052/intelligent-analysis/central-value
#指数分析,算法调用 ���������㷨����
base.url.zsfx:http://139.9.171.247:8052/intelligent-analysis/index-analysis base.url.zsfx:http://139.9.171.247:8052/intelligent-analysis/index-analysis
\ No newline at end of file
...@@ -166,6 +166,12 @@ ...@@ -166,6 +166,12 @@
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
</where> </where>
UNION ALL UNION ALL
( (
...@@ -187,6 +193,12 @@ ...@@ -187,6 +193,12 @@
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
) )
) b ON DATE_FORMAT( b.recDate, "%Y-%m-%d" ) = a.date ) b ON DATE_FORMAT( b.recDate, "%Y-%m-%d" ) = a.date
...@@ -730,6 +742,11 @@ ...@@ -730,6 +742,11 @@
AND SUB_SYSTEM is not null AND SUB_SYSTEM is not null
AND POINT_NAME is not null AND POINT_NAME is not null
AND INDEX_ADDRESS is not null AND INDEX_ADDRESS is not null
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
) )
UNION ALL UNION ALL
(SELECT ARAE AS area, (SELECT ARAE AS area,
...@@ -747,6 +764,11 @@ ...@@ -747,6 +764,11 @@
AND EQUIPMENT_NAME is not null AND EQUIPMENT_NAME is not null
AND POINT_NAME is not null AND POINT_NAME is not null
AND INDEX_ADDRESS is not null AND INDEX_ADDRESS is not null
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
) )
) a ) a
ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc
...@@ -857,16 +879,26 @@ ...@@ -857,16 +879,26 @@
GROUP_LOWER_LIMIT AS groupLowerLimit, GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_fan_health_level FROM idx_biz_fan_health_level
WHERE STATUS IS NOT NULL WHERE (STATUS IS NOT NULL
OR STATUS != '' OR STATUS != '')
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
UNION ALL UNION ALL
SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType, SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType,
HEALTH_LEVEL AS healthLevel, HEALTH_LEVEL AS healthLevel,
GROUP_LOWER_LIMIT AS groupLowerLimit, GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_pv_health_level FROM idx_biz_pv_health_level
WHERE STATUS IS NOT NULL WHERE (STATUS IS NOT NULL
OR STATUS != '' OR STATUS != '')
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select> </select>
<select id="getAddressInfo" resultType="java.lang.String"> <select id="getAddressInfo" resultType="java.lang.String">
select index_address select index_address
...@@ -1321,6 +1353,11 @@ ...@@ -1321,6 +1353,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
GROUP BY STATION GROUP BY STATION
UNION ALL UNION ALL
...@@ -1342,6 +1379,11 @@ ...@@ -1342,6 +1379,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
GROUP BY STATION GROUP BY STATION
) )
...@@ -1369,6 +1411,11 @@ ...@@ -1369,6 +1411,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
GROUP BY EQUIPMENT_NAME GROUP BY EQUIPMENT_NAME
UNION ALL UNION ALL
...@@ -1390,6 +1437,11 @@ ...@@ -1390,6 +1437,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
GROUP BY SUBARRAY GROUP BY SUBARRAY
) )
...@@ -1420,6 +1472,11 @@ ...@@ -1420,6 +1472,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
GROUP BY SUB_SYSTEM GROUP BY SUB_SYSTEM
UNION ALL UNION ALL
...@@ -1441,6 +1498,11 @@ ...@@ -1441,6 +1498,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
GROUP BY EQUIPMENT_NAME GROUP BY EQUIPMENT_NAME
) )
...@@ -1469,6 +1531,11 @@ ...@@ -1469,6 +1531,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
GROUP BY INDEX_ADDRESS GROUP BY INDEX_ADDRESS
UNION ALL UNION ALL
...@@ -1490,6 +1557,11 @@ ...@@ -1490,6 +1557,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
GROUP BY INDEX_ADDRESS GROUP BY INDEX_ADDRESS
) )
...@@ -1616,20 +1688,20 @@ ...@@ -1616,20 +1688,20 @@
<select id="getHourInfo" resultType="java.util.Map"> <select id="getHourInfo" resultType="java.util.Map">
SELECT SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL @s-1 HOUR ), '%Y-%m-%d %H:%i:%s' ) AS date, DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL @s-1 HOUR ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index` ( @s := @s + 1 )- 1 AS `index`
FROM FROM
mysql.help_topic, mysql.help_topic,
( SELECT @s := 1 ) temp ( SELECT @s := 1 ) temp
WHERE WHERE
TIMESTAMPDIFF( HOUR, #{startTime} , #{endTime}) >= @s-1 TIMESTAMPDIFF( HOUR, #{startTime} , #{endTime}) >= @s-1
</select> </select>
<select id="getMomentInfo" resultType="java.util.Map"> <select id="getMomentInfo" resultType="java.util.Map">
SELECT SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL (@s-1)*10 MINUTE ), '%Y-%m-%d %H:%i:%s' ) AS date, DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL (@s-1)*10 MINUTE ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index` ( @s := @s + 1 )- 1 AS `index`
FROM FROM
mysql.help_topic, mysql.help_topic,
( SELECT @s := 1 ) temp ( SELECT @s := 1 ) temp
WHERE WHERE
TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1 TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
</select> </select>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizTableMapper">
<select id="getSelectOptions" resultType="java.util.Map">
SELECT
DISTINCT ${column} AS text,
<if test="valueColumn != null and valueColumn != ''">
${valueColumn} AS value
</if>
<if test="valueColumn == null or valueColumn == ''">
${column} AS value
</if>
FROM
${tableName}
WHERE
${column} IS NOT NULL AND ${column} != ''
<if test="isFx != null and isFx != ''">
AND TAG_CODE = '分析变量'
</if>
<if test="conditionColumn != null and conditionColumn != '' and conditionValue != null and conditionValue != ''">
AND ${conditionColumn} = #{conditionValue}
</if>
<if test="gatewayIds != null">
<if test="gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
<if test="gatewayIds.size() == 0">
AND 1 = 2
</if>
</if>
GROUP BY
${column}
</select>
</mapper>
...@@ -2,4 +2,19 @@ ...@@ -2,4 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper">
<select id="selectDataByequipmentIndexNameAndtimeAndEquipmentNumber" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData">
SELECT
`value_f` AS valueF,
created_time
FROM
iot_data.indicator_data
WHERE
id =#{id} AND ts >= #{startTime} AND ts &lt;= #{endTime}
<if test="gatewayIds != null and gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
</select>
</mapper> </mapper>
...@@ -81,6 +81,11 @@ ...@@ -81,6 +81,11 @@
<if test="station != null"> <if test="station != null">
and station = #{station} and station = #{station}
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by `station`, group by `station`,
`equipment_name`, `equipment_name`,
`warning_name`) a `warning_name`) a
...@@ -129,6 +134,11 @@ ...@@ -129,6 +134,11 @@
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND a.equipment_name = #{EQUIPMENTNAME} AND a.equipment_name = #{EQUIPMENTNAME}
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> AND GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by group by
station, station,
equipment_name, equipment_name,
...@@ -198,6 +208,11 @@ ...@@ -198,6 +208,11 @@
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND z.equipment_name = #{EQUIPMENTNAME} AND z.equipment_name = #{EQUIPMENTNAME}
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by group by
`z`.`station`, `z`.`station`,
`z`.`warning_name`, `z`.`warning_name`,
...@@ -220,6 +235,11 @@ ...@@ -220,6 +235,11 @@
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if> <if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if> <if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if> <if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
<if test="dto.gatewayIds != null and dto.gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="dto.gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
<if test="dto.orderColumns != null and dto.orderColumns != ''"> <if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns} order by ${dto.orderColumns}
...@@ -242,6 +262,11 @@ ...@@ -242,6 +262,11 @@
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if> <if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if> <if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if> <if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
<if test="dto.gatewayIds != null and dto.gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="dto.gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
</select> </select>
......
...@@ -105,6 +105,11 @@ ...@@ -105,6 +105,11 @@
<if test="station != null"> <if test="station != null">
and station = #{station} and station = #{station}
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by group by
re.station, re.station,
re.subarray, re.subarray,
...@@ -140,6 +145,11 @@ ...@@ -140,6 +145,11 @@
<if test="SUBARRAY != '' and SUBARRAY != null"> <if test="SUBARRAY != '' and SUBARRAY != null">
AND a.subarray = #{SUBARRAY} AND a.subarray = #{SUBARRAY}
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> AND GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by group by
station, station,
equipment_name, equipment_name,
...@@ -173,6 +183,11 @@ ...@@ -173,6 +183,11 @@
<if test="SUBARRAY != '' and SUBARRAY != null"> <if test="SUBARRAY != '' and SUBARRAY != null">
AND a.subarray = #{SUBARRAY} AND a.subarray = #{SUBARRAY}
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> AND GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by group by
station, station,
equipment_name, equipment_name,
...@@ -216,6 +231,11 @@ ...@@ -216,6 +231,11 @@
<if test="SUBARRAY != '' and SUBARRAY != null"> <if test="SUBARRAY != '' and SUBARRAY != null">
AND z.subarray = #{SUBARRAY} AND z.subarray = #{SUBARRAY}
</if> </if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> AND GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by group by
`z`.`station`, `z`.`station`,
`z`.`warning_name`, `z`.`warning_name`,
......
package com.yeejoin.amos.boot.module.jxiop.api.feign; package com.yeejoin.amos.boot.module.jxiop.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -17,4 +18,10 @@ public interface IdxFeign { ...@@ -17,4 +18,10 @@ public interface IdxFeign {
FeignClientResult<Map<String, Object>> healthIndexData(@RequestParam(required = false, value = "parentCode") String parentCode, FeignClientResult<Map<String, Object>> healthIndexData(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "stationType") String stationType); @RequestParam(required = false, value = "stationType") String stationType);
/**
* 分页查询业务事实表的数据
*/
@GetMapping("/table/getPage")
FeignClientResult<Page<Map<String, Object>>> getPage(@RequestParam Map<String, Object> map);
} }
package com.yeejoin.amos.boot.module.jxiop.api.feign; package com.yeejoin.amos.boot.module.jxiop.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -39,4 +40,35 @@ public interface McbWarningFeign { ...@@ -39,4 +40,35 @@ public interface McbWarningFeign {
@PostMapping("/task/updateRawDataByTraceId") @PostMapping("/task/updateRawDataByTraceId")
FeignClientResult<Boolean> updateRawDataByTraceId(@RequestParam(value = "traceId") String traceId, @RequestParam(value = "rawData") String rawData); FeignClientResult<Boolean> updateRawDataByTraceId(@RequestParam(value = "traceId") String traceId, @RequestParam(value = "rawData") String rawData);
/**
* 任务详情分页列表
*/
@GetMapping("/warning-warning-info/page")
FeignClientResult<Page<Map<String, Object>>> getTaskDetailPage(@RequestParam Map<String, Object> map);
/**
* 问题记录分页列表
*/
@GetMapping("/warning-question-info/questionPage")
FeignClientResult<Page<Map<String, Object>>> getQuestionRecordPage(@RequestParam Map<String, Object> map);
/**
* 任务详情、问题记录左侧树
*/
@GetMapping("/warning-warning-info/tree")
FeignClientResult getWarnTree(@RequestParam Map<String, Object> map);
/**
* 任务详情列表统计
*/
@GetMapping("/warning-warning-info/statistics")
FeignClientResult getTaskDetailStatistic(@RequestParam Map<String, Object> map);
/**
* 问题记录列表统计
*/
@GetMapping("/warning-question-info/questionPageTopStatistics")
FeignClientResult getQuestionRecordStatistic(@RequestParam Map<String, Object> map);
} }
package com.yeejoin.amos.boot.module.jxiop.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Map;
public interface IMcbWarningService {
/**
* 今日预警-预警总数
*
* @param processingStatus 处理状态
* @return 预警总数
*/
Map<String, Object> queryTodayCount(Integer processingStatus);
/**
* 近七日预警统计
*
* @return 预警统计
*/
List<Map<String, Object>> queryWeekCount();
/**
* 预警信息列表
*
* @return 预警信息列表
*/
Page<Map<String, Object>> queryWarningPage(Page<Map<String, Object>> page, Integer processingStatus, String eventLevel, String createDate, String warningSourceType);
/**
* 预警信息总数
*
* @return 预警信息总数
*/
Long queryWarningCount(Integer processingStatus, String eventLevel, String createDate, String warningSourceType);
/**
* 问题信息列表
*
* @return 问题信息列表
*/
Page<Map<String, Object>> queryQuestionPage(Page<Map<String, Object>> page, Integer completionStatus);
/**
* 问题信息列表
*
* @return 问题信息列表
*/
Long queryQuestionCount(Integer completionStatus);
/**
* 获取地图点位/路线
*
* @return 地图点位/路线
*/
Object queryMapRoutes(String province);
/**
* 任务详情分页列表
*
* @return 任务详情分页列表
*/
Page<Map<String, Object>> getTaskDetailPage(Map<String, Object> map);
/**
* 问题记录分页列表
*
* @return 任务详情分页列表
*/
Page<Map<String, Object>> getQuestionRecordPage(Map<String, Object> map);
/**
* 任务详情、问题记录左侧树
*/
Object getWarnTree(Map<String, Object> map);
/**
* 任务详情列表统计
*/
Object getTaskDetailStatistic(Map<String, Object> map);
/**
* 问题记录列表统计
*/
Object getQuestionRecordStatistic(Map<String, Object> map);
}
package com.yeejoin.amos.boot.module.jxiop.api.service;
import java.util.List;
public interface IPermissionService {
List<String> getCurrentUserPermissions();
List<String> getCurrentUserProjectOrgCodes();
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mcbwarningmapper.McbWarningMapper">
<select id="queryTodayCount" resultType="java.util.Map">
SELECT
COUNT(*) as count
FROM
amos_mcb.mcb_warning_warning_info log
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = log.SOURCE_ATTRIBUTION
<where>
date(log.CREATE_DATE) = CURRENT_DATE
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="processingStatus != null and processingStatus != ''">
AND log.processing_status = #{processingStatus}
</if>
</where>
</select>
<select id="queryWeekCount" resultType="java.util.Map">
SELECT
DATE_FORMAT(b.alarmDate, '%m/%d') AS alarmDate,
b.code AS code,
b.province AS province,
IFNULL(count(log.SEQUENCE_NBR), 0) AS countNum
FROM
(
SELECT
source.CODE AS code,
a.DATE AS alarmDate,
source.PROVINCE AS province
FROM
amos_mcb.mcb_warning_base_source_attribution source,
(
SELECT CURDATE() AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 1 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 2 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 3 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 4 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 5 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 6 DAY ) AS date
) a
) b
LEFT JOIN amos_mcb.mcb_warning_warning_info log ON date(log.CREATE_DATE) = b.alarmDate AND log.SOURCE_ATTRIBUTION = b.CODE
GROUP BY
-- b.code,
b.alarmDate
<trim prefix="having" prefixOverrides="and">
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND log.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</trim>
ORDER BY
b.alarmDate ASC
</select>
<select id="queryWarningList" resultType="java.util.Map">
SELECT
log.SEQUENCE_NBR,
DATE_FORMAT(log.CREATE_DATE, '%Y-%m-%d %H:%i:%s') AS CREATE_DATE,
log.EVENT_LEVEL_DESC,
log.EVENT_LEVEL,
log.SOURCE_ATTRIBUTION_DESC,
log.SOURCE_ATTRIBUTION,
log.CONTENT,
LEVEL.COLOR,
source.PROVINCE,
log.WARNING_SOURCE_TYPE
FROM
amos_mcb.mcb_warning_warning_info log
LEFT JOIN amos_mcb.mcb_warning_base_warning_level LEVEL ON log.EVENT_LEVEL = LEVEL.CODE and LEVEL.SEQUENCE_NBR in (1, 2, 3)
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = log.SOURCE_ATTRIBUTION
<where>
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND log.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="processingStatus != null">
AND log.PROCESSING_STATUS = #{processingStatus}
</if>
<if test="eventLevel != null and eventLevel != ''">
AND log.EVENT_LEVEL = #{eventLevel}
</if>
<if test="createDate != null and createDate != ''">
AND log.CREATE_DATE &gt;= concat(#{createDate}, ' 00:00:00')
AND log.CREATE_DATE &lt;= concat(#{createDate}, ' 23:59:59')
</if>
<if test="warningSourceType != null and warningSourceType != ''">
AND log.WARNING_SOURCE_TYPE = #{warningSourceType}
</if>
</where>
ORDER BY
log.CREATE_DATE DESC
LIMIT #{start}, #{offset}
</select>
<select id="queryWarningCount" resultType="java.lang.Long">
SELECT
count(*)
FROM
amos_mcb.mcb_warning_warning_info log
LEFT JOIN amos_mcb.mcb_warning_base_warning_level LEVEL ON log.EVENT_LEVEL = LEVEL.CODE and LEVEL.SEQUENCE_NBR in (1, 2, 3)
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = log.SOURCE_ATTRIBUTION
<where>
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND log.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="processingStatus != null">
AND log.PROCESSING_STATUS = #{processingStatus}
</if>
<if test="eventLevel != null and eventLevel != ''">
AND log.EVENT_LEVEL = #{eventLevel}
</if>
<if test="createDate != null and createDate != ''">
AND log.CREATE_DATE &gt;= concat(#{createDate}, ' 00:00:00')
AND log.CREATE_DATE &lt;= concat(#{createDate}, ' 23:59:59')
</if>
<if test="warningSourceType != null and warningSourceType != ''">
AND log.WARNING_SOURCE_TYPE = #{warningSourceType}
</if>
</where>
</select>
<select id="queryQuestionList" resultType="java.util.Map">
SELECT
question.SEQUENCE_NBR,
DATE_FORMAT(ifnull(question.REC_DATE, question.CREATE_DATE), '%Y-%m-%d %H:%i:%s') AS REC_DATE,
question.COMPLETION_STATUS_DESC,
question.COMPLETION_STATUS,
question.SOURCE_ATTRIBUTION_DESC,
question.SOURCE_ATTRIBUTION,
question.CONTENT,
source.PROVINCE
FROM
amos_mcb.mcb_warning_question_info question
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = question.SOURCE_ATTRIBUTION
<where>
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND question.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="completionStatus != null">
AND question.COMPLETION_STATUS = #{completionStatus}
</if>
</where>
ORDER BY
question.REC_DATE DESC
LIMIT #{start}, #{offset}
</select>
<select id="queryQuestionCount" resultType="java.lang.Long">
SELECT
count(*)
FROM
amos_mcb.mcb_warning_question_info question
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = question.SOURCE_ATTRIBUTION
<where>
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND question.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="completionStatus != null">
AND question.COMPLETION_STATUS = #{completionStatus}
</if>
</where>
</select>
</mapper>
...@@ -97,7 +97,9 @@ public class CommonServiceImpl { ...@@ -97,7 +97,9 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble(); if(!ObjectUtils.isEmpty(equipments)) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
}
return result; return result;
} }
...@@ -128,7 +130,9 @@ public class CommonServiceImpl { ...@@ -128,7 +130,9 @@ public class CommonServiceImpl {
// } // }
public Double getTotalByIndicatior(List<Map<String, Object>> mapList, String indicator) { public Double getTotalByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double totalvalue = 0.0; Double totalvalue = 0.0;
totalvalue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum(); if(!ObjectUtils.isEmpty(mapList)) {
totalvalue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
}
return Double.valueOf(String.format("%.2f", totalvalue)); return Double.valueOf(String.format("%.2f", totalvalue));
} }
...@@ -139,7 +143,9 @@ public class CommonServiceImpl { ...@@ -139,7 +143,9 @@ public class CommonServiceImpl {
*/ */
public Double getAvgvalueByIndicatior(List<Map<String, Object>> mapList, String indicator) { public Double getAvgvalueByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double avageValue = 0.0; Double avageValue = 0.0;
avageValue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum(); if(!ObjectUtils.isEmpty(mapList)) {
avageValue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
}
return Double.valueOf(String.format("%.2f", avageValue)); return Double.valueOf(String.format("%.2f", avageValue));
} }
...@@ -232,7 +238,11 @@ public class CommonServiceImpl { ...@@ -232,7 +238,11 @@ public class CommonServiceImpl {
stationCacheInfoDto.setStationType(stationBasic.getStationType()); stationCacheInfoDto.setStationType(stationBasic.getStationType());
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0)); stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0)); stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber()))); Double installedCapacity = 0.0d;
if(!ObjectUtils.isEmpty(sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber()))){
installedCapacity =sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber());
}
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", installedCapacity));
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId()); stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0)); stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId()); stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
...@@ -371,7 +381,10 @@ public class CommonServiceImpl { ...@@ -371,7 +381,10 @@ public class CommonServiceImpl {
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum(); if(equipments!=null)
{
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
}
return result; return result;
} }
......
...@@ -1936,17 +1936,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1936,17 +1936,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Double powerOfDay = 0.0000; Double powerOfDay = 0.0000;
Double powerOfMonth = 0.0000; Double powerOfMonth = 0.0000;
Double powerOfAnnual = 0.0000; Double powerOfAnnual = 0.0000;
if(ObjectUtils.isEmpty(query)){ if(result!=null)
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")); {
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")); if(ObjectUtils.isEmpty(query)){
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")); powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
}else { powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)); powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); }else {
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)); powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
} powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
}
Map<String, Object> hashMap = new HashMap<>(); Map<String, Object> hashMap = new HashMap<>();
hashMap.put("日发电量",powerOfDay); hashMap.put("日发电量",powerOfDay);
hashMap.put("月发电量",powerOfMonth); hashMap.put("月发电量",powerOfMonth);
......
...@@ -15,11 +15,12 @@ ...@@ -15,11 +15,12 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencies> <dependencies>
<!--
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-ugp-api</artifactId> <artifactId>amos-boot-module-ugp-api</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-common-biz</artifactId> <artifactId>amos-boot-module-common-biz</artifactId>
...@@ -53,7 +54,7 @@ ...@@ -53,7 +54,7 @@
<version>5.7.22</version> <version>5.7.22</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
......
...@@ -13,5 +13,6 @@ import java.util.Map; ...@@ -13,5 +13,6 @@ import java.util.Map;
* @createDate: 2023/11/9 * @createDate: 2023/11/9
*/ */
public interface UserEmpowerMapper extends BaseMapper<StdUserEmpower> { public interface UserEmpowerMapper extends BaseMapper<StdUserEmpower> {
@Select("select company_name as companyName , level from privilege_company where org_code = #{orgCode}")
Map<String,String> getCompanyInfoByOrgCode(String orgCode);
} }
package com.yeejoin.amos.boot.module.jxiop.biz.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.util.Properties;
@Configuration
@MapperScan(basePackages = "com.yeejoin.amos.boot.module.jxiop.biz.mcbwarningmapper", sqlSessionFactoryRef = "mcbWarningSqlSessionFactory")
public class MabWarningDbConfig {
private Logger logger = LoggerFactory.getLogger(MabWarningDbConfig.class);
// 精确到 master 目录,以便跟其他数据源隔离
private static final String MAPPER_LOCATION = "classpath*:mapper/warning/*.xml";
@Value("${spring.db3.datasource.url}")
private String dbUrl;
@Value("${spring.db2.datasource.username}")
private String username;
@Value("${spring.db2.datasource.password}")
private String password;
@Value("${spring.db2.datasource.driver-class-name}")
private String driverClassName;
@Bean(name="mcbWarningDataSource") //声明其为Bean实例
public DataSource masterDataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(this.dbUrl);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
return datasource;
}
@Bean(name = "mcbWarningTransactionManager")
public DataSourceTransactionManager masterTransactionManager() {
return new DataSourceTransactionManager(masterDataSource());
}
@Bean(name = "mcbWarningSqlSessionFactory")
public SqlSessionFactory masterSqlSessionFactory(@Qualifier("mcbWarningDataSource") DataSource masterDataSource)
throws Exception {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(masterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(MabWarningDbConfig.MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.jxiop.biz.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
//分页插件
Interceptor interceptor = new PageInterceptor();
Properties properties = new Properties();
properties.setProperty("helperDialect", "mysql");
properties.setProperty("offsetAsPageNum", "true");
properties.setProperty("rowBoundsWithCount", "true");
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments","true");
properties.setProperty("params", "pageNum=pageNum;pageSize=pageSize;");
interceptor.setProperties(properties);
sessionFactory.setPlugins(interceptor);
return sessionFactory.getObject();
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMcbWarningService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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 org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "McbWarning Controller")
@RequestMapping(value = "/warning")
public class McbWarningController {
@Autowired
private IMcbWarningService mcbWarningService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]今日预警-预警总数", notes = "[监测总览]今日预警-预警总数")
@GetMapping(value = "/count/today")
public ResponseModel<Map<String, Object>> queryTodayCount(@RequestParam(value = "processingStatus", required = false) Integer processingStatus) {
return ResponseHelper.buildResponse(mcbWarningService.queryTodayCount(processingStatus));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]近七日预警统计", notes = "[监测总览]近七日预警统计")
@GetMapping(value = "/count/week")
public ResponseModel<List<Map<String, Object>>> queryWeekCount() {
return ResponseHelper.buildResponse(mcbWarningService.queryWeekCount());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]预警信息列表", notes = "[监测总览]预警信息列表")
@GetMapping(value = "/warning/page")
public ResponseModel<Page<Map<String, Object>>> queryWarningPage(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
@RequestParam(value = "processingStatus", required = false) Integer processingStatus,
@RequestParam(value = "eventLevel", required = false) String eventLevel,
@RequestParam(value = "createDate", required = false) String createDate,
@RequestParam(value = "warningSourceType", required = false) String warningSourceType
) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
return ResponseHelper.buildResponse(mcbWarningService.queryWarningPage(page, processingStatus, eventLevel, createDate, warningSourceType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]预警信息总数", notes = "[监测总览]预警信息总数")
@GetMapping(value = "/warning/count")
public ResponseModel<Map<String, Object>> queryWarningCount(@RequestParam(value = "processingStatus", required = false) Integer processingStatus,
@RequestParam(value = "eventLevel", required = false) String eventLevel,
@RequestParam(value = "createDate", required = false) String createDate,
@RequestParam(value = "warningSourceType", required = false) String warningSourceType) {
Long count = mcbWarningService.queryWarningCount(processingStatus, eventLevel, createDate, warningSourceType);
Map<String, Object> result = new HashMap<String, Object>() {{
this.put("count", count);
}};
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]问题列表", notes = "[监测总览]问题列表")
@GetMapping(value = "/question/page")
public ResponseModel<Page<Map<String, Object>>> queryQuestionList(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
@RequestParam(value = "completionStatus", required = false) Integer completionStatus) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
return ResponseHelper.buildResponse(mcbWarningService.queryQuestionPage(page, completionStatus));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "任务详情、问题记录左侧树", notes = "任务详情、问题记录左侧树")
@GetMapping(value = "/warning-warning-info/tree")
public ResponseModel getWarnTree(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getWarnTree(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "任务详情分页列表", notes = "任务详情分页列表")
@GetMapping(value = "/warning-warning-info/page")
public ResponseModel<Page<Map<String, Object>>> getTaskDetailPage(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getTaskDetailPage(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "任务详情统计", notes = "任务详情统计")
@GetMapping(value = "/warning-warning-info/statistics")
public ResponseModel getTaskDetailStatistic(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getTaskDetailStatistic(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "问题记录分页列表", notes = "问题记录分页列表")
@GetMapping(value = "/warning-question-info/questionPage")
public ResponseModel<Page<Map<String, Object>>> getQuestionRecordPage(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getQuestionRecordPage(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "问题记录统计", notes = "问题记录统计")
@GetMapping(value = "/warning-question-info/questionPageTopStatistics")
public ResponseModel getQuestionRecordStatistic(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getQuestionRecordStatistic(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]问题总数", notes = "[监测总览]问题总数")
@GetMapping(value = "/question/count")
public ResponseModel<Map<String, Object>> queryQuestionCount(@RequestParam(value = "completionStatus", required = false) Integer completionStatus) {
Long count = mcbWarningService.queryQuestionCount(completionStatus);
Map<String, Object> result = new HashMap<String, Object>() {{
this.put("count", count);
}};
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]地图点位/路线", notes = "[监测总览]地图点位/路线")
@GetMapping(value = "/map/routes")
public ResponseModel<Object> queryMapRoutes(@RequestParam(value = "province", required = false) String province) {
return ResponseHelper.buildResponse(mcbWarningService.queryMapRoutes(province));
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.mcbwarningmapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface McbWarningMapper extends BaseMapper {
/**
* 今日预警-预警总数
*
* @param processingStatus 处理状态
* @return 总数信息
*/
Map<String, Object> queryTodayCount(
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("processingStatus") Integer processingStatus
);
/**
* 近七日预警统计
*
* @return 预警统计
*/
List<Map<String, Object>> queryWeekCount(
@Param("projectOrgCodes") List<String> projectOrgCodes
);
/**
* 预警列表
*
* @return 预警列表
*/
List<Map<String, Object>> queryWarningList(
@Param("start") Long start,
@Param("offset") Long offset,
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("processingStatus") Integer processingStatus,
@Param("eventLevel") String eventLevel,
@Param("createDate") String createDate,
@Param("warningSourceType") String warningSourceType
);
/**
* 预警总数
*
* @return 预警总数
*/
Long queryWarningCount(
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("processingStatus") Integer processingStatus,
@Param("eventLevel") String eventLevel,
@Param("createDate") String createDate,
@Param("warningSourceType") String warningSourceType
);
/**
* 问题列表
*
* @return 问题列表
*/
List<Map<String, Object>> queryQuestionList(
@Param("start") Long start,
@Param("offset") Long offset,
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("completionStatus") Integer completionStatus
);
/**
* 问题总数
*
* @return 问题总数
*/
Long queryQuestionCount(
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("completionStatus") Integer completionStatus
);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper.UserEmpowerMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.StdUserEmpower;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class IPermissionServiceImpl implements IPermissionService {
@Autowired
private RedisUtils redisUtils;
@Autowired
private UserEmpowerMapper userEmpowerMapper;
@Autowired
private StationBasicMapper stationBasicMapper;
@Override
public List<String> getCurrentUserPermissions() {
List<String> result = new ArrayList<>();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level");
if (companyLevel.equals("categroy_leve2")) {
return null;
}
if (companyLevel.equals("area")) {
List<StationBasic> stationBasics = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
result = stationBasics.stream().map(StationBasic::getFanGatewayId).collect(Collectors.toList());
return result;
}
if (companyLevel.equals("station")) {
StationBasic stationBasic = stationBasicMapper.selectOne(new QueryWrapper<StationBasic>().eq("project_org_code", permissionOrgCode));
result.add(stationBasic.getFanGatewayId());
return result;
}
}
return result;
}
@Override
public List<String> getCurrentUserProjectOrgCodes() {
List<String> result = new ArrayList<>();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level");
if (companyLevel.equals("categroy_leve2")) {
return null;
}
if (companyLevel.equals("area")) {
List<StationBasic> stationBasics = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
result = stationBasics.stream().map(StationBasic::getProjectOrgCode).collect(Collectors.toList());
return result;
}
if (companyLevel.equals("station")) {
StationBasic stationBasic = stationBasicMapper.selectOne(new QueryWrapper<StationBasic>().eq("project_org_code", permissionOrgCode));
result.add(stationBasic.getProjectOrgCode());
return result;
}
}
return result;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.feign.McbWarningFeign;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMcbWarningService;
import com.yeejoin.amos.boot.module.jxiop.api.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.mcbwarningmapper.McbWarningMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class McbWarningServiceImpl implements IMcbWarningService {
@Autowired
private McbWarningMapper mcbWarningMapper;
@Autowired
private IPermissionService permissionService;
@Autowired
private McbWarningFeign mcbWarningFeign;
/**
* 今日预警-预警总数
*
* @param processingStatus 处理状态
* @return 总数信息
*/
@Override
public Map<String, Object> queryTodayCount(Integer processingStatus) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
return mcbWarningMapper.queryTodayCount(projectOrgCodes, processingStatus);
}
/**
* 近七日预警统计
*
* @return 预警统计
*/
@Override
public List<Map<String, Object>> queryWeekCount() {
List<String> projectOrgCodes = this.getProjectOrgCodes();
return mcbWarningMapper.queryWeekCount(projectOrgCodes);
}
/**
* 预警信息列表
*
* @param page 分页
* @param processingStatus 处理状态
* @return 预警信息列表
*/
@Override
public Page<Map<String, Object>> queryWarningPage(Page<Map<String, Object>> page, Integer processingStatus, String eventLevel, String createDate, String warningSourceType) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
long start = page.getCurrent() - 1;
long offset = page.getSize() * page.getCurrent();
List<Map<String, Object>> records = mcbWarningMapper.queryWarningList(start, offset, projectOrgCodes, processingStatus, eventLevel, createDate, warningSourceType);
Long total = mcbWarningMapper.queryWarningCount(projectOrgCodes, processingStatus, eventLevel, createDate, warningSourceType);
page.setRecords(records);
page.setTotal(total);
return page;
}
/**
* 预警信息总数
*
* @param processingStatus 处理状态
* @return 预警信息总数
*/
@Override
public Long queryWarningCount(Integer processingStatus, String eventLevel, String createDate, String warningSourceType) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
return mcbWarningMapper.queryWarningCount(projectOrgCodes, processingStatus, eventLevel, createDate, warningSourceType);
}
/**
* 问题信息列表
*
* @param page 分页
* @param completionStatus 完成状态
* @return 问题信息列表
*/
@Override
public Page<Map<String, Object>> queryQuestionPage(Page<Map<String, Object>> page, Integer completionStatus) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
long start = page.getCurrent() - 1;
long offset = page.getSize() * page.getCurrent();
List<Map<String, Object>> records = mcbWarningMapper.queryQuestionList(start, offset, projectOrgCodes, completionStatus);
Long total = mcbWarningMapper.queryQuestionCount(projectOrgCodes, completionStatus);
page.setRecords(records);
page.setTotal(total);
return page;
}
/**
* 问题信息列表
*
* @param completionStatus 完成状态
* @return 问题信息列表
*/
@Override
public Long queryQuestionCount(Integer completionStatus) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
return mcbWarningMapper.queryQuestionCount(projectOrgCodes, completionStatus);
}
/**
* 获取地图点位/路线
*
* @param province 省份
* @return 地图点位/路线
*/
@Override
public Object queryMapRoutes(String province) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
// TODO: 远程调用warning服务
return null;
}
/**
* 任务详情分页列表
*/
@Override
public Page<Map<String, Object>> getTaskDetailPage(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult<Page<Map<String, Object>>> page = mcbWarningFeign.getTaskDetailPage(map);
return page.getResult();
}
@Override
public Page<Map<String, Object>> getQuestionRecordPage(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult<Page<Map<String, Object>>> page = mcbWarningFeign.getQuestionRecordPage(map);
return page.getResult();
}
/**
* 任务详情、问题记录左侧树
*
*/
@Override
public Object getWarnTree(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult result = mcbWarningFeign.getWarnTree(map);
return result.getResult();
}
/**
* 任务详情列表统计
*
*/
@Override
public Object getTaskDetailStatistic(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult result = mcbWarningFeign.getTaskDetailStatistic(map);
return result.getResult();
}
/**
* 问题记录统计
*
*/
@Override
public Object getQuestionRecordStatistic(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult result = mcbWarningFeign.getQuestionRecordStatistic(map);
return result.getResult();
}
/**
* 获取用户权限(此处使用projectOrgCode)
*
* @return gatewayIds
*/
private List<String> getProjectOrgCodes() {
List<String> projectOrgCodes = permissionService.getCurrentUserProjectOrgCodes();
if (Objects.isNull(projectOrgCodes)) {
projectOrgCodes = Collections.emptyList();
}
return projectOrgCodes;
}
private String buildGateWayIdsParam() {
List<String> currentUserPermissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(currentUserPermissions)) {
currentUserPermissions = new ArrayList<>();
}
String gatewayIds = String.join(",", currentUserPermissions);
if (!gatewayIds.isEmpty()) {
gatewayIds = String.format("[%s]", gatewayIds);
}
return Optional.ofNullable(gatewayIds).orElse("[]");
}
}
...@@ -9,6 +9,11 @@ spring.db2.datasource.url=jdbc:mysql://139.9.173.44:3306/amos_project?allowMulti ...@@ -9,6 +9,11 @@ spring.db2.datasource.url=jdbc:mysql://139.9.173.44:3306/amos_project?allowMulti
spring.db2.datasource.username=root spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin@2020 spring.db2.datasource.password=Yeejoin@2020
spring.db3.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
spring.db3.datasource.url=jdbc:mysql://139.9.173.44:3306/amos_mcb?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
spring.db3.datasource.username=root
spring.db3.datasource.password=Yeejoin@2020
## eureka properties: ## eureka properties:
eureka.instance.hostname=172.16.10.220 eureka.instance.hostname=172.16.10.220
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
......
...@@ -49,7 +49,7 @@ import java.util.stream.Collectors; ...@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class CommonServiceImpl { public class CommonServiceImpl {
// @Autowired // @Autowired
// InfluxdbUtil influxdbUtil; // InfluxdbUtil influxdbUtil;
@Autowired @Autowired
SjglZsjZsbtzMapper sjglZsjZsbtzMapper; SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
...@@ -246,7 +246,7 @@ public class CommonServiceImpl { ...@@ -246,7 +246,7 @@ public class CommonServiceImpl {
} catch (Exception e) { } catch (Exception e) {
return totalvalue; return totalvalue;
} }
return Double.valueOf(String.format("%.4f", totalvalue )); return Double.valueOf(String.format("%.4f", totalvalue));
} }
// public Double getTotalByIndicatiorAndParams(String gatewayId, String indicator, String querySql) { // public Double getTotalByIndicatiorAndParams(String gatewayId, String indicator, String querySql) {
...@@ -371,10 +371,10 @@ public class CommonServiceImpl { ...@@ -371,10 +371,10 @@ public class CommonServiceImpl {
coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal))); coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal)));
socialContributionDtoList.add(coal); socialContributionDtoList.add(coal);
toner.setUnit(CommonConstans.TAN_FEN_CHEN_ZHUBIANDIYACE); toner.setUnit(CommonConstans.TAN_FEN_CHEN_ZHUBIANDIYACE);
toner.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.toner ))); toner.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.toner)));
socialContributionDtoList.add(toner); socialContributionDtoList.add(toner);
so2.setUnit(CommonConstans.ER_YANG_HUA_LIU_ZHUBIANDIYACE); so2.setUnit(CommonConstans.ER_YANG_HUA_LIU_ZHUBIANDIYACE);
so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide ))); so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide)));
socialContributionDtoList.add(so2); socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList); socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100); socialContributionDtoPage.setTotal(100);
...@@ -390,11 +390,12 @@ public class CommonServiceImpl { ...@@ -390,11 +390,12 @@ public class CommonServiceImpl {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>(); List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1)); List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name")); List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id")); List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzMapper.selectList(new QueryWrapper<SjglZsjZsbtz>().isNotNull("CAPACITYL").eq("is_del","0").isNotNull("WERKS")); //.isNotNull("fan_gateway_id"));
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzMapper.selectList(new QueryWrapper<SjglZsjZsbtz>().isNotNull("CAPACITYL").eq("is_del", "0").isNotNull("WERKS"));
for (int i = 0; i < stationBasicList.size(); i++) { for (int i = 0; i < stationBasicList.size(); i++) {
StationBasic stationBasic = stationBasicList.get(i); StationBasic stationBasic = stationBasicList.get(i);
Double StationCapactity = sjglZsjZsbtzList.stream().filter(sjglZsjZsbtz -> sjglZsjZsbtz.getWerks().equals(stationBasic.getStationNumber())&& !StringUtils.isEmpty(sjglZsjZsbtz.getCapacityl())).collect(Collectors.toList()).stream().mapToDouble(l->Double.valueOf(l.getCapacityl())).sum(); Double StationCapactity = sjglZsjZsbtzList.stream().filter(sjglZsjZsbtz -> sjglZsjZsbtz.getWerks().equals(stationBasic.getStationNumber()) && !StringUtils.isEmpty(sjglZsjZsbtz.getCapacityl())).collect(Collectors.toList()).stream().mapToDouble(l -> Double.valueOf(l.getCapacityl())).sum();
StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto(); StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto();
stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString()); stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString());
stationCacheInfoDto.setStationName(stationBasic.getStationName()); stationCacheInfoDto.setStationName(stationBasic.getStationName());
...@@ -560,13 +561,17 @@ public class CommonServiceImpl { ...@@ -560,13 +561,17 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble(); if (!ObjectUtils.isEmpty(equipments)) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
}
return result; return result;
} }
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum(); if (equipments != null) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
}
return result; return result;
} }
......
...@@ -26,62 +26,63 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipAlarmEventMapper; ...@@ -26,62 +26,63 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipAlarmEventMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.EquipDivergenceAlarmEventMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.EquipDivergenceAlarmEventMapper;
@Service @Service
public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, EquipAlarmEvent, EquipAlarmEventMapper> { public class EquipAlarmEventServiceImpl
extends BaseService<EquipAlarmEventDto, EquipAlarmEvent, EquipAlarmEventMapper> {
@Autowired @Autowired
EquipAlarmEventMapper equipAlarmEventMapper; EquipAlarmEventMapper equipAlarmEventMapper;
@Autowired @Autowired
StationBasicMapper stationBasicMapper; StationBasicMapper stationBasicMapper;
@Autowired @Autowired
EquipDivergenceAlarmEventMapper equipDivergenceAlarmEventMapper; EquipDivergenceAlarmEventMapper equipDivergenceAlarmEventMapper;
public ResultsData getEventByEquipIndex(String gatewayId, int current, int size, String equipIndex, String frontModule) { public ResultsData getEventByEquipIndex(String gatewayId, int current, int size, String equipIndex,
List<EquipAlarmEventDto> equipAlarmEvents = new ArrayList<>(); String frontModule) {
LambdaQueryWrapper<EquipAlarmEvent> queryWrapper = new LambdaQueryWrapper<>(); List<EquipAlarmEventDto> equipAlarmEvents = new ArrayList<>();
if(equipIndex!=null) LambdaQueryWrapper<EquipAlarmEvent> queryWrapper = new LambdaQueryWrapper<>();
{ if (equipIndex != null) {
queryWrapper.eq(EquipAlarmEvent::getEquipIndex, equipIndex); queryWrapper.eq(EquipAlarmEvent::getEquipIndex, equipIndex);
} }
queryWrapper.eq(EquipAlarmEvent::getGatewayId, gatewayId); queryWrapper.eq(EquipAlarmEvent::getGatewayId, gatewayId);
if(frontModule!=null) if (frontModule != null) {
{ queryWrapper.eq(EquipAlarmEvent::getFrontModule, frontModule);
queryWrapper.eq(EquipAlarmEvent::getFrontModule, frontModule); }
} Calendar calendar = Calendar.getInstance();
Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH, -7);
calendar.add(Calendar.DAY_OF_MONTH, -7); queryWrapper.gt(EquipAlarmEvent::getCreatedTime, calendar.getTime());
queryWrapper.gt(EquipAlarmEvent::getCreatedTime, calendar.getTime()); int count = equipAlarmEventMapper.selectCount(queryWrapper);
int count = equipAlarmEventMapper.selectCount(queryWrapper);
IPage<EquipAlarmEvent> p = new Page<>(current, size);
IPage<EquipAlarmEvent> p = new Page<>(current, size); equipAlarmEvents = equipAlarmEventMapper.getAlarmEventList(gatewayId, equipIndex, frontModule,
equipAlarmEvents= equipAlarmEventMapper.getAlarmEventList(gatewayId, equipIndex, frontModule, (p.getCurrent()-1)*p.getSize(), p.getSize(),calendar.getTime()); (p.getCurrent() - 1) * p.getSize(), p.getSize(), calendar.getTime());
// equipAlarmEvents = equipAlarmEventMapper.selectList(queryWrapper); // equipAlarmEvents = equipAlarmEventMapper.selectList(queryWrapper);
// equipAlarmEvents=page.getRecords(); // equipAlarmEvents=page.getRecords();
equipAlarmEvents.forEach(i->{ equipAlarmEvents.forEach(i -> {
if("true".equals(i.getValue())) if ("true".equals(i.getValue())) {
{ i.setValue("合");
i.setValue("合"); } else {
}else i.setValue("分");
{ }
i.setValue("分"); });
} DataGridMock DataGridMock = new DataGridMock(current, count, false, current, equipAlarmEvents);
}); ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名", "设备名", "dataGrid", "equipName");
DataGridMock DataGridMock = new DataGridMock(current, count, false, current, equipAlarmEvents); ColModel colModelStationName = new ColModel("alarmDesc", "alarmDesc", "事件描述", "事件描述", "dataGrid", "alarmDesc");
ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名", "设备名", "dataGrid", "equipName"); ColModel colModelEventDesc = new ColModel("createdTime", "createdTime", "告警时间", "告警时间", "dataGrid",
ColModel colModelStationName = new ColModel("alarmDesc", "alarmDesc", "事件描述", "事件描述", "dataGrid", "alarmDesc"); "createdTime");
ColModel colModelEventDesc = new ColModel("createdTime", "createdTime", "告警时间", "告警时间", "dataGrid", "createdTime"); ColModel colModelValueDesc = new ColModel("value", "value", "动作", "动作", "dataGrid", "value");
ColModel colModelValueDesc = new ColModel("value", "value", "动作", "动作", "dataGrid", "value"); List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc,
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc,colModelValueDesc); colModelValueDesc);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel); ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData; return resultsData;
} }
public ResultsData getEquipDivergenceEvent(String gatewayId, int current, int size) { public ResultsData getEquipDivergenceEvent(String gatewayId, int current, int size) {
PageHelper.startPage(current, size); PageHelper.startPage(current, size);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -2); calendar.add(Calendar.DAY_OF_MONTH, -2);
List<EquipDivergenceAlarmEvent> alarmEventList = equipDivergenceAlarmEventMapper.getEventList(gatewayId, null, null, List<EquipDivergenceAlarmEvent> alarmEventList = equipDivergenceAlarmEventMapper.getEventList(gatewayId, null,
calendar.getTime()); null, calendar.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar car = Calendar.getInstance(); Calendar car = Calendar.getInstance();
...@@ -91,12 +92,12 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, ...@@ -91,12 +92,12 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto,
// } else if ("false".equals(i.getValue())) { // } else if ("false".equals(i.getValue())) {
// i.setValue("分"); // i.setValue("分");
// } // }
long mills = i.getCreatedTime() ; long mills = i.getCreatedTime() / 1000000;
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
// System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
String time = sdf.format(car.getTime()); String time = sdf.format(car.getTime());
if (time.contains("1970")) { if (time.contains("1970-")) {
mills = i.getCreatedTime()/ 1000000; mills = i.getCreatedTime();
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
time = sdf.format(car.getTime()); time = sdf.format(car.getTime());
} }
...@@ -118,5 +119,5 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, ...@@ -118,5 +119,5 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto,
colModelEventDesc, colModelValueDesc); colModelEventDesc, colModelValueDesc);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel); ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData; return resultsData;
} }
} }
...@@ -149,7 +149,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -149,7 +149,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired @Autowired
private UserEmpowerMapper userEmpowerMapper; private UserEmpowerMapper userEmpowerMapper;
@Override
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) { public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
String table = gateway; String table = gateway;
Map<String, List<String>> queryCodntion = new HashMap<>(); Map<String, List<String>> queryCodntion = new HashMap<>();
...@@ -301,14 +301,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -301,14 +301,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public TreeDto getTreeInfo(String sequenceNbr, ReginParams reginParams) { public TreeDto getTreeInfo(String sequenceNbr, ReginParams reginParams) {
String userId = reginParams.getUserModel().getUserId(); String userId = reginParams.getUserModel().getUserId();
String companyLevel =""; String companyLevel = "";
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH")); StdUserEmpower stdUserEmpower = userEmpowerMapper
.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) { if (ObjectUtils.isEmpty(stdUserEmpower)) {
// throw new BadRequest("您当前未配置数据权限!"); // throw new BadRequest("您当前未配置数据权限!");
}else{ } else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0); String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String,String> companyInfo= userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode); Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString(); companyLevel = companyInfo.get("level").toString();
} }
StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr); StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr);
List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class); List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class);
...@@ -350,11 +351,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -350,11 +351,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
gfzTreeDto.setChildren(gfz); gfzTreeDto.setChildren(gfz);
List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto); List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto);
treeDto.setChildren(treeDtos); treeDto.setChildren(treeDtos);
if(companyLevel.equals("station")){ if (companyLevel.equals("station")) {
List<TreeDto> children = stationListByRegionCode.stream().filter(t->t.getCode().equals(sequenceNbr)).collect(Collectors.toList()); List<TreeDto> children = stationListByRegionCode.stream().filter(t -> t.getCode().equals(sequenceNbr))
if(stationBasic.getStationType().equals("FDZ")){ .collect(Collectors.toList());
treeDto = fdzTreeDto; if (stationBasic.getStationType().equals("FDZ")) {
}else { treeDto = fdzTreeDto;
} else {
treeDto = gfzTreeDto; treeDto = gfzTreeDto;
} }
treeDto.setChildren(children); treeDto.setChildren(children);
...@@ -372,8 +374,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -372,8 +374,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return new ArrayList<ESEquipmentsDTO>(); return new ArrayList<ESEquipmentsDTO>();
} }
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态",
Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态","30秒平均风速")); "停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态", "30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>(); Map<String, List<String>> queryCondtion1 = new HashMap<>();
...@@ -2398,6 +2400,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -2398,6 +2400,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Override @Override
public Map<String, Object> partofWaring3D(String stationId, String equipNum) { public Map<String, Object> partofWaring3D(String stationId, String equipNum) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
if (stationId == null || equipNum == null || "null".equals(stationId) || "equipNum".equals(equipNum)) {
return resultMap;
}
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
......
...@@ -166,12 +166,12 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -166,12 +166,12 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
i.setValue("分"); i.setValue("分");
} }
i.setStationName("升压站"); i.setStationName("升压站");
long mills = i.getCreatedTime() ; long mills = i.getCreatedTime()/ 1000000 ;
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
// System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
String time = sdf.format(car.getTime()); String time = sdf.format(car.getTime());
if (time.contains("1970")) { if (time.contains("1970-")) {
mills = i.getCreatedTime()/ 1000000; mills = i.getCreatedTime();
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
time = sdf.format(car.getTime()); time = sdf.format(car.getTime());
} }
......
...@@ -64,12 +64,12 @@ public class EquipAlarmEventServiceImpl ...@@ -64,12 +64,12 @@ public class EquipAlarmEventServiceImpl
} else if ("false".equals(i.getValue())) { } else if ("false".equals(i.getValue())) {
i.setValue("分"); i.setValue("分");
} }
long mills = i.getCreatedTime() ; long mills = i.getCreatedTime() / 1000000;
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
// System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
String time = sdf.format(car.getTime()); String time = sdf.format(car.getTime());
if (time.contains("1970")) { if (time.contains("1970-")) {
mills = i.getCreatedTime()/ 1000000; mills = i.getCreatedTime();
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
time = sdf.format(car.getTime()); time = sdf.format(car.getTime());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment