mirror of
https://gitee.com/elegant_wings/xiongan-meeting.git
synced 2025-06-21 11:59:36 +08:00
修改了对应用户设备的功能
This commit is contained in:
parent
e5a866ab20
commit
04ad7c9d00
@ -59,7 +59,6 @@ public class BuildingController extends BaseController {
|
|||||||
@PostMapping("save")
|
@PostMapping("save")
|
||||||
public R addSave(@RequestBody Building building) {
|
public R addSave(@RequestBody Building building) {
|
||||||
// Park park = parkService.getById(1L);
|
// Park park = parkService.getById(1L);
|
||||||
building.setParkId(1L);
|
|
||||||
return toAjax(buildingService.insertBuilding(building));
|
return toAjax(buildingService.insertBuilding(building));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,8 +226,6 @@ public class CustomerController extends BaseController {
|
|||||||
// if (User.isAdmin(getCurrentUserId())) {
|
// if (User.isAdmin(getCurrentUserId())) {
|
||||||
// return R.error("不允许超级管理员用户修改");
|
// return R.error("不允许超级管理员用户修改");
|
||||||
// }
|
// }
|
||||||
customer.setParkId(1L);
|
|
||||||
customer.setTenantId(1L);
|
|
||||||
ValidatorUtils.validateEntity(customer);
|
ValidatorUtils.validateEntity(customer);
|
||||||
customer.setUpdateBy(getLoginName());
|
customer.setUpdateBy(getLoginName());
|
||||||
return toAjax(customerService.updateCustomer(customer));
|
return toAjax(customerService.updateCustomer(customer));
|
||||||
|
@ -118,8 +118,6 @@ public class CustomerStaffController extends BaseController {
|
|||||||
if (customerId != null && !"".equals(customerId)) {
|
if (customerId != null && !"".equals(customerId)) {
|
||||||
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
|
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
|
||||||
}
|
}
|
||||||
// Integer customerId = getLoginCustomerId();
|
|
||||||
// icsCustomerStaff.setIcsCustomerId(customerId.longValue());
|
|
||||||
icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT);
|
icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT);
|
||||||
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
|
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
|
||||||
}
|
}
|
||||||
@ -132,9 +130,7 @@ public class CustomerStaffController extends BaseController {
|
|||||||
if (customerId != null && !"".equals(customerId)) {
|
if (customerId != null && !"".equals(customerId)) {
|
||||||
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
|
icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId));
|
||||||
}
|
}
|
||||||
// Integer customerId = getLoginCustomerId();
|
|
||||||
// icsCustomerStaff.setIcsCustomerId(customerId.longValue());
|
|
||||||
// icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF);
|
|
||||||
return result(icsCustomerStaffService.getStaffListNotId(icsCustomerStaff));
|
return result(icsCustomerStaffService.getStaffListNotId(icsCustomerStaff));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,52 +190,39 @@ public class CustomerStaffController extends BaseController {
|
|||||||
@Ignore
|
@Ignore
|
||||||
@PostMapping("updateStaff")
|
@PostMapping("updateStaff")
|
||||||
public R updateStaff(@RequestBody IcsCustomerStaff icsCustomerStaff) {
|
public R updateStaff(@RequestBody IcsCustomerStaff icsCustomerStaff) {
|
||||||
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(Long.valueOf(icsCustomerStaff.getMobile()));
|
|
||||||
if (customerStaff != null) {
|
|
||||||
customerStaff.setIcsCustomerId(Long.valueOf(icsCustomerStaff.getCustomerId()));
|
|
||||||
ArrayList<Long> ids = new ArrayList<>();
|
|
||||||
|
|
||||||
|
|
||||||
//根据企业id 查询对应的房间
|
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectByPhone(icsCustomerStaff.getMobile());
|
||||||
Customer customer = customerService.selectCustomerById(Long.valueOf(icsCustomerStaff.getCustomerId()));
|
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 (customer != null) {
|
|
||||||
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)) {
|
Long icsCustomerId = customerStaff.getIcsCustomerId();
|
||||||
for (Long id : ids) {
|
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());
|
||||||
|
|
||||||
UserEquipment userEquipment = new UserEquipment();
|
|
||||||
userEquipment.setEquipmentId(id);
|
|
||||||
userEquipment.setUserId(Long.valueOf(icsCustomerStaff.getMobile()));
|
|
||||||
userEquipment.setStartTime(customer.getStartDate());
|
|
||||||
userEquipment.setEndDate(customer.getEndDate());
|
|
||||||
userEquipmentService.insertUserEquipment(userEquipment);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customerStaff.setUpdateTime(new Date());
|
|
||||||
return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(customerStaff));
|
return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(customerStaff));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,8 +345,6 @@ public class CustomerStaffController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(ids)) {
|
if (CollUtil.isNotEmpty(ids)) {
|
||||||
List<Equipment> equipment = equipmentService.selectListByIds(ids);
|
List<Equipment> equipment = equipmentService.selectListByIds(ids);
|
||||||
List<Equipment> equipment1 = selectEquipmentListByIds(equipment);
|
List<Equipment> equipment1 = selectEquipmentListByIds(equipment);
|
||||||
@ -428,16 +409,32 @@ public class CustomerStaffController extends BaseController {
|
|||||||
@RequiresPermissions("meeting:roomContent:list")
|
@RequiresPermissions("meeting:roomContent:list")
|
||||||
@PostMapping("/saveUserEquipment")
|
@PostMapping("/saveUserEquipment")
|
||||||
public R saveUserEquipment(@RequestBody UserEquipment equipment) {
|
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, "删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (Long id : equipment.getUserIds()) {
|
for (Long id : equipment.getUserIds()) {
|
||||||
|
|
||||||
UserEquipment userEquipment = new UserEquipment();
|
UserEquipment userEquipment = new UserEquipment();
|
||||||
userEquipment.setEquipmentId(id);
|
userEquipment.setEquipmentId(id);
|
||||||
userEquipment.setUserId(equipment.getUserId());
|
userEquipment.setUserId(equipment.getUserId());
|
||||||
Customer customer = customerService.selectCustomerById(equipment.getUserId());
|
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(equipment.getUserId());
|
||||||
if (customer != null) {
|
if (null != customerStaff) {
|
||||||
userEquipment.setStartTime(customer.getStartDate());
|
Customer customer = customerService.selectCustomerById(customerStaff.getId());
|
||||||
userEquipment.setEndDate(customer.getEndDate());
|
if (customer != null) {
|
||||||
|
userEquipment.setStartTime(customer.getStartDate());
|
||||||
|
userEquipment.setEndDate(customer.getEndDate());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userEquipmentService.insertUserEquipment(userEquipment);
|
userEquipmentService.insertUserEquipment(userEquipment);
|
||||||
}
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
@ -411,8 +411,13 @@ public class EquipmentController extends BaseController {
|
|||||||
public R saveDevice(@RequestBody UserEquipment userEquipment) {
|
public R saveDevice(@RequestBody UserEquipment userEquipment) {
|
||||||
|
|
||||||
if (userEquipment.getId() != null) {
|
if (userEquipment.getId() != null) {
|
||||||
int count = userEquipmentService.deleteUserEquipmentByEquipmentId(userEquipment.getId());
|
|
||||||
Assert.isTrue(count > 0, "删除失败");
|
int num = userEquipmentService.selectListByEquipmentId(userEquipment.getId());
|
||||||
|
if (num > 0) {
|
||||||
|
int count = userEquipmentService.deleteUserEquipmentByEquipmentId(userEquipment.getId());
|
||||||
|
Assert.isTrue(count > 0, "删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Long id : userEquipment.getUserIds()) {
|
for (Long id : userEquipment.getUserIds()) {
|
||||||
|
@ -123,4 +123,11 @@ public class RoomEquipmentServiceImpl extends ServiceImpl<RoomEquipmentMapper, R
|
|||||||
wrapper.eq("room_id",id);
|
wrapper.eq("room_id",id);
|
||||||
return roomEquipmentMapper.selectOne(wrapper);
|
return roomEquipmentMapper.selectOne(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RoomEquipment> selectListByRoomId(Long aLong) {
|
||||||
|
QueryWrapper<RoomEquipment> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("room_id",aLong);
|
||||||
|
return roomEquipmentMapper.selectList(wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,6 +219,27 @@ public class UserEquipmentServiceImpl extends ServiceImpl<UserEquipmentMapper, U
|
|||||||
return userEquipmentMapper.selectCountByUserIdAndDeviceId(userEquipment1);
|
return userEquipmentMapper.selectCountByUserIdAndDeviceId(userEquipment1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int selectListByEquipmentId(Long id) {
|
||||||
|
QueryWrapper<UserEquipment> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("equipment_id", id);
|
||||||
|
return userEquipmentMapper.selectCount(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteUserEquipmentByUserId(Long userId) {
|
||||||
|
UpdateWrapper<UserEquipment> wrapper = new UpdateWrapper<>();
|
||||||
|
wrapper.eq("user_id", userId);
|
||||||
|
return userEquipmentMapper.delete(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int selectListByUserId(Long userId) {
|
||||||
|
QueryWrapper<UserEquipment> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("user_id", userId);
|
||||||
|
return userEquipmentMapper.selectCount(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateDeviceDataSource(List<Equipment> equipments) {
|
public void updateDeviceDataSource(List<Equipment> equipments) {
|
||||||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||||
|
@ -66,4 +66,6 @@ public interface IRoomEquipmentService extends IService<RoomEquipment> {
|
|||||||
RoomEquipment selectByEquipmentIdAndRoomId(RoomEquipment roomEquipment);
|
RoomEquipment selectByEquipmentIdAndRoomId(RoomEquipment roomEquipment);
|
||||||
|
|
||||||
RoomEquipment selectByRoomId(Long id);
|
RoomEquipment selectByRoomId(Long id);
|
||||||
|
|
||||||
|
List<RoomEquipment> selectListByRoomId(Long aLong);
|
||||||
}
|
}
|
||||||
|
@ -66,4 +66,10 @@ public interface IUserEquipmentService extends IService<UserEquipment> {
|
|||||||
UserEquipment selectUserAndEquipment(Long userId, Long id);
|
UserEquipment selectUserAndEquipment(Long userId, Long id);
|
||||||
|
|
||||||
int selectCountByUserIdAndDeviceId(UserEquipment userEquipment1);
|
int selectCountByUserIdAndDeviceId(UserEquipment userEquipment1);
|
||||||
|
|
||||||
|
int selectListByEquipmentId(Long id);
|
||||||
|
|
||||||
|
int deleteUserEquipmentByUserId(Long userId);
|
||||||
|
|
||||||
|
int selectListByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,15 @@ public class IcsCustomerStaff extends BaseEntity<IcsCustomerStaff> {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
/** 姓名 */
|
/** 姓名 */
|
||||||
|
|
||||||
@Excel(name = "微信昵称",type = Excel.Type.EXPORT)
|
@Excel(name = "微信昵称")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Excel(name = "姓名",type = Excel.Type.EXPORT)
|
@Excel(name = "姓名")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String photo;
|
private String photo;
|
||||||
|
|
||||||
@Excel(name = "地址",type = Excel.Type.EXPORT)
|
@Excel(name = "地址")
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
@Excel(name = "邮箱")
|
@Excel(name = "邮箱")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user