异常封装之账户信息后台修改

This commit is contained in:
qiankunpingtai
2019-04-16 15:20:33 +08:00
parent f0dfd90696
commit 10fa40f54b
7 changed files with 261 additions and 85 deletions

View File

@@ -1,6 +1,5 @@
package com.jsh.erp.controller;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
@@ -41,7 +40,7 @@ public class AccountController {
* @return
*/
@GetMapping(value = "/findBySelect")
public String findBySelect(HttpServletRequest request) {
public String findBySelect(HttpServletRequest request) throws Exception {
String res = null;
try {
List<Account> dataList = accountService.findBySelect();
@@ -70,7 +69,7 @@ public class AccountController {
* @return
*/
@GetMapping(value = "/getAccount")
public BaseResponseInfo getAccount(HttpServletRequest request) {
public BaseResponseInfo getAccount(HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
@@ -100,7 +99,7 @@ public class AccountController {
@RequestParam("pageSize") Integer pageSize,
@RequestParam("accountId") Long accountId,
@RequestParam("initialAmount") BigDecimal initialAmount,
HttpServletRequest request) {
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
@@ -133,7 +132,7 @@ public class AccountController {
@PostMapping(value = "/updateAmountIsDefault")
public String updateAmountIsDefault(@RequestParam("isDefault") Boolean isDefault,
@RequestParam("accountId") Long accountId,
HttpServletRequest request) {
HttpServletRequest request) throws Exception{
Map<String, Object> objectMap = new HashMap<String, Object>();
int res = accountService.updateAmountIsDefault(isDefault, accountId);
if(res > 0) {

View File

@@ -4,13 +4,16 @@ import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.service.CommonQueryManager;
import com.jsh.erp.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
@@ -25,7 +28,7 @@ public class ResourceController {
private CommonQueryManager configResourceManager;
@GetMapping(value = "/test/heart")
public JSONObject exitHeart(HttpServletRequest request) {
public JSONObject exitHeart(HttpServletRequest request)throws Exception {
return JsonUtils.ok();
}
@@ -34,7 +37,7 @@ public class ResourceController {
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request) {
HttpServletRequest request)throws Exception {
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
parameterMap.put(Constants.SEARCH, search);
PageQueryInfo queryInfo = new PageQueryInfo();
@@ -60,7 +63,7 @@ public class ResourceController {
@PostMapping(value = "/{apiName}/add", produces = {"application/javascript", "application/json"})
public String addResource(@PathVariable("apiName") String apiName,
@RequestParam("info") String beanJson, HttpServletRequest request) {
@RequestParam("info") String beanJson, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
int insert = configResourceManager.insert(apiName, beanJson, request);
if(insert > 0) {
@@ -73,7 +76,7 @@ public class ResourceController {
@PostMapping(value = "/{apiName}/update", produces = {"application/javascript", "application/json"})
public String updateResource(@PathVariable("apiName") String apiName,
@RequestParam("info") String beanJson,
@RequestParam("id") Long id, HttpServletRequest request) {
@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
int update = configResourceManager.update(apiName, beanJson, id, request);
if(update > 0) {
@@ -85,7 +88,7 @@ public class ResourceController {
@PostMapping(value = "/{apiName}/{id}/delete", produces = {"application/javascript", "application/json"})
public String deleteResource(@PathVariable("apiName") String apiName,
@PathVariable Long id, HttpServletRequest request) {
@PathVariable Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
int delete = configResourceManager.delete(apiName, id, request);
if(delete > 0) {
@@ -97,7 +100,7 @@ public class ResourceController {
@PostMapping(value = "/{apiName}/batchDelete", produces = {"application/javascript", "application/json"})
public String batchDeleteResource(@PathVariable("apiName") String apiName,
@RequestParam("ids") String ids, HttpServletRequest request) {
@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
int delete = configResourceManager.batchDelete(apiName, ids, request);
if(delete > 0) {
@@ -110,7 +113,7 @@ public class ResourceController {
@GetMapping(value = "/{apiName}/checkIsNameExist")
public String checkIsNameExist(@PathVariable("apiName") String apiName,
@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request) {
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
int exist = configResourceManager.checkIsNameExist(apiName, id, name);
if(exist > 0) {