Commit e299998a135cbe4523055fbc0cbcdb806663b438

Authored by yiming
1 parent a2b0ab8c

准点率接口

src/main/java/com/bsth/common/Constants.java
... ... @@ -48,6 +48,7 @@ public class Constants {
48 48 public static final String OUT_URL = "/out/**";
49 49 public static final String DIFYINTER_URL = "/difyinter/**";
50 50 public static final String NOTICE_URL = "/notice/**";
  51 + public static final String JDDZX_URL = "/jddzx/**";
51 52 /**
52 53 * 解除调度指令和班次的外键约束
53 54 */
... ...
src/main/java/com/bsth/data/jddzx/JDInterface.java 0 → 100644
  1 +package com.bsth.data.jddzx;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  5 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  7 +import com.bsth.service.report.CulateMileageService;
  8 +import com.bsth.util.Arith;
  9 +import com.bsth.util.SignUtils;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.jdbc.core.JdbcTemplate;
  14 +import org.springframework.web.bind.annotation.*;
  15 +
  16 +import java.math.BigDecimal;
  17 +import java.util.*;
  18 +import java.util.stream.Collectors;
  19 +
  20 +/**
  21 + * 嘉定定制线对外接口
  22 + */
  23 +@RestController
  24 +@RequestMapping("/jddzx")
  25 +public class JDInterface {
  26 +
  27 + Logger logger = LoggerFactory.getLogger(this.getClass());
  28 +
  29 + @Autowired
  30 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  31 +
  32 + @Autowired
  33 + CulateMileageService culateService;
  34 +
  35 + @Autowired
  36 + JdbcTemplate jdbcTemplate;
  37 +
  38 +
  39 + @RequestMapping(value = "/zdl", method = RequestMethod.POST)
  40 + public Map OutCarOutCar(@RequestBody Map<String,Object> params) {
  41 + Map rtn = new HashMap<>();
  42 + try {
  43 + logger.info("嘉定定制线准点率接口调用----");
  44 + if(!SignUtils.validation(Long.parseLong(params.get("timestamp").toString()),params.get("sign").toString())){
  45 + rtn.put("status",ResponseCode.NO_AUTHENTICATION);
  46 + return rtn;
  47 + }
  48 + String date=params.get("date").toString();//yyyy-MM-dd
  49 + String lineCode=params.get("lineCode").toString();
  50 + List<ScheduleRealInfo> schList=scheduleRealInfoRepository.scheduleDaily(lineCode, date);
  51 + //去除空驶 临加 子任务产生的主任务
  52 + List<ScheduleRealInfo> list=schList.stream().filter((sch) -> !sch.getBcType().equals("out") && !sch.getBcType().equals("in") && !sch.getBcType().equals("venting")
  53 + && !sch.getBcType().equals("ldks") && !sch.isSflj() && !sch.isCcService()).collect(Collectors.toList());
  54 + //按上下行分组并排序
  55 + Map<String,List<ScheduleRealInfo>> xlDir=list.stream().collect(Collectors.groupingBy(ScheduleRealInfo::getXlDir));
  56 + List<ScheduleRealInfo> up = xlDir.get("0");
  57 + up.sort(Comparator.comparing(sch->sch.getFcsj()));
  58 + List<ScheduleRealInfo> down = xlDir.get("1");
  59 + down.sort(Comparator.comparing(sch->sch.getFcsj()));
  60 +
  61 + Map<String,Object> data=new HashMap<>();
  62 +
  63 + //起讫站发车准点率
  64 + Map<String,Object> qqzzdl=new HashMap<>();
  65 + qqzzdl.put("up",culateService.culateFczdl(up,""));
  66 + qqzzdl.put("down",culateService.culateFczdl(down,""));
  67 + data.put("qqzzdl",qqzzdl);
  68 +
  69 + //首末班车发车准点率
  70 + List<ScheduleRealInfo> smb_up=new ArrayList<>();
  71 + if(up.size()>1){
  72 + smb_up.add(up.get(0));
  73 + }
  74 + if(up.size()>2){
  75 + smb_up.add(up.get(1));
  76 + }
  77 + List<ScheduleRealInfo> smb_down=new ArrayList<>();
  78 + if(down.size()>1){
  79 + smb_down.add(down.get(0));
  80 + }
  81 + if(down.size()>2){
  82 + smb_down.add(down.get(1));
  83 + }
  84 + Map<String,Object> smbzdl=new HashMap<>();
  85 + smbzdl.put("up",culateService.culateFczdl(smb_up,""));
  86 + smbzdl.put("down",culateService.culateFczdl(smb_down,""));
  87 + data.put("smbzdl",smbzdl);
  88 +
  89 + //平均车速
  90 + Map<String,Object> pjcs=new HashMap<>();
  91 + pjcs.put("up_z",culateService.culatePjcs(up,"zgf"));
  92 + pjcs.put("up_w",culateService.culatePjcs(up,"wgf"));
  93 + pjcs.put("up_q",culateService.culatePjcs(up,""));
  94 + pjcs.put("down_z",culateService.culatePjcs(down,"zgf"));
  95 + pjcs.put("down_w",culateService.culatePjcs(down,"wgf"));
  96 + pjcs.put("down_q",culateService.culatePjcs(down,""));
  97 + data.put("pjcs",pjcs);
  98 +
  99 + //人员投入
  100 + int jhrytl=culateService.culateJhry(schList,"");
  101 + int sjrytl=culateService.culateSjry(schList,"");
  102 + BigDecimal rytl=BigDecimal.valueOf(100);
  103 + if(jhrytl>0){
  104 + rytl=BigDecimal.valueOf((double)sjrytl/jhrytl*100);
  105 + }
  106 + data.put("rytl",rytl.setScale(2,BigDecimal.ROUND_HALF_UP));
  107 +
  108 + //车辆投入
  109 + Map<String,Object> cltl=new HashMap<>();
  110 + int jh_z=culateService.culateJhcl(schList,"zgf");
  111 + int sj_z=culateService.culateSjcl(schList,"zgf");
  112 + BigDecimal cltl_z=BigDecimal.valueOf(100);
  113 + if(jh_z>0){
  114 + cltl_z=BigDecimal.valueOf((double)sj_z/jh_z*100);
  115 + }
  116 + cltl.put("cltl_z",cltl_z.setScale(2,BigDecimal.ROUND_HALF_UP));
  117 +
  118 + int jh_w=culateService.culateJhcl(schList,"wgf");
  119 + int sj_w=culateService.culateSjcl(schList,"wgf");
  120 + BigDecimal cltl_w=BigDecimal.valueOf(100);
  121 + if(jh_w>0){
  122 + cltl_w=BigDecimal.valueOf((double)sj_w/jh_w*100);
  123 + }
  124 + cltl.put("cltl_w",cltl_w.setScale(2,BigDecimal.ROUND_HALF_UP));
  125 +
  126 + int jh_q=culateService.culateJhcl(schList,"");
  127 + int sj_q=culateService.culateSjcl(schList,"");
  128 + BigDecimal cltl_q=BigDecimal.valueOf(100);
  129 + if(jh_q>0){
  130 + cltl_q=BigDecimal.valueOf((double)sj_q/jh_q*100);
  131 + }
  132 + cltl.put("cltl_q",cltl_q.setScale(2,BigDecimal.ROUND_HALF_UP));
  133 +
  134 + data.put("cltl",cltl);
  135 +
  136 + //班次投入
  137 + Map<String,Object> bctl=new HashMap<>();
  138 + int jhbctl_z=culateService.culateJhbc(schList,"zgf");
  139 + int sjbctl_z=culateService.culateSjbc(schList, "zgf") + culateService.culateLjbc(schList, "zgf");
  140 + BigDecimal bctl_z=BigDecimal.valueOf(100);
  141 + if(jhbctl_z>0){
  142 + bctl_z=BigDecimal.valueOf((double)sjbctl_z/jhbctl_z*100);
  143 + }
  144 + bctl.put("bctl_z",bctl_z.setScale(2,BigDecimal.ROUND_HALF_UP));
  145 +
  146 + int jhbctl_w=culateService.culateJhbc(schList,"wgf");
  147 + int sjbctl_w=culateService.culateSjbc(schList, "wgf") + culateService.culateLjbc(schList, "wgf");
  148 + BigDecimal bctl_w=BigDecimal.valueOf(100);
  149 + if(jhbctl_w>0){
  150 + bctl_w=BigDecimal.valueOf((double)sjbctl_w/jhbctl_w*100);
  151 + }
  152 + bctl.put("bctl_w",bctl_w.setScale(2,BigDecimal.ROUND_HALF_UP));
  153 +
  154 + int jhbctl_q=culateService.culateJhbc(schList,"");
  155 + int sjbctl_q=culateService.culateSjbc(schList, "") + culateService.culateLjbc(schList, "");
  156 + BigDecimal bctl_q=BigDecimal.valueOf(100);
  157 + if(jhbctl_q>0){
  158 + bctl_q=BigDecimal.valueOf((double)sjbctl_q/jhbctl_q*100);
  159 + }
  160 + bctl.put("bctl_q",bctl_q.setScale(2,BigDecimal.ROUND_HALF_UP));
  161 +
  162 + data.put("bctl",bctl);
  163 +
  164 + //公里投入
  165 + List<ScheduleRealInfo> lists = new ArrayList<>();
  166 + for (int i = 0; i < schList.size(); i++) {
  167 + ScheduleRealInfo s = schList.get(i);
  168 + Set<ChildTaskPlan> cts = s.getcTasks();
  169 + if (cts != null && cts.size() > 0) {
  170 + lists.add(s);
  171 + } else {
  172 + if (s.getFcsjActual() != null && s.getZdsjActual() != null) {
  173 + lists.add(s);
  174 + }
  175 + }
  176 + }
  177 + double ksgl = culateService.culateKsgl(list);//子任务空驶公里
  178 + double jccgl = culateService.culateJccgl(lists);//空驶班次公里
  179 + double sjgl = culateService.culateSjgl(lists);//实际营运公里
  180 + double ljgl = culateService.culateLjgl(lists);//临加公里
  181 + Map<String,Object> gltl=new HashMap<>();
  182 + gltl.put("sj",Arith.add(Arith.add(ksgl, jccgl), Arith.add(sjgl, ljgl)));//实际总公里
  183 + gltl.put("jh",Arith.add(culateService.culateJhgl(list), culateService.culateJhJccgl(list))); //计划总里程
  184 + data.put("gltl",gltl);
  185 +
  186 + rtn.put("data",data);
  187 + rtn.put("status",ResponseCode.SUCCESS);
  188 + } catch (Exception e) {
  189 + rtn.put("status", ResponseCode.ERROR);
  190 + logger.error("",e);
  191 + }
  192 + return rtn;
  193 + }
  194 +
  195 +
  196 +}
... ...
src/main/java/com/bsth/filter/BaseFilter.java
... ... @@ -20,7 +20,7 @@ public abstract class BaseFilter implements Filter {
20 20 Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, Constants.LOGIN_FAILURE,
21 21 Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL,
22 22 Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL,
23   - Constants.FILE_AUTH,Constants.OUT_URL,Constants.NOTICE_URL,Constants.DIFYINTER_URL};
  23 + Constants.FILE_AUTH,Constants.OUT_URL,Constants.NOTICE_URL,Constants.DIFYINTER_URL,Constants.JDDZX_URL};
24 24  
25 25 @Override
26 26 public void destroy() {
... ...
src/main/java/com/bsth/security/WebSecurityConfig.java
... ... @@ -39,7 +39,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
39 39 // 白名单
40 40 web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ORIGINAL_LOGIN_PAGE, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,
41 41 Constants.SERVICE_INTERFACE, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES,
42   - Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.FILE_AUTH,Constants.OUT_URL,Constants.NOTICE_URL,Constants.DIFYINTER_URL);
  42 + Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.FILE_AUTH,Constants.OUT_URL,Constants.NOTICE_URL,Constants.DIFYINTER_URL,Constants.JDDZX_URL);
43 43 }
44 44  
45 45 @Override
... ...
src/main/java/com/bsth/security/filter/LoginInterceptor.java
... ... @@ -35,7 +35,7 @@ public class LoginInterceptor implements Filter {
35 35 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.ORIGINAL_LOGIN_PAGE, Constants.SERVICE_INTERFACE,
36 36 Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN,
37 37 Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,
38   - Constants.STATION_AND_SECTION_COUNT, Constants.VEHICLE_DATA_SYNC_URL, Constants.FILE_AUTH ,Constants.OUT_URL,Constants.NOTICE_URL,Constants.DIFYINTER_URL};
  38 + Constants.STATION_AND_SECTION_COUNT, Constants.VEHICLE_DATA_SYNC_URL, Constants.FILE_AUTH ,Constants.OUT_URL,Constants.NOTICE_URL,Constants.DIFYINTER_URL,Constants.JDDZX_URL};
