mirror of
https://gitee.com/elegant_wings/xiongan-meeting.git
synced 2025-06-21 03:49:36 +08:00
修改了对应设备的状态和对应的bug
This commit is contained in:
parent
9aad1f159e
commit
d35bfa64e3
@ -238,13 +238,9 @@ public class CustomerController extends BaseController {
|
||||
@RequiresPermissions("admin:customer:edit")
|
||||
@PostMapping("update")
|
||||
public R editSave(@RequestBody Customer customer) {
|
||||
// if (User.isAdmin(getCurrentUserId())) {
|
||||
// return R.error("不允许超级管理员用户修改");
|
||||
// }
|
||||
ValidatorUtils.validateEntity(customer);
|
||||
customer.setUpdateBy(getLoginName());
|
||||
|
||||
|
||||
//房间转成逗号隔开
|
||||
List<Long> buildingDetailIds = customer.getBuildingDetailIds();
|
||||
|
||||
@ -265,7 +261,7 @@ public class CustomerController extends BaseController {
|
||||
Assert.isTrue(i1 > 0, "修改房间已租状态失败");
|
||||
}
|
||||
}
|
||||
|
||||
//todo 修改成功后需要把里面的用户添加对应的设备
|
||||
|
||||
return toAjax(customerService.updateCustomer(customer));
|
||||
}
|
||||
|
@ -54,6 +54,9 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
* 企业员工 提供者
|
||||
@ -177,7 +180,7 @@ public class CustomerStaffController extends BaseController {
|
||||
|
||||
//如果没有注册小程序的话
|
||||
|
||||
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectByPhone(icsCustomerStaff.getMobile());
|
||||
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectUserByMobile(icsCustomerStaff.getMobile());
|
||||
if (customerStaff != null) {
|
||||
if (icsCustomerStaff.getId() == null) {
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
@ -193,8 +196,8 @@ public class CustomerStaffController extends BaseController {
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(toList());
|
||||
result.addAll(buildCollect);
|
||||
result.addAll(collect);
|
||||
//获取了房间集合,循环对应集合,
|
||||
@ -255,12 +258,65 @@ public class CustomerStaffController extends BaseController {
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(toList());
|
||||
result.addAll(buildCollect);
|
||||
//
|
||||
result.addAll(collect);
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long aLong : result) {
|
||||
//根据楼层获取设备id
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(aLong);
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
//根据设备id获取设备
|
||||
Equipment equipment = equipmentService.selectEquipmentById(detailEquipment.getEquipmentId());
|
||||
if (equipment != null) {
|
||||
String persons = DeviceUtils.queryPersons(equipment.getIp(), String.valueOf(customerStaff.getId()));
|
||||
JSONObject jsonObject = JSONUtil.parseObj(persons);
|
||||
Integer amount = (Integer) jsonObject.get("amount");
|
||||
if (amount <= 0) {
|
||||
DevicePersonDto devicePersonDto = new DevicePersonDto();
|
||||
ArrayList<FacesDto> facesDtos = new ArrayList<>();
|
||||
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
|
||||
devicePersonDto.setName(customerStaff.getName());
|
||||
devicePersonDto.setPhone(String.valueOf(customerStaff.getMobile()));
|
||||
devicePersonDto.setCertificateType("111");
|
||||
devicePersonDto.setCertificateNumber(customerStaff.getCardNo());
|
||||
//添加人员类型
|
||||
devicePersonDto.setPersonType("whitelist");
|
||||
//添加访客时间
|
||||
FacesDto facesDto = new FacesDto();
|
||||
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
|
||||
String photoUrl = url + customerStaff.getPhoto();
|
||||
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
|
||||
|
||||
facesDto.setData(faceData);
|
||||
facesDtos.add(facesDto);
|
||||
devicePersonDto.setFaces(facesDtos);
|
||||
String s = DeviceUtils.addPersons(equipment.getIp(), devicePersonDto);
|
||||
log.info("添加人员返回结果:" + s);
|
||||
} else {
|
||||
//更新用户信息
|
||||
if (icsCustomerStaff.getPhoto() != null) {
|
||||
if (!icsCustomerStaff.getPhoto().equals(customer.getPhone())) {
|
||||
DevicePersonDto devicePersonDto = new DevicePersonDto();
|
||||
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
|
||||
ArrayList<FacesDto> facesDtos = new ArrayList<>();
|
||||
FacesDto facesDto = new FacesDto();
|
||||
String photoUrl = url + icsCustomerStaff.getPhoto();
|
||||
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
|
||||
facesDto.setData(faceData);
|
||||
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
|
||||
facesDtos.add(facesDto);
|
||||
devicePersonDto.setFaces(facesDtos);
|
||||
DeviceUtils.modifyFaces(equipment.getIp(), devicePersonDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//根据房间id获取设备id
|
||||
List<RoomEquipment> roomEquipments = roomEquipmentService.selectListByRoomId(aLong);
|
||||
for (RoomEquipment roomEquipment : roomEquipments) {
|
||||
@ -368,8 +424,8 @@ public class CustomerStaffController extends BaseController {
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(toList());
|
||||
result.addAll(buildCollect);
|
||||
result.addAll(collect);
|
||||
//获取了房间集合,循环对应集合,
|
||||
@ -480,10 +536,8 @@ public class CustomerStaffController extends BaseController {
|
||||
boolean isAdmin = SubjectUtil.hasRole(getRequest(), "manager");
|
||||
if (isAdmin) {
|
||||
Long parkId = currentUserService.getParkId();
|
||||
Long tenantId = currentUserService.getTenantId();
|
||||
Equipment equipment1 = new Equipment();
|
||||
equipment1.setParkId(parkId);
|
||||
// equipment1.setTenantId(tenantId);
|
||||
|
||||
//根据园区id 查询所有的设备信息
|
||||
List<Equipment> equipment = equipmentService.selectEquipmentList(equipment1);
|
||||
@ -500,7 +554,7 @@ public class CustomerStaffController extends BaseController {
|
||||
//根据企业 查询对应的 房间,和对应的楼层
|
||||
String roomId = customer.getRoomId();
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(toList());
|
||||
for (Long roomid : collect) {
|
||||
Room room = roomService.selectRoomById(roomid);
|
||||
if (null != room) {
|
||||
@ -511,7 +565,7 @@ public class CustomerStaffController extends BaseController {
|
||||
ids.add(equipment.getEquipmentId());
|
||||
}
|
||||
}
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(room.getBuildingDetailId());
|
||||
if (CollUtil.isNotEmpty(detailEquipments)) {
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
ids.add(detailEquipment.getEquipmentId());
|
||||
@ -544,7 +598,7 @@ public class CustomerStaffController extends BaseController {
|
||||
@PostMapping("/selectEquipmentListById")
|
||||
public R selectEquipmentListById(@RequestBody UserEquipment equipment) {
|
||||
List<UserEquipment> equipments = userEquipmentService.selectUserEquipmentList(equipment);
|
||||
List<Long> collect = equipments.stream().map(UserEquipment::getEquipmentId).collect(Collectors.toList());
|
||||
List<Long> collect = equipments.stream().map(UserEquipment::getEquipmentId).collect(toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
List<Equipment> equipment1 = equipmentService.selectListByIds(collect);
|
||||
List<Equipment> equipment2 = selectEquipmentListByIds(equipment1);
|
||||
@ -584,71 +638,79 @@ public class CustomerStaffController extends BaseController {
|
||||
@PostMapping("/saveUserEquipment")
|
||||
public R saveUserEquipment(@RequestBody UserEquipment equipment) {
|
||||
|
||||
|
||||
//根据企业查询出所有的设备
|
||||
List<Long> ids =new ArrayList<>();
|
||||
|
||||
|
||||
if (equipment.getUserId() != null) {
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(equipment.getUserId());
|
||||
if (null != customerStaff) {
|
||||
//查询多个企业
|
||||
List<StaffCustomer> staffCustomers = staffCustomerService.selectStaffCustomerByStaffId(customerStaff.getId());
|
||||
for (StaffCustomer staffCustomer : staffCustomers) {
|
||||
Customer customer = customerService.selectCustomerById(staffCustomer.getIcsCustomerId());
|
||||
if (null != customer) {
|
||||
//根据企业 查询对应的 房间,和对应的楼层
|
||||
String roomId = customer.getRoomId();
|
||||
String buildId = customer.getBuildId();
|
||||
List<Long> result = new ArrayList<>();
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
result.addAll(buildCollect);
|
||||
result.addAll(collect);
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long id : result) {
|
||||
List<RoomEquipment> roomEquipment = roomEquipmentService.selectByRoomId(id);
|
||||
if (CollUtil.isNotEmpty(roomEquipment)) {
|
||||
for (RoomEquipment equipment1 : roomEquipment) {
|
||||
ids.add(equipment1.getEquipmentId());
|
||||
}
|
||||
}
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
|
||||
if (CollUtil.isNotEmpty(detailEquipments)) {
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
ids.add(detailEquipment.getEquipmentId());
|
||||
}
|
||||
}
|
||||
List<Long> list = userEquipmentService.selectEquipmentIdByUserId(equipment.getUserId());
|
||||
//查询出当前用户的所有设备
|
||||
List<Long> userIds = equipment.getUserIds();
|
||||
|
||||
List<Long> reduce2 = list.stream().filter(item -> !userIds.contains(item)).collect(toList());
|
||||
log.info("reduce2------------------------------------:{}",reduce2);
|
||||
|
||||
List<Long> reduce3 = userIds.stream().filter(item -> !list.contains(item)).collect(toList());
|
||||
log.info("reduce3------------------------------------:{}",reduce3);
|
||||
|
||||
ids = Stream.concat(reduce2.stream(), reduce3.stream())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
log.info("reduce3------------------------------------:{}",ids);
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(ids)){
|
||||
for (Long id : ids) {
|
||||
|
||||
UserEquipment userEquipment = userEquipmentService.selectUserAndEquipment(equipment.getUserId(), id);
|
||||
if (userEquipment != null){
|
||||
Equipment equipment1 = equipmentService.selectEquipmentById(id);
|
||||
if (equipment1 != null) {
|
||||
DeviceUtils.deletePersons(equipment1.getIp(), equipment.getUserId());
|
||||
}
|
||||
int count = userEquipmentService.deleteUserEquipmentByUserId(equipment.getUserId(), id);
|
||||
Assert.isTrue(count > 0, "删除失败");
|
||||
}else {
|
||||
UserEquipment userEquipment1 = new UserEquipment();
|
||||
userEquipment1.setEquipmentId(id);
|
||||
userEquipment1.setUserId(equipment.getUserId());
|
||||
IcsCustomerStaff customerStaff1 = icsCustomerStaffService.selectIcsCustomerStaffById(equipment.getUserId());
|
||||
if (null != customerStaff1) {
|
||||
Customer customer = customerService.selectCustomerById(customerStaff1.getId());
|
||||
if (customer != null) {
|
||||
userEquipment1.setStartTime(customer.getStartDate());
|
||||
userEquipment1.setEndDate(customer.getEndDate());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Long id : ids) {
|
||||
int num = userEquipmentService.selectListByUserId(equipment.getUserId());
|
||||
if (num > 0) {
|
||||
int count = userEquipmentService.deleteUserEquipmentByUserId(equipment.getUserId(), id);
|
||||
Assert.isTrue(count > 0, "删除失败");
|
||||
}
|
||||
userEquipmentService.insertUserEquipment(userEquipment1);
|
||||
|
||||
// //新增人脸
|
||||
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(equipment.getUserId());
|
||||
|
||||
DevicePersonDto devicePersonDto = new DevicePersonDto();
|
||||
ArrayList<FacesDto> facesDtos = new ArrayList<>();
|
||||
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
|
||||
devicePersonDto.setName(customerStaff.getName());
|
||||
devicePersonDto.setPhone(String.valueOf(customerStaff.getMobile()));
|
||||
devicePersonDto.setCertificateType("111");
|
||||
devicePersonDto.setCertificateNumber(customerStaff.getCardNo());
|
||||
//添加人员类型
|
||||
devicePersonDto.setPersonType("whitelist");
|
||||
//添加访客时间
|
||||
FacesDto facesDto = new FacesDto();
|
||||
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
|
||||
String photoUrl = url + customerStaff.getPhoto();
|
||||
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
|
||||
|
||||
facesDto.setData(faceData);
|
||||
facesDtos.add(facesDto);
|
||||
devicePersonDto.setFaces(facesDtos);
|
||||
Equipment equipment1 = equipmentService.selectEquipmentById(id);
|
||||
|
||||
String s = DeviceUtils.addPersons(equipment1.getIp(), devicePersonDto);
|
||||
log.info("添加人员返回结果:" + s);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
for (Long id : equipment.getUserIds()) {
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(id);
|
||||
userEquipment.setUserId(equipment.getUserId());
|
||||
IcsCustomerStaff customerStaff1 = icsCustomerStaffService.selectIcsCustomerStaffById(equipment.getUserId());
|
||||
if (null != customerStaff1) {
|
||||
Customer customer = customerService.selectCustomerById(customerStaff1.getId());
|
||||
if (customer != null) {
|
||||
userEquipment.setStartTime(customer.getStartDate());
|
||||
userEquipment.setEndDate(customer.getEndDate());
|
||||
}
|
||||
}
|
||||
userEquipmentService.insertUserEquipment(userEquipment);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.ics.admin.controller.meeting;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
@ -17,12 +18,17 @@ import com.ics.admin.service.IIcsCustomerStaffService;
|
||||
import com.ics.admin.service.IRoomService;
|
||||
import com.ics.admin.service.meeting.*;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.common.core.domain.dto.DevicePersonDto;
|
||||
import com.ics.common.core.domain.dto.FacesDto;
|
||||
import com.ics.common.utils.DeviceUtils;
|
||||
import com.ics.common.utils.IpUtils;
|
||||
import com.ics.common.utils.UrlToBase64Util;
|
||||
import com.ics.system.domain.User;
|
||||
import com.ics.system.service.ICurrentUserService;
|
||||
import com.ics.system.service.IUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -40,6 +46,9 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
* 设备 提供者
|
||||
@ -97,6 +106,18 @@ public class EquipmentController extends BaseController {
|
||||
@Autowired
|
||||
private IStaffCustomerService staffCustomerService;
|
||||
|
||||
private static final String BASE64_PREFIX = "data:image/png;base64,";
|
||||
|
||||
|
||||
/**
|
||||
* app的密钥值
|
||||
*/
|
||||
@Value("${dfs.path}")
|
||||
private String path;
|
||||
|
||||
@Value("${dfs.domain}")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 查询设备
|
||||
*/
|
||||
@ -185,6 +206,10 @@ public class EquipmentController extends BaseController {
|
||||
int i = equipmentService.insertEquipment(equipment);
|
||||
Assert.isTrue(i > 0, "添加失败");
|
||||
|
||||
boolean ipv4 = Validator.isIpv4(equipment.getIp());
|
||||
Assert.isTrue(!ipv4, "IP不合法");
|
||||
|
||||
|
||||
boolean ping = DeviceUtils.ping(equipment.getIp());
|
||||
log.info("设备IP:{} 是否ping通:{}", equipment.getIp(), ping);
|
||||
if (ping){
|
||||
@ -194,9 +219,10 @@ public class EquipmentController extends BaseController {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s);
|
||||
Integer status = (Integer) jsonObject.get("status");
|
||||
Assert.isTrue(status == 0, "未找到对应设备");
|
||||
}else {
|
||||
return R.error("设备IP: " + equipment.getIp() + " 无法ping通");
|
||||
}
|
||||
|
||||
|
||||
if (equipment.getRoomId() != null) {
|
||||
RoomEquipment roomEquipment = new RoomEquipment();
|
||||
roomEquipment.setEquipmentId(equipment.getId());
|
||||
@ -482,34 +508,107 @@ public class EquipmentController extends BaseController {
|
||||
@Ignore
|
||||
@PostMapping("saveDevice")
|
||||
public R saveDevice(@RequestBody UserEquipment userEquipment) {
|
||||
List<Long> ids =new ArrayList<>();
|
||||
|
||||
if (userEquipment.getId() != null) {
|
||||
int num = userEquipmentService.selectListByEquipmentId(userEquipment.getId());
|
||||
if (num > 0) {
|
||||
int count = userEquipmentService.deleteUserEquipmentByEquipmentId(userEquipment.getId());
|
||||
Assert.isTrue(count > 0, "删除失败");
|
||||
}
|
||||
}
|
||||
for (Long id : userEquipment.getUserIds()) {
|
||||
UserEquipment userEquipment1 = new UserEquipment();
|
||||
List<Long> list = userEquipmentService.selectEquipmentIdByEquipmentId(userEquipment.getId());
|
||||
|
||||
List<StaffCustomer> staffCustomers = staffCustomerService.selectStaffCustomerByStaffId(id);
|
||||
if (CollUtil.isNotEmpty(staffCustomers)){
|
||||
Customer customer = customerService.selectCustomerById(staffCustomers.get(0).getIcsCustomerId());;
|
||||
if (customer !=null){
|
||||
userEquipment1.setStartTime(customer.getStartDate());
|
||||
userEquipment1.setEndDate(customer.getEndDate());
|
||||
List<Long> userIds = userEquipment.getUserIds();
|
||||
|
||||
List<Long> reduce2 = list.stream().filter(item -> !userIds.contains(item)).collect(toList());
|
||||
log.info("reduce2------------------------------------:{}",reduce2);
|
||||
|
||||
List<Long> reduce3 = userIds.stream().filter(item -> !list.contains(item)).collect(toList());
|
||||
log.info("reduce3------------------------------------:{}",reduce3);
|
||||
|
||||
ids = Stream.concat(reduce2.stream(), reduce3.stream())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isNotEmpty(ids)){
|
||||
for (Long id : ids) {
|
||||
|
||||
UserEquipment userEquipment1 = userEquipmentService.selectUserAndEquipment(id, userEquipment.getId());
|
||||
if (userEquipment1 != null){
|
||||
Equipment equipment1 = equipmentService.selectEquipmentById(userEquipment.getId());
|
||||
if (equipment1 != null) {
|
||||
DeviceUtils.deletePersons(equipment1.getIp(), id);
|
||||
}
|
||||
int count = userEquipmentService.deleteUserEquipmentByUserId(id, userEquipment.getId());
|
||||
Assert.isTrue(count > 0, "删除失败");
|
||||
}else {
|
||||
UserEquipment userEquipment2 = new UserEquipment();
|
||||
userEquipment2.setEquipmentId(userEquipment.getId());
|
||||
userEquipment2.setUserId(id);
|
||||
IcsCustomerStaff customerStaff1 = staffService.selectIcsCustomerStaffById(id);
|
||||
if (null != customerStaff1) {
|
||||
Customer customer = customerService.selectCustomerById(customerStaff1.getId());
|
||||
if (customer != null) {
|
||||
userEquipment2.setStartTime(customer.getStartDate());
|
||||
userEquipment2.setEndDate(customer.getEndDate());
|
||||
}
|
||||
}
|
||||
userEquipmentService.insertUserEquipment(userEquipment2);
|
||||
|
||||
// //新增人脸
|
||||
IcsCustomerStaff customerStaff = staffService.selectIcsCustomerStaffById(id);
|
||||
|
||||
DevicePersonDto devicePersonDto = new DevicePersonDto();
|
||||
ArrayList<FacesDto> facesDtos = new ArrayList<>();
|
||||
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
|
||||
devicePersonDto.setName(customerStaff.getName());
|
||||
devicePersonDto.setPhone(String.valueOf(customerStaff.getMobile()));
|
||||
devicePersonDto.setCertificateType("111");
|
||||
devicePersonDto.setCertificateNumber(customerStaff.getCardNo());
|
||||
//添加人员类型
|
||||
devicePersonDto.setPersonType("whitelist");
|
||||
//添加访客时间
|
||||
FacesDto facesDto = new FacesDto();
|
||||
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
|
||||
String photoUrl = url + customerStaff.getPhoto();
|
||||
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
|
||||
|
||||
facesDto.setData(faceData);
|
||||
facesDtos.add(facesDto);
|
||||
devicePersonDto.setFaces(facesDtos);
|
||||
log.info("设备id1:--------------------------" + userEquipment.getId());
|
||||
Equipment equipment1 = equipmentService.selectEquipmentById(userEquipment.getId());
|
||||
log.info("设备id2:-------------------" + equipment1.getId());
|
||||
String s = DeviceUtils.addPersons(equipment1.getIp(), devicePersonDto);
|
||||
log.info("添加人员返回结果:" + s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
userEquipment1.setEquipmentId(userEquipment.getId());
|
||||
userEquipment1.setUserId(id);
|
||||
int i = userEquipmentService.insertUserEquipment(userEquipment1);
|
||||
|
||||
Assert.isTrue(i > 0, "添加失败");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// if (userEquipment.getId() != null) {
|
||||
// int num = userEquipmentService.selectListByEquipmentId(userEquipment.getId());
|
||||
// if (num > 0) {
|
||||
// int count = userEquipmentService.deleteUserEquipmentByEquipmentId(userEquipment.getId());
|
||||
// Assert.isTrue(count > 0, "删除失败");
|
||||
// }
|
||||
// }
|
||||
// for (Long id : userEquipment.getUserIds()) {
|
||||
// UserEquipment userEquipment1 = new UserEquipment();
|
||||
//
|
||||
// List<StaffCustomer> staffCustomers = staffCustomerService.selectStaffCustomerByStaffId(id);
|
||||
// if (CollUtil.isNotEmpty(staffCustomers)){
|
||||
// Customer customer = customerService.selectCustomerById(staffCustomers.get(0).getIcsCustomerId());;
|
||||
// if (customer !=null){
|
||||
// userEquipment1.setStartTime(customer.getStartDate());
|
||||
// userEquipment1.setEndDate(customer.getEndDate());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// userEquipment1.setEquipmentId(userEquipment.getId());
|
||||
// userEquipment1.setUserId(id);
|
||||
// int i = userEquipmentService.insertUserEquipment(userEquipment1);
|
||||
//
|
||||
// Assert.isTrue(i > 0, "添加失败");
|
||||
//
|
||||
// }
|
||||
return R.data(userEquipment);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ import org.wf.jwtp.util.SubjectUtil;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
/**
|
||||
* 优惠卷 提供者
|
||||
*
|
||||
@ -170,9 +170,27 @@ public class TicketController extends BaseController {
|
||||
CustomerTicket customerTicket = customerTicketService.selectCustomerTicketById(ticket.getId());
|
||||
if (customerTicket ==null){
|
||||
if (ticket.getType() == 1) {
|
||||
if (ticket.getTicketCustomerVo() != null){
|
||||
for (TicketCustomerVo ticketCustomerVo : ticket.getTicketCustomerVo()) {
|
||||
if (CollUtil.isNotEmpty(ticket.getTicketCustomerVo())){
|
||||
|
||||
List<CustomerTicket> customers = customerTicketService.selectCustomerByTicketId(ticket.getId());
|
||||
List<Long> collect1 = customers.stream().map(CustomerTicket::getCustomerId).collect(toList());
|
||||
|
||||
List<TicketCustomerVo> ticketCustomerVo1 = ticket.getTicketCustomerVo();
|
||||
|
||||
List<Long> collect3 = ticketCustomerVo1.stream().map(TicketCustomerVo::getId).collect(toList());
|
||||
|
||||
|
||||
List<Long> collect2 = collect1.stream().filter(item -> !collect3.contains(item)).collect(toList());
|
||||
System.out.println(collect2);
|
||||
|
||||
for (Long aLong : collect2) {
|
||||
customerTicketService.deleteCustomerTicketByTicketIdAndCustomer(ticket.getId(),aLong);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (TicketCustomerVo ticketCustomerVo : ticket.getTicketCustomerVo()) {
|
||||
//查询出所有的 id
|
||||
CustomerTicket customerTicket2 = new CustomerTicket();
|
||||
customerTicket2.setTicketId(ticket.getId());
|
||||
@ -182,12 +200,8 @@ public class TicketController extends BaseController {
|
||||
List<Long> collect = customerTickets.stream().map(CustomerTicket::getId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)){
|
||||
String ids = CollUtil.join(collect, ",");
|
||||
|
||||
int i1 = customerTicketService.deleteCustomerTicketByIds(ids);
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (int j = 0; j < ticketCustomerVo.getSumNum(); j++) {
|
||||
CustomerTicket customerTicket1 = new CustomerTicket();
|
||||
customerTicket1.setTicketId(ticket.getId());
|
||||
@ -197,6 +211,8 @@ public class TicketController extends BaseController {
|
||||
customerTicketService.insertCustomerTicket(customerTicket1);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
customerTicketService.deleteCustomerTicketByTicketId(ticket.getId());
|
||||
}
|
||||
|
||||
}else {
|
||||
|
@ -15,10 +15,7 @@ import com.ics.admin.domain.meeting.*;
|
||||
import com.ics.admin.service.ICustomerService;
|
||||
import com.ics.admin.service.IIcsCustomerStaffService;
|
||||
import com.ics.admin.service.IParkService;
|
||||
import com.ics.admin.service.meeting.IEquipmentService;
|
||||
import com.ics.admin.service.meeting.IRoomEquipmentService;
|
||||
import com.ics.admin.service.meeting.IUserEquipmentService;
|
||||
import com.ics.admin.service.meeting.IVisitorPersonService;
|
||||
import com.ics.admin.service.meeting.*;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.common.core.domain.dto.DevicePersonDto;
|
||||
import com.ics.common.core.domain.dto.FacesDto;
|
||||
@ -51,6 +48,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
* 访客预约表 提供者
|
||||
*
|
||||
@ -93,6 +92,9 @@ public class VisitorPersonController extends BaseController {
|
||||
@Autowired
|
||||
private IUserEquipmentService userEquipmentService;
|
||||
|
||||
@Autowired
|
||||
private IDetailEquipmentService detailEquipmentService;
|
||||
|
||||
@Value("${dfs.domain}")
|
||||
private String url;
|
||||
|
||||
@ -173,29 +175,83 @@ public class VisitorPersonController extends BaseController {
|
||||
Assert.isTrue(IdcardUtil.isValidCard(visitorPerson.getCardNo()), "身份证格式不正确");
|
||||
Assert.isTrue(Validator.isMobile(visitorPerson.getPhone()), "手机号格式不正确");
|
||||
|
||||
IcsCustomerStaff customerStaff = staffService.selectByPhone(visitorPerson.getPhone());
|
||||
if (null != customerStaff){
|
||||
visitorPerson.setIntervieweeId(customerStaff.getId());
|
||||
}
|
||||
IcsCustomerStaff customerStaff = staffService.selectUserByMobile(visitorPerson.getPhone());
|
||||
System.out.println("用户信息为+++++++++++++++++++++++"+customerStaff.getId());
|
||||
visitorPerson.setIntervieweeId(customerStaff.getId());
|
||||
visitorPerson.setUserId(visitorPerson.getUserId());
|
||||
long currentUserId = this.getCurrentUserId();
|
||||
User user = userService.selectUserById(currentUserId);
|
||||
if (null != user){
|
||||
visitorPerson.setIntervieweeId(user.getStaffId());
|
||||
}
|
||||
|
||||
visitorPerson.setStatus(1);
|
||||
visitorPerson.setCreateTime(DateUtils.getNowDate());
|
||||
System.out.println("当前登录人的信息为+++++++++++++++++++++++");
|
||||
visitorPerson.setCreateBy(getLoginName());
|
||||
visitorPerson.setUpdateTime(DateUtils.getNowDate());
|
||||
visitorPerson.setUpdateBy(getLoginName());
|
||||
|
||||
visitorPerson.setUserId(Long.valueOf(RandomUtil.randomInt(10)));
|
||||
int i = visitorPersonService.insertReservationPerson(visitorPerson);
|
||||
if (i > 0){
|
||||
|
||||
// todo 根据被访人企业id,查询对应的房间
|
||||
if (i > 0) {
|
||||
Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId());
|
||||
String roomId = customer.getRoomId();
|
||||
String buildId = customer.getBuildId();
|
||||
List<Long> result = new ArrayList<>();
|
||||
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
|
||||
System.out.println("楼层id为-------------"+buildIds);
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(toList());
|
||||
result.addAll(buildCollect);
|
||||
result.addAll(collect);
|
||||
System.out.println("所有设备id-------------"+result);
|
||||
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long aLong : collect) {
|
||||
for (Long aLong : result) {
|
||||
//根据楼层获取设备id
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(aLong);
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
//根据设备id获取设备
|
||||
Equipment equipment = equipmentService.selectEquipmentById(detailEquipment.getEquipmentId());
|
||||
if (equipment != null) {
|
||||
String persons = DeviceUtils.queryPersons(equipment.getIp(), String.valueOf(visitorPerson.getIntervieweeId()));
|
||||
JSONObject jsonObject = JSONUtil.parseObj(persons);
|
||||
Integer amount = (Integer) jsonObject.get("amount");
|
||||
if (amount <= 0) {
|
||||
//添加 用户和对应的设备
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(equipment.getId());
|
||||
userEquipment.setUserId(visitorPerson.getIntervieweeId());
|
||||
userEquipment.setStartTime(customer.getStartDate());
|
||||
userEquipment.setEndDate(customer.getEndDate());
|
||||
userEquipmentService.insertUserEquipment(userEquipment);
|
||||
|
||||
|
||||
DevicePersonDto devicePersonDto = new DevicePersonDto();
|
||||
ArrayList<FacesDto> facesDtos = new ArrayList<>();
|
||||
devicePersonDto.setPersonId(String.valueOf(visitorPerson.getUserId()));
|
||||
devicePersonDto.setName(visitorPerson.getName());
|
||||
devicePersonDto.setPhone(String.valueOf(visitorPerson.getPhone()));
|
||||
devicePersonDto.setCertificateType("111");
|
||||
devicePersonDto.setCertificateNumber(visitorPerson.getCardNo());
|
||||
//添加人员类型
|
||||
devicePersonDto.setPersonType("whitelist");
|
||||
//添加访客时间
|
||||
FacesDto facesDto = new FacesDto();
|
||||
facesDto.setFaceId(String.valueOf(visitorPerson.getUserId()));
|
||||
String photoUrl = url + visitorPerson.getPhoto();
|
||||
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
|
||||
|
||||
facesDto.setData(faceData);
|
||||
facesDtos.add(facesDto);
|
||||
devicePersonDto.setFaces(facesDtos);
|
||||
String s = DeviceUtils.addPersons(equipment.getIp(), devicePersonDto);
|
||||
System.out.println("新增楼层人员结果:" + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//根据房间id获取设备id
|
||||
List<RoomEquipment> roomEquipments = roomEquipmentService.selectListByRoomId(aLong);
|
||||
for (RoomEquipment roomEquipment : roomEquipments) {
|
||||
@ -212,7 +268,7 @@ public class VisitorPersonController extends BaseController {
|
||||
//添加 用户和对应的设备
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(equipment.getId());
|
||||
userEquipment.setUserId(user.getStaffId());
|
||||
userEquipment.setUserId(visitorPerson.getIntervieweeId());
|
||||
userEquipment.setStartTime(customer.getStartDate());
|
||||
userEquipment.setEndDate(customer.getEndDate());
|
||||
userEquipmentService.insertUserEquipment(userEquipment);
|
||||
@ -232,7 +288,7 @@ public class VisitorPersonController extends BaseController {
|
||||
devicePersonDto.setVisitorValidEndTime(DateUtil.format(visitorPerson.getLeaveTime(), "yyyy-MM-dd'T'HH:mm:ss"));
|
||||
FacesDto facesDto = new FacesDto();
|
||||
facesDto.setFaceId(String.valueOf(visitorPerson.getUserId()));
|
||||
String photoUrl = url+visitorPerson.getPhoto();
|
||||
String photoUrl = url + visitorPerson.getPhoto();
|
||||
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
|
||||
facesDto.setData(faceData);
|
||||
facesDtos.add(facesDto);
|
||||
@ -264,10 +320,65 @@ public class VisitorPersonController extends BaseController {
|
||||
if (visitorPerson.getStatus() == 1){
|
||||
Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId());
|
||||
String roomId = customer.getRoomId();
|
||||
String buildId = customer.getBuildId();
|
||||
List<Long> result = new ArrayList<>();
|
||||
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
|
||||
System.out.println("楼层id为-------------"+buildIds);
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(toList());
|
||||
result.addAll(buildCollect);
|
||||
result.addAll(collect);
|
||||
System.out.println("所有设备id-------------"+result);
|
||||
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long aLong : collect) {
|
||||
for (Long aLong : result) {
|
||||
//根据楼层获取设备id
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(aLong);
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
//根据设备id获取设备
|
||||
Equipment equipment = equipmentService.selectEquipmentById(detailEquipment.getEquipmentId());
|
||||
if (equipment != null) {
|
||||
String persons = DeviceUtils.queryPersons(equipment.getIp(), String.valueOf(visitorPerson.getIntervieweeId()));
|
||||
JSONObject jsonObject = JSONUtil.parseObj(persons);
|
||||
Integer amount = (Integer) jsonObject.get("amount");
|
||||
if (amount <= 0) {
|
||||
//添加 用户和对应的设备
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(equipment.getId());
|
||||
userEquipment.setUserId(visitorPerson.getIntervieweeId());
|
||||
userEquipment.setStartTime(customer.getStartDate());
|
||||
userEquipment.setEndDate(customer.getEndDate());
|
||||
userEquipmentService.insertUserEquipment(userEquipment);
|
||||
|
||||
|
||||
DevicePersonDto devicePersonDto = new DevicePersonDto();
|
||||
ArrayList<FacesDto> facesDtos = new ArrayList<>();
|
||||
devicePersonDto.setPersonId(String.valueOf(visitorPerson.getUserId()));
|
||||
devicePersonDto.setName(visitorPerson.getName());
|
||||
devicePersonDto.setPhone(String.valueOf(visitorPerson.getPhone()));
|
||||
devicePersonDto.setCertificateType("111");
|
||||
devicePersonDto.setCertificateNumber(visitorPerson.getCardNo());
|
||||
//添加人员类型
|
||||
devicePersonDto.setPersonType("whitelist");
|
||||
//添加访客时间
|
||||
FacesDto facesDto = new FacesDto();
|
||||
facesDto.setFaceId(String.valueOf(visitorPerson.getUserId()));
|
||||
String photoUrl = url + visitorPerson.getPhoto();
|
||||
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
|
||||
|
||||
facesDto.setData(faceData);
|
||||
facesDtos.add(facesDto);
|
||||
devicePersonDto.setFaces(facesDtos);
|
||||
String s = DeviceUtils.addPersons(equipment.getIp(), devicePersonDto);
|
||||
System.out.println("新增楼层人员结果:" + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//根据房间id获取设备id
|
||||
List<RoomEquipment> roomEquipments = roomEquipmentService.selectListByRoomId(aLong);
|
||||
for (RoomEquipment roomEquipment : roomEquipments) {
|
||||
@ -318,6 +429,9 @@ public class VisitorPersonController extends BaseController {
|
||||
//则删除设备中的人员信息
|
||||
}
|
||||
|
||||
visitorPerson.setUpdateBy(getLoginName());
|
||||
visitorPerson.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
return toAjax(visitorPersonService.updateReservationPerson(visitorPerson));
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,10 @@ public class Showroom extends BaseEntity<Showroom> {
|
||||
private String meetingName;
|
||||
|
||||
/** 容纳人数 */
|
||||
private Integer capacityNum;
|
||||
private String capacityNum;
|
||||
|
||||
/** 扩充人数 */
|
||||
private Integer expandNum;
|
||||
private String expandNum;
|
||||
|
||||
/** 室内图片url */
|
||||
private String indoorPicUrl;
|
||||
|
@ -88,7 +88,7 @@ public class ShowroomRecord extends BaseEntity<ShowroomRecord> {
|
||||
private String indoorPicUrl;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer capacityNum;
|
||||
private String capacityNum;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String statusName;
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.ics.admin.domain.meeting;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ics.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
@ -66,6 +68,14 @@ public class VisitorPerson extends BaseEntity<VisitorPerson> {
|
||||
/** 证件号码 */
|
||||
private String cardNo;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/** 状态 */
|
||||
private Integer status;
|
||||
|
||||
|
@ -69,4 +69,8 @@ public interface CustomerTicketMapper extends BaseMapper<CustomerTicket> {
|
||||
List<CustomerTicket> selectListByTicketId(Long id);
|
||||
|
||||
int selectByTicketIdAndCustomer(@Param("id") Long id,@Param("customerId") Long customerId);
|
||||
|
||||
void deleteCustomerTicketByTicketId(Long id);
|
||||
|
||||
void deleteCustomerTicketByTicketIdAndCustomer(@Param("id")Long id,@Param("customerId") Long aLong);
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ public interface IIcsCustomerStaffService extends IService<IcsCustomerStaff> {
|
||||
|
||||
List<IcsCustomerStaff> getStaffListByUser(IcsCustomerStaff icsCustomerStaff);
|
||||
|
||||
IcsCustomerStaff selectByPhone(String mobile);
|
||||
|
||||
int updateByCustomer(IcsCustomerStaff customerStaff);
|
||||
|
||||
@ -88,4 +87,6 @@ public interface IIcsCustomerStaffService extends IService<IcsCustomerStaff> {
|
||||
List<IcsCustomerStaff> getUserList(IcsCustomerStaff customerStaff);
|
||||
|
||||
IcsCustomerStaff selectByPhoneAndOpenId(String phoneNumber, String openid);
|
||||
|
||||
IcsCustomerStaff selectUserByMobile(String phone);
|
||||
}
|
||||
|
@ -180,14 +180,7 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMap
|
||||
return icsCustomerStaffMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IcsCustomerStaff selectByPhone(String mobile) {
|
||||
QueryWrapper<IcsCustomerStaff> wrapper = new QueryWrapper<>();
|
||||
|
||||
wrapper.eq("mobile", mobile);
|
||||
|
||||
return icsCustomerStaffMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByCustomer(IcsCustomerStaff customerStaff) {
|
||||
@ -295,6 +288,11 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMap
|
||||
return icsCustomerStaffMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IcsCustomerStaff selectUserByMobile(String phone) {
|
||||
return icsCustomerStaffMapper.selectUserByMobile(phone);
|
||||
}
|
||||
|
||||
//根据企业查询对应的设备
|
||||
public void queryDeviceByCustomerId(Long customerId,Long userId){
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
@ -314,7 +312,7 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMap
|
||||
ids.add(equipment.getEquipmentId());
|
||||
}
|
||||
}
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(room.getBuildingDetailId());
|
||||
if (CollUtil.isNotEmpty(detailEquipments)) {
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
ids.add(detailEquipment.getEquipmentId());
|
||||
|
@ -46,6 +46,7 @@ import org.springframework.web.context.request.RequestContextHolder;
|
||||
import javax.annotation.Resource;
|
||||
import javax.swing.*;
|
||||
|
||||
|
||||
/**
|
||||
* 用户设备关联Service业务层处理
|
||||
*
|
||||
@ -269,6 +270,29 @@ public class UserEquipmentServiceImpl extends ServiceImpl<UserEquipmentMapper, U
|
||||
return userEquipmentMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectEquipmentIdByUserId(Long userId) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("user_id",userId);
|
||||
List<UserEquipment> list = userEquipmentMapper.selectList(queryWrapper);
|
||||
List<Long> deviceIds = list.stream().
|
||||
map(UserEquipment::getEquipmentId).
|
||||
collect(Collectors.toList());
|
||||
return deviceIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectEquipmentIdByEquipmentId(Long id) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("equipment_id",id);
|
||||
List<UserEquipment> list = userEquipmentMapper.selectList(queryWrapper);
|
||||
List<Long> userIds = list.stream().
|
||||
map(UserEquipment::getUserId).
|
||||
collect(Collectors.toList());
|
||||
return userIds;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void updateDeviceDataSource(List<Equipment> equipments) {
|
||||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||
|
@ -167,4 +167,24 @@ public class CustomerTicketServiceImpl extends ServiceImpl<CustomerTicketMapper,
|
||||
public int selectByTicketIdAndCustomer(Long id, Long customerId) {
|
||||
return customerTicketMapper.selectByTicketIdAndCustomer(id, customerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCustomerTicketByTicketId(Long id) {
|
||||
|
||||
customerTicketMapper.deleteCustomerTicketByTicketId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomerTicket> selectCustomerByTicketId(Long id) {
|
||||
QueryWrapper<CustomerTicket> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("ticket_id", id);
|
||||
wrapper.eq("is_verification", 0);
|
||||
wrapper.groupBy("customer_id");
|
||||
return customerTicketMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCustomerTicketByTicketIdAndCustomer(Long id, Long aLong) {
|
||||
customerTicketMapper.deleteCustomerTicketByTicketIdAndCustomer(id, aLong);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,9 @@ public class ShowroomServiceImpl extends ServiceImpl<ShowroomMapper, Showroom> i
|
||||
queryWrapper.eq(showroom.getMeetingName() !=null,"meeting_name", showroom.getMeetingName());
|
||||
queryWrapper.eq(showroom.getTenantId() !=null,"tenant_id", showroom.getTenantId());
|
||||
queryWrapper.eq(showroom.getRoomId() !=null,"room_id", showroom.getRoomId());
|
||||
queryWrapper.eq("is_show",0);
|
||||
queryWrapper.in(showroom.getRoomIds() !=null,"room_id", showroom.getRoomIds());
|
||||
|
||||
return showroomMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -70,4 +70,10 @@ public interface ICustomerTicketService extends IService<CustomerTicket> {
|
||||
List<CustomerTicket> selectListByTicketId(Long id);
|
||||
|
||||
int selectByTicketIdAndCustomer(Long id, Long id1);
|
||||
|
||||
void deleteCustomerTicketByTicketId(Long id);
|
||||
|
||||
List<CustomerTicket> selectCustomerByTicketId(Long id);
|
||||
|
||||
void deleteCustomerTicketByTicketIdAndCustomer(Long id, Long aLong);
|
||||
}
|
||||
|
@ -76,4 +76,8 @@ public interface IUserEquipmentService extends IService<UserEquipment> {
|
||||
List<UserEquipment> selectUserEquipmentNum(UserEquipment userEquipment);
|
||||
|
||||
List<UserEquipment> selectUserEquipmentNumByUserId(UserEquipment userEquipment);
|
||||
|
||||
List<Long> selectEquipmentIdByUserId(Long userId);
|
||||
|
||||
List<Long> selectEquipmentIdByEquipmentId(Long id);
|
||||
}
|
||||
|
@ -95,5 +95,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCustomerTicketByTicketId">
|
||||
DELETE FROM tb_customer_ticket WHERE ticket_id = #{ticketId} and is_verification = 0
|
||||
</delete>
|
||||
<delete id="deleteCustomerTicketByTicketIdAndCustomer">
|
||||
DELETE FROM tb_customer_ticket WHERE ticket_id = #{id} and customer_id = #{customerId} and is_verification = 0
|
||||
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -217,7 +217,7 @@ public class WxLoginAPIController extends BaseController {
|
||||
// 新增用户信息
|
||||
// todo 现根据手机号查询对应的数据。如果存在则不新增,如果不存在则新增
|
||||
|
||||
IcsCustomerStaff customerStaff1 = icsCustomerStaffService.selectByPhone(phoneNumber);
|
||||
IcsCustomerStaff customerStaff1 = icsCustomerStaffService.selectUserByMobile(phoneNumber);
|
||||
//如果手机号等于null 就新增用户
|
||||
if (null == customerStaff1) {
|
||||
icsCustomerStaff.setUsername(phoneNumber);
|
||||
|
@ -7,6 +7,7 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.google.gson.Gson;
|
||||
import com.ics.admin.controller.meeting.UserEquipmentController;
|
||||
import com.ics.admin.domain.meeting.*;
|
||||
import com.ics.admin.domain.meeting.vo.DeviceData;
|
||||
@ -28,6 +29,7 @@ import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -59,7 +61,12 @@ public class ApiEquipmentController extends BaseController {
|
||||
@RequiresPermissions("member:center:view")
|
||||
@GetMapping("/getEquipmentByUserId/{userId}")
|
||||
public R getEquipmentByUserId(@PathVariable("userId") Long userId){
|
||||
|
||||
|
||||
List<UserEquipment> equipments = userEquipmentService.getEquipmentByUserId(userId);
|
||||
|
||||
|
||||
|
||||
return R.ok().put("data",equipments);
|
||||
}
|
||||
|
||||
@ -154,7 +161,7 @@ public class ApiEquipmentController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 扫描二维码开门 用户id 和设备id
|
||||
* 扫描二维码开门 开门控制器 用户id 和设备id
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@GetMapping("/scanOpenDoor")
|
||||
@ -164,14 +171,22 @@ public class ApiEquipmentController extends BaseController {
|
||||
// roomRecord.setUserId(currentUserId);
|
||||
// 对比personId 和用户 id,
|
||||
// 对比equipmentId 和设备id
|
||||
String ip = equipmentService.selectEquipmentById(roomRecord.getDeviceId()).getIp();
|
||||
String openlock = DeviceUtils.openlock(ip);
|
||||
JSONObject jsonObject = JSONUtil.parseObj(openlock);
|
||||
Integer code = (Integer) jsonObject.get("status");
|
||||
Assert.isTrue(code == 0,"开门失败");
|
||||
// log.info("ip地址为{}",ip);
|
||||
log.info("用户id为{}",roomRecord.getUserId());
|
||||
log.info("房间id为{}",roomRecord.getRoomId());
|
||||
// String ip = equipmentService.selectEquipmentById(roomRecord.getDeviceId()).getIp();
|
||||
|
||||
int i = roomRecordService.insertRoomRecord(roomRecord);
|
||||
Assert.isTrue(i == 1,"开门失败");
|
||||
// log.info("ip地址为{}",ip);
|
||||
// log.info("用户id为{}",roomRecord.getUserId());
|
||||
// log.info("房间id为{}",roomRecord.getRoomId());
|
||||
|
||||
// String openlock = DeviceUtils.openlock(ip);
|
||||
// JSONObject jsonObject = JSONUtil.parseObj(openlock);
|
||||
// Integer code = (Integer) jsonObject.get("status");
|
||||
// Assert.isTrue(code == 0,"开门失败");
|
||||
//
|
||||
// int i = roomRecordService.insertRoomRecord(roomRecord);
|
||||
// Assert.isTrue(i == 1,"开门失败");
|
||||
|
||||
return R.ok("开门成功");
|
||||
}
|
||||
@ -181,12 +196,13 @@ public class ApiEquipmentController extends BaseController {
|
||||
*
|
||||
*/
|
||||
@Ignore
|
||||
@GetMapping("/scanDoor")
|
||||
@PostMapping("/scanDoor")
|
||||
public R scanDoor(String ip ){
|
||||
// todo 开门
|
||||
// todo 获取ip后,key为ip,value为设备id 存入redis
|
||||
// 所有设备的ip都存入redis 里面
|
||||
System.out.println(ip);
|
||||
log.info("ip为{}",ip);
|
||||
return R.ok("开门成功");
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ public class ApiRoomContentController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 会议预约记录
|
||||
* 提交会议预约记录
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@PostMapping("/saveMeetingRecord")
|
||||
@ -262,7 +262,7 @@ public class ApiRoomContentController extends BaseController {
|
||||
ids.add(equipment.getEquipmentId());
|
||||
}
|
||||
}
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(room.getBuildingDetailId());
|
||||
if (CollUtil.isNotEmpty(detailEquipments)) {
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
ids.add(detailEquipment.getEquipmentId());
|
||||
@ -318,7 +318,7 @@ public class ApiRoomContentController extends BaseController {
|
||||
ids.add(equipment.getEquipmentId());
|
||||
}
|
||||
}
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(room.getBuildingDetailId());
|
||||
if (CollUtil.isNotEmpty(detailEquipments)) {
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
ids.add(detailEquipment.getEquipmentId());
|
||||
@ -458,7 +458,7 @@ public class ApiRoomContentController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加 预约参观人员
|
||||
* 添加 邀请人员接口
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@PostMapping("/addVisitor")
|
||||
@ -491,7 +491,7 @@ public class ApiRoomContentController extends BaseController {
|
||||
ids.add(equipment.getEquipmentId());
|
||||
}
|
||||
}
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(room.getBuildingDetailId());
|
||||
if (CollUtil.isNotEmpty(detailEquipments)) {
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
ids.add(detailEquipment.getEquipmentId());
|
||||
@ -512,8 +512,6 @@ public class ApiRoomContentController extends BaseController {
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return R.ok("预约成功");
|
||||
}
|
||||
}
|
||||
@ -586,7 +584,7 @@ public class ApiRoomContentController extends BaseController {
|
||||
ids.add(equipment.getEquipmentId());
|
||||
}
|
||||
}
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(room.getBuildingDetailId());
|
||||
if (CollUtil.isNotEmpty(detailEquipments)) {
|
||||
for (DetailEquipment detailEquipment : detailEquipments) {
|
||||
ids.add(detailEquipment.getEquipmentId());
|
||||
|
Loading…
x
Reference in New Issue
Block a user