Merge remote-tracking branch 'origin/feature-BOX一期' into feature-BOX一期

This commit is contained in:
weiyachao 2023-09-18 18:57:26 +08:00
commit d3b914f259
4 changed files with 4024 additions and 51 deletions

View File

@ -38,55 +38,56 @@ public class DeviceController {
private static Long timeOut = 120000l;//2分钟 private static Long timeOut = 120000l;//2分钟
// @GetMapping("/init") @GetMapping("/init")
// public Mono<DeviceInitResp> deviceInit(@RequestParam String wifiMac, @RequestParam String btMac, public Mono<DeviceInitResp> deviceInit(@RequestParam String wifiMac, @RequestParam String btMac,
// @RequestParam Integer type, @RequestParam Long time, @RequestParam Integer type, @RequestParam Long time,
// @RequestParam String signature){ @RequestParam String signature){
// Long now = System.currentTimeMillis(); Long now = System.currentTimeMillis();
// if(checkTimeout && now - time > timeOut){ if(checkTimeout && now - time > timeOut){
// //超时 //超时
// BusinessException ex = new BusinessException("请求已失效"); BusinessException ex = new BusinessException("请求已失效");
// return Mono.error(ex); return Mono.error(ex);
// } }
// //设备类型是否匹配暂时不做限制 //设备类型是否匹配暂时不做限制
// //验签 //验签
// String wifiMd5 = MD5.create().digestHex(wifiMac).toLowerCase(); String wifiMd5 = MD5.create().digestHex(wifiMac).toLowerCase();
// String btMd5 = MD5.create().digestHex(btMac).toLowerCase(); String btMd5 = MD5.create().digestHex(btMac).toLowerCase();
// String md5 = MD5.create().digestHex(wifiMd5 + btMd5 + type + time + key).toLowerCase(); String md5 = MD5.create().digestHex(wifiMd5 + btMd5 + type + time + key).toLowerCase();
// if (md5.equals(signature)) { if (md5.equals(signature)) {
// // //
// DeviceInfoRequest request = new DeviceInfoRequest(); DeviceInfoRequest request = new DeviceInfoRequest();
// request.setWifiMac(wifiMac); request.setWifiMac(wifiMac);
// request.setBtMac(btMac); request.setBtMac(btMac);
// Mono<DeviceInfoEntity> mono = deviceInfoService.selectDeviceInfoByRequest(request); Mono<DeviceInfoEntity> mono = deviceInfoService.selectDeviceInfoByRequest(request);
// return mono.flatMap(d -> {
// Mono o = null; return mono.defaultIfEmpty(new DeviceInfoEntity()).flatMap(entity -> {
// if(d == null){ if(entity.getId() == null){
// DeviceTypeEnum entryTypeEnum = DeviceTypeEnum.getEnumWithCode(type); DeviceTypeEnum entryTypeEnum = DeviceTypeEnum.getEnumWithCode(type);
// d = new DeviceInfoEntity(); entity = new DeviceInfoEntity();
// d.setWifiMac(wifiMac); entity.setWifiMac(wifiMac);
// d.setBtMac(btMac); entity.setBtMac(btMac);
// d.setDeviceType(type); entity.setBatchId(1l);
// d.setKey( com.qiuguo.iot.base.utils.StringUtils.getRandomStr(10));//生成key entity.setName(entryTypeEnum.getName());
// DateTimeFormatter df = DateTimeFormatter.ofPattern("yyMMddHHmmss"); entity.setDeviceType(type);
// d.setSn("QG" + entryTypeEnum.getSn() +df.format(LocalDateTime.now()) + StringUtils.getRandomStr(3)); entity.setKey( com.qiuguo.iot.base.utils.StringUtils.getRandomStr(10));//生成key
// o = deviceInfoService.insertDeviceInfo(d); DateTimeFormatter df = DateTimeFormatter.ofPattern("yyMMddHHmmss");
// }else{ entity.setSn("QG" + entryTypeEnum.getSn() +df.format(LocalDateTime.now()) + StringUtils.getRandomStr(3));
// d.setKey( com.qiuguo.iot.base.utils.StringUtils.getRandomStr(10));//重新生成Key deviceInfoService.insertDeviceInfo(entity);
// o = deviceInfoService.updateDeviceInfoById(d); }else{
// } entity.setKey( com.qiuguo.iot.base.utils.StringUtils.getRandomStr(10));//重新生成Key
// final DeviceInfoEntity entity = d; deviceInfoService.updateDeviceInfoById(entity);
// DeviceInitResp resp = new DeviceInitResp(); }
// resp.setSn(entity.getSn()); return Mono.just(entity);
// resp.setKey(entity.getKey()); }).map(o -> {
// return resp; DeviceInitResp resp = new DeviceInitResp();
// resp.setKey(o.getKey());
// resp.setSn(o.getSn());
// }); return resp;
// } });
// //验签失败 }
// BusinessException ex = new BusinessException("验签失败"); //验签失败
// return Mono.error(ex); BusinessException ex = new BusinessException("验签失败");
// return Mono.error(ex);
// }
}
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff