Commit 71d16daf8bec0db3b346c5c3f5c0cb6d287edb81

Authored by 廖磊
1 parent 3bdf44c2

嘉定行车路单导出

src/main/java/com/bsth/controller/BusIntervalController.java
... ... @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
9 9 import org.springframework.web.bind.annotation.RequestParam;
10 10 import org.springframework.web.bind.annotation.RestController;
11 11  
  12 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
12 13 import com.bsth.service.BusIntervalService;
13 14  
14 15 @RestController
... ... @@ -63,4 +64,14 @@ public class BusIntervalController {
63 64 return busIntervalService.MapById(id);
64 65 }
65 66  
  67 + @RequestMapping(value = "/exportWaybillJd",method = RequestMethod.GET)
  68 + public List<ScheduleRealInfo> exportWaybillJd(@RequestParam String jName, @RequestParam String clZbh,
  69 + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
  70 + return busIntervalService.exportWaybillJd(jName, clZbh, lpName,date,line);
  71 + }
  72 +
  73 + @RequestMapping(value = "exportWaybillMoreJd", method = RequestMethod.GET)
  74 + public Map<String, Object> exportWaybillMoreJd(@RequestParam Map<String, Object> map){
  75 + return busIntervalService.exportWaybillMoreJd(map);
  76 + }
66 77 }
... ...
src/main/java/com/bsth/service/BusIntervalService.java
... ... @@ -3,6 +3,8 @@ package com.bsth.service;
3 3 import java.util.List;
4 4 import java.util.Map;
5 5  
  6 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  7 +
6 8  
7 9 public interface BusIntervalService {
8 10  
... ... @@ -21,7 +23,11 @@ public interface BusIntervalService {
21 23 List<Map<String, Object>> correctStatis(Map<String, Object> map);
22 24  
23 25 Map<String, Object> exportWaybillMore(Map<String, Object> map);
24   -
  26 + Map<String, Object> exportWaybillMoreJd(Map<String, Object> map);
  27 +
25 28 Map<String, Object> MapById(Long id) ;
  29 +
  30 + List<ScheduleRealInfo> exportWaybillJd(String jName,String clZbh,String lpName,String date,String line);
  31 +
26 32  
27 33 }
... ...
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
... ... @@ -2828,7 +2828,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2828 2828 List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh());
2829 2829 if (listCars.size() > 0) {
2830 2830 if(listCars.get(0).getNyType()!=null){
2831   - if (listCars.get(0).getNyType().equals("1")) {
  2831 + if (listCars.get(0).getNyType()==1) {
2832 2832 List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm);
2833 2833 type = 1;
2834 2834 for (int i = 0; i < listDlb.size(); i++) {
... ... @@ -2850,7 +2850,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2850 2850 }
2851 2851  
2852 2852 }
2853   - } else if(listCars.get(0).getNyType().equals("0")){
  2853 + } else if(listCars.get(0).getNyType()==0){
2854 2854 List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm);
2855 2855 type = 0;
2856 2856 for (int i = 0; i < listYlb.size(); i++) {
... ... @@ -2923,7 +2923,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2923 2923 map.put("jcyl", jcyl);
2924 2924 map.put("type", type);
2925 2925 map.put("zlc", zlc);
2926   - map.put("jzl", jzl_);
  2926 + map.put("jzl_", jzl_);
2927 2927 map.put("yh_", yh_);
2928 2928 map.put("ccyl_", ccyl_);
2929 2929 map.put("jcyl_", jcyl_);
... ... @@ -2991,4 +2991,662 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2991 2991 return map;
2992 2992 }
2993 2993  
  2994 + @Override
  2995 + public List<ScheduleRealInfo> exportWaybillJd(String jName, String clZbh, String lpName, String date, String line) {
  2996 +
  2997 + ReportUtils ee = new ReportUtils();
  2998 + ReportRelatedUtils rru = new ReportRelatedUtils();
  2999 + List<Iterator<?>> list = new ArrayList<Iterator<?>>();
  3000 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
  3001 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  3002 +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line);
  3003 + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
  3004 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  3005 + ScheduleRealInfo s=scheduleRealInfos.get(i);
  3006 + Set<ChildTaskPlan> cts = s.getcTasks();
  3007 + if(cts != null && cts.size() > 0){
  3008 + lists.add(s);
  3009 + }else{
  3010 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  3011 + lists.add(s);
  3012 + }
  3013 + }
  3014 + }
  3015 + DecimalFormat format = new DecimalFormat("0.00");
  3016 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  3017 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  3018 + //计算里程和班次数,并放入Map里
  3019 + Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId());
  3020 +
  3021 + map.put("jhlc",Arith.add(culateService.culateJhgl(scheduleRealInfos),culateService.culateJhJccgl(scheduleRealInfos)));
  3022 + map.put("remMileage",culateService.culateLbgl(scheduleRealInfos));
  3023 + map.put("addMileage", culateService.culateLjgl(lists));
  3024 + double yygl=Arith.add(culateService.culateSjgl(lists),culateService.culateLjgl(lists));
  3025 + map.put("yygl", yygl);
  3026 + double ksgl=Arith.add(culateService.culateKsgl(scheduleRealInfos),culateService.culateJccgl(lists));
  3027 + map.put("ksgl",ksgl);
  3028 + map.put("realMileage", Arith.add(yygl ,ksgl));
  3029 + map.put("jhbc", culateService.culateJhbc(scheduleRealInfos,""));
  3030 + map.put("cjbc", culateService.culateLbbc(scheduleRealInfos));
  3031 + map.put("ljbc", culateService.culateLjbc(lists, ""));
  3032 + int sjbc =culateService.culateLjbc(lists, "")+culateService.culateSjbc(lists, "");
  3033 + map.put("sjbc", sjbc);
  3034 +// map=new HashMap<String,Object>();
  3035 +
  3036 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  3037 + String minfcsj="02:00";
  3038 + List<Line> lineList=lineRepository.findLineByCode(line);
  3039 + if(lineList.size()>0){
  3040 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  3041 + + " id = ("
  3042 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  3043 + + ")";
  3044 + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  3045 + }
  3046 + String[] minSjs = minfcsj.split(":");
  3047 + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
  3048 +
  3049 +
  3050 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  3051 + ScheduleRealInfo s=scheduleRealInfos.get(i);
  3052 + String[] fcsj= s.getFcsj().split(":");
  3053 + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]);
  3054 +
  3055 + Long fscjT=0L;
  3056 + if(fcsjL<minSj){
  3057 + Calendar calendar = new GregorianCalendar();
  3058 + calendar.setTime(s.getScheduleDate());
  3059 + calendar.add(calendar.DATE,1);
  3060 + s.setScheduleDate(calendar.getTime());
  3061 + try {
  3062 + fscjT = sdf.parse(sdf.format(s.getScheduleDate())+" "+s.getFcsj()).getTime();
  3063 + } catch (ParseException e) {
  3064 + // TODO Auto-generated catch block
  3065 + e.printStackTrace();
  3066 + }
  3067 +
  3068 + }else{
  3069 + try {
  3070 + fscjT =sdf.parse(s.getScheduleDateStr()+" "+s.getFcsj()).getTime();
  3071 + } catch (ParseException e) {
  3072 + // TODO Auto-generated catch block
  3073 + e.printStackTrace();
  3074 + };
  3075 + }
  3076 + s.setFcsjT(fscjT);
  3077 + }
  3078 + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();
  3079 + Collections.sort(scheduleRealInfos, new ComparableReal());
  3080 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  3081 + ScheduleRealInfo s = scheduleRealInfos.get(i);
  3082 + s.setAdjustExps(i + 1 + "");
  3083 + String remarks = "";
  3084 + if (s.getRemarks() != null) {
  3085 + remarks += s.getRemarks();
  3086 + }
  3087 +
  3088 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  3089 + if (!childTaskPlans.isEmpty()) {
  3090 + s.setFcsjActual("");
  3091 + s.setZdsjActual("");
  3092 + s.setJhlc(0.0);
  3093 + }
  3094 +
  3095 + if (s.isDestroy()) {
  3096 + s.setFcsjActual("");
  3097 + s.setZdsjActual("");
  3098 + s.setJhlc(0.0);
  3099 + remarks += "(烂班)";
  3100 + s.setRemarks(remarks);
  3101 + }
  3102 +
  3103 + listSchedule.add(s);
  3104 + //计算营运里程,空驶里程
  3105 + if (!childTaskPlans.isEmpty()) {
  3106 +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  3107 + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
  3108 + Collections.sort(listit, new ComparableChild());
  3109 + for (int j = 0; j < listit.size(); j++) {
  3110 + ScheduleRealInfo t = new ScheduleRealInfo();
  3111 + ChildTaskPlan childTaskPlan = listit.get(j);
  3112 + if (childTaskPlan.isDestroy()) {
  3113 + t.setFcsjActual("");
  3114 + t.setZdsjActual("");
  3115 + t.setJhlc(0.0);
  3116 + } else {
  3117 + t.setFcsjActual(childTaskPlan.getStartDate());
  3118 + t.setZdsjActual(childTaskPlan.getEndDate());
  3119 + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage())));
  3120 + }
  3121 + t.setQdzName(childTaskPlan.getStartStationName());
  3122 + t.setZdzName(childTaskPlan.getEndStationName());
  3123 + t.setRemarks(childTaskPlan.getRemarks());
  3124 + t.setAdjustExps("子");
  3125 + t.setjGh("");
  3126 + t.setjName("");
  3127 + t.setsGh("");
  3128 + t.setsName("");
  3129 + listSchedule.add(t);
  3130 + }
  3131 + }
  3132 + }
  3133 + Map<String, Object> maps;
  3134 + for (ScheduleRealInfo scheduleRealInfo : listSchedule) {
  3135 + maps = new HashMap<String, Object>();
  3136 + try {
  3137 + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName());
  3138 + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName());
  3139 + maps = rru.getMapValue(scheduleRealInfo);
  3140 + maps.put("bcs", scheduleRealInfo.getAdjustExps());
  3141 + String zdsj = scheduleRealInfo.getZdsj();
  3142 + String zdsjActual = scheduleRealInfo.getZdsjActual();
  3143 + if (zdsj != null && zdsjActual != null &&
  3144 + !zdsj.equals(zdsjActual) &&
  3145 + !zdsj.equals("")&&
  3146 + !zdsjActual.equals("")) {
  3147 + if (zdsj.compareTo(zdsjActual) > 0) {
  3148 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3149 + maps.put("slow", "");
  3150 + } else {
  3151 + maps.put("fast", "");
  3152 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3153 + }
  3154 + } else {
  3155 + maps.put("fast", "");
  3156 + maps.put("slow", "");
  3157 + }
  3158 + listMap.add(maps);
  3159 + } catch (Exception e) {
  3160 + e.printStackTrace();
  3161 + }
  3162 + }
  3163 +
  3164 + String xls="";
  3165 + if(map.get("type").toString().equals("2")){
  3166 + xls="waybill_minhang_yd.xls";
  3167 + }else if(map.get("type").toString().equals("0")){
  3168 + xls="waybill_minhang.xls";
  3169 + }else{
  3170 + xls="waybill_minhang_dl.xls";
  3171 + }
  3172 +
  3173 +
  3174 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3175 +
  3176 + list.add(listMap.iterator());
  3177 + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0),map}, path + "mould/"+xls,
  3178 + path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
  3179 + return scheduleRealInfos;
  3180 +
  3181 + }
  3182 +
  3183 +
  3184 + @Override
  3185 + public Map<String, Object> exportWaybillMoreJd(Map<String, Object> map) {
  3186 + String date = map.get("date").toString();
  3187 + String line = map.get("line").toString();
  3188 + ReportUtils ee = new ReportUtils();
  3189 + List<List> strs = JSON.parseArray(map.get("strs").toString(), List.class);
  3190 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/";
  3191 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3192 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3193 + int num = 0;
  3194 + File file = null;
  3195 + try {
  3196 + while (true) {
  3197 + String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date));
  3198 +// file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹
  3199 + file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件
  3200 + if (file.exists()) { //判断是否已存在重名
  3201 + num++;
  3202 + } else {
  3203 + break;
  3204 + }
  3205 + }
  3206 +// file.mkdirs(); //创建
  3207 +
  3208 + Map<String, List<Ylb>> ylbMap = new HashMap<String, List<Ylb>>();
  3209 + Map<String, List<Dlb>> dlbMap = new HashMap<String, List<Dlb>>();
  3210 + Map<String, List<Cars>> carMap = new HashMap<String, List<Cars>>();
  3211 + List<ScheduleRealInfo> lists_line=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
  3212 + List<DutyEmployee> list2 = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59");
  3213 + List<Ylb> queryYlbByRqXlbm = ylbRepository.queryYlbByRqXlbm(date, line);
  3214 + List<Dlb> queryDlbByRqXlbm = dlbRepository.queryDlbByRqXlbm(date, line);
  3215 + List<Cars> findCars = carsRepository.findCars();
  3216 + String minfcsj="02:00";
  3217 + List<Line> lineList=lineRepository.findLineByCode(line);
  3218 + if(lineList.size()>0){
  3219 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  3220 + + " id = ("
  3221 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  3222 + + ")";
  3223 + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  3224 + }
  3225 +
  3226 + for(Ylb ylb : queryYlbByRqXlbm){
  3227 + String key = ylb.getJsy() + ylb.getNbbm();
  3228 + if(!ylbMap.containsKey(key))
  3229 + ylbMap.put(key, new ArrayList<Ylb>());
  3230 + ylbMap.get(key).add(ylb);
  3231 + }
  3232 + for(Dlb dlb : queryDlbByRqXlbm){
  3233 + String key = dlb.getJsy() + dlb.getNbbm();
  3234 + if(!dlbMap.containsKey(key))
  3235 + dlbMap.put(key, new ArrayList<Dlb>());
  3236 + dlbMap.get(key).add(dlb);
  3237 + }
  3238 + for(Cars car : findCars){
  3239 + String key = car.getInsideCode();
  3240 + if(!carMap.containsKey(key))
  3241 + carMap.put(key, new ArrayList<Cars>());
  3242 + carMap.get(key).add(car);
  3243 + }
  3244 +
  3245 + List<File> files = new ArrayList<File>();
  3246 + for (List<String> list : strs){
  3247 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  3248 + String jName = list.get(0);
  3249 + String clZbh = list.get(1);
  3250 + String lpName = list.get(2);
  3251 + String jGh =list.get(3);
  3252 + for (int i = 0; i < lists_line.size(); i++) {
  3253 + ScheduleRealInfo s=lists_line.get(i);
  3254 + if(s.getjGh().equals(jGh) && s.getClZbh().equals(clZbh) && s.getLpName().equals(lpName)){
  3255 + newList.add(s);
  3256 + }
  3257 + }
  3258 + //——————————————————————————————————————————————————————
  3259 +
  3260 + ReportRelatedUtils rru = new ReportRelatedUtils();
  3261 + List<Iterator<?>> list1 = new ArrayList<Iterator<?>>();
  3262 + List<ScheduleRealInfo> scheduleRealInfos = newList;
  3263 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  3264 +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line);
  3265 + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
  3266 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  3267 + ScheduleRealInfo s=scheduleRealInfos.get(i);
  3268 + Set<ChildTaskPlan> cts = s.getcTasks();
  3269 + if(cts != null && cts.size() > 0){
  3270 + lists.add(s);
  3271 + }else{
  3272 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  3273 + lists.add(s);
  3274 + }
  3275 + }
  3276 + }
  3277 + DecimalFormat format = new DecimalFormat("0.00");
  3278 + //计算里程和班次数,并放入Map里
  3279 +// Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId());
  3280 +
  3281 + //-----------------------------------------------------
  3282 + Map<String, Object> map_ = new HashMap<String, Object>();
  3283 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  3284 +// ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(scheduleRealInfos.get(0).getId());
  3285 + ScheduleRealInfo s = scheduleRealInfos.get(0);
  3286 + String fcrq = s.getScheduleDateStr();
  3287 + String jsy = s.getjGh();
  3288 + String nbbm = s.getClZbh();
  3289 +
  3290 + int type = 0;
  3291 + double ccyl = 0.0;
  3292 + double jcyl = 0.0;
  3293 + double yh = 0.0;
  3294 + double jzl = 0.0;
  3295 + double zlc = 0.0;
  3296 +
  3297 + double ccyl_ = 0.0;
  3298 + double jcyl_ = 0.0;
  3299 + double yh_ = 0.0;
  3300 + double jzl_ = 0.0;
  3301 + double zlc_ = 0.0;
  3302 +// List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(),xlbm);
  3303 +// List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(),xlbm);
  3304 + List<Ylb> listYlb = ylbMap.get(jsy + nbbm);
  3305 + List<Dlb> listDlb = dlbMap.get(jsy + nbbm);
  3306 +
  3307 +// List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh());
  3308 + List<Cars> listCars = carMap.get(s.getClZbh());
  3309 + if (listCars != null && listCars.size() > 0) {
  3310 + if(listCars.get(0).getNyType()!=null){
  3311 + if (listCars.get(0).getNyType()==1) {
  3312 + type = 1;
  3313 + if(listDlb != null)
  3314 + for (int i = 0; i < listDlb.size(); i++) {
  3315 + Dlb d = listDlb.get(i);
  3316 + if (d.getLp() == null) {
  3317 + ccyl = Arith.add(ccyl, d.getCzcd());
  3318 + jcyl = Arith.add(jcyl, d.getJzcd());
  3319 + yh = Arith.add(yh, d.getHd());
  3320 + jzl = Arith.add(jzl, d.getCdl());
  3321 + zlc = Arith.add(zlc, d.getZlc());
  3322 + } else {
  3323 + if (d.getLp().equals(s.getLpName())) {
  3324 + ccyl = Arith.add(ccyl, d.getCzcd());
  3325 + jcyl = Arith.add(jcyl, d.getJzcd());
  3326 + yh = Arith.add(yh, d.getHd());
  3327 + jzl = Arith.add(jzl, d.getCdl());
  3328 + zlc = Arith.add(zlc, d.getZlc());
  3329 + }
  3330 + }
  3331 +
  3332 + }
  3333 + } else if(listCars.get(0).getNyType()==0){
  3334 + type = 0;
  3335 + if(listYlb != null)
  3336 + for (int i = 0; i < listYlb.size(); i++) {
  3337 + Ylb y = listYlb.get(i);
  3338 + if (y.getLp() == null) {
  3339 + ccyl = Arith.add(ccyl, y.getCzyl());
  3340 + jcyl = Arith.add(jcyl, y.getJzyl());
  3341 + yh = Arith.add(yh, y.getYh());
  3342 + jzl = Arith.add(jzl, y.getJzl());
  3343 + zlc = Arith.add(zlc, y.getZlc());
  3344 + } else {
  3345 + if (y.getLp().equals(s.getLpName())) {
  3346 + ccyl = Arith.add(ccyl, y.getCzyl());
  3347 + jcyl = Arith.add(jcyl, y.getJzyl());
  3348 + yh = Arith.add(yh, y.getYh());
  3349 + jzl = Arith.add(jzl, y.getJzl());
  3350 + zlc = Arith.add(zlc, y.getZlc());
  3351 + }
  3352 + }
  3353 + }
  3354 + }else{
  3355 + type = 2;
  3356 + for (int i = 0; i < listDlb.size(); i++) {
  3357 + Dlb d = listDlb.get(i);
  3358 + if (d.getLp() == null) {
  3359 + ccyl_ = Arith.add(ccyl, d.getCzcd());
  3360 + jcyl_ = Arith.add(jcyl, d.getJzcd());
  3361 + yh_ = Arith.add(yh, d.getHd());
  3362 + jzl_ = Arith.add(jzl, d.getCdl());
  3363 + zlc_ = Arith.add(zlc, d.getZlc());
  3364 + } else {
  3365 + if (d.getLp().equals(s.getLpName())) {
  3366 + ccyl_ = Arith.add(ccyl, d.getCzcd());
  3367 + jcyl_ = Arith.add(jcyl, d.getJzcd());
  3368 + yh_ = Arith.add(yh, d.getHd());
  3369 + jzl_ = Arith.add(jzl, d.getCdl());
  3370 + zlc_ = Arith.add(zlc, d.getZlc());
  3371 + }
  3372 + }
  3373 +
  3374 + }
  3375 +
  3376 + for (int i = 0; i < listYlb.size(); i++) {
  3377 + Ylb y = listYlb.get(i);
  3378 + if (y.getLp() == null) {
  3379 + ccyl = Arith.add(ccyl, y.getCzyl());
  3380 + jcyl = Arith.add(jcyl, y.getJzyl());
  3381 + yh = Arith.add(yh, y.getYh());
  3382 + jzl = Arith.add(jzl, y.getJzl());
  3383 + zlc = Arith.add(zlc, y.getZlc());
  3384 + } else {
  3385 + if (y.getLp().equals(s.getLpName())) {
  3386 + ccyl = Arith.add(ccyl, y.getCzyl());
  3387 + jcyl = Arith.add(jcyl, y.getJzyl());
  3388 + yh = Arith.add(yh, y.getYh());
  3389 + jzl = Arith.add(jzl, y.getJzl());
  3390 + zlc = Arith.add(zlc, y.getZlc());
  3391 + }
  3392 + }
  3393 + }
  3394 + }
  3395 + }
  3396 + }
  3397 +
  3398 + map_.put("jzl", jzl);
  3399 + map_.put("yh", yh);
  3400 + map_.put("ccyl", ccyl);
  3401 + map_.put("jcyl", jcyl);
  3402 + map_.put("zlc", zlc);
  3403 + map_.put("jzl_", jzl_);
  3404 + map_.put("yh_", yh_);
  3405 + map_.put("ccyl_", ccyl_);
  3406 + map_.put("jcyl_", jcyl_);
  3407 + map_.put("zlc_", zlc_);
  3408 + map_.put("type", type);
  3409 + map_.put("xlName", s.getXlName());
  3410 + map_.put("clZbh", s.getClZbh());
  3411 + map_.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh()));
  3412 + map_.put("fcsjActual", s.getFcsjActual());
  3413 + map_.put("zdzName", s.getZdzName());
  3414 + map_.put("scheduleDate", s.getScheduleDateStr());
  3415 + map_.put("lpName", s.getLpName());
  3416 + String zdp = "", zwdp = "", wdp = "";
  3417 + String zdpT = "", zwdpT = "", wdpT = "";
  3418 + String dbdp="";
  3419 +// List<DutyEmployee> list2 = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59");
  3420 + try {
  3421 + Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime();
  3422 + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime();
  3423 + Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime();
  3424 + for (int i = 0; i < list2.size(); i++) {
  3425 + DutyEmployee t = list2.get(i);
  3426 + if(dbdp.indexOf(t.getuName()) == -1){
  3427 + if(!(dbdp.length()>0)){
  3428 + dbdp =t.getuName();
  3429 + }else{
  3430 + dbdp +=","+t.getuName();
  3431 + }
  3432 + }
  3433 + Long ts = t.getTs();
  3434 + if (ts > fcsj1 && ts < fcsj2) {
  3435 + if (zdp.indexOf(t.getuName()) == -1) {
  3436 + if (!(zdp.length() > 0)) {
  3437 + zdpT = t.getuName() + "...";
  3438 + }
  3439 + zdp += t.getuName() + ",";
  3440 +
  3441 + }
  3442 + } else if (ts > fcsj2 && ts < fcsj3) {
  3443 + if (zwdp.indexOf(t.getuName()) == -1) {
  3444 + if (!(zwdp.length() > 0)) {
  3445 + zwdpT = t.getuName() + "...";
  3446 + }
  3447 + zwdp += t.getuName() + ",";
  3448 + }
  3449 + } else {
  3450 + if (wdp.indexOf(t.getuName()) == -1) {
  3451 + if (!(wdp.length() > 0)) {
  3452 + wdpT = t.getuName() + "...";
  3453 + }
  3454 + wdp += t.getuName() + ",";
  3455 + }
  3456 + }
  3457 + }
  3458 + } catch (ParseException e) {
  3459 + // TODO Auto-generated catch block
  3460 + e.printStackTrace();
  3461 + }
  3462 + map_.put("zdp", zdp);
  3463 + map_.put("zwdp", zwdp);
  3464 + map_.put("wdp", wdp);
  3465 + map_.put("zdpT", zdpT);
  3466 + map_.put("zwdpT", zwdpT);
  3467 + map_.put("wdpT", wdpT);
  3468 + map_.put("dbdp", dbdp);
  3469 + //-----------------------------------------------------
  3470 +
  3471 + map_.put("jhlc",Arith.add(culateService.culateJhgl(scheduleRealInfos),culateService.culateJhJccgl(scheduleRealInfos)));
  3472 + map_.put("remMileage",culateService.culateLbgl(scheduleRealInfos));
  3473 + map_.put("addMileage", culateService.culateLjgl(lists));
  3474 + double yygl=Arith.add(culateService.culateSjgl(lists),culateService.culateLjgl(lists));
  3475 + map_.put("yygl", yygl);
  3476 + double ksgl=Arith.add(culateService.culateKsgl(scheduleRealInfos),culateService.culateJccgl(lists));
  3477 + map_.put("ksgl",ksgl);
  3478 + map_.put("realMileage", Arith.add(yygl ,ksgl));
  3479 + map_.put("jhbc", culateService.culateJhbc(scheduleRealInfos,""));
  3480 + map_.put("cjbc", culateService.culateLbbc(scheduleRealInfos));
  3481 + map_.put("ljbc", culateService.culateLjbc(lists, ""));
  3482 + int sjbc =culateService.culateLjbc(lists, "")+culateService.culateSjbc(lists, "");
  3483 + map_.put("sjbc", sjbc);
  3484 +// map=new HashMap<String,Object>();
  3485 +
  3486 + SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  3487 +// String minfcsj="02:00";
  3488 +// List<Line> lineList=lineRepository.findLineByCode(newList.get(0).getXlBm());
  3489 +// if(lineList.size()>0){
  3490 +// String sqlMinYysj="select start_opt from bsth_c_line_config where "
  3491 +// + " id = ("
  3492 +// + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  3493 +// + ")";
  3494 +// minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  3495 +// }
  3496 + String[] minSjs = minfcsj.split(":");
  3497 + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
  3498 +
  3499 +
  3500 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  3501 + ScheduleRealInfo ss=scheduleRealInfos.get(i);
  3502 + String[] fcsj= ss.getFcsj().split(":");
  3503 + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]);
  3504 +
  3505 + Long fscjT=0L;
  3506 + if(fcsjL<minSj){
  3507 + Calendar calendar = new GregorianCalendar();
  3508 + calendar.setTime(ss.getScheduleDate());
  3509 + calendar.add(calendar.DATE,1);
  3510 + ss.setScheduleDate(calendar.getTime());
  3511 + try {
  3512 + fscjT = sdf2.parse(sdf2.format(ss.getScheduleDate())+" "+ss.getFcsj()).getTime();
  3513 + } catch (ParseException e) {
  3514 + // TODO Auto-generated catch block
  3515 + e.printStackTrace();
  3516 + }
  3517 +
  3518 + }else{
  3519 + try {
  3520 + fscjT =sdf2.parse(ss.getScheduleDateStr()+" "+ss.getFcsj()).getTime();
  3521 + } catch (ParseException e) {
  3522 + // TODO Auto-generated catch block
  3523 + e.printStackTrace();
  3524 + };
  3525 + }
  3526 + ss.setFcsjT(fscjT);
  3527 + }
  3528 + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();
  3529 + Collections.sort(scheduleRealInfos, new ComparableReal());
  3530 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  3531 + ScheduleRealInfo ss = scheduleRealInfos.get(i);
  3532 + ss.setAdjustExps(i + 1 + "");
  3533 + String remarks = "";
  3534 + if (ss.getRemarks() != null) {
  3535 + remarks += ss.getRemarks();
  3536 + }
  3537 +
  3538 + Set<ChildTaskPlan> childTaskPlans = ss.getcTasks();
  3539 + if (!childTaskPlans.isEmpty()) {
  3540 + ss.setFcsjActual("");
  3541 + ss.setZdsjActual("");
  3542 + ss.setJhlc(0.0);
  3543 + }
  3544 +
  3545 + if (ss.isDestroy()) {
  3546 + ss.setFcsjActual("");
  3547 + ss.setZdsjActual("");
  3548 + ss.setJhlc(0.0);
  3549 + remarks += "(烂班)";
  3550 + ss.setRemarks(remarks);
  3551 + }
  3552 +
  3553 + listSchedule.add(ss);
  3554 + //计算营运里程,空驶里程
  3555 + if (!childTaskPlans.isEmpty()) {
  3556 +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  3557 + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
  3558 + Collections.sort(listit, new ComparableChild());
  3559 + for (int j = 0; j < listit.size(); j++) {
  3560 + ScheduleRealInfo t = new ScheduleRealInfo();
  3561 + ChildTaskPlan childTaskPlan = listit.get(j);
  3562 + if (childTaskPlan.isDestroy()) {
  3563 + t.setFcsjActual("");
  3564 + t.setZdsjActual("");
  3565 + t.setJhlc(0.0);
  3566 + } else {
  3567 + t.setFcsjActual(childTaskPlan.getStartDate());
  3568 + t.setZdsjActual(childTaskPlan.getEndDate());
  3569 + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage())));
  3570 + }
  3571 + t.setQdzName(childTaskPlan.getStartStationName());
  3572 + t.setZdzName(childTaskPlan.getEndStationName());
  3573 + t.setRemarks(childTaskPlan.getRemarks());
  3574 + t.setAdjustExps("子");
  3575 + t.setjGh("");
  3576 + t.setjName("");
  3577 + t.setsGh("");
  3578 + t.setsName("");
  3579 + listSchedule.add(t);
  3580 + }
  3581 + }
  3582 + }
  3583 + Map<String, Object> maps;
  3584 + for (ScheduleRealInfo scheduleRealInfo : listSchedule) {
  3585 + maps = new HashMap<String, Object>();
  3586 + try {
  3587 + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName());
  3588 + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName());
  3589 + maps = rru.getMapValue(scheduleRealInfo);
  3590 + maps.put("bcs", scheduleRealInfo.getAdjustExps());
  3591 + String zdsj = scheduleRealInfo.getZdsj();
  3592 + String zdsjActual = scheduleRealInfo.getZdsjActual();
  3593 + if (zdsj != null && zdsjActual != null &&
  3594 + !zdsj.equals(zdsjActual) &&
  3595 + !zdsj.equals("")&&
  3596 + !zdsjActual.equals("")) {
  3597 + if (zdsj.compareTo(zdsjActual) > 0) {
  3598 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3599 + maps.put("slow", "");
  3600 + } else {
  3601 + maps.put("fast", "");
  3602 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3603 + }
  3604 + } else {
  3605 + maps.put("fast", "");
  3606 + maps.put("slow", "");
  3607 + }
  3608 + listMap.add(maps);
  3609 + } catch (Exception e) {
  3610 + e.printStackTrace();
  3611 + }
  3612 + }
  3613 +
  3614 + String path1 = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3615 + list1.add(listMap.iterator());
  3616 + String xls="";
  3617 + if(map_.get("type").toString().equals("2")){
  3618 + xls="waybill_minhang_yd.xls";
  3619 + }else if(map_.get("type").toString().equals("0")){
  3620 + xls="waybill_minhang.xls";
  3621 + }else{
  3622 + xls="waybill_minhang_dl.xls";
  3623 + }
  3624 + map_.put("sheetName", jName + "-" + clZbh + "-" + lpName);
  3625 + ee.excelReplace(list1, new Object[]{map_}, path1 + "mould/"+xls,
  3626 + path1 + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
  3627 +
  3628 +
  3629 + //————————————————————————————————————————————————
  3630 +
  3631 + File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
  3632 + String fileName = file.getName();
  3633 + files.add(temp);
  3634 + }
  3635 + for(int i = 1; i < files.size(); i++){
  3636 + File file1 = files.get(0);
  3637 + File file2 = files.get(i);
  3638 + ee.copySheetByFile(file2, file1, 0, 145);
  3639 + }
  3640 + File newFile = files.get(0);
  3641 + newFile.renameTo(file);
  3642 +
  3643 + } catch (Exception e) {
  3644 + // TODO: handle exception
  3645 + e.printStackTrace();
  3646 + }
  3647 +
  3648 + map.put("fileName", file.getName());
  3649 + return map;
  3650 + }
  3651 +
2994 3652 }
... ...
src/main/resources/static/pages/forms/mould/waybill_minhang_yd.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/account.html
... ... @@ -114,7 +114,7 @@
114 114 }
115 115 }
116 116 initPinYinSelect2('#line',data,'');
117   -
  117 + initCl();
118 118 });
119 119 });
120 120 //重置
... ...
src/main/resources/static/pages/forms/statement/waybillJd.html
... ... @@ -93,7 +93,7 @@
93 93 </div>
94 94 </div>
95 95 </div>
96   -
  96 +<script src="/pages/mforms/singledatas/jquery.table2excel.min.js"></script>
97 97 <script>
98 98 $(function(){
99 99 var fage=false;
... ... @@ -333,11 +333,19 @@
333 333 return;
334 334 }
335 335 var i = layer.load(2);
336   - $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
  336 + $get('/busInterval/exportWaybillJd',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
337 337 var fileName=date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单";
338 338 window.open("/downloadFile/download?fileName="+encodeURIComponent(fileName));
339 339 layer.close(i);
340   - });
  340 + });
  341 +// $("#forms").table2excel({
  342 +// // 不被导出的表格行的CSS class类
  343 +// exclude: ".noExl",
  344 +// // 导出的Excel文档的名称,(没看到作用)
  345 +// name: "Excel Document Name.xlsx",
  346 +// // Excel文件的名称
  347 +// filename: date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单"
  348 +// });
