新增了两个openId的问题,修改了服务预约记录的功能

This commit is contained in:
chendaze 2024-07-03 17:38:31 +08:00
parent 7abb49419b
commit 52cdfdfe21
35 changed files with 1420 additions and 271 deletions

View File

@ -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<StaffCustomer> 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<FacesDto> facesDtos = new ArrayList<>();
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
devicePersonDto.setName(customerStaff.getName());
devicePersonDto.setPhone(String.valueOf(customerStaff.getMobile()));
devicePersonDto.setCertificateType("111");
devicePersonDto.setCertificateNumber(customerStaff.getCardNo());
//添加人员类型
devicePersonDto.setPersonType("whitelist");
//添加访客时间
FacesDto facesDto = new FacesDto();
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
String photoUrl = url + customerStaff.getPhoto();
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
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<FacesDto> facesDtos = new ArrayList<>();
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
devicePersonDto.setName(customerStaff.getName());
devicePersonDto.setPhone(String.valueOf(customerStaff.getMobile()));
devicePersonDto.setCertificateType("111");
devicePersonDto.setCertificateNumber(customerStaff.getCardNo());
//添加人员类型
devicePersonDto.setPersonType("whitelist");
//添加访客时间
FacesDto facesDto = new FacesDto();
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
String photoUrl = url + customerStaff.getPhoto();
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
facesDto.setData(faceData);
facesDtos.add(facesDto);
devicePersonDto.setFaces(facesDtos);
String s = DeviceUtils.addPersons(equipment.getIp(), devicePersonDto);
log.info("添加人员返回结果:" + s);
} else {
//更新用户信息
if (icsCustomerStaff.getPhoto() != null) {
if (!icsCustomerStaff.getPhoto().equals(customer.getPhone())) {
DevicePersonDto devicePersonDto = new DevicePersonDto();
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
ArrayList<FacesDto> 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<FacesDto> 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<FacesDto> facesDtos = new ArrayList<>();
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
devicePersonDto.setName(customerStaff.getName());
devicePersonDto.setPhone(String.valueOf(customerStaff.getMobile()));
devicePersonDto.setCertificateType("111");
devicePersonDto.setCertificateNumber(customerStaff.getCardNo());
//添加人员类型
devicePersonDto.setPersonType("whitelist");
//添加访客时间
FacesDto facesDto = new FacesDto();
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
String photoUrl = url + customerStaff.getPhoto();
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
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<FacesDto> facesDtos = new ArrayList<>();
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
devicePersonDto.setName(customerStaff.getName());
devicePersonDto.setPhone(String.valueOf(customerStaff.getMobile()));
devicePersonDto.setCertificateType("111");
devicePersonDto.setCertificateNumber(customerStaff.getCardNo());
//添加人员类型
devicePersonDto.setPersonType("whitelist");
//添加访客时间
FacesDto facesDto = new FacesDto();
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
String photoUrl = url + customerStaff.getPhoto();
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
facesDto.setData(faceData);
facesDtos.add(facesDto);
devicePersonDto.setFaces(facesDtos);
String s = DeviceUtils.addPersons(equipment.getIp(), devicePersonDto);
log.info("添加人员返回结果:" + s);
} else {
//更新用户信息
if (icsCustomerStaff.getPhoto() != null) {
if (!icsCustomerStaff.getPhoto().equals(customer.getPhone())) {
DevicePersonDto devicePersonDto = new DevicePersonDto();
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
ArrayList<FacesDto> 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<FacesDto> 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<StaffCustomer> 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<FacesDto> facesDtos = new ArrayList<>();
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
devicePersonDto.setName(customerStaff.getName());
devicePersonDto.setPhone(String.valueOf(customerStaff.getMobile()));
devicePersonDto.setCertificateType("111");
devicePersonDto.setCertificateNumber(customerStaff.getCardNo());
//添加人员类型
devicePersonDto.setPersonType("whitelist");
//添加访客时间
FacesDto facesDto = new FacesDto();
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
String photoUrl = url + customerStaff.getPhoto();
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
Equipment equipment2 = equipmentService.selectEquipmentById(id);
if (equipment2 != null) {
if (equipment2.getType() == 0){
DevicePersonDto devicePersonDto = new DevicePersonDto();
ArrayList<FacesDto> facesDtos = new ArrayList<>();
devicePersonDto.setPersonId(String.valueOf(customerStaff.getId()));
devicePersonDto.setName(customerStaff.getName());
devicePersonDto.setPhone(String.valueOf(customerStaff.getMobile()));
devicePersonDto.setCertificateType("111");
devicePersonDto.setCertificateNumber(customerStaff.getCardNo());
//添加人员类型
devicePersonDto.setPersonType("whitelist");
//添加访客时间
FacesDto facesDto = new FacesDto();
facesDto.setFaceId(String.valueOf(customerStaff.getId()));
String photoUrl = url + customerStaff.getPhoto();
String faceData = BASE64_PREFIX + UrlToBase64Util.imageUrlToBase64(photoUrl);
facesDto.setData(faceData);
facesDtos.add(facesDto);
devicePersonDto.setFaces(facesDtos);
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);
}
}

View File

@ -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());

View File

@ -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));
}
}

