Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f1f42f8d7 | |||
| 3ac18b896a | |||
| f86e7f0183 | |||
|
|
c99a97fff1 | ||
|
|
0f712c45fd |
@@ -37,7 +37,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.authorizeRequests()
|
||||
.antMatchers("/oauth/getPublicKey","/oauth/logout","/auth/getImgCode","/judgeToken/guangZhou","/judgeToken/heBei","/oauth/autoLogin").permitAll()
|
||||
.antMatchers("/oauth/getPublicKey","/oauth/logout","/auth/getImgCode","/judgeToken/guangZhou","/judgeToken/heBei","/oauth/autoLogin","/judgeToken/productionManagementCheck").permitAll()
|
||||
// @link https://gitee.com/xiaoym/knife4j/issues/I1Q5X6 (接口文档knife4j需要放行的规则)
|
||||
.antMatchers("/webjars/**","/doc.html","/swagger-resources/**","/v2/api-docs").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
|
||||
@@ -76,6 +76,93 @@ public class JudgeThirdToken extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产管理系统token校验
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/productionManagementCheck")
|
||||
@ApiOperation("生产管理系统token校验")
|
||||
@ApiImplicitParam(name = "token", required = true)
|
||||
public HttpResult<Object> productionManagementCheck (String token) {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
String methodDescribe = getMethodDescribe("productionManagementCheck");
|
||||
LogUtil.njcnDebug(log, "{},token:{}", methodDescribe, token);
|
||||
|
||||
// 请求地址
|
||||
String url = "http://10.120.192.72:80/head-auth-service/oauth/check_token";
|
||||
|
||||
// 请求头设置,x-www-form-urlencoded格式的数据
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
|
||||
//提交参数设置
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
||||
map.add("token", token);
|
||||
|
||||
// 组装请求体
|
||||
HttpEntity<MultiValueMap<String, String>> request =
|
||||
new HttpEntity<>(map, headers);
|
||||
|
||||
/**
|
||||
* 成功
|
||||
* {
|
||||
* "sub": "40a21660947c44a6a40030109214f313",
|
||||
* "ver": "JWT1.0",
|
||||
* "user_name": "web",
|
||||
* "pri": [
|
||||
* "MASTER_ADMIN",
|
||||
* "znxs",
|
||||
* "root",
|
||||
* "ADMIN"
|
||||
* ],
|
||||
* "last_login": 1744875032,
|
||||
* "scope": [
|
||||
* "all"
|
||||
* ],
|
||||
* "iss": "nrec",
|
||||
* "active": true,
|
||||
* "exp": 1744961431,
|
||||
* "jti": "32add77a-43f0-4d67-82a2-8376fed6fc3d",
|
||||
* "client_id": "frontend"
|
||||
* }
|
||||
*
|
||||
* 失败
|
||||
*
|
||||
* {
|
||||
* "msg": "Cannot convert access token to JSON",
|
||||
* "path": "/auth-service/oauth/check_token",
|
||||
* "code": "2500",
|
||||
* "succ": false,
|
||||
* "error": "Internal Server Error",
|
||||
* "timestamp": 1744879150627
|
||||
* }
|
||||
*/
|
||||
|
||||
// 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
|
||||
try {
|
||||
String result = restTemplate.postForObject(url, request, String.class);
|
||||
JSONObject resultJson = new JSONObject(result);
|
||||
if (resultJson.containsKey("code")) {
|
||||
//失败
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.info(e.toString());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/heBei")
|
||||
|
||||
@@ -24,6 +24,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -148,10 +150,8 @@ public class DataQualityStatServiceImpl implements DataQualityStatService {
|
||||
vo.setOrgName(deptDTOMap.get(vo.getOrgNo()).getName());
|
||||
if(vo.getMeasurementCount()!=0&&vo.getMeasurementCount()!=null){
|
||||
vo.setEffectiveAccessRate(
|
||||
Double.parseDouble(
|
||||
df.format((vo.getEffectiveAccessMeasurementCount() * 1.0)
|
||||
/ (vo.getMeasurementCount() * 1.0))
|
||||
) * 100);
|
||||
BigDecimal.valueOf((vo.getEffectiveAccessMeasurementCount() * 1.0/ (vo.getMeasurementCount() * 1.0))*100).setScale(2, RoundingMode.HALF_UP).doubleValue()
|
||||
);
|
||||
}else{
|
||||
vo.setEffectiveAccessRate(0.0);
|
||||
}
|
||||
|
||||
@@ -215,7 +215,8 @@ whitelist:
|
||||
- /pqs-auth/oauth/getPublicKey
|
||||
- /pqs-auth/judgeToken/heBei
|
||||
- /pqs-auth/judgeToken/guangZhou
|
||||
|
||||
- /pqs-auth/judgeToken/productionManagementCheck
|
||||
-
|
||||
- /webjars/**
|
||||
- /doc.html
|
||||
- /swagger-resources/**
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.njcn.harmonic.service.upload.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.advance.pojo.dto.waveAnalysis.AnalyWave;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.harmonic.api.UploadGwDataFeignClient;
|
||||
import com.njcn.harmonic.pojo.param.UploadParam;
|
||||
import com.njcn.harmonic.pojo.po.upload.RUploadDataLog;
|
||||
import com.njcn.harmonic.service.upload.IPointStatisticalDataService;
|
||||
import com.njcn.harmonic.service.upload.IRUploadDataLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-04-21
|
||||
* @Description: 主网测点失败尝试
|
||||
*/
|
||||
@Component
|
||||
@EnableScheduling
|
||||
@RequiredArgsConstructor
|
||||
public class FailedAttemptJob {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(FailedAttemptJob.class);
|
||||
|
||||
private final IRUploadDataLogService irUploadDataLogService;
|
||||
|
||||
private final IPointStatisticalDataService iPointStatisticalDataService;
|
||||
|
||||
|
||||
// 每天早上 8 点执行
|
||||
@Scheduled(cron = "0 05 8 * * ?")
|
||||
public void executeAtEight() {
|
||||
commFunction();
|
||||
}
|
||||
|
||||
// 每天早上 9 点执行
|
||||
@Scheduled(cron = "0 10 8 * * ?")
|
||||
public void executeAtNine() {
|
||||
commFunction();
|
||||
}
|
||||
|
||||
// 每天早上 10 点执行
|
||||
@Scheduled(cron = "0 15 8 * * ?")
|
||||
public void executeAtTen() {
|
||||
commFunction();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void commFunction(){
|
||||
System.out.println("早上定时任务执行(主网测点失败尝试):" + LocalDateTime.now());
|
||||
LambdaQueryWrapper<RUploadDataLog> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(RUploadDataLog::getStatisticDate, LocalDate.now().minusDays(1)).eq(RUploadDataLog::getBigType,0).eq(RUploadDataLog::getSmallType,1);
|
||||
RUploadDataLog rUploadDataLog = irUploadDataLogService.getOne(lambdaQueryWrapper);
|
||||
if(Objects.nonNull(rUploadDataLog)){
|
||||
if(rUploadDataLog.getResult().equals(0)){
|
||||
//失败了需要重试
|
||||
UploadParam param = new UploadParam();
|
||||
param.setTime(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
||||
iPointStatisticalDataService.uploadPointStatisticalData(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.harmonic.service.upload.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -27,7 +28,7 @@ public class RUploadDataLogServiceImpl extends MppServiceImpl<RUploadDataLogMapp
|
||||
@Override
|
||||
public Page<RUploadDataLog> getList(BaseParam baseParam) {
|
||||
LambdaQueryWrapper<RUploadDataLog> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(RUploadDataLog::getCreateTime,baseParam.getSearchBeginTime(),baseParam.getSearchEndTime())
|
||||
lambdaQueryWrapper.between(RUploadDataLog::getStatisticDate, DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())))
|
||||
.orderByDesc(RUploadDataLog::getStatisticDate);
|
||||
if(StrUtil.isNotBlank(baseParam.getSearchValue())){
|
||||
lambdaQueryWrapper.eq(RUploadDataLog::getSmallType,Integer.parseInt(baseParam.getSearchValue()));
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.harmonic.mapper.upload.PmsTemProcessApprovalMapper">
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
obj_id, temp_user_dossier_id, approval_join_user_id, approval_join_user_name, approval_advise,
|
||||
create_time, update_time, legacy_problem, rectification_status, rectification_time,
|
||||
rectification_user_id, rectification_user_name, rectification_measure
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user