同步记录修改,token定时更新

master
anthonyywj2 3 years ago
parent b704e9fcf7
commit 759cf907f4

@ -85,6 +85,11 @@ public class UdidlDeviceController {
public BaseResponse goOnDlDi(JobRequest jobRequest) {
JobLog jobLog = jobLogService.findById(jobRequest.getJobId());
if (jobLog != null) {
jobLog.setStatus(0);
jobLog.setCreateTime(new Date());
jobLog.setType(Constant.LOG_TYPE_INFO);
jobLog.setDownloadType(Constant.DOWNLOAD_TYPE_MANUAL);
jobLogService.update(jobLog);
if (StrUtil.isNotEmpty(jobLog.getLastUploadRequest())) {
DeviceRequest deviceRequest = JSONUtil.toBean(jobLog.getLastUploadRequest(), DeviceRequest.class);
if (deviceRequest != null) {

@ -79,6 +79,7 @@ public class DeviceDownloadService {
* @return
*/
public String getToken() {
token = redisUtil.get("UDISYNC_TOKEN");
if (StrUtil.isEmpty(token)) {
companyEntity = companyService.findCompany();
TokenRequest tokenRequest = new TokenRequest();
@ -88,13 +89,12 @@ public class DeviceDownloadService {
String response = HttpClient.post("token/get", tokenRequest);
TokenEntity tokenEntity = (TokenEntity) JSONObject.parseObject(response, TokenEntity.class);
token = tokenEntity.getAccessToken();
redisUtil.setEx("UDISYNC_TOKEN", token, 1 * 60 * 60 * 6);
}
return token;
}
public String getTokenNow(TokenRequest tokenRequest) {
try {
String response = HttpClient.post("token/get", tokenRequest);
TokenEntity tokenEntity = (TokenEntity) JSONObject.parseObject(response, TokenEntity.class);
@ -329,7 +329,7 @@ public class DeviceDownloadService {
jobLog.setRealCount(jobLog.getRealCount() + dataSetResult.getDataSet().getDeviceInfo().size());
jobLog.setInsertCount(jobLog.getInsertCount() + insertCount);
jobLog.setTotalCount(dataSetResult.getTotalRecordCount());
jobLog.setMsg("下载中:" + "总条数:" + dataSetResult.getTotalRecordCount() + ";下载条数:" + jobLog.getRealCount() + ";插入条数:" + jobLog.getInsertCount());
jobLog.setMsg("总条数:" + dataSetResult.getTotalRecordCount() + ";下载条数:" + jobLog.getRealCount() + ";插入条数:" + jobLog.getInsertCount());
jobLog.setLastUploadRequest(JSONUtil.toJsonStr(deviceRequest));
jobLogService.update(jobLog);
} catch (Exception e) {

@ -3,8 +3,8 @@ spring:
pathmatch:
matching-strategy: ant_path_matcher
datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
url: jdbc:p6spy:mysql://192.168.235.137:33306/udidl?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.0.66:3360/udidl_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: root
servlet:

@ -1,9 +1,12 @@
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/udidl_test?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
username: root
password: mysql@2020
password: 123456
servlet:
multipart:
max-file-size: 100MB

@ -18,7 +18,7 @@ mybatis-plus:
map-underscore-to-camel-case: false # 使用驼峰命名
auto-mapping-behavior: partial
auto-mapping-unknown-column-behavior: none
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
use-column-label: true # 是否可以使用列的别名
global-config:
banner: true

Loading…
Cancel
Save