View File

@ -274,21 +274,24 @@ public class RoomContentController extends BaseController {
List<Room> rooms = roomService.selectRoomList(room);
String customerId = room.getCustomerId();
Customer customer = customerService.selectCustomerById(Long.valueOf(customerId));
String roomId = customer.getRoomId();
List<String> 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<String> 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);
}

View File

@ -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));
}
}

View File

@ -0,0 +1,10 @@
package com.ics.admin.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
@AllArgsConstructor
@Data
public class TemplateData {
private String value;
}

View File

@ -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<String, TemplateData> data;//推送文字
}

View File

@ -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<Reservation> {
/** 优惠卷id */
private Long ticketId;
private Integer personNum;
@TableField(exist = false)
private String ticketName;
@ -52,6 +55,10 @@ public class Reservation extends BaseEntity<Reservation> {
@TableField(exist = false)
private Integer statusValue;
@TableField(exist = false)
private List<ReservationServe> reservationServes;
/** 预约状态 0待支付1.已预约2.进行中3已结束4.已取消 */
private Status stauts;
public enum Status implements IEnum<Integer> {
@ -189,4 +196,10 @@ public class Reservation extends BaseEntity<Reservation> {
@TableField(exist = false)
private String buildName;
private String createBy;
private Date createTime;
}

View File

@ -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<ReservationServe> {
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;
}

View File

@ -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<StaffOpen> {
private static final long serialVersionUID = 1L;
/** 企业id */
private String openid;
/** 用户id */
private Long staffId;
/** 园区ID */
private Long parkId;
}

View File

@ -77,4 +77,6 @@ public interface IcsCustomerStaffMapper extends BaseMapper<IcsCustomerStaff> {
List<IcsCustomerStaff> getUserList(IcsCustomerStaff customerStaff);
IcsCustomerStaff selectUserByMobileAndParkId(@Param("mobile") String phoneNumber, @Param("parkId") String parkId);
}

View File

@ -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<ReservationServe> {
/**
* 查询预约服务关联
*
* @param id 预约服务关联ID
* @return 预约服务关联
*/
ReservationServe selectReservationServeById(Long id);
/**
* 查询预约服务关联列表
*
* @param reservationServe 预约服务关联
* @return 预约服务关联集合
*/
List<ReservationServe> 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);
}

View File

@ -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<StaffCustomer> {
int deleteStaffCustomerByIds(String[] ids);
List<StaffCustomer> selectStaffCustomerByStaffId(Long id);
List<StaffCustomer> selectStaffCustomerByStaffIdAndParkId(@Param("staffId") Long id,@Param("parkId") String parkId);
}

View File

@ -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<StaffOpen> {
/**
* 查询用户和小程序关联
*
* @param id 用户和小程序关联ID
* @return 用户和小程序关联
*/
StaffOpen selectStaffOpenById(Long id);
/**
* 查询用户和小程序关联列表
*
* @param staffOpen 用户和小程序关联
* @return 用户和小程序关联集合
*/
List<StaffOpen> 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);
}

View File

@ -89,4 +89,6 @@ public interface IIcsCustomerStaffService extends IService<IcsCustomerStaff> {
IcsCustomerStaff selectByPhoneAndOpenId(String phoneNumber, String openid);
IcsCustomerStaff selectUserByMobile(String phone);
// IcsCustomerStaff selectUserByMobileAndParkId(String phoneNumber, String parkId);
}

View File

@ -293,6 +293,8 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMap
return icsCustomerStaffMapper.selectUserByMobile(phone);
}
//根据企业查询对应的设备
public void queryDeviceByCustomerId(Long customerId,Long userId){
ArrayList<Long> ids = new ArrayList<>();

View File

@ -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<ReservationServeMapper, ReservationServe> 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<ReservationServe> 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<ReservationServe> selectReservationServeByReservationId(Long id) {
QueryWrapper<ReservationServe> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("reservation_id",id);
return reservationServeMapper.selectList(queryWrapper);
}
}

View File

