修改了对应的问题

This commit is contained in:
chenze 2024-11-01 09:30:59 +08:00
parent e7cdc255a7
commit 4349c9414c
12 changed files with 124 additions and 33 deletions

View File

@ -64,7 +64,7 @@ public class WisdomRoomController extends BaseController {
room.setStaffId(collect); room.setStaffId(collect);
IcsCustomerStaff icsCustomerStaff =new IcsCustomerStaff(); IcsCustomerStaff icsCustomerStaff =new IcsCustomerStaff();
icsCustomerStaff.setIcsCustomerId(85L); icsCustomerStaff.setIcsCustomerId(85L);
room.setStaffLists(customerStaffService.selectCustomerStaffList(icsCustomerStaff)); room.setStaffLists(customerStaffService.selectCustomerStaff(icsCustomerStaff));
} }
return result(wisdomRooms); return result(wisdomRooms);
} }
@ -130,6 +130,7 @@ public class WisdomRoomController extends BaseController {
IcsCustomerStaff icsCustomerStaff =new IcsCustomerStaff(); IcsCustomerStaff icsCustomerStaff =new IcsCustomerStaff();
icsCustomerStaff.setIcsCustomerId(85L); icsCustomerStaff.setIcsCustomerId(85L);
List<IcsCustomerStaff> customerStaffs = customerStaffService.selectCustomerStaffList(icsCustomerStaff); List<IcsCustomerStaff> customerStaffs = customerStaffService.selectCustomerStaffList(icsCustomerStaff);
return R.data(customerStaffs); return R.data(customerStaffs);
} }

View File

@ -18,4 +18,6 @@ public class DeviceVo {
private String coverType; private String coverType;
private Integer userId;
} }

View File

@ -82,4 +82,6 @@ public interface IcsCustomerStaffMapper extends BaseMapper<IcsCustomerStaff> {
@InterceptorIgnore(tenantLine = "1") @InterceptorIgnore(tenantLine = "1")
List<IcsCustomerStaff> selectListByCustomerId(); List<IcsCustomerStaff> selectListByCustomerId();
List<IcsCustomerStaff> selectCustomerStaff(IcsCustomerStaff icsCustomerStaff);
} }

View File

@ -94,6 +94,8 @@ public interface IIcsCustomerStaffService extends IService<IcsCustomerStaff> {
List<IcsCustomerStaff> selectListByCustomerId(); List<IcsCustomerStaff> selectListByCustomerId();
List<IcsCustomerStaff> selectCustomerStaff(IcsCustomerStaff icsCustomerStaff);
// IcsCustomerStaff selectUserByMobileAndParkId(String phoneNumber, String parkId); // IcsCustomerStaff selectUserByMobileAndParkId(String phoneNumber, String parkId);
} }

View File

