|
|
|
@ -3,11 +3,13 @@ package com.glxp.api.admin.controller.info;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.glxp.api.admin.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.admin.constant.Constant;
|
|
|
|
|
import com.glxp.api.admin.entity.info.SyncDataBustypeEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.info.SyncDataSetEntity;
|
|
|
|
|
import com.glxp.api.admin.res.info.SyncDataSetResponse;
|
|
|
|
|
import com.glxp.api.admin.service.info.SyncDataBustypeService;
|
|
|
|
|
import com.glxp.api.admin.service.info.SyncDataSetService;
|
|
|
|
|
import com.glxp.api.admin.util.RedisUtil;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
@ -29,12 +31,22 @@ public class SyncDataSetController {
|
|
|
|
|
private SyncDataSetService syncDataSetService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SyncDataBustypeService syncDataBustypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("system/param/syncData/config")
|
|
|
|
|
@GetMapping("/system/param/syncData/config")
|
|
|
|
|
public BaseResponse list() {
|
|
|
|
|
return ResultVOUtils.success(syncDataSetService.selectSet());
|
|
|
|
|
|
|
|
|
|
Integer delaySyncTime = (Integer) redisUtil.get(Constant.DELAY_SYNC_TIME);
|
|
|
|
|
if (delaySyncTime != null) {
|
|
|
|
|
long time = redisUtil.getExpire(Constant.DELAY_SYNC_TIME);
|
|
|
|
|
delaySyncTime = Math.toIntExact(time) / 60;
|
|
|
|
|
}
|
|
|
|
|
SyncDataSetResponse syncDataSetResponse = syncDataSetService.selectSet();
|
|
|
|
|
syncDataSetResponse.setDelaySyncTime(delaySyncTime);
|
|
|
|
|
return ResultVOUtils.success(syncDataSetResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("system/param/syncData/save")
|
|
|
|
@ -49,10 +61,14 @@ public class SyncDataSetController {
|
|
|
|
|
syncDataBustypeService.inserts(busTypes);
|
|
|
|
|
syncDataSetEntity.setBusTypes(null);
|
|
|
|
|
boolean b = syncDataSetService.insert(syncDataSetEntity);
|
|
|
|
|
if (syncDataSetResponse.getDelaySyncTime() != null &&
|
|
|
|
|
syncDataSetResponse.getDelaySyncTime() > 0) {
|
|
|
|
|
redisUtil.set(Constant.DELAY_SYNC_TIME, syncDataSetResponse.getDelaySyncTime(), (syncDataSetResponse.getDelaySyncTime() + 1) * 60);
|
|
|
|
|
redisUtil.set("SPS_SYNC_GEN_DATA", System.currentTimeMillis() + syncDataSetResponse.getDelaySyncTime() * 60 * 1000);
|
|
|
|
|
}
|
|
|
|
|
if (!b) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|