@ -343,6 +343,13 @@ public class RoomContentServiceImpl extends ServiceImpl<RoomContentMapper, RoomC
for (Reservation reservation1 : reservation) {
reservation1.setStatusValue(reservation1.getStauts().getValue());
reservation1.setStatusName(reservation1.getStauts().getName());
Long userId = reservation1.getUserId();
IcsCustomerStaff customerStaff = staffService.selectIcsCustomerStaffById(userId);
if (null != customerStaff){
reservation1.setUserName(customerStaff.getUsername());
reservation1.setPhone(customerStaff.getMobile());
}
}
reservationDTO.setReservations(reservation);
list.add(reservationDTO);

View File

@ -43,6 +43,7 @@ public class RoomItemByRoomServiceImpl extends ServiceImpl<RoomItemByRoomMapper,
public List<RoomItemByRoom> 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);
}

View File

@ -106,4 +106,10 @@ public class StaffCustomerServiceImpl extends ServiceImpl<StaffCustomerMapper, S
queryWrapper.eq("ics_customer_id",icsCustomerId);
return staffCustomerMapper.selectOne(queryWrapper);
}
@Override
public List<StaffCustomer> selectStaffCustomerByStaffIdAndParkId(Long id, String parkId) {
return staffCustomerMapper.selectStaffCustomerByStaffIdAndParkId(id,parkId);
}
}

View File

@ -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<StaffOpenMapper, StaffOpen> 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<StaffOpen> 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);
}
}

View File

@ -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<ReservationServe> {
/**
* 查询预约服务关联
*
* @param id 预约服务关联ID
* @return 预约服务关联
*/
ReservationServe selectReservationServeById(Long id);
/**
* 查询预约服务关联列表
*
* @param reservationServe 预约服务关联
* @return 预约服务关联集合
*/
List<ReservationServe> 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<ReservationServe> selectReservationServeByReservationId(Long id);
}

View File

@ -62,4 +62,6 @@ public interface IStaffCustomerService extends IService<StaffCustomer> {
List<StaffCustomer> selectStaffCustomerByStaffId(Long id);
StaffCustomer selectStaffIdAndCustomerId(Long icsCustomerId, Long staffId);
List<StaffCustomer> selectStaffCustomerByStaffIdAndParkId(Long id, String parkId);
}

View File

@ -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<StaffOpen> {
/**
* 查询用户和小程序关联
*
* @param id 用户和小程序关联ID
* @return 用户和小程序关联
*/
StaffOpen selectStaffOpenById(Long id);
/**
* 查询用户和小程序关联列表
*
* @param staffOpen 用户和小程序关联
* @return 用户和小程序关联集合
*/
List<StaffOpen> 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);
}

View File

@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="visitTime" column="visit_time" />
<result property="leaveTime" column="leave_time" />
<result property="visitContent" column="visit_content" />
<result property="tenantId" column="tenant_id" />
<result property="toName" column="to_name" />
<result property="toPhone" column="to_phone" />
<result property="toCustomer" column="to_customer" />
@ -38,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectIcsCustomerStaffVo">
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
</sql>
@ -212,6 +213,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
group by cs.id
</select>
<select id="selectUserByMobileAndOpenId" resultType="com.ics.common.core.domain.IcsCustomerStaff">
<include refid="selectIcsCustomerStaffVo"/> where mobile = #{mobile} and park_id = #{parkId}
</select>
</mapper>

View File

@ -33,11 +33,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remake" column="remake" />
<result property="personNum" column="person_num" />
</resultMap>
<sql id="selectReservationVo">
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"
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null ">update_time,</if>
<if test="remake != null and remake != ''">remake,</if>
<if test="personNum != null and personNum != ''">person_num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if>
@ -139,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null ">#{updateTime},</if>
<if test="remake != null and remake != ''">#{remake},</if>
<if test="personNum != null and personNum != ''">#{personNum},</if>
</trim>
</insert>
@ -172,6 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
<if test="remake != null and remake != ''">remake = #{remake},</if>
<if test="personNum != null and personNum != ''">person_num = #{personNum},</if>
</trim>
WHERE id = #{id}
</update>

View File

