Commit c4cbf96788815a3d8ed692c4c6a263a4b7547247

Authored by 娄高锋
1 parent 15258e9d

早未到接口更新

src/main/java/com/bsth/server_rs/bigdata/BigscreenService.java
@@ -3113,6 +3113,152 @@ public class BigscreenService { @@ -3113,6 +3113,152 @@ public class BigscreenService {
3113 for(Map<String, Object> map : minfcsjList){ 3113 for(Map<String, Object> map : minfcsjList){
3114 minfcsjMap.put(map.get("line").toString(), map.get("minfcsj").toString()); 3114 minfcsjMap.put(map.get("line").toString(), map.get("minfcsj").toString());
3115 } 3115 }
  3116 +
  3117 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  3118 + String format = sdf.format(new Date());
  3119 +
  3120 + List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(date);
  3121 + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
  3122 + Map<String, ScheduleRealInfo> scheduleMap = new HashMap<String, ScheduleRealInfo>();
  3123 + for(ScheduleRealInfo s : findAll){
  3124 + if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路
  3125 + Set<ChildTaskPlan> cts = s.getcTasks();
  3126 + if (cts != null && cts.size() > 0) {
  3127 + list_s.add(s);
  3128 + } else if (s.getZdsjActual() != null && s.getFcsjActual() != null) {
  3129 + list_s.add(s);
  3130 + } else if(s.getStatus() != 0){
  3131 + list_s.add(s);
  3132 + }
  3133 + }
  3134 + }
  3135 +
  3136 + for(ScheduleRealInfo s : list_s){
  3137 + if(!isInOut(s) && !s.isCcService()){
  3138 + String[] split = s.getFcsj().split(":");
  3139 + Long time = Long.valueOf(split[0]) * 60 + Long.valueOf(split[1]);
  3140 + String minfcsj = minfcsjMap.get(s.getXlBm())!=null?minfcsjMap.get(s.getXlBm()).toString():"02:00";
  3141 + String[] split_min = minfcsj.trim().split(":");
  3142 + Long min = Long.valueOf(split_min[0]) * 60 + Long.valueOf(split_min[1]);
  3143 + if(time < min){
  3144 + time += 1440;
  3145 + }
  3146 + s.setFcsjT(time);
  3147 + String cl = s.getClZbh();
  3148 + if(scheduleMap.containsKey(cl)){
  3149 + ScheduleRealInfo s2 = scheduleMap.get(cl);
  3150 + if(time < s2.getFcsjT()){
  3151 + scheduleMap.put(cl, s);
  3152 + }
  3153 + } else {
  3154 + scheduleMap.put(cl, s);
  3155 + }
  3156 + }
  3157 + }
  3158 +
  3159 + List<ScheduleRealInfo> notYetList = new ArrayList<ScheduleRealInfo>();
  3160 +
  3161 + long sum = scheduleMap.keySet().size(), zwd = 0;//早未到数
  3162 +// long yg_z = 0, sn_z = 0, jg_z = 0, nh_z = 0;
  3163 + long cd_1 = 0, cd_2 = 0, cd_3 = 0, cd_5 = 0, cd_6 = 0;
  3164 +// long yg_zwd = 0, sn_zwd = 0, jg_zwd = 0, nh_zwd = 0;
  3165 + long cd_1_zwd = 0, cd_2_zwd = 0, cd_3_zwd = 0, cd_5_zwd = 0, cd_6_zwd = 0;
  3166 + for(String key : scheduleMap.keySet()){
  3167 + ScheduleRealInfo s = scheduleMap.get(key);
  3168 + if("77".equals(s.getGsBm())){
  3169 + if("1".equals(s.getFgsBm())){
  3170 + cd_1 += 1;
  3171 + } else if("2".equals(s.getFgsBm())){
  3172 + cd_2 += 1;
  3173 + } else if("3".equals(s.getFgsBm())){
  3174 + cd_3 += 1;
  3175 + } else if("5".equals(s.getFgsBm())){
  3176 + cd_5 += 1;
  3177 + } else if("6".equals(s.getFgsBm())){
  3178 + cd_6 += 1;
  3179 + }
  3180 + if("缺人".equals(s.getAdjustExps()) || "缺车".equals(s.getAdjustExps())){
  3181 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  3182 + list.add(s);
  3183 + BigDecimal sjgl = new BigDecimal(culateSjgl(list));
  3184 + BigDecimal ljgl = new BigDecimal(culateLjgl(list));
  3185 + BigDecimal zero = new BigDecimal(0.0);
  3186 + if(sjgl.compareTo(zero) == 0 && ljgl.compareTo(zero) == 0){
  3187 + zwd += 1;
  3188 + if("1".equals(s.getFgsBm())){
  3189 + cd_1_zwd += 1;
  3190 + } else if("2".equals(s.getFgsBm())){
  3191 + cd_2_zwd += 1;
  3192 + } else if("3".equals(s.getFgsBm())){
  3193 + cd_3_zwd += 1;
  3194 + } else if("5".equals(s.getFgsBm())){
  3195 + cd_5_zwd += 1;
  3196 + } else if("6".equals(s.getFgsBm())){
  3197 + cd_6_zwd += 1;
  3198 + }
  3199 + notYetList.add(s);
  3200 + }
  3201 + }
  3202 + }
  3203 + }
  3204 +
  3205 + resMap.put("sum", sum);
  3206 + resMap.put("notYet", zwd);
  3207 + resMap.put("sum_1", cd_1);
  3208 + resMap.put("notYet_1", cd_1_zwd);
  3209 + resMap.put("sum_2", cd_2);
  3210 + resMap.put("notYet_2", cd_2_zwd);
  3211 + resMap.put("sum_3", cd_3);
  3212 + resMap.put("notYet_3", cd_3_zwd);
  3213 + resMap.put("sum_5", cd_5);
  3214 + resMap.put("notYet_5", cd_5_zwd);
  3215 + resMap.put("sum_6", cd_6);
  3216 + resMap.put("notYet_6", cd_6_zwd);
  3217 + resMap.put("notYetList", notYetList);
  3218 + return resMap;
  3219 + }
  3220 +
  3221 + /** 按日期查询出车的早未到情况(含回场再出场后的首班) */
  3222 + @GET
  3223 + @Path("/selectData/getNotYet1/{date}")
  3224 + public Map<String, Object> getNotYet1(@PathParam("date") String date){
  3225 + Map<String, Object> resMap = new HashMap<String, Object>();
  3226 +
  3227 + String yyxlSql="SELECT line_code from bsth_c_line "
  3228 + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')";
  3229 + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql,
  3230 + new RowMapper<Map<String, Object>>(){
  3231 + @Override
  3232 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  3233 + Map<String, Object> m=new HashMap<String,Object>();
  3234 + m.put("lineCode", rs.getString("line_code"));
  3235 + return m;
  3236 + }
  3237 + });
  3238 + Set<String> yyLine = new HashSet<String>();
  3239 + for(Map<String, Object> t : yyxlList){
  3240 + if(t.get("lineCode") != null){
  3241 + yyLine.add(t.get("lineCode").toString());
  3242 + }
  3243 + }
  3244 +
  3245 + String sqlMinYysj="select line, start_opt from bsth_c_line_config where "
  3246 + + " id in (select max(id) from bsth_c_line_config group by line)";
  3247 + List<Map<String, Object>> minfcsjList = jdbcTemplate.query(sqlMinYysj,
  3248 + new RowMapper<Map<String, Object>>(){
  3249 + @Override
  3250 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  3251 + Map<String, Object> map = new HashMap<String, Object>();
  3252 + map.put("line", rs.getString("line")!=null?rs.getString("line"):"");
  3253 + map.put("minfcsj", rs.getString("start_opt")!=null?rs.getString("start_opt"):"02:00");
  3254 + return map;
  3255 + }
  3256 + });
  3257 +
  3258 + Map<String, Object> minfcsjMap = new HashMap<String, Object>();
  3259 + for(Map<String, Object> map : minfcsjList){
  3260 + minfcsjMap.put(map.get("line").toString(), map.get("minfcsj").toString());
  3261 + }
3116 3262
3117 List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAllByOrder(date); 3263 List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAllByOrder(date);
3118 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 3264 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();