Commit 5b999d2fc1922b68ad49f424145db8acf2fc0323

Authored by 廖磊
1 parent 4207811b

first commit

Showing 50 changed files with 3028 additions and 1 deletions
.gitignore 0 → 100644
  1 +.classpath
  2 +.project
  3 +.springBeans
  4 +.settings/*
  5 +/target/*
  6 +node_modules/
  7 +test_junitReport/
  8 +test_coverage/
  9 +.idea
  10 +.DS_Store
  11 +*.iml
  12 +tmp
  13 +
  14 +# git忽略空文件夹,按照惯例,空文件夹下放置.gitkeep文件避免文件夹被忽略不上传。
  15 +!.gitkeep
  16 +/target/
README.md
1 -calwaybill  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +<<<<<<< HEAD
  3 +calwaybill
  4 +=======
  5 +
  6 +数据汇总计算!!!
  7 +1、工时汇总
  8 +>>>>>>> first commit
bin/com/bsth/Application.class 0 → 100644
No preview for this file type
bin/com/bsth/StartCommand.class 0 → 100644
No preview for this file type
bin/com/bsth/common/ResponseCode.class 0 → 100644
No preview for this file type
bin/com/bsth/entity/ChildTaskPlan.class 0 → 100644
No preview for this file type
bin/com/bsth/entity/LineConfig.class 0 → 100644
No preview for this file type
bin/com/bsth/entity/ScheduleRealInfo.class 0 → 100644
No preview for this file type
bin/com/bsth/entity/result/CalcWaybill.class 0 → 100644
No preview for this file type
bin/com/bsth/entity/result/WorkingHours_jsy.class 0 → 100644
No preview for this file type
bin/com/bsth/handler/UserCarCountHandler$1.class 0 → 100644
No preview for this file type
bin/com/bsth/handler/UserCarCountHandler$2.class 0 → 100644
No preview for this file type
bin/com/bsth/handler/UserCarCountHandler.class 0 → 100644
No preview for this file type
bin/com/bsth/repository/ScheduleRealInfoRepository.class 0 → 100644
No preview for this file type
bin/com/bsth/service/LineConfigService.class 0 → 100644
No preview for this file type
bin/com/bsth/service/ScheduleRealInfoService.class 0 → 100644
No preview for this file type
bin/com/bsth/service/impl/LineConfigServiceImpl.class 0 → 100644
No preview for this file type
bin/com/bsth/service/impl/ScheduleRealInfoServiceImpl$1.class 0 → 100644
No preview for this file type
bin/com/bsth/service/impl/ScheduleRealInfoServiceImpl.class 0 → 100644
No preview for this file type
bin/com/bsth/thread/WaybillCalcThrad.class 0 → 100644
No preview for this file type
bin/com/bsth/util/Arith.class 0 → 100644
No preview for this file type
bin/com/bsth/util/ConfigUtil.class 0 → 100644
No preview for this file type
bin/com/bsth/util/ConvertUtil.class 0 → 100644
No preview for this file type
bin/com/bsth/util/Tools.class 0 → 100644
No preview for this file type
pom.xml 0 → 100644
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3 +
  4 + <modelVersion>4.0.0</modelVersion>
  5 + <groupId>com.bsth</groupId>
  6 + <artifactId>control_calculator</artifactId>
  7 + <version>0.0.1-SNAPSHOT</version>
  8 + <packaging>jar</packaging>
  9 +
  10 + <parent>
  11 + <groupId>org.springframework.boot</groupId>
  12 + <artifactId>spring-boot-starter-parent</artifactId>
  13 + <version>1.5.2.RELEASE</version>
  14 + </parent>
  15 +
  16 + <dependencies>
  17 +
  18 + <dependency>
  19 + <groupId>org.springframework.boot</groupId>
  20 + <artifactId>spring-boot-starter-web</artifactId>
  21 + </dependency>
  22 +
  23 + <dependency>
  24 + <groupId>org.springframework.boot</groupId>
  25 + <artifactId>spring-boot-starter-tomcat</artifactId>
  26 + <scope>provided</scope>
  27 + </dependency>
  28 +
  29 + <dependency>
  30 + <groupId>org.springframework.boot</groupId>
  31 + <artifactId>spring-boot-starter-data-jpa</artifactId>
  32 + </dependency>
  33 + <dependency>
  34 + <groupId>org.springframework.boot</groupId>
  35 + <artifactId>spring-boot-starter-aop</artifactId>
  36 + </dependency>
  37 +
  38 + <dependency>
  39 + <groupId>org.springframework.boot</groupId>
  40 + <artifactId>spring-boot-starter-data-redis</artifactId>
  41 + </dependency>
  42 +
  43 + <dependency>
  44 + <groupId>org.springframework</groupId>
  45 + <artifactId>spring-context-support</artifactId>
  46 + </dependency>
  47 + <dependency>
  48 + <groupId>mysql</groupId>
  49 + <artifactId>mysql-connector-java</artifactId>
  50 + </dependency>
  51 +
  52 + <dependency>
  53 + <groupId>joda-time</groupId>
  54 + <artifactId>joda-time</artifactId>
  55 + </dependency>
  56 + <dependency>
  57 + <groupId>com.alibaba</groupId>
  58 + <artifactId>fastjson</artifactId>
  59 + <version>1.2.4</version>
  60 + </dependency>
  61 +
  62 + <dependency>
  63 + <groupId>org.apache.httpcomponents</groupId>
  64 + <artifactId>httpclient</artifactId>
  65 + </dependency>
  66 +
  67 + <dependency>
  68 + <groupId>commons-dbcp</groupId>
  69 + <artifactId>commons-dbcp</artifactId>
  70 + </dependency>
  71 + <dependency>
  72 + <groupId>commons-lang</groupId>
  73 + <artifactId>commons-lang</artifactId>
  74 + <version>2.6</version>
  75 + </dependency>
  76 + <dependency>
  77 + <groupId>org.apache.commons</groupId>
  78 + <artifactId>commons-lang3</artifactId>
  79 + <version>3.4</version>
  80 + </dependency>
  81 + <dependency>
  82 + <groupId>commons-fileupload</groupId>
  83 + <artifactId>commons-fileupload</artifactId>
  84 + <version>1.2.2</version>
  85 + </dependency>
  86 + <dependency>
  87 + <groupId>commons-io</groupId>
  88 + <artifactId>commons-io</artifactId>
  89 + <version>2.4</version>
  90 + </dependency>
  91 + <dependency>
  92 + <groupId>org.codehaus.janino</groupId>
  93 + <artifactId>janino</artifactId>
  94 + </dependency>
  95 +
  96 + <dependency>
  97 + <groupId>org.apache.poi</groupId>
  98 + <artifactId>poi</artifactId>
  99 + <version>3.13</version>
  100 + </dependency>
  101 +
  102 + <dependency>
  103 + <groupId>com.google.guava</groupId>
  104 + <artifactId>guava</artifactId>
  105 + <version>19.0</version>
  106 + </dependency>
  107 +
  108 + <dependency>
  109 + <groupId>c3p0</groupId>
  110 + <artifactId>c3p0</artifactId>
  111 + <version>0.9.1.2</version>
  112 + </dependency>
  113 +
  114 + <dependency>
  115 + <groupId>com.fasterxml.jackson.jaxrs</groupId>
  116 + <artifactId>jackson-jaxrs-json-provider</artifactId>
  117 + <version>2.8.7</version>
  118 + </dependency>
  119 +
  120 + <dependency>
  121 + <groupId>org.eclipse.jetty</groupId>
  122 + <artifactId>jetty-util</artifactId>
  123 + <version>8.1.15.v20140411</version>
  124 + </dependency>
  125 + </dependencies>
  126 +
  127 + <build>
  128 + <plugins>
  129 + <plugin>
  130 + <artifactId>maven-compiler-plugin</artifactId>
  131 + <version>2.3.2</version><!--$NO-MVN-MAN-VER$ -->
  132 + <configuration>
  133 + <source>1.7</source>
  134 + <target>1.7</target>
  135 + </configuration>
  136 + </plugin>
  137 + <plugin>
  138 + <artifactId>maven-war-plugin</artifactId>
  139 + <version>2.2</version><!--$NO-MVN-MAN-VER$ -->
  140 + <configuration>
  141 + <failOnMissingWebXml>false</failOnMissingWebXml>
  142 + </configuration>
  143 + </plugin>
  144 + <plugin>
  145 + <groupId>org.springframework.boot</groupId>
  146 + <artifactId>spring-boot-maven-plugin</artifactId>
  147 + </plugin>
  148 + </plugins>
  149 + <resources>
  150 + <resource>
  151 + <directory>src/main/resources</directory>
  152 + <filtering>false</filtering>
  153 + </resource>
  154 + </resources>
  155 + </build>
  156 + <repositories>
  157 + <repository>
  158 + <id>spring-snapshots</id>
  159 + <url>http://repo.spring.io/snapshot</url>
  160 + <snapshots>
  161 + <enabled>true</enabled>
  162 + </snapshots>
  163 + </repository>
  164 + <repository>
  165 + <id>spring-milestones</id>
  166 + <url>http://repo.spring.io/milestone</url>
  167 + </repository>
  168 + </repositories>
  169 + <pluginRepositories>
  170 + <pluginRepository>
  171 + <id>spring-snapshots</id>
  172 + <url>http://repo.spring.io/snapshot</url>
  173 + </pluginRepository>
  174 + <pluginRepository>
  175 + <id>spring-milestones</id>
  176 + <url>http://repo.spring.io/milestone</url>
  177 + </pluginRepository>
  178 + </pluginRepositories>
  179 +
  180 + <properties>
  181 + <start-class>com.bsth.Application</start-class>
  182 + </properties>
  183 +</project>
src/main/java/com/bsth/Application.java 0 → 100644
  1 +package com.bsth;
  2 +
  3 +import org.springframework.boot.SpringApplication;
  4 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  5 +import org.springframework.boot.web.support.SpringBootServletInitializer;
  6 +
  7 +@SpringBootApplication
  8 +public class Application extends SpringBootServletInitializer {
  9 +
  10 + public static void main(String[] args) throws Exception {
  11 + SpringApplication.run(Application.class, args);
  12 + }
  13 +
  14 +}
0 \ No newline at end of file 15 \ No newline at end of file
src/main/java/com/bsth/StartCommand.java 0 → 100644
  1 +package com.bsth;
  2 +
  3 +
  4 +import com.bsth.thread.WaybillCalcThrad;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.boot.CommandLineRunner;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +import java.util.concurrent.Executors;
  10 +import java.util.concurrent.ScheduledExecutorService;
  11 +import java.util.concurrent.TimeUnit;
  12 +
  13 +
  14 +/**
  15 + * 随应用启动运行
  16 + * @author PanZhao
  17 + *
  18 + */
  19 +@Component
  20 +public class StartCommand implements CommandLineRunner{
  21 +
  22 + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(2);
  23 +
  24 + @Autowired
  25 + WaybillCalcThrad waybillCalcThrad;
  26 +
  27 + @Override
  28 + public void run(String... arg0){
  29 +
  30 + try {
  31 + mainServices.scheduleWithFixedDelay(waybillCalcThrad, 60*30, 60*30, TimeUnit.SECONDS);
  32 + } catch (Exception e) {
  33 + e.printStackTrace();
  34 + }
  35 + }
  36 +}
src/main/java/com/bsth/common/ResponseCode.java 0 → 100644
  1 +package com.bsth.common;
  2 +
  3 +/**
  4 + *
  5 + * @ClassName: ResponseCode
  6 + * @Description: TODO(响应状态码)
  7 + * @author PanZhao
  8 + * @date 2016年3月18日 下午11:12:08
  9 + *
  10 + */
  11 +public enum ResponseCode {
  12 +
  13 + SUCCESS("操作成功", 200),
  14 + NO_PERMISSION("无资源访问权限", 403),
  15 + NO_AUTHENTICATION("客户端未授权", 407),
  16 + ERROR("服务器异常", 500);
  17 +
  18 + private String text;
  19 + private int code;
  20 +
  21 + ResponseCode(String text, int code) {
  22 + this.text = text;
  23 + this.code = code;
  24 + }
  25 +
  26 + @Override
  27 + public String toString() {
  28 + return this.code + "";
  29 + }
  30 +
  31 + public String getText() {
  32 + return this.text;
  33 + }
  34 +}
