Commit 73a5679376ee80b6ff0042e68997e90cf89affd1
Merge branch 'minhang' of
http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing
56 changed files
with
2489 additions
and
884 deletions
Too many changes to show.
To preserve performance only 56 of 203 files are displayed.
src/main/java/com/bsth/controller/BusinessController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; |
| 5 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 4 | 6 | import org.springframework.web.bind.annotation.RestController; |
| 5 | 7 | |
| 6 | 8 | import com.bsth.entity.Business; |
| 9 | +import com.bsth.service.BusinessService; | |
| 10 | +import com.bsth.util.GetUIDAndCode; | |
| 7 | 11 | |
| 8 | 12 | /** |
| 9 | 13 | * |
| ... | ... | @@ -23,5 +27,11 @@ import com.bsth.entity.Business; |
| 23 | 27 | @RestController |
| 24 | 28 | @RequestMapping("business") |
| 25 | 29 | public class BusinessController extends BaseController<Business, Integer> { |
| 26 | - | |
| 30 | + @Autowired | |
| 31 | + private BusinessService businessService; | |
| 32 | + | |
| 33 | + @RequestMapping(value = "getCompCode", method = RequestMethod.GET) | |
| 34 | + public long getLineCode() { | |
| 35 | + return businessService.getCompCode(); | |
| 36 | + } | |
| 27 | 37 | } | ... | ... |
src/main/java/com/bsth/controller/SectionController.java
| ... | ... | @@ -48,13 +48,9 @@ public class SectionController extends BaseController<Section, Integer> { |
| 48 | 48 | */ |
| 49 | 49 | @RequestMapping(value="sectionSave" , method = RequestMethod.POST) |
| 50 | 50 | public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) { |
| 51 | - | |
| 52 | 51 | map.put("createBy", ""); |
| 53 | - | |
| 54 | 52 | map.put("updateBy", ""); |
| 55 | - | |
| 56 | 53 | return service.sectionSave(map); |
| 57 | - | |
| 58 | 54 | } |
| 59 | 55 | |
| 60 | 56 | /** | ... | ... |
src/main/java/com/bsth/controller/SectionRouteController.java
| ... | ... | @@ -35,6 +35,17 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer |
| 35 | 35 | @Autowired |
| 36 | 36 | SectionRouteService routeService; |
| 37 | 37 | |
| 38 | + /** | |
| 39 | + * @param @param map | |
| 40 | + * @throws | |
| 41 | + * @Title: list | |
| 42 | + * @Description: TODO(多条件查询) | |
| 43 | + */ | |
| 44 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | |
| 45 | + public Iterable<SectionRoute> list(@RequestParam Map<String, Object> map) { | |
| 46 | + return routeService.list(map); | |
| 47 | + } | |
| 48 | + | |
| 38 | 49 | /** |
| 39 | 50 | * @Description :TODO(查询路段信息) |
| 40 | 51 | * |
| ... | ... | @@ -57,7 +68,6 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer |
| 57 | 68 | */ |
| 58 | 69 | @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET) |
| 59 | 70 | public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) { |
| 60 | - | |
| 61 | 71 | return routeService.findSectionRouteInfoFormId(map); |
| 62 | 72 | } |
| 63 | 73 | ... | ... |
src/main/java/com/bsth/controller/StationController.java
| ... | ... | @@ -60,16 +60,12 @@ public class StationController extends BaseController<Station, Integer> { |
| 60 | 60 | */ |
| 61 | 61 | @RequestMapping(value="collectionSave" , method = RequestMethod.POST) |
| 62 | 62 | public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) { |
| 63 | - | |
| 64 | 63 | return service.systemSaveStations(map); |
| 65 | - | |
| 66 | 64 | } |
| 67 | 65 | |
| 68 | 66 | @RequestMapping(value="manualSave" , method = RequestMethod.POST) |
| 69 | 67 | public Map<String, Object> manualSave(@RequestParam Map<String, Object> map) { |
| 70 | - | |
| 71 | 68 | return service.manualSave(map); |
| 72 | - | |
| 73 | 69 | } |
| 74 | 70 | |
| 75 | 71 | /** |
| ... | ... | @@ -89,13 +85,9 @@ public class StationController extends BaseController<Station, Integer> { |
| 89 | 85 | */ |
| 90 | 86 | @RequestMapping(value="stationSave" , method = RequestMethod.POST) |
| 91 | 87 | public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { |
| 92 | - | |
| 93 | 88 | map.put("createBy", ""); |
| 94 | - | |
| 95 | 89 | map.put("updateBy", ""); |
| 96 | - | |
| 97 | 90 | return service.stationSaveMap(map); |
| 98 | - | |
| 99 | 91 | } |
| 100 | 92 | |
| 101 | 93 | /** | ... | ... |
src/main/java/com/bsth/controller/StationRouteController.java
| ... | ... | @@ -36,6 +36,17 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 36 | 36 | @Autowired |
| 37 | 37 | StationRouteRepository stationRouteRepository; |
| 38 | 38 | |
| 39 | + /** | |
| 40 | + * @param @param map | |
| 41 | + * @throws | |
| 42 | + * @Title: list | |
| 43 | + * @Description: TODO(多条件查询) | |
| 44 | + */ | |
| 45 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | |
| 46 | + public Iterable<StationRoute> list(@RequestParam Map<String, Object> map) { | |
| 47 | + return service.list(map); | |
| 48 | + } | |
| 49 | + | |
| 39 | 50 | /** |
| 40 | 51 | * @Description :TODO(查询树站点与路段数据) |
| 41 | 52 | * | ... | ... |
src/main/java/com/bsth/entity/Business.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +import javax.persistence.Column; | |
| 3 | 6 | import javax.persistence.Entity; |
| 4 | 7 | import javax.persistence.GeneratedValue; |
| 5 | 8 | import javax.persistence.GenerationType; |
| ... | ... | @@ -40,6 +43,29 @@ public class Business { |
| 40 | 43 | |
| 41 | 44 | // 描述 |
| 42 | 45 | private String descriptions; |
| 46 | + | |
| 47 | + // 创建日期 | |
| 48 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 49 | + private Date createDate; | |
| 50 | + | |
| 51 | + // 修改日期 | |
| 52 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 53 | + private Date updateDate; | |
| 54 | + public Date getCreateDate() { | |
| 55 | + return createDate; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setCreateDate(Date createDate) { | |
| 59 | + this.createDate = createDate; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public Date getUpdateDate() { | |
| 63 | + return updateDate; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setUpdateDate(Date updateDate) { | |
| 67 | + this.updateDate = updateDate; | |
| 68 | + } | |
| 43 | 69 | |
| 44 | 70 | public Integer getId() { |
| 45 | 71 | return id; | ... | ... |
src/main/java/com/bsth/entity/LineInformation.java
| ... | ... | @@ -64,6 +64,12 @@ public class LineInformation { |
| 64 | 64 | // 晚高峰结束时间 00:00 |
| 65 | 65 | private String lateEndTime; |
| 66 | 66 | |
| 67 | + // 小夜高峰开始时间 00:00 | |
| 68 | + private String xygfkssj; | |
| 69 | + | |
| 70 | + // 小夜高峰结束时间 00:00 | |
| 71 | + private String xygfjssj; | |
| 72 | + | |
| 67 | 73 | // 早高峰上行行驶时间 |
| 68 | 74 | private Double earlyUpTime; |
| 69 | 75 | |
| ... | ... | @@ -91,15 +97,6 @@ public class LineInformation { |
| 91 | 97 | // 停车场 |
| 92 | 98 | private String carPark; |
| 93 | 99 | |
| 94 | - // 进场时间 | |
| 95 | - private Double paradeTime; | |
| 96 | - | |
| 97 | - // 出场时间 | |
| 98 | - private Double outTime; | |
| 99 | - | |
| 100 | - // 进场里程 | |
| 101 | - private Double paradeMileage; | |
| 102 | - | |
| 103 | 100 | // 上行进场时间 |
| 104 | 101 | private Double upInTimer; |
| 105 | 102 | |
| ... | ... | @@ -123,7 +120,82 @@ public class LineInformation { |
| 123 | 120 | |
| 124 | 121 | // 下行出场里程 |
| 125 | 122 | private Double downOutMileage; |
| 123 | + | |
| 124 | + // 早高峰大间隔(分钟)老调度系统字段,暂时保留 | |
| 125 | + private Double earlyIntervalLg; | |
| 126 | + | |
| 127 | + // 晚高峰大间隔(分钟)老调度系统字段,暂时保留 | |
| 128 | + private Double lateIntervalLg; | |
| 129 | + | |
| 130 | + // 平时大间隔(分钟)老调度系统字段,暂时保留 | |
| 131 | + private Double intervalLg; | |
| 132 | + | |
| 133 | + // 限速(平时)老调度系统字段,暂时保留 | |
| 134 | + private Double speedLimit; | |
| 135 | + | |
| 136 | + // 限速(雨天)老调度系统字段,暂时保留 | |
| 137 | + private Double rainLimit; | |
| 138 | + | |
| 139 | + // 限速(大雾)老调度系统字段,暂时保留 | |
| 140 | + private Double fogLimit; | |
| 126 | 141 | |
| 142 | + // 限速(冰雪)老调度系统字段,暂时保留 | |
| 143 | + private Double snowLimit; | |
| 144 | + | |
| 145 | + // 限速(节庆)老调度系统字段,暂时保留 | |
| 146 | + private Double festivalSpeedLimit; | |
| 147 | + | |
| 148 | + // 滞站 | |
| 149 | + private Integer lagStation; | |
| 150 | + | |
| 151 | + // 越站 | |
| 152 | + private Integer skip; | |
| 153 | + | |
| 154 | + // 超速 | |
| 155 | + private Integer speeding; | |
| 156 | + | |
| 157 | + // 串线 | |
| 158 | + private Integer crossedLine; | |
| 159 | + | |
| 160 | + // 越界 | |
| 161 | + private Integer overflights; | |
| 162 | + | |
| 163 | + // 描述 | |
| 164 | + private String descriptions; | |
| 165 | + | |
| 166 | + // 创建人 | |
| 167 | + private Integer createBy; | |
| 168 | + | |
| 169 | + // 修改人 | |
| 170 | + private Integer updateBy; | |
| 171 | + | |
| 172 | + // 创建日期 | |
| 173 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 174 | + private Date createDate; | |
| 175 | + | |
| 176 | + // 修改日期 | |
| 177 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 178 | + private Date updateDate; | |
| 179 | + | |
| 180 | + @ManyToOne | |
| 181 | + private Line line; | |
| 182 | + | |
| 183 | + public String getXygfkssj() { | |
| 184 | + return xygfkssj; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setXygfkssj(String xygfkssj) { | |
| 188 | + this.xygfkssj = xygfkssj; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public String getXygfjssj() { | |
| 192 | + return xygfjssj; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void setXygfjssj(String xygfjssj) { | |
| 196 | + this.xygfjssj = xygfjssj; | |
| 197 | + } | |
| 198 | + | |
| 127 | 199 | public Double getUpInTimer() { |
| 128 | 200 | return upInTimer; |
| 129 | 201 | } |
| ... | ... | @@ -188,68 +260,6 @@ public class LineInformation { |
| 188 | 260 | this.downOutMileage = downOutMileage; |
| 189 | 261 | } |
| 190 | 262 | |
| 191 | - // 出场里程 | |
| 192 | - private Double outMileage; | |
| 193 | - | |
| 194 | - // 早高峰大间隔(分钟) | |
| 195 | - private Double earlyIntervalLg; | |
| 196 | - | |
| 197 | - // 晚高峰大间隔(分钟) | |
| 198 | - private Double lateIntervalLg; | |
| 199 | - | |
| 200 | - // 平时大间隔(分钟) | |
| 201 | - private Double intervalLg; | |
| 202 | - | |
| 203 | - // 限速(平时) | |
| 204 | - private Double speedLimit; | |
| 205 | - | |
| 206 | - // 限速(雨天) | |
| 207 | - private Double rainLimit; | |
| 208 | - | |
| 209 | - // 限速(大雾) | |
| 210 | - private Double fogLimit; | |
| 211 | - | |
| 212 | - // 限速(冰雪) | |
| 213 | - private Double snowLimit; | |
| 214 | - | |
| 215 | - // 限速(节庆) | |
| 216 | - private Double festivalSpeedLimit; | |
| 217 | - | |
| 218 | - // 滞站 | |
| 219 | - private Integer lagStation; | |
| 220 | - | |
| 221 | - // 越站 | |
| 222 | - private Integer skip; | |
| 223 | - | |
| 224 | - // 超速 | |
| 225 | - private Integer speeding; | |
| 226 | - | |
| 227 | - // 串线 | |
| 228 | - private Integer crossedLine; | |
| 229 | - | |
| 230 | - // 越界 | |
| 231 | - private Integer overflights; | |
| 232 | - | |
| 233 | - // 描述 | |
| 234 | - private String descriptions; | |
| 235 | - | |
| 236 | - // 创建人 | |
| 237 | - private Integer createBy; | |
| 238 | - | |
| 239 | - // 修改人 | |
| 240 | - private Integer updateBy; | |
| 241 | - | |
| 242 | - // 创建日期 | |
| 243 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 244 | - private Date createDate; | |
| 245 | - | |
| 246 | - // 修改日期 | |
| 247 | - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 248 | - private Date updateDate; | |
| 249 | - | |
| 250 | - @ManyToOne | |
| 251 | - private Line line; | |
| 252 | - | |
| 253 | 263 | public Integer getId() { |
| 254 | 264 | return id; |
| 255 | 265 | } |
| ... | ... | @@ -416,39 +426,6 @@ public class LineInformation { |
| 416 | 426 | public void setCarPark(String carPark) { |
| 417 | 427 | this.carPark = carPark; |
| 418 | 428 | } |
| 419 | - | |
| 420 | - public Double getParadeTime() { | |
| 421 | - return paradeTime; | |
| 422 | - } | |
| 423 | - | |
| 424 | - public void setParadeTime(Double paradeTime) { | |
| 425 | - this.paradeTime = paradeTime; | |
| 426 | - } | |
| 427 | - | |
| 428 | - public Double getOutTime() { | |
| 429 | - return outTime; | |
| 430 | - } | |
| 431 | - | |
| 432 | - public void setOutTime(Double outTime) { | |
| 433 | - this.outTime = outTime; | |
| 434 | - } | |
| 435 | - | |
| 436 | - public Double getParadeMileage() { | |
| 437 | - return paradeMileage; | |
| 438 | - } | |
| 439 | - | |
| 440 | - public void setParadeMileage(Double paradeMileage) { | |
| 441 | - this.paradeMileage = paradeMileage; | |
| 442 | - } | |
| 443 | - | |
| 444 | - public Double getOutMileage() { | |
| 445 | - return outMileage; | |
| 446 | - } | |
| 447 | - | |
| 448 | - public void setOutMileage(Double outMileage) { | |
| 449 | - this.outMileage = outMileage; | |
| 450 | - } | |
| 451 | - | |
| 452 | 429 | public Double getEarlyIntervalLg() { |
| 453 | 430 | return earlyIntervalLg; |
| 454 | 431 | } | ... | ... |
src/main/java/com/bsth/entity/SectionRoute.java
src/main/java/com/bsth/entity/excep/Offline.java
| ... | ... | @@ -72,6 +72,40 @@ public class Offline { |
| 72 | 72 | private String jsy; |
| 73 | 73 | @Transient |
| 74 | 74 | private String lpname; |
| 75 | + @Transient | |
| 76 | + private Long ts; | |
| 77 | + | |
| 78 | + @Transient | |
| 79 | + private String tsdate; | |
| 80 | + @Transient | |
| 81 | + private String deviceid; | |
| 82 | + | |
| 83 | + public String getDeviceid() { | |
| 84 | + return deviceid; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setDeviceid(String deviceid) { | |
| 88 | + this.deviceid = deviceid; | |
| 89 | + } | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + public String getTsdate() { | |
| 94 | + return tsdate; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setTsdate(String tsdate) { | |
| 98 | + this.tsdate = tsdate; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public Long getTs() { | |
| 102 | + return ts; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public void setTs(Long ts) { | |
| 106 | + this.ts = ts; | |
| 107 | + } | |
| 108 | + | |
| 75 | 109 | public Integer getId() { |
| 76 | 110 | return id; |
| 77 | 111 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/rule/RerunRule.java
| ... | ... | @@ -53,6 +53,8 @@ public class RerunRule extends BEntity { |
| 53 | 53 | private GuideboardInfo rerunLp; |
| 54 | 54 | /** 套跑班次(时刻表明细ids,使用逗号连接) */ |
| 55 | 55 | private String rerunTtinfodetailIds; |
| 56 | + /** 套跑班次(对应具体班次的发车时间,使用逗号连接) */ | |
| 57 | + private String rerunTtinfodetailFcsjs; | |
| 56 | 58 | |
| 57 | 59 | |
| 58 | 60 | /** 套跑类型(dylp;对应路牌,dybc:对应班车) */ |
| ... | ... | @@ -167,4 +169,11 @@ public class RerunRule extends BEntity { |
| 167 | 169 | this.isCancel = isCancel; |
| 168 | 170 | } |
| 169 | 171 | |
| 172 | + public String getRerunTtinfodetailFcsjs() { | |
| 173 | + return rerunTtinfodetailFcsjs; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public void setRerunTtinfodetailFcsjs(String rerunTtinfodetailFcsjs) { | |
| 177 | + this.rerunTtinfodetailFcsjs = rerunTtinfodetailFcsjs; | |
| 178 | + } | |
| 170 | 179 | } | ... | ... |
src/main/java/com/bsth/repository/BusinessRepository.java
| 1 | 1 | package com.bsth.repository; |
| 2 | 2 | |
| 3 | +import org.springframework.data.jpa.repository.Query; | |
| 3 | 4 | import org.springframework.stereotype.Repository; |
| 4 | 5 | |
| 5 | 6 | import com.bsth.entity.Business; |
| ... | ... | @@ -28,5 +29,7 @@ public interface BusinessRepository extends BaseRepository<Business, Integer> { |
| 28 | 29 | List<Business> findByBusinessCode(String code); |
| 29 | 30 | |
| 30 | 31 | List<Business> findByUpCodeAndBusinessCode(String c1, String c2); |
| 31 | - | |
| 32 | + | |
| 33 | + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_business) k" , nativeQuery=true) | |
| 34 | + long getMaxId(); | |
| 32 | 35 | } | ... | ... |
src/main/java/com/bsth/repository/SectionRepository.java
src/main/java/com/bsth/repository/SectionRouteRepository.java
| ... | ... | @@ -121,7 +121,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int |
| 121 | 121 | "b.create_date AS sectionCreateDate," + |
| 122 | 122 | "b.update_by AS sectionUpdateBy," + |
| 123 | 123 | "b.update_date AS sectionUpdateDate," + |
| 124 | - "b.versions AS sectionVersion FROM (" + | |
| 124 | + "b.versions AS sectionVersion , a.isRoadeSpeed FROM (" + | |
| 125 | 125 | " SELECT s.id AS sectionRouteId," + |
| 126 | 126 | "s.line_code AS sectionRouteLineCode," + |
| 127 | 127 | "s.sectionroute_code AS sectionRouteCode," + |
| ... | ... | @@ -134,7 +134,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int |
| 134 | 134 | "s.update_by AS sectionRouteUpdateBy," + |
| 135 | 135 | "s.update_date AS sectionRouteUpdateDate," + |
| 136 | 136 | "s.versions AS sectionRouteVersions," + |
| 137 | - "s.destroy AS sectionRouteDestroy" + | |
| 137 | + "s.destroy AS sectionRouteDestroy, s.is_roade_speed AS isRoadeSpeed " + | |
| 138 | 138 | " FROM bsth_c_sectionroute s where s.id =?1) a " + |
| 139 | 139 | " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true) |
| 140 | 140 | List<Object[]> findSectionRouteInfoFormId(int id); |
| ... | ... | @@ -171,6 +171,10 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int |
| 171 | 171 | @Query(value="UPDATE bsth_c_sectionroute set is_roade_speed = ?1 where line= ?2 and directions=?3 ",nativeQuery = true) |
| 172 | 172 | void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); |
| 173 | 173 | |
| 174 | + @Modifying | |
| 175 | + @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+10) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) | |
| 176 | + public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod); | |
| 177 | + | |
| 174 | 178 | @Modifying |
| 175 | 179 | @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) |
| 176 | 180 | public void sectionRouteDir(Integer line); | ... | ... |
src/main/java/com/bsth/repository/StationRepository.java
| ... | ... | @@ -37,7 +37,7 @@ public interface StationRepository extends BaseRepository<Station, Integer> { |
| 37 | 37 | , nativeQuery=true) |
| 38 | 38 | long stationMaxId(); |
| 39 | 39 | |
| 40 | - @Query(value = "SELECT * FROM bsth_c_station s where s.station_name = ?1" | |
| 40 | + @Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?1" | |
| 41 | 41 | , nativeQuery=true) |
| 42 | 42 | List<Object[]> findStationName(String stationName); |
| 43 | 43 | ... | ... |
src/main/java/com/bsth/service/BusinessService.java
src/main/java/com/bsth/service/SectionRouteService.java
| ... | ... | @@ -22,6 +22,14 @@ import com.bsth.entity.SectionRoute; |
| 22 | 22 | */ |
| 23 | 23 | public interface SectionRouteService extends BaseService<SectionRoute, Integer> { |
| 24 | 24 | |
| 25 | + /** | |
| 26 | + * | |
| 27 | + * @Title: list | |
| 28 | + * @Description: TODO(多条件查询) | |
| 29 | + * @throws | |
| 30 | + */ | |
| 31 | + Iterable<SectionRoute> list(Map<String, Object> map); | |
| 32 | + | |
| 25 | 33 | List<Map<String, Object>> getSectionRoute(Map<String, Object> map); |
| 26 | 34 | |
| 27 | 35 | /** | ... | ... |
src/main/java/com/bsth/service/StationRouteService.java
| ... | ... | @@ -23,6 +23,14 @@ import com.bsth.entity.StationRoute; |
| 23 | 23 | public interface StationRouteService extends BaseService<StationRoute, Integer> { |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | + * | |
| 27 | + * @Title: list | |
| 28 | + * @Description: TODO(多条件查询) | |
| 29 | + * @throws | |
| 30 | + */ | |
| 31 | + Iterable<StationRoute> list(Map<String, Object> map); | |
| 32 | + | |
| 33 | + /** | |
| 26 | 34 | * @Description :TODO(查询树站点与路段数据) |
| 27 | 35 | * |
| 28 | 36 | * @param map <line.id_eq:线路ID; directions_eq:方向> | ... | ... |
src/main/java/com/bsth/service/excep/impl/OfflineServiceImpl.java
| ... | ... | @@ -4,6 +4,7 @@ import java.sql.Connection; |
| 4 | 4 | import java.sql.PreparedStatement; |
| 5 | 5 | import java.sql.ResultSet; |
| 6 | 6 | import java.sql.SQLException; |
| 7 | +import java.text.DateFormat; | |
| 7 | 8 | import java.text.ParseException; |
| 8 | 9 | import java.text.SimpleDateFormat; |
| 9 | 10 | import java.util.ArrayList; |
| ... | ... | @@ -34,6 +35,35 @@ public class OfflineServiceImpl implements OfflineService { |
| 34 | 35 | |
| 35 | 36 | @Autowired |
| 36 | 37 | JdbcTemplate jdbcTemplate; |
| 38 | + public List<Offline> findGPS(Map<String, Object> map) { | |
| 39 | + Connection conn = null; | |
| 40 | + PreparedStatement ps = null; | |
| 41 | + ResultSet rs = null; | |
| 42 | + List<Offline> list=new ArrayList<Offline>(); | |
| 43 | + String days_year=map.get("days_year").toString(); | |
| 44 | + String line_id=map.get("line_id").toString(); | |
| 45 | + String device_id=map.get("device_id").toString(); | |
| 46 | + String sql="SELECT t.line_id,t.device_id,MIN(ts) as ts,days_year FROM bsth_c_gps_info t " | |
| 47 | + + " WHERE t.line_id='"+line_id+"' and t.device_id='"+device_id+"' and t.days_year='"+days_year+"' " | |
| 48 | + + " GROUP BY t.device_id,t.line_id "; | |
| 49 | + sql +=" order by ts limit ?,?"; | |
| 50 | + try { | |
| 51 | + conn = DBUtils_MS.getConnection(); | |
| 52 | + ps = conn.prepareStatement(sql); | |
| 53 | + ps.setInt(1,0*10); // O-最大条数 -- M-起始条数 | |
| 54 | + ps.setInt(2, 100000000); // O-最小条数 -- M-显示条数 | |
| 55 | + rs = ps.executeQuery(); | |
| 56 | + list = resultSet(rs); | |
| 57 | + } catch (SQLException e) { | |
| 58 | + // TODO Auto-generated catch block | |
| 59 | + e.printStackTrace(); | |
| 60 | + }finally { | |
| 61 | + DBUtils_MS.close(rs, ps, conn); | |
| 62 | + } | |
| 63 | + | |
| 64 | + return list; | |
| 65 | + } | |
| 66 | + | |
| 37 | 67 | // @Override |
| 38 | 68 | static List<Offline> findAll(Map<String, Object> map) { |
| 39 | 69 | // TODO Auto-generated method stub |
| ... | ... | @@ -100,7 +130,18 @@ public class OfflineServiceImpl implements OfflineService { |
| 100 | 130 | |
| 101 | 131 | return list; |
| 102 | 132 | } |
| 103 | - | |
| 133 | + public List<Offline> resultSet(ResultSet rs) throws SQLException{ | |
| 134 | + // TODO Auto-generated method stub | |
| 135 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); | |
| 136 | + List<Offline> list=new ArrayList<Offline>(); | |
| 137 | + Offline offline; | |
| 138 | + while(rs.next()){ | |
| 139 | + offline=new Offline(); | |
| 140 | + offline.setTs(Long.parseLong(rs.getObject("ts").toString())); | |
| 141 | + list.add(offline); | |
| 142 | + } | |
| 143 | + return list; | |
| 144 | + } | |
| 104 | 145 | /** |
| 105 | 146 | * 数据转换 |
| 106 | 147 | */ |
| ... | ... | @@ -122,6 +163,7 @@ public class OfflineServiceImpl implements OfflineService { |
| 122 | 163 | offline.setTimestampDate(sdf.format(new Date(offline.getTimestamp()))); |
| 123 | 164 | offline.setUpDown(Integer.valueOf(rs.getObject("up_down").toString())); |
| 124 | 165 | offline.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("vehicle").toString())); |
| 166 | + offline.setDeviceid(rs.getObject("vehicle").toString()); | |
| 125 | 167 | list.add(offline); |
| 126 | 168 | } |
| 127 | 169 | return list; |
| ... | ... | @@ -190,7 +232,9 @@ public class OfflineServiceImpl implements OfflineService { |
| 190 | 232 | // List<T> list = this.baseDao.queryByObject(pageHelper.getMap()); |
| 191 | 233 | List<Offline> list=findAll(pageHelper.getMap()); |
| 192 | 234 | for (int i = 0; i < list.size(); i++) { |
| 193 | - String nbbm2=list.get(i).getVehicle() ; | |
| 235 | + int lineid= list.get(i).getLine(); | |
| 236 | + String nbbm2=list.get(i).getVehicle(); | |
| 237 | + String deviceid=list.get(i).getDeviceid(); | |
| 194 | 238 | Long d1=list.get(i).getTimestamp(); |
| 195 | 239 | Date datess = new Date(d1); |
| 196 | 240 | String dates=new SimpleDateFormat("yyyy-MM-dd").format(datess); |
| ... | ... | @@ -209,10 +253,22 @@ public class OfflineServiceImpl implements OfflineService { |
| 209 | 253 | return s; |
| 210 | 254 | } |
| 211 | 255 | }); |
| 256 | + Map<String, Object> gpsmap=new HashMap<>(); | |
| 257 | + String str = String.format("%tj",datess); | |
| 258 | + gpsmap.put("device_id",deviceid ); | |
| 259 | + gpsmap.put("line_id", lineid); | |
| 260 | + gpsmap.put("days_year", str); | |
| 261 | + List<Offline> gps=findGPS(gpsmap); | |
| 262 | + if(gps.size()>0){ | |
| 263 | + Long ts= gps.get(0).getTs(); | |
| 264 | + String ts1 =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(ts)); | |
| 265 | + list.get(0).setTsdate(ts1); | |
| 266 | + } | |
| 212 | 267 | if(pbb.size()>0){ |
| 213 | 268 | list.get(i).setJsy(pbb.get(0).getjGh()+"/"+pbb.get(0).getjName()); |
| 214 | 269 | list.get(i).setLpname(pbb.get(0).getLpName()); |
| 215 | 270 | } |
| 271 | + | |
| 216 | 272 | } |
| 217 | 273 | |
| 218 | 274 | PageObject<Offline> pageObject = pageHelper.getPageObject(); | ... | ... |
src/main/java/com/bsth/service/impl/BusinessServiceImpl.java
| 1 | 1 | package com.bsth.service.impl; |
| 2 | 2 | |
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 3 | 4 | import org.springframework.stereotype.Service; |
| 4 | 5 | |
| 5 | 6 | import com.bsth.entity.Business; |
| 7 | +import com.bsth.repository.BusinessRepository; | |
| 6 | 8 | import com.bsth.service.BusinessService; |
| 7 | 9 | |
| 8 | 10 | /** |
| ... | ... | @@ -23,5 +25,12 @@ import com.bsth.service.BusinessService; |
| 23 | 25 | |
| 24 | 26 | @Service |
| 25 | 27 | public class BusinessServiceImpl extends BaseServiceImpl<Business, Integer> implements BusinessService{ |
| 28 | + @Autowired | |
| 29 | + private BusinessRepository businessRepository; | |
| 30 | + @Override | |
| 31 | + public long getCompCode() { | |
| 32 | + // TODO Auto-generated method stub | |
| 33 | + return businessRepository.getMaxId(); | |
| 34 | + } | |
| 26 | 35 | |
| 27 | 36 | } | ... | ... |
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
| ... | ... | @@ -6,16 +6,20 @@ import java.util.List; |
| 6 | 6 | import java.util.Map; |
| 7 | 7 | |
| 8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.data.domain.Sort; | |
| 10 | +import org.springframework.data.domain.Sort.Direction; | |
| 9 | 11 | import org.springframework.stereotype.Service; |
| 10 | 12 | |
| 11 | 13 | import com.bsth.common.ResponseCode; |
| 12 | 14 | import com.bsth.entity.Line; |
| 13 | 15 | import com.bsth.entity.Section; |
| 14 | 16 | import com.bsth.entity.SectionRoute; |
| 17 | +import com.bsth.entity.search.CustomerSpecs; | |
| 15 | 18 | import com.bsth.repository.LineRepository; |
| 16 | 19 | import com.bsth.repository.SectionRepository; |
| 17 | 20 | import com.bsth.repository.SectionRouteRepository; |
| 18 | 21 | import com.bsth.service.SectionRouteService; |
| 22 | +import com.bsth.util.GetUIDAndCode; | |
| 19 | 23 | |
| 20 | 24 | /** |
| 21 | 25 | * |
| ... | ... | @@ -45,6 +49,14 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 45 | 49 | @Autowired |
| 46 | 50 | LineRepository lineRepository; |
| 47 | 51 | |
| 52 | + @Override | |
| 53 | + public Iterable<SectionRoute> list(Map<String, Object> map) { | |
| 54 | + List<Sort.Order> orderList = new ArrayList<>(); | |
| 55 | + orderList.add(new Sort.Order(Direction.ASC, "directions")); | |
| 56 | + orderList.add(new Sort.Order(Direction.ASC, "sectionrouteCode")); | |
| 57 | + return repository.findAll(new CustomerSpecs<SectionRoute>(map), new Sort(orderList)); | |
| 58 | + } | |
| 59 | + | |
| 48 | 60 | /** |
| 49 | 61 | * @Description :TODO(查询路段信息) |
| 50 | 62 | * |
| ... | ... | @@ -185,6 +197,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 185 | 197 | |
| 186 | 198 | tempM.put("sectionVersion", objects.get(i)[33]); |
| 187 | 199 | |
| 200 | + tempM.put("isRoadeSpeed", objects.get(i)[34]); | |
| 188 | 201 | resultList.add(tempM); |
| 189 | 202 | } |
| 190 | 203 | |
| ... | ... | @@ -203,32 +216,19 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 203 | 216 | */ |
| 204 | 217 | @Override |
| 205 | 218 | public List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map) { |
| 206 | - | |
| 207 | 219 | Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); |
| 208 | - | |
| 209 | 220 | Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); |
| 210 | - | |
| 211 | 221 | Integer stationRouteCode = map.get("sectionRouteCode").equals("") ? null : Integer.parseInt(map.get("sectionRouteCode").toString()); |
| 212 | - | |
| 213 | 222 | List<Object[]> reslutList = repository.findUpSectionRouteCode(lineId, direction, stationRouteCode); |
| 214 | - | |
| 215 | 223 | List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); |
| 216 | - | |
| 217 | 224 | if(reslutList.get(0)!=null) { |
| 218 | - | |
| 219 | 225 | for(int i = 0 ; i <reslutList.size() ;i++){ |
| 220 | - | |
| 221 | 226 | Map<String, Object> tempM = new HashMap<String, Object>(); |
| 222 | - | |
| 223 | 227 | System.out.println(reslutList.get(i)); |
| 224 | - | |
| 225 | 228 | tempM.put("sectionrouteCode", reslutList.get(i)); |
| 226 | - | |
| 227 | 229 | list.add(tempM); |
| 228 | - | |
| 229 | 230 | } |
| 230 | 231 | } |
| 231 | - | |
| 232 | 232 | return list; |
| 233 | 233 | } |
| 234 | 234 | |
| ... | ... | @@ -243,8 +243,10 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 243 | 243 | List<Object[]> list = repository.getSectionRoute(line, dir); |
| 244 | 244 | int src = repository.sectionRouteCodeMaxId(); |
| 245 | 245 | for(int i = 0 ; i<list.size() ; i++) { |
| 246 | - int sectionId = Integer.parseInt(String.valueOf(repository2.sectionMaxId())) + 1 ; | |
| 247 | - String sectionCode = String.valueOf(sectionId); | |
| 246 | + /*int sectionId = Integer.parseInt(String.valueOf(repository2.sectionMaxId())) + 1 ;*/ | |
| 247 | + long sectionMaxId = GetUIDAndCode.getSectionId(); | |
| 248 | + String sectionCode = String.valueOf(sectionMaxId); | |
| 249 | + int sectionId = (int)sectionMaxId; | |
| 248 | 250 | String sectionName = list.get(i)[9] == null ? null : list.get(i)[9].toString(); |
| 249 | 251 | String crosesRoad = list.get(i)[10] == null ? null : list.get(i)[10].toString(); |
| 250 | 252 | String endNode = list.get(i)[11] == null ? null : list.get(i)[11].toString(); |
| ... | ... | @@ -267,12 +269,12 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 267 | 269 | gsectionVector, bsectionVector, |
| 268 | 270 | sectionType, csectionVector, roadCoding, |
| 269 | 271 | sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, sectionId); |
| 270 | - int sectionRouteId = Integer.parseInt(String.valueOf(repository.sectionRouteMaxId())) + 1 ; | |
| 272 | + // int sectionRouteId = Integer.parseInt(String.valueOf(repository.sectionRouteMaxId())) + 1 ; | |
| 271 | 273 | SectionRoute sr = new SectionRoute(); |
| 272 | 274 | Line lineObject = lineRepository.findOne(line); |
| 273 | 275 | Section section = repository2.findOne(sectionId); |
| 274 | 276 | Integer xh = (src == 0 ? (toDir ==1? (list.size()-i)*10 : (list.size()+i)*10) : toDir==1? (src + (list.size()-i)*10) : (src + (list.size()+i)*10)) ; |
| 275 | - sr.setId(sectionRouteId); | |
| 277 | + // sr.setId(sectionRouteId); | |
| 276 | 278 | sr.setSectionrouteCode(xh); |
| 277 | 279 | sr.setLineCode(lineObject.getLineCode()); |
| 278 | 280 | sr.setSectionCode(sectionCode); |
| ... | ... | @@ -294,5 +296,4 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 294 | 296 | } |
| 295 | 297 | return resultMap; |
| 296 | 298 | } |
| 297 | - | |
| 298 | -} | |
| 299 | +} | |
| 299 | 300 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| ... | ... | @@ -7,6 +7,7 @@ import java.util.Map; |
| 7 | 7 | |
| 8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.stereotype.Service; |
| 10 | +import org.springframework.transaction.annotation.Transactional; | |
| 10 | 11 | |
| 11 | 12 | import com.alibaba.fastjson.JSONArray; |
| 12 | 13 | import com.bsth.common.ResponseCode; |
| ... | ... | @@ -57,210 +58,122 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 57 | 58 | */ |
| 58 | 59 | @Override |
| 59 | 60 | public Map<String, Object> sectionUpdate(Map<String, Object> map) { |
| 60 | - | |
| 61 | 61 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 62 | - | |
| 63 | 62 | try { |
| 64 | - | |
| 65 | 63 | String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString(); |
| 66 | - | |
| 67 | 64 | // 原始线状图形坐标集合 |
| 68 | 65 | String sectionsBpoints = ""; |
| 69 | - | |
| 70 | 66 | // WGS线状图形坐标集合 |
| 71 | 67 | String sectionsWJPpoints = ""; |
| 72 | - | |
| 73 | 68 | if(!bsectionVector.equals("")) { |
| 74 | - | |
| 75 | 69 | // 转换成JSON数组 |
| 76 | 70 | JSONArray sectionsArray = JSONArray.parseArray(bsectionVector); |
| 77 | - | |
| 78 | 71 | // 遍历 |
| 79 | 72 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 80 | - | |
| 81 | 73 | String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); |
| 82 | - | |
| 83 | 74 | String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); |
| 84 | - | |
| 85 | 75 | /** to WGS坐标 */ |
| 86 | 76 | Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); |
| 87 | - | |
| 88 | 77 | String WGSLngStr = String.valueOf(resultPoint.getLng()); |
| 89 | - | |
| 90 | 78 | String WGSLatStr = String.valueOf(resultPoint.getLat()); |
| 91 | - | |
| 92 | 79 | if(s==0) { |
| 93 | - | |
| 94 | 80 | sectionsBpoints = pointsLngStr + " " + pointsLatStr; |
| 95 | - | |
| 96 | 81 | sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; |
| 97 | - | |
| 98 | 82 | }else { |
| 99 | - | |
| 100 | 83 | sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; |
| 101 | - | |
| 102 | 84 | sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; |
| 103 | - | |
| 104 | 85 | } |
| 105 | - | |
| 106 | - | |
| 107 | 86 | } |
| 108 | - | |
| 109 | 87 | } |
| 110 | - | |
| 111 | 88 | // 原坐标类型 |
| 112 | 89 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 113 | - | |
| 114 | 90 | // 说明 |
| 115 | 91 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); |
| 116 | - | |
| 117 | 92 | // 是否撤销 |
| 118 | 93 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); |
| 119 | - | |
| 120 | 94 | // 方向 |
| 121 | 95 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); |
| 122 | - | |
| 123 | 96 | // 线路ID |
| 124 | 97 | Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); |
| 125 | - | |
| 126 | 98 | // 道路编码 |
| 127 | 99 | String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); |
| 128 | - | |
| 129 | 100 | // 路段编码 |
| 130 | 101 | String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); |
| 131 | - | |
| 132 | 102 | // 路段长度 |
| 133 | 103 | Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); |
| 134 | - | |
| 135 | 104 | // 路段ID |
| 136 | 105 | Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString()); |
| 137 | - | |
| 138 | 106 | // 路段名称 |
| 139 | 107 | String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); |
| 140 | - | |
| 141 | 108 | // 路段路由Id |
| 142 | 109 | Integer sectionRouteId = map.get("sectionRouteId").equals("") ? null : Integer.valueOf(map.get("sectionRouteId").toString()); |
| 143 | - | |
| 144 | 110 | // 线路编码 |
| 145 | 111 | String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); |
| 146 | - | |
| 147 | 112 | // 路段时长 |
| 148 | 113 | Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); |
| 149 | - | |
| 150 | 114 | // 路段路由 |
| 151 | 115 | Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); |
| 152 | - | |
| 153 | 116 | SectionRoute resultS = routeRepository.findOne(sectionRouteId); |
| 154 | - | |
| 155 | 117 | int old_code = resultS.getSectionrouteCode(); |
| 156 | - | |
| 157 | 118 | if(sectionrouteCode!=null) { |
| 158 | - | |
| 159 | 119 | int new_code = sectionrouteCode+100; |
| 160 | - | |
| 161 | 120 | if(new_code==old_code){ |
| 162 | - | |
| 163 | 121 | sectionrouteCode = new_code; |
| 164 | - | |
| 165 | 122 | }else { |
| 166 | - | |
| 167 | 123 | sectionrouteCode = new_code-100+1; |
| 168 | - | |
| 169 | 124 | } |
| 170 | - | |
| 171 | 125 | }else { |
| 172 | - | |
| 173 | 126 | sectionrouteCode = old_code; |
| 174 | - | |
| 175 | 127 | } |
| 176 | - | |
| 177 | 128 | // 限速 |
| 178 | 129 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); |
| 179 | - | |
| 180 | 130 | // 版本 |
| 181 | 131 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); |
| 182 | - | |
| 183 | 132 | // WGS坐标点集合 |
| 184 | 133 | String gsectionVector = null; |
| 185 | 134 | if(!sectionsWJPpoints.equals("")) |
| 186 | 135 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 187 | - | |
| 188 | 136 | // 原坐标点集合 |
| 189 | 137 | String bsectionVectorS = null; |
| 190 | 138 | if(!sectionsBpoints.equals("")) |
| 191 | 139 | bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; |
| 192 | - | |
| 193 | 140 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); |
| 194 | - | |
| 195 | 141 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); |
| 196 | - | |
| 197 | 142 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); |
| 198 | - | |
| 143 | + Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | |
| 199 | 144 | SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); |
| 200 | - | |
| 201 | 145 | Date date = new Date(); |
| 202 | - | |
| 203 | 146 | // 修改日期 |
| 204 | 147 | String updateDate = formatter.format(date); |
| 205 | - | |
| 206 | 148 | String crosesRoad=""; |
| 207 | - | |
| 208 | 149 | String endNode=""; |
| 209 | - | |
| 210 | 150 | String startNode=""; |
| 211 | - | |
| 212 | 151 | String middleNode=""; |
| 213 | - | |
| 214 | 152 | String sectionType=""; |
| 215 | - | |
| 216 | - // String csectionVector=""; | |
| 217 | - | |
| 218 | 153 | // 更新 |
| 219 | - /*repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate);*/ | |
| 220 | 154 | repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); |
| 221 | - | |
| 222 | 155 | SectionRoute route = new SectionRoute(); |
| 223 | - | |
| 224 | 156 | Line line = lineRepository.findOne(sectionRouteLine); |
| 225 | - | |
| 226 | 157 | Section section = repository.findOne(sectionId); |
| 227 | - | |
| 228 | 158 | route.setId(sectionRouteId); |
| 229 | - | |
| 230 | 159 | route.setSectionrouteCode(sectionrouteCode); |
| 231 | - | |
| 232 | 160 | route.setLineCode(lineCode); |
| 233 | - | |
| 234 | 161 | route.setSectionCode(sectionCode); |
| 235 | - | |
| 236 | 162 | route.setDirections(directions); |
| 237 | - | |
| 238 | 163 | route.setVersions(version); |
| 239 | - | |
| 240 | 164 | route.setDestroy(destroy); |
| 241 | - | |
| 242 | 165 | route.setDescriptions(descriptions); |
| 243 | - | |
| 244 | 166 | route.setCreateBy(createBy); |
| 245 | - | |
| 246 | 167 | route.setUpdateBy(updateBy); |
| 247 | - | |
| 248 | 168 | route.setLine(line); |
| 249 | - | |
| 250 | 169 | route.setSection(section); |
| 251 | - | |
| 170 | + route.setIsRoadeSpeed(isRoadeSpeed); | |
| 252 | 171 | routeRepository.save(route); |
| 253 | - | |
| 254 | 172 | resultMap.put("status", ResponseCode.SUCCESS); |
| 255 | - | |
| 256 | 173 | } catch (Exception e) { |
| 257 | - | |
| 258 | 174 | resultMap.put("status", ResponseCode.ERROR); |
| 259 | - | |
| 260 | 175 | logger.error("save erro.", e); |
| 261 | - | |
| 262 | 176 | } |
| 263 | - | |
| 264 | 177 | return resultMap; |
| 265 | 178 | } |
| 266 | 179 | |
| ... | ... | @@ -294,164 +207,105 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 294 | 207 | * @return map<SUCCESS:成功;ERROR:异常> |
| 295 | 208 | */ |
| 296 | 209 | @Override |
| 210 | + @Transactional | |
| 297 | 211 | public Map<String, Object> sectionSave(Map<String, Object> map) { |
| 298 | - | |
| 299 | 212 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 300 | - | |
| 301 | 213 | try { |
| 302 | - | |
| 303 | - /** 线路ID */ | |
| 214 | + // 线路ID. | |
| 304 | 215 | Integer lineId = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString()); |
| 305 | - | |
| 306 | - /** 线路编码 */ | |
| 216 | + // 线路编码. | |
| 307 | 217 | String lineCode = map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); |
| 308 | - | |
| 218 | + // 路段名称. | |
| 309 | 219 | String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); |
| 310 | - | |
| 220 | + // 路段编码. | |
| 311 | 221 | String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); |
| 312 | - | |
| 222 | + // 道路编码. | |
| 313 | 223 | String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); |
| 314 | - | |
| 224 | + // 原始坐标类型. | |
| 315 | 225 | String dbType = map.get("dbType").equals("") ? "" :map.get("dbType").toString(); |
| 316 | - | |
| 226 | + // 路段几何图形坐标. | |
| 317 | 227 | String sectionJSON = map.get("bsectionVector").equals("") ? "" : map.get("bsectionVector").toString(); |
| 318 | - | |
| 228 | + // 路段序号 | |
| 319 | 229 | String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" : map.get("sectionrouteCode").toString(); |
| 320 | - | |
| 321 | - Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); | |
| 322 | - | |
| 323 | - Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); | |
| 324 | - | |
| 325 | - Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | |
| 326 | - | |
| 327 | - Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | |
| 328 | - | |
| 329 | - Integer destroy = map.get("destroy").equals("") ? null : Integer.valueOf(map.get("destroy").toString()); | |
| 330 | - | |
| 331 | - Integer directions = map.get("directions").equals("") ? null : Integer.valueOf(map.get("directions").toString()); | |
| 332 | - | |
| 230 | + // 路段时长. | |
| 231 | + Double sectionTime = map.get("sectionTime").equals("") ? 0.0d : Double.valueOf(map.get("sectionTime").toString()); | |
| 232 | + // 路段距离. | |
| 233 | + Double sectionDistance = map.get("sectionDistance").equals("") ? 0.0d : Double.valueOf(map.get("sectionDistance").toString()); | |
| 234 | + // 路段限速. | |
| 235 | + Double speedLimit = map.get("speedLimit").equals("") ? 0.0d : Double.valueOf(map.get("speedLimit").toString()); | |
| 236 | + // 版本. | |
| 237 | + Integer versions = map.get("versions").equals("") ? 1 : Integer.valueOf(map.get("versions").toString()); | |
| 238 | + // 是否撤销. | |
| 239 | + Integer destroy = map.get("destroy").equals("") ? 0 : Integer.valueOf(map.get("destroy").toString()); | |
| 240 | + // 路段方向. | |
| 241 | + Integer directions = map.get("directions").equals("") ? 0 : Integer.valueOf(map.get("directions").toString()); | |
| 242 | + // 描述与说明. | |
| 333 | 243 | String descriptions = map.get("descriptions").equals("")? "" : map.get("descriptions").toString(); |
| 334 | - | |
| 335 | 244 | // 原始线状图形坐标集合 |
| 336 | 245 | String sectionsBpoints = ""; |
| 337 | - | |
| 338 | 246 | // WGS线状图形坐标集合 |
| 339 | 247 | String sectionsWJPpoints = ""; |
| 340 | - | |
| 341 | 248 | if(!sectionJSON.equals("")) { |
| 342 | - | |
| 343 | 249 | // 转换成JSON数组 |
| 344 | 250 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); |
| 345 | - | |
| 346 | 251 | // 遍历 |
| 347 | 252 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 348 | - | |
| 349 | 253 | String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); |
| 350 | - | |
| 351 | 254 | String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); |
| 352 | - | |
| 353 | 255 | String WGSLngStr = ""; |
| 354 | - | |
| 355 | 256 | String WGSLatStr = ""; |
| 356 | - | |
| 357 | 257 | Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); |
| 358 | - | |
| 359 | 258 | WGSLngStr = String.valueOf(resultPoint.getLng()); |
| 360 | - | |
| 361 | 259 | WGSLatStr = String.valueOf(resultPoint.getLat()); |
| 362 | - | |
| 363 | 260 | if(s==0) { |
| 364 | - | |
| 365 | 261 | sectionsBpoints = pointsLngStr + " " + pointsLatStr; |
| 366 | - | |
| 367 | 262 | sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; |
| 368 | - | |
| 369 | 263 | }else { |
| 370 | - | |
| 371 | 264 | sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; |
| 372 | - | |
| 373 | 265 | sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; |
| 374 | - | |
| 375 | 266 | } |
| 376 | - | |
| 377 | 267 | } |
| 378 | - | |
| 379 | 268 | } |
| 380 | - | |
| 381 | 269 | // WGS坐标点集合 |
| 382 | 270 | String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 383 | - | |
| 384 | 271 | // 原坐标点集合 |
| 385 | 272 | String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; |
| 386 | - | |
| 387 | 273 | String crosesRoad=""; |
| 388 | - | |
| 389 | 274 | String endNode =""; |
| 390 | - | |
| 391 | 275 | String startNode=""; |
| 392 | - | |
| 393 | 276 | String middleNode=""; |
| 394 | - | |
| 395 | 277 | String sectionType=""; |
| 396 | - | |
| 397 | 278 | String csectionVector=null; |
| 398 | - | |
| 399 | 279 | Integer id = Integer.valueOf(sectionCode); |
| 400 | - | |
| 401 | 280 | repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, id); |
| 402 | - | |
| 403 | 281 | Section section = repository.findOne(id); |
| 404 | - | |
| 405 | 282 | Line line = lineRepository.findOne(lineId); |
| 406 | - | |
| 407 | 283 | // 路段路由 |
| 408 | 284 | SectionRoute sectionRoute = new SectionRoute(); |
| 409 | - | |
| 410 | 285 | Integer routeCode = null; |
| 411 | - | |
| 412 | 286 | if(!sectionrouteCode.equals("")){ |
| 413 | - | |
| 414 | 287 | String sectionrouteCodeArray[] = sectionrouteCode.split("_"); |
| 415 | - | |
| 416 | 288 | routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1; |
| 417 | - | |
| 418 | 289 | }else { |
| 419 | - | |
| 420 | 290 | routeCode = 100; |
| 421 | - | |
| 422 | 291 | } |
| 423 | - | |
| 292 | + routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode); | |
| 424 | 293 | sectionRoute.setSectionrouteCode(routeCode); |
| 425 | - | |
| 426 | 294 | sectionRoute.setLineCode(lineCode); |
| 427 | - | |
| 428 | 295 | sectionRoute.setSection(section); |
| 429 | - | |
| 430 | 296 | sectionRoute.setSectionCode(sectionCode); |
| 431 | - | |
| 432 | 297 | sectionRoute.setDirections(directions); |
| 433 | - | |
| 434 | 298 | sectionRoute.setDescriptions(descriptions); |
| 435 | - | |
| 436 | 299 | sectionRoute.setDestroy(destroy); |
| 437 | - | |
| 438 | 300 | sectionRoute.setVersions(versions); |
| 439 | - | |
| 440 | 301 | sectionRoute.setLine(line); |
| 441 | - | |
| 302 | + sectionRoute.setIsRoadeSpeed(0); | |
| 442 | 303 | routeRepository.save(sectionRoute); |
| 443 | - | |
| 444 | 304 | resultMap.put("status", ResponseCode.SUCCESS); |
| 445 | - | |
| 446 | 305 | } catch (Exception e) { |
| 447 | - | |
| 448 | 306 | resultMap.put("status", ResponseCode.ERROR); |
| 449 | - | |
| 450 | 307 | logger.error("save erro.", e); |
| 451 | - | |
| 452 | 308 | } |
| 453 | - | |
| 454 | 309 | return resultMap; |
| 455 | 310 | } |
| 456 | - | |
| 457 | -} | |
| 311 | +} | |
| 458 | 312 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| ... | ... | @@ -4,6 +4,7 @@ import com.bsth.common.ResponseCode; |
| 4 | 4 | import com.bsth.entity.Line; |
| 5 | 5 | import com.bsth.entity.Station; |
| 6 | 6 | import com.bsth.entity.StationRoute; |
| 7 | +import com.bsth.entity.search.CustomerSpecs; | |
| 7 | 8 | import com.bsth.repository.LineRepository; |
| 8 | 9 | import com.bsth.repository.SectionRouteRepository; |
| 9 | 10 | import com.bsth.repository.StationRepository; |
| ... | ... | @@ -16,6 +17,8 @@ import com.bsth.util.Geo.Point; |
| 16 | 17 | import com.bsth.util.db.DBUtils_MS; |
| 17 | 18 | import com.google.common.base.Splitter; |
| 18 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | +import org.springframework.data.domain.Sort; | |
| 21 | +import org.springframework.data.domain.Sort.Direction; | |
| 19 | 22 | import org.springframework.stereotype.Service; |
| 20 | 23 | import org.springframework.transaction.annotation.Transactional; |
| 21 | 24 | |
| ... | ... | @@ -56,6 +59,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 56 | 59 | @Autowired |
| 57 | 60 | private StationRepository stationRepository; |
| 58 | 61 | |
| 62 | + @Override | |
| 63 | + public Iterable<StationRoute> list(Map<String, Object> map) { | |
| 64 | + List<Sort.Order> orderList = new ArrayList<>(); | |
| 65 | + orderList.add(new Sort.Order(Direction.ASC, "directions")); | |
| 66 | + orderList.add(new Sort.Order(Direction.ASC, "stationRouteCode")); | |
| 67 | + return repository.findAll(new CustomerSpecs<StationRoute>(map), new Sort(orderList)); | |
| 68 | + } | |
| 69 | + | |
| 59 | 70 | /** |
| 60 | 71 | * @Description :TODO(查询树站点与路段数据) |
| 61 | 72 | * |
| ... | ... | @@ -402,34 +413,22 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 402 | 413 | */ |
| 403 | 414 | @Override |
| 404 | 415 | public List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map) { |
| 405 | - | |
| 406 | 416 | Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); |
| 407 | - | |
| 408 | 417 | Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); |
| 409 | - | |
| 410 | 418 | Integer stationRouteCode = map.get("stationRouteCode").equals("") ? null : Integer.parseInt(map.get("stationRouteCode").toString()); |
| 411 | - | |
| 412 | 419 | List<Object[]> reslutList = repository.findUpStationRouteCode(lineId, direction, stationRouteCode); |
| 413 | - | |
| 414 | 420 | List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); |
| 415 | - | |
| 416 | 421 | if(reslutList.size()>0) { |
| 417 | - | |
| 418 | 422 | for(int i = 0 ; i <reslutList.size() ;i++){ |
| 419 | 423 | Map<String, Object> tempM = new HashMap<String, Object>(); |
| 420 | 424 | tempM.put("stationRouteCode", reslutList.get(i)[0]); |
| 421 | 425 | tempM.put("stationRouteMarke", reslutList.get(i)[1]); |
| 422 | - | |
| 423 | 426 | list.add(tempM); |
| 424 | - | |
| 425 | 427 | } |
| 426 | - | |
| 427 | 428 | } |
| 428 | - | |
| 429 | 429 | return list; |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - | |
| 433 | 432 | /** |
| 434 | 433 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) |
| 435 | 434 | * | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -31,6 +31,8 @@ import com.bsth.service.StationService; |
| 31 | 31 | import com.bsth.util.GetUIDAndCode; |
| 32 | 32 | import com.bsth.util.TransGPS; |
| 33 | 33 | import com.bsth.util.TransGPS.Location; |
| 34 | +import com.bsth.util.Geo.GeoUtils; | |
| 35 | +import com.bsth.util.Geo.Point; | |
| 34 | 36 | |
| 35 | 37 | /** |
| 36 | 38 | * |
| ... | ... | @@ -82,62 +84,41 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 82 | 84 | */ |
| 83 | 85 | @Override |
| 84 | 86 | public Map<String, Object> systemSaveStations(Map<String, Object> map) { |
| 85 | - | |
| 86 | 87 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| 87 | - | |
| 88 | 88 | try { |
| 89 | - | |
| 90 | 89 | // 站点信息字符传 |
| 91 | 90 | String stationJSON = map.get("stationJSON").toString().equals("") ? "" : map.get("stationJSON").toString(); |
| 92 | - | |
| 93 | 91 | // 路段信息字符串 |
| 94 | 92 | String sectionJSON = map.get("sectionJSON").toString().equals("") ? "" : map.get("sectionJSON").toString(); |
| 95 | - | |
| 96 | 93 | // 方向 |
| 97 | 94 | int directions = Integer.parseInt(map.get("directions").toString()); |
| 98 | - | |
| 99 | 95 | // 是否撤销 |
| 100 | 96 | int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); |
| 101 | - | |
| 102 | 97 | // 版本 |
| 103 | 98 | int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString()); |
| 104 | - | |
| 105 | 99 | // 坐标类型 |
| 106 | 100 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 107 | - | |
| 108 | 101 | // 限速 |
| 109 | 102 | String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString(); |
| 110 | - | |
| 111 | 103 | // 线路ID |
| 112 | 104 | int lineId = map.get("lineId").toString().equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 113 | - | |
| 114 | 105 | // 半径 |
| 115 | 106 | int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString()); |
| 116 | - | |
| 117 | 107 | // 图形类型 |
| 118 | 108 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); |
| 119 | - | |
| 120 | 109 | // 路段距离 |
| 121 | 110 | Double sectionDistance = 0.0d; |
| 122 | - | |
| 123 | 111 | // 路段时长 |
| 124 | 112 | Double sectionDuration = 0.0d; |
| 125 | - | |
| 126 | 113 | // 里程(上或者下) |
| 127 | 114 | double sumUpOrDownMileage = 0.0d; |
| 128 | - | |
| 129 | 115 | // 线路信息 |
| 130 | 116 | Line resultLine = lineRepository.findOne(lineId); |
| 131 | - | |
| 132 | 117 | Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); |
| 133 | - | |
| 134 | 118 | String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); |
| 135 | - | |
| 136 | 119 | if(!stationJSON.equals("")) { |
| 137 | - | |
| 138 | 120 | // 保存站点与站点路由信息 |
| 139 | 121 | resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); |
| 140 | - | |
| 141 | 122 | } |
| 142 | 123 | |
| 143 | 124 | // 路段长度 |
| ... | ... | @@ -259,275 +240,148 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 259 | 240 | * @throws Exception |
| 260 | 241 | */ |
| 261 | 242 | public Map<String, Object> savaStationAndStationRouteInfo(String stationJSON,double sectionDistance,double sectionDuration,String dbType, |
| 262 | - | |
| 263 | 243 | int radius,String shapesType,int destroy,int versions,double sumUpOrDownMileage,int directions,Line resultLine,String baseRes) throws Exception{ |
| 264 | - | |
| 265 | 244 | Map<String, Object> paramsMeleageAndDistncDura = new HashMap<String,Object>(); |
| 266 | - | |
| 267 | 245 | JSONArray stationsArray = JSONArray.parseArray(stationJSON); |
| 268 | - | |
| 269 | 246 | if(stationsArray.size()>0) { |
| 270 | - | |
| 271 | 247 | for(int i = 0;i <stationsArray.size();i++) { |
| 272 | - | |
| 273 | 248 | // 站点名称 |
| 274 | 249 | String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); |
| 275 | - | |
| 276 | 250 | Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString()); |
| 277 | - | |
| 278 | 251 | // 转成公里 |
| 279 | 252 | distance = distance/1000; |
| 280 | - | |
| 281 | 253 | BigDecimal d = new BigDecimal(distance); |
| 282 | - | |
| 283 | 254 | distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| 284 | - | |
| 285 | 255 | sectionDistance= distance + sectionDistance; |
| 286 | - | |
| 287 | 256 | Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString()); |
| 288 | - | |
| 289 | 257 | // 转成分钟 |
| 290 | 258 | duration = duration/60; |
| 291 | - | |
| 292 | 259 | BigDecimal t = new BigDecimal(duration); |
| 293 | - | |
| 294 | 260 | duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| 295 | - | |
| 296 | 261 | sectionDuration = duration + sectionDuration; |
| 297 | - | |
| 298 | 262 | // 百度经纬度坐标 |
| 299 | 263 | String bJwpoints = ""; |
| 300 | - | |
| 301 | 264 | // 百度坐标经度 |
| 302 | 265 | String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString(); |
| 303 | - | |
| 266 | + bLonx = bLonx==null || bLonx.equals("") ? "0" : bLonx; | |
| 304 | 267 | // 百度坐标纬度 |
| 305 | 268 | String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString(); |
| 306 | - | |
| 269 | + bLatx = bLatx==null || bLatx.equals("") ? "0" : bLatx; | |
| 307 | 270 | List<Object[]> stationNameList = repository.findStationName(stationName); |
| 308 | - | |
| 309 | - boolean isHave = isHaveStationname(bJwpoints,stationNameList); | |
| 310 | - | |
| 271 | + Map<String, Object> isHaveMap = isHaveStationname(bLonx,bLatx,stationNameList); | |
| 311 | 272 | // 初始化站点对象 |
| 312 | 273 | Station arg0 = new Station(); |
| 313 | - | |
| 314 | - // 站点编码 | |
| 315 | - long stationCode = 0L; | |
| 316 | - | |
| 317 | - if(isHave) { | |
| 318 | - | |
| 319 | - Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString()); | |
| 320 | - | |
| 274 | + if(Boolean.parseBoolean(isHaveMap.get("isHave").toString())) { | |
| 275 | + /*Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());*/ | |
| 276 | + Integer stationId = Integer.parseInt(isHaveMap.get("id").toString()); | |
| 321 | 277 | arg0 = repository.findOne(stationId); |
| 322 | - | |
| 323 | 278 | }else { |
| 324 | - | |
| 325 | - stationCode = GetUIDAndCode.getStationId(); | |
| 326 | - | |
| 279 | + // 站点编码 | |
| 280 | + long stationCode = GetUIDAndCode.getStationId(); | |
| 327 | 281 | arg0.setStationCod(String.valueOf(stationCode)); |
| 328 | - | |
| 329 | 282 | arg0.setId((int)stationCode); |
| 330 | - | |
| 331 | 283 | arg0.setStationName(stationName); |
| 332 | - | |
| 333 | 284 | // 原坐标类型 |
| 334 | 285 | arg0.setDbType(dbType); |
| 335 | - | |
| 336 | - | |
| 337 | 286 | String gLonxStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").toString(); |
| 338 | - | |
| 339 | 287 | String gLatyStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").toString(); |
| 340 | - | |
| 341 | 288 | float gLonx = 0.0f; |
| 342 | - | |
| 343 | 289 | float gLaty = 0.0f; |
| 344 | - | |
| 345 | 290 | Location resultPoint = null; |
| 346 | - | |
| 347 | 291 | if(baseRes.equals("No")){ |
| 348 | - | |
| 349 | 292 | /** BD to WGS坐标 */ |
| 350 | 293 | resultPoint = FromBDPointToWGSPoint(bLonx,bLatx); |
| 351 | - | |
| 352 | 294 | if(gLonxStr==null) |
| 353 | 295 | gLonx = (float)resultPoint.getLng(); |
| 354 | 296 | else |
| 355 | 297 | gLonx = Float.valueOf(gLonxStr); |
| 356 | - | |
| 357 | 298 | if(gLatyStr==null) |
| 358 | 299 | gLaty = (float)resultPoint.getLat(); |
| 359 | 300 | else |
| 360 | 301 | gLaty = Float.valueOf(gLatyStr); |
| 361 | - | |
| 362 | 302 | arg0.setgLonx(gLonx); |
| 363 | - | |
| 364 | 303 | arg0.setgLaty(gLaty); |
| 365 | - | |
| 366 | 304 | // 百度经纬度 |
| 367 | 305 | bJwpoints = bLonx + " " + bLatx; |
| 368 | - | |
| 369 | 306 | arg0.setbJwpoints(bJwpoints); |
| 370 | - | |
| 371 | 307 | }else if(baseRes.equals("GCJ02")){ |
| 372 | - | |
| 373 | 308 | Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); |
| 374 | - | |
| 375 | 309 | Location location = TransGPS.bd_encrypt(bdLoc); |
| 376 | - | |
| 377 | 310 | String GCJLng = String.valueOf(location.getLng()); |
| 378 | - | |
| 379 | 311 | String GCJLat = String.valueOf(location.getLat()); |
| 380 | - | |
| 381 | 312 | resultPoint = FromBDPointToWGSPoint(GCJLng,GCJLat); |
| 382 | - | |
| 383 | 313 | bJwpoints = GCJLng + " " +GCJLat; |
| 384 | - | |
| 385 | 314 | arg0.setgLonx((float)location.getLng()); |
| 386 | - | |
| 387 | 315 | arg0.setgLaty((float)location.getLat()); |
| 388 | - | |
| 389 | 316 | arg0.setbJwpoints(bJwpoints); |
| 390 | - | |
| 391 | - | |
| 392 | 317 | }else if(baseRes.equals("BD09")){ |
| 393 | - | |
| 394 | 318 | resultPoint = FromBDPointToWGSPoint(gLonxStr, gLatyStr); |
| 395 | - | |
| 396 | 319 | bJwpoints = gLonxStr+ " " + gLatyStr; |
| 397 | - | |
| 398 | 320 | arg0.setgLonx((float)resultPoint.getLng()); |
| 399 | - | |
| 400 | 321 | arg0.setgLaty((float)resultPoint.getLat()); |
| 401 | - | |
| 402 | 322 | }else if(baseRes.equals("WGS84")){ |
| 403 | - | |
| 404 | 323 | Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); |
| 405 | - | |
| 406 | 324 | Location gcjLoc = TransGPS.transformFromWGSToGCJ(bdLoc); |
| 407 | - | |
| 408 | 325 | Location bdEn = TransGPS.bd_encrypt(gcjLoc); |
| 409 | - | |
| 410 | 326 | bJwpoints = String.valueOf(bdEn.getLng()) + " " + String.valueOf(bdEn.getLat()); |
| 411 | - | |
| 412 | 327 | arg0.setbJwpoints(bJwpoints); |
| 413 | - | |
| 414 | 328 | arg0.setgLonx(Float.valueOf(gLonxStr)); |
| 415 | - | |
| 416 | 329 | arg0.setgLaty(Float.valueOf(gLatyStr)); |
| 417 | - | |
| 418 | 330 | } |
| 419 | - | |
| 420 | - | |
| 421 | - | |
| 422 | - /* if(gLonxStr==null) | |
| 423 | - gLonx = (float)resultPoint.getLng(); | |
| 424 | - else | |
| 425 | - gLonx = Float.valueOf(gLonxStr); | |
| 426 | - | |
| 427 | - if(gLatyStr==null) | |
| 428 | - gLaty = (float)resultPoint.getLat(); | |
| 429 | - else | |
| 430 | - gLaty = Float.valueOf(gLatyStr); | |
| 431 | - | |
| 432 | - arg0.setgLonx(gLonx); | |
| 433 | - | |
| 434 | - arg0.setgLaty(gLaty);*/ | |
| 435 | - | |
| 436 | - // 站点地理位置WGS坐标经度 | |
| 437 | - // String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString(); | |
| 438 | - // arg0.setgLonx(Float.parseFloat(gLonx)); | |
| 439 | - | |
| 440 | - // 站点地理位置WGS坐标纬度 | |
| 441 | - // String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString(); | |
| 442 | - // arg0.setgLaty(Float.parseFloat(gLaty)); | |
| 443 | - | |
| 444 | 331 | arg0.setRadius(radius); |
| 445 | - | |
| 446 | - | |
| 447 | 332 | arg0.setShapesType(shapesType); |
| 448 | - | |
| 449 | 333 | // 是否想撤销 |
| 450 | 334 | arg0.setDestroy(destroy); |
| 451 | - | |
| 452 | 335 | // 版本号 |
| 453 | 336 | arg0.setVersions(versions); |
| 454 | - | |
| 455 | 337 | /*arg0.setbJwpoints(bJwpoints);*/ |
| 456 | - | |
| 457 | 338 | // 插入站点信息 |
| 458 | 339 | repository.save(arg0); |
| 459 | 340 | |
| 460 | 341 | } |
| 461 | - | |
| 462 | 342 | // 站点路由对象 |
| 463 | 343 | StationRoute route = new StationRoute(); |
| 464 | - | |
| 465 | 344 | // 站点名称 |
| 466 | 345 | route.setStationName(stationName); |
| 467 | - | |
| 468 | 346 | route.setDistances(distance); |
| 469 | - | |
| 470 | 347 | sumUpOrDownMileage = sumUpOrDownMileage + distance; |
| 471 | - | |
| 472 | 348 | route.setToTime(duration); |
| 473 | - | |
| 474 | - | |
| 475 | 349 | // 站点编码 |
| 476 | 350 | route.setStationCode(arg0.getStationCod()); |
| 477 | - | |
| 478 | 351 | // 站点序号 |
| 479 | 352 | route.setStationRouteCode((i+1)*100); |
| 480 | - | |
| 481 | 353 | // 站点类型 |
| 482 | 354 | if(i==0) { |
| 483 | - | |
| 484 | 355 | // 起始站 |
| 485 | 356 | route.setStationMark("B"); |
| 486 | - | |
| 487 | 357 | }else if(i==stationsArray.size()-1) { |
| 488 | - | |
| 489 | 358 | // 终点站 |
| 490 | 359 | route.setStationMark("E"); |
| 491 | - | |
| 492 | 360 | }else { |
| 493 | - | |
| 494 | 361 | // 中途站 |
| 495 | 362 | route.setStationMark("Z"); |
| 496 | - | |
| 497 | 363 | } |
| 498 | - | |
| 499 | 364 | // 版本号 |
| 500 | 365 | route.setVersions(versions); |
| 501 | - | |
| 502 | 366 | // 站点ID |
| 503 | 367 | route.setStation(arg0); |
| 504 | - | |
| 505 | 368 | // 方向 |
| 506 | 369 | route.setDirections(directions); |
| 507 | - | |
| 508 | 370 | // 线路ID |
| 509 | 371 | route.setLine(resultLine); |
| 510 | - | |
| 511 | 372 | // 线路编码 |
| 512 | 373 | route.setLineCode(resultLine.getLineCode()); |
| 513 | - | |
| 514 | 374 | route.setDestroy(destroy); |
| 515 | - | |
| 516 | 375 | // 插入站点路由信息 |
| 517 | 376 | routeRepository.save(route); |
| 518 | 377 | |
| 519 | 378 | } |
| 520 | - | |
| 521 | 379 | paramsMeleageAndDistncDura.put("sumUpOrDownMileage", sumUpOrDownMileage); |
| 522 | - | |
| 523 | 380 | paramsMeleageAndDistncDura.put("sectionDistance", sectionDistance); |
| 524 | - | |
| 525 | 381 | paramsMeleageAndDistncDura.put("sectionDuration", sectionDuration); |
| 526 | - | |
| 382 | + paramsMeleageAndDistncDura.put("stationdata",stationsArray); | |
| 527 | 383 | } |
| 528 | - | |
| 529 | 384 | return paramsMeleageAndDistncDura; |
| 530 | - | |
| 531 | 385 | } |
| 532 | 386 | |
| 533 | 387 | /** |
| ... | ... | @@ -784,68 +638,52 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 784 | 638 | |
| 785 | 639 | |
| 786 | 640 | Section section = sectionRepository.findOne(sectionid); |
| 787 | - | |
| 788 | 641 | // 路段路由 |
| 789 | 642 | SectionRoute sectionRoute = new SectionRoute(); |
| 790 | - | |
| 791 | 643 | // 路段序号 |
| 792 | 644 | sectionRoute.setSectionrouteCode(100); |
| 793 | - | |
| 794 | 645 | // 线路编码 |
| 795 | 646 | sectionRoute.setLineCode(resultLine.getLineCode()); |
| 796 | - | |
| 797 | 647 | // 路段ID |
| 798 | 648 | sectionRoute.setSection(section); |
| 799 | - | |
| 800 | 649 | sectionRoute.setDestroy(destroy); |
| 801 | - | |
| 802 | 650 | // 线路ID |
| 803 | 651 | sectionRoute.setLine(resultLine); |
| 804 | - | |
| 805 | 652 | // 路段编码 |
| 806 | 653 | sectionRoute.setSectionCode(sectionCode); |
| 807 | - | |
| 808 | 654 | // 版本 |
| 809 | 655 | sectionRoute.setVersions(versions); |
| 810 | - | |
| 811 | 656 | // 方向 |
| 812 | 657 | sectionRoute.setDirections(directions); |
| 813 | - | |
| 814 | 658 | // 路段路由保存 |
| 815 | 659 | sectionRouteRepository.save(sectionRoute); |
| 816 | 660 | |
| 817 | 661 | } |
| 818 | - | |
| 819 | - public boolean isHaveStationname(String bJwpoints,List<Object[]> stationNameList) { | |
| 820 | - | |
| 821 | - boolean temp = true; | |
| 822 | - | |
| 662 | + public Map<String, Object> isHaveStationname(String jd,String wd,List<Object[]> stationNameList) { | |
| 663 | + Map<String, Object> rsM = new HashMap<String ,Object>(); | |
| 664 | + boolean temp = false; | |
| 823 | 665 | if(stationNameList.size()>0) { |
| 824 | - | |
| 825 | - for(int k = 0 ; k <stationNameList.size();k++) { | |
| 826 | - | |
| 827 | - if(bJwpoints.equals(stationNameList.get(k)[0])){ | |
| 828 | - | |
| 829 | - return temp; | |
| 830 | - | |
| 831 | - }else { | |
| 832 | - | |
| 833 | - temp = false; | |
| 834 | - | |
| 666 | + if(jd.equals("0") || wd.equals("0")) { | |
| 667 | + rsM.put("id", stationNameList.get(0)[1]); | |
| 668 | + temp = true; | |
| 669 | + }else{ | |
| 670 | + Point p1 = new Point(Double.parseDouble(jd),Double.parseDouble(wd)); | |
| 671 | + for(int k = 0 ; k <stationNameList.size();k++) { | |
| 672 | + String bJwpoints[] = stationNameList.get(k)[0].toString().split(" "); | |
| 673 | + Point p2 = new Point(Double.parseDouble(bJwpoints[0]),Double.parseDouble(bJwpoints[1])); | |
| 674 | + double jl = GeoUtils.getDistance(p1, p2); | |
| 675 | + if(jl<=120d) { | |
| 676 | + rsM.put("id", stationNameList.get(k)[1]); | |
| 677 | + temp = true; | |
| 678 | + break; | |
| 679 | + } | |
| 835 | 680 | } |
| 836 | - | |
| 837 | 681 | } |
| 838 | - | |
| 839 | - }else { | |
| 840 | - | |
| 841 | - temp = false; | |
| 842 | - } | |
| 843 | - | |
| 844 | - return temp; | |
| 682 | + } | |
| 683 | + rsM.put("isHave", temp); | |
| 684 | + return rsM; | |
| 845 | 685 | } |
| 846 | 686 | |
| 847 | - | |
| 848 | - | |
| 849 | 687 | /** |
| 850 | 688 | * @Description :TODO(新增站点保存) |
| 851 | 689 | * |
| ... | ... | @@ -863,246 +701,134 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 863 | 701 | */ |
| 864 | 702 | @Override |
| 865 | 703 | public Map<String, Object> stationSaveMap(Map<String, Object> map) { |
| 866 | - | |
| 867 | 704 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 868 | - | |
| 869 | 705 | try { |
| 870 | - | |
| 871 | 706 | // 站点编码 |
| 872 | 707 | String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); |
| 873 | - | |
| 874 | 708 | // 站点ID |
| 875 | 709 | int stationId = Integer.valueOf(stationCod); |
| 876 | - | |
| 877 | 710 | // 站点名称 |
| 878 | 711 | String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); |
| 879 | - | |
| 880 | 712 | // 道路编码 |
| 881 | 713 | String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); |
| 882 | - | |
| 883 | 714 | // 原坐标类型 |
| 884 | 715 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 885 | - | |
| 886 | 716 | // 原坐标点 |
| 887 | 717 | String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString(); |
| 888 | - | |
| 889 | 718 | String bJwpointsArray[] = null; |
| 890 | - | |
| 891 | 719 | if(bJwpoints!=null) { |
| 892 | - | |
| 893 | 720 | bJwpointsArray = bJwpoints.split(" "); |
| 894 | - | |
| 895 | 721 | } |
| 896 | - | |
| 897 | 722 | // WGS经纬度 |
| 898 | 723 | Float gLonx = null; |
| 899 | - | |
| 900 | 724 | // WGS纬度 |
| 901 | 725 | Float gLaty = null; |
| 902 | - | |
| 903 | 726 | if(bJwpointsArray.length>0) { |
| 904 | - | |
| 905 | 727 | Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); |
| 906 | - | |
| 907 | 728 | gLonx = (float)resultPoint.getLng(); |
| 908 | - | |
| 909 | 729 | gLaty = (float)resultPoint.getLat(); |
| 910 | - | |
| 911 | 730 | } |
| 912 | - | |
| 913 | - /*// WGS经纬度 | |
| 914 | - String gJwpoints = map.get("gJwpoints").equals("") ? null : map.get("gJwpoints").toString(); | |
| 915 | - | |
| 916 | - String gJwpointsArray []= null; | |
| 917 | - | |
| 918 | - if(gJwpoints!=null) { | |
| 919 | - | |
| 920 | - gJwpointsArray = gJwpoints.split(" "); | |
| 921 | - | |
| 922 | - }*/ | |
| 923 | - | |
| 924 | 731 | // 方向 |
| 925 | 732 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); |
| 926 | - | |
| 927 | 733 | // 距离 |
| 928 | 734 | Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); |
| 929 | - | |
| 930 | 735 | // 时间 |
| 931 | 736 | Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); |
| 932 | - | |
| 933 | - /*// WGS经纬度 | |
| 934 | - Float gLonx = Float.parseFloat(gJwpointsArray[0]); | |
| 935 | - | |
| 936 | - // WGS纬度 | |
| 937 | - Float gLaty = Float.parseFloat(gJwpointsArray[1]);*/ | |
| 938 | - | |
| 939 | 737 | // 城建坐标经度 |
| 940 | 738 | Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); |
| 941 | - | |
| 942 | 739 | // 城建坐标纬度 |
| 943 | 740 | Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); |
| 944 | - | |
| 945 | - // 多边形WGS坐标点集合 | |
| 946 | - // String gPloygonGrid = map.get("gPolygonGrid").equals("") ? "" : map.get("gPolygonGrid").toString(); | |
| 947 | - | |
| 948 | 741 | // 多边形原坐标点集合 |
| 949 | 742 | String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); |
| 950 | - | |
| 951 | 743 | // 多边形WGS坐标点集合 |
| 952 | 744 | String gPloygonGrid =""; |
| 953 | - | |
| 954 | 745 | if(!bPloygonGrid.equals("")) { |
| 955 | - | |
| 956 | 746 | String bPloygonGridArray[] = bPloygonGrid.split(","); |
| 957 | - | |
| 958 | 747 | int bLen_ = bPloygonGridArray.length; |
| 959 | - | |
| 960 | 748 | for(int b = 0 ;b<bLen_;b++) { |
| 961 | - | |
| 962 | 749 | String tempArray[]= bPloygonGridArray[b].split(" "); |
| 963 | - | |
| 964 | 750 | Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); |
| 965 | - | |
| 966 | 751 | if(b==0) { |
| 967 | - | |
| 968 | 752 | gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); |
| 969 | - | |
| 970 | 753 | }else { |
| 971 | - | |
| 972 | 754 | gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); |
| 973 | - | |
| 974 | 755 | } |
| 975 | - | |
| 976 | 756 | } |
| 977 | - | |
| 978 | 757 | } |
| 979 | - | |
| 980 | - /* bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; | |
| 981 | - | |
| 982 | - gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";*/ | |
| 983 | - | |
| 984 | 758 | // 是否撤销 |
| 985 | 759 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); |
| 986 | - | |
| 987 | 760 | // 圆半径 |
| 988 | 761 | Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); |
| 989 | - | |
| 990 | 762 | // 图形类型 |
| 991 | 763 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); |
| 992 | - | |
| 993 | 764 | // 版本 |
| 994 | 765 | Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); |
| 995 | - | |
| 996 | 766 | // 说明 |
| 997 | 767 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); |
| 998 | - | |
| 999 | 768 | // 创建人 |
| 1000 | 769 | Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); |
| 1001 | - | |
| 1002 | 770 | // 修改人 |
| 1003 | 771 | Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); |
| 1004 | - | |
| 1005 | 772 | // 线路ID |
| 1006 | 773 | int line = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 1007 | - | |
| 1008 | 774 | // 线路信息 |
| 1009 | 775 | Line resultLine = lineRepository.findOne(line); |
| 1010 | - | |
| 1011 | 776 | // 站点路由序号 |
| 1012 | 777 | String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString(); |
| 1013 | - | |
| 1014 | 778 | // 站点类型 |
| 1015 | 779 | String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString(); |
| 1016 | - | |
| 1017 | 780 | Integer stationRouteCode = null; |
| 1018 | - | |
| 1019 | 781 | if(stationRouteCodeStr!="") { |
| 1020 | - | |
| 1021 | 782 | String stationRouteCodeArray [] = stationRouteCodeStr.split("_"); |
| 1022 | - | |
| 1023 | 783 | stationRouteCode = Integer.parseInt(stationRouteCodeArray[0].toString())+1; |
| 1024 | - | |
| 1025 | - | |
| 1026 | 784 | }else { |
| 1027 | - | |
| 1028 | 785 | stationRouteCode = 100; |
| 1029 | - | |
| 1030 | 786 | } |
| 1031 | - | |
| 1032 | 787 | if(bPloygonGrid.equals("")) |
| 1033 | 788 | bPloygonGrid = null; |
| 1034 | 789 | else |
| 1035 | 790 | bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; |
| 1036 | - | |
| 1037 | 791 | if(gPloygonGrid.equals("")) |
| 1038 | 792 | gPloygonGrid = null; |
| 1039 | 793 | else |
| 1040 | 794 | gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; |
| 1041 | - | |
| 1042 | 795 | // 保存站点 |
| 1043 | 796 | repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints, |
| 1044 | - | |
| 1045 | 797 | gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, |
| 1046 | - | |
| 1047 | 798 | shapesType, versions, descriptions, createBy, updateBy,stationId); |
| 1048 | - | |
| 1049 | - | |
| 1050 | - | |
| 1051 | - | |
| 1052 | 799 | Station station = repository.findOne(stationId); |
| 1053 | - | |
| 1054 | 800 | StationRoute arg0 = new StationRoute(); |
| 1055 | - | |
| 1056 | 801 | // 线路 |
| 1057 | 802 | arg0.setLine(resultLine); |
| 1058 | - | |
| 1059 | 803 | arg0.setLineCode(resultLine.getLineCode()); |
| 1060 | - | |
| 1061 | 804 | // 站点 |
| 1062 | 805 | arg0.setStation(station); |
| 1063 | - | |
| 1064 | 806 | // 站点路由名称 |
| 1065 | 807 | arg0.setStationName(stationName); |
| 1066 | - | |
| 1067 | 808 | // 站点路由编码 |
| 1068 | 809 | arg0.setStationCode(stationCod); |
| 1069 | - | |
| 1070 | 810 | // 站点路由序号 |
| 1071 | 811 | arg0.setStationRouteCode(stationRouteCode); |
| 1072 | - | |
| 1073 | 812 | // 站点路由类型 |
| 1074 | 813 | arg0.setStationMark(stationMark); |
| 1075 | - | |
| 1076 | 814 | // 站点路由站点方向 |
| 1077 | 815 | arg0.setDirections(directions); |
| 1078 | - | |
| 1079 | 816 | // 站点路由到站距离 |
| 1080 | 817 | arg0.setDistances(distances); |
| 1081 | - | |
| 1082 | 818 | // 站点路由到站时间 |
| 1083 | 819 | arg0.setToTime(toTime); |
| 1084 | - | |
| 1085 | 820 | // 站点版本号 |
| 1086 | 821 | arg0.setVersions(versions); |
| 1087 | - | |
| 1088 | 822 | // 是否撤销 |
| 1089 | 823 | arg0.setDestroy(destroy); |
| 1090 | - | |
| 1091 | 824 | // 站点路由说明 |
| 1092 | 825 | arg0.setDescriptions(descriptions); |
| 1093 | - | |
| 1094 | 826 | routeRepository.save(arg0); |
| 1095 | - | |
| 1096 | 827 | resultMap.put("status", ResponseCode.SUCCESS); |
| 1097 | - | |
| 1098 | 828 | } catch (Exception e) { |
| 1099 | - | |
| 1100 | 829 | resultMap.put("status", ResponseCode.ERROR); |
| 1101 | - | |
| 1102 | 830 | logger.error("save erro.", e); |
| 1103 | - | |
| 1104 | 831 | } |
| 1105 | - | |
| 1106 | 832 | return resultMap; |
| 1107 | 833 | } |
| 1108 | 834 | |
| ... | ... | @@ -1373,101 +1099,64 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1373 | 1099 | |
| 1374 | 1100 | @Override |
| 1375 | 1101 | public Map<String, Object> manualSave(Map<String, Object> map) { |
| 1376 | - | |
| 1377 | 1102 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| 1378 | - | |
| 1379 | 1103 | try { |
| 1380 | - | |
| 1381 | 1104 | // 站点信息字符传 |
| 1382 | 1105 | String stationJSON = map.get("stationJSON").equals("") ? "" : map.get("stationJSON").toString(); |
| 1383 | - | |
| 1384 | 1106 | // 路段信息字符串 |
| 1385 | 1107 | String sectionJSON = map.get("sectionJSON").equals("") ? "" : map.get("sectionJSON").toString(); |
| 1386 | - | |
| 1387 | 1108 | // 方向 |
| 1388 | 1109 | int directions = Integer.parseInt(map.get("directions").toString()); |
| 1389 | - | |
| 1390 | 1110 | // 是否撤销 |
| 1391 | 1111 | int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); |
| 1392 | - | |
| 1393 | 1112 | // 版本 |
| 1394 | 1113 | int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString()); |
| 1395 | - | |
| 1396 | 1114 | // 坐标类型 |
| 1397 | 1115 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 1398 | - | |
| 1399 | 1116 | // 限速 |
| 1400 | 1117 | String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString(); |
| 1401 | - | |
| 1402 | 1118 | // 线路ID |
| 1403 | 1119 | int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 1404 | - | |
| 1405 | 1120 | // 半径 |
| 1406 | 1121 | int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString()); |
| 1407 | - | |
| 1408 | 1122 | // 图形类型 |
| 1409 | 1123 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); |
| 1410 | - | |
| 1411 | 1124 | // 线路信息 |
| 1412 | 1125 | Line resultLine = lineRepository.findOne(lineId); |
| 1413 | - | |
| 1414 | 1126 | // 路段距离 |
| 1415 | 1127 | Double sectionDistance = 0.0d; |
| 1416 | - | |
| 1417 | 1128 | // 路段时长 |
| 1418 | 1129 | Double sectionDuration = 0.0d; |
| 1419 | - | |
| 1420 | 1130 | // 里程(上或者下) |
| 1421 | 1131 | double sumUpOrDownMileage = 0.0d; |
| 1422 | - | |
| 1423 | 1132 | Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); |
| 1424 | - | |
| 1425 | 1133 | String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); |
| 1426 | - | |
| 1427 | 1134 | if(!stationJSON.equals("")) { |
| 1428 | - | |
| 1429 | 1135 | // 保存站点与站点路由信息 |
| 1430 | 1136 | resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); |
| 1431 | - | |
| 1432 | 1137 | } |
| 1433 | - | |
| 1434 | 1138 | // 路段长度 |
| 1435 | 1139 | sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString()); |
| 1436 | - | |
| 1437 | 1140 | // 路段时长 |
| 1438 | 1141 | sectionDuration = Double.valueOf(resultSaveMapm.get("sectionDuration").toString()); |
| 1439 | - | |
| 1440 | 1142 | // 如果路段信息JSON字符串不为空 |
| 1441 | 1143 | if(!sectionJSON.equals("")) { |
| 1442 | - | |
| 1443 | 1144 | manualSaveSectionAndSectionRoute(sectionJSON, speedLimitStr, sectionDistance, sectionDuration, dbType, versions, resultLine, destroy, directions); |
| 1444 | - | |
| 1445 | 1145 | } |
| 1446 | - | |
| 1447 | 1146 | // 里程 |
| 1448 | 1147 | sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString()); |
| 1449 | - | |
| 1450 | 1148 | BigDecimal s = new BigDecimal(sumUpOrDownMileage); |
| 1451 | - | |
| 1452 | 1149 | sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| 1453 | - | |
| 1454 | 1150 | // 更新里程 |
| 1455 | 1151 | // updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage); |
| 1456 | - | |
| 1457 | 1152 | if(directions==0) { |
| 1458 | - | |
| 1459 | 1153 | // lineUpdateStationName(resultLine); |
| 1460 | - | |
| 1461 | 1154 | } |
| 1462 | - | |
| 1463 | 1155 | resultMap.put("status", ResponseCode.SUCCESS); |
| 1464 | - | |
| 1156 | + resultMap.put("stationData", resultSaveMapm.get("stationdata")); | |
| 1465 | 1157 | } catch (Exception e) { |
| 1466 | - | |
| 1467 | 1158 | resultMap.put("status", ResponseCode.ERROR); |
| 1468 | - | |
| 1469 | 1159 | logger.error("save erro.", e); |
| 1470 | - | |
| 1471 | 1160 | } |
| 1472 | 1161 | |
| 1473 | 1162 | return resultMap; |
| ... | ... | @@ -1478,103 +1167,61 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1478 | 1167 | double sectionTime,String dbType,Integer versions,Line resultLine, |
| 1479 | 1168 | |
| 1480 | 1169 | Integer destroy,Integer directions) { |
| 1481 | - | |
| 1482 | 1170 | // 转换成JSON数组 |
| 1483 | 1171 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); |
| 1484 | - | |
| 1485 | 1172 | // 遍历 |
| 1486 | 1173 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 1487 | - | |
| 1488 | 1174 | // 站点名称 |
| 1489 | 1175 | String sectionName = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("sectionName").toString(); |
| 1490 | - | |
| 1491 | 1176 | String pointsStr = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("points").toString(); |
| 1492 | - | |
| 1493 | 1177 | // 原始线状图形坐标集合 |
| 1494 | 1178 | String sectionsBpoints = ""; |
| 1495 | - | |
| 1496 | 1179 | // WGS线状图形坐标集合 |
| 1497 | 1180 | String sectionsWJPpoints = ""; |
| 1498 | - | |
| 1499 | 1181 | if(!pointsStr.equals("")){ |
| 1500 | - | |
| 1501 | 1182 | JSONArray pointsArray = JSONArray.parseArray(pointsStr); |
| 1502 | - | |
| 1503 | 1183 | for(int p =0;p<pointsArray.size();p++){ |
| 1504 | - | |
| 1505 | 1184 | String pointsLngStr = pointsArray.getJSONObject(p).get("lng").toString(); |
| 1506 | - | |
| 1507 | 1185 | String pointsLatStr = pointsArray.getJSONObject(p).get("lat").toString(); |
| 1508 | - | |
| 1509 | 1186 | Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); |
| 1510 | - | |
| 1511 | 1187 | String WGSLngStr = String.valueOf(resultPoint.getLng()); |
| 1512 | - | |
| 1513 | 1188 | String WGSLatStr = String.valueOf(resultPoint.getLat()); |
| 1514 | - | |
| 1515 | 1189 | if(p==pointsArray.size()-1){ |
| 1516 | - | |
| 1517 | 1190 | sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; |
| 1518 | - | |
| 1519 | 1191 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; |
| 1520 | - | |
| 1521 | 1192 | // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat"); |
| 1522 | - | |
| 1523 | 1193 | }else { |
| 1524 | - | |
| 1525 | 1194 | sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; |
| 1526 | - | |
| 1527 | 1195 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ","; |
| 1528 | - | |
| 1529 | 1196 | // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat") +","; |
| 1530 | - | |
| 1531 | - | |
| 1532 | 1197 | } |
| 1533 | - | |
| 1534 | 1198 | } |
| 1535 | - | |
| 1536 | 1199 | } |
| 1537 | - | |
| 1538 | 1200 | long sectionMaxId = GetUIDAndCode.getSectionId(); |
| 1539 | - | |
| 1540 | 1201 | String sectionCode = String.valueOf(sectionMaxId); |
| 1541 | - | |
| 1542 | 1202 | int sectionId = (int) (sectionMaxId); |
| 1543 | - | |
| 1544 | 1203 | // 交出路 |
| 1545 | 1204 | String crosesRoad = ""; |
| 1546 | - | |
| 1547 | 1205 | // 终止节点 |
| 1548 | 1206 | String endNode = ""; |
| 1549 | - | |
| 1550 | 1207 | // 开始节点 |
| 1551 | 1208 | String startNode = ""; |
| 1552 | - | |
| 1553 | 1209 | // 中间节点 |
| 1554 | 1210 | String middleNode = ""; |
| 1555 | - | |
| 1556 | 1211 | // WGS坐标点集合 |
| 1557 | 1212 | String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 1558 | - | |
| 1559 | 1213 | // 原坐标点集合 |
| 1560 | 1214 | String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; |
| 1561 | - | |
| 1562 | 1215 | // 城建坐标点集合 |
| 1563 | 1216 | String csectionVector = ""; |
| 1564 | - | |
| 1565 | 1217 | // 路段类型 |
| 1566 | 1218 | String sectionType = ""; |
| 1567 | - | |
| 1568 | 1219 | // 道路编码 |
| 1569 | 1220 | String roadCoding = ""; |
| 1570 | - | |
| 1571 | 1221 | // 限速 |
| 1572 | 1222 | double speedLimit = Double.parseDouble(speedLimitStr); |
| 1573 | - | |
| 1574 | 1223 | // 说明 |
| 1575 | 1224 | String descriptions = ""; |
| 1576 | - | |
| 1577 | - | |
| 1578 | 1225 | sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, |
| 1579 | 1226 | |
| 1580 | 1227 | middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, |
| ... | ... | @@ -1582,37 +1229,24 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1582 | 1229 | roadCoding, sectionDistance, sectionTime, dbType, speedLimit, |
| 1583 | 1230 | |
| 1584 | 1231 | descriptions, versions,sectionId); |
| 1585 | - | |
| 1586 | - | |
| 1587 | - | |
| 1588 | 1232 | Section section = sectionRepository.findOne(Integer.parseInt(sectionCode)); |
| 1589 | - | |
| 1590 | 1233 | // 路段路由 |
| 1591 | 1234 | SectionRoute sectionRoute = new SectionRoute(); |
| 1592 | - | |
| 1593 | 1235 | // 路段序号 |
| 1594 | 1236 | sectionRoute.setSectionrouteCode((s+1)*100); |
| 1595 | - | |
| 1596 | 1237 | // 线路编码 |
| 1597 | 1238 | sectionRoute.setLineCode(resultLine.getLineCode()); |
| 1598 | - | |
| 1599 | 1239 | // 路段ID |
| 1600 | 1240 | sectionRoute.setSection(section); |
| 1601 | - | |
| 1602 | 1241 | // 线路ID |
| 1603 | 1242 | sectionRoute.setLine(resultLine); |
| 1604 | - | |
| 1605 | 1243 | // 路段编码 |
| 1606 | 1244 | sectionRoute.setSectionCode(sectionCode); |
| 1607 | - | |
| 1608 | 1245 | // 版本 |
| 1609 | 1246 | sectionRoute.setVersions(versions); |
| 1610 | - | |
| 1611 | 1247 | sectionRoute.setDestroy(destroy); |
| 1612 | - | |
| 1613 | 1248 | // 方向 |
| 1614 | 1249 | sectionRoute.setDirections(directions); |
| 1615 | - | |
| 1616 | 1250 | sectionRouteRepository.save(sectionRoute); |
| 1617 | 1251 | } |
| 1618 | 1252 | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -1025,7 +1025,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1025 | 1025 | sch.setLate2(false); |
| 1026 | 1026 | LateAdjustHandle.remove(sch); |
| 1027 | 1027 | } |
| 1028 | - } else if (sch.getFcsjActual() != null){ | |
| 1028 | + } else if (StringUtils.isNotEmpty(sch.getFcsjActual()) && StringUtils.isEmpty(fcsjActual)){ | |
| 1029 | 1029 | //撤销实发 |
| 1030 | 1030 | revokeRealOutgo(sch.getId()); |
| 1031 | 1031 | } |
| ... | ... | @@ -1049,7 +1049,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1049 | 1049 | |
| 1050 | 1050 | //重新计算车辆执行班次 |
| 1051 | 1051 | dayOfSchedule.reCalcExecPlan(sch.getClZbh()); |
| 1052 | - } else if(StringUtils.isNotEmpty(sch.getZdsjActual())){ | |
| 1052 | + } else if(StringUtils.isNotEmpty(sch.getZdsjActual()) && StringUtils.isEmpty(zdsjActual)){ | |
| 1053 | 1053 | //清除实达时间 |
| 1054 | 1054 | sch.clearZdsjActual(); |
| 1055 | 1055 | //清除路牌下一班起点到达时间 | ... | ... |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.Line; | |
| 3 | 4 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | 5 | import com.bsth.entity.schedule.TTInfo; |
| 5 | 6 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | 7 | import com.bsth.repository.BusinessRepository; |
| 7 | 8 | import com.bsth.repository.LineRepository; |
| 8 | 9 | import com.bsth.repository.schedule.*; |
| 9 | -import com.bsth.service.schedule.SchedulePlanRuleResultService; | |
| 10 | 10 | import com.bsth.service.schedule.SchedulePlanService; |
| 11 | 11 | import com.bsth.service.schedule.exception.ScheduleException; |
| 12 | 12 | import com.bsth.service.schedule.rules.ScheduleRuleService; |
| ... | ... | @@ -36,8 +36,6 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 36 | 36 | @Autowired |
| 37 | 37 | private KieBase kieBase; |
| 38 | 38 | @Autowired |
| 39 | - private SchedulePlanInfoRepository schedulePlanInfoRepository; | |
| 40 | - @Autowired | |
| 41 | 39 | private ScheduleRule1FlatRepository scheduleRule1FlatRepository; |
| 42 | 40 | @Autowired |
| 43 | 41 | private TTInfoRepository ttInfoRepository; |
| ... | ... | @@ -52,8 +50,6 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 52 | 50 | @Autowired |
| 53 | 51 | private BusinessRepository businessRepository; |
| 54 | 52 | @Autowired |
| 55 | - private SchedulePlanRuleResultService schedulePlanRuleResultService; | |
| 56 | - @Autowired | |
| 57 | 53 | private ScheduleRuleService scheduleRuleService; |
| 58 | 54 | |
| 59 | 55 | /** 日志记录器 */ |
| ... | ... | @@ -64,7 +60,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 64 | 60 | * @param schedulePlan 排班计划对象 |
| 65 | 61 | * @param lpInfoResults_output 时刻表每日路牌的情况 |
| 66 | 62 | */ |
| 67 | - public ScheduleResults_output loopRuleOutput( | |
| 63 | + private ScheduleResults_output loopRuleOutput( | |
| 68 | 64 | SchedulePlan schedulePlan, |
| 69 | 65 | LpInfoResults_output lpInfoResults_output) { |
| 70 | 66 | // 1-1、构造drools规则输入数据,输出数据 |
| ... | ... | @@ -115,7 +111,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 115 | 111 | * @param schedulePlan 排班计划对象 |
| 116 | 112 | * @return TTInfoResults_output, LpInfoResults_output |
| 117 | 113 | */ |
| 118 | - public Object[] ttInfoOutput(SchedulePlan schedulePlan) { | |
| 114 | + private Object[] ttInfoOutput(SchedulePlan schedulePlan) { | |
| 119 | 115 | // 获取线路的所有未作废的时刻表 |
| 120 | 116 | List<TTInfo> ttInfos = ttInfoRepository.findInCanceledByXl(schedulePlan.getXl()); |
| 121 | 117 | |
| ... | ... | @@ -173,7 +169,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 173 | 169 | * @param ttInfoResults_output ttInfoOutput方法规则输出 |
| 174 | 170 | * @return PlanResult |
| 175 | 171 | */ |
| 176 | - public PlanResult planResultOutput( | |
| 172 | + private PlanResult planResultOutput( | |
| 177 | 173 | SchedulePlan schedulePlan, |
| 178 | 174 | ScheduleResults_output scheduleResults_output, |
| 179 | 175 | TTInfoResults_output ttInfoResults_output) { |
| ... | ... | @@ -186,6 +182,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 186 | 182 | ); |
| 187 | 183 | // 规则输出数据 |
| 188 | 184 | PlanResult planResult = new PlanResult(); |
| 185 | + planResult.setXlId(schedulePlan.getXl().getId().toString()); | |
| 189 | 186 | |
| 190 | 187 | // 1-2、构造drools session->载入数据->启动规则->计算->销毁session |
| 191 | 188 | // 创建session,内部配置的是stateful |
| ... | ... | @@ -214,7 +211,12 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 214 | 211 | |
| 215 | 212 | } |
| 216 | 213 | |
| 217 | - public SchedulePlan save(SchedulePlan schedulePlan) { | |
| 214 | + /** | |
| 215 | + * 生成线路排班(不含套跑规则)。 | |
| 216 | + * @param schedulePlan | |
| 217 | + * @return | |
| 218 | + */ | |
| 219 | + private PlanResult SchedulePlanWithOutRerun(SchedulePlan schedulePlan) { | |
| 218 | 220 | // pre、如果排班的数据之前已经有了,删除之前的数据 |
| 219 | 221 | Date startpre = new Date(); |
| 220 | 222 | scheduleRuleService.deelteSchedulePlanInfo( |
| ... | ... | @@ -238,21 +240,34 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 238 | 240 | PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output); |
| 239 | 241 | Date end3 = new Date(); |
| 240 | 242 | |
| 243 | + logger.info("删除数据 {} ms,drool时刻表每日路牌计算 {} ms,drool循环规则计算 {} ms,drool计划数据 {} ms", | |
| 244 | + endpre.getTime() - startpre.getTime(), | |
| 245 | + end1.getTime() - start1.getTime(), | |
| 246 | + end2.getTime() - start2.getTime(), | |
| 247 | + end3.getTime() - start3.getTime()); | |
| 248 | + | |
| 249 | + return planResult; | |
| 250 | + } | |
| 251 | + | |
| 252 | + public SchedulePlan save(SchedulePlan schedulePlan) { | |
| 253 | + // 1、查找线路,这是主线路 | |
| 254 | + Line xl = lineRepository.findOne(schedulePlan.getXl().getId()); | |
| 255 | + logger.info("<--- 排班master线路 id={}, name={}, 开始排班", xl.getId(), xl.getName()); | |
| 256 | + | |
| 257 | + // 2、确定主线路排班(无套跑规则) | |
| 258 | + PlanResult planResult = SchedulePlanWithOutRerun(schedulePlan); | |
| 259 | + | |
| 260 | + // TODO 3、确定套跑规则 | |
| 261 | + | |
| 241 | 262 | // 4、保存数据(jdbcTemplate 批量插入) |
| 242 | 263 | Date start4 = new Date(); |
| 243 | 264 | scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos()); |
| 244 | 265 | Date end4 = new Date(); |
| 245 | 266 | |
| 246 | - | |
| 247 | - logger.info("删除数据 {} ms,drool时刻表每日路牌计算 {} ms,drool循环规则计算 {} ms,drool计划数据 {} ms,插入数据 {} 条 耗时 {} ms", | |
| 248 | - endpre.getTime() - startpre.getTime(), | |
| 249 | - end1.getTime() - start1.getTime(), | |
| 250 | - end2.getTime() - start2.getTime(), | |
| 251 | - end3.getTime() - start3.getTime(), | |
| 267 | + logger.info("保存主线路数据 {} 条 耗时 {} ms --->", | |
| 252 | 268 | planResult.getSchedulePlanInfos().size(), |
| 253 | 269 | end4.getTime() - start4.getTime()); |
| 254 | 270 | |
| 255 | - | |
| 256 | 271 | return new SchedulePlan(); |
| 257 | 272 | } |
| 258 | 273 | ... | ... |
src/main/java/com/bsth/service/schedule/rules/plan/PlanResult.java
| ... | ... | @@ -9,6 +9,7 @@ import java.util.List; |
| 9 | 9 | * 计划输出。 |
| 10 | 10 | */ |
| 11 | 11 | public class PlanResult { |
| 12 | + private String xlId; | |
| 12 | 13 | private List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>(); |
| 13 | 14 | |
| 14 | 15 | public PlanResult() { |
| ... | ... | @@ -25,4 +26,12 @@ public class PlanResult { |
| 25 | 26 | public void setSchedulePlanInfos(List<SchedulePlanInfo> schedulePlanInfos) { |
| 26 | 27 | this.schedulePlanInfos = schedulePlanInfos; |
| 27 | 28 | } |
| 29 | + | |
| 30 | + public String getXlId() { | |
| 31 | + return xlId; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setXlId(String xlId) { | |
| 35 | + this.xlId = xlId; | |
| 36 | + } | |
| 28 | 37 | } | ... | ... |
src/main/java/com/bsth/util/GetUIDAndCode.java
| ... | ... | @@ -26,80 +26,47 @@ import com.bsth.repository.StationRepository; |
| 26 | 26 | */ |
| 27 | 27 | @Component |
| 28 | 28 | public class GetUIDAndCode { |
| 29 | - | |
| 30 | 29 | @Autowired |
| 31 | 30 | private LineRepository lineRepository; |
| 32 | - | |
| 33 | 31 | @Autowired |
| 34 | 32 | private StationRepository stationRepository; |
| 35 | - | |
| 36 | 33 | @Autowired |
| 37 | 34 | private SectionRepository sectionRepository; |
| 38 | - | |
| 39 | 35 | @Autowired |
| 40 | 36 | private CarParkRepository carParkRepository; |
| 41 | - | |
| 42 | 37 | /** 线路ID */ |
| 43 | 38 | private static long lineId = 0L; |
| 44 | - | |
| 45 | 39 | /** 站点ID */ |
| 46 | 40 | private static long stationId = 0L; |
| 47 | - | |
| 48 | 41 | /** 路段ID */ |
| 49 | 42 | private static long sectionId = 0L; |
| 50 | - | |
| 51 | 43 | /** 停车长ID*/ |
| 52 | 44 | private static long carParkId = 0L; |
| 53 | - | |
| 54 | 45 | public GetUIDAndCode() { |
| 55 | - | |
| 56 | 46 | new Timer().schedule(new TimerTask() { |
| 57 | - | |
| 58 | 47 | @Override |
| 59 | 48 | public void run() { |
| 60 | - | |
| 61 | 49 | lineId = lineRepository.selectMaxIdToLineCode(); |
| 62 | - | |
| 63 | 50 | stationId = stationRepository.stationMaxId(); |
| 64 | - | |
| 65 | 51 | sectionId = sectionRepository.sectionMaxId(); |
| 66 | - | |
| 67 | 52 | carParkId = carParkRepository.carParkMaxId(); |
| 68 | - | |
| 69 | 53 | } |
| 70 | 54 | }, 1000 * 30); |
| 71 | - | |
| 72 | 55 | } |
| 73 | - | |
| 74 | 56 | public static synchronized long getLineId() { |
| 75 | - | |
| 76 | 57 | ++lineId; |
| 77 | - | |
| 78 | 58 | return lineId; |
| 79 | - | |
| 80 | 59 | } |
| 81 | - | |
| 82 | 60 | public static synchronized long getStationId() { |
| 83 | - | |
| 84 | 61 | ++stationId; |
| 85 | - | |
| 86 | 62 | return stationId; |
| 87 | 63 | } |
| 88 | - | |
| 89 | 64 | public static synchronized long getSectionId() { |
| 90 | - | |
| 91 | 65 | ++sectionId; |
| 92 | - | |
| 93 | 66 | return sectionId; |
| 94 | - | |
| 95 | 67 | } |
| 96 | - | |
| 97 | 68 | public static synchronized long getCarParkId() { |
| 98 | - | |
| 99 | 69 | ++carParkId; |
| 100 | - | |
| 101 | 70 | return carParkId; |
| 102 | - | |
| 103 | 71 | } |
| 104 | - | |
| 105 | -} | |
| 72 | +} | |
| 106 | 73 | \ No newline at end of file | ... | ... |
src/main/resources/datatools/ktrs/employeesDataInput.ktr
| ... | ... | @@ -86,6 +86,30 @@ |
| 86 | 86 | <notepads> |
| 87 | 87 | </notepads> |
| 88 | 88 | <connection> |
| 89 | + <name>192.168.168.1_jwgl_dw</name> | |
| 90 | + <server>192.168.168.1</server> | |
| 91 | + <type>ORACLE</type> | |
| 92 | + <access>Native</access> | |
| 93 | + <database>orcl</database> | |
| 94 | + <port>1521</port> | |
| 95 | + <username>jwgl_dw</username> | |
| 96 | + <password>Encrypted 2be98afc86aa7f2e4cb13b977d2adabcd</password> | |
| 97 | + <servername/> | |
| 98 | + <data_tablespace/> | |
| 99 | + <index_tablespace/> | |
| 100 | + <attributes> | |
| 101 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | |
| 102 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | |
| 103 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | |
| 104 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | |
| 105 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | |
| 106 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | |
| 107 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 108 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 109 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | |
| 110 | + </attributes> | |
| 111 | + </connection> | |
| 112 | + <connection> | |
| 89 | 113 | <name>bus_control_variable</name> |
| 90 | 114 | <server>${v_db_ip}</server> |
| 91 | 115 | <type>MYSQL</type> |
| ... | ... | @@ -268,7 +292,7 @@ |
| 268 | 292 | <optimizationLevel>9</optimizationLevel> |
| 269 | 293 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 270 | 294 | <jsScript_name>Script 1</jsScript_name> |
| 271 | - <jsScript_script>//Script here

var gh_calcu = 所属公司代码 + "-" + 工号;</jsScript_script> | |
| 295 | + <jsScript_script>//Script here

var gh_calcu = 工号;

if (工号.indexOf(所属公司代码 + "-") < 0) {
 gh_calcu = 所属公司代码 + "-" + 工号;
} </jsScript_script> | |
| 272 | 296 | </jsScript> </jsScripts> <fields> <field> <name>gh_calcu</name> |
| 273 | 297 | <rename>gh_calcu</rename> |
| 274 | 298 | <type>String</type> |
| ... | ... | @@ -712,4 +736,3 @@ |
| 712 | 736 | <slave_transformation>N</slave_transformation> |
| 713 | 737 | |
| 714 | 738 | </transformation> |
| 715 | - | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataInput.ktr
| ... | ... | @@ -381,12 +381,12 @@ |
| 381 | 381 | <hop> <from>按照班次类型过滤数据1</from><to>正常班次数据</to><enabled>Y</enabled> </hop> |
| 382 | 382 | <hop> <from>按照班次类型过滤数据2</from><to>出场班次数据</to><enabled>Y</enabled> </hop> |
| 383 | 383 | <hop> <from>按照班次类型过滤数据2</from><to>进场班次数据</to><enabled>Y</enabled> </hop> |
| 384 | - <hop> <from>查找线路上下行里程时间</from><to>匹配上下行正常班次里程时间</to><enabled>Y</enabled> </hop> | |
| 384 | + <hop> <from>查找线路所有上下行里程时间</from><to>匹配上下行正常班次里程时间</to><enabled>Y</enabled> </hop> | |
| 385 | 385 | <hop> <from>查找终点站关联</from><to>上下行字典</to><enabled>Y</enabled> </hop> |
| 386 | 386 | <hop> <from>查找起点站关联并确定上下行</from><to>查找终点站关联</to><enabled>Y</enabled> </hop> |
| 387 | 387 | <hop> <from>正常班次_处理数据</from><to>查找起点站关联并确定上下行</to><enabled>Y</enabled> </hop> |
| 388 | 388 | <hop> <from>正常班次数据</from><to>正常班次_处理数据</to><enabled>Y</enabled> </hop> |
| 389 | - <hop> <from>班次类型字典</from><to>查找线路上下行里程时间</to><enabled>Y</enabled> </hop> | |
| 389 | + <hop> <from>班次类型字典</from><to>查找线路所有上下行里程时间</to><enabled>Y</enabled> </hop> | |
| 390 | 390 | <hop> <from>班次类型字典 2</from><to>查找线路出场里程时间</to><enabled>Y</enabled> </hop> |
| 391 | 391 | <hop> <from>班次类型字典 3</from><to>查找线路进场里程时间</to><enabled>Y</enabled> </hop> |
| 392 | 392 | <hop> <from>查找路牌关联</from><to>计算班次类型</to><enabled>Y</enabled> </hop> |
| ... | ... | @@ -696,7 +696,7 @@ |
| 696 | 696 | <optimizationLevel>9</optimizationLevel> |
| 697 | 697 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 698 | 698 | <jsScript_name>Script 1</jsScript_name> |
| 699 | - <jsScript_script>//Script here

var jhlc; // 计划里程
var bcsj; // 班次时间

if (sxx == 0) { // 上行
 jhlc = up_mileage;
 bcsj = up_travel_time;
} else { // sxx == 1 下行
 jhlc = down_mileage;
 bcsj = down_travel_time;
}</jsScript_script> | |
| 699 | + <jsScript_script>//Script here

var jhlc; // 计划里程
var bcsj; // 班次时间

// 时间范围正则表达式
var timeRex = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
// 发车时间转换成日期
var fcsj_hour = str2num(sendtime_calcu.substr(0, 2), "#");
var fcsj_min = str2num(sendtime_calcu.substr(3, 2), "#");
var fcsj_date = new Date(2000,1,1,fcsj_hour,fcsj_min,0);

// 判定是否早高峰
var isZgf = false;
if (timeRex.test(early_start_time) && timeRex.test(early_end_time) && early_up_time != null && early_down_time != null) {
 var early_s_hour = str2num(early_start_time.substr(0, 2), "#");
 var early_s_min = str2num(early_start_time.substr(3, 2), "#");
 var early_s_date = new Date(2000,1,1,early_s_hour,early_s_min,0);

 var early_e_hour = str2num(early_end_time.substr(0, 2), "#");
 var early_e_min = str2num(early_end_time.substr(3, 2), "#");
 var early_e_date = new Date(2000,1,1,early_e_hour,early_e_min,0);

 if (fcsj_date >= early_s_date && fcsj_date <= early_e_date) {
 isZgf = true;
 }
}

// 判定是否晚高峰
var isWgf = false;
if (timeRex.test(late_start_time) && timeRex.test(late_end_time) && late_up_time != null && late_down_time != null) {
 var late_s_hour = str2num(late_start_time.substr(0, 2), "#");
 var late_s_min = str2num(late_start_time.substr(3, 2), "#");
 var late_s_date = new Date(2000,1,1,late_s_hour,late_s_min,0);

 var late_e_hour = str2num(late_end_time.substr(0, 2), "#");
 var late_e_min = str2num(late_end_time.substr(3, 2), "#");
 var late_e_date = new Date(2000,1,1,late_e_hour,late_e_min,0);

 if (fcsj_date >= late_s_date && fcsj_date <= late_e_date) {
 isWgf = true;
 }
}

// 判定是否晚高峰

if (sxx == 0) { // 上行
 if (isZgf) {
 jhlc = up_mileage;
 bcsj = early_up_time;
 } else if (isWgf) {
 jhlc = up_mileage;
 bcsj = late_up_time;
 } else {
 jhlc = up_mileage;
 bcsj = up_travel_time;
 }
} else { // sxx == 1 下行
 if (isZgf) {
 jhlc = down_mileage;
 bcsj = early_down_time;
 } else if (isWgf) {
 jhlc = down_mileage;
 bcsj = late_down_time;
 } else {
 jhlc = down_mileage;
 bcsj = down_travel_time;
 }
}

</jsScript_script> | |
| 700 | 700 | </jsScript> </jsScripts> <fields> <field> <name>jhlc</name> |
| 701 | 701 | <rename>jhlc</rename> |
| 702 | 702 | <type>String</type> |
| ... | ... | @@ -1677,7 +1677,7 @@ |
| 1677 | 1677 | </step> |
| 1678 | 1678 | |
| 1679 | 1679 | <step> |
| 1680 | - <name>查找线路上下行里程时间</name> | |
| 1680 | + <name>查找线路关联</name> | |
| 1681 | 1681 | <type>DBLookup</type> |
| 1682 | 1682 | <description/> |
| 1683 | 1683 | <distribute>Y</distribute> |
| ... | ... | @@ -1693,51 +1693,39 @@ |
| 1693 | 1693 | <cache_size>0</cache_size> |
| 1694 | 1694 | <lookup> |
| 1695 | 1695 | <schema/> |
| 1696 | - <table>bsth_c_line_information</table> | |
| 1696 | + <table>bsth_c_line</table> | |
| 1697 | 1697 | <orderby/> |
| 1698 | 1698 | <fail_on_multiple>N</fail_on_multiple> |
| 1699 | 1699 | <eat_row_on_failure>N</eat_row_on_failure> |
| 1700 | 1700 | <key> |
| 1701 | - <name>xlid</name> | |
| 1702 | - <field>line</field> | |
| 1701 | + <name>xlname_</name> | |
| 1702 | + <field>name</field> | |
| 1703 | + <condition>=</condition> | |
| 1704 | + <name2/> | |
| 1705 | + </key> | |
| 1706 | + <key> | |
| 1707 | + <name>iscanceled</name> | |
| 1708 | + <field>destroy</field> | |
| 1703 | 1709 | <condition>=</condition> |
| 1704 | 1710 | <name2/> |
| 1705 | 1711 | </key> |
| 1706 | 1712 | <value> |
| 1707 | - <name>up_mileage</name> | |
| 1708 | - <rename>up_mileage</rename> | |
| 1709 | - <default/> | |
| 1710 | - <type>Number</type> | |
| 1711 | - </value> | |
| 1712 | - <value> | |
| 1713 | - <name>down_mileage</name> | |
| 1714 | - <rename>down_mileage</rename> | |
| 1715 | - <default/> | |
| 1716 | - <type>Number</type> | |
| 1717 | - </value> | |
| 1718 | - <value> | |
| 1719 | - <name>up_travel_time</name> | |
| 1720 | - <rename>up_travel_time</rename> | |
| 1721 | - <default/> | |
| 1722 | - <type>Number</type> | |
| 1723 | - </value> | |
| 1724 | - <value> | |
| 1725 | - <name>down_travel_time</name> | |
| 1726 | - <rename>down_travel_time</rename> | |
| 1713 | + <name>id</name> | |
| 1714 | + <rename>xlid</rename> | |
| 1727 | 1715 | <default/> |
| 1728 | - <type>Number</type> | |
| 1716 | + <type>Integer</type> | |
| 1729 | 1717 | </value> |
| 1730 | 1718 | </lookup> |
| 1731 | 1719 | <cluster_schema/> |
| 1732 | 1720 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 1733 | - <xloc>149</xloc> | |
| 1734 | - <yloc>581</yloc> | |
| 1721 | + <xloc>1007</xloc> | |
| 1722 | + <yloc>43</yloc> | |
| 1735 | 1723 | <draw>Y</draw> |
| 1736 | 1724 | </GUI> |
| 1737 | 1725 | </step> |
| 1738 | 1726 | |
| 1739 | 1727 | <step> |
| 1740 | - <name>查找线路关联</name> | |
| 1728 | + <name>查找线路出场里程时间</name> | |
| 1741 | 1729 | <type>DBLookup</type> |
| 1742 | 1730 | <description/> |
| 1743 | 1731 | <distribute>Y</distribute> |
| ... | ... | @@ -1753,33 +1741,51 @@ |
| 1753 | 1741 | <cache_size>0</cache_size> |
| 1754 | 1742 | <lookup> |
| 1755 | 1743 | <schema/> |
| 1756 | - <table>bsth_c_line</table> | |
| 1744 | + <table>bsth_c_line_information</table> | |
| 1757 | 1745 | <orderby/> |
| 1758 | 1746 | <fail_on_multiple>N</fail_on_multiple> |
| 1759 | 1747 | <eat_row_on_failure>N</eat_row_on_failure> |
| 1760 | 1748 | <key> |
| 1761 | - <name>xlname_</name> | |
| 1762 | - <field>name</field> | |
| 1749 | + <name>xlid</name> | |
| 1750 | + <field>line</field> | |
| 1763 | 1751 | <condition>=</condition> |
| 1764 | 1752 | <name2/> |
| 1765 | 1753 | </key> |
| 1766 | 1754 | <value> |
| 1767 | - <name>id</name> | |
| 1768 | - <rename>xlid</rename> | |
| 1755 | + <name>up_out_timer</name> | |
| 1756 | + <rename>up_out_timer</rename> | |
| 1769 | 1757 | <default/> |
| 1770 | - <type>Integer</type> | |
| 1758 | + <type>Number</type> | |
| 1759 | + </value> | |
| 1760 | + <value> | |
| 1761 | + <name>up_out_mileage</name> | |
| 1762 | + <rename>up_out_mileage</rename> | |
| 1763 | + <default/> | |
| 1764 | + <type>Number</type> | |
| 1765 | + </value> | |
| 1766 | + <value> | |
| 1767 | + <name>down_out_timer</name> | |
| 1768 | + <rename>down_out_timer</rename> | |
| 1769 | + <default/> | |
| 1770 | + <type>Number</type> | |
| 1771 | + </value> | |
| 1772 | + <value> | |
| 1773 | + <name>down_out_mileage</name> | |
| 1774 | + <rename>down_out_mileage</rename> | |
| 1775 | + <default/> | |
| 1776 | + <type>Number</type> | |
| 1771 | 1777 | </value> |
| 1772 | 1778 | </lookup> |
| 1773 | 1779 | <cluster_schema/> |
| 1774 | 1780 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 1775 | - <xloc>1007</xloc> | |
| 1776 | - <yloc>43</yloc> | |
| 1781 | + <xloc>335</xloc> | |
| 1782 | + <yloc>763</yloc> | |
| 1777 | 1783 | <draw>Y</draw> |
| 1778 | 1784 | </GUI> |
| 1779 | 1785 | </step> |
| 1780 | 1786 | |
| 1781 | 1787 | <step> |
| 1782 | - <name>查找线路出场里程时间</name> | |
| 1788 | + <name>查找线路所有上下行里程时间</name> | |
| 1783 | 1789 | <type>DBLookup</type> |
| 1784 | 1790 | <description/> |
| 1785 | 1791 | <distribute>Y</distribute> |
| ... | ... | @@ -1806,34 +1812,82 @@ |
| 1806 | 1812 | <name2/> |
| 1807 | 1813 | </key> |
| 1808 | 1814 | <value> |
| 1809 | - <name>up_out_timer</name> | |
| 1810 | - <rename>up_out_timer</rename> | |
| 1815 | + <name>up_mileage</name> | |
| 1816 | + <rename>up_mileage</rename> | |
| 1811 | 1817 | <default/> |
| 1812 | 1818 | <type>Number</type> |
| 1813 | 1819 | </value> |
| 1814 | 1820 | <value> |
| 1815 | - <name>up_out_mileage</name> | |
| 1816 | - <rename>up_out_mileage</rename> | |
| 1821 | + <name>down_mileage</name> | |
| 1822 | + <rename>down_mileage</rename> | |
| 1817 | 1823 | <default/> |
| 1818 | 1824 | <type>Number</type> |
| 1819 | 1825 | </value> |
| 1820 | 1826 | <value> |
| 1821 | - <name>down_out_timer</name> | |
| 1822 | - <rename>down_out_timer</rename> | |
| 1827 | + <name>up_travel_time</name> | |
| 1828 | + <rename>up_travel_time</rename> | |
| 1823 | 1829 | <default/> |
| 1824 | 1830 | <type>Number</type> |
| 1825 | 1831 | </value> |
| 1826 | 1832 | <value> |
| 1827 | - <name>down_out_mileage</name> | |
| 1828 | - <rename>down_out_mileage</rename> | |
| 1833 | + <name>down_travel_time</name> | |
| 1834 | + <rename>down_travel_time</rename> | |
| 1835 | + <default/> | |
| 1836 | + <type>Number</type> | |
| 1837 | + </value> | |
| 1838 | + <value> | |
| 1839 | + <name>early_start_time</name> | |
| 1840 | + <rename>early_start_time</rename> | |
| 1841 | + <default/> | |
| 1842 | + <type>String</type> | |
| 1843 | + </value> | |
| 1844 | + <value> | |
| 1845 | + <name>early_end_time</name> | |
| 1846 | + <rename>early_end_time</rename> | |
| 1847 | + <default/> | |
| 1848 | + <type>String</type> | |
| 1849 | + </value> | |
| 1850 | + <value> | |
| 1851 | + <name>early_up_time</name> | |
| 1852 | + <rename>early_up_time</rename> | |
| 1853 | + <default/> | |
| 1854 | + <type>Number</type> | |
| 1855 | + </value> | |
| 1856 | + <value> | |
| 1857 | + <name>early_down_time</name> | |
| 1858 | + <rename>early_down_time</rename> | |
| 1859 | + <default/> | |
| 1860 | + <type>Number</type> | |
| 1861 | + </value> | |
| 1862 | + <value> | |
| 1863 | + <name>late_start_time</name> | |
| 1864 | + <rename>late_start_time</rename> | |
| 1865 | + <default/> | |
| 1866 | + <type>String</type> | |
| 1867 | + </value> | |
| 1868 | + <value> | |
| 1869 | + <name>late_end_time</name> | |
| 1870 | + <rename>late_end_time</rename> | |
| 1871 | + <default/> | |
| 1872 | + <type>String</type> | |
| 1873 | + </value> | |
| 1874 | + <value> | |
| 1875 | + <name>late_up_time</name> | |
| 1876 | + <rename>late_up_time</rename> | |
| 1877 | + <default/> | |
| 1878 | + <type>Number</type> | |
| 1879 | + </value> | |
| 1880 | + <value> | |
| 1881 | + <name>late_down_time</name> | |
| 1882 | + <rename>late_down_time</rename> | |
| 1829 | 1883 | <default/> |
| 1830 | 1884 | <type>Number</type> |
| 1831 | 1885 | </value> |
| 1832 | 1886 | </lookup> |
| 1833 | 1887 | <cluster_schema/> |
| 1834 | 1888 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 1835 | - <xloc>335</xloc> | |
| 1836 | - <yloc>763</yloc> | |
| 1889 | + <xloc>149</xloc> | |
| 1890 | + <yloc>581</yloc> | |
| 1837 | 1891 | <draw>Y</draw> |
| 1838 | 1892 | </GUI> |
| 1839 | 1893 | </step> | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataInput2.ktr
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <transformation> |
| 3 | 3 | <info> |
| 4 | - <name>时刻表明细导出2</name> | |
| 4 | + <name>时刻表明细导入2</name> | |
| 5 | 5 | <description>时刻表明细信息导入</description> |
| 6 | 6 | <extended_description>时刻表明细信息</extended_description> |
| 7 | 7 | <trans_version/> |
| ... | ... | @@ -381,12 +381,12 @@ |
| 381 | 381 | <hop> <from>按照班次类型过滤数据1</from><to>正常班次数据</to><enabled>Y</enabled> </hop> |
| 382 | 382 | <hop> <from>按照班次类型过滤数据2</from><to>出场班次数据</to><enabled>Y</enabled> </hop> |
| 383 | 383 | <hop> <from>按照班次类型过滤数据2</from><to>进场班次数据</to><enabled>Y</enabled> </hop> |
| 384 | - <hop> <from>查找线路上下行里程时间</from><to>匹配上下行正常班次里程时间</to><enabled>Y</enabled> </hop> | |
| 384 | + <hop> <from>查找所有线路上下行里程时间</from><to>匹配上下行正常班次里程时间</to><enabled>Y</enabled> </hop> | |
| 385 | 385 | <hop> <from>查找终点站关联</from><to>上下行字典</to><enabled>Y</enabled> </hop> |
| 386 | 386 | <hop> <from>查找起点站关联并确定上下行</from><to>查找终点站关联</to><enabled>Y</enabled> </hop> |
| 387 | 387 | <hop> <from>正常班次_处理数据</from><to>查找起点站关联并确定上下行</to><enabled>Y</enabled> </hop> |
| 388 | 388 | <hop> <from>正常班次数据</from><to>正常班次_处理数据</to><enabled>Y</enabled> </hop> |
| 389 | - <hop> <from>班次类型字典</from><to>查找线路上下行里程时间</to><enabled>Y</enabled> </hop> | |
| 389 | + <hop> <from>班次类型字典</from><to>查找所有线路上下行里程时间</to><enabled>Y</enabled> </hop> | |
| 390 | 390 | <hop> <from>班次类型字典 2</from><to>查找线路出场里程时间</to><enabled>Y</enabled> </hop> |
| 391 | 391 | <hop> <from>班次类型字典 3</from><to>查找线路进场里程时间</to><enabled>Y</enabled> </hop> |
| 392 | 392 | <hop> <from>查找路牌关联</from><to>计算班次类型</to><enabled>Y</enabled> </hop> |
| ... | ... | @@ -696,7 +696,7 @@ |
| 696 | 696 | <optimizationLevel>9</optimizationLevel> |
| 697 | 697 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 698 | 698 | <jsScript_name>Script 1</jsScript_name> |
| 699 | - <jsScript_script>//Script here

var jhlc; // 计划里程
var bcsj; // 班次时间

if (sxx == 0) { // 上行
 jhlc = up_mileage;
 bcsj = up_travel_time;
} else { // sxx == 1 下行
 jhlc = down_mileage;
 bcsj = down_travel_time;
}</jsScript_script> | |
| 699 | + <jsScript_script>//Script here

var jhlc; // 计划里程
var bcsj; // 班次时间

// 时间范围正则表达式
var timeRex = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
// 发车时间转换成日期
var fcsj_hour = str2num(sendtime_calcu.substr(0, 2), "#");
var fcsj_min = str2num(sendtime_calcu.substr(3, 2), "#");
var fcsj_date = new Date(2000,1,1,fcsj_hour,fcsj_min,0);

// 判定是否早高峰
var isZgf = false;
if (timeRex.test(early_start_time) && timeRex.test(early_end_time) && early_up_time != null && early_down_time != null) {
 var early_s_hour = str2num(early_start_time.substr(0, 2), "#");
 var early_s_min = str2num(early_start_time.substr(3, 2), "#");
 var early_s_date = new Date(2000,1,1,early_s_hour,early_s_min,0);

 var early_e_hour = str2num(early_end_time.substr(0, 2), "#");
 var early_e_min = str2num(early_end_time.substr(3, 2), "#");
 var early_e_date = new Date(2000,1,1,early_e_hour,early_e_min,0);

 if (fcsj_date >= early_s_date && fcsj_date <= early_e_date) {
 isZgf = true;
 }
}

// 判定是否晚高峰
var isWgf = false;
if (timeRex.test(late_start_time) && timeRex.test(late_end_time) && late_up_time != null && late_down_time != null) {
 var late_s_hour = str2num(late_start_time.substr(0, 2), "#");
 var late_s_min = str2num(late_start_time.substr(3, 2), "#");
 var late_s_date = new Date(2000,1,1,late_s_hour,late_s_min,0);

 var late_e_hour = str2num(late_end_time.substr(0, 2), "#");
 var late_e_min = str2num(late_end_time.substr(3, 2), "#");
 var late_e_date = new Date(2000,1,1,late_e_hour,late_e_min,0);

 if (fcsj_date >= late_s_date && fcsj_date <= late_e_date) {
 isWgf = true;
 }
}

// 判定是否晚高峰

if (sxx == 0) { // 上行
 if (isZgf) {
 jhlc = up_mileage;
 bcsj = early_up_time;
 } else if (isWgf) {
 jhlc = up_mileage;
 bcsj = late_up_time;
 } else {
 jhlc = up_mileage;
 bcsj = up_travel_time;
 }
} else { // sxx == 1 下行
 if (isZgf) {
 jhlc = down_mileage;
 bcsj = early_down_time;
 } else if (isWgf) {
 jhlc = down_mileage;
 bcsj = late_down_time;
 } else {
 jhlc = down_mileage;
 bcsj = down_travel_time;
 }
}</jsScript_script> | |
| 700 | 700 | </jsScript> </jsScripts> <fields> <field> <name>jhlc</name> |
| 701 | 701 | <rename>jhlc</rename> |
| 702 | 702 | <type>String</type> |
| ... | ... | @@ -1623,7 +1623,7 @@ |
| 1623 | 1623 | </step> |
| 1624 | 1624 | |
| 1625 | 1625 | <step> |
| 1626 | - <name>查找时刻表基础信息关联</name> | |
| 1626 | + <name>查找所有线路上下行里程时间</name> | |
| 1627 | 1627 | <type>DBLookup</type> |
| 1628 | 1628 | <description/> |
| 1629 | 1629 | <distribute>Y</distribute> |
| ... | ... | @@ -1639,45 +1639,99 @@ |
| 1639 | 1639 | <cache_size>0</cache_size> |
| 1640 | 1640 | <lookup> |
| 1641 | 1641 | <schema/> |
| 1642 | - <table>bsth_c_s_ttinfo</table> | |
| 1642 | + <table>bsth_c_line_information</table> | |
| 1643 | 1643 | <orderby/> |
| 1644 | 1644 | <fail_on_multiple>N</fail_on_multiple> |
| 1645 | 1645 | <eat_row_on_failure>N</eat_row_on_failure> |
| 1646 | 1646 | <key> |
| 1647 | 1647 | <name>xlid</name> |
| 1648 | - <field>xl</field> | |
| 1649 | - <condition>=</condition> | |
| 1650 | - <name2/> | |
| 1651 | - </key> | |
| 1652 | - <key> | |
| 1653 | - <name>ttinfoname_</name> | |
| 1654 | - <field>name</field> | |
| 1655 | - <condition>=</condition> | |
| 1656 | - <name2/> | |
| 1657 | - </key> | |
| 1658 | - <key> | |
| 1659 | - <name>iscanceled</name> | |
| 1660 | - <field>is_cancel</field> | |
| 1648 | + <field>line</field> | |
| 1661 | 1649 | <condition>=</condition> |
| 1662 | 1650 | <name2/> |
| 1663 | 1651 | </key> |
| 1664 | 1652 | <value> |
| 1665 | - <name>id</name> | |
| 1666 | - <rename>ttid</rename> | |
| 1653 | + <name>up_mileage</name> | |
| 1654 | + <rename>up_mileage</rename> | |
| 1667 | 1655 | <default/> |
| 1668 | - <type>Integer</type> | |
| 1656 | + <type>Number</type> | |
| 1657 | + </value> | |
| 1658 | + <value> | |
| 1659 | + <name>down_mileage</name> | |
| 1660 | + <rename>down_mileage</rename> | |
| 1661 | + <default/> | |
| 1662 | + <type>Number</type> | |
| 1663 | + </value> | |
| 1664 | + <value> | |
| 1665 | + <name>up_travel_time</name> | |
| 1666 | + <rename>up_travel_time</rename> | |
| 1667 | + <default/> | |
| 1668 | + <type>Number</type> | |
| 1669 | + </value> | |
| 1670 | + <value> | |
| 1671 | + <name>down_travel_time</name> | |
| 1672 | + <rename>down_travel_time</rename> | |
| 1673 | + <default/> | |
| 1674 | + <type>Number</type> | |
| 1675 | + </value> | |
| 1676 | + <value> | |
| 1677 | + <name>early_start_time</name> | |
| 1678 | + <rename>early_start_time</rename> | |
| 1679 | + <default/> | |
| 1680 | + <type>String</type> | |
| 1681 | + </value> | |
| 1682 | + <value> | |
| 1683 | + <name>early_end_time</name> | |
| 1684 | + <rename>early_end_time</rename> | |
| 1685 | + <default/> | |
| 1686 | + <type>String</type> | |
| 1687 | + </value> | |
| 1688 | + <value> | |
| 1689 | + <name>early_up_time</name> | |
| 1690 | + <rename>early_up_time</rename> | |
| 1691 | + <default/> | |
| 1692 | + <type>Number</type> | |
| 1693 | + </value> | |
| 1694 | + <value> | |
| 1695 | + <name>early_down_time</name> | |
| 1696 | + <rename>early_down_time</rename> | |
| 1697 | + <default/> | |
| 1698 | + <type>Number</type> | |
| 1699 | + </value> | |
| 1700 | + <value> | |
| 1701 | + <name>late_start_time</name> | |
| 1702 | + <rename>late_start_time</rename> | |
| 1703 | + <default/> | |
| 1704 | + <type>String</type> | |
| 1705 | + </value> | |
| 1706 | + <value> | |
| 1707 | + <name>late_end_time</name> | |
| 1708 | + <rename>late_end_time</rename> | |
| 1709 | + <default/> | |
| 1710 | + <type>String</type> | |
| 1711 | + </value> | |
| 1712 | + <value> | |
| 1713 | + <name>late_up_time</name> | |
| 1714 | + <rename>late_up_time</rename> | |
| 1715 | + <default/> | |
| 1716 | + <type>Number</type> | |
| 1717 | + </value> | |
| 1718 | + <value> | |
| 1719 | + <name>late_down_time</name> | |
| 1720 | + <rename>late_down_time</rename> | |
| 1721 | + <default/> | |
| 1722 | + <type>Number</type> | |
| 1669 | 1723 | </value> |
| 1670 | 1724 | </lookup> |
| 1671 | 1725 | <cluster_schema/> |
| 1672 | 1726 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 1673 | - <xloc>1011</xloc> | |
| 1674 | - <yloc>134</yloc> | |
| 1727 | + <xloc>149</xloc> | |
| 1728 | + <yloc>581</yloc> | |
| 1675 | 1729 | <draw>Y</draw> |
| 1676 | 1730 | </GUI> |
| 1677 | 1731 | </step> |
| 1678 | 1732 | |
| 1679 | 1733 | <step> |
| 1680 | - <name>查找线路上下行里程时间</name> | |
| 1734 | + <name>查找时刻表基础信息关联</name> | |
| 1681 | 1735 | <type>DBLookup</type> |
| 1682 | 1736 | <description/> |
| 1683 | 1737 | <distribute>Y</distribute> |
| ... | ... | @@ -1693,45 +1747,39 @@ |
| 1693 | 1747 | <cache_size>0</cache_size> |
| 1694 | 1748 | <lookup> |
| 1695 | 1749 | <schema/> |
| 1696 | - <table>bsth_c_line_information</table> | |
| 1750 | + <table>bsth_c_s_ttinfo</table> | |
| 1697 | 1751 | <orderby/> |
| 1698 | 1752 | <fail_on_multiple>N</fail_on_multiple> |
| 1699 | 1753 | <eat_row_on_failure>N</eat_row_on_failure> |
| 1700 | 1754 | <key> |
| 1701 | 1755 | <name>xlid</name> |
| 1702 | - <field>line</field> | |
| 1756 | + <field>xl</field> | |
| 1757 | + <condition>=</condition> | |
| 1758 | + <name2/> | |
| 1759 | + </key> | |
| 1760 | + <key> | |
| 1761 | + <name>ttinfoname_</name> | |
| 1762 | + <field>name</field> | |
| 1763 | + <condition>=</condition> | |
| 1764 | + <name2/> | |
| 1765 | + </key> | |
| 1766 | + <key> | |
| 1767 | + <name>iscanceled</name> | |
| 1768 | + <field>is_cancel</field> | |
| 1703 | 1769 | <condition>=</condition> |
| 1704 | 1770 | <name2/> |
| 1705 | 1771 | </key> |
| 1706 | 1772 | <value> |
| 1707 | - <name>up_mileage</name> | |
| 1708 | - <rename>up_mileage</rename> | |
| 1709 | - <default/> | |
| 1710 | - <type>Number</type> | |
| 1711 | - </value> | |
| 1712 | - <value> | |
| 1713 | - <name>down_mileage</name> | |
| 1714 | - <rename>down_mileage</rename> | |
| 1715 | - <default/> | |
| 1716 | - <type>Number</type> | |
| 1717 | - </value> | |
| 1718 | - <value> | |
| 1719 | - <name>up_travel_time</name> | |
| 1720 | - <rename>up_travel_time</rename> | |
| 1721 | - <default/> | |
| 1722 | - <type>Number</type> | |
| 1723 | - </value> | |
| 1724 | - <value> | |
| 1725 | - <name>down_travel_time</name> | |
| 1726 | - <rename>down_travel_time</rename> | |
| 1773 | + <name>id</name> | |
| 1774 | + <rename>ttid</rename> | |
| 1727 | 1775 | <default/> |
| 1728 | - <type>Number</type> | |
| 1776 | + <type>Integer</type> | |
| 1729 | 1777 | </value> |
| 1730 | 1778 | </lookup> |
| 1731 | 1779 | <cluster_schema/> |
| 1732 | 1780 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 1733 | - <xloc>149</xloc> | |
| 1734 | - <yloc>581</yloc> | |
| 1781 | + <xloc>1011</xloc> | |
| 1782 | + <yloc>134</yloc> | |
| 1735 | 1783 | <draw>Y</draw> |
| 1736 | 1784 | </GUI> |
| 1737 | 1785 | </step> |
| ... | ... | @@ -1763,6 +1811,12 @@ |
| 1763 | 1811 | <condition>=</condition> |
| 1764 | 1812 | <name2/> |
| 1765 | 1813 | </key> |
| 1814 | + <key> | |
| 1815 | + <name>iscanceled</name> | |
| 1816 | + <field>destroy</field> | |
| 1817 | + <condition>=</condition> | |
| 1818 | + <name2/> | |
| 1819 | + </key> | |
| 1766 | 1820 | <value> |
| 1767 | 1821 | <name>id</name> |
| 1768 | 1822 | <rename>xlid</rename> | ... | ... |
src/main/resources/static/assets/bower_components/ng-sweet-alert/.bower.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "ng-sweet-alert", | |
| 3 | + "description": "Sweet Alert Directive", | |
| 4 | + "version": "1.0.11", | |
| 5 | + "authors": [ | |
| 6 | + "Tushar Borole <tushariscoolster@gmail.com>" | |
| 7 | + ], | |
| 8 | + "repository": { | |
| 9 | + "type": "git", | |
| 10 | + "url": "https://github.com/tushariscoolster/ng-sweet-alert" | |
| 11 | + }, | |
| 12 | + "homepage": "http://tushariscoolster.github.io/ng-sweet-alert/", | |
| 13 | + "license": "LGPL-2.1", | |
| 14 | + "main": "ng-sweet-alert.js", | |
| 15 | + "keywords": [ | |
| 16 | + "sweetalert", | |
| 17 | + "angular", | |
| 18 | + "alert" | |
| 19 | + ], | |
| 20 | + "ignore": [ | |
| 21 | + "gh-pages", | |
| 22 | + "node_modules", | |
| 23 | + "bower_components" | |
| 24 | + ], | |
| 25 | + "dependencies": { | |
| 26 | + "sweetalert": "*" | |
| 27 | + }, | |
| 28 | + "_release": "1.0.11", | |
| 29 | + "_resolution": { | |
| 30 | + "type": "version", | |
| 31 | + "tag": "v1.0.11", | |
| 32 | + "commit": "dddf04ee7750f53b2f86945e06326a7a8eddf56d" | |
| 33 | + }, | |
| 34 | + "_source": "https://github.com/tushariscoolster/ng-sweet-alert.git", | |
| 35 | + "_target": "1.0.11", | |
| 36 | + "_originalSource": "ng-sweet-alert" | |
| 37 | +} | |
| 0 | 38 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/bower_components/ng-sweet-alert/.gitignore
0 → 100644
| 1 | +node_modules/ | ... | ... |
src/main/resources/static/assets/bower_components/ng-sweet-alert/Gruntfile.js
0 → 100644
| 1 | +'use strict'; | |
| 2 | + | |
| 3 | +/* jshint camelcase: false */ | |
| 4 | + | |
| 5 | + | |
| 6 | +module.exports = function (grunt) | |
| 7 | +{ | |
| 8 | + // Load grunt tasks automatically | |
| 9 | + require('load-grunt-tasks')(grunt); | |
| 10 | + | |
| 11 | + // Time how long tasks take. Can help when optimizing build times | |
| 12 | + require('time-grunt')(grunt); | |
| 13 | + | |
| 14 | + var appConfig = { | |
| 15 | + app: 'src', | |
| 16 | + example: 'example', | |
| 17 | + dist: 'dist', | |
| 18 | + tpl: 'src/templates' | |
| 19 | + }; | |
| 20 | + // Define the configuration for all the tasks | |
| 21 | + grunt.initConfig({ | |
| 22 | + // Watches files for changes and runs tasks based on the changed files | |
| 23 | + appConfig: appConfig, | |
| 24 | + bump: { | |
| 25 | + options: { | |
| 26 | + files: ['bower.json','package.json'], | |
| 27 | + updateConfigs: [], | |
| 28 | + commit: true, | |
| 29 | + commitMessage: 'Release v%VERSION%', | |
| 30 | + commitFiles: [ | |
| 31 | + 'bower.json', | |
| 32 | + 'ng-sweet-alert.js', | |
| 33 | + 'package.json' | |
| 34 | + ], | |
| 35 | + createTag: true, | |
| 36 | + tagName: 'v%VERSION%', | |
| 37 | + tagMessage: 'Version %VERSION%', | |
| 38 | + push: false, | |
| 39 | + pushTo: 'git@github.com:tushariscoolster/ng-sweet-alert.git', | |
| 40 | + gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d', | |
| 41 | + globalReplace: false | |
| 42 | + } | |
| 43 | + } | |
| 44 | + }); | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + grunt.registerTask('release', function (target) | |
| 51 | + { | |
| 52 | + grunt.task.run([ | |
| 53 | + 'bump' | |
| 54 | + ]); | |
| 55 | + }); | |
| 56 | + | |
| 57 | +}; | ... | ... |
src/main/resources/static/assets/bower_components/ng-sweet-alert/README.md
0 → 100644
| 1 | +[](https://www.npmjs.com/package/ng-sweet-alert) | |
| 2 | +[](https://www.npmjs.com/package/ng-sweet-alert) | |
| 3 | +[](http://bower.io/search/?q=ng-sweet-alert) | |
| 4 | +[](https://github.com/tushariscoolster/ng-sweet-alert) | |
| 5 | +[](https://github.com/tushariscoolster/ng-sweet-alert) | |
| 6 | + | |
| 7 | + | |
| 8 | +# ng-sweet-alert | |
| 9 | + | |
| 10 | +ng-sweet-alert is an directive for sweet alert [sweetalert]. Integration of sweet alert becomes very easy with angular js. There is no need to write a single line of javascript code. Only few html attribute is enough to use sweetalert. | |
| 11 | + | |
| 12 | +## Getting Started | |
| 13 | + | |
| 14 | +Install via bower | |
| 15 | + | |
| 16 | +```sh | |
| 17 | +bower install ng-sweet-alert | |
| 18 | +``` | |
| 19 | + | |
| 20 | +Install via npm | |
| 21 | + | |
| 22 | +```sh | |
| 23 | +npm install ng-sweet-alert | |
| 24 | +``` | |
| 25 | + | |
| 26 | +Add dependency in your module | |
| 27 | + | |
| 28 | +```javascript | |
| 29 | +angular.module('yourApp',[ 'ng-sweet-alert' ]); | |
| 30 | +``` | |
| 31 | + | |
| 32 | +## Demo | |
| 33 | + | |
| 34 | +Have a look at the [DEMO](http://tushariscoolster.github.io/ng-sweet-alert) or the [plunkr](http://plnkr.co/edit/OBhogm1ZfaGKN466Dijv?p=preview)! Edit and Fork :) | |
| 35 | + | |
| 36 | + | |
| 37 | +## Configure | |
| 38 | + | |
| 39 | +```html | |
| 40 | +<input sweetalert sweet-options="{title: 'Are you sure?',text: 'You will not be able to recover this imaginary file!',type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: 'Yes, delete it!',cancelButtonText: 'No, cancel plx!'}" sweet-confirm-option="{title: 'Deleted!',text: 'Your imaginary file has been deleted.',type: 'success'}" sweet-cancel-option="{title: 'Cancelled!',text: 'Your imaginary file is safe',type: 'error'}" type="submit" name="login-submit" sweet-on-cancel="checkCancel()" sweet-on-confirm="checkConfirm()" id="login-submit" tabindex="4" class="form-control btn btn-login" value="Log In"> | |
| 41 | +``` | |
| 42 | + | |
| 43 | +## Documentation | |
| 44 | + | |
| 45 | + | |
| 46 | +| | Option| | |
| 47 | + ----------------- | ---------------------------- | ------------------ | |
| 48 | +| sweet-options | `'{title: 'Are you sure?',text: 'You will not be able to recover this imaginary file!',type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: 'Yes, delete it!',cancelButtonText: 'No, cancel plx!'}'` | |
| 49 | +| sweet-confirm-option| `"{title: 'Deleted!',text: 'Your imaginary file has been deleted.',type: 'success'}"` | |
| 50 | +| sweet-cancel-option| `{title: 'Cancelled!',text: 'Your imaginary file is safe',type: 'error'}` | |
| 51 | +| sweet-on-cancel| `checkCancel()` | |
| 52 | +| sweet-on-confirm| `checkConfirm()` | |
| 53 | + | |
| 54 | + | |
| 55 | +---------- | |
| 56 | + | |
| 57 | +## Use SweetAlert as service | |
| 58 | + | |
| 59 | + swal() gets two arguments; | |
| 60 | + first argument is parameters Objects (with default values). | |
| 61 | + second argument is Callback function when clicking on "OK"/"Cancel", which is a promise. | |
| 62 | + register to the promise (using 'then') and handle the resolve / reject according to your business logic. | |
| 63 | + | |
| 64 | + Add 'SweetAlert' to your directive / controller / ect) | |
| 65 | + Use SweetAlert.confirm(msg, options) / SweetAlert.alert(msg, options) / SweetAlert.info(msg, options) / SweetAlert.success(msg, options) | |
| 66 | + pass arguments: | |
| 67 | + | |
| 68 | + msg; String - The message to be displayed in the alert / confirm box (mandatory). | |
| 69 | + options; Object (optinal): | |
| 70 | + title: String - the title of the box. | |
| 71 | + type: String - "warning" / "info" / "error" / "success" / "" (empty string will not display a graphic icon). | |
| 72 | + showCancelButton: Boolean - shows the "cancel" button (true will behave like confirm dialog, false will behave like alert dialog). | |
| 73 | + | |
| 74 | + Use returned promise; | |
| 75 | + | |
| 76 | + ```javascript | |
| 77 | + SweetAlert.confirm("Are you sure?", {title : "Careful now!"}) | |
| 78 | + .then(function(p) { do something on success }, | |
| 79 | + function(p) { do something on fail } | |
| 80 | + ); | |
| 81 | + | |
| 82 | + SweetAlert.success("You have successfully completed our poll!", {title: "Good job!"}); | |
| 83 | +``` | |
| 84 | + | |
| 85 | + | |
| 86 | +## Documentation: SweetAlert as a service | |
| 87 | + | |
| 88 | + | |
| 89 | +| | Option| | |
| 90 | + ----------------- | ---------------------------- | ------------------ | |
| 91 | +| msg (mandatory)| `"Are you sure you want to do that.."` | |
| 92 | +| options| `"{title: 'Delete this?', type: 'warning' showCancelButton: true}"` | |
| 93 | + | |
| 94 | + | |
| 95 | +---------- | |
| 96 | + | |
| 97 | +## Contributing | |
| 98 | + | |
| 99 | +Open an issue first to discuss potential changes/additions. If you have questions with the guide, feel free to leave them as issues in the repository. If you find a typo, create a pull request. The idea is to keep the content up to date and use github’s native feature to help tell the story with issues and PR’s, which are all searchable via google. Why? Because odds are if you have a question, someone else does too! You can learn more here at about how to contribute. | |
| 100 | + | |
| 101 | +*By contributing to this repository you are agreeing to make your content available subject to the license of this repository.* | |
| 102 | + | |
| 103 | +### Process | |
| 104 | + 1. Discuss the changes in a GitHub issue. | |
| 105 | + 2. Open a Pull Request, reference the issue, and explain the change and why it adds value. | |
| 106 | + 3. The Pull Request will be evaluated and either merged or declined. | |
| 107 | + | |
| 108 | +## License | |
| 109 | + | |
| 110 | + Use this guide. Attributions are appreciated._ | |
| 111 | + | |
| 112 | +### Copyright | |
| 113 | + | |
| 114 | +Copyright (c) 2014-2015 [Tushar Borole](http://www.tusharborole.com) | |
| 115 | + | |
| 116 | +### (The MIT License) | |
| 117 | +Permission is hereby granted, free of charge, to any person obtaining | |
| 118 | +a copy of this software and associated documentation files (the | |
| 119 | +'Software'), to deal in the Software without restriction, including | |
| 120 | +without limitation the rights to use, copy, modify, merge, publish, | |
| 121 | +distribute, sublicense, and/or sell copies of the Software, and to | |
| 122 | +permit persons to whom the Software is furnished to do so, subject to | |
| 123 | +the following conditions: | |
| 124 | + | |
| 125 | +The above copyright notice and this permission notice shall be | |
| 126 | +included in all copies or substantial portions of the Software. | |
| 127 | + | |
| 128 | +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | |
| 129 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 130 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
| 131 | +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
| 132 | +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
| 133 | +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
| 134 | +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 135 | + | |
| 136 | +##Last but not least | |
| 137 | +This is made in India with love and passion ʕ´•ᴥ•`ʔ | |
| 138 | + | |
| 139 | +<a href="../../" target="_blank"><img src="http://lonamowers-hrd.appspot.com/images/made_india.jpg" height="200"></a> | ... | ... |
src/main/resources/static/assets/bower_components/ng-sweet-alert/bower.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "ng-sweet-alert", | |
| 3 | + "description": "Sweet Alert Directive", | |
| 4 | + "version": "1.0.11", | |
| 5 | + "authors": [ | |
| 6 | + "Tushar Borole <tushariscoolster@gmail.com>" | |
| 7 | + ], | |
| 8 | + "repository": { | |
| 9 | + "type": "git", | |
| 10 | + "url": "https://github.com/tushariscoolster/ng-sweet-alert" | |
| 11 | + }, | |
| 12 | + "homepage": "http://tushariscoolster.github.io/ng-sweet-alert/", | |
| 13 | + "license": "LGPL-2.1", | |
| 14 | + "main": "ng-sweet-alert.js", | |
| 15 | + "keywords": ["sweetalert", | |
| 16 | + "angular", | |
| 17 | + "alert" | |
| 18 | + ], | |
| 19 | + "ignore": [ | |
| 20 | + "gh-pages", | |
| 21 | + "node_modules", | |
| 22 | + "bower_components" | |
| 23 | + ], | |
| 24 | + "dependencies": { | |
| 25 | + "sweetalert": "*" | |
| 26 | + } | |
| 27 | +} | ... | ... |
src/main/resources/static/assets/bower_components/ng-sweet-alert/ng-sweet-alert.js
0 → 100644
| 1 | +/** | |
| 2 | + * * @description directive for sweet alert | |
| 3 | + * @author Tushar Borole | |
| 4 | + * @createDate 18/04/2015 | |
| 5 | + * @version 1.0.3 | |
| 6 | + * @lastmodifiedDate 06/18/2015 | |
| 7 | + */ | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | +(function() { | |
| 12 | + 'use strict'; | |
| 13 | + | |
| 14 | + | |
| 15 | + // Check we have sweet alert js included | |
| 16 | + if (angular.isUndefined(window.swal)) { | |
| 17 | + throw "Please inlcude sweet alert js and css from http://t4t5.github.io/sweetalert/"; | |
| 18 | + } | |
| 19 | + | |
| 20 | + angular | |
| 21 | + .module('ng-sweet-alert', []) | |
| 22 | + .directive('sweetalert', sweetalert) | |
| 23 | + .factory('SweetAlert', sweetalert_service); | |
| 24 | + | |
| 25 | + sweetalert.$inject = ['$parse']; | |
| 26 | + | |
| 27 | + /* @ngInject */ | |
| 28 | + function sweetalert($parse) { | |
| 29 | + // Usage: | |
| 30 | + // | |
| 31 | + // Creates: | |
| 32 | + // | |
| 33 | + var directive = { | |
| 34 | + link: link | |
| 35 | + }; | |
| 36 | + return directive; | |
| 37 | + | |
| 38 | + function link(scope, element, attrs, controller) { | |
| 39 | + var sweetElement = angular.element(element); | |
| 40 | + sweetElement.click(function() { | |
| 41 | + var sweetOptions = scope.$eval(attrs.sweetOptions); | |
| 42 | + var sweetConfirmOption = scope.$eval(attrs.sweetConfirmOption); | |
| 43 | + var sweetCancelOption = scope.$eval(attrs.sweetCancelOption); | |
| 44 | + | |
| 45 | + | |
| 46 | + swal(sweetOptions, | |
| 47 | + function(isConfirm) { | |
| 48 | + if (isConfirm) { | |
| 49 | + if (sweetConfirmOption) swal(sweetConfirmOption); | |
| 50 | + if (attrs.sweetOnConfirm) scope.$evalAsync(attrs.sweetOnConfirm); | |
| 51 | + | |
| 52 | + } else { | |
| 53 | + if (sweetCancelOption) swal(sweetCancelOption); | |
| 54 | + if (attrs.sweetOnCancel) scope.$evalAsync(attrs.sweetOnCancel); | |
| 55 | + } | |
| 56 | + }); | |
| 57 | + | |
| 58 | + }) | |
| 59 | + | |
| 60 | + } | |
| 61 | + } | |
| 62 | + | |
| 63 | + // Use SweetAlert as service | |
| 64 | + // | |
| 65 | + // swal() gets two arguments; | |
| 66 | + // first argument is parameters Objects (with default values). | |
| 67 | + // second argument is Callback function when clicking on "OK"/"Cancel", which is a promise. | |
| 68 | + // register to the promise (using 'then') and handle the resolve / reject according to your business logic. | |
| 69 | + // | |
| 70 | + // Add 'SweetAlert' to your directive / controller / ect) | |
| 71 | + // Use SweetAlert.confirm(msg, options) / SweetAlert.alert(msg, options) / SweetAlert.info(msg, options) / SweetAlert.success(msg, options) | |
| 72 | + // pass arguments: | |
| 73 | + // msg; String - The message to be displayed in the alert / confirm box (mandatory). | |
| 74 | + // options; Object (optinal): | |
| 75 | + // title: String - the title of the box. | |
| 76 | + // type: String - "warning" / "info" / "error" / "success" / "" (empty string will not display a graphic icon). | |
| 77 | + // showCancelButton: Boolean - shows the "cancel" button (true will behave like confirm dialog, false will behave like alert dialog). | |
| 78 | + // Use returned promise; | |
| 79 | + // | |
| 80 | + // SweetAlert.confirm("Are you sure?", {title : "Careful now!"}) | |
| 81 | + // .then(function(p) { do something on success }, | |
| 82 | + // function(p) { do something on fail } | |
| 83 | + // ); | |
| 84 | + // | |
| 85 | + // SweetAlert.success("You have successfully completed our poll!", {title: "Good job!"}); | |
| 86 | + | |
| 87 | + sweetalert_service.$inject = ['$q']; | |
| 88 | + | |
| 89 | + function sweetalert_service($q) { | |
| 90 | + function swal_alert(message, options) { | |
| 91 | + return swal_confirm(message, angular.extend({ | |
| 92 | + title: "Alert", | |
| 93 | + text: message, | |
| 94 | + type: "warning", | |
| 95 | + showCancelButton: false | |
| 96 | + }, options)); | |
| 97 | + } | |
| 98 | + | |
| 99 | + function swal_info(message, options) { | |
| 100 | + return swal_alert(message, angular.extend({ | |
| 101 | + type: "info" | |
| 102 | + }, options)); | |
| 103 | + } | |
| 104 | + | |
| 105 | + function swal_success(message, options) { | |
| 106 | + return swal_alert(message, angular.extend({ | |
| 107 | + type: "success" | |
| 108 | + }, options)); | |
| 109 | + } | |
| 110 | + | |
| 111 | + function swal_error(message, options) { | |
| 112 | + return swal_alert(message, angular.extend({ | |
| 113 | + type: "error" | |
| 114 | + }, options)); | |
| 115 | + } | |
| 116 | + | |
| 117 | + function swal_confirm(message, options) { | |
| 118 | + var defered = $q.defer(); | |
| 119 | + var options = angular.extend({ | |
| 120 | + title: "Alert", | |
| 121 | + text: message, | |
| 122 | + type: "warning", | |
| 123 | + showCancelButton: true | |
| 124 | + }, options); | |
| 125 | + swal(options, function(r) { | |
| 126 | + defered.resolve(r); | |
| 127 | + }, function(e) { | |
| 128 | + defered.reject(e); | |
| 129 | + }); | |
| 130 | + return defered.promise; | |
| 131 | + } | |
| 132 | + return { | |
| 133 | + alert: swal_alert, | |
| 134 | + confirm: swal_confirm, | |
| 135 | + info: swal_info, | |
| 136 | + success: swal_success, | |
| 137 | + error: swal_error | |
| 138 | + }; | |
| 139 | + } | |
| 140 | + | |
| 141 | +})(); | |
| 142 | + | ... | ... |
src/main/resources/static/assets/bower_components/ng-sweet-alert/package.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "ng-sweet-alert", | |
| 3 | + "version": "1.0.11", | |
| 4 | + "repository": { | |
| 5 | + "type": "git", | |
| 6 | + "url": "https://github.com/tushariscoolster/ng-sweet-alert" | |
| 7 | + }, | |
| 8 | + "main": "ng-sweet-alert.js", | |
| 9 | + "devDependencies": { | |
| 10 | + "grunt": "^0.4.1", | |
| 11 | + "grunt-bump": "0.0.16", | |
| 12 | + "load-grunt-tasks": "^0.4.0", | |
| 13 | + "time-grunt": "^0.3.1" | |
| 14 | + }, | |
| 15 | + "engines": { | |
| 16 | + "node": ">=0.10.0" | |
| 17 | + }, | |
| 18 | + "dependencies": {} | |
| 19 | +} | |
| 0 | 20 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/.bower.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "sweetalert", | |
| 3 | + "homepage": "http://tristanedwards.me/sweetalert", | |
| 4 | + "authors": [ | |
| 5 | + "Tristan Edwards <tristan.edwards@me.com> (http://tristanedwards.me)" | |
| 6 | + ], | |
| 7 | + "description": "A beautiful replacement for JavaScript's alert.", | |
| 8 | + "main": [ | |
| 9 | + "dist/sweetalert.min.js", | |
| 10 | + "dist/sweetalert.css" | |
| 11 | + ], | |
| 12 | + "keywords": [ | |
| 13 | + "alert", | |
| 14 | + "modal" | |
| 15 | + ], | |
| 16 | + "repository": { | |
| 17 | + "type": "git", | |
| 18 | + "url": "git@github.com:t4t5/sweetalert.git" | |
| 19 | + }, | |
| 20 | + "license": "MIT", | |
| 21 | + "devDependencies": { | |
| 22 | + "qunit": "~1.18.0", | |
| 23 | + "jquery": "~2.1.4" | |
| 24 | + }, | |
| 25 | + "version": "1.1.3", | |
| 26 | + "_release": "1.1.3", | |
| 27 | + "_resolution": { | |
| 28 | + "type": "version", | |
| 29 | + "tag": "v1.1.3", | |
| 30 | + "commit": "1228f1e0a7ccda1f445224f3945867b4fc1234e5" | |
| 31 | + }, | |
| 32 | + "_source": "https://github.com/t4t5/sweetalert.git", | |
| 33 | + "_target": "*", | |
| 34 | + "_originalSource": "sweetalert" | |
| 35 | +} | |
| 0 | 36 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/.editorconfig
0 → 100644
src/main/resources/static/assets/bower_components/sweetalert/.gitignore
0 → 100644
src/main/resources/static/assets/bower_components/sweetalert/.jshintrc
0 → 100644
src/main/resources/static/assets/bower_components/sweetalert/.travis.yml
0 → 100644
src/main/resources/static/assets/bower_components/sweetalert/LICENSE
0 → 100644
| 1 | +The MIT License (MIT) | |
| 2 | + | |
| 3 | +Copyright (c) 2014 Tristan Edwards | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in all | |
| 13 | +copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 21 | +SOFTWARE. | |
| 22 | + | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/README.md
0 → 100644
| 1 | +SweetAlert [](https://travis-ci.org/t4t5/sweetalert) | |
| 2 | +========== | |
| 3 | + | |
| 4 | +An awesome replacement for JavaScript's alert. | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | +[See it in action!](http://t4t5.github.io/sweetalert) | |
| 9 | + | |
| 10 | +[Learn how to use it!](https://www.ludu.co/lesson/how-to-use-sweetalert) | |
| 11 | + | |
| 12 | + | |
| 13 | +Usage | |
| 14 | +----- | |
| 15 | + | |
| 16 | +You can install SweetAlert through bower: | |
| 17 | + | |
| 18 | +```bash | |
| 19 | +bower install sweetalert | |
| 20 | +``` | |
| 21 | + | |
| 22 | +Or through npm: | |
| 23 | + | |
| 24 | +```bash | |
| 25 | +npm install sweetalert | |
| 26 | +``` | |
| 27 | + | |
| 28 | +Alternatively, download the package and reference the JavaScript and CSS files manually: | |
| 29 | + | |
| 30 | +```html | |
| 31 | +<script src="dist/sweetalert.min.js"></script> | |
| 32 | +<link rel="stylesheet" type="text/css" href="dist/sweetalert.css"> | |
| 33 | +``` | |
| 34 | +**Note:** If you're using an older version than v1.0.0, the files are `lib/sweet-alert.min.js` and `lib/sweet-alert.css` | |
| 35 | + | |
| 36 | + | |
| 37 | +Tutorial | |
| 38 | +-------- | |
| 39 | + | |
| 40 | +The easiest way to get started is follow the [SweetAlert tutorial on Ludu](https://www.ludu.co/lesson/how-to-use-sweetalert)! | |
| 41 | + | |
| 42 | + | |
| 43 | +Examples | |
| 44 | +-------- | |
| 45 | + | |
| 46 | +The most basic message: | |
| 47 | + | |
| 48 | +```javascript | |
| 49 | +swal("Hello world!"); | |
| 50 | +``` | |
| 51 | + | |
| 52 | +A message signaling an error: | |
| 53 | + | |
| 54 | +```javascript | |
| 55 | +swal("Oops...", "Something went wrong!", "error"); | |
| 56 | +``` | |
| 57 | + | |
| 58 | +A warning message, with a function attached to the "Confirm"-button: | |
| 59 | + | |
| 60 | +```javascript | |
| 61 | +swal({ | |
| 62 | + title: "Are you sure?", | |
| 63 | + text: "You will not be able to recover this imaginary file!", | |
| 64 | + type: "warning", | |
| 65 | + showCancelButton: true, | |
| 66 | + confirmButtonColor: "#DD6B55", | |
| 67 | + confirmButtonText: "Yes, delete it!", | |
| 68 | + closeOnConfirm: false, | |
| 69 | + html: false | |
| 70 | +}, function(){ | |
| 71 | + swal("Deleted!", | |
| 72 | + "Your imaginary file has been deleted.", | |
| 73 | + "success"); | |
| 74 | +}); | |
| 75 | +``` | |
| 76 | + | |
| 77 | +A prompt modal where the user's input is logged: | |
| 78 | + | |
| 79 | +```javascript | |
| 80 | +swal({ | |
| 81 | + title: "An input!", | |
| 82 | + text: 'Write something interesting:', | |
| 83 | + type: 'input', | |
| 84 | + showCancelButton: true, | |
| 85 | + closeOnConfirm: false, | |
| 86 | + animation: "slide-from-top" | |
| 87 | +}, function(inputValue){ | |
| 88 | + console.log("You wrote", inputValue); | |
| 89 | +}); | |
| 90 | +``` | |
| 91 | + | |
| 92 | +Ajax request example: | |
| 93 | + | |
| 94 | +```javascript | |
| 95 | +swal({ | |
| 96 | + title: 'Ajax request example', | |
| 97 | + text: 'Submit to run ajax request', | |
| 98 | + type: 'info', | |
| 99 | + showCancelButton: true, | |
| 100 | + closeOnConfirm: false, | |
| 101 | + disableButtonsOnConfirm: true, | |
| 102 | + confirmLoadingButtonColor: '#DD6B55' | |
| 103 | +}, function(inputValue){ | |
| 104 | + setTimeout(function() { | |
| 105 | + swal('Ajax request finished!'); | |
| 106 | + }, 2000); | |
| 107 | +}); | |
| 108 | +``` | |
| 109 | + | |
| 110 | +[View more examples](http://t4t5.github.io/sweetalert) | |
| 111 | + | |
| 112 | + | |
| 113 | +Themes | |
| 114 | +------ | |
| 115 | + | |
| 116 | +SweetAlert can easily be themed to fit your site's design. SweetAlert comes with three example themes that you can try out: **facebook**, **twitter** and **google**. They can be referenced right after the intial sweetalert-CSS: | |
| 117 | +```html | |
| 118 | +<link rel="stylesheet" href="dist/sweetalert.css"> | |
| 119 | +<link rel="stylesheet" href="themes/twitter/twitter.css"> | |
| 120 | +``` | |
| 121 | + | |
| 122 | + | |
| 123 | +Browser compatibility | |
| 124 | +--------------------- | |
| 125 | + | |
| 126 | +SweetAlert works in most major browsers (yes, even IE). Some details: | |
| 127 | + | |
| 128 | +- **IE8**: (Dropped since v1.0.0-beta) | |
| 129 | +- **IE9**: Works, but icons are not animated. | |
| 130 | +- **IE10+**: Works! | |
| 131 | +- **Safari 4+**: Works! | |
| 132 | +- **Firefox 3+**: Works! | |
| 133 | +- **Chrome 14+**: Works! | |
| 134 | +- **Opera 15+**: Works! | |
| 135 | + | |
| 136 | + | |
| 137 | +Contributing | |
| 138 | +------------ | |
| 139 | + | |
| 140 | +If you want to contribute: | |
| 141 | + | |
| 142 | +- Fork the repo | |
| 143 | + | |
| 144 | +- Make sure you have [Node](http://nodejs.org/), [NPM](https://www.npmjs.com/) and [Gulp](http://gulpjs.com/) installed. When in the SweetAlert directory, run `npm install` to install the dependencies. Then run `gulp` while working to automatically minify the SCSS and JS-files. | |
| 145 | + | |
| 146 | +- Keep in mind that SweetAlert uses Browserify in order to compile ES6-files. For easy debugging, make sure you reference the file `dist/sweetalert-dev.js` instead of `sweetalert.js`. | |
| 147 | + | |
| 148 | +- After you're done, make a pull request and wait for approval! :) | |
| 149 | + | |
| 150 | + | |
| 151 | +Related projects | |
| 152 | +---------------- | |
| 153 | + | |
| 154 | +* [SweetAlert for Android](https://github.com/pedant/sweet-alert-dialog) | |
| 155 | +* [SweetAlert for Bootstrap](https://github.com/lipis/bootstrap-sweetalert) | |
| 156 | +* [SweetAlert for AngularJS](https://github.com/oitozero/ngSweetAlert) | |
| 157 | +* [SweetAlert for RubyOnRails](https://github.com/sharshenov/sweetalert-rails) | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/bower.json
0 → 100644
| 1 | +{ | |
| 2 | + "name": "sweetalert", | |
| 3 | + "homepage": "http://tristanedwards.me/sweetalert", | |
| 4 | + "authors": [ | |
| 5 | + "Tristan Edwards <tristan.edwards@me.com> (http://tristanedwards.me)" | |
| 6 | + ], | |
| 7 | + "description": "A beautiful replacement for JavaScript's alert.", | |
| 8 | + "main": [ | |
| 9 | + "dist/sweetalert.min.js", | |
| 10 | + "dist/sweetalert.css" | |
| 11 | + ], | |
| 12 | + "keywords": [ | |
| 13 | + "alert", | |
| 14 | + "modal" | |
| 15 | + ], | |
| 16 | + "repository": { | |
| 17 | + "type": "git", | |
| 18 | + "url": "git@github.com:t4t5/sweetalert.git" | |
| 19 | + }, | |
| 20 | + "license": "MIT", | |
| 21 | + "devDependencies": { | |
| 22 | + "qunit": "~1.18.0", | |
| 23 | + "jquery": "~2.1.4" | |
| 24 | + } | |
| 25 | +} | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/gulpfile-wrap-template.js
0 → 100644
| 1 | +;(function(window, document, undefined) { | |
| 2 | + "use strict"; | |
| 3 | + | |
| 4 | + <%= contents %> | |
| 5 | + | |
| 6 | + /* | |
| 7 | + * Use SweetAlert with RequireJS | |
| 8 | + */ | |
| 9 | + | |
| 10 | + if (typeof define === 'function' && define.amd) { | |
| 11 | + define(function () { | |
| 12 | + return sweetAlert; | |
| 13 | + }); | |
| 14 | + } else if (typeof module !== 'undefined' && module.exports) { | |
| 15 | + module.exports = sweetAlert; | |
| 16 | + } | |
| 17 | + | |
| 18 | +})(window, document); | |
| 0 | 19 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/ie9.css
0 → 100644
| 1 | +/* Internet Explorer 9 has some special quirks that are fixed here */ | |
| 2 | +/* The icons are not animated. */ | |
| 3 | +/* This file is automatically merged into sweet-alert.min.js through Gulp */ | |
| 4 | + | |
| 5 | +/* Error icon */ | |
| 6 | +.sweet-alert .sa-icon.sa-error .sa-line.sa-left { | |
| 7 | + -ms-transform: rotate(45deg)\9; | |
| 8 | +} | |
| 9 | +.sweet-alert .sa-icon.sa-error .sa-line.sa-right { | |
| 10 | + -ms-transform: rotate(-45deg)\9; | |
| 11 | +} | |
| 12 | + | |
| 13 | + | |
| 14 | +/* Success icon */ | |
| 15 | +.sweet-alert .sa-icon.sa-success { | |
| 16 | + border-color: transparent\9; | |
| 17 | +} | |
| 18 | +.sweet-alert .sa-icon.sa-success .sa-line.sa-tip { | |
| 19 | + -ms-transform: rotate(45deg)\9; | |
| 20 | +} | |
| 21 | +.sweet-alert .sa-icon.sa-success .sa-line.sa-long { | |
| 22 | + -ms-transform: rotate(-45deg)\9; | |
| 23 | +} | |
| 0 | 24 | \ No newline at end of file | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/loader-animation.css
0 → 100644
| 1 | +/*! | |
| 2 | + * Load Awesome v1.1.0 (http://github.danielcardoso.net/load-awesome/) | |
| 3 | + * Copyright 2015 Daniel Cardoso <@DanielCardoso> | |
| 4 | + * Licensed under MIT | |
| 5 | + */ | |
| 6 | +.la-ball-fall, | |
| 7 | +.la-ball-fall > div { | |
| 8 | +position: relative; | |
| 9 | +-webkit-box-sizing: border-box; | |
| 10 | + -moz-box-sizing: border-box; | |
| 11 | + box-sizing: border-box; | |
| 12 | +} | |
| 13 | +.la-ball-fall { | |
| 14 | + display: block; | |
| 15 | + font-size: 0; | |
| 16 | + color: #fff; | |
| 17 | +} | |
| 18 | +.la-ball-fall.la-dark { | |
| 19 | + color: #333; | |
| 20 | +} | |
| 21 | +.la-ball-fall > div { | |
| 22 | + display: inline-block; | |
| 23 | + float: none; | |
| 24 | + background-color: currentColor; | |
| 25 | + border: 0 solid currentColor; | |
| 26 | +} | |
| 27 | +.la-ball-fall { | |
| 28 | + width: 54px; | |
| 29 | + height: 18px; | |
| 30 | +} | |
| 31 | +.la-ball-fall > div { | |
| 32 | + width: 10px; | |
| 33 | + height: 10px; | |
| 34 | + margin: 4px; | |
| 35 | + border-radius: 100%; | |
| 36 | + opacity: 0; | |
| 37 | + -webkit-animation: ball-fall 1s ease-in-out infinite; | |
| 38 | + -moz-animation: ball-fall 1s ease-in-out infinite; | |
| 39 | + -o-animation: ball-fall 1s ease-in-out infinite; | |
| 40 | + animation: ball-fall 1s ease-in-out infinite; | |
| 41 | +} | |
| 42 | +.la-ball-fall > div:nth-child(1) { | |
| 43 | + -webkit-animation-delay: -200ms; | |
| 44 | + -moz-animation-delay: -200ms; | |
| 45 | + -o-animation-delay: -200ms; | |
| 46 | + animation-delay: -200ms; | |
| 47 | +} | |
| 48 | +.la-ball-fall > div:nth-child(2) { | |
| 49 | + -webkit-animation-delay: -100ms; | |
| 50 | + -moz-animation-delay: -100ms; | |
| 51 | + -o-animation-delay: -100ms; | |
| 52 | + animation-delay: -100ms; | |
| 53 | +} | |
| 54 | +.la-ball-fall > div:nth-child(3) { | |
| 55 | + -webkit-animation-delay: 0ms; | |
| 56 | + -moz-animation-delay: 0ms; | |
| 57 | + -o-animation-delay: 0ms; | |
| 58 | + animation-delay: 0ms; | |
| 59 | +} | |
| 60 | +.la-ball-fall.la-sm { | |
| 61 | + width: 26px; | |
| 62 | + height: 8px; | |
| 63 | +} | |
| 64 | +.la-ball-fall.la-sm > div { | |
| 65 | + width: 4px; | |
| 66 | + height: 4px; | |
| 67 | + margin: 2px; | |
| 68 | +} | |
| 69 | +.la-ball-fall.la-2x { | |
| 70 | + width: 108px; | |
| 71 | + height: 36px; | |
| 72 | +} | |
| 73 | +.la-ball-fall.la-2x > div { | |
| 74 | + width: 20px; | |
| 75 | + height: 20px; | |
| 76 | + margin: 8px; | |
| 77 | +} | |
| 78 | +.la-ball-fall.la-3x { | |
| 79 | + width: 162px; | |
| 80 | + height: 54px; | |
| 81 | +} | |
| 82 | +.la-ball-fall.la-3x > div { | |
| 83 | + width: 30px; | |
| 84 | + height: 30px; | |
| 85 | + margin: 12px; | |
| 86 | +} | |
| 87 | +/* | |
| 88 | + * Animation | |
| 89 | + */ | |
| 90 | +@-webkit-keyframes ball-fall { | |
| 91 | + 0% { | |
| 92 | + opacity: 0; | |
| 93 | + -webkit-transform: translateY(-145%); | |
| 94 | + transform: translateY(-145%); | |
| 95 | + } | |
| 96 | + 10% { | |
| 97 | + opacity: .5; | |
| 98 | + } | |
| 99 | + 20% { | |
| 100 | + opacity: 1; | |
| 101 | + -webkit-transform: translateY(0); | |
| 102 | + transform: translateY(0); | |
| 103 | + } | |
| 104 | + 80% { | |
| 105 | + opacity: 1; | |
| 106 | + -webkit-transform: translateY(0); | |
| 107 | + transform: translateY(0); | |
| 108 | + } | |
| 109 | + 90% { | |
| 110 | + opacity: .5; | |
| 111 | + } | |
| 112 | + 100% { | |
| 113 | + opacity: 0; | |
| 114 | + -webkit-transform: translateY(145%); | |
| 115 | + transform: translateY(145%); | |
| 116 | + } | |
| 117 | +} | |
| 118 | +@-moz-keyframes ball-fall { | |
| 119 | + 0% { | |
| 120 | + opacity: 0; | |
| 121 | + -moz-transform: translateY(-145%); | |
| 122 | + transform: translateY(-145%); | |
| 123 | + } | |
| 124 | + 10% { | |
| 125 | + opacity: .5; | |
| 126 | + } | |
| 127 | + 20% { | |
| 128 | + opacity: 1; | |
| 129 | + -moz-transform: translateY(0); | |
| 130 | + transform: translateY(0); | |
| 131 | + } | |
| 132 | + 80% { | |
| 133 | + opacity: 1; | |
| 134 | + -moz-transform: translateY(0); | |
| 135 | + transform: translateY(0); | |
| 136 | + } | |
| 137 | + 90% { | |
| 138 | + opacity: .5; | |
| 139 | + } | |
| 140 | + 100% { | |
| 141 | + opacity: 0; | |
| 142 | + -moz-transform: translateY(145%); | |
| 143 | + transform: translateY(145%); | |
| 144 | + } | |
| 145 | +} | |
| 146 | +@-o-keyframes ball-fall { | |
| 147 | + 0% { | |
| 148 | + opacity: 0; | |
| 149 | + -o-transform: translateY(-145%); | |
| 150 | + transform: translateY(-145%); | |
| 151 | + } | |
| 152 | + 10% { | |
| 153 | + opacity: .5; | |
| 154 | + } | |
| 155 | + 20% { | |
| 156 | + opacity: 1; | |
| 157 | + -o-transform: translateY(0); | |
| 158 | + transform: translateY(0); | |
| 159 | + } | |
| 160 | + 80% { | |
| 161 | + opacity: 1; | |
| 162 | + -o-transform: translateY(0); | |
| 163 | + transform: translateY(0); | |
| 164 | + } | |
| 165 | + 90% { | |
| 166 | + opacity: .5; | |
| 167 | + } | |
| 168 | + 100% { | |
| 169 | + opacity: 0; | |
| 170 | + -o-transform: translateY(145%); | |
| 171 | + transform: translateY(145%); | |
| 172 | + } | |
| 173 | +} | |
| 174 | +@keyframes ball-fall { | |
| 175 | + 0% { | |
| 176 | + opacity: 0; | |
| 177 | + -webkit-transform: translateY(-145%); | |
| 178 | + -moz-transform: translateY(-145%); | |
| 179 | + -o-transform: translateY(-145%); | |
| 180 | + transform: translateY(-145%); | |
| 181 | + } | |
| 182 | + 10% { | |
| 183 | + opacity: .5; | |
| 184 | + } | |
| 185 | + 20% { | |
| 186 | + opacity: 1; | |
| 187 | + -webkit-transform: translateY(0); | |
| 188 | + -moz-transform: translateY(0); | |
| 189 | + -o-transform: translateY(0); | |
| 190 | + transform: translateY(0); | |
| 191 | + } | |
| 192 | + 80% { | |
| 193 | + opacity: 1; | |
| 194 | + -webkit-transform: translateY(0); | |
| 195 | + -moz-transform: translateY(0); | |
| 196 | + -o-transform: translateY(0); | |
| 197 | + transform: translateY(0); | |
| 198 | + } | |
| 199 | + 90% { | |
| 200 | + opacity: .5; | |
| 201 | + } | |
| 202 | + 100% { | |
| 203 | + opacity: 0; | |
| 204 | + -webkit-transform: translateY(145%); | |
| 205 | + -moz-transform: translateY(145%); | |
| 206 | + -o-transform: translateY(145%); | |
| 207 | + transform: translateY(145%); | |
| 208 | + } | |
| 209 | +} | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/modules/default-params.js
0 → 100644
| 1 | +var defaultParams = { | |
| 2 | + title: '', | |
| 3 | + text: '', | |
| 4 | + type: null, | |
| 5 | + allowOutsideClick: false, | |
| 6 | + showConfirmButton: true, | |
| 7 | + showCancelButton: false, | |
| 8 | + closeOnConfirm: true, | |
| 9 | + closeOnCancel: true, | |
| 10 | + confirmButtonText: 'OK', | |
| 11 | + confirmButtonColor: '#8CD4F5', | |
| 12 | + cancelButtonText: 'Cancel', | |
| 13 | + imageUrl: null, | |
| 14 | + imageSize: null, | |
| 15 | + timer: null, | |
| 16 | + customClass: '', | |
| 17 | + html: false, | |
| 18 | + animation: true, | |
| 19 | + allowEscapeKey: true, | |
| 20 | + inputType: 'text', | |
| 21 | + inputPlaceholder: '', | |
| 22 | + inputValue: '', | |
| 23 | + showLoaderOnConfirm: false | |
| 24 | +}; | |
| 25 | + | |
| 26 | +export default defaultParams; | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/modules/handle-click.js
0 → 100644
| 1 | +import { colorLuminance } from './utils'; | |
| 2 | +import { getModal } from './handle-swal-dom'; | |
| 3 | +import { hasClass, isDescendant } from './handle-dom'; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* | |
| 7 | + * User clicked on "Confirm"/"OK" or "Cancel" | |
| 8 | + */ | |
| 9 | +var handleButton = function(event, params, modal) { | |
| 10 | + var e = event || window.event; | |
| 11 | + var target = e.target || e.srcElement; | |
| 12 | + | |
| 13 | + var targetedConfirm = target.className.indexOf('confirm') !== -1; | |
| 14 | + var targetedOverlay = target.className.indexOf('sweet-overlay') !== -1; | |
| 15 | + var modalIsVisible = hasClass(modal, 'visible'); | |
| 16 | + var doneFunctionExists = (params.doneFunction && modal.getAttribute('data-has-done-function') === 'true'); | |
| 17 | + | |
| 18 | + // Since the user can change the background-color of the confirm button programmatically, | |
| 19 | + // we must calculate what the color should be on hover/active | |
| 20 | + var normalColor, hoverColor, activeColor; | |
| 21 | + if (targetedConfirm && params.confirmButtonColor) { | |
| 22 | + normalColor = params.confirmButtonColor; | |
| 23 | + hoverColor = colorLuminance(normalColor, -0.04); | |
| 24 | + activeColor = colorLuminance(normalColor, -0.14); | |
| 25 | + } | |
| 26 | + | |
| 27 | + function shouldSetConfirmButtonColor(color) { | |
| 28 | + if (targetedConfirm && params.confirmButtonColor) { | |
| 29 | + target.style.backgroundColor = color; | |
| 30 | + } | |
| 31 | + } | |
| 32 | + | |
| 33 | + switch (e.type) { | |
| 34 | + case 'mouseover': | |
| 35 | + shouldSetConfirmButtonColor(hoverColor); | |
| 36 | + break; | |
| 37 | + | |
| 38 | + case 'mouseout': | |
| 39 | + shouldSetConfirmButtonColor(normalColor); | |
| 40 | + break; | |
| 41 | + | |
| 42 | + case 'mousedown': | |
| 43 | + shouldSetConfirmButtonColor(activeColor); | |
| 44 | + break; | |
| 45 | + | |
| 46 | + case 'mouseup': | |
| 47 | + shouldSetConfirmButtonColor(hoverColor); | |
| 48 | + break; | |
| 49 | + | |
| 50 | + case 'focus': | |
| 51 | + let $confirmButton = modal.querySelector('button.confirm'); | |
| 52 | + let $cancelButton = modal.querySelector('button.cancel'); | |
| 53 | + | |
| 54 | + if (targetedConfirm) { | |
| 55 | + $cancelButton.style.boxShadow = 'none'; | |
| 56 | + } else { | |
| 57 | + $confirmButton.style.boxShadow = 'none'; | |
| 58 | + } | |
| 59 | + break; | |
| 60 | + | |
| 61 | + case 'click': | |
| 62 | + let clickedOnModal = (modal === target); | |
| 63 | + let clickedOnModalChild = isDescendant(modal, target); | |
| 64 | + | |
| 65 | + // Ignore click outside if allowOutsideClick is false | |
| 66 | + if (!clickedOnModal && !clickedOnModalChild && modalIsVisible && !params.allowOutsideClick) { | |
| 67 | + break; | |
| 68 | + } | |
| 69 | + | |
| 70 | + if (targetedConfirm && doneFunctionExists && modalIsVisible) { | |
| 71 | + handleConfirm(modal, params); | |
| 72 | + } else if (doneFunctionExists && modalIsVisible || targetedOverlay) { | |
| 73 | + handleCancel(modal, params); | |
| 74 | + } else if (isDescendant(modal, target) && target.tagName === 'BUTTON') { | |
| 75 | + sweetAlert.close(); | |
| 76 | + } | |
| 77 | + break; | |
| 78 | + } | |
| 79 | +}; | |
| 80 | + | |
| 81 | +/* | |
| 82 | + * User clicked on "Confirm"/"OK" | |
| 83 | + */ | |
| 84 | +var handleConfirm = function(modal, params) { | |
| 85 | + var callbackValue = true; | |
| 86 | + | |
| 87 | + if (hasClass(modal, 'show-input')) { | |
| 88 | + callbackValue = modal.querySelector('input').value; | |
| 89 | + | |
| 90 | + if (!callbackValue) { | |
| 91 | + callbackValue = ''; | |
| 92 | + } | |
| 93 | + } | |
| 94 | + | |
| 95 | + params.doneFunction(callbackValue); | |
| 96 | + | |
| 97 | + if (params.closeOnConfirm) { | |
| 98 | + sweetAlert.close(); | |
| 99 | + } | |
| 100 | + // Disable cancel and confirm button if the parameter is true | |
| 101 | + if (params.showLoaderOnConfirm) { | |
| 102 | + sweetAlert.disableButtons(); | |
| 103 | + } | |
| 104 | +}; | |
| 105 | + | |
| 106 | +/* | |
| 107 | + * User clicked on "Cancel" | |
| 108 | + */ | |
| 109 | +var handleCancel = function(modal, params) { | |
| 110 | + // Check if callback function expects a parameter (to track cancel actions) | |
| 111 | + var functionAsStr = String(params.doneFunction).replace(/\s/g, ''); | |
| 112 | + var functionHandlesCancel = functionAsStr.substring(0, 9) === 'function(' && functionAsStr.substring(9, 10) !== ')'; | |
| 113 | + | |
| 114 | + if (functionHandlesCancel) { | |
| 115 | + params.doneFunction(false); | |
| 116 | + } | |
| 117 | + | |
| 118 | + if (params.closeOnCancel) { | |
| 119 | + sweetAlert.close(); | |
| 120 | + } | |
| 121 | +}; | |
| 122 | + | |
| 123 | + | |
| 124 | +export default { | |
| 125 | + handleButton, | |
| 126 | + handleConfirm, | |
| 127 | + handleCancel | |
| 128 | +}; | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/modules/handle-dom.js
0 → 100644
| 1 | +var hasClass = function(elem, className) { | |
| 2 | + return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' '); | |
| 3 | +}; | |
| 4 | + | |
| 5 | +var addClass = function(elem, className) { | |
| 6 | + if (!hasClass(elem, className)) { | |
| 7 | + elem.className += ' ' + className; | |
| 8 | + } | |
| 9 | +}; | |
| 10 | + | |
| 11 | +var removeClass = function(elem, className) { | |
| 12 | + var newClass = ' ' + elem.className.replace(/[\t\r\n]/g, ' ') + ' '; | |
| 13 | + if (hasClass(elem, className)) { | |
| 14 | + while (newClass.indexOf(' ' + className + ' ') >= 0) { | |
| 15 | + newClass = newClass.replace(' ' + className + ' ', ' '); | |
| 16 | + } | |
| 17 | + elem.className = newClass.replace(/^\s+|\s+$/g, ''); | |
| 18 | + } | |
| 19 | +}; | |
| 20 | + | |
| 21 | +var escapeHtml = function(str) { | |
| 22 | + var div = document.createElement('div'); | |
| 23 | + div.appendChild(document.createTextNode(str)); | |
| 24 | + return div.innerHTML; | |
| 25 | +}; | |
| 26 | + | |
| 27 | +var _show = function(elem) { | |
| 28 | + elem.style.opacity = ''; | |
| 29 | + elem.style.display = 'block'; | |
| 30 | +}; | |
| 31 | + | |
| 32 | +var show = function(elems) { | |
| 33 | + if (elems && !elems.length) { | |
| 34 | + return _show(elems); | |
| 35 | + } | |
| 36 | + for (var i = 0; i < elems.length; ++i) { | |
| 37 | + _show(elems[i]); | |
| 38 | + } | |
| 39 | +}; | |
| 40 | + | |
| 41 | +var _hide = function(elem) { | |
| 42 | + elem.style.opacity = ''; | |
| 43 | + elem.style.display = 'none'; | |
| 44 | +}; | |
| 45 | + | |
| 46 | +var hide = function(elems) { | |
| 47 | + if (elems && !elems.length) { | |
| 48 | + return _hide(elems); | |
| 49 | + } | |
| 50 | + for (var i = 0; i < elems.length; ++i) { | |
| 51 | + _hide(elems[i]); | |
| 52 | + } | |
| 53 | +}; | |
| 54 | + | |
| 55 | +var isDescendant = function(parent, child) { | |
| 56 | + var node = child.parentNode; | |
| 57 | + while (node !== null) { | |
| 58 | + if (node === parent) { | |
| 59 | + return true; | |
| 60 | + } | |
| 61 | + node = node.parentNode; | |
| 62 | + } | |
| 63 | + return false; | |
| 64 | +}; | |
| 65 | + | |
| 66 | +var getTopMargin = function(elem) { | |
| 67 | + elem.style.left = '-9999px'; | |
| 68 | + elem.style.display = 'block'; | |
| 69 | + | |
| 70 | + var height = elem.clientHeight, | |
| 71 | + padding; | |
| 72 | + if (typeof getComputedStyle !== "undefined") { // IE 8 | |
| 73 | + padding = parseInt(getComputedStyle(elem).getPropertyValue('padding-top'), 10); | |
| 74 | + } else { | |
| 75 | + padding = parseInt(elem.currentStyle.padding); | |
| 76 | + } | |
| 77 | + | |
| 78 | + elem.style.left = ''; | |
| 79 | + elem.style.display = 'none'; | |
| 80 | + return ('-' + parseInt((height + padding) / 2) + 'px'); | |
| 81 | +}; | |
| 82 | + | |
| 83 | +var fadeIn = function(elem, interval) { | |
| 84 | + if (+elem.style.opacity < 1) { | |
| 85 | + interval = interval || 16; | |
| 86 | + elem.style.opacity = 0; | |
| 87 | + elem.style.display = 'block'; | |
| 88 | + var last = +new Date(); | |
| 89 | + var tick = function() { | |
| 90 | + elem.style.opacity = +elem.style.opacity + (new Date() - last) / 100; | |
| 91 | + last = +new Date(); | |
| 92 | + | |
| 93 | + if (+elem.style.opacity < 1) { | |
| 94 | + setTimeout(tick, interval); | |
| 95 | + } | |
| 96 | + }; | |
| 97 | + tick(); | |
| 98 | + } | |
| 99 | + elem.style.display = 'block'; //fallback IE8 | |
| 100 | +}; | |
| 101 | + | |
| 102 | +var fadeOut = function(elem, interval) { | |
| 103 | + interval = interval || 16; | |
| 104 | + elem.style.opacity = 1; | |
| 105 | + var last = +new Date(); | |
| 106 | + var tick = function() { | |
| 107 | + elem.style.opacity = +elem.style.opacity - (new Date() - last) / 100; | |
| 108 | + last = +new Date(); | |
| 109 | + | |
| 110 | + if (+elem.style.opacity > 0) { | |
| 111 | + setTimeout(tick, interval); | |
| 112 | + } else { | |
| 113 | + elem.style.display = 'none'; | |
| 114 | + } | |
| 115 | + }; | |
| 116 | + tick(); | |
| 117 | +}; | |
| 118 | + | |
| 119 | +var fireClick = function(node) { | |
| 120 | + // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/ | |
| 121 | + // Then fixed for today's Chrome browser. | |
| 122 | + if (typeof MouseEvent === 'function') { | |
| 123 | + // Up-to-date approach | |
| 124 | + var mevt = new MouseEvent('click', { | |
| 125 | + view: window, | |
| 126 | + bubbles: false, | |
| 127 | + cancelable: true | |
| 128 | + }); | |
| 129 | + node.dispatchEvent(mevt); | |
| 130 | + } else if ( document.createEvent ) { | |
| 131 | + // Fallback | |
| 132 | + var evt = document.createEvent('MouseEvents'); | |
| 133 | + evt.initEvent('click', false, false); | |
| 134 | + node.dispatchEvent(evt); | |
| 135 | + } else if (document.createEventObject) { | |
| 136 | + node.fireEvent('onclick') ; | |
| 137 | + } else if (typeof node.onclick === 'function' ) { | |
| 138 | + node.onclick(); | |
| 139 | + } | |
| 140 | +}; | |
| 141 | + | |
| 142 | +var stopEventPropagation = function(e) { | |
| 143 | + // In particular, make sure the space bar doesn't scroll the main window. | |
| 144 | + if (typeof e.stopPropagation === 'function') { | |
| 145 | + e.stopPropagation(); | |
| 146 | + e.preventDefault(); | |
| 147 | + } else if (window.event && window.event.hasOwnProperty('cancelBubble')) { | |
| 148 | + window.event.cancelBubble = true; | |
| 149 | + } | |
| 150 | +}; | |
| 151 | + | |
| 152 | +export { | |
| 153 | + hasClass, addClass, removeClass, | |
| 154 | + escapeHtml, | |
| 155 | + _show, show, _hide, hide, | |
| 156 | + isDescendant, | |
| 157 | + getTopMargin, | |
| 158 | + fadeIn, fadeOut, | |
| 159 | + fireClick, | |
| 160 | + stopEventPropagation | |
| 161 | +}; | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/modules/handle-key.js
0 → 100644
| 1 | +import { stopEventPropagation, fireClick } from './handle-dom'; | |
| 2 | +import { setFocusStyle } from './handle-swal-dom'; | |
| 3 | + | |
| 4 | + | |
| 5 | +var handleKeyDown = function(event, params, modal) { | |
| 6 | + var e = event || window.event; | |
| 7 | + var keyCode = e.keyCode || e.which; | |
| 8 | + | |
| 9 | + var $okButton = modal.querySelector('button.confirm'); | |
| 10 | + var $cancelButton = modal.querySelector('button.cancel'); | |
| 11 | + var $modalButtons = modal.querySelectorAll('button[tabindex]'); | |
| 12 | + | |
| 13 | + | |
| 14 | + if ([9, 13, 32, 27].indexOf(keyCode) === -1) { | |
| 15 | + // Don't do work on keys we don't care about. | |
| 16 | + return; | |
| 17 | + } | |
| 18 | + | |
| 19 | + var $targetElement = e.target || e.srcElement; | |
| 20 | + | |
| 21 | + var btnIndex = -1; // Find the button - note, this is a nodelist, not an array. | |
| 22 | + for (var i = 0; i < $modalButtons.length; i++) { | |
| 23 | + if ($targetElement === $modalButtons[i]) { | |
| 24 | + btnIndex = i; | |
| 25 | + break; | |
| 26 | + } | |
| 27 | + } | |
| 28 | + | |
| 29 | + if (keyCode === 9) { | |
| 30 | + // TAB | |
| 31 | + if (btnIndex === -1) { | |
| 32 | + // No button focused. Jump to the confirm button. | |
| 33 | + $targetElement = $okButton; | |
| 34 | + } else { | |
| 35 | + // Cycle to the next button | |
| 36 | + if (btnIndex === $modalButtons.length - 1) { | |
| 37 | + $targetElement = $modalButtons[0]; | |
| 38 | + } else { | |
| 39 | + $targetElement = $modalButtons[btnIndex + 1]; | |
| 40 | + } | |
| 41 | + } | |
| 42 | + | |
| 43 | + stopEventPropagation(e); | |
| 44 | + $targetElement.focus(); | |
| 45 | + | |
| 46 | + if (params.confirmButtonColor) { | |
| 47 | + setFocusStyle($targetElement, params.confirmButtonColor); | |
| 48 | + } | |
| 49 | + } else { | |
| 50 | + if (keyCode === 13) { | |
| 51 | + if ($targetElement.tagName === 'INPUT') { | |
| 52 | + $targetElement = $okButton; | |
| 53 | + $okButton.focus(); | |
| 54 | + } | |
| 55 | + | |
| 56 | + if (btnIndex === -1) { | |
| 57 | + // ENTER/SPACE clicked outside of a button. | |
| 58 | + $targetElement = $okButton; | |
| 59 | + } else { | |
| 60 | + // Do nothing - let the browser handle it. | |
| 61 | + $targetElement = undefined; | |
| 62 | + } | |
| 63 | + } else if (keyCode === 27 && params.allowEscapeKey === true) { | |
| 64 | + $targetElement = $cancelButton; | |
| 65 | + fireClick($targetElement, e); | |
| 66 | + } else { | |
| 67 | + // Fallback - let the browser handle it. | |
| 68 | + $targetElement = undefined; | |
| 69 | + } | |
| 70 | + } | |
| 71 | +}; | |
| 72 | + | |
| 73 | +export default handleKeyDown; | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/modules/handle-swal-dom.js
0 → 100644
| 1 | +import { hexToRgb } from './utils'; | |
| 2 | +import { removeClass, getTopMargin, fadeIn, show, addClass } from './handle-dom'; | |
| 3 | +import defaultParams from './default-params'; | |
| 4 | + | |
| 5 | +var modalClass = '.sweet-alert'; | |
| 6 | +var overlayClass = '.sweet-overlay'; | |
| 7 | + | |
| 8 | +/* | |
| 9 | + * Add modal + overlay to DOM | |
| 10 | + */ | |
| 11 | +import injectedHTML from './injected-html'; | |
| 12 | + | |
| 13 | +var sweetAlertInitialize = function() { | |
| 14 | + var sweetWrap = document.createElement('div'); | |
| 15 | + sweetWrap.innerHTML = injectedHTML; | |
| 16 | + | |
| 17 | + // Append elements to body | |
| 18 | + while (sweetWrap.firstChild) { | |
| 19 | + document.body.appendChild(sweetWrap.firstChild); | |
| 20 | + } | |
| 21 | +}; | |
| 22 | + | |
| 23 | +/* | |
| 24 | + * Get DOM element of modal | |
| 25 | + */ | |
| 26 | +var getModal = function() { | |
| 27 | + var $modal = document.querySelector(modalClass); | |
| 28 | + | |
| 29 | + if (!$modal) { | |
| 30 | + sweetAlertInitialize(); | |
| 31 | + $modal = getModal(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + return $modal; | |
| 35 | +}; | |
| 36 | + | |
| 37 | +/* | |
| 38 | + * Get DOM element of input (in modal) | |
| 39 | + */ | |
| 40 | +var getInput = function() { | |
| 41 | + var $modal = getModal(); | |
| 42 | + if ($modal) { | |
| 43 | + return $modal.querySelector('input'); | |
| 44 | + } | |
| 45 | +}; | |
| 46 | + | |
| 47 | +/* | |
| 48 | + * Get DOM element of overlay | |
| 49 | + */ | |
| 50 | +var getOverlay = function() { | |
| 51 | + return document.querySelector(overlayClass); | |
| 52 | +}; | |
| 53 | + | |
| 54 | +/* | |
| 55 | + * Add box-shadow style to button (depending on its chosen bg-color) | |
| 56 | + */ | |
| 57 | +var setFocusStyle = function($button, bgColor) { | |
| 58 | + var rgbColor = hexToRgb(bgColor); | |
| 59 | + $button.style.boxShadow = '0 0 2px rgba(' + rgbColor + ', 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)'; | |
| 60 | +}; | |
| 61 | + | |
| 62 | +/* | |
| 63 | + * Animation when opening modal | |
| 64 | + */ | |
| 65 | +var openModal = function(callback) { | |
| 66 | + var $modal = getModal(); | |
| 67 | + fadeIn(getOverlay(), 10); | |
| 68 | + show($modal); | |
| 69 | + addClass($modal, 'showSweetAlert'); | |
| 70 | + removeClass($modal, 'hideSweetAlert'); | |
| 71 | + | |
| 72 | + window.previousActiveElement = document.activeElement; | |
| 73 | + var $okButton = $modal.querySelector('button.confirm'); | |
| 74 | + $okButton.focus(); | |
| 75 | + | |
| 76 | + setTimeout(function () { | |
| 77 | + addClass($modal, 'visible'); | |
| 78 | + }, 500); | |
| 79 | + | |
| 80 | + var timer = $modal.getAttribute('data-timer'); | |
| 81 | + | |
| 82 | + if (timer !== 'null' && timer !== '') { | |
| 83 | + var timerCallback = callback; | |
| 84 | + $modal.timeout = setTimeout(function() { | |
| 85 | + var doneFunctionExists = ((timerCallback || null) && $modal.getAttribute('data-has-done-function') === 'true'); | |
| 86 | + if (doneFunctionExists) { | |
| 87 | + timerCallback(null); | |
| 88 | + } | |
| 89 | + else { | |
| 90 | + sweetAlert.close(); | |
| 91 | + } | |
| 92 | + }, timer); | |
| 93 | + } | |
| 94 | +}; | |
| 95 | + | |
| 96 | +/* | |
| 97 | + * Reset the styling of the input | |
| 98 | + * (for example if errors have been shown) | |
| 99 | + */ | |
| 100 | +var resetInput = function() { | |
| 101 | + var $modal = getModal(); | |
| 102 | + var $input = getInput(); | |
| 103 | + | |
| 104 | + removeClass($modal, 'show-input'); | |
| 105 | + $input.value = defaultParams.inputValue; | |
| 106 | + $input.setAttribute('type', defaultParams.inputType); | |
| 107 | + $input.setAttribute('placeholder', defaultParams.inputPlaceholder); | |
| 108 | + | |
| 109 | + resetInputError(); | |
| 110 | +}; | |
| 111 | + | |
| 112 | + | |
| 113 | +var resetInputError = function(event) { | |
| 114 | + // If press enter => ignore | |
| 115 | + if (event && event.keyCode === 13) { | |
| 116 | + return false; | |
| 117 | + } | |
| 118 | + | |
| 119 | + var $modal = getModal(); | |
| 120 | + | |
| 121 | + var $errorIcon = $modal.querySelector('.sa-input-error'); | |
| 122 | + removeClass($errorIcon, 'show'); | |
| 123 | + | |
| 124 | + var $errorContainer = $modal.querySelector('.sa-error-container'); | |
| 125 | + removeClass($errorContainer, 'show'); | |
| 126 | +}; | |
| 127 | + | |
| 128 | + | |
| 129 | +/* | |
| 130 | + * Set "margin-top"-property on modal based on its computed height | |
| 131 | + */ | |
| 132 | +var fixVerticalPosition = function() { | |
| 133 | + var $modal = getModal(); | |
| 134 | + $modal.style.marginTop = getTopMargin(getModal()); | |
| 135 | +}; | |
| 136 | + | |
| 137 | + | |
| 138 | +export { | |
| 139 | + sweetAlertInitialize, | |
| 140 | + getModal, | |
| 141 | + getOverlay, | |
| 142 | + getInput, | |
| 143 | + setFocusStyle, | |
| 144 | + openModal, | |
| 145 | + resetInput, | |
| 146 | + resetInputError, | |
| 147 | + fixVerticalPosition | |
| 148 | +}; | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/modules/injected-html.js
0 → 100644
| 1 | +var injectedHTML = | |
| 2 | + | |
| 3 | + // Dark overlay | |
| 4 | + `<div class="sweet-overlay" tabIndex="-1"></div>` + | |
| 5 | + | |
| 6 | + // Modal | |
| 7 | + `<div class="sweet-alert">` + | |
| 8 | + | |
| 9 | + // Error icon | |
| 10 | + `<div class="sa-icon sa-error"> | |
| 11 | + <span class="sa-x-mark"> | |
| 12 | + <span class="sa-line sa-left"></span> | |
| 13 | + <span class="sa-line sa-right"></span> | |
| 14 | + </span> | |
| 15 | + </div>` + | |
| 16 | + | |
| 17 | + // Warning icon | |
| 18 | + `<div class="sa-icon sa-warning"> | |
| 19 | + <span class="sa-body"></span> | |
| 20 | + <span class="sa-dot"></span> | |
| 21 | + </div>` + | |
| 22 | + | |
| 23 | + // Info icon | |
| 24 | + `<div class="sa-icon sa-info"></div>` + | |
| 25 | + | |
| 26 | + // Success icon | |
| 27 | + `<div class="sa-icon sa-success"> | |
| 28 | + <span class="sa-line sa-tip"></span> | |
| 29 | + <span class="sa-line sa-long"></span> | |
| 30 | + | |
| 31 | + <div class="sa-placeholder"></div> | |
| 32 | + <div class="sa-fix"></div> | |
| 33 | + </div>` + | |
| 34 | + | |
| 35 | + `<div class="sa-icon sa-custom"></div>` + | |
| 36 | + | |
| 37 | + // Title, text and input | |
| 38 | + `<h2>Title</h2> | |
| 39 | + <p>Text</p> | |
| 40 | + <fieldset> | |
| 41 | + <input type="text" tabIndex="3" /> | |
| 42 | + <div class="sa-input-error"></div> | |
| 43 | + </fieldset>` + | |
| 44 | + | |
| 45 | + // Input errors | |
| 46 | + `<div class="sa-error-container"> | |
| 47 | + <div class="icon">!</div> | |
| 48 | + <p>Not valid!</p> | |
| 49 | + </div>` + | |
| 50 | + | |
| 51 | + // Cancel and confirm buttons | |
| 52 | + `<div class="sa-button-container"> | |
| 53 | + <button class="cancel" tabIndex="2">Cancel</button> | |
| 54 | + <div class="sa-confirm-button-container"> | |
| 55 | + <button class="confirm" tabIndex="1">OK</button>` + | |
| 56 | + | |
| 57 | + // Loading animation | |
| 58 | + `<div class="la-ball-fall"> | |
| 59 | + <div></div> | |
| 60 | + <div></div> | |
| 61 | + <div></div> | |
| 62 | + </div> | |
| 63 | + </div> | |
| 64 | + </div>` + | |
| 65 | + | |
| 66 | + // End of modal | |
| 67 | + `</div>`; | |
| 68 | + | |
| 69 | +export default injectedHTML; | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/modules/set-params.js
0 → 100644
| 1 | +var alertTypes = ['error', 'warning', 'info', 'success', 'input', 'prompt']; | |
| 2 | + | |
| 3 | +import { | |
| 4 | + isIE8 | |
| 5 | +} from './utils'; | |
| 6 | + | |
| 7 | +import { | |
| 8 | + getModal, | |
| 9 | + getInput, | |
| 10 | + setFocusStyle | |
| 11 | +} from './handle-swal-dom'; | |
| 12 | + | |
| 13 | +import { | |
| 14 | + hasClass, addClass, removeClass, | |
| 15 | + escapeHtml, | |
| 16 | + _show, show, _hide, hide | |
| 17 | +} from './handle-dom'; | |
| 18 | + | |
| 19 | + | |
| 20 | +/* | |
| 21 | + * Set type, text and actions on modal | |
| 22 | + */ | |
| 23 | +var setParameters = function(params) { | |
| 24 | + var modal = getModal(); | |
| 25 | + | |
| 26 | + var $title = modal.querySelector('h2'); | |
| 27 | + var $text = modal.querySelector('p'); | |
| 28 | + var $cancelBtn = modal.querySelector('button.cancel'); | |
| 29 | + var $confirmBtn = modal.querySelector('button.confirm'); | |
| 30 | + | |
| 31 | + /* | |
| 32 | + * Title | |
| 33 | + */ | |
| 34 | + $title.innerHTML = params.html ? params.title : escapeHtml(params.title).split('\n').join('<br>'); | |
| 35 | + | |
| 36 | + /* | |
| 37 | + * Text | |
| 38 | + */ | |
| 39 | + $text.innerHTML = params.html ? params.text : escapeHtml(params.text || '').split('\n').join('<br>'); | |
| 40 | + if (params.text) show($text); | |
| 41 | + | |
| 42 | + /* | |
| 43 | + * Custom class | |
| 44 | + */ | |
| 45 | + if (params.customClass) { | |
| 46 | + addClass(modal, params.customClass); | |
| 47 | + modal.setAttribute('data-custom-class', params.customClass); | |
| 48 | + } else { | |
| 49 | + // Find previously set classes and remove them | |
| 50 | + let customClass = modal.getAttribute('data-custom-class'); | |
| 51 | + removeClass(modal, customClass); | |
| 52 | + modal.setAttribute('data-custom-class', ''); | |
| 53 | + } | |
| 54 | + | |
| 55 | + /* | |
| 56 | + * Icon | |
| 57 | + */ | |
| 58 | + hide(modal.querySelectorAll('.sa-icon')); | |
| 59 | + | |
| 60 | + if (params.type && !isIE8()) { | |
| 61 | + | |
| 62 | + let validType = false; | |
| 63 | + | |
| 64 | + for (let i = 0; i < alertTypes.length; i++) { | |
| 65 | + if (params.type === alertTypes[i]) { | |
| 66 | + validType = true; | |
| 67 | + break; | |
| 68 | + } | |
| 69 | + } | |
| 70 | + | |
| 71 | + if (!validType) { | |
| 72 | + logStr('Unknown alert type: ' + params.type); | |
| 73 | + return false; | |
| 74 | + } | |
| 75 | + | |
| 76 | + let typesWithIcons = ['success', 'error', 'warning', 'info']; | |
| 77 | + let $icon; | |
| 78 | + | |
| 79 | + if (typesWithIcons.indexOf(params.type) !== -1) { | |
| 80 | + $icon = modal.querySelector('.sa-icon.' + 'sa-' + params.type); | |
| 81 | + show($icon); | |
| 82 | + } | |
| 83 | + | |
| 84 | + let $input = getInput(); | |
| 85 | + | |
| 86 | + // Animate icon | |
| 87 | + switch (params.type) { | |
| 88 | + | |
| 89 | + case 'success': | |
| 90 | + addClass($icon, 'animate'); | |
| 91 | + addClass($icon.querySelector('.sa-tip'), 'animateSuccessTip'); | |
| 92 | + addClass($icon.querySelector('.sa-long'), 'animateSuccessLong'); | |
| 93 | + break; | |
| 94 | + | |
| 95 | + case 'error': | |
| 96 | + addClass($icon, 'animateErrorIcon'); | |
| 97 | + addClass($icon.querySelector('.sa-x-mark'), 'animateXMark'); | |
| 98 | + break; | |
| 99 | + | |
| 100 | + case 'warning': | |
| 101 | + addClass($icon, 'pulseWarning'); | |
| 102 | + addClass($icon.querySelector('.sa-body'), 'pulseWarningIns'); | |
| 103 | + addClass($icon.querySelector('.sa-dot'), 'pulseWarningIns'); | |
| 104 | + break; | |
| 105 | + | |
| 106 | + case 'input': | |
| 107 | + case 'prompt': | |
| 108 | + $input.setAttribute('type', params.inputType); | |
| 109 | + $input.value = params.inputValue; | |
| 110 | + $input.setAttribute('placeholder', params.inputPlaceholder); | |
| 111 | + addClass(modal, 'show-input'); | |
| 112 | + setTimeout(function () { | |
| 113 | + $input.focus(); | |
| 114 | + $input.addEventListener('keyup', swal.resetInputError); | |
| 115 | + }, 400); | |
| 116 | + break; | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 120 | + /* | |
| 121 | + * Custom image | |
| 122 | + */ | |
| 123 | + if (params.imageUrl) { | |
| 124 | + let $customIcon = modal.querySelector('.sa-icon.sa-custom'); | |
| 125 | + | |
| 126 | + $customIcon.style.backgroundImage = 'url(' + params.imageUrl + ')'; | |
| 127 | + show($customIcon); | |
| 128 | + | |
| 129 | + let _imgWidth = 80; | |
| 130 | + let _imgHeight = 80; | |
| 131 | + | |
| 132 | + if (params.imageSize) { | |
| 133 | + let dimensions = params.imageSize.toString().split('x'); | |
| 134 | + let imgWidth = dimensions[0]; | |
| 135 | + let imgHeight = dimensions[1]; | |
| 136 | + | |
| 137 | + if (!imgWidth || !imgHeight) { | |
| 138 | + logStr('Parameter imageSize expects value with format WIDTHxHEIGHT, got ' + params.imageSize); | |
| 139 | + } else { | |
| 140 | + _imgWidth = imgWidth; | |
| 141 | + _imgHeight = imgHeight; | |
| 142 | + } | |
| 143 | + } | |
| 144 | + | |
| 145 | + $customIcon.setAttribute('style', $customIcon.getAttribute('style') + 'width:' + _imgWidth + 'px; height:' + _imgHeight + 'px'); | |
| 146 | + } | |
| 147 | + | |
| 148 | + /* | |
| 149 | + * Show cancel button? | |
| 150 | + */ | |
| 151 | + modal.setAttribute('data-has-cancel-button', params.showCancelButton); | |
| 152 | + if (params.showCancelButton) { | |
| 153 | + $cancelBtn.style.display = 'inline-block'; | |
| 154 | + } else { | |
| 155 | + hide($cancelBtn); | |
| 156 | + } | |
| 157 | + | |
| 158 | + /* | |
| 159 | + * Show confirm button? | |
| 160 | + */ | |
| 161 | + modal.setAttribute('data-has-confirm-button', params.showConfirmButton); | |
| 162 | + if (params.showConfirmButton) { | |
| 163 | + $confirmBtn.style.display = 'inline-block'; | |
| 164 | + } else { | |
| 165 | + hide($confirmBtn); | |
| 166 | + } | |
| 167 | + | |
| 168 | + /* | |
| 169 | + * Custom text on cancel/confirm buttons | |
| 170 | + */ | |
| 171 | + if (params.cancelButtonText) { | |
| 172 | + $cancelBtn.innerHTML = escapeHtml(params.cancelButtonText); | |
| 173 | + } | |
| 174 | + if (params.confirmButtonText) { | |
| 175 | + $confirmBtn.innerHTML = escapeHtml(params.confirmButtonText); | |
| 176 | + } | |
| 177 | + | |
| 178 | + /* | |
| 179 | + * Custom color on confirm button | |
| 180 | + */ | |
| 181 | + if (params.confirmButtonColor) { | |
| 182 | + // Set confirm button to selected background color | |
| 183 | + $confirmBtn.style.backgroundColor = params.confirmButtonColor; | |
| 184 | + | |
| 185 | + // Set the confirm button color to the loading ring | |
| 186 | + $confirmBtn.style.borderLeftColor = params.confirmLoadingButtonColor; | |
| 187 | + $confirmBtn.style.borderRightColor = params.confirmLoadingButtonColor; | |
| 188 | + | |
| 189 | + // Set box-shadow to default focused button | |
| 190 | + setFocusStyle($confirmBtn, params.confirmButtonColor); | |
| 191 | + } | |
| 192 | + | |
| 193 | + /* | |
| 194 | + * Allow outside click | |
| 195 | + */ | |
| 196 | + modal.setAttribute('data-allow-outside-click', params.allowOutsideClick); | |
| 197 | + | |
| 198 | + /* | |
| 199 | + * Callback function | |
| 200 | + */ | |
| 201 | + var hasDoneFunction = params.doneFunction ? true : false; | |
| 202 | + modal.setAttribute('data-has-done-function', hasDoneFunction); | |
| 203 | + | |
| 204 | + /* | |
| 205 | + * Animation | |
| 206 | + */ | |
| 207 | + if (!params.animation) { | |
| 208 | + modal.setAttribute('data-animation', 'none'); | |
| 209 | + } else if (typeof params.animation === 'string') { | |
| 210 | + modal.setAttribute('data-animation', params.animation); // Custom animation | |
| 211 | + } else { | |
| 212 | + modal.setAttribute('data-animation', 'pop'); | |
| 213 | + } | |
| 214 | + | |
| 215 | + /* | |
| 216 | + * Timer | |
| 217 | + */ | |
| 218 | + modal.setAttribute('data-timer', params.timer); | |
| 219 | +}; | |
| 220 | + | |
| 221 | +export default setParameters; | ... | ... |
src/main/resources/static/assets/bower_components/sweetalert/dev/modules/utils.js
0 → 100644
| 1 | +/* | |
| 2 | + * Allow user to pass their own params | |
| 3 | + */ | |
| 4 | +var extend = function(a, b) { | |
| 5 | + for (var key in b) { | |
| 6 | + if (b.hasOwnProperty(key)) { | |
| 7 | + a[key] = b[key]; | |
| 8 | + } | |
| 9 | + } | |
| 10 | + return a; | |
| 11 | +}; | |
| 12 | + | |
| 13 | +/* | |
| 14 | + * Convert HEX codes to RGB values (#000000 -> rgb(0,0,0)) | |
| 15 | + */ | |
| 16 | +var hexToRgb = function(hex) { | |
| 17 | + var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); | |
| 18 | + return result ? parseInt(result[1], 16) + ', ' + parseInt(result[2], 16) + ', ' + parseInt(result[3], 16) : null; | |
| 19 | +}; | |
| 20 | + | |
| 21 | +/* | |
| 22 | + * Check if the user is using Internet Explorer 8 (for fallbacks) | |
| 23 | + */ | |
| 24 | +var isIE8 = function() { | |
| 25 | + return (window.attachEvent && !window.addEventListener); | |
| 26 | +}; | |
| 27 | + | |
| 28 | +/* | |
| 29 | + * IE compatible logging for developers | |
| 30 | + */ | |
| 31 | +var logStr = function(string) { | |
| 32 | + if (window.console) { | |
| 33 | + // IE... | |
| 34 | + window.console.log('SweetAlert: ' + string); | |
| 35 | + } | |
| 36 | +}; | |
| 37 | + | |
| 38 | +/* | |
| 39 | + * Set hover, active and focus-states for buttons | |
| 40 | + * (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color) | |
| 41 | + */ | |
| 42 | +var colorLuminance = function(hex, lum) { | |
| 43 | + // Validate hex string | |
| 44 | + hex = String(hex).replace(/[^0-9a-f]/gi, ''); | |
| 45 | + if (hex.length < 6) { | |
| 46 | + hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; | |
| 47 | + } | |
| 48 | + lum = lum || 0; | |
| 49 | + | |
| 50 | + // Convert to decimal and change luminosity | |
| 51 | + var rgb = '#'; | |
| 52 | + var c; | |
| 53 | + var i; | |
| 54 | + | |
| 55 | + for (i = 0; i < 3; i++) { | |
| 56 | + c = parseInt(hex.substr(i * 2, 2), 16); | |
| 57 | + c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16); | |
| 58 | + rgb += ('00' + c).substr(c.length); | |
| 59 | + } | |
| 60 | + | |
| 61 | + return rgb; | |
| 62 | +}; | |
| 63 | + | |
| 64 | + | |
| 65 | +export { | |
| 66 | + extend, | |
| 67 | + hexToRgb, | |
| 68 | + isIE8, | |
| 69 | + logStr, | |
| 70 | + colorLuminance | |
| 71 | +}; | ... | ... |