Browse Source

工作人员解禁

dev_shibei_match
sunyuchao 4 years ago
parent
commit
7d01a81e9a
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java
  2. 8
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EnableStaffFormDTO.java
  3. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  4. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java

@ -54,6 +54,7 @@ public enum RequirePermissionEnum {
ORG_STAFF_CREATE("org_staff_create", "组织:工作人员:新增", "组织:工作人员:新增"),
ORG_STAFF_UPDATE("org_staff_update", "组织:工作人员:编辑", "组织:工作人员:编辑"),
ORG_STAFF_FORBIDDEN("org_staff_forbidden", "组织:工作人员:禁用", "组织:工作人员:禁用"),
ORG_STAFF_ENABLE("org_staff_enable", "组织:工作人员:解禁", "组织:工作人员:解禁"),
ORG_STAFF_TRANSFER("org_staff_transfer", "组织:工作人员:调动", "组织:工作人员:调动"),
/**

8
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EnableStaffFormDTO.java

@ -10,7 +10,7 @@ import java.util.List;
/**
* @author sun
* @dscription 接口入参--通讯录工作人员解禁
* @dscription 通讯录工作人员解禁-接口入参
*/
@NoArgsConstructor
@Data
@ -18,8 +18,8 @@ public class EnableStaffFormDTO implements Serializable {
private static final long serialVersionUID = -5220529162950147825L;
/**
* 徽章名称
* 被解禁用户Id
*/
@NotBlank(message = "徽章名称不能为空")
private String badgeName;
private String staffId;
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -18,6 +18,10 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
@ -433,7 +437,11 @@ public class CustomerStaffController {
* @author sun
*/
@PostMapping("enablestaff")
public Result enableStaff(@RequestBody EnableStaffFormDTO fromDTO){
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_ENABLE)
public Result enableStaff(@LoginUser TokenDto tokenDto, @RequestBody EnableStaffFormDTO fromDTO){
if (tokenDto.getUserId().equals(fromDTO.getStaffId())) {
throw new RenException("工作人员自己不能解禁自己");
}
customerStaffService.enableStaff(fromDTO);
return new Result();
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -744,7 +744,15 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
*/
@Override
public void enableStaff(EnableStaffFormDTO fromDTO) {
//超级管理员解禁 需要加新权限
CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId());
if (null == customerStaffEntity) {
logger.error(String.format("工作人员解禁,未查询到被解禁人信息,被解禁人Id->%s", fromDTO.getStaffId()));
throw new RenException("未查询到被解禁人信息,请核对后操作");
}
CustomerStaffEntity staffEntity = new CustomerStaffEntity();
staffEntity.setId(customerStaffEntity.getId());
staffEntity.setEnableFlag(CustomerStaffConstant.ENABLE);
baseDao.updateById(staffEntity);
}
}

Loading…
Cancel
Save