gongdecai пре 2 година
родитељ
комит
361610beb5

+ 6 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/admin/AdminService.java

@@ -58,6 +58,12 @@ public interface AdminService {
 			@NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId)
 			throws ServiceException;
 
+	@HttpMethod(description = "审核通过", permission = "admin:admin:update", permissionParentName = "系统管理", permissionName = "管理员")
+	public String updateStatus(
+			@NotNull @HttpParam(name = "adminDTO", type = HttpParamType.COMMON, description = "欲修改的admin对象JSON") AdminDTO adminDTO,
+			@NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId)
+			throws ServiceException;
+
 	@HttpMethod(description = "删除", permission = "admin:admin:delete", permissionParentName = "系统管理", permissionName = "管理员")
 	public String delete(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "目标删除Id") Long id,
 			@NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员ID") Long adminId)

+ 25 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/admin/AdminServiceImpl.java

@@ -72,6 +72,10 @@ public class AdminServiceImpl implements AdminService {
 		if (CollectionUtils.isEmpty(adminDOS)) {
 			throw new AdminServiceException(ExceptionDefinition.ADMIN_NOT_EXIST);
 		}
+		if(adminDOS.get(0).getStatus()==0){
+			throw new AdminServiceException(ExceptionDefinition.ADMIN_NOT_JIHUO);
+
+		}
 		AdminDO adminDO = adminDOS.get(0);
 		// 短信验证码
 //        String code = cacheComponent.getRaw(ADMIN_MSG_CODE+adminDO.getPhone() );
@@ -161,6 +165,7 @@ public class AdminServiceImpl implements AdminService {
 		adminDO.setStatus(AdminStatusType.ACTIVE.getCode());
 		adminDO.setLastLoginIp("0.0.0.0");
 		adminDO.setGmtLastLogin("1997-01-20 00:00:00");
+		adminDO.setStatus(0);
 		if (adminMapper.insert(adminDO) > 0) {
 			adminDTO.setId(adminDO.getId());
 			return adminDTO;
@@ -192,6 +197,26 @@ public class AdminServiceImpl implements AdminService {
 		throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public String updateStatus(AdminDTO adminDTO, Long adminId) throws ServiceException {
+		Long id = adminDTO.getId();
+		if (id == null) {
+			throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
+		}
+		AdminDO adminDO = new AdminDO();
+		BeanUtils.copyProperties(adminDTO, adminDO);
+		adminDO.setGmtUpdate(new Date());
+		adminDO.setStatus(1);
+		if (adminMapper.updateById(adminDO) > 0) {
+			return "ok";
+		}
+		throw new AdminServiceException(ExceptionDefinition.ADMIN_UNKNOWN_EXCEPTION);
+	}
+
+
+
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public String delete(Long id, Long adminId) throws ServiceException {

+ 3 - 0
unimall-core/src/main/java/com/iotechn/unimall/core/exception/ExceptionDefinition.java

@@ -276,6 +276,9 @@ public class ExceptionDefinition {
     public static final ServiceExceptionDefinition ADMIN_NOT_EXIST =
             new ServiceExceptionDefinition(50001, "管理员不存在");
 
+    public static final ServiceExceptionDefinition ADMIN_NOT_JIHUO =
+            new ServiceExceptionDefinition(50055, "账号未激活");
+
     public static final ServiceExceptionDefinition ADMIN_PASSWORD_ERROR =
             new ServiceExceptionDefinition(50002, "密码错误");