mirror of
https://gitee.com/elegant_wings/xiongan-meeting.git
synced 2025-06-21 04:59:36 +08:00
修改了对应的bug
This commit is contained in:
parent
c4babf61ea
commit
2147a836eb
@ -185,13 +185,26 @@ public class CustomerStaffController extends BaseController {
|
||||
Customer customer = customerService.selectCustomerById(icsCustomerStaff.getIcsCustomerId());
|
||||
if (null != customer) {
|
||||
String roomId = customer.getRoomId();
|
||||
String buildId = customer.getBuildId();
|
||||
|
||||
List<Long> result = new ArrayList<>();
|
||||
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
result.addAll(buildCollect);
|
||||
result.addAll(collect);
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long id : collect) {
|
||||
RoomEquipment roomEquipment = roomEquipmentService.selectByRoomId(id);
|
||||
if (null != roomEquipment) {
|
||||
ids.add(roomEquipment.getEquipmentId());
|
||||
for (Long id : result) {
|
||||
List<RoomEquipment> roomEquipment = roomEquipmentService.selectListByRoomId(id);
|
||||
if (CollUtil.isNotEmpty(roomEquipment)) {
|
||||
for (RoomEquipment roomEquipment1 : roomEquipment) {
|
||||
// ids.add(detailEquipment.getEquipmentId());
|
||||
ids.add(roomEquipment1.getEquipmentId());
|
||||
|
||||
}
|
||||
}
|
||||
List<DetailEquipment> detailEquipments = detailEquipmentService.selectByRoomId(id);
|
||||
if (CollUtil.isNotEmpty(detailEquipments)) {
|
||||
@ -234,10 +247,19 @@ public class CustomerStaffController extends BaseController {
|
||||
|
||||
if (null != customer) {
|
||||
String roomId = customer.getRoomId();
|
||||
String buildId = customer.getBuildId();
|
||||
|
||||
List<Long> result = new ArrayList<>();
|
||||
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
result.addAll(buildCollect);
|
||||
result.addAll(collect);
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long aLong : collect) {
|
||||
for (Long aLong : result) {
|
||||
//根据房间id获取设备id
|
||||
List<RoomEquipment> roomEquipments = roomEquipmentService.selectListByRoomId(aLong);
|
||||
for (RoomEquipment roomEquipment : roomEquipments) {
|
||||
@ -338,10 +360,19 @@ public class CustomerStaffController extends BaseController {
|
||||
|
||||
if (null != customer) {
|
||||
String roomId = customer.getRoomId();
|
||||
String buildId = customer.getBuildId();
|
||||
|
||||
List<Long> result = new ArrayList<>();
|
||||
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
result.addAll(buildCollect);
|
||||
result.addAll(collect);
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long id : collect) {
|
||||
for (Long id : result) {
|
||||
RoomEquipment roomEquipment = roomEquipmentService.selectByRoomId(id);
|
||||
if (null != roomEquipment) {
|
||||
ids.add(roomEquipment.getEquipmentId());
|
||||
@ -359,8 +390,8 @@ public class CustomerStaffController extends BaseController {
|
||||
int i1 = userEquipmentService.deleteUserEquipmentByUserId(icsCustomerStaff.getId(), id);
|
||||
//删除设备的用户
|
||||
Equipment equipment = equipmentService.selectEquipmentById(id);
|
||||
if (equipment !=null){
|
||||
DeviceUtils.deletePersons(equipment.getIp(),icsCustomerStaff.getId());
|
||||
if (equipment != null) {
|
||||
DeviceUtils.deletePersons(equipment.getIp(), icsCustomerStaff.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -400,7 +431,7 @@ public class CustomerStaffController extends BaseController {
|
||||
// @RequiresPermissions("admin:staff:import")
|
||||
@Ignore
|
||||
@PostMapping("/importData")
|
||||
public R importData(MultipartFile file,Long customerId) throws Exception {
|
||||
public R importData(MultipartFile file, Long customerId) throws Exception {
|
||||
// }
|
||||
ExcelUtil<IcsCustomerStaff> util = new ExcelUtil<IcsCustomerStaff>(IcsCustomerStaff.class);
|
||||
List<IcsCustomerStaff> userList = util.importExcel(file.getInputStream());
|
||||
@ -421,7 +452,7 @@ public class CustomerStaffController extends BaseController {
|
||||
}
|
||||
}
|
||||
}
|
||||
String message = icsCustomerStaffService.importCustomerStaff(userList,customerId);
|
||||
String message = icsCustomerStaffService.importCustomerStaff(userList, customerId);
|
||||
return R.data(message);
|
||||
}
|
||||
|
||||
@ -559,14 +590,22 @@ public class CustomerStaffController extends BaseController {
|
||||
List<StaffCustomer> staffCustomers = staffCustomerService.selectStaffCustomerByStaffId(customerStaff.getId());
|
||||
for (StaffCustomer staffCustomer : staffCustomers) {
|
||||
Customer customer = customerService.selectCustomerById(staffCustomer.getIcsCustomerId());
|
||||
//根据企业 查询对应的 房间,和对应的楼层
|
||||
String roomId = customer.getRoomId();
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
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();
|
||||
if (null != customer) {
|
||||
//根据企业 查询对应的 房间,和对应的楼层
|
||||
String roomId = customer.getRoomId();
|
||||
String buildId = customer.getBuildId();
|
||||
|
||||
List<Long> result = new ArrayList<>();
|
||||
|
||||
List<String> buildIds = StrUtil.split(buildId, ',');
|
||||
|
||||
List<String> roomIds = StrUtil.split(roomId, ',');
|
||||
List<Long> collect = roomIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<Long> buildCollect = buildIds.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
result.addAll(buildCollect);
|
||||
result.addAll(collect);
|
||||
//获取了房间集合,循环对应集合,
|
||||
for (Long id : result) {
|
||||
RoomEquipment roomEquipment = roomEquipmentService.selectByRoomId(id);
|
||||
if (null != roomEquipment) {
|
||||
ids.add(roomEquipment.getEquipmentId());
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.ics.admin.controller.meeting;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@ -20,6 +21,7 @@ import com.ics.common.utils.DeviceUtils;
|
||||
import com.ics.system.domain.User;
|
||||
import com.ics.system.service.ICurrentUserService;
|
||||
import com.ics.system.service.IUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@ -45,6 +47,7 @@ import java.util.stream.Collectors;
|
||||
* @author chen
|
||||
* @date 2024-02-25
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/meeting/equipment")
|
||||
public class EquipmentController extends BaseController {
|
||||
@ -153,6 +156,16 @@ public class EquipmentController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
DetailEquipment detailEquipment = detailEquipmentService.selectByEquipmentId(equipment2.getId());
|
||||
if (detailEquipment != null) {
|
||||
equipment2.setBuildId(detailEquipment.getBuildingDetailId());
|
||||
BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(detailEquipment.getBuildingDetailId());
|
||||
if (buildingDetail != null) {
|
||||
equipment2.setBuildName(buildingDetail.getFloorName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
UserEquipment userEquipment = new UserEquipment();
|
||||
userEquipment.setEquipmentId(equipment2.getId());
|
||||
@ -192,6 +205,7 @@ public class EquipmentController extends BaseController {
|
||||
addPersonDeviceByCustomer(room,equipment.getId());
|
||||
addPersonDeviceByRoomContent(room,equipment.getId());
|
||||
} else {
|
||||
|
||||
DetailEquipment detailEquipment = new DetailEquipment();
|
||||
detailEquipment.setEquipmentId(equipment.getId());
|
||||
detailEquipment.setBuildingDetailId(equipment.getBuildId());
|
||||
@ -219,7 +233,6 @@ public class EquipmentController extends BaseController {
|
||||
roomEquipment.setEquipmentId(equipment.getId());
|
||||
roomEquipment.setRoomId(equipment.getRoomId());
|
||||
|
||||
|
||||
Equipment equipment1 = equipmentService.selectEquipmentById(equipment.getId());
|
||||
if (!ObjectUtil.equals(equipment1.getRoomId(),equipment.getRoomId()) ) {
|
||||
Room room = roomService.selectRoomById(equipment.getRoomId());
|
||||
@ -231,8 +244,20 @@ public class EquipmentController extends BaseController {
|
||||
roomEquipment1.setRoomId(equipment.getRoomId());
|
||||
int i1 = roomEquipmentService.updateRoomEquipment(roomEquipment1);
|
||||
Assert.isTrue(i1 > 0, "修改失败");
|
||||
}else {
|
||||
int i1 = roomEquipmentService.insertRoomEquipment(roomEquipment);
|
||||
Assert.isTrue(i1 > 0, "修改失败");
|
||||
}
|
||||
} else {
|
||||
|
||||
//查询之前是否有房间,删除之前的房间
|
||||
|
||||
RoomEquipment roomEquipment = roomEquipmentService.selectByEquipmentId(equipment.getId());
|
||||
if (roomEquipment != null) {
|
||||
int i1 = roomEquipmentService.deleteRoomEquipment(roomEquipment.getEquipmentId());
|
||||
log.info("删除房间设备关系", i1);
|
||||
}
|
||||
|
||||
Equipment equipment1 = equipmentService.selectEquipmentById(equipment.getId());
|
||||
if (!ObjectUtil.equals(equipment1.getBuildId(),equipment.getBuildId())) {
|
||||
List<Room> rooms = roomService.selectRoomByBuildId(equipment.getBuildId());
|
||||
@ -245,10 +270,12 @@ public class EquipmentController extends BaseController {
|
||||
detailEquipment.setEquipmentId(equipment.getId());
|
||||
detailEquipment.setBuildingDetailId(equipment.getBuildId());
|
||||
DetailEquipment detailEquipment1 = detailEquipmentService.selectByEquipmentId(equipment.getId());
|
||||
if (null != detailEquipment1) {
|
||||
detailEquipment1.setBuildingDetailId(equipment.getBuildId());
|
||||
int i1 = detailEquipmentService.insertDetailEquipment(detailEquipment1);
|
||||
if (null == detailEquipment1) {
|
||||
int i1 = detailEquipmentService.insertDetailEquipment(detailEquipment);
|
||||
Assert.isTrue(i1 > 0, "修改失败");
|
||||
}else {
|
||||
detailEquipment1.setBuildingDetailId(equipment.getBuildId());
|
||||
int i1 = detailEquipmentService.updateDetailEquipment(detailEquipment1);
|
||||
}
|
||||
|
||||
}
|
||||
@ -368,6 +395,7 @@ public class EquipmentController extends BaseController {
|
||||
customerStaff.setIcsCustomerId(customer.getId());
|
||||
}
|
||||
}
|
||||
// todo 根据
|
||||
List<IcsCustomerStaff> icsCustomerStaffs = staffService.getUserList(customerStaff);
|
||||
|
||||
for (IcsCustomerStaff icsCustomerStaff : icsCustomerStaffs) {
|
||||
@ -430,24 +458,32 @@ public class EquipmentController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 新增保存设备
|
||||
* 新增保存设备 授权人员
|
||||
*/
|
||||
@Ignore
|
||||
@PostMapping("saveDevice")
|
||||
public R saveDevice(@RequestBody UserEquipment userEquipment) {
|
||||
|
||||
if (userEquipment.getId() != null) {
|
||||
|
||||
int num = userEquipmentService.selectListByEquipmentId(userEquipment.getId());
|
||||
if (num > 0) {
|
||||
int count = userEquipmentService.deleteUserEquipmentByEquipmentId(userEquipment.getId());
|
||||
Assert.isTrue(count > 0, "删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Long id : userEquipment.getUserIds()) {
|
||||
UserEquipment userEquipment1 = new UserEquipment();
|
||||
|
||||
List<StaffCustomer> staffCustomers = staffCustomerService.selectStaffCustomerByStaffId(id);
|
||||
if (CollUtil.isNotEmpty(staffCustomers)){
|
||||
Customer customer = customerService.selectCustomerById(staffCustomers.get(0).getIcsCustomerId());;
|
||||
if (customer !=null){
|
||||
userEquipment1.setStartTime(customer.getStartDate());
|
||||
userEquipment1.setEndDate(customer.getEndDate());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
userEquipment1.setEquipmentId(userEquipment.getId());
|
||||
userEquipment1.setUserId(id);
|
||||
int i = userEquipmentService.insertUserEquipment(userEquipment1);
|
||||
|
@ -172,16 +172,21 @@ public class ReservationController extends BaseController {
|
||||
List<Reservation> reservations = reservationService.selectReservationList(reservation);
|
||||
for (Reservation reservation1 : reservations) {
|
||||
RoomContent roomContent = iRoomContentService.selectRoomContentById(reservation1.getRoomContentId());
|
||||
String typeName = dictDataMapper.selectDictLabel("meeting_type", String.valueOf(roomContent.getType()));
|
||||
roomContent.setTypeName(typeName);
|
||||
if (roomContent != null){
|
||||
String typeName = dictDataMapper.selectDictLabel("meeting_type", String.valueOf(roomContent.getType()));
|
||||
roomContent.setTypeName(typeName);
|
||||
|
||||
Room room = roomService.selectRoomById(roomContent.getRoomId());
|
||||
if (null != room){
|
||||
reservation1.setBuildingId(room.getBuildingId());
|
||||
}
|
||||
}
|
||||
if (reservation1.getOrderTime()!=null){
|
||||
// 已经支付
|
||||
reservation1.setIsPay("已支付");
|
||||
}else {
|
||||
reservation1.setIsPay("未支付");
|
||||
}
|
||||
|
||||
//会议室名称
|
||||
reservation1.setRoomContent(roomContent);
|
||||
reservation1.setStatusName(reservation1.getStauts().getName());
|
||||
@ -194,11 +199,6 @@ 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);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
public Customer selectByRoomId(Long id) {
|
||||
|
||||
QueryWrapper<Customer> queryWrapper =new QueryWrapper<>();
|
||||
queryWrapper.eq("room_id",id);
|
||||
queryWrapper.likeLeft("room_id",id);
|
||||
return customerMapper.selectOne(queryWrapper);
|
||||
|
||||
}
|
||||
|
@ -130,4 +130,16 @@ public class RoomEquipmentServiceImpl extends ServiceImpl<RoomEquipmentMapper, R
|
||||
wrapper.eq("room_id",aLong);
|
||||
return roomEquipmentMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteRoomEquipment(Long id) {
|
||||
|
||||
|
||||
QueryWrapper<RoomEquipment> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("equipment_id",id);
|
||||
int delete = roomEquipmentMapper.delete(wrapper);
|
||||
return delete;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -68,4 +68,7 @@ public interface IRoomEquipmentService extends IService<RoomEquipment> {
|
||||
RoomEquipment selectByRoomId(Long id);
|
||||
|
||||
List<RoomEquipment> selectListByRoomId(Long aLong);
|
||||
|
||||
int deleteRoomEquipment(Long id);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user