|
|
@@ -4,6 +4,8 @@ import javax.inject.Inject;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.http.server.reactive.ServerHttpRequest;
|
|
|
+import org.springframework.http.server.reactive.ServerHttpResponse;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
@@ -11,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.leanwo.gateway.dto.BaseResponse;
|
|
|
import com.leanwo.gateway.service.AccountManagementService;
|
|
|
+import com.leanwo.gateway.service.SystemAdminService;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -20,7 +23,7 @@ import com.leanwo.gateway.service.AccountManagementService;
|
|
|
*/
|
|
|
|
|
|
@RestController
|
|
|
-@RequestMapping("/AccountManagementResource")
|
|
|
+@RequestMapping("/gateway-api/AccountManagementResource")
|
|
|
public class AccountManagementResource {
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(AccountManagementResource.class);
|
|
|
@@ -28,16 +31,28 @@ public class AccountManagementResource {
|
|
|
@Inject
|
|
|
private AccountManagementService accountManagementService;
|
|
|
|
|
|
+ @Inject
|
|
|
+ private SystemAdminService systemAdminService;
|
|
|
|
|
|
/**
|
|
|
* 重新加载账套
|
|
|
* @param accountId
|
|
|
* @return
|
|
|
+ * @author YangZhiJie 20220826
|
|
|
*/
|
|
|
@RequestMapping(value = "/reloadAccountManagement", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
- public BaseResponse reloadAccountManagement() {
|
|
|
+ public BaseResponse reloadAccountManagement(ServerHttpRequest httpServletRequest, ServerHttpResponse httpServletResponse) {
|
|
|
+ boolean isSystemAdmin = systemAdminService.isSystemAdmin(httpServletRequest);
|
|
|
+
|
|
|
BaseResponse baseResponse = new BaseResponse();
|
|
|
+ if (isSystemAdmin == false) {
|
|
|
+ logger.info("Cookies中不存在SystemAdmin参数。");
|
|
|
+ baseResponse.setErrorCode(2);
|
|
|
+ baseResponse.setErrorMessage("Cookies中不存在SystemAdmin参数。");
|
|
|
+ return baseResponse;
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
accountManagementService.loadAccountManagement(true);
|
|
|
baseResponse.setErrorCode(0);
|