Commit 3fc3dfb3c60d28fe02844b2e1c064bfc8d3eb487

Authored by 娄高锋
1 parent f8e1eb2d

预算公里/人次/营收以月为单位统计报表;二级报表二级表导出。

Showing 28 changed files with 2587 additions and 395 deletions
src/main/java/com/bsth/controller/calc/CalcWaybillController.java
... ... @@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
10 10 import org.springframework.web.bind.annotation.RequestParam;
11 11 import org.springframework.web.bind.annotation.RestController;
12 12  
  13 +import java.text.SimpleDateFormat;
  14 +import java.util.Date;
13 15 import java.util.HashMap;
14 16 import java.util.List;
15 17 import java.util.Map;
... ... @@ -26,10 +28,17 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer>
26 28  
27 29 @RequestMapping(value="/generateNew")
28 30 public Map<String, Object> generateNews(@RequestParam Map<String, Object> map) throws Exception{
29   - String date = "", line = "", key="";
  31 + Map<String, Object> resMap = new HashMap<String, Object>();
  32 + String date = "", date1 = "", date2 = "", line = "", key="";
30 33 if(map.get("date")!=null){
31 34 date=map.get("date").toString().trim();
32 35 }
  36 + if(map.get("date1")!=null){
  37 + date1=map.get("date1").toString().trim();
  38 + }
  39 + if(map.get("date2")!=null){
  40 + date2=map.get("date2").toString().trim();
  41 + }
33 42 if(map.get("line")!=null){
34 43 line=map.get("line").toString().trim();
35 44 }
... ... @@ -37,25 +46,65 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
37 46 key=map.get("key").toString().trim();
38 47 }
39 48  
40   - Map<String, Object> m = new HashMap<String, Object>();
41   - m.put("date", date);
42   - m.put("line", line);
43   - m.put("key", key);
44   - try {
45   -
46   - m = calcWaybillService.generateNew(date, line);
47   -
48   - if(key.length() == 0){
49   - m.put("status", calcWaybillService.calcDaily(date, line));
  49 + if(date.length() > 0){
  50 + try {
  51 +
  52 + if(key.length() == 0){
  53 + resMap = calcWaybillService.generateNew(date, line);
  54 + resMap.put("status", calcWaybillService.calcDaily(date, line));
  55 + } else if("1".equals(key)){
  56 + resMap = calcWaybillService.generateNew(date, line);
  57 + } else if("2".equals(key)){
  58 + resMap.put("status", calcWaybillService.calcDaily(date, line));
  59 + }
  60 +
  61 + } catch (Exception e) {
  62 + // TODO: handle exception
  63 + e.printStackTrace();
  64 + resMap.put("status", ResponseCode.ERROR);
  65 + resMap.put("date", date);
  66 + resMap.put("line", line);
  67 + resMap.put("key", key);
  68 + return resMap;
50 69 }
51   -
52   - } catch (Exception e) {
53   - // TODO: handle exception
54   - e.printStackTrace();
55   - m.put("status", ResponseCode.ERROR);
56   - return m;
  70 + resMap.put("date", date);
  71 + resMap.put("line", line);
  72 + resMap.put("key", key);
  73 + } else if(date1.length() > 0 && date2.length() > 0){
  74 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  75 + Date parse1 = sdf.parse(date1);
  76 + Date parse2 = sdf.parse(date2);
  77 + for(Date d = new Date(parse1.getTime());
  78 + d.getTime() <= parse2.getTime();
  79 + d.setTime(d.getTime() + 1l*1000*60*60*24)){
  80 + try {
  81 +
  82 + if(key.length() == 0){
  83 + resMap = calcWaybillService.generateNew(sdf.format(d), line);
  84 + resMap.put("status", calcWaybillService.calcDaily(sdf.format(d), line));
  85 + } else if("1".equals(key)){
  86 + resMap = calcWaybillService.generateNew(sdf.format(d), line);
  87 + } else if("2".equals(key)){
  88 + resMap.put("status", calcWaybillService.calcDaily(sdf.format(d), line));
  89 + }
  90 +
  91 + } catch (Exception e) {
  92 + // TODO: handle exception
  93 + e.printStackTrace();
  94 + resMap.put("status", ResponseCode.ERROR);
  95 + resMap.put("date1", date1);
  96 + resMap.put("date2", date2);
  97 + resMap.put("line", line);
  98 + resMap.put("key", key);
  99 + return resMap;
  100 + }
  101 + }
  102 + resMap.put("date1", date1);
  103 + resMap.put("date2", date2);
  104 + resMap.put("line", line);
  105 + resMap.put("key", key);
57 106 }
58   - return m;
  107 + return resMap;
59 108 }
60 109  
61 110 @RequestMapping(value="/statisticsDailyTj")
... ... @@ -194,53 +243,103 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
194 243 @RequestMapping(value="/generateLineMileage")
195 244 public Map<String, Object> generateLineMileage(@RequestParam Map<String, Object> map) throws Exception{
196 245 Map<String, Object> m = new HashMap<String, Object>();
197   - String date = "", line = "";
  246 + String date = "", date1 = "", date2 = "", line = "";
198 247 try {
199 248  
200 249 if(map.containsKey("date") && map.get("date")!=null){
201 250 date=map.get("date").toString().trim();
202 251 }
  252 + if(map.containsKey("date1") && map.get("date1")!=null){
  253 + date1=map.get("date1").toString().trim();
  254 + }
  255 + if(map.containsKey("date2") && map.get("date2")!=null){
  256 + date2=map.get("date2").toString().trim();
  257 + }
203 258 if(map.containsKey("line") && map.get("line")!=null){
204 259 line=map.get("line").toString().trim();
205 260 }
206 261  
207 262  
208   - return calcWaybillService.calcLineMileage(date, line);
209   -
  263 + m.put("line", line);
  264 + if(date.length() > 0){
  265 + m.put("date", date);
  266 + Map<String, Object> calcLineMileage = calcWaybillService.calcLineMileage(date, line);
  267 + for(String key : calcLineMileage.keySet()){
  268 + m.put(key, calcLineMileage.get(key));
  269 + }
  270 + } else if(date1.length() > 0 && date2.length() > 0){
  271 + m.put("date1", date1);
  272 + m.put("date2", date2);
  273 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  274 + Date parse1 = sdf.parse(date1);
  275 + Date parse2 = sdf.parse(date2);
  276 + for(Date d = new Date(parse1.getTime());
  277 + d.getTime() <= parse2.getTime();
  278 + d.setTime(d.getTime() + 1l*1000*60*60*24)){
  279 + Map<String, Object> calcLineMileage = calcWaybillService.calcLineMileage(sdf.format(d), line);
  280 + for(String key : calcLineMileage.keySet()){
  281 + m.put(key, calcLineMileage.get(key));
  282 + }
  283 + }
  284 + }
210 285 } catch (Exception e) {
211 286 // TODO: handle exception
212 287 e.printStackTrace();
213 288 m.put("status", ResponseCode.ERROR);
214   - m.put("date", date);
215   - m.put("line", line);
216 289 return m;
217 290 }
  291 + return m;
218 292 }
219 293  
220 294 @RequestMapping(value="/generateBusMileage")
221 295 public Map<String, Object> generateBusMileage(@RequestParam Map<String, Object> map) throws Exception{
222 296 Map<String, Object> m = new HashMap<String, Object>();
223   - String date = "", line = "";
  297 + String date = "", date1 = "", date2 = "", line = "";
224 298 try {
225 299  
226 300 if(map.containsKey("date") && map.get("date")!=null){
227 301 date=map.get("date").toString().trim();
228 302 }
  303 + if(map.containsKey("date1") && map.get("date1")!=null){
  304 + date1=map.get("date1").toString().trim();
  305 + }
  306 + if(map.containsKey("date2") && map.get("date2")!=null){
  307 + date2=map.get("date2").toString().trim();
  308 + }
229 309 if(map.containsKey("line") && map.get("line")!=null){
230 310 line=map.get("line").toString().trim();
231 311 }
232 312  
233 313  
234   - return calcWaybillService.calcBusMileage(date, line);
235   -
  314 + m.put("line", line);
  315 + if(date.length() > 0){
  316 + m.put("date", date);
  317 + Map<String, Object> calcBusMileage = calcWaybillService.calcBusMileage(date, line);
  318 + for(String key : calcBusMileage.keySet()){
  319 + m.put(key, calcBusMileage.get(key));
  320 + }
  321 + } else if(date1.length() > 0 && date2.length() > 0){
  322 + m.put("date1", date1);
  323 + m.put("date2", date2);
  324 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  325 + Date parse1 = sdf.parse(date1);
  326 + Date parse2 = sdf.parse(date2);
  327 + for(Date d = new Date(parse1.getTime());
  328 + d.getTime() <= parse2.getTime();
  329 + d.setTime(d.getTime() + 1l*1000*60*60*24)){
  330 + Map<String, Object> calcBusMileage = calcWaybillService.calcBusMileage(sdf.format(d), line);
  331 + for(String key : calcBusMileage.keySet()){
  332 + m.put(key, calcBusMileage.get(key));
  333 + }
  334 + }
  335 + }
236 336 } catch (Exception e) {
237 337 // TODO: handle exception
238 338 e.printStackTrace();
239 339 m.put("status", ResponseCode.ERROR);
240   - m.put("date", date);
241   - m.put("line", line);
242 340 return m;
243 341 }
  342 + return m;
244 343 }
245 344  
246 345 @RequestMapping(value="/getLineMileage")
... ...
src/main/java/com/bsth/controller/forms/BudgetController.java
... ... @@ -18,13 +18,9 @@ import org.springframework.web.multipart.MultipartFile;
18 18 import com.bsth.common.ResponseCode;
19 19 import com.bsth.controller.BaseController;
20 20 import com.bsth.entity.forms.Budget;
21   -import com.bsth.entity.forms.Revenue;
22 21 import com.bsth.service.forms.BudgetService;
23   -import com.bsth.service.forms.impl.RevenueLoader;
24 22 import com.google.common.io.Files;
25 23  
26   -import lombok.experimental.var;
27   -
28 24 @RestController
29 25 @RequestMapping("budget")
30 26 public class BudgetController extends BaseController<Budget, Integer>{
... ... @@ -95,10 +91,14 @@ public class BudgetController extends BaseController&lt;Budget, Integer&gt;{
95 91 if(map.get("type")!=null){
96 92 type=map.get("type").toString();
97 93 }
  94 + String key = "";
  95 + if(map.get("key")!=null){
  96 + key=map.get("key").toString();
  97 + }
98 98 String year = "";
99 99 if(map.get("year")!=null){
100 100 year=map.get("year").toString();
101   - return service.budgetMileage(year, type);
  101 + return service.budgetMileage(year, type, key);
102 102 } else {
103 103 return resList;
104 104 }
... ... @@ -111,10 +111,14 @@ public class BudgetController extends BaseController&lt;Budget, Integer&gt;{
111 111 if(map.get("type")!=null){
112 112 type=map.get("type").toString();
113 113 }
  114 + String key = "";
  115 + if(map.get("key")!=null){
  116 + key=map.get("key").toString();
  117 + }
114 118 String year = "";
115 119 if(map.get("year")!=null){
116 120 year=map.get("year").toString();
117   - return service.budgetPerson(year, type);
  121 + return service.budgetPerson(year, type, key);
118 122 } else {
119 123 return resList;
120 124 }
... ... @@ -127,10 +131,14 @@ public class BudgetController extends BaseController&lt;Budget, Integer&gt;{
127 131 if(map.get("type")!=null){
128 132 type=map.get("type").toString();
129 133 }
  134 + String key = "";
  135 + if(map.get("key")!=null){
  136 + key=map.get("key").toString();
  137 + }
130 138 String year = "";
131 139 if(map.get("year")!=null){
132 140 year=map.get("year").toString();
133   - return service.budgetAmounts(year, type);
  141 + return service.budgetAmounts(year, type, key);
134 142 } else {
135 143 return resList;
136 144 }
... ... @@ -139,16 +147,45 @@ public class BudgetController extends BaseController&lt;Budget, Integer&gt;{
139 147 @RequestMapping(value = "/budgetSum", method = RequestMethod.POST)
140 148 public List<Map<String, Object>> budgetSum(@RequestParam Map<String, Object> map) {
141 149 List<Map<String, Object>> resList=new ArrayList<Map<String, Object>>();
  150 + String nature="0";
  151 + if(map.get("nature")!=null){
  152 + nature=map.get("nature").toString();
  153 + }
142 154 String type = "";
143 155 if(map.get("type")!=null){
144 156 type=map.get("type").toString();
145 157 }
  158 + String key = "";
  159 + if(map.get("key")!=null){
  160 + key=map.get("key").toString();
  161 + }
146 162 String year = "";
147 163 if(map.get("year")!=null){
148 164 year=map.get("year").toString();
149   - return service.budgetSum(year, type);
  165 + return service.budgetSum(year, nature, type, key);
150 166 } else {
151 167 return resList;
152 168 }
153 169 }
  170 +
  171 + @RequestMapping(value = "/timeSum", method = RequestMethod.POST)
  172 + public List<Map<String, Object>> timeSum(@RequestParam Map<String, Object> map) throws Exception{
  173 + String type = "";
  174 + if(map.get("type")!=null){
  175 + type=map.get("type").toString();
  176 + }
  177 + String date = "";
  178 + if(map.get("date")!=null){
  179 + date=map.get("date").toString();
  180 + }
  181 + String date2 = "";
  182 + if(map.get("date2")!=null){
  183 + date2=map.get("date2").toString();
  184 + }
  185 + String key = "";
  186 + if(map.get("key")!=null){
  187 + key=map.get("key").toString();
  188 + }
  189 + return service.timeSum(date, date2, type, key);
  190 + }
154 191 }
... ...
src/main/java/com/bsth/entity/forms/Budget.java
... ... @@ -22,7 +22,7 @@ public class Budget {
22 22 @Id
23 23 @GeneratedValue(strategy = GenerationType.IDENTITY)
24 24 private Long id;
25   - //年份
  25 + //月份(原计划以年为单位,后改为每月)
26 26 private String year;
27 27 //公司编码
28 28 private String gsBm;
... ... @@ -45,11 +45,11 @@ public class Budget {
45 45 //预算正式公里 = if(有调整){调整}else{预算}
46 46 private Double formalMileage;
47 47 //预算人次
48   - private Long budgetPerson;
  48 + private Double budgetPerson;
49 49 //预算调整人次
50   - private Long changePerson;
  50 + private Double changePerson;
51 51 //预算正式人次 = if(有调整){调整}else{预算}
52   - private Long formalPerson;
  52 + private Double formalPerson;
53 53 //预算营收
54 54 private Double budgetAmounts;
55 55 //预算调整营收
... ... @@ -165,27 +165,27 @@ public class Budget {
165 165 this.formalMileage = formalMileage;
166 166 }
167 167 //预算人次
168   - public Long getBudgetPerson() {
  168 + public Double getBudgetPerson() {
169 169 return budgetPerson;
170 170 }
171 171 //预算人次
172   - public void setBudgetPerson(Long budgetPerson) {
  172 + public void setBudgetPerson(Double budgetPerson) {
173 173 this.budgetPerson = budgetPerson;
174 174 }
175 175 //预算调整人次
176   - public Long getChangePerson() {
  176 + public Double getChangePerson() {
177 177 return changePerson;
178 178 }
179 179 //预算调整人次
180   - public void setChangePerson(Long changePerson) {
  180 + public void setChangePerson(Double changePerson) {
181 181 this.changePerson = changePerson;
182 182 }
183 183 //预算正式人次 = if(有调整){调整}else{预算}
184   - public Long getFormalPerson() {
  184 + public Double getFormalPerson() {
185 185 return formalPerson;
186 186 }
187 187 //预算正式人次 = if(有调整){调整}else{预算}
188   - public void setFormalPerson(Long formalPerson) {
  188 + public void setFormalPerson(Double formalPerson) {
189 189 this.formalPerson = formalPerson;
190 190 }
191 191 //预算营收
... ...
src/main/java/com/bsth/repository/form/BudgetRepository.java
... ... @@ -14,7 +14,7 @@ import org.springframework.stereotype.Repository;
14 14 @Repository
15 15 public interface BudgetRepository extends BaseRepository<Budget, Integer>{
16 16  
17   - @Query(value="SELECT b FROM Budget b where b.year = ?1 ")
  17 + @Query(value="SELECT b FROM Budget b where b.year like %?1% ")
18 18 List<Budget> findByYear(String year);
19 19  
20 20 @Query(value="SELECT b FROM Budget b where b.year = ?1 and b.gsBm = ?2 and b.xlBm = ?3 ")
... ... @@ -26,6 +26,6 @@ public interface BudgetRepository extends BaseRepository&lt;Budget, Integer&gt;{
26 26 + "b.budgetPerson=?4,b.changePerson=?5,b.formalPerson=?6,"
27 27 + "b.budgetAmounts=?7,b.changeAmounts=?8,b.formalAmounts=?9 where b.id=?10 ")
28 28 Integer update(Double budgetMileage, Double changeMileage, Double formalMileage,
29   - Long budgetPerson, Long changePerson, Long formalPerson,
  29 + Double budgetPerson, Double changePerson, Double formalPerson,
30 30 Double budgetAmounts, Double changeAmounts, Double formalAmounts, Long id);
31 31 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -12,6 +12,8 @@ import org.springframework.data.jpa.repository.Query;
12 12 import org.springframework.stereotype.Repository;
13 13  
14 14 import javax.transaction.Transactional;
  15 +
  16 +import java.util.Date;
15 17 import java.util.List;
16 18 import java.util.Map;
17 19  
... ... @@ -237,4 +239,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
237 239 @Query(value = "select count (s.id) from ScheduleRealInfo s where s.clZbh=?1 and s.scheduleDateStr=?2 and s.xlBm=?3 and s.qdzCode=?4")
238 240 Long isCircleQdz(String clzbh,String sdr,String xlbm,String qdzCode);
239 241  
  242 + @Query(value = " select schedule_date_str, xl_bm, j_gh, s_gh from bsth_c_s_sp_info_real " +
  243 + "where schedule_date_str >= ?1 and schedule_date_str <= ?2 " +
  244 + "and adjust_exps = ?3 " +
  245 + "group by schedule_date_str, xl_bm, j_gh, s_gh ", nativeQuery = true)
  246 + List<Object[]> findCancelSchedule(String date1, String date2, String lbType);
240 247 }
... ...
src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
... ... @@ -3,6 +3,7 @@ package com.bsth.repository.schedule;
3 3 import com.bsth.entity.schedule.CarConfigInfo;
4 4 import com.bsth.repository.BaseRepository;
5 5  
  6 +import java.util.Date;
6 7 import java.util.List;
7 8 import java.util.Map;
8 9  
... ... @@ -53,4 +54,14 @@ public interface CarConfigInfoRepository extends BaseRepository&lt;CarConfigInfo, L
53 54  
54 55 @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
55 56 List<CarConfigInfo> findByClId(Integer clid);
  57 +
  58 + @Query(value = " select (select line_code from bsth_c_line where id = e.xl) line_code, " +
  59 + "(select inside_code from bsth_c_cars where id = e.cl) nbbm from ( " +
  60 + "select max(c.create_date) create_date, c.cl from( " +
  61 + "select max(qyrq) qyrq, cl from (select * from bsth_c_s_ccinfo where qyrq <= ?1 ) a " +
  62 + "group by cl ) b " +
  63 + "left join bsth_c_s_ccinfo c on c.qyrq = b.qyrq and c.cl = b.cl " +
  64 + "group by c.cl ) d left join bsth_c_s_ccinfo e " +
  65 + "on e.create_date = d.create_date and e.cl = d.cl ", nativeQuery = true)
  66 + List<Object[]> findLineConfigCar(Date date);
56 67 }
57 68 \ No newline at end of file
... ...
src/main/java/com/bsth/repository/schedule/EmployeeConfigInfoRepository.java
... ... @@ -4,6 +4,7 @@ import com.bsth.entity.schedule.CarConfigInfo;
4 4 import com.bsth.entity.schedule.EmployeeConfigInfo;
5 5 import com.bsth.repository.BaseRepository;
6 6  
  7 +import java.util.Date;
7 8 import java.util.List;
8 9 import java.util.Map;
9 10  
... ... @@ -54,4 +55,13 @@ public interface EmployeeConfigInfoRepository extends BaseRepository&lt;EmployeeCon
54 55 "ec.spy.personnelName as spyName) " +
55 56 "from EmployeeConfigInfo ec ")
56 57 List<Map<String, Object>> findSpyFromConfig();
  58 +
  59 + @Query(value = " select c.* from ( " +
  60 + "select max(create_date)create_date, jsy, IFNULL(spy, '') spy " +
  61 + "from (select * from bsth_c_s_ecinfo where create_date <= ?) a " +
  62 + "group by jsy, spy ) b " +
  63 + "left join bsth_c_s_ecinfo c " +
  64 + "on c.jsy = b.jsy and IFNULL(c.spy, '') = b.spy " +
  65 + "and c.create_date = b.create_date ", nativeQuery = true)
  66 + List<Object[]> findLineConfigEmp(Date date);
57 67 }
... ...
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
... ... @@ -23,6 +23,9 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
23 23  
24 24 @Query(value = "select s from SchedulePlanInfo s where scheduleDate=?1")
25 25 List<SchedulePlanInfo> findByDate(Date date);
  26 +
  27 + @Query(value = "select s from SchedulePlanInfo s where scheduleDate >= ?1 and scheduleDate <= ?2 order by scheduleDate, xl_name, lp_name, bcs")
  28 + List<SchedulePlanInfo> findByDates(Date date1, Date date2);
26 29  
27 30 @Query(value = " select " +
28 31 "info.xl as xlId, " +
... ... @@ -125,4 +128,36 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
125 128 @Query(value="select s from SchedulePlanInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 order by s.xlBm,clZbh,lp,xlDir")
126 129 List<SchedulePlanInfo> findLineScheduleBc(String scheduleDate);
127 130  
  131 + @Query(value = " select gs_bm, xl_bm, max(num) num from ( " +
  132 + "select schedule_date, gs_bm, xl_bm, count(*) num from ( " +
  133 + "select schedule_date, gs_bm, xl_bm, cl_zbh from bsth_c_s_sp_info " +
  134 + "where schedule_date >= ?1 and schedule_date <= ?2 " +
  135 + "group by schedule_date, gs_bm, xl_bm, cl_zbh " +
  136 + ")a group by schedule_date, gs_bm, xl_bm " +
  137 + ")b group by gs_bm, xl_bm ", nativeQuery = true)
  138 + List<Object[]> findPlanGroupCar(Date date1, Date date2);
  139 +
  140 + @Query(value = " select gs_bm, xl_bm, max(num) num from ( " +
  141 + "select schedule_date, gs_bm, xl_bm, count(*) num from ( " +
  142 + "select schedule_date, gs_bm, xl_bm, j_gh from bsth_c_s_sp_info " +
  143 + "where schedule_date >= ?1 and schedule_date <= ?2 " +
  144 + "group by schedule_date, gs_bm, xl_bm, j_gh " +
  145 + ")a group by schedule_date, gs_bm, xl_bm " +
  146 + ")b group by gs_bm, xl_bm ", nativeQuery = true)
  147 + List<Object[]> findPlanGroupDriver(Date date1, Date date2);
  148 +
  149 + @Query(value = " select gs_bm, xl_bm, max(num) num from ( " +
  150 + "select schedule_date, gs_bm, xl_bm, count(*) num from ( " +
  151 + "select schedule_date, gs_bm, xl_bm, s_gh from bsth_c_s_sp_info " +
  152 + "where schedule_date >= ?1 and schedule_date <= ?2 " +
  153 + "and s_gh is not null and s_gh != '' " +
  154 + "group by schedule_date, gs_bm, xl_bm, s_gh " +
  155 + ")a group by schedule_date, gs_bm, xl_bm " +
  156 + ")b group by gs_bm, xl_bm ", nativeQuery = true)
  157 + List<Object[]> findPlanGroupBusConductor(Date date1, Date date2);
  158 +
  159 + @Query(value = " select schedule_date, xl_bm, j_gh, s_gh from bsth_c_s_sp_info " +
  160 + "where schedule_date >= ?1 and schedule_date <= ?2 " +
  161 + "group by schedule_date, xl_bm, j_gh, s_gh ", nativeQuery = true)
  162 + List<Object[]> findPersonnelSchedule(Date date1, Date date2);
128 163 }
... ...
src/main/java/com/bsth/service/forms/BudgetService.java
... ... @@ -17,11 +17,13 @@ public interface BudgetService extends BaseService&lt;Budget, Integer&gt; {
17 17  
18 18 public void updateRevenueRange(String date1, String date2);
19 19  
20   - public List<Map<String, Object>> budgetMileage(String year, String type);
  20 + public List<Map<String, Object>> budgetMileage(String year, String type, String key);
21 21  
22   - public List<Map<String, Object>> budgetPerson(String year, String type);
  22 + public List<Map<String, Object>> budgetPerson(String year, String type, String key);
23 23  
24   - public List<Map<String, Object>> budgetAmounts(String year, String type);
  24 + public List<Map<String, Object>> budgetAmounts(String year, String type, String key);
25 25  
26   - public List<Map<String, Object>> budgetSum(String year, String type);
  26 + public List<Map<String, Object>> budgetSum(String year, String nature, String type, String key);
  27 +
  28 + public List<Map<String, Object>> timeSum(String date, String date2, String type, String key) throws Exception;
27 29 }
... ...
src/main/java/com/bsth/service/forms/impl/BudgetServiceImpl.java
... ... @@ -37,9 +37,14 @@ import com.bsth.entity.Line;
37 37 import com.bsth.entity.calc.CalcStatistics;
38 38 import com.bsth.entity.forms.Budget;
39 39 import com.bsth.entity.forms.Revenue;
  40 +import com.bsth.entity.schedule.SchedulePlanInfo;
40 41 import com.bsth.repository.calc.CalcStatisticsRepository;
41 42 import com.bsth.repository.form.BudgetRepository;
42 43 import com.bsth.repository.form.RevenueRepository;
  44 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  45 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  46 +import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
  47 +import com.bsth.repository.schedule.SchedulePlanInfoRepository;
43 48 import com.bsth.service.LineService;
44 49 import com.bsth.service.forms.BudgetService;
45 50 import com.bsth.service.impl.BaseServiceImpl;
... ... @@ -58,9 +63,21 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
58 63 private LineService lineService;
59 64  
60 65 @Autowired
  66 + private CarConfigInfoRepository ccRepository;
  67 +
  68 + @Autowired
  69 + private EmployeeConfigInfoRepository ecRepository;
  70 +
  71 + @Autowired
61 72 private CalcStatisticsRepository calcStatisticsRepository;
62 73  
63 74 @Autowired
  75 + private SchedulePlanInfoRepository schedulePlanRepository;
  76 +
  77 + @Autowired
  78 + private ScheduleRealInfoRepository scheduleRealRepository;
  79 +
  80 + @Autowired
64 81 JdbcTemplate jdbcTemplate;
65 82  
66 83 Logger logger = LoggerFactory.getLogger(this.getClass());
... ... @@ -70,7 +87,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
70 87 SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy");
71 88 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
72 89 SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
73   - DecimalFormat df = new DecimalFormat("######0.00");
  90 + DecimalFormat df = new DecimalFormat("######0.000");
74 91 List<String> textList = new ArrayList<String>();
75 92 List<Budget> list = new ArrayList<Budget>();
76 93 String msg = "", tempMsg = "";
... ... @@ -84,7 +101,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
84 101 int cellNum = sheet.getRow(0).getLastCellNum();
85 102 HSSFRow row = null;
86 103 HSSFCell cell = null;
87   - for(int i = 2; i < rowNum; i++){
  104 + for(int i = 3; i < rowNum; i++){
88 105 row = sheet.getRow(i);
89 106 if (row == null){
90 107 continue;
... ... @@ -96,7 +113,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
96 113 text += ",";
97 114 continue;
98 115 }
99   - text += String.valueOf(cell) + ",";
  116 + text += String.valueOf(cell) + ",";
100 117 }
101 118 String[] split = (text+";").split(",");
102 119 String str = "";
... ... @@ -129,7 +146,6 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
129 146 String year = split[1].trim();
130 147 String gsName = split[2].trim().replaceAll("公司", "");
131 148 String xlName = split[3].trim();
132   - Date yyyy = null;
133 149 Line line = null;
134 150 String gsBm = "";
135 151 for(String key : BasicData.businessCodeNameMap.keySet()){
... ... @@ -139,13 +155,11 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
139 155 }
140 156 }
141 157 boolean sfyy = false;
142   - Double formalMileage = null, formalAmounts = null;
143   - Long formalPerson = null;
144 158 if(year.length() == 0){
145 159 msg += "第"+(rowNo+1)+"行,没有年份;\\n";
146 160 } else {
147 161 try {
148   - yyyy = yearFormat.parse(year);
  162 + yearFormat.parse(year);
149 163 } catch (ParseException pe) {
150 164 // TODO: handle exception
151 165 pe.printStackTrace();
... ... @@ -162,36 +176,39 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
162 176 msg += "第"+(rowNo+1)+"行,线路基础信息无此线路;\\n";
163 177 }
164 178 }
165   - String mileage = split[4].trim();
166   - String person = split[5].trim();
167   - String amounts = split[6].trim();
168   - try {
169   - if(mileage.length() > 0){
170   - formalMileage = Double.valueOf(mileage);
171   - }
172   - if(person.length() > 0){
173   - formalPerson = Long.valueOf(person);
174   - }
175   - if(amounts.length() > 0){
176   - formalAmounts = Double.valueOf(amounts);
  179 + int left = 3;
  180 + for(int mon = 1; mon <= 12; mon++){
  181 + String mileage = split[left+(mon-1)*3+1].trim();
  182 + String person = split[left+(mon-1)*3+2].trim();
  183 + String amounts = split[left+(mon-1)*3+3].trim();
  184 + Double formalMileage = null, formalPerson = null, formalAmounts = null;
  185 + try {
  186 + if(mileage.length() > 0){
  187 + formalMileage = Double.valueOf(df.format(Double.valueOf(mileage)));
  188 + }
  189 + if(person.length() > 0){
  190 + formalPerson = Double.valueOf(df.format(Double.valueOf(person)));
  191 + }
  192 + if(amounts.length() > 0){
  193 + formalAmounts = Double.valueOf(df.format(Double.valueOf(amounts)));
  194 + }
  195 + Budget b = new Budget();
  196 + b.setYear(year + "-" + (mon>9?mon:("0"+mon)));
  197 + b.setGsBm(gsBm);
  198 + b.setGsName(BasicData.businessCodeNameMap.get(gsBm));
  199 + b.setXlBm(line!=null?line.getLineCode():"");
  200 + b.setXlName(line!=null?line.getName():"");
  201 + b.setSfyy(sfyy);
  202 + b.setFormalMileage(formalMileage);
  203 + b.setFormalPerson(formalPerson);
  204 + b.setFormalAmounts(formalAmounts);
  205 + list.add(b);
  206 + } catch (NumberFormatException nfe) {
  207 + // TODO: handle exception
  208 + nfe.printStackTrace();
  209 + msg += "第"+(rowNo+1)+"行,数字格式异常;\\n";
177 210 }
178   - } catch (NumberFormatException nfe) {
179   - // TODO: handle exception
180   - nfe.printStackTrace();
181   - msg += "第"+(rowNo+1)+"行,数字格式异常;\\n";
182 211 }
183   -
184   - Budget b = new Budget();
185   - b.setYear(year);
186   - b.setGsBm(gsBm);
187   - b.setGsName(BasicData.businessCodeNameMap.get(gsBm));
188   - b.setXlBm(line.getLineCode());
189   - b.setXlName(line.getName());
190   - b.setSfyy(sfyy);
191   - b.setFormalMileage(formalMileage);
192   - b.setFormalPerson(formalPerson);
193   - b.setFormalAmounts(formalAmounts);
194   - list.add(b);
195 212 }
196 213  
197 214 List<Budget> insertList = new ArrayList<Budget>();
... ... @@ -200,13 +217,13 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
200 217 List<Budget> budgets = repository.import_queryBySame(b.getYear(), b.getGsBm(), b.getXlBm());
201 218 if(budgets.size() > 0) {
202 219 Budget bud = budgets.get(0);
203   - if(b.getFormalMileage() != null){
  220 + if(b.getFormalPerson() != null){
204 221 if(bud.getBudgetMileage() != null){
205   - bud.setChangeMileage(b.getFormalMileage());
  222 + bud.setChangeMileage(b.getFormalPerson());
206 223 } else {
207   - bud.setBudgetMileage(b.getFormalMileage());
  224 + bud.setBudgetMileage(b.getFormalPerson());
208 225 }
209   - bud.setFormalMileage(b.getFormalMileage());
  226 + bud.setFormalMileage(b.getFormalPerson());
210 227 }
211 228 if(b.getFormalPerson() != null){
212 229 if(bud.getBudgetPerson() != null){
... ... @@ -224,11 +241,11 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
224 241 }
225 242 bud.setFormalAmounts(b.getFormalAmounts());
226 243 }
227   - repository.update(bud.getBudgetMileage(), bud.getChangeMileage(), bud.getFormalMileage(),
  244 + repository.update(bud.getBudgetMileage(), bud.getChangeMileage(), bud.getFormalPerson(),
228 245 bud.getBudgetPerson(), bud.getChangePerson(), bud.getFormalPerson(),
229 246 bud.getBudgetAmounts(), bud.getChangeAmounts(), bud.getFormalAmounts(), bud.getId());
230 247 } else {
231   - b.setBudgetMileage(b.getFormalMileage());
  248 + b.setBudgetMileage(b.getFormalPerson());
232 249 b.setBudgetPerson(b.getFormalPerson());
233 250 b.setBudgetAmounts(b.getFormalAmounts());
234 251 insertList.add(b);
... ... @@ -401,7 +418,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
401 418 }
402 419  
403 420 @Override
404   - public List<Map<String, Object>> budgetMileage(String year, String tttt) {
  421 + public List<Map<String, Object>> budgetMileage(String year, String tttt, String kkk) {
405 422 // TODO Auto-generated method stub
406 423 SimpleDateFormat sdfMM = new SimpleDateFormat("MM");
407 424 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
... ... @@ -416,9 +433,13 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
416 433 String[] strs = createBudgetMap(resList, keyMap);
417 434  
418 435 for(Budget b : findByYear){
  436 + if(!(b.getYear().contains("-")) || b.getYear().length() != 7){
  437 + continue;
  438 + }
419 439 if(b.getFormalMileage()==null || b.getFormalMileage() < 0d){
420 440 continue;
421 441 }
  442 + System.out.println(b.getId());
422 443 String gsBm = b.getGsBm();
423 444 String xlBm = b.getXlBm();
424 445 String xlName = b.getXlName();
... ... @@ -439,10 +460,47 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
439 460 m.put("formal", b.getFormalMileage()!=null?b.getFormalMileage():"");
440 461 for(int i = 1; i <= 12; i++){
441 462 m.put("mon"+i, "");
  463 + m.put("bud"+i, "");
  464 + }
  465 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  466 + if(b.getFormalMileage()!=null){
  467 + m.put(bud, b.getFormalMileage());
442 468 }
443 469 m.put("monAll", "0");
444 470 xlMap.put(key, m);
445 471 xlList.add(m);
  472 + } else {
  473 + Map<String, Object> m = xlMap.get(key);
  474 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  475 + if(b.getBudgetMileage()!=null){
  476 + if(m.get("budget").toString().length() > 0){
  477 + m.put("budget", new BigDecimal(m.get("budget").toString()).add(
  478 + new BigDecimal(b.getBudgetMileage())).doubleValue());
  479 + } else {
  480 + m.put("budget", b.getBudgetMileage());
  481 + }
  482 + }
  483 + if(b.getChangeMileage()!=null){
  484 + if(m.get("change").toString().length() > 0){
  485 + m.put("change", new BigDecimal(m.get("change").toString()).add(
  486 + new BigDecimal(b.getChangeMileage())).doubleValue());
  487 + } else {
  488 + m.put("change", b.getChangeMileage());
  489 + }
  490 + }
  491 + if(b.getFormalMileage()!=null){
  492 + if(m.get("formal").toString().length() > 0){
  493 + m.put("formal", new BigDecimal(m.get("formal").toString()).add(
  494 + new BigDecimal(b.getFormalMileage())).doubleValue());
  495 + } else {
  496 + m.put("formal", b.getFormalMileage());
  497 + }
  498 + m.put(bud, b.getFormalMileage());
  499 + }
  500 + System.out.println(m);
  501 + System.out.println(b.getBudgetMileage());
  502 + System.out.println(b.getChangeMileage());
  503 + System.out.println(b.getFormalMileage());
446 504 }
447 505 }
448 506  
... ... @@ -467,6 +525,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
467 525 m.put("formal", "");
468 526 for(int i = 1; i <= 12; i++){
469 527 m.put("mon"+i, "");
  528 + m.put("bud"+i, "");
470 529 }
471 530 m.put("monAll", "0");
472 531 xlMap.put(key, m);
... ... @@ -506,6 +565,9 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
506 565 strList.add(gsBm + "_all");
507 566  
508 567 for(String str : strList){
  568 + if(!keyMap.containsKey(str)){
  569 + continue;
  570 + }
509 571 Map<String, Object> map = keyMap.get(str);
510 572 if(m.get("budget").toString().length() > 0){
511 573 if(map.get("budget").toString().length() > 0){
... ... @@ -532,7 +594,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
532 594 }
533 595 }
534 596 for(int i = 1; i <= 12; i++){
535   - String mon = "mon"+i;
  597 + String mon = "mon"+i, bud = "bud"+i;
536 598 if(m.get(mon).toString().length() > 0){
537 599 if(map.get(mon).toString().length() > 0){
538 600 map.put(mon, new BigDecimal(m.get(mon).toString()).add(
... ... @@ -541,6 +603,14 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
541 603 map.put(mon, new BigDecimal(m.get(mon).toString()).doubleValue());
542 604 }
543 605 }
  606 + if(m.get(bud).toString().length() > 0){
  607 + if(map.get(bud).toString().length() > 0){
  608 + map.put(mon, new BigDecimal(m.get(bud).toString()).add(
  609 + new BigDecimal(map.get(bud).toString())).doubleValue());
  610 + } else {
  611 + map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue());
  612 + }
  613 + }
544 614 }
545 615 List<Map<String, Object>>dataList = (List<Map<String, Object>>)map.get("dataList");
546 616 dataList.add(m);
... ... @@ -594,6 +664,20 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
594 664 List<Map<String, Object>> dataList = (List<Map<String, Object>>)allMap.get("dataList");
595 665 dataList.addAll((List<Map<String, Object>>)map.get("dataList"));
596 666 allMap.put("dataList", dataList);
  667 +
  668 + for(Map<String, Object> m : dataList){
  669 + for(int i = 1; i <= 12; i++){
  670 + String mon = "mon" + i, bud = "bud" + i;
  671 + if(m.get(mon).toString().length() > 0 && m.get(bud).toString().length() > 0
  672 + && new BigDecimal(m.get(bud).toString()).doubleValue() > 0d){
  673 + BigDecimal a = new BigDecimal(m.get(mon).toString().length()>0?m.get(mon).toString():"0");
  674 + BigDecimal b = new BigDecimal(m.get(bud).toString());
  675 + m.put("com" + i, a.multiply(new BigDecimal(100)).divide(b, 2, BigDecimal.ROUND_HALF_UP)+ "%");
  676 + } else {
  677 + m.put("com" + i, "");
  678 + }
  679 + }
  680 + }
597 681 }
598 682 }
599 683  
... ... @@ -625,6 +709,18 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
625 709 m.put("diff", "");
626 710 }
627 711 m.put("year", year);
  712 +
  713 + for(int i = 1; i <= 12; i++){
  714 + String mon = "mon" + i, bud = "bud" + i;
  715 + if(m.get(mon).toString().length() > 0 && m.get(bud).toString().length() > 0
  716 + && new BigDecimal(m.get(bud).toString()).doubleValue() > 0d){
  717 + BigDecimal a = new BigDecimal(m.get(mon).toString().length()>0?m.get(mon).toString():"0");
  718 + BigDecimal b = new BigDecimal(m.get(bud).toString());
  719 + m.put("com" + i, a.multiply(new BigDecimal(100)).divide(b, 2, BigDecimal.ROUND_HALF_UP)+ "%");
  720 + } else {
  721 + m.put("com" + i, "");
  722 + }
  723 + }
628 724 }
629 725  
630 726 if(tttt.equals("export")){
... ... @@ -648,11 +744,35 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
648 744 }
649 745 }
650 746  
  747 + if(tttt.equals("exportData")){
  748 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  749 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  750 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  751 + Map<String, Object> m = new HashMap<String, Object>();
  752 + m.put("date", year);
  753 + ReportUtils ee = new ReportUtils();
  754 + try {
  755 + for(Map<String, Object> map : resList){
  756 + if(kkk.equals(map.get("key").toString())){
  757 + List<Map<String, Object>> dataList = (List<Map<String, Object>>)map.get("dataList");
  758 + listI.add(dataList.iterator());
  759 + }
  760 + }
  761 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  762 + ee.excelReplace(listI, new Object[]{m}, path + "mould/budgetMileage_data.xls",
  763 + path + "export/" + year + "-预算公里明细表-线路明细.xls");
  764 + } catch (Exception e) {
  765 + // TODO: handle exception
  766 + e.printStackTrace();
  767 + logger.info("", e);
  768 + }
  769 + }
  770 +
651 771 return resList;
652 772 }
653 773  
654 774 @Override
655   - public List<Map<String, Object>> budgetPerson(String year, String tttt) {
  775 + public List<Map<String, Object>> budgetPerson(String year, String tttt, String kkk) {
656 776 // TODO Auto-generated method stub
657 777 SimpleDateFormat sdfMM = new SimpleDateFormat("MM");
658 778 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
... ... @@ -667,6 +787,9 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
667 787 String[] strs = createBudgetMap(resList, keyMap);
668 788  
669 789 for(Budget b : findByYear){
  790 + if(!(b.getYear().contains("-")) || b.getYear().length() != 7){
  791 + continue;
  792 + }
670 793 if(b.getFormalPerson()==null || b.getFormalPerson() < 0d){
671 794 continue;
672 795 }
... ... @@ -690,10 +813,43 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
690 813 m.put("formal", b.getFormalPerson()!=null?b.getFormalPerson():"");
691 814 for(int i = 1; i <= 12; i++){
692 815 m.put("mon"+i, "");
  816 + m.put("bud"+i, "");
  817 + }
  818 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  819 + if(b.getFormalPerson()!=null){
  820 + m.put(bud, b.getFormalPerson());
693 821 }
694 822 m.put("monAll", "0");
695 823 xlMap.put(key, m);
696 824 xlList.add(m);
  825 + } else {
  826 + Map<String, Object> m = xlMap.get(key);
  827 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  828 + if(b.getBudgetPerson()!=null){
  829 + if(m.get("budget").toString().length() > 0){
  830 + m.put("budget", new BigDecimal(m.get("budget").toString()).add(
  831 + new BigDecimal(b.getBudgetPerson())).doubleValue());
  832 + } else {
  833 + m.put("budget", b.getBudgetPerson());
  834 + }
  835 + }
  836 + if(b.getChangePerson()!=null){
  837 + if(m.get("change").toString().length() > 0){
  838 + m.put("change", new BigDecimal(m.get("change").toString()).add(
  839 + new BigDecimal(b.getChangePerson())).doubleValue());
  840 + } else {
  841 + m.put("change", b.getChangePerson());
  842 + }
  843 + }
  844 + if(b.getFormalPerson()!=null){
  845 + if(m.get("formal").toString().length() > 0){
  846 + m.put("formal", new BigDecimal(m.get("formal").toString()).add(
  847 + new BigDecimal(b.getFormalPerson())).doubleValue());
  848 + } else {
  849 + m.put("formal", b.getFormalPerson());
  850 + }
  851 + m.put(bud, b.getFormalPerson());
  852 + }
697 853 }
698 854 }
699 855  
... ... @@ -718,6 +874,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
718 874 m.put("formal", "");
719 875 for(int i = 1; i <= 12; i++){
720 876 m.put("mon"+i, "");
  877 + m.put("bud"+i, "");
721 878 }
722 879 m.put("monAll", "0");
723 880 xlMap.put(key, m);
... ... @@ -757,6 +914,9 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
757 914 strList.add(gsBm + "_all");
758 915  
759 916 for(String str : strList){
  917 + if(!keyMap.containsKey(str)){
  918 + continue;
  919 + }
760 920 Map<String, Object> map = keyMap.get(str);
761 921 if(m.get("budget").toString().length() > 0){
762 922 if(map.get("budget").toString().length() > 0){
... ... @@ -783,7 +943,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
783 943 }
784 944 }
785 945 for(int i = 1; i <= 12; i++){
786   - String mon = "mon"+i;
  946 + String mon = "mon"+i, bud = "bud"+i;
787 947 if(m.get(mon).toString().length() > 0){
788 948 if(map.get(mon).toString().length() > 0){
789 949 map.put(mon, new BigDecimal(m.get(mon).toString()).add(
... ... @@ -792,6 +952,14 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
792 952 map.put(mon, new BigDecimal(m.get(mon).toString()).doubleValue());
793 953 }
794 954 }
  955 + if(m.get(bud).toString().length() > 0){
  956 + if(map.get(bud).toString().length() > 0){
  957 + map.put(mon, new BigDecimal(m.get(bud).toString()).add(
  958 + new BigDecimal(map.get(bud).toString())).doubleValue());
  959 + } else {
  960 + map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue());
  961 + }
  962 + }
795 963 }
796 964 List<Map<String, Object>>dataList = (List<Map<String, Object>>)map.get("dataList");
797 965 dataList.add(m);
... ... @@ -845,6 +1013,20 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
845 1013 List<Map<String, Object>> dataList = (List<Map<String, Object>>)allMap.get("dataList");
846 1014 dataList.addAll((List<Map<String, Object>>)map.get("dataList"));
847 1015 allMap.put("dataList", dataList);
  1016 +
  1017 + for(Map<String, Object> m : dataList){
  1018 + for(int i = 1; i <= 12; i++){
  1019 + String mon = "mon" + i, bud = "bud" + i;
  1020 + if(m.get(mon).toString().length() > 0 && m.get(bud).toString().length() > 0
  1021 + && new BigDecimal(m.get(bud).toString()).doubleValue() > 0d){
  1022 + BigDecimal a = new BigDecimal(m.get(mon).toString().length()>0?m.get(mon).toString():"0");
  1023 + BigDecimal b = new BigDecimal(m.get(bud).toString());
  1024 + m.put("com" + i, a.multiply(new BigDecimal(100)).divide(b, 2, BigDecimal.ROUND_HALF_UP)+ "%");
  1025 + } else {
  1026 + m.put("com" + i, "");
  1027 + }
  1028 + }
  1029 + }
848 1030 }
849 1031 }
850 1032  
... ... @@ -876,6 +1058,18 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
876 1058 m.put("diff", "");
877 1059 }
878 1060 m.put("year", year);
  1061 +
  1062 + for(int i = 1; i <= 12; i++){
  1063 + String mon = "mon" + i, bud = "bud" + i;
  1064 + if(m.get(mon).toString().length() > 0 && m.get(bud).toString().length() > 0
  1065 + && new BigDecimal(m.get(bud).toString()).doubleValue() > 0d){
  1066 + BigDecimal a = new BigDecimal(m.get(mon).toString().length()>0?m.get(mon).toString():"0");
  1067 + BigDecimal b = new BigDecimal(m.get(bud).toString());
  1068 + m.put("com" + i, a.multiply(new BigDecimal(100)).divide(b, 2, BigDecimal.ROUND_HALF_UP)+ "%");
  1069 + } else {
  1070 + m.put("com" + i, "");
  1071 + }
  1072 + }
879 1073 }
880 1074  
881 1075 if(tttt.equals("export")){
... ... @@ -899,11 +1093,35 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
899 1093 }
900 1094 }
901 1095  
  1096 + if(tttt.equals("exportData")){
  1097 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1098 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1099 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1100 + Map<String, Object> m = new HashMap<String, Object>();
  1101 + m.put("date", year);
  1102 + ReportUtils ee = new ReportUtils();
  1103 + try {
  1104 + for(Map<String, Object> map : resList){
  1105 + if(kkk.equals(map.get("key").toString())){
  1106 + List<Map<String, Object>> dataList = (List<Map<String, Object>>)map.get("dataList");
  1107 + listI.add(dataList.iterator());
  1108 + }
  1109 + }
  1110 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1111 + ee.excelReplace(listI, new Object[]{m}, path + "mould/budgetPerson_data.xls",
  1112 + path + "export/" + year + "-预算人次明细表-线路明细.xls");
  1113 + } catch (Exception e) {
  1114 + // TODO: handle exception
  1115 + e.printStackTrace();
  1116 + logger.info("", e);
  1117 + }
  1118 + }
  1119 +
902 1120 return resList;
903 1121 }
904 1122  
905 1123 @Override
906   - public List<Map<String, Object>> budgetAmounts(String year, String tttt) {
  1124 + public List<Map<String, Object>> budgetAmounts(String year, String tttt, String kkk) {
907 1125 // TODO Auto-generated method stub
908 1126 SimpleDateFormat sdfMM = new SimpleDateFormat("MM");
909 1127 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
... ... @@ -918,6 +1136,9 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
918 1136 String[] strs = createBudgetMap(resList, keyMap);
919 1137  
920 1138 for(Budget b : findByYear){
  1139 + if(!(b.getYear().contains("-")) || b.getYear().length() != 7){
  1140 + continue;
  1141 + }
921 1142 if(b.getFormalAmounts()==null || b.getFormalAmounts() < 0d){
922 1143 continue;
923 1144 }
... ... @@ -941,11 +1162,44 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
941 1162 m.put("formal", b.getFormalAmounts()!=null?b.getFormalAmounts():"");
942 1163 for(int i = 1; i <= 12; i++){
943 1164 m.put("mon"+i, "");
  1165 + m.put("bud"+i, "");
  1166 + }
  1167 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  1168 + if(b.getFormalAmounts()!=null){
  1169 + m.put(bud, b.getFormalAmounts());
944 1170 }
945 1171 m.put("monAll", "0");
946 1172 m.put("num", "0");
947 1173 xlMap.put(key, m);
948 1174 xlList.add(m);
  1175 + } else {
  1176 + Map<String, Object> m = xlMap.get(key);
  1177 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  1178 + if(b.getBudgetAmounts()!=null){
  1179 + if(m.get("budget").toString().length() > 0){
  1180 + m.put("budget", new BigDecimal(m.get("budget").toString()).add(
  1181 + new BigDecimal(b.getBudgetAmounts())).doubleValue());
  1182 + } else {
  1183 + m.put("budget", b.getBudgetAmounts());
  1184 + }
  1185 + }
  1186 + if(b.getChangeAmounts()!=null){
  1187 + if(m.get("change").toString().length() > 0){
  1188 + m.put("change", new BigDecimal(m.get("change").toString()).add(
  1189 + new BigDecimal(b.getChangeAmounts())).doubleValue());
  1190 + } else {
  1191 + m.put("change", b.getChangeAmounts());
  1192 + }
  1193 + }
  1194 + if(b.getFormalAmounts()!=null){
  1195 + if(m.get("formal").toString().length() > 0){
  1196 + m.put("formal", new BigDecimal(m.get("formal").toString()).add(
  1197 + new BigDecimal(b.getFormalAmounts())).doubleValue());
  1198 + } else {
  1199 + m.put("formal", b.getFormalAmounts());
  1200 + }
  1201 + m.put(bud, b.getFormalAmounts());
  1202 + }
949 1203 }
950 1204 }
951 1205  
... ... @@ -970,6 +1224,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
970 1224 m.put("formal", "");
971 1225 for(int i = 1; i <= 12; i++){
972 1226 m.put("mon"+i, "");
  1227 + m.put("bud"+i, "");
973 1228 }
974 1229 m.put("monAll", "0");
975 1230 m.put("num", "0");
... ... @@ -1017,6 +1272,9 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1017 1272 strList.add(gsBm + "_all");
1018 1273  
1019 1274 for(String str : strList){
  1275 + if(!keyMap.containsKey(str)){
  1276 + continue;
  1277 + }
1020 1278 Map<String, Object> map = keyMap.get(str);
1021 1279 if(m.get("budget").toString().length() > 0){
1022 1280 if(map.get("budget").toString().length() > 0){
... ... @@ -1043,7 +1301,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1043 1301 }
1044 1302 }
1045 1303 for(int i = 1; i <= 12; i++){
1046   - String mon = "mon"+i;
  1304 + String mon = "mon"+i, bud = "bud"+i;
1047 1305 if(m.get(mon).toString().length() > 0){
1048 1306 if(map.get(mon).toString().length() > 0){
1049 1307 map.put(mon, new BigDecimal(m.get(mon).toString()).add(
... ... @@ -1052,6 +1310,14 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1052 1310 map.put(mon, new BigDecimal(m.get(mon).toString()).doubleValue());
1053 1311 }
1054 1312 }
  1313 + if(m.get(bud).toString().length() > 0){
  1314 + if(map.get(bud).toString().length() > 0){
  1315 + map.put(mon, new BigDecimal(m.get(bud).toString()).add(
  1316 + new BigDecimal(map.get(bud).toString())).doubleValue());
  1317 + } else {
  1318 + map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue());
  1319 + }
  1320 + }
1055 1321 }
1056 1322 if(m.containsKey("num") && m.get("num").toString().length() > 0){
1057 1323 if(map.containsKey("num") && map.get("num").toString().length() > 0){
... ... @@ -1130,6 +1396,20 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1130 1396 List<Map<String, Object>> dataList = (List<Map<String, Object>>)allMap.get("dataList");
1131 1397 dataList.addAll((List<Map<String, Object>>)map.get("dataList"));
1132 1398 allMap.put("dataList", dataList);
  1399 +
  1400 + for(Map<String, Object> m : dataList){
  1401 + for(int i = 1; i <= 12; i++){
  1402 + String mon = "mon" + i, bud = "bud" + i;
  1403 + if(m.get(mon).toString().length() > 0 && m.get(bud).toString().length() > 0
  1404 + && new BigDecimal(m.get(bud).toString()).doubleValue() > 0d){
  1405 + BigDecimal a = new BigDecimal(m.get(mon).toString().length()>0?m.get(mon).toString():"0");
  1406 + BigDecimal b = new BigDecimal(m.get(bud).toString());
  1407 + m.put("com" + i, a.multiply(new BigDecimal(100)).divide(b, 2, BigDecimal.ROUND_HALF_UP)+ "%");
  1408 + } else {
  1409 + m.put("com" + i, "");
  1410 + }
  1411 + }
  1412 + }
1133 1413 }
1134 1414 }
1135 1415  
... ... @@ -1172,6 +1452,18 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1172 1452 m.put("diff", "");
1173 1453 }
1174 1454 m.put("year", year);
  1455 +
  1456 + for(int i = 1; i <= 12; i++){
  1457 + String mon = "mon" + i, bud = "bud" + i;
  1458 + if(m.get(mon).toString().length() > 0 && m.get(bud).toString().length() > 0
  1459 + && new BigDecimal(m.get(bud).toString()).doubleValue() > 0d){
  1460 + BigDecimal a = new BigDecimal(m.get(mon).toString().length()>0?m.get(mon).toString():"0");
  1461 + BigDecimal b = new BigDecimal(m.get(bud).toString());
  1462 + m.put("com" + i, a.multiply(new BigDecimal(100)).divide(b, 2, BigDecimal.ROUND_HALF_UP)+ "%");
  1463 + } else {
  1464 + m.put("com" + i, "");
  1465 + }
  1466 + }
1175 1467 }
1176 1468  
1177 1469 if(tttt.equals("export")){
... ... @@ -1195,19 +1487,43 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1195 1487 }
1196 1488 }
1197 1489  
  1490 + if(tttt.equals("exportData")){
  1491 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  1492 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  1493 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1494 + Map<String, Object> m = new HashMap<String, Object>();
  1495 + m.put("date", year);
  1496 + ReportUtils ee = new ReportUtils();
  1497 + try {
  1498 + for(Map<String, Object> map : resList){
  1499 + if(kkk.equals(map.get("key").toString())){
  1500 + List<Map<String, Object>> dataList = (List<Map<String, Object>>)map.get("dataList");
  1501 + listI.add(dataList.iterator());
  1502 + }
  1503 + }
  1504 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1505 + ee.excelReplace(listI, new Object[]{m}, path + "mould/budgetAmounts_data.xls",
  1506 + path + "export/" + year + "-预算营收明细表-线路明细.xls");
  1507 + } catch (Exception e) {
  1508 + // TODO: handle exception
  1509 + e.printStackTrace();
  1510 + logger.info("", e);
  1511 + }
  1512 + }
  1513 +
1198 1514 return resList;
1199 1515 }
1200 1516  
1201 1517 @Override
1202   - public List<Map<String, Object>> budgetSum(String year, String tttt) {
  1518 + public List<Map<String, Object>> budgetSum(String year, String nature, String tttt, String kkk) {
1203 1519 // TODO Auto-generated method stub
1204 1520 SimpleDateFormat sdfMM = new SimpleDateFormat("MM");
1205 1521 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1206 1522 Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
1207   - Map<String, Boolean> lineNature = lineService.lineNature();
1208 1523 List<Budget> findByYear = repository.findByYear(year);
1209 1524 List<CalcStatistics> scheduleList = calcStatisticsRepository.selectByDateAndLineTj3(year+"-01-01", year+"-12-31");
1210 1525 List<Revenue> revenueList = revenueRepository.findByDates(year+"-01-01", year+"-12-31");
  1526 + Map<String, Boolean> lineNature = lineService.lineNature();
1211 1527  
1212 1528 Map<String, Map<String, Object>> xlMap = new HashMap<String, Map<String, Object>>();
1213 1529 List<Map<String, Object>> xlList = new ArrayList<Map<String, Object>>();
... ... @@ -1215,6 +1531,20 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1215 1531 String[] strs = createBudgetMap_sum(resList, keyMap);
1216 1532  
1217 1533 for(Budget b : findByYear){
  1534 + if(!(b.getYear().contains("-")) || b.getYear().length() != 7){
  1535 + continue;
  1536 + }
  1537 + Boolean flag = true;
  1538 + if("0".equals(nature)){
  1539 + flag = false;
  1540 + } else if("1".equals(nature) && b.getSfyy()){
  1541 + flag = false;
  1542 + } else if("2".equals(nature) && !(b.getSfyy())){
  1543 + flag = false;
  1544 + }
  1545 + if(flag){
  1546 + continue;
  1547 + }
1218 1548 String gsBm = b.getGsBm();
1219 1549 String xlBm = b.getXlBm();
1220 1550 String xlName = b.getXlName();
... ... @@ -1233,10 +1563,43 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1233 1563 m.put("formal", b.getFormalMileage()!=null?b.getFormalMileage():"");
1234 1564 for(int i = 1; i <= 12; i++){
1235 1565 m.put("mon"+i, "");
  1566 + m.put("bud"+i, "");
  1567 + }
  1568 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  1569 + if(b.getFormalMileage()!=null){
  1570 + m.put(bud, b.getFormalMileage());
1236 1571 }
1237 1572 m.put("monAll", "0");
1238 1573 xlMap.put(key1, m);
1239 1574 xlList.add(m);
  1575 + } else {
  1576 + Map<String, Object> m = xlMap.get(key1);
  1577 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  1578 + if(b.getBudgetMileage()!=null){
  1579 + if(m.get("budget").toString().length() > 0){
  1580 + m.put("budget", new BigDecimal(m.get("budget").toString()).add(
  1581 + new BigDecimal(b.getBudgetMileage())).doubleValue());
  1582 + } else {
  1583 + m.put("budget", b.getBudgetMileage());
  1584 + }
  1585 + }
  1586 + if(b.getChangeMileage()!=null){
  1587 + if(m.get("change").toString().length() > 0){
  1588 + m.put("change", new BigDecimal(m.get("change").toString()).add(
  1589 + new BigDecimal(b.getChangeMileage())).doubleValue());
  1590 + } else {
  1591 + m.put("change", b.getChangeMileage());
  1592 + }
  1593 + }
  1594 + if(b.getFormalMileage()!=null){
  1595 + if(m.get("formal").toString().length() > 0){
  1596 + m.put("formal", new BigDecimal(m.get("formal").toString()).add(
  1597 + new BigDecimal(b.getFormalMileage())).doubleValue());
  1598 + } else {
  1599 + m.put("formal", b.getFormalMileage());
  1600 + }
  1601 + m.put(bud, b.getFormalMileage());
  1602 + }
1240 1603 }
1241 1604 }
1242 1605 if(b.getFormalPerson()!=null && b.getFormalPerson() >= 0d){
... ... @@ -1253,10 +1616,43 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1253 1616 m.put("formal", b.getFormalPerson()!=null?b.getFormalPerson():"");
1254 1617 for(int i = 1; i <= 12; i++){
1255 1618 m.put("mon"+i, "");
  1619 + m.put("bud"+i, "");
  1620 + }
  1621 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  1622 + if(b.getFormalPerson()!=null){
  1623 + m.put(bud, b.getFormalPerson());
1256 1624 }
1257 1625 m.put("monAll", "0");
1258 1626 xlMap.put(key2, m);
1259 1627 xlList.add(m);
  1628 + } else {
  1629 + Map<String, Object> m = xlMap.get(key2);
  1630 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  1631 + if(b.getBudgetPerson()!=null){
  1632 + if(m.get("budget").toString().length() > 0){
  1633 + m.put("budget", new BigDecimal(m.get("budget").toString()).add(
  1634 + new BigDecimal(b.getBudgetPerson())).doubleValue());
  1635 + } else {
  1636 + m.put("budget", b.getBudgetPerson());
  1637 + }
  1638 + }
  1639 + if(b.getChangePerson()!=null){
  1640 + if(m.get("change").toString().length() > 0){
  1641 + m.put("change", new BigDecimal(m.get("change").toString()).add(
  1642 + new BigDecimal(b.getChangePerson())).doubleValue());
  1643 + } else {
  1644 + m.put("change", b.getChangePerson());
  1645 + }
  1646 + }
  1647 + if(b.getFormalPerson()!=null){
  1648 + if(m.get("formal").toString().length() > 0){
  1649 + m.put("formal", new BigDecimal(m.get("formal").toString()).add(
  1650 + new BigDecimal(b.getFormalPerson())).doubleValue());
  1651 + } else {
  1652 + m.put("formal", b.getFormalPerson());
  1653 + }
  1654 + m.put(bud, b.getFormalPerson());
  1655 + }
1260 1656 }
1261 1657 }
1262 1658 if(b.getFormalAmounts()!=null && b.getFormalAmounts() >= 0d){
... ... @@ -1273,15 +1669,59 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1273 1669 m.put("formal", b.getFormalAmounts()!=null?b.getFormalAmounts():"");
1274 1670 for(int i = 1; i <= 12; i++){
1275 1671 m.put("mon"+i, "");
  1672 + m.put("bud"+i, "");
  1673 + }
  1674 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  1675 + if(b.getFormalAmounts()!=null){
  1676 + m.put(bud, b.getFormalAmounts());
1276 1677 }
1277 1678 m.put("monAll", "0");
1278 1679 xlMap.put(key3, m);
1279 1680 xlList.add(m);
  1681 + } else {
  1682 + Map<String, Object> m = xlMap.get(key3);
  1683 + String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]);
  1684 + if(b.getBudgetAmounts()!=null){
  1685 + if(m.get("budget").toString().length() > 0){
  1686 + m.put("budget", new BigDecimal(m.get("budget").toString()).add(
  1687 + new BigDecimal(b.getBudgetAmounts())).doubleValue());
  1688 + } else {
  1689 + m.put("budget", b.getBudgetAmounts());
  1690 + }
  1691 + }
  1692 + if(b.getChangeAmounts()!=null){
  1693 + if(m.get("change").toString().length() > 0){
  1694 + m.put("change", new BigDecimal(m.get("change").toString()).add(
  1695 + new BigDecimal(b.getChangeAmounts())).doubleValue());
  1696 + } else {
  1697 + m.put("change", b.getChangeAmounts());
  1698 + }
  1699 + }
  1700 + if(b.getFormalAmounts()!=null){
  1701 + if(m.get("formal").toString().length() > 0){
  1702 + m.put("formal", new BigDecimal(m.get("formal").toString()).add(
  1703 + new BigDecimal(b.getFormalAmounts())).doubleValue());
  1704 + } else {
  1705 + m.put("formal", b.getFormalAmounts());
  1706 + }
  1707 + m.put(bud, b.getFormalAmounts());
  1708 + }
1280 1709 }
1281 1710 }
1282 1711 }
1283 1712  
1284 1713 for(CalcStatistics cs : scheduleList){ // 公里
  1714 + Boolean flag = true;
  1715 + if("0".equals(nature)){
  1716 + flag = false;
  1717 + } else if("1".equals(nature) && lineNature.containsKey(cs.getXl()) && lineNature.get(cs.getXl())){
  1718 + flag = false;
  1719 + } else if("2".equals(nature) && !(lineNature.containsKey(cs.getXl()) && lineNature.get(cs.getXl()))){
  1720 + flag = false;
  1721 + }
  1722 + if(flag){
  1723 + continue;
  1724 + }
1285 1725 String gsBm = cs.getGsdm();
1286 1726 String xlBm = cs.getXl();
1287 1727 String xlName = cs.getXlName();
... ... @@ -1299,6 +1739,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1299 1739 m.put("formal", "");
1300 1740 for(int i = 1; i <= 12; i++){
1301 1741 m.put("mon"+i, "");
  1742 + m.put("bud"+i, "");
1302 1743 }
1303 1744 m.put("monAll", "0");
1304 1745 xlMap.put(key, m);
... ... @@ -1316,6 +1757,17 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1316 1757 }
1317 1758  
1318 1759 for(Revenue cs : revenueList){
  1760 + Boolean flag = true;
  1761 + if("0".equals(nature)){
  1762 + flag = false;
  1763 + } else if("1".equals(nature) && cs.getSfyy()){
  1764 + flag = false;
  1765 + } else if("2".equals(nature) && !(cs.getSfyy())){
  1766 + flag = false;
  1767 + }
  1768 + if(flag){
  1769 + continue;
  1770 + }
1319 1771 String gsBm = cs.getGsBm();
1320 1772 String xlBm = cs.getXlBm();
1321 1773 String xlName = cs.getXlName();
... ... @@ -1334,6 +1786,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1334 1786 m.put("formal", "");
1335 1787 for(int i = 1; i <= 12; i++){
1336 1788 m.put("mon"+i, "");
  1789 + m.put("bud"+i, "");
1337 1790 }
1338 1791 m.put("monAll", "0");
1339 1792 xlMap.put(key2, m);
... ... @@ -1363,6 +1816,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1363 1816 m.put("formal", "");
1364 1817 for(int i = 1; i <= 12; i++){
1365 1818 m.put("mon"+i, "");
  1819 + m.put("bud"+i, "");
1366 1820 }
1367 1821 m.put("monAll", "0");
1368 1822 xlMap.put(key3, m);
... ... @@ -1403,9 +1857,11 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1403 1857 strList.add(gsBm + "_" + type);
1404 1858  
1405 1859 for(String str : strList){
  1860 + if(!keyMap.containsKey(str)){
  1861 + continue;
  1862 + }
1406 1863 Map<String, Object> map = keyMap.get(str);
1407 1864 if(m.get("budget").toString().length() > 0){
1408   - System.out.println(str);
1409 1865 if(map.get("budget").toString().length() > 0){
1410 1866 map.put("budget", new BigDecimal(m.get("budget").toString()).add(
1411 1867 new BigDecimal(map.get("budget").toString())).doubleValue());
... ... @@ -1430,7 +1886,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1430 1886 }
1431 1887 }
1432 1888 for(int i = 1; i <= 12; i++){
1433   - String mon = "mon"+i;
  1889 + String mon = "mon"+i, bud = "bud"+i;
1434 1890 if(m.get(mon).toString().length() > 0){
1435 1891 if(map.get(mon).toString().length() > 0){
1436 1892 map.put(mon, new BigDecimal(m.get(mon).toString()).add(
... ... @@ -1439,6 +1895,14 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1439 1895 map.put(mon, new BigDecimal(m.get(mon).toString()).doubleValue());
1440 1896 }
1441 1897 }
  1898 + if(m.get(bud).toString().length() > 0){
  1899 + if(map.get(bud).toString().length() > 0){
  1900 + map.put(mon, new BigDecimal(m.get(bud).toString()).add(
  1901 + new BigDecimal(map.get(bud).toString())).doubleValue());
  1902 + } else {
  1903 + map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue());
  1904 + }
  1905 + }
1442 1906 }
1443 1907 List<Map<String, Object>>dataList = (List<Map<String, Object>>)map.get("dataList");
1444 1908 dataList.add(m);
... ... @@ -1496,6 +1960,20 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1496 1960 List<Map<String, Object>> dataList = (List<Map<String, Object>>)allMap.get("dataList");
1497 1961 dataList.addAll((List<Map<String, Object>>)map.get("dataList"));
1498 1962 allMap.put("dataList", dataList);
  1963 +
  1964 + for(Map<String, Object> m : dataList){
  1965 + for(int i = 1; i <= 12; i++){
  1966 + String mon = "mon" + i, bud = "bud" + i;
  1967 + if(m.get(mon).toString().length() > 0 && m.get(bud).toString().length() > 0
  1968 + && new BigDecimal(m.get(bud).toString()).doubleValue() > 0d){
  1969 + BigDecimal a = new BigDecimal(m.get(mon).toString().length()>0?m.get(mon).toString():"0");
  1970 + BigDecimal b = new BigDecimal(m.get(bud).toString());
  1971 + m.put("com" + i, a.multiply(new BigDecimal(100)).divide(b, 2, BigDecimal.ROUND_HALF_UP)+ "%");
  1972 + } else {
  1973 + m.put("com" + i, "");
  1974 + }
  1975 + }
  1976 + }
1499 1977 }
1500 1978 }
1501 1979  
... ... @@ -1531,6 +2009,18 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1531 2009 m.put("diff", "");
1532 2010 }
1533 2011 m.put("year", year);
  2012 +
  2013 + for(int i = 1; i <= 12; i++){
  2014 + String mon = "mon" + i, bud = "bud" + i;
  2015 + if(m.get(mon).toString().length() > 0 && m.get(bud).toString().length() > 0
  2016 + && new BigDecimal(m.get(bud).toString()).doubleValue() > 0d){
  2017 + BigDecimal a = new BigDecimal(m.get(mon).toString().length()>0?m.get(mon).toString():"0");
  2018 + BigDecimal b = new BigDecimal(m.get(bud).toString());
  2019 + m.put("com" + i, a.multiply(new BigDecimal(100)).divide(b, 2, BigDecimal.ROUND_HALF_UP)+ "%");
  2020 + } else {
  2021 + m.put("com" + i, "");
  2022 + }
  2023 + }
1534 2024 }
1535 2025  
1536 2026 if(tttt.equals("export")){
... ... @@ -1554,6 +2044,394 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1554 2044 }
1555 2045 }
1556 2046  
  2047 + if(tttt.equals("exportData")){
  2048 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2049 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2050 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2051 + Map<String, Object> m = new HashMap<String, Object>();
  2052 + m.put("date", year);
  2053 + ReportUtils ee = new ReportUtils();
  2054 + try {
  2055 + if("allData".equals(kkk)){
  2056 + List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
  2057 + Map<String, List<Map<String, Object>>> tempMap = new HashMap<String, List<Map<String, Object>>>();
  2058 + List<String> tempList = new ArrayList<String>();
  2059 + for(Map<String, Object> m1 : (List<Map<String, Object>>)resList.get(resList.size() - 3).get("dataList")){
  2060 + String xlName = m1.get("xlName")!=null?m1.get("xlName").toString():"";
  2061 + if(!tempMap.containsKey(xlName)){
  2062 + tempMap.put(xlName, new ArrayList<Map<String, Object>>());
  2063 + tempList.add(xlName);
  2064 + }
  2065 + tempMap.get(xlName).add(m1);
  2066 + }
  2067 + for(Map<String, Object> m2 : (List<Map<String, Object>>)resList.get(resList.size() - 2).get("dataList")){
  2068 + String xlName = m2.get("xlName")!=null?m2.get("xlName").toString():"";
  2069 + if(!tempMap.containsKey(xlName)){
  2070 + tempMap.put(xlName, new ArrayList<Map<String, Object>>());
  2071 + tempList.add(xlName);
  2072 + }
  2073 + tempMap.get(xlName).add(m2);
  2074 + }
  2075 + for(Map<String, Object> m3 : (List<Map<String, Object>>)resList.get(resList.size() - 1).get("dataList")){
  2076 + String xlName = m3.get("xlName")!=null?m3.get("xlName").toString():"";
  2077 + if(!tempMap.containsKey(xlName)){
  2078 + tempMap.put(xlName, new ArrayList<Map<String, Object>>());
  2079 + tempList.add(xlName);
  2080 + }
  2081 + tempMap.get(xlName).add(m3);
  2082 + }
  2083 + for(String xlName : tempList){
  2084 + dataList.addAll(tempMap.get(xlName));
  2085 + }
  2086 + listI.add(dataList.iterator());
  2087 + } else {
  2088 + for(Map<String, Object> map : resList){
  2089 + if(kkk.equals(map.get("key").toString())){
  2090 + List<Map<String, Object>> dataList = (List<Map<String, Object>>)map.get("dataList");
  2091 + listI.add(dataList.iterator());
  2092 + }
  2093 + }
  2094 + }
  2095 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2096 + ee.excelReplace(listI, new Object[]{m}, path + "mould/budgetSum_data.xls",
  2097 + path + "export/" + year + "-预算汇总表-线路明细.xls");
  2098 + } catch (Exception e) {
  2099 + // TODO: handle exception
  2100 + e.printStackTrace();
  2101 + logger.info("", e);
  2102 + }
  2103 + }
  2104 +
  2105 + return resList;
  2106 + }
  2107 +
  2108 + @Override
  2109 + public List<Map<String, Object>> timeSum(String date1, String date2, String tttt, String k) throws Exception {
  2110 + // TODO Auto-generated method stub
  2111 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  2112 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  2113 + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
  2114 + Map<String, Map<String, Map<String, Long>>> timeMap = new HashMap<String, Map<String, Map<String, Long>>>();
  2115 + Map<String, Boolean> lineNature = lineService.lineNature();
  2116 +
  2117 + Date d1 = sdf.parse(date1);
  2118 + Date d2 = sdf.parse(date2);
  2119 +
  2120 + List<SchedulePlanInfo> findByDates = schedulePlanRepository.findByDates(d1, d2);
  2121 + Iterable<Line> findAll = lineService.findAll();
  2122 + Map<String, Line> lineMap = new HashMap<String, Line>();
  2123 + for(Line line : findAll){
  2124 + lineMap.put(line.getLineCode(), line);
  2125 + }
  2126 +
  2127 + List<Object[]> findPersonnelSchedule = schedulePlanRepository.findPersonnelSchedule(d1, d2);
  2128 + List<Object[]> findCancelSchedule = scheduleRealRepository.findCancelSchedule(date1, date2, "缺人");
  2129 + Map<String, Long> psMap = new HashMap<String, Long>(),
  2130 + csMap = new HashMap<String, Long>();
  2131 + for(Object[] objects : findPersonnelSchedule){
  2132 + if(!psMap.containsKey(objects[1])){
  2133 + psMap.put(objects[1].toString(), 1l);
  2134 + } else {
  2135 + psMap.put(objects[1].toString(), 1l + psMap.get(objects[1].toString()));
  2136 + }
  2137 + }
  2138 + for(Object[] objects : findCancelSchedule){
  2139 + if(!csMap.containsKey(objects[1])){
  2140 + csMap.put(objects[1].toString(), 1l);
  2141 + } else {
  2142 + csMap.put(objects[1].toString(), 1l + csMap.get(objects[1].toString()));
  2143 + }
  2144 + }
  2145 +
  2146 + List<Object[]> findLineConfigCar = ccRepository.findLineConfigCar(d1);
  2147 + List<Object[]> findLineConfigEmp = ecRepository.findLineConfigEmp(d1);
  2148 + List<Object[]> findPlanGroupCar = schedulePlanRepository.findPlanGroupCar(d1, d2);
  2149 + List<Object[]> findPlanGroupDriver = schedulePlanRepository.findPlanGroupDriver(d1, d2);
  2150 + List<Object[]> findPlanGroupBusConductor = schedulePlanRepository.findPlanGroupBusConductor(d1, d2);
  2151 + Map<String, Map<String, Object>> carMap = new HashMap<String, Map<String, Object>>(),
  2152 + driverMap = new HashMap<String, Map<String, Object>>(),
  2153 + busConductorMap = new HashMap<String, Map<String, Object>>();
  2154 + for(Object[] objects : findPlanGroupCar){
  2155 + String key = objects[0].toString();
  2156 + if(!carMap.containsKey(key)){
  2157 + carMap.put(key, new HashMap<String, Object>());
  2158 + }
  2159 + carMap.get(key).put(objects[1].toString(), objects[2]);
  2160 + }
  2161 + for(Object[] objects : findPlanGroupDriver){
  2162 + String key = objects[0].toString();
  2163 + if(!driverMap.containsKey(key)){
  2164 + driverMap.put(key, new HashMap<String, Object>());
  2165 + }
  2166 + driverMap.get(key).put(objects[1].toString(), objects[2]);
  2167 + }
  2168 + for(Object[] objects : findPlanGroupBusConductor){
  2169 + String key = objects[0].toString();
  2170 + if(!busConductorMap.containsKey(key)){
  2171 + busConductorMap.put(key, new HashMap<String, Object>());
  2172 + }
  2173 + busConductorMap.get(key).put(objects[1].toString(), objects[2]);
  2174 + }
  2175 +
  2176 + Map<String, Long> ccMap = new HashMap<String, Long>();
  2177 + Map<String, Long> ecMap = new HashMap<String, Long>();
  2178 + for(Object[] objects : findLineConfigCar){
  2179 + if(!ccMap.containsKey(objects[0].toString())){
  2180 + ccMap.put(objects[0].toString(), 1l);
  2181 + } else {
  2182 + ccMap.put(objects[0].toString(), 1l + ccMap.get(objects[0].toString()));
  2183 + }
  2184 + }
  2185 + for(Object[] objects : findLineConfigEmp){
  2186 + if(!ecMap.containsKey(objects[0].toString())){
  2187 + ecMap.put(objects[0].toString(), 1l);
  2188 + } else {
  2189 + ecMap.put(objects[0].toString(), 1l + ecMap.get(objects[0].toString()));
  2190 + }
  2191 + }
  2192 +
  2193 + String temp = "";
  2194 + Long tempLong = 0l;
  2195 + Long l = 0l;
  2196 + SchedulePlanInfo tempSchedule = new SchedulePlanInfo();
  2197 + for(SchedulePlanInfo s : findByDates){
  2198 + String scheduleDate = sdf.format(s.getScheduleDate());
  2199 + String gs = s.getGsBm();
  2200 + String xlBm = s.getXlBm();
  2201 + String lpName = s.getLpName();
  2202 + String jGh = s.getjGh();
  2203 + String temp1 = gs + "/" + scheduleDate + "/" + xlBm + "/" + lpName + "/" + jGh;
  2204 + String fcsj = s.getFcsj();
  2205 + String[] split = fcsj.split(":");
  2206 + Long tempLong1 = Long.valueOf(split[0])*60l + Long.valueOf(split[1]);
  2207 + if(!(temp1.equals(temp)) || temp.length() == 0){
  2208 + if(l > 0l){
  2209 + String gsFgs = tempSchedule.getGsBm();
  2210 + String xl = tempSchedule.getXlBm();
  2211 + String jj = sdf.format(tempSchedule.getScheduleDate()) + "/" + tempSchedule.getjGh();
  2212 + if(!timeMap.containsKey(gsFgs)){
  2213 + timeMap.put(gsFgs, new HashMap<String, Map<String, Long>>());
  2214 + }
  2215 + if(!timeMap.get(gsFgs).containsKey(xl)){
  2216 + timeMap.get(gsFgs).put(xl, new HashMap<String, Long>());
  2217 + }
  2218 + if(timeMap.get(gsFgs).get(xl).containsKey(jj)){
  2219 + timeMap.get(gsFgs).get(xl).put(jj, timeMap.get(gsFgs).get(xl).get(jj) + l);
  2220 + } else {
  2221 + timeMap.get(gsFgs).get(xl).put(jj, l);
  2222 + }
  2223 + }
  2224 + l = 0l;
  2225 + tempLong = tempLong1;
  2226 + temp = temp1;
  2227 + tempSchedule = s;
  2228 + } else {
  2229 + tempLong1 += s.getBcsj();
  2230 + if(tempLong1 < tempLong){
  2231 + tempLong1 += (1l*60*24);
  2232 + }
  2233 + l += tempLong1 - tempLong;
  2234 + tempLong = tempLong1;
  2235 + }
  2236 + }
  2237 +
  2238 + String[] strs = createBudgetMap_sum2(resList, keyMap);
  2239 +
  2240 + for(String key : strs){
  2241 + Map<String, Object> map = keyMap.get(key);
  2242 + String[] split = key.split("_");
  2243 + String gs = split[0];
  2244 + String nature = split[1];
  2245 + List<Long> lList = new ArrayList<Long>();
  2246 + List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
  2247 + Long warrantCar = 0l, ccNum = 0l, ecNum = 0l,
  2248 + carNum = 0l, driverNum = 0l, busConductorNum = 0l,
  2249 + psNum = 0l, csNum = 0l;
  2250 + for(String gsFgs : timeMap.keySet()){
  2251 + if("all".equals(gs) || gsFgs.equals(gs)){
  2252 + Map<String, Map<String, Long>> xlMap = timeMap.get(gsFgs);
  2253 + for(String xl : xlMap.keySet()){
  2254 + Boolean b = false;
  2255 + if("1".equals(nature) && lineNature.containsKey(xl) && lineNature.get(xl)){
  2256 + b = true;
  2257 + }
  2258 + if("2".equals(nature) && !(lineNature.containsKey(xl) && lineNature.get(xl))){
  2259 + b = true;
  2260 + }
  2261 + if("0".equals(nature)){
  2262 + b = true;
  2263 + }
  2264 + if(b){
  2265 + Map<String, Object> m = new HashMap<String, Object>();
  2266 + m.put("gsName", BasicData.businessCodeNameMap.get(gsFgs));
  2267 + m.put("xlName", lineMap.containsKey(xl)?lineMap.get(xl).getName():"");
  2268 + List<Long> xl_lList = new ArrayList<Long>();
  2269 +
  2270 + Map<String, Long> jjMap = xlMap.get(xl);
  2271 + for(String jj : jjMap.keySet()){ //营运工时
  2272 + lList.add(jjMap.get(jj));
  2273 + xl_lList.add(jjMap.get(jj));
  2274 + }
  2275 + Long sum = 0l;
  2276 + for(Long ll : xl_lList){
  2277 + sum += ll;
  2278 + }
  2279 + m.put("time", xl_lList.size()>0?new BigDecimal(sum).divide(
  2280 + new BigDecimal(xl_lList.size()*60l), 2, BigDecimal.ROUND_HALF_UP):"");
  2281 +
  2282 + if(lineMap.containsKey(xl)){ //权证配车数
  2283 + warrantCar += lineMap.get(xl).getWarrantCar()!=null?lineMap.get(xl).getWarrantCar():0l;
  2284 + m.put("warrantCar", lineMap.get(xl).getWarrantCar());
  2285 + } else {
  2286 + m.put("warrantCar", "");
  2287 + }
  2288 + if(ccMap.containsKey(xl)){ //机务保管数
  2289 + ccNum += ccMap.get(xl);
  2290 + m.put("ccNum", ccMap.get(xl));
  2291 + } else {
  2292 + m.put("ccNum", "");
  2293 + }
  2294 + if(ecMap.containsKey(xl)){ //人事配档数
  2295 + ecNum += ecMap.get(xl);
  2296 + m.put("ecNum", ecMap.get(xl));
  2297 + } else {
  2298 + m.put("ecNum", "");
  2299 + }
  2300 + if(carMap.containsKey(gsFgs) && carMap.get(gsFgs).containsKey(xl)){ //最高配车数
  2301 + carNum += Long.valueOf(carMap.get(gsFgs).get(xl).toString());
  2302 + m.put("carNum", Long.valueOf(carMap.get(gsFgs).get(xl).toString()));
  2303 + } else {
  2304 + m.put("carNum", "");
  2305 + }
  2306 + if(driverMap.containsKey(gsFgs) && driverMap.get(gsFgs).containsKey(xl)){ //司最高陪人数
  2307 + driverNum += Long.valueOf(driverMap.get(gsFgs).get(xl).toString());
  2308 + m.put("driverNum", Long.valueOf(driverMap.get(gsFgs).get(xl).toString()));
  2309 + } else {
  2310 + m.put("driverNum", "");
  2311 + }
  2312 + if(busConductorMap.containsKey(gsFgs) && busConductorMap.get(gsFgs).containsKey(xl)){ //售最高陪人数
  2313 + busConductorNum += Long.valueOf(busConductorMap.get(gsFgs).get(xl).toString());
  2314 + m.put("busConductorNum", Long.valueOf(busConductorMap.get(gsFgs).get(xl).toString()));
  2315 + } else {
  2316 + m.put("busConductorNum", "");
  2317 + }
  2318 + if(psMap.containsKey(xl)){ //总排挡数
  2319 + psNum += psMap.get(xl);
  2320 + m.put("psNum", psMap.get(xl));
  2321 + } else {
  2322 + m.put("psNum", "");
  2323 + }
  2324 + if(csMap.containsKey(xl)){ //总病缺勤数(缺人烂班)
  2325 + csNum += csMap.get(xl);
  2326 + m.put("csNum", csMap.get(xl));
  2327 + } else {
  2328 + m.put("csNum", "");
  2329 + }
  2330 +
  2331 + if(m.containsKey("carNum") && m.get("carNum").toString().length() > 0
  2332 + && m.containsKey("ccNum") && m.get("ccNum").toString().length() > 0){
  2333 + Long car = Long.valueOf(m.get("carNum").toString());
  2334 + Long cc = Long.valueOf(m.get("ccNum").toString());
  2335 + m.put("bcl", cc>0l?new BigDecimal((cc>car?cc-car:0)*100l).divide(
  2336 + new BigDecimal(cc), 2, BigDecimal.ROUND_HALF_UP)+"%":"%");
  2337 + } else {
  2338 + m.put("bcl", "%");
  2339 + }
  2340 + if(m.containsKey("csNum") && m.get("csNum").toString().length() > 0
  2341 + && m.containsKey("psNum") && m.get("psNum").toString().length() > 0){
  2342 + Long cs = Long.valueOf(m.get("csNum").toString());
  2343 + Long ps = Long.valueOf(m.get("psNum").toString());
  2344 + m.put("cspsNum", ps>0l?new BigDecimal((cs<ps?cs:ps)*100l).divide(
  2345 + new BigDecimal(ps), 2, BigDecimal.ROUND_HALF_UP)+"%":"%");
  2346 + } else {
  2347 + m.put("cspsNum", "%");
  2348 + }
  2349 + dataList.add(m);
  2350 + }
  2351 + }
  2352 + }
  2353 + }
  2354 + map.put("warrantCar", warrantCar);
  2355 + map.put("ccNum", ccNum);
  2356 + map.put("carNum", carNum);
  2357 + map.put("bcl", ccNum>0l?new BigDecimal((ccNum>carNum?ccNum-carNum:0)*100l).divide(
  2358 + new BigDecimal(ccNum), 2, BigDecimal.ROUND_HALF_UP)+"%":"%");
  2359 + map.put("ecNum", ecNum);
  2360 + map.put("driverNum", driverNum);
  2361 + map.put("busConductorNum", busConductorNum);
  2362 + map.put("cspsNum", psNum>0l?new BigDecimal((csNum<psNum?csNum:psNum)*100l).divide(
  2363 + new BigDecimal(psNum), 2, BigDecimal.ROUND_HALF_UP)+"%":"%");
  2364 + Long sum = 0l;
  2365 + for(Long ll : lList){
  2366 + sum += ll;
  2367 + }
  2368 + map.put("time", lList.size()>0?new BigDecimal(sum).divide(
  2369 + new BigDecimal(lList.size()*60l), 2, BigDecimal.ROUND_HALF_UP):"");
  2370 + map.put("dataList", dataList);
  2371 + }
  2372 +
  2373 + if(tttt.equals("export")){
  2374 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2375 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2376 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2377 + Map<String, Object> m = new HashMap<String, Object>();
  2378 + m.put("date", date1 + "至" + date2);
  2379 + m.put("typeName", "线路性质");
  2380 + ReportUtils ee = new ReportUtils();
  2381 + try {
  2382 + String dateTime = "";
  2383 + if (date1.equals(date2)) {
  2384 + dateTime = sdfSimple.format(sdfMonth.parse(date1));
  2385 + } else {
  2386 + dateTime = sdfSimple.format(sdfMonth.parse(date1))
  2387 + + "-" + sdfSimple.format(sdfMonth.parse(date2));
  2388 + }
  2389 + listI.add(resList.iterator());
  2390 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2391 + ee.excelReplace(listI, new Object[]{m}, path + "mould/timeSum.xls",
  2392 + path + "export/" + dateTime + "-时刻表汇总表.xls");
  2393 + } catch (Exception e) {
  2394 + // TODO: handle exception
  2395 + e.printStackTrace();
  2396 + logger.info("", e);
  2397 + }
  2398 + }
  2399 +
  2400 + if(tttt.equals("exportData")){
  2401 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2402 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2403 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2404 + Map<String, Object> m = new HashMap<String, Object>();
  2405 + m.put("date", date1 + "至" + date2);
  2406 + m.put("typeName", "线路名");
  2407 + ReportUtils ee = new ReportUtils();
  2408 + try {
  2409 + String dateTime = "";
  2410 + if (date1.equals(date2)) {
  2411 + dateTime = sdfSimple.format(sdfMonth.parse(date1));
  2412 + } else {
  2413 + dateTime = sdfSimple.format(sdfMonth.parse(date1))
  2414 + + "-" + sdfSimple.format(sdfMonth.parse(date2));
  2415 + }
  2416 + for(Map<String, Object> map : resList){
  2417 + if(k.equals(map.get("key").toString())){
  2418 + List<Map<String, Object>> dataList = (List<Map<String, Object>>)map.get("dataList");
  2419 + for(Map<String, Object> mm : dataList){
  2420 + mm.put("type", mm.get("xlName"));
  2421 + }
  2422 + listI.add(dataList.iterator());
  2423 + }
  2424 + }
  2425 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2426 + ee.excelReplace(listI, new Object[]{m}, path + "mould/timeSum.xls",
  2427 + path + "export/" + dateTime + "-时刻表汇总表-线路明细.xls");
  2428 + } catch (Exception e) {
  2429 + // TODO: handle exception
  2430 + e.printStackTrace();
  2431 + logger.info("", e);
  2432 + }
  2433 + }
  2434 +
1557 2435 return resList;
1558 2436 }
1559 2437  
... ... @@ -1600,6 +2478,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1600 2478 m1.put("budget", num);m1.put("change", num);m1.put("formal", num);
1601 2479 for(int i = 1; i <= 12; i++){
1602 2480 m1.put("mon"+i, num);
  2481 + m1.put("bud"+i, num);
1603 2482 }
1604 2483 m1.put("monAll", "0");
1605 2484 m1.put("key", s);
... ... @@ -1644,6 +2523,7 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1644 2523 m1.put("budget", num);m1.put("change", num);m1.put("formal", num);
1645 2524 for(int i = 1; i <= 12; i++){
1646 2525 m1.put("mon"+i, num);
  2526 + m1.put("bud"+i, num);
1647 2527 }
1648 2528 m1.put("monAll", "0");
1649 2529 m1.put("key", s);
... ... @@ -1654,4 +2534,47 @@ public class BudgetServiceImpl extends BaseServiceImpl&lt;Budget, Integer&gt; implemen
1654 2534 return strs;
1655 2535 }
1656 2536  
  2537 +public String[] createBudgetMap_sum2(List<Map<String, Object>> list, Map<String, Map<String, Object>> keyMap){
  2538 +
  2539 + String[] strs = {"05_1", "05_2", "05_0"
  2540 + ,"55_1", "55_2", "55_0"
  2541 + ,"22_1", "22_2", "22_0"
  2542 + ,"26_1", "26_2", "26_0"
  2543 + ,"all_1", "all_2", "all_0"};
  2544 + for(String s : strs){
  2545 + String[] sp = s.split("_");
  2546 + Map<String, Object> m1 = new HashMap<String, Object>();
  2547 + String gs = "", type = "", num = "";
  2548 + if("05".equals(sp[0])){
  2549 + gs = "杨高公司";
  2550 + } else if("55".equals(sp[0])){
  2551 + gs = "上南公司";
  2552 + } else if("22".equals(sp[0])){
  2553 + gs = "金高公司";
  2554 + } else if("26".equals(sp[0])){
  2555 + gs = "南汇公司";
  2556 + } else if("all".equals(sp[0])){
  2557 + gs = "浦交合计";
  2558 + num = "0";
  2559 + }
  2560 + if("1".equals(sp[1])){
  2561 + type = "营运线路";
  2562 + } else if("2".equals(sp[1])){
  2563 + type = "非营运线路";
  2564 + } else if("0".equals(sp[1])){
  2565 + type = "小计";
  2566 + }
  2567 + m1.put("gsName", gs);m1.put("type", type);
  2568 + for(int i = 1; i <= 12; i++){
  2569 + m1.put("mon"+i, num);
  2570 + m1.put("bud"+i, num);
  2571 + }
  2572 + m1.put("key", s);
  2573 + m1.put("dataList", new ArrayList<Map<String, Object>>());
  2574 + list.add(m1);
  2575 + keyMap.put(s, m1);
  2576 + }
  2577 + return strs;
  2578 + }
  2579 +
1657 2580 }
... ...
src/main/java/com/bsth/service/report/impl/CalcSheetServiceImpl.java
... ... @@ -2,6 +2,7 @@ package com.bsth.service.report.impl;
2 2  
3 3  
4 4 import java.lang.reflect.InvocationTargetException;
  5 +import java.math.BigDecimal;
5 6 import java.sql.ResultSet;
6 7 import java.sql.SQLException;
7 8 import java.text.DecimalFormat;
... ... @@ -19,6 +20,8 @@ import java.util.List;
19 20 import java.util.Map;
20 21  
21 22 import org.apache.commons.lang3.StringUtils;
  23 +import org.slf4j.Logger;
  24 +import org.slf4j.LoggerFactory;
22 25 import org.springframework.beans.factory.annotation.Autowired;
23 26 import org.springframework.jdbc.core.JdbcTemplate;
24 27 import org.springframework.jdbc.core.RowMapper;
... ... @@ -49,6 +52,9 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
49 52 LineRepository lineRepository;
50 53 @Autowired
51 54 LineService lineService;
  55 +
  56 + Logger logger = LoggerFactory.getLogger(this.getClass());
  57 +
52 58 @Override
53 59 public List<CalcSheet> countListCalcSheet(Map<String, Object> map) {
54 60 // TODO Auto-generated method stub
... ... @@ -69,46 +75,69 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
69 75 if(map.get("nature")!=null){
70 76 nature=map.get("nature").toString();
71 77 }
  78 + String plate="0";
  79 + if(map.get("plate")!=null){
  80 + plate=map.get("plate").toString();
  81 + }
  82 + String type = "";
  83 + if(map.get("type")!=null){
  84 + type=map.get("type").toString();
  85 + }
  86 +
72 87 Map<String, Boolean> lineMap=lineService.lineNature();
73 88  
74 89 String date=map.get("date").toString();
75 90 String endDate=map.get("endDate").toString();
76   - String sql="select gsdm,fgsdm,xl,xl_name,max(id) as id,sum(jhszfcs) as jhszfcs ,"
  91 + List<String> objList = new ArrayList<String>();
  92 + String sql="select gsdm,fgsdm,xl,xl_name,max(id) as id,sum(jhszfcs) as jhszfcs,"
77 93 + " sum(sjszfczds) as sjszfczds,sum(sjszddzds) as sjszddzds"
78   - + " from bsth_c_calc_sheet where date >= '"+date+"' and date <= '"+endDate+"'";
79   - if(line.trim().equals("")){
80   - sql +=" and gsdm = '"+gs+"' and fgsdm like '%"+fgs+"%'";
  94 + + " from bsth_c_calc_sheet where date >= ? and date <= ?";
  95 + objList.add(date);
  96 + objList.add(endDate);
  97 + if("".equals(gs.trim()) && "".equals(fgs.trim()) && "".equals(line.trim())){
  98 +
  99 + } else if(line.equals("")){
  100 + sql +=" and gsdm = ? and fgsdm like CONCAT('%',?,'%')";
  101 + objList.add(gs);
  102 + objList.add(fgs);
81 103 }else{
82   - sql +=" and xl ='"+line+"'";
  104 + sql += " and xl = ?";
  105 + objList.add(line);
  106 + }
  107 + if("1".equals(plate)){
  108 + sql += " and xl in (select line_code from bsth_c_line_plate where line_code is not null and line_code != '')";
  109 + } else if("2".equals(plate)){
  110 + sql += " and xl not in (select line_code from bsth_c_line_plate where line_code is not null and line_code != '')";
83 111 }
84 112 sql +=" group by gsdm,fgsdm,xl,xl_name";
85   - List<CalcSheet> lists=jdbcTemplate.query(sql,
86   - new RowMapper<CalcSheet>(){
87   - @Override
88   - public CalcSheet mapRow(ResultSet rs, int rowNum) throws SQLException {
89   - CalcSheet s=new CalcSheet();
90   - s.setGsdm(rs.getString("gsdm"));
91   - s.setFgsdm(rs.getString("fgsdm"));
92   - s.setXl(rs.getString("xl"));
93   - s.setXlName(rs.getString("xl_name"));
94   - s.setId(rs.getInt("id"));
95   - s.setJhszfcs(rs.getString("jhszfcs"));
96   - s.setSjszfczds(rs.getString("sjszfczds"));
97   - s.setSjszddzds(rs.getString("sjszddzds"));
98   - int jhfc=Integer.parseInt(rs.getString("jhszfcs"));
99   - int zdfc=Integer.parseInt(rs.getString("sjszfczds"));
100   - int zddd=Integer.parseInt(rs.getString("sjszddzds"));
101   - if(jhfc>0){
102   - double zdl=(zdfc*1.0)/(jhfc*1.0)*100;
103   - s.setSzfczdl(df.format(zdl)+"%");
104   - zdl=(zddd*1.0)/(jhfc*1.0)*100;
105   - s.setSzddzdl(df.format(zdl)+"%");
106   - }else{
107   - s.setSzfczdl("0.0%");
108   - s.setSzddzdl("0.0%");
109   - }
110   - return s;
111   - }
  113 + List<CalcSheet> lists=jdbcTemplate.query(sql,
  114 + objList.toArray(),
  115 + new RowMapper<CalcSheet>(){
  116 + @Override
  117 + public CalcSheet mapRow(ResultSet rs, int rowNum) throws SQLException {
  118 + CalcSheet s=new CalcSheet();
  119 + s.setGsdm(rs.getString("gsdm"));
  120 + s.setFgsdm(rs.getString("fgsdm"));
  121 + s.setXl(rs.getString("xl"));
  122 + s.setXlName(rs.getString("xl_name"));
  123 + s.setId(rs.getInt("id"));
  124 + s.setJhszfcs(rs.getString("jhszfcs"));
  125 + s.setSjszfczds(rs.getString("sjszfczds"));
  126 + s.setSjszddzds(rs.getString("sjszddzds"));
  127 + int jhfc=Integer.parseInt(rs.getString("jhszfcs"));
  128 + int zdfc=Integer.parseInt(rs.getString("sjszfczds"));
  129 + int zddd=Integer.parseInt(rs.getString("sjszddzds"));
  130 + if(jhfc>0){
  131 + double zdl=(zdfc*1.0)/(jhfc*1.0)*100;
  132 + s.setSzfczdl(df.format(zdl)+"%");
  133 + zdl=(zddd*1.0)/(jhfc*1.0)*100;
  134 + s.setSzddzdl(df.format(zdl)+"%");
  135 + }else{
  136 + s.setSzfczdl("0.0%");
  137 + s.setSzddzdl("0.0%");
  138 + }
  139 + return s;
  140 + }
112 141 });
113 142 List<CalcSheet> list=new ArrayList<CalcSheet>();
114 143 for (int i = 0; i < lists.size(); i++) {
... ... @@ -151,7 +180,22 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
151 180 }
152 181 list.add(temp);
153 182  
154   - if(map.get("type").equals("export")){
  183 + List<Map<String, Object>> listmap=new ArrayList<Map<String, Object>>();
  184 + for (int i = 0; i < list.size(); i++) {
  185 + CalcSheet c=list.get(i);
  186 + Map<String, Object> m=new HashMap<String,Object>();
  187 + m.put("gs", c.getGsname()!=null?c.getGsname():"");
  188 + m.put("fgs", c.getFgsname()!=null?c.getFgsname():"");
  189 + m.put("line", c.getXlName()!=null?c.getXlName():"");
  190 + m.put("bcs", c.getJhszfcs());
  191 + m.put("zdbcs", c.getSjszfczds());
  192 + m.put("zdlv", c.getSzfczdl());
  193 + m.put("ddzdbcs", c.getSjszddzds());
  194 + m.put("ddzdlv", c.getSzddzdl());
  195 + listmap.add(m);
  196 + }
  197 +
  198 + if("export".equals(map.get("type"))){
155 199 String lineName="";
156 200 if(!line.equals("")){
157 201 lineName=list.get(0).getXlName();
... ... @@ -160,20 +204,6 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
160 204 }else{
161 205 lineName=list.get(0).getGsname();
162 206 }
163   - List<Map<String, Object>> listmap=new ArrayList<Map<String, Object>>();
164   - for (int i = 0; i < list.size(); i++) {
165   - CalcSheet c=list.get(i);
166   - Map<String, Object> m=new HashMap<String,Object>();
167   - m.put("gs", c.getGsname()!=null?c.getGsname():"");
168   - m.put("fgs", c.getFgsname()!=null?c.getFgsname():"");
169   - m.put("line", c.getXlName()!=null?c.getXlName():"");
170   - m.put("bcs", c.getJhszfcs());
171   - m.put("zdbcs", c.getSjszfczds());
172   - m.put("zdlv", c.getSzfczdl());
173   - m.put("ddzdbcs", c.getSjszddzds());
174   - m.put("ddzdlv", c.getSzddzdl());
175   - listmap.add(m);
176   - }
177 207 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
178 208 Map<String, Object> m = new HashMap<String, Object>();
179 209 m.put("date", date);
... ... @@ -196,6 +226,94 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
196 226 e.printStackTrace();
197 227 }
198 228 }
  229 +
  230 + if (type != null && type.length() != 0 && type.equals("exportAll")) {
  231 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  232 + Map<String, Map<String, Object>> tempMap = new HashMap<String, Map<String, Object>>();
  233 + List<Map<String, Object>> removeList = new ArrayList<Map<String, Object>>();
  234 + for(Map<String, Object> m : listmap){
  235 + if(m.get("gs") != null && m.get("gs").toString().trim().length() > 0
  236 + && m.get("gs").toString().trim().contains("临港")){
  237 + removeList.add(m);
  238 + }
  239 + }
  240 + for(Map<String, Object> m : removeList){
  241 + listmap.remove(m);
  242 + }
  243 + for(Map<String, Object> m : listmap){
  244 + if(m.get("gs") != null && m.get("gs").toString().trim().length() > 0){
  245 + String gsName = m.get("gs").toString().trim();
  246 + Map<String, Object> t = new HashMap<String, Object>();
  247 + if(tempMap.get(gsName) != null){
  248 + t = tempMap.get(gsName);
  249 + } else {
  250 + t.put("gs", gsName);
  251 + t.put("fgs", "小计");
  252 + t.put("line", "");
  253 + tempList.add(t);
  254 + tempMap.put(gsName, t);
  255 + }
  256 + for(String key : m.keySet()){
  257 + try {
  258 + t.put(key, new BigDecimal(m.get(key).toString()).add(
  259 + new BigDecimal(t.get(key)!=null?t.get(key).toString():"0")));
  260 + } catch (Exception e) {
  261 + // TODO: handle exception
  262 + }
  263 + }
  264 + }
  265 + }
  266 + for(Map<String, Object> t : tempList){
  267 + if(t.get("bcs") != null && t.get("bcs").toString().trim().length() > 0
  268 + && Long.valueOf(t.get("bcs").toString().trim()) > 0){
  269 + Long bcs = Long.valueOf(t.get("bcs").toString().trim());
  270 + if(t.get("zdbcs") != null && t.get("zdbcs").toString().trim().length() > 0
  271 + && Long.valueOf(t.get("zdbcs").toString().trim()) > 0){
  272 + Long zdbcs = Long.valueOf(t.get("zdbcs").toString().trim());
  273 + t.put("zdlv", df.format((zdbcs*1.0)/(bcs*1.0)*100) + "%");
  274 + } else {
  275 + t.put("zdlv", "0.0%");
  276 + }
  277 + if(t.get("ddzdbcs") != null && t.get("ddzdbcs").toString().trim().length() > 0
  278 + && Long.valueOf(t.get("ddzdbcs").toString().trim()) > 0){
  279 + Long ddzdbcs = Long.valueOf(t.get("ddzdbcs").toString().trim());
  280 + t.put("ddzdlv", df.format((ddzdbcs*1.0)/(bcs*1.0)*100) + "%");
  281 + } else {
  282 + t.put("ddzdlv", "0.0%");
  283 + }
  284 + } else {
  285 + t.put("zdlv", "0.0%");
  286 + t.put("ddzdlv", "0.0%");
  287 + }
  288 + }
  289 +
  290 + listmap.addAll(listmap.size()>0?listmap.size()-1:0, tempList);
  291 +
  292 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  293 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  294 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  295 + Map<String, Object> m = new HashMap<String, Object>();
  296 + m.put("date", date);
  297 + m.put("endDate", endDate);
  298 + ReportUtils ee = new ReportUtils();
  299 + try {
  300 + String dateTime = "";
  301 + if (date.equals(endDate)) {
  302 + dateTime = sdfSimple.format(sdfMonth.parse(date));
  303 + } else {
  304 + dateTime = sdfSimple.format(sdfMonth.parse(date))
  305 + + "-" + sdfSimple.format(sdfMonth.parse(endDate));
  306 + }
  307 + listI.add(listmap.iterator());
  308 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  309 + ee.excelReplace(listI, new Object[]{m}, path + "mould/calcSheetList.xls",
  310 + path + "export/" + dateTime + "-全部公司-发车到站准点率.xls");
  311 + } catch (Exception e) {
  312 + // TODO: handle exception
  313 + //e.printStackTrace();
  314 + logger.info("", e);
  315 + }
  316 + }
199 317 return list;
200 318 }
201 319 @Override
... ...
src/main/resources/static/pages/forms/budget/budgetAmounts.html
... ... @@ -43,6 +43,7 @@
43 43 <div class="form-group">
44 44 <input class="btn btn-default" type="button" id="query" value="查询"/>
45 45 <input class="btn btn-default" type="button" id="export" value="导出"/>
  46 + <input class="btn btn-default" type="button" id="exportData" value="导出明细"/>
46 47 </div>
47 48 </form>
48 49 </div>
... ... @@ -52,33 +53,70 @@
52 53 <table class="table table-bordered table-hover table-checkable" id="forms">
53 54 <thead style="text-align: center;">
54 55 <tr>
55   - <th colspan="30"><label id="datetodate"></label> 预算营收明细表</th>
  56 + <th colspan="55"><label id="datetodate"></label> 预算营收明细表</th>
56 57 </tr>
57 58 <tr>
58   - <td style="min-width: 73px">公司</td>
59   - <td style="min-width: 87px">公里明细</td>
60   - <td style="min-width: 73px">项目</td>
61   - <td style="min-width: 90px">预算</td>
62   - <td style="min-width: 90px">预算调整</td>
63   - <td style="min-width: 90px">预算</br>正式稿</td>
64   - <td style="min-width: 90px">1月</td>
65   - <td style="min-width: 90px">2月</td>
66   - <td style="min-width: 90px">3月</td>
67   - <td style="min-width: 90px">4月</td>
68   - <td style="min-width: 90px">5月</td>
69   - <td style="min-width: 90px">6月</td>
70   - <td style="min-width: 90px">7月</td>
71   - <td style="min-width: 90px">8月</td>
72   - <td style="min-width: 90px">9月</td>
73   - <td style="min-width: 90px">10月</td>
74   - <td style="min-width: 90px">11月</td>
75   - <td style="min-width: 90px">12月</td>
76   - <td style="min-width: 90px">合计</td>
77   - <td style="min-width: 90px">预算</br>完成率</td>
78   - <td style="min-width: 90px">预算差异</td>
79   - <td style="min-width: 80px">平均票价</br>(元)</td>
  59 + <td style="min-width: 73px" rowspan="2">公司</td>
  60 + <td style="min-width: 87px" rowspan="2">公里明细</td>
  61 + <td style="min-width: 73px" rowspan="2">项目</td>
  62 + <td style="min-width: 90px" rowspan="2">预算</td>
  63 + <td style="min-width: 90px" rowspan="2">预算调整</td>
  64 + <td style="min-width: 90px" rowspan="2">预算</br>正式稿</td>
  65 + <td style="min-width: 90px" colspan="3">1月</td>
  66 + <td style="min-width: 90px" colspan="3">2月</td>
  67 + <td style="min-width: 90px" colspan="3">3月</td>
  68 + <td style="min-width: 90px" colspan="3">4月</td>
  69 + <td style="min-width: 90px" colspan="3">5月</td>
  70 + <td style="min-width: 90px" colspan="3">6月</td>
  71 + <td style="min-width: 90px" colspan="3">7月</td>
  72 + <td style="min-width: 90px" colspan="3">8月</td>
  73 + <td style="min-width: 90px" colspan="3">9月</td>
  74 + <td style="min-width: 90px" colspan="3">10月</td>
  75 + <td style="min-width: 90px" colspan="3">11月</td>
  76 + <td style="min-width: 90px" colspan="3">12月</td>
  77 + <td style="min-width: 90px" rowspan="2">合计</td>
  78 + <td style="min-width: 90px" rowspan="2">预算</br>完成率</td>
  79 + <td style="min-width: 90px" rowspan="2">预算差异</td>
  80 + <td style="min-width: 80px" rowspan="2">平均票价</br>(元)</td>
  81 + </tr>
  82 + <tr>
  83 + <td style="min-width: 80px">实际</td>
  84 + <td style="min-width: 80px">预算</td>
  85 + <td style="min-width: 80px">完成率</td>
  86 + <td style="min-width: 80px">实际</td>
  87 + <td style="min-width: 80px">预算</td>
  88 + <td style="min-width: 80px">完成率</td>
  89 + <td style="min-width: 80px">实际</td>
  90 + <td style="min-width: 80px">预算</td>
  91 + <td style="min-width: 80px">完成率</td>
  92 + <td style="min-width: 80px">实际</td>
  93 + <td style="min-width: 80px">预算</td>
  94 + <td style="min-width: 80px">完成率</td>
  95 + <td style="min-width: 80px">实际</td>
  96 + <td style="min-width: 80px">预算</td>
  97 + <td style="min-width: 80px">完成率</td>
  98 + <td style="min-width: 80px">实际</td>
  99 + <td style="min-width: 80px">预算</td>
  100 + <td style="min-width: 80px">完成率</td>
  101 + <td style="min-width: 80px">实际</td>
  102 + <td style="min-width: 80px">预算</td>
  103 + <td style="min-width: 80px">完成率</td>
  104 + <td style="min-width: 80px">实际</td>
  105 + <td style="min-width: 80px">预算</td>
  106 + <td style="min-width: 80px">完成率</td>
  107 + <td style="min-width: 80px">实际</td>
  108 + <td style="min-width: 80px">预算</td>
  109 + <td style="min-width: 80px">完成率</td>
  110 + <td style="min-width: 80px">实际</td>
  111 + <td style="min-width: 80px">预算</td>
  112 + <td style="min-width: 80px">完成率</td>
  113 + <td style="min-width: 80px">实际</td>
  114 + <td style="min-width: 80px">预算</td>
  115 + <td style="min-width: 80px">完成率</td>
  116 + <td style="min-width: 80px">实际</td>
  117 + <td style="min-width: 80px">预算</td>
  118 + <td style="min-width: 80px">完成率</td>
80 119 </tr>
81   -
82 120 </thead>
83 121 <tbody class="budget_amounts">
84 122  
... ... @@ -89,38 +127,78 @@
89 127 <div class="portlet-body table-container hidden" id="datas_hidden"
90 128 style="margin-top: 30px;overflow:auto;min-width: 906px;">
91 129 <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
  130 + <input class="btn btn-default" type="button" id="exportData0" value="导出明细"/>
  131 + <span class="item-label" style="width: 80px;display: none;" id="key0"></span>
92 132 <span class="item-label" style="width: 80px;margin-left: 60px;">年份: </span>
93 133 <span class="item-label" style="width: 80px;" id="year0"></span>
94 134 <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span>
95 135 <span class="item-label" style="width: 80px;" id="gsName0"></span>
96 136 <span class="item-label" style="width: 80px;margin-left: 60px;">明细: </span>
97 137 <span class="item-label" style="width: 80px;" id="type0"></span>
98   - <span class="item-label" style="width: 80px;margin-left: 60px;">项目: </span>
99   - <span class="item-label" style="width: 80px;" id="item0"></span>
  138 +<!-- <span class="item-label" style="width: 80px;margin-left: 60px;">项目: </span> -->
  139 +<!-- <span class="item-label" style="width: 80px;" id="item0"></span> -->
100 140 <table class="table table-bordered table-hover table-checkable">
101 141 <thead style="text-align: center;">
102 142 <tr>
103   - <td style="min-width: 73px">公司</td>
104   - <td style="min-width: 87px">线路名</td>
105   - <td style="min-width: 90px">预算</td>
106   - <td style="min-width: 90px">预算调整</td>
107   - <td style="min-width: 90px">预算</br>正式稿</td>
108   - <td style="min-width: 90px">1月</td>
109   - <td style="min-width: 90px">2月</td>
110   - <td style="min-width: 90px">3月</td>
111   - <td style="min-width: 90px">4月</td>
112   - <td style="min-width: 90px">5月</td>
113   - <td style="min-width: 90px">6月</td>
114   - <td style="min-width: 90px">7月</td>
115   - <td style="min-width: 90px">8月</td>
116   - <td style="min-width: 90px">9月</td>
117   - <td style="min-width: 90px">10月</td>
118   - <td style="min-width: 90px">11月</td>
119   - <td style="min-width: 90px">12月</td>
120   - <td style="min-width: 90px">合计</td>
121   - <td style="min-width: 90px">预算</br>完成率</td>
122   - <td style="min-width: 90px">预算差异</td>
123   - <td style="min-width: 80px">平均票价</br>(元)</td>
  143 + <td style="min-width: 73px" rowspan="2">公司</td>
  144 + <td style="min-width: 87px" rowspan="2">线路名</td>
  145 + <td style="min-width: 90px" rowspan="2">预算</td>
  146 + <td style="min-width: 90px" rowspan="2">预算调整</td>
  147 + <td style="min-width: 90px" rowspan="2">预算</br>正式稿</td>
  148 + <td style="min-width: 90px" colspan="3">1月</td>
  149 + <td style="min-width: 90px" colspan="3">2月</td>
  150 + <td style="min-width: 90px" colspan="3">3月</td>
  151 + <td style="min-width: 90px" colspan="3">4月</td>
  152 + <td style="min-width: 90px" colspan="3">5月</td>
  153 + <td style="min-width: 90px" colspan="3">6月</td>
  154 + <td style="min-width: 90px" colspan="3">7月</td>
  155 + <td style="min-width: 90px" colspan="3">8月</td>
  156 + <td style="min-width: 90px" colspan="3">9月</td>
  157 + <td style="min-width: 90px" colspan="3">10月</td>
  158 + <td style="min-width: 90px" colspan="3">11月</td>
  159 + <td style="min-width: 90px" colspan="3">12月</td>
  160 + <td style="min-width: 90px" rowspan="2">合计</td>
  161 + <td style="min-width: 90px" rowspan="2">预算</br>完成率</td>
  162 + <td style="min-width: 90px" rowspan="2">预算差异</td>
  163 + <td style="min-width: 80px" rowspan="2">平均票价</br>(元)</td>
  164 + </tr>
  165 + <tr>
  166 + <td style="min-width: 80px">实际</td>
  167 + <td style="min-width: 80px">预算</td>
  168 + <td style="min-width: 80px">完成率</td>
  169 + <td style="min-width: 80px">实际</td>
  170 + <td style="min-width: 80px">预算</td>
  171 + <td style="min-width: 80px">完成率</td>
  172 + <td style="min-width: 80px">实际</td>
  173 + <td style="min-width: 80px">预算</td>
  174 + <td style="min-width: 80px">完成率</td>
  175 + <td style="min-width: 80px">实际</td>
  176 + <td style="min-width: 80px">预算</td>
  177 + <td style="min-width: 80px">完成率</td>
  178 + <td style="min-width: 80px">实际</td>
  179 + <td style="min-width: 80px">预算</td>
  180 + <td style="min-width: 80px">完成率</td>
  181 + <td style="min-width: 80px">实际</td>
  182 + <td style="min-width: 80px">预算</td>
  183 + <td style="min-width: 80px">完成率</td>
  184 + <td style="min-width: 80px">实际</td>
  185 + <td style="min-width: 80px">预算</td>
  186 + <td style="min-width: 80px">完成率</td>
  187 + <td style="min-width: 80px">实际</td>
  188 + <td style="min-width: 80px">预算</td>
  189 + <td style="min-width: 80px">完成率</td>
  190 + <td style="min-width: 80px">实际</td>
  191 + <td style="min-width: 80px">预算</td>
  192 + <td style="min-width: 80px">完成率</td>
  193 + <td style="min-width: 80px">实际</td>
  194 + <td style="min-width: 80px">预算</td>
  195 + <td style="min-width: 80px">完成率</td>
  196 + <td style="min-width: 80px">实际</td>
  197 + <td style="min-width: 80px">预算</td>
  198 + <td style="min-width: 80px">完成率</td>
  199 + <td style="min-width: 80px">实际</td>
  200 + <td style="min-width: 80px">预算</td>
  201 + <td style="min-width: 80px">完成率</td>
124 202 </tr>
125 203 </thead>
126 204 <tbody class="budget_amounts_dataList" id="datas">
... ... @@ -192,6 +270,7 @@
192 270 var tbodyHtml = template('budget_amounts_dataList', {list:dataList});
193 271 $("#datas_hidden").removeClass("hidden");
194 272 $("#datas_hidden").height($(window).height()-280);
  273 + $("#key0").html(g.key);
195 274 $("#year0").html(g.year);
196 275 $("#gsName0").html(g.gsName);
197 276 $("#type0").html(g.type);
... ... @@ -203,11 +282,9 @@
203 282 });
204 283  
205 284 $("#export").on("click",function(){
206   - if($("#date").val() == null || $("#date").val().trim().length == 0){
207   - layer.msg("请选择年份!");
208   - return;
  285 + if(date == null || date.trim().length == 0){
  286 + date = $("#date").val();
209 287 }
210   - date = $("#date").val();
211 288 var params = {};
212 289 params['year'] = date;
213 290 params['type'] = "export";
... ... @@ -218,6 +295,29 @@
218 295 layer.close(i);
219 296 });
220 297 });
  298 +
  299 + $("#exportData").on("click",function(){
  300 + exportData("all_all");
  301 + });
  302 + $("#exportData0").on("click",function(){
  303 + exportData($("#key0").html());
  304 + });
  305 + function exportData(k){
  306 + if(date == null || date.trim().length == 0){
  307 + date = $("#date").val();
  308 + }
  309 + var params = {};
  310 + params['year'] = date;
  311 + params['key'] = k;
  312 + params['type'] = "exportData";
  313 + console.log(params);
  314 + var i = layer.load(2);
  315 + $post('/budget/budgetAmounts',params,function(result){
  316 + window.open("/downloadFile/download?fileName="
  317 + +date+"-预算营收明细表-线路明细");
  318 + layer.close(i);
  319 + });
  320 + }
221 321 });
222 322 </script>
223 323 <script type="text/html" id="budget_amounts">
... ... @@ -235,17 +335,41 @@
235 335 <td>{{obj.change}}</td>
236 336 <td>{{obj.formal}}</td>
237 337 <td>{{obj.mon1}}</td>
  338 + <td>{{obj.bud1}}</td>
  339 + <td>{{obj.com1}}</td>
238 340 <td>{{obj.mon2}}</td>
  341 + <td>{{obj.bud2}}</td>
  342 + <td>{{obj.com2}}</td>
239 343 <td>{{obj.mon3}}</td>
  344 + <td>{{obj.bud3}}</td>
  345 + <td>{{obj.com3}}</td>
240 346 <td>{{obj.mon4}}</td>
  347 + <td>{{obj.bud4}}</td>
  348 + <td>{{obj.com4}}</td>
241 349 <td>{{obj.mon5}}</td>
  350 + <td>{{obj.bud5}}</td>
  351 + <td>{{obj.com5}}</td>
242 352 <td>{{obj.mon6}}</td>
  353 + <td>{{obj.bud6}}</td>
  354 + <td>{{obj.com6}}</td>
243 355 <td>{{obj.mon7}}</td>
  356 + <td>{{obj.bud7}}</td>
  357 + <td>{{obj.com7}}</td>
244 358 <td>{{obj.mon8}}</td>
  359 + <td>{{obj.bud8}}</td>
  360 + <td>{{obj.com8}}</td>
245 361 <td>{{obj.mon9}}</td>
  362 + <td>{{obj.bud9}}</td>
  363 + <td>{{obj.com9}}</td>
246 364 <td>{{obj.mon10}}</td>
  365 + <td>{{obj.bud10}}</td>
  366 + <td>{{obj.com10}}</td>
247 367 <td>{{obj.mon11}}</td>
  368 + <td>{{obj.bud11}}</td>
  369 + <td>{{obj.com11}}</td>
248 370 <td>{{obj.mon12}}</td>
  371 + <td>{{obj.bud12}}</td>
  372 + <td>{{obj.com12}}</td>
249 373 <td>{{obj.monAll}}</td>
250 374 <td>{{obj.complete}}</td>
251 375 <td>{{obj.diff}}</td>
... ... @@ -254,7 +378,7 @@
254 378 {{/each}}
255 379 {{if list.length == 0}}
256 380 <tr>
257   - <td colspan="22"><h6 class="muted">没有找到相关数据</h6></td>
  381 + <td colspan="55"><h6 class="muted">没有找到相关数据</h6></td>
258 382 </tr>
259 383 {{/if}}
260 384 </script>
... ... @@ -267,17 +391,41 @@
267 391 <td>{{obj.change}}</td>
268 392 <td>{{obj.formal}}</td>
269 393 <td>{{obj.mon1}}</td>
  394 + <td>{{obj.bud1}}</td>
  395 + <td>{{obj.com1}}</td>
270 396 <td>{{obj.mon2}}</td>
  397 + <td>{{obj.bud2}}</td>
  398 + <td>{{obj.com2}}</td>
271 399 <td>{{obj.mon3}}</td>
  400 + <td>{{obj.bud3}}</td>
  401 + <td>{{obj.com3}}</td>
272 402 <td>{{obj.mon4}}</td>
  403 + <td>{{obj.bud4}}</td>
  404 + <td>{{obj.com4}}</td>
273 405 <td>{{obj.mon5}}</td>
  406 + <td>{{obj.bud5}}</td>
  407 + <td>{{obj.com5}}</td>
274 408 <td>{{obj.mon6}}</td>
  409 + <td>{{obj.bud6}}</td>
  410 + <td>{{obj.com6}}</td>
275 411 <td>{{obj.mon7}}</td>
  412 + <td>{{obj.bud7}}</td>
  413 + <td>{{obj.com7}}</td>
276 414 <td>{{obj.mon8}}</td>
  415 + <td>{{obj.bud8}}</td>
  416 + <td>{{obj.com8}}</td>
277 417 <td>{{obj.mon9}}</td>
  418 + <td>{{obj.bud9}}</td>
  419 + <td>{{obj.com9}}</td>
278 420 <td>{{obj.mon10}}</td>
  421 + <td>{{obj.bud10}}</td>
  422 + <td>{{obj.com10}}</td>
279 423 <td>{{obj.mon11}}</td>
  424 + <td>{{obj.bud11}}</td>
  425 + <td>{{obj.com11}}</td>
280 426 <td>{{obj.mon12}}</td>
  427 + <td>{{obj.bud12}}</td>
  428 + <td>{{obj.com12}}</td>
281 429 <td>{{obj.monAll}}</td>
282 430 <td>{{obj.complete}}</td>
283 431 <td>{{obj.diff}}</td>
... ... @@ -286,7 +434,7 @@
286 434 {{/each}}
287 435 {{if list.length == 0}}
288 436 <tr>
289   - <td colspan="21"><h6 class="muted">没有找到相关数据</h6></td>
  437 + <td colspan="55"><h6 class="muted">没有找到相关数据</h6></td>
290 438 </tr>
291 439 {{/if}}
292 440 </script>
293 441 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/budget/budgetList.html
... ... @@ -17,7 +17,7 @@
17 17 <div class="portlet-title">
18 18 <div class="caption">
19 19 <i class="fa fa-users font-dark"></i> <span
20   - class="caption-subject font-dark sbold uppercase">年预算表</span>
  20 + class="caption-subject font-dark sbold uppercase">预算录入</span>
21 21 </div>
22 22 <!-- <div class="actions"> -->
23 23 <!-- <a class="btn btn-circle blue" href="cdlAdd.html" data-pjax><i class="fa fa-plus"></i> 添加</a> -->
... ... @@ -42,7 +42,7 @@
42 42 <thead>
43 43 <tr role="row" class="heading">
44 44 <th width="3%">#</th>
45   - <th width="10%" style="text-align: center;">份</th>
  45 + <th width="10%" style="text-align: center;">份</th>