src/main/java/com/bsth/entity/ChildTaskPlan.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonIgnore;
  4 +
  5 +import javax.persistence.*;
  6 +import java.util.Date;
  7 +
  8 +
  9 +/**
  10 + *
  11 + * @ClassName: ChildTaskPlan
  12 + * @Description: TODO(子任务)
  13 + * @author PanZhao
  14 + * @date 2016年6月20日 上午11:22:22
  15 + *
  16 + */
  17 +@Entity
  18 +@Table(name = "bsth_c_s_child_task")
  19 +@NamedEntityGraphs({
  20 + @NamedEntityGraph(name = "childTaskPlan_schedule", attributeNodes = {
  21 + @NamedAttributeNode("schedule")
  22 + })
  23 +})
  24 +public class ChildTaskPlan {
  25 +
  26 + @Id
  27 + @GeneratedValue
  28 + private Long id;
  29 +
  30 + /**
  31 + * 任务类型1
  32 + * 正常,临加
  33 + */
  34 + private String type1;
  35 +
  36 + /**
  37 + * 任务类型2
  38 + */
  39 + private String type2;
  40 +
  41 + /**
  42 + * 起点
  43 + */
  44 + private String startStation;
  45 +
  46 + /**
  47 + * 起点站名称
  48 + */
  49 + private String startStationName;
  50 +
  51 + /**
  52 + * 终点
  53 + */
  54 + private String endStation;
  55 +
  56 + /**
  57 + * 终点站名称
  58 + */
  59 + private String endStationName;
  60 +
  61 + /**
  62 + * 里程类型
  63 + */
  64 + private String mileageType;
  65 +
  66 + /**
  67 + * 里程
  68 + */
  69 + private Float mileage;
  70 +
  71 + /**
  72 + * 开始时间 HH:mm
  73 + */
  74 + private String startDate;
  75 +
  76 + /**
  77 + * 结束时间 HH:mm
  78 + */
  79 + private String endDate;
  80 +
  81 + /**
  82 + * 是否烂班
  83 + */
  84 + private boolean destroy;
  85 +
  86 + /**
  87 + * 烂班原因 -烂班时,该字段仍有值并 =reason
  88 + */
  89 + private String destroyReason;
  90 +
  91 + /**
  92 + * 包括 烂班原因、进出场原因、换车原因 等
  93 + */
  94 + private String reason;
  95 +
  96 + /**
  97 + * 车辆 如果为空,继承主任务
  98 + */
  99 + private String nbbm;
  100 +
  101 + /**
  102 + * 为true 则无售票员, 否则继承主任务
  103 + */
  104 + private boolean noClerk;
  105 +
  106 + /** 创建日期 */
  107 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  108 + private Date createDate;
  109 +
  110 + /**
  111 + * 主排班计划
  112 + */
  113 + @JsonIgnore
  114 + @ManyToOne(fetch = FetchType.LAZY)
  115 + @JoinColumn(name = "schedule")
  116 + private ScheduleRealInfo schedule;
  117 +
  118 + private String remarks;
  119 +
  120 + public Long getId() {
  121 + return id;
  122 + }
  123 +
  124 + public void setId(Long id) {
  125 + this.id = id;
  126 + }
  127 +
  128 + public String getType1() {
  129 + return type1;
  130 + }
  131 +
  132 + public void setType1(String type1) {
  133 + this.type1 = type1;
  134 + }
  135 +
  136 + public String getType2() {
  137 + return type2;
  138 + }
  139 +
  140 + public void setType2(String type2) {
  141 + this.type2 = type2;
  142 + }
  143 +
  144 + public String getStartStation() {
  145 + return startStation;
  146 + }
  147 +
  148 + public void setStartStation(String startStation) {
  149 + this.startStation = startStation;
  150 + }
  151 +
  152 + public String getEndStation() {
  153 + return endStation;
  154 + }
  155 +
  156 + public void setEndStation(String endStation) {
  157 + this.endStation = endStation;
  158 + }
  159 +
  160 + public String getMileageType() {
  161 + return mileageType;
  162 + }
  163 +
  164 + public void setMileageType(String mileageType) {
  165 + this.mileageType = mileageType;
  166 + }
  167 +
  168 + public Float getMileage() {
  169 + return mileage;
  170 + }
  171 +
  172 + public void setMileage(Float mileage) {
  173 + this.mileage = mileage;
  174 + }
  175 +
  176 + public String getStartDate() {
  177 + return startDate;
  178 + }
  179 +
  180 + public void setStartDate(String startDate) {
  181 + this.startDate = startDate;
  182 + }
  183 +
  184 + public String getEndDate() {
  185 + return endDate;
  186 + }
  187 +
  188 + public void setEndDate(String endDate) {
  189 + this.endDate = endDate;
  190 + }
  191 +
  192 + public boolean isDestroy() {
  193 + return destroy;
  194 + }
  195 +
  196 + public void setDestroy(boolean destroy) {
  197 + this.destroy = destroy;
  198 + }
  199 +
  200 + public String getDestroyReason() {
  201 + return destroyReason;
  202 + }
  203 +
  204 + public void setDestroyReason(String destroyReason) {
  205 + this.destroyReason = destroyReason;
  206 + }
  207 +
  208 + public ScheduleRealInfo getSchedule() {
  209 + return schedule;
  210 + }
  211 +
  212 + public void setSchedule(ScheduleRealInfo schedule) {
  213 + this.schedule = schedule;
  214 + }
  215 +
  216 + public String getRemarks() {
  217 + return remarks;
  218 + }
  219 +
  220 + public void setRemarks(String remarks) {
  221 + this.remarks = remarks;
  222 + }
  223 +
  224 + public String getStartStationName() {
  225 + return startStationName;
  226 + }
  227 +
  228 + public void setStartStationName(String startStationName) {
  229 + this.startStationName = startStationName;
  230 + }
  231 +
  232 + public String getEndStationName() {
  233 + return endStationName;
  234 + }
  235 +
  236 + public void setEndStationName(String endStationName) {
  237 + this.endStationName = endStationName;
  238 + }
  239 +
  240 + @Override
  241 + public int hashCode() {
  242 + return ("cTask" + this.getId() + this.getSchedule().getId()).hashCode();
  243 + }
  244 +
  245 + @Override
  246 + public boolean equals(Object obj) {
  247 + return this.id.equals(((ChildTaskPlan)obj).getId());
  248 + }
  249 +
  250 + public Date getCreateDate() {
  251 + return createDate;
  252 + }
  253 +
  254 + public void setCreateDate(Date createDate) {
  255 + this.createDate = createDate;
  256 + }
  257 +
  258 + public String getReason() {
  259 + return reason;
  260 + }
  261 +
  262 + public void setReason(String reason) {
  263 + this.reason = reason;
  264 + }
  265 +
  266 + public String getNbbm() {
  267 + return nbbm;
  268 + }
  269 +
  270 + public void setNbbm(String nbbm) {
  271 + this.nbbm = nbbm;
  272 + }
  273 +
  274 + public boolean isNoClerk() {
  275 + return noClerk;
  276 + }
  277 +
  278 + public void setNoClerk(boolean noClerk) {
  279 + this.noClerk = noClerk;
  280 + }
  281 +}
src/main/java/com/bsth/entity/LineConfig.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +/**
  4 + *
  5 + * @ClassName: LineConfig
  6 + * @Description: TODO(线调 线路相关配置信息)
  7 + * @author PanZhao
  8 + * @date 2016年8月15日 下午1:57:56
  9 + *
  10 + */
  11 +public class LineConfig {
  12 +
  13 + private Integer id;
  14 +
  15 + /**
  16 + * 线路编码
  17 + */
  18 + private String lineCode;
  19 +
  20 + /** 开始运营时间 HH:mm */
  21 + private String startOpt;
  22 +
  23 + /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */
  24 + private int outConfig;
  25 +
  26 + /** 出站既出场 对应的停车场 */
  27 + private String twinsPark;
  28 +
  29 + /** 出站既出场 对应的起点站 */
  30 + private String twinsStation;
  31 +
  32 +
  33 + public String getStartOpt() {
  34 + return startOpt;
  35 + }
  36 +
  37 + public void setStartOpt(String startOpt) {
  38 + this.startOpt = startOpt;
  39 + }
  40 +
  41 + public int getOutConfig() {
  42 + return outConfig;
  43 + }
  44 +
  45 + public void setOutConfig(int outConfig) {
  46 + this.outConfig = outConfig;
  47 + }
  48 +
  49 + public String getTwinsPark() {
  50 + return twinsPark;
  51 + }
  52 +
  53 + public void setTwinsPark(String twinsPark) {
  54 + this.twinsPark = twinsPark;
  55 + }
  56 +
  57 + public String getTwinsStation() {
  58 + return twinsStation;
  59 + }
  60 +
  61 + public void setTwinsStation(String twinsStation) {
  62 + this.twinsStation = twinsStation;
  63 + }
  64 +
  65 + public String getLineCode() {
  66 + return lineCode;
  67 + }
  68 +
  69 + public void setLineCode(String lineCode) {
  70 + this.lineCode = lineCode;
  71 + }
  72 +}
