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
2679e7816b
commit
bcea3e4d3b
@ -67,7 +67,7 @@
|
||||
<version>0.4.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- easypoi -->
|
||||
<!-- easypoi -->
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-base</artifactId>
|
||||
|
@ -6,13 +6,11 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.ics.admin.domain.Building;
|
||||
import com.ics.admin.domain.Customer;
|
||||
import com.ics.admin.domain.Park;
|
||||
import com.ics.admin.domain.Room;
|
||||
import com.ics.admin.service.ICustomerService;
|
||||
import com.ics.admin.service.IIcsCustomerStaffService;
|
||||
import com.ics.admin.service.IParkService;
|
||||
import com.ics.admin.service.IRoomService;
|
||||
import com.ics.admin.service.*;
|
||||
import com.ics.common.constant.Constants;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
@ -20,7 +18,9 @@ import com.ics.common.core.domain.R;
|
||||
import com.ics.common.core.text.Convert;
|
||||
import com.ics.common.utils.ValidatorUtils;
|
||||
import com.ics.common.utils.http.HttpUtils;
|
||||
import com.ics.system.domain.Tenant;
|
||||
import com.ics.system.domain.User;
|
||||
import com.ics.system.service.ITenantService;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -55,6 +55,11 @@ public class CustomerController extends BaseController {
|
||||
@Autowired
|
||||
private IRoomService roomService;
|
||||
|
||||
@Autowired
|
||||
private ITenantService tenantService;
|
||||
|
||||
@Autowired
|
||||
private IBuildingService buildingService;
|
||||
|
||||
/**
|
||||
* app的key值
|
||||
@ -126,7 +131,16 @@ public class CustomerController extends BaseController {
|
||||
public R list(Customer customer) {
|
||||
startPage();
|
||||
customer.setDeleteFlag(0);
|
||||
return result(customerService.selectCustomerList(customer));
|
||||
List<Customer> customers = customerService.selectCustomerList(customer);
|
||||
for (Customer customer1 : customers) {
|
||||
Long tenantId = customer1.getTenantId();
|
||||
Tenant tenant = tenantService.selectTenantById(tenantId);
|
||||
customer1.setTenantName(tenant.getName());
|
||||
Building building = buildingService.selectBuildingById(customer1.getBuildingId());
|
||||
customer1.setBuildingName(building.getBuildingName());
|
||||
|
||||
}
|
||||
return result(customers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,8 +2,11 @@ package com.ics.admin.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.ics.admin.domain.*;
|
||||
import com.ics.admin.domain.meeting.*;
|
||||
@ -19,9 +22,9 @@ import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.common.core.domain.BaseEntity;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.common.core.domain.R;
|
||||
import com.ics.common.utils.DateUtils;
|
||||
import com.ics.common.utils.GuavaCacheUtil;
|
||||
import com.ics.common.utils.StringUtils;
|
||||
import com.ics.common.core.domain.dto.DevicePersonDto;
|
||||
import com.ics.common.core.domain.dto.FacesDto;
|
||||
import com.ics.common.utils.*;
|
||||
import com.ics.common.utils.poi.ExcelUtil;
|
||||
import com.ics.system.domain.User;
|
||||
import com.ics.system.service.ICurrentUserService;
|
||||
@ -96,12 +99,18 @@ public class CustomerStaffController extends BaseController {
|
||||
@Autowired
|
||||
private IBuildingDetailService buildingDetailService;
|
||||
|
||||
private static final String BASE64_PREFIX = "data:image/png;base64,";
|
||||
|
||||
|
||||
/**
|
||||
* app的密钥值
|
||||
*/
|
||||
@Value("${dfs.path}")
|
||||
private String path;
|
||||
|
||||
@Value("${dfs.domain}")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 查询企业员工
|
||||
*/
|
||||
@ -194,39 +203,115 @@ public class CustomerStaffController extends BaseController {
|
||||
@PostMapping("updateStaff")
|
||||
public R updateStaff(@RequestBody IcsCustomerStaff icsCustomerStaff) {
|
||||
|
||||
//如果没有注册小程序的话
|
||||
String customerId = "";
|
||||
|
||||
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectByPhone(icsCustomerStaff.getMobile());
|
||||
customerStaff.setName(icsCustomerStaff.getName());
|
||||
customerStaff.setMobile(icsCustomerStaff.getMobile());
|
||||
customerStaff.setGender(icsCustomerStaff.getGender());
|
||||
customerStaff.setPhoto(icsCustomerStaff.getPhoto());
|
||||
customerStaff.setAvatar(icsCustomerStaff.getAvatar());
|
||||
customerStaff.setUsername(icsCustomerStaff.getUsername());
|
||||
customerStaff.setCardNo(icsCustomerStaff.getCardNo());
|
||||
customerStaff.setAddress(icsCustomerStaff.getAddress());
|
||||
customerStaff.setEmail(icsCustomerStaff.getEmail());
|
||||
customerStaff.setDegree(icsCustomerStaff.getDegree());
|
||||
customerStaff.setUrgent(icsCustomerStaff.getUrgent());
|
||||
if (customerStaff != null) {
|
||||
|
||||
if (icsCustomerStaff.getId() == null) {
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
|
||||
Customer customer = customerService.selectCustomerById(Long.valueOf(icsCustomerStaff.getCustomerId()));
|
||||
if (null != customer) {
|
||||
String roomId = customer.getRoomId();
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long id : collect) {
|
||||
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)) {
|
||||
for (Long id : ids) {
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(id);
|
||||
userEquipment.setUserId(customerStaff.getId());
|
||||
userEquipment.setStartTime(customer.getStartDate());
|
||||
userEquipment.setEndDate(customer.getEndDate());
|
||||
userEquipmentService.insertUserEquipment(userEquipment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//如果修改了照片,根据企业找到对应的房间,根据房间找到对应的设备,添加用户照片进入设备中
|
||||
customerStaff.setName(icsCustomerStaff.getName());
|
||||
customerStaff.setMobile(icsCustomerStaff.getMobile());
|
||||
customerStaff.setGender(icsCustomerStaff.getGender());
|
||||
customerStaff.setPhoto(icsCustomerStaff.getPhoto());
|
||||
customerStaff.setAvatar(icsCustomerStaff.getAvatar());
|
||||
customerStaff.setUsername(icsCustomerStaff.getUsername());
|
||||
customerStaff.setCardNo(icsCustomerStaff.getCardNo());
|
||||
customerStaff.setAddress(icsCustomerStaff.getAddress());
|
||||
customerStaff.setEmail(icsCustomerStaff.getEmail());
|
||||
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();
|
||||
}
|
||||
|
||||
Long icsCustomerId = customerStaff.getIcsCustomerId();
|
||||
Customer customer = customerService.selectCustomerById(icsCustomerId);
|
||||
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());
|
||||
Customer customer = customerService.selectCustomerById(Long.valueOf(customerId));
|
||||
if (null != customer) {
|
||||
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 persons = DeviceUtils.queryPersons(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(customerStaff));
|
||||
}
|
||||
return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(customerStaff));
|
||||
icsCustomerStaff.setDataType("1");
|
||||
icsCustomerStaff.setIcsCustomerId(Long.valueOf(icsCustomerStaff.getCustomerId()));
|
||||
|
||||
return toAjax(icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -282,176 +367,202 @@ public class CustomerStaffController extends BaseController {
|
||||
ExcelUtil<IcsCustomerStaff> util = new ExcelUtil<IcsCustomerStaff>(IcsCustomerStaff.class);
|
||||
List<IcsCustomerStaff> userList = util.importExcel(file.getInputStream());
|
||||
|
||||
for (IcsCustomerStaff customerStaff : userList) {
|
||||
long currentUserId = getCurrentUserId();
|
||||
User user = userService.selectUserById(currentUserId);
|
||||
if (user != null) {
|
||||
customerStaff.setIcsCustomerId(user.getCustomerId());
|
||||
}
|
||||
}
|
||||
String message = icsCustomerStaffService.importCustomerStaff(userList);
|
||||
return R.data(message);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@PostMapping("/exportTemplate")
|
||||
public void exportTemplate(HttpServletResponse response) throws IOException {
|
||||
// List<IcsCustomerStaff> icsCustomerStaffs = icsCustomerStaffService.selectIcsCustomerStaffList(new IcsCustomerStaff());
|
||||
// ExcelUtil<IcsCustomerStaff> util = new ExcelUtil<IcsCustomerStaff>(IcsCustomerStaff.class);
|
||||
// util.exportExcel(icsCustomerStaffs, "客户员工表");
|
||||
|
||||
SellerVO sellerVO = new SellerVO();
|
||||
sellerVO.setId("1");
|
||||
sellerVO.setName("admin");
|
||||
sellerVO.setPhoneNo("10086");
|
||||
List<SellerVO> sellerVOList = new ArrayList<>();
|
||||
sellerVOList.add(sellerVO);
|
||||
String title = "全部商家";
|
||||
String sheetName = "数据";
|
||||
String fileName = sheetName + "-" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + ".xls";
|
||||
EasyPoiUtils.exportExcel(sellerVOList, title, 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());
|
||||
for (IcsCustomerStaff customerStaff : userList) {
|
||||
User user = userService.selectUserById(getCurrentUserId());
|
||||
if (user != null) {
|
||||
customerStaff.setIcsCustomerId(user.getCustomerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
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>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
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 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 equipment;
|
||||
}
|
||||
|
||||
@RequiresPermissions("meeting:roomContent:list")
|
||||
@PostMapping("/saveUserEquipment")
|
||||
public R saveUserEquipment(@RequestBody UserEquipment equipment) {
|
||||
|
||||
if (equipment.getUserId() != null) {
|
||||
|
||||
int num = userEquipmentService.selectListByUserId(equipment.getUserId());
|
||||
if (num > 0) {
|
||||
int count = userEquipmentService.deleteUserEquipmentByUserId(equipment.getUserId());
|
||||
Assert.isTrue(count > 0, "删除失败");
|
||||
/**
|
||||
* 查询当前用户的所有设备
|
||||
*
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (Long id : equipment.getUserIds()) {
|
||||
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(id);
|
||||
userEquipment.setUserId(equipment.getUserId());
|
||||
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(equipment.getUserId());
|
||||
if (null != customerStaff) {
|
||||
Customer customer = customerService.selectCustomerById(customerStaff.getId());
|
||||
if (customer != null) {
|
||||
userEquipment.setStartTime(customer.getStartDate());
|
||||
userEquipment.setEndDate(customer.getEndDate());
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
userEquipmentService.insertUserEquipment(userEquipment);
|
||||
return equipment;
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@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());
|
||||
//根据企业 查询对应的 房间,和对应的楼层
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.ics.admin.controller;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ics.admin.domain.Park;
|
||||
import com.ics.admin.service.IParkService;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
@ -69,6 +71,8 @@ public class ParkController extends BaseController {
|
||||
if (parkService.exists("name", park.getName())) {
|
||||
return R.error("园区名称重复!");
|
||||
}
|
||||
Assert.isTrue(park.getLng().toString().length() <= 10, "经度格式错误");
|
||||
Assert.isTrue(park.getLat().toString().length() <= 10, "维度格式错误");
|
||||
park.setIsMarketable(false);
|
||||
return toAjax(parkService.insertPark(park));
|
||||
}
|
||||
@ -98,8 +102,10 @@ public class ParkController extends BaseController {
|
||||
if (newPark == null) {
|
||||
return R.error("园区不存在!");
|
||||
}
|
||||
park.setMarketableTime(DateUtils.getNowDate());
|
||||
return toAjax(parkService.updatePark(park));
|
||||
newPark.setMarketableTime(DateUtils.getNowDate());
|
||||
//修改上架时间
|
||||
newPark.setIsMarketable(park.getIsMarketable());
|
||||
return toAjax(parkService.updatePark(newPark));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ics.admin.domain.BuildingDetail;
|
||||
import com.ics.admin.domain.Customer;
|
||||
import com.ics.admin.domain.Room;
|
||||
@ -14,6 +16,7 @@ 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.utils.DeviceUtils;
|
||||
import com.ics.system.domain.User;
|
||||
import com.ics.system.service.ICurrentUserService;
|
||||
import com.ics.system.service.IUserService;
|
||||
@ -32,6 +35,7 @@ import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
import org.wf.jwtp.util.SubjectUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -161,6 +165,16 @@ public class EquipmentController extends BaseController {
|
||||
public R addSave(@RequestBody Equipment equipment) {
|
||||
int i = equipmentService.insertEquipment(equipment);
|
||||
Assert.isTrue(i > 0, "添加失败");
|
||||
|
||||
|
||||
equipment.setEquipmentNum(String.valueOf((new Date()).getTime()));
|
||||
|
||||
String s = DeviceUtils.setDeviceInfo(equipment.getEquipmentNum(), equipment.getEquipmentName(), equipment.getIp());
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s);
|
||||
Integer status = (Integer) jsonObject.get("status");
|
||||
Assert.isTrue(status == 0, "未找到对应设备");
|
||||
|
||||
|
||||
if (equipment.getRoomId() != null) {
|
||||
RoomEquipment roomEquipment = new RoomEquipment();
|
||||
roomEquipment.setEquipmentId(equipment.getId());
|
||||
@ -314,10 +328,12 @@ public class EquipmentController extends BaseController {
|
||||
if (null != customerStaff) {
|
||||
roomRecord.setUserName(customerStaff.getUsername());
|
||||
}
|
||||
if (roomRecord.getType().equals("1")) {
|
||||
roomRecord.setType("扫码开门");
|
||||
} else {
|
||||
if (roomRecord.getType().equals("0")) {
|
||||
roomRecord.setType("远程开门");
|
||||
} else if (roomRecord.getType().equals("1")){
|
||||
roomRecord.setType("人脸开门");
|
||||
} else {
|
||||
roomRecord.setType("二维码开门");
|
||||
}
|
||||
}
|
||||
return R.data(roomRecords);
|
||||
|
@ -3,15 +3,16 @@ package com.ics.admin.controller.meeting;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.ics.admin.domain.Customer;
|
||||
import com.ics.admin.domain.*;
|
||||
import com.ics.admin.domain.meeting.RoomContent;
|
||||
import com.ics.admin.service.ICustomerService;
|
||||
import com.ics.admin.service.IIcsCustomerStaffService;
|
||||
import com.ics.admin.service.*;
|
||||
import com.ics.admin.service.meeting.IRoomContentService;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.system.domain.Tenant;
|
||||
import com.ics.system.domain.User;
|
||||
import com.ics.system.mapper.DictDataMapper;
|
||||
import com.ics.system.service.ICurrentUserService;
|
||||
import com.ics.system.service.ITenantService;
|
||||
import com.ics.system.service.IUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -63,6 +64,21 @@ public class ReservationController extends BaseController {
|
||||
@Autowired
|
||||
private ICurrentUserService currentUserService;
|
||||
|
||||
@Autowired
|
||||
private IRoomService roomService;
|
||||
|
||||
@Autowired
|
||||
private IParkService parkService;
|
||||
|
||||
@Autowired
|
||||
private ITenantService tenantService;
|
||||
|
||||
@Autowired
|
||||
private IBuildingService buildingService;
|
||||
|
||||
@Autowired
|
||||
private IBuildingDetailService buildingDetailService;
|
||||
|
||||
/**
|
||||
* 查询预约记录
|
||||
*/
|
||||
@ -90,6 +106,31 @@ public class ReservationController extends BaseController {
|
||||
if (null != customer){
|
||||
reservation.setCustomerName(customer.getName());
|
||||
}
|
||||
|
||||
Park park = parkService.selectParkById(reservation.getParkId());
|
||||
if (park !=null ){
|
||||
reservation.setParkName(park.getName());
|
||||
}
|
||||
|
||||
|
||||
Tenant tenant = tenantService.selectTenantById(reservation.getTenantId());
|
||||
if (tenant !=null ){
|
||||
reservation.setTenantName(tenant.getName());
|
||||
}
|
||||
Room room = roomService.selectRoomById(roomContent.getRoomId());
|
||||
if (null != room){
|
||||
reservation.setRoomName(room.getName());
|
||||
|
||||
Building building = buildingService.selectBuildingById(room.getBuildingId());
|
||||
if (null != building){
|
||||
reservation.setBuildingName(building.getBuildingName());
|
||||
}
|
||||
BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(room.getBuildingDetailId());
|
||||
if (null != buildingDetail){
|
||||
reservation.setBuildName(buildingDetail.getFloorName());
|
||||
}
|
||||
}
|
||||
|
||||
return reservation;
|
||||
}
|
||||
|
||||
@ -113,7 +154,6 @@ public class ReservationController extends BaseController {
|
||||
if (null != user.getCustomerId()){
|
||||
reservation.setCustomerId(user.getCustomerId());
|
||||
}
|
||||
|
||||
}
|
||||
List<Reservation> reservations = reservationService.selectReservationList(reservation);
|
||||
for (Reservation reservation1 : reservations) {
|
||||
@ -140,6 +180,11 @@ public class ReservationController extends BaseController {
|
||||
if (null != customerStaff){
|
||||
reservation1.setUserName(customerStaff.getUsername());
|
||||
}
|
||||
Room room = roomService.selectRoomById(roomContent.getRoomId());
|
||||
if (null != room){
|
||||
reservation1.setBuildingId(room.getBuildingId());
|
||||
}
|
||||
|
||||
}
|
||||
return result(reservations);
|
||||
}
|
||||
@ -166,6 +211,11 @@ public class ReservationController extends BaseController {
|
||||
@RequiresPermissions("meeting:reservation:edit")
|
||||
@PostMapping("update")
|
||||
public R editSave(@RequestBody Reservation reservation) {
|
||||
|
||||
if (reservation.getCancelResaon() !=null){
|
||||
reservation.setCancelResaon("管理员取消原因为:"+reservation.getCancelResaon());
|
||||
}
|
||||
|
||||
return toAjax(reservationService.updateReservation(reservation));
|
||||
}
|
||||
|
||||
|
@ -272,9 +272,6 @@ public class RoomContentController extends BaseController {
|
||||
return R.ok().put("data",rooms);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Ignore
|
||||
@GetMapping("/selectRoomById")
|
||||
public R selectRoomById(Room room) {
|
||||
@ -293,6 +290,15 @@ public class RoomContentController extends BaseController {
|
||||
@RequiresPermissions("meeting:roomContent:list")
|
||||
@GetMapping("/roomContentList")
|
||||
public R roomContentList(RoomContent roomContent) {
|
||||
|
||||
if (null != roomContent.getBuildingId()){
|
||||
List<Room> rooms = roomService.selectRoomByBuildingId(roomContent.getBuildingId());
|
||||
if (CollUtil.isNotEmpty(rooms)){
|
||||
roomContent.setRoomIds(rooms.stream().map(Room::getId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean isAdmin = SubjectUtil.hasRole(getRequest(),"manager");
|
||||
if (isAdmin){
|
||||
Long parkId = currentUserService.getParkId();
|
||||
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.ics.admin.domain.BuildingDetail;
|
||||
import com.ics.admin.domain.Customer;
|
||||
import com.ics.admin.domain.Room;
|
||||
import com.ics.admin.domain.meeting.RoomContent;
|
||||
import com.ics.admin.service.IBuildingDetailService;
|
||||
import com.ics.admin.service.ICustomerService;
|
||||
import com.ics.admin.service.IRoomService;
|
||||
@ -128,8 +129,6 @@ public class ShowroomController extends BaseController {
|
||||
public R addSave(@RequestBody Showroom showroom) {
|
||||
|
||||
List<Showroom> showrooms = showroomService.selectShowroomList(showroom);
|
||||
Assert.isTrue(showrooms.size() == 0, "该展厅已存在");
|
||||
showroom.setId(1L);
|
||||
Room room = roomService.selectRoomById(showroom.getRoomId());
|
||||
room.setStatus(Room.Status.YES);
|
||||
int i1 = roomService.updateRoom(room);
|
||||
@ -156,4 +155,37 @@ public class ShowroomController extends BaseController {
|
||||
return toAjax(showroomService.deleteShowroomByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequiresPermissions("meeting:showroom:list")
|
||||
@GetMapping("/showroomList")
|
||||
public R roomContentList(Showroom showroom) {
|
||||
|
||||
if (null != showroom.getBuildingId()){
|
||||
List<Room> rooms = roomService.selectRoomByBuildingId(showroom.getBuildingId());
|
||||
if (CollUtil.isNotEmpty(rooms)){
|
||||
showroom.setRoomIds(rooms.stream().map(Room::getId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
boolean isAdmin = SubjectUtil.hasRole(getRequest(),"manager");
|
||||
if (isAdmin){
|
||||
Long parkId = currentUserService.getParkId();
|
||||
Long tenantId = currentUserService.getTenantId();
|
||||
showroom.setParkId(parkId);
|
||||
showroom.setTenantId(tenantId);
|
||||
}
|
||||
boolean b = SubjectUtil.hasRole(getRequest(),"admin");
|
||||
if (b){
|
||||
User user = userService.selectUserById(getCurrentUserId());
|
||||
if (null != user.getCustomerId()){
|
||||
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());
|
||||
showroom.setRoomIds(collect);
|
||||
}
|
||||
}
|
||||
return R.data(showroomService.selectShowroomList(showroom));
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
package com.ics.admin.controller.meeting;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.ics.admin.domain.Customer;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ics.admin.domain.*;
|
||||
import com.ics.admin.domain.meeting.RoomContent;
|
||||
import com.ics.admin.domain.meeting.Showroom;
|
||||
import com.ics.admin.service.ICustomerService;
|
||||
import com.ics.admin.service.IIcsCustomerStaffService;
|
||||
import com.ics.admin.service.*;
|
||||
import com.ics.admin.service.meeting.IShowroomService;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.system.domain.Tenant;
|
||||
import com.ics.system.domain.User;
|
||||
import com.ics.system.service.ICurrentUserService;
|
||||
import com.ics.system.service.ITenantService;
|
||||
import com.ics.system.service.IUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -64,6 +68,21 @@ public class ShowroomRecordController extends BaseController {
|
||||
@Autowired
|
||||
private IIcsCustomerStaffService staffService;
|
||||
|
||||
@Autowired
|
||||
private IRoomService roomService;
|
||||
|
||||
@Autowired
|
||||
private IParkService parkService;
|
||||
|
||||
@Autowired
|
||||
private ITenantService tenantService;
|
||||
|
||||
@Autowired
|
||||
private IBuildingService buildingService;
|
||||
|
||||
@Autowired
|
||||
private IBuildingDetailService buildingDetailService;
|
||||
|
||||
/**
|
||||
* 查询展厅预约记录
|
||||
*/
|
||||
@ -72,14 +91,42 @@ public class ShowroomRecordController extends BaseController {
|
||||
public ShowroomRecord get(@PathVariable("id") Long id) {
|
||||
ShowroomRecord showroomRecord = showroomRecordService.selectShowroomRecordById(id);
|
||||
|
||||
Showroom showroom = showroomService.selectShowroomById(showroomRecord.getShowroomId());
|
||||
if (null != showroom) {
|
||||
showroomRecord.setShowRoomName(showroom.getMeetingName());
|
||||
Park park = parkService.selectParkById(showroomRecord.getParkId());
|
||||
if (park != null) {
|
||||
showroomRecord.setParkName(park.getName());
|
||||
}
|
||||
|
||||
|
||||
Tenant tenant = tenantService.selectTenantById(showroomRecord.getTenantId());
|
||||
if (tenant != null) {
|
||||
showroomRecord.setTenantName(tenant.getName());
|
||||
}
|
||||
Room room = roomService.selectRoomById(showroom.getRoomId());
|
||||
if (null != room) {
|
||||
showroomRecord.setRoomName(room.getName());
|
||||
|
||||
Building building = buildingService.selectBuildingById(room.getBuildingId());
|
||||
if (null != building) {
|
||||
showroomRecord.setBuildingName(building.getBuildingName());
|
||||
}
|
||||
BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(room.getBuildingDetailId());
|
||||
if (null != buildingDetail) {
|
||||
showroomRecord.setBuildName(buildingDetail.getFloorName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IcsCustomerStaff customerStaff = customerStaffService.selectIcsCustomerStaffById(showroomRecord.getUserId());
|
||||
if (null != customerStaff){
|
||||
if (null != customerStaff) {
|
||||
showroomRecord.setUserName(customerStaff.getUsername());
|
||||
showroomRecord.setUserPhone(customerStaff.getMobile());
|
||||
|
||||
Customer customer = customerService.selectCustomerById(customerStaff.getIcsCustomerId());
|
||||
if (null != customer){
|
||||
showroomRecord.setCustomerName(customer.getName());
|
||||
if (null != customer) {
|
||||
showroomRecord.setCustomerName(customer.getName());
|
||||
}
|
||||
|
||||
}
|
||||
@ -121,6 +168,12 @@ public class ShowroomRecordController extends BaseController {
|
||||
Showroom showroom = showroomService.selectShowroomById(record.getShowroomId());
|
||||
if (null != showroom){
|
||||
record.setShowRoomName(showroom.getMeetingName());
|
||||
|
||||
Room room = roomService.selectRoomById(showroom.getRoomId());
|
||||
if (null != room){
|
||||
record.setBuildingId(room.getBuildingId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return result(showroomRecords);
|
||||
@ -138,7 +191,6 @@ public class ShowroomRecordController extends BaseController {
|
||||
if (null != user.getCustomerId()){
|
||||
showroomRecord.setUserId(user.getCustomerId());
|
||||
}
|
||||
showroomRecord.setShowroomId(1L);
|
||||
showroomRecord.setCreateTime(new Date());
|
||||
showroomRecord.setStatus(1);
|
||||
showroomRecord.setReservationNumber(RandomUtil.randomNumbers(18));
|
||||
@ -163,4 +215,16 @@ public class ShowroomRecordController extends BaseController {
|
||||
return toAjax(showroomRecordService.deleteShowroomRecordByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Ignore
|
||||
@GetMapping("/customerList")
|
||||
public R list(Customer customer) {
|
||||
List<Customer> customers = customerService.selectCustomerList(customer);
|
||||
return R.data(customers);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
package com.ics.admin.controller.meeting;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ics.common.core.domain.R;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.admin.domain.meeting.StaffCustomer;
|
||||
import com.ics.admin.service.meeting.IStaffCustomerService;
|
||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* 用户企业 提供者
|
||||
*
|
||||
* @author ics
|
||||
* @date 2024-04-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("customer")
|
||||
public class StaffCustomerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IStaffCustomerService staffCustomerService;
|
||||
|
||||
/**
|
||||
* 查询用户企业
|
||||
*/
|
||||
@GetMapping("get/{id}")
|
||||
public StaffCustomer get(@PathVariable("id") Long id) {
|
||||
return staffCustomerService.selectStaffCustomerById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户企业列表
|
||||
*/
|
||||
@RequiresPermissions("meeting:customer:list")
|
||||
@GetMapping("list")
|
||||
public R list(StaffCustomer staffCustomer) {
|
||||
startPage();
|
||||
return result(staffCustomerService.selectStaffCustomerList(staffCustomer));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增保存用户企业
|
||||
*/
|
||||
@RequiresPermissions("meeting:customer:add")
|
||||
@PostMapping("save")
|
||||
public R addSave(@RequestBody StaffCustomer staffCustomer) {
|
||||
return toAjax(staffCustomerService.insertStaffCustomer(staffCustomer));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存用户企业
|
||||
*/
|
||||
@RequiresPermissions("meeting:customer:edit")
|
||||
@PostMapping("update")
|
||||
public R editSave(@RequestBody StaffCustomer staffCustomer) {
|
||||
return toAjax(staffCustomerService.updateStaffCustomer(staffCustomer));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户企业
|
||||
*/
|
||||
@RequiresPermissions("meeting:customer:remove")
|
||||
@PostMapping("remove")
|
||||
public R remove(String ids) {
|
||||
return toAjax(staffCustomerService.deleteStaffCustomerByIds(ids));
|
||||
}
|
||||
|
||||
}
|
@ -133,7 +133,6 @@ public class TicketController extends BaseController {
|
||||
if (customerTicket ==null){
|
||||
if (ticket.getType() == 1) {
|
||||
for (TicketCustomerVo ticketCustomerVo : ticket.getTicketCustomerVo()) {
|
||||
|
||||
for (int j = 0; j < ticketCustomerVo.getSumNum(); j++) {
|
||||
CustomerTicket customerTicket1 = new CustomerTicket();
|
||||
customerTicket1.setTicketId(ticket.getId());
|
||||
@ -175,6 +174,21 @@ public class TicketController extends BaseController {
|
||||
if (ticket.getType() == 1) {
|
||||
for (TicketCustomerVo ticketCustomerVo : ticket.getTicketCustomerVo()) {
|
||||
|
||||
//查询出所有的 id
|
||||
CustomerTicket customerTicket2 = new CustomerTicket();
|
||||
customerTicket2.setTicketId(ticket.getId());
|
||||
customerTicket2.setCustomerId(ticketCustomerVo.getId());
|
||||
customerTicket2.setIsVerification(0);
|
||||
List<CustomerTicket> customerTickets = customerTicketService.selectCustomerTicketList(customerTicket2);
|
||||
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());
|
||||
@ -187,12 +201,17 @@ public class TicketController extends BaseController {
|
||||
}else {
|
||||
for (TicketCustomerVo ticketCustomerVo : ticket.getTicketCustomerVo()) {
|
||||
|
||||
|
||||
|
||||
for (int j = 0; j < ticketCustomerVo.getSumNum(); j++) {
|
||||
CustomerTicket customerTicket1 = new CustomerTicket();
|
||||
customerTicket1.setTicketId(ticket.getId());
|
||||
customerTicket1.setCustomerId(ticketCustomerVo.getId());
|
||||
customerTicket1.setIsVerification(0);
|
||||
customerTicket1.setType(ticket.getType());
|
||||
customerTicket1.setType(ticket.getType());
|
||||
customerTicketService.insertCustomerTicket(customerTicket1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,37 @@
|
||||
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.IdcardUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ics.admin.domain.Customer;
|
||||
import com.ics.admin.domain.meeting.RoomRecord;
|
||||
import com.ics.admin.domain.Park;
|
||||
import com.ics.admin.domain.Room;
|
||||
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.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.DateUtils;
|
||||
import com.ics.common.utils.DeviceUtils;
|
||||
import com.ics.common.utils.UrlToBase64Util;
|
||||
import com.ics.system.domain.Tenant;
|
||||
import com.ics.system.domain.User;
|
||||
import com.ics.system.service.ICurrentUserService;
|
||||
import com.ics.system.service.ITenantService;
|
||||
import com.ics.system.service.IUserService;
|
||||
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;
|
||||
@ -20,11 +41,11 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ics.common.core.domain.R;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.admin.domain.meeting.VisitorPerson;
|
||||
import org.wf.jwtp.annotation.Ignore;
|
||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
import org.wf.jwtp.util.SubjectUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -56,6 +77,28 @@ public class VisitorPersonController extends BaseController {
|
||||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
@Autowired
|
||||
private IRoomEquipmentService roomEquipmentService;
|
||||
|
||||
@Autowired
|
||||
private IEquipmentService equipmentService;
|
||||
|
||||
@Autowired
|
||||
private IParkService parkService;
|
||||
|
||||
@Autowired
|
||||
private ITenantService tenantService;
|
||||
|
||||
@Autowired
|
||||
private IUserEquipmentService userEquipmentService;
|
||||
|
||||
@Value("${dfs.domain}")
|
||||
private String url;
|
||||
|
||||
private static final String BASE64_PREFIX = "data:image/png;base64,";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询预约参观人员
|
||||
*/
|
||||
@ -77,6 +120,16 @@ public class VisitorPersonController extends BaseController {
|
||||
if (null != customer) {
|
||||
visitorPerson.setCustomerName(customer.getName());
|
||||
}
|
||||
|
||||
Park park = parkService.selectParkById(visitorPerson.getParkId());
|
||||
if (park !=null ){
|
||||
visitorPerson.setParkName(park.getName());
|
||||
}
|
||||
|
||||
Tenant tenant = tenantService.selectTenantById(visitorPerson.getTenantId());
|
||||
if (tenant !=null ){
|
||||
visitorPerson.setTenantName(tenant.getName());
|
||||
}
|
||||
return visitorPerson;
|
||||
}
|
||||
|
||||
@ -120,6 +173,13 @@ public class VisitorPersonController extends BaseController {
|
||||
public R addSave(@RequestBody VisitorPerson visitorPerson) {
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
visitorPerson.setUserId(visitorPerson.getUserId());
|
||||
long currentUserId = this.getCurrentUserId();
|
||||
User user = userService.selectUserById(currentUserId);
|
||||
@ -128,8 +188,64 @@ public class VisitorPersonController extends BaseController {
|
||||
}
|
||||
visitorPerson.setStatus(1);
|
||||
visitorPerson.setCreateTime(DateUtils.getNowDate());
|
||||
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();
|
||||
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) {
|
||||
|
||||
return toAjax(visitorPersonService.insertReservationPerson(visitorPerson));
|
||||
//添加 用户和对应的设备
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(equipment.getId());
|
||||
userEquipment.setUserId(user.getStaffId());
|
||||
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.getIntervieweeId()));
|
||||
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(i);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,5 +312,28 @@ public class VisitorPersonController extends BaseController {
|
||||
List<Customer> customers = customerService.selectCustomerList(new Customer());
|
||||
return R.data(customers);
|
||||
}
|
||||
|
||||
|
||||
public void addPersonDeviceByCustomer(Room room, Long deviceId) {
|
||||
if (room != null) {
|
||||
Customer customer = customerService.selectByRoomId(room.getId());
|
||||
if (customer != null) {
|
||||
List<IcsCustomerStaff> icsCustomerStaffs = staffService.selectUserByCustomer(customer.getId());
|
||||
if (CollUtil.isNotEmpty(icsCustomerStaffs)) {
|
||||
List<Long> ids = icsCustomerStaffs.stream().map(item -> {
|
||||
return item.getId();
|
||||
}).collect(Collectors.toList());
|
||||
for (Long id : ids) {
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(deviceId);
|
||||
userEquipment.setUserId(id);
|
||||
userEquipment.setStartTime(customer.getStartDate());
|
||||
userEquipment.setEndDate(customer.getEndDate());
|
||||
userEquipmentService.insertUserEquipment(userEquipment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.ics.admin.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ics.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
@ -33,6 +34,7 @@ public class Building extends BaseEntity<Building> {
|
||||
/**
|
||||
* 关联园区
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Park park;
|
||||
|
||||
}
|
@ -429,4 +429,11 @@ public class Customer extends BaseEntity<Customer> {
|
||||
@TableField(exist = false)
|
||||
private List<Long> roomIds;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String tenantName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String buildingName;
|
||||
|
||||
|
||||
}
|
@ -39,6 +39,8 @@ public class Equipment extends BaseEntity<Equipment> {
|
||||
|
||||
private String ip;
|
||||
|
||||
private Long buildingId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long roomId;
|
||||
|
||||
|
@ -171,4 +171,22 @@ public class Reservation extends BaseEntity<Reservation> {
|
||||
@TableField(exist = false)
|
||||
private String isPay;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long buildingId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String parkName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String TenantName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String roomName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String buildingName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String buildName;
|
||||
|
||||
}
|
||||
|
@ -104,52 +104,6 @@ public class RoomContent extends BaseEntity<RoomContent> {
|
||||
@TableField(exist = false)
|
||||
private Integer typeValue;
|
||||
|
||||
// public enum Type implements IEnum<Integer> {
|
||||
//
|
||||
// /**
|
||||
// * 报名未开始
|
||||
// */
|
||||
// MEETING_ROOM("会议室", 1),
|
||||
//
|
||||
//
|
||||
// ROADSHOW_HALL("路演厅", 2),
|
||||
// /**
|
||||
// * 报名中
|
||||
// */
|
||||
// DATA_WAREHOUSE("数仓", 3),
|
||||
// COUNT_BUTTON("数纽", 4),
|
||||
// NEGOTIATION_ROOM("洽谈室", 5),
|
||||
//
|
||||
// LIVE_ROOM("直播间", 6),
|
||||
//
|
||||
// TEE_ROOM("茶室", 7);
|
||||
//
|
||||
// private String name;
|
||||
// private int value;
|
||||
//
|
||||
// Type(String name, int value) {
|
||||
// this.name = name;
|
||||
// this.value = value;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Integer getValue() {
|
||||
// return this.value;
|
||||
// }
|
||||
//
|
||||
// public String getName() {
|
||||
// return this.name;
|
||||
// }
|
||||
//
|
||||
// public static Type parse(Integer value) {
|
||||
// for (Type type1 : values()) {
|
||||
// if (type1.getValue().equals(value)) {
|
||||
// return type1;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<RoomItem> roomItemList;
|
||||
|
@ -61,6 +61,11 @@ public class Showroom extends BaseEntity<Showroom> {
|
||||
/** 房间id */
|
||||
private Long roomId;
|
||||
|
||||
|
||||
private Long buildId;
|
||||
|
||||
private Long buildingId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String roomName;
|
||||
|
||||
@ -73,8 +78,6 @@ public class Showroom extends BaseEntity<Showroom> {
|
||||
@TableField(exist = false)
|
||||
private String buildingName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long buildId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Long> roomIds;
|
||||
|
@ -96,4 +96,18 @@ public class ShowroomRecord extends BaseEntity<ShowroomRecord> {
|
||||
@TableField(exist = false)
|
||||
private List<Long> staffIds;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long buildingId;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String TenantName;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String buildName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String parkName;
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package com.ics.admin.domain.meeting;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ics.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户企业对象 tb_staff_customer
|
||||
*
|
||||
* @author ics
|
||||
* @date 2024-04-08
|
||||
*/
|
||||
@Data
|
||||
@TableName("tb_staff_customer")
|
||||
public class StaffCustomer extends BaseEntity<StaffCustomer> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 企业id */
|
||||
private Long icsCustomerId;
|
||||
|
||||
/** 用户id */
|
||||
private Long staffId;
|
||||
|
||||
/** 园区ID */
|
||||
private Long parkId;
|
||||
|
||||
}
|
@ -92,4 +92,10 @@ public class VisitorPerson extends BaseEntity<VisitorPerson> {
|
||||
@TableField(exist = false)
|
||||
private List<Long> staffIds;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String parkName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String tenantName;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,64 @@
|
||||
package com.ics.admin.mapper.meeting;
|
||||
|
||||
import com.ics.admin.domain.meeting.StaffCustomer;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户企业Mapper接口
|
||||
*
|
||||
* @author ics
|
||||
* @date 2024-04-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface StaffCustomerMapper extends BaseMapper<StaffCustomer> {
|
||||
/**
|
||||
* 查询用户企业
|
||||
*
|
||||
* @param id 用户企业ID
|
||||
* @return 用户企业
|
||||
*/
|
||||
StaffCustomer selectStaffCustomerById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户企业列表
|
||||
*
|
||||
* @param staffCustomer 用户企业
|
||||
* @return 用户企业集合
|
||||
*/
|
||||
List<StaffCustomer> selectStaffCustomerList(StaffCustomer staffCustomer);
|
||||
|
||||
/**
|
||||
* 新增用户企业
|
||||
*
|
||||
* @param staffCustomer 用户企业
|
||||
* @return 结果
|
||||
*/
|
||||
int insertStaffCustomer(StaffCustomer staffCustomer);
|
||||
|
||||
/**
|
||||
* 修改用户企业
|
||||
*
|
||||
* @param staffCustomer 用户企业
|
||||
* @return 结果
|
||||
*/
|
||||
int updateStaffCustomer(StaffCustomer staffCustomer);
|
||||
|
||||
/**
|
||||
* 删除用户企业
|
||||
*
|
||||
* @param id 用户企业ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteStaffCustomerById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用户企业
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteStaffCustomerByIds(String[] ids);
|
||||
}
|
@ -77,4 +77,7 @@ public interface IRoomService extends IService<Room> {
|
||||
List<Room> selectNotRentRooms(Long deptId);
|
||||
|
||||
List<Room> selectRoomByBuildId(Long buildId);
|
||||
|
||||
|
||||
List<Room> selectRoomByBuildingId(Long buildId);
|
||||
}
|
@ -187,6 +187,7 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMap
|
||||
{
|
||||
user.setCardNo("0");
|
||||
user.setDataType("1");
|
||||
user.setGender(user.getGender().equals("男") ? "0" : "1");
|
||||
icsCustomerStaffMapper.insert(user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、账号 " + user.getName() + " 导入成功");
|
||||
|
@ -125,7 +125,14 @@ public class RoomServiceImpl extends ServiceImpl<RoomMapper, Room> implements IR
|
||||
queryWrapper.eq("status", Room.Status.YES.getValue());
|
||||
queryWrapper.eq("building_detail_Id", buildId);
|
||||
return roomMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Room> selectRoomByBuildingId(Long buildId) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("status", Room.Status.YES.getValue());
|
||||
queryWrapper.eq("building_id", buildId);
|
||||
return roomMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
|
@ -227,7 +227,7 @@ public class UserEquipmentServiceImpl extends ServiceImpl<UserEquipmentMapper, U
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteUserEquipmentByUserId(Long userId) {
|
||||
public int deleteUserEquipmentByUserId(Long userId,Long deviceId) {
|
||||
UpdateWrapper<UserEquipment> wrapper = new UpdateWrapper<>();
|
||||
wrapper.eq("user_id", userId);
|
||||
return userEquipmentMapper.delete(wrapper);
|
||||
|
@ -58,6 +58,9 @@ public class CustomerTicketServiceImpl extends ServiceImpl<CustomerTicketMapper,
|
||||
@Override
|
||||
public List<CustomerTicket> selectCustomerTicketList(CustomerTicket customerTicket) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("customer_id", customerTicket.getCustomerId());
|
||||
queryWrapper.eq("ticket_id", customerTicket.getTicketId());
|
||||
queryWrapper.eq(customerTicket.getIsVerification() !=null,"is_verification", customerTicket.getIsVerification());
|
||||
return customerTicketMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -100,4 +100,12 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
||||
queryWrapper.in("id", ids);
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Equipment selectByDeviceCode(String deviceCode) {
|
||||
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("equipment_num", deviceCode);
|
||||
return baseMapper.selectOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ public class IVisitorPersonServiceImpl extends ServiceImpl<VisitorPersonMapper,
|
||||
queryWrapper.eq(visitorPerson.getParkId() !=null,"park_id", visitorPerson.getParkId());
|
||||
queryWrapper.eq(visitorPerson.getTenantId() !=null,"tenant_id", visitorPerson.getTenantId());
|
||||
queryWrapper.eq(CollUtil.isNotEmpty(visitorPerson.getStaffIds()),"interviewee_id", visitorPerson.getStaffIds());
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
return visitorPersonMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ import com.ics.admin.service.IBuildingDetailService;
|
||||
import com.ics.admin.service.IIcsCustomerStaffService;
|
||||
import com.ics.admin.service.IRoomService;
|
||||
import com.ics.admin.service.meeting.*;
|
||||
import com.ics.common.core.domain.BaseEntity;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.common.utils.DateUtils;
|
||||
import com.ics.system.domain.DictData;
|
||||
@ -174,8 +175,23 @@ public class RoomContentServiceImpl extends ServiceImpl<RoomContentMapper, RoomC
|
||||
roomContents1.add(roomContent1);
|
||||
}
|
||||
}
|
||||
List<RoomContent> collect1 = roomContents.stream().filter(roomContents1::contains).collect(Collectors.toList());
|
||||
return selectRoomContentList(collect1);
|
||||
List<Long> collect1 = roomContents1.stream().map(RoomContent::getId).collect(Collectors.toList());
|
||||
|
||||
|
||||
List<RoomContent> studentList = roomContents.stream().map(item -> {
|
||||
return collect1.stream().filter(id -> { //条件判断
|
||||
return item.getId() == id;
|
||||
}).map(name -> {
|
||||
return item; //返回的结果
|
||||
}).collect(Collectors.toList());
|
||||
}).flatMap(List::stream).collect(Collectors.toList());//设置返回结果类型
|
||||
|
||||
System.out.println(studentList);
|
||||
|
||||
|
||||
|
||||
|
||||
return selectRoomContentList(studentList);
|
||||
}else {
|
||||
if (roomContent.getType() != null) {
|
||||
// RoomContent.Type type = roomContent.getType();
|
||||
|
@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
|
||||
import com.ics.admin.mapper.meeting.RoomRecordMapper;
|
||||
import com.ics.admin.domain.meeting.RoomRecord;
|
||||
import com.ics.admin.service.meeting.IRoomRecordService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 用户开门记录Service业务层处理
|
||||
@ -57,6 +58,7 @@ public class RoomRecordServiceImpl extends ServiceImpl<RoomRecordMapper, RoomRec
|
||||
* @param roomRecord 用户开门记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int insertRoomRecord(RoomRecord roomRecord) {
|
||||
return roomRecordMapper.insert(roomRecord);
|
||||
|
@ -45,7 +45,7 @@ public class ShowroomServiceImpl extends ServiceImpl<ShowroomMapper, Showroom> i
|
||||
queryWrapper.eq(showroom.getParkId() !=null,"park_id", showroom.getParkId());
|
||||
queryWrapper.eq(showroom.getTenantId() !=null,"tenant_id", showroom.getTenantId());
|
||||
queryWrapper.eq(showroom.getRoomId() !=null,"room_id", showroom.getRoomId());
|
||||
queryWrapper.eq(showroom.getRoomIds() !=null,"room_id", showroom.getRoomIds());
|
||||
queryWrapper.in(showroom.getRoomIds() !=null,"room_id", showroom.getRoomIds());
|
||||
return showroomMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,92 @@
|
||||
package com.ics.admin.service.impl.meeting;
|
||||
|
||||
import java.util.List;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ics.admin.mapper.meeting.StaffCustomerMapper;
|
||||
import com.ics.admin.domain.meeting.StaffCustomer;
|
||||
import com.ics.admin.service.meeting.IStaffCustomerService;
|
||||
|
||||
/**
|
||||
* 用户企业Service业务层处理
|
||||
*
|
||||
* @author ics
|
||||
* @date 2024-04-08
|
||||
*/
|
||||
@Service
|
||||
public class StaffCustomerServiceImpl extends ServiceImpl<StaffCustomerMapper, StaffCustomer> implements IStaffCustomerService {
|
||||
@Autowired
|
||||
private StaffCustomerMapper staffCustomerMapper;
|
||||
|
||||
/**
|
||||
* 查询用户企业
|
||||
*
|
||||
* @param id 用户企业ID
|
||||
* @return 用户企业
|
||||
*/
|
||||
@Override
|
||||
public StaffCustomer selectStaffCustomerById(Long id) {
|
||||
return staffCustomerMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户企业列表
|
||||
*
|
||||
* @param staffCustomer 用户企业
|
||||
* @return 用户企业
|
||||
*/
|
||||
@Override
|
||||
public List<StaffCustomer> selectStaffCustomerList(StaffCustomer staffCustomer) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
return staffCustomerMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户企业
|
||||
*
|
||||
* @param staffCustomer 用户企业
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertStaffCustomer(StaffCustomer staffCustomer) {
|
||||
return staffCustomerMapper.insert(staffCustomer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户企业
|
||||
*
|
||||
* @param staffCustomer 用户企业
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateStaffCustomer(StaffCustomer staffCustomer) {
|
||||
return staffCustomerMapper.updateById(staffCustomer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户企业对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteStaffCustomerByIds(String ids) {
|
||||
String[] idsArray = StrUtil.split(ids,",");
|
||||
return staffCustomerMapper.deleteBatchIds(CollUtil.toList(idsArray));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户企业信息
|
||||
*
|
||||
* @param id 用户企业ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteStaffCustomerById(Long id) {
|
||||
return staffCustomerMapper.deleteStaffCustomerById(id);
|
||||
}
|
||||
}
|
@ -62,4 +62,6 @@ public interface IEquipmentService extends IService<Equipment> {
|
||||
int deleteEquipmentById(Long id);
|
||||
|
||||
List<Equipment> selectListByIds(List<Long> ids);
|
||||
|
||||
Equipment selectByDeviceCode(String deviceCode);
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
package com.ics.admin.service.meeting;
|
||||
|
||||
import com.ics.admin.domain.meeting.StaffCustomer;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户企业Service接口
|
||||
*
|
||||
* @author ics
|
||||
* @date 2024-04-08
|
||||
*/
|
||||
public interface IStaffCustomerService extends IService<StaffCustomer> {
|
||||
/**
|
||||
* 查询用户企业
|
||||
*
|
||||
* @param id 用户企业ID
|
||||
* @return 用户企业
|
||||
*/
|
||||
StaffCustomer selectStaffCustomerById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户企业列表
|
||||
*
|
||||
* @param staffCustomer 用户企业
|
||||
* @return 用户企业集合
|
||||
*/
|
||||
List<StaffCustomer> selectStaffCustomerList(StaffCustomer staffCustomer);
|
||||
|
||||
/**
|
||||
* 新增用户企业
|
||||
*
|
||||
* @param staffCustomer 用户企业
|
||||
* @return 结果
|
||||
*/
|
||||
int insertStaffCustomer(StaffCustomer staffCustomer);
|
||||
|
||||
/**
|
||||
* 修改用户企业
|
||||
*
|
||||
* @param staffCustomer 用户企业
|
||||
* @return 结果
|
||||
*/
|
||||
int updateStaffCustomer(StaffCustomer staffCustomer);
|
||||
|
||||
/**
|
||||
* 批量删除用户企业
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteStaffCustomerByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除用户企业信息
|
||||
*
|
||||
* @param id 用户企业ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteStaffCustomerById(Long id);
|
||||
}
|
@ -69,7 +69,7 @@ public interface IUserEquipmentService extends IService<UserEquipment> {
|
||||
|
||||
int selectListByEquipmentId(Long id);
|
||||
|
||||
int deleteUserEquipmentByUserId(Long userId);
|
||||
int deleteUserEquipmentByUserId(Long userId,Long deviceId);
|
||||
|
||||
int selectListByUserId(Long userId);
|
||||
}
|
||||
|
@ -10,17 +10,31 @@ public class SellerVO {
|
||||
/**
|
||||
* 商户ID
|
||||
*/
|
||||
@Excel(name = "ID", height = 11, width = 15)
|
||||
private String id;
|
||||
/**
|
||||
* 商户电话
|
||||
*/
|
||||
@Excel(name = "账号", height = 11, width = 15)
|
||||
private String phoneNo;
|
||||
/**
|
||||
* 商户名称
|
||||
*/
|
||||
@Excel(name = "商户名称", height = 11, width = 15)
|
||||
@Excel(name = "微信昵称")
|
||||
private String username;
|
||||
@Excel(name = "姓名")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "性别")
|
||||
private String gender;
|
||||
|
||||
@Excel(name = "地址")
|
||||
private String address;
|
||||
|
||||
@Excel(name = "身份证号")
|
||||
private String cardNo;
|
||||
|
||||
@Excel(name = "邮箱")
|
||||
private String email;
|
||||
|
||||
@Excel(name = "学历")
|
||||
private String degree;
|
||||
|
||||
@Excel(name = "紧急联系人")
|
||||
private String urgent;
|
||||
|
||||
/** 电话 */
|
||||
@Excel(name = "手机号")
|
||||
private String mobile;
|
||||
|
||||
}
|
||||
|
@ -111,7 +111,8 @@
|
||||
<if test="contacts != null and contacts != ''"> AND ic.contacts LIKE CONCAT('%', #{contacts}, '%')</if>
|
||||
<if test="phone != null and phone != ''"> AND phone LIKE CONCAT('%', #{phone}, '%')</if>
|
||||
<if test="deleteFlag != null"> and ic.delete_flag = #{deleteFlag} </if>
|
||||
<if test="parkId != null"> and ic.park_id = #{parkId} </if>
|
||||
<if test="parkId != null and parkId != '' "> and ic.park_id = #{parkId} </if>
|
||||
<if test="tenantId != null and tenantId != '' "> and ic.tenant_id = #{tenantId} </if>
|
||||
</where>
|
||||
order by ic.create_time desc
|
||||
</select>
|
||||
|
@ -17,14 +17,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="parkId" column="park_id" />
|
||||
<result property="buildingId" column="building_id" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEquipmentVo">
|
||||
SELECT id, type, equipment_name, status, equipment_num,ip, pic, delete_flag, create_by, create_time, update_by, update_time FROM tb_equipment
|
||||
SELECT id, type, equipment_name, status, equipment_num,ip, pic, delete_flag, create_by,park_id,building_id,tenant_id, create_time, update_by, update_time FROM tb_equipment
|
||||
</sql>
|
||||
|
||||
<select id="selectEquipmentList" parameterType="Equipment" resultMap="EquipmentResult">
|
||||
SELECT e.id, e.type, e.equipment_name, e.status, e.equipment_num,e.ip, e.pic, e.delete_flag, e.create_by, e.create_time, e.update_by,
|
||||
SELECT e.id, e.type, e.equipment_name, e.status, e.equipment_num,e.ip,e.park_id,e.building_id,e.tenant_id, e.pic, e.delete_flag, e.create_by, e.create_time, e.update_by,
|
||||
e.update_time,e.park_id,e.tenant_id FROM tb_equipment e
|
||||
left join tb_room_equipment re on re.equipment_id = e.id
|
||||
<where>
|
||||
@ -62,6 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
||||
<if test="updateTime != null ">update_time,</if>
|
||||
<if test="parkId != null and parkId != '' ">park_id,</if>
|
||||
<if test="buildingId != null and buildingId != '' ">building_id,</if>
|
||||
<if test="tenantId != null and tenantId != '' ">tenant_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null ">#{id},</if>
|
||||
@ -77,6 +83,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
||||
<if test="updateTime != null ">#{updateTime},</if>
|
||||
<if test="parkId != null and parkId != '' ">parkId,</if>
|
||||
<if test="buildingId != null and buildingId != '' ">buildingId,</if>
|
||||
<if test="tenantId != null and tenantId != '' ">tenantId,</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -87,6 +96,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="equipmentName != null and equipmentName != ''">equipment_name = #{equipmentName},</if>
|
||||
<if test="status != null ">status = #{status},</if>
|
||||
<if test="equipmentNum != null and equipmentNum != ''">equipment_num = #{equipmentNum},</if>
|
||||
<if test="parkId != null and parkId != ''">park_id = #{parkId},</if>
|
||||
<if test="buildingId != null and buildingId != ''">building_id = #{buildingId},</if>
|
||||
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
|
||||
<if test="pic != null and pic != ''">pic = #{pic},</if>
|
||||
<if test="deleteFlag != null ">delete_flag = #{deleteFlag},</if>
|
||||
<if test="ip != null ">ip = #{ip},</if>
|
||||
|
@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectRoomContentVo"/>
|
||||
<where>
|
||||
<if test="meetingName != null and meetingName != ''"> AND meeting_name LIKE CONCAT('%', #{meetingName}, '%')</if>
|
||||
<if test="typeValue != null and typeValue != ''"> AND `type`= #{typeValue}</if>
|
||||
<if test="type != null and type != ''"> AND `type`= #{type}</if>
|
||||
<if test="capacityNum != null and capacityNum != ''"> AND capacity_num =#{capacityNum}</if>
|
||||
<if test="shape != null and shape != ''"> AND shape =#{shape}</if>
|
||||
<if test="parkId != null and parkId != ''"> AND park_id =#{parkId}</if>
|
||||
|
@ -26,10 +26,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="deleteFlag" column="delete_flag" />
|
||||
<result property="roomId" column="room_id" />
|
||||
<result property="area" column="area" />
|
||||
<result property="parkId" column="park_id" />
|
||||
<result property="buildingId" column="building_id" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="buildId" column="build_id" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectShowroomVo">
|
||||
SELECT id, showroom_code, meeting_name, capacity_num, expand_num, indoor_pic_url, address, start_time, end_date, is_show, head_name, head_phone, content, create_by, create_time, update_by, update_time, version, delete_flag, room_id, area FROM tb_showroom
|
||||
SELECT id, showroom_code, meeting_name, capacity_num, expand_num, indoor_pic_url, address,park_id,building_id,tenant_id,build_id, start_time, end_date, is_show, head_name, head_phone, content, create_by, create_time, update_by, update_time, version, delete_flag, room_id, area FROM tb_showroom
|
||||
</sql>
|
||||
|
||||
<select id="selectShowroomList" parameterType="Showroom" resultMap="ShowroomResult">
|
||||
@ -68,6 +73,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="deleteFlag != null ">delete_flag,</if>
|
||||
<if test="roomId != null ">room_id,</if>
|
||||
<if test="area != null and area != ''">area,</if>
|
||||
<if test="parkId != null and parkId != '' ">park_id,</if>
|
||||
<if test="buildingId != null and buildingId != '' ">building_id,</if>
|
||||
<if test="tenantId != null and tenantId != '' ">tenant_id,</if>
|
||||
<if test="buildId != null and buildId != '' ">build_id,</if>
|
||||
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="showroomCode != null and showroomCode != ''">#{showroomCode},</if>
|
||||
@ -90,6 +100,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="deleteFlag != null ">#{deleteFlag},</if>
|
||||
<if test="roomId != null ">#{roomId},</if>
|
||||
<if test="area != null and area != ''">#{area},</if>
|
||||
<if test="parkId != null and parkId != '' ">parkId,</if>
|
||||
<if test="buildingId != null and buildingId != '' ">buildingId,</if>
|
||||
<if test="tenantId != null and tenantId != '' ">tenantId,</if>
|
||||
<if test="buildId != null and buildId != '' ">buildId,</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -116,6 +130,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="deleteFlag != null ">delete_flag = #{deleteFlag},</if>
|
||||
<if test="roomId != null ">room_id = #{roomId},</if>
|
||||
<if test="area != null and area != ''">area = #{area},</if>
|
||||
<if test="parkId != null and parkId != ''">park_id = #{parkId},</if>
|
||||
<if test="buildingId != null and buildingId != ''">building_id = #{buildingId},</if>
|
||||
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
|
||||
<if test="buildId != null and buildId != ''">build_id = #{buildId},</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ics.admin.mapper.meeting.StaffCustomerMapper">
|
||||
|
||||
<resultMap type="com.ics.admin.domain.meeting.StaffCustomer" id="StaffCustomerResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="icsCustomerId" column="ics_customer_id" />
|
||||
<result property="staffId" column="staff_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="deleteFlag" column="delete_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="parkId" column="park_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectStaffCustomerVo">
|
||||
SELECT id, ics_customer_id, staff_id, create_time, delete_flag, create_by, tenant_id, park_id FROM tb_staff_customer
|
||||
</sql>
|
||||
|
||||
<select id="selectStaffCustomerList" parameterType="StaffCustomer" resultMap="StaffCustomerResult">
|
||||
<include refid="selectStaffCustomerVo"/>
|
||||
<where>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectStaffCustomerById" parameterType="Long" resultMap="StaffCustomerResult">
|
||||
<include refid="selectStaffCustomerVo"/>
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertStaffCustomer" parameterType="StaffCustomer">
|
||||
INSERT INTO tb_staff_customer
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null ">id,</if>
|
||||
<if test="icsCustomerId != null ">ics_customer_id,</if>
|
||||
<if test="staffId != null ">staff_id,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="tenantId != null ">tenant_id,</if>
|
||||
<if test="parkId != null ">park_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null ">#{id},</if>
|
||||
<if test="icsCustomerId != null ">#{icsCustomerId},</if>
|
||||
<if test="staffId != null ">#{staffId},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="tenantId != null ">#{tenantId},</if>
|
||||
<if test="parkId != null ">#{parkId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateStaffCustomer" parameterType="StaffCustomer">
|
||||
UPDATE tb_staff_customer
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="icsCustomerId != null ">ics_customer_id = #{icsCustomerId},</if>
|
||||
<if test="staffId != null ">staff_id = #{staffId},</if>
|
||||
<if test="createTime != null ">create_time = #{createTime},</if>
|
||||
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
||||
<if test="tenantId != null ">tenant_id = #{tenantId},</if>
|
||||
<if test="parkId != null ">park_id = #{parkId},</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteStaffCustomerById" parameterType="Long">
|
||||
DELETE FROM tb_staff_customer WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteStaffCustomerByIds" parameterType="String">
|
||||
DELETE FROM tb_staff_customer where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -12,6 +12,7 @@ import com.ics.common.core.domain.dto.DevicePersonsDto;
|
||||
import com.ics.common.core.domain.dto.FacesDto;
|
||||
import com.ics.common.json.JsonUtils;
|
||||
import org.apache.poi.ss.util.ImageUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -32,6 +33,25 @@ public class DeviceUtils {
|
||||
private static final String BASE64_PREFIX="data:image/png;base64,";
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
public static String setDeviceInfo(String deviceId,String deviceName,String deviceAddress) {
|
||||
String url = deviceAddress + "/api/tmzz/v2/setDeviceInfo";
|
||||
|
||||
JSONObject param = JSONUtil.createObj();
|
||||
|
||||
param.put("deviceId", deviceId);
|
||||
param.put("deviceName", deviceName);
|
||||
param.put("deviceAddress", deviceAddress);
|
||||
|
||||
String msg = HttpUtil.post(url,param.toString());
|
||||
log.info("门禁设备信息:{}", msg);
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 门禁设备信息
|
||||
*
|
||||
@ -125,8 +145,8 @@ public class DeviceUtils {
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
public static String addPersons(DevicePersonDto dto) {
|
||||
String url = DEVICE_IP + "/api/viso/v2/addPersons";
|
||||
public static String addPersons(String ip,DevicePersonDto dto) {
|
||||
String url = ip + "/api/viso/v2/addPersons";
|
||||
ArrayList<DevicePersonDto> dtos = new ArrayList<>();
|
||||
DevicePersonsDto devicePersonDto = new DevicePersonsDto();
|
||||
// DevicePersonDto personDto = new DevicePersonDto();
|
||||
@ -138,17 +158,30 @@ public class DeviceUtils {
|
||||
// personDto.setCertificateType("111");
|
||||
// personDto.setCertificateNumber("11111");
|
||||
// //添加人员类型
|
||||
// personDto.setPersonType("visitor");
|
||||
// //添加访客时间
|
||||
// personDto.setPersonType("whitelist");
|
||||
//
|
||||
// ArrayList<FacesDto> facesDtos = new ArrayList<>();
|
||||
// FacesDto facesDto = new FacesDto();
|
||||
// facesDto.setFaceId("013");
|
||||
// String imgurl = "E:\\360MoveData\\Users\\Administrator\\Desktop\\图片\\图片\\photo.jpg";
|
||||
|
||||
// String faceData =BASE64_PREFIX+ UrlToBase64Util.imageUrlToBase64("https://img2.imgtp.com/2024/04/04/NQbU30N1.png");
|
||||
// facesDto.setData(faceData);
|
||||
// facesDtos.add(facesDto);
|
||||
|
||||
// personDto.setFaces(facesDtos);
|
||||
dtos.add(dto);
|
||||
|
||||
//添加访客时间
|
||||
// personDto.setVisitorValidStartTime("2024-03-12T11:04:40");
|
||||
// personDto.setVisitorValidEndTime("2024-03-14T11:04:40");
|
||||
dtos.add(dto);
|
||||
// dtos.add(dto);
|
||||
devicePersonDto.setPersons(dtos);
|
||||
String json = JsonUtils.toJson(devicePersonDto);
|
||||
System.out.println(json);
|
||||
System.out.println(url);
|
||||
// System.out.println(json);
|
||||
// System.out.println(url);
|
||||
String msg = HttpUtil.post(url,json);
|
||||
log.info("设备新增人员:{}", msg);
|
||||
// log.info("设备新增人员:{}", msg);
|
||||
return msg;
|
||||
}
|
||||
|
||||
@ -162,7 +195,7 @@ public class DeviceUtils {
|
||||
devicePersonDto.setPersonId("010");
|
||||
FacesDto facesDto = new FacesDto();
|
||||
facesDto.setFaceId("001");
|
||||
String imgurl = "https://img2.imgtp.com/2024/03/08/fdH30Rou.jpg";
|
||||
String imgurl = "E:\\360MoveData\\Users\\Administrator\\Desktop\\图片\\图片\\photo.jpg";
|
||||
String s =BASE64_PREFIX+ UrlToBase64Util.imageUrlToBase64(imgurl);
|
||||
facesDto.setData(s);
|
||||
faceDtos.add(facesDto);
|
||||
@ -248,8 +281,8 @@ public class DeviceUtils {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String s = addPersons(new DevicePersonDto() );
|
||||
System.out.println(s);
|
||||
String s = addPersons(null,null);
|
||||
// System.out.println(s);
|
||||
// String s = queryPersons("10000");
|
||||
//
|
||||
// JSONObject jsonObject = JSONUtil.parseObj(s);
|
||||
|
@ -1,56 +1,56 @@
|
||||
package com.ics.quartz.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* 定时任务配置
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class ScheduleConfig {
|
||||
|
||||
@Bean
|
||||
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
|
||||
SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
||||
factory.setDataSource(dataSource);
|
||||
|
||||
// quartz参数
|
||||
Properties prop = new Properties();
|
||||
prop.put("org.quartz.scheduler.instanceName", "IcsScheduler");
|
||||
prop.put("org.quartz.scheduler.instanceId", "AUTO");
|
||||
// 线程池配置
|
||||
prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
|
||||
prop.put("org.quartz.threadPool.threadCount", "20");
|
||||
prop.put("org.quartz.threadPool.threadPriority", "5");
|
||||
// JobStore配置
|
||||
prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
|
||||
// 集群配置
|
||||
prop.put("org.quartz.jobStore.isClustered", "true");
|
||||
prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
|
||||
prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
|
||||
prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
|
||||
|
||||
// sqlserver 启用
|
||||
// prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
|
||||
prop.put("org.quartz.jobStore.misfireThreshold", "12000");
|
||||
prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
|
||||
factory.setQuartzProperties(prop);
|
||||
|
||||
factory.setSchedulerName("IcsScheduler");
|
||||
// 延时启动
|
||||
factory.setStartupDelay(1);
|
||||
factory.setApplicationContextSchedulerContextKey("applicationContextKey");
|
||||
// 可选,QuartzScheduler
|
||||
// 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
|
||||
factory.setOverwriteExistingJobs(true);
|
||||
// 设置自动启动,默认为true
|
||||
factory.setAutoStartup(true);
|
||||
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
//package com.ics.quartz.config;
|
||||
//
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
//
|
||||
//import javax.sql.DataSource;
|
||||
//import java.util.Properties;
|
||||
//
|
||||
///**
|
||||
// * 定时任务配置
|
||||
// *
|
||||
// */
|
||||
//@Configuration
|
||||
//public class ScheduleConfig {
|
||||
//
|
||||
// @Bean
|
||||
// public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
|
||||
// SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
||||
// factory.setDataSource(dataSource);
|
||||
//
|
||||
// // quartz参数
|
||||
// Properties prop = new Properties();
|
||||
// prop.put("org.quartz.scheduler.instanceName", "IcsScheduler");
|
||||
// prop.put("org.quartz.scheduler.instanceId", "AUTO");
|
||||
// // 线程池配置
|
||||
// prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
|
||||
// prop.put("org.quartz.threadPool.threadCount", "20");
|
||||
// prop.put("org.quartz.threadPool.threadPriority", "5");
|
||||
// // JobStore配置
|
||||
// prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
|
||||
// // 集群配置
|
||||
// prop.put("org.quartz.jobStore.isClustered", "true");
|
||||
// prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
|
||||
// prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
|
||||
// prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
|
||||
//
|
||||
// // sqlserver 启用
|
||||
// // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
|
||||
// prop.put("org.quartz.jobStore.misfireThreshold", "12000");
|
||||
// prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
|
||||
// factory.setQuartzProperties(prop);
|
||||
//
|
||||
// factory.setSchedulerName("IcsScheduler");
|
||||
// // 延时启动
|
||||
// factory.setStartupDelay(1);
|
||||
// factory.setApplicationContextSchedulerContextKey("applicationContextKey");
|
||||
// // 可选,QuartzScheduler
|
||||
// // 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
|
||||
// factory.setOverwriteExistingJobs(true);
|
||||
// // 设置自动启动,默认为true
|
||||
// factory.setAutoStartup(true);
|
||||
//
|
||||
// return factory;
|
||||
// }
|
||||
//}
|
||||
|
@ -33,6 +33,7 @@ public class PayTimeOutTask {
|
||||
int compare = DateUtil.compare(DateUtil.date(), endDate);
|
||||
if (compare < 0) {
|
||||
reservation1.setStauts(Reservation.Status.CANCELED);
|
||||
reservation1.setCancelResaon("管理员取消原因为:支付超时");
|
||||
iReservationService.updateReservation(reservation1);
|
||||
log.info("支付超时处理任务执行成功");
|
||||
}
|
||||
|
@ -2,10 +2,21 @@ package com.ics.controller.mobile;
|
||||
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.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.common.constant.Constants;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
@ -25,9 +36,11 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@ -40,7 +53,6 @@ import java.util.concurrent.TimeUnit;
|
||||
public class WxLoginAPIController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private IIcsCustomerStaffService icsCustomerStaffService;
|
||||
|
||||
@ -56,12 +68,26 @@ public class WxLoginAPIController extends BaseController {
|
||||
@Autowired
|
||||
private IParkService parkService;
|
||||
|
||||
@Autowired
|
||||
private IRoomEquipmentService roomEquipmentService;
|
||||
|
||||
@Autowired
|
||||
private IDetailEquipmentService detailEquipmentService;
|
||||
|
||||
@Autowired
|
||||
private IUserEquipmentService userEquipmentService;
|
||||
|
||||
@Autowired
|
||||
private IEquipmentService equipmentService;
|
||||
|
||||
@Autowired
|
||||
private ICustomerService customerService;
|
||||
|
||||
|
||||
String smallWxAccessTokenKey = "smallWxAccessToken";
|
||||
String smallWxUserPassword = "123456";
|
||||
|
||||
|
||||
|
||||
// 微信小程序登录后,新建一个token ,然后在新增LoginUser 这个注解,然后在拦截器中获取token,然后获取用户信息
|
||||
|
||||
@PostMapping("/weixin/login")
|
||||
@ -83,7 +109,7 @@ public class WxLoginAPIController extends BaseController {
|
||||
// 用户存在直接获取token
|
||||
if (sysUser != null) {
|
||||
Long parkId = sysUser.getParkId();
|
||||
if (parkId !=null){
|
||||
if (parkId != null) {
|
||||
Park park = parkService.selectParkById(parkId);
|
||||
sysUser.setParkName(park.getName());
|
||||
}
|
||||
@ -104,7 +130,6 @@ public class WxLoginAPIController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/social_user_login/login")
|
||||
public R social(@RequestBody Map<String, String> paramMap) {
|
||||
try {
|
||||
@ -128,28 +153,60 @@ public class WxLoginAPIController extends BaseController {
|
||||
IcsCustomerStaff icsCustomerStaff = new IcsCustomerStaff();
|
||||
icsCustomerStaff.setMobile(phoneNumber);
|
||||
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectByPhone(phoneNumber);
|
||||
if(customerStaff !=null){
|
||||
if (customerStaff != null) {
|
||||
if (StringUtils.isBlank(customerStaff.getOpenid())) {
|
||||
// 根据 用户绑定的企业 绑定对应的设备
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
Customer customer = customerService.selectCustomerById(customerStaff.getIcsCustomerId());
|
||||
if (null != customer) {
|
||||
String roomId = customer.getRoomId();
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long id : collect) {
|
||||
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)) {
|
||||
for (Long id : ids) {
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(id);
|
||||
userEquipment.setUserId(customerStaff.getId());
|
||||
userEquipment.setStartTime(customer.getStartDate());
|
||||
userEquipment.setEndDate(customer.getEndDate());
|
||||
userEquipmentService.insertUserEquipment(userEquipment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (StringUtils.isBlank(customerStaff.getOpenid())){
|
||||
customerStaff.setOpenid(openid);
|
||||
icsCustomerStaffService.updateIcsCustomerStaff(customerStaff);
|
||||
}
|
||||
Long parkId = customerStaff.getParkId();
|
||||
if (parkId !=null){
|
||||
if (parkId != null) {
|
||||
Park park = parkService.selectParkById(parkId);
|
||||
customerStaff.setParkName(park.getName());
|
||||
}
|
||||
|
||||
User user = new User();
|
||||
PublishFactory.recordLoginInfo(customerStaff.getUsername(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"));
|
||||
BeanUtils.copyBeanProp(user,customerStaff);
|
||||
BeanUtils.copyBeanProp(user, customerStaff);
|
||||
Map<String, Object> token = tokenService.createToken(user);
|
||||
R ajax = R.ok();
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
ajax.put("user", user);
|
||||
ajax.put("openid", openid);
|
||||
return ajax;
|
||||
}else {
|
||||
} else {
|
||||
// 新增用户信息
|
||||
icsCustomerStaff.setUsername(phoneNumber);
|
||||
icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT);
|
||||
@ -170,6 +227,7 @@ public class WxLoginAPIController extends BaseController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信小程序AccessToken
|
||||
*/
|
||||
@ -184,16 +242,16 @@ public class WxLoginAPIController extends BaseController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("member:center:view")
|
||||
@GetMapping ("/wx/getUserInfo")
|
||||
public R login( Long userId) {
|
||||
@GetMapping("/wx/getUserInfo")
|
||||
public R login(Long userId) {
|
||||
try {
|
||||
//检查是否是否存在
|
||||
IcsCustomerStaff icsCustomerStaff = new IcsCustomerStaff();
|
||||
icsCustomerStaff.setId(userId);
|
||||
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(userId);
|
||||
if(null !=customerStaff){
|
||||
return R.ok().put("data",customerStaff);
|
||||
}else {
|
||||
if (null != customerStaff) {
|
||||
return R.ok().put("data", customerStaff);
|
||||
} else {
|
||||
return R.error("获取微信用户数据失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -9,10 +9,12 @@ 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.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.common.core.controller.BaseController;
|
||||
@ -22,13 +24,16 @@ import com.ics.common.core.page.TableSupport;
|
||||
import com.ics.common.json.JsonUtils;
|
||||
import com.ics.common.utils.DeviceUtils;
|
||||
import com.ics.common.utils.IpUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wf.jwtp.annotation.Ignore;
|
||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/equipment")
|
||||
public class ApiEquipmentController extends BaseController {
|
||||
@ -43,6 +48,9 @@ public class ApiEquipmentController extends BaseController {
|
||||
@Autowired
|
||||
private IRoomRecordService roomRecordService;
|
||||
|
||||
@Autowired
|
||||
private IRoomEquipmentService roomEquipmentService;
|
||||
|
||||
//根据用户id查询对应的设备, 楼层分割,房间,设备信息,
|
||||
@RequiresPermissions("member:center:view")
|
||||
@GetMapping("/getEquipmentByUserId/{userId}")
|
||||
@ -107,13 +115,35 @@ public class ApiEquipmentController extends BaseController {
|
||||
* 获取对比记录 todo 没写完 是否需要人脸对比的数据
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@Ignore
|
||||
@PostMapping("/getEquipmentByUserIdAndEquipmentId")
|
||||
public R getEquipmentByUserIdAndEquipmentId(@RequestBody DeviceData data){
|
||||
|
||||
// 对比personId 和用户 id,
|
||||
// 对比equipmentId 和设备id
|
||||
|
||||
if (data.getData() != null){
|
||||
//用户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));
|
||||
|
||||
|
||||
|
||||
record.setParkId(equipment.getParkId());
|
||||
record.setType("1");
|
||||
record.setDeviceId(equipment.getId());
|
||||
RoomEquipment roomEquipment = roomEquipmentService.selectByEquipmentId(equipment.getId());
|
||||
if (null != roomEquipment) {
|
||||
record.setRoomId(roomEquipment.getRoomId());
|
||||
}
|
||||
int i = roomRecordService.insertRoomRecord(record);
|
||||
}
|
||||
// log.info("上传的数据为{}",data.getData().getPersonId());
|
||||
|
||||
return R.ok("调用成功");
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.ics.controller.mobile.meeting;
|
||||
|
||||
import com.ics.admin.domain.Park;
|
||||
import com.ics.admin.service.IParkService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/park")
|
||||
public class ApiParkController {
|
||||
|
||||
@Autowired
|
||||
private IParkService parkService;
|
||||
|
||||
@RequiresPermissions("member:center:view")
|
||||
@GetMapping("get/{id}")
|
||||
public Park get(@PathVariable("id") Long id) {
|
||||
return parkService.selectParkById(id);
|
||||
}
|
||||
|
||||
}
|
@ -521,6 +521,7 @@ public class ApiRoomContentController extends BaseController {
|
||||
|
||||
Assert.notNull(reservation.getId(), "当前预约信息不存在");
|
||||
reservation.setStauts(Reservation.Status.CANCELED);
|
||||
reservation.setCancelResaon("管理员取消原因:"+reservation.getCancelResaon());
|
||||
reservation.setCancelTime(new Date());
|
||||
int i = reservationService.updateReservation(reservation);
|
||||
return toAjax(i);
|
||||
|
@ -61,7 +61,7 @@ public class ApiShowroomController extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@GetMapping("get/{id}")
|
||||
public Showroom get(@PathVariable("id") Long id) {
|
||||
public R get(@PathVariable("id") Long id) {
|
||||
Showroom showroom = showroomService.selectShowroomById(id);
|
||||
if (null != showroom){
|
||||
Room room = roomService.selectRoomById(showroom.getRoomId());
|
||||
@ -76,7 +76,7 @@ public class ApiShowroomController extends BaseController {
|
||||
}
|
||||
}
|
||||
}
|
||||
return showroom;
|
||||
return R.data(showroom);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,6 +187,13 @@ public class ApiShowroomController extends BaseController {
|
||||
Integer pageSize = pageDomain.getPageSize();
|
||||
IPage<ShowroomRecord> showroomRecords = recordService.selectShowroomRecord(showroomRecord,pageNum,pageSize);
|
||||
for (ShowroomRecord showroomRecord1 : showroomRecords.getRecords()) {
|
||||
Long userId = showroomRecord1.getUserId();
|
||||
IcsCustomerStaff icsCustomerStaffs = staffService.selectIcsCustomerStaffById(userId);
|
||||
if (null != icsCustomerStaffs ){
|
||||
showroomRecord1.setCreateBy(icsCustomerStaffs.getUsername());
|
||||
}
|
||||
|
||||
|
||||
if (showroomRecord1.getStatus() == 0){
|
||||
showroomRecord1.setStatusName("待审核");
|
||||
}else if (showroomRecord1.getStatus() == 1){
|
||||
@ -197,6 +204,7 @@ public class ApiShowroomController extends BaseController {
|
||||
|
||||
Showroom showroom = showroomService.selectShowroomById(showroomRecord1.getShowroomId());
|
||||
if (null != showroom){
|
||||
|
||||
showroomRecord1.setIndoorPicUrl(showroom.getIndoorPicUrl());
|
||||
showroomRecord1.setCapacityNum(showroom.getCapacityNum());
|
||||
Room room = roomService.selectRoomById(showroom.getRoomId());
|
||||
|
@ -1,21 +1,23 @@
|
||||
package com.ics.controller.mobile.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.IdcardUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.ics.admin.domain.Customer;
|
||||
import com.ics.admin.domain.Policy;
|
||||
import com.ics.admin.domain.ServiceBanner;
|
||||
import com.ics.admin.domain.meeting.Reservation;
|
||||
import com.ics.admin.domain.meeting.VisitorPerson;
|
||||
import com.ics.admin.domain.meeting.*;
|
||||
import com.ics.admin.domain.meeting.vo.VisitorPersonVo;
|
||||
import com.ics.admin.mapper.meeting.RoomContentMapper;
|
||||
import com.ics.admin.service.*;
|
||||
import com.ics.admin.service.meeting.IReservationPersonService;
|
||||
import com.ics.admin.service.meeting.IVisitorPersonService;
|
||||
import com.ics.admin.service.meeting.*;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.common.core.domain.R;
|
||||
@ -25,8 +27,10 @@ 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.UrlToBase64Util;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
@ -34,17 +38,18 @@ import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 访客管理模块
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/api/visitor")
|
||||
public class ApiVisitorController extends BaseController {
|
||||
|
||||
private static final String BASE64_PREFIX="data:image/png;base64,";
|
||||
|
||||
private static final String BASE64_PREFIX = "data:image/png;base64,";
|
||||
|
||||
|
||||
@Autowired
|
||||
@ -75,6 +80,21 @@ public class ApiVisitorController extends BaseController {
|
||||
@Autowired
|
||||
private IPolicyService policyService;
|
||||
|
||||
@Autowired
|
||||
private IRoomEquipmentService roomEquipmentService;
|
||||
|
||||
@Autowired
|
||||
private IEquipmentService equipmentService;
|
||||
|
||||
@Autowired
|
||||
private IDetailEquipmentService detailEquipmentService;
|
||||
|
||||
@Autowired
|
||||
private IUserEquipmentService userEquipmentService;
|
||||
|
||||
@Value("${dfs.domain}")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 获取所有的企业
|
||||
*/
|
||||
@ -94,6 +114,7 @@ public class ApiVisitorController extends BaseController {
|
||||
List<IcsCustomerStaff> customers = customerStaffService.selectUserByCustomer(customerId);
|
||||
return result(customers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 被访客记录
|
||||
*/
|
||||
@ -105,11 +126,11 @@ public class ApiVisitorController extends BaseController {
|
||||
Integer pageSize = pageDomain.getPageSize();
|
||||
IPage<VisitorPerson> visitorPersons = visitorPersonService.selectVisitorRecord(visitorPerson1.getUserId(), pageNum, pageSize);
|
||||
for (VisitorPerson visitorPerson : visitorPersons.getRecords()) {
|
||||
if (visitorPerson.getStatus() == 0){
|
||||
if (visitorPerson.getStatus() == 0) {
|
||||
visitorPerson.setStatusName("待审核");
|
||||
}else if (visitorPerson.getStatus() == 1){
|
||||
} else if (visitorPerson.getStatus() == 1) {
|
||||
visitorPerson.setStatusName("审核通过");
|
||||
}else if (visitorPerson.getStatus() == 2){
|
||||
} else if (visitorPerson.getStatus() == 2) {
|
||||
visitorPerson.setStatusName("审核拒绝");
|
||||
}
|
||||
|
||||
@ -126,6 +147,7 @@ public class ApiVisitorController extends BaseController {
|
||||
|
||||
/**
|
||||
* 访客记录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@ -137,11 +159,11 @@ public class ApiVisitorController extends BaseController {
|
||||
|
||||
IPage<VisitorPerson> visitorPersons = visitorPersonService.selectVisitorRecordByIntervieweeId(visitorPerson1.getIntervieweeId(), pageNum, pageSize);
|
||||
for (VisitorPerson visitorPerson : visitorPersons.getRecords()) {
|
||||
if (visitorPerson.getStatus() == 0){
|
||||
if (visitorPerson.getStatus() == 0) {
|
||||
visitorPerson.setStatusName("待审核");
|
||||
}else if (visitorPerson.getStatus() == 1){
|
||||
} else if (visitorPerson.getStatus() == 1) {
|
||||
visitorPerson.setStatusName("审核通过");
|
||||
}else if (visitorPerson.getStatus() == 2){
|
||||
} else if (visitorPerson.getStatus() == 2) {
|
||||
visitorPerson.setStatusName("审核拒绝");
|
||||
}
|
||||
|
||||
@ -163,33 +185,32 @@ public class ApiVisitorController extends BaseController {
|
||||
public R selectVisitorRecordById(@PathVariable("id") Long id) {
|
||||
VisitorPerson visitorPerson = visitorPersonService.selectReservationPersonById(id);
|
||||
|
||||
if (visitorPerson.getStatus() == 0){
|
||||
visitorPerson.setStatusName("待审核");
|
||||
}else if (visitorPerson.getStatus() == 1){
|
||||
visitorPerson.setStatusName("审核通过");
|
||||
}else if (visitorPerson.getStatus() == 2){
|
||||
visitorPerson.setStatusName("审核拒绝");
|
||||
}
|
||||
if (visitorPerson.getStatus() == 0) {
|
||||
visitorPerson.setStatusName("待审核");
|
||||
} else if (visitorPerson.getStatus() == 1) {
|
||||
visitorPerson.setStatusName("审核通过");
|
||||
} else if (visitorPerson.getStatus() == 2) {
|
||||
visitorPerson.setStatusName("审核拒绝");
|
||||
}
|
||||
|
||||
Long userId = visitorPerson.getUserId();
|
||||
IcsCustomerStaff icsCustomerStaff = customerStaffService.selectIcsCustomerStaffById(userId);
|
||||
visitorPerson.setUserName(icsCustomerStaff.getUsername());
|
||||
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());
|
||||
visitorPerson.setMobile(icsCustomerStaff.getMobile());
|
||||
Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId());
|
||||
visitorPerson.setCustomerName(customer.getName());
|
||||
|
||||
VisitorPersonVo visitorPersonVO = new VisitorPersonVo();
|
||||
BeanUtils.copyProperties(visitorPerson,visitorPersonVO );
|
||||
BeanUtils.copyProperties(visitorPerson, visitorPersonVO);
|
||||
visitorPersonVO.setUsername(icsCustomerStaff.getUsername());
|
||||
|
||||
return R.ok().put("data", visitorPersonVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 被访人审核功能
|
||||
* 被访人审核功能
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@PostMapping("updateVisitorPersonStatus")
|
||||
@ -197,45 +218,94 @@ public class ApiVisitorController extends BaseController {
|
||||
VisitorPerson visitorPerson = visitorPersonService.selectReservationPersonById(person.getId());
|
||||
Assert.isTrue(visitorPerson.getStatus() == 0, "该访客已审核");
|
||||
|
||||
|
||||
person.setReviewers(person.getUserId());
|
||||
person.setReviewersTime(new Date());
|
||||
int update = visitorPersonService.updateVisitorPersonStatus(person);
|
||||
if (update > 0){
|
||||
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){
|
||||
if (amount > 0) {
|
||||
//todo 需要修改 到底是按照访客时间。
|
||||
return toAjax(1);
|
||||
}
|
||||
// Assert.isTrue(IdcardUtil.isValidCard(person.getCardNo()), "身份证格式不正确");
|
||||
// Assert.isTrue(Validator.isPlateNumber(person.getPhone()), "手机号格式不正确");
|
||||
DevicePersonDto devicePersonDto = new DevicePersonDto();
|
||||
ArrayList<FacesDto> facesDtos = new ArrayList<>();
|
||||
devicePersonDto.setPersonId(String.valueOf(person.getIntervieweeId()));
|
||||
devicePersonDto.setName(person.getName());
|
||||
devicePersonDto.setPhone(String.valueOf(person.getPhone()));
|
||||
devicePersonDto.setCertificateType("111");
|
||||
devicePersonDto.setCertificateNumber(person.getCardNo());
|
||||
//添加人员类型
|
||||
devicePersonDto.setPersonType("visitor");
|
||||
//添加访客时间
|
||||
devicePersonDto.setVisitorValidStartTime(DateUtil.format(person.getVisitTime(), "yyyy-MM-dd'T'HH:mm:ss"));
|
||||
devicePersonDto.setVisitorValidEndTime(DateUtil.format(person.getLeaveTime(), "yyyy-MM-dd'T'HH:mm:ss"));
|
||||
FacesDto facesDto = new FacesDto();
|
||||
facesDto.setFaceId(String.valueOf(person.getUserId()));
|
||||
String faceData =BASE64_PREFIX+ UrlToBase64Util.imageUrlToBase64(person.getUrl());
|
||||
facesDto.setData(faceData);
|
||||
facesDtos.add(facesDto);
|
||||
devicePersonDto.setFaces(facesDtos);
|
||||
|
||||
DeviceUtils.addPersons(devicePersonDto);
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
|
||||
Customer customer = customerService.selectCustomerById(Long.valueOf(visitorPerson.getCustomerId()));
|
||||
if (null != customer) {
|
||||
String roomId = customer.getRoomId();
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long id : collect) {
|
||||
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)) {
|
||||
for (Long id : ids) {
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(id);
|
||||
userEquipment.setUserId(visitorPerson.getIntervieweeId());
|
||||
userEquipment.setStartTime(customer.getStartDate());
|
||||
userEquipment.setEndDate(customer.getEndDate());
|
||||
userEquipmentService.insertUserEquipment(userEquipment);
|
||||
}
|
||||
}
|
||||
}
|
||||
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) {
|
||||
|
||||
DevicePersonDto devicePersonDto = new DevicePersonDto();
|
||||
ArrayList<FacesDto> facesDtos = new ArrayList<>();
|
||||
devicePersonDto.setPersonId(String.valueOf(visitorPerson.getIntervieweeId()));
|
||||
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);
|
||||
String s1 = DeviceUtils.addPersons(equipment.getIp(), devicePersonDto);
|
||||
log.info("添加人员返回结果:" + s1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return toAjax(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 访客邀请记录
|
||||
* 访客邀请记录
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@GetMapping("selectVisitorInvitationRecord/{userId}")
|
||||
@ -244,21 +314,22 @@ public class ApiVisitorController extends BaseController {
|
||||
Integer pageNum = pageDomain.getPageNum();
|
||||
Integer pageSize = pageDomain.getPageSize();
|
||||
|
||||
IPage<Reservation> list = reservationPersonService.selectListByParticipantId(userId,pageNum,pageSize);
|
||||
return R.ok().put("page",list);
|
||||
IPage<Reservation> list = reservationPersonService.selectListByParticipantId(userId, pageNum, pageSize);
|
||||
return R.ok().put("page", list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加访客预约
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@PostMapping("visitorPerson")
|
||||
public R visitorPerson(@RequestBody VisitorPerson person) {
|
||||
person.setStatus(0);
|
||||
Assert.isTrue(IdcardUtil.isValidCard(person.getCardNo()), "身份证格式不正确");
|
||||
Assert.isTrue(Validator.isMobile(person.getPhone()), "手机号格式不正确");
|
||||
int i = visitorPersonService.insertReservationPerson(person);
|
||||
Assert.isTrue(i>0, "添加访客预约失败");
|
||||
Assert.isTrue(i > 0, "添加访客预约失败");
|
||||
//添加成功后,需要 往设备中添加一条数据
|
||||
|
||||
return toAjax(i);
|
||||
@ -269,7 +340,7 @@ public class ApiVisitorController extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@GetMapping("/carousel")
|
||||
public R carousel(){
|
||||
public R carousel() {
|
||||
|
||||
return R.data(bannerService.selectServiceBannerList(new ServiceBanner()));
|
||||
}
|
||||
@ -279,7 +350,7 @@ public class ApiVisitorController extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@GetMapping("/policy")
|
||||
public R policy(){
|
||||
public R policy() {
|
||||
return R.data(policyService.selectPolicyById(11L));
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,18 @@
|
||||
package com.ics.controller.mobile.member;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import com.ics.admin.domain.Customer;
|
||||
import com.ics.admin.domain.meeting.Equipment;
|
||||
import com.ics.admin.domain.meeting.RoomEquipment;
|
||||
import com.ics.admin.service.ICustomerService;
|
||||
import com.ics.admin.service.IIcsCustomerStaffService;
|
||||
import com.ics.admin.service.meeting.IEquipmentService;
|
||||
import com.ics.admin.service.meeting.IRoomEquipmentService;
|
||||
import com.ics.common.annotation.LoginStaff;
|
||||
import com.ics.common.annotation.LoginUser;
|
||||
import com.ics.common.constant.Constants;
|
||||
@ -14,23 +20,33 @@ import com.ics.common.constant.UserConstants;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.common.core.domain.R;
|
||||
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.UrlToBase64Util;
|
||||
import com.ics.common.utils.bean.BeanUtils;
|
||||
import com.ics.system.service.IConfigService;
|
||||
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.*;
|
||||
import org.wf.jwtp.annotation.Ignore;
|
||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
import org.wf.jwtp.util.SubjectUtil;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 个人资料
|
||||
*
|
||||
* @author jack
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/user/profile")
|
||||
public class ProfileAPIController extends BaseController {
|
||||
@ -46,8 +62,18 @@ public class ProfileAPIController extends BaseController {
|
||||
@Autowired
|
||||
private IConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private IRoomEquipmentService roomEquipmentService;
|
||||
|
||||
@Autowired
|
||||
private IEquipmentService equipmentService;
|
||||
|
||||
|
||||
private static final String BASE64_PREFIX="data:image/png;base64,";
|
||||
|
||||
|
||||
@Value("${dfs.domain}")
|
||||
private String url;
|
||||
|
||||
|
||||
/**
|
||||
@ -61,29 +87,13 @@ public class ProfileAPIController extends BaseController {
|
||||
String siteUrl = jsonObject.getString("siteUrl");
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
icsCustomerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(icsCustomerStaff.getId());
|
||||
Customer customer = customerService.selectCustomerById(icsCustomerStaff.getIcsCustomerId());
|
||||
if (null != customer){
|
||||
icsCustomerStaff.setCustomerName(customer.getName());
|
||||
if (icsCustomerStaff !=null ){
|
||||
Customer customer = customerService.selectCustomerById(icsCustomerStaff.getIcsCustomerId());
|
||||
if (null != customer){
|
||||
icsCustomerStaff.setCustomerName(customer.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// if (icsCustomerStaff.getAvatar().contains(Constants.RESOURCE_PREFIX)) {
|
||||
// icsCustomerStaff.setAvatar(icsCustomerStaff.getAvatar());
|
||||
// } else {
|
||||
// icsCustomerStaff.setAvatar(icsCustomerStaff.getAvatar());
|
||||
// }
|
||||
/* map.put("userId", icsCustomerStaff.getId());
|
||||
map.put("mobile", icsCustomerStaff.getMobile());
|
||||
if (icsCustomerStaff.getAvatar().contains(Constants.RESOURCE_PREFIX)) {
|
||||
map.put("avatar", siteUrl + icsCustomerStaff.getAvatar());
|
||||
} else {
|
||||
map.put("avatar", icsCustomerStaff.getAvatar());
|
||||
}
|
||||
map.put("username", icsCustomerStaff.getUsername());
|
||||
map.put("sex", icsCustomerStaff.getGender());
|
||||
map.put("dataType",icsCustomerStaff.getDataType());
|
||||
map.put("parkId",icsCustomerStaff.getParkId());
|
||||
map.put("cardType",icsCustomerStaff.getCardType());*/
|
||||
|
||||
return R.data(icsCustomerStaff);
|
||||
}
|
||||
|
||||
@ -94,14 +104,54 @@ public class ProfileAPIController extends BaseController {
|
||||
@PostMapping("/update")
|
||||
public R update(@RequestBody IcsCustomerStaff icsCustomerStaff) {
|
||||
long userId = this.getCurrentUserId();
|
||||
// System.out.println(currentUserId);
|
||||
// IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(currentUserId);
|
||||
// BeanUtils.copyBeanProp(customerStaff, icsCustomerStaff);
|
||||
// if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(icsCustomerStaffService.checkMobileUnique(customerStaff.getMobile()))) {
|
||||
// return R.error("修改用户'" + currentUser.getUsername()+ "'失败,手机号码已存在");
|
||||
// }
|
||||
|
||||
icsCustomerStaff.setId(userId);
|
||||
|
||||
if(StrUtil.isNotBlank(icsCustomerStaff.getPhoto())) {
|
||||
Long icsCustomerId = icsCustomerStaff.getIcsCustomerId();
|
||||
Customer customer = customerService.selectCustomerById(icsCustomerId);
|
||||
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 persons = DeviceUtils.queryPersons(String.valueOf(icsCustomerStaff.getId()));
|
||||
cn.hutool.json.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(icsCustomerStaff.getId()));
|
||||
devicePersonDto.setName(icsCustomerStaff.getName());
|
||||
devicePersonDto.setPhone(String.valueOf(icsCustomerStaff.getMobile()));
|
||||
devicePersonDto.setCertificateType("111");
|
||||
devicePersonDto.setCertificateNumber(icsCustomerStaff.getCardNo());
|
||||
//添加人员类型
|
||||
devicePersonDto.setPersonType("whitelist");
|
||||
//添加访客时间
|
||||
FacesDto facesDto = new FacesDto();
|
||||
facesDto.setFaceId(String.valueOf(icsCustomerStaff.getId()));
|
||||
String photoUrl = url + icsCustomerStaff.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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(icsCustomerStaff));
|
||||
}
|
||||
}
|
||||
|
44
pom.xml
44
pom.xml
@ -288,28 +288,28 @@
|
||||
</dependency>
|
||||
|
||||
<!-- Easy POI -->
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-base</artifactId>
|
||||
<version>${easypoi.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-annotation</artifactId>
|
||||
<version>${easypoi.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cn.afterturn</groupId>-->
|
||||
<!-- <artifactId>easypoi-base</artifactId>-->
|
||||
<!-- <version>${easypoi.version}</version>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>guava</artifactId>-->
|
||||
<!-- <groupId>com.google.guava</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cn.afterturn</groupId>-->
|
||||
<!-- <artifactId>easypoi-annotation</artifactId>-->
|
||||
<!-- <version>${easypoi.version}</version>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>guava</artifactId>-->
|
||||
<!-- <groupId>com.google.guava</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
|
Loading…
x
Reference in New Issue
Block a user