Commit fc19cbfdaa3d11f70c5df6f69a03c2d5cbeb8196
Merge branch 'minhang' of git@192.168.168.201:panzhaov5/bsth_control.git into minhang
Showing
9 changed files
with
529 additions
and
428 deletions
Too many changes to show.
To preserve performance only 9 of 15 files are displayed.
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -335,8 +335,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -335,8 +335,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 335 | @RequestMapping(value = "/correctForm") | 335 | @RequestMapping(value = "/correctForm") |
| 336 | public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date, | 336 | public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date, |
| 337 | @RequestParam String endDate, | 337 | @RequestParam String endDate, |
| 338 | - @RequestParam String lpName, @RequestParam String code, @RequestParam String type) { | ||
| 339 | - return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type); | 338 | + @RequestParam String lpName, @RequestParam String code, |
| 339 | + @RequestParam String type,@RequestParam String changType) { | ||
| 340 | + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType); | ||
| 340 | } | 341 | } |
| 341 | /** | 342 | /** |
| 342 | * @Title queryListWaybill | 343 | * @Title queryListWaybill |
src/main/java/com/bsth/controller/report/ReportController.java
| @@ -6,12 +6,15 @@ import java.util.Iterator; | @@ -6,12 +6,15 @@ import java.util.Iterator; | ||
| 6 | import java.util.List; | 6 | import java.util.List; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | 8 | ||
| 9 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.web.bind.annotation.RequestMapping; | 11 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | import org.springframework.web.bind.annotation.RequestMethod; | 12 | import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | import org.springframework.web.bind.annotation.RequestParam; | 13 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | import org.springframework.web.bind.annotation.RestController; | 14 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 15 | ||
| 16 | +import com.alibaba.fastjson.JSONArray; | ||
| 17 | +import com.alibaba.fastjson.JSONObject; | ||
| 15 | import com.bsth.entity.StationRoute; | 18 | import com.bsth.entity.StationRoute; |
| 16 | import com.bsth.entity.excep.ArrivalInfo; | 19 | import com.bsth.entity.excep.ArrivalInfo; |
| 17 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 20 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| @@ -276,4 +279,40 @@ public class ReportController { | @@ -276,4 +279,40 @@ public class ReportController { | ||
| 276 | public List<Map<String, Object>> countDjg(@RequestParam Map<String, Object> map){ | 279 | public List<Map<String, Object>> countDjg(@RequestParam Map<String, Object> map){ |
| 277 | return service.countDjg(map); | 280 | return service.countDjg(map); |
| 278 | } | 281 | } |
| 282 | + | ||
| 283 | + | ||
| 284 | + @RequestMapping(value="/countDjgXx") | ||
| 285 | + public List<Map<String, Object>> countDjgXx(@RequestParam Map<String, Object> map){ | ||
| 286 | + List<Map<String, Object>> lMap=new ArrayList<Map<String, Object>>(); | ||
| 287 | + String json =StringEscapeUtils.unescapeHtml4(map.get("listXx").toString()); | ||
| 288 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 289 | + JSONObject jsonObject; | ||
| 290 | + for (int x = 0; x < jsonArray.size(); x++) { | ||
| 291 | + jsonObject=jsonArray.getJSONObject(x); | ||
| 292 | + Map<String, Object> m_=new HashMap<String,Object>(); | ||
| 293 | + m_.put("fgsname", jsonObject.getString("fgsname")); | ||
| 294 | + m_.put("xlName", jsonObject.getString("xlName")); | ||
| 295 | + m_.put("djgde", jsonObject.getString("djgde")); | ||
| 296 | + m_.put("qJh", jsonObject.getString("qJh")); | ||
| 297 | + m_.put("qSj", jsonObject.getString("qSj")); | ||
| 298 | + m_.put("hJh", jsonObject.getString("hJh")); | ||
| 299 | + m_.put("hSj", jsonObject.getString("hSj")); | ||
| 300 | + lMap.add(m_); | ||
| 301 | + } | ||
| 302 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 303 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 304 | + m.put("date", map.get("date").toString()); | ||
| 305 | + ReportUtils ee = new ReportUtils(); | ||
| 306 | + try { | ||
| 307 | + listI.add(lMap.iterator()); | ||
| 308 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 309 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/countIntervalXx.xls", | ||
| 310 | + path + "export/大间隔统计表详细.xls"); | ||
| 311 | + } catch (Exception e) { | ||
| 312 | + // TODO: handle exception | ||
| 313 | + e.printStackTrace(); | ||
| 314 | + } | ||
| 315 | + | ||
| 316 | + return lMap; | ||
| 317 | + } | ||
| 279 | } | 318 | } |
src/main/java/com/bsth/data/pinyin/PersionPinYin.java
| 1 | -package com.bsth.data.pinyin; | ||
| 2 | - | ||
| 3 | -import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * 人员拼音映射 | ||
| 7 | - * Created by panzhao on 2017/7/19. | ||
| 8 | - */ | ||
| 9 | -public class PersionPinYin { | ||
| 10 | - | ||
| 11 | - /** | ||
| 12 | - * Id | ||
| 13 | - */ | ||
| 14 | - private Integer id; | ||
| 15 | - | ||
| 16 | - /** | ||
| 17 | - * 工号 | ||
| 18 | - */ | ||
| 19 | - private String workId; | ||
| 20 | - | ||
| 21 | - /** | ||
| 22 | - * 姓名 | ||
| 23 | - */ | ||
| 24 | - private String name; | ||
| 25 | - | ||
| 26 | - /** | ||
| 27 | - * 全拼 | ||
| 28 | - */ | ||
| 29 | - private String fullChars; | ||
| 30 | - | ||
| 31 | - /** | ||
| 32 | - * 简便 | ||
| 33 | - */ | ||
| 34 | - private String camelChars; | ||
| 35 | - | ||
| 36 | - /** | ||
| 37 | - * 所属公司编码 | ||
| 38 | - */ | ||
| 39 | - @JsonIgnore | ||
| 40 | - private String companyId; | ||
| 41 | - | ||
| 42 | - /** | ||
| 43 | - * 所属分公司编码 | ||
| 44 | - */ | ||
| 45 | - @JsonIgnore | ||
| 46 | - private String fgsCompanyId; | ||
| 47 | - | ||
| 48 | - public String getWorkId() { | ||
| 49 | - return workId; | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - public void setWorkId(String workId) { | ||
| 53 | - this.workId = workId; | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - public String getName() { | ||
| 57 | - return name; | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - public void setName(String name) { | ||
| 61 | - this.name = name; | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - public String getFullChars() { | ||
| 65 | - return fullChars; | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - public void setFullChars(String fullChars) { | ||
| 69 | - this.fullChars = fullChars; | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - public String getCamelChars() { | ||
| 73 | - return camelChars; | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - public void setCamelChars(String camelChars) { | ||
| 77 | - this.camelChars = camelChars; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - public String getCompanyId() { | ||
| 81 | - return companyId; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - public void setCompanyId(String companyId) { | ||
| 85 | - this.companyId = companyId; | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - public String getFgsCompanyId() { | ||
| 89 | - return fgsCompanyId; | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - public void setFgsCompanyId(String fgsCompanyId) { | ||
| 93 | - this.fgsCompanyId = fgsCompanyId; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - public Integer getId() { | ||
| 97 | - return id; | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - public void setId(Integer id) { | ||
| 101 | - this.id = id; | ||
| 102 | - } | ||
| 103 | -} | 1 | +package com.bsth.data.pinyin; |
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 人员拼音映射 | ||
| 7 | + * Created by panzhao on 2017/7/19. | ||
| 8 | + */ | ||
| 9 | +public class PersionPinYin { | ||
| 10 | + | ||
| 11 | + /** | ||
| 12 | + * Id | ||
| 13 | + */ | ||
| 14 | + private Integer id; | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 工号 | ||
| 18 | + */ | ||
| 19 | + private String workId; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 姓名 | ||
| 23 | + */ | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 全拼 | ||
| 28 | + */ | ||
| 29 | + private String fullChars; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 简便 | ||
| 33 | + */ | ||
| 34 | + private String camelChars; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 所属公司编码 | ||
| 38 | + */ | ||
| 39 | + @JsonIgnore | ||
| 40 | + private String companyId; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 所属分公司编码 | ||
| 44 | + */ | ||
| 45 | + @JsonIgnore | ||
| 46 | + private String fgsCompanyId; | ||
| 47 | + | ||
| 48 | + public String getWorkId() { | ||
| 49 | + return workId; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void setWorkId(String workId) { | ||
| 53 | + this.workId = workId; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public String getName() { | ||
| 57 | + return name; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public void setName(String name) { | ||
| 61 | + this.name = name; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public String getFullChars() { | ||
| 65 | + return fullChars; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public void setFullChars(String fullChars) { | ||
| 69 | + this.fullChars = fullChars; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public String getCamelChars() { | ||
| 73 | + return camelChars; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setCamelChars(String camelChars) { | ||
| 77 | + this.camelChars = camelChars; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public String getCompanyId() { | ||
| 81 | + return companyId; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setCompanyId(String companyId) { | ||
| 85 | + this.companyId = companyId; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public String getFgsCompanyId() { | ||
| 89 | + return fgsCompanyId; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setFgsCompanyId(String fgsCompanyId) { | ||
| 93 | + this.fgsCompanyId = fgsCompanyId; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public Integer getId() { | ||
| 97 | + return id; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setId(Integer id) { | ||
| 101 | + this.id = id; | ||
| 102 | + } | ||
| 103 | +} |
src/main/java/com/bsth/data/pinyin/PersionPinYinBuffer.java
| 1 | -package com.bsth.data.pinyin; | ||
| 2 | - | ||
| 3 | -import com.bsth.data.BasicData; | ||
| 4 | -import com.bsth.entity.Personnel; | ||
| 5 | -import com.bsth.entity.sys.CompanyAuthority; | ||
| 6 | -import com.github.stuxuhai.jpinyin.PinyinException; | ||
| 7 | -import com.github.stuxuhai.jpinyin.PinyinFormat; | ||
| 8 | -import com.github.stuxuhai.jpinyin.PinyinHelper; | ||
| 9 | -import com.google.common.collect.ArrayListMultimap; | ||
| 10 | -import org.slf4j.Logger; | ||
| 11 | -import org.slf4j.LoggerFactory; | ||
| 12 | -import org.springframework.stereotype.Component; | ||
| 13 | - | ||
| 14 | -import java.util.ArrayList; | ||
| 15 | -import java.util.Collection; | ||
| 16 | -import java.util.List; | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * 人员拼音数据映射缓存 | ||
| 20 | - * Created by panzhao on 2017/7/19. | ||
| 21 | - */ | ||
| 22 | -@Component | ||
| 23 | -public class PersionPinYinBuffer { | ||
| 24 | - | ||
| 25 | - static ArrayListMultimap<String, PersionPinYin> listMultimap = ArrayListMultimap.create(); | ||
| 26 | - static List<PersionPinYin> all = new ArrayList<>(); | ||
| 27 | - | ||
| 28 | - Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - public void refresh(){ | ||
| 32 | - ArrayListMultimap<String, PersionPinYin> listMultimapCopy = ArrayListMultimap.create(); | ||
| 33 | - List<PersionPinYin> allCopy = new ArrayList<>(); | ||
| 34 | - PersionPinYin ppy; | ||
| 35 | - | ||
| 36 | - Collection<Personnel> list = BasicData.perMap.values(); | ||
| 37 | - for(Personnel p : list){ | ||
| 38 | - ppy = new PersionPinYin(); | ||
| 39 | - ppy.setId(p.getId()); | ||
| 40 | - ppy.setCompanyId(p.getCompanyCode()); | ||
| 41 | - ppy.setFgsCompanyId(p.getBrancheCompanyCode()); | ||
| 42 | - ppy.setName(p.getPersonnelName()); | ||
| 43 | - ppy.setWorkId(p.getJobCode()); | ||
| 44 | - try { | ||
| 45 | - ppy.setFullChars(PinyinHelper.convertToPinyinString(ppy.getName(), "" , PinyinFormat.WITHOUT_TONE)); | ||
| 46 | - ppy.setCamelChars(PinyinHelper.getShortPinyin(ppy.getName())); | ||
| 47 | - }catch (PinyinException pye){ | ||
| 48 | - log.error("拼音转换出现异常," + ppy.getName(), pye); | ||
| 49 | - continue; | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - listMultimapCopy.put(ppy.getCompanyId() + "_" + ppy.getFgsCompanyId(), ppy); | ||
| 53 | - allCopy.add(ppy); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - if(allCopy.size() > 0){ | ||
| 57 | - all = allCopy; | ||
| 58 | - listMultimap = listMultimapCopy; | ||
| 59 | - } | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - public List<PersionPinYin> getAll(){ | ||
| 63 | - return all; | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - public List<PersionPinYin> getAll(List<CompanyAuthority> auths){ | ||
| 67 | - List<PersionPinYin> rs = new ArrayList<>(); | ||
| 68 | - for(CompanyAuthority ca : auths){ | ||
| 69 | - rs.addAll(listMultimap.get(ca.getCompanyCode() + "_" + ca.getSubCompanyCode())); | ||
| 70 | - } | ||
| 71 | - return rs; | ||
| 72 | - } | ||
| 73 | -} | 1 | +package com.bsth.data.pinyin; |
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.entity.Personnel; | ||
| 5 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 6 | +import com.github.stuxuhai.jpinyin.PinyinException; | ||
| 7 | +import com.github.stuxuhai.jpinyin.PinyinFormat; | ||
| 8 | +import com.github.stuxuhai.jpinyin.PinyinHelper; | ||
| 9 | +import com.google.common.collect.ArrayListMultimap; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.stereotype.Component; | ||
| 13 | + | ||
| 14 | +import java.util.ArrayList; | ||
| 15 | +import java.util.Collection; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 人员拼音数据映射缓存 | ||
| 20 | + * Created by panzhao on 2017/7/19. | ||
| 21 | + */ | ||
| 22 | +@Component | ||
| 23 | +public class PersionPinYinBuffer { | ||
| 24 | + | ||
| 25 | + static ArrayListMultimap<String, PersionPinYin> listMultimap = ArrayListMultimap.create(); | ||
| 26 | + static List<PersionPinYin> all = new ArrayList<>(); | ||
| 27 | + | ||
| 28 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + public void refresh(){ | ||
| 32 | + ArrayListMultimap<String, PersionPinYin> listMultimapCopy = ArrayListMultimap.create(); | ||
| 33 | + List<PersionPinYin> allCopy = new ArrayList<>(); | ||
| 34 | + PersionPinYin ppy; | ||
| 35 | + | ||
| 36 | + Collection<Personnel> list = BasicData.perMap.values(); | ||
| 37 | + for(Personnel p : list){ | ||
| 38 | + ppy = new PersionPinYin(); | ||
| 39 | + ppy.setId(p.getId()); | ||
| 40 | + ppy.setCompanyId(p.getCompanyCode()); | ||
| 41 | + ppy.setFgsCompanyId(p.getBrancheCompanyCode()); | ||
| 42 | + ppy.setName(p.getPersonnelName()); | ||
| 43 | + ppy.setWorkId(p.getJobCode()); | ||
| 44 | + try { | ||
| 45 | + ppy.setFullChars(PinyinHelper.convertToPinyinString(ppy.getName(), "" , PinyinFormat.WITHOUT_TONE)); | ||
| 46 | + ppy.setCamelChars(PinyinHelper.getShortPinyin(ppy.getName())); | ||
| 47 | + }catch (PinyinException pye){ | ||
| 48 | + log.error("拼音转换出现异常," + ppy.getName(), pye); | ||
| 49 | + continue; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + listMultimapCopy.put(ppy.getCompanyId() + "_" + ppy.getFgsCompanyId(), ppy); | ||
| 53 | + allCopy.add(ppy); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + if(allCopy.size() > 0){ | ||
| 57 | + all = allCopy; | ||
| 58 | + listMultimap = listMultimapCopy; | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public List<PersionPinYin> getAll(){ | ||
| 63 | + return all; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public List<PersionPinYin> getAll(List<CompanyAuthority> auths){ | ||
| 67 | + List<PersionPinYin> rs = new ArrayList<>(); | ||
| 68 | + for(CompanyAuthority ca : auths){ | ||
| 69 | + rs.addAll(listMultimap.get(ca.getCompanyCode() + "_" + ca.getSubCompanyCode())); | ||
| 70 | + } | ||
| 71 | + return rs; | ||
| 72 | + } | ||
| 73 | +} |
src/main/java/com/bsth/data/schedule/f_a_l/FirstAndLastHandler.java
| 1 | -package com.bsth.data.schedule.f_a_l; | ||
| 2 | - | ||
| 3 | -import com.bsth.data.BasicData; | ||
| 4 | -import com.bsth.data.schedule.DayOfSchedule; | ||
| 5 | -import com.bsth.data.schedule.ScheduleComparator; | ||
| 6 | -import com.bsth.data.schedule.f_a_l.entity.ToGateway; | ||
| 7 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 8 | -import com.bsth.util.db.DBUtils_MS; | ||
| 9 | -import org.slf4j.Logger; | ||
| 10 | -import org.slf4j.LoggerFactory; | ||
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | -import org.springframework.jdbc.core.BatchPreparedStatementSetter; | ||
| 13 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 14 | -import org.springframework.jdbc.datasource.DataSourceTransactionManager; | ||
| 15 | -import org.springframework.stereotype.Component; | ||
| 16 | -import org.springframework.transaction.TransactionDefinition; | ||
| 17 | -import org.springframework.transaction.TransactionStatus; | ||
| 18 | -import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
| 19 | - | ||
| 20 | -import java.sql.PreparedStatement; | ||
| 21 | -import java.sql.SQLException; | ||
| 22 | -import java.util.ArrayList; | ||
| 23 | -import java.util.Collections; | ||
| 24 | -import java.util.List; | ||
| 25 | -import java.util.concurrent.ConcurrentHashMap; | ||
| 26 | - | ||
| 27 | -/** | ||
| 28 | - * 首末班处理程序 | ||
| 29 | - * Created by panzhao on 2017/7/19. | ||
| 30 | - */ | ||
| 31 | -@Component | ||
| 32 | -public class FirstAndLastHandler { | ||
| 33 | - | ||
| 34 | - static ConcurrentHashMap<String, ToGateway> maps = new ConcurrentHashMap<>(); | ||
| 35 | - | ||
| 36 | - static Logger log = LoggerFactory.getLogger(FirstAndLastHandler.class); | ||
| 37 | - | ||
| 38 | - static boolean flag; | ||
| 39 | - | ||
| 40 | - @Autowired | ||
| 41 | - DayOfSchedule dayOfSchedule; | ||
| 42 | - | ||
| 43 | - public void marks(String lineCode){ | ||
| 44 | - marks(dayOfSchedule.findByLineCode(lineCode)); | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - /** | ||
| 48 | - * 标记首末班 | ||
| 49 | - * @param list | ||
| 50 | - */ | ||
| 51 | - public static void marks(List<ScheduleRealInfo> list){ | ||
| 52 | - try{ | ||
| 53 | - Collections.sort(list, new ScheduleComparator.FCSJ()); | ||
| 54 | - //按上下行分组 | ||
| 55 | - List<ScheduleRealInfo> ups = new ArrayList<>(), | ||
| 56 | - downs = new ArrayList<>(); | ||
| 57 | - | ||
| 58 | - for(ScheduleRealInfo sch : list){ | ||
| 59 | - if(sch.getXlDir().equals("0")) | ||
| 60 | - ups.add(sch); | ||
| 61 | - else | ||
| 62 | - downs.add(sch); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - markOneWay(ups); | ||
| 66 | - markOneWay(downs); | ||
| 67 | - }catch (Exception e){ | ||
| 68 | - log.error("", e); | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - /** | ||
| 73 | - * 标记单程,上行或下行 | ||
| 74 | - * @param list | ||
| 75 | - */ | ||
| 76 | - private static void markOneWay(List<ScheduleRealInfo> list){ | ||
| 77 | - ScheduleRealInfo first = null, last = null; | ||
| 78 | - | ||
| 79 | - for(ScheduleRealInfo sch: list){ | ||
| 80 | - if(sch._isInout() || sch.getBcType().equals("region") | ||
| 81 | - || sch.getBcType().equals("venting")) | ||
| 82 | - continue; | ||
| 83 | - | ||
| 84 | - if(first == null) | ||
| 85 | - first = sch; | ||
| 86 | - | ||
| 87 | - last = sch; | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - put(first, last); | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - private static void put(ScheduleRealInfo first, ScheduleRealInfo last){ | ||
| 94 | - if(first == null || last == null) | ||
| 95 | - return; | ||
| 96 | - | ||
| 97 | - ToGateway tg = new ToGateway(); | ||
| 98 | - tg.setLineCode(first.getXlBm()); | ||
| 99 | - tg.setUpDown(Integer.parseInt(first.getXlDir())); | ||
| 100 | - tg.setsDeviceId(BasicData.deviceId2NbbmMap.inverse().get(first.getClZbh())); | ||
| 101 | - tg.setSt(first.getDfsjT()); | ||
| 102 | - | ||
| 103 | - tg.setRq(first.getScheduleDateStr()); | ||
| 104 | - | ||
| 105 | - tg.seteDeviceId(BasicData.deviceId2NbbmMap.inverse().get(last.getClZbh())); | ||
| 106 | - tg.setEt(last.getDfsjT()); | ||
| 107 | - | ||
| 108 | - maps.put(tg.getLineCode() + "_" + tg.getUpDown(), tg); | ||
| 109 | - flag = true; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - public static void saveAll(){ | ||
| 113 | - if(!flag) | ||
| 114 | - return; | ||
| 115 | - | ||
| 116 | - final List<ToGateway> pstList = new ArrayList<>(maps.values()); | ||
| 117 | - if(pstList == null || pstList.size() == 0) | ||
| 118 | - return; | ||
| 119 | - | ||
| 120 | - flag = false; | ||
| 121 | - JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_MS.getDataSource()); | ||
| 122 | - //编程式事务 | ||
| 123 | - DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemp.getDataSource()); | ||
| 124 | - DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
| 125 | - def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
| 126 | - TransactionStatus status = tran.getTransaction(def); | ||
| 127 | - | ||
| 128 | - try{ | ||
| 129 | - //删除 | ||
| 130 | - jdbcTemp.update("delete from bsth_t_first_last"); | ||
| 131 | - //重新写入 | ||
| 132 | - jdbcTemp.batchUpdate("insert into bsth_t_first_last(line_code, s_device_id, st, e_device_id, et, up_down, rq) VALUES(?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() { | ||
| 133 | - @Override | ||
| 134 | - public void setValues(PreparedStatement ps, int i) throws SQLException { | ||
| 135 | - ToGateway tg = pstList.get(i); | ||
| 136 | - ps.setString(1, tg.getLineCode()); | ||
| 137 | - ps.setString(2, tg.getsDeviceId()); | ||
| 138 | - ps.setLong(3, tg.getSt()); | ||
| 139 | - ps.setString(4, tg.geteDeviceId()); | ||
| 140 | - ps.setLong(5, tg.getEt()); | ||
| 141 | - ps.setInt(6, tg.getUpDown()); | ||
| 142 | - ps.setString(7, tg.getRq()); | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - @Override | ||
| 146 | - public int getBatchSize() { | ||
| 147 | - return pstList.size(); | ||
| 148 | - } | ||
| 149 | - }); | ||
| 150 | - | ||
| 151 | - log.info("首末班数据入库," + pstList.size()); | ||
| 152 | - tran.commit(status); | ||
| 153 | - }catch (Exception e){ | ||
| 154 | - log.error("", e); | ||
| 155 | - tran.rollback(status); | ||
| 156 | - } | ||
| 157 | - } | ||
| 158 | -} | 1 | +package com.bsth.data.schedule.f_a_l; |
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 5 | +import com.bsth.data.schedule.ScheduleComparator; | ||
| 6 | +import com.bsth.data.schedule.f_a_l.entity.ToGateway; | ||
| 7 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 8 | +import com.bsth.util.db.DBUtils_MS; | ||
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.jdbc.core.BatchPreparedStatementSetter; | ||
| 13 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 14 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | ||
| 15 | +import org.springframework.stereotype.Component; | ||
| 16 | +import org.springframework.transaction.TransactionDefinition; | ||
| 17 | +import org.springframework.transaction.TransactionStatus; | ||
| 18 | +import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
| 19 | + | ||
| 20 | +import java.sql.PreparedStatement; | ||
| 21 | +import java.sql.SQLException; | ||
| 22 | +import java.util.ArrayList; | ||
| 23 | +import java.util.Collections; | ||
| 24 | +import java.util.List; | ||
| 25 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + * 首末班处理程序 | ||
| 29 | + * Created by panzhao on 2017/7/19. | ||
| 30 | + */ | ||
| 31 | +@Component | ||
| 32 | +public class FirstAndLastHandler { | ||
| 33 | + | ||
| 34 | + static ConcurrentHashMap<String, ToGateway> maps = new ConcurrentHashMap<>(); | ||
| 35 | + | ||
| 36 | + static Logger log = LoggerFactory.getLogger(FirstAndLastHandler.class); | ||
| 37 | + | ||
| 38 | + static boolean flag; | ||
| 39 | + | ||
| 40 | + @Autowired | ||
| 41 | + DayOfSchedule dayOfSchedule; | ||
| 42 | + | ||
| 43 | + public void marks(String lineCode){ | ||
| 44 | + marks(dayOfSchedule.findByLineCode(lineCode)); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 标记首末班 | ||
| 49 | + * @param list | ||
| 50 | + */ | ||
| 51 | + public static void marks(List<ScheduleRealInfo> list){ | ||
| 52 | + try{ | ||
| 53 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | ||
| 54 | + //按上下行分组 | ||
| 55 | + List<ScheduleRealInfo> ups = new ArrayList<>(), | ||
| 56 | + downs = new ArrayList<>(); | ||
| 57 | + | ||
| 58 | + for(ScheduleRealInfo sch : list){ | ||
| 59 | + if(sch.getXlDir().equals("0")) | ||
| 60 | + ups.add(sch); | ||
| 61 | + else | ||
| 62 | + downs.add(sch); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + markOneWay(ups); | ||
| 66 | + markOneWay(downs); | ||
| 67 | + }catch (Exception e){ | ||
| 68 | + log.error("", e); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 标记单程,上行或下行 | ||
| 74 | + * @param list | ||
| 75 | + */ | ||
| 76 | + private static void markOneWay(List<ScheduleRealInfo> list){ | ||
| 77 | + ScheduleRealInfo first = null, last = null; | ||
| 78 | + | ||
| 79 | + for(ScheduleRealInfo sch: list){ | ||
| 80 | + if(sch._isInout() || sch.getBcType().equals("region") | ||
| 81 | + || sch.getBcType().equals("venting")) | ||
| 82 | + continue; | ||
| 83 | + | ||
| 84 | + if(first == null) | ||
| 85 | + first = sch; | ||
| 86 | + | ||
| 87 | + last = sch; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + put(first, last); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + private static void put(ScheduleRealInfo first, ScheduleRealInfo last){ | ||
| 94 | + if(first == null || last == null) | ||
| 95 | + return; | ||
| 96 | + | ||
| 97 | + ToGateway tg = new ToGateway(); | ||
| 98 | + tg.setLineCode(first.getXlBm()); | ||
| 99 | + tg.setUpDown(Integer.parseInt(first.getXlDir())); | ||
| 100 | + tg.setsDeviceId(BasicData.deviceId2NbbmMap.inverse().get(first.getClZbh())); | ||
| 101 | + tg.setSt(first.getDfsjT()); | ||
| 102 | + | ||
| 103 | + tg.setRq(first.getScheduleDateStr()); | ||
| 104 | + | ||
| 105 | + tg.seteDeviceId(BasicData.deviceId2NbbmMap.inverse().get(last.getClZbh())); | ||
| 106 | + tg.setEt(last.getDfsjT()); | ||
| 107 | + | ||
| 108 | + maps.put(tg.getLineCode() + "_" + tg.getUpDown(), tg); | ||
| 109 | + flag = true; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public static void saveAll(){ | ||
| 113 | + if(!flag) | ||
| 114 | + return; | ||
| 115 | + | ||
| 116 | + final List<ToGateway> pstList = new ArrayList<>(maps.values()); | ||
| 117 | + if(pstList == null || pstList.size() == 0) | ||
| 118 | + return; | ||
| 119 | + | ||
| 120 | + flag = false; | ||
| 121 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_MS.getDataSource()); | ||
| 122 | + //编程式事务 | ||
| 123 | + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemp.getDataSource()); | ||
| 124 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
| 125 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
| 126 | + TransactionStatus status = tran.getTransaction(def); | ||
| 127 | + | ||
| 128 | + try{ | ||
| 129 | + //删除 | ||
| 130 | + jdbcTemp.update("delete from bsth_t_first_last"); | ||
| 131 | + //重新写入 | ||
| 132 | + jdbcTemp.batchUpdate("insert into bsth_t_first_last(line_code, s_device_id, st, e_device_id, et, up_down, rq) VALUES(?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() { | ||
| 133 | + @Override | ||
| 134 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | ||
| 135 | + ToGateway tg = pstList.get(i); | ||
| 136 | + ps.setString(1, tg.getLineCode()); | ||
| 137 | + ps.setString(2, tg.getsDeviceId()); | ||
| 138 | + ps.setLong(3, tg.getSt()); | ||
| 139 | + ps.setString(4, tg.geteDeviceId()); | ||
| 140 | + ps.setLong(5, tg.getEt()); | ||
| 141 | + ps.setInt(6, tg.getUpDown()); | ||
| 142 | + ps.setString(7, tg.getRq()); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + @Override | ||
| 146 | + public int getBatchSize() { | ||
| 147 | + return pstList.size(); | ||
| 148 | + } | ||
| 149 | + }); | ||
| 150 | + | ||
| 151 | + log.info("首末班数据入库," + pstList.size()); | ||
| 152 | + tran.commit(status); | ||
| 153 | + }catch (Exception e){ | ||
| 154 | + log.error("", e); | ||
| 155 | + tran.rollback(status); | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | +} |
src/main/java/com/bsth/data/schedule/f_a_l/entity/ToGateway.java
| 1 | -package com.bsth.data.schedule.f_a_l.entity; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * 发送给网关的首末班数据格式 | ||
| 5 | - * Created by panzhao on 2017/7/19. | ||
| 6 | - */ | ||
| 7 | -public class ToGateway { | ||
| 8 | - | ||
| 9 | - /** 线路 */ | ||
| 10 | - private String lineCode; | ||
| 11 | - | ||
| 12 | - /** 上下行 */ | ||
| 13 | - private int upDown; | ||
| 14 | - | ||
| 15 | - /** 首班设备号 */ | ||
| 16 | - private String sDeviceId; | ||
| 17 | - | ||
| 18 | - /** 首班时间 */ | ||
| 19 | - private Long st; | ||
| 20 | - | ||
| 21 | - /** 末班设备号 */ | ||
| 22 | - private String eDeviceId; | ||
| 23 | - | ||
| 24 | - /** 末班时间 */ | ||
| 25 | - private Long et; | ||
| 26 | - | ||
| 27 | - /** 班次日期 */ | ||
| 28 | - private String rq; | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - public String getLineCode() { | ||
| 32 | - return lineCode; | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - public void setLineCode(String lineCode) { | ||
| 36 | - this.lineCode = lineCode; | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - public Long getSt() { | ||
| 40 | - return st; | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - public void setSt(Long st) { | ||
| 44 | - this.st = st; | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - public Long getEt() { | ||
| 48 | - return et; | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - public void setEt(Long et) { | ||
| 52 | - this.et = et; | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - public String getRq() { | ||
| 56 | - return rq; | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - public void setRq(String rq) { | ||
| 60 | - this.rq = rq; | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - public int getUpDown() { | ||
| 64 | - return upDown; | ||
| 65 | - } | ||
| 66 | - | ||
| 67 | - public void setUpDown(int upDown) { | ||
| 68 | - this.upDown = upDown; | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - public String getsDeviceId() { | ||
| 72 | - return sDeviceId; | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - public void setsDeviceId(String sDeviceId) { | ||
| 76 | - this.sDeviceId = sDeviceId; | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - public String geteDeviceId() { | ||
| 80 | - return eDeviceId; | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - public void seteDeviceId(String eDeviceId) { | ||
| 84 | - this.eDeviceId = eDeviceId; | ||
| 85 | - } | ||
| 86 | -} | 1 | +package com.bsth.data.schedule.f_a_l.entity; |
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 发送给网关的首末班数据格式 | ||
| 5 | + * Created by panzhao on 2017/7/19. | ||
| 6 | + */ | ||
| 7 | +public class ToGateway { | ||
| 8 | + | ||
| 9 | + /** 线路 */ | ||
| 10 | + private String lineCode; | ||
| 11 | + | ||
| 12 | + /** 上下行 */ | ||
| 13 | + private int upDown; | ||
| 14 | + | ||
| 15 | + /** 首班设备号 */ | ||
| 16 | + private String sDeviceId; | ||
| 17 | + | ||
| 18 | + /** 首班时间 */ | ||
| 19 | + private Long st; | ||
| 20 | + | ||
| 21 | + /** 末班设备号 */ | ||
| 22 | + private String eDeviceId; | ||
| 23 | + | ||
| 24 | + /** 末班时间 */ | ||
| 25 | + private Long et; | ||
| 26 | + | ||
| 27 | + /** 班次日期 */ | ||
| 28 | + private String rq; | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + public String getLineCode() { | ||
| 32 | + return lineCode; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public void setLineCode(String lineCode) { | ||
| 36 | + this.lineCode = lineCode; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public Long getSt() { | ||
| 40 | + return st; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public void setSt(Long st) { | ||
| 44 | + this.st = st; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public Long getEt() { | ||
| 48 | + return et; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public void setEt(Long et) { | ||
| 52 | + this.et = et; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public String getRq() { | ||
| 56 | + return rq; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public void setRq(String rq) { | ||
| 60 | + this.rq = rq; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public int getUpDown() { | ||
| 64 | + return upDown; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public void setUpDown(int upDown) { | ||
| 68 | + this.upDown = upDown; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public String getsDeviceId() { | ||
| 72 | + return sDeviceId; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public void setsDeviceId(String sDeviceId) { | ||
| 76 | + this.sDeviceId = sDeviceId; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public String geteDeviceId() { | ||
| 80 | + return eDeviceId; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public void seteDeviceId(String eDeviceId) { | ||
| 84 | + this.eDeviceId = eDeviceId; | ||
| 85 | + } | ||
| 86 | +} |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -105,7 +105,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -105,7 +105,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 105 | List<Map<String,Object>> accountPx(String line,String date,String code,String xlName, String px); | 105 | List<Map<String,Object>> accountPx(String line,String date,String code,String xlName, String px); |
| 106 | 106 | ||
| 107 | 107 | ||
| 108 | - List<SchEditInfoDto> correctForm(String line,String date,String endDate,String lpName,String code, String type); | 108 | + List<SchEditInfoDto> correctForm(String line,String date,String endDate,String lpName,String code, String type,String changType); |
| 109 | 109 | ||
| 110 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); | 110 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); |
| 111 | 111 |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -1810,7 +1810,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1810,7 +1810,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1810 | 1810 | ||
| 1811 | @Override | 1811 | @Override |
| 1812 | public List<SchEditInfoDto> correctForm(String line,String date,String endDate, | 1812 | public List<SchEditInfoDto> correctForm(String line,String date,String endDate, |
| 1813 | - String lpName,String code, String type) { | 1813 | + String lpName,String code, String type,String changType) { |
| 1814 | 1814 | ||
| 1815 | // var types = {'DFTZ': '待发调整', 'FCXXWT':'发车信息微调', 'JHLB': '计划烂班', 'CXLB': '撤销烂班', | 1815 | // var types = {'DFTZ': '待发调整', 'FCXXWT':'发车信息微调', 'JHLB': '计划烂班', 'CXLB': '撤销烂班', |
| 1816 | // 'CXZX': '撤销执行', 'CXSF': '撤销实发', 'SFTZ': '实发调整', 'TZRC': '调整人车'}; | 1816 | // 'CXZX': '撤销执行', 'CXSF': '撤销实发', 'SFTZ': '实发调整', 'TZRC': '调整人车'}; |
| @@ -1824,6 +1824,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1824,6 +1824,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1824 | map.put("SFTZ", "实发调整"); | 1824 | map.put("SFTZ", "实发调整"); |
| 1825 | map.put("TZRC", "调整人车"); | 1825 | map.put("TZRC", "调整人车"); |
| 1826 | 1826 | ||
| 1827 | + SimpleDateFormat sdf1=new SimpleDateFormat("HH:mm"); | ||
| 1828 | + SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 1827 | String cont = ""; | 1829 | String cont = ""; |
| 1828 | cont = " and xl_bm ='"+line +"'"; | 1830 | cont = " and xl_bm ='"+line +"'"; |
| 1829 | if(!lpName.equals("")){ | 1831 | if(!lpName.equals("")){ |
| @@ -1832,7 +1834,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1832,7 +1834,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1832 | if(!code.equals("")){ | 1834 | if(!code.equals("")){ |
| 1833 | cont +=" and cl_zbh ='"+code+"'"; | 1835 | cont +=" and cl_zbh ='"+code+"'"; |
| 1834 | } | 1836 | } |
| 1835 | - String sql = "select t1.*, " | 1837 | + String sql = "select t1.*, t2.real_exec_date," |
| 1836 | + "t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name," | 1838 | + "t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name," |
| 1837 | + "t2.xl_dir,t2.real_exec_date from (select * from " | 1839 | + "t2.xl_dir,t2.real_exec_date from (select * from " |
| 1838 | + "logger_sch_modify where rq BETWEEN ? and ? and line_code=? )" | 1840 | + "logger_sch_modify where rq BETWEEN ? and ? and line_code=? )" |
| @@ -1843,9 +1845,39 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1843,9 +1845,39 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1843 | new BeanPropertyRowMapper(SchEditInfoDto.class),date,endDate, line); | 1845 | new BeanPropertyRowMapper(SchEditInfoDto.class),date,endDate, line); |
| 1844 | List<SchEditInfoDto> lists=new ArrayList<SchEditInfoDto>(); | 1846 | List<SchEditInfoDto> lists=new ArrayList<SchEditInfoDto>(); |
| 1845 | for (int i = 0; i < list.size(); i++) { | 1847 | for (int i = 0; i < list.size(); i++) { |
| 1848 | + Long fcsjs=0l; | ||
| 1849 | + Long updsj=0l; | ||
| 1846 | SchEditInfoDto t=list.get(i); | 1850 | SchEditInfoDto t=list.get(i); |
| 1847 | if(map.get(t.getType())!=null){ | 1851 | if(map.get(t.getType())!=null){ |
| 1848 | - t.setType2(t.getUser()+"于"+t.getTimeStr()+"进行"+map.get(t.getType()).toString()+";"); | 1852 | + |
| 1853 | + if(changType.equals("")){ | ||
| 1854 | + t.setType2(t.getUser()+"于"+t.getTimeStr()+"进行"+map.get(t.getType()).toString()+";"); | ||
| 1855 | + }else{ | ||
| 1856 | + String fcsj=""; | ||
| 1857 | + String updtime=""; | ||
| 1858 | + try { | ||
| 1859 | + fcsj= sdf1.format(sdf1.parse(t.getFcsj())); | ||
| 1860 | + updtime=sdf1.format(sdf1.parse(t.getTimeStr())); | ||
| 1861 | + fcsjs=sdf2.parse(t.getRealExecDate()+" "+fcsj).getTime(); | ||
| 1862 | + updsj=sdf2.parse(t.getRq()+" "+updtime).getTime(); | ||
| 1863 | + } catch (ParseException e) { | ||
| 1864 | + // TODO Auto-generated catch block | ||
| 1865 | + e.printStackTrace(); | ||
| 1866 | + } | ||
| 1867 | + if(changType.equals("1")){ | ||
| 1868 | + if(fcsjs>updsj){ | ||
| 1869 | + t.setType2(t.getUser()+"于"+t.getTimeStr()+"进行"+map.get(t.getType()).toString()+";"); | ||
| 1870 | + }else{ | ||
| 1871 | + t.setType2(""); | ||
| 1872 | + } | ||
| 1873 | + }else if(changType.equals("2")){ | ||
| 1874 | + if(fcsjs<updsj){ | ||
| 1875 | + t.setType2(t.getUser()+"于"+t.getTimeStr()+"进行"+map.get(t.getType()).toString()+";"); | ||
| 1876 | + }else{ | ||
| 1877 | + t.setType2(""); | ||
| 1878 | + } | ||
| 1879 | + } | ||
| 1880 | + } | ||
| 1849 | }else{ | 1881 | }else{ |
| 1850 | t.setType2(""); | 1882 | t.setType2(""); |
| 1851 | } | 1883 | } |
| @@ -1859,7 +1891,19 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1859,7 +1891,19 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1859 | } | 1891 | } |
| 1860 | 1892 | ||
| 1861 | if(fage){ | 1893 | if(fage){ |
| 1862 | - lists.add(t); | 1894 | + if(changType.equals("")){ |
| 1895 | + lists.add(t); | ||
| 1896 | + } else { | ||
| 1897 | + if (changType.equals("1")) { | ||
| 1898 | + if (fcsjs > updsj) { | ||
| 1899 | + lists.add(t); | ||
| 1900 | + } | ||
| 1901 | + } else if (changType.equals("2")) { | ||
| 1902 | + if (fcsjs < updsj) { | ||
| 1903 | + lists.add(t); | ||
| 1904 | + } | ||
| 1905 | + } | ||
| 1906 | + } | ||
| 1863 | } | 1907 | } |
| 1864 | } | 1908 | } |
| 1865 | 1909 |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| @@ -4,6 +4,7 @@ import com.bsth.entity.Line; | @@ -4,6 +4,7 @@ import com.bsth.entity.Line; | ||
| 4 | import com.bsth.entity.Personnel; | 4 | import com.bsth.entity.Personnel; |
| 5 | import com.bsth.entity.StationRoute; | 5 | import com.bsth.entity.StationRoute; |
| 6 | import com.bsth.entity.excep.ArrivalInfo; | 6 | import com.bsth.entity.excep.ArrivalInfo; |
| 7 | +import com.bsth.entity.mcy_forms.Daily; | ||
| 7 | import com.bsth.entity.oil.Dlb; | 8 | import com.bsth.entity.oil.Dlb; |
| 8 | import com.bsth.entity.oil.Ylb; | 9 | import com.bsth.entity.oil.Ylb; |
| 9 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 10 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| @@ -2234,6 +2235,7 @@ public class ReportServiceImpl implements ReportService{ | @@ -2234,6 +2235,7 @@ public class ReportServiceImpl implements ReportService{ | ||
| 2234 | String date=map.get("date").toString(); | 2235 | String date=map.get("date").toString(); |
| 2235 | String gsbm=map.get("gsbm").toString(); | 2236 | String gsbm=map.get("gsbm").toString(); |
| 2236 | String fgsbm=map.get("fgsbm").toString(); | 2237 | String fgsbm=map.get("fgsbm").toString(); |
| 2238 | + String type=map.get("type").toString(); | ||
| 2237 | List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | 2239 | List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); |
| 2238 | if(line.equals("")){ | 2240 | if(line.equals("")){ |
| 2239 | list=scheduleRealInfoRepository.scheduleByDateAndLineByGs(gsbm, fgsbm, date); | 2241 | list=scheduleRealInfoRepository.scheduleByDateAndLineByGs(gsbm, fgsbm, date); |
| @@ -2273,7 +2275,6 @@ public class ReportServiceImpl implements ReportService{ | @@ -2273,7 +2275,6 @@ public class ReportServiceImpl implements ReportService{ | ||
| 2273 | } | 2275 | } |
| 2274 | }); | 2276 | }); |
| 2275 | 2277 | ||
| 2276 | - | ||
| 2277 | for (int i = 0; i < xlList.size(); i++) { | 2278 | for (int i = 0; i < xlList.size(); i++) { |
| 2278 | String lineCode=xlList.get(i).get("line").toString(); | 2279 | String lineCode=xlList.get(i).get("line").toString(); |
| 2279 | String grade =xlList.get(i).get("grade").toString(); | 2280 | String grade =xlList.get(i).get("grade").toString(); |
| @@ -2309,6 +2310,7 @@ public class ReportServiceImpl implements ReportService{ | @@ -2309,6 +2310,7 @@ public class ReportServiceImpl implements ReportService{ | ||
| 2309 | e.printStackTrace(); | 2310 | e.printStackTrace(); |
| 2310 | } | 2311 | } |
| 2311 | } | 2312 | } |
| 2313 | + | ||
| 2312 | if(listInfo.size()>0){ | 2314 | if(listInfo.size()>0){ |
| 2313 | int sjbcs=culateService.culateSjbc(list_, "")+culateService.culateLjbc(list_, ""); | 2315 | int sjbcs=culateService.culateSjbc(list_, "")+culateService.culateLjbc(list_, ""); |
| 2314 | Map<String, Object> m=listDjg(gsbm,fgsbm,lineCode,sjbcs,peak,trough,listInfo,grade); | 2316 | Map<String, Object> m=listDjg(gsbm,fgsbm,lineCode,sjbcs,peak,trough,listInfo,grade); |
| @@ -2316,6 +2318,21 @@ public class ReportServiceImpl implements ReportService{ | @@ -2316,6 +2318,21 @@ public class ReportServiceImpl implements ReportService{ | ||
| 2316 | } | 2318 | } |
| 2317 | 2319 | ||
| 2318 | } | 2320 | } |
| 2321 | + if(type.equals("export")){ | ||
| 2322 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 2323 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 2324 | + m.put("date", date); | ||
| 2325 | + ReportUtils ee = new ReportUtils(); | ||
| 2326 | + try { | ||
| 2327 | + listI.add(lMap.iterator()); | ||
| 2328 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 2329 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/countInterval.xls", | ||
| 2330 | + path + "export/大间隔统计表.xls"); | ||
| 2331 | + } catch (Exception e) { | ||
| 2332 | + // TODO: handle exception | ||
| 2333 | + e.printStackTrace(); | ||
| 2334 | + } | ||
| 2335 | + } | ||
| 2319 | return lMap; | 2336 | return lMap; |
| 2320 | } | 2337 | } |
| 2321 | 2338 |