src/main/java/com/bsth/entity/ScheduleRealInfo.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import org.apache.commons.lang3.StringUtils;
  4 +import org.joda.time.format.DateTimeFormat;
  5 +import org.joda.time.format.DateTimeFormatter;
  6 +
  7 +import javax.persistence.*;
  8 +import java.io.Serializable;
  9 +import java.util.Date;
  10 +import java.util.HashSet;
  11 +import java.util.Set;
  12 +
  13 +/**
  14 + * 实际排班计划明细。
  15 + */
  16 +@Entity
  17 +@Table(name = "bsth_c_s_sp_info_real")
  18 +@NamedEntityGraphs({
  19 + @NamedEntityGraph(name = "scheduleRealInfo_cTasks", attributeNodes = {
  20 + @NamedAttributeNode("cTasks")
  21 + })
  22 +})
  23 +public class ScheduleRealInfo implements Serializable{
  24 +
  25 +
  26 +
  27 + /** 主键Id */
  28 + @Id
  29 + private Long id;
  30 +
  31 + /** 计划ID */
  32 + private Long spId;
  33 +
  34 + /** 排班计划日期 */
  35 + private Date scheduleDate;
  36 + private String scheduleDateStr;
  37 +
  38 + /** 真实执行时间 yyyy-MM-dd */
  39 + private String realExecDate;
  40 +
  41 + /** 线路名称 */
  42 + private String xlName;
  43 + /** 线路编码 */
  44 + private String xlBm;
  45 +
  46 + /** 路牌名称 */
  47 + private String lpName;
  48 +
  49 + /** 车辆自编号 */
  50 + private String clZbh;
  51 +
  52 + /** 驾驶员工号 */
  53 + private String jGh;
  54 + /** 驾驶员名字 */
  55 + private String jName;
  56 + /** 售票员工号 */
  57 + private String sGh;
  58 + /** 售票员名字 */
  59 + private String sName;
  60 +
  61 + /** 线路方向 */
  62 + private String xlDir;
  63 + /** 起点站code*/
  64 + private String qdzCode;
  65 + /** 起点站名字 */
  66 + private String qdzName;
  67 +
  68 + /** 终点站code*/
  69 + private String zdzCode;
  70 + /** 终点站名字 */
  71 + private String zdzName;
  72 +
  73 + /** 计划发车时间(格式 HH:mm) */
  74 + private String fcsj;
  75 + /** 计划发车时间戳*/
  76 + @Transient
  77 + private Long fcsjT;
  78 +
  79 + /** 计划终点时间(格式 HH:mm) */
  80 + private String zdsj;
  81 + /** 计划终点时间戳*/
  82 + @Transient
  83 + private Long zdsjT;
  84 +
  85 + /** 计划里程 */
  86 + private Double jhlc;
  87 +
  88 + /** 原始计划里程 (原计调的数据) */
  89 + private Double jhlcOrig;
  90 +
  91 + /** 班次历时 */
  92 + private Integer bcsj;
  93 +
  94 + /**
  95 + * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
  96 + */
  97 + private String bcType;
  98 +
  99 + /** 实际发车时间*/
  100 + private String fcsjActual;
  101 + /** 实际发车时间戳*/
  102 + @Transient
  103 + private Long fcsjActualTime;
  104 + /**实际终点时间 */
  105 + private String zdsjActual;
  106 + /** 实际终点时间戳*/
  107 + @Transient
  108 + private Long zdsjActualTime;
  109 +
  110 + /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */
  111 + private int status;
  112 +
  113 + private String adjustExps;
  114 +
  115 + /** 是否是临加班次 */
  116 + private boolean sflj;
  117 +
  118 + /** 备注*/
  119 + private String remarks;
  120 +
  121 + /**待发时间(格式 HH:mm) */
  122 + private String dfsj;
  123 +
  124 + /**待发时间戳 */
  125 + @Transient
  126 + private Long dfsjT;
  127 +
  128 + /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */
  129 + private Integer directiveState = -1;
  130 +
  131 + /** 子任务 */
  132 + @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")
  133 + private Set<ChildTaskPlan> cTasks = new HashSet<>();
  134 +
  135 + /** 关联的公司名称 */
  136 + private String gsName;
  137 + /** 关联的公司编码 */
  138 + private String gsBm;
  139 + /** 关联的分公司名称 */
  140 + private String fgsName;
  141 + /** 关联的分公司编码 */
  142 + private String fgsBm;
  143 +
  144 + /** 工时(分钟),包含停站时间 */
  145 + @Transient
  146 + private Integer hours;
  147 +
  148 + @Override
  149 + public int hashCode() {
  150 + return (this.id + this.scheduleDateStr + this.xlBm + this.fcsj).hashCode();
  151 + }
  152 +
  153 + @Override
  154 + public boolean equals(Object obj) {
  155 + return this.id.equals(((ScheduleRealInfo)obj).getId());
  156 + }
  157 +
  158 + public Long getId() {
  159 + return id;
  160 + }
  161 +
  162 + public void setId(Long id) {
  163 + this.id = id;
  164 + }
  165 +
  166 + public Long getSpId() {
  167 + return spId;
  168 + }
  169 +
  170 + public void setSpId(Long spId) {
  171 + this.spId = spId;
  172 + }
  173 +
  174 + public Date getScheduleDate() {
  175 + return scheduleDate;
  176 + }
  177 +
  178 + public void setScheduleDate(Date scheduleDate) {
  179 + this.scheduleDate = scheduleDate;
  180 + }
  181 +
  182 + public String getScheduleDateStr() {
  183 + return scheduleDateStr;
  184 + }
  185 +
  186 + public void setScheduleDateStr(String scheduleDateStr) {
  187 + this.scheduleDateStr = scheduleDateStr;
  188 + }
  189 +
  190 + public String getRealExecDate() {
  191 + return realExecDate;
  192 + }
  193 +
  194 + public void setRealExecDate(String realExecDate) {
  195 + this.realExecDate = realExecDate;
  196 + }
  197 +
  198 + public String getXlName() {
  199 + return xlName;
  200 + }
  201 +
  202 + public void setXlName(String xlName) {
  203 + this.xlName = xlName;
  204 + }
  205 +
  206 + public String getXlBm() {
  207 + return xlBm;
  208 + }
  209 +
  210 + public void setXlBm(String xlBm) {
  211 + this.xlBm = xlBm;
  212 + }
  213 +
  214 + public String getLpName() {
  215 + return lpName;
  216 + }
  217 +
  218 + public void setLpName(String lpName) {
  219 + this.lpName = lpName;
  220 + }
  221 +
  222 + public String getClZbh() {
  223 + return clZbh;
  224 + }
  225 +
  226 + public void setClZbh(String clZbh) {
  227 + this.clZbh = clZbh;
  228 + }
  229 +
  230 + public String getjGh() {
  231 + return jGh;
  232 + }
  233 +
  234 + public void setjGh(String jGh) {
  235 + this.jGh = jGh;
  236 + }
  237 +
  238 + public String getjName() {
  239 + return jName;
  240 + }
  241 +
  242 + public void setjName(String jName) {
  243 + this.jName = jName;
  244 + }
  245 +
  246 + public String getsGh() {
  247 + return sGh;
  248 + }
  249 +
  250 + public void setsGh(String sGh) {
  251 + this.sGh = sGh;
  252 + }
  253 +
  254 + public String getsName() {
  255 + return sName;
  256 + }
  257 +
  258 + public void setsName(String sName) {
  259 + this.sName = sName;
  260 + }
  261 +
  262 + public String getXlDir() {
  263 + return xlDir;
  264 + }
  265 +
  266 + public void setXlDir(String xlDir) {
  267 + this.xlDir = xlDir;
  268 + }
  269 +
  270 + public String getQdzCode() {
  271 + return qdzCode;
  272 + }
  273 +
  274 + public void setQdzCode(String qdzCode) {
  275 + this.qdzCode = qdzCode;
  276 + }
  277 +
  278 + public String getQdzName() {
  279 + return qdzName;
  280 + }
  281 +
  282 + public void setQdzName(String qdzName) {
  283 + this.qdzName = qdzName;
  284 + }
  285 +
  286 + public String getZdzCode() {
  287 + return zdzCode;
  288 + }
  289 +
  290 + public void setZdzCode(String zdzCode) {
  291 + this.zdzCode = zdzCode;
  292 + }
  293 +
  294 + public String getZdzName() {
  295 + return zdzName;
  296 + }
  297 +
  298 + public void setZdzName(String zdzName) {
  299 + this.zdzName = zdzName;
  300 + }
  301 +
  302 + public String getFcsj() {
  303 + return fcsj;
  304 + }
  305 +
  306 + public void setFcsj(String fcsj) {
  307 + this.fcsj = fcsj;
  308 + }
  309 +
  310 + public Long getFcsjT() {
  311 + return fcsjT;
  312 + }
  313 +
  314 + public void setFcsjT(Long fcsjT) {
  315 + this.fcsjT = fcsjT;
  316 + }
  317 +
  318 + public String getZdsj() {
  319 + return zdsj;
  320 + }
  321 +
  322 + public void setZdsj(String zdsj) {
  323 + this.zdsj = zdsj;
  324 + }
  325 +
  326 + public Long getZdsjT() {
  327 + return zdsjT;
  328 + }
  329 +
  330 + public void setZdsjT(Long zdsjT) {
  331 + this.zdsjT = zdsjT;
  332 + }
  333 +
  334 + public Double getJhlc() {
  335 + return jhlc;
  336 + }
  337 +
  338 + public void setJhlc(Double jhlc) {
  339 + this.jhlc = jhlc;
  340 + }
  341 +
  342 + public Integer getBcsj() {
  343 + return bcsj;
  344 + }
  345 +
  346 + public void setBcsj(Integer bcsj) {
  347 + this.bcsj = bcsj;
  348 + }
  349 +
  350 + public String getBcType() {
  351 + return bcType;
  352 + }
  353 +
  354 + public void setBcType(String bcType) {
  355 + this.bcType = bcType;
  356 + }
  357 +
  358 + public String getFcsjActual() {
  359 + return fcsjActual;
  360 + }
  361 +
  362 + public void setFcsjActual(String fcsjActual) {
  363 + this.fcsjActual = fcsjActual;
  364 + }
  365 +
  366 + public Long getFcsjActualTime() {
  367 + return fcsjActualTime;
  368 + }
  369 +
  370 + public void setFcsjActualTime(Long fcsjActualTime) {
  371 + this.fcsjActualTime = fcsjActualTime;
  372 + }
  373 +
  374 + public String getZdsjActual() {
  375 + return zdsjActual;
  376 + }
  377 +
  378 + public void setZdsjActual(String zdsjActual) {
  379 + this.zdsjActual = zdsjActual;
  380 + }
  381 +
  382 + public Long getZdsjActualTime() {
  383 + return zdsjActualTime;
  384 + }
  385 +
  386 + public void setZdsjActualTime(Long zdsjActualTime) {
  387 + this.zdsjActualTime = zdsjActualTime;
  388 + }
  389 +
  390 + public int getStatus() {
  391 + return status;
  392 + }
  393 +
  394 + public void setStatus(int status) {
  395 + this.status = status;
  396 + }
  397 +
  398 + public String getAdjustExps() {
  399 + return adjustExps;
  400 + }
  401 +
  402 + public void setAdjustExps(String adjustExps) {
  403 + this.adjustExps = adjustExps;
  404 + }
  405 +
  406 + public boolean isSflj() {
  407 + return sflj;
  408 + }
  409 +
  410 + public void setSflj(boolean sflj) {
  411 + this.sflj = sflj;
  412 + }
  413 +
  414 + public String getRemarks() {
  415 + return remarks;
  416 + }
  417 +
  418 + public void setRemarks(String remarks) {
  419 + this.remarks = remarks;
  420 + }
  421 +
  422 + public String getDfsj() {
  423 + return dfsj;
  424 + }
  425 +
  426 + public void setDfsj(String dfsj) {
  427 + this.dfsj = dfsj;
  428 + }
  429 +
  430 + public Long getDfsjT() {
  431 + return dfsjT;
  432 + }
  433 +
  434 + public void setDfsjT(Long dfsjT) {
  435 + this.dfsjT = dfsjT;
  436 + }
  437 +
  438 + public Integer getDirectiveState() {
  439 + return directiveState;
  440 + }
  441 +
  442 + public void setDirectiveState(Integer directiveState) {
  443 + this.directiveState = directiveState;
  444 + }
  445 +
  446 + public Set<ChildTaskPlan> getcTasks() {
  447 + return cTasks;
  448 + }
  449 +
  450 + public void setcTasks(Set<ChildTaskPlan> cTasks) {
  451 + this.cTasks = cTasks;
  452 + }
  453 +
  454 + public String getGsName() {
  455 + return gsName;
  456 + }
  457 +
  458 + public void setGsName(String gsName) {
  459 + this.gsName = gsName;
  460 + }
  461 +
  462 + public String getGsBm() {
  463 + return gsBm;
  464 + }
  465 +
  466 + public void setGsBm(String gsBm) {
  467 + this.gsBm = gsBm;
  468 + }
  469 +
  470 + public String getFgsName() {
  471 + return fgsName;
  472 + }
  473 +
  474 + public void setFgsName(String fgsName) {
  475 + this.fgsName = fgsName;
  476 + }
  477 +
  478 + public String getFgsBm() {
  479 + return fgsBm;
  480 + }
  481 +
  482 + public void setFgsBm(String fgsBm) {
  483 + this.fgsBm = fgsBm;
  484 + }
  485 +
  486 + public Double getJhlcOrig() {
  487 + return jhlcOrig;
  488 + }
  489 +
  490 + public void setJhlcOrig(Double jhlcOrig) {
  491 + this.jhlcOrig = jhlcOrig;
  492 + }
  493 +
  494 +
  495 + @Transient
  496 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  497 + @Transient
  498 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  499 +
  500 + /**
  501 + *
  502 + * @Title: setFcsjAll
  503 + * @Description: TODO(设置计划发车时间)
  504 + * @throws
  505 + */
  506 + public void setFcsjAll(Long fcsjT){
  507 + this.fcsjT = fcsjT;
  508 + this.fcsj = fmtHHmm.print(fcsjT);
  509 + }
  510 +
  511 + public void setDfsjAll(Long dfsjT) {
  512 + this.dfsjT = dfsjT;
  513 + this.dfsj = fmtHHmm.print(this.dfsjT);
  514 + }
  515 +
  516 + /**
  517 + *
  518 + * @Title: setFcsjActualAll
  519 + * @Description: TODO(设置实际发车时间 时间戳)
  520 + * @throws
  521 + */
  522 + public void setFcsjActualAll(Long t){
  523 + this.fcsjActualTime = t;
  524 + this.fcsjActual = fmtHHmm.print(t);
  525 + }
  526 +
  527 + /**
  528 + *
  529 + * @Title: setFcsjActualAll
  530 + * @Description: TODO(设置实际终点时间)
  531 + * @throws
  532 + */
  533 + public void setZdsjActualAll(Long t){
  534 + this.zdsjActualTime = t;
  535 + this.zdsjActual = fmtHHmm.print(t);
  536 + }
  537 +
  538 + public void setDfsjAll(String dfsj) {
  539 + this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj);
  540 + this.dfsj = dfsj;
  541 + }
  542 +
  543 + /**
  544 + *
  545 + * @Title: setFcsjActualAll
  546 + * @Description: TODO(设置实际发车时间 字符串)
  547 + * @throws
  548 + */
  549 + public void setFcsjActualAll(String fcsjActual){
  550 + this.fcsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsjActual);
  551 + this.fcsjActual = fcsjActual;
  552 + }
  553 +
  554 + /**
  555 + *
  556 + * @Title: setFcsjActualAll
  557 + * @Description: TODO(设置实际终点时间)
  558 + * @throws
  559 + */
  560 + public void setZdsjActualAll(String zdsjActual){
  561 + this.zdsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + zdsjActual);
  562 + this.zdsjActual = zdsjActual;
  563 + }
  564 +
  565 + public void calcHoursJh() {
  566 + if(this.status == -1)
  567 + this.setHours(0);
  568 + else
  569 + this.setHours(this.getBcsj());
  570 + }
  571 +
  572 + public void calcHoursSJ() {
  573 + try {
  574 + if(StringUtils.isEmpty(this.fcsjActual))
  575 + this.setFcsjActualAll(this.dfsjT);
  576 + if(StringUtils.isEmpty(this.zdsjActual))
  577 + this.setZdsjActualAll(this.zdsjT);
  578 +
  579 + /*if(this.status == -1)
  580 + this.hours = 0;
  581 + else*/
  582 + this.hours = Integer.parseInt(String.valueOf((this.zdsjActualTime - this.fcsjActualTime) / 1000 / 60));
  583 + }catch (Exception e){
  584 + System.out.println("aa");
  585 + }
  586 + }
  587 +
  588 + public Integer getHours() {
  589 + return hours;
  590 + }
  591 +
  592 + public void setHours(Integer hours) {
  593 + this.hours = hours;
  594 + }
  595 +}
