|
@@ -9,13 +9,10 @@ import com.chelvc.cloud.uc.api.dto.EmployeeDTO;
|
|
|
import com.chelvc.cloud.uc.api.dto.EmployeeDetailDTO;
|
|
|
import com.chelvc.cloud.uc.api.param.EmployeeModifyParam;
|
|
|
import com.chelvc.cloud.uc.api.param.EmployeePagingParam;
|
|
|
-import com.chelvc.cloud.uc.api.param.PasswordResetParam;
|
|
|
-import com.chelvc.cloud.uc.api.param.PasswordUpdateParam;
|
|
|
import com.chelvc.cloud.uc.api.service.EmployeeService;
|
|
|
-import com.chelvc.framework.base.annotation.UnifiedResponseBody;
|
|
|
-import com.chelvc.framework.base.context.SessionContextHolder;
|
|
|
-import com.chelvc.framework.base.model.Pagination;
|
|
|
-import com.chelvc.framework.base.util.ErrorUtils;
|
|
|
+import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
+import com.chelvc.framework.base.util.ResourceUtils;
|
|
|
+import com.chelvc.framework.common.model.Pagination;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -34,7 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
*/
|
|
|
@Validated
|
|
|
@RestController
|
|
|
-@UnifiedResponseBody
|
|
|
+@ResponseWrapping
|
|
|
@PreAuthorize("isBusiness('EMPLOYEE')")
|
|
|
public class EmployeeController {
|
|
|
@DubboReference
|
|
@@ -63,29 +60,6 @@ public class EmployeeController {
|
|
|
this.employeeService.updateEmployee(id, param);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 需改当前员工密码
|
|
|
- *
|
|
|
- * @param param 修改参数
|
|
|
- */
|
|
|
- @PutMapping("/employee/mine/password")
|
|
|
- public void updateMinePassword(@RequestBody @Valid PasswordUpdateParam param) {
|
|
|
- Long id = SessionContextHolder.getSession().getId();
|
|
|
- this.employeeService.updateEmployeePassword(id, param);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 重置员工密码
|
|
|
- *
|
|
|
- * @param id 员工主键
|
|
|
- * @param param 修改参数
|
|
|
- */
|
|
|
- @PutMapping("/employee/{id}/password")
|
|
|
- public void updateEmployeePassword(@PathVariable("id") @Min(value = 1, message = "员工主键不能小于1") Long id,
|
|
|
- @RequestBody @Valid PasswordResetParam param) {
|
|
|
- this.employeeService.resetEmployeePassword(id, param);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取当前员工个人信息
|
|
|
*
|
|
@@ -105,9 +79,7 @@ public class EmployeeController {
|
|
|
*/
|
|
|
@GetMapping("/employee/{id}")
|
|
|
public EmployeeDTO getEmployee(@PathVariable("id") @Min(value = 1, message = "员工主键不能小于1") Long id) {
|
|
|
- EmployeeDTO employee = this.employeeService.getEmployee(id);
|
|
|
- ErrorUtils.requireResource(employee, "员工不存在");
|
|
|
- return employee;
|
|
|
+ return ResourceUtils.required(this.employeeService.getEmployee(id), "员工不存在");
|
|
|
}
|
|
|
|
|
|
/**
|