@ -316,6 +316,11 @@ public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMap
} }
@Override
public List<IcsCustomerStaff> selectCustomerStaff(IcsCustomerStaff icsCustomerStaff) {
return icsCustomerStaffMapper.selectCustomerStaff(icsCustomerStaff);
}
//根据企业查询对应的设备 //根据企业查询对应的设备
public void queryDeviceByCustomerId(Long customerId,Long userId){ public void queryDeviceByCustomerId(Long customerId,Long userId){

View File

@ -50,7 +50,7 @@ public class WisdomStaffServiceImpl extends ServiceImpl<WisdomStaffMapper, Wisdo
*/ */
@Override @Override
public List<WisdomStaff> selectWisdomStaffList(WisdomStaff wisdomStaff) { public List<WisdomStaff> selectWisdomStaffList(WisdomStaff wisdomStaff) {
QueryWrapper queryWrapper = new QueryWrapper(); QueryWrapper<WisdomStaff> queryWrapper = new QueryWrapper();
return wisdomStaffMapper.selectList(queryWrapper); return wisdomStaffMapper.selectList(queryWrapper);
} }

View File

@ -224,6 +224,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE tsc.ics_customer_id = 85 WHERE tsc.ics_customer_id = 85
ORDER BY CONVERT(cs.name USING GBK) ASC ORDER BY CONVERT(cs.name USING GBK) ASC
</select> </select>
<select id="selectCustomerStaff" resultType="com.ics.common.core.domain.IcsCustomerStaff">
SELECT cs.id, cs.username, cs.mobile, cs.create_by, cs.create_time, cs.update_by,cs.name,cs.photo,cs.address,cs.email,cs.degree,cs.urgent,cs.update_time,
cs.delete_flag, cs.ics_customer_id, cs.openid, cs.avatar, cs.gender, cs.status, cs.park_id,cs.card_no,cs.data_type
FROM ics_customer_staff cs
left join tb_staff_customer tsc on cs.id = tsc.staff_id
left join ics_customer icc on tsc.ics_customer_id = icc.id
left join tb_wisdom_staff tws on tws.staff_id = cs.id
<where>
tws.data_type = 0
<if test="username != null and username != ''"> AND cs.username LIKE CONCAT('%', #{username}, '%') </if>
<if test="icsCustomerId != null and icsCustomerId != ''"> AND tsc.ics_customer_id = #{icsCustomerId} </if>
<if test="mobile != null and mobile != ''"> AND cs.mobile LIKE CONCAT('%', #{mobile}, '%') </if>
<if test="name != null and name != ''"> AND cs.name LIKE CONCAT('%', #{name}, '%') </if>
<if test="parkId != null and parkId != ''"> AND icc.park_id = #{parkId} </if>
<if test="tenantId != null and tenantId != ''"> AND cs.tenant_id = #{tenantId} </if>
<if test="dataType != null and dataType != ''"> AND cs.data_type = #{dataType} </if>
</where>
</select>
</mapper> </mapper>

View File

@ -0,0 +1,45 @@
package com.ics.common.utils.device;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
public class MenjinUtils {
public static void main(String[] args) {
try {
// 创建TCP服务器并绑定到指定端口 //tcp 通讯接口4370
int port = 8083;
ServerSocket serverSocket = new ServerSocket(port);
System.out.println("服务器已启动,等待客户端连接...");
while (true) {
// 等待客户端连接
Socket clientSocket = serverSocket.accept();
System.out.println("客户端连接成功");
// 创建输入流和输出流
InputStream inputStream = clientSocket.getInputStream();
OutputStream outputStream = clientSocket.getOutputStream();
// 读取客户端发送的数据
byte[] buffer = new byte[1024];
int bytesRead = inputStream.read(buffer);
String receivedMessage = new String(buffer, 0, bytesRead);
System.out.println("收到消息:" + receivedMessage);
// 发送响应数据给客户端
String responseMessage = "Hello, Client!";
outputStream.write(responseMessage.getBytes());
// 关闭连接
clientSocket.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -51,9 +51,9 @@ public class SignUtils {
Map<String, String > heads = new HashMap<>(); Map<String, String > heads = new HashMap<>();
System.out.println("ip为"+"222.67.226.196"); System.out.println("ip为"+"222.67.48.244");
String body = HttpRequest.post("http://222.67.226.196:8888/cootoo/openLock") String body = HttpRequest.post("http://222.67.48.244:8888/cootoo/openLock")
.headerMap(heads, false) .headerMap(heads, false)
.body(on.toString()).timeout(30 * 1000).execute().body(); .body(on.toString()).timeout(30 * 1000).execute().body();
System.out.println(body); System.out.println(body);

View File

@ -300,8 +300,8 @@ public class WisDomDeviceUtils {
} }
public static String openControlLock(String ip) { public static String openControlLock(String ip) {
String url = "http://222.67.226.196:1234/api/Op/OpDoor?ipaddress="+ip; String url = "http://222.67.48.244:1234/api/Op/OpDoor?ipaddress="+ip;
log.info("开门控制器的url:{}", "222.67.226.196"); log.info("开门控制器的url:{}", "222.67.48.244");
String msg = HttpUtil.get(url); String msg = HttpUtil.get(url);
log.info("开门控制器的结果为结果:{}", msg); log.info("开门控制器的结果为结果:{}", msg);
return msg; return msg;

View File

@ -1,5 +1,6 @@
package com.ics.controller.mobile.meeting; package com.ics.controller.mobile.meeting;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
@ -97,16 +98,17 @@ public class ApiEquipmentController extends BaseController {
} }
Equipment equipment = equipmentService.selectEquipmentById(roomRecord.getDeviceId()); Equipment equipment = equipmentService.selectEquipmentById(roomRecord.getDeviceId());
if (equipment.getType() == 0){ if (equipment.getType() == 0) {
String openlock = DeviceUtils.openlock(equipment.getIp()); String openlock = DeviceUtils.openlock(equipment.getIp());
JSONObject jsonObject = JSONUtil.parseObj(openlock); JSONObject jsonObject = JSONUtil.parseObj(openlock);
Integer code = (Integer) jsonObject.get("status"); Integer code = (Integer) jsonObject.get("status");
Assert.isTrue(code == 0, "开门失败"); Assert.isTrue(code == 0, "开门失败");
}else if (equipment.getType() == 1){ } else if (equipment.getType() == 1) {
String openlock = DeviceUtils.openControlLock(equipment.getIp()); String openlock = DeviceUtils.openControlLock(equipment.getIp());
log.info("开门控制器的结果为结果:{}", openlock);; log.info("开门控制器的结果为结果:{}", openlock);
;
} }
roomRecord.setType("0"); roomRecord.setType("0");
int i = roomRecordService.insertRoomRecord(roomRecord); int i = roomRecordService.insertRoomRecord(roomRecord);
@ -136,7 +138,6 @@ public class ApiEquipmentController extends BaseController {
/** /**
* 获取对比记录,获取设备的对比记录设备往服务端传输数据 * 获取对比记录,获取设备的对比记录设备往服务端传输数据
*
*/ */
@Ignore @Ignore
@PostMapping("/getEquipmentByUserIdAndEquipmentId") @PostMapping("/getEquipmentByUserIdAndEquipmentId")
@ -225,7 +226,8 @@ public class ApiEquipmentController extends BaseController {
String ip = equipmentService.selectEquipmentById(roomRecord.getDeviceId()).getIp(); String ip = equipmentService.selectEquipmentById(roomRecord.getDeviceId()).getIp();
String openlock = DeviceUtils.openControlLock(ip); String openlock = DeviceUtils.openControlLock(ip);
log.info("开门控制器的结果为结果:{}", openlock);; log.info("开门控制器的结果为结果:{}", openlock);
;
} }
return R.ok("开门成功"); return R.ok("开门成功");
@ -237,20 +239,20 @@ public class ApiEquipmentController extends BaseController {
WisdomDevice wisdomDevice = new WisdomDevice(); WisdomDevice wisdomDevice = new WisdomDevice();
log.info("会议室的id为{}", roomRecord.getRoomId()); log.info("2222222222222222222222会议室的id为{}", roomRecord.getRoomId());
//大会议室 52 茶室 53 小会议室 54 //大会议室 52 茶室 53 小会议室 54
if(roomRecord.getRoomId() == 237L ){ if (roomRecord.getRoomId() == 237L) {
wisdomDevice.setEquipmentNum("238"); wisdomDevice.setEquipmentNum("238");
}else if (roomRecord.getRoomId() == 238L){ } else if (roomRecord.getRoomId() == 238L) {
wisdomDevice.setEquipmentNum("240"); wisdomDevice.setEquipmentNum("240");
}else if (roomRecord.getRoomId() == 239L){ } else if (roomRecord.getRoomId() == 239L) {
wisdomDevice.setEquipmentNum("239"); wisdomDevice.setEquipmentNum("239");
}else if (roomRecord.getRoomId() == 242L){ } else if (roomRecord.getRoomId() == 242L) {
wisdomDevice.setEquipmentNum("192.168.1.201"); wisdomDevice.setEquipmentNum("192.168.1.201");
wisdomDevice.setType("开门控制器"); wisdomDevice.setType("开门控制器");
}else if (roomRecord.getRoomId() == 243L){ } else if (roomRecord.getRoomId() == 243L) {
wisdomDevice.setEquipmentNum("192.168.1.34"); wisdomDevice.setEquipmentNum("192.168.1.34");
wisdomDevice.setType("开门控制器"); wisdomDevice.setType("开门控制器");
} }
@ -261,19 +263,28 @@ public class ApiEquipmentController extends BaseController {
Integer count1 = wisdomStaffService.selectByUserIdAndRoomId(Integer.parseInt(String.valueOf(roomRecord.getUserId())), "0"); Integer count1 = wisdomStaffService.selectByUserIdAndRoomId(Integer.parseInt(String.valueOf(roomRecord.getUserId())), "0");
if (count1 == 0) { if (count1 == 0) {
List<WisdomStaff> list = wisdomStaffService.selectListByUserIdAndRoomId(Integer.parseInt(String.valueOf(roomRecord.getUserId())), "1"); List<WisdomStaff> list = wisdomStaffService.selectListByUserIdAndRoomId(Integer.parseInt(String.valueOf(roomRecord.getUserId())), "1");
int num = 0;
for (WisdomStaff wisdomStaff : list) { for (WisdomStaff wisdomStaff : list) {
boolean in = DateUtil.isIn(new Date(), wisdomStaff.getStartTime(), wisdomStaff.getEndDate()); Date startTime = wisdomStaff.getStartTime();
if (!in) return R.error("该用户没有权限开锁"); Date endDate = wisdomStaff.getEndDate();
if (wisdomDevice.getType() !=null && wisdomDevice.getType().equals("开门控制器")){ Date offset = DateUtil.offset(startTime, DateField.MINUTE, -10);
WisDomDeviceUtils.openControlLock(wisdomDevice.getEquipmentNum()); Date offset1 = DateUtil.offset(endDate, DateField.MINUTE, -10);
}else { boolean in = DateUtil.isIn(new Date(), offset, offset1);
SignUtils.lock(wisdomDevice.getEquipmentNum()); if (in) {
num++;
} }
} }
} else { if (num <= 0) return R.error("该用户没有权限开锁");
if (wisdomDevice.getType() !=null && wisdomDevice.getType().equals("开门控制器")){ if (wisdomDevice.getType() != null && wisdomDevice.getType().equals("开门控制器")) {
WisDomDeviceUtils.openControlLock(wisdomDevice.getEquipmentNum()); WisDomDeviceUtils.openControlLock(wisdomDevice.getEquipmentNum());
}else { } else {
SignUtils.lock(wisdomDevice.getEquipmentNum());
}
} else {
if (wisdomDevice.getType() != null && wisdomDevice.getType().equals("开门控制器")) {
WisDomDeviceUtils.openControlLock(wisdomDevice.getEquipmentNum());
} else {
SignUtils.lock(wisdomDevice.getEquipmentNum()); SignUtils.lock(wisdomDevice.getEquipmentNum());
} }
} }
@ -281,7 +292,6 @@ public class ApiEquipmentController extends BaseController {
} }
/** /**
* 扫描二维码开门 用户id 和设备id * 扫描二维码开门 用户id 和设备id
*/ */

View File

@ -40,7 +40,7 @@ public class WisdomApiController extends BaseController {
private IWisdomDeviceService wisdomDeviceService; private IWisdomDeviceService wisdomDeviceService;
@Autowired @Autowired
private IWisdomStaffService wisdomStaffService; private IWisdomStaffService wisdomStaffService;
@Autowired @Autowired
private IIcsCustomerStaffService customerStaffService; private IIcsCustomerStaffService customerStaffService;
@ -103,7 +103,7 @@ public class WisdomApiController extends BaseController {
wisdomDevice.setWisdomRoomId(id); wisdomDevice.setWisdomRoomId(id);
if (id == 3 || id == 4) { if (id == 3 || id == 4) {
wisdomDevice.setType("门锁"); wisdomDevice.setType("门锁");
}else if (id ==18 || id == 19){ } else if (id == 18 || id == 19) {
wisdomDevice.setType("开门控制器"); wisdomDevice.setType("开门控制器");
} }
List<WisdomDevice> wisdomDevices = wisdomDeviceService.selectWisdomDeviceList(wisdomDevice); List<WisdomDevice> wisdomDevices = wisdomDeviceService.selectWisdomDeviceList(wisdomDevice);
@ -147,6 +147,7 @@ public class WisdomApiController extends BaseController {
*/ */
@RequiresPermissions("member:center:view") @RequiresPermissions("member:center:view")
// @Ignore
@RequestMapping("/callApiByDeviceId") @RequestMapping("/callApiByDeviceId")
public R callApiByDeviceId(@RequestBody DeviceVo deviceVo) { public R callApiByDeviceId(@RequestBody DeviceVo deviceVo) {
@ -174,17 +175,19 @@ public class WisdomApiController extends BaseController {
Integer count1 = wisdomStaffService.selectByUserIdAndRoomId(loginStaffId, "0"); Integer count1 = wisdomStaffService.selectByUserIdAndRoomId(loginStaffId, "0");
if (count1 == 0) { if (count1 == 0) {
List<WisdomStaff> list = wisdomStaffService.selectListByUserIdAndRoomId(loginStaffId, "1"); List<WisdomStaff> list = wisdomStaffService.selectListByUserIdAndRoomId(loginStaffId, "1");
int num = 0;
for (WisdomStaff wisdomStaff : list) { for (WisdomStaff wisdomStaff : list) {
Date startTime = wisdomStaff.getStartTime(); Date startTime = wisdomStaff.getStartTime();
Date endDate = wisdomStaff.getEndDate(); Date endDate = wisdomStaff.getEndDate();
Date offset = DateUtil.offset(startTime, DateField.MINUTE, -10); Date offset = DateUtil.offset(startTime, DateField.MINUTE, -10);
Date offset1 = DateUtil.offset(endDate, DateField.MINUTE, -10); Date offset1 = DateUtil.offset(endDate, DateField.MINUTE, -10);
boolean in = DateUtil.isIn(new Date(), offset, offset1); boolean in = DateUtil.isIn(new Date(), offset, offset1);
if (!in) return R.error("该用户没有权限开锁"); if (in) {
num++;
SignUtils.lock(wisdomDevice.getEquipmentNum()); }
} }
if (num <= 0) return R.error("该用户没有权限开锁");
SignUtils.lock(wisdomDevice.getEquipmentNum());
} else { } else {
// WisDomDeviceUtils.openControlLock(wisdomDevice.getEquipmentNum()); // WisDomDeviceUtils.openControlLock(wisdomDevice.getEquipmentNum());
@ -257,4 +260,6 @@ public class WisdomApiController extends BaseController {
return R.ok(); return R.ok();
} }
} }