改修の実装によるバグの修正【社員検索機能の項目追加:「入社年月日」、「勤続年数」を追加】
This commit is contained in:
@@ -121,11 +121,16 @@ public class SelectEmployeeController {
|
||||
);
|
||||
|
||||
// 検索条件を元に検索を実施
|
||||
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST,
|
||||
EmployeeInfoForm.convertFrom(
|
||||
searchEmployeeInfo.searchBy(
|
||||
SearchConditionEmployeeForm.convertTo(searchConditionEmployeeForm())
|
||||
)));
|
||||
List<EmployeeInfoForm>employeeInfoForm =EmployeeInfoForm.convertFrom(
|
||||
searchEmployeeInfo.searchBy(
|
||||
SearchConditionEmployeeForm.convertTo(searchConditionEmployeeForm())
|
||||
));
|
||||
for(EmployeeInfoForm form:employeeInfoForm) {
|
||||
String tenure = tenureCalc.tenureCalc(form.getHireDate());
|
||||
form.setTenure(tenure);
|
||||
}
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.EMPLOYEE_INFO_FORM_LIST,employeeInfoForm);
|
||||
|
||||
// 検索ページに遷移
|
||||
return TransitionTargetPageNameKeyword.SELECT_EMPLOYEE_HTML;
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
package com.example.rhizome.app.presentation.controller;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||
import com.example.rhizome.app.domain.model.Employee;
|
||||
@@ -15,18 +29,6 @@ import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||
import com.example.rhizome.app.presentation.form.UpdateEmployeeInfoForm;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* employee を更新して結果を返す為のコントローラ
|
||||
@@ -148,7 +150,10 @@ public class UpdateEmployeeResultController {
|
||||
return TransitionTargetPageNameKeyword.UPDATE_EMPLOYEE_INPUT_HTML;
|
||||
}
|
||||
|
||||
updateEmployeeInfoForm.setHireDate(beforeEmployee.getHireDate());
|
||||
|
||||
// 画面用の型からビジネスロジック用のモデルに変換し、Updateを実行
|
||||
|
||||
updateEmployee.updateEmployee(beforeEmployee, UpdateEmployeeInfoForm.convertTo(updateEmployeeInfoForm));
|
||||
|
||||
// Update後の情報を再取得
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
package com.example.rhizome.app.presentation.controller;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||
import com.example.rhizome.app.domain.model.Employee;
|
||||
@@ -12,18 +26,6 @@ import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTa
|
||||
import com.example.rhizome.app.presentation.form.LoginUserForm;
|
||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||
import com.example.rhizome.app.presentation.form.UpdatePersonalUserForm;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* 個人情報更新用コントローラ
|
||||
@@ -134,11 +136,15 @@ public class UpdatePersonalEmployeeResultController {
|
||||
}
|
||||
|
||||
//更新前のEmployeeの情報を取得
|
||||
Employee beforeEmployee =searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee());
|
||||
|
||||
updatePersonalUserForm.setHireDate(beforeEmployee.getHireDate());
|
||||
|
||||
// 画面用のインスタンスから更新用のインスタンスに変換し、Update実施
|
||||
updateEmployee.updateEmployee(
|
||||
searchEmployee.searchEmployeeByIdEmployee(updatePersonalUserForm.getIdEmployee()),
|
||||
UpdatePersonalUserForm.convertTo(updatePersonalUserForm)
|
||||
);
|
||||
beforeEmployee,
|
||||
UpdatePersonalUserForm.convertTo(updatePersonalUserForm))
|
||||
;
|
||||
|
||||
// ログイン者の情報をセッション情報に格納
|
||||
httpSession.setAttribute(
|
||||
|
||||
@@ -41,6 +41,10 @@ public class UpdateEmployeeInfoForm {
|
||||
* パスワード確認用
|
||||
*/
|
||||
private String passwordConfirm;
|
||||
/**
|
||||
* 入社年月日
|
||||
*/
|
||||
private String hireDate;
|
||||
/**
|
||||
* 管理者権限
|
||||
*/
|
||||
@@ -65,6 +69,7 @@ public class UpdateEmployeeInfoForm {
|
||||
employeeInfo.getEmployee().getMailAddress(),
|
||||
employeeInfo.getEmployee().getPassword(),
|
||||
null,
|
||||
employeeInfo.getEmployee().getHireDate(),
|
||||
employeeInfo.getEmployee().getAdminAuth(),
|
||||
employeeInfo.getDepartment().getIdDepartment()
|
||||
);
|
||||
@@ -95,7 +100,7 @@ public class UpdateEmployeeInfoForm {
|
||||
updateEmployeeInfoForm.getKnEmployee(),
|
||||
updateEmployeeInfoForm.getMailAddress(),
|
||||
updateEmployeeInfoForm.getPassword(),
|
||||
null,
|
||||
updateEmployeeInfoForm.getHireDate(),
|
||||
updateEmployeeInfoForm.getAdminAuth(),
|
||||
updateEmployeeInfoForm.getIdDepartment()
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.example.rhizome.app.presentation.form;
|
||||
|
||||
import com.example.rhizome.app.domain.model.Employee;
|
||||
import com.example.rhizome.app.domain.model.LoginUser;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -37,7 +38,10 @@ public class UpdatePersonalUserForm {
|
||||
* パスワード確認用
|
||||
*/
|
||||
private String passwordConfirm;
|
||||
|
||||
/**
|
||||
* 入社年月日
|
||||
*/
|
||||
private String hireDate;
|
||||
|
||||
/**
|
||||
* 画面用(presentation 層)の UpdatePersonalUserForm クラスから business 層の Employee クラスに
|
||||
@@ -53,6 +57,7 @@ public class UpdatePersonalUserForm {
|
||||
updatePersonalUserForm.getKnEmployee(),
|
||||
updatePersonalUserForm.getMailAddress(),
|
||||
updatePersonalUserForm.getPassword(),
|
||||
updatePersonalUserForm.getHireDate(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
@@ -72,7 +77,9 @@ public class UpdatePersonalUserForm {
|
||||
employee.getKnEmployee(),
|
||||
employee.getMailAddress(),
|
||||
employee.getPassword(),
|
||||
null
|
||||
null,
|
||||
employee.getHireDate()
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,6 +97,7 @@ public class UpdatePersonalUserForm {
|
||||
loginUser.getKnEmployee(),
|
||||
loginUser.getMailAddress(),
|
||||
loginUser.getPassword(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user