修改了对应不同园区不同企业的功能

This commit is contained in:
chendaze 2024-04-09 10:02:49 +08:00
parent bcea3e4d3b
commit 9a3d01fbf3
23 changed files with 451 additions and 284 deletions

View File

@ -99,6 +99,10 @@ public class CustomerStaffController extends BaseController {
@Autowired
private IBuildingDetailService buildingDetailService;
@Autowired
private IStaffCustomerService staffCustomerService;
private static final String BASE64_PREFIX = "data:image/png;base64,";
@ -122,49 +126,17 @@ public class CustomerStaffController extends BaseController {
/**
* 查询企业员工列表
*/
@RequiresPermissions("admin:staff:list")
@GetMapping("list")
public R list(IcsCustomerStaff icsCustomerStaff) {
startPage();
String customerId = icsCustomerStaff.getCustomerId();
if (customerId != null && !"".equals(customerId)) {
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
}
icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT);
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
}
@Ignore
@GetMapping("getStaffListNotId")
public R getStaffListNotId(IcsCustomerStaff icsCustomerStaff) {
startPage();
String customerId = icsCustomerStaff.getCustomerId();
if (customerId != null && !"".equals(customerId)) {
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
}
return result(icsCustomerStaffService.getStaffListNotId(icsCustomerStaff));
}
@Ignore
@GetMapping("getStaffListByUser")
public R getStaffListByUser(IcsCustomerStaff icsCustomerStaff) {
startPage();
String customerId = icsCustomerStaff.getCustomerId();
if (customerId != null && !"".equals(customerId)) {
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
}
List<IcsCustomerStaff> staffListByUser = icsCustomerStaffService.getStaffListByUser(icsCustomerStaff);
if (icsCustomerStaff.getStaffId() != null) {
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(icsCustomerStaff.getStaffId());
if (null != customerStaff) {
staffListByUser.add(customerStaff);
}
}
return result(staffListByUser);
}
// @RequiresPermissions("admin:staff:list")
// @GetMapping("list")
// public R list(IcsCustomerStaff icsCustomerStaff) {
// startPage();
// String customerId = icsCustomerStaff.getCustomerId();
// if (customerId != null && !"".equals(customerId)) {
// icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
// }
// icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT);
// return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
// }
/**
@ -204,15 +176,13 @@ public class CustomerStaffController extends BaseController {
public R updateStaff(@RequestBody IcsCustomerStaff icsCustomerStaff) {
//如果没有注册小程序的话
String customerId = "";
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectByPhone(icsCustomerStaff.getMobile());
if (customerStaff != null) {
if (icsCustomerStaff.getId() == null) {
ArrayList<Long> ids = new ArrayList<>();
Customer customer = customerService.selectCustomerById(Long.valueOf(icsCustomerStaff.getCustomerId()));
Customer customer = customerService.selectCustomerById(icsCustomerStaff.getIcsCustomerId());
if (null != customer) {
String roomId = customer.getRoomId();
List<String> roomIds = StrUtil.split(roomId, ',');
@ -238,11 +208,16 @@ public class CustomerStaffController extends BaseController {
userEquipment.setUserId(customerStaff.getId());
userEquipment.setStartTime(customer.getStartDate());
userEquipment.setEndDate(customer.getEndDate());
userEquipmentService.insertUserEquipment(userEquipment);
List<UserEquipment> equipments = userEquipmentService.selectUserEquipmentList(userEquipment);
if (CollUtil.isEmpty(equipments)){
userEquipmentService.insertUserEquipment(userEquipment);
}
}
}
}
Long customerId1 = icsCustomerStaff.getIcsCustomerId();
Customer customer = customerService.selectCustomerById(customerId1);
customerStaff.setName(icsCustomerStaff.getName());
customerStaff.setMobile(icsCustomerStaff.getMobile());
@ -256,14 +231,7 @@ public class CustomerStaffController extends BaseController {
customerStaff.setDegree(icsCustomerStaff.getDegree());
customerStaff.setUrgent(icsCustomerStaff.getUrgent());
//如果修改了照片根据企业找到对应的房间根据房间找到对应的设备添加用户照片进入设备中
if (icsCustomerStaff.getCustomerId() != null) {
customerStaff.setIcsCustomerId(Long.valueOf(icsCustomerStaff.getCustomerId()));
customerId = icsCustomerStaff.getCustomerId();
} else {
customerId = customerStaff.getIcsCustomerId().toString();
}
Customer customer = customerService.selectCustomerById(Long.valueOf(customerId));
if (null != customer) {
String roomId = customer.getRoomId();
List<String> roomIds = StrUtil.split(roomId, ',');
@ -276,7 +244,7 @@ public class CustomerStaffController extends BaseController {
//根据设备id获取设备
Equipment equipment = equipmentService.selectEquipmentById(roomEquipment.getEquipmentId());
if (equipment != null) {
String persons = DeviceUtils.queryPersons(String.valueOf(customerStaff.getId()));
String persons = DeviceUtils.queryPersons(equipment.getIp(),String.valueOf(customerStaff.getId()));
JSONObject jsonObject = JSONUtil.parseObj(persons);
Integer amount = (Integer) jsonObject.get("amount");
if (amount <= 0) {
@ -294,23 +262,57 @@ public class CustomerStaffController extends BaseController {
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);
}
}
}
}
}
}
}
return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(customerStaff));
int i = icsCustomerStaffService.updateIcsCustomerStaff(customerStaff);
Assert.isTrue(i > 0, "更新失败");
StaffCustomer staffCustomer = new StaffCustomer();
staffCustomer.setIcsCustomerId(icsCustomerStaff.getIcsCustomerId());
staffCustomer.setStaffId(customerStaff.getId());
List<StaffCustomer> staffCustomers = staffCustomerService.selectStaffCustomerList(staffCustomer);
if (staffCustomers.size() == 0) {
staffCustomerService.insertStaffCustomer(staffCustomer);
}
return toAjax(i);
}
icsCustomerStaff.setDataType("1");
icsCustomerStaff.setIcsCustomerId(Long.valueOf(icsCustomerStaff.getCustomerId()));
int i = icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff);
Assert.isTrue(i > 0, "添加失败");
//新增用户和企业 id
StaffCustomer staffCustomer = new StaffCustomer();
staffCustomer.setIcsCustomerId(icsCustomerStaff.getIcsCustomerId());
staffCustomer.setStaffId(icsCustomerStaff.getStaffId());
staffCustomerService.insertStaffCustomer(staffCustomer);
return toAjax(icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff));
return toAjax(i);
}
@ -323,10 +325,8 @@ public class CustomerStaffController extends BaseController {
@Ignore
@PostMapping("updateStaffByCustomer")
public R updateStaffByCustomer(@RequestBody IcsCustomerStaff icsCustomerStaff) {
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(Long.valueOf(icsCustomerStaff.getId()));
customerStaff.setUpdateTime(new Date());
return toAjax(icsCustomerStaffService.updateByCustomer(customerStaff));
StaffCustomer staffCustomer = staffCustomerService.selectStaffIdAndCustomerId(icsCustomerStaff.getIcsCustomerId(),icsCustomerStaff.getId());
return toAjax(staffCustomerService.deleteStaffCustomerById(staffCustomer.getId()));
}
/**
@ -383,142 +383,144 @@ public class CustomerStaffController extends BaseController {
}
}
}
String message = icsCustomerStaffService.importCustomerStaff(userList);
return R.data(message);
String message = icsCustomerStaffService.importCustomerStaff(userList);
return R.data(message);
}
@Ignore
@GetMapping("/exportTemplate")
public void exportTemplate(HttpServletResponse response) throws IOException {
List<SellerVO> sellerVOList = new ArrayList<>();
String title = "用户导入数据";
String sheetName = "用户导模板";
String fileName = sheetName + "-" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + ".xls";
EasyPoiUtils.exportExcel(sellerVOList, null, sheetName, SellerVO.class, fileName, true, response);
}
//授权用户设备权限查询出所有的设备
@RequiresPermissions("meeting:roomContent:list")
@PostMapping("/selectUserDeviceList")
public R selectUserDeviceList() {
//根据园区 角色 查询所有的设备信息
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);
List<Equipment> equipment2 = selectEquipmentListByIds(equipment);
return R.data(equipment2);
}
@Ignore
@GetMapping("/exportTemplate")
public void exportTemplate (HttpServletResponse response) throws IOException {
List<SellerVO> sellerVOList = new ArrayList<>();
String title = "用户导入数据";
String sheetName = "用户导模板";
String fileName = sheetName + "-" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + ".xls";
EasyPoiUtils.exportExcel(sellerVOList, null, sheetName, SellerVO.class, fileName, true, response);
}
//授权用户设备权限查询出所有的设备
@RequiresPermissions("meeting:roomContent:list")
@PostMapping("/selectUserDeviceList")
public R selectUserDeviceList () {
//根据园区 角色 查询所有的设备信息
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);
List<Equipment> equipment2 = selectEquipmentListByIds(equipment);
return R.data(equipment2);
}
boolean b = SubjectUtil.hasRole(getRequest(), "admin");
if (b) {
User user = userService.selectUserById(getCurrentUserId());
if (null != user.getCustomerId()) {
ArrayList<Long> ids = new ArrayList<>();
Customer customer = customerService.selectCustomerById(user.getCustomerId());
//根据企业 查询对应的 房间和对应的楼层
String roomId = customer.getRoomId();
List<String> roomIds = StrUtil.split(roomId, ',');
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
for (Long roomid : collect) {
Room room = roomService.selectRoomById(roomid);
if (null != room) {
Long id = room.getId();
RoomEquipment roomEquipment = roomEquipmentService.selectByRoomId(id);
if (null != roomEquipment) {
ids.add(roomEquipment.getEquipmentId());
}
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
if (CollUtil.isNotEmpty(detailEquipments)) {
for (DetailEquipment detailEquipment : detailEquipments) {
ids.add(detailEquipment.getEquipmentId());
}
boolean b = SubjectUtil.hasRole(getRequest(), "admin");
if (b) {
User user = userService.selectUserById(getCurrentUserId());
if (null != user.getCustomerId()) {
ArrayList<Long> ids = new ArrayList<>();
Customer customer = customerService.selectCustomerById(user.getCustomerId());
//根据企业 查询对应的 房间和对应的楼层
String roomId = customer.getRoomId();
List<String> roomIds = StrUtil.split(roomId, ',');
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
for (Long roomid : collect) {
Room room = roomService.selectRoomById(roomid);
if (null != room) {
Long id = room.getId();
RoomEquipment roomEquipment = roomEquipmentService.selectByRoomId(id);
if (null != roomEquipment) {
ids.add(roomEquipment.getEquipmentId());
}
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
if (CollUtil.isNotEmpty(detailEquipments)) {
for (DetailEquipment detailEquipment : detailEquipments) {
ids.add(detailEquipment.getEquipmentId());
}
}
}
if (CollUtil.isNotEmpty(ids)) {
List<Equipment> equipment = equipmentService.selectListByIds(ids);
List<Equipment> equipment1 = selectEquipmentListByIds(equipment);
}
if (CollUtil.isNotEmpty(ids)) {
List<Equipment> equipment = equipmentService.selectListByIds(ids);
List<Equipment> equipment1 = selectEquipmentListByIds(equipment);
return R.data(equipment1);
} else {
return R.data(new ArrayList<Equipment>());
}
return R.data(equipment1);
} else {
return R.data(new ArrayList<Equipment>());
}
}
List<Equipment> equipment = equipmentService.selectEquipmentList(new Equipment());
List<Equipment> equipment1 = selectEquipmentListByIds(equipment);
return R.data(equipment1);
}
/**
* 查询当前用户的所有设备
*
* @return
*/
@RequiresPermissions("meeting:roomContent:list")
@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());
if (CollUtil.isNotEmpty(collect)) {
List<Equipment> equipment1 = equipmentService.selectListByIds(collect);
List<Equipment> equipment2 = selectEquipmentListByIds(equipment1);
return R.data(equipment2);
}
return R.data(equipments);
List<Equipment> equipment = equipmentService.selectEquipmentList(new Equipment());
List<Equipment> equipment1 = selectEquipmentListByIds(equipment);
return R.data(equipment1);
}
/**
* 查询当前用户的所有设备
*
* @return
*/
@RequiresPermissions("meeting:roomContent:list")
@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());
if (CollUtil.isNotEmpty(collect)) {
List<Equipment> equipment1 = equipmentService.selectListByIds(collect);
List<Equipment> equipment2 = selectEquipmentListByIds(equipment1);
return R.data(equipment2);
}
return R.data(equipments);
}
public List<Equipment> selectEquipmentListByIds (List < Equipment > equipment) {
for (Equipment equipment2 : equipment) {
RoomEquipment roomEquipment = roomEquipmentService.selectByEquipmentId(equipment2.getId());
if (roomEquipment != null) {
Room room = roomService.selectRoomById(roomEquipment.getRoomId());
equipment2.setRoomId(room.getId());
equipment2.setBuildId(room.getBuildingDetailId());
equipment2.setRoomName(room.getName());
BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(room.getBuildingDetailId());
public List<Equipment> selectEquipmentListByIds(List<Equipment> equipment) {
for (Equipment equipment2 : equipment) {
RoomEquipment roomEquipment = roomEquipmentService.selectByEquipmentId(equipment2.getId());
if (roomEquipment != null) {
Room room = roomService.selectRoomById(roomEquipment.getRoomId());
equipment2.setRoomId(room.getId());
equipment2.setBuildId(room.getBuildingDetailId());
equipment2.setRoomName(room.getName());
BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(room.getBuildingDetailId());
if (buildingDetail != null) {
equipment2.setBuildName(buildingDetail.getFloorName());
}
} else {
DetailEquipment detailEquipment = detailEquipmentService.selectByEquipmentId(equipment2.getId());
if (null != detailEquipment) {
BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(detailEquipment.getBuildingDetailId());
if (buildingDetail != null) {
equipment2.setBuildName(buildingDetail.getFloorName());
}
} else {
DetailEquipment detailEquipment = detailEquipmentService.selectByEquipmentId(equipment2.getId());
if (null != detailEquipment) {
BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(detailEquipment.getBuildingDetailId());
if (buildingDetail != null) {
equipment2.setBuildName(buildingDetail.getFloorName());
}
}
}
}
return equipment;
}
return equipment;
}
@RequiresPermissions("meeting:roomContent:list")
@PostMapping("/saveUserEquipment")
public R saveUserEquipment (@RequestBody UserEquipment equipment){
@RequiresPermissions("meeting:roomContent:list")
@PostMapping("/saveUserEquipment")
public R saveUserEquipment(@RequestBody UserEquipment equipment) {
//根据企业查询出所有的设备
//根据企业查询出所有的设备
if (equipment.getUserId() != null) {
ArrayList<Long> ids = new ArrayList<>();
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(equipment.getUserId());
if (null != customerStaff) {
Customer customer = customerService.selectCustomerById(customerStaff.getIcsCustomerId());
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());
//根据企业 查询对应的 房间和对应的楼层
String roomId = customer.getRoomId();
List<String> roomIds = StrUtil.split(roomId, ',');
@ -539,30 +541,33 @@ public class CustomerStaffController extends BaseController {
}
}
}
for (Long id : ids) {
int num = userEquipmentService.selectListByUserId(equipment.getUserId());
if (num > 0) {
int count = userEquipmentService.deleteUserEquipmentByUserId(equipment.getUserId(), id);
Assert.isTrue(count > 0, "删除失败");
}
}
for (Long id : ids) {
int num = userEquipmentService.selectListByUserId(equipment.getUserId());
if (num > 0) {
int count = userEquipmentService.deleteUserEquipmentByUserId(equipment.getUserId(), id);
Assert.isTrue(count > 0, "删除失败");
}
}
}
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();
}
}
}
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();
}
}

