/[projects]/dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/afstandandenrute/DatabaseRouteDistance.java
ViewVC logotype

Diff of /dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/afstandandenrute/DatabaseRouteDistance.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2971 by torben, Sat Feb 13 13:16:34 2016 UTC revision 2972 by torben, Tue Mar 8 09:41:53 2016 UTC
# Line 35  public class DatabaseRouteDistance { Line 35  public class DatabaseRouteDistance {
35                    
36          Map<Short,List<Address>> daekkedeAddressrHO = new HashMap<Short,List<Address>>();          Map<Short,List<Address>> daekkedeAddressrHO = new HashMap<Short,List<Address>>();
37                    
38            String weekdayField;
39            
40                    
41                    
42                    
# Line 51  public class DatabaseRouteDistance { Line 53  public class DatabaseRouteDistance {
53                    
54          private HashMap<Short,BoundingBox> bbCache = new HashMap<Short,BoundingBox>();          private HashMap<Short,BoundingBox> bbCache = new HashMap<Short,BoundingBox>();
55    
56          public DatabaseRouteDistance(Connection conn, boolean isIncremental)  throws SQLException,IOException {          public DatabaseRouteDistance(Connection conn, boolean isIncremental, String weekdayField) throws SQLException,IOException {
57                  this.conn = conn;                  this.conn = conn;
58                                    
59                  String newExt = "";                  String newExt = "";
60                  if (isIncremental == false) {                  if (isIncremental == false) {
61                          newExt = "_ny";                          newExt = "_ny";
62                  }                  }
63                    
64                    this.weekdayField = weekdayField;
65    
66                  String sql = "INSERT INTO fulddaekning.afstand_anden_rute" + newExt + " (orgId,orgPostnr, orgAdresse,orgGadeid,orgHusnr,orgHusnrBogstav,orgRute,id,postnr,adresse,gadeid,husnr,husnrbogstav,rute,afstand,`timestamp`) "+                  String sql = "INSERT IGNORE INTO fulddaekning.afstand_anden_rute" + newExt + " (orgId,orgPostnr, orgAdresse,orgGadeid,orgHusnr,orgHusnrBogstav,orgRute,id,postnr,adresse,gadeid,husnr,husnrbogstav,rute,afstand,`timestamp`) "+
67                                  "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, now() )";                                  "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, now() )";
68    
69                  saveStmt = conn.prepareStatement(sql);                            saveStmt = conn.prepareStatement(sql);          
# Line 137  public class DatabaseRouteDistance { Line 141  public class DatabaseRouteDistance {
141                                  "FROM fulddaekning.adressetabel a " +                                  "FROM fulddaekning.adressetabel a " +
142                                  "LEFT JOIN bogleveringer.postnummerdistributor p on (a.postnr=p.postnr) " +                                  "LEFT JOIN bogleveringer.postnummerdistributor p on (a.postnr=p.postnr) " +
143                                  placeHolder1 +                                  placeHolder1 +
144                                  "WHERE ruteMa IS NULL " +  //Ingen dækning                                  "WHERE " + weekdayField +  " IS NULL " +  //Ingen dækning
145                                  "AND a.postnr BETWEEN ? AND ? " +                                  "AND a.postnr BETWEEN ? AND ? " +
146                                  "AND latitude IS NOT NULL " +                                  "AND latitude IS NOT NULL " +
147                                  "AND longitude IS NOT NULL " +                                  "AND longitude IS NOT NULL " +
# Line 211  public class DatabaseRouteDistance { Line 215  public class DatabaseRouteDistance {
215                          String sql = "SELECT id,a.postnr,vejnavn,gadeid,husnr,husnrbogstav,latitude,longitude,ruteMa,p.distributor as ho " +                          String sql = "SELECT id,a.postnr,vejnavn,gadeid,husnr,husnrbogstav,latitude,longitude,ruteMa,p.distributor as ho " +
216                                          "FROM fulddaekning.adressetabel a " +                                          "FROM fulddaekning.adressetabel a " +
217                                          "LEFT JOIN bogleveringer.postnummerdistributor p on (a.postnr=p.postnr) " +                                          "LEFT JOIN bogleveringer.postnummerdistributor p on (a.postnr=p.postnr) " +
218                                          "WHERE ruteMa IS NOT NULL " +                                          "WHERE " + weekdayField +  " IS NOT NULL " +
219                                          "AND latitude IS NOT NULL " +                                          "AND latitude IS NOT NULL " +
220                                          "AND longitude IS NOT NULL " +                                          "AND longitude IS NOT NULL " +
221                                          "AND a.distributor = ? ";                                          "AND a.distributor = ? ";
# Line 305  public class DatabaseRouteDistance { Line 309  public class DatabaseRouteDistance {
309                  String sql1 = "UPDATE fulddaekning.afstand_anden_rute" + consts.getTableExtension() + " afstand " +                  String sql1 = "UPDATE fulddaekning.afstand_anden_rute" + consts.getTableExtension() + " afstand " +
310                                           "JOIN fulddaekning.adressetabel addr ON (afstand.id = addr.id) " +                                           "JOIN fulddaekning.adressetabel addr ON (afstand.id = addr.id) " +
311                                           "SET afstand.id = 0 " +                                           "SET afstand.id = 0 " +
312                                           "WHERE addr.rutema is null "                                           "WHERE ruteMa is null "
313                                           ;                                           ;
314                                    
315                  String sql2 = "DELETE FROM fulddaekning.afstand_anden_rute" + consts.getTableExtension() + " " +                  String sql2 = "DELETE FROM fulddaekning.afstand_anden_rute" + consts.getTableExtension() + " " +

Legend:
Removed from v.2971  
changed lines
  Added in v.2972

  ViewVC Help
Powered by ViewVC 1.1.20