src/main/java/com/bsth/entity/result/CalcWaybill.java 0 → 100644
  1 +package com.bsth.entity.result;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class CalcWaybill {
  6 + /* 主键*/
  7 + private Long id;
  8 + /* 公司代码*/
  9 + private String gsdm;
  10 + /* 公司名称*/
  11 + private String gsname;
  12 + /* 分公司代码*/
  13 + private String fgsdm;
  14 + /* 分公司名称*/
  15 + private String fgsname;
  16 + /* 日期*/
  17 + private Date rq;
  18 + /* 日期字符串*/
  19 + private String rqStr;
  20 + /* 线路编码*/
  21 + private String xl;
  22 + /* 线路名称*/
  23 + private String xlName;
  24 + /* 车辆自编号*/
  25 + private String cl;
  26 + /* 路牌名字*/
  27 + private String lp;
  28 + /* 驾驶员工号*/
  29 + private String jGh;
  30 + /* 驾驶员名字*/
  31 + private String jName;
  32 + /* 售票员工号*/
  33 + private String sGh;
  34 + /* 售票员名字*/
  35 + private String sName;
  36 + /* 计划营运班次*/
  37 + private int jhyybc;
  38 + /* 计划早高峰营运班次*/
  39 + private int jhyybczgf;
  40 + /* 计划晚高峰营运班次*/
  41 + private int jhyybcwgf;
  42 + /* 计划空驶班次*/
  43 + private int jhksbc;
  44 + /* 计划进出场班次*/
  45 + private int jhjccbc;
  46 + /* 计划营运里程*/
  47 + private Double jhyylc;
  48 + /* 计划空驶里程*/
  49 + private Double jhkslc;
  50 + /* 计划进出场里程*/
  51 + private Double jhjcclc;
  52 + /* 实际营运班次*/
  53 + private int sjyybc;
  54 + /* 实际早高峰营运班次*/
  55 + private int sjyybczgf;
  56 + /* 实际晚高峰营运班次*/
  57 + private int sjyybcwgf;
  58 + /* 实际空驶班次*/
  59 + private int sjksbc;
  60 + /* 实际进出场班次*/
  61 + private int sjjccbc;
  62 + /* 实际营运里程*/
  63 + private Double sjyylc;
  64 + /* 实际空驶里程*/
  65 + private Double sjkslc;
  66 + /* 实际进出场里程*/
  67 + private Double sjjcclc;
  68 + /* 临加班次*/
  69 + private int ljbc;
  70 + /* 临加早高峰班次*/
  71 + private int ljbczgf;
  72 + /* 临加晚高峰班次*/
  73 + private int ljbcwgf;
  74 + /* 临加营运里程*/
  75 + private Double ljyylc;
  76 + /* 临加空驶里程*/
  77 + private Double ljkslc;
  78 + /* 临加进出场里程*/
  79 + private Double ljjcclc;
  80 + /* 烂班班次*/
  81 + private int lbbc;
  82 + /* 烂班里程*/
  83 + private Double lblc;
  84 + /* 路阻*/
  85 + private Double lblcLz;
  86 + /* 吊慢*/
  87 + private Double lblcDm;
  88 + /* 故障*/
  89 + private Double lblcGz;
  90 + /* 纠纷*/
  91 + private Double lblcJf;
  92 + /* 肇事*/
  93 + private Double lblcZs;
  94 + /* 缺人*/
  95 + private Double lblcQr;
  96 + /* 缺车*/
  97 + private Double lblcQc;
  98 + /* 客稀*/
  99 + private Double lblcKx;
  100 + /* 气候*/
  101 + private Double lblcQh;
  102 + /* 援外*/
  103 + private Double lblcYw;
  104 + /* 其他*/
  105 + private Double lblcQt;
  106 + /* 放站班次*/
  107 + private int fzbc;
  108 + /* 放站早高峰班次*/
  109 + private int fzbczgf;
  110 + /* 放站晚高峰班次*/
  111 + private int fgbcwgf;
  112 + /* 掉头班次*/
  113 + private int dtbc;
  114 + /* 掉头早高峰班次*/
  115 + private int dtbczgf;
  116 + /* 掉头晚高峰班次*/
  117 + private int dtbcwgf;
  118 + /* 计划内营运公里*/
  119 + private Double jhnyygl;
  120 + /* 计划外营运公里*/
  121 + private Double jhwyygl;
  122 + /* 计划内进出场空驶*/
  123 + private Double jhnjcc;
  124 + /* 计划外进出场空驶*/
  125 + private Double jhwjcc;
  126 + /* 故障进出场*/
  127 + private Double gzjcc;
  128 + /* 肇事进出场*/
  129 + private Double zsjcc;
  130 + /* 纠纷进出场*/
  131 + private Double jfjcc;
  132 + /* 其他进出场*/
  133 + private Double qtjcc;
  134 + /* 实际空放空驶*/
  135 + private Double kfks;
  136 + /* 创建时间*/
  137 + private Date createTime;
  138 + /* 修改时间*/
  139 + private Date updateTime;
  140 + public Long getId() {
  141 + return id;
  142 + }
  143 + public void setId(Long id) {
  144 + this.id = id;
  145 + }
  146 + public String getGsdm() {
  147 + return gsdm;
  148 + }
  149 + public void setGsdm(String gsdm) {
  150 + this.gsdm = gsdm;
  151 + }
  152 + public String getGsname() {
  153 + return gsname;
  154 + }
  155 + public void setGsname(String gsname) {
  156 + this.gsname = gsname;
  157 + }
  158 + public String getFgsdm() {
  159 + return fgsdm;
  160 + }
  161 + public void setFgsdm(String fgsdm) {
  162 + this.fgsdm = fgsdm;
  163 + }
  164 + public String getFgsname() {
  165 + return fgsname;
  166 + }
  167 + public void setFgsname(String fgsname) {
  168 + this.fgsname = fgsname;
  169 + }
  170 + public Date getRq() {
  171 + return rq;
  172 + }
  173 + public void setRq(Date rq) {
  174 + this.rq = rq;
  175 + }
  176 + public String getRqStr() {
  177 + return rqStr;
  178 + }
  179 + public void setRqStr(String rqStr) {
  180 + this.rqStr = rqStr;
  181 + }
  182 + public String getXl() {
  183 + return xl;
  184 + }
  185 + public void setXl(String xl) {
  186 + this.xl = xl;
  187 + }
  188 + public String getXlName() {
  189 + return xlName;
  190 + }
  191 + public void setXlName(String xlName) {
  192 + this.xlName = xlName;
  193 + }
  194 + public String getCl() {
  195 + return cl;
  196 + }
  197 + public void setCl(String cl) {
  198 + this.cl = cl;
  199 + }
  200 + public String getLp() {
  201 + return lp;
  202 + }
  203 + public void setLp(String lp) {
  204 + this.lp = lp;
  205 + }
  206 + public String getjGh() {
  207 + return jGh;
  208 + }
  209 + public void setjGh(String jGh) {
  210 + this.jGh = jGh;
  211 + }
  212 + public String getjName() {
  213 + return jName;
  214 + }
  215 + public void setjName(String jName) {
  216 + this.jName = jName;
  217 + }
  218 + public String getsGh() {
  219 + return sGh;
  220 + }
  221 + public void setsGh(String sGh) {
  222 + this.sGh = sGh;
  223 + }
  224 + public String getsName() {
  225 + return sName;
  226 + }
  227 + public void setsName(String sName) {
  228 + this.sName = sName;
  229 + }
  230 + public int getJhyybc() {
  231 + return jhyybc;
  232 + }
  233 + public void setJhyybc(int jhyybc) {
  234 + this.jhyybc = jhyybc;
  235 + }
  236 + public int getJhyybczgf() {
  237 + return jhyybczgf;
  238 + }
  239 + public void setJhyybczgf(int jhyybczgf) {
  240 + this.jhyybczgf = jhyybczgf;
  241 + }
  242 + public int getJhyybcwgf() {
  243 + return jhyybcwgf;
  244 + }
  245 + public void setJhyybcwgf(int jhyybcwgf) {
  246 + this.jhyybcwgf = jhyybcwgf;
  247 + }
  248 + public int getJhksbc() {
  249 + return jhksbc;
  250 + }
  251 + public void setJhksbc(int jhksbc) {
  252 + this.jhksbc = jhksbc;
  253 + }
  254 + public int getJhjccbc() {
  255 + return jhjccbc;
  256 + }
  257 + public void setJhjccbc(int jhjccbc) {
  258 + this.jhjccbc = jhjccbc;
  259 + }
  260 + public Double getJhyylc() {
  261 + return jhyylc;
  262 + }
  263 + public void setJhyylc(Double jhyylc) {
  264 + this.jhyylc = jhyylc;
  265 + }
  266 + public Double getJhkslc() {
  267 + return jhkslc;
  268 + }
  269 + public void setJhkslc(Double jhkslc) {
  270 + this.jhkslc = jhkslc;
  271 + }
  272 + public Double getJhjcclc() {
  273 + return jhjcclc;
  274 + }
  275 + public void setJhjcclc(Double jhjcclc) {
  276 + this.jhjcclc = jhjcclc;
  277 + }
  278 + public int getSjyybc() {
  279 + return sjyybc;
  280 + }
  281 + public void setSjyybc(int sjyybc) {
  282 + this.sjyybc = sjyybc;
  283 + }
  284 + public int getSjyybczgf() {
  285 + return sjyybczgf;
  286 + }
  287 + public void setSjyybczgf(int sjyybczgf) {
  288 + this.sjyybczgf = sjyybczgf;
  289 + }
  290 + public int getSjyybcwgf() {
  291 + return sjyybcwgf;
  292 + }
  293 + public void setSjyybcwgf(int sjyybcwgf) {
  294 + this.sjyybcwgf = sjyybcwgf;
  295 + }
  296 + public int getSjksbc() {
  297 + return sjksbc;
  298 + }
  299 + public void setSjksbc(int sjksbc) {
  300 + this.sjksbc = sjksbc;
  301 + }
  302 + public int getSjjccbc() {
  303 + return sjjccbc;
  304 + }
  305 + public void setSjjccbc(int sjjccbc) {
  306 + this.sjjccbc = sjjccbc;
  307 + }
  308 + public Double getSjyylc() {
  309 + return sjyylc;
  310 + }
  311 + public void setSjyylc(Double sjyylc) {
  312 + this.sjyylc = sjyylc;
  313 + }
  314 + public Double getSjkslc() {
  315 + return sjkslc;
  316 + }
  317 + public void setSjkslc(Double sjkslc) {
  318 + this.sjkslc = sjkslc;
  319 + }
  320 + public Double getSjjcclc() {
  321 + return sjjcclc;
  322 + }
  323 + public void setSjjcclc(Double sjjcclc) {
  324 + this.sjjcclc = sjjcclc;
  325 + }
  326 + public int getLjbc() {
  327 + return ljbc;
  328 + }
  329 + public void setLjbc(int ljbc) {
  330 + this.ljbc = ljbc;
  331 + }
  332 + public int getLjbczgf() {
  333 + return ljbczgf;
  334 + }
  335 + public void setLjbczgf(int ljbczgf) {
  336 + this.ljbczgf = ljbczgf;
  337 + }
  338 + public int getLjbcwgf() {
  339 + return ljbcwgf;
  340 + }
  341 + public void setLjbcwgf(int ljbcwgf) {
  342 + this.ljbcwgf = ljbcwgf;
  343 + }
  344 + public Double getLjyylc() {
  345 + return ljyylc;
  346 + }
  347 + public void setLjyylc(Double ljyylc) {
  348 + this.ljyylc = ljyylc;
  349 + }
  350 + public Double getLjkslc() {
  351 + return ljkslc;
  352 + }
  353 + public void setLjkslc(Double ljkslc) {
  354 + this.ljkslc = ljkslc;
  355 + }
  356 + public Double getLjjcclc() {
  357 + return ljjcclc;
  358 + }
  359 + public void setLjjcclc(Double ljjcclc) {
  360 + this.ljjcclc = ljjcclc;
  361 + }
  362 + public int getLbbc() {
  363 + return lbbc;
  364 + }
  365 + public void setLbbc(int lbbc) {
  366 + this.lbbc = lbbc;
  367 + }
  368 + public Double getLblc() {
  369 + return lblc;
  370 + }
  371 + public void setLblc(Double lblc) {
  372 + this.lblc = lblc;
  373 + }
  374 + public Double getLblcLz() {
  375 + return lblcLz;
  376 + }
  377 + public void setLblcLz(Double lblcLz) {
  378 + this.lblcLz = lblcLz;
  379 + }
  380 + public Double getLblcDm() {
  381 + return lblcDm;
  382 + }
  383 + public void setLblcDm(Double lblcDm) {
  384 + this.lblcDm = lblcDm;
  385 + }
  386 + public Double getLblcGz() {
  387 + return lblcGz;
  388 + }
  389 + public void setLblcGz(Double lblcGz) {
  390 + this.lblcGz = lblcGz;
  391 + }
  392 + public Double getLblcJf() {
  393 + return lblcJf;
  394 + }
  395 + public void setLblcJf(Double lblcJf) {
  396 + this.lblcJf = lblcJf;
  397 + }
  398 + public Double getLblcZs() {
  399 + return lblcZs;
  400 + }
  401 + public void setLblcZs(Double lblcZs) {
  402 + this.lblcZs = lblcZs;
  403 + }
  404 + public Double getLblcQr() {
  405 + return lblcQr;
  406 + }
  407 + public void setLblcQr(Double lblcQr) {
  408 + this.lblcQr = lblcQr;
  409 + }
  410 + public Double getLblcQc() {
  411 + return lblcQc;
  412 + }
  413 + public void setLblcQc(Double lblcQc) {
  414 + this.lblcQc = lblcQc;
  415 + }
  416 + public Double getLblcKx() {
  417 + return lblcKx;
  418 + }
  419 + public void setLblcKx(Double lblcKx) {
  420 + this.lblcKx = lblcKx;
  421 + }
  422 + public Double getLblcQh() {
  423 + return lblcQh;
  424 + }
  425 + public void setLblcQh(Double lblcQh) {
  426 + this.lblcQh = lblcQh;
  427 + }
  428 + public Double getLblcYw() {
  429 + return lblcYw;
  430 + }
  431 + public void setLblcYw(Double lblcYw) {
  432 + this.lblcYw = lblcYw;
  433 + }
  434 + public Double getLblcQt() {
  435 + return lblcQt;
  436 + }
  437 + public void setLblcQt(Double lblcQt) {
  438 + this.lblcQt = lblcQt;
  439 + }
  440 + public int getFzbc() {
  441 + return fzbc;
  442 + }
  443 + public void setFzbc(int fzbc) {
  444 + this.fzbc = fzbc;
  445 + }
  446 + public int getFzbczgf() {
  447 + return fzbczgf;
  448 + }
  449 + public void setFzbczgf(int fzbczgf) {
  450 + this.fzbczgf = fzbczgf;
  451 + }
  452 + public int getFgbcwgf() {
  453 + return fgbcwgf;
  454 + }
  455 + public void setFgbcwgf(int fgbcwgf) {
  456 + this.fgbcwgf = fgbcwgf;
  457 + }
  458 + public int getDtbc() {
  459 + return dtbc;
  460 + }
  461 + public void setDtbc(int dtbc) {
  462 + this.dtbc = dtbc;
  463 + }
  464 + public int getDtbczgf() {
  465 + return dtbczgf;
  466 + }
  467 + public void setDtbczgf(int dtbczgf) {
  468 + this.dtbczgf = dtbczgf;
  469 + }
  470 + public int getDtbcwgf() {
  471 + return dtbcwgf;
  472 + }
  473 + public void setDtbcwgf(int dtbcwgf) {
  474 + this.dtbcwgf = dtbcwgf;
  475 + }
  476 + public Double getJhnyygl() {
  477 + return jhnyygl;
  478 + }
  479 + public void setJhnyygl(Double jhnyygl) {
  480 + this.jhnyygl = jhnyygl;
  481 + }
  482 + public Double getJhwyygl() {
  483 + return jhwyygl;
  484 + }
  485 + public void setJhwyygl(Double jhwyygl) {
  486 + this.jhwyygl = jhwyygl;
  487 + }
  488 + public Double getJhnjcc() {
  489 + return jhnjcc;
  490 + }
  491 + public void setJhnjcc(Double jhnjcc) {
  492 + this.jhnjcc = jhnjcc;
  493 + }
  494 + public Double getJhwjcc() {
  495 + return jhwjcc;
  496 + }
  497 + public void setJhwjcc(Double jhwjcc) {
  498 + this.jhwjcc = jhwjcc;
  499 + }
  500 + public Double getGzjcc() {
  501 + return gzjcc;
  502 + }
  503 + public void setGzjcc(Double gzjcc) {
  504 + this.gzjcc = gzjcc;
  505 + }
  506 + public Double getZsjcc() {
  507 + return zsjcc;
  508 + }
  509 + public void setZsjcc(Double zsjcc) {
  510 + this.zsjcc = zsjcc;
  511 + }
  512 + public Double getJfjcc() {
  513 + return jfjcc;
  514 + }
  515 + public void setJfjcc(Double jfjcc) {
  516 + this.jfjcc = jfjcc;
  517 + }
  518 + public Double getQtjcc() {
  519 + return qtjcc;
  520 + }
  521 + public void setQtjcc(Double qtjcc) {
  522 + this.qtjcc = qtjcc;
  523 + }
  524 + public Double getKfks() {
  525 + return kfks;
  526 + }
  527 + public void setKfks(Double kfks) {
  528 + this.kfks = kfks;
  529 + }
  530 + public Date getCreateTime() {
  531 + return createTime;
  532 + }
  533 + public void setCreateTime(Date createTime) {
  534 + this.createTime = createTime;
  535 + }
  536 + public Date getUpdateTime() {
  537 + return updateTime;
  538 + }
  539 + public void setUpdateTime(Date updateTime) {
  540 + this.updateTime = updateTime;
  541 + }
  542 +
  543 +
  544 +
  545 +}