46 46 <th width="13%" style="text-align: center;">公司</th>
47 47 <!-- <th width="14%" style="text-align: center;">分公司</th> -->
48 48 <th width="14%" style="text-align: center;">线路</th>
... ... @@ -54,7 +54,7 @@
54 54 <tr role="row" class="filter">
55 55 <td></td>
56 56 <td style="padding: 8px;">
57   - <input class="form-control" type="text" name="year" id="year" />
  57 + <input class="form-control" type="text" name="year_eq" id="year" />
58 58 </td>
59 59 <td>
60 60 <select class="form-control" name="gsBm_like" id="budListGsdmId" ></select>
... ... @@ -102,7 +102,7 @@ $(function(){
102 102 var year = d.getFullYear();
103 103 $("#year").val(year);
104 104 $("#year").datetimepicker({
105   - format : 'YYYY',
  105 + format : 'YYYY-MM',
106 106 locale : 'zh-cn'
107 107 });
108 108  
... ... @@ -166,7 +166,7 @@ $(function(){
166 166 var budGsdm=$("#budListGsdmId").val();
167 167 var budFgsdm=$("#budListFgsdmId").val();
168 168 if(year=="" ||year ==null){
169   - layer.msg("请选择份");
  169 + layer.msg("请选择份");
170 170 return;
171 171 }
172 172 var cells = $('tr.filter')[0].cells
... ... @@ -197,10 +197,11 @@ $(function(){
197 197 params = p;
198 198 }
199 199 //更新时间排序
200   - params['order'] = 'id';
  200 + params['order'] = 'year,gsName,xlName';
201 201 params['direction'] = 'ASC';
202 202 params['page'] = page;
203 203 var i = 2;
  204 + console.log("query", params);
204 205 $get('/budget' ,params, function(data){
205 206 $.each(data.content, function(i, obj) {
206 207 obj.updatetime = moment(obj.updatetime).format("YYYY-MM-DD");
... ... @@ -252,7 +253,7 @@ $(function(){
252 253 for(var j = 0, item; item = items[j++];){
253 254 name = $(item).attr('name');
254 255 if(name){
255   - params[name] = $(item).val();
  256 + params[name] = $.trim($(item).val());
256 257 }
257 258 }
258 259 });
... ...
src/main/resources/static/pages/forms/budget/budgetMileage.html
... ... @@ -43,6 +43,7 @@
43 43 <div class="form-group">
44 44 <input class="btn btn-default" type="button" id="query" value="查询"/>
45 45 <input class="btn btn-default" type="button" id="export" value="导出"/>
  46 + <input class="btn btn-default" type="button" id="exportData" value="导出明细"/>
46 47 </div>
47 48 </form>
48 49 </div>
... ... @@ -52,32 +53,69 @@
52 53 <table class="table table-bordered table-hover table-checkable" id="forms">
53 54 <thead style="text-align: center;">
54 55 <tr>
55   - <th colspan="30"><label id="datetodate"></label> 预算公里明细表</th>
  56 + <th colspan="54"><label id="datetodate"></label> 预算公里明细表</th>
56 57 </tr>
57 58 <tr>
58   - <td style="min-width: 73px">公司</td>
59   - <td style="min-width: 87px">公里明细</td>
60   - <td style="min-width: 73px">项目</td>
61   - <td style="min-width: 90px">预算</td>
62   - <td style="min-width: 90px">预算调整</td>
63   - <td style="min-width: 90px">预算</br>正式稿</td>
64   - <td style="min-width: 90px">1月</td>
65   - <td style="min-width: 90px">2月</td>
66   - <td style="min-width: 90px">3月</td>
67   - <td style="min-width: 90px">4月</td>
68   - <td style="min-width: 90px">5月</td>
69   - <td style="min-width: 90px">6月</td>
70   - <td style="min-width: 90px">7月</td>
71   - <td style="min-width: 90px">8月</td>
72   - <td style="min-width: 90px">9月</td>
73   - <td style="min-width: 90px">10月</td>
74   - <td style="min-width: 90px">11月</td>
75   - <td style="min-width: 90px">12月</td>
76   - <td style="min-width: 90px">合计</td>
77   - <td style="min-width: 90px">预算</br>完成率</td>
78   - <td style="min-width: 90px">预算差异</td>
  59 + <td style="min-width: 73px" rowspan="2">公司</td>
  60 + <td style="min-width: 87px" rowspan="2">公里明细</td>
  61 + <td style="min-width: 73px" rowspan="2">项目</td>
  62 + <td style="min-width: 90px" rowspan="2">预算</td>
  63 + <td style="min-width: 90px" rowspan="2">预算调整</td>
  64 + <td style="min-width: 90px" rowspan="2">预算</br>正式稿</td>
  65 + <td style="min-width: 90px" colspan="3">1月</td>
  66 + <td style="min-width: 90px" colspan="3">2月</td>
  67 + <td style="min-width: 90px" colspan="3">3月</td>
  68 + <td style="min-width: 90px" colspan="3">4月</td>
  69 + <td style="min-width: 90px" colspan="3">5月</td>
  70 + <td style="min-width: 90px" colspan="3">6月</td>
  71 + <td style="min-width: 90px" colspan="3">7月</td>
  72 + <td style="min-width: 90px" colspan="3">8月</td>
  73 + <td style="min-width: 90px" colspan="3">9月</td>
  74 + <td style="min-width: 90px" colspan="3">10月</td>
  75 + <td style="min-width: 90px" colspan="3">11月</td>
  76 + <td style="min-width: 90px" colspan="3">12月</td>
  77 + <td style="min-width: 90px" rowspan="2">合计</td>
  78 + <td style="min-width: 90px" rowspan="2">预算</br>完成率</td>
  79 + <td style="min-width: 90px" rowspan="2">预算差异</td>
  80 + </tr>
  81 + <tr>
  82 + <td style="min-width: 80px">实际</td>
  83 + <td style="min-width: 80px">预算</td>
  84 + <td style="min-width: 80px">完成率</td>
  85 + <td style="min-width: 80px">实际</td>
  86 + <td style="min-width: 80px">预算</td>
  87 + <td style="min-width: 80px">完成率</td>
  88 + <td style="min-width: 80px">实际</td>
  89 + <td style="min-width: 80px">预算</td>
  90 + <td style="min-width: 80px">完成率</td>
  91 + <td style="min-width: 80px">实际</td>
  92 + <td style="min-width: 80px">预算</td>
  93 + <td style="min-width: 80px">完成率</td>
  94 + <td style="min-width: 80px">实际</td>
  95 + <td style="min-width: 80px">预算</td>
  96 + <td style="min-width: 80px">完成率</td>
  97 + <td style="min-width: 80px">实际</td>
  98 + <td style="min-width: 80px">预算</td>
  99 + <td style="min-width: 80px">完成率</td>
  100 + <td style="min-width: 80px">实际</td>
  101 + <td style="min-width: 80px">预算</td>
  102 + <td style="min-width: 80px">完成率</td>
  103 + <td style="min-width: 80px">实际</td>
  104 + <td style="min-width: 80px">预算</td>
  105 + <td style="min-width: 80px">完成率</td>
  106 + <td style="min-width: 80px">实际</td>
  107 + <td style="min-width: 80px">预算</td>
  108 + <td style="min-width: 80px">完成率</td>
  109 + <td style="min-width: 80px">实际</td>
  110 + <td style="min-width: 80px">预算</td>
  111 + <td style="min-width: 80px">完成率</td>
  112 + <td style="min-width: 80px">实际</td>
  113 + <td style="min-width: 80px">预算</td>
  114 + <td style="min-width: 80px">完成率</td>
  115 + <td style="min-width: 80px">实际</td>
  116 + <td style="min-width: 80px">预算</td>
  117 + <td style="min-width: 80px">完成率</td>
79 118 </tr>
80   -
81 119 </thead>
82 120 <tbody class="budget_mileage">
83 121  
... ... @@ -88,37 +126,77 @@
88 126 <div class="portlet-body table-container hidden" id="datas_hidden"
89 127 style="margin-top: 30px;overflow:auto;min-width: 906px;">
90 128 <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
  129 + <input class="btn btn-default" type="button" id="exportData0" value="导出明细"/>
  130 + <span class="item-label" style="width: 80px;display: none;" id="key0"></span>
91 131 <span class="item-label" style="width: 80px;margin-left: 60px;">年份: </span>
92 132 <span class="item-label" style="width: 80px;" id="year0"></span>
93 133 <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span>
94 134 <span class="item-label" style="width: 80px;" id="gsName0"></span>
95 135 <span class="item-label" style="width: 80px;margin-left: 60px;">明细: </span>
96 136 <span class="item-label" style="width: 80px;" id="type0"></span>
97   - <span class="item-label" style="width: 80px;margin-left: 60px;">项目: </span>
98   - <span class="item-label" style="width: 80px;" id="item0"></span>
  137 +<!-- <span class="item-label" style="width: 80px;margin-left: 60px;">项目: </span> -->
  138 +<!-- <span class="item-label" style="width: 80px;" id="item0"></span> -->
99 139 <table class="table table-bordered table-hover table-checkable">
100 140 <thead style="text-align: center;">
101 141 <tr>
102   - <td style="min-width: 73px">公司</td>
103   - <td style="min-width: 87px">线路名</td>
104   - <td style="min-width: 90px">预算</td>
105   - <td style="min-width: 90px">预算调整</td>
106   - <td style="min-width: 90px">预算</br>正式稿</td>
107   - <td style="min-width: 90px">1月</td>
108   - <td style="min-width: 90px">2月</td>
109   - <td style="min-width: 90px">3月</td>
110   - <td style="min-width: 90px">4月</td>
111   - <td style="min-width: 90px">5月</td>
112   - <td style="min-width: 90px">6月</td>
113   - <td style="min-width: 90px">7月</td>
114   - <td style="min-width: 90px">8月</td>
115   - <td style="min-width: 90px">9月</td>
116   - <td style="min-width: 90px">10月</td>
117   - <td style="min-width: 90px">11月</td>
118   - <td style="min-width: 90px">12月</td>
119   - <td style="min-width: 90px">合计</td>
120   - <td style="min-width: 90px">预算</br>完成率</td>
121   - <td style="min-width: 90px">预算差异</td>
  142 + <td style="min-width: 73px" rowspan="2">公司</td>
  143 + <td style="min-width: 87px" rowspan="2">线路名</td>
  144 + <td style="min-width: 90px" rowspan="2">预算</td>
  145 + <td style="min-width: 90px" rowspan="2">预算调整</td>
  146 + <td style="min-width: 90px" rowspan="2">预算</br>正式稿</td>
  147 + <td style="min-width: 90px" colspan="3">1月</td>
  148 + <td style="min-width: 90px" colspan="3">2月</td>
  149 + <td style="min-width: 90px" colspan="3">3月</td>
  150 + <td style="min-width: 90px" colspan="3">4月</td>
  151 + <td style="min-width: 90px" colspan="3">5月</td>
  152 + <td style="min-width: 90px" colspan="3">6月</td>
  153 + <td style="min-width: 90px" colspan="3">7月</td>
  154 + <td style="min-width: 90px" colspan="3">8月</td>
  155 + <td style="min-width: 90px" colspan="3">9月</td>
  156 + <td style="min-width: 90px" colspan="3">10月</td>
  157 + <td style="min-width: 90px" colspan="3">11月</td>
  158 + <td style="min-width: 90px" colspan="3">12月</td>
  159 + <td style="min-width: 90px" rowspan="2">合计</td>
  160 + <td style="min-width: 90px" rowspan="2">预算</br>完成率</td>
  161 + <td style="min-width: 90px" rowspan="2">预算差异</td>
  162 + </tr>
  163 + <tr>
  164 + <td style="min-width: 80px">实际</td>
  165 + <td style="min-width: 80px">预算</td>
  166 + <td style="min-width: 80px">完成率</td>
  167 + <td style="min-width: 80px">实际</td>
  168 + <td style="min-width: 80px">预算</td>
  169 + <td style="min-width: 80px">完成率</td>
  170 + <td style="min-width: 80px">实际</td>
  171 + <td style="min-width: 80px">预算</td>
  172 + <td style="min-width: 80px">完成率</td>
  173 + <td style="min-width: 80px">实际</td>
  174 + <td style="min-width: 80px">预算</td>
  175 + <td style="min-width: 80px">完成率</td>
  176 + <td style="min-width: 80px">实际</td>
  177 + <td style="min-width: 80px">预算</td>
  178 + <td style="min-width: 80px">完成率</td>
  179 + <td style="min-width: 80px">实际</td>
  180 + <td style="min-width: 80px">预算</td>
  181 + <td style="min-width: 80px">完成率</td>
  182 + <td style="min-width: 80px">实际</td>
  183 + <td style="min-width: 80px">预算</td>
  184 + <td style="min-width: 80px">完成率</td>
  185 + <td style="min-width: 80px">实际</td>
  186 + <td style="min-width: 80px">预算</td>
  187 + <td style="min-width: 80px">完成率</td>
  188 + <td style="min-width: 80px">实际</td>
  189 + <td style="min-width: 80px">预算</td>
  190 + <td style="min-width: 80px">完成率</td>
  191 + <td style="min-width: 80px">实际</td>
  192 + <td style="min-width: 80px">预算</td>
  193 + <td style="min-width: 80px">完成率</td>
  194 + <td style="min-width: 80px">实际</td>
  195 + <td style="min-width: 80px">预算</td>
  196 + <td style="min-width: 80px">完成率</td>
  197 + <td style="min-width: 80px">实际</td>
  198 + <td style="min-width: 80px">预算</td>
  199 + <td style="min-width: 80px">完成率</td>
122 200 </tr>
123 201 </thead>
124 202 <tbody class="budget_mileage_dataList" id="datas">
... ... @@ -190,6 +268,7 @@
190 268 var tbodyHtml = template('budget_mileage_dataList', {list:dataList});
191 269 $("#datas_hidden").removeClass("hidden");
192 270 $("#datas_hidden").height($(window).height()-280);
  271 + $("#key0").html(g.key);
193 272 $("#year0").html(g.year);
194 273 $("#gsName0").html(g.gsName);
195 274 $("#type0").html(g.type);
... ... @@ -201,11 +280,9 @@
201 280 });
202 281  
203 282 $("#export").on("click",function(){
204   - if($("#date").val() == null || $("#date").val().trim().length == 0){
205   - layer.msg("请选择年份!");
206   - return;
  283 + if(date == null || date.trim().length == 0){
  284 + date = $("#date").val();
207 285 }
208   - date = $("#date").val();
209 286 var params = {};
210 287 params['year'] = date;
211 288 params['type'] = "export";
... ... @@ -216,6 +293,29 @@
216 293 layer.close(i);
217 294 });
218 295 });
  296 +
  297 + $("#exportData").on("click",function(){
  298 + exportData("all_all");
  299 + });
  300 + $("#exportData0").on("click",function(){
  301 + exportData($("#key0").html());
  302 + });
  303 + function exportData(k){
  304 + if(date == null || date.trim().length == 0){
  305 + date = $("#date").val();
  306 + }
  307 + var params = {};
  308 + params['year'] = date;
  309 + params['key'] = k;
  310 + params['type'] = "exportData";
  311 + console.log(params);
  312 + var i = layer.load(2);
  313 + $post('/budget/budgetMileage',params,function(result){
  314 + window.open("/downloadFile/download?fileName="
  315 + +date+"-预算公里明细表-线路明细");
  316 + layer.close(i);
  317 + });
  318 + }
219 319 });
220 320 </script>
221 321 <script type="text/html" id="budget_mileage">
... ... @@ -233,17 +333,41 @@
233 333 <td>{{obj.change}}</td>
234 334 <td>{{obj.formal}}</td>
235 335 <td>{{obj.mon1}}</td>
  336 + <td>{{obj.bud1}}</td>
  337 + <td>{{obj.com1}}</td>
236 338 <td>{{obj.mon2}}</td>
  339 + <td>{{obj.bud2}}</td>
  340 + <td>{{obj.com2}}</td>
237 341 <td>{{obj.mon3}}</td>
  342 + <td>{{obj.bud3}}</td>
  343 + <td>{{obj.com3}}</td>
238 344 <td>{{obj.mon4}}</td>
  345 + <td>{{obj.bud4}}</td>
  346 + <td>{{obj.com4}}</td>
239 347 <td>{{obj.mon5}}</td>
  348 + <td>{{obj.bud5}}</td>
  349 + <td>{{obj.com5}}</td>
240 350 <td>{{obj.mon6}}</td>
  351 + <td>{{obj.bud6}}</td>
  352 + <td>{{obj.com6}}</td>
241 353 <td>{{obj.mon7}}</td>
  354 + <td>{{obj.bud7}}</td>
  355 + <td>{{obj.com7}}</td>
242 356 <td>{{obj.mon8}}</td>
  357 + <td>{{obj.bud8}}</td>
  358 + <td>{{obj.com8}}</td>
243 359 <td>{{obj.mon9}}</td>
  360 + <td>{{obj.bud9}}</td>
  361 + <td>{{obj.com9}}</td>
244 362 <td>{{obj.mon10}}</td>
  363 + <td>{{obj.bud10}}</td>
  364 + <td>{{obj.com10}}</td>
245 365 <td>{{obj.mon11}}</td>
  366 + <td>{{obj.bud11}}</td>
  367 + <td>{{obj.com11}}</td>
246 368 <td>{{obj.mon12}}</td>
  369 + <td>{{obj.bud12}}</td>
  370 + <td>{{obj.com12}}</td>
247 371 <td>{{obj.monAll}}</td>
248 372 <td>{{obj.complete}}</td>
249 373 <td>{{obj.diff}}</td>
... ... @@ -251,7 +375,7 @@
251 375 {{/each}}
252 376 {{if list.length == 0}}
253 377 <tr>
254   - <td colspan="21"><h6 class="muted">没有找到相关数据</h6></td>
  378 + <td colspan="54"><h6 class="muted">没有找到相关数据</h6></td>
255 379 </tr>
256 380 {{/if}}
257 381 </script>
... ... @@ -264,17 +388,41 @@
264 388 <td>{{obj.change}}</td>
265 389 <td>{{obj.formal}}</td>
266 390 <td>{{obj.mon1}}</td>
  391 + <td>{{obj.bud1}}</td>
  392 + <td>{{obj.com1}}</td>
267 393 <td>{{obj.mon2}}</td>
  394 + <td>{{obj.bud2}}</td>
  395 + <td>{{obj.com2}}</td>
268 396 <td>{{obj.mon3}}</td>
  397 + <td>{{obj.bud3}}</td>
  398 + <td>{{obj.com3}}</td>
269 399 <td>{{obj.mon4}}</td>
  400 + <td>{{obj.bud4}}</td>
  401 + <td>{{obj.com4}}</td>
270 402 <td>{{obj.mon5}}</td>
  403 + <td>{{obj.bud5}}</td>
  404 + <td>{{obj.com5}}</td>
271 405 <td>{{obj.mon6}}</td>
  406 + <td>{{obj.bud6}}</td>
  407 + <td>{{obj.com6}}</td>
272 408 <td>{{obj.mon7}}</td>
  409 + <td>{{obj.bud7}}</td>
  410 + <td>{{obj.com7}}</td>
273 411 <td>{{obj.mon8}}</td>
  412 + <td>{{obj.bud8}}</td>
  413 + <td>{{obj.com8}}</td>
274 414 <td>{{obj.mon9}}</td>
  415 + <td>{{obj.bud9}}</td>
  416 + <td>{{obj.com9}}</td>
275 417 <td>{{obj.mon10}}</td>
  418 + <td>{{obj.bud10}}</td>
  419 + <td>{{obj.com10}}</td>
276 420 <td>{{obj.mon11}}</td>
  421 + <td>{{obj.bud11}}</td>
  422 + <td>{{obj.com11}}</td>
277 423 <td>{{obj.mon12}}</td>
  424 + <td>{{obj.bud12}}</td>
  425 + <td>{{obj.com12}}</td>
278 426 <td>{{obj.monAll}}</td>
279 427 <td>{{obj.complete}}</td>
280 428 <td>{{obj.diff}}</td>
... ... @@ -282,7 +430,7 @@
282 430 {{/each}}
283 431 {{if list.length == 0}}
284 432 <tr>
285   - <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td>
  433 + <td colspan="54"><h6 class="muted">没有找到相关数据</h6></td>
286 434 </tr>
287 435 {{/if}}
288 436 </script>
289 437 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/budget/budgetPerson.html
... ... @@ -43,6 +43,7 @@
43 43 <div class="form-group">
44 44 <input class="btn btn-default" type="button" id="query" value="查询"/>
45 45 <input class="btn btn-default" type="button" id="export" value="导出"/>
  46 + <input class="btn btn-default" type="button" id="exportData" value="导出明细"/>
46 47 </div>
47 48 </form>
48 49 </div>
... ... @@ -52,32 +53,69 @@
52 53 <table class="table table-bordered table-hover table-checkable" id="forms">
53 54 <thead style="text-align: center;">
54 55 <tr>
55   - <th colspan="30"><label id="datetodate"></label> 预算人次明细表</th>
  56 + <th colspan="54"><label id="datetodate"></label> 预算人次明细表</th>
56 57 </tr>
57 58 <tr>
58   - <td style="min-width: 73px">公司</td>
59   - <td style="min-width: 87px">公里明细</td>
60   - <td style="min-width: 73px">项目</td>
61   - <td style="min-width: 90px">预算</td>
62   - <td style="min-width: 90px">预算调整</td>
63   - <td style="min-width: 90px">预算</br>正式稿</td>
64   - <td style="min-width: 90px">1月</td>
65   - <td style="min-width: 90px">2月</td>
66   - <td style="min-width: 90px">3月</td>
67   - <td style="min-width: 90px">4月</td>
68   - <td style="min-width: 90px">5月</td>
69   - <td style="min-width: 90px">6月</td>
70   - <td style="min-width: 90px">7月</td>
71   - <td style="min-width: 90px">8月</td>
72   - <td style="min-width: 90px">9月</td>
73   - <td style="min-width: 90px">10月</td>
74   - <td style="min-width: 90px">11月</td>
75   - <td style="min-width: 90px">12月</td>
76   - <td style="min-width: 90px">合计</td>
77   - <td style="min-width: 90px">预算</br>完成率</td>
78   - <td style="min-width: 90px">预算差异</td>
  59 + <td style="min-width: 73px" rowspan="2">公司</td>
  60 + <td style="min-width: 87px" rowspan="2">公里明细</td>
  61 + <td style="min-width: 73px" rowspan="2">项目</td>
  62 + <td style="min-width: 90px" rowspan="2">预算</td>
  63 + <td style="min-width: 90px" rowspan="2">预算调整</td>
  64 + <td style="min-width: 90px" rowspan="2">预算</br>正式稿</td>
  65 + <td style="min-width: 90px" colspan="3">1月</td>
  66 + <td style="min-width: 90px" colspan="3">2月</td>
  67 + <td style="min-width: 90px" colspan="3">3月</td>
  68 + <td style="min-width: 90px" colspan="3">4月</td>
  69 + <td style="min-width: 90px" colspan="3">5月</td>
  70 + <td style="min-width: 90px" colspan="3">6月</td>
  71 + <td style="min-width: 90px" colspan="3">7月</td>
  72 + <td style="min-width: 90px" colspan="3">8月</td>
  73 + <td style="min-width: 90px" colspan="3">9月</td>
  74 + <td style="min-width: 90px" colspan="3">10月</td>
  75 + <td style="min-width: 90px" colspan="3">11月</td>
  76 + <td style="min-width: 90px" colspan="3">12月</td>
  77 + <td style="min-width: 90px" rowspan="2">合计</td>
  78 + <td style="min-width: 90px" rowspan="2">预算</br>完成率</td>
  79 + <td style="min-width: 90px" rowspan="2">预算差异</td>
  80 + </tr>
  81 + <tr>
  82 + <td style="min-width: 80px">实际</td>
  83 + <td style="min-width: 80px">预算</td>
  84 + <td style="min-width: 80px">完成率</td>
  85 + <td style="min-width: 80px">实际</td>
  86 + <td style="min-width: 80px">预算</td>
  87 + <td style="min-width: 80px">完成率</td>
  88 + <td style="min-width: 80px">实际</td>
  89 + <td style="min-width: 80px">预算</td>
  90 + <td style="min-width: 80px">完成率</td>
  91 + <td style="min-width: 80px">实际</td>
  92 + <td style="min-width: 80px">预算</td>
  93 + <td style="min-width: 80px">完成率</td>
  94 + <td style="min-width: 80px">实际</td>
  95 + <td style="min-width: 80px">预算</td>
  96 + <td style="min-width: 80px">完成率</td>
  97 + <td style="min-width: 80px">实际</td>
  98 + <td style="min-width: 80px">预算</td>
  99 + <td style="min-width: 80px">完成率</td>
  100 + <td style="min-width: 80px">实际</td>
  101 + <td style="min-width: 80px">预算</td>
  102 + <td style="min-width: 80px">完成率</td>
  103 + <td style="min-width: 80px">实际</td>
  104 + <td style="min-width: 80px">预算</td>
  105 + <td style="min-width: 80px">完成率</td>
  106 + <td style="min-width: 80px">实际</td>
  107 + <td style="min-width: 80px">预算</td>
  108 + <td style="min-width: 80px">完成率</td>
  109 + <td style="min-width: 80px">实际</td>
  110 + <td style="min-width: 80px">预算</td>
  111 + <td style="min-width: 80px">完成率</td>
  112 + <td style="min-width: 80px">实际</td>
  113 + <td style="min-width: 80px">预算</td>
  114 + <td style="min-width: 80px">完成率</td>
  115 + <td style="min-width: 80px">实际</td>
  116 + <td style="min-width: 80px">预算</td>
  117 + <td style="min-width: 80px">完成率</td>
79 118 </tr>
80   -
81 119 </thead>
82 120 <tbody class="budget_person">
83 121  
... ... @@ -88,37 +126,77 @@
88 126 <div class="portlet-body table-container hidden" id="datas_hidden"
89 127 style="margin-top: 30px;overflow:auto;min-width: 906px;">
90 128 <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
  129 + <input class="btn btn-default" type="button" id="exportData0" value="导出明细"/>
  130 + <span class="item-label" style="width: 80px;display: none;" id="key0"></span>
91 131 <span class="item-label" style="width: 80px;margin-left: 60px;">年份: </span>
92 132 <span class="item-label" style="width: 80px;" id="year0"></span>
93 133 <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span>
94 134 <span class="item-label" style="width: 80px;" id="gsName0"></span>
95 135 <span class="item-label" style="width: 80px;margin-left: 60px;">明细: </span>
96 136 <span class="item-label" style="width: 80px;" id="type0"></span>
97   - <span class="item-label" style="width: 80px;margin-left: 60px;">项目: </span>
98   - <span class="item-label" style="width: 80px;" id="item0"></span>
  137 +<!-- <span class="item-label" style="width: 80px;margin-left: 60px;">项目: </span> -->
  138 +<!-- <span class="item-label" style="width: 80px;" id="item0"></span> -->
99 139 <table class="table table-bordered table-hover table-checkable">
100 140 <thead style="text-align: center;">
101 141 <tr>
102   - <td style="min-width: 73px">公司</td>
103   - <td style="min-width: 87px">线路名</td>
104   - <td style="min-width: 90px">预算</td>
105   - <td style="min-width: 90px">预算调整</td>
106   - <td style="min-width: 90px">预算</br>正式稿</td>
107   - <td style="min-width: 90px">1月</td>
108   - <td style="min-width: 90px">2月</td>
109   - <td style="min-width: 90px">3月</td>
110   - <td style="min-width: 90px">4月</td>
111   - <td style="min-width: 90px">5月</td>
112   - <td style="min-width: 90px">6月</td>
113   - <td style="min-width: 90px">7月</td>
114   - <td style="min-width: 90px">8月</td>
115   - <td style="min-width: 90px">9月</td>
116   - <td style="min-width: 90px">10月</td>
117   - <td style="min-width: 90px">11月</td>
118   - <td style="min-width: 90px">12月</td>
119   - <td style="min-width: 90px">合计</td>
120   - <td style="min-width: 90px">预算</br>完成率</td>
121   - <td style="min-width: 90px">预算差异</td>
  142 + <td style="min-width: 73px" rowspan="2">公司</td>
  143 + <td style="min-width: 87px" rowspan="2">线路名</td>
  144 + <td style="min-width: 90px" rowspan="2">预算</td>
  145 + <td style="min-width: 90px" rowspan="2">预算调整</td>
  146 + <td style="min-width: 90px" rowspan="2">预算</br>正式稿</td>
  147 + <td style="min-width: 90px" colspan="3">1月</td>
  148 + <td style="min-width: 90px" colspan="3">2月</td>
  149 + <td style="min-width: 90px" colspan="3">3月</td>
  150 + <td style="min-width: 90px" colspan="3">4月</td>
  151 + <td style="min-width: 90px" colspan="3">5月</td>
  152 + <td style="min-width: 90px" colspan="3">6月</td>
  153 + <td style="min-width: 90px" colspan="3">7月</td>
  154 + <td style="min-width: 90px" colspan="3">8月</td>
  155 + <td style="min-width: 90px" colspan="3">9月</td>
  156 + <td style="min-width: 90px" colspan="3">10月</td>
  157 + <td style="min-width: 90px" colspan="3">11月</td>
  158 + <td style="min-width: 90px" colspan="3">12月</td>
  159 + <td style="min-width: 90px" rowspan="2">合计</td>
  160 + <td style="min-width: 90px" rowspan="2">预算</br>完成率</td>
  161 + <td style="min-width: 90px" rowspan="2">预算差异</td>
  162 + </tr>
  163 + <tr>
  164 + <td style="min-width: 80px">实际</td>
  165 + <td style="min-width: 80px">预算</td>
  166 + <td style="min-width: 80px">完成率</td>
  167 + <td style="min-width: 80px">实际</td>
  168 + <td style="min-width: 80px">预算</td>
  169 + <td style="min-width: 80px">完成率</td>
  170 + <td style="min-width: 80px">实际</td>
  171 + <td style="min-width: 80px">预算</td>
  172 + <td style="min-width: 80px">完成率</td>
  173 + <td style="min-width: 80px">实际</td>
  174 + <td style="min-width: 80px">预算</td>
  175 + <td style="min-width: 80px">完成率</td>
  176 + <td style="min-width: 80px">实际</td>
  177 + <td style="min-width: 80px">预算</td>
  178 + <td style="min-width: 80px">完成率</td>
  179 + <td style="min-width: 80px">实际</td>
  180 + <td style="min-width: 80px">预算</td>
  181 + <td style="min-width: 80px">完成率</td>
  182 + <td style="min-width: 80px">实际</td>
  183 + <td style="min-width: 80px">预算</td>
  184 + <td style="min-width: 80px">完成率</td>
  185 + <td style="min-width: 80px">实际</td>
  186 + <td style="min-width: 80px">预算</td>
  187 + <td style="min-width: 80px">完成率</td>
  188 + <td style="min-width: 80px">实际</td>
  189 + <td style="min-width: 80px">预算</td>
  190 + <td style="min-width: 80px">完成率</td>
  191 + <td style="min-width: 80px">实际</td>
  192 + <td style="min-width: 80px">预算</td>
  193 + <td style="min-width: 80px">完成率</td>
  194 + <td style="min-width: 80px">实际</td>
  195 + <td style="min-width: 80px">预算</td>
  196 + <td style="min-width: 80px">完成率</td>
  197 + <td style="min-width: 80px">实际</td>
  198 + <td style="min-width: 80px">预算</td>
  199 + <td style="min-width: 80px">完成率</td>
122 200 </tr>
123 201 </thead>
124 202 <tbody class="budget_person_dataList" id="datas">
... ... @@ -190,6 +268,7 @@
190 268 var tbodyHtml = template('budget_person_dataList', {list:dataList});
191 269 $("#datas_hidden").removeClass("hidden");
192 270 $("#datas_hidden").height($(window).height()-280);
  271 + $("#key0").html(g.key);
193 272 $("#year0").html(g.year);
194 273 $("#gsName0").html(g.gsName);
195 274 $("#type0").html(g.type);
... ... @@ -201,11 +280,9 @@
201 280 });
202 281  
203 282 $("#export").on("click",function(){
204   - if($("#date").val() == null || $("#date").val().trim().length == 0){
205   - layer.msg("请选择年份!");
206   - return;
  283 + if(date == null || date.trim().length == 0){
  284 + date = $("#date").val();
207 285 }
208   - date = $("#date").val();
209 286 var params = {};
210 287 params['year'] = date;
211 288 params['type'] = "export";
... ... @@ -216,6 +293,29 @@
216 293 layer.close(i);
217 294 });
218 295 });
  296 +
  297 + $("#exportData").on("click",function(){
  298 + exportData("all_all");
  299 + });
  300 + $("#exportData0").on("click",function(){
  301 + exportData($("#key0").html());
  302 + });
  303 + function exportData(k){
  304 + if(date == null || date.trim().length == 0){
  305 + date = $("#date").val();
  306 + }
  307 + var params = {};
  308 + params['year'] = date;
  309 + params['key'] = k;
  310 + params['type'] = "exportData";
  311 + console.log(params);
  312 + var i = layer.load(2);
  313 + $post('/budget/budgetPerson',params,function(result){
  314 + window.open("/downloadFile/download?fileName="
  315 + +date+"-预算人次明细表-线路明细");
  316 + layer.close(i);
  317 + });
  318 + }
219 319 });
220 320 </script>
221 321 <script type="text/html" id="budget_person">
... ... @@ -233,17 +333,41 @@
233 333 <td>{{obj.change}}</td>
234 334 <td>{{obj.formal}}</td>
235 335 <td>{{obj.mon1}}</td>
  336 + <td>{{obj.bud1}}</td>
  337 + <td>{{obj.com1}}</td>
