|
@@ -2,10 +2,15 @@ package com.zcxk.controller;
|
|
|
|
|
|
import com.zcxk.dao.mysql.SendDao;
|
|
|
import com.zcxk.dao.sqlserver.ReceiveDao;
|
|
|
+import com.zcxk.entity.MeterDataEntity;
|
|
|
+import com.zcxk.entity.TaskEntity;
|
|
|
+import com.zcxk.entity.UploadWaterMeterDataEntity;
|
|
|
+import com.zcxk.entity.WaterMeterBaseEntity;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -16,23 +21,45 @@ public class DemoController {
|
|
|
ReceiveDao receiveDao;
|
|
|
@Autowired
|
|
|
SendDao sendDao;
|
|
|
- @GetMapping("/test")
|
|
|
+ @GetMapping("/getBaseInfo")
|
|
|
public void countPlanDevice(){
|
|
|
- sendDao.selectOne();
|
|
|
- Map<String,Object>args=new HashMap<>();
|
|
|
- args.put("regionId",null);
|
|
|
- /* List<Map<String, Object>> meterInfor = receiveDao.getMeterInfor(args);
|
|
|
- // List<Map<String, Object>> meterChangeRecord = receiveDao.getMeterChangeRecord(args);
|
|
|
- args.clear();
|
|
|
+ //sendDao.selectOne();
|
|
|
+ WaterMeterBaseEntity waterMeterBaseEntity=new WaterMeterBaseEntity();
|
|
|
+ List<Map<String, Object>> meterInfor = receiveDao.getMeterInfor(waterMeterBaseEntity);
|
|
|
+
|
|
|
+ System.out.println(meterInfor);
|
|
|
+
|
|
|
+ }
|
|
|
+ @GetMapping("/uploadData")
|
|
|
+ public void uploadData(){
|
|
|
Map<String,Object>args2=new HashMap<>();
|
|
|
List<Map<String, Object>> uploadPlan = receiveDao.getUploadPlan(args2);
|
|
|
uploadPlan.forEach(map->{
|
|
|
- // args.put("planId ",map.get("PlanId"));
|
|
|
- receiveDao.creatUploadTask(args);
|
|
|
- });
|
|
|
+ TaskEntity taskEntity=new TaskEntity();
|
|
|
+ taskEntity.setPlanId((String) map.get("PlanId"));
|
|
|
+ receiveDao.creatUploadTask(taskEntity);
|
|
|
+ if(taskEntity.getReturnCode()==1){
|
|
|
|
|
|
- // receiveDao.meterDataInsert(args);
|
|
|
- System.out.println(1);*/
|
|
|
|
|
|
+ try {
|
|
|
+
|
|
|
+ List<MeterDataEntity>datas=new ArrayList<>();
|
|
|
+ MeterDataEntity meterDataEntity=new MeterDataEntity();
|
|
|
+ meterDataEntity.setReleationId("1");
|
|
|
+ meterDataEntity.setCurrentReading(12.05f);
|
|
|
+ meterDataEntity.setCurrentReadDate("2020-12-29 12:15:16");
|
|
|
+ datas.add(meterDataEntity);
|
|
|
+ UploadWaterMeterDataEntity uploadWaterMeterDataEntity=new UploadWaterMeterDataEntity();
|
|
|
+ uploadWaterMeterDataEntity.setTaskId(taskEntity.getTaskId());
|
|
|
+ uploadWaterMeterDataEntity.setMeterData(datas);
|
|
|
+ receiveDao.meterDataInsert(uploadWaterMeterDataEntity);
|
|
|
+ System.out.println(1);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
}
|
|
|
}
|