充电重复点击优化
This commit is contained in:
@@ -86,4 +86,6 @@ public class AgvDto implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String type = "AGV";
|
private String type = "AGV";
|
||||||
|
|
||||||
|
private Boolean chargingFlag=false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.hand.amb.service.HFHandService;
|
import org.nl.hand.amb.service.HFHandService;
|
||||||
|
import org.nl.modules.common.annotation.Limit;
|
||||||
import org.nl.modules.logging.annotation.Log;
|
import org.nl.modules.logging.annotation.Log;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -169,6 +170,7 @@ public class HFHandController {
|
|||||||
@Log("创建充电任务")
|
@Log("创建充电任务")
|
||||||
@ApiOperation("创建充电任务")
|
@ApiOperation("创建充电任务")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
|
@Limit(period = 2, count = 1)
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
public ResponseEntity<Object> createChargingTask(@RequestBody Map<String, String> whereJson) {
|
public ResponseEntity<Object> createChargingTask(@RequestBody Map<String, String> whereJson) {
|
||||||
return new ResponseEntity<>(HandService.createChargingTask(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(HandService.createChargingTask(whereJson), HttpStatus.OK);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.agv.server.NDCAgvService;
|
import org.nl.acs.agv.server.NDCAgvService;
|
||||||
import org.nl.acs.agv.server.XianGongAgvService;
|
import org.nl.acs.agv.server.XianGongAgvService;
|
||||||
|
import org.nl.acs.agv.server.dto.AgvDto;
|
||||||
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
|
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
|
||||||
import org.nl.acs.auto.run.AutoRunService;
|
import org.nl.acs.auto.run.AutoRunService;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
@@ -59,6 +60,7 @@ public class HFHandServiceImpl implements HFHandService {
|
|||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final DeviceService deviceService;
|
private final DeviceService deviceService;
|
||||||
private final DeviceAppService deviceAppService;
|
private final DeviceAppService deviceAppService;
|
||||||
|
private final NDCAgvService ndcAgvService;
|
||||||
InstructionService instructionService = null;
|
InstructionService instructionService = null;
|
||||||
|
|
||||||
|
|
||||||
@@ -772,6 +774,12 @@ public class HFHandServiceImpl implements HFHandService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String type = whereJson.get("carno");
|
String type = whereJson.get("carno");
|
||||||
|
AgvDto agv = ndcAgvService.findByCarNumber(type);
|
||||||
|
if(agv.getChargingFlag()){
|
||||||
|
jo.put("code", "0");
|
||||||
|
jo.put("desc", "该车已在充电!");
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||||
try {
|
try {
|
||||||
agvService.createChargingTaskToNDC(type);
|
agvService.createChargingTaskToNDC(type);
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class LimitAspect {
|
|||||||
log.info("第{}次访问key为 {},描述为 [{}] 的接口", count, keys, limit.name());
|
log.info("第{}次访问key为 {},描述为 [{}] 的接口", count, keys, limit.name());
|
||||||
return joinPoint.proceed();
|
return joinPoint.proceed();
|
||||||
} else {
|
} else {
|
||||||
throw new BadRequestException("访问次数受限制");
|
throw new BadRequestException("请不要重复点击!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -970,6 +970,18 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
// 状态
|
// 状态
|
||||||
AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19]));
|
AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19]));
|
||||||
agv.setState(String.valueOf(ikey));
|
agv.setState(String.valueOf(ikey));
|
||||||
|
}else if (phase == 0x40) {
|
||||||
|
// 状态
|
||||||
|
AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19]));
|
||||||
|
agv.setChargingFlag(true);
|
||||||
|
}else if (phase == 0x41) {
|
||||||
|
// 状态
|
||||||
|
AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19]));
|
||||||
|
agv.setChargingFlag(false);
|
||||||
|
}else if (phase == 0x42) {
|
||||||
|
// 状态
|
||||||
|
AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19]));
|
||||||
|
agv.setChargingFlag(false);
|
||||||
}
|
}
|
||||||
if (!ObjectUtil.isEmpty(data)) {
|
if (!ObjectUtil.isEmpty(data)) {
|
||||||
write(data);
|
write(data);
|
||||||
|
|||||||
Reference in New Issue
Block a user