diff --git a/ics-admin/src/main/java/com/ics/admin/controller/CustomerStaffController.java b/ics-admin/src/main/java/com/ics/admin/controller/CustomerStaffController.java index 300fb7a..8e6899c 100644 --- a/ics-admin/src/main/java/com/ics/admin/controller/CustomerStaffController.java +++ b/ics-admin/src/main/java/com/ics/admin/controller/CustomerStaffController.java @@ -1,5 +1,6 @@ package com.ics.admin.controller; +import cn.hutool.core.lang.Assert; import com.ics.admin.service.IIcsCustomerStaffService; import com.ics.common.constant.Constants; import com.ics.common.core.controller.BaseController; @@ -9,6 +10,7 @@ import com.ics.system.domain.User; import com.ics.system.service.IUserService; 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; @@ -45,12 +47,31 @@ public class CustomerStaffController extends BaseController { @GetMapping("list") public R list(IcsCustomerStaff icsCustomerStaff) { startPage(); - Integer customerId = getLoginCustomerId(); - icsCustomerStaff.setIcsCustomerId(customerId.longValue()); - icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF); + String customerId = icsCustomerStaff.getCustomerId(); + if (customerId != null && !"".equals(customerId)) { + icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId)); + } +// Integer customerId = getLoginCustomerId(); +// icsCustomerStaff.setIcsCustomerId(customerId.longValue()); +// icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF); return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff)); } + @Ignore + @GetMapping("getStaffListNotId") + public R getStaffListNotId(IcsCustomerStaff icsCustomerStaff) { + startPage(); + String customerId = icsCustomerStaff.getCustomerId(); + if (customerId != null && !"".equals(customerId)) { + icsCustomerStaff.setIcsCustomerId(Long.valueOf(customerId)); + } +// Integer customerId = getLoginCustomerId(); +// icsCustomerStaff.setIcsCustomerId(customerId.longValue()); +// icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF); + return result(icsCustomerStaffService.getStaffListNotId(icsCustomerStaff)); + } + + /** * 新增保存企业员工 @@ -58,8 +79,9 @@ public class CustomerStaffController extends BaseController { @RequiresPermissions("admin:staff:add") @PostMapping("save") public R addSave(@RequestBody IcsCustomerStaff icsCustomerStaff) { - Integer customerId = getLoginCustomerId(); - icsCustomerStaff.setIcsCustomerId(customerId.longValue()); + + Long customerId = getLoginCustomerId(); + icsCustomerStaff.setIcsCustomerId(customerId); icsCustomerStaff.setCreateTime(new Date()); icsCustomerStaff.setCreateBy(getLoginName()); icsCustomerStaff.setDataType(Constants.CUSTOMER_STAFF); @@ -75,12 +97,15 @@ public class CustomerStaffController extends BaseController { /** * 修改保存企业员工 */ - @RequiresPermissions("admin:staff:edit") @PostMapping("update") public R editSave(@RequestBody IcsCustomerStaff icsCustomerStaff) { + IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(icsCustomerStaff.getId()); + Assert.isTrue(null !=customerStaff , "用户不存在,请联系管理员"); + + customerStaff.setIcsCustomerId(Long.valueOf(icsCustomerStaff.getCustomerId())); icsCustomerStaff.setUpdateTime(new Date()); icsCustomerStaff.setUpdateBy(getLoginName()); - return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(icsCustomerStaff)); + return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(customerStaff)); } /** diff --git a/ics-admin/src/main/java/com/ics/admin/controller/meeting/EquipmentController.java b/ics-admin/src/main/java/com/ics/admin/controller/meeting/EquipmentController.java index 8c32b51..3bbe346 100644 --- a/ics-admin/src/main/java/com/ics/admin/controller/meeting/EquipmentController.java +++ b/ics-admin/src/main/java/com/ics/admin/controller/meeting/EquipmentController.java @@ -98,6 +98,10 @@ public class EquipmentController extends BaseController { equipment2.setRoomName(room.getName()); BuildingDetail buildingDetail = buildingDetailService.selectBuildingDetailById(room.getBuildingDetailId()); equipment2.setBuildName(buildingDetail.getFloorName()); + UserEquipment userEquipment = new UserEquipment(); + userEquipment.setEquipmentId(equipment2.getId()); + List equipments = userEquipmentService.selectUserEquipmentList(userEquipment); + equipment2.setPersonCount(equipments.size()); } return result(equipment1); } @@ -217,12 +221,18 @@ public class EquipmentController extends BaseController { @Ignore @PostMapping("saveDevice") public R saveDevice(@RequestBody UserEquipment userEquipment) { + + int count = userEquipmentService.deleteUserEquipmentByEquipmentId(userEquipment.getId()); + Assert.isTrue(count>0 , "删除失败"); + + for (Long id : userEquipment.getUserIds()) { UserEquipment userEquipment1 = new UserEquipment(); userEquipment1.setEquipmentId(userEquipment.getId()); userEquipment1.setUserId(id); int i = userEquipmentService.insertUserEquipment(userEquipment1); - Assert.isTrue(i > 0, "添加失败"); + + Assert.isTrue(i>0 , "添加失败"); } return R.data(userEquipment); diff --git a/ics-admin/src/main/java/com/ics/admin/controller/meeting/TicketController.java b/ics-admin/src/main/java/com/ics/admin/controller/meeting/TicketController.java index bf9074f..7f5fffb 100644 --- a/ics-admin/src/main/java/com/ics/admin/controller/meeting/TicketController.java +++ b/ics-admin/src/main/java/com/ics/admin/controller/meeting/TicketController.java @@ -172,13 +172,11 @@ public class TicketController extends BaseController { public R getTicketByCompany(Customer customer) { startPage(); - ArrayList customerArrayList = new ArrayList<>(); List customers = customerService.selectCustomerList(customer); for (Customer customer1 : customers) { User user = userService.selectUserByCustomer(customer1.getId()); if (user != null){ customer1.setUser(user); -// customerArrayList.add(customer1); } } return result(customers); diff --git a/ics-admin/src/main/java/com/ics/admin/controller/meeting/VisitorPersonController.java b/ics-admin/src/main/java/com/ics/admin/controller/meeting/VisitorPersonController.java index 92e4c5d..0fc5a17 100644 --- a/ics-admin/src/main/java/com/ics/admin/controller/meeting/VisitorPersonController.java +++ b/ics-admin/src/main/java/com/ics/admin/controller/meeting/VisitorPersonController.java @@ -6,6 +6,7 @@ import com.ics.admin.service.ICustomerService; import com.ics.admin.service.IIcsCustomerStaffService; import com.ics.admin.service.meeting.IVisitorPersonService; import com.ics.common.core.domain.IcsCustomerStaff; +import com.ics.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -50,17 +51,17 @@ public class VisitorPersonController extends BaseController { public VisitorPerson get(@PathVariable("id") Long id) { VisitorPerson visitorPerson = visitorPersonService.selectReservationPersonById(id); IcsCustomerStaff customerStaff = staffService.selectIcsCustomerStaffById(visitorPerson.getIntervieweeId()); - if (null != customerStaff){ + if (null != customerStaff) { visitorPerson.setIntervieweeName(customerStaff.getUsername()); } IcsCustomerStaff customerStaff1 = staffService.selectIcsCustomerStaffById(visitorPerson.getUserId()); - if (null != customerStaff1){ + if (null != customerStaff1) { visitorPerson.setUserName(customerStaff1.getUsername()); visitorPerson.setUserPhone(customerStaff1.getMobile()); } Customer customer = customerService.selectCustomerById(visitorPerson.getCustomerId()); - if (null != customer){ + if (null != customer) { visitorPerson.setCustomerName(customer.getName()); } return visitorPerson; @@ -83,6 +84,10 @@ public class VisitorPersonController extends BaseController { @RequiresPermissions("meeting:visitorPerson:add") @PostMapping("save") public R addSave(@RequestBody VisitorPerson visitorPerson) { + visitorPerson.setStatus(1); + visitorPerson.setCreateTime(DateUtils.getNowDate()); + visitorPerson.setUserId(getLoginCustomerId()); + return toAjax(visitorPersonService.insertReservationPerson(visitorPerson)); } @@ -93,10 +98,10 @@ public class VisitorPersonController extends BaseController { @PostMapping("update") public R editSave(@RequestBody VisitorPerson visitorPerson) { - if (null != visitorPerson.getStatus()){ - Integer loginCustomerId = this.getLoginCustomerId(); - if (loginCustomerId != null){ - visitorPerson.setReviewers(Long.valueOf(loginCustomerId)); + if (null != visitorPerson.getStatus()) { + Long loginCustomerId = this.getLoginCustomerId(); + if (loginCustomerId != null) { + visitorPerson.setReviewers(loginCustomerId); visitorPerson.setReviewersTime(new Date()); } } @@ -120,17 +125,35 @@ public class VisitorPersonController extends BaseController { @Ignore @GetMapping("getRecordByReservationId/{id}") public R getRecordByReservationId(@PathVariable("id") Long id) { - List list =visitorPersonService.getRecordByReservationId(id); + List list = visitorPersonService.getRecordByReservationId(id); for (RoomRecord record : list) { IcsCustomerStaff customerStaff1 = staffService.selectIcsCustomerStaffById(record.getUserId()); - if (null != customerStaff1){ + if (null != customerStaff1) { record.setUserName(customerStaff1.getUsername()); record.setUserPhone(customerStaff1.getMobile()); - } } return R.data(list); } + /** + * 根据企业id查询出所有的用户 + */ + @Ignore + @GetMapping("selectUserByCustomer/{customerId}") + public R selectUserByCustomer(@PathVariable("customerId") Long customerId) { + List customers = staffService.selectUserByCustomer(customerId); + return R.data(customers); + } + /** + * 根据企业id查询出所有的用户 + */ + @Ignore + @GetMapping("selectCustomer") + public R selectCustomer() { + List customers = customerService.selectCustomerList(new Customer()); + return R.data(customers); + } } + diff --git a/ics-admin/src/main/java/com/ics/admin/domain/meeting/Equipment.java b/ics-admin/src/main/java/com/ics/admin/domain/meeting/Equipment.java index 0ec54ed..ad68ec0 100644 --- a/ics-admin/src/main/java/com/ics/admin/domain/meeting/Equipment.java +++ b/ics-admin/src/main/java/com/ics/admin/domain/meeting/Equipment.java @@ -49,4 +49,7 @@ public class Equipment extends BaseEntity { @TableField(exist = false) private String buildName; + @TableField(exist = false) + private Integer personCount; + } diff --git a/ics-admin/src/main/java/com/ics/admin/service/IIcsCustomerStaffService.java b/ics-admin/src/main/java/com/ics/admin/service/IIcsCustomerStaffService.java index feb59f1..09c8f90 100644 --- a/ics-admin/src/main/java/com/ics/admin/service/IIcsCustomerStaffService.java +++ b/ics-admin/src/main/java/com/ics/admin/service/IIcsCustomerStaffService.java @@ -72,4 +72,7 @@ public interface IIcsCustomerStaffService extends IService { List selectUserByCustomer(Long customerId); List selectListByUserIds(List userIds); + + List getStaffListNotId(IcsCustomerStaff icsCustomerStaff); + } diff --git a/ics-admin/src/main/java/com/ics/admin/service/impl/IcsCustomerStaffServiceImpl.java b/ics-admin/src/main/java/com/ics/admin/service/impl/IcsCustomerStaffServiceImpl.java index 0751e5d..0c87e9d 100644 --- a/ics-admin/src/main/java/com/ics/admin/service/impl/IcsCustomerStaffServiceImpl.java +++ b/ics-admin/src/main/java/com/ics/admin/service/impl/IcsCustomerStaffServiceImpl.java @@ -115,4 +115,15 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl getStaffListNotId(IcsCustomerStaff icsCustomerStaff) { + + QueryWrapper objectQueryWrapper = new QueryWrapper<>(); + objectQueryWrapper.ne(icsCustomerStaff.getIcsCustomerId() != null,"ics_customer_Id",icsCustomerStaff.getIcsCustomerId()).or().isNull("ics_customer_Id"); + + return icsCustomerStaffMapper.selectList(objectQueryWrapper); + + + } } diff --git a/ics-admin/src/main/java/com/ics/admin/service/impl/UserEquipmentServiceImpl.java b/ics-admin/src/main/java/com/ics/admin/service/impl/UserEquipmentServiceImpl.java index d3b2145..7a1d21e 100644 --- a/ics-admin/src/main/java/com/ics/admin/service/impl/UserEquipmentServiceImpl.java +++ b/ics-admin/src/main/java/com/ics/admin/service/impl/UserEquipmentServiceImpl.java @@ -14,6 +14,7 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ics.admin.domain.Room; import com.ics.admin.domain.meeting.Equipment; @@ -174,6 +175,14 @@ public class UserEquipmentServiceImpl extends ServiceImpl wrapper = new UpdateWrapper<>(); + wrapper.eq("equipment_id", id); + return userEquipmentMapper.delete(wrapper); + } + public void updateDeviceDataSource(List equipments) { RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); diff --git a/ics-admin/src/main/java/com/ics/admin/service/meeting/IUserEquipmentService.java b/ics-admin/src/main/java/com/ics/admin/service/meeting/IUserEquipmentService.java index 88c8567..311e250 100644 --- a/ics-admin/src/main/java/com/ics/admin/service/meeting/IUserEquipmentService.java +++ b/ics-admin/src/main/java/com/ics/admin/service/meeting/IUserEquipmentService.java @@ -60,4 +60,6 @@ public interface IUserEquipmentService extends IService { int deleteUserEquipmentById(Long id); List getEquipmentByUserId(Long userId); + + int deleteUserEquipmentByEquipmentId(Long id); } diff --git a/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml b/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml index fc898f5..ea453c4 100644 --- a/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml +++ b/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml @@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND username LIKE CONCAT('%', #{username}, '%') AND ics_customer_id = #{icsCustomerId} - AND mobile = #{mobile} + AND mobile LIKE CONCAT('%', #{mobile}, '%') diff --git a/ics-common/ics-common-core/src/main/java/com/ics/common/core/controller/BaseController.java b/ics-common/ics-common-core/src/main/java/com/ics/common/core/controller/BaseController.java index b26b652..49f04b0 100644 --- a/ics-common/ics-common-core/src/main/java/com/ics/common/core/controller/BaseController.java +++ b/ics-common/ics-common-core/src/main/java/com/ics/common/core/controller/BaseController.java @@ -131,12 +131,12 @@ public class BaseController { * 获取企业id * @return */ - public Integer getLoginCustomerId() { + public Long getLoginCustomerId() { Token token = SubjectUtil.getToken(getRequest()); String value = valueOperations.get(ACCESS_USERID + ":" + token.getUserId()); JSONObject jo = StringUtils.isEmpty(value) ? null : JSON.parseObject(value, JSONObject.class); if (jo != null && jo.containsKey("customerId")) { - return (Integer)jo.get("customerId"); + return (Long)jo.get("customerId"); } return null; } diff --git a/ics-common/ics-common-core/src/main/java/com/ics/common/core/domain/IcsCustomerStaff.java b/ics-common/ics-common-core/src/main/java/com/ics/common/core/domain/IcsCustomerStaff.java index 0471f9c..62c9502 100644 --- a/ics-common/ics-common-core/src/main/java/com/ics/common/core/domain/IcsCustomerStaff.java +++ b/ics-common/ics-common-core/src/main/java/com/ics/common/core/domain/IcsCustomerStaff.java @@ -77,4 +77,7 @@ public class IcsCustomerStaff extends BaseEntity { /**数据类型,1企业员工,2临时访客*/ private String dataType; + @TableField(exist = false) + private String customerId; + } diff --git a/ics-system/src/main/resources/mapper/system/UserMapper.xml b/ics-system/src/main/resources/mapper/system/UserMapper.xml index 645b937..b203786 100644 --- a/ics-system/src/main/resources/mapper/system/UserMapper.xml +++ b/ics-system/src/main/resources/mapper/system/UserMapper.xml @@ -327,9 +327,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{avatar}, #{email}, #{mobile}, - #{customerId}, #{gender}, #{password}, + #{customerId}, #{salt}, #{status}, #{createBy}, @@ -399,12 +399,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" email = #{email}, mobile = #{mobile}, gender = #{gender}, - customer_id = #{customerId}, avatar = #{avatar}, password = #{password}, salt = #{salt}, status = #{status}, login_ip = #{loginIp}, + customer_id = #{customerId}, login_date = #{loginDate}, update_by = #{updateBy}, delete_flag = #{deleteFlag},