src/main/java/com/bsth/entity/result/WorkingHours_jsy.java 0 → 100644
  1 +package com.bsth.entity.result;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * Created by panzhao on 2017/7/26.
  7 + * table:
  8 + * 驾驶员工时
  9 + */
  10 +public class WorkingHours_jsy {
  11 +
  12 + /** 公司编码 */
  13 + private String companyId;
  14 +
  15 + /** 分公司编码 */
  16 + private String subCompanyId;
  17 +
  18 + /** 线路编码 */
  19 + private String lineCode;
  20 +
  21 + /** 线路名称 */
  22 + private String lineName;
  23 +
  24 + /** 驾驶员工号 */
  25 + private String jsy;
  26 +
  27 + /** 驾驶员姓名 */
  28 + private String jsyName;
  29 +
  30 + /** 车辆自编号 */
  31 + private String nbbm;
  32 +
  33 + /** 路牌 */
  34 + private String lpName;
  35 +
  36 + /** 日期 (班次日期) */
  37 + private String rq;
  38 +
  39 + /** 计划工时(分钟) */
  40 + private Integer hoursJh;
  41 +
  42 + /** 实际工时(分钟) */
  43 + private Integer hoursSj;
  44 +
  45 + /** 来源 0: 从路单结算、 1:人工录入 */
  46 + private int source;
  47 +
  48 + /** 备注 */
  49 + private String remarks;
  50 +
  51 + private Date createDate;
  52 +
  53 + public String getCompanyId() {
  54 + return companyId;
  55 + }
  56 +
  57 + public void setCompanyId(String companyId) {
  58 + this.companyId = companyId;
  59 + }
  60 +
  61 + public String getSubCompanyId() {
  62 + return subCompanyId;
  63 + }
  64 +
  65 + public void setSubCompanyId(String subCompanyId) {
  66 + this.subCompanyId = subCompanyId;
  67 + }
  68 +
  69 + public String getLineCode() {
  70 + return lineCode;
  71 + }
  72 +
  73 + public void setLineCode(String lineCode) {
  74 + this.lineCode = lineCode;
  75 + }
  76 +
  77 + public String getLineName() {
  78 + return lineName;
  79 + }
  80 +
  81 + public void setLineName(String lineName) {
  82 + this.lineName = lineName;
  83 + }
  84 +
  85 + public String getJsy() {
  86 + return jsy;
  87 + }
  88 +
  89 + public void setJsy(String jsy) {
  90 + this.jsy = jsy;
  91 + }
  92 +
  93 + public String getJsyName() {
  94 + return jsyName;
  95 + }
  96 +
  97 + public void setJsyName(String jsyName) {
  98 + this.jsyName = jsyName;
  99 + }
  100 +
  101 + public String getNbbm() {
  102 + return nbbm;
  103 + }
  104 +
  105 + public void setNbbm(String nbbm) {
  106 + this.nbbm = nbbm;
  107 + }
  108 +
  109 + public String getLpName() {
  110 + return lpName;
  111 + }
  112 +
  113 + public void setLpName(String lpName) {
  114 + this.lpName = lpName;
  115 + }
  116 +
  117 + public String getRq() {
  118 + return rq;
  119 + }
  120 +
  121 + public void setRq(String rq) {
  122 + this.rq = rq;
  123 + }
  124 +
  125 +
  126 + public int getSource() {
  127 + return source;
  128 + }
  129 +
  130 + public void setSource(int source) {
  131 + this.source = source;
  132 + }
  133 +
  134 + public String getRemarks() {
  135 + return remarks;
  136 + }
  137 +
  138 + public void setRemarks(String remarks) {
  139 + this.remarks = remarks;
  140 + }
  141 +
  142 + public Date getCreateDate() {
  143 + return createDate;
  144 + }
  145 +
  146 + public void setCreateDate(Date createDate) {
  147 + this.createDate = createDate;
  148 + }
  149 +
  150 + public Integer getHoursJh() {
  151 + return hoursJh;
  152 + }
  153 +
  154 + public void setHoursJh(Integer hoursJh) {
  155 + this.hoursJh = hoursJh;
  156 + }
  157 +
  158 + public Integer getHoursSj() {
  159 + return hoursSj;
  160 + }
  161 +
  162 + public void setHoursSj(Integer hoursSj) {
  163 + this.hoursSj = hoursSj;
  164 + }
  165 +
  166 + public String keys() {
  167 + return this.getLineCode() + "_" + this.getLpName() + "_" + this.getJsy() + "_" + this.getNbbm();
  168 + }
  169 +}
