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