Commit 1c60cdf5 authored by chenzhao's avatar chenzhao

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

parents 43543883 9aa7053c
...@@ -1035,8 +1035,8 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -1035,8 +1035,8 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
} }
// List<JpInverter> jpInverter1 = jpInverterMapper.selectList(new QueryWrapper<JpInverter>(). List<JpInverter> jpInverter1 = jpInverterMapper.selectList(new QueryWrapper<JpInverter>().
// eq("third_code", PVProducerInfoEnum.KSOLAR.getCode())); eq("third_code", PVProducerInfoEnum.KSOLAR.getCode()));
...@@ -1059,8 +1059,19 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -1059,8 +1059,19 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
SimpleDateFormat sdf = new SimpleDateFormat(pattern); SimpleDateFormat sdf = new SimpleDateFormat(pattern);
Date startTimeL = sdf.parse(startTime); Date startTimeL = sdf.parse(startTime);
Date recoverTimeL = sdf.parse(recoverTime); Date recoverTimeL = sdf.parse(recoverTime);
String snCode=null;
if(jpInverter1!=null&&!jpInverter1.isEmpty()){
for (JpInverter jpInverter : jpInverter1) {
if(jpInverter.getCollectorId().equals(ksolarAlarmDto.getDeviceId())){
snCode=jpInverter.getCollectorSnCode();
break;
}
}
}
HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>() HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code", ksolarAlarmDto.getAlarmId()) .eq("sn_code",snCode)
.eq("start_time", startTimeL.getTime()) .eq("start_time", startTimeL.getTime())
.eq("third_code", PVProducerInfoEnum.KSOLAR.getCode()) .eq("third_code", PVProducerInfoEnum.KSOLAR.getCode())
.eq("third_station_id", ksolarAlarmDto.getStationId()) .eq("third_station_id", ksolarAlarmDto.getStationId())
...@@ -1071,15 +1082,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -1071,15 +1082,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
hygfjpInverterWarn.setTime(System.currentTimeMillis()); hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis()); hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(snCode);
// if(jpInverter1!=null&&!jpInverter1.isEmpty()){
// for (JpInverter jpInverter : jpInverter1) {
// if(jpInverter.getCollectorId().equals(ksolarAlarmDto.getDeviceId())){
// hygfjpInverterWarn.setSnCode(jpInverter.getCollectorSnCode());
// break;
// }
// }
// }
hygfjpInverterWarn.setThirdStationId(ksolarAlarmDto.getStationId()); hygfjpInverterWarn.setThirdStationId(ksolarAlarmDto.getStationId());
hygfjpInverterWarn.setLevel(KSolarConstant.alarmLevel.get(ksolarAlarmDto.getLevels())); hygfjpInverterWarn.setLevel(KSolarConstant.alarmLevel.get(ksolarAlarmDto.getLevels()));
hygfjpInverterWarn.setContent(ksolarAlarmDto.getMessage()); hygfjpInverterWarn.setContent(ksolarAlarmDto.getMessage());
......
...@@ -50,17 +50,12 @@ public class UserEmpowerInterceptor implements Interceptor { ...@@ -50,17 +50,12 @@ public class UserEmpowerInterceptor implements Interceptor {
@Override @Override
public Object intercept(Invocation invocation) throws Throwable { public Object intercept(Invocation invocation) throws Throwable {
try { try {
StatementHandler statementHandler = PluginUtils.realTarget(invocation.getTarget()); StatementHandler statementHandler = PluginUtils.realTarget(invocation.getTarget());
MetaObject metaObject = SystemMetaObject.forObject(statementHandler); MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement"); MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
//获取方法注解 //获取方法注解
Method method = getTargetDataAuthMethod(mappedStatement); Method method = getTargetDataAuthMethod(mappedStatement);
UserEmpower userEmpower = getTargetDataAuthAnnotation(mappedStatement); UserEmpower userEmpower = getTargetDataAuthAnnotation(mappedStatement);
if(userEmpower==null){ if(userEmpower==null){
return invocation.proceed(); return invocation.proceed();
} }
...@@ -71,10 +66,7 @@ public class UserEmpowerInterceptor implements Interceptor { ...@@ -71,10 +66,7 @@ public class UserEmpowerInterceptor implements Interceptor {
//获取 参数之间关系 //获取 参数之间关系
String fileBetweenCondition= userEmpower.relationship(); String fileBetweenCondition= userEmpower.relationship();
//获取参数值, //获取参数值,
Vector<String> orgCode = UserEmpowerThreadLocal.getDataAuthRule(); List<String> orgCode = UserEmpowerThreadLocal.getDataAuthRule();
BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql"); BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql");
//获取sql //获取sql
String sql = boundSql.getSql(); String sql = boundSql.getSql();
...@@ -135,7 +127,7 @@ public class UserEmpowerInterceptor implements Interceptor { ...@@ -135,7 +127,7 @@ public class UserEmpowerInterceptor implements Interceptor {
} }
private List<String> selectSql(String[] filed,String[] fileCondition, Vector<String> data){ private List<String> selectSql(String[] filed,String[] fileCondition, List<String> data){
List<String> sql=new ArrayList<>(); List<String> sql=new ArrayList<>();
if(filed!=null&&filed.length>0&&fileCondition!=null&&fileCondition.length>0&&data!=null&&data.size()>0){ if(filed!=null&&filed.length>0&&fileCondition!=null&&fileCondition.length>0&&data!=null&&data.size()>0){
......
...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.hygf.api.config; ...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.hygf.api.config;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Vector; import java.util.Vector;
/** /**
...@@ -18,11 +20,11 @@ public class UserEmpowerThreadLocal { ...@@ -18,11 +20,11 @@ public class UserEmpowerThreadLocal {
return requestContext.get(); return requestContext.get();
} }
public static Vector<String> getDataAuthRule() { public static List<String> getDataAuthRule() {
return getPermissionInterceptorContext().getThreadLocalData(); return getPermissionInterceptorContext().getThreadLocalData();
} }
public static void setDataAuthRule(Vector<String> dataAuthRule) { public static void setDataAuthRule(List<String> dataAuthRule) {
getPermissionInterceptorContext().setDataAuthRule(dataAuthRule); getPermissionInterceptorContext().setDataAuthRule(dataAuthRule);
} }
......
package com.yeejoin.amos.boot.module.hygf.api.config; package com.yeejoin.amos.boot.module.hygf.api.config;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import java.util.Vector; import java.util.Vector;
/** /**
...@@ -11,13 +12,13 @@ import java.util.Vector; ...@@ -11,13 +12,13 @@ import java.util.Vector;
public class UserEmpowerThreadLocalModel implements Serializable { public class UserEmpowerThreadLocalModel implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Vector<String> threadLocalData; private List<String> threadLocalData;
public Vector<String> getThreadLocalData() { public List<String> getThreadLocalData() {
return threadLocalData; return threadLocalData;
} }
public void setDataAuthRule(Vector<String> threadLocalData) { public void setDataAuthRule(List<String> threadLocalData) {
this.threadLocalData = threadLocalData; this.threadLocalData = threadLocalData;
} }
......
...@@ -48,17 +48,11 @@ public class UserLimitsAdvice { ...@@ -48,17 +48,11 @@ public class UserLimitsAdvice {
// 获取该方法上的 OpenApi注解 // 获取该方法上的 OpenApi注解
// UserLimits aspectAnnotation = method.getAnnotation(UserLimits.class); // UserLimits aspectAnnotation = method.getAnnotation(UserLimits.class);
// String userid=RequestContext.getExeUserId(); String userid=RequestContext.getExeUserId();
// LambdaQueryWrapper<StdUserEmpower> qu=new LambdaQueryWrapper(); LambdaQueryWrapper<StdUserEmpower> qu=new LambdaQueryWrapper();
// qu.eq(StdUserEmpower::getAmosUserId,userid); qu.eq(StdUserEmpower::getAmosUserId,userid);
// StdUserEmpower list= userEmpowerMapper.selectOne(qu); StdUserEmpower list= userEmpowerMapper.selectOne(qu);
UserEmpowerThreadLocal.setDataAuthRule(list!=null?list.getAmosOrgCode():null);
Vector<String> list=new Vector<>();
list.add("55555");
list.add("66666");
UserEmpowerThreadLocal.setDataAuthRule(list!=null?(Vector<String>) list:null);
//正常往后执行 //正常往后执行
return joinPoint.proceed(); return joinPoint.proceed();
} }
......
...@@ -19,8 +19,10 @@ import java.util.Map; ...@@ -19,8 +19,10 @@ import java.util.Map;
public interface JpStationMapper extends BaseMapper<JpStation> { public interface JpStationMapper extends BaseMapper<JpStation> {
List<JpStationDto> queryForDealerReviewPage(@Param("dto") JpStationDto reviewDto); List<JpStationDto> queryForDealerReviewPage(@Param("dto") JpStationDto reviewDto);
JpStationDto queryCount(@Param("dto") JpStationDto reviewDto); JpStationDto queryCount(@Param("dto") JpStationDto reviewDto);
@UserEmpower(field ={"aaa","bbb"} ,fieldConditions ={"in","in"} ,relationship="and")
List<Map<String,Object>> countState(@Param("dto") JpStationDto reviewDto); List<Map<String,Object>> countState(@Param("dto") JpStationDto reviewDto);
List<Map<String,Double>> getPowerqx(String dateType); List<Map<String,Double>> getPowerqx(String dateType);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
List<JpStation> getJpStation();
} }
...@@ -153,4 +153,13 @@ ...@@ -153,4 +153,13 @@
</select> </select>
<select id="getJpStation" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.JpStation">
select
`sequence_nbr` sequenceNbr,
third_station_id thirdStationId
from hygf_jp_station
where is_delete=0
</select>
</mapper> </mapper>
...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper; ...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser; import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser;
import org.omg.CORBA.OBJ_ADAPTER;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -349,11 +350,10 @@ public class JpStationController extends BaseController { ...@@ -349,11 +350,10 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "工率曲线", notes = "电站监控电量收益") @ApiOperation(httpMethod = "GET",value = "工率曲线", notes = "电站监控电量收益")
@GetMapping(value = "/test") @GetMapping(value = "/test")
@UserLimits @UserLimits
public ResponseModel< Map<String, List<Object>>> getPowerqx() { public Object getPowerqx() {
jpStationMapper.countState(new JpStationDto()); return jpStationMapper.getJpStation();
return null;
} }
} }
...@@ -334,10 +334,10 @@ public class KafkaAnalyseController { ...@@ -334,10 +334,10 @@ public class KafkaAnalyseController {
} }
} }
} }
stationDto.setScoreRange("(最高:" + stationLowScore + "分, 最低:" + stationHighScore + "分)"); stationDto.setScoreRange("(最低:" + stationLowScore + "分, 最高:" + stationHighScore + "分)");
} }
areaMapDto.setScoreRange("(最高:" + areaLowScore + "分, 最低:" + areaHighScore + "分)"); areaMapDto.setScoreRange("(最低:" + areaLowScore + "分, 最高:" + areaHighScore + "分)");
} }
List<FullViewRecallInfoDTO> resultList = new ArrayList<>(); List<FullViewRecallInfoDTO> resultList = new ArrayList<>();
resultList.add(allMapDto); resultList.add(allMapDto);
......
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