Mod set default as -1 for没有传上来值的item
Showing
1 changed file
with
7 additions
and
1 deletions
@@ -204,7 +204,13 @@ public class ReportService implements IReportService { | @@ -204,7 +204,13 @@ public class ReportService implements IReportService { | ||
204 | */ | 204 | */ |
205 | JSONObject rpDetails = rpJson.getJSONObject("detail"); | 205 | JSONObject rpDetails = rpJson.getJSONObject("detail"); |
206 | for (int item_id = 1; item_id <= 125; item_id++) { | 206 | for (int item_id = 1; item_id <= 125; item_id++) { |
207 | - float val = rpDetails.getFloat(String.valueOf(item_id)).floatValue(); | 207 | + float val; |
208 | + try { | ||
209 | + val = rpDetails.getFloat(String.valueOf(item_id)).floatValue(); | ||
210 | + } catch (Exception e) { | ||
211 | + val = -1f; | ||
212 | + log.info("WARNING, lose one item value and set " + item_id + " as defalut -1!!! " + e); | ||
213 | + } | ||
208 | XklAmpReportDetailEntity detail = new XklAmpReportDetailEntity(); | 214 | XklAmpReportDetailEntity detail = new XklAmpReportDetailEntity(); |
209 | detail.setItemValue(val); | 215 | detail.setItemValue(val); |
210 | detail.setItemId(item_id); | 216 | detail.setItemId(item_id); |
-
Please register or login to post a comment