add:新增手动下发充电任务
This commit is contained in:
@@ -86,4 +86,6 @@ public interface NDCAgvService {
|
||||
public boolean createChargingTaskToNDC(String carno);
|
||||
|
||||
public void charge(String carno);
|
||||
|
||||
public void charge(String carno,String station);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -585,4 +586,59 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
return AGVDeviceStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void charge(String carno, String station) {
|
||||
//判断当前充电桩是否已下发充电任务
|
||||
Dict temp = dictService.getDictByName2("station", station);
|
||||
if (ObjectUtil.isNotEmpty(temp)) {
|
||||
int satation = 0;
|
||||
if(ObjectUtil.isNotEmpty(temp)){
|
||||
satation = Integer.parseInt(temp.getPara1());
|
||||
}
|
||||
String instcode =CodeUtil.getNewCode("INSTRUCT_NO");
|
||||
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||
byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno));
|
||||
byte carlow = (byte) IntToHexLow(Integer.parseInt(carno));
|
||||
byte satationhigh = (byte) IntToHexHigh(satation);
|
||||
byte satationlow = (byte) IntToHexLow(satation);
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "ikey:" + (Integer.parseInt(instcode));
|
||||
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
|
||||
str += "carno:" + (Integer.parseInt(carno));
|
||||
str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF);
|
||||
str += "/satation:" + (satation);
|
||||
str1 += "/satation:" + hexToString(satationhigh & 0xFF) + hexToString(satationlow & 0xFF);
|
||||
//todo 核对NDC协议
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X0E,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X0A,
|
||||
(byte) 0X64, (byte) 0X80,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) carhigh, (byte) carlow,
|
||||
(byte) satationhigh, (byte) satationlow
|
||||
|
||||
};
|
||||
log.info("下发AGV充电任务--{}", str1);
|
||||
|
||||
try{
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
temp.setValue("1");
|
||||
temp.setPara2(String.valueOf(carno));
|
||||
dictService.updateDetail(temp);
|
||||
} catch (Exception e){
|
||||
log.error("下发充电任务失败{}{}",e,e.getMessage());
|
||||
}
|
||||
|
||||
} else {
|
||||
log.info("当前充电桩{}已被使用!请检查充电桩状态再操作!", station);
|
||||
throw new BadRequestException("当前充电桩已被使用或者车号不为空,请检查充电桩状态再操作!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
@@ -62,6 +64,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
AutoRunService autoRunService;
|
||||
@Autowired
|
||||
LuceneExecuteLogService luceneExecuteLogService;
|
||||
@Autowired
|
||||
ISysDictService dictService;
|
||||
|
||||
|
||||
public OneNDCSocketConnectionAutoRun() {
|
||||
@@ -133,6 +137,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
int agvaddr = arr[18] * 256 + arr[19];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
//充电桩站点号
|
||||
int station = arr[25];
|
||||
Instruction link_inst = null;
|
||||
Instruction inst = null;
|
||||
List<Instruction> insts = null;
|
||||
@@ -196,6 +202,28 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
|
||||
}else if (phase == 0x64){
|
||||
log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}",agvaddr,station);
|
||||
Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null);
|
||||
if (ObjectUtil.isNotEmpty(dict)){
|
||||
dict.setValue("1");
|
||||
dict.setPara2(String.valueOf(agvaddr));
|
||||
dict.setPara3("下发成功");
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
//充电成功
|
||||
}else if (phase == 0x65){
|
||||
log.info("AGV车号{}反馈充电中,充电桩{}",agvaddr,station);
|
||||
//充电取消上报
|
||||
}else if (phase == 0x66){
|
||||
log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}",agvaddr,station);
|
||||
Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null);
|
||||
if (ObjectUtil.isNotEmpty(dict)){
|
||||
dict.setValue("0");
|
||||
dict.setPara2("");
|
||||
dict.setPara3("充电桩空闲");
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.acs.device.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
@@ -55,6 +56,14 @@ public class DeviceController {
|
||||
deviceService.downDeviceDBloadCSV(deviceService.queryDeviceProtocol(whereJson), response);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCarList")
|
||||
@Log("下拉选车号")
|
||||
@ApiOperation("下拉选车号")
|
||||
//@PreAuthorize("@el.check('routePlan:list')")
|
||||
public ResponseEntity<Object> selectCarList() {
|
||||
return new ResponseEntity<>(deviceService.selectCarList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DeviceDto dto) {
|
||||
|
||||
@@ -383,4 +383,6 @@ public interface DeviceService extends CommonService<Device> {
|
||||
* @return
|
||||
*/
|
||||
JSONArray selectDriverCodeList(String device_code);
|
||||
|
||||
JSONArray selectCarList();
|
||||
}
|
||||
|
||||
@@ -1989,4 +1989,18 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
ja = JSONArray.parseArray(JSON.toJSONString(uniqueDriverSet));
|
||||
return ja;
|
||||
}
|
||||
|
||||
public JSONArray selectCarList() {
|
||||
List<Device> deviceList = new LambdaQueryChainWrapper<>(deviceMapper).apply("device_type = 'agv' AND is_delete= '0' AND is_active= '1' AND is_config = 'true'").orderByAsc(Device::getDevice_code).list();
|
||||
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(deviceList));
|
||||
JSONArray result = new JSONArray();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject obj = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", obj.getString("device_code"));
|
||||
json.put("device_name", obj.getString("device_name"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.system.controller.dict;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
@@ -36,13 +37,13 @@ public class SysDictController {
|
||||
|
||||
@Log("查询字典")
|
||||
@GetMapping
|
||||
|
||||
|
||||
// @SaCheckPermission("dict:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery pageable){
|
||||
return new ResponseEntity<>(TableDataInfo.build(dictService.queryAll(whereJson,pageable)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping(value = "/all")
|
||||
// @SaCheckPermission("dict:list")
|
||||
public ResponseEntity<Object> queryAll(){
|
||||
@@ -51,16 +52,24 @@ public class SysDictController {
|
||||
|
||||
@Log("新增字典")
|
||||
@PostMapping
|
||||
|
||||
|
||||
// @SaCheckPermission("dict:add")
|
||||
public ResponseEntity<Object> create(@RequestBody Dict dict){
|
||||
dictService.create(dict);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("查询充电桩")
|
||||
@PutMapping( "/{car}")
|
||||
@ApiOperation("查询充电桩")
|
||||
// @SaCheckPermission("dict:list")
|
||||
public ResponseEntity<Object> selectStationByCar(@PathVariable String car){
|
||||
return new ResponseEntity<>(dictService.selectStationByCar(car), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改字典")
|
||||
|
||||
|
||||
//@SaCheckPermission("@el.check('dict:edit')")
|
||||
public ResponseEntity<Object> updateDict(@Validated @RequestBody Dict dto){
|
||||
dictService.updateDict(dto);
|
||||
@@ -68,7 +77,7 @@ public class SysDictController {
|
||||
}
|
||||
|
||||
@Log("删除字典")
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
// @SaCheckPermission("dict:del")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids){
|
||||
@@ -77,13 +86,13 @@ public class SysDictController {
|
||||
}
|
||||
|
||||
@GetMapping("/dictDetail")
|
||||
|
||||
|
||||
public ResponseEntity<Object> queryDetails(@RequestParam Map criteria, PageQuery pageable){
|
||||
DictQuery dictQuery = JSONObject.parseObject(JSONObject.toJSONString(criteria), DictQuery.class);
|
||||
return new ResponseEntity<>(TableDataInfo.build(dictService.queryAllDetail(dictQuery,pageable)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping(value = "/dictDetail/map")
|
||||
public ResponseEntity<Object> getDictDetailMaps(@RequestParam String dictName){
|
||||
String[] names = dictName.split("[,,]");
|
||||
@@ -95,7 +104,7 @@ public class SysDictController {
|
||||
}
|
||||
|
||||
@Log("新增字典详情")
|
||||
|
||||
|
||||
@PostMapping("/dictDetail")
|
||||
// @SaCheckPermission("dict:add")
|
||||
public ResponseEntity<Object> createDetail(@RequestBody Dict resources){
|
||||
@@ -104,7 +113,7 @@ public class SysDictController {
|
||||
}
|
||||
|
||||
@Log("修改字典详情")
|
||||
|
||||
|
||||
@PutMapping("/dictDetail")
|
||||
// @SaCheckPermission("dict:edit")
|
||||
public ResponseEntity<Object> updateDetail(@RequestBody Dict resources){
|
||||
@@ -113,7 +122,7 @@ public class SysDictController {
|
||||
}
|
||||
|
||||
@Log("删除字典详情")
|
||||
|
||||
|
||||
@DeleteMapping(value = "/dictDetail/{id}")
|
||||
// @SaCheckPermission("dict:del")
|
||||
public ResponseEntity<Object> deleteDetail(@PathVariable String id){
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.system.controller.param;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -36,7 +38,7 @@ class SysParamController {
|
||||
|
||||
@Autowired
|
||||
private ISysParamService paramService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@Log("查询系统参数")
|
||||
//@SaCheckPermission("param:list")
|
||||
@@ -87,6 +89,15 @@ class SysParamController {
|
||||
paramService.setParam(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendTask")
|
||||
@Log("下发充电任务")
|
||||
@ApiOperation("下发充电任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendTask(@RequestBody JSONObject json) {
|
||||
paramService.sendTask(json);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.system.service.dict;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -103,4 +104,8 @@ public interface ISysDictService extends IService<Dict> {
|
||||
* @return
|
||||
*/
|
||||
Dict getDictByName3(String name,String carno,String station);
|
||||
|
||||
Dict getDictByName2(String name,String station);
|
||||
|
||||
JSONArray selectStationByCar(String car);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,17 @@ package org.nl.system.service.dict.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.ibatis.annotations.Lang;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.mapper.DeviceMapper;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -37,6 +42,8 @@ import java.util.Set;
|
||||
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> implements ISysDictService {
|
||||
@Autowired
|
||||
private SysDictMapper sysDictMapper;
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
@Override
|
||||
public IPage<Dict> queryAll(Map whereJson, PageQuery page) {
|
||||
@@ -197,14 +204,6 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
sysDictMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dict> queryAll() {
|
||||
return sysDictMapper.selectList(new QueryWrapper<Dict>()
|
||||
.select("MAX(dict_id) AS dictId, code, name")
|
||||
.lambda()
|
||||
.groupBy(Dict::getCode, Dict::getName));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void initDict(Dict dto) {
|
||||
@@ -223,6 +222,24 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
sysDictMapper.updateById(dict);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray selectStationByCar(String car) {
|
||||
Device device = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_code", car));
|
||||
String manufacturer = device.getManufacturer();//车间
|
||||
List<Dict> stations = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getDict_type, manufacturer));
|
||||
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(stations));
|
||||
JSONArray result = new JSONArray();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject obj = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
String value = obj.getString("value");
|
||||
json.put("label", obj.getString("label") + ("1".equals(obj.getString("value")) ? "(已使用)" : "(未使用)"));
|
||||
json.put("para1", obj.getString("para1"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dict getDictByName2(String name) {
|
||||
Dict dict = null;
|
||||
@@ -240,6 +257,32 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
return dict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dict getDictByName2(String name, String station) {
|
||||
Dict dict = null;
|
||||
Dict dict1 = sysDictMapper.selectOne(
|
||||
new LambdaQueryWrapper<Dict>()
|
||||
.eq(Dict::getCode, name)
|
||||
.eq(ObjectUtil.isNotEmpty(station), Dict::getPara1, station)
|
||||
.eq(Dict::getValue, "0")
|
||||
.and(slam -> slam.isNull(Dict::getPara2)
|
||||
.or()
|
||||
.eq(Dict::getPara2, ""))
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(dict1)) {
|
||||
dict = dict1;
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dict> queryAll() {
|
||||
return sysDictMapper.selectList(new QueryWrapper<Dict>()
|
||||
.select("MAX(dict_id) AS dictId, code, name")
|
||||
.lambda()
|
||||
.groupBy(Dict::getCode, Dict::getName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dict getDictByName3(String name,String carno,String station) {
|
||||
Dict dict = null;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.system.service.param;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -61,4 +62,6 @@ public interface ISysParamService extends IService<Param> {
|
||||
Map<String, Object> queryParam();
|
||||
|
||||
void setParam(Map whereJson);
|
||||
|
||||
void sendTask(JSONObject json);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.system.service.param.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -10,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.utils.PageUtil;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -17,10 +20,13 @@ import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.MapOf;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.dao.mapper.SysParamMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -43,6 +49,11 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
||||
|
||||
@Autowired
|
||||
private SysParamMapper paramMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private NDCAgvService ndcAgvService;
|
||||
@Autowired
|
||||
private ISysDictService dictService;
|
||||
|
||||
@Override
|
||||
public IPage<Param> queryPage(Map whereJson, Pageable page) {
|
||||
@@ -170,4 +181,23 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
||||
paramMapper.updateById(param_electric_end);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTask(JSONObject json) {
|
||||
String carno = json.getString("carno");
|
||||
String station = json.getString("station");
|
||||
if (StrUtil.isEmpty(carno)){
|
||||
throw new BadRequestException("车辆编号不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(station)){
|
||||
throw new BadRequestException("充电站编号不能为空");
|
||||
}
|
||||
//判断是否已下发充电任务
|
||||
Dict dict1 = dictService.getDictByName3("station",carno,null);
|
||||
if(ObjectUtil.isNotEmpty(dict1)){
|
||||
log.info("当前车辆{}已分配充电桩{},退出后续判断",carno,dict1.getPara1());
|
||||
}else {
|
||||
ndcAgvService.charge(carno, station);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user