341 349 });
342 350  
343 351 $("#print").click(function(){
... ... @@ -363,7 +371,7 @@
363 371 });
364 372 // $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){
365 373 // window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包
366   - $get('/busInterval/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){
  374 + $get('/busInterval/exportWaybillMoreJd',{date:date,line:line,strs:JSON.stringify(param)},function(result){
367 375 window.open("/downloadFile/download?fileName="+result.fileName);
368 376 layer.close(i);
369 377 });
... ... @@ -439,11 +447,12 @@
439 447 <td colspan="4">本日耗电 {{yh}}度</td>
440 448 {{/if}}
441 449 {{if type==2}}
442   - <td colspan="2">出场存电 {{ccyl}}%</td>
443   - <td colspan="2">充电量 {{jzl}}度</td>
444   - <td colspan="2">进场存电 {{jcyl}}%</td>
  450 + <td colspan="2">出场存电 {{ccyl_}}%<br/>
  451 + 出场存油{{ccyl}}升</td>
  452 + <td colspan="2">充电量 {{jzl_}}度<br/>加注量{{jzl}}升</td>
  453 + <td colspan="2">进场存电 {{jcyl_}}%<br/>进场存油 {{jcyl}}升</td>
445 454 <td colspan="4">加注机油 &nbsp;升</td>
446   - <td colspan="4">本日耗电 {{yh}}度</td>
  455 + <td colspan="4">本日耗电 {{yh_}}度<br/>本日耗油 {{yh}}升</td>
447 456 {{/if}}
448 457 </tr>
449 458 <tr>
... ...