src/main/java/com/bsth/handler/UserCarCountHandler.java 0 → 100644
  1 +package com.bsth.handler;
  2 +
  3 +import com.bsth.entity.LineConfig;
  4 +import com.bsth.entity.ScheduleRealInfo;
  5 +import com.bsth.entity.result.WorkingHours_jsy;
  6 +import com.bsth.service.LineConfigService;
  7 +import com.bsth.service.ScheduleRealInfoService;
  8 +import com.bsth.util.ConvertUtil;
  9 +import com.google.common.collect.ArrayListMultimap;
  10 +import com.mysql.fabric.xmlrpc.base.Data;
  11 +
  12 +import org.joda.time.DateTime;
  13 +import org.slf4j.Logger;
  14 +import org.slf4j.LoggerFactory;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  17 +import org.springframework.jdbc.core.JdbcTemplate;
  18 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
  19 +import org.springframework.stereotype.Component;
  20 +import org.springframework.transaction.TransactionDefinition;
  21 +import org.springframework.transaction.TransactionStatus;
  22 +import org.springframework.transaction.support.DefaultTransactionDefinition;
  23 +
  24 +import java.lang.reflect.Field;
  25 +import java.sql.PreparedStatement;
  26 +import java.sql.SQLException;
  27 +import java.text.SimpleDateFormat;
  28 +import java.util.*;
  29 +
  30 +/**
  31 + * 人员车辆班次里程处理程序
  32 + */
  33 +@Component
  34 +public class UserCarCountHandler {
  35 +
  36 + /**
  37 + * 结算规则, 周几 ——> 结算前几天 (考虑间隔)
  38 + */
  39 + private static Map<Integer, Integer> runRuleMap;
  40 +
  41 + /**
  42 + * 间隔1天(留一天的时间给各个公司检查路单)
  43 + */
  44 + private final static int DAY_SPACE = 1;
  45 +
  46 + /**
  47 + * 判定分班时间阈值
  48 + */
  49 + private final static long FB_THRESHOLD_TIME = 1000 * 60 * 60 * 2;
  50 +
  51 + @Autowired
  52 + ScheduleRealInfoService scheduleRealInfoService;
  53 + @Autowired
  54 + LineConfigService lineConfigService;
  55 +
  56 + @Autowired
  57 + JdbcTemplate jdbcTemplate;
  58 +
  59 + Logger logger = LoggerFactory.getLogger(this.getClass());
  60 +
  61 + static {
  62 + //0 是周天
  63 + runRuleMap = new HashMap<>();
  64 + runRuleMap.put(1, 0);
  65 + runRuleMap.put(2, 3);
  66 + runRuleMap.put(3, 1);
  67 + runRuleMap.put(4, 1);
  68 + runRuleMap.put(5, 1);
  69 + runRuleMap.put(6, 1);
  70 + runRuleMap.put(0, 0);
  71 + }
  72 +
  73 + /*public void calc() {
  74 + DateTime dt = DateTime.now();
  75 + Calendar calendar = Calendar.getInstance();
  76 + calendar.setTime(dt.toDate());
  77 + //今天要结算多少天的工时
  78 + int count = runRuleMap.get(calendar.get(Calendar.DAY_OF_WEEK) - 1);
  79 +
  80 + dt = dt.minusDays(DAY_SPACE + count);
  81 + String rq;
  82 + for (int i = 0; i < count; i++) {
  83 + rq = dt.toString("yyyy-MM-dd");
  84 + calc(rq);
  85 + dt = dt.plusDays(1);
  86 + }
  87 + }*/
  88 +
  89 + public void calcLast(){
  90 + //计算前一天班次里程
  91 + Date dNow = new Date();
  92 + Calendar calendar = Calendar.getInstance();
  93 + calendar.setTime(dNow);
  94 + calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
  95 + Date dBefore = calendar.getTime(); //得到前一天的时间
  96 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); //设置时间格式
  97 + SimpleDateFormat sdf2=new SimpleDateFormat(" HH:mm");//得到当前时间
  98 + String lastRq = sdf.format(dBefore); //格式化前一天
  99 + String time=sdf2.format(dNow); //格式化当前时间
  100 + String times[] =time.split(":");
  101 + time=times[0]+times[1];
  102 + int t=Integer.parseInt(times[0])*60+Integer.parseInt(times[1]);
  103 + calc(lastRq,t);
  104 +
  105 + }
  106 +
  107 + private void calc(String rq,int t){
  108 + try {
  109 + List<LineConfig> listLineConfig=lineConfigService.findAllList();
  110 + for (int i = 0; i < listLineConfig.size(); i++) {
  111 + LineConfig lineConfig=listLineConfig.get(i);
  112 + String lineCode=lineConfig.getLineCode();
  113 + String startOpt=lineConfig.getStartOpt();
  114 + String times[] =startOpt.split(":");
  115 + int time=Integer.parseInt(times[0])*60+Integer.parseInt(times[1])-30;
  116 + //线路重新排版前30分钟 统计该线路前一天的 班次 里程
  117 + if(time>t){
  118 + //查询该线路前一天的排班
  119 + }
  120 +
  121 + }
  122 +
  123 + }catch (Exception e) {
  124 + logger.error("", e);
  125 + }
  126 + }
  127 +
  128 + /*private void calc(String rq) {
  129 + try {
  130 + logger.info("开始结算工时: " + rq);
  131 + List<WorkingHours_jsy> list = new ArrayList<>();
  132 + //实际班次,路单数据
  133 + List<ScheduleRealInfo> sjList = scheduleRealInfoService.findAll(rq);
  134 + //计划班次,计调数据
  135 + List<ScheduleRealInfo> jhList = scheduleRealInfoService.findAll_JH(rq);
  136 +
  137 + //附加停站时间
  138 + addStopTime(sjList);
  139 + addStopTime(jhList);
  140 +
  141 + //合计工时
  142 + List<WorkingHours_jsy> jhArray = count(jhList, true);
  143 + List<WorkingHours_jsy> sjArray = count(sjList, false);
  144 +
  145 + //合并计划和实际
  146 + Map<String, WorkingHours_jsy> merges = new HashMap<>();
  147 + for (WorkingHours_jsy jh : jhArray) {
  148 + jh.setHoursSj(0);
  149 + merges.put(jh.keys(), jh);
  150 + }
  151 +
  152 + String key;
  153 + for (WorkingHours_jsy sj : sjArray) {
  154 + key = sj.keys();
  155 + if (merges.containsKey(key)) {
  156 + merges.get(key).setHoursSj(sj.getHoursSj());
  157 + } else {
  158 + sj.setHoursJh(0);
  159 + merges.put(key, sj);
  160 + }
  161 + }
  162 + //入库
  163 + save(new ArrayList(merges.values()));
  164 + logger.info("结算工时成功: " + rq + " -size: " + merges.values().size());
  165 + } catch (Exception e) {
  166 + logger.error("", e);
  167 + }
  168 + }*/
  169 +
  170 + private void addStopTime(List<ScheduleRealInfo> list) throws NoSuchFieldException {
  171 + Class clazz = ScheduleRealInfo.class;
  172 + //按驾驶员分组班次
  173 + ArrayListMultimap<String, ScheduleRealInfo> multimap = new ConvertUtil<ScheduleRealInfo>()
  174 + .groupMultiList(list, "", clazz.getDeclaredField("jGh"));
  175 +
  176 + //为班次附上停站时间
  177 + Set<String> ks = multimap.keySet();
  178 + for (String k : ks) {
  179 + calcOne(multimap.get(k));
  180 + }
  181 + }
  182 +
  183 + private List<WorkingHours_jsy> count(List<ScheduleRealInfo> list, boolean isJh) throws NoSuchFieldException {
  184 + List<WorkingHours_jsy> rs = new ArrayList<>();
  185 + Class clazz = ScheduleRealInfo.class;
  186 + //按 线路_路牌_驾驶员_车辆分组数据
  187 + Field xl_f = clazz.getDeclaredField("xlBm"),
  188 + lp_f = clazz.getDeclaredField("lpName"),
  189 + jsy_f = clazz.getDeclaredField("jGh"),
  190 + cl_f = clazz.getDeclaredField("clZbh");
  191 +
  192 + ArrayListMultimap<String, ScheduleRealInfo> multimap = new ConvertUtil<ScheduleRealInfo>()
  193 + .groupMultiList(list, "_", xl_f, lp_f, jsy_f, cl_f);
  194 +
  195 + //合计工时
  196 + Date d = new Date();
  197 + Set<String> ks = multimap.keySet();
  198 + WorkingHours_jsy wh;
  199 + for (String k : ks) {
  200 + wh = sum(multimap.get(k), isJh);
  201 + wh.setCreateDate(d);
  202 + rs.add(wh);
  203 + }
  204 +
  205 + return rs;
  206 + }
  207 +
  208 + private void save(final List<WorkingHours_jsy> list) {
  209 + String sql = "insert into z_calc_hoursjsy(company_id, sub_company_id, line_code, line_name, jsy, jsy_name, nbbm, lp_name, rq, hours_jh, hours_sj, source, remarks, create_date) " +
  210 + " VALUES(?, ?, ?, ?, ?,?, ?, ?,?,?,?,?,?,?)";
  211 +
  212 + //编程式事务
  213 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  214 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  215 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  216 + TransactionStatus status = tran.getTransaction(def);
  217 +
  218 + try {
  219 + jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
  220 + @Override
  221 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  222 + WorkingHours_jsy wh = list.get(i);
  223 + ps.setString(1, wh.getCompanyId());
  224 + ps.setString(2, wh.getSubCompanyId());
  225 + ps.setString(3, wh.getLineCode());
  226 + ps.setString(4, wh.getLineName());
  227 + ps.setString(5, wh.getJsy());
  228 + ps.setString(6, wh.getJsyName());
  229 + ps.setString(7, wh.getNbbm());
  230 + ps.setString(8, wh.getLpName());
  231 + ps.setString(9, wh.getRq());
  232 + ps.setDouble(10, wh.getHoursJh());
  233 + ps.setDouble(11, wh.getHoursSj());
  234 + ps.setInt(12, wh.getSource());
  235 + ps.setString(13, wh.getRemarks());
  236 + ps.setDate(14, new java.sql.Date(wh.getCreateDate().getTime()));
  237 + }
  238 +
  239 + @Override
  240 + public int getBatchSize() {
  241 + return list.size();
  242 + }
  243 + });
  244 +
  245 + tran.commit(status);
  246 + } catch (Exception e) {
  247 + tran.rollback(status);
  248 + logger.error("", e);
  249 + }
  250 + }
  251 +
  252 +
  253 + /**
  254 + * 合计工时
  255 + *
  256 + * @param list
  257 + * @return
  258 + */
  259 + private WorkingHours_jsy sum(List<ScheduleRealInfo> list, boolean jh) {
  260 + ScheduleRealInfo sch = list.get(0);
  261 + WorkingHours_jsy wh = new WorkingHours_jsy();
  262 +
  263 + wh.setCompanyId(sch.getGsBm());
  264 + wh.setSubCompanyId(sch.getFgsBm());
  265 + wh.setLineCode(sch.getXlBm());
  266 + wh.setLpName(sch.getLpName());
  267 + wh.setJsy(sch.getjGh());
  268 + wh.setJsyName(sch.getjName());
  269 + wh.setNbbm(sch.getClZbh());
  270 + wh.setLineName(sch.getXlName());
  271 + wh.setRq(sch.getScheduleDateStr());
  272 + //wh.set
  273 + Integer sum = 0;
  274 +
  275 + for (ScheduleRealInfo s : list) {
  276 + sum += s.getHours();
  277 + }
  278 +
  279 + if (jh)
  280 + wh.setHoursJh(sum);
  281 + else
  282 + wh.setHoursSj(sum);
  283 + return wh;
  284 + }
  285 +
  286 + /**
  287 + * 计算每个班次的工时(包括停站时间)
  288 + *
  289 + * @param list
  290 + */
  291 + private void calcOne(List<ScheduleRealInfo> list) {
  292 + if (list.size() <= 1)
  293 + return;
  294 +
  295 +
  296 + Collections.sort(list, new Comparator<ScheduleRealInfo>() {
  297 + @Override
  298 + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
  299 + return (int) (s1.getDfsjT() - s2.getDfsjT());
  300 + }
  301 + });
  302 +
  303 + int len = list.size() - 1;
  304 + for (int i = 0; i < len; i++) {
  305 + calcToNextHours(list.get(i), list.get(i + 1));
  306 + }
  307 +
  308 + }
  309 +
  310 + /**
  311 + * 当前班次 和 下一个班次计算工时
  312 + *
  313 + * @param sch
  314 + * @param next
  315 + */
  316 + private void calcToNextHours(ScheduleRealInfo sch, ScheduleRealInfo next) {
  317 + /*if(sch.getjGh().equals("008435") && sch.getClZbh().equals("W0F-017"))
  318 + System.out.println("aaa");*/
  319 + //分班班次
  320 + /*if (isIn(sch) && isOut(next) )
  321 + return;*/
  322 +
  323 + //分班间隔
  324 + if (next.getFcsjT() - sch.getFcsjT() >= FB_THRESHOLD_TIME){
  325 + if(sch.getStatus()==-1)
  326 + sch.setHours(0);
  327 + return;
  328 + }
  329 +
  330 + //把停站时间算进去
  331 + //sch.setHours((int) ((next.getFcsjT() - sch.getFcsjT()) / 1000 / 60));
  332 + sch.setHours((int) ((next.getFcsjActualTime() - sch.getFcsjActualTime()) / 1000 / 60));
  333 + }
  334 +
  335 + private boolean isIn(ScheduleRealInfo sch) {
  336 + return sch.getBcType().equals("in");
  337 + }
  338 +
  339 + private boolean isOut(ScheduleRealInfo sch) {
  340 + return sch.getBcType().equals("out");
  341 + }
  342 +}
src/main/java/com/bsth/repository/ScheduleRealInfoRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.ScheduleRealInfo;
  4 +import org.springframework.data.jpa.repository.EntityGraph;
  5 +import org.springframework.data.jpa.repository.Query;
  6 +import org.springframework.data.repository.PagingAndSortingRepository;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import java.util.List;
  10 +
  11 +@Repository
  12 +public interface ScheduleRealInfoRepository extends PagingAndSortingRepository<ScheduleRealInfo, Long> {
  13 +
  14 + /**
  15 + * 根据日期获取班次信息
  16 + * @param schDate
  17 + * @return
  18 + */
  19 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  20 + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1")
  21 + List<ScheduleRealInfo> findAll(String schDate);
  22 +
  23 + /**
  24 + * 根据日期和线路编码获取班次信息
  25 + * @param schDate
  26 + * @param lineCode
  27 + * @return
  28 + */
  29 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  30 + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 and s.xlBm=?2")
  31 + List<ScheduleRealInfo> findAll(String schDate, String lineCode);
  32 +
  33 + /**
  34 + * 获取大于指定日期的班次信息
  35 + * @param schDate
  36 + * @return
  37 + */
  38 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  39 + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr>?1")
  40 + List<ScheduleRealInfo> findByDateLT(String schDate);
  41 +}
