Commit 7ed073d5 authored by hezhuozhi's avatar hezhuozhi

解决风机健康状态不展示、区域不显示、待确认数量统计报错

parent a1c9d322
......@@ -15,7 +15,7 @@ import java.util.Map;
* @createDate: 2023/11/9
*/
public interface UserEmpowerMapper extends BaseMapper<StdUserEmpower> {
@Select("select company_name as companyName , level_ from privilege_company where org_code = #{orgCode}")
@Select("select company_name as companyName , `level` from privilege_company where org_code = #{orgCode}")
CompanyModel getCompanyInfoByOrgCode(String orgCode);
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanHealthLevelDto;
......@@ -15,7 +16,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
*
......@@ -105,7 +105,7 @@ public class IdxBizFanHealthLevelController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "健康等级划分", notes = "健康等级划分")
@GetMapping(value = "/queryHealthLevel")
public ResponseModel<List<Map<String,Object>>> queryHealthLevel() {
public ResponseModel<JSONObject> queryHealthLevel() {
return ResponseHelper.buildResponse(idxBizFanHealthLevelServiceImpl.queryHealthLevel());
}
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanHealthLevelDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
......@@ -18,7 +21,7 @@ import java.util.Map;
* @date 2023-08-15
*/
@Service
public class IdxBizFanHealthLevelServiceImpl extends BaseService<IdxBizFanHealthLevelDto,IdxBizFanHealthLevel,IdxBizFanHealthLevelMapper> implements IIdxBizFanHealthLevelService {
public class IdxBizFanHealthLevelServiceImpl extends BaseService<IdxBizFanHealthLevelDto, IdxBizFanHealthLevel, IdxBizFanHealthLevelMapper> implements IIdxBizFanHealthLevelService {
/**
* 分页查询
*/
......@@ -37,7 +40,62 @@ public class IdxBizFanHealthLevelServiceImpl extends BaseService<IdxBizFanHealth
* 查询健康等级
* @return
*/
public List<Map<String,Object>> queryHealthLevel() {
return this.baseMapper.queryHealthLevel();
public JSONObject queryHealthLevel() {
List<Map<String, Object>> maps = this.baseMapper.queryHealthLevel();
JSONObject result = new JSONObject();
result.put("colModel", buildColModel());
result.put("dataGridMock", buildDataGridMock(maps));
return result;
}
private JSONObject buildDataGridMock(List<Map<String, Object>> maps) {
JSONObject result = new JSONObject();
JSONArray dataList = new JSONArray();
if (CollectionUtil.isNotEmpty(maps)) {
result.put("total", maps.size());
int i = 0;
for (Map<String, Object> map : maps) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("_id", ++i);
jsonObject.put("title2_measure", map.get("GROUP_UPPER_LIMIT"));
jsonObject.put("title3_measure", map.get("GROUP_LOWER_LIMIT"));
dataList.add(jsonObject);
}
}
result.put("totalPage", 1);
result.put("pageSize", 10);
result.put("current", 1);
result.put("pagination", false);
result.put("dataList", dataList);
return result;
}
private JSONArray buildColModel() {
JSONArray result = new JSONArray();
JSONObject dengji = new JSONObject();
dengji.put("fid", "title1_measure");
dengji.put("dataIndex", "title1_measure");
dengji.put("name", "title1");
dengji.put("title", "健康等级");
dengji.put("type", "dataGrid");
dengji.put("key", "title1_measure");
JSONObject sx = new JSONObject();
sx.put("fid", "title2_measure");
sx.put("dataIndex", "title2_measure");
sx.put("name", "title2");
sx.put("title", "区间上限值");
sx.put("type", "dataGrid");
sx.put("key", "title2_measure");
JSONObject xx = new JSONObject();
xx.put("fid", "title3_measure");
xx.put("dataIndex", "title3_measure");
xx.put("name", "title3");
xx.put("title", "区间下限值");
xx.put("type", "dataGrid");
xx.put("key", "title3_measure");
result.add(dengji);
result.add(sx);
result.add(xx);
return result;
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@ import java.util.Map;
public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex,rec_date as recDate, `health_index` AS `value`, rec_date AS recDate, anomaly, substr(analysis_time,1,10) as analysisTime,station,equipment_name AS equipmentName, point_name as pointName, index_address as indexAddress, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"SELECT distinct `health_index` AS healthIndex,rec_date as recDate, `health_index` AS `value`, rec_date AS recDate, anomaly, substr(analysis_time,1,10) as analysisTime,station,equipment_name AS equipmentName, point_name as pointName, index_address as indexAddress, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......@@ -42,7 +42,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Select("<script>"+
"SELECT count(1)" +
"SELECT count(1) FROM (SELECT distinct `health_index` AS healthIndex,rec_date as recDate, `health_index` AS `value`, anomaly, substr(analysis_time,1,10) as analysisTime,station,equipment_name AS equipmentName, point_name as pointName, index_address as indexAddress, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......@@ -54,7 +54,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
// "<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"<if test='orgCode!= null'>AND org_code like '${orgCode}' </if>" +
"<if test='orgCode!= null'>AND org_code like '${orgCode}' </if>)" +
"</script>")
int selectDataTotal(@Param("station")String station,@Param("analysisType")String analysisType,@Param("indexAddress")String indexAddress,@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("analysisObjType")String analysisObjType, @Param("subarray")String subarray, @Param("pointName")String pointName,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("equipmentName")String equipmentName,@Param("orgCode") String orgCode);
......
......@@ -10,7 +10,7 @@ import java.util.Map;
public interface PrivilegeCompanyMapper extends BaseMapper<PrivilegeCompany> {
@Select("select SEQUENCE_NBR as sequenceNbr,ORG_CODE as orgCode,COMPANY_NAME as companyName ,LEVEL from privilege_company where COMPANY_TYPE = 'region' and IS_DELETED = 0 ")
@Select("select SEQUENCE_NBR as sequenceNbr,ORG_CODE as orgCode,COMPANY_NAME as companyName ,`LEVEL` from privilege_company where COMPANY_TYPE = 'region' and IS_DELETED = 0 ")
public List<PrivilegeCompany> getAreaCompany();
......
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