Commit b0f8c8d0 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://36.40.66.175:5000/moa/amos-boot-biz into developer

parents d3439d39 fe71f339
......@@ -90,7 +90,7 @@ public class UserEmpowerInterceptor implements Interceptor {
}
}
}else{
throw new BadRequest("权限认证失败!参数之间关系不能为空");
sqldata=" ";
}
}
}
......@@ -144,8 +144,6 @@ public class UserEmpowerInterceptor implements Interceptor {
sq= getCondition(filed[i],fileCondition[i],data);
sql.add(sq);
}
}else{
throw new BadRequest("权限认证失败!");
}
return sql;
}
......
......@@ -36,4 +36,6 @@ public class StdUserEmpower extends BaseEntity {
private List<String> amosOrgCode;
}
package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
......@@ -51,5 +53,6 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
Map<String,Object> getcount( JpStationDto reviewDto);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
List<JpStationDto> queryForDealerReviewPagenew(@Param("dto") JpStationDto reviewDto);
@UserLimits
List<JpStationDto> queryForDealerReviewPagenew(@Param("dto") JpStationDto reviewDto, Page<JpStationDto> pa);
}
......@@ -504,7 +504,7 @@
`cumulative_income` cumulativeIncome,
`email`,
rated_power ratedPower,
ROUND(`real_time_power`/ratedPower,3) fullhour,
ROUND(`real_time_power`/rated_power,3) fullhour,
(select privilege_company.COMPANY_NAME from privilege_company where privilege_company.ORG_CODE=hygf_jp_station.regional_companies_code) regionalCompaniesName
from hygf_jp_station
<where>
......
......@@ -182,7 +182,7 @@ public class HouseholdContractController extends BaseController {
//去签署
@TycloudOperation(ApiLevel = UserType.AGENCY)
@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) {
return ResponseHelper.buildResponse(householdContractServiceImpl.updateWithModel(model));
......@@ -191,7 +191,7 @@ public class HouseholdContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping (value = "/signing/{sequenceNbr}")
@ApiOperation(httpMethod = "Post", value = "签字", notes = "签字")
@ApiOperation(httpMethod = "POST", value = "签字", notes = "签字")
public ResponseModel<Boolean> signing(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
HouseholdContract householdContrac= householdContractServiceImpl.getById(sequenceNbr);
......@@ -207,7 +207,7 @@ public class HouseholdContractController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping (value = "/stamp/{sequenceNbr}")
@ApiOperation(httpMethod = "Post", value = "盖章", notes = "盖章")
@ApiOperation(httpMethod = "POST", value = "盖章", notes = "盖章")
public ResponseModel<Boolean> stamp(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
......@@ -250,7 +250,7 @@ public class HouseholdContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping (value = "/cancel/{sequenceNbr}")
@ApiOperation(httpMethod = "Post", value = "作废", notes = "作废")
@ApiOperation(httpMethod = "POST", value = "作废", notes = "作废")
public ResponseModel<Boolean> cancel(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(this.canceldata(sequenceNbr));
}
......@@ -298,7 +298,7 @@ public class HouseholdContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping (value = "/reissue")
@ApiOperation(httpMethod = "post", value = "重新发起", notes = "重新发起")
@ApiOperation(httpMethod = "POST", value = "重新发起", notes = "重新发起")
public ResponseModel<HouseholdContract> reissue(@RequestBody HouseholdContract model ) {
HouseholdContract householdContract= householdContractServiceImpl.reissueinitiateHouseholdContract(model);
return ResponseHelper.buildResponse(householdContract);
......
......@@ -374,11 +374,18 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "查询当前登录人权限区域公司", notes = "查询当前登录人权限区域公司")
@GetMapping(value = "/getRegion")
@UserLimits
public ResponseModel< List<DropDown>> getRegion() {
public ResponseModel<List<Map<String,String>>> getRegion() {
List<DropDown> list= jpStationMapper.getRegion();
List<Map<String,String>> result = new ArrayList<>();
list.forEach(dropDown -> {
Map<String,String> item = new HashMap<>();
item.put("text",dropDown.getName());
item.put("value",dropDown.getOrgCode());
result.add(item);
});
return ResponseHelper.buildResponse(list);
return ResponseHelper.buildResponse(result);
}
......@@ -387,9 +394,16 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "查询当前登录人权限经销商", notes = "查询当前登录人权限经销商")
@GetMapping(value = "/getDealer")
@UserLimits
public ResponseModel<List<DropDown>> getDealer(String regionalCompaniesCode ) {
public ResponseModel<List<Map<String,String>>> getDealer(String 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("text",dropDown.getName());
item.put("value",dropDown.getOrgCode());
result.add(item);
});
return ResponseHelper.buildResponse(result);
}
//电站发电量统计
......@@ -616,8 +630,8 @@ public class JpStationController extends BaseController {
@GetMapping(value = "/test")
public Object getPowerqx(JpStationDto reviewDto) {
return jpStationMapper.getJpStation(null);
List<JpStation> list= jpStationServiceImpl.getJpStation(new JpStationDto());
return list;
}
......
......@@ -89,7 +89,7 @@ public class QiyuesuoController extends BaseController {
private String engineering;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "个人token", notes = "个人token")
@ApiOperation(httpMethod = "POST",value = "个人token", notes = "个人token")
@PostMapping (value = "/getUserToken")
public ResponseModel<Object> getSdkResponse(@RequestBody UserAuthMiniappTicketRequest request) {
......@@ -99,7 +99,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "合同token", notes = "合同token")
@ApiOperation(httpMethod = "POST",value = "合同token", notes = "合同token")
@PostMapping (value = "/getContractToken")
public ResponseModel<Object> getContractSdkResponse(@RequestBody ContractMiniappTicketRequest request) {
......@@ -108,7 +108,7 @@ public class QiyuesuoController extends BaseController {
return ResponseHelper.buildResponse(result.getResult());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "合同token", notes = "合同token")
@ApiOperation(httpMethod = "POST",value = "合同token", notes = "合同token")
@PostMapping (value = "/getContractTokengz/{sequenceNbr}")
public ResponseModel<Object> getContractSdkResponseSequenceNbr(@RequestBody ContractMiniappTicketRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
......@@ -122,7 +122,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "创建合同", notes = "创建合同")
@ApiOperation(httpMethod = "POST",value = "创建合同", notes = "创建合同")
@PostMapping (value = "/addContract")
public ResponseModel<HouseholdContract> initiateHouseholdContract(@RequestBody HouseholdContractDto model) {
HouseholdContract householdContract=householdContractServiceImpl.initiateHouseholdContract(model);
......@@ -132,7 +132,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "契约锁回调接口", notes = "契约锁回调接口")
@ApiOperation(httpMethod = "POST",value = "契约锁回调接口", notes = "契约锁回调接口")
@PostMapping (value = "/callback")
public String callback( String content) {
try {
......@@ -231,7 +231,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "获取经销商单位", notes = "liebiao ")
@ApiOperation(httpMethod = "POST",value = "获取经销商单位", notes = "liebiao ")
@PostMapping (value = "/getUnit1000")
public ResponseModel<ContractListResult> getUnit1000(@RequestBody ContractListRequest request) {
......@@ -268,7 +268,7 @@ public class QiyuesuoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "创建合同", notes = "创建合同")
@ApiOperation(httpMethod = "POST",value = "创建合同", notes = "创建合同")
@PostMapping (value = "/getUnit2000")
public ResponseModel<SdkResponse<Object>> getUnit2000(@RequestBody Map<String,String> map) {
......
......@@ -238,7 +238,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
for (int i = 0; i < jpInverterList.size(); i++) {
JpInverter jpInverter = jpInverterList.get(i);
Map<String, String> item = new HashMap<>();
if (StringUtils.isNotEmpty(jpInverter.getSnCode().trim())) {
if (StringUtils.isNotBlank(jpInverter.getSnCode().trim())) {
item.put("name", jpInverter.getSnCode().trim());
item.put("value", jpInverter.getSnCode().trim());
}
......
......@@ -77,17 +77,22 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
/**
* 分页查询
*/
@UserLimits
public Page<JpStationDto> queryForJpStationPagenew(int pageNum, int pageSize, JpStationDto reviewDto) {
PageHelper.startPage(pageNum, pageSize);
List<JpStationDto> list = jpStationMapper.queryForDealerReviewPagenew(reviewDto);
PageInfo<JpStationDto> page = new PageInfo(list);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>();
pagenew.setCurrent(pageNum);
pagenew.setTotal(page.getTotal());
pagenew.setSize(pageSize);
pagenew.setRecords(page.getList());
return pagenew;
Page<JpStationDto> page = new Page<>(pageNum, pageSize);
List<JpStationDto> list = jpStationMapper.queryForDealerReviewPagenew(reviewDto, page );
page.setRecords(list);
// PageInfo<JpStationDto> page = new PageInfo(list);
// com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>();
// pagenew.setCurrent(pageNum);
// pagenew.setTotal(page.getTotal());
// pagenew.setSize(pageSize);
// pagenew.setRecords(page.getList());
return page;
}
@Override
......
## DB properties:
spring.datasource.dynamic.primary= mysql-service
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.password=Yeejoin@2020
spring.datasource.mysql-service.type=com.zaxxer.hikari.HikariDataSource
......
......@@ -202,7 +202,7 @@ public class BigScreenAnalyseController extends BaseController {
public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception {
Map<String, Object> resultMap = new HashMap<>();
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 = new ArrayList<>();
......@@ -220,7 +220,7 @@ public class BigScreenAnalyseController extends BaseController {
}
list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList());
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("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap);
......
......@@ -4,6 +4,7 @@ import static com.yeejoin.amos.boot.biz.common.utils.DateUtils.DATE_TIME_PATTERN
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -121,22 +122,23 @@ public class TDBigScreenAnalyseController extends BaseController {
@Autowired
private IdxBizPvWarningRuleSetServiceImpl idxBizPvWarningRuleSetService;
public final DecimalFormat df = new DecimalFormat("#.0");
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘", notes = "场站设备健康状态指数与趋势 - 仪表盘")
@GetMapping(value = "/getHealthScoreInfo")
public ResponseModel<Map<String, Integer>> getHealthScoreInfo(@RequestParam(required = false) String areaCode,
public ResponseModel<Map<String, Object>> getHealthScoreInfo(@RequestParam(required = false) String areaCode,
@RequestParam(required = false) String stationCode, @RequestParam(required = false) String tableName) {
HashMap<String, Integer> stringBigDecimalHashMap = new HashMap<>();
HashMap<String, Object> stringBigDecimalHashMap = new HashMap<>();
if (CharSequenceUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId();
stringBigDecimalHashMap.put("value", Integer.valueOf(idxBizFanHealthIndexMapper
.getHealthScoreInfoByStation(stationCode, tableName).toString().replace(".0", "")));
stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper
.getHealthScoreInfoByStation(stationCode, tableName));
return ResponseHelper.buildResponse(stringBigDecimalHashMap);
}
stringBigDecimalHashMap.put("value", Integer.valueOf(idxBizFanHealthIndexMapper
.getHealthScoreInfoByLatest(areaCode, stationCode).toString().replace(".0", "")));
stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper
.getHealthScoreInfoByLatest(areaCode, stationCode));
return ResponseHelper.buildResponse(stringBigDecimalHashMap);
}
......@@ -144,16 +146,23 @@ public class TDBigScreenAnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图")
@GetMapping(value = "/getHealthListInfo")
public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode,
@RequestParam(required = false) String stationCode, @RequestParam(required = false) String analysisType,
@RequestParam(required = false) String stationCode, @RequestParam(required = false) String area,
@RequestParam(required = false) String station, @RequestParam(required = false) String analysisType,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId();
} else if (StrUtil.isNotEmpty(station)) {
StationBasic stationBasic = stationBasicMapper.selectOne(new LambdaQueryWrapper<StationBasic>()
.like(StationBasic::getStationName, station.substring(0, station.length() - 1)));
stationCode = stationBasic.getFanGatewayId();
}
if (StrUtil.isNotEmpty(areaCode)) {
areaCode = "%" + areaCode + "%";
} else if (StrUtil.isNotEmpty(area)) {
areaCode = "%" + area + "%";
}
HashMap<String, Object> resultMap = new HashMap<>();
......@@ -293,12 +302,8 @@ public class TDBigScreenAnalyseController extends BaseController {
@GetMapping(value = "/getHealthInfoByArea")
public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception {
Map<String, Object> resultMap = new HashMap<>();
// List<Map<String, Object>> healthListInfo =
// idxBizFanHealthIndexMapper.getHealthInfoByArea();
List<Map<String, Object>> healthListInfo = fanHealthIndexDayMapper.getHealthInfoByArea();
Map<String, Integer> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(),
t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", ""))));
// List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区");
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByArea();
Map<String, Object> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> t.get("healthIndex")));
List<String> list = new ArrayList<>();
......@@ -315,7 +320,7 @@ public class TDBigScreenAnalyseController extends BaseController {
}
list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList());
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("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap);
......@@ -424,7 +429,7 @@ public class TDBigScreenAnalyseController extends BaseController {
List<Object> seriesData = new ArrayList<>();
healthListInfo.forEach(item -> {
list.add(item.get("station").toString());
seriesData.add(item.get("healthIndex").toString().replace(".0", ""));
seriesData.add(item.get("healthIndex"));
});
resultMap.put("axisData", list);
resultMap.put("seriesData", seriesData);
......@@ -563,8 +568,8 @@ public class TDBigScreenAnalyseController extends BaseController {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getSubSystemInfo(equipmentName,
stationBasic.getFanGatewayId());
Map<Object, Integer> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(
t -> t.get("subSystem"), t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", ""))));
Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(
t -> t.get("subSystem"), t -> t.get("healthIndex")));
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
......@@ -572,7 +577,7 @@ public class TDBigScreenAnalyseController extends BaseController {
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper
.getSumSystemListByEquipment(stationBasic.getFanGatewayId(), equipmentName);
equipmentList.forEach(item -> {
Integer equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subSystem"), 100);
Object equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subSystem"), 100.0);
seriesData.add(equipmentHealthScore);
axisData.add(item.get("subSystem"));
});
......@@ -671,7 +676,7 @@ public class TDBigScreenAnalyseController extends BaseController {
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvSubSystemInfo(subarray,
stationBasic.getFanGatewayId());
Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors
.toMap(t -> t.get("equipmentName"), t -> t.get("avgHealthIndex").toString().replace(".0", "")));
.toMap(t -> t.get("equipmentName"), t -> t.get("avgHealthIndex")));
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
......@@ -679,7 +684,7 @@ public class TDBigScreenAnalyseController extends BaseController {
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper
.getPvSumSystemListByEquipment(stationBasic.getFanGatewayId(), subarray);
equipmentList.forEach(item -> {
Object equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100);
Object equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100.0);
seriesData.add(equipmentHealthScore);
axisData.add(item.get("equipmentName"));
});
......@@ -758,8 +763,8 @@ public class TDBigScreenAnalyseController extends BaseController {
} catch (ParseException e) {
}
time.add(date);
String value = CharSequenceUtil.isEmpty(item.get("healthindex").toString().replace(".0", "")) ? "100"
: item.get("healthindex").toString().replace(".0", "");
String value = CharSequenceUtil.isEmpty(item.get("healthindex").toString()) ? "100.0"
: item.get("healthindex").toString();
valueList.add(value);
});
List<Map<String, Object>> arrayList = new ArrayList<>();
......
......@@ -119,7 +119,7 @@
</select>
<select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal">
SELECT
CEILING(IFNULL( HEALTH_INDEX , 100 )) AS healthIndex
round(IFNULL( HEALTH_INDEX , 100 ), 1) AS healthIndex
FROM
${tableName}
<where>
......@@ -205,11 +205,11 @@
</select>
<select id="getHealthInfoByArea" resultType="java.util.Map">
SELECT ARAE as area,
CEILING(avg(a.avgHealthIndex)) AS healthIndex
round(avg(a.avgHealthIndex), 1) AS healthIndex
FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
ARAE
FROM idx_biz_fan_health_index
FROM fan_health_index_latest_data
WHERE ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
......@@ -218,7 +218,7 @@
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
ARAE
FROM idx_biz_pv_health_index
FROM pv_health_index_latest_data
WHERE ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
......@@ -267,14 +267,14 @@
<select id="getHealthInfoByStation" resultType="java.util.Map">
SELECT
a.STATION as station,
CEILING(avg( a.avgHealthIndex )) AS healthIndex
round(avg( a.avgHealthIndex ), 1) AS healthIndex
FROM
(
SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
STATION
FROM
idx_biz_fan_health_index
fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天'
......@@ -290,7 +290,7 @@
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
STATION
FROM
idx_biz_pv_health_index
pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天'
......@@ -434,7 +434,7 @@
</select>
<select id="getSubSystemInfo" resultType="java.util.Map">
SELECT
CEILING(IFNULL( HEALTH_INDEX, 100 )) AS healthIndex,
round(IFNULL( HEALTH_INDEX, 100 ), 1) AS healthIndex,
SUB_SYSTEM AS subSystem
FROM
fan_health_index_latest_data
......@@ -599,7 +599,7 @@
</select>
<select id="getPvSubSystemInfo" resultType="java.util.Map">
SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
round(IFNULL( AVG( HEALTH_INDEX ), 100 ), 1) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName
FROM
pv_health_index_latest_data
......@@ -1538,7 +1538,7 @@
</select>
<select id="getHealthScoreInfoByLatest" resultType="java.math.BigDecimal">
SELECT
CEILING(avg( a.avgHealthIndex )) AS healthIndex
round(avg( a.avgHealthIndex ), 1) AS healthIndex
FROM
(
SELECT
......
......@@ -4,7 +4,7 @@
<select id="getHealthInfoByArea" resultType="java.util.Map">
select area as area,
ceil(avg(a.avghealthindex)) as healthIndex
avg(a.avghealthindex) as healthIndex
from (
select avg(health_index) as avghealthindex,
area
......
......@@ -161,4 +161,10 @@ public class PersonBasic extends BaseEntity {
*/
@TableField("qrcode_desc")
private String qrcodeDesc;
/**
* 赋码颜色描述
*/
@TableField("qrcode_date")
private Date qrcodeDate;
}
......@@ -27,6 +27,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
......@@ -284,8 +285,11 @@ public class PersonQrCodeController extends BaseController {
item.put("name", name);
item.put("faultInfo", "该存在缺陷或者告警");
item.put("faultLevel", "严重");
if (!Objects.isNull(score)) {
item.put("mark", new BigDecimal(100).subtract(score));
if (!Objects.isNull(score) && equipYardByPageCount != 0) {
BigDecimal divide = new BigDecimal(100).subtract(score).divide(BigDecimal.valueOf(equipYardByPageCount), 10, 2);
BigDecimal bigDecimal = divide.setScale(PersonBasicServiceImpl.getNonZeroDecimalPlaces(divide), RoundingMode.HALF_UP);
item.put("mark", bigDecimal);
}
});
resultList.setRecords(equipYardByPage);
......@@ -300,8 +304,11 @@ public class PersonQrCodeController extends BaseController {
item.put("name", name);
item.put("faultInfo", "该任务超时");
item.put("faultLevel", "严重");
if (!Objects.isNull(score)) {
item.put("mark", new BigDecimal(100).subtract(score));
if (!Objects.isNull(score) && jobYardByPageCount != 0) {
BigDecimal divide = new BigDecimal(100).subtract(score).divide(BigDecimal.valueOf(jobYardByPageCount), 10, 2);
BigDecimal bigDecimal = divide.setScale(PersonBasicServiceImpl.getNonZeroDecimalPlaces(divide), RoundingMode.HALF_UP);
item.put("mark", bigDecimal);
}
});
resultList.setRecords(jobYardByPage);
......
......@@ -23,6 +23,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -128,8 +129,10 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
item.put("name", name);
item.put("faultInfo", "证书不全或临期");
item.put("faultLevel", "严重");
if (!Objects.isNull(score)) {
item.put("mark", new BigDecimal(100).subtract(score));
if (!Objects.isNull(score) && count != 0) {
BigDecimal divide = new BigDecimal(100).subtract(score).divide(BigDecimal.valueOf(count), 10, 2);
BigDecimal bigDecimal = divide.setScale(getNonZeroDecimalPlaces(divide), RoundingMode.HALF_UP);
item.put("mark", bigDecimal);
}
});
Page<Map<String, Object>> mapPage = new Page<>();
......@@ -140,6 +143,20 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
return mapPage;
}
public static int getNonZeroDecimalPlaces(BigDecimal number) {
String str = number.stripTrailingZeros().toPlainString();
int index = str.indexOf(".");
if (index < 0) {
return 0;
}
for (int i = index + 1; i < str.length(); i++) {
if (str.charAt(i) != '0') {
return i - index;
}
}
return 0;
}
public Map<String, Object> getPersonDetailInfoByObjectId(String objectId) {
Map<String, Object> resultMap = personBasicMapper.getPersonDetailInfoByObjectId(objectId);
return resultMap;
......
......@@ -2,7 +2,7 @@
{
"title": "逆变器台数",
"title1": "逆变器台数(台)",
"url": "upload/jxiop/amos_studio/EA3572E1BD31DC1E7D8DA162F09ECB.png"
"url": "upload/jxiop/amos_studio/4C82F011332D3EE6E378B7DF2E2F483.png"
},
{
"title": "装机容量",
......
......@@ -14,6 +14,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
......@@ -68,19 +69,27 @@ public class PersonYardMessage extends EmqxListener {
};
public void jxIopUpdate(JSONObject analysisResult) {
try {
Thread.sleep(10000); // 等待3秒
log.info("人员赋码数据:{}", analysisResult);
String warningObjectCode = String.valueOf(analysisResult.get("warningObjectCode"));
String codeColor = String.valueOf(analysisResult.get("codeColor"));
PersonBasic personBasic = personBasicMapper.selectById(warningObjectCode);
if (ObjectUtils.isEmpty(personBasic)) {
try {
emqKeeper.getMqttClient().publish("ryfm/warning/coding", analysisResult.toJSONString().getBytes(), 2, Boolean.FALSE);
} catch (MqttException e) {
e.printStackTrace();
}
} else {
log.info("人员基础信息:{}", JSON.toJSONString(personBasic));
// if (ObjectUtils.isEmpty(personBasic)) {
// try {
// emqKeeper.getMqttClient().publish("ryfm/warning/coding", analysisResult.toJSONString().getBytes(), 2, Boolean.FALSE);
// } catch (MqttException e) {
// e.printStackTrace();
// }
// } else {
personBasic.setQrcodeColor(codeColor);
personBasic.setQrcodeDate(new Date());
personBasicMapper.updateById(personBasic);
} catch (InterruptedException e) {
e.printStackTrace();
}
// }
}
}
......@@ -186,7 +186,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
PersonBasic personBasic = new PersonBasic();
BeanUtils.copyProperties(personUser, personBasic);
//默认红码
// personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDesc("证书不全");
// 该岗位应获得的证书
List<String> list2 = new ArrayList<>();
......@@ -221,17 +221,27 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) {
personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode());
personBasic.setQrcodeDesc("证书齐全");
} else if (CollectionUtils.isEmpty(list) && isOver == 1) {
// personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDate(new Date());
} else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) {
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDesc("证书不全");
personBasic.setQrcodeDate(new Date());
} else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) {
// personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeDesc("证书临期");
personBasic.setQrcodeDate(new Date());
}
this.baseMapper.insert(personBasic);
CompanyModel companyModel = new CompanyModel();
//单位
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())) {
personBasic.setProjectOrgCode(companyModel.getOrgCode());
personAccount.setProjectName(companyModel.getCompanyName());
......@@ -308,15 +318,15 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
//personBasic.setProjectOrgCode(departmentModel.getOrgCode());
personAccount.setProjectDepartmentName(departmentModel.getDepartmentName());
}
personBasic.setProjectOrgCode(companyModel.getOrgCode());
if (personUser.getNativePlace()!=null) {
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
}
// personBasic.setProjectOrgCode(companyModel.getOrgCode());
//
//
// if (personUser.getNativePlace()!=null) {
// personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
// }
personAccount.setPuserId(agencyUserModel.getUserId());
personAccount.setProjectName(companyModel.getCompanyName());
this.personBasicMapper.updateById(personBasic);
// this.personBasicMapper.updateById(personBasic);
this.personAccountService.updateById(personAccount);
PersonAccountFed personAccountFed = new PersonAccountFed();
......@@ -412,48 +422,21 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
if (CollectionUtils.isEmpty(list) && isInMonth == 0 && isOver == 0) {
personBasic.setQrcodeColor(QrcodeColorEnum.GREEN.getCode());
personBasic.setQrcodeDesc("证书齐全");
} else if (CollectionUtils.isEmpty(list) && isOver == 1) {
// personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDate(new Date());
} else if ((CollectionUtils.isEmpty(list) && isOver == 1) || (CollectionUtils.isNotEmpty(list))) {
personBasic.setQrcodeColor(QrcodeColorEnum.RED.getCode());
personBasic.setQrcodeDesc("证书不全");
personBasic.setQrcodeDate(new Date());
} else if (CollectionUtils.isEmpty(list) && isOver == 0 && isInMonth == 1) {
// personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
personBasic.setQrcodeDesc("证书临期");
personBasic.setQrcodeDate(new Date());
}
personBasic.setProjectOrgCode(companyModel.getOrgCode());
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);
......@@ -501,7 +484,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
if (personAccount.getDepartmentId() != null) {
departmentModel = this.getdepartmentModel(personAccount.getDepartmentId());
}
BeanUtils.copyProperties(personUser, personBasic);
BeanUtils.copyProperties(personUser, personBasic, "qrcodeDesc", "qrcodeColor");
if (departmentModel != null) {
//personBasic.setProjectOrgCode(departmentModel.getOrgCode());
personAccount.setProjectDepartmentName(departmentModel.getDepartmentName());
......@@ -512,7 +495,40 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
personBasic.setNativePlace(JSON.toJSONString(personUser.getNativePlace()));
}
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();
}
}
} else {
this.personBasicMapper.updateById(personBasic);
}
personAccountService.updateById(personAccount);
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