Commit 43d4748c authored by 赵啸非's avatar 赵啸非

添加信息公开平台通知

parent 97ff9b7d
......@@ -288,6 +288,8 @@ public class DeviceApiController {
ApiResp<String> rsp = new ApiResp<>();
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
try {
log.info("【getToken】【请求体】--> " + loginForm.getLoginName(),loginForm.getPassword());
UserEntity userEntity = userService.doLogin(loginForm.getLoginName(), loginForm.getPassword(), "");
if (!ObjectUtils.isEmpty(userEntity)) {
String token = IdUtil.fastSimpleUUID();
......
......@@ -294,7 +294,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceEntity.setUpdateTime(new Date());
deviceEntity.setUpdateUserId(getContextUserId(context));
this.getDeviceDao().update(deviceEntity);
this.putCache(deviceEntity.getId().toString(),deviceEntity);
this.putCache(deviceEntity.getId().toString(), deviceEntity);
PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId() == null ? "-1" : deviceEntity.getPlatformId().toString());
ProductEntity productEntity = productService.getCache(deviceEntity.getProductId() == null ? "-1" : deviceEntity.getProductId().toString());
if (enabled == YesNoEnum.YES.getValue()) {
......@@ -303,12 +303,12 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
this.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.STOP);
}
if(enabled==EnabledEnum.停止.getValue()){
if (enabled == EnabledEnum.停止.getValue()) {
ErrorLogPdu errorLogPdu = new ErrorLogPdu();
errorLogPdu.initAttrValue();
errorLogPdu.setTraceID(IdUtil.objectId());
errorLogPdu.setAppName(productEntity.getProductCode());
errorLogPdu.setMessage(deviceEntity.getDeviceName()+"设备停用!");
errorLogPdu.setMessage(deviceEntity.getDeviceName() + "设备停用!");
errorLogPdu.setPlatform("webos");
errorLogPdu.setCulprit("");
errorLogPdu.setTags("");
......@@ -317,7 +317,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
errorLogPdu.setReleaseVersion("");
errorLogPdu.setFingerprint(LogTypeEnum.上报事件.name());
errorLogPdu.setThreadNo(Thread.currentThread().toString());
errorLogPdu.setErrorStack(Thread.currentThread()+deviceEntity.getDeviceName()+"设备停用!");
errorLogPdu.setErrorStack(Thread.currentThread() + deviceEntity.getDeviceName() + "设备停用!");
errorLogPdu.setContext("");
errorLogPdu.setExtra("");
errorLogPdu.setLogTime(new Date());
......@@ -600,6 +600,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
ProductEntity productEntity = productService.selectOne(new ProductQuery().productCode(entity.getProductCode()));
if (!ObjectUtils.isEmpty(productEntity)) {
entity.setProductId(productEntity.getId());
entity.setProductCode(productEntity.getProductCode());
entity.setProductName(productEntity.getProductName());
//根据产品查询平台
if (!ObjectUtils.isEmpty(productEntity.getPlatformId())) {
......@@ -638,7 +639,19 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
protected void updateBefore(DeviceEntity entity, Context context) throws AppException {
super.updateBefore(entity, context);
ProductEntity productEntity = productService.get(entity.getProductId(), context);
entity.setProductCode(productEntity == null ? "" : productEntity.getProductCode());
if (!ObjectUtils.isEmpty(productEntity)) {
entity.setProductCode(productEntity.getProductCode());
entity.setProductName(productEntity.getProductName());
PlatformEntity platformEntity = platformService.getCache(productEntity.getPlatformId().toString());
if (!ObjectUtils.isEmpty(platformEntity)) {
entity.setPlatformId(platformEntity.getId());
entity.setPlatformCode(platformEntity.getPlatformSn());
entity.setPlatformName(platformEntity.getPlatformName());
}
}
//更新平台
updateDeviceHomeUrl(entity);
}
......
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