Commit 292cf086 authored by 赵啸非's avatar 赵啸非

修改同步逻辑

parent 22aafc34
package com.mortals.xhx.feign.device; package com.mortals.xhx.feign.device;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.UploadDeviceReq;
import com.mortals.xhx.common.pdu.device.DeviceMsgReqPdu; import com.mortals.xhx.common.pdu.device.DeviceMsgReqPdu;
import com.mortals.xhx.feign.IFeign; import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
...@@ -29,7 +30,14 @@ public interface IDeviceMessageFeign extends IFeign { ...@@ -29,7 +30,14 @@ public interface IDeviceMessageFeign extends IFeign {
@PostMapping(value = "/api/callbackByProduct") @PostMapping(value = "/api/callbackByProduct")
Rest<String> callbackByProduct(@RequestBody DeviceMsgReqPdu devicePdu); Rest<String> callbackByProduct(@RequestBody DeviceMsgReqPdu devicePdu);
/**
* 设备消息 下发
*
* @param req
* @return
*/
@PostMapping(value = "/notify/downMsg")
Rest<String> downMsg(@RequestBody UploadDeviceReq req);
} }
...@@ -44,6 +52,11 @@ class DeviceMessageFeignFallbackFactory implements FallbackFactory<IDeviceMessag ...@@ -44,6 +52,11 @@ class DeviceMessageFeignFallbackFactory implements FallbackFactory<IDeviceMessag
public Rest<String> callbackByProduct(DeviceMsgReqPdu devicePdu) { public Rest<String> callbackByProduct(DeviceMsgReqPdu devicePdu) {
return Rest.fail("发送消息失败,请稍后再试!"); return Rest.fail("发送消息失败,请稍后再试!");
} }
@Override
public Rest<String> downMsg(UploadDeviceReq req) {
return Rest.fail("发送消息失败,请稍后再试!");
}
}; };
} }
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<Field :span="20" label="选择工作人员" prop="roomId" v-model="form.workmanId" :multiple="true" type="select" :enumData="dict.workmanId" placeholder="请选择人员"/> <Field :span="20" label="选择工作人员" prop="roomId" v-model="form.workmanId" :multiple="true" type="select" :enumData="dict.workmanId" placeholder="请选择人员"/>
<Field :span="20" label="轮播图片"><fileUpload v-model="filePaths" :limit="limit" :fileType="fileType" :fileName="form.fileName" @getFileName="getFileName" prePath="/file/fileupload"/></Field> <Field :span="20" label="轮播图片"><fileUpload v-model="filePaths" :limit="limit" :fileType="fileType" :fileName="form.fileName" @getFileName="getFileName" prePath="/file/fileupload"/> 建议图片分辨率大小为1000*1200</Field>
......
...@@ -9,8 +9,10 @@ import com.mortals.xhx.common.code.DeviceMethodEnum; ...@@ -9,8 +9,10 @@ import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.common.code.DeviceStatusEnum; import com.mortals.xhx.common.code.DeviceStatusEnum;
import com.mortals.xhx.common.code.EnabledEnum; import com.mortals.xhx.common.code.EnabledEnum;
import com.mortals.xhx.common.pdu.LoginForm; import com.mortals.xhx.common.pdu.LoginForm;
import com.mortals.xhx.common.pdu.UploadDeviceReq;
import com.mortals.xhx.common.pdu.device.DeviceReq; import com.mortals.xhx.common.pdu.device.DeviceReq;
import com.mortals.xhx.feign.device.IDeviceFeign; import com.mortals.xhx.feign.device.IDeviceFeign;
import com.mortals.xhx.feign.device.IDeviceMessageFeign;
import com.mortals.xhx.module.device.dao.DeviceDao; import com.mortals.xhx.module.device.dao.DeviceDao;
import com.mortals.xhx.module.device.model.*; import com.mortals.xhx.module.device.model.*;
import com.mortals.xhx.module.device.service.DeviceFileService; import com.mortals.xhx.module.device.service.DeviceFileService;
...@@ -55,6 +57,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -55,6 +57,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Autowired @Autowired
private WorkmanService workmanService; private WorkmanService workmanService;
@Autowired
private IDeviceMessageFeign messageFeign;
@Override @Override
protected String getExtKey(DeviceEntity data) { protected String getExtKey(DeviceEntity data) {
return data.getDeviceCode(); return data.getDeviceCode();
...@@ -141,8 +146,16 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -141,8 +146,16 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if (!ObjectUtils.isEmpty(entity.getDeviceFileEntityList())) { if (!ObjectUtils.isEmpty(entity.getDeviceFileEntityList())) {
saveDeviceFile(entity, context); saveDeviceFile(entity, context);
} }
notifyDevice(entity);
} }
private void notifyDevice(DeviceEntity entity) {
UploadDeviceReq uploadDeviceReq = new UploadDeviceReq();
uploadDeviceReq.setDeviceCodeList(Arrays.asList(entity.getDeviceCode()));
uploadDeviceReq.setAction("edition");
log.info("downMsg:{}", JSON.toJSONString(uploadDeviceReq));
messageFeign.downMsg(uploadDeviceReq);
}
@Override @Override
protected void updateAfter(DeviceEntity entity, Context context) throws AppException { protected void updateAfter(DeviceEntity entity, Context context) throws AppException {
...@@ -162,6 +175,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -162,6 +175,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceFileService.remove(deviceIds, context); deviceFileService.remove(deviceIds, context);
saveDeviceFile(entity, context); saveDeviceFile(entity, context);
} }
notifyDevice(entity);
} }
private void saveDeviceFile(DeviceEntity entity, Context context) { private void saveDeviceFile(DeviceEntity entity, Context context) {
......
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