inisialisasi
This commit is contained in:
304
src/main/java/org/sadigit/scheduling/Ago/JobGetAgoApkt.java
Normal file
304
src/main/java/org/sadigit/scheduling/Ago/JobGetAgoApkt.java
Normal file
@@ -0,0 +1,304 @@
|
||||
// package org.sadigit.scheduling.Ago;
|
||||
|
||||
// import com.iconpln.schedulerintegapktago.dao.AgoApktDao;
|
||||
// import java.io.IOException;
|
||||
// import java.util.ArrayList;
|
||||
// import java.util.HashMap;
|
||||
// import java.util.Iterator;
|
||||
// import java.util.List;
|
||||
// import java.util.Map;
|
||||
// import org.slf4j.Logger;
|
||||
// import org.slf4j.LoggerFactory;
|
||||
// import org.springframework.beans.factory.annotation.Autowired;
|
||||
// import org.springframework.stereotype.Component;
|
||||
|
||||
// @Component("jobGetAgoApkt")
|
||||
// public class JobGetAgoApkt {
|
||||
|
||||
// private static final Logger log =
|
||||
// LoggerFactory.getLogger(JobGetAgoApkt.class);
|
||||
|
||||
// @Autowired
|
||||
// private AgoApktDao agoApktDao;
|
||||
|
||||
// public JobGetAgoApkt() {
|
||||
// }
|
||||
|
||||
// public void executeGetAgoApkt() throws IOException {
|
||||
// log.info("--- JOB GET AGO APKT ---");
|
||||
// List<Map<String, String>> lstMap = this.getAmbilDataAgoSync();
|
||||
// if (!lstMap.isEmpty()) {
|
||||
// Iterator var2 = lstMap.iterator();
|
||||
|
||||
// while(var2.hasNext()) {
|
||||
// Map<String, String> mapsync = (Map)var2.next();
|
||||
// List lstMapMasterKooBon;
|
||||
// Map SimpanDataMasterKooBon;
|
||||
// if (((String)mapsync.get("id_master")).toString().equals("1")) {
|
||||
// lstMapMasterKooBon = this.getAmbilDataMaterialPihak3();
|
||||
// if (!lstMapMasterKooBon.isEmpty()) {
|
||||
// log.info("BERHASIL GET AGO JML DATA MATERIAL PIHAK 3 : {}",
|
||||
// lstMapMasterKooBon.size());
|
||||
// log.info("BERHASIL GET AGO RESPONSE MATERIAL PIHAK 3 : {}",
|
||||
// lstMapMasterKooBon);
|
||||
// SimpanDataMasterKooBon = this.SimpanDataMaterialPihak3(lstMapMasterKooBon);
|
||||
// if (((String)SimpanDataMasterKooBon.get("return")).equals("1")) {
|
||||
// log.info("BERHASIL SIMPAN AGO SIMPAN DATA MATERIAL PIHAK 3: {}",
|
||||
// SimpanDataMasterKooBon);
|
||||
// }
|
||||
// } else {
|
||||
// log.info("GAGAL GET AGO RESPONSE MATERIAL : DATA KOSONG {}",
|
||||
// lstMapMasterKooBon);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (((String)mapsync.get("id_master")).toString().equals("2")) {
|
||||
// lstMapMasterKooBon = this.getAmbilDataMasterKoo();
|
||||
// if (!lstMapMasterKooBon.isEmpty()) {
|
||||
// log.info("BERHASIL GET AGO JML DATA KOO : {}", lstMapMasterKooBon.size());
|
||||
// log.info("BERHASIL GET AGO RESPONSE KOO: {}", lstMapMasterKooBon);
|
||||
// SimpanDataMasterKooBon = this.SimpanDataMasterKoo(lstMapMasterKooBon);
|
||||
// if (((String)SimpanDataMasterKooBon.get("return")).equals("1")) {
|
||||
// log.info("BERHASIL SIMPAN AGO SIMPAN DATA KOO : {}", SimpanDataMasterKooBon);
|
||||
// }
|
||||
// } else {
|
||||
// log.info("GAGAL GET AGO RESPONSE MASTER KOO : DATA KOSONG {}",
|
||||
// lstMapMasterKooBon);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (((String)mapsync.get("id_master")).toString().equals("3")) {
|
||||
// lstMapMasterKooBon = this.getAmbilDataMasterKooRegu();
|
||||
// if (!lstMapMasterKooBon.isEmpty()) {
|
||||
// log.info("BERHASIL GET AGO JML DATA REGU : {}", lstMapMasterKooBon.size());
|
||||
// log.info("BERHASIL GET AGO RESPONSE REGU : {}", lstMapMasterKooBon);
|
||||
// SimpanDataMasterKooBon = this.SimpanDataMasterKooRegu(lstMapMasterKooBon);
|
||||
// if (((String)SimpanDataMasterKooBon.get("return")).equals("1")) {
|
||||
// log.info("BERHASIL SIMPAN AGO SIMPAN DATA REGU : {}",
|
||||
// SimpanDataMasterKooBon);
|
||||
// }
|
||||
// } else {
|
||||
// log.info("GAGAL GET AGO RESPONSE MASTER REGU : DATA KOSONG {}",
|
||||
// lstMapMasterKooBon);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (((String)mapsync.get("id_master")).toString().equals("4")) {
|
||||
// lstMapMasterKooBon = this.getAmbilDataKooBon();
|
||||
// if (!lstMapMasterKooBon.isEmpty()) {
|
||||
// log.info("BERHASIL GET AGO JML DATA KOO BON : {}",
|
||||
// lstMapMasterKooBon.size());
|
||||
// log.info("BERHASIL GET AGO RESPONSE KOO BON : {}", lstMapMasterKooBon);
|
||||
// SimpanDataMasterKooBon = this.SimpanDataMasterKooBon(lstMapMasterKooBon);
|
||||
// if (((String)SimpanDataMasterKooBon.get("return")).equals("1")) {
|
||||
// log.info("BERHASIL SIMPAN AGO SIMPAN DATA KOO BON : {}",
|
||||
// SimpanDataMasterKooBon);
|
||||
// }
|
||||
// } else {
|
||||
// log.info("GAGAL GET AGO RESPONSE MASTER KOO BON : DATA KOSONG {}",
|
||||
// lstMapMasterKooBon);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// log.info("GAGAL GET AGO RESPONSE SYNC : DATA KOSONG {}", lstMap);
|
||||
// }
|
||||
|
||||
// log.info("--- JOB GET APKT AGO---");
|
||||
// List<Map<String, String>> lstMapMasterKooBon =
|
||||
// this.getAmbilDataMasterKooBon();
|
||||
// List<Map<String, String>> lstMapPemakaian = this.getAmbilDataPemakaian();
|
||||
// List<Map<String, String>> lstMapKembali = this.getAmbilDataKembali();
|
||||
// List<Map<String, String>> lstMapPemakaianSync = new ArrayList();
|
||||
// Iterator var5;
|
||||
// Map mapsyncpemakaian;
|
||||
// if (!lstMapMasterKooBon.isEmpty()) {
|
||||
// var5 = lstMapMasterKooBon.iterator();
|
||||
|
||||
// while(var5.hasNext()) {
|
||||
// mapsyncpemakaian = (Map)var5.next();
|
||||
// log.info("BERHASIL GET APKT JML DATA MASTER KOO BON: {}",
|
||||
// lstMapMasterKooBon.size());
|
||||
// log.info("BERHASIL GET APKT ID_KOO : {}",
|
||||
// ((String)mapsyncpemakaian.get("id_koo")).toString());
|
||||
// log.info("BERHASIL GET APKT NOMOR_BON : {}",
|
||||
// ((String)mapsyncpemakaian.get("nomor_bon")).toString());
|
||||
// List<Map<String, String>> mapGetDataMaterialBon =
|
||||
// this.getAmbilDataMaterialBon(((String)mapsyncpemakaian.get("id_koo")).toString(),
|
||||
// ((String)mapsyncpemakaian.get("nomor_bon")).toString());
|
||||
// if (!mapGetDataMaterialBon.isEmpty()) {
|
||||
// log.info("BERHASIL GET APKT JML DATA MATERIAL BON : {}",
|
||||
// mapGetDataMaterialBon.size());
|
||||
// log.info("BERHASIL GET APKT RESPONSE MATERIAL BON : {}",
|
||||
// mapGetDataMaterialBon);
|
||||
// Map<String, String> mapSimpanDataBonMaterial =
|
||||
// this.SimpanDataBonMaterial(mapGetDataMaterialBon);
|
||||
// if (((String)mapSimpanDataBonMaterial.get("return")).equals("1")) {
|
||||
// log.info("BERHASIL APKT SIMPAN DATA MATERIAL BON : {}",
|
||||
// mapSimpanDataBonMaterial);
|
||||
// }
|
||||
// } else {
|
||||
// log.info("GAGAL GET APKT RESPONSE MATERIAL BON : DATA KOSONG {}",
|
||||
// mapGetDataMaterialBon);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// log.info("GAGAL GET APKT RESPONSE MASTER KOO BON : DATA KOSONG {}",
|
||||
// lstMapMasterKooBon);
|
||||
// }
|
||||
|
||||
// Map mapSimpanKembali;
|
||||
// if (!lstMapPemakaian.isEmpty()) {
|
||||
// log.info("BERHASIL GET APKT JML DATA PEMAKAIAN : {}",
|
||||
// lstMapPemakaian.size());
|
||||
// log.info("BERHASIL GET APKT RESPONSE PEMAKAIAN : {}", lstMapPemakaian);
|
||||
// log.info("LSTMAPPEMAKAIAN : {}", lstMapPemakaian);
|
||||
// var5 = lstMapPemakaian.iterator();
|
||||
|
||||
// while(var5.hasNext()) {
|
||||
// mapsyncpemakaian = (Map)var5.next();
|
||||
// log.info("MAPSYNCPEMAKAIAAN : {}", mapsyncpemakaian);
|
||||
// if (!((String)mapsyncpemakaian.get("nomor_bon")).toString().isEmpty()) {
|
||||
// lstMapPemakaianSync.add(mapsyncpemakaian);
|
||||
// log.info("LSTMAPPEMAKAIANSYNC : {}", lstMapPemakaianSync);
|
||||
// log.info("LSTMAPPEMAKAIANSYNC : {}", lstMapPemakaianSync.size());
|
||||
// } else {
|
||||
// log.info("GAGAL INSERT APKT PEMAKAIAN NO WO : {} TIDAK ADA NOMOR BON ",
|
||||
// ((String)mapsyncpemakaian.get("no_wo")).toString());
|
||||
// }
|
||||
// }
|
||||
|
||||
// mapSimpanKembali = this.SimpanDataTmpReservasiApkt(lstMapPemakaianSync);
|
||||
// if (((String)mapSimpanKembali.get("return")).equals("1")) {
|
||||
// log.info("BERHASIL SIMPAN APKT SIMPAN DATA PEMAKAIAN : {}",
|
||||
// mapSimpanKembali);
|
||||
// }
|
||||
// } else {
|
||||
// log.info("GAGAL GET APKT RESPONSE PEMAKAIAN : DATA KOSONG {}",
|
||||
// lstMapPemakaian);
|
||||
// }
|
||||
|
||||
// if (!lstMapKembali.isEmpty()) {
|
||||
// log.info("BERHASIL GET APKT JML DATA PENGEMBALIAN : {}",
|
||||
// lstMapKembali.size());
|
||||
// log.info("BERHASIL GET APKT RESPONSE PENGEMBALIAN : {}", lstMapKembali);
|
||||
// mapSimpanKembali = this.SimpanDataTmpPengembalianApkt(lstMapKembali);
|
||||
// if (((String)mapSimpanKembali.get("return")).equals("1")) {
|
||||
// log.info("BERHASIL SIMPAN APKT SIMPAN DATA PENGEMBALIAN : {}",
|
||||
// mapSimpanKembali);
|
||||
// }
|
||||
// } else {
|
||||
// log.info("GAGAL GET APKT RESPONSE PENGEMBALIAN : DATA KOSONG {}",
|
||||
// lstMapKembali);
|
||||
// }
|
||||
// }
|
||||
|
||||
// //AGO APKT
|
||||
// private List<Map<String, String>> getAmbilDataAgoSync() {
|
||||
// List<Map<String, String>> lstMap = this.agoApktDao.getAmbilDataAgoSync();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getAmbilDataMaterialPihak3() {
|
||||
// List<Map<String, String>> lstMap =
|
||||
// this.agoApktDao.getAmbilDataMaterialPihak3();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataMaterialPihak3(List<Map<String,
|
||||
// String>> lstMapMaterial) {
|
||||
// new HashMap();
|
||||
// Map<String, String> mapResult =
|
||||
// this.agoApktDao.SimpanDataMaterialPihak3(lstMapMaterial);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getAmbilDataMasterKoo() {
|
||||
// List<Map<String, String>> lstMap = this.agoApktDao.getAmbilDataMasterKoo();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataMasterKoo(List<Map<String, String>>
|
||||
// lstMapMaster) {
|
||||
// new HashMap();
|
||||
// Map<String, String> mapResult =
|
||||
// this.agoApktDao.SimpanDataMasterKoo(lstMapMaster);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getAmbilDataMasterKooRegu() {
|
||||
// List<Map<String, String>> lstMap =
|
||||
// this.agoApktDao.getAmbilDataMasterKooRegu();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataMasterKooRegu(List<Map<String, String>>
|
||||
// lstMapMasterRegu) {
|
||||
// new HashMap();
|
||||
// Map<String, String> mapResult =
|
||||
// this.agoApktDao.SimpanDataMasterKooRegu(lstMapMasterRegu);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getAmbilDataKooBon() {
|
||||
// List<Map<String, String>> lstMap = this.agoApktDao.getAmbilDataKooBon();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataMasterKooBon(List<Map<String, String>>
|
||||
// lstMapMasterKooBon) {
|
||||
// new HashMap();
|
||||
// Map<String, String> mapResult =
|
||||
// this.agoApktDao.SimpanDataMasterKooBon(lstMapMasterKooBon);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// //APKT AGO
|
||||
// private List<Map<String, String>> getAmbilDataMasterKooBon() {
|
||||
// List<Map<String, String>> lstMap =
|
||||
// this.agoApktDao.getAmbilDataMasterKooBon();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getAmbilDataMaterialBon(String id_koo,
|
||||
// String nomor_bon) {
|
||||
// List<Map<String, String>> lstMap =
|
||||
// this.agoApktDao.getAmbilDataMaterialBon(id_koo, nomor_bon);
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataBonMaterial(List<Map<String, String>>
|
||||
// lstMapBonMaterial) {
|
||||
// new HashMap();
|
||||
// Map<String, String> mapResult =
|
||||
// this.agoApktDao.SimpanDataBonMaterial(lstMapBonMaterial);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getAmbilDataPemakaian() {
|
||||
// List<Map<String, String>> lstMap = this.agoApktDao.getAmbilDataPemakaian();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataTmpReservasiApkt(List<Map<String,
|
||||
// String>> lstMapTmpReservasiApkt) {
|
||||
// new HashMap();
|
||||
// Map<String, String> mapResult =
|
||||
// this.agoApktDao.SimpanDataTmpReservasiApkt(lstMapTmpReservasiApkt);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getAmbilDataKembali() {
|
||||
// List<Map<String, String>> lstMap = this.agoApktDao.getAmbilDataKembali();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataTmpPengembalianApkt(List<Map<String,
|
||||
// String>> lstMapTmpPengembalianApkt) {
|
||||
// new HashMap();
|
||||
// Map<String, String> mapResult =
|
||||
// this.agoApktDao.SimpanDataTmpPengembalianApkt(lstMapTmpPengembalianApkt);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// }
|
13
src/main/java/org/sadigit/scheduling/AnotherBean.java
Normal file
13
src/main/java/org/sadigit/scheduling/AnotherBean.java
Normal file
@@ -0,0 +1,13 @@
|
||||
// package org.sadigit.scheduling;
|
||||
|
||||
// import org.springframework.stereotype.Component;
|
||||
|
||||
// @Component("anotherBean")
|
||||
// public class AnotherBean {
|
||||
|
||||
// public void printAnotherMessage(){
|
||||
// System.out.println("I am called by Quartz jobBean using
|
||||
// CronTriggerFactoryBean");
|
||||
// }
|
||||
|
||||
// }
|
294
src/main/java/org/sadigit/scheduling/Maximo/JobGetAsset.java
Normal file
294
src/main/java/org/sadigit/scheduling/Maximo/JobGetAsset.java
Normal file
@@ -0,0 +1,294 @@
|
||||
// package org.sadigit.scheduling.Maximo;
|
||||
|
||||
// import com.google.gson.Gson;
|
||||
// import com.google.gson.GsonBuilder;
|
||||
// import
|
||||
// com.iconpln.schedulerintegmaximoupdate.Interceptor.AuthenticationInterceptor;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.dao.AssetDao;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataGardu;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataPenyulang;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataTrafo;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.payload.ResponseGardu;
|
||||
// import
|
||||
// com.iconpln.schedulerintegmaximoupdate.model.payload.ResponsePenyulang;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.payload.ResponseTrafo;
|
||||
// import lombok.extern.slf4j.Slf4j;
|
||||
// import org.springframework.beans.factory.annotation.Autowired;
|
||||
// import org.springframework.beans.factory.annotation.Value;
|
||||
// import org.springframework.http.HttpEntity;
|
||||
// import org.springframework.http.HttpMethod;
|
||||
// import org.springframework.http.ResponseEntity;
|
||||
// import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
// import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
// import
|
||||
// org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
// import org.springframework.stereotype.Component;
|
||||
// import org.springframework.web.client.RestTemplate;
|
||||
|
||||
// import java.io.IOException;
|
||||
// import java.text.SimpleDateFormat;
|
||||
// import java.util.*;
|
||||
|
||||
// @Slf4j
|
||||
// @Component("jobGetAsset")
|
||||
// public class JobGetAsset {
|
||||
|
||||
// @Value("${url.api.maximo1}")
|
||||
// private String URL;
|
||||
|
||||
// @Value("${auth.api.maximo}")
|
||||
// private String AUTH;
|
||||
|
||||
// // @Value("${content.api.maximo}")
|
||||
// // private String CONTENT;
|
||||
|
||||
// @Autowired
|
||||
// private AssetDao assetDao;
|
||||
|
||||
// public void executeGetAsset() throws IOException {
|
||||
// log.info("--- JOB GET ASSET ---");
|
||||
// List<Map<String, String>> lstMap = getDataSiapAmbil();
|
||||
// log.info("JML DATA CXUNIT : {}", lstMap.size());
|
||||
// if (!lstMap.isEmpty()) {
|
||||
// for (Map<String, String> map : lstMap) {
|
||||
// if (map.get("tipe").toString().equals("GARDU") ) {
|
||||
// ResponseGardu response = getGarduUpdateEndPoint(map);
|
||||
// log.info("JML DATA GARDU : {}", response.getMember().size());
|
||||
// log.info("CXUNIT : {}", map.get("unitid").toString());
|
||||
// log.info("TIPE : {}", map.get("tipe").toString());
|
||||
|
||||
// if (response.getMember() != null) {
|
||||
// Map<String, String> mapSimpanDataGarduKolektif =
|
||||
// SimpanDataGarduKolektif(map.get("unitid").toString(), response.getMember());
|
||||
// if (mapSimpanDataGarduKolektif.get("return").equals("1")) {
|
||||
// log.info("SIMPAN DATA GARDU : {}", mapSimpanDataGarduKolektif);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (map.get("tipe").toString().equals("FEEDER") ) {
|
||||
// ResponsePenyulang response = getPenyulangUpdateEndPoint(map);
|
||||
// log.info("JML DATA PENYULANG : {}", response.getMember().size());
|
||||
// log.info("CXUNIT : {}", map.get("unitid").toString());
|
||||
// log.info("TIPE : {}", map.get("tipe").toString());
|
||||
|
||||
// if (response.getMember() != null) {
|
||||
// Map<String, String> mapSimpanDataPenyulangKolektif =
|
||||
// SimpanDataPenyulangKolektif(map.get("unitid").toString(),
|
||||
// response.getMember());
|
||||
// if (mapSimpanDataPenyulangKolektif.get("return").equals("1")) {
|
||||
// log.info("SIMPAN DATA PENYULANG : {}", mapSimpanDataPenyulangKolektif);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (map.get("tipe").toString().equals("TRAFO") ) {
|
||||
// ResponseTrafo response = getTrafoUpdateEndPoint(map);
|
||||
// log.info("JML DATA TRAFO : {}", response.getMember().size());
|
||||
// log.info("CXUNIT : {}", map.get("unitid").toString());
|
||||
// log.info("TIPE : {}", map.get("tipe").toString());
|
||||
|
||||
// if (response.getMember() != null) {
|
||||
// Map<String, String> mapSimpanDataTrafoKolektif =
|
||||
// SimpanDataTrafoKolektif(map.get("unitid").toString(), response.getMember());
|
||||
// if (mapSimpanDataTrafoKolektif.get("return").equals("1")) {
|
||||
// log.info("SIMPAN DATA TRAFO : {}", mapSimpanDataTrafoKolektif);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getDataSiapAmbil() {
|
||||
// List<Map<String, String>> lstMap = assetDao.getAmbilDataGardu();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private ResponseGardu getGarduUpdateEndPoint (Map<String, String> map) {
|
||||
// RestTemplate restTemplate = new RestTemplate();
|
||||
// Map<String, Object> mapParams = new HashMap<>();
|
||||
// ResponseGardu response = new ResponseGardu();
|
||||
// ResponseEntity<ResponseGardu> res = null;
|
||||
// try {
|
||||
// ClientHttpRequestInterceptor authenticationInterceptor = new
|
||||
// AuthenticationInterceptor(AUTH);
|
||||
// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor));
|
||||
// restTemplate.getMessageConverters().add(new
|
||||
// MappingJackson2HttpMessageConverter());
|
||||
// restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
|
||||
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// // String url = URL +
|
||||
// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and
|
||||
// cxunit=\"{unitid}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// String url = URL +
|
||||
// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,apkt_numbers,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// // String url = URL +
|
||||
// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,apkt_numbers,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// Object mapValue = "{longitudex,latitudey,formattedaddress}";
|
||||
// mapParams.put("longitudex,latitudey,formattedaddress", mapValue);
|
||||
// mapParams.put("unitid", map.get("unitid").toString());
|
||||
// mapParams.put("currentdate", formatter.format(date));
|
||||
// // Map mapParam = new HashMap();
|
||||
// // res = restTemplate.getForEntity(url, null, ResponseGardu.class, mapParam);
|
||||
// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY,
|
||||
// ResponseGardu.class, mapParams);
|
||||
// // log.info("res : {}", res);
|
||||
|
||||
// Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
// String jsonifyresponse = gson.toJson(res.getBody());
|
||||
// log.info("RESPONSE : {}", jsonifyresponse);
|
||||
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// log.error("ERROR GET GARDU : {}", ex);
|
||||
// // response.setRc("01");
|
||||
// response.setMessage("Error, "+ex.getMessage());
|
||||
// response.setMember(null);
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// return res.getBody();
|
||||
// }
|
||||
|
||||
// private ResponsePenyulang getPenyulangUpdateEndPoint (Map<String, String>
|
||||
// map) {
|
||||
// RestTemplate restTemplate = new RestTemplate();
|
||||
// Map<String, Object> mapParams = new HashMap<>();
|
||||
// ResponsePenyulang response = new ResponsePenyulang();
|
||||
// ResponseEntity<ResponsePenyulang> res = null;
|
||||
// try {
|
||||
// ClientHttpRequestInterceptor authenticationInterceptor = new
|
||||
// AuthenticationInterceptor(AUTH);
|
||||
// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor));
|
||||
// restTemplate.getMessageConverters().add(new
|
||||
// MappingJackson2HttpMessageConverter());
|
||||
// restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
|
||||
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// // String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,
|
||||
// location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec{assetattrid,alnvalue,numvalue,measureunitid},location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy{parent}&oslc.where=status="OPERATING"
|
||||
// and cxclassificationdesc="MVCable 20 kV" and
|
||||
// apkt_number!="NULL"&ignorecollectionref=1&oslc.pageSize=10&lean=1&collectioncount=1";
|
||||
// String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,endmeasure&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"MVCable 20 kV\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// // String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,endmeasure&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"MVCable 20 kV\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// Object mapValue =
|
||||
// "{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit}";
|
||||
// mapParams.put("serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit",
|
||||
// mapValue);
|
||||
// mapParams.put("unitid", map.get("unitid").toString());
|
||||
// mapParams.put("currentdate", formatter.format(date));
|
||||
// // Map mapParam = new HashMap();
|
||||
// // res = restTemplate.getForEntity(url, null, ResponseTrafo.class, mapParam);
|
||||
// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY,
|
||||
// ResponsePenyulang.class, mapParams);
|
||||
// // log.info("res : {}", res);
|
||||
|
||||
// Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
// String jsonifyresponse = gson.toJson(res.getBody());
|
||||
// log.info("RESPONSE : {}", jsonifyresponse);
|
||||
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// log.error("ERROR GET PENYULANG : {}", ex);
|
||||
// // response.setRc("01");
|
||||
// response.setMessage("Error, "+ex.getMessage());
|
||||
// response.setMember(null);
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// return res.getBody();
|
||||
// }
|
||||
|
||||
// private ResponseTrafo getTrafoUpdateEndPoint (Map<String, String> map) {
|
||||
// RestTemplate restTemplate = new RestTemplate();
|
||||
// Map<String, Object> mapParams = new HashMap<>();
|
||||
// ResponseTrafo response = new ResponseTrafo();
|
||||
// ResponseEntity<ResponseTrafo> res = null;
|
||||
// try {
|
||||
// ClientHttpRequestInterceptor authenticationInterceptor = new
|
||||
// AuthenticationInterceptor(AUTH);
|
||||
// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor));
|
||||
// restTemplate.getMessageConverters().add(new
|
||||
// MappingJackson2HttpMessageConverter());
|
||||
// restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
|
||||
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// // String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Trafo\" and
|
||||
// cxunit=\"{unitid}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Trafo\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// // String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Trafo\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// Object mapValue =
|
||||
// "{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit}";
|
||||
// mapParams.put("serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit",
|
||||
// mapValue);
|
||||
// mapParams.put("unitid", map.get("unitid").toString());
|
||||
// mapParams.put("currentdate", formatter.format(date));
|
||||
// // Map mapParam = new HashMap();
|
||||
// // res = restTemplate.getForEntity(url, null, ResponseTrafo.class, mapParam);
|
||||
// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY,
|
||||
// ResponseTrafo.class, mapParams);
|
||||
// // log.info("res : {}", res);
|
||||
|
||||
// Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
// String jsonifyresponse = gson.toJson(res.getBody());
|
||||
// log.info("RESPONSE : {}", jsonifyresponse);
|
||||
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// log.error("ERROR GET TRAFO : {}", ex);
|
||||
// // response.setRc("01");
|
||||
// response.setMessage("Error, "+ex.getMessage());
|
||||
// response.setMember(null);
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// return res.getBody();
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataGarduKolektif(String unitid,
|
||||
// List<DataGardu> lstGardu){
|
||||
// Map<String, String> mapResult = new HashMap<>();
|
||||
// mapResult = assetDao.SimpanDataGarduKolektif(unitid, lstGardu);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataPenyulangKolektif(String unitid,
|
||||
// List<DataPenyulang> lstPenyulang){
|
||||
// Map<String, String> mapResult = new HashMap<>();
|
||||
// mapResult = assetDao.SimpanDataPenyulangKolektif(unitid, lstPenyulang);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataTrafoKolektif(String unitid,
|
||||
// List<DataTrafo> lstTrafo){
|
||||
// Map<String, String> mapResult = new HashMap<>();
|
||||
// mapResult = assetDao.SimpanDataTrafoKolektif(unitid, lstTrafo);
|
||||
// return mapResult;
|
||||
// }
|
||||
// }
|
@@ -0,0 +1,133 @@
|
||||
// package org.sadigit.scheduling.Maximo;
|
||||
|
||||
// import com.google.gson.Gson;
|
||||
// import com.google.gson.GsonBuilder;
|
||||
// import
|
||||
// com.iconpln.schedulerintegmaximoupdate.Interceptor.AuthenticationInterceptor;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.dao.GarduDao;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataGardu;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.payload.ResponseGardu;
|
||||
// import lombok.extern.slf4j.Slf4j;
|
||||
// import org.springframework.beans.factory.annotation.Autowired;
|
||||
// import org.springframework.beans.factory.annotation.Value;
|
||||
// import org.springframework.http.HttpEntity;
|
||||
// import org.springframework.http.HttpMethod;
|
||||
// import org.springframework.http.ResponseEntity;
|
||||
// import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
// import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
// import
|
||||
// org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
// import org.springframework.stereotype.Component;
|
||||
// import org.springframework.web.client.RestTemplate;
|
||||
|
||||
// import java.io.IOException;
|
||||
// import java.text.SimpleDateFormat;
|
||||
// import java.util.*;
|
||||
|
||||
// @Slf4j
|
||||
// @Component("jobGetGarduUpdate")
|
||||
// public class JobGetGarduUpdate {
|
||||
|
||||
// @Value("${url.api.maximo1}")
|
||||
// private String URL;
|
||||
|
||||
// @Value("${auth.api.maximo}")
|
||||
// private String AUTH;
|
||||
|
||||
// // @Value("${content.api.maximo}")
|
||||
// // private String CONTENT;
|
||||
|
||||
// @Autowired
|
||||
// private GarduDao garduDao;
|
||||
|
||||
// public void executeGetGarduUpdate() throws IOException {
|
||||
// log.info("--- JOB GET GARDU ---");
|
||||
// List<Map<String, String>> lstMap = getDataSiapAmbil();
|
||||
// // log.info("JML DATA CXUNIT : {}", lstMap.size());
|
||||
// if (!lstMap.isEmpty()) {
|
||||
// for (Map<String, String> map : lstMap) {
|
||||
// if (map.get("tipe").toString().equals("GARDU") ) {
|
||||
// ResponseGardu response = getGarduUpdateEndPoint(map);
|
||||
// log.info("JML DATA GARDU : {}", response.getMember().size());
|
||||
// log.info("CXUNIT : {}", map.get("unitid").toString());
|
||||
// log.info("TIPE : {}", map.get("tipe").toString());
|
||||
|
||||
// if (response.getMember() != null) {
|
||||
// Map<String, String> mapSimpanDataGarduKolektif =
|
||||
// SimpanDataGarduKolektif(map.get("unitid").toString(), response.getMember());
|
||||
// if (mapSimpanDataGarduKolektif.get("return").equals("1")) {
|
||||
// log.info("SIMPAN DATA GARDU : {}", mapSimpanDataGarduKolektif);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getDataSiapAmbil() {
|
||||
// List<Map<String, String>> lstMap = garduDao.getAmbilDataGardu();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private ResponseGardu getGarduUpdateEndPoint (Map<String, String> map) {
|
||||
// RestTemplate restTemplate = new RestTemplate();
|
||||
// Map<String, Object> mapParams = new HashMap<>();
|
||||
// ResponseGardu response = new ResponseGardu();
|
||||
// ResponseEntity<ResponseGardu> res = null;
|
||||
// try {
|
||||
// ClientHttpRequestInterceptor authenticationInterceptor = new
|
||||
// AuthenticationInterceptor(AUTH);
|
||||
// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor));
|
||||
// restTemplate.getMessageConverters().add(new
|
||||
// MappingJackson2HttpMessageConverter());
|
||||
// restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
|
||||
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// // String url = URL +
|
||||
// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and
|
||||
// cxunit=\"{unitid}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// // String url = URL +
|
||||
// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,apkt_numbers,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// String url = URL +
|
||||
// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,apkt_numbers,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// Object mapValue = "{longitudex,latitudey,formattedaddress}";
|
||||
// mapParams.put("longitudex,latitudey,formattedaddress", mapValue);
|
||||
// mapParams.put("unitid", map.get("unitid").toString());
|
||||
// mapParams.put("currentdate", formatter.format(date));
|
||||
// // Map mapParam = new HashMap();
|
||||
// // res = restTemplate.getForEntity(url, null, ResponseGardu.class, mapParam);
|
||||
// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY,
|
||||
// ResponseGardu.class, mapParams);
|
||||
// // log.info("res : {}", res);
|
||||
|
||||
// Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
// String jsonifyresponse = gson.toJson(res.getBody());
|
||||
// log.info("RESPONSE : {}", jsonifyresponse);
|
||||
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// log.error("ERROR GET GARDU : {}", ex);
|
||||
// // response.setRc("01");
|
||||
// response.setMessage("Error, "+ex.getMessage());
|
||||
// response.setMember(null);
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// return res.getBody();
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataGarduKolektif(String unitid,
|
||||
// List<DataGardu> lstGardu){
|
||||
// Map<String, String> mapResult = new HashMap<>();
|
||||
// mapResult = garduDao.SimpanDataGarduKolektif(unitid, lstGardu);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// }
|
@@ -0,0 +1,139 @@
|
||||
// package org.sadigit.scheduling.Maximo;
|
||||
|
||||
// import com.google.gson.Gson;
|
||||
// import com.google.gson.GsonBuilder;
|
||||
// import
|
||||
// com.iconpln.schedulerintegmaximoupdate.Interceptor.AuthenticationInterceptor;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.dao.PenyulangDao;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataPenyulang;
|
||||
// import
|
||||
// com.iconpln.schedulerintegmaximoupdate.model.payload.ResponsePenyulang;
|
||||
// import lombok.extern.slf4j.Slf4j;
|
||||
// import org.springframework.beans.factory.annotation.Autowired;
|
||||
// import org.springframework.beans.factory.annotation.Value;
|
||||
// import org.springframework.http.HttpEntity;
|
||||
// import org.springframework.http.HttpMethod;
|
||||
// import org.springframework.http.ResponseEntity;
|
||||
// import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
// import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
// import
|
||||
// org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
// import org.springframework.stereotype.Component;
|
||||
// import org.springframework.web.client.RestTemplate;
|
||||
|
||||
// import java.io.IOException;
|
||||
// import java.text.SimpleDateFormat;
|
||||
// import java.util.*;
|
||||
|
||||
// @Slf4j
|
||||
// @Component("jobGetPenyulangUpdate")
|
||||
// public class JobGetPenyulangUpdate {
|
||||
|
||||
// @Value("${url.api.maximo1}")
|
||||
// private String URL;
|
||||
|
||||
// @Value("${auth.api.maximo}")
|
||||
// private String AUTH;
|
||||
|
||||
// // @Value("${content.api.maximo}")
|
||||
// // private String CONTENT;
|
||||
|
||||
// @Autowired
|
||||
// private PenyulangDao penyulangDao;
|
||||
|
||||
// public void executeGetPenyulangUpdate() throws IOException {
|
||||
// log.info("--- JOB GET PENYULANG ---");
|
||||
// List<Map<String, String>> lstMap = getDataSiapAmbil();
|
||||
// // log.info("JML DATA CXUNIT : {}", lstMap.size());
|
||||
// if (!lstMap.isEmpty()) {
|
||||
// for (Map<String, String> map : lstMap) {
|
||||
// if (map.get("tipe").toString().equals("FEEDER") ) {
|
||||
// ResponsePenyulang response = getPenyulangUpdateEndPoint(map);
|
||||
// log.info("JML DATA PENYULANG : {}", response.getMember().size());
|
||||
// log.info("CXUNIT : {}", map.get("unitid").toString());
|
||||
// log.info("TIPE : {}", map.get("tipe").toString());
|
||||
|
||||
// if (response.getMember() != null) {
|
||||
// Map<String, String> mapSimpanDataPenyulangKolektif =
|
||||
// SimpanDataPenyulangKolektif(map.get("unitid").toString(),
|
||||
// response.getMember());
|
||||
// if (mapSimpanDataPenyulangKolektif.get("return").equals("1")) {
|
||||
// log.info("SIMPAN DATA PENYULANG : {}", mapSimpanDataPenyulangKolektif);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getDataSiapAmbil() {
|
||||
// List<Map<String, String>> lstMap = penyulangDao.getAmbilDataPenyulang();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private ResponsePenyulang getPenyulangUpdateEndPoint (Map<String, String>
|
||||
// map) {
|
||||
// RestTemplate restTemplate = new RestTemplate();
|
||||
// Map<String, Object> mapParams = new HashMap<>();
|
||||
// ResponsePenyulang response = new ResponsePenyulang();
|
||||
// ResponseEntity<ResponsePenyulang> res = null;
|
||||
// try {
|
||||
// ClientHttpRequestInterceptor authenticationInterceptor = new
|
||||
// AuthenticationInterceptor(AUTH);
|
||||
// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor));
|
||||
// restTemplate.getMessageConverters().add(new
|
||||
// MappingJackson2HttpMessageConverter());
|
||||
// restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
|
||||
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// // String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,
|
||||
// location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec{assetattrid,alnvalue,numvalue,measureunitid},location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy{parent}&oslc.where=status="OPERATING"
|
||||
// and cxclassificationdesc="MVCable 20 kV" and
|
||||
// apkt_number!="NULL"&ignorecollectionref=1&oslc.pageSize=10&lean=1&collectioncount=1";
|
||||
// // String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,endmeasure&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"MVCable 20 kV\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,endmeasure&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"MVCable 20 kV\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// Object mapValue =
|
||||
// "{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit}";
|
||||
// mapParams.put("serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit",
|
||||
// mapValue);
|
||||
// mapParams.put("unitid", map.get("unitid").toString());
|
||||
// mapParams.put("currentdate", formatter.format(date));
|
||||
// // Map mapParam = new HashMap();
|
||||
// // res = restTemplate.getForEntity(url, null, ResponseTrafo.class, mapParam);
|
||||
// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY,
|
||||
// ResponsePenyulang.class, mapParams);
|
||||
// // log.info("res : {}", res);
|
||||
|
||||
// Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
// String jsonifyresponse = gson.toJson(res.getBody());
|
||||
// log.info("RESPONSE : {}", jsonifyresponse);
|
||||
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// log.error("ERROR GET PENYULANG : {}", ex);
|
||||
// // response.setRc("01");
|
||||
// response.setMessage("Error, "+ex.getMessage());
|
||||
// response.setMember(null);
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// return res.getBody();
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataPenyulangKolektif(String unitid,
|
||||
// List<DataPenyulang> lstPenyulang){
|
||||
// Map<String, String> mapResult = new HashMap<>();
|
||||
// mapResult = penyulangDao.SimpanDataPenyulangKolektif(unitid, lstPenyulang);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// }
|
@@ -0,0 +1,135 @@
|
||||
// package org.sadigit.scheduling.Maximo;
|
||||
|
||||
// import com.google.gson.Gson;
|
||||
// import com.google.gson.GsonBuilder;
|
||||
// import
|
||||
// com.iconpln.schedulerintegmaximoupdate.Interceptor.AuthenticationInterceptor;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.dao.TrafoDao;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataTrafo;
|
||||
// import com.iconpln.schedulerintegmaximoupdate.model.payload.ResponseTrafo;
|
||||
// import lombok.extern.slf4j.Slf4j;
|
||||
// import org.springframework.beans.factory.annotation.Autowired;
|
||||
// import org.springframework.beans.factory.annotation.Value;
|
||||
// import org.springframework.http.HttpEntity;
|
||||
// import org.springframework.http.HttpMethod;
|
||||
// import org.springframework.http.ResponseEntity;
|
||||
// import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
// import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
// import
|
||||
// org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
// import org.springframework.stereotype.Component;
|
||||
// import org.springframework.web.client.RestTemplate;
|
||||
|
||||
// import java.io.IOException;
|
||||
// import java.text.SimpleDateFormat;
|
||||
// import java.util.*;
|
||||
|
||||
// @Slf4j
|
||||
// @Component("jobGetTrafoUpdate")
|
||||
// public class JobGetTrafoUpdate {
|
||||
|
||||
// @Value("${url.api.maximo1}")
|
||||
// private String URL;
|
||||
|
||||
// @Value("${auth.api.maximo}")
|
||||
// private String AUTH;
|
||||
|
||||
// // @Value("${content.api.maximo}")
|
||||
// // private String CONTENT;
|
||||
|
||||
// @Autowired
|
||||
// private TrafoDao trafoDao;
|
||||
|
||||
// public void executeGetTrafoUpdate() throws IOException {
|
||||
// log.info("--- JOB GET TRAFO ---");
|
||||
// List<Map<String, String>> lstMap = getDataSiapAmbil();
|
||||
// // log.info("JML DATA CXUNIT : {}", lstMap.size());
|
||||
// if (!lstMap.isEmpty()) {
|
||||
// for (Map<String, String> map : lstMap) {
|
||||
// if (map.get("tipe").toString().equals("TRAFO") ) {
|
||||
// ResponseTrafo response = getTrafoUpdateEndPoint(map);
|
||||
// log.info("JML DATA TRAFO : {}", response.getMember().size());
|
||||
// log.info("CXUNIT : {}", map.get("unitid").toString());
|
||||
// log.info("TIPE : {}", map.get("tipe").toString());
|
||||
|
||||
// if (response.getMember() != null) {
|
||||
// Map<String, String> mapSimpanDataTrafoKolektif =
|
||||
// SimpanDataTrafoKolektif(map.get("unitid").toString(), response.getMember());
|
||||
// if (mapSimpanDataTrafoKolektif.get("return").equals("1")) {
|
||||
// log.info("SIMPAN DATA TRAFO : {}", mapSimpanDataTrafoKolektif);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private List<Map<String, String>> getDataSiapAmbil() {
|
||||
// List<Map<String, String>> lstMap = trafoDao.getAmbilDataTrafo();
|
||||
// return lstMap;
|
||||
// }
|
||||
|
||||
// private ResponseTrafo getTrafoUpdateEndPoint (Map<String, String> map) {
|
||||
// RestTemplate restTemplate = new RestTemplate();
|
||||
// Map<String, Object> mapParams = new HashMap<>();
|
||||
// ResponseTrafo response = new ResponseTrafo();
|
||||
// ResponseEntity<ResponseTrafo> res = null;
|
||||
// try {
|
||||
// ClientHttpRequestInterceptor authenticationInterceptor = new
|
||||
// AuthenticationInterceptor(AUTH);
|
||||
// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor));
|
||||
// restTemplate.getMessageConverters().add(new
|
||||
// MappingJackson2HttpMessageConverter());
|
||||
// restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
|
||||
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
// // String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Trafo\" and
|
||||
// cxunit=\"{unitid}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// // String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Trafo\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// String url = URL +
|
||||
// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\"
|
||||
// and cxclassificationdesc=\"Trafo\" and cxunit=\"{unitid}\" and
|
||||
// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1";
|
||||
// Object mapValue =
|
||||
// "{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit}";
|
||||
// mapParams.put("serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit",
|
||||
// mapValue);
|
||||
// mapParams.put("unitid", map.get("unitid").toString());
|
||||
// mapParams.put("currentdate", formatter.format(date));
|
||||
// // Map mapParam = new HashMap();
|
||||
// // res = restTemplate.getForEntity(url, null, ResponseTrafo.class, mapParam);
|
||||
// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY,
|
||||
// ResponseTrafo.class, mapParams);
|
||||
// // log.info("res : {}", res);
|
||||
|
||||
// Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
// String jsonifyresponse = gson.toJson(res.getBody());
|
||||
// log.info("RESPONSE : {}", jsonifyresponse);
|
||||
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// log.error("ERROR GET TRAFO : {}", ex);
|
||||
// // response.setRc("01");
|
||||
// response.setMessage("Error, "+ex.getMessage());
|
||||
// response.setMember(null);
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// return res.getBody();
|
||||
// }
|
||||
|
||||
// private Map<String, String> SimpanDataTrafoKolektif(String unitid,
|
||||
// List<DataTrafo> lstTrafo){
|
||||
// Map<String, String> mapResult = new HashMap<>();
|
||||
// mapResult = trafoDao.SimpanDataTrafoKolektif(unitid, lstTrafo);
|
||||
// return mapResult;
|
||||
// }
|
||||
|
||||
// }
|
Reference in New Issue
Block a user