@Test public void testFormatJson() throws Exception { }
public JSONObject formatJson(JSONObject jsonObject, List<HashMap> arrangementRule){ JSONArray personalRulesArray = new JSONArray(); for(HashMap personalRule : arrangementRule){ String timeStr = ""; if((Boolean)personalRule.get("monAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monAm"); if((Boolean)personalRule.get("monPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monPm"); if((Boolean)personalRule.get("tueAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tueAm"); if((Boolean)personalRule.get("tuePm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tuePm"); if((Boolean)personalRule.get("wedAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedAm"); if((Boolean)personalRule.get("wedPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedPm"); if((Boolean)personalRule.get("thuAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuAm"); if((Boolean)personalRule.get("thuPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuPm"); if((Boolean)personalRule.get("friAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friAm"); if((Boolean)personalRule.get("friPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friPm"); if((Boolean)personalRule.get("satAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satAm"); if((Boolean)personalRule.get("satPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satPm"); if((Boolean)personalRule.get("sunAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunAm"); if((Boolean)personalRule.get("sunPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunPm"); personalRule.put("ruleTime", timeStr); personalRulesArray.add(personalRule); } jsonObject.put("arrangementRule", personalRulesArray); return jsonObject; }
ArrangementManagementServiceImpl implements ArrangementManagementService { public JSONObject formatJson(JSONObject jsonObject, List<HashMap> arrangementRule){ JSONArray personalRulesArray = new JSONArray(); for(HashMap personalRule : arrangementRule){ String timeStr = ""; if((Boolean)personalRule.get("monAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monAm"); if((Boolean)personalRule.get("monPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monPm"); if((Boolean)personalRule.get("tueAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tueAm"); if((Boolean)personalRule.get("tuePm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tuePm"); if((Boolean)personalRule.get("wedAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedAm"); if((Boolean)personalRule.get("wedPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedPm"); if((Boolean)personalRule.get("thuAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuAm"); if((Boolean)personalRule.get("thuPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuPm"); if((Boolean)personalRule.get("friAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friAm"); if((Boolean)personalRule.get("friPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friPm"); if((Boolean)personalRule.get("satAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satAm"); if((Boolean)personalRule.get("satPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satPm"); if((Boolean)personalRule.get("sunAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunAm"); if((Boolean)personalRule.get("sunPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunPm"); personalRule.put("ruleTime", timeStr); personalRulesArray.add(personalRule); } jsonObject.put("arrangementRule", personalRulesArray); return jsonObject; } }
ArrangementManagementServiceImpl implements ArrangementManagementService { public JSONObject formatJson(JSONObject jsonObject, List<HashMap> arrangementRule){ JSONArray personalRulesArray = new JSONArray(); for(HashMap personalRule : arrangementRule){ String timeStr = ""; if((Boolean)personalRule.get("monAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monAm"); if((Boolean)personalRule.get("monPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monPm"); if((Boolean)personalRule.get("tueAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tueAm"); if((Boolean)personalRule.get("tuePm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tuePm"); if((Boolean)personalRule.get("wedAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedAm"); if((Boolean)personalRule.get("wedPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedPm"); if((Boolean)personalRule.get("thuAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuAm"); if((Boolean)personalRule.get("thuPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuPm"); if((Boolean)personalRule.get("friAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friAm"); if((Boolean)personalRule.get("friPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friPm"); if((Boolean)personalRule.get("satAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satAm"); if((Boolean)personalRule.get("satPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satPm"); if((Boolean)personalRule.get("sunAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunAm"); if((Boolean)personalRule.get("sunPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunPm"); personalRule.put("ruleTime", timeStr); personalRulesArray.add(personalRule); } jsonObject.put("arrangementRule", personalRulesArray); return jsonObject; }  }
ArrangementManagementServiceImpl implements ArrangementManagementService { public JSONObject formatJson(JSONObject jsonObject, List<HashMap> arrangementRule){ JSONArray personalRulesArray = new JSONArray(); for(HashMap personalRule : arrangementRule){ String timeStr = ""; if((Boolean)personalRule.get("monAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monAm"); if((Boolean)personalRule.get("monPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monPm"); if((Boolean)personalRule.get("tueAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tueAm"); if((Boolean)personalRule.get("tuePm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tuePm"); if((Boolean)personalRule.get("wedAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedAm"); if((Boolean)personalRule.get("wedPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedPm"); if((Boolean)personalRule.get("thuAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuAm"); if((Boolean)personalRule.get("thuPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuPm"); if((Boolean)personalRule.get("friAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friAm"); if((Boolean)personalRule.get("friPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friPm"); if((Boolean)personalRule.get("satAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satAm"); if((Boolean)personalRule.get("satPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satPm"); if((Boolean)personalRule.get("sunAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunAm"); if((Boolean)personalRule.get("sunPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunPm"); personalRule.put("ruleTime", timeStr); personalRulesArray.add(personalRule); } jsonObject.put("arrangementRule", personalRulesArray); return jsonObject; }  @Override CommonResult insertArrangementRule(ArrangementRuleParam arrangementRuleParam); @Override CommonResult listArrangementRules(Integer departmentId); @Override CommonResult insertArrangement(ArrangementParam arrangementParam); List<ArrangementConflictParam> saveArrangement(Date today, int week, Integer departmentId,
                                                          Integer arrangementRuleId, List<Arrangement> arrangements,
                                                          List<ArrangementConflictParam> conflict, Boolean toInsert,
                                                          List<Arrangement> toInsertArrangements); @Override CommonResult listArrangements(Date startDate, Date endDate, Integer departmentId); String getStatusStr(Boolean isValid); @Override CommonResult modifyArrangements(ArrangementParam arrangementParam); @Override CommonResult modifyArrangement(Integer arrangementId, Byte timeSlot); JSONObject formatJson(JSONObject jsonObject, List<HashMap> arrangementRule); }
ArrangementManagementServiceImpl implements ArrangementManagementService { public JSONObject formatJson(JSONObject jsonObject, List<HashMap> arrangementRule){ JSONArray personalRulesArray = new JSONArray(); for(HashMap personalRule : arrangementRule){ String timeStr = ""; if((Boolean)personalRule.get("monAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monAm"); if((Boolean)personalRule.get("monPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("monPm"); if((Boolean)personalRule.get("tueAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tueAm"); if((Boolean)personalRule.get("tuePm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("tuePm"); if((Boolean)personalRule.get("wedAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedAm"); if((Boolean)personalRule.get("wedPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("wedPm"); if((Boolean)personalRule.get("thuAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuAm"); if((Boolean)personalRule.get("thuPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("thuPm"); if((Boolean)personalRule.get("friAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friAm"); if((Boolean)personalRule.get("friPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("friPm"); if((Boolean)personalRule.get("satAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satAm"); if((Boolean)personalRule.get("satPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("satPm"); if((Boolean)personalRule.get("sunAm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunAm"); if((Boolean)personalRule.get("sunPm") == true) timeStr = timeStr + 1; else timeStr = timeStr + 0; personalRule.remove("sunPm"); personalRule.put("ruleTime", timeStr); personalRulesArray.add(personalRule); } jsonObject.put("arrangementRule", personalRulesArray); return jsonObject; }  @Override CommonResult insertArrangementRule(ArrangementRuleParam arrangementRuleParam); @Override CommonResult listArrangementRules(Integer departmentId); @Override CommonResult insertArrangement(ArrangementParam arrangementParam); List<ArrangementConflictParam> saveArrangement(Date today, int week, Integer departmentId,
                                                          Integer arrangementRuleId, List<Arrangement> arrangements,
                                                          List<ArrangementConflictParam> conflict, Boolean toInsert,
                                                          List<Arrangement> toInsertArrangements); @Override CommonResult listArrangements(Date startDate, Date endDate, Integer departmentId); String getStatusStr(Boolean isValid); @Override CommonResult modifyArrangements(ArrangementParam arrangementParam); @Override CommonResult modifyArrangement(Integer arrangementId, Byte timeSlot); JSONObject formatJson(JSONObject jsonObject, List<HashMap> arrangementRule);  }