39 39  
40 40  
41 41 @Override
... ...
src/main/java/com/bsth/service/report/CulateMileageService.java
... ... @@ -63,7 +63,20 @@ public interface CulateMileageService {
63 63 double culateZrwJccLc(List<ScheduleRealInfo> lists,String item);//子任务进出场
64 64  
65 65 double culateKfksLc(List<ScheduleRealInfo> lists);
66   -
  66 +
  67 + double culateFczdl(List<ScheduleRealInfo> lists,String item);//起讫站发车准点率
  68 +
  69 + double culatePjcs(List<ScheduleRealInfo> lists,String item);//平均车速
  70 +
  71 + int culateJhry(List<ScheduleRealInfo> lists,String item);//计划人员投入
  72 +
  73 + int culateJhcl(List<ScheduleRealInfo> lists,String item);//计划车辆投入
  74 +
  75 + int culateSjry(List<ScheduleRealInfo> lists,String item);//实际人员投入
  76 +
  77 + int culateSjcl(List<ScheduleRealInfo> lists,String item);//实际车辆投入
  78 +
  79 +
67 80  
68 81 }
69 82  
... ...
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
... ... @@ -2058,5 +2058,299 @@ public class CulateMileageServiceImpl implements CulateMileageService{
2058 2058 }
2059 2059 return ljks;
2060 2060 }
2061   -
  2061 +
  2062 + @Override
  2063 + public double culateFczdl(List<ScheduleRealInfo> lists,String item) {
  2064 + // TODO Auto-generated method stub
  2065 + BigDecimal zdl=BigDecimal.valueOf(100);
  2066 + if(lists.size()==0) {
  2067 + return zdl.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
  2068 + }
  2069 + int zd=0;
  2070 + for (int i = 0; i < lists.size(); i++) {
  2071 + ScheduleRealInfo scheduleRealInfo=lists.get(i);
  2072 + if (!isInOut(scheduleRealInfo)) {
  2073 + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService() && scheduleRealInfo.getFcsjActual()!=null){
  2074 + String[] fcsjStr = scheduleRealInfo.getFcsj().split(":");
  2075 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  2076 + String[] fcsjActualStr = scheduleRealInfo.getFcsjActual().split(":");
  2077 + long fcsjActual= Long.parseLong(fcsjActualStr[0])*60+Long.parseLong(fcsjActualStr[1]);
  2078 + if(item.equals("zgf")){
  2079 + if(fcsj>=zgf1 && fcsj<=zgf2){
  2080 + if(fcsjActual-fcsj>=-1 && fcsjActual-fcsj<=3){
  2081 + zd++;
  2082 + }
  2083 + }
  2084 + }else if(item.equals("wgf")){
  2085 + if(fcsj>=wgf1 && fcsj<=wgf2){
  2086 + if(fcsjActual-fcsj>=-1 && fcsjActual-fcsj<=3){
  2087 + zd++;
  2088 + }
  2089 + }
  2090 + }else{
  2091 + if(fcsjActual-fcsj>=-1 && fcsjActual-fcsj<=3){
  2092 + zd++;
  2093 + }
  2094 + }
  2095 +
  2096 + }
  2097 + }
  2098 + }
  2099 + zdl=BigDecimal.valueOf((double)zd/lists.size()*100).setScale(2,BigDecimal.ROUND_HALF_UP);
  2100 + return zdl.doubleValue();
  2101 + }
  2102 +
  2103 + @Override
  2104 + public double culatePjcs(List<ScheduleRealInfo> lists,String item) {
  2105 + // TODO Auto-generated method stub
  2106 + double lc=0;
  2107 + int sj=0;
  2108 +
  2109 + BigDecimal pjcs=BigDecimal.valueOf(0);
  2110 + if(lists.size()==0) {
  2111 + return pjcs.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
  2112 + }
  2113 + int zd=0;
  2114 + for (int i = 0; i < lists.size(); i++) {
  2115 + ScheduleRealInfo scheduleRealInfo=lists.get(i);
  2116 + if (!isInOut(scheduleRealInfo)) {
  2117 + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService() && scheduleRealInfo.getFcsjActual()!=null && scheduleRealInfo.getZdsjActual()!=null){
  2118 + String[] fcsjActualStr = scheduleRealInfo.getFcsjActual().split(":");
  2119 + long fcsjActual= Long.parseLong(fcsjActualStr[0])*60+Long.parseLong(fcsjActualStr[1]);
  2120 + String[] zdsjActualStr = scheduleRealInfo.getZdsjActual().split(":");
  2121 + long zdsjActual= Long.parseLong(zdsjActualStr[0])*60+Long.parseLong(zdsjActualStr[1]);
  2122 + if(zdsjActual-fcsjActual<0){
  2123 + System.out.println(1);
  2124 + }
  2125 + if(item.equals("zgf")){
  2126 + if(fcsjActual>=zgf1 && fcsjActual<=zgf2){
  2127 + sj+=(zdsjActual-fcsjActual)<0?(zdsjActual-fcsjActual+60*24):(zdsjActual-fcsjActual);
  2128 + lc+=scheduleRealInfo.getJhlc();
  2129 + }
  2130 + }else if(item.equals("wgf")){
  2131 + if(fcsjActual>=wgf1 && fcsjActual<=wgf2){
  2132 + sj+=(zdsjActual-fcsjActual)<0?(zdsjActual-fcsjActual+60*24):(zdsjActual-fcsjActual);
  2133 + lc+=scheduleRealInfo.getJhlc();
  2134 + }
  2135 + }else{
  2136 + System.out.println((zdsjActual-fcsjActual)<0?(zdsjActual-fcsjActual+60*24):(zdsjActual-fcsjActual));
  2137 + sj+=(zdsjActual-fcsjActual)<0?(zdsjActual-fcsjActual+60*24):(zdsjActual-fcsjActual);
  2138 + lc+=scheduleRealInfo.getJhlc();
  2139 + }
  2140 +
  2141 + }
  2142 + }
  2143 + }
  2144 + pjcs=BigDecimal.valueOf(lc/sj*60).setScale(2,BigDecimal.ROUND_HALF_UP);
  2145 + return pjcs.doubleValue();
  2146 + }
  2147 +
  2148 + @Override
  2149 + public int culateJhry(List<ScheduleRealInfo> lists,String item) {
  2150 + // TODO Auto-generated method stub
  2151 + Set<String> jhry=new HashSet<>();
  2152 + for (int i = 0; i < lists.size(); i++) {
  2153 + ScheduleRealInfo scheduleRealInfo=lists.get(i);
  2154 + if (!isInOut(scheduleRealInfo)) {
  2155 + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService()){
  2156 + String[] fcsjStr = scheduleRealInfo.getFcsj().split(":");
  2157 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  2158 + if(item.equals("zgf")){
  2159 + if(fcsj>=zgf1 && fcsj<=zgf2){
  2160 + jhry.add(scheduleRealInfo.getjGh());
  2161 + }
  2162 + }else if(item.equals("wgf")){
  2163 + if(fcsj>=wgf1 && fcsj<=wgf2){
  2164 + jhry.add(scheduleRealInfo.getjGh());
  2165 + }
  2166 + }else{
  2167 + jhry.add(scheduleRealInfo.getjGh());
  2168 + }
  2169 +
  2170 + }
  2171 + }
  2172 + }
  2173 + return jhry.size();
  2174 + }
  2175 +
  2176 + @Override
  2177 + public int culateJhcl(List<ScheduleRealInfo> lists,String item) {
  2178 + // TODO Auto-generated method stub
  2179 + Set<String> jhcl=new HashSet<>();
  2180 + for (int i = 0; i < lists.size(); i++) {
  2181 + ScheduleRealInfo scheduleRealInfo=lists.get(i);
  2182 + if (!isInOut(scheduleRealInfo)) {
  2183 + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService()){
  2184 + String[] fcsjStr = scheduleRealInfo.getFcsj().split(":");
  2185 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  2186 + if(item.equals("zgf")){
  2187 + if(fcsj>=zgf1 && fcsj<=zgf2){
  2188 + jhcl.add(scheduleRealInfo.getClZbh());
  2189 + }
  2190 + }else if(item.equals("wgf")){
  2191 + if(fcsj>=wgf1 && fcsj<=wgf2){
  2192 + jhcl.add(scheduleRealInfo.getClZbh());
  2193 + }
  2194 + }else{
  2195 + jhcl.add(scheduleRealInfo.getClZbh());
  2196 + }
  2197 +
  2198 + }
  2199 + }
  2200 + }
  2201 + return jhcl.size();
  2202 + }
  2203 +
  2204 + @Override
  2205 + public int culateSjry(List<ScheduleRealInfo> lists,String item) {
  2206 + // TODO Auto-generated method stub
  2207 + Set<String> jhry=new HashSet<>();
  2208 + for (int i = 0; i < lists.size(); i++) {
  2209 + ScheduleRealInfo scheduleRealInfo=lists.get(i);
  2210 + if (!isInOut(scheduleRealInfo)) {
  2211 + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService()){
  2212 + String time="";
  2213 + if(item.equals("zgf") || item.equals("wgf")){
  2214 + if(scheduleRealInfo.getFcsjActual()!=null){
  2215 + time=scheduleRealInfo.getFcsjActual();
  2216 + }
  2217 + if(time.equals("")){
  2218 + if(scheduleRealInfo.getDfsj()!=null){
  2219 + time=scheduleRealInfo.getDfsj();
  2220 + }
  2221 + }
  2222 + }else{
  2223 + time=scheduleRealInfo.getFcsj();
  2224 + }
  2225 + if(!time.equals("")){
  2226 + String[] fcsjStr = time.split(":");
  2227 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  2228 + if(scheduleRealInfo.getStatus()!=-1){
  2229 + if(item.equals("zgf")){
  2230 + if(fcsj>=zgf1 && fcsj<=zgf2){
  2231 + jhry.add(scheduleRealInfo.getjGh());
  2232 + }
  2233 + }else if(item.equals("wgf")){
  2234 + if(fcsj>=wgf1 && fcsj<=wgf2){
  2235 + jhry.add(scheduleRealInfo.getjGh());
  2236 + }
  2237 + }else{
  2238 + jhry.add(scheduleRealInfo.getjGh());
  2239 + }
  2240 +
  2241 + } else if(scheduleRealInfo.getStatus()==-1){ //(20231031)烂班班次,子任务如果有营运里程,视为实际班次。
  2242 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  2243 + if(!childTaskPlans.isEmpty()){
  2244 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  2245 + boolean b = false;
  2246 + while (it.hasNext()) {
  2247 + ChildTaskPlan c = it.next();
  2248 + if("service".equals(c.getMileageType()) && !c.isDestroy()){
  2249 + BigDecimal mileage = new BigDecimal(c.getMileage());
  2250 + if(mileage.compareTo(BigDecimal.ZERO) == 1){ //大于0
  2251 + b = true;
  2252 + }
  2253 + }
  2254 + if(b){
  2255 + break;
  2256 + }
  2257 + }
  2258 + if(b){
  2259 + if(item.equals("zgf")){
  2260 + if(fcsj>=zgf1 && fcsj<=zgf2){
  2261 + jhry.add(scheduleRealInfo.getjGh());
  2262 + }
  2263 + }else if(item.equals("wgf")){
  2264 + if(fcsj>=wgf1 && fcsj<=wgf2){
  2265 + jhry.add(scheduleRealInfo.getjGh());
  2266 + }
  2267 + }else{
  2268 + jhry.add(scheduleRealInfo.getjGh());
  2269 + }
  2270 + }
  2271 + }
  2272 + }
  2273 + }
  2274 + }
  2275 + }
  2276 + }
  2277 + return jhry.size();
  2278 + }
  2279 +
  2280 + @Override
  2281 + public int culateSjcl(List<ScheduleRealInfo> lists,String item) {
  2282 + // TODO Auto-generated method stub
  2283 + Set<String> jhcl=new HashSet<>();
  2284 + for (int i = 0; i < lists.size(); i++) {
  2285 + ScheduleRealInfo scheduleRealInfo=lists.get(i);
  2286 + if (!isInOut(scheduleRealInfo)) {
  2287 + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService()){
  2288 + String time="";
  2289 + if(item.equals("zgf") || item.equals("wgf")){
  2290 + if(scheduleRealInfo.getFcsjActual()!=null){
  2291 + time=scheduleRealInfo.getFcsjActual();
  2292 + }
  2293 + if(time.equals("")){
  2294 + if(scheduleRealInfo.getDfsj()!=null){
  2295 + time=scheduleRealInfo.getDfsj();
  2296 + }
  2297 + }
  2298 + }else{
  2299 + time=scheduleRealInfo.getFcsj();
  2300 + }
  2301 + if(!time.equals("")){
  2302 + String[] fcsjStr = time.split(":");
  2303 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  2304 + if(scheduleRealInfo.getStatus()!=-1){
  2305 + if(item.equals("zgf")){
  2306 + if(fcsj>=zgf1 && fcsj<=zgf2){
  2307 + jhcl.add(scheduleRealInfo.getClZbh());
  2308 + }
  2309 + }else if(item.equals("wgf")){
  2310 + if(fcsj>=wgf1 && fcsj<=wgf2){
  2311 + jhcl.add(scheduleRealInfo.getClZbh());
  2312 + }
  2313 + }else{
  2314 + jhcl.add(scheduleRealInfo.getClZbh());
  2315 + }
  2316 +
  2317 + } else if(scheduleRealInfo.getStatus()==-1){ //(20231031)烂班班次,子任务如果有营运里程,视为实际班次。
  2318 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  2319 + if(!childTaskPlans.isEmpty()){
  2320 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  2321 + boolean b = false;
  2322 + while (it.hasNext()) {
  2323 + ChildTaskPlan c = it.next();
  2324 + if("service".equals(c.getMileageType()) && !c.isDestroy()){
  2325 + BigDecimal mileage = new BigDecimal(c.getMileage());
  2326 + if(mileage.compareTo(BigDecimal.ZERO) == 1){ //大于0
  2327 + b = true;
  2328 + }
  2329 + }
  2330 + if(b){
  2331 + break;
  2332 + }
  2333 + }
  2334 + if(b){
  2335 + if(item.equals("zgf")){
  2336 + if(fcsj>=zgf1 && fcsj<=zgf2){
  2337 + jhcl.add(scheduleRealInfo.getClZbh());
  2338 + }
  2339 + }else if(item.equals("wgf")){
  2340 + if(fcsj>=wgf1 && fcsj<=wgf2){
  2341 + jhcl.add(scheduleRealInfo.getClZbh());
  2342 + }
  2343 + }else{
  2344 + jhcl.add(scheduleRealInfo.getClZbh());
  2345 + }
  2346 + }
  2347 + }
  2348 + }
  2349 + }
  2350 + }
  2351 + }
  2352 + }
  2353 + return jhcl.size();
  2354 + }
  2355 +
2062 2356 }
... ...