View File

@ -91,6 +91,9 @@ public class EquipmentController extends BaseController {
@Autowired
private IUserService userService;
@Autowired
private IStaffCustomerService staffCustomerService;
/**
* 查询设备
*/
@ -363,10 +366,14 @@ public class EquipmentController extends BaseController {
}
}
List<IcsCustomerStaff> icsCustomerStaffs = staffService.selectIcsCustomerStaffList(customerStaff);
for (IcsCustomerStaff icsCustomerStaff : icsCustomerStaffs) {
Customer customer = customerService.selectCustomerById(icsCustomerStaff.getIcsCustomerId());
if (null != customer) {
icsCustomerStaff.setCustomerName(customer.getName());
List<StaffCustomer> staffCustomers = staffCustomerService.selectStaffCustomerByStaffId(icsCustomerStaff.getId());
for (StaffCustomer staffCustomer : staffCustomers) {
Customer customer = customerService.selectCustomerById(staffCustomer.getIcsCustomerId());
if (null != customer) {
icsCustomerStaff.setCustomerName(customer.getName());
}
}
}
return R.data(icsCustomerStaffs);

View File

@ -124,6 +124,7 @@ public class ShowroomRecordController extends BaseController {
showroomRecord.setUserName(customerStaff.getUsername());
showroomRecord.setUserPhone(customerStaff.getMobile());
// todo 企业展示如何展示
Customer customer = customerService.selectCustomerById(customerStaff.getIcsCustomerId());
if (null != customer) {
showroomRecord.setCustomerName(customer.getName());

View File

@ -24,6 +24,7 @@ import com.ics.common.core.domain.dto.DevicePersonDto;
import com.ics.common.core.domain.dto.FacesDto;
import com.ics.common.utils.DateUtils;
import com.ics.common.utils.DeviceUtils;
import com.ics.common.utils.RandomUtil;
import com.ics.common.utils.UrlToBase64Util;
import com.ics.system.domain.Tenant;
import com.ics.system.domain.User;
@ -111,11 +112,7 @@ public class VisitorPersonController extends BaseController {
visitorPerson.setIntervieweeName(customerStaff.getUsername());
}
IcsCustomerStaff customerStaff1 = staffService.selectIcsCustomerStaffById(visitorPerson.getUserId());
if (null != customerStaff1) {
visitorPerson.setUserName(customerStaff1.getUsername());
visitorPerson.setUserPhone(customerStaff1.getMobile());
}
Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId());
if (null != customer) {
visitorPerson.setCustomerName(customer.getName());
@ -188,15 +185,10 @@ public class VisitorPersonController extends BaseController {
}
visitorPerson.setStatus(1);
visitorPerson.setCreateTime(DateUtils.getNowDate());
visitorPerson.setUserId(Long.valueOf(RandomUtil.randomInt(10)));
int i = visitorPersonService.insertReservationPerson(visitorPerson);
if (i > 0){
String s = DeviceUtils.queryPersons(String.valueOf(visitorPerson.getIntervieweeId()));
JSONObject jsonObject = JSONUtil.parseObj(s);
Integer amount = (Integer) jsonObject.get("amount");
if (amount > 0) {
//todo 需要修改 到底是按照访客时间
return toAjax(1);
}
// todo 根据被访人企业id查询对应的房间
Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId());
String roomId = customer.getRoomId();
@ -210,7 +202,13 @@ public class VisitorPersonController extends BaseController {
//根据设备id获取设备
Equipment equipment = equipmentService.selectEquipmentById(roomEquipment.getEquipmentId());
if (equipment != null) {
String s = DeviceUtils.queryPersons(equipment.getIp(), String.valueOf(visitorPerson.getIntervieweeId()));
JSONObject jsonObject = JSONUtil.parseObj(s);
Integer amount = (Integer) jsonObject.get("amount");
if (amount > 0) {
//todo 需要修改 到底是按照访客时间
return toAjax(1);
}
//添加 用户和对应的设备
UserEquipment userEquipment = new UserEquipment();
userEquipment.setEquipmentId(equipment.getId());
@ -222,7 +220,7 @@ public class VisitorPersonController extends BaseController {
//往设备添加对应的人脸数据
DevicePersonDto devicePersonDto = new DevicePersonDto();
ArrayList<FacesDto> facesDtos = new ArrayList<>();
devicePersonDto.setPersonId(String.valueOf(visitorPerson.getIntervieweeId()));
devicePersonDto.setPersonId(String.valueOf(visitorPerson.getUserId()));
devicePersonDto.setName(visitorPerson.getName());
devicePersonDto.setPhone(String.valueOf(visitorPerson.getPhone()));
devicePersonDto.setCertificateType("111");
@ -257,12 +255,74 @@ public class VisitorPersonController extends BaseController {
if (null != visitorPerson.getStatus()) {
Long loginCustomerId = this.getLoginCustomerId();
if (loginCustomerId != null) {
visitorPerson.setReviewers(loginCustomerId);
visitorPerson.setReviewersTime(new Date());
}
}
if (visitorPerson.getStatus() == 1){
Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId());
String roomId = customer.getRoomId();
List<String> roomIds = StrUtil.split(roomId, ',');
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
//获取了房间集合循环对应集合
for (Long aLong : collect) {
//根据房间id获取设备id
List<RoomEquipment> roomEquipments = roomEquipmentService.selectListByRoomId(aLong);
for (RoomEquipment roomEquipment : roomEquipments) {
//根据设备id获取设备
Equipment equipment = equipmentService.selectEquipmentById(roomEquipment.getEquipmentId());
if (equipment != null) {
String s = DeviceUtils.queryPersons(equipment.getIp(), String.valueOf(visitorPerson.getIntervieweeId()));
JSONObject jsonObject = JSONUtil.parseObj(s);
Integer amount = (Integer) jsonObject.get("amount");
if (amount > 0) {
//todo 需要修改 到底是按照访客时间
return toAjax(1);
}
//添加 用户和对应的设备
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("visitor");
//添加访客时间
devicePersonDto.setVisitorValidStartTime(DateUtil.format(visitorPerson.getVisitTime(), "yyyy-MM-dd'T'HH:mm:ss"));
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 faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
facesDto.setData(faceData);
facesDtos.add(facesDto);
devicePersonDto.setFaces(facesDtos);
DeviceUtils.addPersons(equipment.getIp(), devicePersonDto);
}
}
}
}
return toAjax(visitorPersonService.updateReservationPerson(visitorPerson));
}
@ -308,8 +368,10 @@ public class VisitorPersonController extends BaseController {
*/
@Ignore
@GetMapping("selectCustomer")
public R selectCustomer() {
List<Customer> customers = customerService.selectCustomerList(new Customer());
public R selectCustomer(Long parkId) {
Customer customer = new Customer();
customer.setParkId(parkId);
List<Customer> customers = customerService.selectCustomerList(customer);
return R.data(customers);
}

View File

@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.annotation.IEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ics.admin.domain.BannerImage;
import com.ics.admin.handler.BannerImageHandler;
import com.ics.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -38,6 +41,9 @@ public class RoomContent extends BaseEntity<RoomContent> {
/** 室内图片url */
private String indoorPicUrl;
// @TableField(typeHandler = BannerImageHandler.class)
// private List<BannerImage> bannerImages = new ArrayList<>();
/** 地址 */
private String address;

View File

@ -21,11 +21,9 @@ public class VisitorPerson extends BaseEntity<VisitorPerson> {
/** 被访人id */
private Long userId;
@TableField(exist = false)
private String userName;
@TableField(exist = false)
private String userPhone;
private String userMobile;

View File

@ -22,12 +22,10 @@ public class VisitorPersonVo extends BaseEntity<VisitorPersonVo> {
private Long userId;
@TableField(exist = false)
private String username;
private String userName;
@TableField(exist = false)
private String mobile;
private String userMobile;
/** 被访人id */

View File

@ -61,4 +61,6 @@ public interface ICustomerService extends IService<Customer> {
int deleteCustomerById(Long id);
Customer selectByRoomId(Long id);
Customer selectCustomerByIdAndParkId(Long icsCustomerId, Long parkId);
}

View File

@ -99,4 +99,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
return customerMapper.selectOne(queryWrapper);
}
@Override
public Customer selectCustomerByIdAndParkId(Long icsCustomerId, Long parkId) {
QueryWrapper<Customer> queryWrapper =new QueryWrapper<>();
queryWrapper.eq("id",icsCustomerId).eq("park_id",parkId);
return customerMapper.selectOne(queryWrapper);
}
}

View File

@ -161,9 +161,8 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMap
@Override
public List<IcsCustomerStaff> selectCustomerStaffList(IcsCustomerStaff icsCustomerStaff) {
QueryWrapper<IcsCustomerStaff> wrapper = new QueryWrapper<>();
wrapper.eq("ics_customer_id",icsCustomerStaff.getIcsCustomerId());
return icsCustomerStaffMapper.selectList(wrapper);
return icsCustomerStaffMapper.selectIcsCustomerStaffList(icsCustomerStaff);
}
@Override

View File

@ -94,6 +94,8 @@ public class UserEquipmentServiceImpl extends ServiceImpl<UserEquipmentMapper, U
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(null != userEquipment.getEquipmentId(),"equipment_id",userEquipment.getEquipmentId());
queryWrapper.eq(null != userEquipment.getUserId(),"user_id",userEquipment.getUserId());
queryWrapper.eq(null != userEquipment.getStartTime(),"start_time",userEquipment.getStartTime());
queryWrapper.eq(null != userEquipment.getEndDate(),"end_date",userEquipment.getEndDate());
queryWrapper.in(CollUtil.isNotEmpty(userEquipment.getUserIds()),"user_id",userEquipment.getUserIds());
return userEquipmentMapper.selectList(queryWrapper);
}

View File

@ -137,16 +137,25 @@ public class IVisitorPersonServiceImpl extends ServiceImpl<VisitorPersonMapper,
VisitorPerson visitorPerson = visitorPersonMapper.selectReservationPersonById(id);
//获取当前预约记录根据开始时间和结束时间去查找对应的
//开始时间
Date visitTime = visitorPerson.getVisitTime();
//结束时间
Date leaveTime = visitorPerson.getLeaveTime();
// //开始时间
// Date visitTime = visitorPerson.getVisitTime();
// //结束时间
// Date leaveTime = visitorPerson.getLeaveTime();
QueryWrapper<RoomRecord> wrapper = new QueryWrapper<RoomRecord>();
wrapper.between("create_time",visitTime,leaveTime);
// wrapper.between("create_time",visitTime,leaveTime);
wrapper.eq("user_id",visitorPerson.getIntervieweeId());
return roomRecordMapper.selectList(wrapper);
}
@Override
public VisitorPerson selectByUserId(String personId) {
QueryWrapper<VisitorPerson> wrapper = new QueryWrapper<VisitorPerson>();
wrapper.eq("user_id",personId);
return visitorPersonMapper.selectOne(wrapper);
}
}

View File

@ -42,6 +42,8 @@ public class StaffCustomerServiceImpl extends ServiceImpl<StaffCustomerMapper, S
@Override
public List<StaffCustomer> selectStaffCustomerList(StaffCustomer staffCustomer) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.like(staffCustomer.getIcsCustomerId() != null,"ics_customer_id",staffCustomer.getIcsCustomerId());
queryWrapper.like(staffCustomer.getStaffId() !=null,"staff_id",staffCustomer.getStaffId());
return staffCustomerMapper.selectList(queryWrapper);
}
@ -89,4 +91,21 @@ public class StaffCustomerServiceImpl extends ServiceImpl<StaffCustomerMapper, S
public int deleteStaffCustomerById(Long id) {
return staffCustomerMapper.deleteStaffCustomerById(id);
}
@Override
public List<StaffCustomer> selectStaffCustomerByStaffId(Long id) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("staff_id",id);
return staffCustomerMapper.selectList(queryWrapper);
}
@Override
public StaffCustomer selectStaffIdAndCustomerId(Long icsCustomerId, Long staffId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("staff_id",staffId);
queryWrapper.eq("ics_customer_id",icsCustomerId);
return staffCustomerMapper.selectOne(queryWrapper);
}
}

View File

@ -58,4 +58,8 @@ public interface IStaffCustomerService extends IService<StaffCustomer> {
* @return 结果
*/
int deleteStaffCustomerById(Long id);
List<StaffCustomer> selectStaffCustomerByStaffId(Long id);
StaffCustomer selectStaffIdAndCustomerId(Long icsCustomerId, Long staffId);
}

View File

@ -69,4 +69,7 @@ public interface IVisitorPersonService extends IService<VisitorPerson> {
int updateVisitorPersonStatus(VisitorPerson person);
List<RoomRecord> getRecordByReservationId(Long id);
VisitorPerson selectByUserId(String personId);
}

View File

@ -43,16 +43,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectIcsCustomerStaffList" parameterType="com.ics.common.core.domain.IcsCustomerStaff" resultMap="IcsCustomerStaffResult">
<include refid="selectIcsCustomerStaffVo"/>
SELECT cs.id, cs.username, cs.mobile, cs.create_by, cs.create_time, cs.update_by,cs.name,cs.photo,cs.address,cs.email,cs.degree,cs.urgent,cs.update_time,
cs.delete_flag, cs.ics_customer_id, cs.openid, cs.avatar, cs.gender, cs.status, cs.park_id,cs.card_no,cs.data_type
FROM ics_customer_staff cs
left join tb_staff_customer tsc on cs.id = tsc.staff_id
<where>
<if test="username != null and username != ''"> AND username LIKE CONCAT('%', #{username}, '%') </if>
<if test="icsCustomerId != null and icsCustomerId != ''"> AND ics_customer_id = #{icsCustomerId} </if>
<if test="mobile != null and mobile != ''"> AND mobile LIKE CONCAT('%', #{mobile}, '%') </if>
<if test="name != null and name != ''"> AND name LIKE CONCAT('%', #{name}, '%') </if>
<if test="dataType != null and dataType != ''"> AND data_type = #{dataType} </if>
<if test="parkId != null and parkId != ''"> AND park_id = #{parkId} </if>
<if test="tenantId != null and tenantId != ''"> AND tenant_id = #{tenantId} </if>
<if test="username != null and username != ''"> AND cs.username LIKE CONCAT('%', #{username}, '%') </if>
<if test="icsCustomerId != null and icsCustomerId != ''"> AND tsc.ics_customer_id = #{icsCustomerId} </if>
<if test="mobile != null and mobile != ''"> AND cs.mobile LIKE CONCAT('%', #{mobile}, '%') </if>
<if test="name != null and name != ''"> AND cs.name LIKE CONCAT('%', #{name}, '%') </if>
<if test="dataType != null and dataType != ''"> AND cs.data_type = #{dataType} </if>
<if test="parkId != null and parkId != ''"> AND cs.park_id = #{parkId} </if>
<if test="tenantId != null and tenantId != ''"> AND cs.tenant_id = #{tenantId} </if>
</where>
</select>
<select id="selectIcsCustomerStaffById" parameterType="Long" resultMap="IcsCustomerStaffResult">

View File

@ -9,6 +9,8 @@
<result property="userId" column="user_id"/>
<result property="intervieweeId" column="interviewee_id"/>
<result property="name" column="name"/>
<result property="userName" column="user_name"/>
<result property="userMobile" column="user_mobile"/>
<result property="phone" column="phone"/>
<result property="joinTime" column="join_time"/>
<result property="visitTime" column="visit_time"/>
@ -25,7 +27,7 @@
</resultMap>
<sql id="selectReservationPersonVo">
SELECT id, user_id, interviewee_id, name, phone,reject_content, join_time,reviewers,reviewers_time, visit_time,photo,customer_id, leave_time, visit_content, card_type, card_no, status FROM tb_visitor_person
SELECT id, user_id, interviewee_id, name, phone,reject_content,user_name,user_mobile, join_time,reviewers,reviewers_time, visit_time,photo,customer_id, leave_time, visit_content, card_type, card_no, status FROM tb_visitor_person
</sql>
<select id="selectReservationPersonList" parameterType="VisitorPerson" resultMap="ReservationPersonResult">
@ -50,6 +52,8 @@
<if test="phone != null ">phone,</if>
<if test="joinTime != null ">join_time,</if>
<if test="visitTime != null ">visit_time,</if>
<if test="userName != null ">user_name,</if>
<if test="userMobile != null ">user_mobile,</if>
<if test="customerId != null ">customer_id,</if>
<if test="reviewers != null ">reviewers,</if>
<if test="reviewersTime != null ">reviewers_time,</if>
@ -67,6 +71,8 @@
<if test="intervieweeId != null ">#{intervieweeId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null ">#{phone},</if>
<if test="userName != null ">#{userName},</if>
<if test="userMobile != null ">#{userMobile},</if>
<if test="joinTime != null ">#{joinTime},</if>
<if test="reviewers != null ">#{reviewers},</if>
<if test="reviewersTime != null ">#{reviewersTime},</if>
@ -91,6 +97,8 @@
<if test="phone != null ">phone = #{phone},</if>
<if test="joinTime != null ">join_time = #{joinTime},</if>
<if test="visitTime != null ">visit_time = #{visitTime},</if>
<if test="userName != null ">user_name = #{userName},</if>
<if test="userMobile != null ">user_mobile = #{userMobile},</if>
<if test="customerId != null ">customer_id = #{customerId},</if>
<if test="reviewersTime != null ">reviewers_time = #{reviewersTime},</if>
<if test="reviewers != null ">reviewers = #{reviewers},</if>

View File

@ -185,6 +185,26 @@ public class DeviceUtils {
return msg;
}
/**
* 修改人脸
*/
public static String modifyFaces(String ip,DevicePersonDto dto) {
String url = ip + "/api/viso/v2/modifyFaces";
// DevicePersonDto devicePersonDto = new DevicePersonDto();
// FacesDto facesDto = new FacesDto();
// facesDto.setFaceId("001");
// String imgurl = "E:\\360MoveData\\Users\\Administrator\\Desktop\\图片\\图片\\photo.jpg";
// String s =BASE64_PREFIX+ UrlToBase64Util.imageUrlToBase64(imgurl);
String json = JsonUtils.toJson(dto);
System.out.println(json);
System.out.println(url);
String msg = HttpUtil.post(url,json);
log.info("设备修改人脸:{}", msg);
return msg;
}
/**
* 添加人脸照片
*/
@ -227,8 +247,8 @@ public class DeviceUtils {
return msg;
}
public static String queryPersons(String personId) {
String url = DEVICE_IP + "/api/viso/v2/queryPersons";
public static String queryPersons(String ip,String personId) {
String url = ip + "/api/viso/v2/queryPersons";
JSONObject param = JSONUtil.createObj();
param.put("any", false);
param.put("personId", personId);

View File

@ -9,14 +9,12 @@ import com.ics.admin.domain.Customer;
import com.ics.admin.domain.Park;
import com.ics.admin.domain.meeting.DetailEquipment;
import com.ics.admin.domain.meeting.RoomEquipment;
import com.ics.admin.domain.meeting.StaffCustomer;
import com.ics.admin.domain.meeting.UserEquipment;
import com.ics.admin.service.ICustomerService;
import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.admin.service.IParkService;
import com.ics.admin.service.meeting.IDetailEquipmentService;
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.*;
import com.ics.common.constant.Constants;
import com.ics.common.core.controller.BaseController;
import com.ics.common.core.domain.IcsCustomerStaff;
@ -83,6 +81,9 @@ public class WxLoginAPIController extends BaseController {
@Autowired
private ICustomerService customerService;
@Autowired
private IStaffCustomerService staffCustomerService;
String smallWxAccessTokenKey = "smallWxAccessToken";
String smallWxUserPassword = "123456";
@ -243,13 +244,25 @@ public class WxLoginAPIController extends BaseController {
@RequiresPermissions("member:center:view")
@GetMapping("/wx/getUserInfo")
public R login(Long userId) {
public R login(Long userId,Long parkId) {
try {
//检查是否是否存在
IcsCustomerStaff icsCustomerStaff = new IcsCustomerStaff();
icsCustomerStaff.setId(userId);
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(userId);
if (null != customerStaff) {
StaffCustomer staffCustomer = new StaffCustomer();
staffCustomer.setStaffId(userId);
List<StaffCustomer> staffCustomers = staffCustomerService.selectStaffCustomerByStaffId(userId);
if(CollUtil.isNotEmpty(staffCustomers)){
for (StaffCustomer staffCustomer1 : staffCustomers) {
Customer customer = customerService.selectCustomerByIdAndParkId(staffCustomer1.getIcsCustomerId(), parkId);
if (null != customer){
customerStaff.setCustomerName(customer.getName());
customerStaff.setIcsCustomerId(customer.getId());
break;
}
}
}
return R.ok().put("data", customerStaff);
} else {
return R.error("获取微信用户数据失败");

View File

@ -8,15 +8,9 @@ import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ics.admin.controller.meeting.UserEquipmentController;
import com.ics.admin.domain.meeting.Equipment;
import com.ics.admin.domain.meeting.RoomEquipment;
import com.ics.admin.domain.meeting.RoomRecord;
import com.ics.admin.domain.meeting.UserEquipment;
import com.ics.admin.domain.meeting.*;
import com.ics.admin.domain.meeting.vo.DeviceData;
import com.ics.admin.service.meeting.IEquipmentService;
import com.ics.admin.service.meeting.IRoomEquipmentService;
import com.ics.admin.service.meeting.IRoomRecordService;
import com.ics.admin.service.meeting.IUserEquipmentService;
import com.ics.admin.service.meeting.*;
import com.ics.common.core.controller.BaseController;
import com.ics.common.core.domain.R;
import com.ics.common.core.page.PageDomain;
@ -51,6 +45,9 @@ public class ApiEquipmentController extends BaseController {
@Autowired
private IRoomEquipmentService roomEquipmentService;
@Autowired
private IVisitorPersonService visitorPersonService;
//根据用户id查询对应的设备 楼层分割房间设备信息
@RequiresPermissions("member:center:view")
@GetMapping("/getEquipmentByUserId/{userId}")
@ -112,7 +109,7 @@ public class ApiEquipmentController extends BaseController {
/**
* 获取对比记录 todo 没写完 是否需要人脸对比的数据
* 获取对比记录
* @return
*/
@Ignore
@ -126,13 +123,19 @@ public class ApiEquipmentController extends BaseController {
//用户id
String personId = data.getData().getPersonId();
String deviceId = data.getData().getDeviceId();
Equipment equipment = equipmentService.selectByDeviceCode(deviceId);
Assert.isTrue(equipment != null,"设备不存在");
RoomRecord record = new RoomRecord();
record.setUserId(Long.valueOf(personId));
if (data.getData().getPersonType().equals("visitor")){
VisitorPerson visitorPerson =visitorPersonService.selectByUserId(personId);
record.setUserId(visitorPerson.getIntervieweeId());
}
record.setParkId(equipment.getParkId());
record.setType("1");

View File

@ -90,6 +90,9 @@ public class ApiShowroomController extends BaseController {
Room room = roomService.selectRoomById(showroom1.getRoomId());
if (room != null) {
showroom1.setRoomName(room.getName());
//查询楼层号
BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(room.getBuildingDetailId());
if (buildingDetail != null) {
@ -198,8 +201,8 @@ public class ApiShowroomController extends BaseController {
showroomRecord1.setStatusName("待审核");
}else if (showroomRecord1.getStatus() == 1){
showroomRecord1.setStatusName("审核通过");
}else if (showroomRecord1.getStatus() == 2){
showroomRecord1.setStatusName("审核驳回");
}else if (showroomRecord1.getStatus() == 4){
showroomRecord1.setStatusName("已取消");
}
Showroom showroom = showroomService.selectShowroomById(showroomRecord1.getShowroomId());
@ -233,8 +236,8 @@ public class ApiShowroomController extends BaseController {
showroomRecord.setStatusName("待审核");
} else if (showroomRecord.getStatus() == 1) {
showroomRecord.setStatusName("审核通过");
} else if (showroomRecord.getStatus() == 2) {
showroomRecord.setStatusName("审核驳回");
} else if (showroomRecord.getStatus() == 4) {
showroomRecord.setStatusName("已取消");
}
IcsCustomerStaff icsCustomerStaff = staffService.selectIcsCustomerStaffById(showroomRecord.getUserId());

View File

@ -26,6 +26,7 @@ import com.ics.common.core.domain.dto.FacesDto;
import com.ics.common.core.page.PageDomain;
import com.ics.common.core.page.TableSupport;
import com.ics.common.utils.DeviceUtils;
import com.ics.common.utils.RandomUtil;
import com.ics.common.utils.UrlToBase64Util;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@ -167,10 +168,7 @@ public class ApiVisitorController extends BaseController {
visitorPerson.setStatusName("审核拒绝");
}
Long userId = visitorPerson.getUserId();
IcsCustomerStaff icsCustomerStaff = customerStaffService.selectIcsCustomerStaffById(userId);
visitorPerson.setUserName(icsCustomerStaff.getUsername());
visitorPerson.setMobile(icsCustomerStaff.getMobile());
Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId());
visitorPerson.setCustomerName(customer.getName());
}
@ -193,17 +191,11 @@ public class ApiVisitorController extends BaseController {
visitorPerson.setStatusName("审核拒绝");
}
Long userId = visitorPerson.getUserId();
IcsCustomerStaff icsCustomerStaff = customerStaffService.selectIcsCustomerStaffById(userId);
visitorPerson.setUserName(icsCustomerStaff.getUsername());
// visitorPerson.setUsername(icsCustomerStaff.getUsername());
visitorPerson.setMobile(icsCustomerStaff.getMobile());
Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId());
visitorPerson.setCustomerName(customer.getName());
VisitorPersonVo visitorPersonVO = new VisitorPersonVo();
BeanUtils.copyProperties(visitorPerson, visitorPersonVO);
visitorPersonVO.setUsername(icsCustomerStaff.getUsername());
return R.ok().put("data", visitorPersonVO);
}
@ -223,13 +215,7 @@ public class ApiVisitorController extends BaseController {
person.setReviewersTime(new Date());
int update = visitorPersonService.updateVisitorPersonStatus(person);
if (update > 0) {
String s = DeviceUtils.queryPersons(String.valueOf(person.getIntervieweeId()));
JSONObject jsonObject = JSONUtil.parseObj(s);
Integer amount = (Integer) jsonObject.get("amount");
if (amount > 0) {
//todo 需要修改 到底是按照访客时间
return toAjax(1);
}
ArrayList<Long> ids = new ArrayList<>();
@ -273,7 +259,13 @@ public class ApiVisitorController extends BaseController {
//根据设备id获取设备
Equipment equipment = equipmentService.selectEquipmentById(roomEquipment.getEquipmentId());
if (equipment != null) {
String s = DeviceUtils.queryPersons(equipment.getIp(),String.valueOf(person.getIntervieweeId()));
JSONObject jsonObject = JSONUtil.parseObj(s);
Integer amount = (Integer) jsonObject.get("amount");
if (amount > 0) {
//todo 需要修改 到底是按照访客时间
return toAjax(1);
}
DevicePersonDto devicePersonDto = new DevicePersonDto();
ArrayList<FacesDto> facesDtos = new ArrayList<>();
devicePersonDto.setPersonId(String.valueOf(visitorPerson.getIntervieweeId()));
@ -328,6 +320,7 @@ public class ApiVisitorController extends BaseController {
person.setStatus(0);
Assert.isTrue(IdcardUtil.isValidCard(person.getCardNo()), "身份证格式不正确");
Assert.isTrue(Validator.isMobile(person.getPhone()), "手机号格式不正确");
person.setUserId(Long.valueOf(RandomUtil.randomInt(10)));
int i = visitorPersonService.insertReservationPerson(person);
Assert.isTrue(i > 0, "添加访客预约失败");
//添加成功后需要 往设备中添加一条数据

View File

@ -121,7 +121,7 @@ public class ProfileAPIController extends BaseController {
//根据设备id获取设备
Equipment equipment = equipmentService.selectEquipmentById(roomEquipment.getEquipmentId());
if (equipment != null) {
String persons = DeviceUtils.queryPersons(String.valueOf(icsCustomerStaff.getId()));
String persons = DeviceUtils.queryPersons(equipment.getIp(),String.valueOf(icsCustomerStaff.getId()));
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(persons);
Integer amount = (Integer) jsonObject.get("amount");
if (amount <= 0) {