|
@@ -49,57 +49,7 @@ public class BackendCountryController extends BaseController {
|
|
|
@CrossOrigin
|
|
|
@PreAuthorize("@pms.hasPermission('country:list')")
|
|
|
public ResponseObject list(HttpServletRequest request) throws BusinessCheckException {
|
|
|
- String token = request.getHeader("Access-Token");
|
|
|
- Integer page = request.getParameter("page") == null ? Constants.PAGE_NUMBER : Integer.parseInt(request.getParameter("page"));
|
|
|
- Integer pageSize = request.getParameter("pageSize") == null ? Constants.PAGE_SIZE : Integer.parseInt(request.getParameter("pageSize"));
|
|
|
- String title = request.getParameter("title");
|
|
|
- String status = request.getParameter("status");
|
|
|
- String searchStoreId = request.getParameter("storeId");
|
|
|
-
|
|
|
- AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
|
|
- Long storeId;
|
|
|
- if (accountInfo == null) {
|
|
|
- return getFailureResult(1001, "请先登录");
|
|
|
- } else {
|
|
|
- storeId = accountInfo.getStoreId();
|
|
|
- }
|
|
|
-
|
|
|
- PaginationRequest paginationRequest = new PaginationRequest();
|
|
|
- paginationRequest.setCurrentPage(page);
|
|
|
- paginationRequest.setPageSize(pageSize);
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
|
|
|
- params.put("merchantId", accountInfo.getMerchantId());
|
|
|
- }
|
|
|
- if (StringUtil.isNotEmpty(title)) {
|
|
|
- params.put("title", title);
|
|
|
- }
|
|
|
- if (StringUtil.isNotEmpty(status)) {
|
|
|
- params.put("status", status);
|
|
|
- }
|
|
|
- if (StringUtil.isNotEmpty(searchStoreId)) {
|
|
|
- params.put("storeId", searchStoreId);
|
|
|
- }
|
|
|
- if (storeId != null && storeId > 0) {
|
|
|
- params.put("storeId", storeId);
|
|
|
- }
|
|
|
- paginationRequest.setSearchParams(params);
|
|
|
- PaginationResponse<MtCountry> paginationResponse = countryService.queryCountryListByPagination(paginationRequest);
|
|
|
-
|
|
|
- Map<String, Object> paramsStore = new HashMap<>();
|
|
|
- paramsStore.put("status", StatusEnum.ENABLED.getKey());
|
|
|
- if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
|
|
|
- paramsStore.put("storeId", accountInfo.getStoreId().toString());
|
|
|
- }
|
|
|
- if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
|
|
|
- paramsStore.put("merchantId", accountInfo.getMerchantId());
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
- result.put("paginationResponse", paginationResponse);
|
|
|
-
|
|
|
- return getSuccessResult(result);
|
|
|
+ return getSuccessResult(null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -112,22 +62,7 @@ public class BackendCountryController extends BaseController {
|
|
|
@CrossOrigin
|
|
|
@PreAuthorize("@pms.hasPermission('country:edit')")
|
|
|
public ResponseObject updateStatus(HttpServletRequest request, @RequestBody Map<String, Object> params) throws BusinessCheckException {
|
|
|
- String token = request.getHeader("Access-Token");
|
|
|
- String status = params.get("status") != null ? params.get("status").toString() : StatusEnum.ENABLED.getKey();
|
|
|
- Long id = params.get("id") == null ? 0 : Long.parseLong(params.get("id").toString());
|
|
|
|
|
|
- AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
|
|
- if (accountInfo == null) {
|
|
|
- return getFailureResult(1001, "请先登录");
|
|
|
- }
|
|
|
-
|
|
|
- MtCountry mtCountry = countryService.queryCountryById(id);
|
|
|
- if (mtCountry == null) {
|
|
|
- return getFailureResult(201);
|
|
|
- }
|
|
|
-
|
|
|
- String operator = accountInfo.getAccountName();
|
|
|
- countryService.updateCountry(mtCountry);
|
|
|
|
|
|
return getSuccessResult(true);
|
|
|
}
|
|
@@ -143,17 +78,6 @@ public class BackendCountryController extends BaseController {
|
|
|
@CrossOrigin
|
|
|
@PreAuthorize("@pms.hasPermission('country:add')")
|
|
|
public ResponseObject saveHandler(HttpServletRequest request, @RequestBody Map<String, Object> params) throws BusinessCheckException {
|
|
|
- String token = request.getHeader("Access-Token");
|
|
|
- String id = params.get("id") == null ? "" : params.get("id").toString();
|
|
|
- String status = params.get("status") == null ? "" : params.get("status").toString();
|
|
|
- String storeId = params.get("storeId") == null ? "0" : params.get("storeId").toString();
|
|
|
-
|
|
|
- AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
|
|
- if (accountInfo == null) {
|
|
|
- return getFailureResult(1001, "请先登录");
|
|
|
- }
|
|
|
-
|
|
|
- MtCountry info = new MtCountry();
|
|
|
|
|
|
return getSuccessResult(true);
|
|
|
}
|
|
@@ -169,17 +93,8 @@ public class BackendCountryController extends BaseController {
|
|
|
@CrossOrigin
|
|
|
@PreAuthorize("@pms.hasPermission('country:list')")
|
|
|
public ResponseObject info(HttpServletRequest request, @PathVariable("id") Integer id) throws BusinessCheckException {
|
|
|
- String token = request.getHeader("Access-Token");
|
|
|
- AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
|
|
|
- if (accountInfo == null) {
|
|
|
- return getFailureResult(1001, "请先登录");
|
|
|
- }
|
|
|
-
|
|
|
- MtCountry countryInfo = countryService.queryCountryById(Long.valueOf(id));
|
|
|
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
- result.put("countryInfo", countryInfo);
|
|
|
|
|
|
- return getSuccessResult(result);
|
|
|
+ return getSuccessResult(null);
|
|
|
}
|
|
|
}
|