src/main/java/com/bsth/service/LineConfigService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.LineConfig;
  4 +
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/7/27.
  10 + */
  11 +public interface LineConfigService {
  12 +
  13 + Map<String,LineConfig> findAll();
  14 +
  15 + List<LineConfig> findAllList();
  16 +}
src/main/java/com/bsth/service/ScheduleRealInfoService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.ScheduleRealInfo;
  4 +import com.bsth.entity.result.CalcWaybill;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/7/27.
  10 + */
  11 +public interface ScheduleRealInfoService {
  12 +
  13 + List<CalcWaybill> findAll(String rq,String lineCode);
  14 +
  15 +}
src/main/java/com/bsth/service/impl/LineConfigServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import com.bsth.entity.LineConfig;
  4 +import com.bsth.service.LineConfigService;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  7 +import org.springframework.jdbc.core.JdbcTemplate;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +import java.util.HashMap;
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +
  14 +/**
  15 + * Created by panzhao on 2017/7/27.
  16 + */
  17 +@Service
  18 +public class LineConfigServiceImpl implements LineConfigService {
  19 +
  20 + @Autowired
  21 + JdbcTemplate jdbcTemplate;
  22 +
  23 + @Override
  24 + public Map<String, LineConfig> findAll() {
  25 + String sql = "select c.id,c.out_config,c.start_opt,c.trust,t.line_code from bsth_c_line_config c LEFT JOIN bsth_c_line t on c.line=t.id";
  26 + List<LineConfig> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(LineConfig.class));
  27 +
  28 + Map<String, LineConfig> rs = new HashMap<>();
  29 + for(LineConfig config : list){
  30 + rs.put(config.getLineCode(), config);
  31 + }
  32 + return rs;
  33 + }
  34 +
  35 + @Override
  36 + public List<LineConfig> findAllList() {
  37 + String sql = "select c.id,c.out_config,c.start_opt,c.trust,t.line_code from bsth_c_line_config c LEFT JOIN bsth_c_line t on c.line=t.id";
  38 + List<LineConfig> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(LineConfig.class));
  39 +
  40 + return list;
  41 + }
  42 +}
src/main/java/com/bsth/service/impl/ScheduleRealInfoServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import com.bsth.entity.LineConfig;
  4 +import com.bsth.entity.ScheduleRealInfo;
  5 +import com.bsth.entity.result.CalcWaybill;
  6 +import com.bsth.repository.ScheduleRealInfoRepository;
  7 +import com.bsth.service.LineConfigService;
  8 +import com.bsth.service.ScheduleRealInfoService;
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.joda.time.format.DateTimeFormat;
  11 +import org.joda.time.format.DateTimeFormatter;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.jdbc.core.JdbcTemplate;
  16 +import org.springframework.jdbc.core.RowMapper;
  17 +import org.springframework.stereotype.Service;
  18 +
  19 +import java.sql.ResultSet;
  20 +import java.sql.SQLException;
  21 +import java.util.ArrayList;
  22 +import java.util.HashMap;
  23 +import java.util.List;
  24 +import java.util.Map;
  25 +import java.util.Set;
  26 +import com.bsth.entity.ChildTaskPlan;
  27 +
  28 +/**
  29 + * Created by panzhao on 2017/7/27.
  30 + */
  31 +@Service
  32 +public class ScheduleRealInfoServiceImpl implements ScheduleRealInfoService {
  33 +
  34 + @Autowired
  35 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  36 +
  37 + @Autowired
  38 + JdbcTemplate jdbcTemplate;
  39 +
  40 + @Autowired
  41 + LineConfigService lineConfigService;
  42 +
  43 + Logger logger = LoggerFactory.getLogger(this.getClass());
  44 +
  45 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"),
  46 + fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"),
  47 + fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  48 +
  49 + private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
  50 +
  51 + @Override
  52 + public List<CalcWaybill> findAll(String rq,String lineCode) {
  53 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.findAll(rq,lineCode);
  54 + String sql ="select r.j_gh ,r.s_gh,r.cl_zbh,r.xl_bm, r.lp_name FROM"
  55 + + " bsth_c_s_sp_info_real r where "
  56 + + " r.schedule_date_str='"+rq+"' and r.xl_bm = '"+lineCode+"'"
  57 + + " GROUP BY r.j_gh,r.xl_bm,r.lp_name ";
  58 +
  59 + List<Map<String, String>> listMap = jdbcTemplate.query(sql, new RowMapper<Map<String, String>>() {
  60 + @Override
  61 + public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
  62 + Map<String, String> c = new HashMap<String,String>();
  63 + c.put("jGh", arg0.getString("j_gh"));
  64 + c.put("sGh", arg0.getString("s_gh")==null?"":arg0.getString("s_gh"));
  65 + c.put("clZbh", arg0.getString("cl_zbh"));
  66 + c.put("xlBm", arg0.getString("xl_bm"));
  67 + c.put("lpName", arg0.getString("lp_name"));
  68 + return c;
  69 + }
  70 + });
  71 + for (int i = 0; i < listMap.size(); i++) {
  72 + Map<String, String> m=listMap.get(i);
  73 + String jGh=m.get("jGh");
  74 + String sGh=m.get("sGh");
  75 + String clZbh=m.get("clZbh");
  76 + String xlBm=m.get("xlBm");
  77 + String lpName=m.get("lpName");
  78 + //所有数据排班数据
  79 + List<ScheduleRealInfo> list_=new ArrayList<ScheduleRealInfo>();
  80 + //执行了的班次的排班数据
  81 + List<ScheduleRealInfo> lists_=new ArrayList<ScheduleRealInfo>();
  82 + for (int j = 0; j < list.size(); j++) {
  83 + ScheduleRealInfo s=list.get(j);
  84 + if(jGh.equals(s.getjGh())
  85 + && sGh.equals(s.getsGh()==null?"":s.getsGh())
  86 + && clZbh.equals(s.getClZbh())
  87 + && xlBm.equals(s.getXlBm())
  88 + && lpName.equals(s.getLpName())){
  89 +
  90 + list_.add(s);
  91 +
  92 + Set<ChildTaskPlan> cts = s.getcTasks();
  93 + if(cts != null && cts.size() > 0){
  94 + lists_.add(s);
  95 + }else{
  96 + if(s.getZdsjActual()!=null
  97 + && s.getFcsjActual() !=null){
  98 + lists_.add(s);
  99 + }
  100 + }
  101 + }
  102 + }
  103 +
  104 +
  105 + }
  106 + return null;
  107 + }
  108 +
  109 +}
src/main/java/com/bsth/thread/WaybillCalcThrad.java 0 → 100644
  1 +package com.bsth.thread;
  2 +
  3 +import com.bsth.handler.UserCarCountHandler;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +/**
  10 + * 人员车辆班次里程计算线程
  11 + */
  12 +@Component
  13 +public class WaybillCalcThrad extends Thread {
  14 +
  15 +
  16 + @Autowired
  17 + UserCarCountHandler userCarCountHandler;
  18 +
  19 + Logger logger = LoggerFactory.getLogger(this.getClass());
  20 +
  21 + @Override
  22 + public void run() {
  23 + try {
  24 + userCarCountHandler.calcLast();
  25 + } catch (Exception e) {
  26 + logger.error("", e);
  27 + }
  28 + }
  29 +}
src/main/java/com/bsth/util/Arith.java 0 → 100644
  1 +package com.bsth.util;
  2 +
  3 +import java.math.BigDecimal;
  4 +
  5 +/**
  6 + * 进行BigDecimal对象的加减乘除,四舍五入等运算的工具类
  7 + * @author ameyume
  8 + *
  9 + */
  10 +public class Arith {
  11 +
  12 + /**
  13 + * 由于Java的简单类型不能够精确的对浮点数进行运算,这个工具类提供精
  14 + * 确的浮点数运算,包括加减乘除和四舍五入。
  15 + */
  16 + //默认除法运算精度
  17 + private static final int DEF_DIV_SCALE = 10;
  18 +
  19 + //这个类不能实例化
  20 + private Arith(){
  21 + }
  22 +
  23 + /**
  24 + * 提供精确的加法运算。
  25 + * @param v1 被加数
  26 + * @param v2 加数
  27 + * @return 两个参数的和
  28 + */
  29 + public static double add(Object v1,Object v2){
  30 + BigDecimal b1 = new BigDecimal(String.valueOf(v1));
  31 + BigDecimal b2 = new BigDecimal(String.valueOf(v2));
  32 + return b1.add(b2).doubleValue();
  33 + }
  34 +
  35 + /**
  36 + * 提供精确的减法运算。
  37 + * @param v1 被减数
  38 + * @param v2 减数
  39 + * @return 两个参数的差
  40 + */
  41 + public static double sub(Object v1,Object v2){
  42 + BigDecimal b1 = new BigDecimal(String.valueOf(v1));
  43 + BigDecimal b2 = new BigDecimal(String.valueOf(v2));
  44 + return b1.subtract(b2).doubleValue();
  45 + }
  46 +
  47 + /**
  48 + * 提供精确的乘法运算。
  49 + * @param v1 被乘数
  50 + * @param v2 乘数
  51 + * @return 两个参数的积
  52 + */
  53 + public static double mul(Object v1,Object v2){
  54 + BigDecimal b1 = new BigDecimal(String.valueOf(v1));
  55 + BigDecimal b2 = new BigDecimal(String.valueOf(v2));
  56 + return b1.multiply(b2).doubleValue();
  57 + }
  58 +
  59 + /**
  60 + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
  61 + * 小数点以后10位,以后的数字四舍五入。
  62 + * @param v1 被除数
  63 + * @param v2 除数
  64 + * @return 两个参数的商
  65 + */
  66 + public static double div(Object v1,Object v2){
  67 + return div(v1,v2,DEF_DIV_SCALE);
  68 + }
  69 +
  70 + /**
  71 + * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
  72 + * 定精度,以后的数字四舍五入。
  73 + * @param v1 被除数
  74 + * @param v2 除数
  75 + * @param scale 表示表示需要精确到小数点以后几位。
  76 + * @return 两个参数的商
  77 + */
  78 + public static double div(Object v1,Object v2,int scale){
  79 + if(scale<0){
  80 + throw new IllegalArgumentException(
  81 + "The scale must be a positive integer or zero");
  82 + }
  83 + BigDecimal b1 = new BigDecimal(String.valueOf(v1));
  84 + BigDecimal b2 = new BigDecimal(String.valueOf(v2));
  85 + return b1.divide(b2,scale,BigDecimal.ROUND_HALF_UP).doubleValue();
  86 + }
  87 +
  88 + /**
  89 + * 提供精确的小数位四舍五入处理。
  90 + * @param v 需要四舍五入的数字
  91 + * @param scale 小数点后保留几位
  92 + * @return 四舍五入后的结果
  93 + */
  94 + public static double round(Object v,int scale){
  95 + if(scale<0){
  96 + throw new IllegalArgumentException(
  97 + "The scale must be a positive integer or zero");
  98 + }
  99 + BigDecimal b = new BigDecimal(String.valueOf(v));
  100 + BigDecimal one = new BigDecimal("1");
  101 + return b.divide(one,scale,BigDecimal.ROUND_HALF_UP).doubleValue();
  102 + }
  103 +
  104 + /**
  105 + * 提供精确的类型转换(Float)
  106 + * @param v 需要被转换的数字
  107 + * @return 返回转换结果
  108 + */
  109 + public static float convertsToFloat(double v){
  110 + BigDecimal b = new BigDecimal(v);
  111 + return b.floatValue();
  112 + }
  113 +
  114 + /**
  115 + * 提供精确的类型转换(Int)不进行四舍五入
  116 + * @param v 需要被转换的数字
  117 + * @return 返回转换结果
  118 + */
  119 + public static int convertsToInt(double v){
  120 + BigDecimal b = new BigDecimal(v);
  121 + return b.intValue();
  122 + }
  123 +
  124 + /**
  125 + * 提供精确的类型转换(Long)
  126 + * @param v 需要被转换的数字
  127 + * @return 返回转换结果
  128 + */
  129 + public static long convertsToLong(double v){
  130 + BigDecimal b = new BigDecimal(v);
  131 + return b.longValue();
  132 + }
  133 +
  134 + /**
  135 + * 返回两个数中大的一个值
  136 + * @param v1 需要被对比的第一个数
  137 + * @param v2 需要被对比的第二个数
  138 + * @return 返回两个数中大的一个值
  139 + */
  140 + public static double returnMax(double v1,double v2){
  141 + BigDecimal b1 = new BigDecimal(v1);
  142 + BigDecimal b2 = new BigDecimal(v2);
  143 + return b1.max(b2).doubleValue();
  144 + }
  145 +
  146 + /**
  147 + * 返回两个数中小的一个值
  148 + * @param v1 需要被对比的第一个数
  149 + * @param v2 需要被对比的第二个数
  150 + * @return 返回两个数中小的一个值
  151 + */
  152 + public static double returnMin(double v1,double v2){
  153 + BigDecimal b1 = new BigDecimal(v1);
  154 + BigDecimal b2 = new BigDecimal(v2);
  155 + return b1.min(b2).doubleValue();
  156 + }
  157 +
  158 + /**
  159 + * 精确对比两个数字
  160 + * @param v1 需要被对比的第一个数
  161 + * @param v2 需要被对比的第二个数
  162 + * @return 如果两个数一样则返回0,如果第一个数比第二个数大则返回1,反之返回-1
  163 + */
  164 + public static int compareTo(double v1,double v2){
  165 + BigDecimal b1 = new BigDecimal(v1);
  166 + BigDecimal b2 = new BigDecimal(v2);
  167 + return b1.compareTo(b2);
  168 + }
  169 +
  170 +}
