Browse Source

add:增加充电桩管理

master
张东升 4 weeks ago
parent
commit
f9a04fb2f6
  1. 2
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  2. 15
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/dict/SysDictController.java
  3. 3
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/ISysDictService.java
  4. 18
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java
  5. 18
      acs/nladmin-ui/src/views/system/param/index.vue
  6. 18
      acs/nladmin-ui/src/views/system/param/param.js
  7. 150
      acs/nladmin-ui/src/views/system/param/stationDialog.vue

2
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -360,7 +360,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
//判断是否已下发充电任务
Dict dict1 = dictService.getDictByName3("station",String.valueOf(this.agvaddr),null);
if(ObjectUtil.isNotEmpty(dict1)){
log.info("当前车辆{}已分配充电桩{},退出后续判断",carno,dict1.getPara1());
log.info("当前车辆{}已分配充电桩{},退出后续判断",this.agvaddr,dict1.getPara1());
}else{
//未下发,判断是否有空闲充电桩
Dict dict = dictService.getDictByName2("station");

15
acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/dict/SysDictController.java

@ -67,6 +67,14 @@ public class SysDictController {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/initDict")
@Log("初始化字典")
@ApiOperation("初始化字典")
public ResponseEntity<Object> initDict(@Validated @RequestBody Dict dto){
dictService.initDict(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除字典")
@ApiOperation("删除字典")
@DeleteMapping
@ -94,6 +102,13 @@ public class SysDictController {
return new ResponseEntity<>(dictMap, HttpStatus.OK);
}
@GetMapping("/showDetail2")
@Log("查询字典明细")
@ApiOperation("查询字典明细")
public ResponseEntity<Object> showDetail2(@RequestParam String name){
return new ResponseEntity<>(dictService.getDictByName(name), HttpStatus.OK);
}
@Log("新增字典详情")
@ApiOperation("新增字典详情")
@PostMapping("/dictDetail")

3
acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/ISysDictService.java

@ -41,6 +41,9 @@ public interface ISysDictService extends IService<Dict> {
*/
void updateDict(Dict dto);
void initDict(Dict dto);
/**
* 通过id批量删除字典
* @param ids

18
acs/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java

@ -94,6 +94,24 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
});
}
@Override
@Transactional(rollbackFor = Exception.class)
public void initDict(Dict dto) {
Dict dict = sysDictMapper.selectById(dto.getDict_id());
if (ObjectUtil.isEmpty(dict)) {
throw new BadRequestException("字典不存在");
}
String currentUserId = SecurityUtils.getCurrentUserId();
String currentNickName = SecurityUtils.getCurrentNickName();
dict.setValue("0");
dict.setPara2("");
dict.setPara3("充电桩空闲");
dict.setUpdate_id(currentUserId);
dict.setUpdate_name(currentNickName);
dict.setUpdate_time(DateUtil.now());
sysDictMapper.updateById(dict);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteBatchByIds(Set<String> ids) {

18
acs/nladmin-ui/src/views/system/param/index.vue

@ -14,6 +14,16 @@
>
配置自动充电
</el-button>
<el-button
slot="right"
class="filter-item"
type="primary"
icon="el-icon-position"
size="mini"
@click="divOpenStation"
>
充电桩管理
</el-button>
</crudOperation>
<!--表单组件-->
<el-dialog
@ -71,6 +81,7 @@
<pagination />
</div>
<tube-dialog2 :dialog-show.sync="showView2" @AddChanged="querytable" />
<station-dialog :dialog-show.sync="showStation" @AddChanged="querytable" />
</div>
</template>
@ -81,6 +92,7 @@ import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import TubeDialog2 from '@/views/system/param/tubeDialog2.vue'
import StationDialog from '@/views/system/param/stationDialog.vue'
const defaultForm = {
id: null,
@ -92,7 +104,7 @@ const defaultForm = {
}
export default {
name: 'Param',
components: { pagination, crudOperation, udOperation, TubeDialog2 },
components: { pagination, crudOperation, udOperation, TubeDialog2, StationDialog },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({ title: '系统参数', url: 'api/param', idField: 'id', sort: 'id,desc', crudMethod: { ...crudParam },
@ -113,6 +125,7 @@ export default {
del: ['admin', 'param:del']
},
showView2: false,
showStation: false,
rules: {
id: [
{ required: true, message: '不能为空', trigger: 'blur' }
@ -144,6 +157,9 @@ export default {
},
divOpen() {
this.showView2 = true
},
divOpenStation() {
this.showStation = true
}
}
}

18
acs/nladmin-ui/src/views/system/param/param.js

@ -46,4 +46,20 @@ export function setParam(data) {
})
}
export default { add, edit, del, getValueByCode, queryParam, setParam }
export function showDetail2(params) {
return request({
url: 'api/dict/showDetail2',
method: 'get',
params
})
}
export function initDict(data) {
return request({
url: 'api/dict/initDict',
method: 'post',
data
})
}
export default { add, edit, del, getValueByCode, queryParam, setParam, showDetail2, initDict }

150
acs/nladmin-ui/src/views/system/param/stationDialog.vue

@ -0,0 +1,150 @@
<template>
<el-dialog
append-to-body
v-loading.fullscreen.lock="fullscreenLoading"
title="充电桩管理"
:visible.sync="dialogVisible"
destroy-on-close
width="1200px"
@close="close"
@open="open"
>
<div class="grid-container">
<el-table
ref="table2"
:data="tableDtl"
style="width: 100%;"
size="mini"
:cell-style="cellStyle"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column v-if="false" prop="dict_id" label="uuid" align="center" />
<el-table-column min-width="60" prop="label" label="充电桩名称" align="center" />
<el-table-column prop="value" label="是否分配车辆(1是0否)" align="center" width="150" />
<el-table-column min-width="60" prop="para1" label="充电桩站点" align="center" />
<el-table-column min-width="50" prop="para2" label="当前车号" align="center" />
<el-table-column min-width="60" prop="use_time" label="充电时长(H)" align="center" :formatter="Myduration" />
<el-table-column min-width="60" prop="para3" label="充电状态" align="center" />
<el-table-column prop="update_time" label="修改时间" align="center" />
<el-table-column prop="update_name" label="修改人" align="center" />
<el-table-column
fixed="right"
label="操作"
width="150">
<template slot-scope="scope">
<el-button @click="handleClick(scope.row)" type="danger" size="small">初始化充电桩信息</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
</template>
<script>
import crudParam, {updateDict} from '@/views/system/param/param'
import { crud } from '@crud/crud'
export default {
name: 'StationDialog',
components: { },
mixins: [crud()],
props: {
dialogShow: {
type: Boolean,
default: false
}
},
data() {
return {
dialogVisible: false,
fullscreenLoading: false,
tableDtl: [],
form: {
electric: 0,
electric2: 0,
electric_begin: '06:00',
electric_end: '18:00'
}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
open() {
this.queryTableDtl()
},
close() {
this.$emit('update:dialogShow', false)
this.tableDtl = []
this.$emit('AddChanged')
},
Myduration(row, column) {
const start = new Date(row.update_time)
const end = new Date()
const diffTime = Math.abs(end - start)
let diffDays = 0
if (row.para2 && row.para2 !== null) {
diffDays = Math.ceil(diffTime / (1000 * 60 * 60)) // H
}
return diffDays
},
handleClick(row) {
this.$confirm('此操作将初始化充电桩信息, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.fullscreenLoading = true
debugger
crudParam.initDict(row).then(res => {
this.$message({
type: 'success',
message: '初始化成功!'
})
this.fullscreenLoading = false
this.queryTableDtl()
}).catch(() => {
this.fullscreenLoading = false
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
cellStyle({ row, column, rowIndex, columnIndex }) {
if (column.property === 'use_time') {
const start = new Date(row.update_time)
const end = new Date()
const diffTime = Math.abs(end - start)
let diffDays = 0
if (row.para2 && row.para2 !== null) {
diffDays = Math.ceil(diffTime / (1000 * 60 * 60)) // H
}
if (diffDays > 0 && diffDays <= 3) {
return 'background: #13ce66'
} else if (diffDays > 3) {
return 'background: red'
}
}
},
queryTableDtl() {
crudParam.showDetail2({ 'name': 'station' }).then(res => {
this.tableDtl = res
})
}
}
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save