Commit 851deb5b authored by 赵啸非's avatar 赵啸非

添加巴中经开区windows shell

parent bf12a8da
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -621,6 +621,60 @@ public class DeviceApiController {
return JSON.toJSONString(rsp);
}
/**
* 检查设备最新版本信息
*
* @param req
* @return
*/
@PostMapping("checkVersionCopy")
@UnAuth
public String checkVersionCopy(HttpServletRequest request, @RequestBody DeviceReq req) {
String serverName = request.getHeader("server-name");
Integer serverPort = DataUtil.converStr2Int(request.getHeader("server-port"), 0);
// String serverName = request.getServerName();
// int serverPort = request.getServerPort();
log.info("【检查设备最新版本信息】【请求体】--> " + JSONObject.toJSONString(req));
ApiResp<DeviceResp> rsp = new ApiResp<>();
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
DeviceResp deviceResp = new DeviceResp();
try {
DeviceEntity deviceEntity = checkDeviceExist(req);
//查找版本号最大的. todo 根据站点来划分
ProductVersionQuery productVersionQuery = new ProductVersionQuery();
productVersionQuery.setProductId(deviceEntity.getProductId());
productVersionQuery.setSiteId(deviceEntity.getSiteId());
productVersionQuery.setOrderColList(Arrays.asList(new OrderCol("version", OrderCol.DESCENDING)));
/* ProductVersionEntity productVersionEntity = productVersionService.find(productVersionQuery)
.stream()
.filter(item -> StrUtil.endWith(item.getFilePath(), ".apk", true))
.findFirst().orElseGet(() -> null);*/
ProductVersionEntity productVersionEntity = productVersionService.selectOne(productVersionQuery);
if (ObjectUtils.isEmpty(productVersionEntity)) {
throw new AppException(DEVICE_VERSION_UNEXIST, DEVICE_VERSION_UNEXIST_CONTENT);
}
ProductVersionInfo productVersionInfo = new ProductVersionInfo();
BeanUtils.copyProperties(productVersionEntity, productVersionInfo, BeanUtil.getNullPropertyNames(productVersionEntity));
buildDownloadUrl(productVersionEntity, productVersionInfo, serverName, serverPort);
String content = EncryptUtil.myEnscrt(JSON.toJSONString(productVersionInfo), 9, DES_STR, ENCRYPT_STR);
log.info("响应【设备版本检查】【响应体】--> " + JSONObject.toJSONString(productVersionInfo));
deviceResp.setContent(content);
rsp.setData(deviceResp);
} catch (AppException e) {
rsp.setCode(e.getCode());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
} catch (Exception e) {
log.error("接收数据失败", e);
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
}
return JSON.toJSONString(rsp);
}
/**
* 检查设备最新版本信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment