Commit 0d76655f650749727278ac36f6a5a544b4517c3f
1 parent
4da7d734
1.维修上报
Showing
3 changed files
with
26 additions
and
3 deletions
src/main/java/com/bsth/entity/report/RepairReport.java
| ... | ... | @@ -46,6 +46,8 @@ public class RepairReport { |
| 46 | 46 | // 格式化的时间字符串 |
| 47 | 47 | @Transient |
| 48 | 48 | private String reportStateStr; |
| 49 | + // 上报方式 0自动 1主动 | |
| 50 | + private int reportMode; | |
| 49 | 51 | |
| 50 | 52 | public Integer getId() { |
| 51 | 53 | return id; |
| ... | ... | @@ -150,4 +152,12 @@ public class RepairReport { |
| 150 | 152 | public void setReportStateStr(String reportStateStr) { |
| 151 | 153 | this.reportStateStr = reportStateStr; |
| 152 | 154 | } |
| 155 | + | |
| 156 | + public int getReportMode() { | |
| 157 | + return reportMode; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public void setReportMode(int reportMode) { | |
| 161 | + this.reportMode = reportMode; | |
| 162 | + } | |
| 153 | 163 | } | ... | ... |
src/main/java/com/bsth/repository/RepairReportRepository.java
| ... | ... | @@ -31,4 +31,7 @@ public interface RepairReportRepository extends BaseRepository<RepairReport, Int |
| 31 | 31 | + " RepairReport r where r.lineId = ?1 and r.reportDate between ?2 and " |
| 32 | 32 | + "?3 and r.incode like ?4%") |
| 33 | 33 | List<RepairReport> repairReportList(String lineId,Date start,Date end,String incode); |
| 34 | + | |
| 35 | + @Query(value="select count(r) from RepairReport r where r.schId = ?1 and r.reportMode = ?2") | |
| 36 | + int repairReportBySch(Long schId, int reportMode); | |
| 34 | 37 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -1534,6 +1534,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1534 | 1534 | |
| 1535 | 1535 | private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); |
| 1536 | 1536 | |
| 1537 | + @Transactional | |
| 1537 | 1538 | @Override |
| 1538 | 1539 | public Map<String, Object> schInfoFineTune(Map<String, String> map) { |
| 1539 | 1540 | Map<String, Object> rs = new HashMap<>(); |
| ... | ... | @@ -1543,7 +1544,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1543 | 1544 | if (StringUtils.isNotBlank(map.get("repairTypes"))) { |
| 1544 | 1545 | Map<String, Object> param = new HashMap<String, Object>(); |
| 1545 | 1546 | param.putAll(map); |
| 1546 | - repairReport(param, false); | |
| 1547 | + Map<String, Object> rrs = repairReport(param, false); | |
| 1548 | + if (ResponseCode.ERROR.equals(rrs.get("status"))) { | |
| 1549 | + return rrs; | |
| 1550 | + } | |
| 1547 | 1551 | } |
| 1548 | 1552 | |
| 1549 | 1553 | Long id = Long.parseLong(map.get("id")); |
| ... | ... | @@ -6068,6 +6072,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 6068 | 6072 | res.put("status", ResponseCode.ERROR); |
| 6069 | 6073 | res.putAll(response); |
| 6070 | 6074 | } |
| 6075 | + } else { | |
| 6076 | + res.put("status", ResponseCode.ERROR); | |
| 6077 | + res.put("msg", "调用上报接口异常"); | |
| 6071 | 6078 | } |
| 6072 | 6079 | } catch (IOException e) { |
| 6073 | 6080 | // TODO Auto-generated catch block |
| ... | ... | @@ -6116,9 +6123,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 6116 | 6123 | StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1])); |
| 6117 | 6124 | url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]); |
| 6118 | 6125 | |
| 6126 | + int count = repairReportRepository.repairReportBySch(id, 0); | |
| 6127 | + if (count > 0) return res; | |
| 6119 | 6128 | RepairReport lrr = dayOfSchedule.getLastestRepairReport(incode); |
| 6120 | - // 非主动上报并且无上报记录或上次已上报或上次上报的同一个班次 则不用上报 | |
| 6121 | - if (!isActive && (lrr == null || lrr.getReportState() != 0 || lrr.getSchId().equals(id))) { | |
| 6129 | + // 非主动上报并且无上报记录或上次已上报 则不用上报 | |
| 6130 | + if (!isActive && (lrr == null || lrr.getReportState() != 0)) { | |
| 6122 | 6131 | reportState = 0; |
| 6123 | 6132 | } else { |
| 6124 | 6133 | res = request(url.toString()); |
| ... | ... | @@ -6136,6 +6145,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 6136 | 6145 | rr.setRepairType(repairTypes); |
| 6137 | 6146 | rr.setReportDate(new Date()); |
| 6138 | 6147 | rr.setReportState(reportState); |
| 6148 | + rr.setReportMode(isActive ? 1 : 0); | |
| 6139 | 6149 | repairReportRepository.save(rr); |
| 6140 | 6150 | dayOfSchedule.setLastestRepairReport(rr); |
| 6141 | 6151 | ... | ... |