智能电表水表定时更新接口
This commit is contained in:
parent
edbe07ca0e
commit
7a7284e5ac
|
@ -24,7 +24,7 @@ public class DeviceInfoController extends JeecgController<TqDeviceInfo, ITqDevic
|
|||
*/
|
||||
@GetMapping(value = "/getAllMeter")
|
||||
public Result<String> getAllMeter() {
|
||||
service.getAllMeter();
|
||||
service.getAllMeter(false);
|
||||
return Result.OK("获取设备信息成功!");
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class DeviceInfoController extends JeecgController<TqDeviceInfo, ITqDevic
|
|||
*/
|
||||
@GetMapping(value = "/getAllCollector")
|
||||
public Result<String> getAllCollector() {
|
||||
service.getAllCollector();
|
||||
service.getAllCollector(false);
|
||||
return Result.OK("获取采集器信息成功!");
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,6 @@ public class CollectorDataJob implements Job {
|
|||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
service.getAllCollector();
|
||||
service.getAllCollector(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,6 @@ public class MeterStatusJob implements Job {
|
|||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
service.getAllMeter();
|
||||
service.getAllMeter(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,6 @@ import com.nu.modules.tq.common.entity.TqDeviceInfo;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface ITqDeviceInfoService extends IService<TqDeviceInfo> {
|
||||
void getAllMeter();
|
||||
void getAllCollector();
|
||||
void getAllMeter(boolean isJob);
|
||||
void getAllCollector(boolean isJob);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TqDeviceInfoServiceImpl extends ServiceImpl<TqDeviceInfoMapper, TqD
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void getAllMeter(){
|
||||
public void getAllMeter(boolean isJob){
|
||||
String responseStr = tqApi.getMeters();
|
||||
JSONObject jsonObject = new JSONObject(responseStr);
|
||||
String status = jsonObject.getStr("status");
|
||||
|
@ -65,7 +65,9 @@ public class TqDeviceInfoServiceImpl extends ServiceImpl<TqDeviceInfoMapper, TqD
|
|||
waterMeter.setRemark(remark);
|
||||
WaterMeter entity = waterMeterMapper.getWaterMeter(waterMeter);
|
||||
if(entity == null){
|
||||
waterMeterMapper.insert(waterMeter);
|
||||
if(!isJob){
|
||||
waterMeterMapper.insert(waterMeter);
|
||||
}
|
||||
}else{
|
||||
waterMeterMapper.update(waterMeter);
|
||||
}
|
||||
|
@ -91,7 +93,7 @@ public class TqDeviceInfoServiceImpl extends ServiceImpl<TqDeviceInfoMapper, TqD
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void getAllCollector(){
|
||||
public void getAllCollector(boolean isJob){
|
||||
String responseStr = tqApi.getCollectors();
|
||||
JSONObject jsonObject = new JSONObject(responseStr);
|
||||
String status = jsonObject.getStr("status");
|
||||
|
@ -119,7 +121,9 @@ public class TqDeviceInfoServiceImpl extends ServiceImpl<TqDeviceInfoMapper, TqD
|
|||
tdi.setRemark(remark);
|
||||
TqDeviceInfo entity = baseMapper.getDeviceInfo(tdi);
|
||||
if(entity == null){
|
||||
baseMapper.insert(tdi);
|
||||
if(!isJob) {
|
||||
baseMapper.insert(tdi);
|
||||
}
|
||||
}else{
|
||||
baseMapper.update(tdi);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue