opt: 优化流量限制功能
This commit is contained in:
@@ -181,24 +181,24 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
|||||||
getAgvStatus();
|
getAgvStatus();
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
String isError;
|
String isError;
|
||||||
if(is_error){
|
if (is_error) {
|
||||||
isError = "报错";
|
isError = "报错";
|
||||||
}else{
|
} else {
|
||||||
isError = "正常";
|
isError = "正常";
|
||||||
}
|
}
|
||||||
if(CommonFinalParam.ONE.equals(upload_scene_status)){
|
if (CommonFinalParam.ONE.equals(upload_scene_status)) {
|
||||||
upload_scene_status = "正在更新场景";
|
upload_scene_status = "正在更新场景";
|
||||||
}else if(CommonFinalParam.TWO.equals(upload_scene_status)){
|
} else if (CommonFinalParam.TWO.equals(upload_scene_status)) {
|
||||||
upload_scene_status = "正在执行运单";
|
upload_scene_status = "正在执行运单";
|
||||||
}else if(CommonFinalParam.DELETE.equals(upload_scene_status)){
|
} else if (CommonFinalParam.DELETE.equals(upload_scene_status)) {
|
||||||
upload_scene_status = "可推送";
|
upload_scene_status = "可推送";
|
||||||
}
|
}
|
||||||
jo.put("is_error",isError);
|
jo.put("is_error", isError);
|
||||||
jo.put("upload_scene_status",upload_scene_status);
|
jo.put("upload_scene_status", upload_scene_status);
|
||||||
jo.put("procBusiness",procBusiness);
|
jo.put("procBusiness", procBusiness);
|
||||||
jo.put("current_order",current_order);
|
jo.put("current_order", current_order);
|
||||||
jo.put("connection_status",connection_status);
|
jo.put("connection_status", connection_status);
|
||||||
jo.put("dispatchable",dispatchable);
|
jo.put("dispatchable", dispatchable);
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,13 +209,12 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取机器人信息
|
* 获取机器人信息
|
||||||
*/
|
*/
|
||||||
private void getAgvStatus() {
|
private void getAgvStatus() {
|
||||||
HttpResponse robotInfo = xianGongAgvService.getRobotInfo(this.getDevice().getDevice_name());
|
HttpResponse robotInfo = xianGongAgvService.getRobotInfo(this.getDevice().getDevice_name());
|
||||||
if(robotInfo.getStatus() == 200){
|
if (robotInfo.getStatus() == 200) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(robotInfo.body());
|
JSONObject jsonObject = JSONObject.parseObject(robotInfo.body());
|
||||||
String report = jsonObject.getString("report");
|
String report = jsonObject.getString("report");
|
||||||
//core出错标识
|
//core出错标识
|
||||||
@@ -223,8 +222,8 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
|||||||
//是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单
|
//是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单
|
||||||
upload_scene_status = jsonObject.getString("upload_scene_status");
|
upload_scene_status = jsonObject.getString("upload_scene_status");
|
||||||
JSONArray objects = JSONObject.parseArray(report);
|
JSONArray objects = JSONObject.parseArray(report);
|
||||||
for (int i = 0; i < objects.size(); i++) {
|
for (Object object : objects) {
|
||||||
JSONObject json = (JSONObject)objects.get(i);
|
JSONObject json = (JSONObject) object;
|
||||||
//是否正在执行用户下发的运单
|
//是否正在执行用户下发的运单
|
||||||
procBusiness = json.getBooleanValue("procBusiness");
|
procBusiness = json.getBooleanValue("procBusiness");
|
||||||
//机器人当前运单
|
//机器人当前运单
|
||||||
@@ -234,7 +233,7 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
|||||||
//机器人可接单状态 true=可接单 false=不可接单
|
//机器人可接单状态 true=可接单 false=不可接单
|
||||||
dispatchable = json.getString("dispatchable");
|
dispatchable = json.getString("dispatchable");
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
log.info("请求{}机器人状态失败", this.getDevice().getDevice_name());
|
log.info("请求{}机器人状态失败", this.getDevice().getDevice_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ public class LimitRegionalController {
|
|||||||
return new ResponseEntity<>( HttpStatus.OK);
|
return new ResponseEntity<>( HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("selectByRegion")
|
||||||
|
@Log("查询区域")
|
||||||
|
public ResponseEntity<Object> selectByRegion() {
|
||||||
|
return new ResponseEntity<>(limitRegionalService.selectByRegion(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("updateActive")
|
@GetMapping("updateActive")
|
||||||
@Log("修改流量限制状态")
|
@Log("修改流量限制状态")
|
||||||
public ResponseEntity<Object> updateStatusById(@RequestParam Map whereJson) {
|
public ResponseEntity<Object> updateStatusById(@RequestParam Map whereJson) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface LimitRegionalService extends CommonService<LimitRegional> {
|
public interface LimitRegionalService extends CommonService<LimitRegional> {
|
||||||
@@ -61,4 +62,10 @@ public interface LimitRegionalService extends CommonService<LimitRegional> {
|
|||||||
* @param nextRegion
|
* @param nextRegion
|
||||||
*/
|
*/
|
||||||
LimitRegionalDto selectByReging(String startdevice, String nextRegion);
|
LimitRegionalDto selectByReging(String startdevice, String nextRegion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询区域
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TreeSet<Integer> selectByRegion();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.nl.acs.limit_regional.domain.LimitRegional;
|
|||||||
import org.nl.acs.limit_regional.server.LimitRegionalService;
|
import org.nl.acs.limit_regional.server.LimitRegionalService;
|
||||||
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
|
import org.nl.acs.limit_regional.server.dto.LimitRegionalDto;
|
||||||
import org.nl.acs.limit_regional.server.mapper.LimitRegionalMapper;
|
import org.nl.acs.limit_regional.server.mapper.LimitRegionalMapper;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
import org.nl.acs.utils.ConvertUtil;
|
import org.nl.acs.utils.ConvertUtil;
|
||||||
import org.nl.acs.utils.PageUtil;
|
import org.nl.acs.utils.PageUtil;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
@@ -30,6 +31,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static sun.audio.AudioDevice.device;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -39,6 +42,9 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LimitRegionalMapper limitRegionalMapper;
|
private LimitRegionalMapper limitRegionalMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceAppService deviceAppService;
|
||||||
|
|
||||||
private List<LimitRegional> dataList;
|
private List<LimitRegional> dataList;
|
||||||
|
|
||||||
|
|
||||||
@@ -75,6 +81,8 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LimitRegional> add(JSONObject json) {
|
public List<LimitRegional> add(JSONObject json) {
|
||||||
|
TreeSet<Integer> integers = deviceAppService.selectRegion();
|
||||||
|
integers.remove(0);
|
||||||
LimitRegional limitRegional = new LimitRegional();
|
LimitRegional limitRegional = new LimitRegional();
|
||||||
limitRegional.setId(RandomUtil.randomString(8));
|
limitRegional.setId(RandomUtil.randomString(8));
|
||||||
limitRegional.setStart_regional(json.getString("start_regional"));
|
limitRegional.setStart_regional(json.getString("start_regional"));
|
||||||
@@ -144,4 +152,11 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TreeSet<Integer> selectByRegion() {
|
||||||
|
TreeSet<Integer> integers = deviceAppService.selectRegion();
|
||||||
|
integers.remove(0);
|
||||||
|
return integers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.nl.acs.device_driver.LinewayDeviceDriver;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 20220102CG\noblelift
|
* @author 20220102CG\noblelift
|
||||||
@@ -123,4 +124,8 @@ public interface DeviceAppService {
|
|||||||
*/
|
*/
|
||||||
void addDevice(String deviceCode);
|
void addDevice(String deviceCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查找设备区域
|
||||||
|
*/
|
||||||
|
TreeSet<Integer> selectRegion();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,4 +400,13 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TreeSet<Integer> selectRegion() {
|
||||||
|
TreeSet<Integer> set = new TreeSet<>();
|
||||||
|
for (Device device : devices) {
|
||||||
|
set.add(Integer.parseInt(StrUtil.isEmpty(device.getRegion()) ? "0" : device.getRegion()));
|
||||||
|
}
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import org.nl.acs.instruction.domain.InstructionMybatis;
|
|||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.task.domain.Task;
|
import org.nl.acs.task.domain.Task;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.system.service.logging.ISysLogService;
|
||||||
|
import org.nl.system.service.logging.dao.SysLog;
|
||||||
|
import org.nl.system.service.param.ISysParamService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -29,19 +32,31 @@ public class DeleteDeviceErrorLog {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private InstructionService instructionService;
|
private InstructionService instructionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysLogService sysLogService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysParamService paramService;
|
||||||
|
|
||||||
public void run(){
|
public void run(){
|
||||||
log.info("开始删除设备报警记录");
|
|
||||||
|
int days = Integer.parseInt(paramService.findByCode("logs_day").getValue());
|
||||||
|
log.info("开始自动清理日志");
|
||||||
errorLogServer.remove(Wrappers.lambdaQuery(AcsDeviceErrorLog.class)
|
errorLogServer.remove(Wrappers.lambdaQuery(AcsDeviceErrorLog.class)
|
||||||
.lt(AcsDeviceErrorLog::getError_time, LocalDateTime.now().minusDays(15)));
|
.lt(AcsDeviceErrorLog::getError_time, LocalDateTime.now().minusDays(days)));
|
||||||
log.info("已将设备报警记录中超过十五天的删除成功");
|
log.info("已将设备报警记录中超过十五天的删除成功");
|
||||||
|
|
||||||
taskService.remove(Wrappers.lambdaQuery(Task.class)
|
taskService.remove(Wrappers.lambdaQuery(Task.class)
|
||||||
.lt(Task::getCreate_time, LocalDateTime.now().minusDays(30)));
|
.lt(Task::getCreate_time, LocalDateTime.now().minusDays(days)));
|
||||||
log.info("已将任务记录中超过三十天的删除成功");
|
log.info("已将任务记录中超过三十天的删除成功");
|
||||||
|
|
||||||
instructionService.remove(Wrappers.lambdaQuery(InstructionMybatis.class)
|
instructionService.remove(Wrappers.lambdaQuery(InstructionMybatis.class)
|
||||||
.lt(InstructionMybatis::getCreate_time, LocalDateTime.now().minusDays(30)));
|
.lt(InstructionMybatis::getCreate_time, LocalDateTime.now().minusDays(days)));
|
||||||
log.info("已将指令记录中超过三十天的删除成功");
|
log.info("已将指令记录中超过三十天的删除成功");
|
||||||
|
|
||||||
|
sysLogService.remove(Wrappers.lambdaQuery(SysLog.class)
|
||||||
|
.lt(SysLog::getCreate_time, LocalDateTime.now().minusDays(days)));
|
||||||
|
log.info("已将日志记录中超过三十天的删除成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,4 +38,11 @@ export function updateOn(id, is_active) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, updateOn, reload }
|
export function deviceByRegion() {
|
||||||
|
return request({
|
||||||
|
url: '/api/acsRegional/selectByRegion',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, updateOn, reload, deviceByRegion }
|
||||||
|
|||||||
@@ -40,13 +40,42 @@
|
|||||||
:label="$t('regional.table.origin_region')"
|
:label="$t('regional.table.origin_region')"
|
||||||
prop="start_regional"
|
prop="start_regional"
|
||||||
>
|
>
|
||||||
<el-input v-model="form.start_regional" :disabled="crud.status.edit" style="width: 370px;" />
|
<!-- <el-input v-model="form.start_regional" :disabled="crud.status.edit" style="width: 370px;" /> -->
|
||||||
|
<el-select
|
||||||
|
v-model="form.start_regional"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
reserve-keyword
|
||||||
|
:placeholder="$t('auto.common.please')"
|
||||||
|
style="width: 370px;"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceRegion"
|
||||||
|
:key="item"
|
||||||
|
:label="item"
|
||||||
|
:value="item"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="$t('regional.table.target_region')"
|
:label="$t('regional.table.target_region')"
|
||||||
prop="next_regional"
|
|
||||||
>
|
>
|
||||||
<el-input v-model="form.next_regional" :disabled="crud.status.edit" style="width: 370px;" />
|
<!-- <el-input v-model="form.next_regional" :disabled="crud.status.edit" style="width: 370px;" /> prop="next_regional" -->
|
||||||
|
<el-select
|
||||||
|
v-model="form.next_regional"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
reserve-keyword
|
||||||
|
:placeholder="$t('auto.common.please')"
|
||||||
|
style="width: 370px;"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceRegion"
|
||||||
|
:key="item"
|
||||||
|
:label="item"
|
||||||
|
:value="item"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="$t('regional.table.origin_region_excluded_devices')"
|
:label="$t('regional.table.origin_region_excluded_devices')"
|
||||||
@@ -237,6 +266,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
deviceList: [],
|
deviceList: [],
|
||||||
|
deviceRegion: [],
|
||||||
permission: {
|
permission: {
|
||||||
add: ['admin', 'acsRegional:add'],
|
add: ['admin', 'acsRegional:add'],
|
||||||
edit: ['admin', 'acsRegional:edit'],
|
edit: ['admin', 'acsRegional:edit'],
|
||||||
@@ -268,6 +298,7 @@ export default {
|
|||||||
this.deviceList = data
|
this.deviceList = data
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
this.deviceByRegions()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
@@ -281,6 +312,17 @@ export default {
|
|||||||
console.log(err.response.data.message)
|
console.log(err.response.data.message)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
deviceByRegions() {
|
||||||
|
console.log('-=================================')
|
||||||
|
crudAcsRegional.deviceByRegion()
|
||||||
|
.then(res => {
|
||||||
|
console.log(res)
|
||||||
|
this.deviceRegion = res
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
updateIsOn(id, is_active) {
|
updateIsOn(id, is_active) {
|
||||||
var msg = this.$t('regional.table.disabled')
|
var msg = this.$t('regional.table.disabled')
|
||||||
if (is_active === '1') {
|
if (is_active === '1') {
|
||||||
|
|||||||
Reference in New Issue
Block a user