@Test public void testInsertArrangementRule() throws Exception { }
@Override public CommonResult insertArrangementRule(ArrangementRuleParam arrangementRuleParam){ int count = 0; Integer adminId = arrangementRuleParam.getAdminId(); Integer departmentId = arrangementRuleParam.getDepartmentId(); String ruleName = arrangementRuleParam.getRuleName(); if(0 != arrangementRuleMapper.listByRuleName(ruleName).size()){ return CommonResult.fail(ResultCode.E_806); } List<ArrangementRule> arrangementRuleList = arrangementRuleParam.getArrangementRules(); if(0 == arrangementRuleList.size()) return CommonResult.fail(ResultCode.E_801); Integer id = arrangementRuleMapper.getLastId(); if(id == null) id = 0; id = id + 1; for(ArrangementRule arrangementRule : arrangementRuleList){ arrangementRule.setId(id); arrangementRule.setRuleName(ruleName); arrangementRule.setAdminId(adminId); arrangementRule.setDepartmentId(departmentId); arrangementRule.setIsValid(true); Integer roleId = arrangementRule.getRoleId(); Integer titleId = roleMapper.getTitleByRoleId(roleId); Byte levelId; Byte maxAppointment; arrangementRule.setTitleId(titleId); if(titleId == 1 || titleId == 2) { levelId = 2; maxAppointment = 20; } else if(titleId == 3 || titleId == 4) { levelId = 1; maxAppointment = 50; } else return CommonResult.fail(ResultCode.E_801); arrangementRule.setRegistrationLevelId(levelId); arrangementRule.setMaxAppointment(maxAppointment); count = arrangementRuleMapper.insertSelective(arrangementRule); if(count <= 0) return CommonResult.fail(ResultCode.E_802); } return CommonResult.success(count); }
ArrangementManagementServiceImpl implements ArrangementManagementService { @Override public CommonResult insertArrangementRule(ArrangementRuleParam arrangementRuleParam){ int count = 0; Integer adminId = arrangementRuleParam.getAdminId(); Integer departmentId = arrangementRuleParam.getDepartmentId(); String ruleName = arrangementRuleParam.getRuleName(); if(0 != arrangementRuleMapper.listByRuleName(ruleName).size()){ return CommonResult.fail(ResultCode.E_806); } List<ArrangementRule> arrangementRuleList = arrangementRuleParam.getArrangementRules(); if(0 == arrangementRuleList.size()) return CommonResult.fail(ResultCode.E_801); Integer id = arrangementRuleMapper.getLastId(); if(id == null) id = 0; id = id + 1; for(ArrangementRule arrangementRule : arrangementRuleList){ arrangementRule.setId(id); arrangementRule.setRuleName(ruleName); arrangementRule.setAdminId(adminId); arrangementRule.setDepartmentId(departmentId); arrangementRule.setIsValid(true); Integer roleId = arrangementRule.getRoleId(); Integer titleId = roleMapper.getTitleByRoleId(roleId); Byte levelId; Byte maxAppointment; arrangementRule.setTitleId(titleId); if(titleId == 1 || titleId == 2) { levelId = 2; maxAppointment = 20; } else if(titleId == 3 || titleId == 4) { levelId = 1; maxAppointment = 50; } else return CommonResult.fail(ResultCode.E_801); arrangementRule.setRegistrationLevelId(levelId); arrangementRule.setMaxAppointment(maxAppointment); count = arrangementRuleMapper.insertSelective(arrangementRule); if(count <= 0) return CommonResult.fail(ResultCode.E_802); } return CommonResult.success(count); } }
ArrangementManagementServiceImpl implements ArrangementManagementService { @Override public CommonResult insertArrangementRule(ArrangementRuleParam arrangementRuleParam){ int count = 0; Integer adminId = arrangementRuleParam.getAdminId(); Integer departmentId = arrangementRuleParam.getDepartmentId(); String ruleName = arrangementRuleParam.getRuleName(); if(0 != arrangementRuleMapper.listByRuleName(ruleName).size()){ return CommonResult.fail(ResultCode.E_806); } List<ArrangementRule> arrangementRuleList = arrangementRuleParam.getArrangementRules(); if(0 == arrangementRuleList.size()) return CommonResult.fail(ResultCode.E_801); Integer id = arrangementRuleMapper.getLastId(); if(id == null) id = 0; id = id + 1; for(ArrangementRule arrangementRule : arrangementRuleList){ arrangementRule.setId(id); arrangementRule.setRuleName(ruleName); arrangementRule.setAdminId(adminId); arrangementRule.setDepartmentId(departmentId); arrangementRule.setIsValid(true); Integer roleId = arrangementRule.getRoleId(); Integer titleId = roleMapper.getTitleByRoleId(roleId); Byte levelId; Byte maxAppointment; arrangementRule.setTitleId(titleId); if(titleId == 1 || titleId == 2) { levelId = 2; maxAppointment = 20; } else if(titleId == 3 || titleId == 4) { levelId = 1; maxAppointment = 50; } else return CommonResult.fail(ResultCode.E_801); arrangementRule.setRegistrationLevelId(levelId); arrangementRule.setMaxAppointment(maxAppointment); count = arrangementRuleMapper.insertSelective(arrangementRule); if(count <= 0) return CommonResult.fail(ResultCode.E_802); } return CommonResult.success(count); }  }
ArrangementManagementServiceImpl implements ArrangementManagementService { @Override public CommonResult insertArrangementRule(ArrangementRuleParam arrangementRuleParam){ int count = 0; Integer adminId = arrangementRuleParam.getAdminId(); Integer departmentId = arrangementRuleParam.getDepartmentId(); String ruleName = arrangementRuleParam.getRuleName(); if(0 != arrangementRuleMapper.listByRuleName(ruleName).size()){ return CommonResult.fail(ResultCode.E_806); } List<ArrangementRule> arrangementRuleList = arrangementRuleParam.getArrangementRules(); if(0 == arrangementRuleList.size()) return CommonResult.fail(ResultCode.E_801); Integer id = arrangementRuleMapper.getLastId(); if(id == null) id = 0; id = id + 1; for(ArrangementRule arrangementRule : arrangementRuleList){ arrangementRule.setId(id); arrangementRule.setRuleName(ruleName); arrangementRule.setAdminId(adminId); arrangementRule.setDepartmentId(departmentId); arrangementRule.setIsValid(true); Integer roleId = arrangementRule.getRoleId(); Integer titleId = roleMapper.getTitleByRoleId(roleId); Byte levelId; Byte maxAppointment; arrangementRule.setTitleId(titleId); if(titleId == 1 || titleId == 2) { levelId = 2; maxAppointment = 20; } else if(titleId == 3 || titleId == 4) { levelId = 1; maxAppointment = 50; } else return CommonResult.fail(ResultCode.E_801); arrangementRule.setRegistrationLevelId(levelId); arrangementRule.setMaxAppointment(maxAppointment); count = arrangementRuleMapper.insertSelective(arrangementRule); if(count <= 0) return CommonResult.fail(ResultCode.E_802); } return CommonResult.success(count); }  @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 { @Override public CommonResult insertArrangementRule(ArrangementRuleParam arrangementRuleParam){ int count = 0; Integer adminId = arrangementRuleParam.getAdminId(); Integer departmentId = arrangementRuleParam.getDepartmentId(); String ruleName = arrangementRuleParam.getRuleName(); if(0 != arrangementRuleMapper.listByRuleName(ruleName).size()){ return CommonResult.fail(ResultCode.E_806); } List<ArrangementRule> arrangementRuleList = arrangementRuleParam.getArrangementRules(); if(0 == arrangementRuleList.size()) return CommonResult.fail(ResultCode.E_801); Integer id = arrangementRuleMapper.getLastId(); if(id == null) id = 0; id = id + 1; for(ArrangementRule arrangementRule : arrangementRuleList){ arrangementRule.setId(id); arrangementRule.setRuleName(ruleName); arrangementRule.setAdminId(adminId); arrangementRule.setDepartmentId(departmentId); arrangementRule.setIsValid(true); Integer roleId = arrangementRule.getRoleId(); Integer titleId = roleMapper.getTitleByRoleId(roleId); Byte levelId; Byte maxAppointment; arrangementRule.setTitleId(titleId); if(titleId == 1 || titleId == 2) { levelId = 2; maxAppointment = 20; } else if(titleId == 3 || titleId == 4) { levelId = 1; maxAppointment = 50; } else return CommonResult.fail(ResultCode.E_801); arrangementRule.setRegistrationLevelId(levelId); arrangementRule.setMaxAppointment(maxAppointment); count = arrangementRuleMapper.insertSelective(arrangementRule); if(count <= 0) return CommonResult.fail(ResultCode.E_802); } return CommonResult.success(count); }  @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);  }