|
|
@ -11,8 +11,11 @@ import com.kms.yg.dd.domain.AttDiscBase; |
|
|
|
import com.kms.yg.dd.service.AttDiscBaseService; |
|
|
|
import com.kms.yg.df.domain.BsSgcDfJbxx; |
|
|
|
import com.kms.yg.df.domain.BsSgcDfSafeJbxx; |
|
|
|
import com.kms.yg.df.domain.BsSgcDfSwtz; |
|
|
|
import com.kms.yg.df.domain.dto.BsSgcDfSwtzDto; |
|
|
|
import com.kms.yg.df.service.BsSgcDfJbxxService; |
|
|
|
import com.kms.yg.df.service.BsSgcDfSafeJbxxService; |
|
|
|
import com.kms.yg.df.service.BsSgcDfSwtzService; |
|
|
|
import com.kms.yg.ly.domain.AttBasBase; |
|
|
|
import com.kms.yg.ly.service.AttBasBaseService; |
|
|
|
import com.kms.yg.rv.domain.AttRvBase; |
|
|
@ -69,6 +72,9 @@ public class YgSynchronous { |
|
|
|
@Autowired |
|
|
|
BsSgcDfSafeJbxxService bsSgcDfSafeJbxxService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
BsSgcDfSwtzService bsSgcDfSwtzService; |
|
|
|
|
|
|
|
private static String XH3CID = "3359137640337"; |
|
|
|
private static String XH3CAPPKEY = "q7sli9ch"; |
|
|
|
|
|
|
@ -99,35 +105,40 @@ public class YgSynchronous { |
|
|
|
static final String dawb="http://19.25.35.205:31190/ZHSL_ZY/jck/yggx/dws_att_waga_base"; |
|
|
|
//堤防基础信息
|
|
|
|
static final String dadb= "http://19.25.35.205:31190/ZHSL_ZY/jck/yggx/dws_att_dike_base"; |
|
|
|
|
|
|
|
//水闸行政区划关系数据
|
|
|
|
static final String drwa="http://19.25.35.205:31190/ZHSL_ZY/dws_rel_waga_ad"; |
|
|
|
//堤防行政区划关系数据
|
|
|
|
static final String drda="http://19.25.35.205:31190/ZHSL_ZY/dws_rel_dike_ad"; |
|
|
|
//堤防水文特征数据
|
|
|
|
static final String dadt="http://19.25.35.205:31190/ZHSL_ZY/jck/ytjgx/dws_att_dike_bsfst"; |
|
|
|
/** |
|
|
|
* 同步 |
|
|
|
*/ |
|
|
|
// @GetMapping("sktz1")
|
|
|
|
// public void synchronous() throws ExecutionException, InterruptedException {
|
|
|
|
// int pageNum = 1;
|
|
|
|
// int pageSize = 1000;
|
|
|
|
// Boolean f = true;
|
|
|
|
// HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
// int i = 1;
|
|
|
|
// while (f) {
|
|
|
|
// String s = sendRequest(ddsj + "?pageNum=" + pageNum + "&pageSize=" + pageSize);
|
|
|
|
// String data = JSONObject.parseObject(s).getString("data");
|
|
|
|
// List<AttDiscBase> attResRspps = JSONObject.parseArray(data, AttDiscBase.class);
|
|
|
|
// if(attResRspps.size()<pageSize){
|
|
|
|
// f = false;
|
|
|
|
// }
|
|
|
|
// for (AttDiscBase attDiscBase : attResRspps) {
|
|
|
|
// hashMap.put(attDiscBase.getDiscCode(),i++);
|
|
|
|
// attDiscBase.preInsert();
|
|
|
|
// attDiscBase.setId(attDiscBase.getDiscCode());
|
|
|
|
// attDiscBaseService.save(attDiscBase);
|
|
|
|
// }
|
|
|
|
//// CopyOnWriteArrayList<AttDiscBase> attDiscBases = CollectionUtil.newCopyOnWriteArrayList(attResRspps);
|
|
|
|
//// executorService.execute(new sktz(attResRspps));
|
|
|
|
// pageNum++;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
@GetMapping("sktz1") |
|
|
|
public void synchronous() throws ExecutionException, InterruptedException { |
|
|
|
int pageNum = 1; |
|
|
|
int pageSize = 1000; |
|
|
|
Boolean f = true; |
|
|
|
HashMap<String, Object> hashMap = new HashMap<>(); |
|
|
|
int i = 1; |
|
|
|
while (f) { |
|
|
|
String s = sendRequest(ddsj + "?pageNum=" + pageNum + "&pageSize=" + pageSize); |
|
|
|
String data = JSONObject.parseObject(s).getString("data"); |
|
|
|
List<AttDiscBase> attResRspps = JSONObject.parseArray(data, AttDiscBase.class); |
|
|
|
if(attResRspps.size()<pageSize){ |
|
|
|
f = false; |
|
|
|
} |
|
|
|
for (AttDiscBase attDiscBase : attResRspps) { |
|
|
|
hashMap.put(attDiscBase.getDiscCode(),i++); |
|
|
|
attDiscBase.preInsert(); |
|
|
|
attDiscBase.setId(attDiscBase.getDiscCode()); |
|
|
|
attDiscBaseService.save(attDiscBase); |
|
|
|
} |
|
|
|
// CopyOnWriteArrayList<AttDiscBase> attDiscBases = CollectionUtil.newCopyOnWriteArrayList(attResRspps);
|
|
|
|
// executorService.execute(new sktz(attResRspps));
|
|
|
|
pageNum++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Data |
|
|
|
class sktz implements Runnable{ |
|
|
@ -156,6 +167,8 @@ public class YgSynchronous { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
* 提段线程 |
|
|
|
* @param list |
|
|
@ -193,6 +206,26 @@ public class YgSynchronous { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("dadt") |
|
|
|
@Scheduled(initialDelay = 0, fixedRate = Long.MAX_VALUE) |
|
|
|
public void dadt(){ |
|
|
|
int pageNum=1; |
|
|
|
int pageSize=999999; |
|
|
|
String s=sendRequest(dadt+"?pageNum=" + pageNum + "&pageSize=" + pageSize); |
|
|
|
String data=JSONObject.parseObject(s).getString("data"); |
|
|
|
List<BsSgcDfSwtzDto>sgcDfSwtzDtos=JSONObject.parseArray(data, BsSgcDfSwtzDto.class); |
|
|
|
sgcDfSwtzDtos.forEach(bsSgcDfSwtzDto -> { |
|
|
|
BsSgcDfSwtz bsSgcDfSwtz=new BsSgcDfSwtz(); |
|
|
|
bsSgcDfSwtz.setId(bsSgcDfSwtzDto.getDikeCode()); |
|
|
|
bsSgcDfSwtz.setDikeCode(bsSgcDfSwtzDto.getDikeCode()); |
|
|
|
bsSgcDfSwtz.setDsflStd(bsSgcDfSwtzDto.getFlcnst()); |
|
|
|
bsSgcDfSwtz.setDsflLev(bsSgcDfSwtzDto.getDsfllv()); |
|
|
|
bsSgcDfSwtz.setAlwtLev(bsSgcDfSwtzDto.getWrwl()); |
|
|
|
bsSgcDfSwtz.setNote(bsSgcDfSwtzDto.getNote()); |
|
|
|
bsSgcDfSwtz.setEffDate(bsSgcDfSwtzDto.getEffDate()); |
|
|
|
bsSgcDfSwtzService.saveOrUpdate(bsSgcDfSwtz); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("dadb") |
|
|
|
@Scheduled(initialDelay = 0, fixedRate = Long.MAX_VALUE) |
|
|
@ -200,8 +233,17 @@ public class YgSynchronous { |
|
|
|
int pageNum=1; |
|
|
|
int pageSize=999999; |
|
|
|
String s=sendRequest(dadb+"?pageNum=" + pageNum + "&pageSize=" + pageSize); |
|
|
|
String s1=sendRequest(drda+"?pageNum=" + pageNum + "&pageSize=" + pageSize); |
|
|
|
String data=JSONObject.parseObject(s).getString("data"); |
|
|
|
String dataAcad=JSONObject.parseObject(s1).getString("data"); |
|
|
|
List<BsSgcDfSafeJbxx> bsSgcDfSafeJbxxes=JSONObject.parseArray(data, BsSgcDfSafeJbxx.class); |
|
|
|
List<BsSgcDfSafeJbxx> bsSgcDfSafeJbxxesAcad=JSONObject.parseArray(dataAcad, BsSgcDfSafeJbxx.class); |
|
|
|
bsSgcDfSafeJbxxesAcad.forEach(bsSgcDfSafeJbxx -> { |
|
|
|
bsSgcDfSafeJbxx.preInsert(); |
|
|
|
bsSgcDfSafeJbxx.setId(bsSgcDfSafeJbxx.getDikeCode()); |
|
|
|
bsSgcDfSafeJbxx.setAdcd(bsSgcDfSafeJbxx.getAdcd().substring(0, Math.min(bsSgcDfSafeJbxx.getAdcd().length(), 6))); |
|
|
|
bsSgcDfSafeJbxxService.saveOrUpdate(bsSgcDfSafeJbxx); |
|
|
|
}); |
|
|
|
bsSgcDfSafeJbxxes.forEach(bsSgcDfSafeJbxx -> { |
|
|
|
bsSgcDfSafeJbxx.preInsert(); |
|
|
|
bsSgcDfSafeJbxx.setStatus("6"); |
|
|
@ -216,9 +258,19 @@ public class YgSynchronous { |
|
|
|
int pageNum=1; |
|
|
|
int pageSize=999999; |
|
|
|
String s=sendRequest(dawb+"?pageNum=" + pageNum + "&pageSize=" + pageSize); |
|
|
|
String s1=sendRequest(drwa+"?pageNum=" + pageNum + "&pageSize=" + pageSize); |
|
|
|
String data=JSONObject.parseObject(s).getString("data"); |
|
|
|
String dataAcad=JSONObject.parseObject(s1).getString("data"); |
|
|
|
List<BsSgcSzSafeJbxx> bsSgcSzSafeJbxxes=JSONObject.parseArray(data, BsSgcSzSafeJbxx.class); |
|
|
|
bsSgcSzSafeJbxxes.forEach(bsSgcSzSafeJbxx -> { |
|
|
|
List<BsSgcSzSafeJbxx> bsSgcSzSafeJbxxesAcad=JSONObject.parseArray(dataAcad, BsSgcSzSafeJbxx.class); |
|
|
|
|
|
|
|
bsSgcSzSafeJbxxesAcad.forEach(bsSgcSzSafeJbxx-> { |
|
|
|
bsSgcSzSafeJbxx.preInsert(); |
|
|
|
bsSgcSzSafeJbxx.setId(bsSgcSzSafeJbxx.getWagaCode()); |
|
|
|
bsSgcSzSafeJbxx.setAdcd(bsSgcSzSafeJbxx.getAdcd().substring(0, Math.min(bsSgcSzSafeJbxx.getAdcd().length(), 6))); |
|
|
|
bsSgcSzSafeJbxxService.saveOrUpdate(bsSgcSzSafeJbxx); |
|
|
|
}); |
|
|
|
bsSgcSzSafeJbxxes.forEach(bsSgcSzSafeJbxx -> { |
|
|
|
bsSgcSzSafeJbxx.preInsert(); |
|
|
|
bsSgcSzSafeJbxx.setStatus("6"); |
|
|
|
bsSgcSzSafeJbxx.setId(bsSgcSzSafeJbxx.getWagaCode()); |
|
|
|