Commit 57f6c657 authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer' into developer

parents 428ccd29 a1c9d322
...@@ -347,8 +347,8 @@ public class SunlightServiceImpl implements SunlightService { ...@@ -347,8 +347,8 @@ public class SunlightServiceImpl implements SunlightService {
String today = DateUtil.today(); String today = DateUtil.today();
String hour = new Date().getHours() + ":00"; String hour = new Date().getHours() + ":00";
HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne(
.selectOne(new QueryWrapper<HYGFJPDayPower>().eq("third_station_id", sunlightDto.getPs_id().toString()) new QueryWrapper<HYGFJPDayPower>().eq("third_station_id", sunlightDto.getPs_id().toString())
.eq("year_month_day", today).eq("hour", hour)); .eq("year_month_day", today).eq("hour", hour));
if (ObjectUtils.isEmpty(hygfjpDayPower)) { if (ObjectUtils.isEmpty(hygfjpDayPower)) {
hygfjpDayPower = new HYGFJPDayPower(); hygfjpDayPower = new HYGFJPDayPower();
...@@ -417,9 +417,13 @@ public class SunlightServiceImpl implements SunlightService { ...@@ -417,9 +417,13 @@ public class SunlightServiceImpl implements SunlightService {
jpStationMapper.insert(jpStation); jpStationMapper.insert(jpStation);
} }
this.setJpInverte(listd, jpStation, listdtx); if (listd != null) {
this.setJpInverte(listd, jpStation, listdtx);
}
this.collectorDetail(listd, jpStation); if (listd != null) {
this.collectorDetail(listd, jpStation);
}
// 电站报表 // 电站报表
// 户用场站日发电量 // 户用场站日发电量
...@@ -1059,10 +1063,12 @@ public class SunlightServiceImpl implements SunlightService { ...@@ -1059,10 +1063,12 @@ public class SunlightServiceImpl implements SunlightService {
try { try {
TimeUnit.MINUTES.sleep(1); TimeUnit.MINUTES.sleep(1);
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis()); hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} }
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} }
} }
} }
......
...@@ -48,8 +48,8 @@ public class AnalyseController extends BaseController { ...@@ -48,8 +48,8 @@ public class AnalyseController extends BaseController {
@Autowired @Autowired
CommonServiceImpl commonServiceImpl; CommonServiceImpl commonServiceImpl;
@Autowired // @Autowired
IdxBizFanHealthIndexMapper idxBizFanHealthIndexMapper; // IdxBizFanHealthIndexMapper idxBizFanHealthIndexMapper;
@Autowired @Autowired
IAlarmInfoDetailService iAlarmInfoDetailService; IAlarmInfoDetailService iAlarmInfoDetailService;
...@@ -242,12 +242,12 @@ public class AnalyseController extends BaseController { ...@@ -242,12 +242,12 @@ public class AnalyseController extends BaseController {
|| CharSequenceUtil.isEmpty(map.get("EQUIPINDEX").toString())) { || CharSequenceUtil.isEmpty(map.get("EQUIPINDEX").toString())) {
return ResponseHelper.buildResponse(new HashMap<>()); return ResponseHelper.buildResponse(new HashMap<>());
} }
LambdaQueryWrapper<IdxBizFanHealthIndex> indexLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<FanHealthIndex> indexLambdaQueryWrapper = new LambdaQueryWrapper<>();
indexLambdaQueryWrapper.eq(IdxBizFanHealthIndex::getStation, map.get("STATION")); indexLambdaQueryWrapper.eq(FanHealthIndex::getStation, map.get("STATION"));
indexLambdaQueryWrapper.eq(IdxBizFanHealthIndex::getEquipmentName, map.get("EQUIPNAME")); indexLambdaQueryWrapper.eq(FanHealthIndex::getEquipmentName, map.get("EQUIPNAME"));
indexLambdaQueryWrapper.eq(IdxBizFanHealthIndex::getPointName, map.get("EQUIPINDEX")).last("limit 1"); indexLambdaQueryWrapper.eq(FanHealthIndex::getPointName, map.get("EQUIPINDEX")).last("limit 1");
List<IdxBizFanHealthIndex> idxBizFanHealthIndices = idxBizFanHealthIndexMapper List<FanHealthIndex> idxBizFanHealthIndices = fanHealthIndexMapper
.selectList(indexLambdaQueryWrapper); .selectList(indexLambdaQueryWrapper);
if (CollectionUtils.isNotEmpty(idxBizFanHealthIndices)) { if (CollectionUtils.isNotEmpty(idxBizFanHealthIndices)) {
pointId = idxBizFanHealthIndices.get(0).getIndexAddress(); pointId = idxBizFanHealthIndices.get(0).getIndexAddress();
......
...@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* *
...@@ -101,6 +102,13 @@ public class IdxBizFanHealthLevelController extends BaseController { ...@@ -101,6 +102,13 @@ public class IdxBizFanHealthLevelController extends BaseController {
return ResponseHelper.buildResponse(idxBizFanHealthLevelServiceImpl.queryForIdxBizFanHealthLevelPage(page)); return ResponseHelper.buildResponse(idxBizFanHealthLevelServiceImpl.queryForIdxBizFanHealthLevelPage(page));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "健康等级划分", notes = "健康等级划分")
@GetMapping(value = "/queryHealthLevel")
public ResponseModel<List<Map<String,Object>>> queryHealthLevel() {
return ResponseHelper.buildResponse(idxBizFanHealthLevelServiceImpl.queryHealthLevel());
}
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
......
...@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/** /**
* Mapper 接口 * Mapper 接口
* *
...@@ -26,4 +29,9 @@ public interface IdxBizFanHealthLevelMapper extends BaseMapper<IdxBizFanHealthLe ...@@ -26,4 +29,9 @@ public interface IdxBizFanHealthLevelMapper extends BaseMapper<IdxBizFanHealthLe
@Param("groupLowerLimit") String groupLowerLimit, @Param("groupLowerLimit") String groupLowerLimit,
@Param("analysisObjType") String analysisObjType, @Param("analysisObjType") String analysisObjType,
@Param("healthLevel") String healthLevel); @Param("healthLevel") String healthLevel);
/**
* 查询健康等级
* @return
*/
List<Map<String, Object>> queryHealthLevel();
} }
...@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service; ...@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 服务实现类 * 服务实现类
...@@ -31,4 +32,12 @@ public class IdxBizFanHealthLevelServiceImpl extends BaseService<IdxBizFanHealth ...@@ -31,4 +32,12 @@ public class IdxBizFanHealthLevelServiceImpl extends BaseService<IdxBizFanHealth
public List<IdxBizFanHealthLevelDto> queryForIdxBizFanHealthLevelList() { public List<IdxBizFanHealthLevelDto> queryForIdxBizFanHealthLevelList() {
return this.queryForList("" , false); return this.queryForList("" , false);
} }
/**
* 查询健康等级
* @return
*/
public List<Map<String,Object>> queryHealthLevel() {
return this.baseMapper.queryHealthLevel();
}
} }
\ No newline at end of file
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> { public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
@Select("<script>"+ @Select("<script>"+
"SELECT `health_index` AS healthIndex,anomaly,rec_date as recDate, `health_index` AS `value`, substr(analysis_time,1,10) as analysisTime, station,equipment_name AS equipmentName,point_name as pointName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null" + "SELECT distinct `health_index` AS healthIndex,anomaly,rec_date as recDate, `health_index` AS `value`, substr(analysis_time,1,10) as analysisTime, station,equipment_name AS equipmentName,point_name as pointName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " + "<if test='area!= null'> AND area = #{area} </if> " +
...@@ -34,7 +34,8 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> { ...@@ -34,7 +34,8 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
@Select("<script>"+ @Select("<script>"+
"SELECT count(1) FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null" + "SELECT count(1) from ( SELECT distinct `health_index` AS healthIndex,anomaly,rec_date as recDate, `health_index` AS `value`, substr(analysis_time,1,10) as analysisTime, station,equipment_name AS equipmentName,point_name as pointName,\n" +
"( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " + "<if test='area!= null'> AND area = #{area} </if> " +
...@@ -44,7 +45,7 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> { ...@@ -44,7 +45,7 @@ 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='orgCode!= null'>AND org_code like '${orgCode}' </if>" + "<if test='orgCode!= null'>AND org_code like '${orgCode}' </if>)" +
"</script>") "</script>")
int selectDataTotal(@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("orgCode")String orgCode); int selectDataTotal(@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("orgCode")String orgCode);
......
...@@ -27,4 +27,8 @@ ...@@ -27,4 +27,8 @@
ANALYSIS_OBJ_TYPE = #{analysisObjType} ANALYSIS_OBJ_TYPE = #{analysisObjType}
AND HEALTH_LEVEL = #{healthLevel} AND HEALTH_LEVEL = #{healthLevel}
</update> </update>
<select id="queryHealthLevel" resultType="java.util.Map">
SELECT * FROM idx_biz_fan_health_level where ANALYSIS_OBJ_TYPE = '全域' ORDER BY GROUP_UPPER_LIMIT DESC
</select>
</mapper> </mapper>
...@@ -98,4 +98,7 @@ spring.activemq.password=admin ...@@ -98,4 +98,7 @@ spring.activemq.password=admin
spring.jms.pub-sub-domain=false spring.jms.pub-sub-domain=false
myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
modifypasswordqueue= amos.privilege.v1.JXIOP.AMOS_ADMIN.modifyPassword modifypasswordqueue= amos.privilege.v1.JXIOP.AMOS_ADMIN.modifyPassword
yth.qg.id=1 yth.qg.id=1
\ No newline at end of file emqx.client-user-name=admin
emqx.client-password=public
logic=false
\ No newline at end of file
...@@ -19,11 +19,23 @@ ...@@ -19,11 +19,23 @@
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-common-biz</artifactId> <artifactId>amos-boot-module-common-biz</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId> <artifactId>amos-boot-biz-common</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
...@@ -36,6 +48,11 @@ ...@@ -36,6 +48,11 @@
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>5.7.22</version> <version>5.7.22</version>
</dependency> </dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15to18</artifactId>
<version>1.69</version>
</dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.influxdb</groupId>--> <!-- <groupId>org.influxdb</groupId>-->
<!-- <artifactId>influxdb-java</artifactId>--> <!-- <artifactId>influxdb-java</artifactId>-->
......
package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvDeviceDataEntity;
public interface PvDeviceDataMapper extends BaseMapper<PvDeviceDataEntity> {
}
package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvStationDataEntity;
public interface PvStationDataMapper extends BaseMapper<PvStationDataEntity> {
}
package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.StationDailyDataEntity;
public interface StationDailyDataMapper extends BaseMapper<StationDailyDataEntity> {
}
package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindDeviceDataEntity;
public interface WindDeviceDataMapper extends BaseMapper<WindDeviceDataEntity> {
}
package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindStationDataEntity;
public interface WindStationDataMapper extends BaseMapper<WindStationDataEntity> {
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory.JXDZExecute;
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.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
@RestController
@RequestMapping(value = "/jxdz")
public class JXDZExecuteController {
@Autowired
JXDZExecute jxdzExecute;
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping("/testDay")
public String testDay() {
jxdzExecute.dayInterface();
return "Success";
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping("/testHour")
public String testHour() {
jxdzExecute.hourInterface();
return "Success";
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum JXDZAccessTypeEnum {
CAIJI(1, "采集"),
BULU(2, "补录"),
;
private Integer code;
private String remark;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum JXDZCodeEnum {
XZ("W005", "夏造风电站"),
GF("P001", "泰和前进光伏电站"),
;
private String code;
private String remark;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum JXDZDataTypeEnum {
FDZJC(1, "风电站监测数据"),
GFDZJC(2, "光伏电站监测数据"),
FDZSBJC(3, "风电站设备监测数据"),
GFDZSBJC(4, "光伏电站设备监测数据"),
DZMTSJ(5, "电站每天数据包括:运维、节能减排、发电效率"),
;
private Integer code;
private String remark;
public static JXDZDataTypeEnum getEnumByCode(Integer code) {
for (JXDZDataTypeEnum jxdzDataTypeEnum : JXDZDataTypeEnum.values()) {
if (jxdzDataTypeEnum.getCode().equals(code)) {
return jxdzDataTypeEnum;
}
}
return null;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "jxdz_pv_device_data", autoResultMap = true)
public class PvDeviceDataEntity extends BaseEntity {
@TableField("code")
private String code;
@TableField("name")
private String name;
/**
* 毫秒级别时间
*/
@TableField("date_time")
private Long dateTime;
/**
*日发电量
*/
@TableField("generation_daily")
private Double GenerationDaily;
/**
*月发电量
*/
@TableField("generation_month")
private Double GenerationMonth;
/**
*年发电量
*/
@TableField("generation_year")
private Double GenerationYear;
/**
*累计发电量
*/
@TableField("generation_gross")
private Double GenerationGross;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "jxdz_pv_station_data", autoResultMap = true)
public class PvStationDataEntity extends BaseEntity {
@TableField("code")
private String code;
@TableField("name")
private String name;
/**
* 毫秒级别时间
*/
@TableField("date_time")
private Long dateTime;
/**
*发电功率
*/
@TableField("generation_power")
private Double GenerationPower;
/**
*总辐射
*/
@TableField("total_radiation")
private Double TotalRadiation;
/**
*直接辐射
*/
@TableField("direct_radiation")
private Double DirectRadiation;
/**
*散射辐射
*/
@TableField("scatter_radiation")
private Double ScatterRadiation;
/**
*日发电量
*/
@TableField("generation_daily")
private Double GenerationDaily;
/**
*月发电量
*/
@TableField("generation_month")
private Double GenerationMonth;
/**
*年发电量
*/
@TableField("generation_year")
private Double GenerationYear;
/**
*累计发电量
*/
@TableField("generation_gross")
private Double GenerationGross;
/**
*利用小时数
*/
@TableField("utilize_hours")
private Double UtilizeHours;
/**
*损失电量
*/
@TableField("loss_electricity")
private Double LossElectricity;
/**
*总辐照度
*/
@TableField("total_irradiance")
private Double TotalIrradiance;
/**
*直接辐照度
*/
@TableField("direct_irradiance")
private Double DirectIrradiance;
/**
*散射辐照度
*/
@TableField("scatter_irradiance")
private Double ScatterIrradiance;
/**
* 日上网电量
*/
@TableField("on_grid_energy_daily")
private Double OnGridEnergyDaily;
/**
* 月上网电量
*/
@TableField("on_grid_energy_month")
private Double OnGridEnergyMonth;
/**
* 年上网电量
*/
@TableField("on_grid_energy_year")
private Double OnGridEnergyYear;
/**
* 累计上网电量
*/
@TableField("on_grid_energy_gross")
private Double OnGridEnergyGross;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "jxdz_station_daily_data", autoResultMap = true)
public class StationDailyDataEntity extends BaseEntity {
@TableField("code")
private String code;
@TableField("name")
private String name;
/**
* 毫秒级别时间
*/
@TableField("date_time")
private Long dateTime;
/**
* 工作票总数
*/
@TableField("work_ticket_total_nums")
private Double WorkTicketTotalNums;
/**
* 办理中工作票数
*/
@TableField("work_ticket_processing_nums")
private Double WorkTicketProcessingNums;
/**
* 已作废工作票数
*/
@TableField("work_ticket_invalidated_nums")
private Double WorkTicketInvalidatedNums;
/**
* 执行中工作票总数
*/
@TableField("work_ticket_executing_nums")
private Double WorkTicketExecutingNums;
/**
* 已终结的工作票数
*/
@TableField("work_ticket_terminated_nums")
private Double WorkTicketTerminatedNums;
/**
*定期工作任务
*/
@TableField("regular_tasks_nums")
private Double RegularTasksNums;
/**
* 巡检任务数量
*/
@TableField("inspection_tasks_nums")
private Double InspectionTasksNums;
/**
* 工单总数
*/
@TableField("work_order_total_nums")
private Double WorkOrderTotalNums;
/**
* 工单作废数
*/
@TableField("work_order_invalidated_nums")
private Double WorkOrderInvalidatedNums;
/**
* 工单待开工数
*/
@TableField("work_order_to_be_opened_nums")
private Double WorkOrderToBeOpenedNums;
/**
* 工单终结数
*/
@TableField("work_order_terminated_nums")
private Double WorkOrderTerminatedNums;
/**
* 工单开工数
*/
@TableField("work_order_start_nums")
private Double WorkOrderStartNums;
/**
* 二氧化碳减排量
*/
@TableField("co2_emission_reduction")
private Double Co2EmissionReduction;
/**
* 节约标准煤
*/
@TableField("standard_coal_saving")
private Double StandardCoalSaving;
/**
* 二氧化硫减排量
*/
@TableField("so2_emission_reduction")
private Double So2EmissionReduction;
/**
* 碳粉尘减排量
*/
@TableField("carbon_dust_emission_reduction")
private Double CarbonDustEmissionReduction;
/**
* 发电效率
*/
@TableField("generation_efficiency")
private Double GenerationEfficiency;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "jxdz_wind_device_data", autoResultMap = true)
public class WindDeviceDataEntity extends BaseEntity {
@TableField("code")
private String code;
@TableField("name")
private String name;
/**
* 毫秒级别时间
*/
@TableField("date_time")
private Long dateTime;
/**
*日发电量
*/
@TableField("generation_daily")
private Double GenerationDaily;
/**
*月发电量
*/
@TableField("generation_month")
private Double GenerationMonth;
/**
*年发电量
*/
@TableField("generation_year")
private Double GenerationYear;
/**
*累计发电量
*/
@TableField("generation_gross")
private Double GenerationGross;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "jxdz_wind_station_data", autoResultMap = true)
public class WindStationDataEntity extends BaseEntity {
@TableField("code")
private String code;
@TableField("name")
private String name;
/**
* 毫秒级别时间
*/
@TableField("date_time")
private Long dateTime;
/**
*发电功率
*/
@TableField("generation_power")
private Double GenerationPower;
/**
* 风速
*/
@TableField("wind_speed")
private Double WindSpeed;
/**
*风向
*/
@TableField("wind_direction")
private Double WindDirection;
/**
*日发电量
*/
@TableField("generation_daily")
private Double GenerationDaily;
/**
* 月发电量
*/
@TableField("generation_month")
private Double GenerationMonth;
/**
* 年发电量
*/
@TableField("generation_year")
private Double GenerationYear;
/**
*累计发电量
*/
@TableField("generation_gross")
private Double GenerationGross;
/**
*利用小时数
*/
@TableField("utilize_hours")
private Double UtilizeHours;
/**
*损失电量
*/
@TableField("loss_electricity")
private Double LossElectricity;
/**
* 日上网电量
*/
@TableField("on_grid_energy_daily")
private Double OnGridEnergyDaily;
/**
* 月上网电量
*/
@TableField("on_grid_energy_month")
private Double OnGridEnergyMonth;
/**
* 年上网电量
*/
@TableField("on_grid_energy_year")
private Double OnGridEnergyYear;
/**
* 累计上网电量
*/
@TableField("on_grid_energy_gross")
private Double OnGridEnergyGross;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.StationDailyDataEntity;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.StationDailyDataServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.StationDailyDataVO;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.JXDZMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
@Service
public class DZMTSJServiceImpl implements IJXDZService {
@Autowired
JXDZUtils jxdzUtils;
@Autowired
StationDailyDataServiceImpl stationDailyDataService;
@Autowired
JXDZMapper jxdzMapper;
@Override
public void backupData(List list, Long dateTime) {
if (CollectionUtil.isNotEmpty(list)) {
List<StationDailyDataEntity> stationDailyDataEntityList = new ArrayList<>();
list.forEach(item -> {
StationDailyDataEntity stationDailyDataEntity = BeanUtil.copyProperties(item, StationDailyDataEntity.class);
stationDailyDataEntity.setDateTime(dateTime);
stationDailyDataEntityList.add(stationDailyDataEntity);
});
stationDailyDataService.saveBatch(stationDailyDataEntityList);
}
}
@Override
public List buildData(Integer accessType, Long dateTime) {
List<StationDailyDataVO> list = new ArrayList<>();
if (JXDZAccessTypeEnum.BULU.getCode().equals(accessType)) {
List<StationDailyDataEntity> stationDailyDataEntityList = stationDailyDataService.list(new LambdaQueryWrapper<StationDailyDataEntity>().eq(StationDailyDataEntity::getDateTime, dateTime));
list = BeanUtil.copyToList(stationDailyDataEntityList, StationDailyDataVO.class);
} else {
list.add(getBusinessData(JXDZCodeEnum.XZ.getCode(), JXDZCodeEnum.XZ.getRemark()));
list.add(getBusinessData(JXDZCodeEnum.GF.getCode(), JXDZCodeEnum.GF.getRemark()));
}
return list;
}
/**
* 获取业务数据
* @param code
* @param name
* @return
*/
private StationDailyDataVO getBusinessData(String code, String name) {
StationDailyDataVO stationDailyDataVO = new StationDailyDataVO();
if(JXDZCodeEnum.XZ.getCode().equals(code)){
stationDailyDataVO.setCode(JXDZUtils.XZ_CODE);
}else if(JXDZCodeEnum.GF.getCode().equals(code)){
stationDailyDataVO.setCode(JXDZUtils.GF_CODE);
}else {
stationDailyDataVO.setCode(code);
}
stationDailyDataVO.setName(name);
stationDailyDataVO.setWorkTicketTotalNums(jxdzMapper.countWorkTicketTotalByCode(code).doubleValue());
stationDailyDataVO.setWorkTicketProcessingNums(jxdzMapper.countWorkTicketProcessingByCode(code).doubleValue());
stationDailyDataVO.setWorkTicketInvalidatedNums(jxdzMapper.countWorkOrderInvalidatedByCode(code).doubleValue());
stationDailyDataVO.setWorkTicketExecutingNums(jxdzMapper.countWorkTicketInvalidatedByCode(code).doubleValue());
stationDailyDataVO.setWorkTicketTerminatedNums(jxdzMapper.countWorkTicketTerminatedByCode(code).doubleValue());
stationDailyDataVO.setRegularTasksNums(jxdzMapper.countRegularTasksByCode(code).doubleValue());
stationDailyDataVO.setInspectionTasksNums(jxdzMapper.countInspectionTasksByCode(code).doubleValue());
stationDailyDataVO.setWorkOrderTotalNums(jxdzMapper.countWorkOrderTotalByCode(code).doubleValue());
stationDailyDataVO.setWorkOrderInvalidatedNums(jxdzMapper.countWorkOrderToBeOpenedByCode(code).doubleValue());
stationDailyDataVO.setWorkOrderToBeOpenedNums(jxdzMapper.countWorkOrderTotalByCode(code).doubleValue());
stationDailyDataVO.setWorkOrderTerminatedNums(jxdzMapper.countWorkOrderTerminatedByCode(code).doubleValue());
stationDailyDataVO.setWorkOrderStartNums(jxdzMapper.countWorkOrderStartByCode(code).doubleValue());
//调用core 接口
JSONObject jsonObject = new JSONObject();
if (JXDZCodeEnum.XZ.getCode().equals(code)) {
String url = "/core/datastorage/gateway/point/list?groupId=1764453166557986818&dataType=analog";
jsonObject = jxdzUtils.sendCoreGetRequest(url);
} else if (JXDZCodeEnum.GF.getCode().equals(code)) {
String url = "/core/datastorage/gateway/point/list?groupId=1770308721235230721&dataType=analog";
jsonObject = jxdzUtils.sendCoreGetRequest(url);
}
if (jsonObject.getInteger("status") == HttpStatus.OK.value()) {
//补充电站测点信息
supplementStationData(jsonObject.getJSONArray("result"), stationDailyDataVO);
supplementBDData(stationDailyDataVO, code);
//补充其他信息
}
return stationDailyDataVO;
}
/**
* 补充部盾提供的数据
* @param stationDailyDataVO
*/
private void supplementBDData(StationDailyDataVO stationDailyDataVO, String code) {
if (JXDZCodeEnum.GF.getCode().equals(code)) {
try {
String yesterday = DateUtils.dateFormat(Date.from(LocalDate.now().minusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd");
String url = "/screen_api?method=scene_screen.large_screen.get_loss_of_electricity&reporting_data=" + yesterday + "&source_station_id=1701778419827638274&station_type=PV";
JSONObject jsonObject = jxdzUtils.sendCoreGetRequest(url);
if (0 == jsonObject.getInteger("status")) {
JSONObject data = jsonObject.getJSONObject("data");
if (!Objects.isNull(data)) {
stationDailyDataVO.setGenerationEfficiency(data.getDouble("comprehensive_efficiency"));
}
}
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
}
/**
* 补充场站数据
* @param result
* @param stationDailyDataVO
*/
private void supplementStationData(JSONArray result, StationDailyDataVO stationDailyDataVO) {
if (CollectionUtil.isNotEmpty(result)) {
for (Object o : result) {
if (o instanceof Map) {
Map map = (Map) o;
JSONObject jsonObject = new JSONObject(map);
String pointName = (String) map.get("pointName");
if ("二氧化碳排放量(t)".equals(pointName)) {
stationDailyDataVO.setCo2EmissionReduction(jsonObject.getDouble("value"));
}
if ("节约标准煤(t)".equals(pointName)) {
stationDailyDataVO.setStandardCoalSaving(jsonObject.getDouble("value"));
}
if ("二氧化硫排放量(t)".equals(pointName)) {
stationDailyDataVO.setSo2EmissionReduction(jsonObject.getDouble("value"));
}
if ("碳粉尘减排量(t)".equals(pointName)) {
stationDailyDataVO.setCarbonDustEmissionReduction(jsonObject.getDouble("value"));
}
if ("发电效率".equals(pointName)) {
stationDailyDataVO.setGenerationEfficiency(jsonObject.getDouble("value"));
}
}
}
}
}
@Override
public void sendData(Integer accessType, NeedDataVO needDataVO, List list) {
if (CollectionUtil.isNotEmpty(list)) {
jxdzUtils.sendJXDZPostRequest("/ngnsyncjiangxiyw/accessdaydata/stationDailyData", accessType, needDataVO, list);
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindStationDataEntity;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.WindStationDataServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.WindStationDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
@Service
public class FDZJCServiceImpl implements IJXDZService {
@Autowired
JXDZUtils jxdzUtils;
@Autowired
WindStationDataServiceImpl windStationDataService;
@Override
public void backupData(List list, Long dateTime) {
if (CollectionUtil.isNotEmpty(list)) {
List<WindStationDataEntity> windStationDataEntityList = new ArrayList<>();
list.forEach(item -> {
WindStationDataEntity windStationDataEntity = BeanUtil.copyProperties(item, WindStationDataEntity.class);
windStationDataEntity.setDateTime(dateTime);
windStationDataEntityList.add(windStationDataEntity);
});
windStationDataService.saveBatch(windStationDataEntityList);
}
}
@Override
public List buildData(Integer accessType, Long dateTime) {
List<WindStationDataVO> list = new ArrayList<>();
if (JXDZAccessTypeEnum.BULU.getCode().equals(accessType)) {
List<WindStationDataEntity> windStationDataEntityList = windStationDataService.list(new LambdaQueryWrapper<WindStationDataEntity>().eq(WindStationDataEntity::getDateTime, dateTime));
list = BeanUtil.copyToList(windStationDataEntityList, WindStationDataVO.class);
} else {
list.add(getBusinessData(JXDZCodeEnum.XZ.getCode(), JXDZCodeEnum.XZ.getRemark()));
}
return list;
}
private WindStationDataVO getBusinessData(String code, String name) {
WindStationDataVO windStationDataVO = new WindStationDataVO();
if(JXDZCodeEnum.XZ.getCode().equals(code)){
windStationDataVO.setCode(JXDZUtils.XZ_CODE);
}else {
windStationDataVO.setCode(code);
}
windStationDataVO.setName(name);
//调用core 接口
JSONObject jsonObject = new JSONObject();
if (JXDZCodeEnum.XZ.getCode().equals(code)) {
String url = "/core/datastorage/gateway/point/list?groupId=1764453166557986818&dataType=analog";
jsonObject = jxdzUtils.sendCoreGetRequest(url);
}
if (jsonObject.getInteger("status") == HttpStatus.OK.value()) {
//补充电站测点信息
supplementStationData(jsonObject.getJSONArray("result"), windStationDataVO);
supplementBDData(windStationDataVO, code);
}
return windStationDataVO;
}
/**
* 补充部盾提供的数据
* @param windStationDataVO
*/
private void supplementBDData(WindStationDataVO windStationDataVO, String code) {
JSONObject jsonObject = new JSONObject();
if (JXDZCodeEnum.XZ.getCode().equals(code)) {
String yesterday = null;
try {
yesterday = DateUtils.dateFormat(Date.from(LocalDate.now().minusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd");
} catch (ParseException e) {
throw new RuntimeException(e);
}
String url = "/screen_api?method=scene_screen.large_screen.get_loss_of_electricity&reporting_data=" + yesterday + "&source_station_id=1701779143491878913&station_type=FAN";
jsonObject = jxdzUtils.sendCoreGetRequest(url);
}
if (0 == jsonObject.getInteger("status")) {
JSONObject data = jsonObject.getJSONObject("data");
if (!Objects.isNull(data)) {
windStationDataVO.setLossElectricity(data.getDouble("loss_of_electricity_day"));
windStationDataVO.setOnGridEnergyDaily(data.getDouble("on_grid_energy_day"));
windStationDataVO.setOnGridEnergyMonth(data.getDouble("on_grid_energy_month"));
windStationDataVO.setOnGridEnergyYear(data.getDouble("on_grid_energy_year"));
windStationDataVO.setOnGridEnergyGross(data.getDouble("on_grid_energy"));
}
}
}
/**
* 补充电站数据
* @param result
* @param windStationDataVO
*/
private void supplementStationData(JSONArray result, WindStationDataVO windStationDataVO) {
if (CollectionUtil.isNotEmpty(result)) {
for (Object o : result) {
if (o instanceof Map) {
Map map = (Map) o;
JSONObject jsonObject = new JSONObject(map);
String pointName = (String) map.get("pointName");
if ("发电功率".equals(pointName)) {
windStationDataVO.setGenerationPower(jsonObject.getDouble("value"));
}
if ("瞬时平均风速".equals(pointName)) {
windStationDataVO.setWindSpeed(jsonObject.getDouble("value"));
}
if ("风向".equals(pointName)) {
windStationDataVO.setWindDirection(jsonObject.getDouble("value"));
}
if ("日发电量总和".equals(pointName)) {
windStationDataVO.setGenerationDaily(jsonObject.getDouble("value"));
}
if ("月发电量总和".equals(pointName)) {
windStationDataVO.setGenerationMonth(jsonObject.getDouble("value"));
}
if ("年发电量总和".equals(pointName)) {
windStationDataVO.setGenerationYear(jsonObject.getDouble("value"));
windStationDataVO.setGenerationGross(jsonObject.getDouble("value"));
}
if ("日利用小时数".equals(pointName)) {
windStationDataVO.setUtilizeHours(jsonObject.getDouble("value"));
}
}
}
}
}
@Override
public void sendData(Integer accessType, NeedDataVO needDataVO, List list) {
if (CollectionUtil.isNotEmpty(list)) {
jxdzUtils.sendJXDZPostRequest("/ngnsyncjiangxiyw/accesshourdata/windStationData", accessType, needDataVO, list);
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindDeviceDataEntity;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.WindDeviceDataServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.WindDeviceDataVO;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.JXDZMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
public class FDZSBJCServiceImpl implements IJXDZService {
@Autowired
JXDZUtils jxdzUtils;
@Autowired
WindDeviceDataServiceImpl windDeviceDataService;
@Autowired
JXDZMapper jxdzMapper;
@Override
public void backupData(List list, Long dateTime) {
if (CollectionUtil.isNotEmpty(list)) {
List<WindDeviceDataEntity> windDeviceDataEntityList = new ArrayList<>();
list.forEach(item -> {
WindDeviceDataEntity windDeviceDataEntity = BeanUtil.copyProperties(item, WindDeviceDataEntity.class);
windDeviceDataEntity.setDateTime(dateTime);
windDeviceDataEntityList.add(windDeviceDataEntity);
});
windDeviceDataService.saveBatch(windDeviceDataEntityList);
}
}
@Override
public List buildData(Integer accessType, Long dateTime) {
List<WindDeviceDataVO> list = new ArrayList<>();
if (JXDZAccessTypeEnum.BULU.getCode().equals(accessType)) {
List<WindDeviceDataEntity> windDeviceDataEntityList = windDeviceDataService.list(new LambdaQueryWrapper<WindDeviceDataEntity>().eq(WindDeviceDataEntity::getDateTime, dateTime));
list = BeanUtil.copyToList(windDeviceDataEntityList, WindDeviceDataVO.class);
} else {
JSONArray zzBusinessData = getZZBusinessData();
if (CollectionUtil.isNotEmpty(zzBusinessData)) {
for (Object o : zzBusinessData) {
if (o instanceof Map) {
Map map = (Map) o;
JSONObject jsonObject = new JSONObject(map);
if (jsonObject.getString("name").contains("风机")) {
list.add(getWindDeviceDataVO(jsonObject));
}
}
}
}
}
return list;
}
/**
* 获取风电设备数据
* @param jsonObject
* @return
*/
private WindDeviceDataVO getWindDeviceDataVO(JSONObject jsonObject) {
WindDeviceDataVO windDeviceDataVO = new WindDeviceDataVO();
String sequenceNbr = jsonObject.getString("sequenceNbr");
windDeviceDataVO.setName(jsonObject.getString("name"));
windDeviceDataVO.setCode(getWindDeviceCode(jsonObject.getString("name")));
//开始调用具体列表接口
JSONArray windDeviceJSONArray = getWindDeviceDataBySequenceNbr(sequenceNbr);
if (CollectionUtil.isNotEmpty(windDeviceJSONArray)) {
for (Object o : windDeviceJSONArray) {
if (o instanceof Map) {
Map map = (Map) o;
JSONObject result = new JSONObject(map);
String pointName = (String) map.get("pointName");
if ("日发电量".equals(pointName)) {
windDeviceDataVO.setGenerationDaily(result.getDouble("value"));
}
if ("月发电量".equals(pointName)) {
windDeviceDataVO.setGenerationMonth(result.getDouble("value"));
}
if ("年发电量".equals(pointName)) {
windDeviceDataVO.setGenerationYear(result.getDouble("value"));
windDeviceDataVO.setGenerationGross(result.getDouble("value"));
}
}
}
}
return windDeviceDataVO;
}
/**
* 获取风电设备Code
* @param name
* @return
*/
private String getWindDeviceCode(String name) {
String replaceString = name.replace("风机", "");
Integer value = Integer.valueOf(replaceString);
String field = "%#" + value + "风机系统%";
String replaceField = "%#" + replaceString + "风机系统%";
return jxdzMapper.getDeviceCode(JXDZCodeEnum.XZ.getCode(), field, replaceField);
}
/**
* 根据主键获取具体的风电测点数据
* @param sequenceNbr
* @return
*/
private JSONArray getWindDeviceDataBySequenceNbr(String sequenceNbr) {
JSONObject jsonObject = jxdzUtils.sendCoreGetRequest("/core/datastorage/gateway/point/list?groupId=" + sequenceNbr + "&dataType=analog");
if (!Objects.isNull(jsonObject)) {
if (jsonObject.getInteger("status") == HttpStatus.OK.value()) {
return jsonObject.getJSONArray("result");
}
}
return new JSONArray();
}
/**
* 获取装置测点数据
* @return
*/
private JSONArray getZZBusinessData() {
JSONObject jsonObject = jxdzUtils.sendCoreGetRequest("/core/front-gateway-device/tree?gatewayId=1762633242759958530");
if (!Objects.isNull(jsonObject)) {
if (jsonObject.getInteger("status") == HttpStatus.OK.value()) {
JSONArray result = jsonObject.getJSONArray("result");
if (CollectionUtil.isNotEmpty(result)) {
JSONObject firstObject = result.getJSONObject(0).getJSONArray("children").getJSONObject(0);
if (!Objects.isNull(firstObject)) {
JSONArray children = firstObject.getJSONArray("children");
if (CollectionUtil.isNotEmpty(children)) {
for (Object child : children) {
if (child instanceof Map) {
Map map = (Map) child;
JSONObject childJSON = new JSONObject(map);
if ("装置测点".equals(childJSON.getString("name"))) {
return childJSON.getJSONArray("children");
}
}
}
}
}
}
}
}
return new JSONArray();
}
@Override
public void sendData(Integer accessType, NeedDataVO needDataVO, List list) {
if(CollectionUtil.isNotEmpty(list)){
jxdzUtils.sendJXDZPostRequest("/ngnsyncjiangxiyw/accesshourdata/windDeviceData", accessType, needDataVO, list);
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvStationDataEntity;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.PvStationDataServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.PvStationDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
@Service
public class GFDZJCServiceImpl implements IJXDZService {
@Autowired
JXDZUtils jxdzUtils;
@Autowired
PvStationDataServiceImpl pvStationDataService;
@Override
public void backupData(List list, Long dateTime) {
if (CollectionUtil.isNotEmpty(list)) {
List<PvStationDataEntity> pvStationDataEntityList = new ArrayList<>();
list.forEach(item -> {
PvStationDataEntity pvStationDataEntity = BeanUtil.copyProperties(item, PvStationDataEntity.class);
pvStationDataEntity.setDateTime(dateTime);
pvStationDataEntityList.add(pvStationDataEntity);
});
pvStationDataService.saveBatch(pvStationDataEntityList);
}
}
@Override
public List buildData(Integer accessType, Long dateTime) {
List<PvStationDataVO> list = new ArrayList<>();
if (JXDZAccessTypeEnum.BULU.getCode().equals(accessType)) {
List<PvStationDataEntity> windStationDataEntityList = pvStationDataService.list(new LambdaQueryWrapper<PvStationDataEntity>().eq(PvStationDataEntity::getDateTime, dateTime));
list = BeanUtil.copyToList(windStationDataEntityList, PvStationDataVO.class);
} else {
list.add(getBusinessData(JXDZCodeEnum.GF.getCode(), JXDZCodeEnum.GF.getRemark()));
}
return list;
}
private PvStationDataVO getBusinessData(String code, String name) {
PvStationDataVO pvStationDataVO = new PvStationDataVO();
if (JXDZCodeEnum.GF.getCode().equals(code)) {
pvStationDataVO.setCode(JXDZUtils.GF_CODE);
} else {
pvStationDataVO.setCode(code);
}
pvStationDataVO.setName(name);
//调用core 接口
JSONObject jsonObject = new JSONObject();
if (JXDZCodeEnum.GF.getCode().equals(code)) {
String url = "/core/datastorage/gateway/point/list?groupId=1770308721235230721&dataType=analog";
jsonObject = jxdzUtils.sendCoreGetRequest(url);
}
if (jsonObject.getInteger("status") == HttpStatus.OK.value()) {
//补充电站测点信息
supplementStationData(jsonObject.getJSONArray("result"), pvStationDataVO);
supplementBDData(pvStationDataVO, code);
}
return pvStationDataVO;
}
/**
* 补充损失电量
* @param pvStationDataVO
* @param code
*/
private void supplementBDData(PvStationDataVO pvStationDataVO, String code) {
JSONObject jsonObject = new JSONObject();
if (JXDZCodeEnum.GF.getCode().equals(code)) {
String yesterday = null;
try {
yesterday = DateUtils.dateFormat(Date.from(LocalDate.now().minusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd");
} catch (ParseException e) {
throw new RuntimeException(e);
}
String url = "/screen_api?method=scene_screen.large_screen.get_loss_of_electricity&reporting_data=" + yesterday + "&source_station_id=1701778419827638274&station_type=PV";
jsonObject = jxdzUtils.sendCoreGetRequest(url);
}
if (0 == jsonObject.getInteger("status")) {
JSONObject data = jsonObject.getJSONObject("data");
if (!Objects.isNull(data)) {
pvStationDataVO.setLossElectricity(data.getDouble("loss_of_electricity_day"));
pvStationDataVO.setOnGridEnergyDaily(data.getDouble("on_grid_energy_day"));
pvStationDataVO.setOnGridEnergyMonth(data.getDouble("on_grid_energy_month"));
pvStationDataVO.setOnGridEnergyYear(data.getDouble("on_grid_energy_year"));
pvStationDataVO.setOnGridEnergyGross(data.getDouble("on_grid_energy"));
}
}
}
/**
* 补充场站数据
* @param result
* @param pvStationDataVO
*/
private void supplementStationData(JSONArray result, PvStationDataVO pvStationDataVO) {
if (CollectionUtil.isNotEmpty(result)) {
for (Object o : result) {
if (o instanceof Map) {
Map map = (Map) o;
JSONObject jsonObject = new JSONObject(map);
String pointName = (String) map.get("pointName");
if ("发电功率".equals(pointName)) {
pvStationDataVO.setGenerationPower((Double) map.get("value"));
}
if ("总辐射".equals(pointName)) {
pvStationDataVO.setTotalRadiation(jsonObject.getDouble("value"));
}
if ("直接辐射".equals(pointName)) {
pvStationDataVO.setDirectRadiation(jsonObject.getDouble("value"));
}
if ("散射辐射".equals(pointName)) {
pvStationDataVO.setScatterRadiation(jsonObject.getDouble("value"));
}
if ("直接辐照度".equals(pointName)) {
pvStationDataVO.setDirectIrradiance(jsonObject.getDouble("value"));
}
if ("总辐照度".equals(pointName)) {
pvStationDataVO.setTotalIrradiance(jsonObject.getDouble("value"));
}
if ("散射辐照度".equals(pointName)) {
pvStationDataVO.setScatterIrradiance(jsonObject.getDouble("value"));
}
if ("日发电量".equals(pointName)) {
pvStationDataVO.setGenerationDaily(jsonObject.getDouble("value"));
}
if ("月发电量".equals(pointName)) {
pvStationDataVO.setGenerationMonth(jsonObject.getDouble("value"));
}
if ("年发电量".equals(pointName)) {
pvStationDataVO.setGenerationYear(jsonObject.getDouble("value"));
}
if ("累计发电量".equals(pointName)) {
pvStationDataVO.setGenerationGross(jsonObject.getDouble("value"));
}
if ("利用小时数".equals(pointName)) {
pvStationDataVO.setUtilizeHours(jsonObject.getDouble("value"));
}
}
}
}
}
@Override
public void sendData(Integer accessType, NeedDataVO needDataVO, List list) {
if (CollectionUtil.isNotEmpty(list)) {
jxdzUtils.sendJXDZPostRequest("/ngnsyncjiangxiyw/accesshourdata/pvStationData", accessType, needDataVO, list);
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvDeviceDataEntity;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.PvDeviceDataServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.PvDeviceDataVO;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.JXDZMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
public class GFDZSBJCServiceImpl implements IJXDZService {
@Autowired
JXDZUtils jxdzUtils;
@Autowired
PvDeviceDataServiceImpl pvDeviceDataService;
@Autowired
JXDZMapper jxdzMapper;
@Override
public void backupData(List list, Long dateTime) {
if (CollectionUtil.isNotEmpty(list)) {
List<PvDeviceDataEntity> pvDeviceDataEntityList = new ArrayList<>();
list.forEach(item -> {
PvDeviceDataEntity pvDeviceDataEntity = BeanUtil.copyProperties(item, PvDeviceDataEntity.class);
pvDeviceDataEntity.setDateTime(dateTime);
pvDeviceDataEntityList.add(pvDeviceDataEntity);
});
pvDeviceDataService.saveBatch(pvDeviceDataEntityList);
}
}
@Override
public List buildData(Integer accessType, Long dateTime) {
List<PvDeviceDataVO> list = new ArrayList<>();
if (JXDZAccessTypeEnum.BULU.getCode().equals(accessType)) {
List<PvDeviceDataEntity> windStationDataEntityList = pvDeviceDataService.list(new LambdaQueryWrapper<PvDeviceDataEntity>().eq(PvDeviceDataEntity::getDateTime, dateTime));
list = BeanUtil.copyToList(windStationDataEntityList, PvDeviceDataVO.class);
} else {
JSONArray zzBusinessData = getZZBusinessData();
if (CollectionUtil.isNotEmpty(zzBusinessData)) {
for (Object o : zzBusinessData) {
if (o instanceof Map) {
Map map = (Map) o;
JSONObject jsonObject = new JSONObject(map);
if (jsonObject.getString("name").contains("子阵")) {
list.add(getPvDeviceDataVO(jsonObject));
}
}
}
}
}
return list;
}
/**
* 获取光伏设备数据
* @param jsonObject
* @return
*/
private PvDeviceDataVO getPvDeviceDataVO(JSONObject jsonObject) {
PvDeviceDataVO pvDeviceDataVO = new PvDeviceDataVO();
String sequenceNbr = jsonObject.getString("sequenceNbr");
pvDeviceDataVO.setName(jsonObject.getString("name"));
pvDeviceDataVO.setCode(getPvDeviceCode(jsonObject.getString("name")));
//开始调用具体列表接口
JSONArray windDeviceJSONArray = getPvDeviceDataBySequenceNbr(sequenceNbr);
if (CollectionUtil.isNotEmpty(windDeviceJSONArray)) {
for (Object o : windDeviceJSONArray) {
if (o instanceof Map) {
Map map = (Map) o;
JSONObject result = new JSONObject(map);
String pointLocation = result.getString("pointLocation");
Boolean flag = checkPvDevice(pointLocation, jsonObject.getString("name"));
if (flag) {
String pointName = (String) map.get("pointName");
if (pointName.contains("日发电量")) {
pvDeviceDataVO.setGenerationDaily(result.getDouble("value"));
}
if (pointName.contains("月发电量")) {
pvDeviceDataVO.setGenerationMonth(result.getDouble("value"));
}
if (pointName.contains("年发电量")) {
pvDeviceDataVO.setGenerationYear(result.getDouble("value"));
}
if (pointName.contains("总发电量")) {
pvDeviceDataVO.setGenerationGross(result.getDouble("value"));
}
}
}
}
}
return pvDeviceDataVO;
}
/**
* 校验路径是否是子阵的 路径倒数第三位为子阵
* @param pointLocation
* @param name
* @return
*/
private Boolean checkPvDevice(String pointLocation, String name) {
if (!StrUtil.isEmpty(pointLocation)) {
String[] split = pointLocation.split("/");
if (!Objects.isNull(split)) {
String zdName = split[split.length - 3];
if (zdName.equals(name)) {
return true;
}
}
}
return false;
}
/**
* 获取光伏设备数据根据主键
* @param sequenceNbr
* @return
*/
private JSONArray getPvDeviceDataBySequenceNbr(String sequenceNbr) {
JSONObject jsonObject = jxdzUtils.sendCoreGetRequest("/core/datastorage/gateway/point/list?groupId=" + sequenceNbr + "&dataType=accumulator");
if (!Objects.isNull(jsonObject)) {
if (jsonObject.getInteger("status") == HttpStatus.OK.value()) {
return jsonObject.getJSONArray("result");
}
}
return new JSONArray();
}
/**
* 获取光伏设备Code
* @param name
* @return
*/
private String getPvDeviceCode(String name) {
String replaceString = name.replace("子阵", "");
Integer value = Integer.valueOf(replaceString);
String field = "%#" + value + "光伏阵区系统%";
String replaceField = "%#" + replaceString + "光伏阵区系统%";
return jxdzMapper.getDeviceCode(JXDZCodeEnum.GF.getCode(), field, replaceField);
}
private JSONArray getZZBusinessData() {
JSONObject jsonObject = jxdzUtils.sendCoreGetRequest("/core/front-gateway-device/tree?gatewayId=1762633785632919553");
if (!Objects.isNull(jsonObject)) {
if (jsonObject.getInteger("status") == HttpStatus.OK.value()) {
JSONArray result = jsonObject.getJSONArray("result");
if (CollectionUtil.isNotEmpty(result)) {
JSONObject firstObject = result.getJSONObject(0).getJSONArray("children").getJSONObject(0);
if (!Objects.isNull(firstObject)) {
JSONArray children = firstObject.getJSONArray("children");
if (CollectionUtil.isNotEmpty(children)) {
for (Object child : children) {
if (child instanceof Map) {
Map map = (Map) child;
JSONObject childJSON = new JSONObject(map);
if ("装置测点".equals(childJSON.getString("name"))) {
return childJSON.getJSONArray("children");
}
}
}
}
}
}
}
}
return new JSONArray();
}
@Override
public void sendData(Integer accessType, NeedDataVO needDataVO, List list) {
if(CollectionUtil.isNotEmpty(list)){
jxdzUtils.sendJXDZPostRequest("/ngnsyncjiangxiyw/accesshourdata/pvDeviceData", accessType, needDataVO, list);
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO;
import java.util.List;
public interface IJXDZService {
/**
* 备份数据
* @param list
* @param dateTime
*/
void backupData(List list, Long dateTime);
/**
* 构建数据
* @param accessType
* @param dateTime
* @return
*/
List buildData(Integer accessType, Long dateTime);
/**
* 发送数据
* @param accessType
* @param needDataVO
* @param list
*/
void sendData(Integer accessType, NeedDataVO needDataVO, List list);
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZDataTypeEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.List;
import java.util.Map;
@Component
@Slf4j
public class JXDZExecute {
@Autowired
JXDZUtils jxdzUtils;
@Autowired
JXDZFactory jxdzFactory;
@Value("${scheduledEnable:false}")
private Boolean scheduledEnable;
@Scheduled(cron = "0 0 */1 * * ?")
public void hourInterface() {
if (!scheduledEnable) {
return;
}
log.info("开始执行小时任务");
//发送请求传入的参数
NeedDataVO needDataVO = new NeedDataVO();
needDataVO.setPlatformId(Long.valueOf(1360001));
needDataVO.setDateTime(LocalDateTime.now().withMinute(0).withSecond(0).withNano(0).atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli());
//构建数据
IJXDZService fdzjcService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.FDZJC);
IJXDZService gfdzjcService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.GFDZJC);
IJXDZService fdzsbjcService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.FDZSBJC);
IJXDZService gfdzsbjcService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.GFDZSBJC);
List<WindStationDataVO> windStationDataVOList = fdzjcService.buildData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO.getDateTime());
List<PvStationDataVO> pvStationDataVOList = gfdzjcService.buildData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO.getDateTime());
List<WindDeviceDataVO> windDeviceDataVOList = fdzsbjcService.buildData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO.getDateTime());
List<PvDeviceDataVO> pvDeviceDataVOList = gfdzsbjcService.buildData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO.getDateTime());
//备份数据
fdzjcService.backupData(windStationDataVOList, needDataVO.getDateTime());
gfdzjcService.backupData(pvStationDataVOList, needDataVO.getDateTime());
fdzsbjcService.backupData(windDeviceDataVOList, needDataVO.getDateTime());
gfdzsbjcService.backupData(pvDeviceDataVOList, needDataVO.getDateTime());
//发送请求
fdzjcService.sendData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO, windStationDataVOList);
gfdzjcService.sendData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO, pvStationDataVOList);
fdzsbjcService.sendData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO, windDeviceDataVOList);
gfdzsbjcService.sendData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO, pvDeviceDataVOList);
log.info("小时任务执行成功");
}
@Scheduled(cron = "0 0 1 * * ?")
public void dayInterface() {
if (!scheduledEnable) {
return;
}
log.info("开始执行天任务");
//发送请求传入的参数
NeedDataVO needDataVO = new NeedDataVO();
needDataVO.setPlatformId(Long.valueOf(1360001));
needDataVO.setDateTime(LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0).atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli());
//构建数据
IJXDZService dzmtsjService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.DZMTSJ);
List<StationDailyDataVO> stationDailyDataVOList = dzmtsjService.buildData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO.getDateTime());
//备份数据
dzmtsjService.backupData(stationDailyDataVOList, needDataVO.getDateTime());
//发送请求
dzmtsjService.sendData(JXDZAccessTypeEnum.CAIJI.getCode(), needDataVO, stationDailyDataVOList);
//处理补录
listNeed();
log.info("天任务执行成功");
}
/**
* 处理需要补录的数据
*/
private void listNeed() {
log.info("处理补录数据中");
JSONObject listNeedJson = jxdzUtils.sendJXDZGetRequest("/ngnsyncjiangxiyw/needreaccess/listNeed?platformId=1360001");
if (HttpStatus.OK.value() == listNeedJson.getInteger("code")) {
JSONArray data = listNeedJson.getJSONArray("data");
if (CollectionUtil.isNotEmpty(data)) {
log.info("需要补录的数据有{}条", data.size());
for (Object o : data) {
if (o instanceof Map) {
Map needData = (Map) o;
dealListNeedData(new JSONObject(needData));
}
}
} else {
log.info("没有补录的数据需要处理");
}
}
log.info("补录数据处理完成");
}
private void dealListNeedData(JSONObject needData) {
NeedDataVO needDataVO = JSONObject.parseObject(needData.toJSONString(), NeedDataVO.class);
JXDZDataTypeEnum dataTypeEnum = JXDZDataTypeEnum.getEnumByCode(needDataVO.getDataType());
IJXDZService fdzjcService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.FDZJC);
IJXDZService gfdzjcService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.GFDZJC);
IJXDZService fdzsbjcService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.FDZSBJC);
IJXDZService gfdzsbjcService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.GFDZSBJC);
IJXDZService gzmtsjService = jxdzFactory.getJXDZService(JXDZDataTypeEnum.DZMTSJ);
switch (dataTypeEnum) {
case FDZJC:
fdzjcService.sendData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO, fdzjcService.buildData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO.getDateTime()));
break;
case GFDZJC:
gfdzjcService.sendData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO, gfdzjcService.buildData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO.getDateTime()));
break;
case FDZSBJC:
fdzsbjcService.sendData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO, fdzsbjcService.buildData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO.getDateTime()));
break;
case GFDZSBJC:
gfdzsbjcService.sendData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO, gfdzsbjcService.buildData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO.getDateTime()));
break;
case DZMTSJ:
gzmtsjService.sendData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO, gzmtsjService.buildData(JXDZAccessTypeEnum.BULU.getCode(), needDataVO.getDateTime()));
break;
default:
throw new BadRequest("没有找到匹配的补录数据类型");
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZDataTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
@Component
public class JXDZFactory {
@Autowired
private FDZJCServiceImpl fdzjcService;
@Autowired
private GFDZJCServiceImpl gfdzjcService;
@Autowired
private FDZSBJCServiceImpl fdzsbjcService;
@Autowired
private GFDZSBJCServiceImpl gfdzsbjcService;
@Autowired
private DZMTSJServiceImpl dzmtsjService;
public IJXDZService getJXDZService(JXDZDataTypeEnum dataType) {
switch (dataType) {
case FDZJC:
return fdzjcService;
case GFDZJC:
return gfdzjcService;
case FDZSBJC:
return fdzsbjcService;
case GFDZSBJC:
return gfdzsbjcService;
case DZMTSJ:
return dzmtsjService;
default:
throw new BadRequest("没有找到匹配的补录数据类型");
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PvDeviceDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvDeviceDataEntity;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service
public class PvDeviceDataServiceImpl extends BaseService<PvDeviceDataEntity, PvDeviceDataEntity, PvDeviceDataMapper> {
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PvStationDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvStationDataEntity;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service
public class PvStationDataServiceImpl extends BaseService<PvStationDataEntity, PvStationDataEntity, PvStationDataMapper> {
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationDailyDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.StationDailyDataEntity;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service
public class StationDailyDataServiceImpl extends BaseService<StationDailyDataEntity, StationDailyDataEntity, StationDailyDataMapper> {
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.WindDeviceDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindDeviceDataEntity;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service
public class WindDeviceDataServiceImpl extends BaseService<WindDeviceDataEntity, WindDeviceDataEntity, WindDeviceDataMapper> {
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.WindStationDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindStationDataEntity;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
@Service
public class WindStationDataServiceImpl extends BaseService<WindStationDataEntity, WindStationDataEntity, WindStationDataMapper> {
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils;
import cn.hutool.core.codec.Base64;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.asn1.gm.GMNamedCurves;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.crypto.engines.SM2Engine;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.bouncycastle.crypto.params.ParametersWithRandom;
import org.bouncycastle.math.ec.ECPoint;
import org.bouncycastle.util.encoders.Hex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.List;
import java.util.Objects;
/**
* 江西电建工具类
*/
@Component
@Slf4j
public class JXDZUtils {
@Value("${coreIp:iiet-jepcc.powerchina.cn:8088}")
String coreIp;
@Value("${jxdzIp:122.70.153.215:9003}")
String jxdzIp;
@Value("${jxdzTokenUserName:jiangxi_epc}")
String jxdzTokenUserName;
@Value("${jxdzTokenPassword:123456}")
String jxdzTokenPassword;
@Value("${jxdzPublicKey:04508e9c4df8463c784df2dde2536e792851a8f3fd0e5ff29b7bf1a5d9e3f566aa49a7a5fe7683e3dc4dc30dd7bc8773838a9e4fbcf7dfac53461c8777a6aed691}")
String publicKey;
@Autowired
RestTemplate restTemplate;
@Autowired
AmosRequestContext amosRequestContext;
public static String XZ_CODE="PWC20123608280010";
public static String GF_CODE="PPC17063608260011";
private String dataEncrypt(String obj, String publicKey) {
X9ECParameters sm2ECParameters = GMNamedCurves.getByName("sm2p256v1");
ECDomainParameters domainParameters = new ECDomainParameters(sm2ECParameters.getCurve(), sm2ECParameters.getG(),
sm2ECParameters.getN(), sm2ECParameters.getH());
ECPoint pukPoint = sm2ECParameters.getCurve()
.decodePoint(Hex.decode(publicKey));
ECPublicKeyParameters publicKeyParameters = new ECPublicKeyParameters(pukPoint, domainParameters);
SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2;
SM2Engine sm2Engine = new SM2Engine(mode);
// 设置sm2为加密模式
sm2Engine.init(true, new ParametersWithRandom(publicKeyParameters, new SecureRandom()));
byte[] arrayOfBytes = null;
byte[] in = obj.getBytes(StandardCharsets.UTF_8);
try {
arrayOfBytes = sm2Engine.processBlock(in, 0, in.length);
} catch (Exception e) {
e.printStackTrace();
}
return Base64.encode(arrayOfBytes);
}
/**
* 获取token
* @return
*/
private String getToken() {
String url = "http://" + jxdzIp + "/auth/justLogin";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
JSONObject jsonObject = new JSONObject();
jsonObject.put("username", jxdzTokenUserName);
jsonObject.put("password", jxdzTokenPassword);
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(jsonObject, headers);
try {
ResponseEntity<JSONObject> result = restTemplate.postForEntity(url, httpEntity, JSONObject.class);
if (HttpStatus.OK == result.getStatusCode()) {
JSONObject body = result.getBody();
if (HttpStatus.OK.value() == body.getInteger("code")) {
JSONObject data = body.getJSONObject("data");
return data.getString("access_token");
} else {
throw new BadRequest("获取token失败,失败原因[" + body + "]");
}
} else {
throw new BadRequest("获取token失败,失败原因[" + result + "]");
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BadRequest("获取token失败,失败原因[" + e.getMessage() + "]");
}
}
/**
* 发送GET请求
* @param url
* @return
*/
public JSONObject sendCoreGetRequest(String url) {
String reqUrl = "http://" + coreIp + url;
HttpHeaders headers = new HttpHeaders();
headers.set("Token", amosRequestContext.getToken());
headers.set("Product", amosRequestContext.getProduct());
headers.set("Appkey", amosRequestContext.getAppKey());
HttpEntity entity = new HttpEntity<>(headers);
log.info("发送GET请求,请求地址{}", reqUrl);
try {
ResponseEntity<JSONObject> response = restTemplate.exchange(reqUrl, HttpMethod.GET, entity, JSONObject.class);
if (HttpStatus.OK == response.getStatusCode()) {
log.info("发送请求成功,请求返回体{}", response.getBody());
return response.getBody();
} else {
throw new BadRequest("返回接口异常,失败原因[" + response + "]");
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BadRequest("发送GET请求失败,失败原因[" + e.getMessage() + "]");
}
}
/**
* 发送GET请求
* @param url
* @return
*/
public JSONObject sendJXDZGetRequest(String url) {
String reqUrl = "http://" + jxdzIp + url;
log.info("发送GET请求,请求地址{}", reqUrl);
HttpEntity entity = new HttpEntity<>(buildHttpHeaders());
try {
ResponseEntity<JSONObject> response = restTemplate.exchange(reqUrl, HttpMethod.GET, entity, JSONObject.class);
if (HttpStatus.OK == response.getStatusCode()) {
log.info("发送请求成功,请求返回体{}", response.getBody());
return response.getBody();
} else {
throw new BadRequest("返回接口异常,失败原因[" + response + "]");
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BadRequest("发送GET请求失败,失败原因[" + e.getMessage() + "]");
}
}
/**
* 发送Post请求
* @param url
* @param accessType
* @param needDataVO
* @param data
*/
public void sendJXDZPostRequest(String url, Integer accessType, NeedDataVO needDataVO, List data) {
String reqUrl = "http://" + jxdzIp + url;
log.info("发送POST请求,请求地址{}", reqUrl);
HttpEntity<JSONObject> entity = new HttpEntity<>(buildBody(needDataVO.getPlatformId(), needDataVO.getDateTime(), data, accessType, needDataVO.getReaccessId()), buildHttpHeaders());
try {
ResponseEntity<JSONObject> response = restTemplate.postForEntity(reqUrl, entity, JSONObject.class);
if (HttpStatus.OK == response.getStatusCode()) {
JSONObject body = response.getBody();
if (HttpStatus.OK.value() == body.getInteger("code")) {
log.info("发送JXDZ请求成功,请求返回体{}", response.getBody());
} else {
log.info("发送JXDZ请求失败,请求返回体{}", response.getBody());
throw new BadRequest("发送JXDZ请求失败,失败原因[" + response.getBody() + "]");
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BadRequest("发送POST请求失败,失败原因[" + e.getMessage() + "]");
}
}
private HttpHeaders buildHttpHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
String authorization = "Bearer " + getToken();
headers.set("Authorization", authorization);
return headers;
}
/**
* 构建请求体
* @param platformId
* @param time
* @param data
* @param accessType
* @param reaccessId
* @return
*/
private JSONObject buildBody(Long platformId, Long time, List data, Integer accessType, Long reaccessId) {
JSONObject body = new JSONObject();
body.put("accessType", accessType);
body.put("encryptData", buildEncryptData(platformId, time, data, reaccessId));
return body;
}
/**
* 加密数据
* @param platformId
* @param time
* @param data
* @param reaccessId
* @return
*/
private String buildEncryptData(Long platformId, Long time, List data, Long reaccessId) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("platformId", platformId);
if (!Objects.isNull(reaccessId)) {
jsonObject.put("reaccessId", reaccessId);
}
jsonObject.put("time", time);
jsonObject.put("data", data);
return dataEncrypt(jsonObject.toJSONString(), publicKey);
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo;
import lombok.Data;
@Data
public class NeedDataVO {
/**
* 补录数据的标识
*/
private Long reaccessId;
/**
* 子系统标识
*/
private Long platformId;
/**
* 需要补录的数据类型
*/
private Integer dataType;
/**
* 毫秒级别时间
*/
private Long dateTime;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class PvDeviceDataVO {
private String code;
private String name;
/**
*日发电量
*/
@JSONField(name = "GenerationDaily")
private Double GenerationDaily;
/**
*月发电量
*/
@JSONField(name = "GenerationMonth")
private Double GenerationMonth;
/**
*年发电量
*/
@JSONField(name = "GenerationYear")
private Double GenerationYear;
/**
*累计发电量
*/
@JSONField(name = "GenerationGross")
private Double GenerationGross;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class PvStationDataVO {
private String code;
private String name;
/**
*发电功率
*/
@JSONField(name = "GenerationPower")
private Double GenerationPower;
/**
*总辐射
*/
@JSONField(name = "TotalRadiation")
private Double TotalRadiation;
/**
*直接辐射
*/
@JSONField(name = "DirectRadiation")
private Double DirectRadiation;
/**
*散射辐射
*/
@JSONField(name = "ScatterRadiation")
private Double ScatterRadiation;
/**
*日发电量
*/
@JSONField(name = "GenerationDaily")
private Double GenerationDaily;
/**
*月发电量
*/
@JSONField(name = "GenerationMonth")
private Double GenerationMonth;
/**
*年发电量
*/
@JSONField(name = "GenerationYear")
private Double GenerationYear;
/**
*累计发电量
*/
@JSONField(name = "GenerationGross")
private Double GenerationGross;
/**
*利用小时数
*/
@JSONField(name = "UtilizeHours")
private Double UtilizeHours;
/**
*损失电量
*/
@JSONField(name = "LossElectricity")
private Double LossElectricity;
/**
*总辐照度
*/
@JSONField(name = "TotalIrradiance")
private Double TotalIrradiance;
/**
*直接辐照度
*/
@JSONField(name = "DirectIrradiance")
private Double DirectIrradiance;
/**
*散射辐照度
*/
@JSONField(name = "ScatterIrradiance")
private Double ScatterIrradiance;
/**
* 日上网电量
*/
@JSONField(name = "OnGridEnergyDaily")
private Double OnGridEnergyDaily;
/**
* 月上网电量
*/
@JSONField(name = "OnGridEnergyMonth")
private Double OnGridEnergyMonth;
/**
* 年上网电量
*/
@JSONField(name = "OnGridEnergyYear")
private Double OnGridEnergyYear;
/**
* 累计上网电量
*/
@JSONField(name = "OnGridEnergyGross")
private Double OnGridEnergyGross;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
/**
* 电站运维数据
*/
@Data
public class StationDailyDataVO {
private String code;
private String name;
/**
* 工作票总数
*/
@JSONField(name = "WorkTicketTotalNums")
private Double WorkTicketTotalNums;
/**
* 办理中工作票数
*/
@JSONField(name = "WorkTicketProcessingNums")
private Double WorkTicketProcessingNums;
/**
* 已作废工作票数
*/
@JSONField(name = "WorkTicketInvalidatedNums")
private Double WorkTicketInvalidatedNums;
/**
* 执行中工作票总数
*/
@JSONField(name = "WorkTicketExecutingNums")
private Double WorkTicketExecutingNums;
/**
* 已终结的工作票数
*/
@JSONField(name = "WorkTicketTerminatedNums")
private Double WorkTicketTerminatedNums;
/**
*定期工作任务
*/
@JSONField(name = "RegularTasksNums")
private Double RegularTasksNums;
/**
* 巡检任务数量
*/
@JSONField(name = "InspectionTasksNums")
private Double InspectionTasksNums;
/**
* 工单总数
*/
@JSONField(name = "WorkOrderTotalNums")
private Double WorkOrderTotalNums;
/**
* 工单作废数
*/
@JSONField(name = "WorkOrderInvalidatedNums")
private Double WorkOrderInvalidatedNums;
/**
* 工单待开工数
*/
@JSONField(name = "WorkOrderToBeOpenedNums")
private Double WorkOrderToBeOpenedNums;
/**
* 工单终结数
*/
@JSONField(name = "WorkOrderTerminatedNums")
private Double WorkOrderTerminatedNums;
/**
* 工单开工数
*/
@JSONField(name = "WorkOrderStartNums")
private Double WorkOrderStartNums;
/**
* 二氧化碳减排量
*/
@JSONField(name = "Co2EmissionReduction")
private Double Co2EmissionReduction;
/**
* 节约标准煤
*/
@JSONField(name = "StandardCoalSaving")
private Double StandardCoalSaving;
/**
* 二氧化硫减排量
*/
@JSONField(name = "So2EmissionReduction")
private Double So2EmissionReduction;
/**
* 碳粉尘减排量
*/
@JSONField(name = "CarbonDustEmissionReduction")
private Double CarbonDustEmissionReduction;
/**
* 发电效率
*/
@JSONField(name = "GenerationEfficiency")
private Double GenerationEfficiency;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class WindDeviceDataVO {
private String code;
private String name;
/**
*日发电量
*/
@JSONField(name = "GenerationDaily")
private Double GenerationDaily;
/**
*月发电量
*/
@JSONField(name = "GenerationMonth")
private Double GenerationMonth;
/**
*年发电量
*/
@JSONField(name = "GenerationYear")
private Double GenerationYear;
/**
*累计发电量
*/
@JSONField(name = "GenerationGross")
private Double GenerationGross;
}
package com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
@Data
public class WindStationDataVO {
private String code;
private String name;
/**
*发电功率
*/
@JSONField(name = "GenerationPower")
private Double GenerationPower;
/**
* 风速
*/
@JSONField(name = "WindSpeed")
private Double WindSpeed;
/**
*风向
*/
@JSONField(name = "WindDirection")
private Double WindDirection;
/**
*日发电量
*/
@JSONField(name = "GenerationDaily")
private Double GenerationDaily;
/**
* 月发电量
*/
@JSONField(name = "GenerationMonth")
private Double GenerationMonth;
/**
* 年发电量
*/
@JSONField(name = "GenerationYear")
private Double GenerationYear;
/**
*累计发电量
*/
@JSONField(name = "GenerationGross")
private Double GenerationGross;
/**
*利用小时数
*/
@JSONField(name = "UtilizeHours")
private Double UtilizeHours;
/**
*损失电量
*/
@JSONField(name = "LossElectricity")
private Double LossElectricity;
/**
* 日上网电量
*/
@JSONField(name = "OnGridEnergyDaily")
private Double OnGridEnergyDaily;
/**
* 月上网电量
*/
@JSONField(name = "OnGridEnergyMonth")
private Double OnGridEnergyMonth;
/**
* 年上网电量
*/
@JSONField(name = "OnGridEnergyYear")
private Double OnGridEnergyYear;
/**
* 累计上网电量
*/
@JSONField(name = "OnGridEnergyGross")
private Double OnGridEnergyGross;
}
package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import org.apache.ibatis.annotations.Param;
public interface JXDZMapper {
/**
* 获取工作票总数
* @param code
* @return
*/
Integer countWorkTicketTotalByCode(@Param("code") String code);
/**
* 获取处理中工作票总数
* @param code
* @return
*/
Integer countWorkTicketProcessingByCode(@Param("code") String code);
/**
* 获取作废的工作票总数
* @param code
* @return
*/
Integer countWorkTicketInvalidatedByCode(@Param("code") String code);
/**
* 获取已终结的工作票总数
* @param code
* @return
*/
Integer countWorkTicketTerminatedByCode(@Param("code") String code);
/**
* 定期工作任务
* @param code
* @return
*/
Integer countRegularTasksByCode(@Param("code") String code);
/**
* 巡检任务数量
* @param code
* @return
*/
Integer countInspectionTasksByCode(@Param("code") String code);
/**
* 工单总数
* @param code
* @return
*/
Integer countWorkOrderTotalByCode(@Param("code") String code);
/**
* 工单作废数
* @param code
* @return
*/
Integer countWorkOrderInvalidatedByCode(@Param("code") String code);
/**
* 工单待开工数
* @param code
* @return
*/
Integer countWorkOrderToBeOpenedByCode(@Param("code") String code);
/**
* 工单终结数
* @param code
* @return
*/
Integer countWorkOrderTerminatedByCode(@Param("code") String code);
/**
* 工单开工数
* @param code
* @return
*/
Integer countWorkOrderStartByCode(@Param("code") String code);
/**
* 获取设备Code
* @param werks
* @param value
* @return
*/
String getDeviceCode(@Param("werks") String werks, @Param("value") String value, @Param("replaceValue") String replaceValue);
}
...@@ -162,8 +162,13 @@ spring.elasticsearch.rest.username=elastic ...@@ -162,8 +162,13 @@ spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=Yeejoin@2020 spring.elasticsearch.rest.password=Yeejoin@2020
spring.elasticsearch.rest.read-timeout=30000 spring.elasticsearch.rest.read-timeout=30000
logic=false
coreIp=iiet-jepcc.powerchina.cn:8088
jxdzIp=122.70.153.215:9003
jxdzTokenUserName=jiangxi_epc
jxdzTokenPassword=123456
publicKey=04508e9c4df8463c784df2dde2536e792851a8f3fd0e5ff29b7bf1a5d9e3f566aa49a7a5fe7683e3dc4dc30dd7bc8773838a9e4fbcf7dfac53461c8777a6aed691
scheduledEnable=false
......
<?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.JXDZMapper">
<select id="countWorkTicketTotalByCode" resultType="java.lang.Integer">
select COUNT(1) from yxgl_gzp_main where WERKS=#{code}
</select>
<select id="countWorkTicketProcessingByCode" resultType="java.lang.Integer">
select COUNT(1) from yxgl_gzp_main where WERKS=#{code} and ZSTAT in
('01','02','03','04','05','06','07','08','09','10','11','12','15','17','20','21','22','23','24','25','26','27','28','29','30','31','32','33')
</select>
<select id="countWorkTicketInvalidatedByCode" resultType="java.lang.Integer">
select COUNT(1) from yxgl_gzp_main where WERKS=#{code} and ZSTAT ='19'
</select>
<select id="countWorkTicketTerminatedByCode" resultType="java.lang.Integer">
select COUNT(1) from yxgl_gzp_main where WERKS=#{code} and ZSTAT ='13'
</select>
<select id="countRegularTasksByCode" resultType="java.lang.Integer">
SELECT COUNT(1) from yxgl_dqgz_dqrw where WERKS=#{code}
</select>
<select id="countInspectionTasksByCode" resultType="java.lang.Integer">
select COUNT(1) from yxgl_xhjc_new_xjrw where WERKS=#{code}
</select>
<select id="countWorkOrderTotalByCode" resultType="java.lang.Integer">
select COUNT(1) from fdgl_job_main where WERKS=#{code}
</select>
<select id="countWorkOrderInvalidatedByCode" resultType="java.lang.Integer">
select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='4'
</select>
<select id="countWorkOrderToBeOpenedByCode" resultType="java.lang.Integer">
select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='6'
</select>
<select id="countWorkOrderTerminatedByCode" resultType="java.lang.Integer">
select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='3'
</select>
<select id="countWorkOrderStartByCode" resultType="java.lang.Integer">
select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='1'
</select>
<select id="getDeviceCode" resultType="java.lang.String">
select KKSBM from sjgl_zsj_zsbtz where WERKS=#{werks} and (KKSMS like #{value} or KKSMS like #{replaceValue})
</select>
</mapper>
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