Commit 4ee4e972 authored by tangwei's avatar tangwei

解决冲突

parents b9876e03 79976dad
package com.yeejoin.amos.boot.module.hygf.api.entity; package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
...@@ -14,30 +16,40 @@ public class TdHYGFInverterMonthGenerate implements Serializable { ...@@ -14,30 +16,40 @@ public class TdHYGFInverterMonthGenerate implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
@ExcelIgnore
private Long createdTime; private Long createdTime;
/** /**
* 第三方场站id * 第三方场站id
*/ */
@ExcelIgnore
private String thirdStationId; private String thirdStationId;
/** /**
* sncode *日 yyyy-MM-dd
*/ */
private String snCode; @ExcelProperty("时间")
private String dayTime;
/** /**
*日 yyyy-MM * sncode
*/ */
private String monthTime; @ExcelProperty("SN")
private String snCode;
/** /**
*月 yyyy *月 yyyy
*/ */
private String year; @ExcelIgnore
private String yearMonth;
/** /**
* 发电量 * 发电量
*/ */
@ExcelProperty("日发电量(kWh)")
private Double generate; private Double generate;
/** /**
* 满发小时数 * 满发小时数
*/ */
@ExcelProperty("日满发小时数(h)")
private Double fullhour; private Double fullhour;
@ExcelIgnore
private Double income;
} }
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
@TableName(value = "td_hygf_inverter_total_generate" ,autoResultMap = true)
public class TdHYGFInverterTotalGenerate implements Serializable {
/**
* 创建时间
*/
private Long createdTime;
/**
* 第三方场站id
*/
private String thirdStationId;
/**
* sncode
*/
private String snCode;
/**
*日 yyyy-MM
*/
private String yearTime;
/**
*月 yyyy
*/
private String year;
/**
* 发电量
*/
private Double generate;
/**
* 满发小时数
*/
private Double fullhour;
private Double income;
}
package com.yeejoin.amos.boot.module.hygf.api.entity; package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
...@@ -14,30 +16,40 @@ public class TdHYGFInverterYearGenerate implements Serializable { ...@@ -14,30 +16,40 @@ public class TdHYGFInverterYearGenerate implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
@ExcelIgnore
private Long createdTime; private Long createdTime;
/** /**
* 第三方场站id * 第三方场站id
*/ */
@ExcelIgnore
private String thirdStationId; private String thirdStationId;
/** /**
* sncode *日 yyyy-MM
*/ */
private String snCode; @ExcelProperty("时间")
private String monthTime;
/** /**
*日 yyyy-MM * sncode
*/ */
private String yearTime; @ExcelProperty("SN")
private String snCode;
/** /**
*月 yyyy *月 yyyy
*/ */
@ExcelIgnore
private String year; private String year;
/** /**
* 发电量 * 发电量
*/ */
@ExcelProperty("月发电量(kWh)")
private Double generate; private Double generate;
/** /**
* 满发小时数 * 满发小时数
*/ */
@ExcelProperty("月满发小时数(h)")
private Double fullhour; private Double fullhour;
@ExcelIgnore
private Double income;
} }
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
@TableName(value = "td_hygf_station_day_generate" ,autoResultMap = true)
public class TdHYGFStationDayGenerate implements Serializable {
/**
* 创建时间
*/
private Long createdTime;
/**
* 第三方场站id
*/
private String thirdStationId;
/**
*日 yyyy-MM-dd
*/
private String dayTime;
/**
*月 yyyy-MM
*/
private String yearMonth;
/**
* 发电量
*/
private Double generate;
private Double fullhour;
}
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
@TableName(value = "td_hygf_station_month_generate" ,autoResultMap = true)
public class TdHYGFStationMonthGenerate implements Serializable {
/**
* 创建时间
*/
private Long createdTime;
/**
* 第三方场站id
*/
private String thirdStationId;
/**
*日 yyyy-MM
*/
private String monthTime;
/**
*月 yyyy
*/
private String year;
/**
* 发电量
*/
private Double generate;
private Double fullhour;
}
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
@TableName(value = "td_hygf_station_year_generate" ,autoResultMap = true)
public class TdHYGFStationYearGenerate implements Serializable {
/**
* 创建时间
*/
private Long createdTime;
/**
* 第三方场站id
*/
private String thirdStationId;
/**
*日 yyyy-MM
*/
private String yearTime;
/**
*月 yyyy
*/
private String year;
/**
* 发电量
*/
private Double generate;
private Double fullhour;
}
...@@ -3,5 +3,12 @@ package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper; ...@@ -3,5 +3,12 @@ package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate;
import java.util.List;
import java.util.Map;
public interface TdHYGFInverterDayGenerateMapper extends BaseMapper<TdHYGFInverterDayGenerate> { public interface TdHYGFInverterDayGenerateMapper extends BaseMapper<TdHYGFInverterDayGenerate> {
List<Map<String,Object>> selectDayTrend(List<String> treeParams, String time, String snCode, String thirdStationId);
} }
...@@ -3,5 +3,11 @@ package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper; ...@@ -3,5 +3,11 @@ package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterMonthGenerate; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterMonthGenerate;
import java.util.List;
import java.util.Map;
public interface TdHYGFInverterMonthGenerateMapper extends BaseMapper<TdHYGFInverterMonthGenerate> { public interface TdHYGFInverterMonthGenerateMapper extends BaseMapper<TdHYGFInverterMonthGenerate> {
List<Map<String,Object>> selectMonthTrend(String time, String snCode, String thirdStationId);
Map<String,Object> selectMonthTotal(String time, String snCode, String thirdStationId);
} }
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper; package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterTotalGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterYearGenerate; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterYearGenerate;
import java.util.List;
import java.util.Map;
public interface TdHYGFInverterYearGenerateMapper extends BaseMapper<TdHYGFInverterYearGenerate> { public interface TdHYGFInverterYearGenerateMapper extends BaseMapper<TdHYGFInverterYearGenerate> {
List<Map<String, Object>> selectYearTrend(String time, String snCode, String thirdStationId);
List<Map<String, Object>> selectTotalTrend(String time, String snCode, String thirdStationId);
Map<String, Object> selectYearTotal(String time, String snCode, String thirdStationId);
List<TdHYGFInverterTotalGenerate> selectTotalSum(String time, String snCode, String thirdStationId);
} }
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFStationDayGenerate;
public interface TdHYGFStationDayGenerateMapper extends BaseMapper<TdHYGFStationDayGenerate> {
}
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFStationMonthGenerate;
public interface TdHYGFStationMonthGenerateMapper extends BaseMapper<TdHYGFStationMonthGenerate> {
}
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFStationYearGenerate;
public interface TdHYGFStationYearGenerateMapper extends BaseMapper<TdHYGFStationYearGenerate> {
}
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.hygf.api.tdenginemapper.TdHYGFInverterDayGenerateMapper"> <mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterDayGenerateMapper">
<select id="selectDayTrend" resultType="map">
SELECT
<foreach collection="treeParams" item="item" separator=",">
#{item}
</foreach>,
created_time as `time`,
work_status as workstatus
from
house_pv_data.td_hygf_inverter_day_generate
<where>
created_time >= (#{time} - 8h )
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.hygf.api.tdenginemapper.TdHYGFInverterMonthGenerateMapper"> <mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterMonthGenerateMapper">
<select id="selectMonthTrend" resultType="map">
SELECT
day_time as dayTime,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_month_generate
<where>
year_month = #{time}
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
<select id="selectMonthTotal" resultType="map">
SELECT
generate,
fullhour,
income
from
house_pv_data.td_hygf_inverter_month_generate
<where>
day_time = #{time}
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.hygf.api.tdenginemapper.TdHYGFInverterYearGenerateMapper"> <mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterYearGenerateMapper">
<select id="selectYearTrend" resultType="map">
SELECT
month_time as daytime,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_year_generate
<where>
`year` = #{time}
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
<select id="selectTotalTrend" resultType="map">
SELECT
year_time as dayTime,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_total_generate
<where>
<if test="time != null and time !=''">
and year_time = #{time}
</if>
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
<select id="selectYearTotal" resultType="map">
SELECT
income ,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_year_generate
<where>
month_time = #{time}
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
<select id="selectTotalSum" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterTotalGenerate">
SELECT
income ,
generate,
fullhour
from
house_pv_data.td_hygf_inverter_total_generate
<where>
<if test="time != null and time !=''">
year_time = #{time}
</if>
<if test="snCode != null and snCode !=''">
and sn_code = #{snCode}
</if>
<if test="thirdStationId != null and thirdStationId !=''">
and third_station_id = #{thirdStationId}
</if>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
<?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.hygf.api.tdenginemapper.TdHYGFStationDayGenerateMapper">
</mapper>
<?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.hygf.api.tdenginemapper.TdHYGFStationMonthGenerateMapper">
</mapper>
<?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.hygf.api.tdenginemapper.TdHYGFStationYearGenerateMapper">
</mapper>
...@@ -182,7 +182,7 @@ public class HouseholdContractController extends BaseController { ...@@ -182,7 +182,7 @@ public class HouseholdContractController extends BaseController {
//去签署 //去签署
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/{sequenceNbr}") @PostMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "post", value = "根据sequenceNbr发起", notes = "根据sequenceNbr发起") @ApiOperation(httpMethod = "POST", value = "根据sequenceNbr发起", notes = "根据sequenceNbr发起")
public ResponseModel<HouseholdContractDto> qsBySequenceNbrHouseholdContract(@RequestBody HouseholdContractDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<HouseholdContractDto> qsBySequenceNbrHouseholdContract(@RequestBody HouseholdContractDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(householdContractServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(householdContractServiceImpl.updateWithModel(model));
...@@ -191,7 +191,7 @@ public class HouseholdContractController extends BaseController { ...@@ -191,7 +191,7 @@ public class HouseholdContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping (value = "/signing/{sequenceNbr}") @PostMapping (value = "/signing/{sequenceNbr}")
@ApiOperation(httpMethod = "Post", value = "签字", notes = "签字") @ApiOperation(httpMethod = "POST", value = "签字", notes = "签字")
public ResponseModel<Boolean> signing(@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<Boolean> signing(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
HouseholdContract householdContrac= householdContractServiceImpl.getById(sequenceNbr); HouseholdContract householdContrac= householdContractServiceImpl.getById(sequenceNbr);
...@@ -207,7 +207,7 @@ public class HouseholdContractController extends BaseController { ...@@ -207,7 +207,7 @@ public class HouseholdContractController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping (value = "/stamp/{sequenceNbr}") @PostMapping (value = "/stamp/{sequenceNbr}")
@ApiOperation(httpMethod = "Post", value = "盖章", notes = "盖章") @ApiOperation(httpMethod = "POST", value = "盖章", notes = "盖章")
public ResponseModel<Boolean> stamp(@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<Boolean> stamp(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
...@@ -250,7 +250,7 @@ public class HouseholdContractController extends BaseController { ...@@ -250,7 +250,7 @@ public class HouseholdContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping (value = "/cancel/{sequenceNbr}") @PostMapping (value = "/cancel/{sequenceNbr}")
@ApiOperation(httpMethod = "Post", value = "作废", notes = "作废") @ApiOperation(httpMethod = "POST", value = "作废", notes = "作废")
public ResponseModel<Boolean> cancel(@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<Boolean> cancel(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(this.canceldata(sequenceNbr)); return ResponseHelper.buildResponse(this.canceldata(sequenceNbr));
} }
...@@ -298,7 +298,7 @@ public class HouseholdContractController extends BaseController { ...@@ -298,7 +298,7 @@ public class HouseholdContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping (value = "/reissue") @PostMapping (value = "/reissue")
@ApiOperation(httpMethod = "post", value = "重新发起", notes = "重新发起") @ApiOperation(httpMethod = "POST", value = "重新发起", notes = "重新发起")
public ResponseModel<HouseholdContract> reissue(@RequestBody HouseholdContract model ) { public ResponseModel<HouseholdContract> reissue(@RequestBody HouseholdContract model ) {
HouseholdContract householdContract= householdContractServiceImpl.reissueinitiateHouseholdContract(model); HouseholdContract householdContract= householdContractServiceImpl.reissueinitiateHouseholdContract(model);
return ResponseHelper.buildResponse(householdContract); return ResponseHelper.buildResponse(householdContract);
......
...@@ -3,9 +3,12 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller; ...@@ -3,9 +3,12 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum; import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate; import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -37,7 +40,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -37,7 +40,6 @@ 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.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -63,94 +65,94 @@ public class JpInverterController extends BaseController { ...@@ -63,94 +65,94 @@ public class JpInverterController extends BaseController {
@Autowired @Autowired
JpPersonStationMapper pPersonStationMapper; JpPersonStationMapper pPersonStationMapper;
@Value("classpath:/json/paramsTree.json")
@Value("classpath:/json/paramsTree.json") private Resource paramsTree;
private Resource paramsTree;
/** /**
* 新增户用光伏监盘逆变器表 * 新增户用光伏监盘逆变器表
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增户用光伏监盘逆变器表", notes = "新增户用光伏监盘逆变器表") @ApiOperation(httpMethod = "POST", value = "新增户用光伏监盘逆变器表", notes = "新增户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> save(@RequestBody JpInverterDto model) { public ResponseModel<JpInverterDto> save(@RequestBody JpInverterDto model) {
model = jpInverterServiceImpl.createWithModel(model); model = jpInverterServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/** /**
* 根据sequenceNbr更新 * 根据sequenceNbr更新
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘逆变器表", notes = "根据sequenceNbr更新户用光伏监盘逆变器表") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘逆变器表", notes = "根据sequenceNbr更新户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> updateBySequenceNbrJpInverter(@RequestBody JpInverterDto model, public ResponseModel<JpInverterDto> updateBySequenceNbrJpInverter(@RequestBody JpInverterDto model,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) { @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jpInverterServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(jpInverterServiceImpl.updateWithModel(model));
} }
/** /**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除户用光伏监盘逆变器表", notes = "根据sequenceNbr删除户用光伏监盘逆变器表") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除户用光伏监盘逆变器表", notes = "根据sequenceNbr删除户用光伏监盘逆变器表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) { @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jpInverterServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(jpInverterServiceImpl.removeById(sequenceNbr));
} }
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个户用光伏监盘逆变器表", notes = "根据sequenceNbr查询单个户用光伏监盘逆变器表") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个户用光伏监盘逆变器表", notes = "根据sequenceNbr查询单个户用光伏监盘逆变器表")
public ResponseModel<JpInverterDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<JpInverterDto> selectOne(@PathVariable Long sequenceNbr) {
JpInverterDto jpInverter = jpInverterServiceImpl.queryBySeq(sequenceNbr); JpInverterDto jpInverter= jpInverterServiceImpl.queryBySeq(sequenceNbr);
jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration() != null ? jpInverter.getDayPowerGeneration() / 1000 : 0); jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration()!=null?jpInverter.getDayPowerGeneration()/1000:0);
jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration() != null ? jpInverter.getMonthPowerGeneration() / 1000 : 0); jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration()!=null?jpInverter.getMonthPowerGeneration()/1000:0);
jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration() != null ? jpInverter.getYearPowerGeneration() / 1000 : 0); jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration()!=null?jpInverter.getYearPowerGeneration()/1000:0);
jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration() != null ? jpInverter.getTotalPowerGeneration() / 1000 : 0); jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration()!=null?jpInverter.getTotalPowerGeneration()/1000:0);
return ResponseHelper.buildResponse(jpInverter); return ResponseHelper.buildResponse(jpInverter);
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
* @param current 每页大小 * @param current 每页大小
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器表分页查询", notes = "户用光伏监盘逆变器表分页查询") @ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器表分页查询", notes = "户用光伏监盘逆变器表分页查询")
public ResponseModel<Page<JpInverterDto>> queryForPage(@RequestParam(value = "current") int current, public ResponseModel<Page<JpInverterDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, JpInverterDto jpInverterDto) { @RequestParam(value = "size") int size, JpInverterDto jpInverterDto) {
List<JpPersonStation> pPersonStation = null; List<JpPersonStation> pPersonStation =null;
if (jpInverterDto.getName() != null && !"".equals(jpInverterDto.getName())) { if(jpInverterDto.getName()!=null&&!"".equals(jpInverterDto.getName())){
LambdaQueryWrapper<JpPersonStation> qug1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JpPersonStation> qug1=new LambdaQueryWrapper<>();
qug1.like(JpPersonStation::getStationName, jpInverterDto.getName()); qug1.like(JpPersonStation::getStationName,jpInverterDto.getName());
pPersonStation = pPersonStationMapper.selectList(qug1); pPersonStation=pPersonStationMapper.selectList(qug1);
} else { }else{
LambdaQueryWrapper<JpPersonStation> qug = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JpPersonStation> qug = new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId, getUserInfo().getUserId()); qug.eq(JpPersonStation::getPersonId, getUserInfo().getUserId());
pPersonStation = pPersonStationMapper.selectList(qug); pPersonStation = pPersonStationMapper.selectList(qug);
} }
if (!pPersonStation.isEmpty()) { if (!pPersonStation.isEmpty()) {
...@@ -207,36 +209,57 @@ public class JpInverterController extends BaseController { ...@@ -207,36 +209,57 @@ public class JpInverterController extends BaseController {
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(list);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/jpInverterTrend") @PostMapping(value = "/jpInverterTrend")
@ApiOperation(httpMethod = "GET", value = "逆变器图标 折线图", notes = "逆变器图标 折线图") @ApiOperation(httpMethod = "POST", value = "逆变器图标 折线图", notes = "逆变器图标 折线图")
public void jpInverterTrend(List<String> treeParams, String type, String time, String snCode, String thirdStationId) { public ResponseModel<Map<String,Object>> jpInverterTrend (@RequestBody Map<String,Object> treeParams) {
String time = treeParams.get("time").toString();
if (CollectionUtils.isNotEmpty(treeParams)) { String snCode = treeParams.get("snCode").toString();
String thirdStationId = treeParams.get("thirdStationId").toString();
jpInverterServiceImpl.selectDayTrend(treeParams, time, snCode, thirdStationId); if (treeParams.get("date").equals("day")){
time = time+ " 00:00:00";
List<JSONObject> treeParams1 = parseArray(JSONObject.toJSONString(treeParams.get("treeParams")), JSONObject.class);
return ResponseHelper.buildResponse(jpInverterServiceImpl.selectDayTrend(treeParams1, time, snCode, thirdStationId));
}else if (treeParams.get("date").equals("month")){
return ResponseHelper.buildResponse(jpInverterServiceImpl.selectMonthTrend(time, snCode, thirdStationId));
}else if (treeParams.get("date").equals("year")) {
return ResponseHelper.buildResponse(jpInverterServiceImpl.selectYearTrend(time, snCode, thirdStationId));
}else {
return ResponseHelper.buildResponse(jpInverterServiceImpl.selectTotalTrend(time, snCode, thirdStationId));
} }
}
// jpInverterServiceImpl. @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getInverterSncodes")
@ApiOperation(httpMethod = "GET", value = "获取逆变器snCode", notes = "获取逆变器snCode")
public ResponseModel<List<Map<String,String>>> getInverterSncodes() {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
return ResponseHelper.buildResponse(jpInverterServiceImpl.getInverterSncodes(stationIds));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterDayReport") @GetMapping(value = "/jpInverterDayReport")
@ApiOperation(httpMethod = "GET", value = "逆变器日报表", notes = "逆变器日报表") @ApiOperation(httpMethod = "GET", value = "逆变器日报表", notes = "逆变器日报表")
public ResponseModel<Page<TdHYGFInverterDayGenerate>> jpInverterDayReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, String time, @RequestParam(required = false) List<String> snCodes) { public ResponseModel<Page<TdHYGFInverterDayGenerate>> jpInverterDayReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size,@RequestParam(required = false) String time, @RequestParam(required = false) List<String> snCodes) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(null); List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationids = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList()); List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterDayReport(current,size,time,snCodes,stationids)); if(StringUtils.isEmpty(time)){
time = DateUtil.format(new Date(),"yyyy-MM-dd");
}
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterDayReport(current,size,time,snCodes,stationIds));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpInverterDayReportExport", method = RequestMethod.GET) @RequestMapping(value = "/jpInverterDayReportExport", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "逆变器日报表导出", notes = "逆变器日报表导出") @ApiOperation(httpMethod = "GET", value = "逆变器日报表导出", notes = "逆变器日报表导出")
public void jpInverterDayReportExport( String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) { public void jpInverterDayReportExport( @RequestParam(required = false)String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(null); List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationids = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList()); List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(time,snCodes,stationids); if(StringUtils.isEmpty(time)){
time = DateUtil.format(new Date(),"yyyy-MM-dd");
}
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(time,snCodes,stationIds);
try { try {
setResponseHeadForDowload(response,"逆变器日报表.xls"); setResponseHeadForDowload(response,"逆变器日报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates); EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates);
...@@ -244,6 +267,65 @@ public class JpInverterController extends BaseController { ...@@ -244,6 +267,65 @@ public class JpInverterController extends BaseController {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterMonthReport")
@ApiOperation(httpMethod = "GET", value = "逆变器月报表", notes = "逆变器月报表")
public ResponseModel<Page<TdHYGFInverterMonthGenerate>> jpInverterMonthReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size,@RequestParam(required = false) String time, @RequestParam(required = false) List<String> snCodes) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){
time = DateUtil.format(new Date(),"yyyy-MM");
}
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterMonthReport(current,size,time,snCodes,stationIds));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpInverterMonthReportExport", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "逆变器月报表导出", notes = "逆变器月报表导出")
public void jpInverterMonthReportExport( @RequestParam(required = false)String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){
time = DateUtil.format(new Date(),"yyyy-MM");
}
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates =jpInverterServiceImpl.jpInverterMonthReportExport(time,snCodes,stationIds);
try {
setResponseHeadForDowload(response,"逆变器月报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterMonthGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器月报表").doWrite(tdHYGFInverterMonthGenerates);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterYearReport")
@ApiOperation(httpMethod = "GET", value = "逆变器年报表", notes = "逆变器年报表")
public ResponseModel<Page<TdHYGFInverterYearGenerate>> jpInverterYearReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, @RequestParam(required = false)String time, @RequestParam(required = false) List<String> snCodes) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){
time = DateUtil.format(new Date(),"yyyy");
}
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterYearReport(current,size,time,snCodes,stationIds));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpInverterYearReportExport", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "逆变器年报表导出", notes = "逆变器年报表导出")
public void jpInverterYearReportExport(@RequestParam(required = false) String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){
time = DateUtil.format(new Date(),"yyyy");
}
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates =jpInverterServiceImpl.jpInverterYearReportExport(time,snCodes,stationIds);
try {
setResponseHeadForDowload(response,"逆变器年报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterYearGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器年报表").doWrite(tdHYGFInverterYearGenerates);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/** /**
* 设置响应头 * 设置响应头
...@@ -261,6 +343,14 @@ public class JpInverterController extends BaseController { ...@@ -261,6 +343,14 @@ public class JpInverterController extends BaseController {
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/jpInverterTotal")
@ApiOperation(httpMethod = "GET", value = "逆变器详折线图上方统计", notes = "逆变器详折线图上方统计")
public ResponseModel<Map<String,Object>> jpInverterTotal( String time,String snCode,String thirdStationId,String date) {
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterTotal(snCode,thirdStationId,time,date));
}
} }
...@@ -364,11 +364,18 @@ public class JpStationController extends BaseController { ...@@ -364,11 +364,18 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司") @ApiOperation(httpMethod = "GET",value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
@GetMapping(value = "/getRegion") @GetMapping(value = "/getRegion")
@UserLimits @UserLimits
public ResponseModel< List<DropDown>> getRegion() { public ResponseModel<List<Map<String,String>>> getRegion() {
List<DropDown> list= jpStationMapper.getRegion(); List<DropDown> list= jpStationMapper.getRegion();
List<Map<String,String>> result = new ArrayList<>();
return ResponseHelper.buildResponse(list); list.forEach(dropDown -> {
Map<String,String> item = new HashMap<>();
item.put("name",dropDown.getName());
item.put("value",dropDown.getOrgCode());
result.add(item);
});
return ResponseHelper.buildResponse(result);
} }
...@@ -377,9 +384,16 @@ public class JpStationController extends BaseController { ...@@ -377,9 +384,16 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "查询当前登录人权限经销商", notes = "查询当前登录人权限经销商") @ApiOperation(httpMethod = "GET",value = "查询当前登录人权限经销商", notes = "查询当前登录人权限经销商")
@GetMapping(value = "/getDealer") @GetMapping(value = "/getDealer")
@UserLimits @UserLimits
public ResponseModel<List<DropDown>> getDealer(String regionalCompaniesCode ) { public ResponseModel<List<Map<String,String>>> getDealer(String regionalCompaniesCode ) {
List<DropDown> list= jpStationMapper.getDealer(regionalCompaniesCode); List<DropDown> list= jpStationMapper.getDealer(regionalCompaniesCode);
return ResponseHelper.buildResponse(list); List<Map<String,String>> result = new ArrayList<>();
list.forEach(dropDown -> {
Map<String,String> item = new HashMap<>();
item.put("name",dropDown.getName());
item.put("value",dropDown.getOrgCode());
result.add(item);
});
return ResponseHelper.buildResponse(result);
} }
//电站发电量统计 //电站发电量统计
......
...@@ -89,7 +89,7 @@ public class QiyuesuoController extends BaseController { ...@@ -89,7 +89,7 @@ public class QiyuesuoController extends BaseController {
private String engineering; private String engineering;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "个人token", notes = "个人token") @ApiOperation(httpMethod = "POST",value = "个人token", notes = "个人token")
@PostMapping (value = "/getUserToken") @PostMapping (value = "/getUserToken")
public ResponseModel<Object> getSdkResponse(@RequestBody UserAuthMiniappTicketRequest request) { public ResponseModel<Object> getSdkResponse(@RequestBody UserAuthMiniappTicketRequest request) {
...@@ -99,7 +99,7 @@ public class QiyuesuoController extends BaseController { ...@@ -99,7 +99,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "合同token", notes = "合同token") @ApiOperation(httpMethod = "POST",value = "合同token", notes = "合同token")
@PostMapping (value = "/getContractToken") @PostMapping (value = "/getContractToken")
public ResponseModel<Object> getContractSdkResponse(@RequestBody ContractMiniappTicketRequest request) { public ResponseModel<Object> getContractSdkResponse(@RequestBody ContractMiniappTicketRequest request) {
...@@ -108,7 +108,7 @@ public class QiyuesuoController extends BaseController { ...@@ -108,7 +108,7 @@ public class QiyuesuoController extends BaseController {
return ResponseHelper.buildResponse(result.getResult()); return ResponseHelper.buildResponse(result.getResult());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "合同token", notes = "合同token") @ApiOperation(httpMethod = "POST",value = "合同token", notes = "合同token")
@PostMapping (value = "/getContractTokengz/{sequenceNbr}") @PostMapping (value = "/getContractTokengz/{sequenceNbr}")
public ResponseModel<Object> getContractSdkResponseSequenceNbr(@RequestBody ContractMiniappTicketRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<Object> getContractSdkResponseSequenceNbr(@RequestBody ContractMiniappTicketRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
...@@ -122,7 +122,7 @@ public class QiyuesuoController extends BaseController { ...@@ -122,7 +122,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "创建合同", notes = "创建合同") @ApiOperation(httpMethod = "POST",value = "创建合同", notes = "创建合同")
@PostMapping (value = "/addContract") @PostMapping (value = "/addContract")
public ResponseModel<HouseholdContract> initiateHouseholdContract(@RequestBody HouseholdContractDto model) { public ResponseModel<HouseholdContract> initiateHouseholdContract(@RequestBody HouseholdContractDto model) {
HouseholdContract householdContract=householdContractServiceImpl.initiateHouseholdContract(model); HouseholdContract householdContract=householdContractServiceImpl.initiateHouseholdContract(model);
...@@ -132,7 +132,7 @@ public class QiyuesuoController extends BaseController { ...@@ -132,7 +132,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "契约锁回调接口", notes = "契约锁回调接口") @ApiOperation(httpMethod = "POST",value = "契约锁回调接口", notes = "契约锁回调接口")
@PostMapping (value = "/callback") @PostMapping (value = "/callback")
public String callback( String content) { public String callback( String content) {
try { try {
...@@ -231,7 +231,7 @@ public class QiyuesuoController extends BaseController { ...@@ -231,7 +231,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "获取经销商单位", notes = "liebiao ") @ApiOperation(httpMethod = "POST",value = "获取经销商单位", notes = "liebiao ")
@PostMapping (value = "/getUnit1000") @PostMapping (value = "/getUnit1000")
public ResponseModel<ContractListResult> getUnit1000(@RequestBody ContractListRequest request) { public ResponseModel<ContractListResult> getUnit1000(@RequestBody ContractListRequest request) {
...@@ -268,7 +268,7 @@ public class QiyuesuoController extends BaseController { ...@@ -268,7 +268,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "创建合同", notes = "创建合同") @ApiOperation(httpMethod = "POST",value = "创建合同", notes = "创建合同")
@PostMapping (value = "/getUnit2000") @PostMapping (value = "/getUnit2000")
public ResponseModel<SdkResponse<Object>> getUnit2000(@RequestBody Map<String,String> map) { public ResponseModel<SdkResponse<Object>> getUnit2000(@RequestBody Map<String,String> map) {
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import java.util.Collections; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.List; import java.util.*;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits; import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterYearGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterTotalGenerate;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterDayGenerateMapper; import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterDayGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterMonthGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterYearGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterMonthGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterYearGenerateMapper;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
...@@ -36,7 +47,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -36,7 +47,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
implements IJpInverterService { implements IJpInverterService {
@Autowired @Autowired
TdHYGFInverterDayGenerateMapper tdHYGFInverterDayGenerateMapper; TdHYGFInverterDayGenerateMapper tdHYGFInverterDayGenerateMapper;
@Autowired
TdHYGFInverterMonthGenerateMapper tdHYGFInverterMonthGenerateMapper;
@Autowired
TdHYGFInverterYearGenerateMapper tdHYGFInverterYearGenerateMapper;
@Autowired
JpInverterMapper jpInverterMapper;
/** /**
* 分页查询 * 分页查询
...@@ -84,12 +101,29 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -84,12 +101,29 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
return this.getBaseMapper().selectPageDataTotal(jpInverterDto); return this.getBaseMapper().selectPageDataTotal(jpInverterDto);
} }
public void selectDayTrend(List<String> treeParams, String time, String snCode, String thirdStationId) { public Map<String,Object> selectDayTrend(List<JSONObject>treeParams, String time, String snCode, String thirdStationId) {
List<String> key = treeParams.stream().map(e -> e.get("key").toString().replace("_","")).collect(Collectors.toList());
List<Map<String,Object>> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectDayTrend(key, time, snCode, thirdStationId);
} List<String> zData = new ArrayList<>();
tdHYGFInverterDayGenerates.forEach(e->zData.add(e.get("workstatus").toString()) );
Set<String> xData = new TreeSet<>();
for (JSONObject treeParam : treeParams) {
List<String> value = new ArrayList<>();
for (Map<String, Object> obj : tdHYGFInverterDayGenerates) {
xData.add(obj.get("time").toString().substring(0,obj.get("time").toString().length()-4));
String key1 = treeParam.get("key").toString().replace("_","");
value.add(obj.get(key1).toString());
}
treeParam.put("data",value);
}
Map<String,Object> map = new HashMap<>();
map.put("xData",xData);
map.put("yData",treeParams);
map.put("zData",zData);
return map;
}
public Page<TdHYGFInverterDayGenerate> jpInverterDayReport(int current, int size, String time, List<String> sncodes,List<String> stationIds) { public Page<TdHYGFInverterDayGenerate> jpInverterDayReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterDayGenerate> tdHYGFInverterDayGeneratePage = new Page<>(); Page<TdHYGFInverterDayGenerate> tdHYGFInverterDayGeneratePage = new Page<>();
Date date = DateUtil.parse(time, "yyyy-MM-dd"); Date date = DateUtil.parse(time, "yyyy-MM-dd");
String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00"; String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00";
...@@ -97,41 +131,224 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -97,41 +131,224 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>() QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
.ge("created_time", startTime) .ge("created_time", startTime)
.le("created_time", endTime) .le("created_time", endTime)
.in("third_station_id",stationIds);; .in("third_station_id", stationIds);
;
if (CollectionUtil.isNotEmpty(sncodes)) { if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes); queryWrapper.in("sn_code", sncodes);
} }
queryWrapper.orderByDesc("created_time"); queryWrapper.orderByDesc("created_time");
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper); List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper);
tdHYGFInverterDayGeneratePage.setTotal(tdHYGFInverterDayGenerates.size()); tdHYGFInverterDayGeneratePage.setTotal(tdHYGFInverterDayGenerates.size());
tdHYGFInverterDayGeneratePage.setSize(size); tdHYGFInverterDayGeneratePage.setSize(size);
tdHYGFInverterDayGeneratePage.setCurrent(current); tdHYGFInverterDayGeneratePage.setCurrent(current);
tdHYGFInverterDayGenerates=tdHYGFInverterDayGenerates.subList((current-1)*size,current*size>tdHYGFInverterDayGenerates.size()?tdHYGFInverterDayGenerates.size():current*size); tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerates.subList((current - 1) * size, current * size > tdHYGFInverterDayGenerates.size() ? tdHYGFInverterDayGenerates.size() : current * size);
tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> { tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> {
Date date1=new Date(tdHYGFInverterDayGenerate.getCreatedTime()); Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN)); tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
}); });
tdHYGFInverterDayGeneratePage.setRecords(tdHYGFInverterDayGenerates); tdHYGFInverterDayGeneratePage.setRecords(tdHYGFInverterDayGenerates);
return tdHYGFInverterDayGeneratePage; return tdHYGFInverterDayGeneratePage;
} }
public List<TdHYGFInverterDayGenerate> jpInverterDayReportExport(String time, List<String> sncodes,List<String> stationIds) { public List<TdHYGFInverterDayGenerate> jpInverterDayReportExport(String time, List<String> sncodes, List<String> stationIds) {
Date date = DateUtil.parse(time, "yyyy-MM-dd"); Date date = DateUtil.parse(time, "yyyy-MM-dd");
String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00"; String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00";
String endTime = DateUtil.format(date, "yyyy-MM-dd") + "23:59:59"; String endTime = DateUtil.format(date, "yyyy-MM-dd") + "23:59:59";
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>() QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
.ge("created_time", startTime) .ge("created_time", startTime)
.le("created_time", endTime) .le("created_time", endTime)
.in("third_station_id",stationIds); .in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) { if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes); queryWrapper.in("sn_code", sncodes);
} }
queryWrapper.orderByDesc("created_time"); queryWrapper.orderByDesc("created_time");
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper); List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper);
tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> { tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> {
Date date1=new Date(tdHYGFInverterDayGenerate.getCreatedTime()); Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN)); tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
}); });
return tdHYGFInverterDayGenerates; return tdHYGFInverterDayGenerates;
} }
public Page<TdHYGFInverterMonthGenerate> jpInverterMonthReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGeneratePage = new Page<>();
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterMonthGenerate>()
.eq("year_month", time)
.in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
queryWrapper.orderByDesc("day_time");
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates = tdHYGFInverterMonthGenerateMapper.selectList(queryWrapper);
tdHYGFInverterMonthGeneratePage.setTotal(tdHYGFInverterMonthGenerates.size());
tdHYGFInverterMonthGeneratePage.setSize(size);
tdHYGFInverterMonthGeneratePage.setCurrent(current);
tdHYGFInverterMonthGenerates = tdHYGFInverterMonthGenerates.subList((current - 1) * size, current * size > tdHYGFInverterMonthGenerates.size() ? tdHYGFInverterMonthGenerates.size() : current * size);
tdHYGFInverterMonthGeneratePage.setRecords(tdHYGFInverterMonthGenerates);
return tdHYGFInverterMonthGeneratePage;
}
public List<TdHYGFInverterMonthGenerate> jpInverterMonthReportExport( String time, List<String> sncodes, List<String> stationIds) {
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterMonthGenerate>()
.eq("year_month", time)
.in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
queryWrapper.orderByDesc("day_time");
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates = tdHYGFInverterMonthGenerateMapper.selectList(queryWrapper);
return tdHYGFInverterMonthGenerates;
}
public Page<TdHYGFInverterYearGenerate> jpInverterYearReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterYearGenerate> tdHYGFInverterYearGeneratePage = new Page<>();
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterYearGenerate>()
.eq("year", time)
.in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
queryWrapper.orderByDesc("month_time");
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates = tdHYGFInverterYearGenerateMapper.selectList(queryWrapper);
tdHYGFInverterYearGeneratePage.setTotal(tdHYGFInverterYearGenerates.size());
tdHYGFInverterYearGeneratePage.setSize(size);
tdHYGFInverterYearGeneratePage.setCurrent(current);
tdHYGFInverterYearGenerates = tdHYGFInverterYearGenerates.subList((current - 1) * size, current * size > tdHYGFInverterYearGenerates.size() ? tdHYGFInverterYearGenerates.size() : current * size);
tdHYGFInverterYearGeneratePage.setRecords(tdHYGFInverterYearGenerates);
return tdHYGFInverterYearGeneratePage;
}
public List<TdHYGFInverterYearGenerate> jpInverterYearReportExport(String time, List<String> sncodes, List<String> stationIds) {
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterYearGenerate>()
.eq("year", time)
.in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
queryWrapper.orderByDesc("month_time");
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates = tdHYGFInverterYearGenerateMapper.selectList(queryWrapper);
return tdHYGFInverterYearGenerates;
}
public List<Map<String, String>> getInverterSncodes(List<String> stationIds) {
List<Map<String, String>> result = new ArrayList<>();
QueryWrapper queryWrapper = new QueryWrapper<JpInverter>()
.in("third_station_id", stationIds);
queryWrapper.orderByAsc("third_station_id");
List<JpInverter> jpInverterList = jpInverterMapper.selectList(queryWrapper);
for (int i = 0; i < jpInverterList.size(); i++) {
JpInverter jpInverter = jpInverterList.get(i);
Map<String, String> item = new HashMap<>();
if (StringUtils.isNotBlank(jpInverter.getSnCode().trim())) {
item.put("name", jpInverter.getSnCode().trim());
item.put("value", jpInverter.getSnCode().trim());
}
result.add(item);
}
return result;
}
public Map<String,Object> selectMonthTrend(String time, String snCode, String thirdStationId) {
Set<String> xData = new TreeSet<>();
List<String> value1 = new ArrayList<>();
List<String> value2 = new ArrayList<>();
List<Map<String, Object>> maps = tdHYGFInverterMonthGenerateMapper.selectMonthTrend(time, snCode, thirdStationId);
for (Map<String, Object> map : maps) {
xData.add(map.get("daytime").toString());
value1.add(map.get("generate").toString());
value2.add(map.get("fullhour").toString());
}
List<Map<String, Object>> yData = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
Map<String,Object> map1 = new HashMap<>();
map1.put("name","发电量");
map1.put("unit","kw");
map1.put("data",value1);
yData.add(map1);
Map<String,Object> map2 = new HashMap<>();
map2.put("name","满发小时数");
map2.put("unit","h");
map2.put("data",value2);
yData.add(map2);
map.put("xData",xData);
map.put("yData",yData);
return map;
}
public Map<String,Object> selectYearTrend(String time, String snCode, String thirdStationId) {
Set<String> xData = new TreeSet<>();
List<String> value1 = new ArrayList<>();
List<String> value2 = new ArrayList<>();
List<Map<String, Object>> maps = tdHYGFInverterYearGenerateMapper.selectYearTrend(time, snCode, thirdStationId);
for (Map<String, Object> map : maps) {
xData.add(map.get("daytime").toString());
value1.add(map.get("generate").toString());
value2.add(map.get("fullhour").toString());
}
List<Map<String, Object>> yData = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
Map<String,Object> map1 = new HashMap<>();
map1.put("name","发电量");
map1.put("unit","kw");
map1.put("data",value1);
yData.add(map1);
Map<String,Object> map2 = new HashMap<>();
map2.put("name","满发小时数");
map2.put("unit","h");
map2.put("data",value2);
yData.add(map2);
map.put("xData",xData);
map.put("yData",yData);
return map;
}
public Map<String,Object> selectTotalTrend(String time, String snCode, String thirdStationId) {
Set<String> xData = new TreeSet<>();
List<String> value1 = new ArrayList<>();
List<String> value2 = new ArrayList<>();
List<Map<String, Object>> maps = tdHYGFInverterYearGenerateMapper.selectTotalTrend(time, snCode, thirdStationId);
for (Map<String, Object> map : maps) {
xData.add(map.get("daytime").toString());
value1.add(map.get("generate").toString());
value2.add(map.get("fullhour").toString());
}
List<Map<String, Object>> yData = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
Map<String,Object> map1 = new HashMap<>();
map1.put("name","发电量");
map1.put("unit","kw");
map1.put("data",value1);
yData.add(map1);
Map<String,Object> map2 = new HashMap<>();
map2.put("name","满发小时数");
map2.put("unit","h");
map2.put("data",value2);
yData.add(map2);
map.put("xData",xData);
map.put("yData",yData);
return map;
}
public Map<String,Object> jpInverterTotal(String snCode, String thirdStationId, String time, String date) {
if (date.equals("day")){
return tdHYGFInverterMonthGenerateMapper.selectMonthTotal(time, snCode, thirdStationId);
}else if (date.equals("month")){
return tdHYGFInverterYearGenerateMapper.selectYearTotal(time, snCode, thirdStationId);
}else if (date.equals("year")){
TdHYGFInverterTotalGenerate tdHYGFInverterTotalGenerate = tdHYGFInverterYearGenerateMapper.selectTotalSum(time, snCode, thirdStationId).get(0);
return Bean.BeantoMap(tdHYGFInverterTotalGenerate) ;
}else {
List<TdHYGFInverterTotalGenerate> maps = tdHYGFInverterYearGenerateMapper.selectTotalSum(null, snCode, thirdStationId);
double fullhour = maps.stream().mapToDouble(TdHYGFInverterTotalGenerate::getFullhour).sum();
double income = maps.stream().filter(e->null != e.getIncome() ).mapToDouble(TdHYGFInverterTotalGenerate::getIncome).sum();
double generate = maps.stream().mapToDouble(TdHYGFInverterTotalGenerate::getGenerate).sum();
Map<String,Object> map = new HashMap<>();
map.put("fullhour",fullhour);
map.put("income",income);
map.put("generate",generate);
return map;
}
}
} }
\ No newline at end of file
## DB properties: ## DB properties:
spring.datasource.dynamic.primary= mysql-service spring.datasource.dynamic.primary= mysql-service
spring.datasource.mysql-service.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.mysql-service.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.mysql-service.jdbc-url=jdbc:mysql://172.16.10.220:3306/amos_project?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.mysql-service.jdbc-url=jdbc:mysql://172.16.10.220:3306/amos_project_2023?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.mysql-service.username=root spring.datasource.mysql-service.username=root
spring.datasource.mysql-service.password=Yeejoin@2020 spring.datasource.mysql-service.password=Yeejoin@2020
spring.datasource.mysql-service.type=com.zaxxer.hikari.HikariDataSource spring.datasource.mysql-service.type=com.zaxxer.hikari.HikariDataSource
......
[ [
{ {
"name": "直流电压", "name": "直流电压",
"key": "voltage", "key": "acv",
"children": [ "children": [
{"name":"直流电压PV1", {"name":"直流电压PV1",
"key": "acv1" "key": "acv_1",
"unit": "V"
}, },
{"name":"直流电压PV2", {"name":"直流电压PV2",
"key": "acv2" "key": "acv_2",
"unit": "V"
}, },
{"name":"直流电压PV3", {"name":"直流电压PV3",
"key": "acv3" "key": "acv_3",
"unit": "V"
}, },
{"name":"直流电压PV4", {"name":"直流电压PV4",
"key": "acv4" "key": "acv_4",
"unit": "V"
} }
] ]
}, },
{ {
"name": "直流电流", "name": "直流电流",
"key": "current", "key": "acc",
"children": [ "children": [
{"name":"直流电流PV1", {"name":"直流电流PV1",
"key": "acc1" "key": "acc_1",
"unit": "A"
}, },
{"name":"直流电流PV2", {"name":"直流电流PV2",
"key": "acc2" "key": "acc_2",
"unit": "A"
}, },
{"name":"直流电流PV3", {"name":"直流电流PV3",
"key": "acc3" "key": "acc_3",
"unit": "A"
}, },
{"name":"直流电流PV4", {"name":"直流电流PV4",
"key": "acc4" "key": "acc_4",
"unit": "A"
} }
] ]
}, },
...@@ -54,66 +62,73 @@ ...@@ -54,66 +62,73 @@
]}, ]},
{ {
"name": "U_交流电压", "name": "U_交流电压",
"key": "1", "key": "acv1",
"unit": "V",
"children": [ "children": [
] ]
}, },
{ {
"name": "V_交流电压", "name": "V_交流电压",
"key": "2", "key": "acv2",
"unit": "V",
"children": [ "children": [
] ]
}, { }, {
"name": "W_交流电压", "name": "W_交流电压",
"key": "3", "key": "acv3",
"unit": "V",
"children": [ "children": [
] ]
}, },
{ {
"name": "U_交流电流", "name": "U_交流电流",
"key": "4", "key": "acc1",
"unit": "A",
"children": [ "children": [
] ]
}, },
{ {
"name": "W_交流电流", "name": "W_交流电流",
"key": "5", "key": "acc3",
"unit": "A",
"children": [ "children": [
] ]
}, },
{ {
"name": "V_交流电流", "name": "V_交流电流",
"key": "6", "key": "acc2",
"unit": "A",
"children": [ "children": [
] ]
}, },
{ {
"name": "交流输出频率", "name": "交流输出频率",
"key": "7", "key": "frequency",
"unit": "Hz",
"children": [ "children": [
] ]
}, },
{ {
"name": "总功率", "name": "总功率",
"key": "totalPower", "key": "total_power",
"children": [ "children": [
] ]
}, },
{ {
"name": "当日电量", "name": "当日电量",
"key": "dayGen", "key": "day_gen",
"children": [ "children": [
] ]
}, },
{ {
"name": "累计电量", "name": "累计电量",
"key": "totalGen", "key": "total_gen",
"children": [ "children": [
] ]
}, },
{ {
"name": "IGBT温度", "name": "IGBT温度",
"key": "igbtTmep", "key": "igbt_temp",
"children": [ "children": [
] ]
} }
......
...@@ -129,4 +129,10 @@ public class CommonConstans { ...@@ -129,4 +129,10 @@ public class CommonConstans {
put("按天", DatePattern.NORM_DATE_PATTERN); put("按天", DatePattern.NORM_DATE_PATTERN);
} }
}; };
public static final String ANALYSE_TYPE_MOMENT = "按时刻";
public static final String ANALYSE_TYPE_HOUR = "按小时";
public static final String ANALYSE_TYPE_DAY = "按天";
} }
...@@ -202,7 +202,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -202,7 +202,7 @@ public class BigScreenAnalyseController extends BaseController {
public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception { public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByArea(); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByArea();
Map<String, Integer> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", "")))); Map<String, Object> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> t.get("healthIndex")));
// List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区"); // List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区");
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
...@@ -220,7 +220,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -220,7 +220,7 @@ public class BigScreenAnalyseController extends BaseController {
} }
list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList()); list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList());
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
list.forEach(item -> seriesData.add(collect.getOrDefault(item, 100))); list.forEach(item -> seriesData.add(collect.getOrDefault(item, 100.0)));
resultMap.put("axisData", list); resultMap.put("axisData", list);
resultMap.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
......
...@@ -392,7 +392,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -392,7 +392,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop); int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
page.setRecords(fanHealthIndexDays); page.setRecords(fanHealthIndexDays);
page.setTotal(total); page.setTotal(total);
page.setTotal(Long.valueOf(fanHealthIndexDays.size())); // page.setTotal(Long.valueOf(fanHealthIndexDays.size()));
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
...@@ -549,6 +549,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -549,6 +549,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
Page page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
page.setTotal(total);
page.setRecords(fanHealthIndexDays); page.setRecords(fanHealthIndexDays);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
}else if (requiredType.equals("按小时")){ }else if (requiredType.equals("按小时")){
...@@ -578,6 +580,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -578,6 +580,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
Page page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
page.setTotal(total);
page.setRecords(fanHealthIndexHours); page.setRecords(fanHealthIndexHours);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
}else { }else {
...@@ -600,6 +604,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -600,6 +604,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
Page page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
page.setTotal(total);
page.setRecords(fanHealthIndexMoments); page.setRecords(fanHealthIndexMoments);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
......
package com.yeejoin.amos.boot.module.jxiop.biz.mapper2; package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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.IdxBizFanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/** /**
* Mapper 接口 * Mapper 接口
* *
* @author system_generator * @author system_generator
* @date 2023-08-15 * @date 2023-08-15
*/ */
public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIndex> { public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIndex> {
BigDecimal getHealthScoreInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode); BigDecimal getHealthScoreInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
BigDecimal getHealthScoreInfoByLatest(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
BigDecimal getHealthScoreInfoByStation(@Param("stationCode") String stationCode, @Param("tableName") String tableName);
BigDecimal getHealthScoreInfoByParam(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("analysisType") String analysisType);
List<Map<String, String>> getDateInfoBy15();
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
List<Map<String, Object>> getAllEquipAlarmInfo(@Param("tableName") String tableName);
List<Map<String, Object>> getHealthInfoByArea();
List<Map<String, Object>> getAllEquipAlarmInfoByStation();
List<Map<String, Object>> getHealthInfoByStation(@Param("areaCode") String areaCode);
List<Map<String, Object>> equipWarningRadarMap(@Param("stationCode") String stationCode);
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByStationType(@Param("tableName") String tableName,
@Param("areaCode") String areaCode,
@Param("stationType") String stationType);
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByArea(@Param("areaCode") String areaCode);
List<Map<String, Object>> getSubSystemInfo(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getFanInfoByPage(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getFanHealthInfoList(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getSumSystemListByEquipment(@Param("gatewayId") String gatewayId, @Param("equipmentName") String equipmentName);
List<Map<String, Object>> getPointNameListBySumSystem(@Param("gatewayId") String gatewayId, @Param("subSystem") String subSystem); BigDecimal getHealthScoreInfoByLatest(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
BigDecimal getHealthScoreInfoByStation(@Param("stationCode") String stationCode,
@Param("tableName") String tableName);
List<Map<String, Object>> getHealthInfoBySubSystem(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId); BigDecimal getHealthScoreInfoByParam(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode,
@Param("analysisType") String analysisType);
List<Map<String, Object>> getWarningInfoBySubSystem(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId); List<Map<String, String>> getDateInfoBy15();
List<Map<String, String>> getDateInfo(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, Object>> getHealthListInfo(@Param("areaCode") String areaCode,
@Param("stationCode") String stationCode);
List<Map<String, Object>> getAllEquipAlarmInfo(@Param("tableName") String tableName);
List<Map<String, Object>> getPvInfoByPage(@Param("gatewayId") String gatewayId); List<Map<String, Object>> getHealthInfoByArea();
List<Map<String, Object>> getPvHealthInfoList(@Param("gatewayId") String gatewayId); List<Map<String, Object>> getAllEquipAlarmInfoByStation();
List<Map<String, Object>> getHealthInfoByStation(@Param("areaCode") String areaCode);
List<Map<String, Object>> equipWarningRadarMap(@Param("stationCode") String stationCode);
List<Map<String, Object>> getPvSubSystemInfo(@Param("subarray") String subarray, @Param("gatewayId") String gatewayId); List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByStationType(@Param("tableName") String tableName,
@Param("areaCode") String areaCode, @Param("stationType") String stationType);
List<Map<String, Object>> getPvSumSystemListByEquipment(@Param("gatewayId") String gatewayId, @Param("subarray") String subarray); List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByArea(@Param("areaCode") String areaCode);
List<Map<String, Object>> getSubSystemInfo(@Param("equipmentName") String equipmentName,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getFanInfoByPage(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getFanHealthInfoList(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getSumSystemListByEquipment(@Param("gatewayId") String gatewayId,
@Param("equipmentName") String equipmentName);
List<Map<String, Object>> getPvHealthInfoBySubSystem(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId); List<Map<String, Object>> getPointNameListBySumSystem(@Param("gatewayId") String gatewayId,
List<Map<String, Object>> getPvWarningInfoBySubSystem(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId); @Param("subSystem") String subSystem);
List<Map<String, Object>> getHealthInfoBySubSystem(@Param("subSystem") String subSystem,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvPointNameListBySumSystem(@Param("gatewayId") String gatewayId, @Param("equipmentName") String equipmentName); List<Map<String, Object>> getWarningInfoBySubSystem(@Param("subSystem") String subSystem,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvInfoByPage(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvHealthInfoList(@Param("gatewayId") String gatewayId);
String getPointNameByIndexAddress(@Param("varDesc") String varDesc, List<Map<String, Object>> getPvSubSystemInfo(@Param("subarray") String subarray,
@Param("tableName") String tableName, @Param("gatewayId") String gatewayId);
@Param("gatewayId") String gatewayId);
List<FullViewRecallDataDTO> getFullViewRecall(); List<Map<String, Object>> getPvSumSystemListByEquipment(@Param("gatewayId") String gatewayId,
@Param("subarray") String subarray);
List<Map<String, Object>> getStationIndexInfo(); List<Map<String, Object>> getPvHealthInfoBySubSystem(@Param("equipmentName") String equipmentName,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getEquipmentIndexInfo(); List<Map<String, Object>> getPvWarningInfoBySubSystem(@Param("equipmentName") String equipmentName,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getSubSystemIndexInfo(); List<Map<String, Object>> getPvPointNameListBySumSystem(@Param("gatewayId") String gatewayId,
@Param("equipmentName") String equipmentName);
List<Map<String, Object>> getPointNameIndexInfo(); String getPointNameByIndexAddress(@Param("varDesc") String varDesc, @Param("tableName") String tableName,
@Param("gatewayId") String gatewayId);
List<FullViewRecallDataDTO> getFullViewRecall();
List<Map<String, Object>> getStationIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getStationIndexInfo();
List<Map<String, Object>> getEquipmentIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getEquipmentIndexInfo();
List<Map<String, Object>> getSubSystemIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getSubSystemIndexInfo();
List<Map<String, Object>> getPointNameIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getPointNameIndexInfo();
List<Map<String, Object>> getStationIndexInfoByParam(@Param("analysisType") String analysisType);
List<IdxBizFanHealthLevel> getHealthLevelInfoList(); List<Map<String, Object>> getEquipmentIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String, Object>> getSubSystemIndexInfoByParam(@Param("analysisType") String analysisType);
List<String> getAddressInfo(); List<Map<String, Object>> getPointNameIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String,Object>> queryForLeftTableList(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,Integer current,Integer size); List<IdxBizFanHealthLevel> getHealthLevelInfoList();
int queryForLeftTableListCount(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME); List<String> getAddressInfo();
Map<String,Object> queryForLeftTableListNum(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME); List<Map<String, Object>> queryForLeftTableList(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME,
Integer current, Integer size);
List<Map<String,Object>> queryForLeftTableListByPoint(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME,Integer current,Integer size); int queryForLeftTableListCount(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME);
List<Map<String,Object>> selectPointByANALYSISTYPE(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME,String startTime,String endTime); Map<String, Object> queryForLeftTableListNum(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME);
Map<String,Object> getFanEquipStatusByStation(String STATION);
int queryForLeftTableListByPointCount(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME); List<Map<String, Object>> queryForLeftTableListByPoint(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME,
String POINTNAME, Integer current, Integer size);
Map<String,Object> queryForLeftTableListByPointNum(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME); List<Map<String, Object>> selectPointByANALYSISTYPE(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME,
String POINTNAME, String startTime, String endTime);
List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY, String EQUIPMENTNAME); Map<String, Object> getFanEquipStatusByStation(String STATION);
Integer pointNum(String STATION, String SUBSYSTEM, String EQUIPMENTNAME);
Map<String, Object> getPvEquipStatusByStation(String station); int queryForLeftTableListByPointCount(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME, String POINTNAME);
String getRecDateByIndexAddress(@Param("fanGatewayId") String fanGatewayId, @Param("indexAddress") String indexAddress, @Param("tableName") String tableName); Map<String, Object> queryForLeftTableListByPointNum(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME,
String POINTNAME);
List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY, String EQUIPMENTNAME);
Integer pointNum(String STATION, String SUBSYSTEM, String EQUIPMENTNAME);
List<Map<String, Object>> getInfoListByTableName(@Param("fanGatewayId") String fanGatewayId, Map<String, Object> getPvEquipStatusByStation(String station);
@Param("indexAddress") String indexAddress,
@Param("tableName") String tableName,
@Param("recDate") String recDate);
String getRecDateByIndexAddress(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress, @Param("tableName") String tableName);
List<Map<String, Object>> getInfoListByTableName(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress, @Param("tableName") String tableName,
@Param("recDate") String recDate);
int getIsWarningByPointId(@Param("indexAddress") String indexAddress, @Param("fanGatewayId") String fanGatewayId, @Param("tableName") String tableName); int getIsWarningByPointId(@Param("indexAddress") String indexAddress, @Param("fanGatewayId") String fanGatewayId,
@Param("tableName") String tableName);
List<Map<String,Object>> queryIndexByArae(String ARAE, String ANALYSISTYPE,String startTimeTop,String endTimeTop); List<Map<String, Object>> queryIndexByArae(String ARAE, String ANALYSISTYPE, String startTimeTop,
String endTimeTop);
} }
...@@ -95,5 +95,9 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> { ...@@ -95,5 +95,9 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
List<Map<String, Object>> getWarningInfoBySubSystemTd(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId); List<Map<String, Object>> getWarningInfoBySubSystemTd(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId);
String getInfoByDate(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("date") String date); List<Map<String,Object>> getInfoByDate(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("list") List<String> list);
List<Map<String,Object>> getInfoByHour(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("list") List<String> list);
List<Map<String,Object>> getInfoByMoment(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("list") List<String> list);
} }
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.IdxBizFanHealthIndexMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper">
<select id="getHealthScoreInfo" resultType="java.math.BigDecimal">
<select id="getHealthScoreInfo" resultType="java.math.BigDecimal"> SELECT
SELECT
CEILING(avg( a.avgHealthIndex )) AS healthIndex CEILING(avg( a.avgHealthIndex )) AS healthIndex
FROM FROM
( (
...@@ -11,50 +10,47 @@ ...@@ -11,50 +10,47 @@
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<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>
</where>
</where> UNION ALL
UNION ALL
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<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>
</where> </where>
) )
) a ) a
</select> </select>
<select id="getHealthScoreInfoByParam" resultType="java.math.BigDecimal">
<select id="getHealthScoreInfoByParam" resultType="java.math.BigDecimal"> SELECT
SELECT
CEILING(avg( a.avgHealthIndex )) AS healthIndex CEILING(avg( a.avgHealthIndex )) AS healthIndex
FROM FROM
( (
...@@ -62,89 +58,82 @@ ...@@ -62,89 +58,82 @@
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM FROM
fan_health_index_latest_data fan_health_index_latest_data
<where> <where>
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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="areaCode != null and areaCode != ''">
<if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<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>
</where>
</where> UNION ALL
UNION ALL
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM FROM
pv_health_index_latest_data pv_health_index_latest_data
<where> <where>
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<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>
</where> </where>
) )
) a ) a
</select> </select>
<select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal">
<select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal"> SELECT
SELECT round(IFNULL( HEALTH_INDEX , 100 ), 1) AS healthIndex
CEILING(IFNULL( HEALTH_INDEX , 100 )) AS healthIndex
FROM FROM
${tableName} ${tableName}
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
</where> </where>
limit 1 limit 1
</select> </select>
<select id="getHealthListInfo" resultType="java.util.Map">
SELECT
<select id="getHealthListInfo" resultType="java.util.Map">
SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex, CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
DATE_ADD( a.date, INTERVAL - 1 DAY ) as date DATE_ADD( a.date, INTERVAL - 1 DAY ) as date
FROM FROM
...@@ -164,48 +153,47 @@ ...@@ -164,48 +153,47 @@
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) AS recDate DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) AS recDate
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<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>
</where> </where>
UNION ALL UNION ALL
( (
SELECT SELECT
HEALTH_INDEX, HEALTH_INDEX,
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) AS recDate DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) AS recDate
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<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>
</where> </where>
) )
) b ON DATE_FORMAT( b.recDate, "%Y-%m-%d" ) = a.date ) b ON DATE_FORMAT( b.recDate, "%Y-%m-%d" ) = a.date
GROUP BY GROUP BY
a.date a.date
</select> </select>
<select id="getAllEquipAlarmInfo" resultType="java.util.Map">
<select id="getAllEquipAlarmInfo" resultType="java.util.Map">
SELECT ARAE as area, SELECT ARAE as area,
WARNING_NAME as warningName, WARNING_NAME as warningName,
count(1) as num count(1) as num
...@@ -215,14 +203,13 @@ ...@@ -215,14 +203,13 @@
group by ARAE, group by ARAE,
WARNING_NAME WARNING_NAME
</select> </select>
<select id="getHealthInfoByArea" resultType="java.util.Map">
<select id="getHealthInfoByArea" resultType="java.util.Map">
SELECT ARAE as area, SELECT ARAE as area,
CEILING(avg(a.avgHealthIndex)) AS healthIndex round(avg(a.avgHealthIndex), 1) AS healthIndex
FROM ( FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
ARAE ARAE
FROM idx_biz_fan_health_index FROM fan_health_index_latest_data
WHERE ANALYSIS_OBJ_TYPE = '片区' WHERE ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
...@@ -231,7 +218,7 @@ ...@@ -231,7 +218,7 @@
( (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
ARAE ARAE
FROM idx_biz_pv_health_index FROM pv_health_index_latest_data
WHERE ANALYSIS_OBJ_TYPE = '片区' WHERE ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
...@@ -240,8 +227,7 @@ ...@@ -240,8 +227,7 @@
) a ) a
GROUP BY a.ARAE GROUP BY a.ARAE
</select> </select>
<select id="getAllEquipAlarmInfoByStation" resultType="java.util.Map">
<select id="getAllEquipAlarmInfoByStation" resultType="java.util.Map">
SELECT a.* SELECT a.*
FROM ( FROM (
SELECT STATION AS station, SELECT STATION AS station,
...@@ -278,53 +264,50 @@ ...@@ -278,53 +264,50 @@
) a ) a
ORDER BY a.allNum ASC ORDER BY a.allNum ASC
</select> </select>
<select id="getHealthInfoByStation" resultType="java.util.Map">
SELECT
<select id="getHealthInfoByStation" resultType="java.util.Map">
SELECT
a.STATION as station, a.STATION as station,
CEILING(avg( a.avgHealthIndex )) AS healthIndex round(avg( a.avgHealthIndex ), 1) AS healthIndex
FROM FROM
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
STATION STATION
FROM FROM
idx_biz_fan_health_index fan_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '场站' ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
STATION UNION ALL STATION UNION ALL
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
STATION STATION
FROM FROM
idx_biz_pv_health_index pv_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '场站' ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
STATION STATION
) )
) a ) a
GROUP BY GROUP BY
a.STATION a.STATION
</select> </select>
<select id="equipWarningRadarMap" resultType="java.util.Map">
<select id="equipWarningRadarMap" resultType="java.util.Map"> SELECT
SELECT
a.warningName, a.warningName,
count( 1 ) AS num count( 1 ) AS num
FROM FROM
...@@ -333,63 +316,61 @@ ...@@ -333,63 +316,61 @@
WARNING_NAME AS warningName WARNING_NAME AS warningName
FROM FROM
idx_biz_fan_warning_record idx_biz_fan_warning_record
<where> <where>
((DISPOSOTION_STATE = '未处置') ((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) )) or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
and GATEWAY_ID = #{stationCode} and GATEWAY_ID = #{stationCode}
</if> </if>
</where> </where>
UNION ALL UNION ALL
SELECT SELECT
WARNING_NAME AS warningName WARNING_NAME AS warningName
FROM FROM
idx_biz_pv_warning_record idx_biz_pv_warning_record
<where> <where>
((DISPOSOTION_STATE = '未处置') ((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) )) or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
and GATEWAY_ID = #{stationCode} and GATEWAY_ID = #{stationCode}
</if> </if>
</where> </where>
) a ) a
GROUP BY GROUP BY
a.warningName a.warningName
</select> </select>
<select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map">
<select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map"> SELECT
SELECT
concat(#{stationType}, '-', a.POINT_NAME) as pointName, concat(#{stationType}, '-', a.POINT_NAME) as pointName,
a.WARNING_NAME as warningName, a.WARNING_NAME as warningName,
count(1) as num, count(1) as num,
(select count(1) from ${tableName} as tb (select count(1) from ${tableName} as tb
<where> <where>
((tb.DISPOSOTION_STATE = '未处置') ((tb.DISPOSOTION_STATE = '未处置')
or (tb.DISPOSOTION_STATE = '已处置' and tb.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) )) or (tb.DISPOSOTION_STATE = '已处置' and tb.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
and tb.POINT_NAME = a.POINT_NAME and tb.POINT_NAME = a.POINT_NAME
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and tb.ARAE like concat('%', #{areaCode}, '%') and tb.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
) AS totalNum ) AS totalNum
FROM FROM
${tableName} a ${tableName} a
<where> <where>
((a.DISPOSOTION_STATE = '未处置') ((a.DISPOSOTION_STATE = '未处置')
or (a.DISPOSOTION_STATE = '已处置' and a.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) )) or (a.DISPOSOTION_STATE = '已处置' and a.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and a.ARAE like concat('%', #{areaCode}, '%') and a.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
group by pointName, group by pointName,
warningName warningName
having pointName IS NOT NULL having pointName IS NOT NULL
AND pointName != '' AND pointName != ''
order by totalNum asc order by totalNum asc
</select> </select>
<select id="getAllEquipAlarmInfoAnalysisByArea" resultType="java.util.Map">
<select id="getAllEquipAlarmInfoAnalysisByArea" resultType="java.util.Map"> SELECT
SELECT
a.* a.*
FROM FROM
( (
...@@ -398,26 +379,25 @@ ...@@ -398,26 +379,25 @@
concat('光伏-', wr.POINT_NAME) AS pointName, concat('光伏-', wr.POINT_NAME) AS pointName,
count( 1 ) AS num, count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_pv_warning_record ( SELECT count( 1 ) FROM idx_biz_pv_warning_record
<where> <where>
((DISPOSOTION_STATE = '未处置') ((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) )) or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
AND wr.POINT_NAME = POINT_NAME AND wr.POINT_NAME = POINT_NAME
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and ARAE like concat('%', #{areaCode}, '%') and ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
) AS allNum
) AS allNum
FROM FROM
idx_biz_pv_warning_record wr idx_biz_pv_warning_record wr
<where> <where>
((wr.DISPOSOTION_STATE = '未处置') ((wr.DISPOSOTION_STATE = '未处置')
or (wr.DISPOSOTION_STATE = '已处置' and wr.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) )) or (wr.DISPOSOTION_STATE = '已处置' and wr.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and wr.ARAE like concat('%', #{areaCode}, '%') and wr.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
pointName, pointName,
warningName UNION ALL warningName UNION ALL
SELECT SELECT
...@@ -425,26 +405,25 @@ ...@@ -425,26 +405,25 @@
concat('风电-', wr.POINT_NAME) AS pointName, concat('风电-', wr.POINT_NAME) AS pointName,
count( 1 ) AS num, count( 1 ) AS num,
( SELECT count( 1 ) FROM idx_biz_fan_warning_record ( SELECT count( 1 ) FROM idx_biz_fan_warning_record
<where> <where>
((DISPOSOTION_STATE = '未处置') ((DISPOSOTION_STATE = '未处置')
or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) )) or (DISPOSOTION_STATE = '已处置' and DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
AND wr.POINT_NAME = POINT_NAME AND wr.POINT_NAME = POINT_NAME
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and ARAE like concat('%', #{areaCode}, '%') and ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
) AS allNum
) AS allNum
FROM FROM
idx_biz_fan_warning_record wr idx_biz_fan_warning_record wr
<where> <where>
((wr.DISPOSOTION_STATE = '未处置') ((wr.DISPOSOTION_STATE = '未处置')
or (wr.DISPOSOTION_STATE = '已处置' and wr.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) )) or (wr.DISPOSOTION_STATE = '已处置' and wr.DISPOSOTION_DATE > DATE_ADD( now(), INTERVAL - 3 DAY ) ))
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
and wr.ARAE like concat('%', #{areaCode}, '%') and wr.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
pointName, pointName,
warningName warningName
) a ) a
...@@ -452,292 +431,270 @@ ...@@ -452,292 +431,270 @@
a.pointName IS NOT NULL a.pointName IS NOT NULL
AND a.pointName != '' AND a.pointName != ''
order by a.allNum ASC order by a.allNum ASC
</select> </select>
<select id="getSubSystemInfo" resultType="java.util.Map">
<select id="getSubSystemInfo" resultType="java.util.Map"> SELECT
SELECT round(IFNULL( HEALTH_INDEX, 100 ), 1) AS healthIndex,
CEILING(IFNULL( HEALTH_INDEX, 100 )) AS healthIndex,
SUB_SYSTEM AS subSystem SUB_SYSTEM AS subSystem
FROM FROM
fan_health_index_latest_data fan_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '子系统' ANALYSIS_OBJ_TYPE = '子系统'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="equipmentName != null and equipmentName != ''"> <if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME like concat( '%', #{equipmentName} ,'风机') AND EQUIPMENT_NAME like concat( '%', #{equipmentName} ,'风机')
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
group by subSystem group by subSystem
</select>
</select> <select id="getFanInfoByPage" resultType="java.util.Map">
SELECT
<select id="getFanInfoByPage" resultType="java.util.Map">
SELECT
EQUIPMENT_NAME as equipmentName, EQUIPMENT_NAME as equipmentName,
INDEX_ADDRESS as indexAddress, INDEX_ADDRESS as indexAddress,
STATION as station STATION as station
FROM FROM
idx_biz_fan_point_process_variable_classification idx_biz_fan_point_process_variable_classification
<where> <where>
EQUIPMENT_NAME LIKE '%#%' EQUIPMENT_NAME LIKE '%#%'
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
EQUIPMENT_NAME EQUIPMENT_NAME
ORDER BY ORDER BY
RIGHT(EQUIPMENT_NAME, 6) ASC RIGHT(EQUIPMENT_NAME, 6) ASC
</select> </select>
<select id="getFanHealthInfoList" resultType="java.util.Map">
<select id="getFanHealthInfoList" resultType="java.util.Map"> SELECT
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
EQUIPMENT_NAME as equipmentName EQUIPMENT_NAME as equipmentName
FROM FROM
fan_health_index_latest_data fan_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '设备' ANALYSIS_OBJ_TYPE = '设备'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
EQUIPMENT_NAME EQUIPMENT_NAME
</select> </select>
<select id="getSumSystemListByEquipment" resultType="java.util.Map">
<select id="getSumSystemListByEquipment" resultType="java.util.Map"> SELECT
SELECT
SUB_SYSTEM as subSystem, SUB_SYSTEM as subSystem,
INDEX_ADDRESS as indexAddress INDEX_ADDRESS as indexAddress
FROM FROM
idx_biz_fan_point_process_variable_classification idx_biz_fan_point_process_variable_classification
<where> <where>
SUB_SYSTEM IS NOT NULL AND SUB_SYSTEM != '' SUB_SYSTEM IS NOT NULL AND SUB_SYSTEM != ''
<if test="equipmentName != null and equipmentName != ''"> <if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME like concat( '%', #{equipmentName} ,'风机') AND EQUIPMENT_NAME like concat( '%', #{equipmentName} ,'风机')
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
SUB_SYSTEM SUB_SYSTEM
</select> </select>
<select id="getPointNameListBySumSystem" resultType="java.util.Map">
<select id="getPointNameListBySumSystem" resultType="java.util.Map"> SELECT
SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
INDEX_ADDRESS as indexAddress, INDEX_ADDRESS as indexAddress,
STATION AS station STATION AS station
FROM FROM
idx_biz_fan_point_process_variable_classification idx_biz_fan_point_process_variable_classification
<where> <where>
<if test="subSystem != null and subSystem != ''"> <if test="subSystem != null and subSystem != ''">
AND SUB_SYSTEM = #{subSystem} AND SUB_SYSTEM = #{subSystem}
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
POINT_NAME POINT_NAME
</select> </select>
<select id="getHealthInfoBySubSystem" resultType="java.util.Map">
<select id="getHealthInfoBySubSystem" resultType="java.util.Map"> SELECT
SELECT
IFNULL( avg( HEALTH_INDEX ), 100 ) AS healthIndex, IFNULL( avg( HEALTH_INDEX ), 100 ) AS healthIndex,
POINT_NAME AS pointName POINT_NAME AS pointName
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
<where> <where>
ANALYSIS_OBJ_TYPE= '测点' ANALYSIS_OBJ_TYPE= '测点'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND POINT_NAME IS NOT NULL AND POINT_NAME IS NOT NULL
AND POINT_NAME != '' AND POINT_NAME != ''
<if test="subSystem != null and subSystem != ''"> <if test="subSystem != null and subSystem != ''">
AND SUB_SYSTEM = #{subSystem} AND SUB_SYSTEM = #{subSystem}
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
POINT_NAME POINT_NAME
</select> </select>
<select id="getWarningInfoBySubSystem" resultType="java.util.Map">
SELECT
<select id="getWarningInfoBySubSystem" resultType="java.util.Map">
SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
WARNING_NAME as warningName WARNING_NAME as warningName
FROM FROM
idx_biz_fan_warning_record idx_biz_fan_warning_record
<where> <where>
DISPOSOTION_STATE = '未处置' DISPOSOTION_STATE = '未处置'
<if test="subSystem != null and subSystem != ''"> <if test="subSystem != null and subSystem != ''">
AND SUB_SYSTEM = #{subSystem} AND SUB_SYSTEM = #{subSystem}
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
POINT_NAME POINT_NAME
ORDER BY ORDER BY
WARNING_NAME ASC WARNING_NAME ASC
</select> </select>
<select id="getPvInfoByPage" resultType="java.util.Map">
SELECT
<select id="getPvInfoByPage" resultType="java.util.Map">
SELECT
SUBARRAY as subarray, SUBARRAY as subarray,
STATION AS station STATION AS station
FROM FROM
idx_biz_pv_point_process_variable_classification idx_biz_pv_point_process_variable_classification
<where> <where>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
GATEWAY_ID = #{gatewayId} GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
SUBARRAY SUBARRAY
ORDER BY ORDER BY
SUBARRAY SUBARRAY
</select> </select>
<select id="getPvHealthInfoList" resultType="java.util.Map">
<select id="getPvHealthInfoList" resultType="java.util.Map"> SELECT
SELECT
IFNULL( round(AVG( HEALTH_INDEX ), 2), 0 ) AS avgHealthIndex, IFNULL( round(AVG( HEALTH_INDEX ), 2), 0 ) AS avgHealthIndex,
SUBARRAY as subarray SUBARRAY as subarray
FROM FROM
pv_health_index_latest_data pv_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '子阵' ANALYSIS_OBJ_TYPE = '子阵'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY SUBARRAY GROUP BY SUBARRAY
order by SUBARRAY order by SUBARRAY
</select> </select>
<select id="getPvSubSystemInfo" resultType="java.util.Map">
<select id="getPvSubSystemInfo" resultType="java.util.Map"> SELECT
SELECT round(IFNULL( AVG( HEALTH_INDEX ), 100 ), 1) AS avgHealthIndex,
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName EQUIPMENT_NAME AS equipmentName
FROM FROM
pv_health_index_latest_data pv_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '设备' ANALYSIS_OBJ_TYPE = '设备'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="subarray != null and subarray != ''"> <if test="subarray != null and subarray != ''">
AND SUBARRAY = concat('#', #{subarray}) AND SUBARRAY = concat('#', #{subarray})
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
group by EQUIPMENT_NAME group by EQUIPMENT_NAME
</select> </select>
<select id="getPvSumSystemListByEquipment" resultType="java.util.Map">
SELECT
<select id="getPvSumSystemListByEquipment" resultType="java.util.Map">
SELECT
EQUIPMENT_NAME as equipmentName EQUIPMENT_NAME as equipmentName
FROM FROM
idx_biz_pv_point_process_variable_classification idx_biz_pv_point_process_variable_classification
<where> <where>
EQUIPMENT_NAME IS NOT NULL EQUIPMENT_NAME IS NOT NULL
AND EQUIPMENT_NAME != '' AND EQUIPMENT_NAME != ''
<if test="subarray != null and subarray != ''"> <if test="subarray != null and subarray != ''">
AND SUBARRAY = concat('#', #{subarray}) AND SUBARRAY = concat('#', #{subarray})
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
EQUIPMENT_NAME EQUIPMENT_NAME
</select> </select>
<select id="getPvHealthInfoBySubSystem" resultType="java.util.Map">
SELECT
<select id="getPvHealthInfoBySubSystem" resultType="java.util.Map">
SELECT
IFNULL( ROUND(avg( HEALTH_INDEX ), 2), 0 ) AS healthIndex, IFNULL( ROUND(avg( HEALTH_INDEX ), 2), 0 ) AS healthIndex,
POINT_NAME AS pointName POINT_NAME AS pointName
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
ANALYSIS_OBJ_TYPE = '测点' ANALYSIS_OBJ_TYPE = '测点'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND POINT_NAME IS NOT NULL AND POINT_NAME IS NOT NULL
AND POINT_NAME != '' AND POINT_NAME != ''
<if test="equipmentName != null and equipmentName != ''"> <if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME = #{equipmentName} AND EQUIPMENT_NAME = #{equipmentName}
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
POINT_NAME POINT_NAME
</select> </select>
<select id="getPvWarningInfoBySubSystem" resultType="java.util.Map">
<select id="getPvWarningInfoBySubSystem" resultType="java.util.Map"> SELECT
SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
WARNING_NAME as warningName WARNING_NAME as warningName
FROM FROM
idx_biz_pv_warning_record idx_biz_pv_warning_record
<where> <where>
DISPOSOTION_STATE = '未处置' DISPOSOTION_STATE = '未处置'
<if test="equipmentName != null and equipmentName != ''"> <if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME = #{equipmentName} AND EQUIPMENT_NAME = #{equipmentName}
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
POINT_NAME POINT_NAME
ORDER BY ORDER BY
WARNING_NAME ASC WARNING_NAME ASC
</select> </select>
<select id="getPvPointNameListBySumSystem" resultType="java.util.Map">
SELECT
<select id="getPvPointNameListBySumSystem" resultType="java.util.Map">
SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
INDEX_ADDRESS as indexAddress, INDEX_ADDRESS as indexAddress,
STATION AS station STATION AS station
FROM FROM
idx_biz_pv_point_process_variable_classification idx_biz_pv_point_process_variable_classification
<where> <where>
<if test="equipmentName != null and equipmentName != ''"> <if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME = #{equipmentName} AND EQUIPMENT_NAME = #{equipmentName}
</if> </if>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId} AND GATEWAY_ID = #{gatewayId}
</if> </if>
</where> </where>
GROUP BY GROUP BY
POINT_NAME POINT_NAME
</select> </select>
<select id="getPointNameByIndexAddress" resultType="java.lang.String">
<select id="getPointNameByIndexAddress" resultType="java.lang.String">
select POINT_NAME select POINT_NAME
from ${tableName} from ${tableName}
where INDEX_ADDRESS = #{varDesc} where INDEX_ADDRESS = #{varDesc}
...@@ -746,8 +703,7 @@ ...@@ -746,8 +703,7 @@
</select> </select>
<select id="getFullViewRecall" resultType="com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO">
<select id="getFullViewRecall" resultType="com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO">
SELECT a.*, SELECT a.*,
row_number() over ( ORDER BY pointName ) AS id row_number() over ( ORDER BY pointName ) AS id
FROM ( FROM (
...@@ -787,8 +743,7 @@ ...@@ -787,8 +743,7 @@
) 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
</select> </select>
<select id="getStationIndexInfo" resultType="java.util.Map">
<select id="getStationIndexInfo" resultType="java.util.Map">
SELECT a.STATION AS station, SELECT a.STATION AS station,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM ( FROM (
...@@ -812,8 +767,7 @@ ...@@ -812,8 +767,7 @@
) a ) a
GROUP BY a.STATION GROUP BY a.STATION
</select> </select>
<select id="getEquipmentIndexInfo" resultType="java.util.Map">
<select id="getEquipmentIndexInfo" resultType="java.util.Map">
SELECT a.equipmentName AS equipmentName, SELECT a.equipmentName AS equipmentName,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM ( FROM (
...@@ -840,8 +794,7 @@ ...@@ -840,8 +794,7 @@
GROUP BY GROUP BY
a.equipmentName a.equipmentName
</select> </select>
<select id="getSubSystemIndexInfo" resultType="java.util.Map">
<select id="getSubSystemIndexInfo" resultType="java.util.Map">
SELECT a.subSystem AS subSystem, SELECT a.subSystem AS subSystem,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
...@@ -870,8 +823,7 @@ ...@@ -870,8 +823,7 @@
a.subSystem a.subSystem
</select> </select>
<select id="getPointNameIndexInfo" resultType="java.util.Map">
<select id="getPointNameIndexInfo" resultType="java.util.Map">
SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex, SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex,
concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress
...@@ -891,8 +843,7 @@ ...@@ -891,8 +843,7 @@
GROUP BY INDEX_ADDRESS GROUP BY INDEX_ADDRESS
) )
</select> </select>
<select id="getHealthLevelInfoList" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel">
<select id="getHealthLevelInfoList" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel">
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,
...@@ -909,16 +860,14 @@ ...@@ -909,16 +860,14 @@
WHERE STATUS IS NOT NULL WHERE STATUS IS NOT NULL
OR STATUS != '' OR STATUS != ''
</select> </select>
<select id="getAddressInfo" resultType="java.lang.String">
<select id="getAddressInfo" resultType="java.lang.String">
select index_address select index_address
from wl_equipment_specific_index from wl_equipment_specific_index
where gateway_id = '1668801435891929089' where gateway_id = '1668801435891929089'
and data_type = 'analog' limit 100 and data_type = 'analog' limit 100
</select> </select>
<select id="queryForLeftTableList" resultType="map">
<select id="queryForLeftTableList" resultType="map"> SELECT
SELECT
b.*, b.*,
IFNULL(CAST(HEALTH_INDEX AS UNSIGNED), 100 ) as HEALTH_INDEX , IFNULL(CAST(HEALTH_INDEX AS UNSIGNED), 100 ) as HEALTH_INDEX ,
IFNULL( ibfhi.HEALTH_LEVEL, '安全' ) as HEALTH_LEVEL, IFNULL( ibfhi.HEALTH_LEVEL, '安全' ) as HEALTH_LEVEL,
...@@ -944,23 +893,22 @@ ...@@ -944,23 +893,22 @@
LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) ) LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) )
AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND
DATE_FORMAT(ibfhi.REC_DATE,"%Y-%m-%d") = DATE_FORMAT(NOW(),"%Y-%m-%d") DATE_FORMAT(ibfhi.REC_DATE,"%Y-%m-%d") = DATE_FORMAT(NOW(),"%Y-%m-%d")
<where> <where>
<if test="STATION != '' and STATION != null"> <if test="STATION != '' and STATION != null">
b.STATION = #{STATION} b.STATION = #{STATION}
</if> </if>
<if test="HEALTHLEVEL != '' and HEALTHLEVEL != null"> <if test="HEALTHLEVEL != '' and HEALTHLEVEL != null">
AND HEALTH_LEVEL = #{HEALTHLEVEL} AND HEALTH_LEVEL = #{HEALTHLEVEL}
</if> </if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
</where> </where>
order by HEALTH_INDEX ASC order by HEALTH_INDEX ASC
limit ${current},${size} limit ${current},${size}
</select> </select>
<select id="queryForLeftTableListCount" resultType="int">
<select id="queryForLeftTableListCount" resultType="int"> SELECT
SELECT
count(1) count(1)
FROM FROM
( (
...@@ -979,21 +927,20 @@ ...@@ -979,21 +927,20 @@
LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) ) LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) )
AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND
DATE_FORMAT(ibfhi.REC_DATE,"%Y-%m-%d") = DATE_FORMAT(NOW(),"%Y-%m-%d") DATE_FORMAT(ibfhi.REC_DATE,"%Y-%m-%d") = DATE_FORMAT(NOW(),"%Y-%m-%d")
<where> <where>
<if test="STATION != '' and STATION != null"> <if test="STATION != '' and STATION != null">
b.STATION = #{STATION} b.STATION = #{STATION}
</if> </if>
<if test="HEALTHLEVEL != '' and HEALTHLEVEL != null"> <if test="HEALTHLEVEL != '' and HEALTHLEVEL != null">
AND HEALTH_LEVEL = #{HEALTHLEVEL} AND HEALTH_LEVEL = #{HEALTHLEVEL}
</if> </if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
</where> </where>
</select> </select>
<select id="queryForLeftTableListNum" resultType="map">
<select id="queryForLeftTableListNum" resultType="map"> SELECT
SELECT
CAST(ibfhi.HEALTH_INDEX AS UNSIGNED) as value CAST(ibfhi.HEALTH_INDEX AS UNSIGNED) as value
FROM FROM
...@@ -1013,22 +960,20 @@ ...@@ -1013,22 +960,20 @@
LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) ) LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) )
AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND
DATE_FORMAT(ibfhi.REC_DATE,"%Y-%m-%d") = DATE_FORMAT(NOW(),"%Y-%m-%d") DATE_FORMAT(ibfhi.REC_DATE,"%Y-%m-%d") = DATE_FORMAT(NOW(),"%Y-%m-%d")
<where> <where>
<if test="STATION != '' and STATION != null"> <if test="STATION != '' and STATION != null">
b.STATION = #{STATION} b.STATION = #{STATION}
</if> </if>
<if test="HEALTHLEVEL != '' and HEALTHLEVEL != null"> <if test="HEALTHLEVEL != '' and HEALTHLEVEL != null">
AND HEALTH_LEVEL = #{HEALTHLEVEL} AND HEALTH_LEVEL = #{HEALTHLEVEL}
</if> </if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
</where> </where>
</select> </select>
<select id="queryForLeftTableListByPoint" resultType="map">
SELECT
<select id="queryForLeftTableListByPoint" resultType="map">
SELECT
b.* b.*
FROM FROM
( (
...@@ -1056,27 +1001,25 @@ ...@@ -1056,27 +1001,25 @@
INNER JOIN idx_biz_fan_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ INNER JOIN idx_biz_fan_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ
AND rule.WARNING_NAME = '注意' AND rule.WARNING_NAME = '注意'
AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE
<where> <where>
<if test="STATION != null and STATION != '' "> <if test="STATION != null and STATION != '' ">
b.STATION = #{STATION} b.STATION = #{STATION}
</if> </if>
<if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' "> <if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' ">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
<if test="HEALTHLEVEL != null and HEALTHLEVEL != '' "> <if test="HEALTHLEVEL != null and HEALTHLEVEL != '' ">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL} AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if> </if>
<if test="POINTNAME != null and POINTNAME != '' "> <if test="POINTNAME != null and POINTNAME != '' ">
AND b.POINT_NAME = #{POINTNAME} AND b.POINT_NAME = #{POINTNAME}
</if> </if>
</where> </where>
order by b.HEALTH_INDEX ASC order by b.HEALTH_INDEX ASC
limit ${current},${size} limit ${current},${size}
</select> </select>
<select id="queryForLeftTableListByPointCount" resultType="int">
SELECT
<select id="queryForLeftTableListByPointCount" resultType="int">
SELECT
count(1) count(1)
FROM FROM
( (
...@@ -1104,25 +1047,23 @@ ...@@ -1104,25 +1047,23 @@
INNER JOIN idx_biz_fan_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ INNER JOIN idx_biz_fan_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ
AND rule.WARNING_NAME = '注意' AND rule.WARNING_NAME = '注意'
AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE
<where> <where>
<if test="STATION != null and STATION != '' "> <if test="STATION != null and STATION != '' ">
b.STATION = #{STATION} b.STATION = #{STATION}
</if> </if>
<if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' "> <if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' ">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
<if test="HEALTHLEVEL != null and HEALTHLEVEL != '' "> <if test="HEALTHLEVEL != null and HEALTHLEVEL != '' ">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL} AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if> </if>
<if test="POINTNAME != null and POINTNAME != '' "> <if test="POINTNAME != null and POINTNAME != '' ">
AND b.POINT_NAME = #{POINTNAME} AND b.POINT_NAME = #{POINTNAME}
</if> </if>
</where> </where>
</select> </select>
<select id="queryForLeftTableListByPointNum" resultType="map">
SELECT
<select id="queryForLeftTableListByPointNum" resultType="map">
SELECT
b.HEALTH_INDEX as value b.HEALTH_INDEX as value
FROM FROM
( (
...@@ -1150,61 +1091,57 @@ ...@@ -1150,61 +1091,57 @@
INNER JOIN idx_biz_fan_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ INNER JOIN idx_biz_fan_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ
AND rule.WARNING_NAME = '注意' AND rule.WARNING_NAME = '注意'
AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE
<where> <where>
<if test="STATION != null and STATION != '' "> <if test="STATION != null and STATION != '' ">
b.STATION = #{STATION} b.STATION = #{STATION}
</if> </if>
<if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' "> <if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' ">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
<if test="HEALTHLEVEL != null and HEALTHLEVEL != '' "> <if test="HEALTHLEVEL != null and HEALTHLEVEL != '' ">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL} AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if> </if>
<if test="POINTNAME != null and POINTNAME != '' "> <if test="POINTNAME != null and POINTNAME != '' ">
AND b.POINT_NAME = #{POINTNAME} AND b.POINT_NAME = #{POINTNAME}
</if> </if>
</where> </where>
</select> </select>
<select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord">
<select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord"> SELECT
SELECT
* *
FROM FROM
idx_biz_fan_warning_record re idx_biz_fan_warning_record re
WHERE WHERE
re.`STATUS` = 0 re.`STATUS` = 0
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND re.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND re.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
<if test="SUBARRAY != null and SUBARRAY != '' "> <if test="SUBARRAY != null and SUBARRAY != '' ">
AND re.SUBARRAY = #{SUBARRAY} AND re.SUBARRAY = #{SUBARRAY}
</if> </if>
<if test="STATION != null and STATION != '' "> <if test="STATION != null and STATION != '' ">
AND re.STATION = #{STATION} AND re.STATION = #{STATION}
</if> </if>
</select> </select>
<select id="pointNum" resultType="int">
<select id="pointNum" resultType="int"> SELECT
SELECT
count(1) count(1)
FROM FROM
idx_biz_fan_point_process_variable_classification cl idx_biz_fan_point_process_variable_classification cl
WHERE WHERE
cl.TAG_CODE = '分析变量' cl.TAG_CODE = '分析变量'
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND cl.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND cl.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
<if test="SUBSYSTEM != null and SUBSYSTEM != '' "> <if test="SUBSYSTEM != null and SUBSYSTEM != '' ">
AND cl.SUB_SYSTEM = #{SUBSYSTEM} AND cl.SUB_SYSTEM = #{SUBSYSTEM}
</if> </if>
<if test="STATION != null and STATION != '' "> <if test="STATION != null and STATION != '' ">
AND cl.STATION = #{STATION} AND cl.STATION = #{STATION}
</if> </if>
</select> </select>
<select id="selectPointByANALYSISTYPE" resultType="map">
SELECT
<select id="selectPointByANALYSISTYPE" resultType="map">
SELECT
b.* b.*
FROM FROM
( (
...@@ -1225,40 +1162,38 @@ ...@@ -1225,40 +1162,38 @@
`idx_biz_fan_health_index` `idx_biz_fan_health_index`
WHERE WHERE
ANALYSIS_OBJ_TYPE = '测点' ANALYSIS_OBJ_TYPE = '测点'
<if test="(startTime == null or startTime == '' ) and (endTime == null or endTime =='') "> <if test="(startTime == null or startTime == '' ) and (endTime == null or endTime =='') ">
AND ( ANALYSIS_TYPE = '按小时' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 15 HOUR ) ) AND ( ANALYSIS_TYPE = '按小时' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 15 HOUR ) )
OR ( REC_DATE >=DATE_SUB( NOW(), INTERVAL 15 DAY ) AND ANALYSIS_TYPE = '按天' ) OR ( REC_DATE >=DATE_SUB( NOW(), INTERVAL 15 DAY ) AND ANALYSIS_TYPE = '按天' )
OR ( ANALYSIS_TYPE = '按时刻' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 150 MINUTE ) ) OR ( ANALYSIS_TYPE = '按时刻' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 150 MINUTE ) )
</if> </if>
<if test="startTime != null and startTime != '' or endTime != null and endTime != '' "> <if test="startTime != null and startTime != '' or endTime != null and endTime != '' ">
AND REC_DATE >= #{startTime} AND REC_DATE >= #{startTime}
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
<![CDATA[ AND REC_DATE <= #{endTime}]]> <![CDATA[ AND REC_DATE <= #{endTime}]]>
</if> </if>
) b ) b
INNER JOIN idx_biz_fan_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ INNER JOIN idx_biz_fan_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ
AND rule.WARNING_NAME = '注意' AND rule.WARNING_NAME = '注意'
AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE
<where> <where>
<if test="STATION != null and STATION != '' "> <if test="STATION != null and STATION != '' ">
b.STATION = #{STATION} b.STATION = #{STATION}
</if> </if>
<if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' "> <if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' ">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME} AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if> </if>
<if test="HEALTHLEVEL != null and HEALTHLEVEL != '' "> <if test="HEALTHLEVEL != null and HEALTHLEVEL != '' ">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL} AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if> </if>
<if test="POINTNAME != null and POINTNAME != '' "> <if test="POINTNAME != null and POINTNAME != '' ">
AND b.POINT_NAME = #{POINTNAME} AND b.POINT_NAME = #{POINTNAME}
</if> </if>
</where> </where>
</select>
</select> <select id="getFanEquipStatusByStation" resultType="map">
SELECT
<select id="getFanEquipStatusByStation" resultType="map">
SELECT
max( CASE WHEN a.HEALTH_LEVEL = '安全' THEN num ELSE 0 END ) AS 安全, max( CASE WHEN a.HEALTH_LEVEL = '安全' THEN num ELSE 0 END ) AS 安全,
max( CASE WHEN a.HEALTH_LEVEL = '注意' THEN num ELSE 0 END ) AS 注意, max( CASE WHEN a.HEALTH_LEVEL = '注意' THEN num ELSE 0 END ) AS 注意,
max( CASE WHEN a.HEALTH_LEVEL = '警告' THEN num ELSE 0 END ) AS 警告, max( CASE WHEN a.HEALTH_LEVEL = '警告' THEN num ELSE 0 END ) AS 警告,
...@@ -1275,17 +1210,16 @@ ...@@ -1275,17 +1210,16 @@
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备'
AND REC_DATE >= CURRENT_DATE ( ) AND REC_DATE >= CURRENT_DATE ( )
<if test="STATION != null and STATION != ''"> <if test="STATION != null and STATION != ''">
AND STATION = #{STATION} AND STATION = #{STATION}
</if> </if>
GROUP BY GROUP BY
STATION, STATION,
HEALTH_LEVEL HEALTH_LEVEL
) a ) a
</select> </select>
<select id="getPvEquipStatusByStation" resultType="java.util.Map">
<select id="getPvEquipStatusByStation" resultType="java.util.Map"> SELECT
SELECT
max( CASE WHEN a.HEALTH_LEVEL = '安全' THEN num ELSE 0 END ) AS 安全, max( CASE WHEN a.HEALTH_LEVEL = '安全' THEN num ELSE 0 END ) AS 安全,
max( CASE WHEN a.HEALTH_LEVEL = '注意' THEN num ELSE 0 END ) AS 注意, max( CASE WHEN a.HEALTH_LEVEL = '注意' THEN num ELSE 0 END ) AS 注意,
max( CASE WHEN a.HEALTH_LEVEL = '警告' THEN num ELSE 0 END ) AS 警告, max( CASE WHEN a.HEALTH_LEVEL = '警告' THEN num ELSE 0 END ) AS 警告,
...@@ -1302,17 +1236,15 @@ ...@@ -1302,17 +1236,15 @@
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备'
AND REC_DATE >= CURRENT_DATE ( ) AND REC_DATE >= CURRENT_DATE ( )
<if test="STATION != null and STATION != ''"> <if test="STATION != null and STATION != ''">
AND STATION = #{STATION} AND STATION = #{STATION}
</if> </if>
GROUP BY GROUP BY
STATION, STATION,
HEALTH_LEVEL HEALTH_LEVEL
) a ) a
</select>
</select> <select id="getRecDateByIndexAddress" resultType="java.lang.String">
<select id="getRecDateByIndexAddress" resultType="java.lang.String">
SELECT SELECT
a.REC_DATE a.REC_DATE
FROM FROM
...@@ -1341,8 +1273,7 @@ ...@@ -1341,8 +1273,7 @@
LIMIT 1 LIMIT 1
) a ) a
</select> </select>
<select id="getInfoListByTableName" resultType="java.util.Map">
<select id="getInfoListByTableName" resultType="java.util.Map">
SELECT SELECT
*, *,
CEILING(HEALTH_INDEX) as healthIndex CEILING(HEALTH_INDEX) as healthIndex
...@@ -1355,219 +1286,207 @@ ...@@ -1355,219 +1286,207 @@
AND INDEX_ADDRESS = #{indexAddress} AND INDEX_ADDRESS = #{indexAddress}
AND GATEWAY_ID = #{fanGatewayId} AND GATEWAY_ID = #{fanGatewayId}
</select> </select>
<select id="getIsWarningByPointId" resultType="int">
<select id="getIsWarningByPointId" resultType="int">
select count(1) from ${tableName} select count(1) from ${tableName}
where INDEX_ADDRESS = #{indexAddress} where INDEX_ADDRESS = #{indexAddress}
AND GATEWAY_ID = #{fanGatewayId} AND GATEWAY_ID = #{fanGatewayId}
and DISPOSOTION_STATE = '未处置' and DISPOSOTION_STATE = '未处置'
</select> </select>
<select id="getStationIndexInfoByParam" resultType="java.util.Map">
<select id="getStationIndexInfoByParam" resultType="java.util.Map"> SELECT a.STATION AS station,
SELECT a.STATION AS station,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM ( FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
STATION AS STATION STATION AS STATION
FROM fan_health_index_latest_data FROM fan_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '场站' ANALYSIS_OBJ_TYPE = '场站'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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>
</where> </where>
GROUP BY STATION GROUP BY STATION
UNION ALL UNION ALL
( (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
STATION AS STATION STATION AS STATION
FROM pv_health_index_latest_data FROM pv_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '场站' ANALYSIS_OBJ_TYPE = '场站'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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>
</where> </where>
GROUP BY STATION GROUP BY STATION
) )
) a ) a
GROUP BY a.STATION GROUP BY a.STATION
</select> </select>
<select id="getEquipmentIndexInfoByParam" resultType="java.util.Map">
<select id="getEquipmentIndexInfoByParam" resultType="java.util.Map"> SELECT a.equipmentName AS equipmentName,
SELECT a.equipmentName AS equipmentName,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM ( FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName EQUIPMENT_NAME AS equipmentName
FROM fan_health_index_latest_data FROM fan_health_index_latest_data
<where>
<where> ANALYSIS_OBJ_TYPE = '设备'
ANALYSIS_OBJ_TYPE = '设备' <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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>
</where> </where>
GROUP BY EQUIPMENT_NAME GROUP BY EQUIPMENT_NAME
UNION ALL UNION ALL
( (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
SUBARRAY AS equipmentName SUBARRAY AS equipmentName
FROM pv_health_index_latest_data FROM pv_health_index_latest_data
<where>
<where> ANALYSIS_OBJ_TYPE = '子阵'
ANALYSIS_OBJ_TYPE = '子阵' <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
<if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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>
</where> </where>
GROUP BY SUBARRAY GROUP BY SUBARRAY
) )
) a ) a
where equipmentName is not null where equipmentName is not null
and equipmentName != '' and equipmentName != ''
GROUP BY GROUP BY
a.equipmentName a.equipmentName
</select> </select>
<select id="getSubSystemIndexInfoByParam" resultType="java.util.Map">
<select id="getSubSystemIndexInfoByParam" resultType="java.util.Map"> SELECT a.subSystem AS subSystem,
SELECT a.subSystem AS subSystem,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM ( FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
SUB_SYSTEM AS subSystem SUB_SYSTEM AS subSystem
FROM fan_health_index_latest_data FROM fan_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '子系统' ANALYSIS_OBJ_TYPE = '子系统'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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>
</where> </where>
GROUP BY SUB_SYSTEM GROUP BY SUB_SYSTEM
UNION ALL UNION ALL
( (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
EQUIPMENT_NAME AS subSystem EQUIPMENT_NAME AS subSystem
FROM pv_health_index_latest_data FROM pv_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '设备' ANALYSIS_OBJ_TYPE = '设备'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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>
</where> </where>
GROUP BY EQUIPMENT_NAME GROUP BY EQUIPMENT_NAME
) )
) a ) a
where subSystem is not null where subSystem is not null
and subSystem != '' and subSystem != ''
GROUP BY GROUP BY
a.subSystem a.subSystem
</select>
</select> <select id="getPointNameIndexInfoByParam" resultType="java.util.Map">
SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex,
<select id="getPointNameIndexInfoByParam" resultType="java.util.Map">
SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex,
concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress
FROM fan_health_index_latest_data FROM fan_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '测点' ANALYSIS_OBJ_TYPE = '测点'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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>
</where> </where>
GROUP BY INDEX_ADDRESS
GROUP BY INDEX_ADDRESS
UNION ALL UNION ALL
( (
SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex, SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex,
concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress
FROM pv_health_index_latest_data FROM pv_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '测点' ANALYSIS_OBJ_TYPE = '测点'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
</if> </if>
<if test="analysisType == '按小时'"> <if test="analysisType == '按小时'">
AND ANALYSIS_TYPE = '按小时' AND ANALYSIS_TYPE = '按小时'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 59 MINUTE )
</if> </if>
<if test="analysisType == '按时刻'"> <if test="analysisType == '按时刻'">
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>
</where> </where>
GROUP BY INDEX_ADDRESS GROUP BY INDEX_ADDRESS
) )
</select> </select>
<select id="queryIndexByArae" resultType="map">
<select id="queryIndexByArae" resultType="map"> SELECT
SELECT
CAST(AVG(b.HEALTH_INDEX) as SIGNED) HEALTHINDEX, CAST(AVG(b.HEALTH_INDEX) as SIGNED) HEALTHINDEX,
b.REC_DATE, b.REC_DATE,
b.ANALYSIS_TIME as ANALYSISTIME b.ANALYSIS_TIME as ANALYSISTIME
...@@ -1579,97 +1498,93 @@ ...@@ -1579,97 +1498,93 @@
HEALTH_INDEX HEALTH_INDEX
FROM FROM
`idx_biz_fan_health_index` `idx_biz_fan_health_index`
<where> <where>
<if test = 'startTimeTop != null and startTimeTop != ""' > <if test='startTimeTop != null and startTimeTop != ""'>
AND REC_DATE >= #{startTimeTop} AND REC_DATE >= #{startTimeTop}
</if> </if>
<if test = 'endTimeTop != null and endTimeTop != ""' > <if test='endTimeTop != null and endTimeTop != ""'>
<![CDATA[ AND REC_DATE <= #{endTimeTop}]]> <![CDATA[ AND REC_DATE <= #{endTimeTop}]]>
</if> </if>
<if test = 'ARAE != null and ARAE != ""' > <if test='ARAE != null and ARAE != ""'>
AND ARAE = #{ARAE} AND ARAE = #{ARAE}
</if> </if>
<if test = 'ANALYSISTYPE != null and ANALYSISTYPE != ""' > <if test='ANALYSISTYPE != null and ANALYSISTYPE != ""'>
AND ANALYSIS_TYPE = #{ANALYSISTYPE} AND ANALYSIS_TYPE = #{ANALYSISTYPE}
</if> </if>
</where> </where>
UNION ALL UNION ALL
SELECT SELECT
ANALYSIS_TIME, ANALYSIS_TIME,
REC_DATE, REC_DATE,
HEALTH_INDEX HEALTH_INDEX
FROM FROM
`idx_biz_PV_health_index` `idx_biz_PV_health_index`
<where> <where>
<if test = ' startTimeTop != null and startTimeTop != ""' > <if test=' startTimeTop != null and startTimeTop != ""'>
AND REC_DATE >= #{startTimeTop} AND REC_DATE >= #{startTimeTop}
</if> </if>
<if test = 'endTimeTop != null and endTimeTop != ""' > <if test='endTimeTop != null and endTimeTop != ""'>
<![CDATA[ AND REC_DATE <= #{endTimeTop}]]> <![CDATA[ AND REC_DATE <= #{endTimeTop}]]>
</if> </if>
<if test = 'ARAE != null and ARAE != ""' > <if test='ARAE != null and ARAE != ""'>
AND ARAE = #{ARAE} AND ARAE = #{ARAE}
</if> </if>
<if test = 'ANALYSISTYPE != null and ANALYSISTYPE !=""' > <if test='ANALYSISTYPE != null and ANALYSISTYPE !=""'>
AND ANALYSIS_TYPE = #{ANALYSISTYPE} AND ANALYSIS_TYPE = #{ANALYSISTYPE}
</if> </if>
</where> </where>
)b )b
GROUP BY REC_DATE GROUP BY REC_DATE
</select> </select>
<select id="getHealthScoreInfoByLatest" resultType="java.math.BigDecimal">
<select id="getHealthScoreInfoByLatest" resultType="java.math.BigDecimal"> SELECT
SELECT round(avg( a.avgHealthIndex ), 1) AS healthIndex
CEILING(avg( a.avgHealthIndex )) AS healthIndex
FROM FROM
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM FROM
fan_health_index_latest_data fan_health_index_latest_data
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<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>
</where>
</where> UNION ALL
UNION ALL
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM FROM
pv_health_index_latest_data pv_health_index_latest_data
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<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>
</where> </where>
) )
) a ) a
</select> </select>
<select id="getDateInfoBy15" resultType="java.util.Map">
<select id="getDateInfoBy15" resultType="java.util.Map">
SELECT SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date, DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index` @s := @s + 1 AS `index`
...@@ -1679,4 +1594,34 @@ ...@@ -1679,4 +1594,34 @@
WHERE WHERE
DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s
</select> </select>
<select id="getDateInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( #{endTime}, INTERVAL - DATEDIFF( #{endTime}, #{startTime})-1 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( #{endTime}, DATE( DATE_ADD( #{endTime}, INTERVAL - DATEDIFF( #{endTime}, #{startTime})-1 DAY )) ) >= @s
</select>
<select id="getHourInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL @s-1 HOUR ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( HOUR, #{startTime} , #{endTime}) >= @s-1
</select>
<select id="getMomentInfo" resultType="java.util.Map">
SELECT
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`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
</select>
</mapper> </mapper>
...@@ -334,14 +334,18 @@ ...@@ -334,14 +334,18 @@
group by point_name group by point_name
</select> </select>
<select id="getInfoByDate" resultType="java.lang.String"> <select id="getInfoByDate" resultType="java.util.Map">
select ceil(avg(b.health_index)) as healthIndex from select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT (SELECT
health_index health_index,
rec_date
FROM FROM
pv_health_index_day pv_health_index_day
<where> <where>
rec_date = concat(#{date}, ' 00:00:00') rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND area like #{areaCode} AND area like #{areaCode}
AND analysis_obj_type = '片区' AND analysis_obj_type = '片区'
...@@ -357,12 +361,15 @@ ...@@ -357,12 +361,15 @@
UNION ALL UNION ALL
( (
SELECT SELECT
health_index health_index,
rec_date
FROM FROM
fan_health_index_day fan_health_index_day
<where> <where>
rec_date = concat(#{date}, ' 00:00:00') rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND area like #{areaCode} AND area like #{areaCode}
AND analysis_obj_type = '片区' AND analysis_obj_type = '片区'
...@@ -375,10 +382,110 @@ ...@@ -375,10 +382,110 @@
AND analysis_obj_type = '片区' AND analysis_obj_type = '片区'
</if> </if>
</where> </where>
)) b )) b GROUP BY b.rec_date
</select>
<select id="getInfoByHour" resultType="java.util.Map">
select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT
health_index,
rec_date
FROM
pv_health_index_hour
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
UNION ALL
(
SELECT
health_index,
rec_date
FROM
fan_health_index_hour
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
)) b GROUP BY b.rec_date
</select>
<select id="getInfoByMoment" resultType="java.util.Map">
select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT
health_index,
rec_date
FROM
pv_health_index_moment
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
UNION ALL
(
SELECT
health_index,
rec_date
FROM
fan_health_index_moment
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
)) b GROUP BY b.rec_date
</select> </select>
<select id="getInfoListByGroupByQgFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex"> <select id="getInfoListByGroupByQgFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<select id="getHealthInfoByArea" resultType="java.util.Map"> <select id="getHealthInfoByArea" resultType="java.util.Map">
select area as area, select area as area,
ceil(avg(a.avghealthindex)) as healthIndex avg(a.avghealthindex) as healthIndex
from ( from (
select avg(health_index) as avghealthindex, select avg(health_index) as avghealthindex,
area area
......
...@@ -111,6 +111,7 @@ ...@@ -111,6 +111,7 @@
</select> </select>
<select id="selectWarningPoint" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord"> <select id="selectWarningPoint" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord">
select * from (
SELECT SELECT
a.station, a.station,
a.warning_name, a.warning_name,
...@@ -134,7 +135,7 @@ ...@@ -134,7 +135,7 @@
point_name, point_name,
rec_date , rec_date ,
content, content,
warning_name warning_name) b
limit #{current},#{size} limit #{current},#{size}
</select> </select>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{ {
"title": "逆变器台数", "title": "逆变器台数",
"title1": "逆变器台数(台)", "title1": "逆变器台数(台)",
"url": "upload/jxiop/amos_studio/EA3572E1BD31DC1E7D8DA162F09ECB.png" "url": "upload/jxiop/amos_studio/4C82F011332D3EE6E378B7DF2E2F483.png"
}, },
{ {
"title": "装机容量", "title": "装机容量",
......
...@@ -68,19 +68,26 @@ public class PersonYardMessage extends EmqxListener { ...@@ -68,19 +68,26 @@ public class PersonYardMessage extends EmqxListener {
}; };
public void jxIopUpdate(JSONObject analysisResult) { public void jxIopUpdate(JSONObject analysisResult) {
try {
Thread.sleep(10000); // 等待3秒
log.info("人员赋码数据:{}", analysisResult); log.info("人员赋码数据:{}", analysisResult);
String warningObjectCode = String.valueOf(analysisResult.get("warningObjectCode")); String warningObjectCode = String.valueOf(analysisResult.get("warningObjectCode"));
String codeColor = String.valueOf(analysisResult.get("codeColor")); String codeColor = String.valueOf(analysisResult.get("codeColor"));
PersonBasic personBasic = personBasicMapper.selectById(warningObjectCode); PersonBasic personBasic = personBasicMapper.selectById(warningObjectCode);
if (ObjectUtils.isEmpty(personBasic)) { log.info("人员基础信息:{}", JSON.toJSONString(personBasic));
try { // if (ObjectUtils.isEmpty(personBasic)) {
emqKeeper.getMqttClient().publish("ryfm/warning/coding", analysisResult.toJSONString().getBytes(), 2, Boolean.FALSE); // try {
} catch (MqttException e) { // emqKeeper.getMqttClient().publish("ryfm/warning/coding", analysisResult.toJSONString().getBytes(), 2, Boolean.FALSE);
e.printStackTrace(); // } catch (MqttException e) {
} // e.printStackTrace();
} else { // }
// } else {
personBasic.setQrcodeColor(codeColor); personBasic.setQrcodeColor(codeColor);
personBasicMapper.updateById(personBasic); personBasicMapper.updateById(personBasic);
} catch (InterruptedException e) {
e.printStackTrace();
} }
// }
} }
} }
...@@ -228,10 +228,17 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -228,10 +228,17 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
// personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode()); // personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeDesc("证书临期"); personBasic.setQrcodeDesc("证书临期");
} }
this.baseMapper.insert(personBasic);
CompanyModel companyModel = new CompanyModel(); CompanyModel companyModel = new CompanyModel();
//单位 //单位
companyModel = this.getCompanyModel(personAccount.getProjectId()); companyModel = this.getCompanyModel(personAccount.getProjectId());
personBasic.setProjectOrgCode(companyModel.getOrgCode());
if (personUser.getNativePlace()!=null) {
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
}
this.baseMapper.insert(personBasic);
if ("证书不全".equals(personBasic.getQrcodeDesc()) || "证书临期".equals(personBasic.getQrcodeDesc())) { if ("证书不全".equals(personBasic.getQrcodeDesc()) || "证书临期".equals(personBasic.getQrcodeDesc())) {
personBasic.setProjectOrgCode(companyModel.getOrgCode()); personBasic.setProjectOrgCode(companyModel.getOrgCode());
personAccount.setProjectName(companyModel.getCompanyName()); personAccount.setProjectName(companyModel.getCompanyName());
...@@ -308,15 +315,15 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -308,15 +315,15 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
//personBasic.setProjectOrgCode(departmentModel.getOrgCode()); //personBasic.setProjectOrgCode(departmentModel.getOrgCode());
personAccount.setProjectDepartmentName(departmentModel.getDepartmentName()); personAccount.setProjectDepartmentName(departmentModel.getDepartmentName());
} }
personBasic.setProjectOrgCode(companyModel.getOrgCode()); // personBasic.setProjectOrgCode(companyModel.getOrgCode());
//
//
if (personUser.getNativePlace()!=null) { // if (personUser.getNativePlace()!=null) {
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace())); // personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
} // }
personAccount.setPuserId(agencyUserModel.getUserId()); personAccount.setPuserId(agencyUserModel.getUserId());
personAccount.setProjectName(companyModel.getCompanyName()); personAccount.setProjectName(companyModel.getCompanyName());
this.personBasicMapper.updateById(personBasic); // this.personBasicMapper.updateById(personBasic);
this.personAccountService.updateById(personAccount); this.personAccountService.updateById(personAccount);
PersonAccountFed personAccountFed = new PersonAccountFed(); PersonAccountFed personAccountFed = new PersonAccountFed();
...@@ -413,47 +420,17 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -413,47 +420,17 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode());
personBasic.setQrcodeDesc("证书齐全"); personBasic.setQrcodeDesc("证书齐全");
} else if (CollectionUtils.isEmpty(list) && isOver == 1) { } else if (CollectionUtils.isEmpty(list) && isOver == 1) {
// personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDesc("证书不全"); personBasic.setQrcodeDesc("证书不全");
} else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) { } else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) {
// personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeDesc("证书临期"); personBasic.setQrcodeDesc("证书临期");
} }
personBasic.setProjectOrgCode(companyModel.getOrgCode()); personBasic.setProjectOrgCode(companyModel.getOrgCode());
personAccount.setProjectName(companyModel.getCompanyName()); personAccount.setProjectName(companyModel.getCompanyName());
if (!qrcodeDescOld.equals(personBasic.getQrcodeDesc())) {
personBasic.setRecDate(new Date());
this.personBasicMapper.updateById(personBasic);
if (("证书不全".equals(personBasic.getQrcodeDesc()) ||
"证书临期".equals(personBasic.getQrcodeDesc()))) {
BizMessage bizMessage = new BizMessage();
bizMessage.setIndexKey("RYFM");
bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc());
RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount);
bizMessage.setBizInfo(riskBizInfoVo);
bizMessage.setDataSource("人员赋码");
try {
emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_DATA_MQTT_TOPIC, JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) {
e.printStackTrace();
}
} else if ("证书齐全".equals(personBasic.getQrcodeDesc())) {
HashMap<String, String> personMap = new HashMap<>();
personMap.put("objectId", String.valueOf(personBasic.getSequenceNbr()));
personMap.put("qrCodeColor", qrcodeColorOld);
personMap.put("warningObjectType", "RYFM");
personMap.put("sourceAttribution", personBasic.getProjectOrgCode());
personMap.put("sourceAttributionDesc", personAccount.getProjectName());
personMap.put("warningSourceType", "人员赋码");
try {
emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_GREEN, JSON.toJSONString(personMap).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) {
e.printStackTrace();
}
}
}
//人员账号信息 //人员账号信息
personAccount.setPersonId(sequenceNbr); personAccount.setPersonId(sequenceNbr);
...@@ -501,7 +478,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -501,7 +478,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
if (personAccount.getDepartmentId() != null) { if (personAccount.getDepartmentId() != null) {
departmentModel = this.getdepartmentModel(personAccount.getDepartmentId()); departmentModel = this.getdepartmentModel(personAccount.getDepartmentId());
} }
BeanUtils.copyProperties(personUser, personBasic); BeanUtils.copyProperties(personUser, personBasic, "qrcodeDesc", "qrcodeColor");
if (departmentModel != null) { if (departmentModel != null) {
//personBasic.setProjectOrgCode(departmentModel.getOrgCode()); //personBasic.setProjectOrgCode(departmentModel.getOrgCode());
personAccount.setProjectDepartmentName(departmentModel.getDepartmentName()); personAccount.setProjectDepartmentName(departmentModel.getDepartmentName());
...@@ -512,7 +489,40 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -512,7 +489,40 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace())); personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
} }
personAccount.setProjectName(companyModel.getCompanyName()); personAccount.setProjectName(companyModel.getCompanyName());
this.personBasicMapper.updateById(personBasic);
if (!qrcodeDescOld.equals(personBasic.getQrcodeDesc())) {
personBasic.setRecDate(new Date());
this.personBasicMapper.updateById(personBasic);
if (("证书不全".equals(personBasic.getQrcodeDesc()) ||
"证书临期".equals(personBasic.getQrcodeDesc()))) {
BizMessage bizMessage = new BizMessage();
bizMessage.setIndexKey("RYFM");
bizMessage.setIndexValue(personBasic.getPostName() + personBasic.getQrcodeDesc());
RiskBizInfoVo riskBizInfoVo = fetchData(personBasic, personAccount);
bizMessage.setBizInfo(riskBizInfoVo);
bizMessage.setDataSource("人员赋码");
try {
emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_DATA_MQTT_TOPIC, JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) {
e.printStackTrace();
}
} else if ("证书齐全".equals(personBasic.getQrcodeDesc())) {
HashMap<String, String> personMap = new HashMap<>();
personMap.put("objectId", String.valueOf(personBasic.getSequenceNbr()));
personMap.put("qrCodeColor", qrcodeColorOld);
personMap.put("warningObjectType", "RYFM");
personMap.put("sourceAttribution", personBasic.getProjectOrgCode());
personMap.put("sourceAttributionDesc", personAccount.getProjectName());
personMap.put("warningSourceType", "人员赋码");
try {
emqKeeper.getMqttClient().publish(PersonBasicServiceImpl.RYFM_GREEN, JSON.toJSONString(personMap).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) {
e.printStackTrace();
}
}
} else {
this.personBasicMapper.updateById(personBasic);
}
personAccountService.updateById(personAccount); personAccountService.updateById(personAccount);
PersonAccountFed personAccountFed = new PersonAccountFed(); PersonAccountFed personAccountFed = new PersonAccountFed();
......
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