Commit 42753a79 authored by caotao's avatar caotao

智能分析指标权限配置权限过滤问题处理

parent 357809bf
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectentity.StdUserEmpower;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper.UserEmpowerMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.core.framework.GatewayIdAutowired;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
......@@ -44,7 +49,7 @@ import static com.yeejoin.amos.boot.biz.common.utils.DateUtils.DATE_TIME_PATTERN
@RestController
@Api(tags = "智能分析相关API - TD数据源")
@RequestMapping(value = "/tdInfoQueryApi")
public class TdInfoQueryController {
public class TdInfoQueryController extends BaseController {
@Autowired
private FanHealthIndexMapper fanHealthIndexMapper;
......@@ -67,13 +72,23 @@ public class TdInfoQueryController {
@Autowired
IdxBizFanHealthIndexMapper idxBizFanHealthIndexMapper;
public final DecimalFormat df = new DecimalFormat("#.0");
@Autowired
UserEmpowerMapper userEmpowerMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanHealthIndexInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电")
@GatewayIdAutowired
public ResponseModel<Page<FanHealthIndex>> getFanHealthIndexInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
String orgCode = "86";
if (!ObjectUtils.isEmpty(stdUserEmpower)) {
orgCode = stdUserEmpower.getAmosOrgCode().get(0);
}
dto.setOrgCode(orgCode);
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate();
Date date = DateUtils.dateParse(startDate, DATE_TIME_PATTERN);
......@@ -142,6 +157,14 @@ public class TdInfoQueryController {
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏")
@GatewayIdAutowired
public ResponseModel<Page<PvHealthIndex>> getPvHealthIndexInfo(@RequestBody PvHealthIndexDto dto) throws ParseException {
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
String orgCode = "86";
if (!ObjectUtils.isEmpty(stdUserEmpower)) {
orgCode = stdUserEmpower.getAmosOrgCode().get(0);
}
dto.setOrgCode(orgCode);
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate();
Date date = DateUtils.dateParse(startDate, DATE_TIME_PATTERN);
......
......@@ -44,5 +44,6 @@ public class FanHealthIndexDto implements Serializable {
private String subarray;
private String sortOne;
private String sortsString;
private String orgCode;
private List<String> gatewayIds;
}
......@@ -45,5 +45,6 @@ public class PvHealthIndexDto {
private String orderColumns;
private String sortOne;
private String sortsString;
private String orgCode;
private List<String> gatewayIds;
}
......@@ -470,6 +470,7 @@ public class HealthStatusIndicatorServiceImpl {
pvWarningRecord.setRecDate(format);
pvWarningRecord.setTs(timestamp);
pvWarningRecord.setHealthIndex(String.format(CommonConstans.Onedecimalplaces,idxBizPvHealthIndices.get(0).getHealthIndex()));
pvWarningRecord.setOrgCode(idxBizPvHealthIndices.get(0).getOrgCode());
tdPvWarningRecordList.add(pvWarningRecord);
}
}
......@@ -635,6 +636,7 @@ public class HealthStatusIndicatorServiceImpl {
pvWarningRecord.setRecDate(format);
pvWarningRecord.setTs(timestamp);
pvWarningRecord.setHealthIndex(String.format(CommonConstans.Onedecimalplaces,idxBizPvHealthIndices.get(0).getHealthIndex()));
pvWarningRecord.setOrgCode(idxBizPvHealthIndices.get(0).getOrgCode());
tdPvWarningRecordList.add(pvWarningRecord);
}
}
......
......@@ -416,7 +416,8 @@
`ANOMALY`,
`POINT_NAME`,
`ANALYSIS_TIME`,
`KKS`
`KKS`,
`ORG_CODE`
)
values
<foreach collection="list" separator="," item="item" index="index">
......@@ -442,6 +443,7 @@
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR}
#{item.orgCode, jdbcType=VARCHAR}
)
</foreach>
</insert>
......
......@@ -177,6 +177,9 @@
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}
</if>
</where>
<if test="dto.orgCode != null and dto.orgCode != ''">
org_code like CONCAT(#{dto.orgCode},'%')
</if>
<if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns}
</if>
......@@ -202,6 +205,9 @@
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}
</if>
</where>
<if test="dto.orgCode != null and dto.orgCode != ''">
org_code like CONCAT(#{dto.orgCode},'%')
</if>
</select>
<select id="saveBatchHealthIndexLatestInfo" resultType="int">
......
......@@ -115,6 +115,7 @@
subarray,
equipment_name,
avg(anomaly) as anomaly,
org_code,
AVG(health_index) as health_index
from
#{tableName}
......@@ -138,6 +139,7 @@
area,
subarray,
avg(anomaly) as anomaly,
org_code,
AVG(health_index) as health_index
from
#{tableName}
......@@ -159,6 +161,7 @@
'场站' as analysis_obj_type,
area,
avg(anomaly) as anomaly,
org_code,
AVG(health_index) as health_index
from
#{tableName}
......@@ -177,6 +180,7 @@
'片区' as analysis_obj_type,
area,
avg(anomaly) as anomaly,
org_code,
AVG(health_index) as health_index
from
#{tableName}
......@@ -203,6 +207,9 @@
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}
</if>
</where>
<if test="dto.orgCode != null and dto.orgCode != ''">
org_code like CONCAT(#{dto.orgCode},'%')
</if>
<if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns}
</if>
......@@ -227,6 +234,9 @@
<if test="dto.equipmentName!= null and dto.equipmentName!= ''">AND equipment_name = #{dto.equipmentName}
</if>
</where>
<if test="dto.orgCode != null and dto.orgCode != ''">
org_code like CONCAT(#{dto.orgCode},'%')
</if>
</select>
<select id="saveBatchHealthIndexLatestInfo" resultType="int">
......@@ -255,6 +265,7 @@
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR}
#{item.orgCode, jdbcType=VARCHAR}
)
</foreach>
</select>
......
package com.yeejoin.amos.boot.module.jxiop.api.feign;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@FeignClient(name = "${amos.jxiop.name:AMOS-JXIOP}", path = "jxiop", configuration = {FeignConfiguration.class})
public interface JxiopServiceFeignClient {
@GetMapping(value = "/auth/getJxiopOrgCode")
FeignClientResult<String> getJxiopOrgCode() throws InnerInvokException;
}
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