@ -33,6 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectStaffCustomerVo"/>
WHERE staff_id = #{id}
</select>
<select id="selectStaffCustomerByStaffIdAndParkId" resultType="com.ics.admin.domain.meeting.StaffCustomer">
<include refid="selectStaffCustomerVo"/>
WHERE staff_id = #{staffId} AND park_id = #{parkId}
</select>
<insert id="insertStaffCustomer" parameterType="StaffCustomer">
INSERT INTO tb_staff_customer

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ics.admin.mapper.meeting.StaffOpenMapper">
<resultMap type="com.ics.admin.domain.meeting.StaffOpen" id="StaffOpenResult">
<result property="id" column="id" />
<result property="openid" column="openid" />
<result property="staffId" column="staff_id" />
<result property="createTime" column="create_time" />
<result property="deleteFlag" column="delete_flag" />
<result property="createBy" column="create_by" />
<result property="tenantId" column="tenant_id" />
<result property="parkId" column="park_id" />
</resultMap>
<sql id="selectStaffOpenVo">
SELECT id, openid, staff_id, create_time, delete_flag, create_by, tenant_id, park_id FROM tb_staff_open
</sql>
<select id="selectStaffOpenList" parameterType="StaffOpen" resultMap="StaffOpenResult">
<include refid="selectStaffOpenVo"/>
<where>
</where>
</select>
<select id="selectStaffOpenById" parameterType="Long" resultMap="StaffOpenResult">
<include refid="selectStaffOpenVo"/>
WHERE id = #{id}
</select>
<select id="selectStaffOpenByOpenId" resultType="com.ics.admin.domain.meeting.StaffOpen">
SELECT * FROM tb_staff_open WHERE openid = #{openid}
</select>
<select id="selectStaffOpenByStaffIdAndOpenId" resultType="com.ics.admin.domain.meeting.StaffOpen">
SELECT * FROM tb_staff_open WHERE staff_id = #{staffId} AND openid = #{openid}
</select>
<insert id="insertStaffOpen" parameterType="StaffOpen" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tb_staff_open
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="openid != null and openid != ''">openid,</if>
<if test="staffId != null ">staff_id,</if>
<if test="createTime != null ">create_time,</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="tenantId != null ">tenant_id,</if>
<if test="parkId != null ">park_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="openid != null and openid != ''">#{openid},</if>
<if test="staffId != null ">#{staffId},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="tenantId != null ">#{tenantId},</if>
<if test="parkId != null ">#{parkId},</if>
</trim>
</insert>
<update id="updateStaffOpen" parameterType="StaffOpen">
UPDATE tb_staff_open
<trim prefix="SET" suffixOverrides=",">
<if test="openid != null and openid != ''">openid = #{openid},</if>
<if test="staffId != null ">staff_id = #{staffId},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="tenantId != null ">tenant_id = #{tenantId},</if>
<if test="parkId != null ">park_id = #{parkId},</if>
</trim>
WHERE id = #{id}
</update>
<delete id="deleteStaffOpenById" parameterType="Long">
DELETE FROM tb_staff_open WHERE id = #{id}
</delete>
<delete id="deleteStaffOpenByIds" parameterType="String">
DELETE FROM tb_staff_open where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -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;
}
}

View File

@ -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<String, String> map){
public static JSONObject sendGet(String url, Map<String, String> map) {
OkHttpClient client = new OkHttpClient();
// 创建url
HttpUrl.Builder urlBuilder = HttpUrl.parse(url).newBuilder();
// 添加参数
if(map != null){
if (map != null) {
for (Map.Entry<String, String> 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<String , String> paramMap) {
if(paramMap == null){
public static JSONObject sendPost(String url, Map<String, String> 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<String, String> 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");
}
}

View File

@ -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<String, Object> 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<String, Object> 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<String, String> 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<StaffCustomer> 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<String, Object> token = tokenService.createToken(user);
R ajax = R.ok();
ajax.put(Constants.TOKEN, token);
ajax.put("user", user);
ajax.put("openid", openid);
return ajax;
}
}
/**
* 郑州授权登录
*
* @param paramMap
* @return
*/
@PostMapping("/social_user_login/login")
public R social(@RequestBody Map<String, String> 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<Long> 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<String, Object> 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<String, Object> token = tokenService.createToken(user);
R ajax = R.ok();
ajax.put(Constants.TOKEN, token);
ajax.put("user", user);
ajax.put("openid", openid);
return ajax;
}
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<String, Object> 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<String, Object> 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<String, Object> token = tokenService.createToken(user);
// R ajax = R.ok();
// ajax.put(Constants.TOKEN, token);
// ajax.put("user", user);
// ajax.put("openid", openid);
return ajax;
}
} 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;
}

View File

@ -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<UserEquipment> 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为ipvalue为设备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("开门失败");
}
}

View File

@ -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<RoomEquipment> 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<ReservationServe> 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);
}

View File

@ -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<RoomContent> roomContents = roomContentService.selectApiRoomList(new RoomContent());
public R list(@RequestBody HashMap<String,Long> map) {
Long parkId = map.get("parkId");
RoomContent roomContent1 = new RoomContent();
if (parkId != null){
roomContent1.setParkId(parkId);
}
List<RoomContent> 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<Park> parkList = parkService.selectParkList(park);
return R.data(parkList);
}

View File

@ -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));