From 381d0465a589a1862e9d79394619ae4bcc04350b Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Wed, 07 Apr 2021 08:39:51 +0800
Subject: [PATCH] 角色功能修改

---
 screen-manage/src/main/java/com/moral/api/controller/AccountController.java |  121 +++++++++++++++++++++-------------------
 1 files changed, 63 insertions(+), 58 deletions(-)

diff --git a/screen-manage/src/main/java/com/moral/api/controller/AccountController.java b/screen-manage/src/main/java/com/moral/api/controller/AccountController.java
index ece5b58..8307df0 100644
--- a/screen-manage/src/main/java/com/moral/api/controller/AccountController.java
+++ b/screen-manage/src/main/java/com/moral/api/controller/AccountController.java
@@ -1,33 +1,22 @@
 package com.moral.api.controller;
 
-import com.moral.api.pojo.dto.account.AccountDeleteDTO;
-import com.moral.api.pojo.dto.account.AccountInsertDTO;
-import com.moral.api.pojo.dto.account.AccountQueryDTO;
-import com.moral.api.pojo.dto.account.AccountUpdateDTO;
-import com.moral.api.pojo.dto.login.LoginDTO;
-import com.moral.api.pojo.form.*;
+import com.moral.api.pojo.dto.account.*;
+import com.moral.api.pojo.dto.organization.OrganizationDTO;
+import com.moral.api.pojo.form.account.AccountDeleteForm;
+import com.moral.api.pojo.form.account.AccountInsertForm;
+import com.moral.api.pojo.form.account.AccountQueryForm;
+import com.moral.api.pojo.form.account.AccountUpdateForm;
 import com.moral.api.pojo.vo.account.AccountDeleteVO;
 import com.moral.api.pojo.vo.account.AccountInsertVO;
 import com.moral.api.pojo.vo.account.AccountQueryVO;
 import com.moral.api.pojo.vo.account.AccountUpdateVO;
-import com.moral.api.pojo.vo.login.LoginVO;
 import com.moral.api.service.ManageAccountService;
-import com.moral.constant.Constants;
 import com.moral.constant.ResponseCodeEnum;
 import com.moral.constant.ResultMessage;
-import com.moral.util.KaptchaUtils;
-import com.moral.util.TokenUtils;
 import io.swagger.annotations.*;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 
 @Slf4j
 @Api(tags = {"������������������"})
@@ -38,68 +27,84 @@
     ManageAccountService accountService;
 
     @PostMapping("insert")
-    public ResultMessage insert(@RequestBody AccountInsertForm accountInsertForm) {
-        if (!accountInsertForm.valid())
+    public ResultMessage insert(@RequestBody AccountInsertForm form) {
+        //������������������������
+        if (!form.valid())
             return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
                     ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
-        //������������������������������
-        AccountInsertDTO conditionDTO = accountInsertForm.paramValid();
+
+        //������������������������
+        AccountInsertDTO conditionDTO = form.paramValid();
         if (conditionDTO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
             return new ResultMessage(conditionDTO.getCode(), conditionDTO.getMsg(), null);
         }
 
-        AccountInsertDTO accountInsertDTO = accountService.insertAccount(accountInsertForm);
+        //������������������
+        AccountDTO dto = accountService.insertAccount(form);
 
-        AccountInsertVO accountInsertVO = AccountInsertVO.convert(accountInsertDTO);
+        //������������������������
+        AccountInsertVO accountInsertVO = AccountInsertVO.convert(dto);
 
-        return new ResultMessage(accountInsertDTO.getCode(), accountInsertDTO.getMsg(), accountInsertVO);
+        return new ResultMessage(dto.getCode(), dto.getMsg(), accountInsertVO);
     }
 
-    @GetMapping("query")
-    public ResultMessage query(AccountQueryForm accountQueryForm) {
-        if (!accountQueryForm.valid())
+    @PostMapping("update")
+    public ResultMessage update(@RequestBody AccountUpdateForm form) {
+        //������������������������
+        if (!form.valid())
             return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
                     ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
 
-        AccountQueryDTO accountQueryDTO = accountService.queryAccount(accountQueryForm);
+        //������������������������
+        AccountUpdateDTO conditionDTO = form.paramValid();
+        if (conditionDTO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
+            return new ResultMessage(conditionDTO.getCode(), conditionDTO.getMsg(), null);
+        }
 
+        //������������������
+        AccountDTO dto = accountService.updateAccount(form);
+
+        //���������������������������
+        AccountUpdateVO vo = AccountUpdateVO.convert(dto);
+
+        return new ResultMessage(dto.getCode(), dto.getMsg(), vo);
+    }
+
+    @PostMapping("delete")
+    public ResultMessage delete(@RequestBody AccountDeleteForm form) {
+        //������������������������
+        if (!form.valid())
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
+                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+
+        //������������������
+        AccountDTO dto = accountService.deleteAccount(form);
+
+        //���������������������������
+        AccountDeleteVO vo = AccountDeleteVO.convert(dto);
+
+        return new ResultMessage(dto.getCode(), dto.getMsg(), vo);
+    }
+
+    @GetMapping("query")
+    public ResultMessage query(AccountQueryForm form) {
+        //������������������������
+        if (!form.valid())
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
+                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+
+        //������������������
+        AccountQueryDTO accountQueryDTO = accountService.queryAccount(form);
+
+        //���������������������������
         AccountQueryVO accountQueryVO = AccountQueryVO.convert(accountQueryDTO);
+
 
         return new ResultMessage(accountQueryDTO.getCode(), accountQueryDTO.getMsg(), accountQueryVO);
     }
 
 
-    @PostMapping("update")
-    public ResultMessage update(@RequestBody AccountUpdateForm accountUpdateRequest) {
-        if (!accountUpdateRequest.valid())
-            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
-                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
 
-        //������������������������������
-        AccountUpdateDTO conditionDTO = accountUpdateRequest.paramValid();
-        if (conditionDTO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
-            return new ResultMessage(conditionDTO.getCode(), conditionDTO.getMsg(), null);
-        }
-
-        AccountUpdateDTO accountUpdateDTO = accountService.updateAccount(accountUpdateRequest);
-
-        AccountUpdateVO accountUpdateVO = AccountUpdateVO.convert(accountUpdateDTO);
-
-        return new ResultMessage(accountUpdateDTO.getCode(), accountUpdateDTO.getMsg(), accountUpdateVO);
-    }
-
-    @PostMapping("delete")
-    public ResultMessage delete(@RequestBody AccountDeleteForm accountDeleteForm) {
-        if (!accountDeleteForm.valid())
-            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
-                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
-
-        AccountDeleteDTO accountDeleteDTO = accountService.deleteAccount(accountDeleteForm);
-
-        AccountDeleteVO accountDeleteVO = AccountDeleteVO.convert(accountDeleteDTO);
-
-        return new ResultMessage(accountDeleteDTO.getCode(), accountDeleteDTO.getMsg(), accountDeleteVO);
-    }
 
 
 }

--
Gitblit v1.8.0