236 338 <td>{{obj.mon2}}</td>
  339 + <td>{{obj.bud2}}</td>
  340 + <td>{{obj.com2}}</td>
237 341 <td>{{obj.mon3}}</td>
  342 + <td>{{obj.bud3}}</td>
  343 + <td>{{obj.com3}}</td>
238 344 <td>{{obj.mon4}}</td>
  345 + <td>{{obj.bud4}}</td>
  346 + <td>{{obj.com4}}</td>
239 347 <td>{{obj.mon5}}</td>
  348 + <td>{{obj.bud5}}</td>
  349 + <td>{{obj.com5}}</td>
240 350 <td>{{obj.mon6}}</td>
  351 + <td>{{obj.bud6}}</td>
  352 + <td>{{obj.com6}}</td>
241 353 <td>{{obj.mon7}}</td>
  354 + <td>{{obj.bud7}}</td>
  355 + <td>{{obj.com7}}</td>
242 356 <td>{{obj.mon8}}</td>
  357 + <td>{{obj.bud8}}</td>
  358 + <td>{{obj.com8}}</td>
243 359 <td>{{obj.mon9}}</td>
  360 + <td>{{obj.bud9}}</td>
  361 + <td>{{obj.com9}}</td>
244 362 <td>{{obj.mon10}}</td>
  363 + <td>{{obj.bud10}}</td>
  364 + <td>{{obj.com10}}</td>
245 365 <td>{{obj.mon11}}</td>
  366 + <td>{{obj.bud11}}</td>
  367 + <td>{{obj.com11}}</td>
246 368 <td>{{obj.mon12}}</td>
  369 + <td>{{obj.bud12}}</td>
  370 + <td>{{obj.com12}}</td>
247 371 <td>{{obj.monAll}}</td>
248 372 <td>{{obj.complete}}</td>
249 373 <td>{{obj.diff}}</td>
... ... @@ -251,7 +375,7 @@
251 375 {{/each}}
252 376 {{if list.length == 0}}
253 377 <tr>
254   - <td colspan="21"><h6 class="muted">没有找到相关数据</h6></td>
  378 + <td colspan="54"><h6 class="muted">没有找到相关数据</h6></td>
255 379 </tr>
256 380 {{/if}}
257 381 </script>
... ... @@ -264,17 +388,41 @@
264 388 <td>{{obj.change}}</td>
265 389 <td>{{obj.formal}}</td>
266 390 <td>{{obj.mon1}}</td>
  391 + <td>{{obj.bud1}}</td>
  392 + <td>{{obj.com1}}</td>
267 393 <td>{{obj.mon2}}</td>
  394 + <td>{{obj.bud2}}</td>
  395 + <td>{{obj.com2}}</td>
268 396 <td>{{obj.mon3}}</td>
  397 + <td>{{obj.bud3}}</td>
  398 + <td>{{obj.com3}}</td>
269 399 <td>{{obj.mon4}}</td>
  400 + <td>{{obj.bud4}}</td>
  401 + <td>{{obj.com4}}</td>
270 402 <td>{{obj.mon5}}</td>
  403 + <td>{{obj.bud5}}</td>
  404 + <td>{{obj.com5}}</td>
271 405 <td>{{obj.mon6}}</td>
  406 + <td>{{obj.bud6}}</td>
  407 + <td>{{obj.com6}}</td>
272 408 <td>{{obj.mon7}}</td>
  409 + <td>{{obj.bud7}}</td>
  410 + <td>{{obj.com7}}</td>
273 411 <td>{{obj.mon8}}</td>
  412 + <td>{{obj.bud8}}</td>
  413 + <td>{{obj.com8}}</td>
274 414 <td>{{obj.mon9}}</td>
  415 + <td>{{obj.bud9}}</td>
  416 + <td>{{obj.com9}}</td>
275 417 <td>{{obj.mon10}}</td>
  418 + <td>{{obj.bud10}}</td>
  419 + <td>{{obj.com10}}</td>
276 420 <td>{{obj.mon11}}</td>
  421 + <td>{{obj.bud11}}</td>
  422 + <td>{{obj.com11}}</td>
277 423 <td>{{obj.mon12}}</td>
  424 + <td>{{obj.bud12}}</td>
  425 + <td>{{obj.com12}}</td>
278 426 <td>{{obj.monAll}}</td>
279 427 <td>{{obj.complete}}</td>
280 428 <td>{{obj.diff}}</td>
... ... @@ -282,7 +430,7 @@
282 430 {{/each}}
283 431 {{if list.length == 0}}
284 432 <tr>
285   - <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td>
  433 + <td colspan="54"><h6 class="muted">没有找到相关数据</h6></td>
286 434 </tr>
287 435 {{/if}}
288 436 </script>
289 437 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/budget/budgetSum.html
... ... @@ -40,43 +40,91 @@
40 40 <span class="item-label" style="width: 80px;" >年份: </span>
41 41 <input class="form-control" type="text" id="date" style="width: 180px;"/>
42 42 </div>
  43 + <div style="display: inline-block;margin-left: 15px;">
  44 + <span class="item-label" style="width: 80px;">线路性质: </span>
  45 + <select
  46 + class="form-control" name="nature" id="nature"
  47 + style="width: 180px;">
  48 + <option value="0">全部线路</option>
  49 + <option value="1" selected="selected">营运线路</option>
  50 + <option value="2">非营运线路</option>
  51 + </select>
  52 + </div>
43 53 <div class="form-group">
44 54 <input class="btn btn-default" type="button" id="query" value="查询"/>
45 55 <input class="btn btn-default" type="button" id="export" value="导出"/>
  56 + <input class="btn btn-default" type="button" id="exportData" value="导出明细"/>
46 57 </div>
47 58 </form>
48 59 </div>
49 60 <div class="portlet-body">
50   - <label>单位:万</label>
  61 + <label>单位:万公里、万人次、万元</label>
51 62 <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px">
52 63 <table class="table table-bordered table-hover table-checkable" id="forms">
53 64 <thead style="text-align: center;">
54 65 <tr>
55   - <th colspan="30"><label id="datetodate"></label> 预算汇总表</th>
  66 + <th colspan="54"><label id="datetodate"></label> 预算汇总表</th>
56 67 </tr>
57 68 <tr>
58   - <td style="min-width: 73px">公司</td>
59   - <td style="min-width: 87px">明细</td>
60   - <td style="min-width: 90px">预算</td>
61   - <td style="min-width: 90px">预算调整</td>
62   - <td style="min-width: 90px">预算</br>正式稿</td>
63   - <td style="min-width: 90px">1月</td>
64   - <td style="min-width: 90px">2月</td>
65   - <td style="min-width: 90px">3月</td>
66   - <td style="min-width: 90px">4月</td>
67   - <td style="min-width: 90px">5月</td>
68   - <td style="min-width: 90px">6月</td>
69   - <td style="min-width: 90px">7月</td>
70   - <td style="min-width: 90px">8月</td>
71   - <td style="min-width: 90px">9月</td>
72   - <td style="min-width: 90px">10月</td>
73   - <td style="min-width: 90px">11月</td>
74   - <td style="min-width: 90px">12月</td>
75   - <td style="min-width: 90px">合计</td>
76   - <td style="min-width: 90px">预算</br>完成率</td>
77   - <td style="min-width: 90px">预算差异</td>
  69 + <td style="min-width: 73px" rowspan="2">公司</td>
  70 + <td style="min-width: 87px" rowspan="2">明细</td>
  71 + <td style="min-width: 90px" rowspan="2">预算</td>
  72 + <td style="min-width: 90px" rowspan="2">预算调整</td>
  73 + <td style="min-width: 90px" rowspan="2">预算</br>正式稿</td>
  74 + <td style="min-width: 90px" colspan="3">1月</td>
  75 + <td style="min-width: 90px" colspan="3">2月</td>
  76 + <td style="min-width: 90px" colspan="3">3月</td>
  77 + <td style="min-width: 90px" colspan="3">4月</td>
  78 + <td style="min-width: 90px" colspan="3">5月</td>
  79 + <td style="min-width: 90px" colspan="3">6月</td>
  80 + <td style="min-width: 90px" colspan="3">7月</td>
  81 + <td style="min-width: 90px" colspan="3">8月</td>
  82 + <td style="min-width: 90px" colspan="3">9月</td>
  83 + <td style="min-width: 90px" colspan="3">10月</td>
  84 + <td style="min-width: 90px" colspan="3">11月</td>
  85 + <td style="min-width: 90px" colspan="3">12月</td>
  86 + <td style="min-width: 90px" rowspan="2">合计</td>
  87 + <td style="min-width: 90px" rowspan="2">预算</br>完成率</td>
  88 + <td style="min-width: 90px" rowspan="2">预算差异</td>
  89 + </tr>
  90 + <tr>
  91 + <td style="min-width: 80px">实际</td>
  92 + <td style="min-width: 80px">预算</td>
  93 + <td style="min-width: 80px">完成率</td>
  94 + <td style="min-width: 80px">实际</td>
  95 + <td style="min-width: 80px">预算</td>
  96 + <td style="min-width: 80px">完成率</td>
  97 + <td style="min-width: 80px">实际</td>
  98 + <td style="min-width: 80px">预算</td>
  99 + <td style="min-width: 80px">完成率</td>
  100 + <td style="min-width: 80px">实际</td>
  101 + <td style="min-width: 80px">预算</td>
  102 + <td style="min-width: 80px">完成率</td>
  103 + <td style="min-width: 80px">实际</td>
  104 + <td style="min-width: 80px">预算</td>
  105 + <td style="min-width: 80px">完成率</td>
  106 + <td style="min-width: 80px">实际</td>
  107 + <td style="min-width: 80px">预算</td>
  108 + <td style="min-width: 80px">完成率</td>
  109 + <td style="min-width: 80px">实际</td>
  110 + <td style="min-width: 80px">预算</td>
  111 + <td style="min-width: 80px">完成率</td>
  112 + <td style="min-width: 80px">实际</td>
  113 + <td style="min-width: 80px">预算</td>
  114 + <td style="min-width: 80px">完成率</td>
  115 + <td style="min-width: 80px">实际</td>
  116 + <td style="min-width: 80px">预算</td>
  117 + <td style="min-width: 80px">完成率</td>
  118 + <td style="min-width: 80px">实际</td>
  119 + <td style="min-width: 80px">预算</td>
  120 + <td style="min-width: 80px">完成率</td>
  121 + <td style="min-width: 80px">实际</td>
  122 + <td style="min-width: 80px">预算</td>
  123 + <td style="min-width: 80px">完成率</td>
  124 + <td style="min-width: 80px">实际</td>
  125 + <td style="min-width: 80px">预算</td>
  126 + <td style="min-width: 80px">完成率</td>
78 127 </tr>
79   -
80 128 </thead>
81 129 <tbody class="budget_sum">
82 130  
... ... @@ -86,46 +134,83 @@
86 134 </div>
87 135 <div class="portlet-body table-container hidden" id="datas_hidden"
88 136 style="margin-top: 30px;overflow:auto;min-width: 906px;">
89   - <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
90   - <span class="item-label" style="width: 80px;margin-left: 60px;">年份: </span>
91   - <span class="item-label" style="width: 80px;" id="year0"></span>
92   - <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span>
93   - <span class="item-label" style="width: 80px;" id="gsName0"></span>
94   - <span class="item-label" style="width: 80px;margin-left: 60px;">明细: </span>
95   - <span class="item-label" style="width: 80px;" id="type0"></span>
96   - <span class="item-label" style="width: 80px;margin-left: 60px;">项目: </span>
97   - <span class="item-label" style="width: 80px;" id="item0"></span>
98   - <table class="table table-bordered table-hover table-checkable">
99   - <thead style="text-align: center;">
100   - <tr>
101   - <td style="min-width: 73px">公司</td>
102   - <td style="min-width: 87px">线路名</td>
103   - <td style="min-width: 73px">明细</td>
104   - <td style="min-width: 90px">预算</td>
105   - <td style="min-width: 90px">预算调整</td>
106   - <td style="min-width: 90px">预算</br>正式稿</td>
107   - <td style="min-width: 90px">1月</td>
108   - <td style="min-width: 90px">2月</td>
109   - <td style="min-width: 90px">3月</td>
110   - <td style="min-width: 90px">4月</td>
111   - <td style="min-width: 90px">5月</td>
112   - <td style="min-width: 90px">6月</td>
113   - <td style="min-width: 90px">7月</td>
114   - <td style="min-width: 90px">8月</td>
115   - <td style="min-width: 90px">9月</td>
116   - <td style="min-width: 90px">10月</td>
117   - <td style="min-width: 90px">11月</td>
118   - <td style="min-width: 90px">12月</td>
119   - <td style="min-width: 90px">合计</td>
120   - <td style="min-width: 90px">预算</br>完成率</td>
121   - <td style="min-width: 90px">预算差异</td>
122   - </tr>
123   - </thead>
124   - <tbody class="budget_sum_dataList" id="datas">
125   -
126   - </tbody>
127   - </table>
128   - </div>
  137 + <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
  138 + <input class="btn btn-default" type="button" id="exportData0" value="导出明细"/>
  139 + <span class="item-label" style="width: 80px;display: none;" id="key0"></span>
  140 + <span class="item-label" style="width: 80px;margin-left: 60px;">年份: </span>
  141 + <span class="item-label" style="width: 80px;" id="year0"></span>
  142 + <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span>
  143 + <span class="item-label" style="width: 80px;" id="gsName0"></span>
  144 + <span class="item-label" style="width: 80px;margin-left: 60px;">明细: </span>
  145 + <span class="item-label" style="width: 80px;" id="type0"></span>
  146 + <table class="table table-bordered table-hover table-checkable">
  147 + <thead style="text-align: center;">
  148 + <tr>
  149 + <td style="min-width: 73px" rowspan="2">公司</td>
  150 + <td style="min-width: 87px" rowspan="2">线路名</td>
  151 + <td style="min-width: 73px" rowspan="2">明细</td>
  152 + <td style="min-width: 90px" rowspan="2">预算</td>
  153 + <td style="min-width: 90px" rowspan="2">预算调整</td>
  154 + <td style="min-width: 90px" rowspan="2">预算</br>正式稿</td>
  155 + <td style="min-width: 90px" colspan="3">1月</td>
  156 + <td style="min-width: 90px" colspan="3">2月</td>
  157 + <td style="min-width: 90px" colspan="3">3月</td>
  158 + <td style="min-width: 90px" colspan="3">4月</td>
  159 + <td style="min-width: 90px" colspan="3">5月</td>
  160 + <td style="min-width: 90px" colspan="3">6月</td>
  161 + <td style="min-width: 90px" colspan="3">7月</td>
  162 + <td style="min-width: 90px" colspan="3">8月</td>
  163 + <td style="min-width: 90px" colspan="3">9月</td>
  164 + <td style="min-width: 90px" colspan="3">10月</td>
  165 + <td style="min-width: 90px" colspan="3">11月</td>
  166 + <td style="min-width: 90px" colspan="3">12月</td>
  167 + <td style="min-width: 90px" rowspan="2">合计</td>
  168 + <td style="min-width: 90px" rowspan="2">预算</br>完成率</td>
  169 + <td style="min-width: 90px" rowspan="2">预算差异</td>
  170 + </tr>
  171 + <tr>
  172 + <td style="min-width: 80px">实际</td>
  173 + <td style="min-width: 80px">预算</td>
  174 + <td style="min-width: 80px">完成率</td>
  175 + <td style="min-width: 80px">实际</td>
  176 + <td style="min-width: 80px">预算</td>
  177 + <td style="min-width: 80px">完成率</td>
  178 + <td style="min-width: 80px">实际</td>
  179 + <td style="min-width: 80px">预算</td>
  180 + <td style="min-width: 80px">完成率</td>
  181 + <td style="min-width: 80px">实际</td>
  182 + <td style="min-width: 80px">预算</td>
  183 + <td style="min-width: 80px">完成率</td>
  184 + <td style="min-width: 80px">实际</td>
  185 + <td style="min-width: 80px">预算</td>
  186 + <td style="min-width: 80px">完成率</td>
  187 + <td style="min-width: 80px">实际</td>
  188 + <td style="min-width: 80px">预算</td>
  189 + <td style="min-width: 80px">完成率</td>
  190 + <td style="min-width: 80px">实际</td>
  191 + <td style="min-width: 80px">预算</td>
  192 + <td style="min-width: 80px">完成率</td>
  193 + <td style="min-width: 80px">实际</td>
  194 + <td style="min-width: 80px">预算</td>
  195 + <td style="min-width: 80px">完成率</td>
  196 + <td style="min-width: 80px">实际</td>
  197 + <td style="min-width: 80px">预算</td>
  198 + <td style="min-width: 80px">完成率</td>
  199 + <td style="min-width: 80px">实际</td>
  200 + <td style="min-width: 80px">预算</td>
  201 + <td style="min-width: 80px">完成率</td>
  202 + <td style="min-width: 80px">实际</td>
  203 + <td style="min-width: 80px">预算</td>
  204 + <td style="min-width: 80px">完成率</td>
  205 + <td style="min-width: 80px">实际</td>
  206 + <td style="min-width: 80px">预算</td>
  207 + <td style="min-width: 80px">完成率</td>
  208 + </tr>
  209 + </thead>
  210 + <tbody class="budget_sum_dataList" id="datas">
  211 +
  212 + </tbody>
  213 + </table>
