北京暂降平台调整
This commit is contained in:
@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Description:
|
||||
* Date: 2025/06/19 下午 1:43【需求编号】
|
||||
*
|
||||
@@ -19,4 +19,7 @@ public interface PqLineMapper extends BaseMapper<PqLine> {
|
||||
|
||||
List<LedgerBaseInfoDTO> getBaseLineInfo(@Param("ids")List<Integer> ids);
|
||||
|
||||
}
|
||||
|
||||
List<LedgerBaseInfoDTO> getBaseLedger(@Param("ids")List<Integer> ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.gather.event.devcie.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqsStationMap;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2025/06/19 下午 1:43【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PqsStationMapMapper extends BaseMapper<PqsStationMap> {
|
||||
|
||||
|
||||
}
|
||||
@@ -62,4 +62,30 @@ where 1=1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getBaseLedger" resultType="com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO">
|
||||
select
|
||||
PQ_GDINFORMATION.name gdName,
|
||||
pq_line.GD_INDEX gdIndex,
|
||||
pq_line.line_index lineId,
|
||||
pq_line.name lineName,
|
||||
PQ_SUBVOLTAGE.SUBV_INDEX busBarId,
|
||||
PQ_SUBVOLTAGE.name busBarName,
|
||||
pq_device.dev_index devId,
|
||||
pq_device.name devName,
|
||||
pq_device.Status runFlag,
|
||||
PQ_SUBSTATION.sub_index stationId,
|
||||
PQ_SUBSTATION.name stationName
|
||||
from
|
||||
pq_line inner JOIN PQ_SUBVOLTAGE on pq_line.SUBV_INDEX = PQ_SUBVOLTAGE.SUBV_INDEX
|
||||
inner JOIN pq_device on PQ_SUBVOLTAGE.DEV_INDEX = pq_device.DEV_INDEX
|
||||
inner JOIN PQ_SUBSTATION on pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX
|
||||
inner JOIN PQ_GDINFORMATION on pq_line.GD_INDEX =PQ_GDINFORMATION.GD_INDEX
|
||||
where 1=1
|
||||
and pq_line.line_index in
|
||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.njcn.gather.event.devcie.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-06-25
|
||||
@@ -32,5 +34,8 @@ public class LedgerBaseInfoDTO {
|
||||
//通讯状态
|
||||
private Integer runFlag=0;
|
||||
|
||||
private Integer eventCount;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.njcn.gather.event.devcie.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* CN_Gather
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2025/8/11
|
||||
*/
|
||||
@TableName(value="PQS_MAP")
|
||||
@Data
|
||||
public class PqsStationMap {
|
||||
|
||||
|
||||
@TableId
|
||||
@TableField(value = "MAP_INDEX")
|
||||
private String mapIndex;
|
||||
|
||||
|
||||
@TableField(value = "SUB_INDEX")
|
||||
private Long subIndex;
|
||||
|
||||
|
||||
@TableField(value = "GD_INDEX")
|
||||
private Long gdIndex;
|
||||
|
||||
//经度
|
||||
|
||||
@TableField(value = "LONGITUDE")
|
||||
private Float longItude;
|
||||
|
||||
//纬度
|
||||
|
||||
@TableField(value = "LATITUDE")
|
||||
private Float latItude;
|
||||
|
||||
//数据状态
|
||||
|
||||
@TableField(value = "STATE")
|
||||
private Long state;
|
||||
|
||||
//用户ID
|
||||
|
||||
@TableField(value = "USER_INDEX")
|
||||
private String userIndex;
|
||||
|
||||
//更新时间
|
||||
|
||||
@TableField(value = "UPDATETIME")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Description:
|
||||
* Date: 2025/06/19 下午 1:43【需求编号】
|
||||
*
|
||||
@@ -19,4 +19,6 @@ public interface PqLineService extends IService<PqLine>{
|
||||
|
||||
|
||||
List<LedgerBaseInfoDTO> getBaseLineInfo(List<Integer> ids);
|
||||
|
||||
List<LedgerBaseInfoDTO> getBaseLedger(List<Integer> ids);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import com.njcn.gather.event.devcie.service.PqLineService;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Description:
|
||||
* Date: 2025/06/19 下午 1:43【需求编号】
|
||||
*
|
||||
@@ -44,6 +44,28 @@ public class PqLineServiceImpl extends ServiceImpl<PqLineMapper, PqLine> impleme
|
||||
ledgerBaseInfoDTOS.addAll(temp);
|
||||
}
|
||||
return ledgerBaseInfoDTOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LedgerBaseInfoDTO> getBaseLedger(List<Integer> ids) {
|
||||
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = new ArrayList<>();
|
||||
|
||||
if(CollectionUtils.isEmpty(ids)){
|
||||
return ledgerBaseInfoDTOS;
|
||||
}
|
||||
if(ids.size()>1000){
|
||||
List<List<Integer>> listIds = CollUtil.split(ids,1000);
|
||||
for(List<Integer> itemIds : listIds){
|
||||
List<LedgerBaseInfoDTO> temp =this.baseMapper.getBaseLedger(itemIds);
|
||||
ledgerBaseInfoDTOS.addAll(temp);
|
||||
}
|
||||
}else {
|
||||
List<LedgerBaseInfoDTO> temp =this.baseMapper.getBaseLedger(ids);
|
||||
ledgerBaseInfoDTOS.addAll(temp);
|
||||
}
|
||||
return ledgerBaseInfoDTOS;
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ public class JwtRequestFilter extends OncePerRequestFilter {
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
|
||||
/* final String authorizationHeader = request.getHeader("Authorization");
|
||||
/* final String authorizationHeader = request.getHeader("Authorization");
|
||||
String username = null;
|
||||
String jwt = null;
|
||||
if (authorizationHeader != null && authorizationHeader.startsWith("Bearer ")) {
|
||||
@@ -79,4 +78,4 @@ public class JwtRequestFilter extends OncePerRequestFilter {
|
||||
|
||||
response.getWriter().write(new JSONObject(httpResult, false).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.event.transientes.pojo.vo;
|
||||
|
||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqsEventdetail;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -26,7 +27,7 @@ public class SubStationCountVO {
|
||||
private Integer lineCount;
|
||||
private Integer eventCount;
|
||||
|
||||
private List<LineEventDetail> lineEventDetails;
|
||||
private List<LedgerBaseInfoDTO> lineEventDetails;
|
||||
|
||||
|
||||
@Data
|
||||
@@ -55,6 +56,7 @@ public class SubStationCountVO {
|
||||
private String stationName;
|
||||
//通讯状态
|
||||
private Integer runFlag=0;
|
||||
|
||||
private Integer eventCount;
|
||||
|
||||
private List<PqsEventdetail> pqsEventdetails;
|
||||
|
||||
@@ -21,10 +21,13 @@ import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@@ -46,7 +49,7 @@ public class AuthController extends BaseController {
|
||||
|
||||
@PostMapping("/cn_authenticate")
|
||||
@ApiOperation("登录认证")
|
||||
public HttpResult<AuthResponse> createAuthenticationToken(@RequestBody AuthRequest authRequest) {
|
||||
public HttpResult<AuthResponse> createAuthenticationToken(@RequestBody @Validated AuthRequest authRequest) {
|
||||
String methodDescribe = getMethodDescribe("createAuthenticationToken");
|
||||
//log.info("Authentication request - username: {}, password: {}",authRequest.getUsername(),authRequest.getPassword());
|
||||
try {
|
||||
@@ -84,6 +87,8 @@ public class AuthController extends BaseController {
|
||||
|
||||
// 认证请求类
|
||||
class AuthRequest {
|
||||
|
||||
@NotBlank(message = "用户名不可为空")
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
@@ -102,4 +107,4 @@ class AuthRequest {
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MyUserDetailsService implements UserDetailsService {
|
||||
public MyUserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
|
||||
|
||||
if(username.equals("system_event")){
|
||||
if("system_event".equals(username)){
|
||||
return new MyUserDetails("12345678910","system_event", "@#001njcnpqs","10001",
|
||||
new ArrayList<>());
|
||||
}
|
||||
@@ -67,4 +67,4 @@ public class MyUserDetailsService implements UserDetailsService {
|
||||
throw new UsernameNotFoundException("User not found with username: " + username);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,16 +34,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable()
|
||||
.authorizeRequests()
|
||||
//.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent").permitAll() // 允许访问认证接口
|
||||
.antMatchers("/**").permitAll() // 允许访问认证接口
|
||||
.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent").permitAll() // 允许访问认证接口
|
||||
// .antMatchers("/**").permitAll() // 允许访问认证接口
|
||||
.antMatchers("/**").permitAll() // 允许访问认证接口
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.sessionManagement()
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS); // 使用无状态会话
|
||||
|
||||
// http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
//http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -56,4 +54,4 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,11 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
} else {
|
||||
eventQuery.in(PqsEventdetail::getLineid, lineIds);
|
||||
}
|
||||
return pqsEventdetailService.list(eventQuery);
|
||||
List<PqsEventdetail> eventdetailList = pqsEventdetailService.list(eventQuery);
|
||||
if(CollUtil.isNotEmpty(eventdetailList)){
|
||||
eventdetailList.forEach(it->it.setPersisttime(BigDecimal.valueOf(it.getPersisttime() / 1000).setScale(3,RoundingMode.HALF_UP).doubleValue()));
|
||||
}
|
||||
return eventdetailList;
|
||||
}
|
||||
|
||||
private List<PqUserLedgerPO> getUserLedgers(List<String> assUserIds,LargeScreenCountParam param,boolean queryFlag){
|
||||
@@ -382,7 +386,7 @@ public class EventRightServiceImpl implements EventRightService {
|
||||
eventDetailVO.setPointname(dto.getLineName());
|
||||
eventDetailVO.setEventdetail_index(pqsEventdetail.getEventdetailIndex());
|
||||
eventDetailVO.setDevName(dto.getDevName());
|
||||
|
||||
eventDetailVO.setPersisttime(BigDecimal.valueOf(pqsEventdetail.getPersisttime() / 1000).setScale(3,RoundingMode.HALF_UP).toString());
|
||||
resultList.add(eventDetailVO);
|
||||
}
|
||||
result.setTotal(page.getTotal());
|
||||
|
||||
@@ -17,19 +17,17 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.event.devcie.config.PqlineCache;
|
||||
import com.njcn.gather.event.devcie.mapper.PqLineMapper;
|
||||
import com.njcn.gather.event.devcie.mapper.PqLinedetailMapper;
|
||||
import com.njcn.gather.event.devcie.mapper.PqsStationMapMapper;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLinedetail;
|
||||
import com.njcn.gather.event.devcie.pojo.po.*;
|
||||
import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper;
|
||||
import com.njcn.gather.event.transientes.mapper.PqUserLineAssMapper;
|
||||
import com.njcn.gather.event.transientes.mapper.PqsIntegrityMapper;
|
||||
import com.njcn.gather.event.transientes.mapper.PqsOnlinerateMapper;
|
||||
import com.njcn.gather.event.transientes.pojo.param.LargeScreenCountParam;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqDevice;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqLine;
|
||||
import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline;
|
||||
import com.njcn.gather.event.transientes.pojo.param.MessageEventFeedbackParam;
|
||||
import com.njcn.gather.event.transientes.pojo.po.PqsDepts;
|
||||
import com.njcn.gather.event.transientes.pojo.po.MessageEventFeedback;
|
||||
@@ -99,6 +97,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
|
||||
private final PqUserLineAssMapper pqUserLineAssMapper;
|
||||
|
||||
private final PqsStationMapMapper pqsStationMapMapper;
|
||||
|
||||
@Value("${SYS_TYPE_ZT}")
|
||||
private String sysTypeZt;
|
||||
private final static String NAME_KEY = "LineCache:";
|
||||
@@ -977,23 +977,47 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<PqUserLineAssPO> getUserLineAssociations(List<Integer> lineIds){
|
||||
LambdaQueryWrapper<PqUserLineAssPO> assQuery = new LambdaQueryWrapper<>();
|
||||
assQuery.in(PqUserLineAssPO::getLineIndex, lineIds);
|
||||
|
||||
if(lineIds.size()>1000){
|
||||
List<List<Integer>> lineList = CollUtil.split(lineIds, 1000);
|
||||
assQuery.and(w -> {
|
||||
for (List<Integer> ids : lineList) {
|
||||
w.or(wIn -> wIn.in(PqUserLineAssPO::getLineIndex, ids));
|
||||
}
|
||||
});
|
||||
}else {
|
||||
assQuery.in(PqUserLineAssPO::getLineIndex, lineIds);
|
||||
}
|
||||
|
||||
return pqUserLineAssMapper.selectList(assQuery);
|
||||
}
|
||||
|
||||
private List<PqUserLedgerPO> getUserLedgers(List<String> assUserIds){
|
||||
LambdaQueryWrapper<PqUserLedgerPO> userWrapper = new LambdaQueryWrapper<>();
|
||||
if(assUserIds.size()>1000){
|
||||
List<List<String>> assUserIdsList = CollUtil.split(assUserIds, 1000);
|
||||
userWrapper.and(w -> {
|
||||
for (List<String> ids : assUserIdsList) {
|
||||
w.or(wIn -> wIn.in(PqUserLedgerPO::getId, ids));
|
||||
}
|
||||
});
|
||||
}else {
|
||||
userWrapper.in(PqUserLedgerPO::getId, assUserIds);
|
||||
}
|
||||
return pqUserLedgerMapper.selectList(userWrapper);
|
||||
}
|
||||
@Override
|
||||
public List<SubStationCountVO> substationCount(LargeScreenCountParam largeScreenCountParam) {
|
||||
LocalDateTime startTime = largeScreenCountParam.getStartTime().atStartOfDay();
|
||||
LocalDateTime endTime = LocalDateTimeUtil.endOfDay(largeScreenCountParam.getEndTime().atStartOfDay());
|
||||
|
||||
List<SubStationCountVO> subStationCountVOS = new ArrayList<>();
|
||||
List<PqLine> pqLineList = (List<PqLine>) redisUtil.getObjectByKey( NAME_KEY+ StrUtil.DASHED+"pqLineList");
|
||||
List<Integer> deptslineIds = (List<Integer>) redisUtil.getObjectByKey( NAME_KEY+ StrUtil.DASHED+largeScreenCountParam.getDeptId());
|
||||
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = pqLineService.getBaseLineInfo(deptslineIds);
|
||||
Map<Integer,LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = ledgerBaseInfoDTOS.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
||||
|
||||
pqLineList = pqLineList.stream().filter(temp->deptslineIds.contains(temp.getLineIndex())).collect(Collectors.toList());
|
||||
List<Integer> subIndexs = pqLineList.stream().map(PqLine::getSubIndex).collect(Collectors.toList());
|
||||
List<SubstationDTO> substationDTOS = pqSubstationService.queryListByIds(subIndexs);
|
||||
Map<Integer, SubstationDTO> substationDTOMap= substationDTOS.stream().collect(Collectors.toMap(SubstationDTO::getStationId, Function.identity()));
|
||||
|
||||
List<Integer> deptslineIds = commGeneralService.getLineIdsByRedis(largeScreenCountParam.getDeptId());
|
||||
if(CollUtil.isEmpty(deptslineIds)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
//查询暂态事件
|
||||
List<PqsEventdetail> eventdetails = new ArrayList<>();
|
||||
if(deptslineIds.size()>1000){
|
||||
@@ -1002,9 +1026,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
List<PqsEventdetail> temp = pqsEventdetailService.lambdaQuery()
|
||||
.between(PqsEventdetail::getTimeid,startTime, endTime)
|
||||
.in(PqsEventdetail::getWavetype,msgEventConfigService.getEventType())
|
||||
.in(PqsEventdetail::getLineid,listIds)
|
||||
.orderByDesc(PqsEventdetail::getTimeid).list()
|
||||
;
|
||||
.in(PqsEventdetail::getLineid,itemIds)
|
||||
.orderByDesc(PqsEventdetail::getTimeid).list();
|
||||
eventdetails.addAll(temp);
|
||||
}
|
||||
}else {
|
||||
@@ -1015,42 +1038,64 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
||||
.orderByDesc(PqsEventdetail::getTimeid).list();
|
||||
eventdetails.addAll(temp);
|
||||
}
|
||||
Map<Integer, List<PqLine>> map = pqLineList.stream().collect(Collectors.groupingBy(PqLine::getSubIndex));
|
||||
map.forEach((k,v)->{
|
||||
if(substationDTOMap.containsKey(k)){
|
||||
|
||||
if(CollUtil.isEmpty(eventdetails)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<Integer> lineIds = eventdetails.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList());
|
||||
//List<PqLine> pqLineList = (List<PqLine>) redisUtil.getObjectByKey( NAME_KEY+ StrUtil.DASHED+"pqLineList");
|
||||
//pqLineList = pqLineList.stream().filter(temp->lineIds.contains(temp.getLineIndex())).collect(Collectors.toList());
|
||||
|
||||
List<PqUserLineAssPO> assPOList = getUserLineAssociations(lineIds);
|
||||
List<String> userIds = assPOList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||
|
||||
Map<Integer,List<String>> lineAssMap = assPOList.stream().collect(Collectors.groupingBy(PqUserLineAssPO::getLineIndex,Collectors.mapping(PqUserLineAssPO::getUserIndex,Collectors.toList())));
|
||||
|
||||
List<PqUserLedgerPO> pqUserLedgerPOList = getUserLedgers(userIds);
|
||||
|
||||
List<SubStationCountVO> subStationCountVOS = new ArrayList<>();
|
||||
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = pqLineService.getBaseLedger(lineIds);
|
||||
//Map<Integer,LedgerBaseInfoDTO> ledgerBaseInfoDTOMap = ledgerBaseInfoDTOS.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
||||
|
||||
List<Integer> subIndexs = ledgerBaseInfoDTOS.stream().map(LedgerBaseInfoDTO::getStationId).collect(Collectors.toList());
|
||||
List<PqsStationMap> pqsStationMapList = pqsStationMapMapper.selectList(new LambdaQueryWrapper<PqsStationMap>().in(PqsStationMap::getSubIndex,subIndexs).eq(PqsStationMap::getState,1));
|
||||
Map<Long,PqsStationMap> stationMapMap = pqsStationMapList.stream().collect(Collectors.toMap(PqsStationMap::getSubIndex,dept->dept));
|
||||
|
||||
Map<Integer, List<LedgerBaseInfoDTO>> substationDTOMap= ledgerBaseInfoDTOS.stream().collect(Collectors.groupingBy(LedgerBaseInfoDTO::getStationId));
|
||||
|
||||
Map<Integer, List<PqsEventdetail>> collect = eventdetails.stream().collect(Collectors.groupingBy(PqsEventdetail::getLineid));
|
||||
|
||||
substationDTOMap.forEach((k,v)->{
|
||||
LedgerBaseInfoDTO ledgerBaseInfoDTO = v.get(0);
|
||||
SubStationCountVO subStationCountVO = new SubStationCountVO();
|
||||
SubstationDTO substationDTO = substationDTOMap.get(k);
|
||||
subStationCountVO.setStationId(substationDTO.getStationId());
|
||||
subStationCountVO.setStationName(substationDTO.getStationName());
|
||||
subStationCountVO.setGdName(substationDTO.getGdName());
|
||||
subStationCountVO.setLongitude(substationDTO.getLongitude());
|
||||
subStationCountVO.setLatitude(substationDTO.getLatitude());
|
||||
List<Integer> tempLineIds = v.stream().map(PqLine::getLineIndex).collect(Collectors.toList());
|
||||
subStationCountVO.setStationId(k);
|
||||
subStationCountVO.setStationName(ledgerBaseInfoDTO.getStationName());
|
||||
subStationCountVO.setGdName(ledgerBaseInfoDTO.getGdName());
|
||||
PqsStationMap pqsStationMap = stationMapMap.get(k.longValue());
|
||||
subStationCountVO.setLongitude(pqsStationMap.getLongItude());
|
||||
subStationCountVO.setLatitude(pqsStationMap.getLatItude());
|
||||
|
||||
List<Integer> tempLineIds = v.stream().map(LedgerBaseInfoDTO::getLineId).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
subStationCountVO.setLineCount(tempLineIds.size());
|
||||
List<PqsEventdetail> tempEventList = eventdetails.stream().filter(temp -> tempLineIds.contains(temp.getLineid())).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(tempEventList)){
|
||||
subStationCountVO.setEventCount(0);
|
||||
return;
|
||||
|
||||
}
|
||||
subStationCountVO.setEventCount(tempEventList.size());
|
||||
Map<Integer, List<PqsEventdetail>> collect = tempEventList.stream().collect(Collectors.groupingBy(PqsEventdetail::getLineid));
|
||||
List<SubStationCountVO.LineEventDetail> lineEventDetails = new ArrayList<>();
|
||||
collect.forEach((k1,v1)->{
|
||||
SubStationCountVO.LineEventDetail lineEventDetail = new SubStationCountVO.LineEventDetail();
|
||||
LedgerBaseInfoDTO ledgerBaseInfoDTO = ledgerBaseInfoDTOMap.get(k1);
|
||||
BeanUtils.copyProperties(ledgerBaseInfoDTO,lineEventDetail);
|
||||
lineEventDetail.setEventCount(v1.size());
|
||||
// lineEventDetail.setPqsEventdetails(v1);
|
||||
lineEventDetails.add(lineEventDetail);
|
||||
|
||||
v.forEach(item->{
|
||||
String obj = "";
|
||||
if(lineAssMap.containsKey(item.getLineId())){
|
||||
List<String> userIndex = lineAssMap.get(item.getLineId());
|
||||
obj = pqUserLedgerPOList.stream().filter(it->userIndex.contains(it.getId())).map(PqUserLedgerPO::getCustomerName).collect(Collectors.joining(";"));
|
||||
}
|
||||
item.setObjName(StrUtil.isNotBlank(obj)? obj:"/");
|
||||
item.setEventCount(collect.get(item.getLineId()).size());
|
||||
});
|
||||
subStationCountVO.setLineEventDetails(lineEventDetails);
|
||||
subStationCountVO.setLineEventDetails(v);
|
||||
subStationCountVOS.add(subStationCountVO);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
return subStationCountVOS;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class JwtUtil {
|
||||
|
||||
|
||||
private static final Key SECRET_KEY = Keys.secretKeyFor(SignatureAlgorithm.HS256);
|
||||
private static final long EXPIRATION_TIME = 1000 * 60 * 60 * 100000L; // 10小时
|
||||
private static final long EXPIRATION_TIME = 1000 * 60 * 60 * 1000000000L; // 100000小时
|
||||
|
||||
// 生成JWT令牌
|
||||
public String generateToken(MyUserDetails userDetails) {
|
||||
@@ -82,4 +82,4 @@ public class JwtUtil {
|
||||
private Boolean isTokenExpired(String token) {
|
||||
return extractExpiration(token).before(new Date());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ spring:
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1
|
||||
max-wait: 8000
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ spring:
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 20
|
||||
max-wait: 5000
|
||||
max-wait: 8000
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ spring:
|
||||
application:
|
||||
name: event_smart
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
|
||||
Reference in New Issue
Block a user