mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 09:55:16 +08:00
管理页面添加人脸识别设备管理,完善人脸识别核销接口
This commit is contained in:
parent
5efc76dfc8
commit
d0191ba05d
@ -559,20 +559,7 @@ public class ClientController extends BaseController {
|
||||
System.out.println("face device heartbeat.....");
|
||||
System.out.println(request);
|
||||
return "ok";
|
||||
// StringBuffer data = new StringBuffer();
|
||||
// String line = null;
|
||||
// BufferedReader reader = null;
|
||||
// try {
|
||||
// reader = request.getReader();
|
||||
// while (null != (line = reader.readLine())) {
|
||||
// data.append(line);
|
||||
// }
|
||||
// JSONObject jsonObject = JSONObject.parseObject(data.toString());
|
||||
// System.out.println(jsonObject);
|
||||
// } catch (IOException e) {
|
||||
// } finally {
|
||||
// }
|
||||
// return data.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -592,6 +579,13 @@ public class ClientController extends BaseController {
|
||||
Integer personId = info.getInteger("PersonID");
|
||||
Long deviceId = info.getLong("DeviceID");
|
||||
|
||||
// 判断该设备是否有效
|
||||
Boolean isEffective = iFtConfigDaoService.isDeviceEffective(deviceId);
|
||||
if (!isEffective) {
|
||||
log.info("设备有效性 : {} ", "该人脸识别设备已失效");
|
||||
return "该人脸识别设备已失效";
|
||||
}
|
||||
|
||||
// 是否有该员工
|
||||
FtStaffInfoDao staffInfoDao = staffInfoDaoService.inStaff(personId);
|
||||
|
||||
@ -616,48 +610,17 @@ public class ClientController extends BaseController {
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + dinnerType);
|
||||
}
|
||||
log.info("人脸核销结果: {}", message);
|
||||
log.info("人脸核销结果 : {}", message);
|
||||
|
||||
return message;
|
||||
|
||||
} else {
|
||||
|
||||
// 如果该人脸id没有对应的员工,则记录找日志中
|
||||
|
||||
log.info("员工查询 : {}", "没有找到该员工");
|
||||
return "没有找到该员工";
|
||||
}
|
||||
|
||||
|
||||
// 跟进人脸id信息,查找该id对应的员工id的当餐订单
|
||||
|
||||
// StringBuffer data = new StringBuffer();
|
||||
//
|
||||
// try {
|
||||
// // 从请求头中获取数据
|
||||
// BufferedReader reader = request.getReader();
|
||||
// String line = null;
|
||||
// while (null != (line = reader.readLine()))
|
||||
// data.append(line);
|
||||
// JSONObject jsonObject = JSONObject.parseObject(data.toString());
|
||||
// System.out.println(jsonObject);
|
||||
//
|
||||
// HashMap<String, Object> map = new HashMap<>();
|
||||
// map.put("flag", 0);
|
||||
// List<FtFaceEventDao> dao = faceEventService.selectByMap(map);
|
||||
// if (dao.size() == 0)
|
||||
// {
|
||||
// JSONObject infoObject = JSONObject.parseObject(jsonObject.getString("info"));
|
||||
// FtFaceEventDao eventDao = new FtFaceEventDao();
|
||||
//
|
||||
// eventDao.setDeviceId(infoObject.getString("DeviceID"));
|
||||
// eventDao.setPersonId(infoObject.getString("PersonID"));
|
||||
//// faceEventService.insert(eventDao);
|
||||
// }
|
||||
// else {
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// } finally {
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -155,7 +155,23 @@ public class FtConfigDaoController extends BaseController {
|
||||
ftConfigDao.setConfigValue(configValue.toString());
|
||||
|
||||
iFtConfigDaoService.update(ftConfigDao, wrapper);
|
||||
System.out.println(params);
|
||||
return null;
|
||||
return AjaxResult.success("已修改");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改人脸识别设备信息
|
||||
*/
|
||||
@PostMapping("/updateFaceDevice")
|
||||
public AjaxResult updateFaceDevice(@RequestBody JSONObject params) {
|
||||
|
||||
String deviceId = params.getString("deviceId");
|
||||
Long deviceConfigId = params.getLong("deviceConfigId");
|
||||
iFtConfigDaoService.updateConfigValue(deviceConfigId, deviceId);
|
||||
|
||||
String deviceFlag = params.getString("deviceFlag");
|
||||
Long flagConfigId = params.getLong("flagConfigId");
|
||||
iFtConfigDaoService.updateConfigValue(flagConfigId, deviceFlag);
|
||||
|
||||
return AjaxResult.success("已修改");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.ruoyi.system.fantang.service;
|
||||
|
||||
import com.ruoyi.system.fantang.domain.FtConfigDao;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.system.fantang.domain.FtConfigDao;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -14,4 +14,8 @@ import java.util.Map;
|
||||
public interface IFtConfigDaoService extends IService<FtConfigDao> {
|
||||
|
||||
Map<String, String> getDinnerTimeSetting();
|
||||
|
||||
void updateConfigValue(Long id, String value);
|
||||
|
||||
Boolean isDeviceEffective(Long deviceId);
|
||||
}
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
package com.ruoyi.system.fantang.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.system.fantang.domain.FtConfigDao;
|
||||
import com.ruoyi.system.fantang.mapper.FtConfigDaoMapper;
|
||||
import com.ruoyi.system.fantang.service.IFtConfigDaoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -38,4 +37,34 @@ public class FtConfigDaoServiceImpl extends ServiceImpl<FtConfigDaoMapper, FtCon
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigValue(Long id, String value) {
|
||||
|
||||
UpdateWrapper<FtConfigDao> wrapper = new UpdateWrapper<>();
|
||||
wrapper.eq("id", id);
|
||||
FtConfigDao ftConfigDao = new FtConfigDao();
|
||||
ftConfigDao.setConfigValue(value);
|
||||
this.baseMapper.update(ftConfigDao, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isDeviceEffective(Long deviceId) {
|
||||
|
||||
QueryWrapper<FtConfigDao> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("config_key", "device_id");
|
||||
wrapper.eq("config_value", deviceId.toString());
|
||||
FtConfigDao ftConfigDao = this.baseMapper.selectOne(wrapper);
|
||||
|
||||
if (ftConfigDao == null) {
|
||||
return false;
|
||||
|
||||
} else {
|
||||
QueryWrapper<FtConfigDao> flagWrapper = new QueryWrapper<>();
|
||||
flagWrapper.eq("config_key", "device_flag");
|
||||
FtConfigDao flagDao = this.baseMapper.selectOne(flagWrapper);
|
||||
|
||||
return !"0".equals(flagDao.getConfigValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,14 @@ export function updateDinnerTime(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function updateFaceDevice(data) {
|
||||
return request({
|
||||
url: '/fantang/fantangConfig/updateFaceDevice',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改饭堂参数
|
||||
export function updateFantangConfig(data) {
|
||||
return request({
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<el-form :inline="true" :model="dinnerForm">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="早餐时间段">
|
||||
<el-form-item label="早餐时间段" label-width="97px">
|
||||
<el-time-picker
|
||||
is-range
|
||||
ref="breakfastPick"
|
||||
@ -26,7 +26,7 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="午餐时间段">
|
||||
<el-form-item label="午餐时间段" label-width="97px">
|
||||
<el-time-picker
|
||||
is-range
|
||||
v-model="dinnerForm.lunch"
|
||||
@ -40,7 +40,7 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="晚餐时间段">
|
||||
<el-form-item label="晚餐时间段" label-width="97px">
|
||||
<el-time-picker
|
||||
is-range
|
||||
v-model="dinnerForm.dinner"
|
||||
@ -50,12 +50,26 @@
|
||||
placeholder="选择时间范围">
|
||||
</el-time-picker>
|
||||
</el-form-item>
|
||||
<el-button type="primary" @click="submitDinnerForm">提交</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitDinnerForm">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-form :inline="true" :model="faceDeviceForm">
|
||||
<el-form-item label="人脸识别设备" label-width="97px">
|
||||
<el-input v-model="faceDeviceForm.deviceId" placeholder="请输入设备 id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否开启">
|
||||
<el-select v-model="faceDeviceForm.deviceFlag" placeholder="请选择是否开启">
|
||||
<el-option
|
||||
v-for="item in deviceFlagOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-button type="primary" @click="submitFaceDeviceForm">提交</el-button>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
@ -71,23 +85,37 @@ import {
|
||||
updateDinnerTime,
|
||||
updateFantangConfig
|
||||
} from "@/api/fantang/fantangConfig";
|
||||
import {updateFaceDevice} from "../../../api/fantang/fantangConfig";
|
||||
|
||||
export default {
|
||||
name: "FantangConfig",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
deviceFlagOptions: [{
|
||||
value: '1',
|
||||
label: '开启'
|
||||
}, {
|
||||
value: '0',
|
||||
label: '关闭'
|
||||
}],
|
||||
timeArr: [],
|
||||
formInline: {
|
||||
configValue: null,
|
||||
id: null,
|
||||
},
|
||||
dinnerForm: {
|
||||
breakfast: [new Date('2016-9-10 8:41'), new Date(2016, 9, 10, 9, 40)],
|
||||
breakfast: [],
|
||||
lunch: [],
|
||||
dinner: [],
|
||||
id: 7,
|
||||
},
|
||||
faceDeviceForm: {
|
||||
deviceId: null,
|
||||
deviceConfigId: 11,
|
||||
deviceFlag: null,
|
||||
flagConfigId: 12,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@ -101,12 +129,12 @@ export default {
|
||||
listFantangConfig().then(response => {
|
||||
this.formInline.configValue = response.rows[7].configValue
|
||||
this.formInline.id = response.rows[7].id
|
||||
console.log("数据库获取--------", response.rows[6].configValue.split(','))
|
||||
|
||||
this.timeArr = response.rows[6].configValue.split(',')
|
||||
this.dinnerForm.breakfast = [new Date(2016, 9, 1, this.timeArr[0].split(':')[0], this.timeArr[0].split(':')[1]), new Date(2016, 9, 1, this.timeArr[1].split(':')[0], this.timeArr[1].split(':')[1])];
|
||||
this.dinnerForm.lunch = [new Date(2016, 9, 1, this.timeArr[2].split(':')[0], this.timeArr[2].split(':')[1]), new Date(2016, 9, 1, this.timeArr[3].split(':')[0], this.timeArr[3].split(':')[1])];
|
||||
this.dinnerForm.dinner = [new Date(2016, 9, 1, this.timeArr[4].split(':')[0], this.timeArr[4].split(':')[1]), new Date(2016, 9, 1, this.timeArr[5].split(':')[0], this.timeArr[5].split(':')[1])];
|
||||
this.faceDeviceForm.deviceId = response.rows[10].configValue;
|
||||
this.faceDeviceForm.deviceFlag = response.rows[11].configValue;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
@ -158,9 +186,20 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 人脸识别设备
|
||||
submitFaceDeviceForm() {
|
||||
if (this.faceDeviceForm.deviceId != null && this.faceDeviceForm.deviceId !== ''
|
||||
&& this.faceDeviceForm.deviceFlag != null && this.faceDeviceForm.deviceFlag !== '') {
|
||||
console.log(this.faceDeviceForm)
|
||||
updateFaceDevice(this.faceDeviceForm).then(response => {
|
||||
this.msgSuccess("修改成功")
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// 用餐时间提交
|
||||
submitDinnerForm() {
|
||||
console.log(this.dinnerForm)
|
||||
updateDinnerTime(this.dinnerForm).then(response => {
|
||||
this.msgSuccess("修改成功")
|
||||
})
|
||||
@ -168,7 +207,6 @@ export default {
|
||||
|
||||
// 补贴金额
|
||||
onSubmit() {
|
||||
console.log(this.formInline)
|
||||
if (this.formInline.configValue != null || this.formInline.configValue !== '')
|
||||
updateFantangConfig(this.formInline).then(response => {
|
||||
this.msgSuccess("修改成功")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user