0 \ No newline at end of file 171 \ No newline at end of file
src/main/java/com/bsth/util/ConfigUtil.java 0 → 100644
  1 +package com.bsth.util;
  2 +
  3 +public class ConfigUtil {
  4 +
  5 + static Tools tools;
  6 +
  7 + static{
  8 + tools = new Tools("application.properties");
  9 + String active = tools.getValue("spring.profiles.active");
  10 + tools = new Tools("application-"+active+".properties");
  11 + }
  12 +
  13 + public static String get(String key){
  14 + return tools.getValue(key);
  15 + }
  16 +}
src/main/java/com/bsth/util/ConvertUtil.java 0 → 100644
  1 +package com.bsth.util;
  2 +
  3 +import com.google.common.collect.ArrayListMultimap;
  4 +import org.joda.time.format.DateTimeFormat;
  5 +import org.joda.time.format.DateTimeFormatter;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +
  9 +import java.lang.reflect.Field;
  10 +import java.util.*;
  11 +
  12 +/**
  13 + * 数据转换
  14 + * Created by panzhao on 2017/3/13.
  15 + */
  16 +public class ConvertUtil<T> {
  17 +
  18 + Logger logger = LoggerFactory.getLogger(this.getClass());
  19 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyyMMdd");
  20 +
  21 + /**
  22 + * 根据指定字段 将 list 分组
  23 + *
  24 + * @param list
  25 + * @param separator 字段使用分隔符连接 组成key
  26 + * @param fields
  27 + * @return
  28 + */
  29 + public ArrayListMultimap<String, T> groupMultiList(List<T> list, String separator, Field... fields) {
  30 + ArrayListMultimap<String, T> multimap = ArrayListMultimap.create();
  31 +
  32 + String key;
  33 + //Object field;
  34 + try {
  35 + for (T t : list) {
  36 +
  37 + key = "";
  38 + for (Field f : fields) {
  39 + f.setAccessible(true);
  40 + //日期类型格式化为 YYYY-MM-DD
  41 + if (f.getType().equals(Date.class))
  42 + key += (separator + fmtyyyyMMdd.print(((Date) f.get(t)).getTime()));
  43 + else
  44 + key += (separator + f.get(t).toString());
  45 + }
  46 + key = key.substring(1);
  47 +
  48 + multimap.put(key, t);
  49 + }
  50 + } catch (Exception e) {
  51 + logger.error("", e);
  52 + }
  53 +
  54 + return multimap;
  55 + }
  56 +
  57 + /**
  58 + * 根据指定字段 将 list 分组
  59 + *
  60 + * @param list
  61 + * @param separator 字段使用分隔符连接 组成key
  62 + * @param fields
  63 + * @return
  64 + */
  65 + public Map<String, T> groupList(List<T> list, String separator, Field... fields) {
  66 + Map<String, T> map = new HashMap<>();
  67 +
  68 + String key;
  69 + //Object field;
  70 + try {
  71 + for (T t : list) {
  72 +
  73 + key = "";
  74 + for (Field f : fields) {
  75 + f.setAccessible(true);
  76 + //日期类型格式化为 YYYY-MM-DD
  77 + if (f.getType().equals(Date.class))
  78 + key += (separator + fmtyyyyMMdd.print(((Date) f.get(t)).getTime()));
  79 + else
  80 + key += (separator + f.get(t).toString());
  81 + }
  82 + key = key.substring(1);
  83 +
  84 + map.put(key, t);
  85 + }
  86 + } catch (Exception e) {
  87 + logger.error("", e);
  88 + }
  89 +
  90 + return map;
  91 + }
  92 +
  93 + /**
  94 + * 计算并集
  95 + *
  96 + * @param all
  97 + * @param sub
  98 + * @return
  99 + */
  100 + public List<String> calcUnion(Collection<String> all, Collection<String> sub) {
  101 + List<String> rs = new ArrayList<>();
  102 +
  103 + for (String str : all) {
  104 + if (sub.contains(str))
  105 + rs.add(str);
  106 + }
  107 + return rs;
  108 + }
  109 +
  110 + /**
  111 + * 计算补集
  112 + *
  113 + * @param all
  114 + * @param sub
  115 + * @return
  116 + */
  117 + public List<String> calcComplement(Collection<String> all, Collection<String> sub) {
  118 + List<String> rs = new ArrayList<>();
  119 +
  120 + for (String str : all) {
  121 + if (!sub.contains(str))
  122 + rs.add(str);
  123 + }
  124 + return rs;
  125 + }
  126 +}
src/main/java/com/bsth/util/Tools.java 0 → 100644
  1 +package com.bsth.util;
  2 +
  3 +import java.io.IOException;
  4 +import java.util.Properties;
  5 +
  6 +public class Tools {
  7 + private static Properties p = new Properties();
  8 + private static String f;
  9 + public Tools(String file){
  10 + f = file;
  11 + try {
  12 + p.load(Tools.class.getClassLoader().getResourceAsStream(f));
  13 + } catch (IOException e) {
  14 + e.printStackTrace();
  15 + }
  16 + }
  17 +
  18 + /**
  19 + * 根据key得到value的值
  20 + */
  21 + public String getValue(String key)
  22 + {
  23 + return p.getProperty(key);
  24 + }
  25 +}
src/main/resources/application-dev.properties 0 → 100644
  1 +server.port=9089
  2 +management.port= 9001
  3 +management.address= 127.0.0.1
  4 +
  5 +spring.jpa.hibernate.ddl-auto= none
  6 +spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
  7 +#DATABASE
  8 +spring.jpa.database= MYSQL
  9 +spring.jpa.show-sql= true
  10 +spring.datasource.driver-class-name= com.mysql.jdbc.Driver
  11 +spring.datasource.url= jdbc:mysql://127.0.0.1/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false
  12 +spring.datasource.username= root
  13 +spring.datasource.password= root
  14 +#DATASOURCE
  15 +spring.datasource.max-active=100
  16 +spring.datasource.max-idle=8
  17 +spring.datasource.min-idle=8
  18 +spring.datasource.initial-size=5
  19 +
  20 +spring.datasource.test-on-borrow=true
  21 +spring.datasource.test-on-connect=true
  22 +spring.datasource.test-on-return=true
  23 +spring.datasource.test-while-idle=true
  24 +spring.datasource.validation-query=select 1
  25 +
  26 +## calculator result database
  27 +#calculator.datasource.driver= com.mysql.jdbc.Driver
  28 +#calculator.datasource.url= jdbc:mysql://127.0.0.1/calculator?useUnicode=true&characterEncoding=utf-8&useSSL=false
  29 +#calculator.datasource.username= root
  30 +#calculator.datasource.password= panzhao
src/main/resources/application-prod.properties 0 → 100644
  1 +server.port=9099
  2 +management.port= 9001
  3 +management.address= 127.0.0.1
  4 +
  5 +spring.jpa.hibernate.ddl-auto= none
  6 +spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
  7 +#DATABASE
  8 +spring.jpa.database= MYSQL
  9 +spring.jpa.show-sql= false
  10 +spring.datasource.driver-class-name= com.mysql.jdbc.Driver
  11 +spring.datasource.url= jdbc:mysql://10.10.150.20:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
  12 +spring.datasource.username= root
  13 +spring.datasource.password= root2jsp@JSP
  14 +#DATASOURCE
  15 +spring.datasource.max-active=50
  16 +spring.datasource.max-idle=8
  17 +spring.datasource.min-idle=8
  18 +spring.datasource.initial-size=3
  19 +
  20 +spring.datasource.test-on-borrow=true
  21 +spring.datasource.test-on-connect=true
  22 +spring.datasource.test-on-return=true
  23 +spring.datasource.test-while-idle=true
  24 +spring.datasource.validation-query=select 1
0 \ No newline at end of file 25 \ No newline at end of file
src/main/resources/application.properties 0 → 100644
  1 +spring.profiles: dev,prod
  2 +spring.profiles.active: dev
  3 +
  4 +spring.view.suffix=.html
  5 +server.session-timeout=-1
  6 +security.basic.enabled=false
  7 +
  8 +# \u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u9650\u5236\u914D\u7F6E
  9 +# File size limit
  10 +multipart.maxFileSize = -1
  11 +# Total request size for a multipart/form-data
  12 +multipart.maxRequestSize = -1
  13 +
  14 +server.compression.enabled=true
  15 +server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript
  16 +
  17 +#redis »º´æ¶àÉÙÌìµÄÊý¾Ý
  18 +cache.days=60
src/main/resources/banner.txt 0 → 100644
  1 + ____ _____ _______ _ _
  2 + | _ \ / ____| |__ __| | | | |
  3 + | |_) | | (___ | | | |__| |
  4 + | _ < \___ \ | | | __ |
  5 + | |_) | ____) | | | | | | |
  6 + |____/ |_____/ |_| |_| |_|
  7 +
  8 +Running Spring Boot ${spring-boot.version}
0 \ No newline at end of file 9 \ No newline at end of file
src/main/resources/init.sql 0 → 100644
  1 +CREATE TABLE `bsth_control_r_hoursjsy` (
  2 + `id` bigint(11) NOT NULL AUTO_INCREMENT,
  3 + `company_id` varchar(20) DEFAULT NULL,
  4 + `sub_company_id` varchar(20) DEFAULT NULL,
  5 + `line_code` varchar(100) DEFAULT NULL,
  6 + `line_name` varchar(100) DEFAULT NULL,
  7 + `jsy` varchar(100) DEFAULT NULL,
  8 + `jsy_name` varchar(100) DEFAULT NULL,
  9 + `nbbm` varchar(100) DEFAULT NULL,
  10 + `lp_name` varchar(20) DEFAULT NULL,
  11 + `rq` varchar(100) DEFAULT NULL,
  12 + `hours_jh` float(10,0) DEFAULT NULL,
  13 + `hours_sj` float(10,0) DEFAULT NULL,
  14 + `fb_status` int(11) DEFAULT NULL,
  15 + `source` int(11) DEFAULT NULL,
  16 + `remarks` varchar(4000) DEFAULT NULL,
  17 + PRIMARY KEY (`id`)
  18 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
0 \ No newline at end of file 19 \ No newline at end of file
src/main/resources/logback.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd"> -->
  3 +<configuration>
  4 +
  5 + <!-- <property resource="application.properties" /> -->
  6 + <property name="LOG_BASE" value="E:/calc_log" />
  7 + <!-- 控制台输出 -->
  8 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  9 +
  10 + <layout class="ch.qos.logback.classic.PatternLayout">
  11 + <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
  12 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%file:%line]
  13 + %-5level-%msg%n
  14 + </pattern>
  15 + </layout>
  16 + </appender>
  17 +
  18 + <!-- 主日志文件 -->
  19 + <appender name="FILE"
  20 + class="ch.qos.logback.core.rolling.RollingFileAppender">
  21 + <file>${LOG_BASE}/calc_log.log</file>
  22 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  23 + <fileNamePattern>${LOG_BASE}/calc_log-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  24 + <timeBasedFileNamingAndTriggeringPolicy
  25 + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  26 + <maxFileSize>100MB</maxFileSize>
  27 + </timeBasedFileNamingAndTriggeringPolicy>
  28 + </rollingPolicy>
  29 + <encoder>
  30 + <pattern>%msg%n</pattern>
  31 + </encoder>
  32 +
  33 + <layout class="ch.qos.logback.classic.PatternLayout">
  34 + <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
  35 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%file:%line]
  36 + %-5level-%msg%n
  37 + </pattern>
  38 + </layout>
  39 + </appender>
  40 +
  41 +
  42 + <!-- 日志输出级别 -->
  43 + <root level="info">
  44 + <appender-ref ref="STDOUT" />
  45 + <appender-ref ref="FILE" />
  46 + </root>
  47 +</configuration>
0 \ No newline at end of file 48 \ No newline at end of file