129 214 </div>
130 215 </div>
131 216 </div>
... ... @@ -159,8 +244,10 @@
159 244 return;
160 245 }
161 246 date = $("#date").val();
  247 + nature = $("#nature").val();
162 248 var params = {};
163 249 params['year'] = date;
  250 + params['nature'] = nature;
164 251 params['type'] = "query";
165 252 var i = layer.load(2);
166 253 $post('/budget/budgetSum',params,function(result){
... ... @@ -190,10 +277,10 @@
190 277 var tbodyHtml = template('budget_sum_dataList', {list:dataList});
191 278 $("#datas_hidden").removeClass("hidden");
192 279 $("#datas_hidden").height($(window).height()-280);
  280 + $("#key0").html(g.key);
193 281 $("#year0").html(g.year);
194 282 $("#gsName0").html(g.gsName);
195 283 $("#type0").html(g.type);
196   - $("#item0").html(g.item);
197 284 $("#datas").html(tbodyHtml);
198 285 }
199 286 });
... ... @@ -201,13 +288,12 @@
201 288 });
202 289  
203 290 $("#export").on("click",function(){
204   - if($("#date").val() == null || $("#date").val().trim().length == 0){
205   - layer.msg("请选择年份!");
206   - return;
  291 + if(date == null || date.trim().length == 0){
  292 + date = $("#date").val();
207 293 }
208   - date = $("#date").val();
209 294 var params = {};
210 295 params['year'] = date;
  296 + params['nature'] = nature;
211 297 params['type'] = "export";
212 298 var i = layer.load(2);
213 299 $post('/budget/budgetSum',params,function(result){
... ... @@ -216,6 +302,30 @@
216 302 layer.close(i);
217 303 });
218 304 });
  305 +
  306 + $("#exportData").on("click",function(){
  307 + exportData("allData");
  308 + });
  309 + $("#exportData0").on("click",function(){
  310 + exportData($("#key0").html());
  311 + });
  312 + function exportData(k){
  313 + if(date == null || date.trim().length == 0){
  314 + date = $("#date").val();
  315 + }
  316 + var params = {};
  317 + params['year'] = date;
  318 + params['nature'] = nature;
  319 + params['key'] = k;
  320 + params['type'] = "exportData";
  321 + console.log(params);
  322 + var i = layer.load(2);
  323 + $post('/budget/budgetSum',params,function(result){
  324 + window.open("/downloadFile/download?fileName="
  325 + +date+"-预算汇总表-线路明细");
  326 + layer.close(i);
  327 + });
  328 + }
219 329 });
220 330 </script>
221 331 <script type="text/html" id="budget_sum">
... ... @@ -227,17 +337,41 @@
227 337 <td>{{obj.change}}</td>
228 338 <td>{{obj.formal}}</td>
229 339 <td>{{obj.mon1}}</td>
  340 + <td>{{obj.bud1}}</td>
  341 + <td>{{obj.com1}}</td>
230 342 <td>{{obj.mon2}}</td>
  343 + <td>{{obj.bud2}}</td>
  344 + <td>{{obj.com2}}</td>
231 345 <td>{{obj.mon3}}</td>
  346 + <td>{{obj.bud3}}</td>
  347 + <td>{{obj.com3}}</td>
232 348 <td>{{obj.mon4}}</td>
  349 + <td>{{obj.bud4}}</td>
  350 + <td>{{obj.com4}}</td>
233 351 <td>{{obj.mon5}}</td>
  352 + <td>{{obj.bud5}}</td>
  353 + <td>{{obj.com5}}</td>
234 354 <td>{{obj.mon6}}</td>
  355 + <td>{{obj.bud6}}</td>
  356 + <td>{{obj.com6}}</td>
235 357 <td>{{obj.mon7}}</td>
  358 + <td>{{obj.bud7}}</td>
  359 + <td>{{obj.com7}}</td>
236 360 <td>{{obj.mon8}}</td>
  361 + <td>{{obj.bud8}}</td>
  362 + <td>{{obj.com8}}</td>
237 363 <td>{{obj.mon9}}</td>
  364 + <td>{{obj.bud9}}</td>
  365 + <td>{{obj.com9}}</td>
238 366 <td>{{obj.mon10}}</td>
  367 + <td>{{obj.bud10}}</td>
  368 + <td>{{obj.com10}}</td>
239 369 <td>{{obj.mon11}}</td>
  370 + <td>{{obj.bud11}}</td>
  371 + <td>{{obj.com11}}</td>
240 372 <td>{{obj.mon12}}</td>
  373 + <td>{{obj.bud12}}</td>
  374 + <td>{{obj.com12}}</td>
241 375 <td>{{obj.monAll}}</td>
242 376 <td>{{obj.complete}}</td>
243 377 <td>{{obj.diff}}</td>
... ... @@ -245,7 +379,7 @@
245 379 {{/each}}
246 380 {{if list.length == 0}}
247 381 <tr>
248   - <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td>
  382 + <td colspan="54"><h6 class="muted">没有找到相关数据</h6></td>
249 383 </tr>
250 384 {{/if}}
251 385 </script>
... ... @@ -259,17 +393,41 @@
259 393 <td>{{obj.change}}</td>
260 394 <td>{{obj.formal}}</td>
261 395 <td>{{obj.mon1}}</td>
  396 + <td>{{obj.bud1}}</td>
  397 + <td>{{obj.com1}}</td>
262 398 <td>{{obj.mon2}}</td>
  399 + <td>{{obj.bud2}}</td>
  400 + <td>{{obj.com2}}</td>
263 401 <td>{{obj.mon3}}</td>
  402 + <td>{{obj.bud3}}</td>
  403 + <td>{{obj.com3}}</td>
264 404 <td>{{obj.mon4}}</td>
  405 + <td>{{obj.bud4}}</td>
  406 + <td>{{obj.com4}}</td>
265 407 <td>{{obj.mon5}}</td>
  408 + <td>{{obj.bud5}}</td>
  409 + <td>{{obj.com5}}</td>
266 410 <td>{{obj.mon6}}</td>
  411 + <td>{{obj.bud6}}</td>
  412 + <td>{{obj.com6}}</td>
267 413 <td>{{obj.mon7}}</td>
  414 + <td>{{obj.bud7}}</td>
  415 + <td>{{obj.com7}}</td>
268 416 <td>{{obj.mon8}}</td>
  417 + <td>{{obj.bud8}}</td>
  418 + <td>{{obj.com8}}</td>
269 419 <td>{{obj.mon9}}</td>
  420 + <td>{{obj.bud9}}</td>
  421 + <td>{{obj.com9}}</td>
270 422 <td>{{obj.mon10}}</td>
  423 + <td>{{obj.bud10}}</td>
  424 + <td>{{obj.com10}}</td>
271 425 <td>{{obj.mon11}}</td>
  426 + <td>{{obj.bud11}}</td>
  427 + <td>{{obj.com11}}</td>
272 428 <td>{{obj.mon12}}</td>
  429 + <td>{{obj.bud12}}</td>
  430 + <td>{{obj.com12}}</td>
273 431 <td>{{obj.monAll}}</td>
274 432 <td>{{obj.complete}}</td>
275 433 <td>{{obj.diff}}</td>
... ... @@ -277,7 +435,7 @@
277 435 {{/each}}
278 436 {{if list.length == 0}}
279 437 <tr>
280   - <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td>
  438 + <td colspan="54"><h6 class="muted">没有找到相关数据</h6></td>
281 439 </tr>
282 440 {{/if}}
283 441 </script>
284 442 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/budget/timeSum.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +
  18 + #forms > thead > tr> td >span{
  19 + width: 5px;
  20 + word-wrap: break-word;
  21 + letter-spacing: 20px;
  22 + }
  23 +
  24 + #forms > thead > tr> td >label{
  25 + word-break: keep-all;white-space:nowrap;
  26 + }
  27 +</style>
  28 +
  29 +<div class="page-head">
  30 + <div class="page-title">
  31 + <h1>时刻表汇总表</h1>
  32 + </div>
  33 +</div>
  34 +
  35 +<div class="row">
  36 + <div class="col-md-12 portlet light porttlet-fit bordered">
  37 + <div class="portlet-title">
  38 + <form class="form-inline" action="" autocomplete="off">
  39 + <div style="display: inline-block;margin-left: 15px;">
  40 + <span class="item-label" style="width: 80px;">开始日期: </span>
  41 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  42 + </div>
  43 + <div style="display: inline-block;margin-left: 15px;">
  44 + <span class="item-label" style="width: 80px;">结束日期: </span>
  45 + <input class="form-control" type="text" id="date2" style="width: 180px;"/>
  46 + </div>
  47 + <div class="form-group">
  48 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  49 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  50 + <input class="btn btn-default" type="button" id="exportData" value="导出明细"/>
  51 + </div>
  52 + </form>
  53 + </div>
  54 + <div class="portlet-body">
  55 + <div class="table-container" id="timeSumDiv" style="margin-top: 10px;overflow:auto;min-width: 906px">
  56 + <table class="table table-bordered table-hover table-checkable" id="forms">
  57 + <thead style="text-align: center;">
  58 + <tr>
  59 + <th colspan="30">时刻表汇总表</th>
  60 + </tr>
  61 + <tr>
  62 + <td style="min-width: 73px">公司</td>
  63 + <td style="min-width: 87px">线路性质</td>
  64 + <td style="min-width: 90px">权证配车数</td>
  65 + <td style="min-width: 90px">机务保管数</td>
  66 + <td style="min-width: 90px">最高配车数</td>
  67 + <td style="min-width: 90px">备车率%</td>
  68 + <td style="min-width: 90px">人事配档数</td>
  69 + <td style="min-width: 90px">司最高配档数</td>
  70 + <td style="min-width: 90px">售最高配档数</td>
  71 + <td style="min-width: 90px">病缺勤比例%</td>
  72 + <td style="min-width: 90px">人均营运工时(小时)</td>
  73 + </tr>
  74 +
  75 + </thead>
  76 + <tbody class="time_sum">
  77 +
  78 + </tbody>
  79 + </table>
  80 + </div>
  81 + </div>
  82 + <div class="portlet-body table-container hidden" id="datas_time_hidden"
  83 + style="margin-top: 30px;overflow:auto;min-width: 906px;">
  84 + <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
  85 + <input class="btn btn-default" type="button" id="exportData0" value="导出明细"/>
  86 + <span class="item-label" style="width: 80px;display: none;" id="key0"></span>
  87 + <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span>
  88 + <span class="item-label" style="width: 80px;" id="gsName0"></span>
  89 + <span class="item-label" style="width: 80px;margin-left: 60px;">线路性质: </span>
  90 + <span class="item-label" style="width: 80px;" id="type0"></span>
  91 + <table class="table table-bordered table-hover table-checkable">
  92 + <thead style="text-align: center;">
  93 + <tr>
  94 + <td style="min-width: 73px">公司</td>
  95 + <td style="min-width: 87px">线路名</td>
  96 + <td style="min-width: 90px">权证配车数</td>
  97 + <td style="min-width: 90px">机务保管数</td>
  98 + <td style="min-width: 90px">最高配车数</td>
  99 + <td style="min-width: 90px">备车率%</td>
  100 + <td style="min-width: 90px">人事配档数</td>
  101 + <td style="min-width: 90px">司最高配档数</td>
  102 + <td style="min-width: 90px">售最高配档数</td>
  103 + <td style="min-width: 90px">病缺勤比例%</td>
  104 + <td style="min-width: 90px">人均营运工时(小时)</td>
  105 + </tr>
  106 + </thead>
  107 + <tbody class="budget_sum_dataList" id="datas_time">
  108 +
  109 + </tbody>
  110 + </table>
  111 + </div>
  112 + </div>
  113 +</div>
  114 +
  115 +<script>
  116 + $(function(){
  117 +// $('#export').attr('disabled', "true");
  118 +
  119 + // 关闭左侧栏
  120 + if (!$('body').hasClass('page-sidebar-closed'))
  121 + $('.menu-toggler.sidebar-toggler').click();
  122 +
  123 + $("#timeSumDiv").height($(window).height()-280);
  124 +
  125 + $("#date").datetimepicker({
  126 + format : 'YYYY-MM-DD',
  127 + locale : 'zh-cn'
  128 + });
  129 + $("#date2").datetimepicker({
  130 + format : 'YYYY-MM-DD',
  131 + locale : 'zh-cn'
  132 + });
  133 +
  134 + var d = new Date();
  135 + d.setTime(d.getTime() - 4*1000*60*60*24);
  136 + var year = d.getFullYear();
  137 + var month = d.getMonth() + 1;
  138 + var day = d.getDate();
  139 + if(month < 10)
  140 + month = "0" + month;
  141 + if(day < 10)
  142 + day = "0" + day;
  143 + $("#date").val(year + "-" + month + "-" + day);
  144 + $("#date2").val(year + "-" + month + "-" + day);
  145 +
  146 + var date = "";
  147 + var date2 = "";
  148 + var resList;
  149 + $("#query").on("click",function(){
  150 + $("#timeSumDiv").height($(window).height()-280);
  151 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  152 + layer.msg("请选择日期区间!");
  153 + return;
  154 + }
  155 + if($("#date2").val() == null || $("#date2").val().trim().length == 0){
  156 + layer.msg("请选择日期区间!");
  157 + return;
  158 + }
  159 + date = $("#date").val();
  160 + date2 = $("#date2").val();
  161 + var params = {};
  162 + params['date'] = date;
  163 + params['date2'] = date2;
  164 + params['type'] = "query";
  165 + var i = layer.load(2);
  166 + $post('/budget/timeSum',params,function(result){
  167 + layer.close(i);
  168 + // 把数据填充到模版中
  169 + var tbodyHtml = template('time_sum',{list:result});
  170 + // 把渲染好的模版html文本追加到表格中
  171 + $('#forms .time_sum').html(tbodyHtml);
  172 +
  173 + $("#datetodate").html(date);
  174 +
  175 + if(result.length == 0)
  176 + $("#export").attr('disabled',"true");
  177 + else
  178 + $("#export").removeAttr("disabled");
  179 +
  180 + $("#datas_time_hidden").addClass("hidden");
  181 + resList = result;
  182 + });
  183 + });
  184 +
  185 + $("#forms tbody").on("click", "a", function(){
  186 + var key = $(this).data("key");
  187 + $.each(resList, function(i, g){
  188 + if(key == g.key){
  189 + var dataList = g.dataList;
  190 + var tbodyHtml = template('time_sum_dataList', {list:dataList});
  191 + $("#datas_time_hidden").removeClass("hidden");
  192 + $("#datas_time_hidden").height($(window).height()-280);
  193 + $("#key0").html(g.key);
  194 + $("#gsName0").html(g.gsName);
  195 + $("#type0").html(g.type);
  196 + $("#datas_time").html(tbodyHtml);
  197 + }
  198 + });
  199 + $("html,body").animate({scrollTop:$("#datas_time").offset().top},700);
  200 + });
  201 +
  202 + $("#export").on("click",function(){
  203 + if(date == null || date.trim().length == 0){
  204 + date = $("#date").val();
  205 + }
  206 + if(date2 == null || date2.trim().length == 0){
  207 + date2 = $("#date2").val();
  208 + }
  209 + var params = {};
  210 + params['date'] = date;
  211 + params['date2'] = date2;
  212 + params['type'] = "export";
  213 + var i = layer.load(2);
  214 + $post('/budget/timeSum',params,function(result){
  215 + var dateTime = "";
  216 + if(date == date2){
  217 + dateTime = moment(date).format("YYYYMMDD");
  218 + } else {
  219 + dateTime = moment(date).format("YYYYMMDD")
  220 + +"-"+moment(date2).format("YYYYMMDD");
  221 + }
  222 + window.open("/downloadFile/download?fileName="
  223 + +dateTime+"-时刻表汇总表");
  224 + layer.close(i);
  225 + });
  226 + });
  227 +
  228 + $("#exportData").on("click",function(){
  229 + exportData("all_0");
  230 + });
  231 + $("#exportData0").on("click",function(){
  232 + exportData($("#key0").html());
  233 + });
  234 + function exportData(k){
  235 + if(date == null || date.trim().length == 0){
  236 + date = $("#date").val();
  237 + }
  238 + if(date2 == null || date2.trim().length == 0){
  239 + date2 = $("#date2").val();
  240 + }
  241 + var params = {};
  242 + params['date'] = date;
  243 + params['date2'] = date2;
  244 + params['key'] = k;
  245 + params['type'] = "exportData";
  246 + var i = layer.load(2);
  247 + $post('/budget/timeSum',params,function(result){
  248 + var dateTime = "";
  249 + if(date == date2){
  250 + dateTime = moment(date).format("YYYYMMDD");
  251 + } else {
  252 + dateTime = moment(date).format("YYYYMMDD")
  253 + +"-"+moment(date2).format("YYYYMMDD");
  254 + }
  255 + window.open("/downloadFile/download?fileName="
  256 + +dateTime+"-时刻表汇总表-线路明细");
  257 + layer.close(i);
  258 + });
  259 + }
  260 + });
  261 +</script>
  262 +<script type="text/html" id="time_sum">
  263 + {{each list as obj i}}
  264 + <tr>
  265 + <td>{{obj.gsName}}</td>
  266 + <td><a data-key="{{obj.key}}">{{obj.type}}</a></td>
  267 + <td>{{obj.warrantCar}}</td>
  268 + <td>{{obj.ccNum}}</td>
  269 + <td>{{obj.carNum}}</td>
  270 + <td>{{obj.bcl}}</td>
  271 + <td>{{obj.ecNum}}</td>
  272 + <td>{{obj.driverNum}}</td>
  273 + <td>{{obj.busConductorNum}}</td>
  274 + <td>{{obj.cspsNum}}</td>
  275 + <td>{{obj.time}}</td>
  276 + </tr>
  277 + {{/each}}
  278 + {{if list.length == 0}}
  279 + <tr>
  280 + <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td>
  281 + </tr>
  282 + {{/if}}
  283 +</script>
  284 +<script type="text/html" id="time_sum_dataList">
  285 + {{each list as obj i}}
  286 + <tr>
  287 + <td>{{obj.gsName}}</td>
  288 + <td>{{obj.xlName}}</td>
  289 + <td>{{obj.warrantCar}}</td>
  290 + <td>{{obj.ccNum}}</td>
  291 + <td>{{obj.carNum}}</td>
  292 + <td>{{obj.bcl}}</td>
  293 + <td>{{obj.ecNum}}</td>
  294 + <td>{{obj.driverNum}}</td>
  295 + <td>{{obj.busConductorNum}}</td>
  296 + <td>{{obj.cspsNum}}</td>
  297 + <td>{{obj.time}}</td>
  298 + </tr>
  299 + {{/each}}
  300 + {{if list.length == 0}}
  301 + <tr>
  302 + <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td>
  303 + </tr>
  304 + {{/if}}
  305 +</script>
0 306 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/mould/budgetAmounts.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetAmounts_data.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetMileage.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetMileage_data.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetPerson.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetPerson_data.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetSum.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetSum_data.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/import_budget.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/timeSum.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/report/sheet/calcSheetList.html
... ... @@ -27,24 +27,33 @@
27 27 <div class="portlet light porttlet-fit bordered">
28 28 <div class="portlet-title">
29 29 <form class="form-inline" action="">
30   - <div style="display: inline-block; margin-left: 61px;" id="gsdmDiv">
  30 + <div style="display: inline-block; margin-left: 41px;" id="gsdmDiv">
31 31 <span class="item-label" style="width: 80px;">公司: </span> <select
32 32 class="form-control" name="company" id="gsdm"
33 33 style="width: 180px;"></select>
34 34 </div>
35   - <div style="display: inline-block; margin-left: 38px;"
  35 + <div style="display: inline-block; margin-left: 28px;"
36 36 id="fgsdmDiv">
37 37 <span class="item-label" style="width: 80px;">分公司: </span> <select
38 38 class="form-control" name="subCompany" id="fgsdm"
39 39 style="width: 180px;"></select>
40 40 </div>
41 41  
42   - <div style="display: inline-block; margin-left: 53px;">
  42 + <div style="display: inline-block; margin-left: 43px;">
43 43 <span class="item-label" style="width: 80px;">线路: </span> <select
44 44 class="form-control" name="line" id="line" style="width: 180px;"></select>
45 45 </div>
  46 + <div style="display: inline-block; margin-left: 14px;">
  47 + <span class="item-label" style="width: 80px;">挂牌线路: </span> <select
  48 + class="form-control" name="plate" id="plate"
  49 + style="width: 180px;">
  50 + <option value="0" selected="selected">全部线路</option>
  51 + <option value="1">是</option>
  52 + <option value="2">否</option>
  53 + </select>
  54 + </div>
46 55 <div style="margin-top: 10px"></div>
47   - <div style="display: inline-block; margin-left: 33px;">
  56 + <div style="display: inline-block; margin-left: 13px;">
48 57 <span class="item-label" style="width: 80px;">线路性质: </span> <select
49 58 class="form-control" name="nature" id="nature"
50 59 style="width: 180px;">
... ... @@ -54,20 +63,21 @@
54 63 </select>
55 64 </div>
56 65 <div style="display: inline-block;">
57   - <span class="item-label" style="width: 80px; margin-left: 24px;">开始时间:
  66 + <span class="item-label" style="width: 80px; margin-left: 14px;">开始时间:
58 67 </span> <input class="form-control" type="text" id="date"
59 68 style="width: 180px;" />
60 69 </div>
61 70 <div style="display: inline-block;">
62   - <span class="item-label" style="width: 80px; margin-left: 24px;">结束时间:
  71 + <span class="item-label" style="width: 80px; margin-left: 14px;">结束时间:
63 72 </span> <input class="form-control" type="text" id="endDate"
64 73 style="width: 180px;" />
65 74 </div>
66 75  
67 76 <div class="form-group">
68 77 <input type="hidden" id="id" /> <input class="btn btn-default"
69   - type="button" id="query" value="查询" /> <input
70   - class="btn btn-default" type="button" id="export" value="导出" />
  78 + type="button" id="query" value="查询" />
  79 + <input class="btn btn-default" type="button" id="export" value="导出" />
  80 + <input class="btn btn-default" type="button" id="exportAll" value="导出全部公司" style="display: none;"/>
71 81 </div>
72 82 </form>
73 83 </div>
... ... @@ -248,10 +258,11 @@
248 258 var fgs=$('#fgsdm').val();
249 259 var gs=$('#gsdm').val();
250 260 var nature=$("#nature").val();
  261 + var plate=$("#plate").val();
251 262 var i = layer.load(2);
252   - $get('/calcSheet/countList',{line:line,date:date,endDate:endDate,gs:gs,fgs:fgs,nature:nature,type:'query'},function(result){
253   - layer.close(i);
254   - var calcSheetList = template('calcSheetList',{list:result});
  263 + $get('/calcSheet/countList',{line:line,date:date,endDate:endDate,gs:gs,fgs:fgs,nature:nature,plate:plate,type:'query'},function(result){
  264 + layer.close(i);
  265 + var calcSheetList = template('calcSheetList',{list:result});
255 266 $('#forms tbody').html(calcSheetList);
256 267 $('.btn-calcSheetList').on('click', showcalcSheetList);
257 268  
... ... @@ -320,13 +331,14 @@
320 331 var fgs=$('#fgsdm').val();
321 332 var gs=$('#gsdm').val();
322 333 var nature=$("#nature").val();
  334 + var plate=$("#plate").val();
323 335 var lineName = $('#line option:selected').text();
324 336 if(lineName == "全部线路")
325 337 lineName = $('#fgsdm option:selected').text();
326 338 if(lineName == "请选择")
327 339 lineName =$('#gsdm option:selected').text();
328 340 var i = layer.load(2);
329   - $get('/calcSheet/countList',{line:line,date:date,endDate:endDate,gs:gs,fgs:fgs,nature:nature,type:'export'},function(result){
  341 + $get('/calcSheet/countList',{line:line,date:date,endDate:endDate,gs:gs,fgs:fgs,nature:nature,plate:plate,type:'export'},function(result){
330 342 var dateTime = "";
331 343 if(date == endDate){
332 344 dateTime = moment(date).format("YYYYMMDD");
... ... @@ -357,7 +369,37 @@
357 369 window.open("/downloadFile/download?fileName=发车到站准点率"+moment(date).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
358 370 layer.close(i);
359 371 });
360   - })
  372 + });
  373 +
  374 +
  375 + $.get('/user/getCurrentUser', function(result){
  376 + var roleName = "";
  377 + $(result.roles).each(function(i, e){
  378 + roleName += e.roleName + "、";
  379 + });
  380 + if(roleName.indexOf("浦交") > -1 || roleName.indexOf("拓华") > -1){
  381 + $("#exportAll").show();
  382 + }
  383 + });
  384 + $("#exportAll").on("click",function(){
  385 + var date = $("#date").val();
  386 + var endDate = $("#endDate").val();
  387 + var nature=$("#nature").val();
  388 + var plate=$("#plate").val();
  389 + var i = layer.load(2);
  390 + $get('/calcSheet/countList',{date:date,endDate:endDate,nature:nature,plate:plate,type:'exportAll'},function(result){
  391 + var dateTime = "";
  392 + if(date == endDate){
  393 + dateTime = moment(date).format("YYYYMMDD");
  394 + } else {
  395 + dateTime = moment(date).format("YYYYMMDD")+"-"+
  396 + moment(endDate).format("YYYYMMDD");
  397 + }
  398 + window.open("/downloadFile/download?fileName="
  399 + +dateTime+"-全部公司-发车到站准点率");
  400 + layer.close(i);
  401 + });
  402 + });
361 403  
362 404 });
363 405 </script>
... ...