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 13cc2ee..85de0dc 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 @@ -180,6 +180,43 @@ public class CustomerStaffController extends BaseController { //如果没有注册小程序的话 + //如果是上海的小程序 + Long icsCustomerId = icsCustomerStaff.getIcsCustomerId(); + Customer customer1 = customerService.selectCustomerById(icsCustomerId); + + if (customer1.getParkId() == 26){ + IcsCustomerStaff customerStaff = icsCustomerStaffService.selectUserByMobile(icsCustomerStaff.getMobile()); + if (customerStaff != null){ + int i = icsCustomerStaffService.updateIcsCustomerStaff(icsCustomerStaff); + StaffCustomer staffCustomer = new StaffCustomer(); + staffCustomer.setIcsCustomerId(icsCustomerStaff.getIcsCustomerId()); + staffCustomer.setStaffId(customerStaff.getId()); + List staffCustomers = staffCustomerService.selectStaffCustomerList(staffCustomer); + if (staffCustomers.size() == 0) { + staffCustomerService.insertStaffCustomer(staffCustomer); + } + return toAjax(i); + }else { + icsCustomerStaff.setDataType("1"); + icsCustomerStaff.setParkId(customer1.getParkId()); + icsCustomerStaff.setTenantId(customer1.getTenantId()); + int i = icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff); + Assert.isTrue(i > 0, "添加失败"); + //新增用户和企业 id + StaffCustomer staffCustomer = new StaffCustomer(); + staffCustomer.setIcsCustomerId(icsCustomerStaff.getIcsCustomerId()); + staffCustomer.setStaffId(icsCustomerStaff.getId()); + staffCustomer.setParkId(customer1.getParkId()); + staffCustomer.setTenantId(customer1.getTenantId()); + staffCustomerService.insertStaffCustomer(staffCustomer); + return toAjax(i); + } + } + + + + + IcsCustomerStaff customerStaff = icsCustomerStaffService.selectUserByMobile(icsCustomerStaff.getMobile()); if (customerStaff != null) { if (icsCustomerStaff.getId() == null) { @@ -271,48 +308,51 @@ public class CustomerStaffController extends BaseController { //根据设备id获取设备 Equipment equipment = equipmentService.selectEquipmentById(detailEquipment.getEquipmentId()); if (equipment != null) { - String persons = DeviceUtils.queryPersons(equipment.getIp(), String.valueOf(customerStaff.getId())); - JSONObject jsonObject = JSONUtil.parseObj(persons); - Integer amount = (Integer) jsonObject.get("amount"); - if (amount <= 0) { - DevicePersonDto devicePersonDto = new DevicePersonDto(); - ArrayList 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); + if (equipment.getType() == 0){ + String persons = DeviceUtils.queryPersons(equipment.getIp(), String.valueOf(customerStaff.getId())); + JSONObject jsonObject = JSONUtil.parseObj(persons); + Integer amount = (Integer) jsonObject.get("amount"); + if (amount <= 0) { + DevicePersonDto devicePersonDto = new DevicePersonDto(); + ArrayList 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); - } else { - //更新用户信息 - if (icsCustomerStaff.getPhoto() != null) { - if (!icsCustomerStaff.getPhoto().equals(customer.getPhone())) { - DevicePersonDto devicePersonDto = new DevicePersonDto(); - devicePersonDto.setPersonId(String.valueOf(customerStaff.getId())); - ArrayList facesDtos = new ArrayList<>(); - FacesDto facesDto = new FacesDto(); - String photoUrl = url + icsCustomerStaff.getPhoto(); - String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl); - facesDto.setData(faceData); - facesDto.setFaceId(String.valueOf(customerStaff.getId())); - facesDtos.add(facesDto); - devicePersonDto.setFaces(facesDtos); - DeviceUtils.modifyFaces(equipment.getIp(), devicePersonDto); + facesDto.setData(faceData); + facesDtos.add(facesDto); + devicePersonDto.setFaces(facesDtos); + String s = DeviceUtils.addPersons(equipment.getIp(), devicePersonDto); + log.info("添加人员返回结果:" + s); + } else { + //更新用户信息 + if (icsCustomerStaff.getPhoto() != null) { + if (!icsCustomerStaff.getPhoto().equals(customer.getPhone())) { + DevicePersonDto devicePersonDto = new DevicePersonDto(); + devicePersonDto.setPersonId(String.valueOf(customerStaff.getId())); + ArrayList facesDtos = new ArrayList<>(); + FacesDto facesDto = new FacesDto(); + String photoUrl = url + icsCustomerStaff.getPhoto(); + String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl); + facesDto.setData(faceData); + facesDto.setFaceId(String.valueOf(customerStaff.getId())); + facesDtos.add(facesDto); + devicePersonDto.setFaces(facesDtos); + DeviceUtils.modifyFaces(equipment.getIp(), devicePersonDto); + } } } } + } } @@ -323,52 +363,57 @@ public class CustomerStaffController extends BaseController { //根据设备id获取设备 Equipment equipment = equipmentService.selectEquipmentById(roomEquipment.getEquipmentId()); if (equipment != null) { - String persons = DeviceUtils.queryPersons(equipment.getIp(), String.valueOf(customerStaff.getId())); - JSONObject jsonObject = JSONUtil.parseObj(persons); - Integer amount = (Integer) jsonObject.get("amount"); - if (amount <= 0) { - DevicePersonDto devicePersonDto = new DevicePersonDto(); - ArrayList 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); + if (equipment.getType() == 0){ + String persons = DeviceUtils.queryPersons(equipment.getIp(), String.valueOf(customerStaff.getId())); + JSONObject jsonObject = JSONUtil.parseObj(persons); + Integer amount = (Integer) jsonObject.get("amount"); + if (amount <= 0) { + DevicePersonDto devicePersonDto = new DevicePersonDto(); + ArrayList 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); - } else { - //更新用户信息 - if (icsCustomerStaff.getPhoto() != null) { - if (!icsCustomerStaff.getPhoto().equals(customer.getPhone())) { - DevicePersonDto devicePersonDto = new DevicePersonDto(); - devicePersonDto.setPersonId(String.valueOf(customerStaff.getId())); - ArrayList facesDtos = new ArrayList<>(); - FacesDto facesDto = new FacesDto(); - String photoUrl = url + icsCustomerStaff.getPhoto(); - String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl); - facesDto.setData(faceData); - facesDto.setFaceId(String.valueOf(customerStaff.getId())); - facesDtos.add(facesDto); - devicePersonDto.setFaces(facesDtos); - DeviceUtils.modifyFaces(equipment.getIp(), devicePersonDto); + facesDto.setData(faceData); + facesDtos.add(facesDto); + devicePersonDto.setFaces(facesDtos); + String s = DeviceUtils.addPersons(equipment.getIp(), devicePersonDto); + log.info("添加人员返回结果:" + s); + } else { + //更新用户信息 + if (icsCustomerStaff.getPhoto() != null) { + if (!icsCustomerStaff.getPhoto().equals(customer.getPhone())) { + DevicePersonDto devicePersonDto = new DevicePersonDto(); + devicePersonDto.setPersonId(String.valueOf(customerStaff.getId())); + ArrayList facesDtos = new ArrayList<>(); + FacesDto facesDto = new FacesDto(); + String photoUrl = url + icsCustomerStaff.getPhoto(); + String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl); + facesDto.setData(faceData); + facesDto.setFaceId(String.valueOf(customerStaff.getId())); + facesDtos.add(facesDto); + devicePersonDto.setFaces(facesDtos); + DeviceUtils.modifyFaces(equipment.getIp(), devicePersonDto); + } } } } + } } } } + customerStaff.setParkId(customer1.getParkId()); + customerStaff.setTenantId(customer1.getTenantId()); int i = icsCustomerStaffService.updateIcsCustomerStaff(customerStaff); Assert.isTrue(i > 0, "更新失败"); @@ -382,13 +427,21 @@ public class CustomerStaffController extends BaseController { return toAjax(i); } + Customer customer = customerService.selectCustomerById(icsCustomerStaff.getIcsCustomerId()); + if (null != customer){ + icsCustomerStaff.setParkId(customer.getParkId()); + icsCustomerStaff.setTenantId(customer.getTenantId()); + } icsCustomerStaff.setDataType("1"); + int i = icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff); Assert.isTrue(i > 0, "添加失败"); //新增用户和企业 id StaffCustomer staffCustomer = new StaffCustomer(); staffCustomer.setIcsCustomerId(icsCustomerStaff.getIcsCustomerId()); - staffCustomer.setStaffId(icsCustomerStaff.getStaffId()); + staffCustomer.setStaffId(customerStaff.getStaffId()); + staffCustomer.setParkId(customer.getParkId()); + staffCustomer.setTenantId(customer.getTenantId()); staffCustomerService.insertStaffCustomer(staffCustomer); return toAjax(i); @@ -450,7 +503,9 @@ public class CustomerStaffController extends BaseController { //删除设备的用户 Equipment equipment = equipmentService.selectEquipmentById(id); if (equipment != null) { - DeviceUtils.deletePersons(equipment.getIp(), icsCustomerStaff.getId()); + if (equipment.getType() == 0){ + DeviceUtils.deletePersons(equipment.getIp(), icsCustomerStaff.getId()); + } } } } @@ -664,7 +719,9 @@ public class CustomerStaffController extends BaseController { if (userEquipment != null){ Equipment equipment1 = equipmentService.selectEquipmentById(id); if (equipment1 != null) { - DeviceUtils.deletePersons(equipment1.getIp(), equipment.getUserId()); + if (equipment1.getType() == 0){ + DeviceUtils.deletePersons(equipment1.getIp(), equipment.getUserId()); + } } int count = userEquipmentService.deleteUserEquipmentByUserId(equipment.getUserId(), id); Assert.isTrue(count > 0, "删除失败"); @@ -674,39 +731,49 @@ public class CustomerStaffController extends BaseController { userEquipment1.setUserId(equipment.getUserId()); IcsCustomerStaff customerStaff1 = icsCustomerStaffService.selectIcsCustomerStaffById(equipment.getUserId()); if (null != customerStaff1) { - Customer customer = customerService.selectCustomerById(customerStaff1.getId()); - if (customer != null) { - userEquipment1.setStartTime(customer.getStartDate()); - userEquipment1.setEndDate(customer.getEndDate()); + List staffCustomers = staffCustomerService.selectStaffCustomerByStaffId(customerStaff1.getId()); + if (CollUtil.isNotEmpty(staffCustomers)) { + StaffCustomer staffCustomer = staffCustomers.get(0); + Customer customer = customerService.selectCustomerById(staffCustomer.getIcsCustomerId()); + if (customer != null) { + userEquipment1.setStartTime(customer.getStartDate()); + userEquipment1.setEndDate(customer.getEndDate()); + } } + } userEquipmentService.insertUserEquipment(userEquipment1); - // //新增人脸 IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(equipment.getUserId()); - DevicePersonDto devicePersonDto = new DevicePersonDto(); - ArrayList 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); + Equipment equipment2 = equipmentService.selectEquipmentById(id); + if (equipment2 != null) { + if (equipment2.getType() == 0){ + DevicePersonDto devicePersonDto = new DevicePersonDto(); + ArrayList 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); - Equipment equipment1 = equipmentService.selectEquipmentById(id); + facesDto.setData(faceData); + facesDtos.add(facesDto); + devicePersonDto.setFaces(facesDtos); + Equipment equipment1 = equipmentService.selectEquipmentById(id); + + String s = DeviceUtils.addPersons(equipment1.getIp(), devicePersonDto); + log.info("添加人员返回结果:" + s); + } + } - String s = DeviceUtils.addPersons(equipment1.getIp(), devicePersonDto); - log.info("添加人员返回结果:" + s); } } 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 60af247..bcf7f49 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 @@ -207,7 +207,7 @@ public class EquipmentController extends BaseController { Assert.isTrue(i > 0, "添加失败"); boolean ipv4 = Validator.isIpv4(equipment.getIp()); - Assert.isTrue(!ipv4, "IP不合法"); + Assert.isTrue(ipv4, "IP不合法"); boolean ping = DeviceUtils.ping(equipment.getIp()); diff --git a/ics-admin/src/main/java/com/ics/admin/controller/meeting/ReservationServeController.java b/ics-admin/src/main/java/com/ics/admin/controller/meeting/ReservationServeController.java new file mode 100644 index 0000000..7d2cc9a --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/controller/meeting/ReservationServeController.java @@ -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.ReservationServe; +import com.ics.admin.service.meeting.IReservationServeService; +import org.wf.jwtp.annotation.RequiresPermissions; + +/** + * 预约服务关联 提供者 + * + * @author chen + * @date 2024-06-26 + */ +@RestController +@RequestMapping("serve") +public class ReservationServeController extends BaseController { + + @Autowired + private IReservationServeService reservationServeService; + + /** + * 查询预约服务关联 + */ + @GetMapping("get/{id}") + public ReservationServe get(@PathVariable("id") Long id) { + return reservationServeService.selectReservationServeById(id); + } + + /** + * 查询预约服务关联列表 + */ + @RequiresPermissions("meeting:serve:list") + @GetMapping("list") + public R list(ReservationServe reservationServe) { + startPage(); + return result(reservationServeService.selectReservationServeList(reservationServe)); + } + + + /** + * 新增保存预约服务关联 + */ + @RequiresPermissions("meeting:serve:add") + @PostMapping("save") + public R addSave(@RequestBody ReservationServe reservationServe) { + return toAjax(reservationServeService.insertReservationServe(reservationServe)); + } + + /** + * 修改保存预约服务关联 + */ + @RequiresPermissions("meeting:serve:edit") + @PostMapping("update") + public R editSave(@RequestBody ReservationServe reservationServe) { + return toAjax(reservationServeService.updateReservationServe(reservationServe)); + } + + /** + * 删除预约服务关联 + */ + @RequiresPermissions("meeting:serve:remove") + @PostMapping("remove") + public R remove(String ids) { + return toAjax(reservationServeService.deleteReservationServeByIds(ids)); + } + +} diff --git a/ics-admin/src/main/java/com/ics/admin/controller/meeting/RoomContentController.java b/ics-admin/src/main/java/com/ics/admin/controller/meeting/RoomContentController.java index b481e89..666f74e 100644 --- a/ics-admin/src/main/java/com/ics/admin/controller/meeting/RoomContentController.java +++ b/ics-admin/src/main/java/com/ics/admin/controller/meeting/RoomContentController.java @@ -274,21 +274,24 @@ public class RoomContentController extends BaseController { List rooms = roomService.selectRoomList(room); - String customerId = room.getCustomerId(); - Customer customer = customerService.selectCustomerById(Long.valueOf(customerId)); - String roomId = customer.getRoomId(); - List roomIds = StrUtil.split(roomId, ','); + if (StrUtil.isNotBlank(room.getCustomerId())){ + String customerId = room.getCustomerId(); + Customer customer = customerService.selectCustomerById(Long.valueOf(customerId)); + String roomId = customer.getRoomId(); + List roomIds = StrUtil.split(roomId, ','); - if (CollUtil.isNotEmpty(roomIds) ){ - for (String id : roomIds) { - Room room1 = roomService.selectRoomById(Long.valueOf(id)); - if (null != room1){ - rooms.add(room1); + if (CollUtil.isNotEmpty(roomIds) ){ + for (String id : roomIds) { + Room room1 = roomService.selectRoomById(Long.valueOf(id)); + if (null != room1){ + rooms.add(room1); + } } - } + } } + return R.ok().put("data",rooms); } diff --git a/ics-admin/src/main/java/com/ics/admin/controller/meeting/StaffOpenController.java b/ics-admin/src/main/java/com/ics/admin/controller/meeting/StaffOpenController.java new file mode 100644 index 0000000..e093603 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/controller/meeting/StaffOpenController.java @@ -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.StaffOpen; +import com.ics.admin.service.meeting.IStaffOpenService; +import org.wf.jwtp.annotation.RequiresPermissions; + +/** + * 用户和小程序关联 提供者 + * + * @author ics + * @date 2024-06-25 + */ +@RestController +@RequestMapping("open") +public class StaffOpenController extends BaseController { + + @Autowired + private IStaffOpenService staffOpenService; + + /** + * 查询用户和小程序关联 + */ + @GetMapping("get/{id}") + public StaffOpen get(@PathVariable("id") Long id) { + return staffOpenService.selectStaffOpenById(id); + } + + /** + * 查询用户和小程序关联列表 + */ + @RequiresPermissions("meeting:open:list") + @GetMapping("list") + public R list(StaffOpen staffOpen) { + startPage(); + return result(staffOpenService.selectStaffOpenList(staffOpen)); + } + + + /** + * 新增保存用户和小程序关联 + */ + @RequiresPermissions("meeting:open:add") + @PostMapping("save") + public R addSave(@RequestBody StaffOpen staffOpen) { + return toAjax(staffOpenService.insertStaffOpen(staffOpen)); + } + + /** + * 修改保存用户和小程序关联 + */ + @RequiresPermissions("meeting:open:edit") + @PostMapping("update") + public R editSave(@RequestBody StaffOpen staffOpen) { + return toAjax(staffOpenService.updateStaffOpen(staffOpen)); + } + + /** + * 删除用户和小程序关联 + */ + @RequiresPermissions("meeting:open:remove") + @PostMapping("remove") + public R remove(String ids) { + return toAjax(staffOpenService.deleteStaffOpenByIds(ids)); + } + +} diff --git a/ics-admin/src/main/java/com/ics/admin/domain/TemplateData.java b/ics-admin/src/main/java/com/ics/admin/domain/TemplateData.java new file mode 100644 index 0000000..de5cd9a --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/domain/TemplateData.java @@ -0,0 +1,10 @@ +package com.ics.admin.domain; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@AllArgsConstructor +@Data +public class TemplateData { + private String value; +} \ No newline at end of file diff --git a/ics-admin/src/main/java/com/ics/admin/domain/WxMssVO.java b/ics-admin/src/main/java/com/ics/admin/domain/WxMssVO.java new file mode 100644 index 0000000..260f43b --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/domain/WxMssVO.java @@ -0,0 +1,15 @@ +package com.ics.admin.domain; + +import lombok.Data; + +import java.util.Map; + +@Data +public class WxMssVO { + + private String touser;//用户openid + private String template_id;//订阅消息模版id + private String page = "pages/index/index";//默认跳到小程序首页 + private Map data;//推送文字 +} + diff --git a/ics-admin/src/main/java/com/ics/admin/domain/meeting/Reservation.java b/ics-admin/src/main/java/com/ics/admin/domain/meeting/Reservation.java index ea687aa..c1ab2d5 100644 --- a/ics-admin/src/main/java/com/ics/admin/domain/meeting/Reservation.java +++ b/ics-admin/src/main/java/com/ics/admin/domain/meeting/Reservation.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.ics.common.core.domain.BaseEntity; import lombok.Data; import java.util.Date; +import java.util.List; /** * 预约记录对象 tb_reservation @@ -34,6 +35,8 @@ public class Reservation extends BaseEntity { /** 优惠卷id */ private Long ticketId; + private Integer personNum; + @TableField(exist = false) private String ticketName; @@ -52,6 +55,10 @@ public class Reservation extends BaseEntity { @TableField(exist = false) private Integer statusValue; + + @TableField(exist = false) + private List reservationServes; + /** 预约状态 0待支付,1.已预约,2.进行中,3已结束,4.已取消 */ private Status stauts; public enum Status implements IEnum { @@ -189,4 +196,10 @@ public class Reservation extends BaseEntity { @TableField(exist = false) private String buildName; + private String createBy; + + + private Date createTime; + + } diff --git a/ics-admin/src/main/java/com/ics/admin/domain/meeting/ReservationServe.java b/ics-admin/src/main/java/com/ics/admin/domain/meeting/ReservationServe.java new file mode 100644 index 0000000..31a16c2 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/domain/meeting/ReservationServe.java @@ -0,0 +1,34 @@ +package com.ics.admin.domain.meeting; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ics.common.core.domain.BaseEntity; +import lombok.Data; + +/** + * 预约服务关联对象 tb_reservation_serve + * + * @author chen + * @date 2024-06-26 + */ +@Data +@TableName("tb_reservation_serve") +public class ReservationServe extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 服务id */ + private Long serveId; + + /** 预约记录id */ + private Long reservationId; + + /** 数量 */ + private Integer num; + + /** 园区ID */ + private Long parkId; + + @TableField(exist = false) + private String serveName; + +} diff --git a/ics-admin/src/main/java/com/ics/admin/domain/meeting/StaffOpen.java b/ics-admin/src/main/java/com/ics/admin/domain/meeting/StaffOpen.java new file mode 100644 index 0000000..cfe9066 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/domain/meeting/StaffOpen.java @@ -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_open + * + * @author ics + * @date 2024-06-25 + */ +@Data +@TableName("tb_staff_open") +public class StaffOpen extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 企业id */ + private String openid; + + /** 用户id */ + private Long staffId; + + /** 园区ID */ + private Long parkId; + +} diff --git a/ics-admin/src/main/java/com/ics/admin/mapper/IcsCustomerStaffMapper.java b/ics-admin/src/main/java/com/ics/admin/mapper/IcsCustomerStaffMapper.java index f6d7dad..e76c0ae 100644 --- a/ics-admin/src/main/java/com/ics/admin/mapper/IcsCustomerStaffMapper.java +++ b/ics-admin/src/main/java/com/ics/admin/mapper/IcsCustomerStaffMapper.java @@ -77,4 +77,6 @@ public interface IcsCustomerStaffMapper extends BaseMapper { List getUserList(IcsCustomerStaff customerStaff); + IcsCustomerStaff selectUserByMobileAndParkId(@Param("mobile") String phoneNumber, @Param("parkId") String parkId); + } diff --git a/ics-admin/src/main/java/com/ics/admin/mapper/meeting/ReservationServeMapper.java b/ics-admin/src/main/java/com/ics/admin/mapper/meeting/ReservationServeMapper.java new file mode 100644 index 0000000..b99c0f1 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/mapper/meeting/ReservationServeMapper.java @@ -0,0 +1,64 @@ +package com.ics.admin.mapper.meeting; + +import com.ics.admin.domain.meeting.ReservationServe; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 预约服务关联Mapper接口 + * + * @author chen + * @date 2024-06-26 + */ +@Mapper +public interface ReservationServeMapper extends BaseMapper { + /** + * 查询预约服务关联 + * + * @param id 预约服务关联ID + * @return 预约服务关联 + */ + ReservationServe selectReservationServeById(Long id); + + /** + * 查询预约服务关联列表 + * + * @param reservationServe 预约服务关联 + * @return 预约服务关联集合 + */ + List selectReservationServeList(ReservationServe reservationServe); + + /** + * 新增预约服务关联 + * + * @param reservationServe 预约服务关联 + * @return 结果 + */ + int insertReservationServe(ReservationServe reservationServe); + + /** + * 修改预约服务关联 + * + * @param reservationServe 预约服务关联 + * @return 结果 + */ + int updateReservationServe(ReservationServe reservationServe); + + /** + * 删除预约服务关联 + * + * @param id 预约服务关联ID + * @return 结果 + */ + int deleteReservationServeById(Long id); + + /** + * 批量删除预约服务关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + int deleteReservationServeByIds(String[] ids); +} diff --git a/ics-admin/src/main/java/com/ics/admin/mapper/meeting/StaffCustomerMapper.java b/ics-admin/src/main/java/com/ics/admin/mapper/meeting/StaffCustomerMapper.java index 5abad88..8b150a2 100644 --- a/ics-admin/src/main/java/com/ics/admin/mapper/meeting/StaffCustomerMapper.java +++ b/ics-admin/src/main/java/com/ics/admin/mapper/meeting/StaffCustomerMapper.java @@ -3,6 +3,7 @@ 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 org.apache.ibatis.annotations.Param; import java.util.List; @@ -63,4 +64,6 @@ public interface StaffCustomerMapper extends BaseMapper { int deleteStaffCustomerByIds(String[] ids); List selectStaffCustomerByStaffId(Long id); + + List selectStaffCustomerByStaffIdAndParkId(@Param("staffId") Long id,@Param("parkId") String parkId); } diff --git a/ics-admin/src/main/java/com/ics/admin/mapper/meeting/StaffOpenMapper.java b/ics-admin/src/main/java/com/ics/admin/mapper/meeting/StaffOpenMapper.java new file mode 100644 index 0000000..e4f9f4b --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/mapper/meeting/StaffOpenMapper.java @@ -0,0 +1,70 @@ +package com.ics.admin.mapper.meeting; + +import com.ics.admin.domain.meeting.StaffOpen; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户和小程序关联Mapper接口 + * + * @author ics + * @date 2024-06-25 + */ +@Mapper +public interface StaffOpenMapper extends BaseMapper { + /** + * 查询用户和小程序关联 + * + * @param id 用户和小程序关联ID + * @return 用户和小程序关联 + */ + StaffOpen selectStaffOpenById(Long id); + + /** + * 查询用户和小程序关联列表 + * + * @param staffOpen 用户和小程序关联 + * @return 用户和小程序关联集合 + */ + List selectStaffOpenList(StaffOpen staffOpen); + + /** + * 新增用户和小程序关联 + * + * @param staffOpen 用户和小程序关联 + * @return 结果 + */ + int insertStaffOpen(StaffOpen staffOpen); + + /** + * 修改用户和小程序关联 + * + * @param staffOpen 用户和小程序关联 + * @return 结果 + */ + int updateStaffOpen(StaffOpen staffOpen); + + /** + * 删除用户和小程序关联 + * + * @param id 用户和小程序关联ID + * @return 结果 + */ + int deleteStaffOpenById(Long id); + + /** + * 批量删除用户和小程序关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + int deleteStaffOpenByIds(String[] ids); + + StaffOpen selectStaffOpenByOpenId(String openid); + + + StaffOpen selectStaffOpenByStaffIdAndOpenId(@Param("staffId") Long id,@Param("openid") String openId); +} 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 c75bf4a..c9ea29c 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 @@ -89,4 +89,6 @@ public interface IIcsCustomerStaffService extends IService { IcsCustomerStaff selectByPhoneAndOpenId(String phoneNumber, String openid); IcsCustomerStaff selectUserByMobile(String phone); + +// IcsCustomerStaff selectUserByMobileAndParkId(String phoneNumber, String parkId); } 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 dfa6970..25525d0 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 @@ -293,6 +293,8 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl ids = new ArrayList<>(); diff --git a/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/ReservationServeServiceImpl.java b/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/ReservationServeServiceImpl.java new file mode 100644 index 0000000..a77aac6 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/ReservationServeServiceImpl.java @@ -0,0 +1,101 @@ +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.ReservationServeMapper; +import com.ics.admin.domain.meeting.ReservationServe; +import com.ics.admin.service.meeting.IReservationServeService; + +/** + * 预约服务关联Service业务层处理 + * + * @author chen + * @date 2024-06-26 + */ +@Service +public class ReservationServeServiceImpl extends ServiceImpl implements IReservationServeService { + @Autowired + private ReservationServeMapper reservationServeMapper; + + /** + * 查询预约服务关联 + * + * @param id 预约服务关联ID + * @return 预约服务关联 + */ + @Override + public ReservationServe selectReservationServeById(Long id) { + return reservationServeMapper.selectById(id); + } + + /** + * 查询预约服务关联列表 + * + * @param reservationServe 预约服务关联 + * @return 预约服务关联 + */ + @Override + public List selectReservationServeList(ReservationServe reservationServe) { + QueryWrapper queryWrapper = new QueryWrapper(); + return reservationServeMapper.selectList(queryWrapper); + } + + /** + * 新增预约服务关联 + * + * @param reservationServe 预约服务关联 + * @return 结果 + */ + @Override + public int insertReservationServe(ReservationServe reservationServe) { + return reservationServeMapper.insert(reservationServe); + } + + /** + * 修改预约服务关联 + * + * @param reservationServe 预约服务关联 + * @return 结果 + */ + @Override + public int updateReservationServe(ReservationServe reservationServe) { + return reservationServeMapper.updateById(reservationServe); + } + + /** + * 删除预约服务关联对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteReservationServeByIds(String ids) { + String[] idsArray = StrUtil.split(ids,","); + return reservationServeMapper.deleteBatchIds(CollUtil.toList(idsArray)); + } + + /** + * 删除预约服务关联信息 + * + * @param id 预约服务关联ID + * @return 结果 + */ + @Override + public int deleteReservationServeById(Long id) { + return reservationServeMapper.deleteReservationServeById(id); + } + + @Override + public List selectReservationServeByReservationId(Long id) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("reservation_id",id); + return reservationServeMapper.selectList(queryWrapper); + } + +} diff --git a/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/RoomContentServiceImpl.java b/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/RoomContentServiceImpl.java index bb9e535..6a01c93 100644 --- a/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/RoomContentServiceImpl.java +++ b/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/RoomContentServiceImpl.java @@ -343,6 +343,13 @@ public class RoomContentServiceImpl extends ServiceImpl selectRoomItemByRoomList(RoomItemByRoom roomItemByRoom) { QueryWrapper queryWrapper = new QueryWrapper(); queryWrapper.eq(roomItemByRoom.getRoomContentId() !=null,"room_content_id",roomItemByRoom.getRoomContentId()); + queryWrapper.eq(roomItemByRoom.getParkId() !=null,"park_id",roomItemByRoom.getParkId()); return roomItemByRoomMapper.selectList(queryWrapper); } diff --git a/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/StaffCustomerServiceImpl.java b/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/StaffCustomerServiceImpl.java index b00c3e6..07791f6 100644 --- a/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/StaffCustomerServiceImpl.java +++ b/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/StaffCustomerServiceImpl.java @@ -106,4 +106,10 @@ public class StaffCustomerServiceImpl extends ServiceImpl selectStaffCustomerByStaffIdAndParkId(Long id, String parkId) { + + return staffCustomerMapper.selectStaffCustomerByStaffIdAndParkId(id,parkId); + } } diff --git a/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/StaffOpenServiceImpl.java b/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/StaffOpenServiceImpl.java new file mode 100644 index 0000000..d2b82d2 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/service/impl/meeting/StaffOpenServiceImpl.java @@ -0,0 +1,107 @@ +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.StaffOpenMapper; +import com.ics.admin.domain.meeting.StaffOpen; +import com.ics.admin.service.meeting.IStaffOpenService; + +/** + * 用户和小程序关联Service业务层处理 + * + * @author ics + * @date 2024-06-25 + */ +@Service +public class StaffOpenServiceImpl extends ServiceImpl implements IStaffOpenService { + @Autowired + private StaffOpenMapper staffOpenMapper; + + /** + * 查询用户和小程序关联 + * + * @param id 用户和小程序关联ID + * @return 用户和小程序关联 + */ + @Override + public StaffOpen selectStaffOpenById(Long id) { + return staffOpenMapper.selectById(id); + } + + /** + * 查询用户和小程序关联列表 + * + * @param staffOpen 用户和小程序关联 + * @return 用户和小程序关联 + */ + @Override + public List selectStaffOpenList(StaffOpen staffOpen) { + QueryWrapper queryWrapper = new QueryWrapper(); + return staffOpenMapper.selectList(queryWrapper); + } + + /** + * 新增用户和小程序关联 + * + * @param staffOpen 用户和小程序关联 + * @return 结果 + */ + @Override + public int insertStaffOpen(StaffOpen staffOpen) { + return staffOpenMapper.insert(staffOpen); + } + + /** + * 修改用户和小程序关联 + * + * @param staffOpen 用户和小程序关联 + * @return 结果 + */ + @Override + public int updateStaffOpen(StaffOpen staffOpen) { + return staffOpenMapper.updateById(staffOpen); + } + + /** + * 删除用户和小程序关联对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteStaffOpenByIds(String ids) { + String[] idsArray = StrUtil.split(ids,","); + return staffOpenMapper.deleteBatchIds(CollUtil.toList(idsArray)); + } + + /** + * 删除用户和小程序关联信息 + * + * @param id 用户和小程序关联ID + * @return 结果 + */ + @Override + public int deleteStaffOpenById(Long id) { + return staffOpenMapper.deleteStaffOpenById(id); + } + + @Override + public StaffOpen selectStaffOpenByOpenId(String openid) { + + return staffOpenMapper.selectStaffOpenByOpenId(openid); + } + + + + @Override + public StaffOpen selectStaffOpenByStaffIdAndOpenId(Long id, String openId) { + return staffOpenMapper.selectStaffOpenByStaffIdAndOpenId(id,openId); + } + + +} diff --git a/ics-admin/src/main/java/com/ics/admin/service/meeting/IReservationServeService.java b/ics-admin/src/main/java/com/ics/admin/service/meeting/IReservationServeService.java new file mode 100644 index 0000000..2024887 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/service/meeting/IReservationServeService.java @@ -0,0 +1,63 @@ +package com.ics.admin.service.meeting; + +import com.ics.admin.domain.meeting.ReservationServe; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * 预约服务关联Service接口 + * + * @author chen + * @date 2024-06-26 + */ +public interface IReservationServeService extends IService { + /** + * 查询预约服务关联 + * + * @param id 预约服务关联ID + * @return 预约服务关联 + */ + ReservationServe selectReservationServeById(Long id); + + /** + * 查询预约服务关联列表 + * + * @param reservationServe 预约服务关联 + * @return 预约服务关联集合 + */ + List selectReservationServeList(ReservationServe reservationServe); + + /** + * 新增预约服务关联 + * + * @param reservationServe 预约服务关联 + * @return 结果 + */ + int insertReservationServe(ReservationServe reservationServe); + + /** + * 修改预约服务关联 + * + * @param reservationServe 预约服务关联 + * @return 结果 + */ + int updateReservationServe(ReservationServe reservationServe); + + /** + * 批量删除预约服务关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + int deleteReservationServeByIds(String ids); + + /** + * 删除预约服务关联信息 + * + * @param id 预约服务关联ID + * @return 结果 + */ + int deleteReservationServeById(Long id); + + List selectReservationServeByReservationId(Long id); +} diff --git a/ics-admin/src/main/java/com/ics/admin/service/meeting/IStaffCustomerService.java b/ics-admin/src/main/java/com/ics/admin/service/meeting/IStaffCustomerService.java index 500eb08..c6d8cf1 100644 --- a/ics-admin/src/main/java/com/ics/admin/service/meeting/IStaffCustomerService.java +++ b/ics-admin/src/main/java/com/ics/admin/service/meeting/IStaffCustomerService.java @@ -62,4 +62,6 @@ public interface IStaffCustomerService extends IService { List selectStaffCustomerByStaffId(Long id); StaffCustomer selectStaffIdAndCustomerId(Long icsCustomerId, Long staffId); + + List selectStaffCustomerByStaffIdAndParkId(Long id, String parkId); } diff --git a/ics-admin/src/main/java/com/ics/admin/service/meeting/IStaffOpenService.java b/ics-admin/src/main/java/com/ics/admin/service/meeting/IStaffOpenService.java new file mode 100644 index 0000000..2bd3011 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/service/meeting/IStaffOpenService.java @@ -0,0 +1,66 @@ +package com.ics.admin.service.meeting; + +import com.ics.admin.domain.meeting.StaffOpen; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * 用户和小程序关联Service接口 + * + * @author ics + * @date 2024-06-25 + */ +public interface IStaffOpenService extends IService { + /** + * 查询用户和小程序关联 + * + * @param id 用户和小程序关联ID + * @return 用户和小程序关联 + */ + StaffOpen selectStaffOpenById(Long id); + + /** + * 查询用户和小程序关联列表 + * + * @param staffOpen 用户和小程序关联 + * @return 用户和小程序关联集合 + */ + List selectStaffOpenList(StaffOpen staffOpen); + + /** + * 新增用户和小程序关联 + * + * @param staffOpen 用户和小程序关联 + * @return 结果 + */ + int insertStaffOpen(StaffOpen staffOpen); + + /** + * 修改用户和小程序关联 + * + * @param staffOpen 用户和小程序关联 + * @return 结果 + */ + int updateStaffOpen(StaffOpen staffOpen); + + /** + * 批量删除用户和小程序关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + int deleteStaffOpenByIds(String ids); + + /** + * 删除用户和小程序关联信息 + * + * @param id 用户和小程序关联ID + * @return 结果 + */ + int deleteStaffOpenById(Long id); + + StaffOpen selectStaffOpenByOpenId(String openid); + + StaffOpen selectStaffOpenByStaffIdAndOpenId(Long id, String openId); + +} diff --git a/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml b/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml index 35a9691..4d55dda 100644 --- a/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml +++ b/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml @@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -38,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT id, username, mobile, create_by, create_time, update_by,name,photo,address,email,degree,urgent, update_time, delete_flag, ics_customer_id, openid, avatar, gender, status, park_id,card_no, visit_time, - leave_time,visit_content,to_name,to_phone,to_customer,to_customer_id,data_type + leave_time,visit_content,to_name,to_phone,to_customer,to_customer_id,data_type,park_id,tenant_id FROM ics_customer_staff @@ -212,6 +213,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" group by cs.id + diff --git a/ics-admin/src/main/resources/mapper/admin/meeting/ReservationMapper.xml b/ics-admin/src/main/resources/mapper/admin/meeting/ReservationMapper.xml index 88940d9..0050964 100644 --- a/ics-admin/src/main/resources/mapper/admin/meeting/ReservationMapper.xml +++ b/ics-admin/src/main/resources/mapper/admin/meeting/ReservationMapper.xml @@ -33,11 +33,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + SELECT id, room_content_id, user_id, ticket_id, - customer_id, title, stauts,serve_id,end_date, is_after_sale, + customer_id, title, stauts,serve_id,end_date, is_after_sale,person_num, oder_number,reservation_number, order_money, cancel_time,prepay_id, cancel_resaon, visit_type, explain_need_type, meeting_need_type, photograph_type, start_time, delete_flag, create_by, create_time, update_by, update_time, remake FROM tb_reservation @@ -109,6 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, update_time, remake, + person_num, #{id}, @@ -139,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, #{updateTime}, #{remake}, + #{personNum}, @@ -172,6 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, update_time = #{updateTime}, remake = #{remake}, + person_num = #{personNum}, WHERE id = #{id} diff --git a/ics-admin/src/main/resources/mapper/admin/meeting/StaffCustomerMapper.xml b/ics-admin/src/main/resources/mapper/admin/meeting/StaffCustomerMapper.xml index edd5f01..043463e 100644 --- a/ics-admin/src/main/resources/mapper/admin/meeting/StaffCustomerMapper.xml +++ b/ics-admin/src/main/resources/mapper/admin/meeting/StaffCustomerMapper.xml @@ -33,6 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE staff_id = #{id} + INSERT INTO tb_staff_customer diff --git a/ics-admin/src/main/resources/mapper/admin/meeting/StaffOpenMapper.xml b/ics-admin/src/main/resources/mapper/admin/meeting/StaffOpenMapper.xml new file mode 100644 index 0000000..d6d0b00 --- /dev/null +++ b/ics-admin/src/main/resources/mapper/admin/meeting/StaffOpenMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + SELECT id, openid, staff_id, create_time, delete_flag, create_by, tenant_id, park_id FROM tb_staff_open + + + + + + + + + + + INSERT INTO tb_staff_open + + openid, + staff_id, + create_time, + delete_flag, + create_by, + tenant_id, + park_id, + + + #{openid}, + #{staffId}, + #{createTime}, + #{deleteFlag}, + #{createBy}, + #{tenantId}, + #{parkId}, + + + + + UPDATE tb_staff_open + + openid = #{openid}, + staff_id = #{staffId}, + create_time = #{createTime}, + delete_flag = #{deleteFlag}, + create_by = #{createBy}, + tenant_id = #{tenantId}, + park_id = #{parkId}, + + WHERE id = #{id} + + + + DELETE FROM tb_staff_open WHERE id = #{id} + + + + DELETE FROM tb_staff_open where id in + + #{id} + + + + \ No newline at end of file diff --git a/ics-common/ics-common-core/src/main/java/com/ics/common/utils/DeviceUtils.java b/ics-common/ics-common-core/src/main/java/com/ics/common/utils/DeviceUtils.java index 71e4c9e..3e891f2 100644 --- a/ics-common/ics-common-core/src/main/java/com/ics/common/utils/DeviceUtils.java +++ b/ics-common/ics-common-core/src/main/java/com/ics/common/utils/DeviceUtils.java @@ -355,4 +355,12 @@ public class DeviceUtils { } + public static String openControlLock(String ip) { + String url = "http://192.168.30.36:808/api/Op/OpDoor?ipaddress="+ip; + String msg = HttpUtil.get(url); + log.info("查询人员id:{}", msg); + return msg; + } + + } diff --git a/ics-web/src/main/java/com/ics/controller/mobile/SmallWxOkHttp.java b/ics-web/src/main/java/com/ics/controller/mobile/SmallWxOkHttp.java index dda5c21..4f4f9c8 100644 --- a/ics-web/src/main/java/com/ics/controller/mobile/SmallWxOkHttp.java +++ b/ics-web/src/main/java/com/ics/controller/mobile/SmallWxOkHttp.java @@ -1,10 +1,14 @@ package com.ics.controller.mobile; +import cn.hutool.core.date.DateUtil; +import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import okhttp3.*; +import org.springframework.web.client.RestTemplate; import java.io.IOException; +import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -13,12 +17,12 @@ public class SmallWxOkHttp { static String APP_ID = "wx5582a07c1fbbcf06"; static String SECRET = "ad24130a8919c613efd9538f69abafd3"; - public static JSONObject sendGet(String url , Map map){ + public static JSONObject sendGet(String url, Map map) { OkHttpClient client = new OkHttpClient(); // 创建url HttpUrl.Builder urlBuilder = HttpUrl.parse(url).newBuilder(); // 添加参数 - if(map != null){ + if (map != null) { for (Map.Entry entry : map.entrySet()) { urlBuilder.addQueryParameter(entry.getKey(), entry.getValue()); } @@ -31,15 +35,15 @@ public class SmallWxOkHttp { Response response = client.newCall(request).execute(); String resultStr = response.body().string(); System.out.println(resultStr); - return JSON.parseObject(resultStr); + return JSON.parseObject(resultStr); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException(e); } } - public static JSONObject sendPost(String url, Map paramMap) { - if(paramMap == null){ + public static JSONObject sendPost(String url, Map paramMap) { + if (paramMap == null) { paramMap = new HashMap<>(); } String jsonString = JSON.toJSONString(paramMap); @@ -55,7 +59,7 @@ public class SmallWxOkHttp { Response response = call.execute(); String resultStr = response.body().string(); System.out.println(resultStr); - return JSON.parseObject(resultStr); + return JSON.parseObject(resultStr); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException(e); @@ -65,7 +69,7 @@ public class SmallWxOkHttp { /** * 获取AccessToken */ - public static String getAccessToken(String appId, String secret){ + public static String getAccessToken(String appId, String secret) { // url String url = "https://api.weixin.qq.com/cgi-bin/token"; // 参数 @@ -75,15 +79,15 @@ public class SmallWxOkHttp { map.put("secret", secret); // 发送请求 JSONObject jsonObject = sendGet(url, map); - String accessToken = jsonObject.getString("access_token"); - String expiresIn = jsonObject.getString("expires_in"); + String accessToken = jsonObject.getString("access_token"); + String expiresIn = jsonObject.getString("expires_in"); return accessToken; } /** * 小程序登录 */ - public static JSONObject code2Session(String jsCode,String appId,String secret){ + public static JSONObject code2Session(String jsCode, String appId, String secret) { // url String url = "https://api.weixin.qq.com/sns/jscode2session"; // 参数 @@ -100,7 +104,7 @@ public class SmallWxOkHttp { /** * 获取手机号 */ - public static JSONObject getPhoneNumber(String code, String openid, String accessToken){ + public static JSONObject getPhoneNumber(String code, String openid, String accessToken) { // url String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + accessToken; // 参数 @@ -113,9 +117,74 @@ public class SmallWxOkHttp { } - public static void main(String[] args) { -// getAccessToken(); - getPhoneNumber("", "", "74_NGF_xru4Mt5gDVperBd9LYwtMjWaXGb7JNleZ-nqSOSGvtW3vIGYKkFY0ymMFn2aLYZaN9d1rAZ65X5X-mGX556bWQWFy1mawkWUorOvz37QH34q2YBJjsDCih8FYOfAHAWPF"); + /* + * 发送模板 + * + * name01 :{ + * value : + * } + */ + public static String push() { + + JSONObject map = new JSONObject(); + + JSONObject jsonObject = new JSONObject(); + JSONObject thing1 = new JSONObject(); + thing1.put("value","123456"); + jsonObject.put("thing1",thing1); + JSONObject time2 = new JSONObject(); + time2.put("value","2022-01-01 12:00:00"); + jsonObject.put("time2",time2); + JSONObject thing3 = new JSONObject(); + thing3.put("value","789"); + jsonObject.put("thing3",thing3); + + map.put("touser", "o0_yY69LcLUi_x62WyH5Wvpe0tsA"); + map.put("template_id", "lSuc6ocmiPVoXP7ohyJ38wAqZKP2Nn-rhjCxM9JjvBI"); + + map.put("page","/page/index/index"); + map.put("miniprogram_state","formal"); + map.put("lang","zh_CN"); + map.put("data",jsonObject); + + System.out.println(map); + + + String result = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+getAccessToken(APP_ID,SECRET)) + .body(map.toString()).timeout(30*1000).execute().body(); + + JSONObject jsonObject1 = JSON.parseObject(result); + System.out.println(jsonObject1); +// Boolean success = Boolean.valueOf(jsonObject1.getString("success")); +// log.info("情景面板接口返回结果:{}",jsonObject1); +// +// log.info(DateUtil.date()+" -------情景面板接口结果:{}",success); + + +// String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+getAccessToken(APP_ID,SECRET); +// + +// +// System.out.println("-------"+jsonObject); +// Map map = new HashMap<>(); +// map.put("touser", "o0_yY69LcLUi_x62WyH5Wvpe0tsA"); +// map.put("template_id", "lSuc6ocmiPVoXP7ohyJ38wAqZKP2Nn-rhjCxM9JjvBI"); +// +// map.put("page","/page/index/index"); +// map.put("miniprogram_state","formal"); +// map.put("lang","zh_CN"); +// map.put("data",jsonObject.toString()); +// System.out.println(map); +//// return new JSONObject(); +// JSONObject jsonObject1 = sendPost(url, map); + return "jsonObject1"; } -} + + public static void main (String[]args){ + push(); +// getAccessToken(); +// getPhoneNumber("", "", "74_NGF_xru4Mt5gDVperBd9LYwtMjWaXGb7JNleZ-nqSOSGvtW3vIGYKkFY0ymMFn2aLYZaN9d1rAZ65X5X-mGX556bWQWFy1mawkWUorOvz37QH34q2YBJjsDCih8FYOfAHAWPF"); + } + + } diff --git a/ics-web/src/main/java/com/ics/controller/mobile/WxLoginAPIController.java b/ics-web/src/main/java/com/ics/controller/mobile/WxLoginAPIController.java index b820bc9..d3cbedb 100644 --- a/ics-web/src/main/java/com/ics/controller/mobile/WxLoginAPIController.java +++ b/ics-web/src/main/java/com/ics/controller/mobile/WxLoginAPIController.java @@ -3,14 +3,12 @@ package com.ics.controller.mobile; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; 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.StaffCustomer; -import com.ics.admin.domain.meeting.UserEquipment; +import com.ics.admin.domain.meeting.*; import com.ics.admin.service.ICustomerService; import com.ics.admin.service.IIcsCustomerStaffService; import com.ics.admin.service.IParkService; @@ -84,6 +82,9 @@ public class WxLoginAPIController extends BaseController { @Autowired private IStaffCustomerService staffCustomerService; + @Autowired + private IStaffOpenService staffOpenService; + String smallWxAccessTokenKey = "smallWxAccessToken"; String smallWxUserPassword = "123456"; @@ -102,30 +103,32 @@ public class WxLoginAPIController extends BaseController { throw new RuntimeException("请传递jsCode"); } // 小程序登录 - JSONObject sessionObject = SmallWxOkHttp.code2Session(jsCode,appId,appSecret); + JSONObject sessionObject = SmallWxOkHttp.code2Session(jsCode, appId, appSecret); String openid = sessionObject.getString("openid"); - String unionid = sessionObject.getString("unionid"); // R ajax = R.ok(); // 校验用户是否存在 - IcsCustomerStaff sysUser = icsCustomerStaffService.selectUserByOpenid(openid); + StaffOpen staffOpen = staffOpenService.selectStaffOpenByOpenId(openid); // 用户存在直接获取token - if (sysUser != null) { - Long parkId = sysUser.getParkId(); - if (parkId != null) { - Park park = parkService.selectParkById(parkId); - sysUser.setParkName(park.getName()); - } - String phonenumber = sysUser.getMobile(); - User user = new User(); - PublishFactory.recordLoginInfo(sysUser.getUsername(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); - BeanUtils.copyBeanProp(user, sysUser); - Map token = tokenService.createToken(user); - ajax.put(Constants.TOKEN, token); -// ajax.put(Constants.TOKEN, token); - ajax.put("user", sysUser); - ajax.put("openid", openid); + if (staffOpen != null) { + IcsCustomerStaff sysUser = icsCustomerStaffService.selectIcsCustomerStaffById(staffOpen.getStaffId()); + if (null != sysUser) { + Long parkId = sysUser.getParkId(); + if (parkId != null) { + Park park = parkService.selectParkById(parkId); + sysUser.setParkName(park.getName()); + } + User user = new User(); + PublishFactory.recordLoginInfo(sysUser.getUsername(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); + BeanUtils.copyBeanProp(user, sysUser); + Map token = tokenService.createToken(user); + ajax.put(Constants.TOKEN, token); + ajax.put("user", sysUser); + ajax.put("openid", openid); + return ajax; + } + ajax.put("openid", openid); return ajax; } else { // 用户不存在返回openid进行注册登录 ajax.put("openid", openid); @@ -134,6 +137,77 @@ public class WxLoginAPIController extends BaseController { } + @PostMapping("/changyang_user_login/login") + public R userLogin(@RequestBody Map paramMap) { + // 参数 + String code = paramMap.get("code"); + String openid = paramMap.get("openid"); + String appId = paramMap.get("appId"); + String appSecret = paramMap.get("appSecret"); + String parkId = paramMap.get("parkId"); + String tenantId = paramMap.get("tenantId"); + // 必填 + if (StringUtils.isBlank(code)) { + throw new RuntimeException("请传递code"); + } + if (StringUtils.isBlank(openid)) { + throw new RuntimeException("请传递openid"); + } + // 获取微信小程序 AccessToken + String smallWxAccessToken = getSmallWxAccessToken(appId, appSecret); + // 获取手机号 + JSONObject jsonObj = SmallWxOkHttp.getPhoneNumber(code, openid, smallWxAccessToken); + JSONObject phoneInfo = jsonObj.getJSONObject("phone_info"); + // 手机号 + String phoneNumber = phoneInfo.getString("phoneNumber"); + IcsCustomerStaff icsCustomerStaff = new IcsCustomerStaff(); + icsCustomerStaff.setMobile(phoneNumber); + // 需要根据手机号 查询对应的用户。 + + IcsCustomerStaff customerStaff1 = icsCustomerStaffService.selectUserByMobile(phoneNumber); + //如果手机号等于null 就新增用户 + if (null == customerStaff1) { + Assert.isTrue(false, "外部人员注册,请联系管理员"); + return R.error("外部人员注册,请联系管理员"); + } else { + + List staffCustomers = staffCustomerService.selectStaffCustomerByStaffIdAndParkId(customerStaff1.getId(),parkId); + if (CollUtil.isEmpty(staffCustomers)) { + Assert.isTrue(false, "外部人员注册,请联系管理员"); + return R.error("外部人员注册,请联系管理员"); + } + + + StaffOpen staffOpen = staffOpenService.selectStaffOpenByOpenId(openid); + if (null == staffOpen) { + StaffOpen staffOpen1 = new StaffOpen(); + staffOpen1.setOpenid(openid); + staffOpen1.setStaffId(customerStaff1.getId()); + staffOpen1.setParkId(Long.valueOf(parkId)); + staffOpen1.setTenantId(Long.valueOf(tenantId)); + staffOpenService.insertStaffOpen(staffOpen1); + } + + icsCustomerStaffService.updateIcsCustomerStaff(customerStaff1); + User user = new User(); + PublishFactory.recordLoginInfo(customerStaff1.getUsername(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); + BeanUtils.copyBeanProp(user, customerStaff1); + Map token = tokenService.createToken(user); + R ajax = R.ok(); + ajax.put(Constants.TOKEN, token); + ajax.put("user", user); + ajax.put("openid", openid); + return ajax; + } + } + + + /** + * 郑州授权登录 + * + * @param paramMap + * @return + */ @PostMapping("/social_user_login/login") public R social(@RequestBody Map paramMap) { try { @@ -142,6 +216,8 @@ public class WxLoginAPIController extends BaseController { String openid = paramMap.get("openid"); String appId = paramMap.get("appId"); String appSecret = paramMap.get("appSecret"); + String parkId = paramMap.get("parkId"); + String tenantId = paramMap.get("tenantId"); // 必填 if (StringUtils.isBlank(code)) { throw new RuntimeException("请传递code"); @@ -150,7 +226,7 @@ public class WxLoginAPIController extends BaseController { throw new RuntimeException("请传递openid"); } // 获取微信小程序 AccessToken - String smallWxAccessToken = getSmallWxAccessToken(appId,appSecret); + String smallWxAccessToken = getSmallWxAccessToken(appId, appSecret); // 获取手机号 JSONObject jsonObj = SmallWxOkHttp.getPhoneNumber(code, openid, smallWxAccessToken); JSONObject phoneInfo = jsonObj.getJSONObject("phone_info"); @@ -159,9 +235,12 @@ public class WxLoginAPIController extends BaseController { IcsCustomerStaff icsCustomerStaff = new IcsCustomerStaff(); icsCustomerStaff.setMobile(phoneNumber); //todo 需要根据手机号和对应的openId 查询对应的用户。 - IcsCustomerStaff customerStaff = icsCustomerStaffService.selectByPhoneAndOpenId(phoneNumber,openid); + IcsCustomerStaff customerStaff = icsCustomerStaffService.selectUserByMobile(phoneNumber); if (customerStaff != null) { - if (StringUtils.isBlank(customerStaff.getOpenid())) { + + StaffOpen staffOpen = staffOpenService.selectStaffOpenByStaffIdAndOpenId(customerStaff.getId(),openid); + + if (staffOpen != null) { // 根据 用户绑定的企业 绑定对应的设备 ArrayList ids = new ArrayList<>(); Customer customer = customerService.selectCustomerById(customerStaff.getIcsCustomerId()); @@ -195,15 +274,20 @@ public class WxLoginAPIController extends BaseController { userEquipmentService.insertUserEquipment(userEquipment); } } - customerStaff.setOpenid(openid); - icsCustomerStaffService.updateIcsCustomerStaff(customerStaff); + }else { + StaffOpen staffOpen1 = new StaffOpen(); + staffOpen1.setOpenid(openid); + staffOpen1.setStaffId(customerStaff.getId()); +// staffOpen1.setParkId(Long.valueOf(parkId)); +// staffOpen1.setTenantId(Long.valueOf(tenantId)); + staffOpenService.insertStaffOpen(staffOpen1); } - Long parkId = customerStaff.getParkId(); if (parkId != null) { - Park park = parkService.selectParkById(parkId); + Park park = parkService.selectParkById(Long.valueOf(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); @@ -217,35 +301,53 @@ public class WxLoginAPIController extends BaseController { // 新增用户信息 // todo 现根据手机号查询对应的数据。如果存在则不新增,如果不存在则新增 - IcsCustomerStaff customerStaff1 = icsCustomerStaffService.selectUserByMobile(phoneNumber); - //如果手机号等于null 就新增用户 - if (null == customerStaff1) { - icsCustomerStaff.setUsername(phoneNumber); - icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT); - icsCustomerStaff.setOpenid(openid); - icsCustomerStaff.setGender("0"); - icsCustomerStaff.setStatus("0"); - int i = icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff); - Map token = tokenService.createStaffToken(icsCustomerStaff); - R ajax = R.ok(); - ajax.put(Constants.TOKEN, token); - ajax.put("user", icsCustomerStaff); - ajax.put("openid", openid); - return ajax; - }else { - String openid1 = customerStaff1.getOpenid(); - customerStaff1.setOpenid(openid1 + ","+openid); - icsCustomerStaffService.updateIcsCustomerStaff(customerStaff1); - User user = new User(); - PublishFactory.recordLoginInfo(customerStaff1.getUsername(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); - BeanUtils.copyBeanProp(user, customerStaff1); - Map token = tokenService.createToken(user); - R ajax = R.ok(); - ajax.put(Constants.TOKEN, token); - ajax.put("user", user); - ajax.put("openid", openid); - return ajax; - } + icsCustomerStaff.setUsername(phoneNumber); + icsCustomerStaff.setGender("0"); + icsCustomerStaff.setStatus("0"); + int i = icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff); + + StaffOpen staffOpen1 = new StaffOpen(); + staffOpen1.setOpenid(openid); + staffOpen1.setStaffId(icsCustomerStaff.getId()); +// staffOpen1.setParkId(Long.valueOf(parkId)); +// staffOpen1.setTenantId(Long.valueOf(tenantId)); + staffOpenService.insertStaffOpen(staffOpen1); + + Map token = tokenService.createStaffToken(icsCustomerStaff); + R ajax = R.ok(); + ajax.put(Constants.TOKEN, token); + ajax.put("user", icsCustomerStaff); + ajax.put("openid", openid); + + +// IcsCustomerStaff customerStaff1 = icsCustomerStaffService.selectUserByMobile(phoneNumber); +// //如果手机号等于null 就新增用户 +// if (null == customerStaff1) { +// icsCustomerStaff.setUsername(phoneNumber); +// icsCustomerStaff.setDataType(Constants.CUSTOMER_VISIT); +// icsCustomerStaff.setOpenid(openid); +// icsCustomerStaff.setGender("0"); +// icsCustomerStaff.setStatus("0"); +// int i = icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff); +// Map token = tokenService.createStaffToken(icsCustomerStaff); +// R ajax = R.ok(); +// ajax.put(Constants.TOKEN, token); +// ajax.put("user", icsCustomerStaff); +// ajax.put("openid", openid); +// return ajax; +// } else { +// String openid1 = customerStaff1.getOpenid(); +// customerStaff1.setOpenid(openid1 + "," + openid); +// icsCustomerStaffService.updateIcsCustomerStaff(customerStaff1); +// User user = new User(); +// PublishFactory.recordLoginInfo(customerStaff1.getUsername(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); +// BeanUtils.copyBeanProp(user, customerStaff1); +// Map token = tokenService.createToken(user); +// R ajax = R.ok(); +// ajax.put(Constants.TOKEN, token); +// ajax.put("user", user); +// ajax.put("openid", openid); + return ajax; } } catch (Exception e) { log.error(e.getMessage(), e); @@ -262,7 +364,7 @@ public class WxLoginAPIController extends BaseController { String smallWxAccessToken = redisTemplate.opsForValue().get(smallWxAccessTokenKey); if (StringUtils.isBlank(smallWxAccessToken)) { smallWxAccessToken = SmallWxOkHttp.getAccessToken(appId, appSecret); - redisTemplate.opsForValue().set(smallWxAccessTokenKey, smallWxAccessToken, 7200, TimeUnit.SECONDS); + redisTemplate.opsForValue().set(appId + smallWxAccessTokenKey, appId + smallWxAccessToken, 7200, TimeUnit.SECONDS); } return smallWxAccessToken; } diff --git a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiEquipmentController.java b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiEquipmentController.java index 4bb63c5..5cf53d0 100644 --- a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiEquipmentController.java +++ b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiEquipmentController.java @@ -1,14 +1,9 @@ package com.ics.controller.mobile.meeting; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.DateUnit; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Assert; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.google.gson.Gson; -import com.ics.admin.controller.meeting.UserEquipmentController; import com.ics.admin.domain.meeting.*; import com.ics.admin.domain.meeting.vo.DeviceData; import com.ics.admin.service.meeting.*; @@ -16,9 +11,7 @@ import com.ics.common.core.controller.BaseController; import com.ics.common.core.domain.R; import com.ics.common.core.page.PageDomain; 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 com.ics.common.utils.StringUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -27,9 +20,7 @@ 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; -import java.util.concurrent.TimeUnit; @Slf4j @RestController @@ -60,44 +51,49 @@ public class ApiEquipmentController extends BaseController { //根据用户id查询对应的设备, 楼层分割,房间,设备信息, @RequiresPermissions("member:center:view") @GetMapping("/getEquipmentByUserId/{userId}") - public R getEquipmentByUserId(@PathVariable("userId") Long userId){ + public R getEquipmentByUserId(@PathVariable("userId") Long userId) { List equipments = userEquipmentService.getEquipmentByUserId(userId); - - return R.ok().put("data",equipments); + return R.ok().put("data", equipments); } /** - * 开门 + * 开门 */ @RequiresPermissions("member:center:view") @PostMapping("/openDoor") - public R openDoor(@RequestBody RoomRecord roomRecord){ + public R openDoor(@RequestBody RoomRecord roomRecord) { //判断用户是否有权限开门 UserEquipment userEquipment1 = new UserEquipment(); userEquipment1.setEquipmentId(roomRecord.getDeviceId()); userEquipment1.setUserId(roomRecord.getUserId()); - int count =userEquipmentService.selectCountByUserIdAndDeviceId(userEquipment1); + int count = userEquipmentService.selectCountByUserIdAndDeviceId(userEquipment1); - if (count == 0){ + if (count == 0) { return R.error("您没有权限开门,不在开门时间内"); } - String ip = equipmentService.selectEquipmentById(roomRecord.getDeviceId()).getIp(); + Equipment equipment = equipmentService.selectEquipmentById(roomRecord.getDeviceId()); + if (equipment.getType() == 0){ + String openlock = DeviceUtils.openlock(equipment.getIp()); + JSONObject jsonObject = JSONUtil.parseObj(openlock); + Integer code = (Integer) jsonObject.get("status"); + Assert.isTrue(code == 0, "开门失败"); - String openlock = DeviceUtils.openlock(ip); - JSONObject jsonObject = JSONUtil.parseObj(openlock); - Integer code = (Integer) jsonObject.get("status"); - Assert.isTrue(code == 0,"开门失败"); + }else if (equipment.getType() == 1){ + String openlock = DeviceUtils.openControlLock(equipment.getIp()); + log.info("开门控制器的结果为结果:{}", openlock);; + } roomRecord.setType("0"); int i = roomRecordService.insertRoomRecord(roomRecord); - Assert.isTrue(i == 1,"开门失败"); + Assert.isTrue(i == 1, "开门失败"); + return R.ok("开门成功"); } @@ -117,34 +113,35 @@ public class ApiEquipmentController extends BaseController { Equipment equipment = equipmentService.selectEquipmentById(record.getDeviceId()); record.setDeviceName(equipment.getEquipmentName()); } - return R.ok().put("data",openDoorRecord); + return R.ok().put("data", openDoorRecord); } /** * 获取对比记录,获取设备的对比记录,设备往服务端传输数据 - * @return + * */ @Ignore @PostMapping("/getEquipmentByUserIdAndEquipmentId") - public R getEquipmentByUserIdAndEquipmentId(@RequestBody DeviceData data){ + public R getEquipmentByUserIdAndEquipmentId(@RequestBody DeviceData data) { // 对比personId 和用户 id, // 对比equipmentId 和设备id - if (data.getData() != null && data.getData().getEventType() != 17 && StringUtils.isNotEmpty(data.getData().getPersonId())){ + if (data.getData() != null && data.getData().getEventType() != 17 && StringUtils.isNotEmpty(data.getData().getPersonId())) { //用户id String personId = data.getData().getPersonId(); String deviceId = data.getData().getDeviceId(); Equipment equipment = equipmentService.selectByDeviceCode(deviceId); - Assert.isTrue(equipment != null,"设备不存在"); + Assert.isTrue(equipment != null, "设备不存在"); RoomRecord record = new RoomRecord(); record.setUserId(Long.valueOf(personId)); - if (data.getData().getPersonType().equals("visitor")){ - VisitorPerson visitorPerson =visitorPersonService.selectByUserId(personId); + if (data.getData().getPersonType().equals("visitor")) { + VisitorPerson visitorPerson = visitorPersonService.selectByUserId(personId); record.setUserId(visitorPerson.getIntervieweeId()); } + assert equipment != null; record.setParkId(equipment.getParkId()); record.setType("1"); record.setDeviceId(equipment.getId()); @@ -161,61 +158,72 @@ public class ApiEquipmentController extends BaseController { /** - * 扫描二维码开门 开门控制器 用户id 和设备id + * 扫描二维码开门 开门控制器 用户id 和设备id */ @RequiresPermissions("member:center:view") @GetMapping("/scanOpenDoor") - public R scanOpenDoor( RoomRecord roomRecord){ + public R scanOpenDoor(RoomRecord roomRecord) { - log.info("用户id为{}",roomRecord.getUserId()); - log.info("房间id为{}",roomRecord.getRoomId()); + log.info("用户id为{}", roomRecord.getUserId()); + log.info("房间id为{}", roomRecord.getRoomId()); - if (roomRecord.getEquipmentType().equals("displayScreen")){ - Long deviceId = roomRecord.getDeviceId(); - Long userId = roomRecord.getUserId(); - UserEquipment userEquipment = userEquipmentService.selectUserAndEquipment(userId, deviceId); - if (null == userEquipment){ - return R.error("您没有该设备的权限"); + if (roomRecord.getEquipmentType().equals("displayScreen")) { +// Long deviceId = roomRecord.getDeviceId(); +// Long userId = roomRecord.getUserId(); + + UserEquipment userEquipment1 = new UserEquipment(); + userEquipment1.setEquipmentId(roomRecord.getDeviceId()); + userEquipment1.setUserId(roomRecord.getUserId()); + + + int count = userEquipmentService.selectCountByUserIdAndDeviceId(userEquipment1); + if (count == 0) { + return R.error("您没有权限开门"); } String ip = equipmentService.selectEquipmentById(roomRecord.getDeviceId()).getIp(); + String openlock = DeviceUtils.openlock(ip); + JSONObject jsonObject = JSONUtil.parseObj(openlock); + Integer code = (Integer) jsonObject.get("status"); + Assert.isTrue(code == 0, "开门失败"); - - - String openlock = DeviceUtils.openlock(ip); - JSONObject jsonObject = JSONUtil.parseObj(openlock); - Integer code = (Integer) jsonObject.get("status"); - Assert.isTrue(code == 0,"开门失败"); - - int i = roomRecordService.insertRoomRecord(roomRecord); - Assert.isTrue(i == 1,"开门失败"); + int i = roomRecordService.insertRoomRecord(roomRecord); + Assert.isTrue(i == 1, "开门失败"); } -// String openlock = DeviceUtils.openlock(ip); -// JSONObject jsonObject = JSONUtil.parseObj(openlock); -// Integer code = (Integer) jsonObject.get("status"); -// Assert.isTrue(code == 0,"开门失败"); -// -// int i = roomRecordService.insertRoomRecord(roomRecord); -// Assert.isTrue(i == 1,"开门失败"); + if (roomRecord.getEquipmentType().equals("control")) { + UserEquipment userEquipment1 = new UserEquipment(); + userEquipment1.setEquipmentId(roomRecord.getDeviceId()); + userEquipment1.setUserId(roomRecord.getUserId()); + + + int count = userEquipmentService.selectCountByUserIdAndDeviceId(userEquipment1); + if (count == 0) { + return R.error("您没有权限开门"); + } + + String ip = equipmentService.selectEquipmentById(roomRecord.getDeviceId()).getIp(); + + String openlock = DeviceUtils.openControlLock(ip); + log.info("开门控制器的结果为结果:{}", openlock);; + } return R.ok("开门成功"); } /** - * 扫描二维码开门 用户id 和设备id - * + * 扫描二维码开门 用户id 和设备id */ @Ignore @PostMapping("/scanDoor") - public R scanDoor(String ip ){ + public R scanDoor(String ip) { // todo 开门 // todo 获取ip后,key为ip,value为设备id 存入redis // 所有设备的ip都存入redis 里面 System.out.println(ip); - log.info("ip为{}",ip); + log.info("ip为{}", ip); return R.ok("开门成功"); } @@ -224,16 +232,16 @@ public class ApiEquipmentController extends BaseController { */ @Ignore @GetMapping("/isOpenDoor") - public R isOpenDoor(String ip ){ + public R isOpenDoor(String ip) { // 根据ip 去redis读取数据 - String smallWxAccessToken = redisTemplate.opsForValue().get(smallWxAccessTokenKey+ip); - if (StringUtils.isNotBlank(smallWxAccessToken)){ + String smallWxAccessToken = redisTemplate.opsForValue().get(smallWxAccessTokenKey + ip); + if (StringUtils.isNotBlank(smallWxAccessToken)) { Boolean delete = redisTemplate.delete(smallWxAccessTokenKey + ip); - if (delete){ + if (delete) { R.error("删除redis失败"); } return R.ok("开门成功"); - }else { + } else { return R.error("开门失败"); } } diff --git a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiRoomContentController.java b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiRoomContentController.java index 1f9ee7d..77df321 100644 --- a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiRoomContentController.java +++ b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiRoomContentController.java @@ -27,6 +27,7 @@ import com.ics.controller.mobile.pay.wx.dto.WxChatBasePayDto; import com.ics.controller.mobile.pay.wx.dto.WxChatPayDto; 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.math.BigDecimal; @@ -50,8 +51,6 @@ public class ApiRoomContentController extends BaseController { @Autowired private IReservationPersonService reservationPersonService; - @Autowired - private ICustomerService customerService; @Autowired private RoomContentMapper roomContentMapper; @@ -71,8 +70,7 @@ public class ApiRoomContentController extends BaseController { @Autowired private IParkService parkService; - @Autowired - private RoomEquipmentMapper roomEquipmentMapper; + @Autowired private IRoomEquipmentService roomEquipmentService; @@ -86,6 +84,12 @@ public class ApiRoomContentController extends BaseController { @Autowired private IDetailEquipmentService detailEquipmentService; + @Autowired + private IReservationServeService reservationServeService; + + @Autowired + private IRoomServeService roomServeService; + /** * 查询条件筛选 @@ -199,13 +203,42 @@ public class ApiRoomContentController extends BaseController { return R.ok().put("count", count).put("msg", msg); } + /** + * 上海会议预约记录 + */ + @RequiresPermissions("member:center:view") + @PostMapping("/saveChangyangMeetingRecord") + public R saveMeetingRoomRecord(@RequestBody Reservation reservation) { + reservation.setStauts(Reservation.Status.APPOINTMENT); + + + reservation.setOderNumber(RandomUtil.randomNumbers(18)); + boolean b = reservationService.selectFreeMeetingRoom(reservation); + Assert.isFalse(b, "会议室不可用"); + IcsCustomerStaff customerStaff = customerStaffService.selectIcsCustomerStaffById(reservation.getUserId()); + Assert.isTrue(customerStaff != null, "用户不存在"); + boolean save = reservationService.save(reservation); + Assert.isTrue(save, "预约失败"); + + //新增预约服务数据 + + for (ReservationServe reservationServe : reservation.getReservationServes()) { + reservationServe.setReservationId(reservation.getId()); + reservationServe.setParkId(reservation.getParkId()); + reservationServe.setTenantId(reservation.getTenantId()); + reservationServeService.insertReservationServe(reservationServe); + } + + Long id = reservation.getId(); + return toAjax(save).put("reservationId", id); + } /** * 提交会议预约记录 */ @RequiresPermissions("member:center:view") @PostMapping("/saveMeetingRecord") - public R getMeetingRoomRecord(@RequestBody Reservation reservation) { + public R saveMeetingRecord(@RequestBody Reservation reservation) { //根据用户获取对应的企业id,查询该企业下对应的优惠卷 reservation.setStauts(Reservation.Status.APPOINTMENT); @@ -418,15 +451,16 @@ public class ApiRoomContentController extends BaseController { if (buildingDetail != null) { roomContent.setBuildingName(buildingDetail.getFloorName() + "F"); } - //根据房间id查询设备 -// QueryWrapper wrapper = new QueryWrapper<>(); -// wrapper.eq("room_id", room.getId()); -// RoomEquipment roomEquipment = roomEquipmentMapper.selectOne(wrapper); -// if (roomEquipment != null) { -// roomContent.setEquipmentId(roomEquipment.getEquipmentId()); -// } } reservation.setRoomContent(roomContent); + + List reservationServes = reservationServeService.selectReservationServeByReservationId(reservation.getId()); + if (CollUtil.isNotEmpty(reservationServes)){ + for (ReservationServe reservationServe : reservationServes) { + reservationServe.setServeName(roomServeService.selectRoomServeById(reservationServe.getServeId()).getServeName()); + } + } + reservation.setReservationServes(reservationServes); return R.ok().put("data", reservation); } diff --git a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiRoomController.java b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiRoomController.java index 4f52fcf..5c7ea83 100644 --- a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiRoomController.java +++ b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiRoomController.java @@ -25,6 +25,7 @@ import org.wf.jwtp.annotation.Ignore; import org.wf.jwtp.annotation.RequiresPermissions; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -76,8 +77,13 @@ public class ApiRoomController extends BaseController { */ @Ignore @PostMapping("list") - public R list() { - List roomContents = roomContentService.selectApiRoomList(new RoomContent()); + public R list(@RequestBody HashMap map) { + Long parkId = map.get("parkId"); + RoomContent roomContent1 = new RoomContent(); + if (parkId != null){ + roomContent1.setParkId(parkId); + } + List roomContents = roomContentService.selectApiRoomList(roomContent1); for (RoomContent roomContent : roomContents) { RoomEquipment roomEquipment = roomEquipmentService.selectRoomId(roomContent.getRoomId()); if (null != roomEquipment){ @@ -115,7 +121,6 @@ public class ApiRoomController extends BaseController { @GetMapping("selectParkList") public R selectParkList(Long tenantId) { Park park = new Park(); - park.setTenantId(tenantId); List parkList = parkService.selectParkList(park); return R.data(parkList); } diff --git a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiShowroomController.java b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiShowroomController.java index bc77ff3..5dc814d 100644 --- a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiShowroomController.java +++ b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiShowroomController.java @@ -166,6 +166,12 @@ public class ApiShowroomController extends BaseController { showroomRecord.setCreateTime(new Date()); boolean save = recordService.save(showroomRecord); + if (showroomRecord.getParkId() == 25){ + + } + + + Long id = showroomRecord.getId(); return toAjax(save).put("showroomRecord",id); } @@ -173,7 +179,8 @@ public class ApiShowroomController extends BaseController { /** * 查询字典 */ - @RequiresPermissions("member:center:view") + @Ignore +// @RequiresPermissions("member:center:view") @PostMapping("/listByType") public R list(@RequestBody DictData dictData) { return R.ok().put("data",dictDataService.selectDictDataList(dictData));