Commit a2a66ec848e6a38c790eb95a16a2edd4ff0f075f
1 parent
a166408c
预算报表
Showing
28 changed files
with
4198 additions
and
101 deletions
src/main/java/com/bsth/controller/forms/BudgetController.java
0 → 100644
| 1 | +package com.bsth.controller.forms; | ||
| 2 | + | ||
| 3 | +import java.io.File; | ||
| 4 | +import java.text.SimpleDateFormat; | ||
| 5 | +import java.util.ArrayList; | ||
| 6 | +import java.util.Date; | ||
| 7 | +import java.util.HashMap; | ||
| 8 | +import java.util.List; | ||
| 9 | +import java.util.Map; | ||
| 10 | + | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 14 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 15 | +import org.springframework.web.bind.annotation.RestController; | ||
| 16 | +import org.springframework.web.multipart.MultipartFile; | ||
| 17 | + | ||
| 18 | +import com.bsth.common.ResponseCode; | ||
| 19 | +import com.bsth.controller.BaseController; | ||
| 20 | +import com.bsth.entity.forms.Budget; | ||
| 21 | +import com.bsth.entity.forms.Revenue; | ||
| 22 | +import com.bsth.service.forms.BudgetService; | ||
| 23 | +import com.bsth.service.forms.impl.RevenueLoader; | ||
| 24 | +import com.google.common.io.Files; | ||
| 25 | + | ||
| 26 | +import lombok.experimental.var; | ||
| 27 | + | ||
| 28 | +@RestController | ||
| 29 | +@RequestMapping("budget") | ||
| 30 | +public class BudgetController extends BaseController<Budget, Integer>{ | ||
| 31 | + | ||
| 32 | + @Autowired | ||
| 33 | + private BudgetService service; | ||
| 34 | + | ||
| 35 | + @RequestMapping(value = "/uploadFile",method = RequestMethod.POST) | ||
| 36 | + public String uploadFile(MultipartFile file) throws Exception{ | ||
| 37 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 38 | + File newFile = new File( | ||
| 39 | + getDataImportClasspath() + File.separator + | ||
| 40 | + file.getOriginalFilename()); | ||
| 41 | + Files.write(file.getBytes(), newFile); | ||
| 42 | + String result = service.importExcel(newFile); | ||
| 43 | + return "{\"result\":" + "\""+result+"\"}"; | ||
| 44 | + } | ||
| 45 | + public String getDataImportClasspath(){ | ||
| 46 | + return this.getClass().getResource("/").getPath() + "/static/pages/forms/budget"; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @RequestMapping(value = "/deleteIds", method = RequestMethod.POST) | ||
| 50 | + public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) { | ||
| 51 | + Map<String, Object> maps=new HashMap<String, Object>(); | ||
| 52 | + try { | ||
| 53 | + maps= service.deleteIds(map); | ||
| 54 | + } catch (Exception e) { | ||
| 55 | + // TODO Auto-generated catch block | ||
| 56 | + e.printStackTrace(); | ||
| 57 | + } | ||
| 58 | + return maps; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @RequestMapping(value = "/updateRevenue", method = RequestMethod.GET) | ||
| 62 | + public Map<String, Object> updateRevenue(@RequestParam Map<String, Object> map) { | ||
| 63 | + Map<String, Object> resMap=new HashMap<String, Object>(); | ||
| 64 | + try { | ||
| 65 | + System.out.println(map); | ||
| 66 | + if(map.get("date") != null && map.get("date").toString().length() > 0){ | ||
| 67 | + resMap = service.updateRevenue(map.get("date").toString()); | ||
| 68 | + } | ||
| 69 | + if(map.get("date1") != null && map.get("date1").toString().length() > 0 | ||
| 70 | + && map.get("date2") != null && map.get("date2").toString().length() > 0){ | ||
| 71 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 72 | + String date1 = map.get("date1").toString(); | ||
| 73 | + String date2 = map.get("date2").toString(); | ||
| 74 | + Date parse1 = sdf.parse(date1); | ||
| 75 | + Date parse2 = sdf.parse(date2); | ||
| 76 | + for(Date parse = new Date(parse1.getTime()); | ||
| 77 | + parse.getTime() <= parse2.getTime(); | ||
| 78 | + parse.setTime(parse.getTime() + 1l*1000*60*60*24)){ | ||
| 79 | + service.updateRevenue(sdf.format(parse)); | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + resMap.put("status", ResponseCode.SUCCESS); | ||
| 83 | + } catch (Exception e) { | ||
| 84 | + // TODO Auto-generated catch block | ||
| 85 | + e.printStackTrace(); | ||
| 86 | + resMap.put("status", ResponseCode.ERROR); | ||
| 87 | + } | ||
| 88 | + return resMap; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + @RequestMapping(value = "/budgetMileage", method = RequestMethod.POST) | ||
| 92 | + public List<Map<String, Object>> budgetMileage(@RequestParam Map<String, Object> map) { | ||
| 93 | + List<Map<String, Object>> resList=new ArrayList<Map<String, Object>>(); | ||
| 94 | + String type = ""; | ||
| 95 | + if(map.get("type")!=null){ | ||
| 96 | + type=map.get("type").toString(); | ||
| 97 | + } | ||
| 98 | + String year = ""; | ||
| 99 | + if(map.get("year")!=null){ | ||
| 100 | + year=map.get("year").toString(); | ||
| 101 | + return service.budgetMileage(year, type); | ||
| 102 | + } else { | ||
| 103 | + return resList; | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + @RequestMapping(value = "/budgetPerson", method = RequestMethod.POST) | ||
| 108 | + public List<Map<String, Object>> budgetPerson(@RequestParam Map<String, Object> map) { | ||
| 109 | + List<Map<String, Object>> resList=new ArrayList<Map<String, Object>>(); | ||
| 110 | + String type = ""; | ||
| 111 | + if(map.get("type")!=null){ | ||
| 112 | + type=map.get("type").toString(); | ||
| 113 | + } | ||
| 114 | + String year = ""; | ||
| 115 | + if(map.get("year")!=null){ | ||
| 116 | + year=map.get("year").toString(); | ||
| 117 | + return service.budgetPerson(year, type); | ||
| 118 | + } else { | ||
| 119 | + return resList; | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + @RequestMapping(value = "/budgetAmounts", method = RequestMethod.POST) | ||
| 124 | + public List<Map<String, Object>> budgetAmounts(@RequestParam Map<String, Object> map) { | ||
| 125 | + List<Map<String, Object>> resList=new ArrayList<Map<String, Object>>(); | ||
| 126 | + String type = ""; | ||
| 127 | + if(map.get("type")!=null){ | ||
| 128 | + type=map.get("type").toString(); | ||
| 129 | + } | ||
| 130 | + String year = ""; | ||
| 131 | + if(map.get("year")!=null){ | ||
| 132 | + year=map.get("year").toString(); | ||
| 133 | + return service.budgetAmounts(year, type); | ||
| 134 | + } else { | ||
| 135 | + return resList; | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + @RequestMapping(value = "/budgetSum", method = RequestMethod.POST) | ||
| 140 | + public List<Map<String, Object>> budgetSum(@RequestParam Map<String, Object> map) { | ||
| 141 | + List<Map<String, Object>> resList=new ArrayList<Map<String, Object>>(); | ||
| 142 | + String type = ""; | ||
| 143 | + if(map.get("type")!=null){ | ||
| 144 | + type=map.get("type").toString(); | ||
| 145 | + } | ||
| 146 | + String year = ""; | ||
| 147 | + if(map.get("year")!=null){ | ||
| 148 | + year=map.get("year").toString(); | ||
| 149 | + return service.budgetSum(year, type); | ||
| 150 | + } else { | ||
| 151 | + return resList; | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | +} |
src/main/java/com/bsth/entity/forms/Budget.java
0 → 100644
| 1 | +package com.bsth.entity.forms; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Column; | ||
| 6 | +import javax.persistence.Entity; | ||
| 7 | +import javax.persistence.GeneratedValue; | ||
| 8 | +import javax.persistence.GenerationType; | ||
| 9 | +import javax.persistence.Id; | ||
| 10 | +import javax.persistence.Table; | ||
| 11 | + | ||
| 12 | +import com.bsth.entity.sys.SysUser; | ||
| 13 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 年度预算表 | ||
| 17 | + */ | ||
| 18 | +@Entity | ||
| 19 | +@Table(name = "bsth_t_budget") | ||
| 20 | +public class Budget { | ||
| 21 | + | ||
| 22 | + @Id | ||
| 23 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 24 | + private Long id; | ||
| 25 | + //年份 | ||
| 26 | + private String year; | ||
| 27 | + //公司编码 | ||
| 28 | + private String gsBm; | ||
| 29 | + //公司名称 | ||
| 30 | + private String gsName; | ||
| 31 | + //分公司编码 | ||
| 32 | + private String fgsBm; | ||
| 33 | + //分公司名称 | ||
| 34 | + private String fgsName; | ||
| 35 | + //线路编码 | ||
| 36 | + private String xlBm; | ||
| 37 | + //线路名 | ||
| 38 | + private String xlName; | ||
| 39 | + //是否营运 | ||
| 40 | + private boolean sfyy; | ||
| 41 | + //预算公里 | ||
| 42 | + private Double budgetMileage; | ||
| 43 | + //预算调整公里 | ||
| 44 | + private Double changeMileage; | ||
| 45 | + //预算正式公里 = if(有调整){调整}else{预算} | ||
| 46 | + private Double formalMileage; | ||
| 47 | + //预算人次 | ||
| 48 | + private Long budgetPerson; | ||
| 49 | + //预算调整人次 | ||
| 50 | + private Long changePerson; | ||
| 51 | + //预算正式人次 = if(有调整){调整}else{预算} | ||
| 52 | + private Long formalPerson; | ||
| 53 | + //预算营收 | ||
| 54 | + private Double budgetAmounts; | ||
| 55 | + //预算调整营收 | ||
| 56 | + private Double changeAmounts; | ||
| 57 | + //预算正式营收 = if(有调整){调整}else{预算} | ||
| 58 | + private Double formalAmounts; | ||
| 59 | + /** 创建人 */ | ||
| 60 | + @JsonIgnore | ||
| 61 | + private SysUser createBy; | ||
| 62 | + /** 修改人 */ | ||
| 63 | + @JsonIgnore | ||
| 64 | + private SysUser updateBy; | ||
| 65 | + /** 创建日期 */ | ||
| 66 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 67 | + private Date createDate; | ||
| 68 | + /** 修改日期 */ | ||
| 69 | + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 70 | + private Date updateDate; | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + public Long getId() { | ||
| 74 | + return id; | ||
| 75 | + } | ||
| 76 | + public void setId(Long id) { | ||
| 77 | + this.id = id; | ||
| 78 | + } | ||
| 79 | + //年份 | ||
| 80 | + public String getYear() { | ||
| 81 | + return year; | ||
| 82 | + } | ||
| 83 | + //年份 | ||
| 84 | + public void setYear(String year) { | ||
| 85 | + this.year = year; | ||
| 86 | + } | ||
| 87 | + //公司编码 | ||
| 88 | + public String getGsBm() { | ||
| 89 | + return gsBm; | ||
| 90 | + } | ||
| 91 | + //公司编码 | ||
| 92 | + public void setGsBm(String gsBm) { | ||
| 93 | + this.gsBm = gsBm; | ||
| 94 | + } | ||
| 95 | + //公司名称 | ||
| 96 | + public String getGsName() { | ||
| 97 | + return gsName; | ||
| 98 | + } | ||
| 99 | + //公司名称 | ||
| 100 | + public void setGsName(String gsName) { | ||
| 101 | + this.gsName = gsName; | ||
| 102 | + } | ||
| 103 | + //分公司编码 | ||
| 104 | + public String getFgsBm() { | ||
| 105 | + return fgsBm; | ||
| 106 | + } | ||
| 107 | + //分公司编码 | ||
| 108 | + public void setFgsBm(String fgsBm) { | ||
| 109 | + this.fgsBm = fgsBm; | ||
| 110 | + } | ||
| 111 | + //分公司名称 | ||
| 112 | + public String getFgsName() { | ||
| 113 | + return fgsName; | ||
| 114 | + } | ||
| 115 | + //分公司名称 | ||
| 116 | + public void setFgsName(String fgsName) { | ||
| 117 | + this.fgsName = fgsName; | ||
| 118 | + } | ||
| 119 | + //线路编码 | ||
| 120 | + public String getXlBm() { | ||
| 121 | + return xlBm; | ||
| 122 | + } | ||
| 123 | + //线路编码 | ||
| 124 | + public void setXlBm(String xlBm) { | ||
| 125 | + this.xlBm = xlBm; | ||
| 126 | + } | ||
| 127 | + //线路名 | ||
| 128 | + public String getXlName() { | ||
| 129 | + return xlName; | ||
| 130 | + } | ||
| 131 | + //线路名 | ||
| 132 | + public void setXlName(String xlName) { | ||
| 133 | + this.xlName = xlName; | ||
| 134 | + } | ||
| 135 | + //是否营运 | ||
| 136 | + public boolean getSfyy() { | ||
| 137 | + return sfyy; | ||
| 138 | + } | ||
| 139 | + //是否营运 | ||
| 140 | + public void setSfyy(boolean sfyy) { | ||
| 141 | + this.sfyy = sfyy; | ||
| 142 | + } | ||
| 143 | + //预算公里 | ||
| 144 | + public Double getBudgetMileage() { | ||
| 145 | + return budgetMileage; | ||
| 146 | + } | ||
| 147 | + //预算公里 | ||
| 148 | + public void setBudgetMileage(Double budgetMileage) { | ||
| 149 | + this.budgetMileage = budgetMileage; | ||
| 150 | + } | ||
| 151 | + //预算调整公里 | ||
| 152 | + public Double getChangeMileage() { | ||
| 153 | + return changeMileage; | ||
| 154 | + } | ||
| 155 | + //预算调整公里 | ||
| 156 | + public void setChangeMileage(Double changeMileage) { | ||
| 157 | + this.changeMileage = changeMileage; | ||
| 158 | + } | ||
| 159 | + //预算正式公里 = if(有调整){调整}else{预算} | ||
| 160 | + public Double getFormalMileage() { | ||
| 161 | + return formalMileage; | ||
| 162 | + } | ||
| 163 | + //预算正式公里 = if(有调整){调整}else{预算} | ||
| 164 | + public void setFormalMileage(Double formalMileage) { | ||
| 165 | + this.formalMileage = formalMileage; | ||
| 166 | + } | ||
| 167 | + //预算人次 | ||
| 168 | + public Long getBudgetPerson() { | ||
| 169 | + return budgetPerson; | ||
| 170 | + } | ||
| 171 | + //预算人次 | ||
| 172 | + public void setBudgetPerson(Long budgetPerson) { | ||
| 173 | + this.budgetPerson = budgetPerson; | ||
| 174 | + } | ||
| 175 | + //预算调整人次 | ||
| 176 | + public Long getChangePerson() { | ||
| 177 | + return changePerson; | ||
| 178 | + } | ||
| 179 | + //预算调整人次 | ||
| 180 | + public void setChangePerson(Long changePerson) { | ||
| 181 | + this.changePerson = changePerson; | ||
| 182 | + } | ||
| 183 | + //预算正式人次 = if(有调整){调整}else{预算} | ||
| 184 | + public Long getFormalPerson() { | ||
| 185 | + return formalPerson; | ||
| 186 | + } | ||
| 187 | + //预算正式人次 = if(有调整){调整}else{预算} | ||
| 188 | + public void setFormalPerson(Long formalPerson) { | ||
| 189 | + this.formalPerson = formalPerson; | ||
| 190 | + } | ||
| 191 | + //预算营收 | ||
| 192 | + public Double getBudgetAmounts() { | ||
| 193 | + return budgetAmounts; | ||
| 194 | + } | ||
| 195 | + //预算营收 | ||
| 196 | + public void setBudgetAmounts(Double budgetAmounts) { | ||
| 197 | + this.budgetAmounts = budgetAmounts; | ||
| 198 | + } | ||
| 199 | + //预算调整营收 | ||
| 200 | + public Double getChangeAmounts() { | ||
| 201 | + return changeAmounts; | ||
| 202 | + } | ||
| 203 | + //预算调整营收 | ||
| 204 | + public void setChangeAmounts(Double changeAmounts) { | ||
| 205 | + this.changeAmounts = changeAmounts; | ||
| 206 | + } | ||
| 207 | + //预算正式营收 = if(有调整){调整}else{预算} | ||
| 208 | + public Double getFormalAmounts() { | ||
| 209 | + return formalAmounts; | ||
| 210 | + } | ||
| 211 | + //预算正式营收 = if(有调整){调整}else{预算} | ||
| 212 | + public void setFormalAmounts(Double formalAmounts) { | ||
| 213 | + this.formalAmounts = formalAmounts; | ||
| 214 | + } | ||
| 215 | + public SysUser getCreateBy() { | ||
| 216 | + return createBy; | ||
| 217 | + } | ||
| 218 | + public void setCreateBy(SysUser createBy) { | ||
| 219 | + this.createBy = createBy; | ||
| 220 | + } | ||
| 221 | + public SysUser getUpdateBy() { | ||
| 222 | + return updateBy; | ||
| 223 | + } | ||
| 224 | + public void setUpdateBy(SysUser updateBy) { | ||
| 225 | + this.updateBy = updateBy; | ||
| 226 | + } | ||
| 227 | + public Date getCreateDate() { | ||
| 228 | + return createDate; | ||
| 229 | + } | ||
| 230 | + public void setCreateDate(Date createDate) { | ||
| 231 | + this.createDate = createDate; | ||
| 232 | + } | ||
| 233 | + public Date getUpdateDate() { | ||
| 234 | + return updateDate; | ||
| 235 | + } | ||
| 236 | + public void setUpdateDate(Date updateDate) { | ||
| 237 | + this.updateDate = updateDate; | ||
| 238 | + } | ||
| 239 | +} |
src/main/java/com/bsth/entity/forms/Revenue.java
0 → 100644
| 1 | +package com.bsth.entity.forms; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Column; | ||
| 6 | +import javax.persistence.Entity; | ||
| 7 | +import javax.persistence.GeneratedValue; | ||
| 8 | +import javax.persistence.GenerationType; | ||
| 9 | +import javax.persistence.Id; | ||
| 10 | +import javax.persistence.Table; | ||
| 11 | + | ||
| 12 | +import com.bsth.entity.sys.SysUser; | ||
| 13 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 线路人次营收表 | ||
| 17 | + */ | ||
| 18 | +@Entity | ||
| 19 | +@Table(name = "bsth_t_revenue") | ||
| 20 | +public class Revenue { | ||
| 21 | + | ||
| 22 | + @Id | ||
| 23 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 24 | + private Long id; | ||
| 25 | + //营运日期 | ||
| 26 | + private Date scheduleDate; | ||
| 27 | + //营运日期字符串(yyyy-MM-dd) | ||
| 28 | + private String scheduleDateStr; | ||
| 29 | + //公司编码 | ||
| 30 | + private String gsBm; | ||
| 31 | + //公司名称 | ||
| 32 | + private String gsName; | ||
| 33 | + //分公司编码 | ||
| 34 | + private String fgsBm; | ||
| 35 | + //分公司名称 | ||
| 36 | + private String fgsName; | ||
| 37 | + //线路编码 | ||
| 38 | + private String xlBm; | ||
| 39 | + //线路名 | ||
| 40 | + private String xlName; | ||
| 41 | + //是否营运 | ||
| 42 | + private boolean sfyy; | ||
| 43 | + //总人次 | ||
| 44 | + private Long num; | ||
| 45 | + //总营收(单位:分) | ||
| 46 | + private Double amount; | ||
| 47 | + /** 创建人 */ | ||
| 48 | + @JsonIgnore | ||
| 49 | + private SysUser createBy; | ||
| 50 | + /** 修改人 */ | ||
| 51 | + @JsonIgnore | ||
| 52 | + private SysUser updateBy; | ||
| 53 | + /** 创建日期 */ | ||
| 54 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 55 | + private Date createDate; | ||
| 56 | + /** 修改日期 */ | ||
| 57 | + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 58 | + private Date updateDate; | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + public Long getId() { | ||
| 62 | + return id; | ||
| 63 | + } | ||
| 64 | + public void setId(Long id) { | ||
| 65 | + this.id = id; | ||
| 66 | + } | ||
| 67 | + //营运日期 | ||
| 68 | + public Date getScheduleDate() { | ||
| 69 | + return scheduleDate; | ||
| 70 | + } | ||
| 71 | + //营运日期 | ||
| 72 | + public void setScheduleDate(Date scheduleDate) { | ||
| 73 | + this.scheduleDate = scheduleDate; | ||
| 74 | + } | ||
| 75 | + //营运日期字符串(yyyy-MM-dd) | ||
| 76 | + public String getScheduleDateStr() { | ||
| 77 | + return scheduleDateStr; | ||
| 78 | + } | ||
| 79 | + //营运日期字符串(yyyy-MM-dd) | ||
| 80 | + public void setScheduleDateStr(String scheduleDateStr) { | ||
| 81 | + this.scheduleDateStr = scheduleDateStr; | ||
| 82 | + } | ||
| 83 | + //公司编码 | ||
| 84 | + public String getGsBm() { | ||
| 85 | + return gsBm; | ||
| 86 | + } | ||
| 87 | + //公司编码 | ||
| 88 | + public void setGsBm(String gsBm) { | ||
| 89 | + this.gsBm = gsBm; | ||
| 90 | + } | ||
| 91 | + //公司名称 | ||
| 92 | + public String getGsName() { | ||
| 93 | + return gsName; | ||
| 94 | + } | ||
| 95 | + //公司名称 | ||
| 96 | + public void setGsName(String gsName) { | ||
| 97 | + this.gsName = gsName; | ||
| 98 | + } | ||
| 99 | + //分公司编码 | ||
| 100 | + public String getFgsBm() { | ||
| 101 | + return fgsBm; | ||
| 102 | + } | ||
| 103 | + //分公司编码 | ||
| 104 | + public void setFgsBm(String fgsBm) { | ||
| 105 | + this.fgsBm = fgsBm; | ||
| 106 | + } | ||
| 107 | + //分公司名称 | ||
| 108 | + public String getFgsName() { | ||
| 109 | + return fgsName; | ||
| 110 | + } | ||
| 111 | + //分公司名称 | ||
| 112 | + public void setFgsName(String fgsName) { | ||
| 113 | + this.fgsName = fgsName; | ||
| 114 | + } | ||
| 115 | + //线路编码 | ||
| 116 | + public String getXlBm() { | ||
| 117 | + return xlBm; | ||
| 118 | + } | ||
| 119 | + //线路编码 | ||
| 120 | + public void setXlBm(String xlBm) { | ||
| 121 | + this.xlBm = xlBm; | ||
| 122 | + } | ||
| 123 | + //线路名 | ||
| 124 | + public String getXlName() { | ||
| 125 | + return xlName; | ||
| 126 | + } | ||
| 127 | + //线路名 | ||
| 128 | + public void setXlName(String xlName) { | ||
| 129 | + this.xlName = xlName; | ||
| 130 | + } | ||
| 131 | + //是否营运 | ||
| 132 | + public boolean getSfyy() { | ||
| 133 | + return sfyy; | ||
| 134 | + } | ||
| 135 | + //是否营运 | ||
| 136 | + public void setSfyy(boolean sfyy) { | ||
| 137 | + this.sfyy = sfyy; | ||
| 138 | + } | ||
| 139 | + //总人次 | ||
| 140 | + public Long getNum() { | ||
| 141 | + return num; | ||
| 142 | + } | ||
| 143 | + //总人次 | ||
| 144 | + public void setNum(Long num) { | ||
| 145 | + this.num = num; | ||
| 146 | + } | ||
| 147 | + //总营收(单位:分) | ||
| 148 | + public Double getAmount() { | ||
| 149 | + return amount; | ||
| 150 | + } | ||
| 151 | + //总营收(单位:分) | ||
| 152 | + public void setAmount(Double amount) { | ||
| 153 | + this.amount = amount; | ||
| 154 | + } | ||
| 155 | + public SysUser getCreateBy() { | ||
| 156 | + return createBy; | ||
| 157 | + } | ||
| 158 | + public void setCreateBy(SysUser createBy) { | ||
| 159 | + this.createBy = createBy; | ||
| 160 | + } | ||
| 161 | + public SysUser getUpdateBy() { | ||
| 162 | + return updateBy; | ||
| 163 | + } | ||
| 164 | + public void setUpdateBy(SysUser updateBy) { | ||
| 165 | + this.updateBy = updateBy; | ||
| 166 | + } | ||
| 167 | + public Date getCreateDate() { | ||
| 168 | + return createDate; | ||
| 169 | + } | ||
| 170 | + public void setCreateDate(Date createDate) { | ||
| 171 | + this.createDate = createDate; | ||
| 172 | + } | ||
| 173 | + public Date getUpdateDate() { | ||
| 174 | + return updateDate; | ||
| 175 | + } | ||
| 176 | + public void setUpdateDate(Date updateDate) { | ||
| 177 | + this.updateDate = updateDate; | ||
| 178 | + } | ||
| 179 | + @Override | ||
| 180 | + public String toString() { | ||
| 181 | + return "Revenue [id=" + id + ", scheduleDate=" + scheduleDate + ", scheduleDateStr=" + scheduleDateStr | ||
| 182 | + + ", gsBm=" + gsBm + ", gsName=" + gsName + ", fgsBm=" + fgsBm + ", fgsName=" + fgsName + ", xlBm=" | ||
| 183 | + + xlBm + ", xlName=" + xlName + ", sfyy=" + sfyy + ", num=" + num + ", amount=" + amount + ", createBy=" | ||
| 184 | + + createBy + ", updateBy=" + updateBy + ", createDate=" + createDate + ", updateDate=" + updateDate | ||
| 185 | + + "]"; | ||
| 186 | + } | ||
| 187 | +} |
src/main/java/com/bsth/repository/form/BudgetRepository.java
0 → 100644
| 1 | +package com.bsth.repository.form; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.forms.Budget; | ||
| 4 | +import com.bsth.repository.BaseRepository; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +import javax.transaction.Transactional; | ||
| 9 | + | ||
| 10 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 11 | +import org.springframework.data.jpa.repository.Query; | ||
| 12 | +import org.springframework.stereotype.Repository; | ||
| 13 | + | ||
| 14 | +@Repository | ||
| 15 | +public interface BudgetRepository extends BaseRepository<Budget, Integer>{ | ||
| 16 | + | ||
| 17 | + @Query(value="SELECT b FROM Budget b where b.year = ?1 ") | ||
| 18 | + List<Budget> findByYear(String year); | ||
| 19 | + | ||
| 20 | + @Query(value="SELECT b FROM Budget b where b.year = ?1 and b.gsBm = ?2 and b.xlBm = ?3 ") | ||
| 21 | + List<Budget> import_queryBySame(String year, String gsbm, String xlBm); | ||
| 22 | + | ||
| 23 | + @Modifying | ||
| 24 | + @Transactional | ||
| 25 | + @Query(value = "update Budget b set b.budgetMileage=?1,b.changeMileage=?2,b.formalMileage=?3," | ||
| 26 | + + "b.budgetPerson=?4,b.changePerson=?5,b.formalPerson=?6," | ||
| 27 | + + "b.budgetAmounts=?7,b.changeAmounts=?8,b.formalAmounts=?9 where b.id=?10 ") | ||
| 28 | + Integer update(Double budgetMileage, Double changeMileage, Double formalMileage, | ||
| 29 | + Long budgetPerson, Long changePerson, Long formalPerson, | ||
| 30 | + Double budgetAmounts, Double changeAmounts, Double formalAmounts, Long id); | ||
| 31 | +} |
src/main/java/com/bsth/repository/form/RevenueRepository.java
0 → 100644
| 1 | +package com.bsth.repository.form; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.forms.Revenue; | ||
| 4 | +import com.bsth.repository.BaseRepository; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 7 | +import java.util.Map; | ||
| 8 | + | ||
| 9 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 10 | +import org.springframework.data.jpa.repository.Query; | ||
| 11 | +import org.springframework.stereotype.Repository; | ||
| 12 | +import org.springframework.transaction.annotation.Transactional; | ||
| 13 | + | ||
| 14 | +@Repository | ||
| 15 | +public interface RevenueRepository extends BaseRepository<Revenue, Integer>{ | ||
| 16 | + | ||
| 17 | + @Query(value="select d.ticket_line_name, d.local_line_name from " | ||
| 18 | + + " bsth_t_revenue_diction d ",nativeQuery=true) | ||
| 19 | + List<Map<String, String>> findRevenueDictionAll(); | ||
| 20 | + | ||
| 21 | + @Query(value="select r from " | ||
| 22 | + + " Revenue r where r.scheduleDateStr between ?1 and ?2 order by xlName ") | ||
| 23 | + List<Revenue> findByDates(String date, String date2); | ||
| 24 | + | ||
| 25 | + @Transactional | ||
| 26 | + @Modifying | ||
| 27 | + @Query(value="delete Revenue r where r.scheduleDateStr = ?1 ") | ||
| 28 | + void deleteByScheduleDate(String date); | ||
| 29 | +} |
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
| @@ -2200,8 +2200,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -2200,8 +2200,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 2200 | if(cwNext.getCl() != null) | 2200 | if(cwNext.getCl() != null) |
| 2201 | keyNext += cwNext.getCl(); | 2201 | keyNext += cwNext.getCl(); |
| 2202 | } | 2202 | } |
| 2203 | - key = cw.getFgsdm()+"/"+cw.getXl() + "/" + key; | ||
| 2204 | - keyNext = cw.getFgsdm()+"/"+cwNext.getXl() + "/" + keyNext; | 2203 | + key = cw.getGsdm()+"/"+cw.getFgsdm()+"/"+cw.getXl() + "/" + key; |
| 2204 | + keyNext = cwNext.getGsdm()+"/"+cwNext.getFgsdm()+"/"+cwNext.getXl() + "/" + keyNext; | ||
| 2205 | CalcWaybillDetail calc = new CalcWaybillDetail(); | 2205 | CalcWaybillDetail calc = new CalcWaybillDetail(); |
| 2206 | List<CalcWaybillDetail> calcList = new ArrayList<>(); | 2206 | List<CalcWaybillDetail> calcList = new ArrayList<>(); |
| 2207 | // 是否一行数据的第一个、生成key,calc为刚添加,不去和cw相加 | 2207 | // 是否一行数据的第一个、生成key,calc为刚添加,不去和cw相加 |
| @@ -2242,7 +2242,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -2242,7 +2242,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 2242 | this.summation(zjCalc, cw); | 2242 | this.summation(zjCalc, cw); |
| 2243 | 2243 | ||
| 2244 | 2244 | ||
| 2245 | - if(dayIndexPrev == dayIndex){ | 2245 | + if(dayIndexPrev == dayIndex && calcList.size() > dayIndex){ |
| 2246 | CalcWaybillDetail cwPrev = calcList.get(dayIndex); | 2246 | CalcWaybillDetail cwPrev = calcList.get(dayIndex); |
| 2247 | this.summation(cwPrev, cw); | 2247 | this.summation(cwPrev, cw); |
| 2248 | } else { | 2248 | } else { |
src/main/java/com/bsth/service/forms/BudgetService.java
0 → 100644
| 1 | +package com.bsth.service.forms; | ||
| 2 | + | ||
| 3 | +import java.io.File; | ||
| 4 | +import java.util.List; | ||
| 5 | +import java.util.Map; | ||
| 6 | + | ||
| 7 | +import com.bsth.entity.forms.Budget; | ||
| 8 | +import com.bsth.service.BaseService; | ||
| 9 | + | ||
| 10 | +public interface BudgetService extends BaseService<Budget, Integer> { | ||
| 11 | + | ||
| 12 | + public String importExcel(File file); | ||
| 13 | + | ||
| 14 | + public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception; | ||
| 15 | + | ||
| 16 | + public Map<String, Object> updateRevenue(String date) throws Exception; | ||
| 17 | + | ||
| 18 | + public List<Map<String, Object>> budgetMileage(String year, String type); | ||
| 19 | + | ||
| 20 | + public List<Map<String, Object>> budgetPerson(String year, String type); | ||
| 21 | + | ||
| 22 | + public List<Map<String, Object>> budgetAmounts(String year, String type); | ||
| 23 | + | ||
| 24 | + public List<Map<String, Object>> budgetSum(String year, String type); | ||
| 25 | +} |
src/main/java/com/bsth/service/forms/impl/BudgetServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.forms.impl; | ||
| 2 | + | ||
| 3 | +import java.io.File; | ||
| 4 | +import java.io.FileInputStream; | ||
| 5 | +import java.math.BigDecimal; | ||
| 6 | +import java.text.DecimalFormat; | ||
| 7 | +import java.text.ParseException; | ||
| 8 | +import java.text.SimpleDateFormat; | ||
| 9 | +import java.util.ArrayList; | ||
| 10 | +import java.util.Date; | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.HashSet; | ||
| 13 | +import java.util.Iterator; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Map; | ||
| 16 | +import java.util.Set; | ||
| 17 | + | ||
| 18 | +import javax.transaction.Transactional; | ||
| 19 | + | ||
| 20 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 21 | +import org.apache.poi.hssf.usermodel.HSSFCell; | ||
| 22 | +import org.apache.poi.hssf.usermodel.HSSFRow; | ||
| 23 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | ||
| 24 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
| 25 | +import org.apache.poi.poifs.filesystem.POIFSFileSystem; | ||
| 26 | +import org.slf4j.Logger; | ||
| 27 | +import org.slf4j.LoggerFactory; | ||
| 28 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 29 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 30 | +import org.springframework.stereotype.Service; | ||
| 31 | + | ||
| 32 | +import com.alibaba.fastjson.JSONArray; | ||
| 33 | +import com.alibaba.fastjson.JSONObject; | ||
| 34 | +import com.bsth.common.ResponseCode; | ||
| 35 | +import com.bsth.data.BasicData; | ||
| 36 | +import com.bsth.entity.Line; | ||
| 37 | +import com.bsth.entity.calc.CalcStatistics; | ||
| 38 | +import com.bsth.entity.forms.Budget; | ||
| 39 | +import com.bsth.entity.forms.Revenue; | ||
| 40 | +import com.bsth.repository.calc.CalcStatisticsRepository; | ||
| 41 | +import com.bsth.repository.form.BudgetRepository; | ||
| 42 | +import com.bsth.repository.form.RevenueRepository; | ||
| 43 | +import com.bsth.service.LineService; | ||
| 44 | +import com.bsth.service.forms.BudgetService; | ||
| 45 | +import com.bsth.service.impl.BaseServiceImpl; | ||
| 46 | +import com.bsth.util.ReportUtils; | ||
| 47 | + | ||
| 48 | +@Service | ||
| 49 | +public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implements BudgetService{ | ||
| 50 | + | ||
| 51 | + @Autowired | ||
| 52 | + private BudgetRepository repository; | ||
| 53 | + | ||
| 54 | + @Autowired | ||
| 55 | + private RevenueRepository revenueRepository; | ||
| 56 | + | ||
| 57 | + @Autowired | ||
| 58 | + private LineService lineService; | ||
| 59 | + | ||
| 60 | + @Autowired | ||
| 61 | + private CalcStatisticsRepository calcStatisticsRepository; | ||
| 62 | + | ||
| 63 | + @Autowired | ||
| 64 | + JdbcTemplate jdbcTemplate; | ||
| 65 | + | ||
| 66 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public String importExcel(File file) { | ||
| 70 | + SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); | ||
| 71 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 72 | + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 73 | + DecimalFormat df = new DecimalFormat("######0.00"); | ||
| 74 | + List<String> textList = new ArrayList<String>(); | ||
| 75 | + List<Budget> list = new ArrayList<Budget>(); | ||
| 76 | + String msg = "", tempMsg = ""; | ||
| 77 | + try { | ||
| 78 | + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); | ||
| 79 | + HSSFWorkbook wb = new HSSFWorkbook(fs); | ||
| 80 | + HSSFSheet sheet = wb.getSheetAt(0); | ||
| 81 | + // 取得总行数 | ||
| 82 | + int rowNum = sheet.getLastRowNum() + 1; | ||
| 83 | + // 取得总列数 | ||
| 84 | + int cellNum = sheet.getRow(0).getLastCellNum(); | ||
| 85 | + HSSFRow row = null; | ||
| 86 | + HSSFCell cell = null; | ||
| 87 | + for(int i = 2; i < rowNum; i++){ | ||
| 88 | + row = sheet.getRow(i); | ||
| 89 | + if (row == null){ | ||
| 90 | + continue; | ||
| 91 | + } | ||
| 92 | + String text = ""; | ||
| 93 | + for(int j = 0; j < cellNum; j++){ | ||
| 94 | + cell = row.getCell(j); | ||
| 95 | + if(cell == null){ | ||
| 96 | + text += ","; | ||
| 97 | + continue; | ||
| 98 | + } | ||
| 99 | + text += String.valueOf(cell) + ","; | ||
| 100 | + } | ||
| 101 | + String[] split = (text+";").split(","); | ||
| 102 | + String str = ""; | ||
| 103 | + for(int j = 0; j < split.length && j < 5; j++){ | ||
| 104 | + str += split[j]; | ||
| 105 | + } | ||
| 106 | + if(str.trim().length() == 0){ | ||
| 107 | + continue; | ||
| 108 | + } | ||
| 109 | + textList.add(i + "," + text + ";"); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + Map<String, Line> lineMap = new HashMap<String, Line>(); | ||
| 113 | + Iterable<Line> findAllLine = lineService.findAll(); | ||
| 114 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 115 | + for(Line l : findAllLine){ | ||
| 116 | + if(BasicData.businessCodeNameMap.containsKey(l.getCompany())){ | ||
| 117 | +// String gsName = BasicData.businessCodeNameMap.get(l.getCompany()); | ||
| 118 | +// gsName = gsName.replaceAll("公司", ""); | ||
| 119 | +// lineMap.put(gsName + "_" + l.getName(), l); | ||
| 120 | + lineMap.put(l.getName(), l); | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + for(int i = 0; i < textList.size(); i++){ | ||
| 125 | + String text = textList.get(i); | ||
| 126 | +// System.out.println(text); | ||
| 127 | + String[] split = text.split(","); | ||
| 128 | + int rowNo = Integer.valueOf(split[0].trim()); | ||
| 129 | + String year = split[1].trim(); | ||
| 130 | + String gsName = split[2].trim().replaceAll("公司", ""); | ||
| 131 | + String xlName = split[3].trim(); | ||
| 132 | + Date yyyy = null; | ||
| 133 | + Line line = null; | ||
| 134 | + String gsBm = ""; | ||
| 135 | + for(String key : BasicData.businessCodeNameMap.keySet()){ | ||
| 136 | + String name = BasicData.businessCodeNameMap.get(key).replaceAll("公司", ""); | ||
| 137 | + if(name.equals(gsName)){ | ||
| 138 | + gsBm = key; | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + boolean sfyy = false; | ||
| 142 | + Double formalMileage = null, formalAmounts = null; | ||
| 143 | + Long formalPerson = null; | ||
| 144 | + if(year.length() == 0){ | ||
| 145 | + msg += "第"+(rowNo+1)+"行,没有年份;\\n"; | ||
| 146 | + } else { | ||
| 147 | + try { | ||
| 148 | + yyyy = yearFormat.parse(year); | ||
| 149 | + } catch (ParseException pe) { | ||
| 150 | + // TODO: handle exception | ||
| 151 | + pe.printStackTrace(); | ||
| 152 | + msg += "第"+(rowNo+1)+"行,年份书写错误;\\n"; | ||
| 153 | + } | ||
| 154 | + } | ||
| 155 | + if(xlName.length() == 0){ | ||
| 156 | + msg += "第"+(rowNo+1)+"行,没有线路名;\\n"; | ||
| 157 | + } else { | ||
| 158 | + if(lineMap.containsKey(xlName)){ | ||
| 159 | + line = lineMap.get(xlName); | ||
| 160 | + sfyy = lineNature.containsKey(line.getLineCode())?lineNature.get(line.getLineCode()):false; | ||
| 161 | + } else { | ||
| 162 | + msg += "第"+(rowNo+1)+"行,线路基础信息无此线路;\\n"; | ||
| 163 | + } | ||
| 164 | + } | ||
| 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); | ||
| 177 | + } | ||
| 178 | + } catch (NumberFormatException nfe) { | ||
| 179 | + // TODO: handle exception | ||
| 180 | + nfe.printStackTrace(); | ||
| 181 | + msg += "第"+(rowNo+1)+"行,数字格式异常;\\n"; | ||
| 182 | + } | ||
| 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 | + } | ||
| 196 | + | ||
| 197 | + List<Budget> insertList = new ArrayList<Budget>(); | ||
| 198 | + if(msg.length() == 0){ | ||
| 199 | + for(Budget b : list){ | ||
| 200 | + List<Budget> budgets = repository.import_queryBySame(b.getYear(), b.getGsBm(), b.getXlBm()); | ||
| 201 | + if(budgets.size() > 0) { | ||
| 202 | + Budget bud = budgets.get(0); | ||
| 203 | + if(b.getFormalMileage() != null){ | ||
| 204 | + if(bud.getBudgetMileage() != null){ | ||
| 205 | + bud.setChangeMileage(b.getFormalMileage()); | ||
| 206 | + } else { | ||
| 207 | + bud.setBudgetMileage(b.getFormalMileage()); | ||
| 208 | + } | ||
| 209 | + bud.setFormalMileage(b.getFormalMileage()); | ||
| 210 | + } | ||
| 211 | + if(b.getFormalPerson() != null){ | ||
| 212 | + if(bud.getBudgetPerson() != null){ | ||
| 213 | + bud.setChangePerson(b.getFormalPerson()); | ||
| 214 | + } else { | ||
| 215 | + bud.setBudgetPerson(b.getFormalPerson()); | ||
| 216 | + } | ||
| 217 | + bud.setFormalPerson(b.getFormalPerson()); | ||
| 218 | + } | ||
| 219 | + if(b.getFormalAmounts() != null){ | ||
| 220 | + if(bud.getBudgetAmounts() != null){ | ||
| 221 | + bud.setChangeAmounts(b.getFormalAmounts()); | ||
| 222 | + } else { | ||
| 223 | + bud.setBudgetAmounts(b.getFormalAmounts()); | ||
| 224 | + } | ||
| 225 | + bud.setFormalAmounts(b.getFormalAmounts()); | ||
| 226 | + } | ||
| 227 | + repository.update(bud.getBudgetMileage(), bud.getChangeMileage(), bud.getFormalMileage(), | ||
| 228 | + bud.getBudgetPerson(), bud.getChangePerson(), bud.getFormalPerson(), | ||
| 229 | + bud.getBudgetAmounts(), bud.getChangeAmounts(), bud.getFormalAmounts(), bud.getId()); | ||
| 230 | + } else { | ||
| 231 | + b.setBudgetMileage(b.getFormalMileage()); | ||
| 232 | + b.setBudgetPerson(b.getFormalPerson()); | ||
| 233 | + b.setBudgetAmounts(b.getFormalAmounts()); | ||
| 234 | + insertList.add(b); | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + repository.saveAll(insertList); | ||
| 238 | + | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + wb.close(); | ||
| 242 | + fs.close(); | ||
| 243 | + }catch (Exception e) { | ||
| 244 | + // TODO Auto-generated catch block | ||
| 245 | + e.printStackTrace(); | ||
| 246 | + return msg.length()>0?msg:"文件导入失败"; | ||
| 247 | + } finally { | ||
| 248 | + file.delete(); | ||
| 249 | + } | ||
| 250 | + return msg.length()>0?msg:"文件导入成功"; | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + @Transactional | ||
| 254 | + @Override | ||
| 255 | + public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception{ | ||
| 256 | + // TODO Auto-generated method stub | ||
| 257 | + Map<String, Object> maps = new HashMap<>(); | ||
| 258 | + try{ | ||
| 259 | + String json =StringEscapeUtils.unescapeHtml4(map.get("ids").toString()); | ||
| 260 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 261 | + JSONObject jsonObject; | ||
| 262 | + for (int x = 0; x < jsonArray.size(); x++) { | ||
| 263 | + jsonObject=jsonArray.getJSONObject(x); | ||
| 264 | + Long id = jsonObject.getLong("id"); | ||
| 265 | + Budget b = new Budget(); | ||
| 266 | + b.setId(id); | ||
| 267 | + repository.delete(b); | ||
| 268 | +// repository.deleteById(id); | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | +// SysUser user = SecurityUtils.getCurrentUser(); | ||
| 272 | + maps.put("status", ResponseCode.SUCCESS); | ||
| 273 | + } catch (Exception e) { | ||
| 274 | + maps.put("status", ResponseCode.ERROR); | ||
| 275 | + logger.error("save erro.", e); | ||
| 276 | + throw e; | ||
| 277 | + } | ||
| 278 | + return maps; | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + @Override | ||
| 282 | + public Map<String, Object> updateRevenue(String date) throws Exception { | ||
| 283 | + // TODO Auto-generated method stub | ||
| 284 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 285 | + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd"); | ||
| 286 | + Map<String, Object> resMap=new HashMap<String, Object>(); | ||
| 287 | + Set<String> strSet = new HashSet<String>(); // 去重 | ||
| 288 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 289 | + Map<String, Map<String, Line>> lineMap = new HashMap<String, Map<String, Line>>(); | ||
| 290 | + Map<String, Line> lineAllMap = new HashMap<String, Line>(); | ||
| 291 | + Iterable<Line> findAllLine = lineService.findAll(); | ||
| 292 | + for(Line l : findAllLine){ | ||
| 293 | + if(!(lineMap.containsKey(l.getCompany()))){ | ||
| 294 | + lineMap.put(l.getCompany(), new HashMap<String, Line>()); | ||
| 295 | + } | ||
| 296 | + lineMap.get(l.getCompany()).put(l.getName(), l); | ||
| 297 | + lineAllMap.put(l.getName(), l); | ||
| 298 | + } | ||
| 299 | + Map<String, String> dictionMap = new HashMap<String, String>(); | ||
| 300 | + List<Map<String, String>> revenueDiction = revenueRepository.findRevenueDictionAll(); | ||
| 301 | + for(Map<String, String> m : revenueDiction){ | ||
| 302 | + dictionMap.put(m.get("ticket_line_name").toString(), m.get("local_line_name").toString()); | ||
| 303 | + } | ||
| 304 | + List<Revenue> list = new ArrayList<Revenue>(); | ||
| 305 | + Date parse = sdf.parse(date); | ||
| 306 | + String ymd = sdf2.format(parse); | ||
| 307 | + for(String gsBm : BasicData.businessCodeNameMap.keySet()){ | ||
| 308 | + List<Map<String, Object>> load = RevenueLoader.load(ymd, gsBm); | ||
| 309 | + if(load != null && load.size() > 0){ | ||
| 310 | + for(Map<String, Object> m : load){ | ||
| 311 | + if(m.containsKey("lineName")){ | ||
| 312 | + String fgsBm = m.get("branchCompanyCode") != null ? m.get("branchCompanyCode").toString() : ""; | ||
| 313 | + String lineName = m.get("lineName").toString().split("空调")[0].split("电车")[0]; | ||
| 314 | + Revenue r = new Revenue(); | ||
| 315 | + if(lineMap.get(gsBm) != null && lineMap.get(gsBm).containsKey(lineName)){ | ||
| 316 | + r.setXlBm(lineMap.get(gsBm).get(lineName).getLineCode()); | ||
| 317 | + r.setXlName(lineMap.get(gsBm).get(lineName).getName()); | ||
| 318 | + }if(dictionMap.containsKey(lineName)){ | ||
| 319 | + String name = dictionMap.get(lineName); | ||
| 320 | + if(lineAllMap.containsKey(name)){ | ||
| 321 | + r.setXlBm(lineAllMap.get(name).getLineCode()); | ||
| 322 | + r.setXlName(lineAllMap.get(name).getName()); | ||
| 323 | + } | ||
| 324 | + } else { | ||
| 325 | + boolean flag = true; | ||
| 326 | + for(String key : lineAllMap.keySet()){ | ||
| 327 | + Line l = lineAllMap.get(key); | ||
| 328 | + String name = l.getName(); | ||
| 329 | + if(l.getStartStationName() != null & l.getStartStationName().length() > 0){ | ||
| 330 | + name = name.replaceAll("区间", "") + l.getStartStationName().substring(0, 1); | ||
| 331 | + } | ||
| 332 | + if(l.getName().equals(lineName) || name.equals(lineName)){ | ||
| 333 | + flag = false; | ||
| 334 | + r.setXlBm(l.getLineCode()); | ||
| 335 | + r.setXlName(l.getName()); | ||
| 336 | + break; | ||
| 337 | + } | ||
| 338 | + } | ||
| 339 | +// if(flag){ | ||
| 340 | +// System.out.println(m.get("lineName").toString() + " >> " + lineName); | ||
| 341 | +// } | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + if(r.getXlBm() != null){ | ||
| 345 | + r.setScheduleDate(parse); | ||
| 346 | + r.setScheduleDateStr(date); | ||
| 347 | + r.setGsBm(gsBm); | ||
| 348 | + r.setGsName(BasicData.businessCodeNameMap.get(gsBm)); | ||
| 349 | + r.setFgsBm(fgsBm); | ||
| 350 | + r.setFgsName(BasicData.businessFgsCodeNameMap.get(fgsBm + "_" + gsBm)); | ||
| 351 | + r.setSfyy(lineNature.containsKey(r.getXlBm())?lineNature.get(r.getXlBm()):false); | ||
| 352 | + r.setNum(Long.valueOf(m.get("num").toString().split("[.]")[0])); | ||
| 353 | + r.setAmount(Double.valueOf(m.get("amount").toString())); | ||
| 354 | + String str = r.getGsBm() + "/" + r.getFgsBm() + "/" + r.getXlBm(); | ||
| 355 | + if(strSet.add(str)){ | ||
| 356 | + list.add(r); | ||
| 357 | + } | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + } | ||
| 361 | + } | ||
| 362 | + } | ||
| 363 | + if(list.size() > 0){ | ||
| 364 | + revenueRepository.deleteByScheduleDate(date); | ||
| 365 | + revenueRepository.saveAll(list); | ||
| 366 | + } | ||
| 367 | + | ||
| 368 | + resMap.put("status", ResponseCode.SUCCESS); | ||
| 369 | + return resMap; | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + @Override | ||
| 373 | + public List<Map<String, Object>> budgetMileage(String year, String tttt) { | ||
| 374 | + // TODO Auto-generated method stub | ||
| 375 | + SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); | ||
| 376 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 377 | + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | ||
| 378 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 379 | + List<Budget> findByYear = repository.findByYear(year); | ||
| 380 | + List<CalcStatistics> list = calcStatisticsRepository.selectByDateAndLineTj3(year+"-01-01", year+"-12-31"); | ||
| 381 | + | ||
| 382 | + Map<String, Map<String, Object>> xlMap = new HashMap<String, Map<String, Object>>(); | ||
| 383 | + List<Map<String, Object>> xlList = new ArrayList<Map<String, Object>>(); | ||
| 384 | + | ||
| 385 | + String[] strs = createBudgetMap(resList, keyMap); | ||
| 386 | + | ||
| 387 | + for(Budget b : findByYear){ | ||
| 388 | + if(b.getFormalMileage()==null || b.getFormalMileage() < 0d){ | ||
| 389 | + continue; | ||
| 390 | + } | ||
| 391 | + String gsBm = b.getGsBm(); | ||
| 392 | + String xlBm = b.getXlBm(); | ||
| 393 | + String xlName = b.getXlName(); | ||
| 394 | + int sfyy = b.getSfyy()?1:0; | ||
| 395 | + int sfjc = xlName.contains("机场")?1:0; | ||
| 396 | + | ||
| 397 | + String key = gsBm + "_" + xlBm; | ||
| 398 | + if(!(xlMap.containsKey(key))){ | ||
| 399 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 400 | + m.put("gsBm", gsBm); | ||
| 401 | + m.put("gsName", b.getGsName()); | ||
| 402 | + m.put("xlBm", xlBm); | ||
| 403 | + m.put("xlName", xlName); | ||
| 404 | + m.put("sfyy", sfyy); | ||
| 405 | + m.put("sfjc", sfjc); | ||
| 406 | + m.put("budget", b.getBudgetMileage()!=null?b.getBudgetMileage():""); | ||
| 407 | + m.put("change", b.getChangeMileage()!=null?b.getChangeMileage():""); | ||
| 408 | + m.put("formal", b.getFormalMileage()!=null?b.getFormalMileage():""); | ||
| 409 | + for(int i = 1; i <= 12; i++){ | ||
| 410 | + m.put("mon"+i, ""); | ||
| 411 | + } | ||
| 412 | + m.put("monAll", "0"); | ||
| 413 | + xlMap.put(key, m); | ||
| 414 | + xlList.add(m); | ||
| 415 | + } | ||
| 416 | + } | ||
| 417 | + | ||
| 418 | + for(CalcStatistics cs : list){ | ||
| 419 | + String gsBm = cs.getGsdm(); | ||
| 420 | + String xlBm = cs.getXl(); | ||
| 421 | + String xlName = cs.getXlName(); | ||
| 422 | + int sfyy = lineNature.containsKey(xlBm)&&lineNature.get(xlBm)?1:0; | ||
| 423 | + int sfjc = xlName.contains("机场")?1:0; | ||
| 424 | + | ||
| 425 | + String key = gsBm + "_" + xlBm; | ||
| 426 | + if(!(xlMap.containsKey(key))){ | ||
| 427 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 428 | + m.put("gsBm", gsBm); | ||
| 429 | + m.put("gsName", BasicData.businessCodeNameMap.get(gsBm)); | ||
| 430 | + m.put("xlBm", xlBm); | ||
| 431 | + m.put("xlName", xlName); | ||
| 432 | + m.put("sfyy", sfyy); | ||
| 433 | + m.put("sfjc", sfjc); | ||
| 434 | + m.put("budget", ""); | ||
| 435 | + m.put("change", ""); | ||
| 436 | + m.put("formal", ""); | ||
| 437 | + for(int i = 1; i <= 12; i++){ | ||
| 438 | + m.put("mon"+i, ""); | ||
| 439 | + } | ||
| 440 | + m.put("monAll", "0"); | ||
| 441 | + xlMap.put(key, m); | ||
| 442 | + xlList.add(m); | ||
| 443 | + } | ||
| 444 | + Map<String, Object> map = xlMap.get(key); | ||
| 445 | + String mon = "mon" + Integer.valueOf(sdfMM.format(cs.getDate())); | ||
| 446 | + String val = map.get(mon).toString(); | ||
| 447 | + BigDecimal sjzlc = new BigDecimal(cs.getSjzlc().toString()); | ||
| 448 | + if(val.length() == 0){ | ||
| 449 | + map.put(mon, sjzlc.doubleValue()); | ||
| 450 | + } else { | ||
| 451 | + map.put(mon, new BigDecimal(val).add(sjzlc).doubleValue()); | ||
| 452 | + } | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + for(Map<String, Object> m : xlList){ | ||
| 456 | + BigDecimal monAll = new BigDecimal("0"); | ||
| 457 | + for(int i = 1; i <= 12; i++){ | ||
| 458 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 459 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 460 | + monAll = monAll.add(val); | ||
| 461 | + } | ||
| 462 | + } | ||
| 463 | + m.put("monAll", monAll.doubleValue()); | ||
| 464 | + | ||
| 465 | + String gsBm = m.get("gsBm").toString(); | ||
| 466 | + int type = Integer.valueOf(m.get("sfyy").toString()); | ||
| 467 | + int item = Integer.valueOf(m.get("sfjc").toString()) == 1 ? 0 : 1; | ||
| 468 | + List<String> strList = new ArrayList<String>(); | ||
| 469 | + if(1 == type){ | ||
| 470 | + strList.add(gsBm + "_" + type + "_" + item); | ||
| 471 | + strList.add(gsBm + "_" + type + "_all"); | ||
| 472 | + } else { | ||
| 473 | + strList.add(gsBm + "_" + type); | ||
| 474 | + } | ||
| 475 | + strList.add(gsBm + "_all"); | ||
| 476 | + | ||
| 477 | + for(String str : strList){ | ||
| 478 | + Map<String, Object> map = keyMap.get(str); | ||
| 479 | + if(m.get("budget").toString().length() > 0){ | ||
| 480 | + if(map.get("budget").toString().length() > 0){ | ||
| 481 | + map.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 482 | + new BigDecimal(map.get("budget").toString())).doubleValue()); | ||
| 483 | + } else { | ||
| 484 | + map.put("budget", new BigDecimal(m.get("budget").toString()).doubleValue()); | ||
| 485 | + } | ||
| 486 | + } | ||
| 487 | + if(m.get("change").toString().length() > 0){ | ||
| 488 | + if(map.get("change").toString().length() > 0){ | ||
| 489 | + map.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 490 | + new BigDecimal(map.get("change").toString())).doubleValue()); | ||
| 491 | + } else { | ||
| 492 | + map.put("change", new BigDecimal(m.get("change").toString()).doubleValue()); | ||
| 493 | + } | ||
| 494 | + } | ||
| 495 | + if(m.get("formal").toString().length() > 0){ | ||
| 496 | + if(map.get("formal").toString().length() > 0){ | ||
| 497 | + map.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 498 | + new BigDecimal(map.get("formal").toString())).doubleValue()); | ||
| 499 | + } else { | ||
| 500 | + map.put("formal", new BigDecimal(m.get("formal").toString()).doubleValue()); | ||
| 501 | + } | ||
| 502 | + } | ||
| 503 | + for(int i = 1; i <= 12; i++){ | ||
| 504 | + String mon = "mon"+i; | ||
| 505 | + if(m.get(mon).toString().length() > 0){ | ||
| 506 | + if(map.get(mon).toString().length() > 0){ | ||
| 507 | + map.put(mon, new BigDecimal(m.get(mon).toString()).add( | ||
| 508 | + new BigDecimal(map.get(mon).toString())).doubleValue()); | ||
| 509 | + } else { | ||
| 510 | + map.put(mon, new BigDecimal(m.get(mon).toString()).doubleValue()); | ||
| 511 | + } | ||
| 512 | + } | ||
| 513 | + } | ||
| 514 | + List<Map<String, Object>>dataList = (List<Map<String, Object>>)map.get("dataList"); | ||
| 515 | + dataList.add(m); | ||
| 516 | + } | ||
| 517 | + | ||
| 518 | + for(int i = 1; i <= 12; i++){ | ||
| 519 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 520 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 521 | + val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 522 | + m.put("mon"+i, val.doubleValue()); | ||
| 523 | + } | ||
| 524 | + } | ||
| 525 | + monAll = monAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 526 | + m.put("monAll", monAll.doubleValue()); | ||
| 527 | + | ||
| 528 | + if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 529 | + && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 530 | + BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 531 | + m.put("complete", monAll.divide( | ||
| 532 | + formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 533 | + new BigDecimal(100)).divide( | ||
| 534 | + new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 535 | + BigDecimal diff = monAll.subtract(formal); | ||
| 536 | + m.put("diff", diff.doubleValue() > 0 ? "+" + diff.toString() : diff.toString()); | ||
| 537 | + } else { | ||
| 538 | + m.put("complete", ""); | ||
| 539 | + m.put("diff", ""); | ||
| 540 | + } | ||
| 541 | + } | ||
| 542 | + | ||
| 543 | + for(String key : strs){ | ||
| 544 | + if(!(key.contains("all_"))){ | ||
| 545 | + String[] sp = key.split("_"); | ||
| 546 | + String allKey = "all"; | ||
| 547 | + for(int i = 1; i < sp.length; i++){ | ||
| 548 | + allKey += "_" + sp[i]; | ||
| 549 | + } | ||
| 550 | + Map<String, Object> map = keyMap.get(key); | ||
| 551 | + Map<String, Object> allMap = keyMap.get(allKey); | ||
| 552 | + for(String k : map.keySet()){ | ||
| 553 | + if("year".equals(k)){ // 不想被计算的数字型字段 | ||
| 554 | + continue; | ||
| 555 | + } | ||
| 556 | + try { | ||
| 557 | + allMap.put(k, new BigDecimal(map.get(k).toString()).add( | ||
| 558 | + new BigDecimal(allMap.get(k).toString())).doubleValue()); | ||
| 559 | + } catch (Exception e) { | ||
| 560 | + // TODO: handle exception | ||
| 561 | + } | ||
| 562 | + } | ||
| 563 | + List<Map<String, Object>> dataList = (List<Map<String, Object>>)allMap.get("dataList"); | ||
| 564 | + dataList.addAll((List<Map<String, Object>>)map.get("dataList")); | ||
| 565 | + allMap.put("dataList", dataList); | ||
| 566 | + } | ||
| 567 | + } | ||
| 568 | + | ||
| 569 | + for(String key : strs){ | ||
| 570 | + Map<String, Object> m = keyMap.get(key); | ||
| 571 | + BigDecimal monAll = new BigDecimal("0"); | ||
| 572 | + for(int i = 1; i <= 12; i++){ | ||
| 573 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 574 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 575 | + monAll = monAll.add(val); | ||
| 576 | + val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 577 | + m.put("mon"+i, val.doubleValue()); | ||
| 578 | + } | ||
| 579 | + } | ||
| 580 | + monAll = monAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 581 | + m.put("monAll", monAll.doubleValue()); | ||
| 582 | + | ||
| 583 | + if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 584 | + && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 585 | + BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 586 | + m.put("complete", monAll.divide( | ||
| 587 | + formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 588 | + new BigDecimal(100)).divide( | ||
| 589 | + new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 590 | + BigDecimal diff = monAll.subtract(formal); | ||
| 591 | + m.put("diff", diff.doubleValue() > 0 ? "+" + diff.toString() : diff.toString()); | ||
| 592 | + } else { | ||
| 593 | + m.put("complete", ""); | ||
| 594 | + m.put("diff", ""); | ||
| 595 | + } | ||
| 596 | + m.put("year", year); | ||
| 597 | + } | ||
| 598 | + | ||
| 599 | + if(tttt.equals("export")){ | ||
| 600 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 601 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 602 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 603 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 604 | + String xls="budgetMileage.xls"; | ||
| 605 | + ReportUtils ee = new ReportUtils(); | ||
| 606 | + try { | ||
| 607 | + String dateTime = ""; | ||
| 608 | + m.put("date", year); | ||
| 609 | + dateTime = year; | ||
| 610 | + listI.add(resList.iterator()); | ||
| 611 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 612 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls, | ||
| 613 | + path + "export/"+dateTime+"-预算公里明细表.xls"); | ||
| 614 | + } catch (Exception e) { | ||
| 615 | + // TODO: handle exception | ||
| 616 | + e.printStackTrace(); | ||
| 617 | + } | ||
| 618 | + } | ||
| 619 | + | ||
| 620 | + return resList; | ||
| 621 | + } | ||
| 622 | + | ||
| 623 | + @Override | ||
| 624 | + public List<Map<String, Object>> budgetPerson(String year, String tttt) { | ||
| 625 | + // TODO Auto-generated method stub | ||
| 626 | + SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); | ||
| 627 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 628 | + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | ||
| 629 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 630 | + List<Budget> findByYear = repository.findByYear(year); | ||
| 631 | + List<Revenue> list = revenueRepository.findByDates(year+"-01-01", year+"-12-31"); | ||
| 632 | + | ||
| 633 | + Map<String, Map<String, Object>> xlMap = new HashMap<String, Map<String, Object>>(); | ||
| 634 | + List<Map<String, Object>> xlList = new ArrayList<Map<String, Object>>(); | ||
| 635 | + | ||
| 636 | + String[] strs = createBudgetMap(resList, keyMap); | ||
| 637 | + | ||
| 638 | + for(Budget b : findByYear){ | ||
| 639 | + if(b.getFormalPerson()==null || b.getFormalPerson() < 0d){ | ||
| 640 | + continue; | ||
| 641 | + } | ||
| 642 | + String gsBm = b.getGsBm(); | ||
| 643 | + String xlBm = b.getXlBm(); | ||
| 644 | + String xlName = b.getXlName(); | ||
| 645 | + int sfyy = b.getSfyy()?1:0; | ||
| 646 | + int sfjc = xlName.contains("机场")?1:0; | ||
| 647 | + | ||
| 648 | + String key = gsBm + "_" + xlBm; | ||
| 649 | + if(!(xlMap.containsKey(key))){ | ||
| 650 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 651 | + m.put("gsBm", gsBm); | ||
| 652 | + m.put("gsName", b.getGsName()); | ||
| 653 | + m.put("xlBm", xlBm); | ||
| 654 | + m.put("xlName", xlName); | ||
| 655 | + m.put("sfyy", sfyy); | ||
| 656 | + m.put("sfjc", sfjc); | ||
| 657 | + m.put("budget", b.getBudgetPerson()!=null?b.getBudgetPerson():""); | ||
| 658 | + m.put("change", b.getChangePerson()!=null?b.getChangePerson():""); | ||
| 659 | + m.put("formal", b.getFormalPerson()!=null?b.getFormalPerson():""); | ||
| 660 | + for(int i = 1; i <= 12; i++){ | ||
| 661 | + m.put("mon"+i, ""); | ||
| 662 | + } | ||
| 663 | + m.put("monAll", "0"); | ||
| 664 | + xlMap.put(key, m); | ||
| 665 | + xlList.add(m); | ||
| 666 | + } | ||
| 667 | + } | ||
| 668 | + | ||
| 669 | + for(Revenue cs : list){ | ||
| 670 | + String gsBm = cs.getGsBm(); | ||
| 671 | + String xlBm = cs.getXlBm(); | ||
| 672 | + String xlName = cs.getXlName(); | ||
| 673 | + int sfyy = lineNature.containsKey(xlBm)&&lineNature.get(xlBm)?1:0; | ||
| 674 | + int sfjc = xlName.contains("机场")?1:0; | ||
| 675 | + | ||
| 676 | + String key = gsBm + "_" + xlBm; | ||
| 677 | + if(!(xlMap.containsKey(key))){ | ||
| 678 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 679 | + m.put("gsBm", gsBm); | ||
| 680 | + m.put("gsName", BasicData.businessCodeNameMap.get(gsBm)); | ||
| 681 | + m.put("xlBm", xlBm); | ||
| 682 | + m.put("xlName", xlName); | ||
| 683 | + m.put("sfyy", sfyy); | ||
| 684 | + m.put("sfjc", sfjc); | ||
| 685 | + m.put("budget", ""); | ||
| 686 | + m.put("change", ""); | ||
| 687 | + m.put("formal", ""); | ||
| 688 | + for(int i = 1; i <= 12; i++){ | ||
| 689 | + m.put("mon"+i, ""); | ||
| 690 | + } | ||
| 691 | + m.put("monAll", "0"); | ||
| 692 | + xlMap.put(key, m); | ||
| 693 | + xlList.add(m); | ||
| 694 | + } | ||
| 695 | + Map<String, Object> map = xlMap.get(key); | ||
| 696 | + String mon = "mon" + Integer.valueOf(sdfMM.format(cs.getScheduleDate())); | ||
| 697 | + String val = map.get(mon).toString(); | ||
| 698 | + BigDecimal num = new BigDecimal(cs.getNum().toString()); | ||
| 699 | + if(val.length() == 0){ | ||
| 700 | + map.put(mon, num.doubleValue()); | ||
| 701 | + } else { | ||
| 702 | + map.put(mon, new BigDecimal(val).add(num).doubleValue()); | ||
| 703 | + } | ||
| 704 | + } | ||
| 705 | + | ||
| 706 | + for(Map<String, Object> m : xlList){ | ||
| 707 | + BigDecimal monAll = new BigDecimal("0"); | ||
| 708 | + for(int i = 1; i <= 12; i++){ | ||
| 709 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 710 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 711 | + monAll = monAll.add(val); | ||
| 712 | + } | ||
| 713 | + } | ||
| 714 | + m.put("monAll", monAll.doubleValue()); | ||
| 715 | + | ||
| 716 | + String gsBm = m.get("gsBm").toString(); | ||
| 717 | + int type = Integer.valueOf(m.get("sfyy").toString()); | ||
| 718 | + int item = Integer.valueOf(m.get("sfjc").toString()) == 1 ? 0 : 1; | ||
| 719 | + List<String> strList = new ArrayList<String>(); | ||
| 720 | + if(1 == type){ | ||
| 721 | + strList.add(gsBm + "_" + type + "_" + item); | ||
| 722 | + strList.add(gsBm + "_" + type + "_all"); | ||
| 723 | + } else { | ||
| 724 | + strList.add(gsBm + "_" + type); | ||
| 725 | + } | ||
| 726 | + strList.add(gsBm + "_all"); | ||
| 727 | + | ||
| 728 | + for(String str : strList){ | ||
| 729 | + Map<String, Object> map = keyMap.get(str); | ||
| 730 | + if(m.get("budget").toString().length() > 0){ | ||
| 731 | + if(map.get("budget").toString().length() > 0){ | ||
| 732 | + map.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 733 | + new BigDecimal(map.get("budget").toString())).doubleValue()); | ||
| 734 | + } else { | ||
| 735 | + map.put("budget", new BigDecimal(m.get("budget").toString()).doubleValue()); | ||
| 736 | + } | ||
| 737 | + } | ||
| 738 | + if(m.get("change").toString().length() > 0){ | ||
| 739 | + if(map.get("change").toString().length() > 0){ | ||
| 740 | + map.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 741 | + new BigDecimal(map.get("change").toString())).doubleValue()); | ||
| 742 | + } else { | ||
| 743 | + map.put("change", new BigDecimal(m.get("change").toString()).doubleValue()); | ||
| 744 | + } | ||
| 745 | + } | ||
| 746 | + if(m.get("formal").toString().length() > 0){ | ||
| 747 | + if(map.get("formal").toString().length() > 0){ | ||
| 748 | + map.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 749 | + new BigDecimal(map.get("formal").toString())).doubleValue()); | ||
| 750 | + } else { | ||
| 751 | + map.put("formal", new BigDecimal(m.get("formal").toString()).doubleValue()); | ||
| 752 | + } | ||
| 753 | + } | ||
| 754 | + for(int i = 1; i <= 12; i++){ | ||
| 755 | + String mon = "mon"+i; | ||
| 756 | + if(m.get(mon).toString().length() > 0){ | ||
| 757 | + if(map.get(mon).toString().length() > 0){ | ||
| 758 | + map.put(mon, new BigDecimal(m.get(mon).toString()).add( | ||
| 759 | + new BigDecimal(map.get(mon).toString())).doubleValue()); | ||
| 760 | + } else { | ||
| 761 | + map.put(mon, new BigDecimal(m.get(mon).toString()).doubleValue()); | ||
| 762 | + } | ||
| 763 | + } | ||
| 764 | + } | ||
| 765 | + List<Map<String, Object>>dataList = (List<Map<String, Object>>)map.get("dataList"); | ||
| 766 | + dataList.add(m); | ||
| 767 | + } | ||
| 768 | + | ||
| 769 | + for(int i = 1; i <= 12; i++){ | ||
| 770 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 771 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 772 | + val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 773 | + m.put("mon"+i, val.doubleValue()); | ||
| 774 | + } | ||
| 775 | + } | ||
| 776 | + monAll = monAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 777 | + m.put("monAll", monAll.doubleValue()); | ||
| 778 | + | ||
| 779 | + if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 780 | + && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 781 | + BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 782 | + m.put("complete", monAll.divide( | ||
| 783 | + formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 784 | + new BigDecimal(100)).divide( | ||
| 785 | + new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 786 | + BigDecimal diff = monAll.subtract(formal); | ||
| 787 | + m.put("diff", diff.doubleValue() > 0 ? "+" + diff.toString() : diff.toString()); | ||
| 788 | + } else { | ||
| 789 | + m.put("complete", ""); | ||
| 790 | + m.put("diff", ""); | ||
| 791 | + } | ||
| 792 | + } | ||
| 793 | + | ||
| 794 | + for(String key : strs){ | ||
| 795 | + if(!(key.contains("all_"))){ | ||
| 796 | + String[] sp = key.split("_"); | ||
| 797 | + String allKey = "all"; | ||
| 798 | + for(int i = 1; i < sp.length; i++){ | ||
| 799 | + allKey += "_" + sp[i]; | ||
| 800 | + } | ||
| 801 | + Map<String, Object> map = keyMap.get(key); | ||
| 802 | + Map<String, Object> allMap = keyMap.get(allKey); | ||
| 803 | + for(String k : map.keySet()){ | ||
| 804 | + if("year".equals(k)){ // 不想被计算的数字型字段 | ||
| 805 | + continue; | ||
| 806 | + } | ||
| 807 | + try { | ||
| 808 | + allMap.put(k, new BigDecimal(map.get(k).toString()).add( | ||
| 809 | + new BigDecimal(allMap.get(k).toString())).doubleValue()); | ||
| 810 | + } catch (Exception e) { | ||
| 811 | + // TODO: handle exception | ||
| 812 | + } | ||
| 813 | + } | ||
| 814 | + List<Map<String, Object>> dataList = (List<Map<String, Object>>)allMap.get("dataList"); | ||
| 815 | + dataList.addAll((List<Map<String, Object>>)map.get("dataList")); | ||
| 816 | + allMap.put("dataList", dataList); | ||
| 817 | + } | ||
| 818 | + } | ||
| 819 | + | ||
| 820 | + for(String key : strs){ | ||
| 821 | + Map<String, Object> m = keyMap.get(key); | ||
| 822 | + BigDecimal monAll = new BigDecimal("0"); | ||
| 823 | + for(int i = 1; i <= 12; i++){ | ||
| 824 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 825 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 826 | + monAll = monAll.add(val); | ||
| 827 | + val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 828 | + m.put("mon"+i, val.doubleValue()); | ||
| 829 | + } | ||
| 830 | + } | ||
| 831 | + monAll = monAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 832 | + m.put("monAll", monAll.doubleValue()); | ||
| 833 | + | ||
| 834 | + if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 835 | + && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 836 | + BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 837 | + m.put("complete", monAll.divide( | ||
| 838 | + formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 839 | + new BigDecimal(100)).divide( | ||
| 840 | + new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 841 | + BigDecimal diff = monAll.subtract(formal); | ||
| 842 | + m.put("diff", diff.doubleValue() > 0 ? "+" + diff.toString() : diff.toString()); | ||
| 843 | + } else { | ||
| 844 | + m.put("complete", ""); | ||
| 845 | + m.put("diff", ""); | ||
| 846 | + } | ||
| 847 | + m.put("year", year); | ||
| 848 | + } | ||
| 849 | + | ||
| 850 | + if(tttt.equals("export")){ | ||
| 851 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 852 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 853 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 854 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 855 | + String xls="budgetPerson.xls"; | ||
| 856 | + ReportUtils ee = new ReportUtils(); | ||
| 857 | + try { | ||
| 858 | + String dateTime = ""; | ||
| 859 | + m.put("date", year); | ||
| 860 | + dateTime = year; | ||
| 861 | + listI.add(resList.iterator()); | ||
| 862 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 863 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls, | ||
| 864 | + path + "export/"+dateTime+"-预算人次明细表.xls"); | ||
| 865 | + } catch (Exception e) { | ||
| 866 | + // TODO: handle exception | ||
| 867 | + e.printStackTrace(); | ||
| 868 | + } | ||
| 869 | + } | ||
| 870 | + | ||
| 871 | + return resList; | ||
| 872 | + } | ||
| 873 | + | ||
| 874 | + @Override | ||
| 875 | + public List<Map<String, Object>> budgetAmounts(String year, String tttt) { | ||
| 876 | + // TODO Auto-generated method stub | ||
| 877 | + SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); | ||
| 878 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 879 | + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | ||
| 880 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 881 | + List<Budget> findByYear = repository.findByYear(year); | ||
| 882 | + List<Revenue> list = revenueRepository.findByDates(year+"-01-01", year+"-12-31"); | ||
| 883 | + | ||
| 884 | + Map<String, Map<String, Object>> xlMap = new HashMap<String, Map<String, Object>>(); | ||
| 885 | + List<Map<String, Object>> xlList = new ArrayList<Map<String, Object>>(); | ||
| 886 | + | ||
| 887 | + String[] strs = createBudgetMap(resList, keyMap); | ||
| 888 | + | ||
| 889 | + for(Budget b : findByYear){ | ||
| 890 | + if(b.getFormalAmounts()==null || b.getFormalAmounts() < 0d){ | ||
| 891 | + continue; | ||
| 892 | + } | ||
| 893 | + String gsBm = b.getGsBm(); | ||
| 894 | + String xlBm = b.getXlBm(); | ||
| 895 | + String xlName = b.getXlName(); | ||
| 896 | + int sfyy = b.getSfyy()?1:0; | ||
| 897 | + int sfjc = xlName.contains("机场")?1:0; | ||
| 898 | + | ||
| 899 | + String key = gsBm + "_" + xlBm; | ||
| 900 | + if(!(xlMap.containsKey(key))){ | ||
| 901 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 902 | + m.put("gsBm", gsBm); | ||
| 903 | + m.put("gsName", b.getGsName()); | ||
| 904 | + m.put("xlBm", xlBm); | ||
| 905 | + m.put("xlName", xlName); | ||
| 906 | + m.put("sfyy", sfyy); | ||
| 907 | + m.put("sfjc", sfjc); | ||
| 908 | + m.put("budget", b.getBudgetAmounts()!=null?b.getBudgetAmounts():""); | ||
| 909 | + m.put("change", b.getChangeAmounts()!=null?b.getChangeAmounts():""); | ||
| 910 | + m.put("formal", b.getFormalAmounts()!=null?b.getFormalAmounts():""); | ||
| 911 | + for(int i = 1; i <= 12; i++){ | ||
| 912 | + m.put("mon"+i, ""); | ||
| 913 | + } | ||
| 914 | + m.put("monAll", "0"); | ||
| 915 | + m.put("num", "0"); | ||
| 916 | + xlMap.put(key, m); | ||
| 917 | + xlList.add(m); | ||
| 918 | + } | ||
| 919 | + } | ||
| 920 | + | ||
| 921 | + for(Revenue cs : list){ | ||
| 922 | + String gsBm = cs.getGsBm(); | ||
| 923 | + String xlBm = cs.getXlBm(); | ||
| 924 | + String xlName = cs.getXlName(); | ||
| 925 | + int sfyy = lineNature.containsKey(xlBm)&&lineNature.get(xlBm)?1:0; | ||
| 926 | + int sfjc = xlName.contains("机场")?1:0; | ||
| 927 | + | ||
| 928 | + String key = gsBm + "_" + xlBm; | ||
| 929 | + if(!(xlMap.containsKey(key))){ | ||
| 930 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 931 | + m.put("gsBm", gsBm); | ||
| 932 | + m.put("gsName", BasicData.businessCodeNameMap.get(gsBm)); | ||
| 933 | + m.put("xlBm", xlBm); | ||
| 934 | + m.put("xlName", xlName); | ||
| 935 | + m.put("sfyy", sfyy); | ||
| 936 | + m.put("sfjc", sfjc); | ||
| 937 | + m.put("budget", ""); | ||
| 938 | + m.put("change", ""); | ||
| 939 | + m.put("formal", ""); | ||
| 940 | + for(int i = 1; i <= 12; i++){ | ||
| 941 | + m.put("mon"+i, ""); | ||
| 942 | + } | ||
| 943 | + m.put("monAll", "0"); | ||
| 944 | + m.put("num", "0"); | ||
| 945 | + xlMap.put(key, m); | ||
| 946 | + xlList.add(m); | ||
| 947 | + } | ||
| 948 | + Map<String, Object> map = xlMap.get(key); | ||
| 949 | + String mon = "mon" + Integer.valueOf(sdfMM.format(cs.getScheduleDate())); | ||
| 950 | + String val = map.get(mon).toString(); | ||
| 951 | + BigDecimal amount = new BigDecimal(cs.getAmount().toString()); | ||
| 952 | + if(val.length() == 0){ | ||
| 953 | + map.put(mon, amount.doubleValue()); | ||
| 954 | + } else { | ||
| 955 | + map.put(mon, new BigDecimal(val).add(amount).doubleValue()); | ||
| 956 | + } | ||
| 957 | + | ||
| 958 | + BigDecimal num = new BigDecimal(cs.getNum().toString()); | ||
| 959 | + if(map.containsKey("num")){ | ||
| 960 | + map.put("num", new BigDecimal(map.get("num").toString()).add(num).doubleValue()); | ||
| 961 | + } else { | ||
| 962 | + map.put("num", num.doubleValue()); | ||
| 963 | + } | ||
| 964 | + } | ||
| 965 | + | ||
| 966 | + for(Map<String, Object> m : xlList){ | ||
| 967 | + BigDecimal monAll = new BigDecimal("0"); | ||
| 968 | + for(int i = 1; i <= 12; i++){ | ||
| 969 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 970 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 971 | + monAll = monAll.add(val); | ||
| 972 | + } | ||
| 973 | + } | ||
| 974 | + m.put("monAll", monAll.doubleValue()); | ||
| 975 | + | ||
| 976 | + String gsBm = m.get("gsBm").toString(); | ||
| 977 | + int type = Integer.valueOf(m.get("sfyy").toString()); | ||
| 978 | + int item = Integer.valueOf(m.get("sfjc").toString()) == 1 ? 0 : 1; | ||
| 979 | + List<String> strList = new ArrayList<String>(); | ||
| 980 | + if(1 == type){ | ||
| 981 | + strList.add(gsBm + "_" + type + "_" + item); | ||
| 982 | + strList.add(gsBm + "_" + type + "_all"); | ||
| 983 | + } else { | ||
| 984 | + strList.add(gsBm + "_" + type); | ||
| 985 | + } | ||
| 986 | + strList.add(gsBm + "_all"); | ||
| 987 | + | ||
| 988 | + for(String str : strList){ | ||
| 989 | + Map<String, Object> map = keyMap.get(str); | ||
| 990 | + if(m.get("budget").toString().length() > 0){ | ||
| 991 | + if(map.get("budget").toString().length() > 0){ | ||
| 992 | + map.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 993 | + new BigDecimal(map.get("budget").toString())).doubleValue()); | ||
| 994 | + } else { | ||
| 995 | + map.put("budget", new BigDecimal(m.get("budget").toString()).doubleValue()); | ||
| 996 | + } | ||
| 997 | + } | ||
| 998 | + if(m.get("change").toString().length() > 0){ | ||
| 999 | + if(map.get("change").toString().length() > 0){ | ||
| 1000 | + map.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 1001 | + new BigDecimal(map.get("change").toString())).doubleValue()); | ||
| 1002 | + } else { | ||
| 1003 | + map.put("change", new BigDecimal(m.get("change").toString()).doubleValue()); | ||
| 1004 | + } | ||
| 1005 | + } | ||
| 1006 | + if(m.get("formal").toString().length() > 0){ | ||
| 1007 | + if(map.get("formal").toString().length() > 0){ | ||
| 1008 | + map.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 1009 | + new BigDecimal(map.get("formal").toString())).doubleValue()); | ||
| 1010 | + } else { | ||
| 1011 | + map.put("formal", new BigDecimal(m.get("formal").toString()).doubleValue()); | ||
| 1012 | + } | ||
| 1013 | + } | ||
| 1014 | + for(int i = 1; i <= 12; i++){ | ||
| 1015 | + String mon = "mon"+i; | ||
| 1016 | + if(m.get(mon).toString().length() > 0){ | ||
| 1017 | + if(map.get(mon).toString().length() > 0){ | ||
| 1018 | + map.put(mon, new BigDecimal(m.get(mon).toString()).add( | ||
| 1019 | + new BigDecimal(map.get(mon).toString())).doubleValue()); | ||
| 1020 | + } else { | ||
| 1021 | + map.put(mon, new BigDecimal(m.get(mon).toString()).doubleValue()); | ||
| 1022 | + } | ||
| 1023 | + } | ||
| 1024 | + } | ||
| 1025 | + if(m.containsKey("num") && m.get("num").toString().length() > 0){ | ||
| 1026 | + if(map.containsKey("num") && map.get("num").toString().length() > 0){ | ||
| 1027 | + map.put("num", new BigDecimal(m.get("num").toString()).add( | ||
| 1028 | + new BigDecimal(map.get("num").toString())).doubleValue()); | ||
| 1029 | + } else { | ||
| 1030 | + map.put("num", new BigDecimal(m.get("num").toString()).doubleValue()); | ||
| 1031 | + } | ||
| 1032 | + } | ||
| 1033 | + List<Map<String, Object>>dataList = (List<Map<String, Object>>)map.get("dataList"); | ||
| 1034 | + dataList.add(m); | ||
| 1035 | + } | ||
| 1036 | + | ||
| 1037 | + if(m.containsKey("num") && m.get("num").toString().length() > 0 | ||
| 1038 | + && Double.valueOf(m.get("num").toString()) > 0){ | ||
| 1039 | + m.put("average", monAll.divide( | ||
| 1040 | + new BigDecimal(m.get("num").toString()).multiply(new BigDecimal("100")), | ||
| 1041 | + 2, BigDecimal.ROUND_HALF_UP).doubleValue()); | ||
| 1042 | + } else { | ||
| 1043 | + m.put("average", ""); | ||
| 1044 | + } | ||
| 1045 | + | ||
| 1046 | + for(int i = 1; i <= 12; i++){ | ||
| 1047 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 1048 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 1049 | + val = val.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 1050 | + m.put("mon"+i, val.doubleValue()); | ||
| 1051 | + } | ||
| 1052 | + } | ||
| 1053 | + monAll = monAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 1054 | + m.put("monAll", monAll.doubleValue()); | ||
| 1055 | + | ||
| 1056 | + if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 1057 | + && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 1058 | + BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 1059 | + m.put("complete", monAll.divide( | ||
| 1060 | + formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 1061 | + new BigDecimal(100)).divide( | ||
| 1062 | + new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 1063 | + BigDecimal diff = monAll.subtract(formal); | ||
| 1064 | + m.put("diff", diff.doubleValue() > 0 ? "+" + diff.toString() : diff.toString()); | ||
| 1065 | + } else { | ||
| 1066 | + m.put("complete", ""); | ||
| 1067 | + m.put("diff", ""); | ||
| 1068 | + } | ||
| 1069 | + } | ||
| 1070 | + | ||
| 1071 | + for(String key : strs){ | ||
| 1072 | + if(!(key.contains("all_"))){ | ||
| 1073 | + String[] sp = key.split("_"); | ||
| 1074 | + String allKey = "all"; | ||
| 1075 | + for(int i = 1; i < sp.length; i++){ | ||
| 1076 | + allKey += "_" + sp[i]; | ||
| 1077 | + } | ||
| 1078 | + Map<String, Object> map = keyMap.get(key); | ||
| 1079 | + Map<String, Object> allMap = keyMap.get(allKey); | ||
| 1080 | + for(String k : map.keySet()){ | ||
| 1081 | + if("year".equals(k) || "num".equals(k)){ // 不想被计算的数字型字段 | ||
| 1082 | + continue; | ||
| 1083 | + } | ||
| 1084 | + try { | ||
| 1085 | + allMap.put(k, new BigDecimal(map.get(k).toString()).add( | ||
| 1086 | + new BigDecimal(allMap.get(k).toString())).doubleValue()); | ||
| 1087 | + } catch (Exception e) { | ||
| 1088 | + // TODO: handle exception | ||
| 1089 | + } | ||
| 1090 | + } | ||
| 1091 | + if(map.containsKey("num") && map.get("num").toString().length() > 0){ | ||
| 1092 | + if(allMap.containsKey("num") && allMap.get("num").toString().length() > 0){ | ||
| 1093 | + allMap.put("num", new BigDecimal(map.get("num").toString()).add( | ||
| 1094 | + new BigDecimal(allMap.get("num").toString())).doubleValue()); | ||
| 1095 | + } else { | ||
| 1096 | + allMap.put("num", new BigDecimal(map.get("num").toString()).doubleValue()); | ||
| 1097 | + } | ||
| 1098 | + } | ||
| 1099 | + List<Map<String, Object>> dataList = (List<Map<String, Object>>)allMap.get("dataList"); | ||
| 1100 | + dataList.addAll((List<Map<String, Object>>)map.get("dataList")); | ||
| 1101 | + allMap.put("dataList", dataList); | ||
| 1102 | + } | ||
| 1103 | + } | ||
| 1104 | + | ||
| 1105 | + for(String key : strs){ | ||
| 1106 | + Map<String, Object> m = keyMap.get(key); | ||
| 1107 | + | ||
| 1108 | + BigDecimal monAll = new BigDecimal("0"); | ||
| 1109 | + for(int i = 1; i <= 12; i++){ | ||
| 1110 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 1111 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 1112 | + monAll = monAll.add(val); | ||
| 1113 | + val = val.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 1114 | + m.put("mon"+i, val.doubleValue()); | ||
| 1115 | + } | ||
| 1116 | + } | ||
| 1117 | + | ||
| 1118 | + if(m.containsKey("num") && m.get("num").toString().length() > 0 | ||
| 1119 | + && Double.valueOf(m.get("num").toString()) > 0){ | ||
| 1120 | + m.put("average", monAll.divide( | ||
| 1121 | + new BigDecimal(m.get("num").toString()).multiply(new BigDecimal("100")), | ||
| 1122 | + 2, BigDecimal.ROUND_HALF_UP).doubleValue()); | ||
| 1123 | + } else { | ||
| 1124 | + m.put("average", ""); | ||
| 1125 | + } | ||
| 1126 | + | ||
| 1127 | + monAll = monAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 1128 | + m.put("monAll", monAll.doubleValue()); | ||
| 1129 | + | ||
| 1130 | + if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 1131 | + && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 1132 | + BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 1133 | + m.put("complete", monAll.divide( | ||
| 1134 | + formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 1135 | + new BigDecimal(100)).divide( | ||
| 1136 | + new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 1137 | + BigDecimal diff = monAll.subtract(formal); | ||
| 1138 | + m.put("diff", diff.doubleValue() > 0 ? "+" + diff.toString() : diff.toString()); | ||
| 1139 | + } else { | ||
| 1140 | + m.put("complete", ""); | ||
| 1141 | + m.put("diff", ""); | ||
| 1142 | + } | ||
| 1143 | + m.put("year", year); | ||
| 1144 | + } | ||
| 1145 | + | ||
| 1146 | + if(tttt.equals("export")){ | ||
| 1147 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 1148 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 1149 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 1150 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1151 | + String xls="budgetAmounts.xls"; | ||
| 1152 | + ReportUtils ee = new ReportUtils(); | ||
| 1153 | + try { | ||
| 1154 | + String dateTime = ""; | ||
| 1155 | + m.put("date", year); | ||
| 1156 | + dateTime = year; | ||
| 1157 | + listI.add(resList.iterator()); | ||
| 1158 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 1159 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls, | ||
| 1160 | + path + "export/"+dateTime+"-预算营收明细表.xls"); | ||
| 1161 | + } catch (Exception e) { | ||
| 1162 | + // TODO: handle exception | ||
| 1163 | + e.printStackTrace(); | ||
| 1164 | + } | ||
| 1165 | + } | ||
| 1166 | + | ||
| 1167 | + return resList; | ||
| 1168 | + } | ||
| 1169 | + | ||
| 1170 | + @Override | ||
| 1171 | + public List<Map<String, Object>> budgetSum(String year, String tttt) { | ||
| 1172 | + // TODO Auto-generated method stub | ||
| 1173 | + SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); | ||
| 1174 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 1175 | + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | ||
| 1176 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 1177 | + List<Budget> findByYear = repository.findByYear(year); | ||
| 1178 | + List<CalcStatistics> scheduleList = calcStatisticsRepository.selectByDateAndLineTj3(year+"-01-01", year+"-12-31"); | ||
| 1179 | + List<Revenue> revenueList = revenueRepository.findByDates(year+"-01-01", year+"-12-31"); | ||
| 1180 | + | ||
| 1181 | + Map<String, Map<String, Object>> xlMap = new HashMap<String, Map<String, Object>>(); | ||
| 1182 | + List<Map<String, Object>> xlList = new ArrayList<Map<String, Object>>(); | ||
| 1183 | + | ||
| 1184 | + String[] strs = createBudgetMap_sum(resList, keyMap); | ||
| 1185 | + | ||
| 1186 | + for(Budget b : findByYear){ | ||
| 1187 | + String gsBm = b.getGsBm(); | ||
| 1188 | + String xlBm = b.getXlBm(); | ||
| 1189 | + String xlName = b.getXlName(); | ||
| 1190 | + String key = gsBm + "_" + xlBm; | ||
| 1191 | + if(b.getFormalMileage()!=null && b.getFormalMileage() >= 0d){ | ||
| 1192 | + String key1 = key + "_1"; | ||
| 1193 | + if(!(xlMap.containsKey(key1))){ | ||
| 1194 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1195 | + m.put("gsBm", gsBm); | ||
| 1196 | + m.put("gsName", b.getGsName()); | ||
| 1197 | + m.put("xlBm", xlBm); | ||
| 1198 | + m.put("xlName", xlName); | ||
| 1199 | + m.put("type", "公里"); | ||
| 1200 | + m.put("budget", b.getBudgetMileage()!=null?b.getBudgetMileage():""); | ||
| 1201 | + m.put("change", b.getChangeMileage()!=null?b.getChangeMileage():""); | ||
| 1202 | + m.put("formal", b.getFormalMileage()!=null?b.getFormalMileage():""); | ||
| 1203 | + for(int i = 1; i <= 12; i++){ | ||
| 1204 | + m.put("mon"+i, ""); | ||
| 1205 | + } | ||
| 1206 | + m.put("monAll", "0"); | ||
| 1207 | + xlMap.put(key1, m); | ||
| 1208 | + xlList.add(m); | ||
| 1209 | + } | ||
| 1210 | + } | ||
| 1211 | + if(b.getFormalPerson()!=null && b.getFormalPerson() >= 0d){ | ||
| 1212 | + String key2 = key + "_2"; | ||
| 1213 | + if(!(xlMap.containsKey(key2))){ | ||
| 1214 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1215 | + m.put("gsBm", gsBm); | ||
| 1216 | + m.put("gsName", b.getGsName()); | ||
| 1217 | + m.put("xlBm", xlBm); | ||
| 1218 | + m.put("xlName", xlName); | ||
| 1219 | + m.put("type", "人次"); | ||
| 1220 | + m.put("budget", b.getBudgetPerson()!=null?b.getBudgetPerson():""); | ||
| 1221 | + m.put("change", b.getChangePerson()!=null?b.getChangePerson():""); | ||
| 1222 | + m.put("formal", b.getFormalPerson()!=null?b.getFormalPerson():""); | ||
| 1223 | + for(int i = 1; i <= 12; i++){ | ||
| 1224 | + m.put("mon"+i, ""); | ||
| 1225 | + } | ||
| 1226 | + m.put("monAll", "0"); | ||
| 1227 | + xlMap.put(key2, m); | ||
| 1228 | + xlList.add(m); | ||
| 1229 | + } | ||
| 1230 | + } | ||
| 1231 | + if(b.getFormalAmounts()!=null && b.getFormalAmounts() >= 0d){ | ||
| 1232 | + String key3 = key + "_3"; | ||
| 1233 | + if(!(xlMap.containsKey(key3))){ | ||
| 1234 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1235 | + m.put("gsBm", gsBm); | ||
| 1236 | + m.put("gsName", b.getGsName()); | ||
| 1237 | + m.put("xlBm", xlBm); | ||
| 1238 | + m.put("xlName", xlName); | ||
| 1239 | + m.put("type", "营收"); | ||
| 1240 | + m.put("budget", b.getBudgetAmounts()!=null?b.getBudgetAmounts():""); | ||
| 1241 | + m.put("change", b.getChangeAmounts()!=null?b.getChangeAmounts():""); | ||
| 1242 | + m.put("formal", b.getFormalAmounts()!=null?b.getFormalAmounts():""); | ||
| 1243 | + for(int i = 1; i <= 12; i++){ | ||
| 1244 | + m.put("mon"+i, ""); | ||
| 1245 | + } | ||
| 1246 | + m.put("monAll", "0"); | ||
| 1247 | + xlMap.put(key3, m); | ||
| 1248 | + xlList.add(m); | ||
| 1249 | + } | ||
| 1250 | + } | ||
| 1251 | + } | ||
| 1252 | + | ||
| 1253 | + for(CalcStatistics cs : scheduleList){ // 公里 | ||
| 1254 | + String gsBm = cs.getGsdm(); | ||
| 1255 | + String xlBm = cs.getXl(); | ||
| 1256 | + String xlName = cs.getXlName(); | ||
| 1257 | + | ||
| 1258 | + String key = gsBm + "_" + xlBm + "_1"; | ||
| 1259 | + if(!(xlMap.containsKey(key))){ | ||
| 1260 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1261 | + m.put("gsBm", gsBm); | ||
| 1262 | + m.put("gsName", BasicData.businessCodeNameMap.get(gsBm)); | ||
| 1263 | + m.put("xlBm", xlBm); | ||
| 1264 | + m.put("xlName", xlName); | ||
| 1265 | + m.put("type", "公里"); | ||
| 1266 | + m.put("budget", ""); | ||
| 1267 | + m.put("change", ""); | ||
| 1268 | + m.put("formal", ""); | ||
| 1269 | + for(int i = 1; i <= 12; i++){ | ||
| 1270 | + m.put("mon"+i, ""); | ||
| 1271 | + } | ||
| 1272 | + m.put("monAll", "0"); | ||
| 1273 | + xlMap.put(key, m); | ||
| 1274 | + xlList.add(m); | ||
| 1275 | + } | ||
| 1276 | + Map<String, Object> map = xlMap.get(key); | ||
| 1277 | + String mon = "mon" + Integer.valueOf(sdfMM.format(cs.getDate())); | ||
| 1278 | + String val = map.get(mon).toString(); | ||
| 1279 | + BigDecimal num = new BigDecimal(cs.getSjzlc().toString()); | ||
| 1280 | + if(val.length() == 0){ | ||
| 1281 | + map.put(mon, num.doubleValue()); | ||
| 1282 | + } else { | ||
| 1283 | + map.put(mon, new BigDecimal(val).add(num).doubleValue()); | ||
| 1284 | + } | ||
| 1285 | + } | ||
| 1286 | + | ||
| 1287 | + for(Revenue cs : revenueList){ | ||
| 1288 | + String gsBm = cs.getGsBm(); | ||
| 1289 | + String xlBm = cs.getXlBm(); | ||
| 1290 | + String xlName = cs.getXlName(); | ||
| 1291 | + | ||
| 1292 | + { // 人次 | ||
| 1293 | + String key2 = gsBm + "_" + xlBm + "_2"; | ||
| 1294 | + if(!(xlMap.containsKey(key2))){ | ||
| 1295 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1296 | + m.put("gsBm", gsBm); | ||
| 1297 | + m.put("gsName", BasicData.businessCodeNameMap.get(gsBm)); | ||
| 1298 | + m.put("xlBm", xlBm); | ||
| 1299 | + m.put("xlName", xlName); | ||
| 1300 | + m.put("type", "人次"); | ||
| 1301 | + m.put("budget", ""); | ||
| 1302 | + m.put("change", ""); | ||
| 1303 | + m.put("formal", ""); | ||
| 1304 | + for(int i = 1; i <= 12; i++){ | ||
| 1305 | + m.put("mon"+i, ""); | ||
| 1306 | + } | ||
| 1307 | + m.put("monAll", "0"); | ||
| 1308 | + xlMap.put(key2, m); | ||
| 1309 | + xlList.add(m); | ||
| 1310 | + } | ||
| 1311 | + Map<String, Object> map = xlMap.get(key2); | ||
| 1312 | + String mon = "mon" + Integer.valueOf(sdfMM.format(cs.getScheduleDate())); | ||
| 1313 | + String val = map.get(mon).toString(); | ||
| 1314 | + BigDecimal num = new BigDecimal(cs.getNum().toString()); | ||
| 1315 | + if(val.length() == 0){ | ||
| 1316 | + map.put(mon, num.doubleValue()); | ||
| 1317 | + } else { | ||
| 1318 | + map.put(mon, new BigDecimal(val).add(num).doubleValue()); | ||
| 1319 | + } | ||
| 1320 | + } | ||
| 1321 | + { // 营收 | ||
| 1322 | + String key3 = gsBm + "_" + xlBm + "_3"; | ||
| 1323 | + if(!(xlMap.containsKey(key3))){ | ||
| 1324 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1325 | + m.put("gsBm", gsBm); | ||
| 1326 | + m.put("gsName", BasicData.businessCodeNameMap.get(gsBm)); | ||
| 1327 | + m.put("xlBm", xlBm); | ||
| 1328 | + m.put("xlName", xlName); | ||
| 1329 | + m.put("type", "营收"); | ||
| 1330 | + m.put("budget", ""); | ||
| 1331 | + m.put("change", ""); | ||
| 1332 | + m.put("formal", ""); | ||
| 1333 | + for(int i = 1; i <= 12; i++){ | ||
| 1334 | + m.put("mon"+i, ""); | ||
| 1335 | + } | ||
| 1336 | + m.put("monAll", "0"); | ||
| 1337 | + xlMap.put(key3, m); | ||
| 1338 | + xlList.add(m); | ||
| 1339 | + } | ||
| 1340 | + Map<String, Object> map = xlMap.get(key3); | ||
| 1341 | + String mon = "mon" + Integer.valueOf(sdfMM.format(cs.getScheduleDate())); | ||
| 1342 | + String val = map.get(mon).toString(); | ||
| 1343 | + BigDecimal num = new BigDecimal(cs.getAmount().toString()); | ||
| 1344 | + if(val.length() == 0){ | ||
| 1345 | + map.put(mon, num.doubleValue()); | ||
| 1346 | + } else { | ||
| 1347 | + map.put(mon, new BigDecimal(val).add(num).doubleValue()); | ||
| 1348 | + } | ||
| 1349 | + } | ||
| 1350 | + } | ||
| 1351 | + | ||
| 1352 | + for(Map<String, Object> m : xlList){ | ||
| 1353 | + BigDecimal monAll = new BigDecimal("0"); | ||
| 1354 | + for(int i = 1; i <= 12; i++){ | ||
| 1355 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 1356 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 1357 | + monAll = monAll.add(val); | ||
| 1358 | + } | ||
| 1359 | + } | ||
| 1360 | + m.put("monAll", monAll.doubleValue()); | ||
| 1361 | + | ||
| 1362 | + String gsBm = m.get("gsBm").toString(); | ||
| 1363 | + String type = m.get("type").toString(); | ||
| 1364 | + if("公里".equals(type)){ | ||
| 1365 | + type = "1"; | ||
| 1366 | + } else if("人次".equals(type)){ | ||
| 1367 | + type = "2"; | ||
| 1368 | + } else if("营收".equals(type)){ | ||
| 1369 | + type = "3"; | ||
| 1370 | + } | ||
| 1371 | + List<String> strList = new ArrayList<String>(); | ||
| 1372 | + strList.add(gsBm + "_" + type); | ||
| 1373 | + | ||
| 1374 | + for(String str : strList){ | ||
| 1375 | + Map<String, Object> map = keyMap.get(str); | ||
| 1376 | + if(m.get("budget").toString().length() > 0){ | ||
| 1377 | + System.out.println(str); | ||
| 1378 | + if(map.get("budget").toString().length() > 0){ | ||
| 1379 | + map.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 1380 | + new BigDecimal(map.get("budget").toString())).doubleValue()); | ||
| 1381 | + } else { | ||
| 1382 | + map.put("budget", new BigDecimal(m.get("budget").toString()).doubleValue()); | ||
| 1383 | + } | ||
| 1384 | + } | ||
| 1385 | + if(m.get("change").toString().length() > 0){ | ||
| 1386 | + if(map.get("change").toString().length() > 0){ | ||
| 1387 | + map.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 1388 | + new BigDecimal(map.get("change").toString())).doubleValue()); | ||
| 1389 | + } else { | ||
| 1390 | + map.put("change", new BigDecimal(m.get("change").toString()).doubleValue()); | ||
| 1391 | + } | ||
| 1392 | + } | ||
| 1393 | + if(m.get("formal").toString().length() > 0){ | ||
| 1394 | + if(map.get("formal").toString().length() > 0){ | ||
| 1395 | + map.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 1396 | + new BigDecimal(map.get("formal").toString())).doubleValue()); | ||
| 1397 | + } else { | ||
| 1398 | + map.put("formal", new BigDecimal(m.get("formal").toString()).doubleValue()); | ||
| 1399 | + } | ||
| 1400 | + } | ||
| 1401 | + for(int i = 1; i <= 12; i++){ | ||
| 1402 | + String mon = "mon"+i; | ||
| 1403 | + if(m.get(mon).toString().length() > 0){ | ||
| 1404 | + if(map.get(mon).toString().length() > 0){ | ||
| 1405 | + map.put(mon, new BigDecimal(m.get(mon).toString()).add( | ||
| 1406 | + new BigDecimal(map.get(mon).toString())).doubleValue()); | ||
| 1407 | + } else { | ||
| 1408 | + map.put(mon, new BigDecimal(m.get(mon).toString()).doubleValue()); | ||
| 1409 | + } | ||
| 1410 | + } | ||
| 1411 | + } | ||
| 1412 | + List<Map<String, Object>>dataList = (List<Map<String, Object>>)map.get("dataList"); | ||
| 1413 | + dataList.add(m); | ||
| 1414 | + } | ||
| 1415 | + | ||
| 1416 | + String digit = "10000"; | ||
| 1417 | + if("营收".equals(m.get("type").toString())){ | ||
| 1418 | + digit = "1000000"; | ||
| 1419 | + } | ||
| 1420 | + for(int i = 1; i <= 12; i++){ | ||
| 1421 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 1422 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 1423 | + val = val.divide(new BigDecimal(digit), 3, BigDecimal.ROUND_HALF_UP); | ||
| 1424 | + m.put("mon"+i, val.doubleValue()); | ||
| 1425 | + } | ||
| 1426 | + } | ||
| 1427 | + monAll = monAll.divide(new BigDecimal(digit), 3, BigDecimal.ROUND_HALF_UP); | ||
| 1428 | + m.put("monAll", monAll.doubleValue()); | ||
| 1429 | + | ||
| 1430 | + if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 1431 | + && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 1432 | + BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 1433 | + m.put("complete", monAll.divide( | ||
| 1434 | + formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 1435 | + new BigDecimal(100)).divide( | ||
| 1436 | + new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 1437 | + BigDecimal diff = monAll.subtract(formal); | ||
| 1438 | + m.put("diff", diff.doubleValue() > 0 ? "+" + diff.toString() : diff.toString()); | ||
| 1439 | + } else { | ||
| 1440 | + m.put("complete", ""); | ||
| 1441 | + m.put("diff", ""); | ||
| 1442 | + } | ||
| 1443 | + } | ||
| 1444 | + | ||
| 1445 | + for(String key : strs){ | ||
| 1446 | + if(!(key.contains("all_"))){ | ||
| 1447 | + String[] sp = key.split("_"); | ||
| 1448 | + String allKey = "all"; | ||
| 1449 | + for(int i = 1; i < sp.length; i++){ | ||
| 1450 | + allKey += "_" + sp[i]; | ||
| 1451 | + } | ||
| 1452 | + Map<String, Object> map = keyMap.get(key); | ||
| 1453 | + Map<String, Object> allMap = keyMap.get(allKey); | ||
| 1454 | + for(String k : map.keySet()){ | ||
| 1455 | + if("year".equals(k)){ // 不想被计算的数字型字段 | ||
| 1456 | + continue; | ||
| 1457 | + } | ||
| 1458 | + try { | ||
| 1459 | + allMap.put(k, new BigDecimal(map.get(k).toString()).add( | ||
| 1460 | + new BigDecimal(allMap.get(k).toString())).doubleValue()); | ||
| 1461 | + } catch (Exception e) { | ||
| 1462 | + // TODO: handle exception | ||
| 1463 | + } | ||
| 1464 | + } | ||
| 1465 | + List<Map<String, Object>> dataList = (List<Map<String, Object>>)allMap.get("dataList"); | ||
| 1466 | + dataList.addAll((List<Map<String, Object>>)map.get("dataList")); | ||
| 1467 | + allMap.put("dataList", dataList); | ||
| 1468 | + } | ||
| 1469 | + } | ||
| 1470 | + | ||
| 1471 | + for(String key : strs){ | ||
| 1472 | + Map<String, Object> m = keyMap.get(key); | ||
| 1473 | + BigDecimal monAll = new BigDecimal("0"); | ||
| 1474 | + String digit = "10000"; | ||
| 1475 | + if("营收".equals(m.get("type").toString())){ | ||
| 1476 | + digit = "1000000"; | ||
| 1477 | + } | ||
| 1478 | + for(int i = 1; i <= 12; i++){ | ||
| 1479 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 1480 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 1481 | + monAll = monAll.add(val); | ||
| 1482 | + val = val.divide(new BigDecimal(digit), 3, BigDecimal.ROUND_HALF_UP); | ||
| 1483 | + m.put("mon"+i, val.doubleValue()); | ||
| 1484 | + } | ||
| 1485 | + } | ||
| 1486 | + monAll = monAll.divide(new BigDecimal(digit), 3, BigDecimal.ROUND_HALF_UP); | ||
| 1487 | + m.put("monAll", monAll.doubleValue()); | ||
| 1488 | + | ||
| 1489 | + if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 1490 | + && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 1491 | + BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 1492 | + m.put("complete", monAll.divide( | ||
| 1493 | + formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 1494 | + new BigDecimal(100)).divide( | ||
| 1495 | + new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 1496 | + BigDecimal diff = monAll.subtract(formal); | ||
| 1497 | + m.put("diff", diff.doubleValue() > 0 ? "+" + diff.toString() : diff.toString()); | ||
| 1498 | + } else { | ||
| 1499 | + m.put("complete", ""); | ||
| 1500 | + m.put("diff", ""); | ||
| 1501 | + } | ||
| 1502 | + m.put("year", year); | ||
| 1503 | + } | ||
| 1504 | + | ||
| 1505 | + if(tttt.equals("export")){ | ||
| 1506 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 1507 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 1508 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 1509 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1510 | + String xls="budgetSum.xls"; | ||
| 1511 | + ReportUtils ee = new ReportUtils(); | ||
| 1512 | + try { | ||
| 1513 | + String dateTime = ""; | ||
| 1514 | + m.put("date", year); | ||
| 1515 | + dateTime = year; | ||
| 1516 | + listI.add(resList.iterator()); | ||
| 1517 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 1518 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls, | ||
| 1519 | + path + "export/"+dateTime+"-预算汇总表.xls"); | ||
| 1520 | + } catch (Exception e) { | ||
| 1521 | + // TODO: handle exception | ||
| 1522 | + e.printStackTrace(); | ||
| 1523 | + } | ||
| 1524 | + } | ||
| 1525 | + | ||
| 1526 | + return resList; | ||
| 1527 | + } | ||
| 1528 | + | ||
| 1529 | + public String[] createBudgetMap(List<Map<String, Object>> list, Map<String, Map<String, Object>> keyMap){ | ||
| 1530 | + | ||
| 1531 | + String[] strs = {"05_1_1", "05_1_0", "05_1_all", "05_0", "05_all" | ||
| 1532 | + ,"55_1_1", "55_1_0", "55_1_all", "55_0", "55_all" | ||
| 1533 | + ,"22_1_1", "22_1_0", "22_1_all", "22_0", "22_all" | ||
| 1534 | + ,"26_1_1", "26_1_0", "26_1_all", "26_0", "26_all" | ||
| 1535 | + ,"all_1_1", "all_1_0", "all_1_all", "all_0", "all_all"}; | ||
| 1536 | + for(String s : strs){ | ||
| 1537 | + String[] sp = s.split("_"); | ||
| 1538 | + Map<String, Object> m1 = new HashMap<String, Object>(); | ||
| 1539 | + String gs = "", type = "", item = "", num = ""; | ||
| 1540 | + if("05".equals(sp[0])){ | ||
| 1541 | + gs = "杨高公司"; | ||
| 1542 | + } else if("55".equals(sp[0])){ | ||
| 1543 | + gs = "上南公司"; | ||
| 1544 | + } else if("22".equals(sp[0])){ | ||
| 1545 | + gs = "金高公司"; | ||
| 1546 | + } else if("26".equals(sp[0])){ | ||
| 1547 | + gs = "南汇公司"; | ||
| 1548 | + } else if("all".equals(sp[0])){ | ||
| 1549 | + gs = "浦东公交合计"; | ||
| 1550 | + num = "0"; | ||
| 1551 | + } | ||
| 1552 | + if("1".equals(sp[1])){ | ||
| 1553 | + type = "营运线路"; | ||
| 1554 | + } else if("0".equals(sp[1])){ | ||
| 1555 | + type = "非营运线路"; | ||
| 1556 | + } else if("all".equals(sp[1])){ | ||
| 1557 | + type = "全部线路"; | ||
| 1558 | + } | ||
| 1559 | + if(sp.length > 2){ | ||
| 1560 | + if("1".equals(sp[2])){ | ||
| 1561 | + item = "营运线路"; | ||
| 1562 | + } else if("0".equals(sp[2])){ | ||
| 1563 | + item = "机场线路"; | ||
| 1564 | + } else if("all".equals(sp[2])){ | ||
| 1565 | + item = "小计"; | ||
| 1566 | + } | ||
| 1567 | + } | ||
| 1568 | + m1.put("gsName", gs);m1.put("type", type);m1.put("item", item); | ||
| 1569 | + m1.put("budget", num);m1.put("change", num);m1.put("formal", num); | ||
| 1570 | + for(int i = 1; i <= 12; i++){ | ||
| 1571 | + m1.put("mon"+i, num); | ||
| 1572 | + } | ||
| 1573 | + m1.put("monAll", "0"); | ||
| 1574 | + m1.put("key", s); | ||
| 1575 | + m1.put("dataList", new ArrayList<Map<String, Object>>()); | ||
| 1576 | + list.add(m1); | ||
| 1577 | + keyMap.put(s, m1); | ||
| 1578 | + } | ||
| 1579 | + return strs; | ||
| 1580 | + } | ||
| 1581 | + | ||
| 1582 | + public String[] createBudgetMap_sum(List<Map<String, Object>> list, Map<String, Map<String, Object>> keyMap){ | ||
| 1583 | + | ||
| 1584 | + String[] strs = {"05_1", "05_2", "05_3" | ||
| 1585 | + ,"55_1", "55_2", "55_3" | ||
| 1586 | + ,"22_1", "22_2", "22_3" | ||
| 1587 | + ,"26_1", "26_2", "26_3" | ||
| 1588 | + ,"all_1", "all_2", "all_3"}; | ||
| 1589 | + for(String s : strs){ | ||
| 1590 | + String[] sp = s.split("_"); | ||
| 1591 | + Map<String, Object> m1 = new HashMap<String, Object>(); | ||
| 1592 | + String gs = "", type = "", num = ""; | ||
| 1593 | + if("05".equals(sp[0])){ | ||
| 1594 | + gs = "杨高公司"; | ||
| 1595 | + } else if("55".equals(sp[0])){ | ||
| 1596 | + gs = "上南公司"; | ||
| 1597 | + } else if("22".equals(sp[0])){ | ||
| 1598 | + gs = "金高公司"; | ||
| 1599 | + } else if("26".equals(sp[0])){ | ||
| 1600 | + gs = "南汇公司"; | ||
| 1601 | + } else if("all".equals(sp[0])){ | ||
| 1602 | + gs = "浦东公交合计"; | ||
| 1603 | + num = "0"; | ||
| 1604 | + } | ||
| 1605 | + if("1".equals(sp[1])){ | ||
| 1606 | + type = "公里"; | ||
| 1607 | + } else if("2".equals(sp[1])){ | ||
| 1608 | + type = "人次"; | ||
| 1609 | + } else if("3".equals(sp[1])){ | ||
| 1610 | + type = "营收"; | ||
| 1611 | + } | ||
| 1612 | + m1.put("gsName", gs);m1.put("type", type); | ||
| 1613 | + m1.put("budget", num);m1.put("change", num);m1.put("formal", num); | ||
| 1614 | + for(int i = 1; i <= 12; i++){ | ||
| 1615 | + m1.put("mon"+i, num); | ||
| 1616 | + } | ||
| 1617 | + m1.put("monAll", "0"); | ||
| 1618 | + m1.put("key", s); | ||
| 1619 | + m1.put("dataList", new ArrayList<Map<String, Object>>()); | ||
| 1620 | + list.add(m1); | ||
| 1621 | + keyMap.put(s, m1); | ||
| 1622 | + } | ||
| 1623 | + return strs; | ||
| 1624 | + } | ||
| 1625 | + | ||
| 1626 | +} |
src/main/java/com/bsth/service/forms/impl/RevenueLoader.java
0 → 100644
| 1 | +package com.bsth.service.forms.impl; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.bsth.util.ConfigUtil; | ||
| 5 | +import org.apache.http.HttpEntity; | ||
| 6 | +import org.apache.http.client.config.RequestConfig; | ||
| 7 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 8 | +import org.apache.http.client.methods.HttpGet; | ||
| 9 | +import org.apache.http.impl.client.CloseableHttpClient; | ||
| 10 | +import org.apache.http.impl.client.HttpClients; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | +import org.springframework.stereotype.Component; | ||
| 14 | + | ||
| 15 | +import java.io.BufferedReader; | ||
| 16 | +import java.io.InputStreamReader; | ||
| 17 | +import java.util.ArrayList; | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +@Component | ||
| 22 | +public class RevenueLoader { | ||
| 23 | + | ||
| 24 | + static Logger logger = LoggerFactory.getLogger(RevenueLoader.class); | ||
| 25 | + | ||
| 26 | + static String url; | ||
| 27 | + static List<Map<String, Object>> list; | ||
| 28 | + static CloseableHttpClient httpClient = null; | ||
| 29 | + static HttpGet get; | ||
| 30 | + static RequestConfig requestConfig; | ||
| 31 | + static CloseableHttpResponse response; | ||
| 32 | + static HttpEntity entity; | ||
| 33 | + static BufferedReader br; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 从票务系统获取营收 | ||
| 37 | + * @param date | ||
| 38 | + * @param gsBm | ||
| 39 | + * @return | ||
| 40 | + */ | ||
| 41 | + public static List<Map<String, Object>> load(String date, String gsBm){ | ||
| 42 | + try { | ||
| 43 | + url = ConfigUtil.get("http.ticketing.interface") + "?txnType=getLineRevenue&busiDate="+date+"&companyCode="+gsBm; | ||
| 44 | + list = new ArrayList<>(); | ||
| 45 | + httpClient = HttpClients.createDefault(); | ||
| 46 | + get = new HttpGet(url); | ||
| 47 | + requestConfig = RequestConfig.custom() | ||
| 48 | + .setConnectTimeout(2500).setConnectionRequestTimeout(2000) | ||
| 49 | + .setSocketTimeout(2500).build(); | ||
| 50 | + get.setConfig(requestConfig); | ||
| 51 | + if(list.size() > 0) | ||
| 52 | + list.clear(); | ||
| 53 | + logger.info("load start..."); | ||
| 54 | + response = httpClient.execute(get); | ||
| 55 | + entity = response.getEntity(); | ||
| 56 | + if(null == entity) | ||
| 57 | + return list; | ||
| 58 | + | ||
| 59 | + br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 60 | + StringBuilder sb = new StringBuilder(); | ||
| 61 | + String str; | ||
| 62 | + while ((str = br.readLine()) != null) | ||
| 63 | + sb.append(str); | ||
| 64 | + | ||
| 65 | + Map<String, Object> parseObj = JSON.parseObject(sb.toString(), Map.class); | ||
| 66 | + if(parseObj.get("status") != null && "SUCCESS".equals(parseObj.get("status").toString())){ | ||
| 67 | + for(Map<String, Object> m : (List<Map<String, Object>>) parseObj.get("respData")){ | ||
| 68 | + list.add(m); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + logger.info("load end ! size: " + list.size()); | ||
| 73 | + | ||
| 74 | + if (null != response) | ||
| 75 | + response.close(); | ||
| 76 | + } catch (Exception e) { | ||
| 77 | + logger.error("", e); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + return list; | ||
| 81 | + } | ||
| 82 | +} |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -3179,13 +3179,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3179,13 +3179,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3179 | sdfSimple = new SimpleDateFormat("yyyyMMdd"); | 3179 | sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 3180 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | 3180 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| 3181 | Map<String, Object> m = new HashMap<String, Object>(); | 3181 | Map<String, Object> m = new HashMap<String, Object>(); |
| 3182 | - m.put("date", date); | ||
| 3183 | ReportUtils ee = new ReportUtils(); | 3182 | ReportUtils ee = new ReportUtils(); |
| 3184 | try { | 3183 | try { |
| 3185 | String dateTime = ""; | 3184 | String dateTime = ""; |
| 3186 | if (date.equals(date2)) { | 3185 | if (date.equals(date2)) { |
| 3186 | + m.put("date", date); | ||
| 3187 | dateTime = sdfSimple.format(sdfMonth.parse(date)); | 3187 | dateTime = sdfSimple.format(sdfMonth.parse(date)); |
| 3188 | } else { | 3188 | } else { |
| 3189 | + m.put("date", date + "至" + date2); | ||
| 3189 | dateTime = sdfSimple.format(sdfMonth.parse(date)) | 3190 | dateTime = sdfSimple.format(sdfMonth.parse(date)) |
| 3190 | + "-" + sdfSimple.format(sdfMonth.parse(date2)); | 3191 | + "-" + sdfSimple.format(sdfMonth.parse(date2)); |
| 3191 | } | 3192 | } |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| @@ -2542,11 +2542,11 @@ public class ReportServiceImpl implements ReportService{ | @@ -2542,11 +2542,11 @@ public class ReportServiceImpl implements ReportService{ | ||
| 2542 | for (Map<String, Object> m : listAll) { | 2542 | for (Map<String, Object> m : listAll) { |
| 2543 | if(m.get("xl") != null && m.get("xl").toString().trim().length() > 0){ | 2543 | if(m.get("xl") != null && m.get("xl").toString().trim().length() > 0){ |
| 2544 | if(nature.equals("1")){ | 2544 | if(nature.equals("1")){ |
| 2545 | - if(lineMap.get(m.get("xl").toString())){ | 2545 | + if(lineMap.containsKey(m.get("xl").toString())){ |
| 2546 | list.add(m); | 2546 | list.add(m); |
| 2547 | } | 2547 | } |
| 2548 | }else{ | 2548 | }else{ |
| 2549 | - if(!lineMap.get(m.get("xl").toString())){ | 2549 | + if(!lineMap.containsKey(m.get("xl").toString())){ |
| 2550 | list.add(m); | 2550 | list.add(m); |
| 2551 | } | 2551 | } |
| 2552 | } | 2552 | } |
| @@ -2699,14 +2699,15 @@ public class ReportServiceImpl implements ReportService{ | @@ -2699,14 +2699,15 @@ public class ReportServiceImpl implements ReportService{ | ||
| 2699 | sdfSimple = new SimpleDateFormat("yyyyMMdd"); | 2699 | sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 2700 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | 2700 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| 2701 | Map<String, Object> m = new HashMap<String, Object>(); | 2701 | Map<String, Object> m = new HashMap<String, Object>(); |
| 2702 | - m.put("date", date); | ||
| 2703 | String xls="countMileageSum.xls"; | 2702 | String xls="countMileageSum.xls"; |
| 2704 | ReportUtils ee = new ReportUtils(); | 2703 | ReportUtils ee = new ReportUtils(); |
| 2705 | try { | 2704 | try { |
| 2706 | String dateTime = ""; | 2705 | String dateTime = ""; |
| 2707 | if(date.equals(date2)){ | 2706 | if(date.equals(date2)){ |
| 2707 | + m.put("date", date); | ||
| 2708 | dateTime = sdfSimple.format(sdfMonth.parse(date)); | 2708 | dateTime = sdfSimple.format(sdfMonth.parse(date)); |
| 2709 | } else { | 2709 | } else { |
| 2710 | + m.put("date", date + "至" + date2); | ||
| 2710 | dateTime = sdfSimple.format(sdfMonth.parse(date)) | 2711 | dateTime = sdfSimple.format(sdfMonth.parse(date)) |
| 2711 | +"-"+sdfSimple.format(sdfMonth.parse(date2)); | 2712 | +"-"+sdfSimple.format(sdfMonth.parse(date2)); |
| 2712 | } | 2713 | } |
src/main/resources/application-dev.properties
| @@ -45,5 +45,7 @@ http.gps.real.url= http://114.80.178.12:18080/transport_server/rtgps/ | @@ -45,5 +45,7 @@ http.gps.real.url= http://114.80.178.12:18080/transport_server/rtgps/ | ||
| 45 | http.send.directive = http://192.168.168.201:9090/transport_server/message/ | 45 | http.send.directive = http://192.168.168.201:9090/transport_server/message/ |
| 46 | ## rfid data | 46 | ## rfid data |
| 47 | http.rfid.url= http://114.80.178.12:29000/rfid | 47 | http.rfid.url= http://114.80.178.12:29000/rfid |
| 48 | +## http ticketing interface | ||
| 49 | +http.ticketing.interface= http://112.64.187.3:1080/gjService/request | ||
| 48 | ## first last generate | 50 | ## first last generate |
| 49 | ms.fl.generate=true | 51 | ms.fl.generate=true |
| 50 | \ No newline at end of file | 52 | \ No newline at end of file |
src/main/resources/application-prod.properties
| 1 | -server.port=9088 | ||
| 2 | - | ||
| 3 | -# dubbo����ʹ�ÿ���flag | ||
| 4 | -dubbo.use=false | ||
| 5 | - | ||
| 6 | -#JPA | ||
| 7 | -spring.jpa.hibernate.ddl-auto= none | ||
| 8 | -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 9 | -spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 10 | -spring.jpa.database= MYSQL | ||
| 11 | -spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 12 | -spring.jpa.show-sql= true | ||
| 13 | - | ||
| 14 | -#DATABASE | ||
| 15 | -spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 16 | -spring.datasource.url= jdbc:mysql://10.10.200.121:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai | ||
| 17 | -spring.datasource.username= root | ||
| 18 | -spring.datasource.password= root2jsp | ||
| 19 | -spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 20 | - | ||
| 21 | -#DATASOURCE SETTING | ||
| 22 | -spring.datasource.hikari.minimum-idle= 8 | ||
| 23 | -spring.datasource.hikari.maximum-pool-size= 100 | ||
| 24 | -#spring.datasource.hikari.auto-commit= true | ||
| 25 | -spring.datasource.hikari.idle-timeout= 60000 | ||
| 26 | -#spring.datasource.hikari.pool-name= HikariPool | ||
| 27 | -spring.datasource.hikari.max-lifetime= 1800000 | ||
| 28 | -spring.datasource.hikari.connection-timeout= 3000 | ||
| 29 | -spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 30 | -spring.datasource.hikari.validation-timeout= 3000 | ||
| 31 | -spring.datasource.hikari.register-mbeans=true | ||
| 32 | - | ||
| 33 | -## gps client data | ||
| 34 | -http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all | ||
| 35 | -## gateway real data | ||
| 36 | -http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/ | ||
| 37 | -## gateway send directive | ||
| 38 | -http.send.directive= http://10.10.200.79:8080/transport_server/message/ | ||
| 39 | -## rfid data | ||
| 40 | -http.rfid.url= http://10.10.200.82:9000/rfid | ||
| 41 | -## wxsb | ||
| 42 | -#http.report.url.05= http://192.168.168.154:8088/ygjwsystem_j2ee/clbx/clbx_dd.do | ||
| 43 | -#http.report.url.22= http://192.168.168.154:8088/jgjwsystem_j2ee/clbx/clbx_dd.do | ||
| 44 | -#http.report.url.26= http://192.168.168.154:8088/nhjwsystem_j2ee/clbx/clbx_dd.do | ||
| 45 | -#http.report.url.55= http://192.168.168.154:8088/snjwsystem_j2ee/clbx/clbx_dd.do | ||
| 46 | -http.report.url.05= http://116.228.197.222:8081/ygjwsystem_j2ee/clbx/clbx_dd.do | ||
| 47 | -http.report.url.22= http://116.247.73.122:9098/jgjwsystem_j2ee/clbx/clbx_dd.do | ||
| 48 | -http.report.url.26= http://116.236.141.34:8088/nhjwsystem_j2ee/clbx/clbx_dd.do | ||
| 49 | -http.report.url.55= http://180.168.216.248:8088/snjwsystem_j2ee/clbx/clbx_dd.do | ||
| 50 | -## first last generate | 1 | +server.port=9088 |
| 2 | + | ||
| 3 | +# dubbo����ʹ�ÿ���flag | ||
| 4 | +dubbo.use=false | ||
| 5 | + | ||
| 6 | +#JPA | ||
| 7 | +spring.jpa.hibernate.ddl-auto= none | ||
| 8 | +spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 9 | +spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 10 | +spring.jpa.database= MYSQL | ||
| 11 | +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 12 | +spring.jpa.show-sql= true | ||
| 13 | + | ||
| 14 | +#DATABASE | ||
| 15 | +spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 16 | +spring.datasource.url= jdbc:mysql://10.10.200.121:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai | ||
| 17 | +spring.datasource.username= root | ||
| 18 | +spring.datasource.password= root2jsp | ||
| 19 | +spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 20 | + | ||
| 21 | +#DATASOURCE SETTING | ||
| 22 | +spring.datasource.hikari.minimum-idle= 8 | ||
| 23 | +spring.datasource.hikari.maximum-pool-size= 100 | ||
| 24 | +#spring.datasource.hikari.auto-commit= true | ||
| 25 | +spring.datasource.hikari.idle-timeout= 60000 | ||
| 26 | +#spring.datasource.hikari.pool-name= HikariPool | ||
| 27 | +spring.datasource.hikari.max-lifetime= 1800000 | ||
| 28 | +spring.datasource.hikari.connection-timeout= 3000 | ||
| 29 | +spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 30 | +spring.datasource.hikari.validation-timeout= 3000 | ||
| 31 | +spring.datasource.hikari.register-mbeans=true | ||
| 32 | + | ||
| 33 | +## gps client data | ||
| 34 | +http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all | ||
| 35 | +## gateway real data | ||
| 36 | +http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/ | ||
| 37 | +## gateway send directive | ||
| 38 | +http.send.directive= http://10.10.200.79:8080/transport_server/message/ | ||
| 39 | +## rfid data | ||
| 40 | +http.rfid.url= http://10.10.200.82:9000/rfid | ||
| 41 | +## wxsb | ||
| 42 | +#http.report.url.05= http://192.168.168.154:8088/ygjwsystem_j2ee/clbx/clbx_dd.do | ||
| 43 | +#http.report.url.22= http://192.168.168.154:8088/jgjwsystem_j2ee/clbx/clbx_dd.do | ||
| 44 | +#http.report.url.26= http://192.168.168.154:8088/nhjwsystem_j2ee/clbx/clbx_dd.do | ||
| 45 | +#http.report.url.55= http://192.168.168.154:8088/snjwsystem_j2ee/clbx/clbx_dd.do | ||
| 46 | +http.report.url.05= http://116.228.197.222:8081/ygjwsystem_j2ee/clbx/clbx_dd.do | ||
| 47 | +http.report.url.22= http://116.247.73.122:9098/jgjwsystem_j2ee/clbx/clbx_dd.do | ||
| 48 | +http.report.url.26= http://116.236.141.34:8088/nhjwsystem_j2ee/clbx/clbx_dd.do | ||
| 49 | +http.report.url.55= http://180.168.216.248:8088/snjwsystem_j2ee/clbx/clbx_dd.do | ||
| 50 | +## http ticketing interface | ||
| 51 | +http.ticketing.interface= http://112.64.187.3:1080/gjService/request | ||
| 52 | +## first last generate | ||
| 51 | ms.fl.generate=true | 53 | ms.fl.generate=true |
| 52 | \ No newline at end of file | 54 | \ No newline at end of file |
src/main/resources/application-test.properties
| 1 | -server.port=9088 | ||
| 2 | - | ||
| 3 | -# dubbo����ʹ�ÿ���flag | ||
| 4 | -dubbo.use=false | ||
| 5 | - | ||
| 6 | -#JPA | ||
| 7 | -spring.jpa.hibernate.ddl-auto= none | ||
| 8 | -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 9 | -spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 10 | -spring.jpa.database= MYSQL | ||
| 11 | -spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 12 | -spring.jpa.show-sql= false | ||
| 13 | - | ||
| 14 | -#DATABASE | ||
| 15 | -spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 16 | -spring.datasource.url= jdbc:mysql://10.10.200.148:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 17 | -spring.datasource.username= root | ||
| 18 | -spring.datasource.password= root | ||
| 19 | -spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 20 | - | ||
| 21 | -#DATASOURCE SETTING | ||
| 22 | -spring.datasource.hikari.minimum-idle= 8 | ||
| 23 | -spring.datasource.hikari.maximum-pool-size= 100 | ||
| 24 | -#spring.datasource.hikari.auto-commit= true | ||
| 25 | -spring.datasource.hikari.idle-timeout= 60000 | ||
| 26 | -#spring.datasource.hikari.pool-name= HikariPool | ||
| 27 | -spring.datasource.hikari.max-lifetime= 1800000 | ||
| 28 | -spring.datasource.hikari.connection-timeout= 3000 | ||
| 29 | -spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 30 | -spring.datasource.hikari.validation-timeout= 3000 | ||
| 31 | -spring.datasource.hikari.register-mbeans=true | ||
| 32 | - | ||
| 33 | -## gps client data | ||
| 34 | -http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all | ||
| 35 | -## gateway real data | ||
| 36 | -http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/ | ||
| 37 | -## gateway send directive | ||
| 38 | -#http.send.directive = http://10.10.200.79:8080/transport_server/message/ | ||
| 39 | -## rfid data | ||
| 40 | -http.rfid.url= http://10.10.200.82:9000/rfid | ||
| 41 | -## first last generate | 1 | +server.port=9088 |
| 2 | + | ||
| 3 | +# dubbo����ʹ�ÿ���flag | ||
| 4 | +dubbo.use=false | ||
| 5 | + | ||
| 6 | +#JPA | ||
| 7 | +spring.jpa.hibernate.ddl-auto= none | ||
| 8 | +spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 9 | +spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 10 | +spring.jpa.database= MYSQL | ||
| 11 | +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 12 | +spring.jpa.show-sql= false | ||
| 13 | + | ||
| 14 | +#DATABASE | ||
| 15 | +spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 16 | +spring.datasource.url= jdbc:mysql://10.10.200.148:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 17 | +spring.datasource.username= root | ||
| 18 | +spring.datasource.password= root | ||
| 19 | +spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 20 | + | ||
| 21 | +#DATASOURCE SETTING | ||
| 22 | +spring.datasource.hikari.minimum-idle= 8 | ||
| 23 | +spring.datasource.hikari.maximum-pool-size= 100 | ||
| 24 | +#spring.datasource.hikari.auto-commit= true | ||
| 25 | +spring.datasource.hikari.idle-timeout= 60000 | ||
| 26 | +#spring.datasource.hikari.pool-name= HikariPool | ||
| 27 | +spring.datasource.hikari.max-lifetime= 1800000 | ||
| 28 | +spring.datasource.hikari.connection-timeout= 3000 | ||
| 29 | +spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 30 | +spring.datasource.hikari.validation-timeout= 3000 | ||
| 31 | +spring.datasource.hikari.register-mbeans=true | ||
| 32 | + | ||
| 33 | +## gps client data | ||
| 34 | +http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all | ||
| 35 | +## gateway real data | ||
| 36 | +http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/ | ||
| 37 | +## gateway send directive | ||
| 38 | +#http.send.directive = http://10.10.200.79:8080/transport_server/message/ | ||
| 39 | +## rfid data | ||
| 40 | +http.rfid.url= http://10.10.200.82:9000/rfid | ||
| 41 | +## http ticketing interface | ||
| 42 | +http.ticketing.interface= http://112.64.187.3:1080/gjService/request | ||
| 43 | +## first last generate | ||
| 42 | ms.fl.generate=false | 44 | ms.fl.generate=false |
| 43 | \ No newline at end of file | 45 | \ No newline at end of file |
src/main/resources/static/pages/forms/budget/budgetAmounts.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 class="form-group"> | ||
| 44 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 45 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 46 | + </div> | ||
| 47 | + </form> | ||
| 48 | + </div> | ||
| 49 | + <div class="portlet-body"> | ||
| 50 | + <label>单位:万</label> | ||
| 51 | + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 52 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 53 | + <thead style="text-align: center;"> | ||
| 54 | + <tr> | ||
| 55 | + <th colspan="30"><label id="datetodate"></label> 预算营收明细表</th> | ||
| 56 | + </tr> | ||
| 57 | + <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> | ||
| 80 | + </tr> | ||
| 81 | + | ||
| 82 | + </thead> | ||
| 83 | + <tbody class="budget_amounts"> | ||
| 84 | + | ||
| 85 | + </tbody> | ||
| 86 | + </table> | ||
| 87 | + </div> | ||
| 88 | + </div> | ||
| 89 | + <div class="portlet-body table-container hidden" id="datas_hidden" | ||
| 90 | + style="margin-top: 30px;overflow:auto;min-width: 906px;"> | ||
| 91 | + <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span> | ||
| 92 | + <span class="item-label" style="width: 80px;margin-left: 60px;">年份: </span> | ||
| 93 | + <span class="item-label" style="width: 80px;" id="year0"></span> | ||
| 94 | + <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span> | ||
| 95 | + <span class="item-label" style="width: 80px;" id="gsName0"></span> | ||
| 96 | + <span class="item-label" style="width: 80px;margin-left: 60px;">明细: </span> | ||
| 97 | + <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> | ||
| 100 | + <table class="table table-bordered table-hover table-checkable"> | ||
| 101 | + <thead style="text-align: center;"> | ||
| 102 | + <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> | ||
| 124 | + </tr> | ||
| 125 | + </thead> | ||
| 126 | + <tbody class="budget_amounts_dataList" id="datas"> | ||
| 127 | + | ||
| 128 | + </tbody> | ||
| 129 | + </table> | ||
| 130 | + </div> | ||
| 131 | + </div> | ||
| 132 | + </div> | ||
| 133 | +</div> | ||
| 134 | + | ||
| 135 | +<script> | ||
| 136 | + $(function(){ | ||
| 137 | +// $('#export').attr('disabled', "true"); | ||
| 138 | + | ||
| 139 | + // 关闭左侧栏 | ||
| 140 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 141 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 142 | + | ||
| 143 | + $("#countLine").height($(window).height()-280); | ||
| 144 | + | ||
| 145 | + $("#date").datetimepicker({ | ||
| 146 | + format : 'YYYY', | ||
| 147 | + locale : 'zh-cn' | ||
| 148 | + }); | ||
| 149 | + | ||
| 150 | + var d = new Date(); | ||
| 151 | + var year = d.getFullYear(); | ||
| 152 | + $("#date").val(year); | ||
| 153 | + | ||
| 154 | + var date = ""; | ||
| 155 | + var nature = ""; | ||
| 156 | + var resList; | ||
| 157 | + $("#query").on("click",function(){ | ||
| 158 | + $("#countLine").height($(window).height()-280); | ||
| 159 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 160 | + layer.msg("请选择年份!"); | ||
| 161 | + return; | ||
| 162 | + } | ||
| 163 | + date = $("#date").val(); | ||
| 164 | + var params = {}; | ||
| 165 | + params['year'] = date; | ||
| 166 | + params['type'] = "query"; | ||
| 167 | + var i = layer.load(2); | ||
| 168 | + $post('/budget/budgetAmounts',params,function(result){ | ||
| 169 | + layer.close(i); | ||
| 170 | + // 把数据填充到模版中 | ||
| 171 | + var tbodyHtml = template('budget_amounts',{list:result}); | ||
| 172 | + // 把渲染好的模版html文本追加到表格中 | ||
| 173 | + $('#forms .budget_amounts').html(tbodyHtml); | ||
| 174 | + | ||
| 175 | + $("#datetodate").html(date); | ||
| 176 | + | ||
| 177 | + if(result.length == 0) | ||
| 178 | + $("#export").attr('disabled',"true"); | ||
| 179 | + else | ||
| 180 | + $("#export").removeAttr("disabled"); | ||
| 181 | + | ||
| 182 | + $("#datas_hidden").addClass("hidden"); | ||
| 183 | + resList = result; | ||
| 184 | + }); | ||
| 185 | + }); | ||
| 186 | + | ||
| 187 | + $("#forms tbody").on("click", "a", function(){ | ||
| 188 | + var key = $(this).data("key"); | ||
| 189 | + $.each(resList, function(i, g){ | ||
| 190 | + if(key == g.key){ | ||
| 191 | + var dataList = g.dataList; | ||
| 192 | + var tbodyHtml = template('budget_amounts_dataList', {list:dataList}); | ||
| 193 | + $("#datas_hidden").removeClass("hidden"); | ||
| 194 | + $("#datas_hidden").height($(window).height()-280); | ||
| 195 | + $("#year0").html(g.year); | ||
| 196 | + $("#gsName0").html(g.gsName); | ||
| 197 | + $("#type0").html(g.type); | ||
| 198 | + $("#item0").html(g.item); | ||
| 199 | + $("#datas").html(tbodyHtml); | ||
| 200 | + } | ||
| 201 | + }); | ||
| 202 | + $("html,body").animate({scrollTop:$("#datas").offset().top},700); | ||
| 203 | + }); | ||
| 204 | + | ||
| 205 | + $("#export").on("click",function(){ | ||
| 206 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 207 | + layer.msg("请选择年份!"); | ||
| 208 | + return; | ||
| 209 | + } | ||
| 210 | + date = $("#date").val(); | ||
| 211 | + var params = {}; | ||
| 212 | + params['year'] = date; | ||
| 213 | + params['type'] = "export"; | ||
| 214 | + var i = layer.load(2); | ||
| 215 | + $post('/budget/budgetAmounts',params,function(result){ | ||
| 216 | + window.open("/downloadFile/download?fileName=" | ||
| 217 | + +date+"-预算营收明细表"); | ||
| 218 | + layer.close(i); | ||
| 219 | + }); | ||
| 220 | + }); | ||
| 221 | + }); | ||
| 222 | +</script> | ||
| 223 | +<script type="text/html" id="budget_amounts"> | ||
| 224 | + {{each list as obj i}} | ||
| 225 | + <tr style='{{if obj.type=='全部线路'}}background-color: #b9d6fb;{{/if}}'> | ||
| 226 | + <td>{{obj.gsName}}</td> | ||
| 227 | + {{if obj.item==''}} | ||
| 228 | + <td><a data-key="{{obj.key}}">{{obj.type}}</a></td> | ||
| 229 | + <td>{{obj.item}}</td> | ||
| 230 | + {{else}} | ||
| 231 | + <td>{{obj.type}}</td> | ||
| 232 | + <td><a data-key="{{obj.key}}">{{obj.item}}</a></td> | ||
| 233 | + {{/if}} | ||
| 234 | + <td>{{obj.budget}}</td> | ||
| 235 | + <td>{{obj.change}}</td> | ||
| 236 | + <td>{{obj.formal}}</td> | ||
| 237 | + <td>{{obj.mon1}}</td> | ||
| 238 | + <td>{{obj.mon2}}</td> | ||
| 239 | + <td>{{obj.mon3}}</td> | ||
| 240 | + <td>{{obj.mon4}}</td> | ||
| 241 | + <td>{{obj.mon5}}</td> | ||
| 242 | + <td>{{obj.mon6}}</td> | ||
| 243 | + <td>{{obj.mon7}}</td> | ||
| 244 | + <td>{{obj.mon8}}</td> | ||
| 245 | + <td>{{obj.mon9}}</td> | ||
| 246 | + <td>{{obj.mon10}}</td> | ||
| 247 | + <td>{{obj.mon11}}</td> | ||
| 248 | + <td>{{obj.mon12}}</td> | ||
| 249 | + <td>{{obj.monAll}}</td> | ||
| 250 | + <td>{{obj.complete}}</td> | ||
| 251 | + <td>{{obj.diff}}</td> | ||
| 252 | + <td>{{obj.average}}</td> | ||
| 253 | + </tr> | ||
| 254 | + {{/each}} | ||
| 255 | + {{if list.length == 0}} | ||
| 256 | + <tr> | ||
| 257 | + <td colspan="22"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 258 | + </tr> | ||
| 259 | + {{/if}} | ||
| 260 | +</script> | ||
| 261 | +<script type="text/html" id="budget_amounts_dataList"> | ||
| 262 | + {{each list as obj i}} | ||
| 263 | + <tr> | ||
| 264 | + <td>{{obj.gsName}}</td> | ||
| 265 | + <td>{{obj.xlName}}</td> | ||
| 266 | + <td>{{obj.budget}}</td> | ||
| 267 | + <td>{{obj.change}}</td> | ||
| 268 | + <td>{{obj.formal}}</td> | ||
| 269 | + <td>{{obj.mon1}}</td> | ||
| 270 | + <td>{{obj.mon2}}</td> | ||
| 271 | + <td>{{obj.mon3}}</td> | ||
| 272 | + <td>{{obj.mon4}}</td> | ||
| 273 | + <td>{{obj.mon5}}</td> | ||
| 274 | + <td>{{obj.mon6}}</td> | ||
| 275 | + <td>{{obj.mon7}}</td> | ||
| 276 | + <td>{{obj.mon8}}</td> | ||
| 277 | + <td>{{obj.mon9}}</td> | ||
| 278 | + <td>{{obj.mon10}}</td> | ||
| 279 | + <td>{{obj.mon11}}</td> | ||
| 280 | + <td>{{obj.mon12}}</td> | ||
| 281 | + <td>{{obj.monAll}}</td> | ||
| 282 | + <td>{{obj.complete}}</td> | ||
| 283 | + <td>{{obj.diff}}</td> | ||
| 284 | + <td>{{obj.average}}</td> | ||
| 285 | + </tr> | ||
| 286 | + {{/each}} | ||
| 287 | + {{if list.length == 0}} | ||
| 288 | + <tr> | ||
| 289 | + <td colspan="21"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 290 | + </tr> | ||
| 291 | + {{/if}} | ||
| 292 | +</script> | ||
| 0 | \ No newline at end of file | 293 | \ No newline at end of file |
src/main/resources/static/pages/forms/budget/budgetList.html
0 → 100644
| 1 | +<div class="page-head"> | ||
| 2 | + <div class="page-title"> | ||
| 3 | + <h1>预算录入</h1> | ||
| 4 | + </div> | ||
| 5 | +</div> | ||
| 6 | + | ||
| 7 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 8 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 9 | + <li><span class="active">预算管理</span> <i class="fa fa-circle"></i></li> | ||
| 10 | + <li><span class="active">预算录入</span></li> | ||
| 11 | +</ul> | ||
| 12 | + | ||
| 13 | +<div class="row"> | ||
| 14 | + <div class="col-md-12"> | ||
| 15 | + <!-- Begin: life time stats --> | ||
| 16 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | ||
| 17 | + <div class="portlet-title"> | ||
| 18 | + <div class="caption"> | ||
| 19 | + <i class="fa fa-users font-dark"></i> <span | ||
| 20 | + class="caption-subject font-dark sbold uppercase">年预算表</span> | ||
| 21 | + </div> | ||
| 22 | +<!-- <div class="actions"> --> | ||
| 23 | +<!-- <a class="btn btn-circle blue" href="cdlAdd.html" data-pjax><i class="fa fa-plus"></i> 添加</a> --> | ||
| 24 | +<!-- </div> --> | ||
| 25 | + <div class="actions"> | ||
| 26 | + <button type="button" class="btn btn-circle blue" id="upload"><i class="fa fa-file-excel-o"></i> | ||
| 27 | + 导入Excel | ||
| 28 | + </button> | ||
| 29 | + <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> | ||
| 30 | + 删除 | ||
| 31 | + </button> | ||
| 32 | + <button type="button" class="btn btn-circle blue" id="updateRevenue"><i class="fa fa-hourglass-half"></i> | ||
| 33 | + 获取人次营收 | ||
| 34 | + </button> | ||
| 35 | + </div> | ||
| 36 | + </div> | ||
| 37 | + <div class="portlet-body"> | ||
| 38 | + <div class="table-container" style="margin-top: 10px"> | ||
| 39 | + <table | ||
| 40 | + class="table table-striped table-bordered table-hover table-checkable" | ||
| 41 | + id="datatable_budget" style="text-align: center;"> | ||
| 42 | + <thead> | ||
| 43 | + <tr role="row" class="heading"> | ||
| 44 | + <th width="3%">#</th> | ||
| 45 | + <th width="10%" style="text-align: center;">年份</th> | ||
| 46 | + <th width="13%" style="text-align: center;">公司</th> | ||
| 47 | +<!-- <th width="14%" style="text-align: center;">分公司</th> --> | ||
| 48 | + <th width="14%" style="text-align: center;">线路</th> | ||
| 49 | + <th width="18%" style="text-align: center;" colspan="2">公里 (万公里)</th> | ||
| 50 | + <th width="18%" style="text-align: center;" colspan="2">人次 (万人次)</th> | ||
| 51 | + <th width="18%" style="text-align: center;" colspan="2">营收 (万元)</th> | ||
| 52 | + <th width="6%" style="text-align: center;">操作</th> | ||
| 53 | + </tr> | ||
| 54 | + <tr role="row" class="filter"> | ||
| 55 | + <td></td> | ||
| 56 | + <td style="padding: 8px;"> | ||
| 57 | + <input class="form-control" type="text" name="year" id="year" /> | ||
| 58 | + </td> | ||
| 59 | + <td> | ||
| 60 | + <select class="form-control" name="gsBm_like" id="budListGsdmId" ></select> | ||
| 61 | + </td> | ||
| 62 | +<!-- <td> --> | ||
| 63 | +<!-- <select class="form-control" name="fgsBm_like" id="budListFgsdmId" ></select> --> | ||
| 64 | +<!-- </td> --> | ||
| 65 | + <td> | ||
| 66 | + <select class="form-control form-filter input-sm" name="xlBm_like" id="line"></select> | ||
| 67 | + </td> | ||
| 68 | + <td>预算</td><td>调整</td> | ||
| 69 | + <td>预算</td><td>调整</td> | ||
| 70 | + <td>预算</td><td>调整</td> | ||
| 71 | + <td> | ||
| 72 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" > | ||
| 73 | + <i class="fa fa-search"></i> 搜索</button> | ||
| 74 | + | ||
| 75 | +<!-- <button class="btn btn-sm red btn-outline filter-cancel"> --> | ||
| 76 | +<!-- <i class="fa fa-times"></i> 重置</button> --> | ||
| 77 | + </td> | ||
| 78 | + </tr> | ||
| 79 | + </thead> | ||
| 80 | + <tbody></tbody> | ||
| 81 | + </table> | ||
| 82 | + <div style="text-align: right;"> | ||
| 83 | + <ul id="pagination" class="pagination"></ul> | ||
| 84 | + </div> | ||
| 85 | + </div> | ||
| 86 | + </div> | ||
| 87 | + </div> | ||
| 88 | + </div> | ||
| 89 | +</div> | ||
| 90 | + | ||
| 91 | +<script src="/assets/js/ajaxfileupload/ajaxfileupload.js"></script> | ||
| 92 | + | ||
| 93 | +<script> | ||
| 94 | +$(function(){ | ||
| 95 | + var page = 0, initPagination; | ||
| 96 | + var icheckOptions = { | ||
| 97 | + checkboxClass: 'icheckbox_flat-blue', | ||
| 98 | + increaseArea: '20%' | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + var d = new Date(); | ||
| 102 | + var year = d.getFullYear(); | ||
| 103 | + $("#year").val(year); | ||
| 104 | + $("#year").datetimepicker({ | ||
| 105 | + format : 'YYYY', | ||
| 106 | + locale : 'zh-cn' | ||
| 107 | + }); | ||
| 108 | + | ||
| 109 | + | ||
| 110 | + $.get('/user/companyData', function(result){ | ||
| 111 | + obj = result; | ||
| 112 | + var options = '<option value="">全部公司</option>'; | ||
| 113 | + for(var i = 0; i < obj.length; i++){ | ||
| 114 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 115 | + } | ||
| 116 | + $('#budListGsdmId').html(options); | ||
| 117 | + updateCompany(); | ||
| 118 | + }); | ||
| 119 | + | ||
| 120 | + $("#budListGsdmId").on("change",updateCompany); | ||
| 121 | + function updateCompany(){ | ||
| 122 | + var company = $('#budListGsdmId').val(); | ||
| 123 | + var options = '<option value="">全部分公司</option>'; | ||
| 124 | + for(var i = 0; i < obj.length; i++){ | ||
| 125 | + if(obj[i].companyCode == company){ | ||
| 126 | + var children = obj[i].children; | ||
| 127 | + for(var j = 0; j < children.length; j++){ | ||
| 128 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + $('#budListFgsdmId').html(options); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + var tempData = {}; | ||
| 136 | + $.get('/report/lineList',function(xlList){ | ||
| 137 | + var data = []; | ||
| 138 | + data.push({id: " ", text: "全部线路"}); | ||
| 139 | + $.get('/user/companyData', function(result){ | ||
| 140 | + for(var i = 0; i < result.length; i++){ | ||
| 141 | + var companyCode = result[i].companyCode; | ||
| 142 | + var children = result[i].children; | ||
| 143 | + for(var j = 0; j < children.length; j++){ | ||
| 144 | + var code = children[j].code; | ||
| 145 | + for(var k=0;k < xlList.length;k++){ | ||
| 146 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 147 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 148 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | ||
| 149 | + } | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + initPinYinSelect2('#line',data,''); | ||
| 154 | + | ||
| 155 | + }); | ||
| 156 | + }); | ||
| 157 | + | ||
| 158 | + //重置 | ||
| 159 | + $('tr.filter .filter-cancel').on('click', function(){ | ||
| 160 | + $('tr.filter input, select').val('').change(); | ||
| 161 | + }); | ||
| 162 | + | ||
| 163 | + //提交 | ||
| 164 | + $('tr.filter .filter-submit').on('click', function(){ | ||
| 165 | + var year=$("#year").val(); | ||
| 166 | + var budGsdm=$("#budListGsdmId").val(); | ||
| 167 | + var budFgsdm=$("#budListFgsdmId").val(); | ||
| 168 | + if(year=="" ||year ==null){ | ||
| 169 | + layer.msg("请选择年份"); | ||
| 170 | + return; | ||
| 171 | + } | ||
| 172 | + var cells = $('tr.filter')[0].cells | ||
| 173 | + ,params = {} | ||
| 174 | + ,name; | ||
| 175 | + $.each(cells, function(i, cell){ | ||
| 176 | + var items = $('input,select', cell); | ||
| 177 | + for(var j = 0, item; item = items[j++];){ | ||
| 178 | + name = $(item).attr('name'); | ||
| 179 | + if(name){ | ||
| 180 | + console.log($(item)); | ||
| 181 | + params[name] = $(item).val().trim(); | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | + }); | ||
| 185 | + page = 0; | ||
| 186 | + jsDoQuery(params, true); | ||
| 187 | + }); | ||
| 188 | + | ||
| 189 | + | ||
| 190 | + | ||
| 191 | + /* | ||
| 192 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | ||
| 193 | + */ | ||
| 194 | + function jsDoQuery(p, pagination){ | ||
| 195 | + var params = {}; | ||
| 196 | + if(p){ | ||
| 197 | + params = p; | ||
| 198 | + } | ||
| 199 | + //更新时间排序 | ||
| 200 | + params['order'] = 'id'; | ||
| 201 | + params['direction'] = 'ASC'; | ||
| 202 | + params['page'] = page; | ||
| 203 | + var i = 2; | ||
| 204 | + $get('/budget' ,params, function(data){ | ||
| 205 | + $.each(data.content, function(i, obj) { | ||
| 206 | + obj.updatetime = moment(obj.updatetime).format("YYYY-MM-DD"); | ||
| 207 | + }); | ||
| 208 | + var bodyHtm = template('budget_list_temp', {list: data.content}); | ||
| 209 | + | ||
| 210 | + $('#datatable_budget tbody').html(bodyHtm) | ||
| 211 | + .find('.icheck').iCheck(icheckOptions) | ||
| 212 | + .on('ifChanged', iCheckChange); | ||
| 213 | + if(pagination && data.content.length > 0){ | ||
| 214 | + //重新分页 | ||
| 215 | + initPagination = true; | ||
| 216 | + showPagination(data); | ||
| 217 | + } | ||
| 218 | + layer.close(i); | ||
| 219 | + }); | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + function iCheckChange(){ | ||
| 223 | + var tr = $(this).parents('tr'); | ||
| 224 | + if(this.checked) | ||
| 225 | + tr.addClass('row-active'); | ||
| 226 | + else | ||
| 227 | + tr.removeClass('row-active'); | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + function showPagination(data){ | ||
| 231 | + //分页 | ||
| 232 | + $('#pagination').jqPaginator({ | ||
| 233 | + totalPages: data.totalPages, | ||
| 234 | + visiblePages: 6, | ||
| 235 | + currentPage: page + 1, | ||
| 236 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | ||
| 237 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | ||
| 238 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | ||
| 239 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | ||
| 240 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | ||
| 241 | + onPageChange: function (num, type) { | ||
| 242 | + if(initPagination){ | ||
| 243 | + initPagination = false; | ||
| 244 | + return; | ||
| 245 | + } | ||
| 246 | + page = num - 1; | ||
| 247 | + var cells = $('tr.filter')[0].cells | ||
| 248 | + ,params = {} | ||
| 249 | + ,name; | ||
| 250 | + $.each(cells, function(i, cell){ | ||
| 251 | + var items = $('input,select', cell); | ||
| 252 | + for(var j = 0, item; item = items[j++];){ | ||
| 253 | + name = $(item).attr('name'); | ||
| 254 | + if(name){ | ||
| 255 | + params[name] = $(item).val(); | ||
| 256 | + } | ||
| 257 | + } | ||
| 258 | + }); | ||
| 259 | + jsDoQuery(params, false); | ||
| 260 | + } | ||
| 261 | + }); | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + | ||
| 265 | + //导入 | ||
| 266 | + $("#upload").on("click", function(){ | ||
| 267 | + $.get('upload.html', function(m){$(pjaxContainer).append(m);}); | ||
| 268 | + }); | ||
| 269 | + | ||
| 270 | + | ||
| 271 | + //删除 | ||
| 272 | + $('#removeButton').on('click', function(){ | ||
| 273 | + if($(this).attr('disabled')) | ||
| 274 | + return; | ||
| 275 | + | ||
| 276 | + var idArray = []; | ||
| 277 | + var x=0; | ||
| 278 | + $('input.icheck:checked').each(function(){ | ||
| 279 | + x++; | ||
| 280 | + var map ={}; | ||
| 281 | + var id=$(this).data('id'); | ||
| 282 | + map['id']=id; | ||
| 283 | + idArray.push(map); | ||
| 284 | + }) | ||
| 285 | + var params = {}; | ||
| 286 | + params['ids']=JSON.stringify(idArray); | ||
| 287 | + if (x==0) { | ||
| 288 | + layer.msg("请选择要删除的数据"); | ||
| 289 | + }else{ | ||
| 290 | + if(confirm('确定要删除选中的数据?')){ | ||
| 291 | + var i = layer.load(2); | ||
| 292 | + $post('/budget/deleteIds', params, function (result) { | ||
| 293 | + layer.close(i); | ||
| 294 | + $('tr.filter .filter-submit').click(); | ||
| 295 | + }); | ||
| 296 | + } | ||
| 297 | + } | ||
| 298 | + }); | ||
| 299 | + | ||
| 300 | + | ||
| 301 | + //获取人次营收 | ||
| 302 | + $("#updateRevenue").on("click", function(){ | ||
| 303 | + $.get('updateRevenue.html', function(m){$(pjaxContainer).append(m);}); | ||
| 304 | + }); | ||
| 305 | +}); | ||
| 306 | +</script> | ||
| 307 | + | ||
| 308 | +<script id="budget_list_temp" type="text/html"> | ||
| 309 | +{{each list as obj i}} | ||
| 310 | +<tr> | ||
| 311 | + <td style="vertical-align: middle;"> | ||
| 312 | + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | ||
| 313 | + </td> | ||
| 314 | + <td> | ||
| 315 | + {{obj.year}} | ||
| 316 | + </td> | ||
| 317 | + <td> | ||
| 318 | + {{obj.gsName}} | ||
| 319 | + </td> | ||
| 320 | + <td> | ||
| 321 | + {{obj.xlName}} | ||
| 322 | + </td> | ||
| 323 | + <td> | ||
| 324 | + {{obj.budgetMileage}} | ||
| 325 | + </td> | ||
| 326 | + <td> | ||
| 327 | + {{obj.changeMileage}} | ||
| 328 | + </td> | ||
| 329 | + <td> | ||
| 330 | + {{obj.budgetPerson}} | ||
| 331 | + </td> | ||
| 332 | + <td> | ||
| 333 | + {{obj.changePerson}} | ||
| 334 | + </td> | ||
| 335 | + <td> | ||
| 336 | + {{obj.budgetAmounts}} | ||
| 337 | + </td> | ||
| 338 | + <td> | ||
| 339 | + {{obj.changeAmounts}} | ||
| 340 | + </td> | ||
| 341 | + <td> | ||
| 342 | + <!--<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>--> | ||
| 343 | + </td> | ||
| 344 | +</tr> | ||
| 345 | +{{/each}} | ||
| 346 | +{{if list.length == 0}} | ||
| 347 | +<tr> | ||
| 348 | + <td colspan=11><h6 class="muted">没有找到相关数据</h6></td> | ||
| 349 | +</tr> | ||
| 350 | +{{/if}} | ||
| 351 | +</script> | ||
| 0 | \ No newline at end of file | 352 | \ No newline at end of file |
src/main/resources/static/pages/forms/budget/budgetMileage.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 class="form-group"> | ||
| 44 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 45 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 46 | + </div> | ||
| 47 | + </form> | ||
| 48 | + </div> | ||
| 49 | + <div class="portlet-body"> | ||
| 50 | + <label>单位:万公里</label> | ||
| 51 | + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 52 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 53 | + <thead style="text-align: center;"> | ||
| 54 | + <tr> | ||
| 55 | + <th colspan="30"><label id="datetodate"></label> 预算公里明细表</th> | ||
| 56 | + </tr> | ||
| 57 | + <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 | + </tr> | ||
| 80 | + | ||
| 81 | + </thead> | ||
| 82 | + <tbody class="budget_mileage"> | ||
| 83 | + | ||
| 84 | + </tbody> | ||
| 85 | + </table> | ||
| 86 | + </div> | ||
| 87 | + </div> | ||
| 88 | + <div class="portlet-body table-container hidden" id="datas_hidden" | ||
| 89 | + style="margin-top: 30px;overflow:auto;min-width: 906px;"> | ||
| 90 | + <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span> | ||
| 91 | + <span class="item-label" style="width: 80px;margin-left: 60px;">年份: </span> | ||
| 92 | + <span class="item-label" style="width: 80px;" id="year0"></span> | ||
| 93 | + <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span> | ||
| 94 | + <span class="item-label" style="width: 80px;" id="gsName0"></span> | ||
| 95 | + <span class="item-label" style="width: 80px;margin-left: 60px;">明细: </span> | ||
| 96 | + <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> | ||
| 99 | + <table class="table table-bordered table-hover table-checkable"> | ||
| 100 | + <thead style="text-align: center;"> | ||
| 101 | + <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> | ||
| 122 | + </tr> | ||
| 123 | + </thead> | ||
| 124 | + <tbody class="budget_mileage_dataList" id="datas"> | ||
| 125 | + | ||
| 126 | + </tbody> | ||
| 127 | + </table> | ||
| 128 | + </div> | ||
| 129 | + </div> | ||
| 130 | + </div> | ||
| 131 | +</div> | ||
| 132 | + | ||
| 133 | +<script> | ||
| 134 | + $(function(){ | ||
| 135 | +// $('#export').attr('disabled', "true"); | ||
| 136 | + | ||
| 137 | + // 关闭左侧栏 | ||
| 138 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 139 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 140 | + | ||
| 141 | + $("#countLine").height($(window).height()-280); | ||
| 142 | + | ||
| 143 | + $("#date").datetimepicker({ | ||
| 144 | + format : 'YYYY', | ||
| 145 | + locale : 'zh-cn' | ||
| 146 | + }); | ||
| 147 | + | ||
| 148 | + var d = new Date(); | ||
| 149 | + var year = d.getFullYear(); | ||
| 150 | + $("#date").val(year); | ||
| 151 | + | ||
| 152 | + var date = ""; | ||
| 153 | + var nature = ""; | ||
| 154 | + var resList; | ||
| 155 | + $("#query").on("click",function(){ | ||
| 156 | + $("#countLine").height($(window).height()-280); | ||
| 157 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 158 | + layer.msg("请选择年份!"); | ||
| 159 | + return; | ||
| 160 | + } | ||
| 161 | + date = $("#date").val(); | ||
| 162 | + var params = {}; | ||
| 163 | + params['year'] = date; | ||
| 164 | + params['type'] = "query"; | ||
| 165 | + var i = layer.load(2); | ||
| 166 | + $post('/budget/budgetMileage',params,function(result){ | ||
| 167 | + layer.close(i); | ||
| 168 | + // 把数据填充到模版中 | ||
| 169 | + var tbodyHtml = template('budget_mileage',{list:result}); | ||
| 170 | + // 把渲染好的模版html文本追加到表格中 | ||
| 171 | + $('#forms .budget_mileage').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_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('budget_mileage_dataList', {list:dataList}); | ||
| 191 | + $("#datas_hidden").removeClass("hidden"); | ||
| 192 | + $("#datas_hidden").height($(window).height()-280); | ||
| 193 | + $("#year0").html(g.year); | ||
| 194 | + $("#gsName0").html(g.gsName); | ||
| 195 | + $("#type0").html(g.type); | ||
| 196 | + $("#item0").html(g.item); | ||
| 197 | + $("#datas").html(tbodyHtml); | ||
| 198 | + } | ||
| 199 | + }); | ||
| 200 | + $("html,body").animate({scrollTop:$("#datas").offset().top},700); | ||
| 201 | + }); | ||
| 202 | + | ||
| 203 | + $("#export").on("click",function(){ | ||
| 204 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 205 | + layer.msg("请选择年份!"); | ||
| 206 | + return; | ||
| 207 | + } | ||
| 208 | + date = $("#date").val(); | ||
| 209 | + var params = {}; | ||
| 210 | + params['year'] = date; | ||
| 211 | + params['type'] = "export"; | ||
| 212 | + var i = layer.load(2); | ||
| 213 | + $post('/budget/budgetMileage',params,function(result){ | ||
| 214 | + window.open("/downloadFile/download?fileName=" | ||
| 215 | + +date+"-预算公里明细表"); | ||
| 216 | + layer.close(i); | ||
| 217 | + }); | ||
| 218 | + }); | ||
| 219 | + }); | ||
| 220 | +</script> | ||
| 221 | +<script type="text/html" id="budget_mileage"> | ||
| 222 | + {{each list as obj i}} | ||
| 223 | + <tr style='{{if obj.type=='全部线路'}}background-color: #b9d6fb;{{/if}}'> | ||
| 224 | + <td>{{obj.gsName}}</td> | ||
| 225 | + {{if obj.item==''}} | ||
| 226 | + <td><a data-key="{{obj.key}}">{{obj.type}}</a></td> | ||
| 227 | + <td>{{obj.item}}</td> | ||
| 228 | + {{else}} | ||
| 229 | + <td>{{obj.type}}</td> | ||
| 230 | + <td><a data-key="{{obj.key}}">{{obj.item}}</a></td> | ||
| 231 | + {{/if}} | ||
| 232 | + <td>{{obj.budget}}</td> | ||
| 233 | + <td>{{obj.change}}</td> | ||
| 234 | + <td>{{obj.formal}}</td> | ||
| 235 | + <td>{{obj.mon1}}</td> | ||
| 236 | + <td>{{obj.mon2}}</td> | ||
| 237 | + <td>{{obj.mon3}}</td> | ||
| 238 | + <td>{{obj.mon4}}</td> | ||
| 239 | + <td>{{obj.mon5}}</td> | ||
| 240 | + <td>{{obj.mon6}}</td> | ||
| 241 | + <td>{{obj.mon7}}</td> | ||
| 242 | + <td>{{obj.mon8}}</td> | ||
| 243 | + <td>{{obj.mon9}}</td> | ||
| 244 | + <td>{{obj.mon10}}</td> | ||
| 245 | + <td>{{obj.mon11}}</td> | ||
| 246 | + <td>{{obj.mon12}}</td> | ||
| 247 | + <td>{{obj.monAll}}</td> | ||
| 248 | + <td>{{obj.complete}}</td> | ||
| 249 | + <td>{{obj.diff}}</td> | ||
| 250 | + </tr> | ||
| 251 | + {{/each}} | ||
| 252 | + {{if list.length == 0}} | ||
| 253 | + <tr> | ||
| 254 | + <td colspan="21"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 255 | + </tr> | ||
| 256 | + {{/if}} | ||
| 257 | +</script> | ||
| 258 | +<script type="text/html" id="budget_mileage_dataList"> | ||
| 259 | + {{each list as obj i}} | ||
| 260 | + <tr> | ||
| 261 | + <td>{{obj.gsName}}</td> | ||
| 262 | + <td>{{obj.xlName}}</td> | ||
| 263 | + <td>{{obj.budget}}</td> | ||
| 264 | + <td>{{obj.change}}</td> | ||
| 265 | + <td>{{obj.formal}}</td> | ||
| 266 | + <td>{{obj.mon1}}</td> | ||
| 267 | + <td>{{obj.mon2}}</td> | ||
| 268 | + <td>{{obj.mon3}}</td> | ||
| 269 | + <td>{{obj.mon4}}</td> | ||
| 270 | + <td>{{obj.mon5}}</td> | ||
| 271 | + <td>{{obj.mon6}}</td> | ||
| 272 | + <td>{{obj.mon7}}</td> | ||
| 273 | + <td>{{obj.mon8}}</td> | ||
| 274 | + <td>{{obj.mon9}}</td> | ||
| 275 | + <td>{{obj.mon10}}</td> | ||
| 276 | + <td>{{obj.mon11}}</td> | ||
| 277 | + <td>{{obj.mon12}}</td> | ||
| 278 | + <td>{{obj.monAll}}</td> | ||
| 279 | + <td>{{obj.complete}}</td> | ||
| 280 | + <td>{{obj.diff}}</td> | ||
| 281 | + </tr> | ||
| 282 | + {{/each}} | ||
| 283 | + {{if list.length == 0}} | ||
| 284 | + <tr> | ||
| 285 | + <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 286 | + </tr> | ||
| 287 | + {{/if}} | ||
| 288 | +</script> | ||
| 0 | \ No newline at end of file | 289 | \ No newline at end of file |
src/main/resources/static/pages/forms/budget/budgetPerson.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 class="form-group"> | ||
| 44 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 45 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 46 | + </div> | ||
| 47 | + </form> | ||
| 48 | + </div> | ||
| 49 | + <div class="portlet-body"> | ||
| 50 | + <label>单位:万人次</label> | ||
| 51 | + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 52 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 53 | + <thead style="text-align: center;"> | ||
| 54 | + <tr> | ||
| 55 | + <th colspan="30"><label id="datetodate"></label> 预算人次明细表</th> | ||
| 56 | + </tr> | ||
| 57 | + <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 | + </tr> | ||
| 80 | + | ||
| 81 | + </thead> | ||
| 82 | + <tbody class="budget_person"> | ||
| 83 | + | ||
| 84 | + </tbody> | ||
| 85 | + </table> | ||
| 86 | + </div> | ||
| 87 | + </div> | ||
| 88 | + <div class="portlet-body table-container hidden" id="datas_hidden" | ||
| 89 | + style="margin-top: 30px;overflow:auto;min-width: 906px;"> | ||
| 90 | + <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span> | ||
| 91 | + <span class="item-label" style="width: 80px;margin-left: 60px;">年份: </span> | ||
| 92 | + <span class="item-label" style="width: 80px;" id="year0"></span> | ||
| 93 | + <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span> | ||
| 94 | + <span class="item-label" style="width: 80px;" id="gsName0"></span> | ||
| 95 | + <span class="item-label" style="width: 80px;margin-left: 60px;">明细: </span> | ||
| 96 | + <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> | ||
| 99 | + <table class="table table-bordered table-hover table-checkable"> | ||
| 100 | + <thead style="text-align: center;"> | ||
| 101 | + <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> | ||
| 122 | + </tr> | ||
| 123 | + </thead> | ||
| 124 | + <tbody class="budget_person_dataList" id="datas"> | ||
| 125 | + | ||
| 126 | + </tbody> | ||
| 127 | + </table> | ||
| 128 | + </div> | ||
| 129 | + </div> | ||
| 130 | + </div> | ||
| 131 | +</div> | ||
| 132 | + | ||
| 133 | +<script> | ||
| 134 | + $(function(){ | ||
| 135 | +// $('#export').attr('disabled', "true"); | ||
| 136 | + | ||
| 137 | + // 关闭左侧栏 | ||
| 138 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 139 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 140 | + | ||
| 141 | + $("#countLine").height($(window).height()-280); | ||
| 142 | + | ||
| 143 | + $("#date").datetimepicker({ | ||
| 144 | + format : 'YYYY', | ||
| 145 | + locale : 'zh-cn' | ||
| 146 | + }); | ||
| 147 | + | ||
| 148 | + var d = new Date(); | ||
| 149 | + var year = d.getFullYear(); | ||
| 150 | + $("#date").val(year); | ||
| 151 | + | ||
| 152 | + var date = ""; | ||
| 153 | + var nature = ""; | ||
| 154 | + var resList; | ||
| 155 | + $("#query").on("click",function(){ | ||
| 156 | + $("#countLine").height($(window).height()-280); | ||
| 157 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 158 | + layer.msg("请选择年份!"); | ||
| 159 | + return; | ||
| 160 | + } | ||
| 161 | + date = $("#date").val(); | ||
| 162 | + var params = {}; | ||
| 163 | + params['year'] = date; | ||
| 164 | + params['type'] = "query"; | ||
| 165 | + var i = layer.load(2); | ||
| 166 | + $post('/budget/budgetPerson',params,function(result){ | ||
| 167 | + layer.close(i); | ||
| 168 | + // 把数据填充到模版中 | ||
| 169 | + var tbodyHtml = template('budget_person',{list:result}); | ||
| 170 | + // 把渲染好的模版html文本追加到表格中 | ||
| 171 | + $('#forms .budget_person').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_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('budget_person_dataList', {list:dataList}); | ||
| 191 | + $("#datas_hidden").removeClass("hidden"); | ||
| 192 | + $("#datas_hidden").height($(window).height()-280); | ||
| 193 | + $("#year0").html(g.year); | ||
| 194 | + $("#gsName0").html(g.gsName); | ||
| 195 | + $("#type0").html(g.type); | ||
| 196 | + $("#item0").html(g.item); | ||
| 197 | + $("#datas").html(tbodyHtml); | ||
| 198 | + } | ||
| 199 | + }); | ||
| 200 | + $("html,body").animate({scrollTop:$("#datas").offset().top},700); | ||
| 201 | + }); | ||
| 202 | + | ||
| 203 | + $("#export").on("click",function(){ | ||
| 204 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 205 | + layer.msg("请选择年份!"); | ||
| 206 | + return; | ||
| 207 | + } | ||
| 208 | + date = $("#date").val(); | ||
| 209 | + var params = {}; | ||
| 210 | + params['year'] = date; | ||
| 211 | + params['type'] = "export"; | ||
| 212 | + var i = layer.load(2); | ||
| 213 | + $post('/budget/budgetPerson',params,function(result){ | ||
| 214 | + window.open("/downloadFile/download?fileName=" | ||
| 215 | + +date+"-预算人次明细表"); | ||
| 216 | + layer.close(i); | ||
| 217 | + }); | ||
| 218 | + }); | ||
| 219 | + }); | ||
| 220 | +</script> | ||
| 221 | +<script type="text/html" id="budget_person"> | ||
| 222 | + {{each list as obj i}} | ||
| 223 | + <tr style='{{if obj.type=='全部线路'}}background-color: #b9d6fb;{{/if}}'> | ||
| 224 | + <td>{{obj.gsName}}</td> | ||
| 225 | + {{if obj.item==''}} | ||
| 226 | + <td><a data-key="{{obj.key}}">{{obj.type}}</a></td> | ||
| 227 | + <td>{{obj.item}}</td> | ||
| 228 | + {{else}} | ||
| 229 | + <td>{{obj.type}}</td> | ||
| 230 | + <td><a data-key="{{obj.key}}">{{obj.item}}</a></td> | ||
| 231 | + {{/if}} | ||
| 232 | + <td>{{obj.budget}}</td> | ||
| 233 | + <td>{{obj.change}}</td> | ||
| 234 | + <td>{{obj.formal}}</td> | ||
| 235 | + <td>{{obj.mon1}}</td> | ||
| 236 | + <td>{{obj.mon2}}</td> | ||
| 237 | + <td>{{obj.mon3}}</td> | ||
| 238 | + <td>{{obj.mon4}}</td> | ||
| 239 | + <td>{{obj.mon5}}</td> | ||
| 240 | + <td>{{obj.mon6}}</td> | ||
| 241 | + <td>{{obj.mon7}}</td> | ||
| 242 | + <td>{{obj.mon8}}</td> | ||
| 243 | + <td>{{obj.mon9}}</td> | ||
| 244 | + <td>{{obj.mon10}}</td> | ||
| 245 | + <td>{{obj.mon11}}</td> | ||
| 246 | + <td>{{obj.mon12}}</td> | ||
| 247 | + <td>{{obj.monAll}}</td> | ||
| 248 | + <td>{{obj.complete}}</td> | ||
| 249 | + <td>{{obj.diff}}</td> | ||
| 250 | + </tr> | ||
| 251 | + {{/each}} | ||
| 252 | + {{if list.length == 0}} | ||
| 253 | + <tr> | ||
| 254 | + <td colspan="21"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 255 | + </tr> | ||
| 256 | + {{/if}} | ||
| 257 | +</script> | ||
| 258 | +<script type="text/html" id="budget_person_dataList"> | ||
| 259 | + {{each list as obj i}} | ||
| 260 | + <tr> | ||
| 261 | + <td>{{obj.gsName}}</td> | ||
| 262 | + <td>{{obj.xlName}}</td> | ||
| 263 | + <td>{{obj.budget}}</td> | ||
| 264 | + <td>{{obj.change}}</td> | ||
| 265 | + <td>{{obj.formal}}</td> | ||
| 266 | + <td>{{obj.mon1}}</td> | ||
| 267 | + <td>{{obj.mon2}}</td> | ||
| 268 | + <td>{{obj.mon3}}</td> | ||
| 269 | + <td>{{obj.mon4}}</td> | ||
| 270 | + <td>{{obj.mon5}}</td> | ||
| 271 | + <td>{{obj.mon6}}</td> | ||
| 272 | + <td>{{obj.mon7}}</td> | ||
| 273 | + <td>{{obj.mon8}}</td> | ||
| 274 | + <td>{{obj.mon9}}</td> | ||
| 275 | + <td>{{obj.mon10}}</td> | ||
| 276 | + <td>{{obj.mon11}}</td> | ||
| 277 | + <td>{{obj.mon12}}</td> | ||
| 278 | + <td>{{obj.monAll}}</td> | ||
| 279 | + <td>{{obj.complete}}</td> | ||
| 280 | + <td>{{obj.diff}}</td> | ||
| 281 | + </tr> | ||
| 282 | + {{/each}} | ||
| 283 | + {{if list.length == 0}} | ||
| 284 | + <tr> | ||
| 285 | + <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 286 | + </tr> | ||
| 287 | + {{/if}} | ||
| 288 | +</script> | ||
| 0 | \ No newline at end of file | 289 | \ No newline at end of file |
src/main/resources/static/pages/forms/budget/budgetSum.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 class="form-group"> | ||
| 44 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 45 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 46 | + </div> | ||
| 47 | + </form> | ||
| 48 | + </div> | ||
| 49 | + <div class="portlet-body"> | ||
| 50 | + <label>单位:万</label> | ||
| 51 | + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 52 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 53 | + <thead style="text-align: center;"> | ||
| 54 | + <tr> | ||
| 55 | + <th colspan="30"><label id="datetodate"></label> 预算汇总表</th> | ||
| 56 | + </tr> | ||
| 57 | + <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> | ||
| 78 | + </tr> | ||
| 79 | + | ||
| 80 | + </thead> | ||
| 81 | + <tbody class="budget_sum"> | ||
| 82 | + | ||
| 83 | + </tbody> | ||
| 84 | + </table> | ||
| 85 | + </div> | ||
| 86 | + </div> | ||
| 87 | + <div class="portlet-body table-container hidden" id="datas_hidden" | ||
| 88 | + 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> | ||
| 129 | + </div> | ||
| 130 | + </div> | ||
| 131 | +</div> | ||
| 132 | + | ||
| 133 | +<script> | ||
| 134 | + $(function(){ | ||
| 135 | +// $('#export').attr('disabled', "true"); | ||
| 136 | + | ||
| 137 | + // 关闭左侧栏 | ||
| 138 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 139 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 140 | + | ||
| 141 | + $("#countLine").height($(window).height()-280); | ||
| 142 | + | ||
| 143 | + $("#date").datetimepicker({ | ||
| 144 | + format : 'YYYY', | ||
| 145 | + locale : 'zh-cn' | ||
| 146 | + }); | ||
| 147 | + | ||
| 148 | + var d = new Date(); | ||
| 149 | + var year = d.getFullYear(); | ||
| 150 | + $("#date").val(year); | ||
| 151 | + | ||
| 152 | + var date = ""; | ||
| 153 | + var nature = ""; | ||
| 154 | + var resList; | ||
| 155 | + $("#query").on("click",function(){ | ||
| 156 | + $("#countLine").height($(window).height()-280); | ||
| 157 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 158 | + layer.msg("请选择年份!"); | ||
| 159 | + return; | ||
| 160 | + } | ||
| 161 | + date = $("#date").val(); | ||
| 162 | + var params = {}; | ||
| 163 | + params['year'] = date; | ||
| 164 | + params['type'] = "query"; | ||
| 165 | + var i = layer.load(2); | ||
| 166 | + $post('/budget/budgetSum',params,function(result){ | ||
| 167 | + layer.close(i); | ||
| 168 | + // 把数据填充到模版中 | ||
| 169 | + var tbodyHtml = template('budget_sum',{list:result}); | ||
| 170 | + // 把渲染好的模版html文本追加到表格中 | ||
| 171 | + $('#forms .budget_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_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('budget_sum_dataList', {list:dataList}); | ||
| 191 | + $("#datas_hidden").removeClass("hidden"); | ||
| 192 | + $("#datas_hidden").height($(window).height()-280); | ||
| 193 | + $("#year0").html(g.year); | ||
| 194 | + $("#gsName0").html(g.gsName); | ||
| 195 | + $("#type0").html(g.type); | ||
| 196 | + $("#item0").html(g.item); | ||
| 197 | + $("#datas").html(tbodyHtml); | ||
| 198 | + } | ||
| 199 | + }); | ||
| 200 | + $("html,body").animate({scrollTop:$("#datas").offset().top},700); | ||
| 201 | + }); | ||
| 202 | + | ||
| 203 | + $("#export").on("click",function(){ | ||
| 204 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 205 | + layer.msg("请选择年份!"); | ||
| 206 | + return; | ||
| 207 | + } | ||
| 208 | + date = $("#date").val(); | ||
| 209 | + var params = {}; | ||
| 210 | + params['year'] = date; | ||
| 211 | + params['type'] = "export"; | ||
| 212 | + var i = layer.load(2); | ||
| 213 | + $post('/budget/budgetSum',params,function(result){ | ||
| 214 | + window.open("/downloadFile/download?fileName=" | ||
| 215 | + +date+"-预算汇总表"); | ||
| 216 | + layer.close(i); | ||
| 217 | + }); | ||
| 218 | + }); | ||
| 219 | + }); | ||
| 220 | +</script> | ||
| 221 | +<script type="text/html" id="budget_sum"> | ||
| 222 | + {{each list as obj i}} | ||
| 223 | + <tr style='{{if obj.type=='全部线路'}}background-color: #b9d6fb;{{/if}}'> | ||
| 224 | + <td>{{obj.gsName}}</td> | ||
| 225 | + <td><a data-key="{{obj.key}}">{{obj.type}}</a></td> | ||
| 226 | + <td>{{obj.budget}}</td> | ||
| 227 | + <td>{{obj.change}}</td> | ||
| 228 | + <td>{{obj.formal}}</td> | ||
| 229 | + <td>{{obj.mon1}}</td> | ||
| 230 | + <td>{{obj.mon2}}</td> | ||
| 231 | + <td>{{obj.mon3}}</td> | ||
| 232 | + <td>{{obj.mon4}}</td> | ||
| 233 | + <td>{{obj.mon5}}</td> | ||
| 234 | + <td>{{obj.mon6}}</td> | ||
| 235 | + <td>{{obj.mon7}}</td> | ||
| 236 | + <td>{{obj.mon8}}</td> | ||
| 237 | + <td>{{obj.mon9}}</td> | ||
| 238 | + <td>{{obj.mon10}}</td> | ||
| 239 | + <td>{{obj.mon11}}</td> | ||
| 240 | + <td>{{obj.mon12}}</td> | ||
| 241 | + <td>{{obj.monAll}}</td> | ||
| 242 | + <td>{{obj.complete}}</td> | ||
| 243 | + <td>{{obj.diff}}</td> | ||
| 244 | + </tr> | ||
| 245 | + {{/each}} | ||
| 246 | + {{if list.length == 0}} | ||
| 247 | + <tr> | ||
| 248 | + <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 249 | + </tr> | ||
| 250 | + {{/if}} | ||
| 251 | +</script> | ||
| 252 | +<script type="text/html" id="budget_sum_dataList"> | ||
| 253 | + {{each list as obj i}} | ||
| 254 | + <tr> | ||
| 255 | + <td>{{obj.gsName}}</td> | ||
| 256 | + <td>{{obj.xlName}}</td> | ||
| 257 | + <td>{{obj.type}}</td> | ||
| 258 | + <td>{{obj.budget}}</td> | ||
| 259 | + <td>{{obj.change}}</td> | ||
| 260 | + <td>{{obj.formal}}</td> | ||
| 261 | + <td>{{obj.mon1}}</td> | ||
| 262 | + <td>{{obj.mon2}}</td> | ||
| 263 | + <td>{{obj.mon3}}</td> | ||
| 264 | + <td>{{obj.mon4}}</td> | ||
| 265 | + <td>{{obj.mon5}}</td> | ||
| 266 | + <td>{{obj.mon6}}</td> | ||
| 267 | + <td>{{obj.mon7}}</td> | ||
| 268 | + <td>{{obj.mon8}}</td> | ||
| 269 | + <td>{{obj.mon9}}</td> | ||
| 270 | + <td>{{obj.mon10}}</td> | ||
| 271 | + <td>{{obj.mon11}}</td> | ||
| 272 | + <td>{{obj.mon12}}</td> | ||
| 273 | + <td>{{obj.monAll}}</td> | ||
| 274 | + <td>{{obj.complete}}</td> | ||
| 275 | + <td>{{obj.diff}}</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> | ||
| 0 | \ No newline at end of file | 284 | \ No newline at end of file |
src/main/resources/static/pages/forms/budget/updateRevenue.html
0 → 100644
| 1 | +<div class="modal fade" id="uploadFile" tabindex="-1" role="basic" | ||
| 2 | + aria-hidden="true"> | ||
| 3 | + <div class="modal-dialog"> | ||
| 4 | + <div class="modal-content"> | ||
| 5 | + <div class="modal-header"> | ||
| 6 | + <button type="button" class="close" data-dismiss="modal" | ||
| 7 | + aria-hidden="true"></button> | ||
| 8 | + <h4 class="modal-title">获取人次营收</h4> | ||
| 9 | + </div> | ||
| 10 | + <div class="modal-body"> | ||
| 11 | + <form class="form-horizontal" role="form" id="excelFile" method="post" | ||
| 12 | + action="" enctype="multipart/form-data" autocomplete="off"> | ||
| 13 | + <input type="hidden" name="groupType" value="3"> | ||
| 14 | + <div class="alert alert-danger display-hide"> | ||
| 15 | + <button class="close" data-close="alert"></button> | ||
| 16 | + 您的输入有误,请检查下面的输入项 | ||
| 17 | + </div> | ||
| 18 | + <div class="form-body"> | ||
| 19 | + <div class="form-group"> | ||
| 20 | + <label class="col-md-3 control-label">选择日期区间</label> | ||
| 21 | + <div class="col-md-9"> | ||
| 22 | + 开始:<input class="form-control" type="text" id="date1" style="width: 180px;"/> | ||
| 23 | + 结束:<input class="form-control" type="text" id="date2" style="width: 180px;"/> | ||
| 24 | + </div> | ||
| 25 | + </div> | ||
| 26 | + </div> | ||
| 27 | + </form> | ||
| 28 | + </div> | ||
| 29 | + <div class="modal-footer"> | ||
| 30 | + <button type="button" class="btn default" data-dismiss="modal">取消</button> | ||
| 31 | + <button type="button" class="btn btn-primary" id="submit">确认获取</button> | ||
| 32 | + </div> | ||
| 33 | + </div> | ||
| 34 | + </div> | ||
| 35 | +</div> | ||
| 36 | +<script id="res_tbody_temp" type="text/html"> | ||
| 37 | + | ||
| 38 | +</script> | ||
| 39 | +<script data-exclude=1> | ||
| 40 | + $(function() { | ||
| 41 | + var form = $('#excelFile'); | ||
| 42 | + var error = $('.alert-danger', form); | ||
| 43 | + | ||
| 44 | + //modal 显示事件 | ||
| 45 | + $('#uploadFile').on('show.bs.modal', function(){ | ||
| 46 | + }) | ||
| 47 | + .modal('show'); | ||
| 48 | + | ||
| 49 | + $("#date1").datetimepicker({ | ||
| 50 | + format : 'YYYY-MM-DD', | ||
| 51 | + locale : 'zh-cn' | ||
| 52 | + }); | ||
| 53 | + $("#date2").datetimepicker({ | ||
| 54 | + format : 'YYYY-MM-DD', | ||
| 55 | + locale : 'zh-cn' | ||
| 56 | + }); | ||
| 57 | + var d = new Date(); | ||
| 58 | + var year = d.getFullYear(); | ||
| 59 | + var month = d.getMonth() + 1; | ||
| 60 | + var day = d.getDate(); | ||
| 61 | + if(month < 10) | ||
| 62 | + month = "0" + month; | ||
| 63 | + if(day < 10) | ||
| 64 | + day = "0" + day; | ||
| 65 | + var dateTime = year + "-" + month + "-" + day; | ||
| 66 | + $("#date1, #date2").val(dateTime); | ||
| 67 | + | ||
| 68 | + //提交 | ||
| 69 | +// $('#submit').on('click', function() { | ||
| 70 | +// form.submit(); | ||
| 71 | +// }); | ||
| 72 | + | ||
| 73 | + $('#submit').on('click', function() { | ||
| 74 | + if($("#date1").val() == null || $("#date1").val().trim().length == 0){ | ||
| 75 | + layer.msg("请选择时间范围!"); | ||
| 76 | + return; | ||
| 77 | + } | ||
| 78 | + if($("#date2").val() == null || $("#date2").val().trim().length == 0){ | ||
| 79 | + layer.msg("请选择时间范围!"); | ||
| 80 | + return; | ||
| 81 | + } | ||
| 82 | + if($("#date1").val() > $("#date2").val()){ | ||
| 83 | + layer.msg("请选择正确的时间范围!"); | ||
| 84 | + return; | ||
| 85 | + } | ||
| 86 | + var j = layer.load(2); | ||
| 87 | + var param = {}; | ||
| 88 | + param.date1 = $("#date1").val(); | ||
| 89 | + param.date2 = $("#date2").val(); | ||
| 90 | + $.ajax({ | ||
| 91 | + url : '/budget/updateRevenue', | ||
| 92 | + dataType : 'json', | ||
| 93 | + data : param, | ||
| 94 | + success : function(data) { | ||
| 95 | + layer.close(j); | ||
| 96 | +// alert(data.result); | ||
| 97 | + if(data.status == "SUCCESS"){ | ||
| 98 | + alert("获取成功"); | ||
| 99 | + $('#uploadFile').modal('hide'); | ||
| 100 | + $('tr.filter .filter-submit').click(); | ||
| 101 | + } else { | ||
| 102 | + alert("获取失败"); | ||
| 103 | + } | ||
| 104 | + }, | ||
| 105 | + error : function(data, status, e) { | ||
| 106 | + layer.close(j); | ||
| 107 | + alert("获取失败"); | ||
| 108 | + } | ||
| 109 | + }) | ||
| 110 | + }); | ||
| 111 | + | ||
| 112 | + function getCurrSelNode(){ | ||
| 113 | + return $.jstree.reference("#modules_tree").get_selected(true); | ||
| 114 | + } | ||
| 115 | + }); | ||
| 116 | +</script> | ||
| 0 | \ No newline at end of file | 117 | \ No newline at end of file |
src/main/resources/static/pages/forms/budget/upload.html
0 → 100644
| 1 | +<div class="modal fade" id="uploadFile" tabindex="-1" role="basic" | ||
| 2 | + aria-hidden="true"> | ||
| 3 | + <div class="modal-dialog"> | ||
| 4 | + <div class="modal-content"> | ||
| 5 | + <div class="modal-header"> | ||
| 6 | + <button type="button" class="close" data-dismiss="modal" | ||
| 7 | + aria-hidden="true"></button> | ||
| 8 | + <h4 class="modal-title">导入Excel</h4> | ||
| 9 | + </div> | ||
| 10 | + <div class="modal-body"> | ||
| 11 | + <form class="form-horizontal" role="form" id="excelFile" method="post" | ||
| 12 | + action="" enctype="multipart/form-data"> | ||
| 13 | + <input type="hidden" name="groupType" value="3"> | ||
| 14 | + <div class="alert alert-danger display-hide"> | ||
| 15 | + <button class="close" data-close="alert"></button> | ||
| 16 | + 您的输入有误,请检查下面的输入项 | ||
| 17 | + </div> | ||
| 18 | + <div class="form-body"> | ||
| 19 | + <div class="form-group"> | ||
| 20 | + <label class="col-md-3 control-label">选择文件</label> | ||
| 21 | + <div class="col-md-9"> | ||
| 22 | + <input type="file" name="file" id="file" | ||
| 23 | + accept="application/vnd.ms-excel"/> | ||
| 24 | + </div> | ||
| 25 | + </div> | ||
| 26 | + </div> | ||
| 27 | + </form> | ||
| 28 | + </div> | ||
| 29 | + <div class="modal-footer"> | ||
| 30 | + <button type="button" class="btn default" id="downLoad">下载模板</button> | ||
| 31 | + <button type="button" class="btn default" data-dismiss="modal">取消</button> | ||
| 32 | + <button type="button" class="btn btn-primary" id="submit">确认导入</button> | ||
| 33 | + </div> | ||
| 34 | + </div> | ||
| 35 | + </div> | ||
| 36 | +</div> | ||
| 37 | +<script id="res_tbody_temp" type="text/html"> | ||
| 38 | + | ||
| 39 | +</script> | ||
| 40 | +<script data-exclude=1> | ||
| 41 | + $(function() { | ||
| 42 | + var form = $('#excelFile'); | ||
| 43 | + var error = $('.alert-danger', form); | ||
| 44 | + | ||
| 45 | + //modal 显示事件 | ||
| 46 | + $('#uploadFile').on('show.bs.modal', function(){ | ||
| 47 | + }) | ||
| 48 | + .modal('show'); | ||
| 49 | + | ||
| 50 | + //提交 | ||
| 51 | +// $('#submit').on('click', function() { | ||
| 52 | +// form.submit(); | ||
| 53 | +// }); | ||
| 54 | + | ||
| 55 | + $('#submit').on('click', function() { | ||
| 56 | + var j = layer.load(2); | ||
| 57 | + var param = {}; | ||
| 58 | + param.uploadDir = 'upload'; | ||
| 59 | + $.ajaxFileUpload({ | ||
| 60 | + url : '/budget/uploadFile', | ||
| 61 | + secureuri : false, | ||
| 62 | + fileElementId : 'file', | ||
| 63 | + dataType : 'json', | ||
| 64 | + data : param, | ||
| 65 | + success : function(data) { | ||
| 66 | + layer.close(j); | ||
| 67 | + alert(data.result); | ||
| 68 | +// alert("文件导入成功"); | ||
| 69 | + $('#uploadFile').modal('hide'); | ||
| 70 | + $('tr.filter .filter-submit').click(); | ||
| 71 | + }, | ||
| 72 | + error : function(data, status, e) { | ||
| 73 | + layer.close(j); | ||
| 74 | + alert("文件导入失败"); | ||
| 75 | + } | ||
| 76 | + }) | ||
| 77 | + }); | ||
| 78 | + | ||
| 79 | + $('#downLoad').on('click', function(){ | ||
| 80 | + window.open("/downloadFile/downloadModel?fileName=import_budget"); | ||
| 81 | + }); | ||
| 82 | + | ||
| 83 | + function getCurrSelNode(){ | ||
| 84 | + return $.jstree.reference("#modules_tree").get_selected(true); | ||
| 85 | + } | ||
| 86 | + }); | ||
| 87 | +</script> | ||
| 0 | \ No newline at end of file | 88 | \ No newline at end of file |
src/main/resources/static/pages/forms/export/import_budget.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetAmounts.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetMileage.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetPerson.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/budgetSum.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/dispatchDailySum.html
| @@ -195,8 +195,6 @@ | @@ -195,8 +195,6 @@ | ||
| 195 | // if((time2-time1)>2678400000){ | 195 | // if((time2-time1)>2678400000){ |
| 196 | // layer.msg('查询超过一个月请点击【统计查询】.'); | 196 | // layer.msg('查询超过一个月请点击【统计查询】.'); |
| 197 | // }else{ | 197 | // }else{ |
| 198 | - $("#tjrq").html(date); | ||
| 199 | - $("#rqxs").html(date); | ||
| 200 | var params = {}; | 198 | var params = {}; |
| 201 | params['date'] = date; | 199 | params['date'] = date; |
| 202 | params['date2'] = date2; | 200 | params['date2'] = date2; |
| @@ -210,6 +208,14 @@ | @@ -210,6 +208,14 @@ | ||
| 210 | $('#forms .dispatch_daily_sum').html(tbodyHtml); | 208 | $('#forms .dispatch_daily_sum').html(tbodyHtml); |
| 211 | layer.close(i); | 209 | layer.close(i); |
| 212 | 210 | ||
| 211 | + if(date == date2){ | ||
| 212 | + $("#tjrq").html(date); | ||
| 213 | + $("#rqxs").html(date); | ||
| 214 | + } else { | ||
| 215 | + $("#tjrq").html(date + "至" + date2); | ||
| 216 | + $("#rqxs").html(date + "至" + date2); | ||
| 217 | + } | ||
| 218 | + | ||
| 213 | if(result.length == 0){ | 219 | if(result.length == 0){ |
| 214 | $("#export").attr('disabled',"true"); | 220 | $("#export").attr('disabled',"true"); |
| 215 | }else{ | 221 | }else{ |
src/main/resources/static/pages/report/countMileage/countLine/countMileageSum.html
| @@ -172,12 +172,17 @@ | @@ -172,12 +172,17 @@ | ||
| 172 | var i = layer.load(2); | 172 | var i = layer.load(2); |
| 173 | $get('/report/countMileageSum',params,function(result){ | 173 | $get('/report/countMileageSum',params,function(result){ |
| 174 | layer.close(i); | 174 | layer.close(i); |
| 175 | - $("#datetodate").html(date); | ||
| 176 | // 把数据填充到模版中 | 175 | // 把数据填充到模版中 |
| 177 | var tbodyHtml = template('count_mileage_sum',{list:result}); | 176 | var tbodyHtml = template('count_mileage_sum',{list:result}); |
| 178 | // 把渲染好的模版html文本追加到表格中 | 177 | // 把渲染好的模版html文本追加到表格中 |
| 179 | $('#forms .count_mileage_sum').html(tbodyHtml); | 178 | $('#forms .count_mileage_sum').html(tbodyHtml); |
| 180 | 179 | ||
| 180 | + if(date == date2){ | ||
| 181 | + $("#datetodate").html(date); | ||
| 182 | + } else { | ||
| 183 | + $("#datetodate").html(date + "至" + date2); | ||
| 184 | + } | ||
| 185 | + | ||
| 181 | if(result.length == 0) | 186 | if(result.length == 0) |
| 182 | $("#export").attr('disabled',"true"); | 187 | $("#export").attr('disabled',"true"); |
| 183 | else | 188 | else |