缓存手动刷新接口
This commit is contained in:
@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.product.event.devcie.mapper.PqGdCompanyMapper;
|
||||
import com.njcn.product.event.devcie.mapper.PqLineMapper;
|
||||
import com.njcn.product.event.devcie.mapper.PqLinedetailMapper;
|
||||
import com.njcn.product.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.product.event.devcie.pojo.po.PqGdCompany;
|
||||
@@ -23,6 +24,7 @@ import com.njcn.product.event.config.RedisUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -41,6 +43,7 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
@@ -60,6 +63,7 @@ public class DataSynchronization {
|
||||
|
||||
private final OssFileStorageUtils ossFileStorageUtils;
|
||||
private final PqLinedetailMapper pqLinedetailMapper;
|
||||
private final PqLineMapper pqLineMapper;
|
||||
|
||||
private final PqUserLineAssMapper pqUserLineAssMapper;
|
||||
private final PqUserLedgerMapper pqUserLedgerMapper;
|
||||
@@ -280,6 +284,10 @@ public class DataSynchronization {
|
||||
upLoadEvent.setEventreason(pqsEventdetail.getEventreason());
|
||||
upLoadEvent.setEventtype(pqsEventdetail.getEventtype());
|
||||
LedgerBaseInfoDTO ledgerBaseInfoDTO = LedgerBaseInfoDTOMap.get(pqsEventdetail.getLineid());
|
||||
if(Objects.isNull(ledgerBaseInfoDTO)){
|
||||
List<LedgerBaseInfoDTO> baseLineInfo = pqLineMapper.getBaseLineInfo(Stream.of(pqsEventdetail.getLineid()).collect(Collectors.toList()));
|
||||
ledgerBaseInfoDTO = baseLineInfo.get(0);
|
||||
}
|
||||
upLoadEvent.setGdname(ledgerBaseInfoDTO.getGdName());
|
||||
upLoadEvent.setBdname(ledgerBaseInfoDTO.getBusBarName());
|
||||
upLoadEvent.setPointname(ledgerBaseInfoDTO.getLineName());
|
||||
@@ -321,6 +329,10 @@ public class DataSynchronization {
|
||||
upLoadEvent.setEventreason(pqsEventdetail.getEventreason());
|
||||
upLoadEvent.setEventtype(pqsEventdetail.getEventtype());
|
||||
LedgerBaseInfoDTO ledgerBaseInfoDTO = LedgerBaseInfoDTOMap.get(pqsEventdetail.getLineid());
|
||||
if(Objects.isNull(ledgerBaseInfoDTO)){
|
||||
List<LedgerBaseInfoDTO> baseLineInfo = pqLineMapper.getBaseLineInfo(Stream.of(pqsEventdetail.getLineid()).collect(Collectors.toList()));
|
||||
ledgerBaseInfoDTO = baseLineInfo.get(0);
|
||||
}
|
||||
upLoadEvent.setGdname(ledgerBaseInfoDTO.getGdName());
|
||||
upLoadEvent.setBdname(ledgerBaseInfoDTO.getBusBarName());
|
||||
upLoadEvent.setPointname(ledgerBaseInfoDTO.getLineName());
|
||||
@@ -436,6 +448,10 @@ public class DataSynchronization {
|
||||
upLoadEvent.setEventreason(unsyncedEvent.getEventreason());
|
||||
upLoadEvent.setEventtype(unsyncedEvent.getEventtype());
|
||||
LedgerBaseInfoDTO ledgerBaseInfoDTO = LedgerBaseInfoDTOMap.get(unsyncedEvent.getLineid());
|
||||
if(Objects.isNull(ledgerBaseInfoDTO)){
|
||||
List<LedgerBaseInfoDTO> baseLineInfo = pqLineMapper.getBaseLineInfo(Stream.of(unsyncedEvent.getLineid()).collect(Collectors.toList()));
|
||||
ledgerBaseInfoDTO = baseLineInfo.get(0);
|
||||
}
|
||||
upLoadEvent.setGdname(ledgerBaseInfoDTO.getGdName());
|
||||
upLoadEvent.setBdname(ledgerBaseInfoDTO.getBusBarName());
|
||||
upLoadEvent.setPointname(ledgerBaseInfoDTO.getLineName());
|
||||
|
||||
@@ -14,6 +14,8 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.product.event.devcie.config.PqlineCache;
|
||||
import com.njcn.product.event.devcie.job.LineCacheJob;
|
||||
import com.njcn.product.event.devcie.mapper.PqLineMapper;
|
||||
import com.njcn.product.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||
import com.njcn.product.event.devcie.pojo.po.PqLine;
|
||||
@@ -93,7 +95,7 @@ public class EventGateController extends BaseController {
|
||||
private final SmsUtils smsUtils;
|
||||
|
||||
private final ThreadPoolTaskExecutor smsTaskExecutor;
|
||||
|
||||
private final PqlineCache pqlineCache;
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/eventMsg")
|
||||
@@ -458,6 +460,11 @@ public class EventGateController extends BaseController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/refreshIdCache")
|
||||
@ApiOperation("刷新缓存")
|
||||
public Boolean refreshIdCache() {
|
||||
pqlineCache.init();
|
||||
return true;// HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, "数据同步");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent","/accept/eventMsg","/accept/simpleTest","/accept/phoneSend").permitAll() // 允许访问认证接口
|
||||
.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent","/accept/eventMsg","/accept/simpleTest","/accept/phoneSend","/accept/refreshIdCache").permitAll() // 允许访问认证接口
|
||||
// .antMatchers("/**").permitAll() // 允许访问认证接口
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
|
||||
Reference in New Issue
Block a user