异常封装之账户信息后台修改
This commit is contained in:
@@ -18,6 +18,17 @@ public class ExceptionConstants {
|
|||||||
**/
|
**/
|
||||||
public static final int SERVICE_SUCCESS_CODE = 200;
|
public static final int SERVICE_SUCCESS_CODE = 200;
|
||||||
public static final String SERVICE_SUCCESS_MSG = "操作成功";
|
public static final String SERVICE_SUCCESS_MSG = "操作成功";
|
||||||
|
/**
|
||||||
|
* 数据写入异常
|
||||||
|
*/
|
||||||
|
public static final int DATA_WRITE_FAIL_CODE = 300;
|
||||||
|
public static final String DATA_WRITE_FAIL_MSG = "数据写入异常";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据查询异常
|
||||||
|
*/
|
||||||
|
public static final int DATA_READ_FAIL_CODE = 301;
|
||||||
|
public static final String DATA_READ_FAIL_MSG = "数据查询异常";
|
||||||
/**
|
/**
|
||||||
* 系统运行时未知错误
|
* 系统运行时未知错误
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.jsh.erp.controller;
|
package com.jsh.erp.controller;
|
||||||
|
|
||||||
import com.alibaba.druid.util.StringUtils;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
@@ -41,7 +40,7 @@ public class AccountController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/findBySelect")
|
@GetMapping(value = "/findBySelect")
|
||||||
public String findBySelect(HttpServletRequest request) {
|
public String findBySelect(HttpServletRequest request) throws Exception {
|
||||||
String res = null;
|
String res = null;
|
||||||
try {
|
try {
|
||||||
List<Account> dataList = accountService.findBySelect();
|
List<Account> dataList = accountService.findBySelect();
|
||||||
@@ -70,7 +69,7 @@ public class AccountController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getAccount")
|
@GetMapping(value = "/getAccount")
|
||||||
public BaseResponseInfo getAccount(HttpServletRequest request) {
|
public BaseResponseInfo getAccount(HttpServletRequest request) throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
try {
|
try {
|
||||||
@@ -100,7 +99,7 @@ public class AccountController {
|
|||||||
@RequestParam("pageSize") Integer pageSize,
|
@RequestParam("pageSize") Integer pageSize,
|
||||||
@RequestParam("accountId") Long accountId,
|
@RequestParam("accountId") Long accountId,
|
||||||
@RequestParam("initialAmount") BigDecimal initialAmount,
|
@RequestParam("initialAmount") BigDecimal initialAmount,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) throws Exception{
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
try {
|
try {
|
||||||
@@ -133,7 +132,7 @@ public class AccountController {
|
|||||||
@PostMapping(value = "/updateAmountIsDefault")
|
@PostMapping(value = "/updateAmountIsDefault")
|
||||||
public String updateAmountIsDefault(@RequestParam("isDefault") Boolean isDefault,
|
public String updateAmountIsDefault(@RequestParam("isDefault") Boolean isDefault,
|
||||||
@RequestParam("accountId") Long accountId,
|
@RequestParam("accountId") Long accountId,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) throws Exception{
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int res = accountService.updateAmountIsDefault(isDefault, accountId);
|
int res = accountService.updateAmountIsDefault(isDefault, accountId);
|
||||||
if(res > 0) {
|
if(res > 0) {
|
||||||
|
|||||||
@@ -4,13 +4,16 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.service.CommonQueryManager;
|
import com.jsh.erp.service.CommonQueryManager;
|
||||||
import com.jsh.erp.utils.*;
|
import com.jsh.erp.utils.*;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
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;
|
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||||
|
|
||||||
@@ -25,7 +28,7 @@ public class ResourceController {
|
|||||||
private CommonQueryManager configResourceManager;
|
private CommonQueryManager configResourceManager;
|
||||||
|
|
||||||
@GetMapping(value = "/test/heart")
|
@GetMapping(value = "/test/heart")
|
||||||
public JSONObject exitHeart(HttpServletRequest request) {
|
public JSONObject exitHeart(HttpServletRequest request)throws Exception {
|
||||||
return JsonUtils.ok();
|
return JsonUtils.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +37,7 @@ public class ResourceController {
|
|||||||
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
||||||
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
|
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
|
||||||
@RequestParam(value = Constants.SEARCH, required = false) String search,
|
@RequestParam(value = Constants.SEARCH, required = false) String search,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
|
||||||
parameterMap.put(Constants.SEARCH, search);
|
parameterMap.put(Constants.SEARCH, search);
|
||||||
PageQueryInfo queryInfo = new PageQueryInfo();
|
PageQueryInfo queryInfo = new PageQueryInfo();
|
||||||
@@ -60,7 +63,7 @@ public class ResourceController {
|
|||||||
|
|
||||||
@PostMapping(value = "/{apiName}/add", produces = {"application/javascript", "application/json"})
|
@PostMapping(value = "/{apiName}/add", produces = {"application/javascript", "application/json"})
|
||||||
public String addResource(@PathVariable("apiName") String apiName,
|
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>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int insert = configResourceManager.insert(apiName, beanJson, request);
|
int insert = configResourceManager.insert(apiName, beanJson, request);
|
||||||
if(insert > 0) {
|
if(insert > 0) {
|
||||||
@@ -73,7 +76,7 @@ public class ResourceController {
|
|||||||
@PostMapping(value = "/{apiName}/update", produces = {"application/javascript", "application/json"})
|
@PostMapping(value = "/{apiName}/update", produces = {"application/javascript", "application/json"})
|
||||||
public String updateResource(@PathVariable("apiName") String apiName,
|
public String updateResource(@PathVariable("apiName") String apiName,
|
||||||
@RequestParam("info") String beanJson,
|
@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>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int update = configResourceManager.update(apiName, beanJson, id, request);
|
int update = configResourceManager.update(apiName, beanJson, id, request);
|
||||||
if(update > 0) {
|
if(update > 0) {
|
||||||
@@ -85,7 +88,7 @@ public class ResourceController {
|
|||||||
|
|
||||||
@PostMapping(value = "/{apiName}/{id}/delete", produces = {"application/javascript", "application/json"})
|
@PostMapping(value = "/{apiName}/{id}/delete", produces = {"application/javascript", "application/json"})
|
||||||
public String deleteResource(@PathVariable("apiName") String apiName,
|
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>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int delete = configResourceManager.delete(apiName, id, request);
|
int delete = configResourceManager.delete(apiName, id, request);
|
||||||
if(delete > 0) {
|
if(delete > 0) {
|
||||||
@@ -97,7 +100,7 @@ public class ResourceController {
|
|||||||
|
|
||||||
@PostMapping(value = "/{apiName}/batchDelete", produces = {"application/javascript", "application/json"})
|
@PostMapping(value = "/{apiName}/batchDelete", produces = {"application/javascript", "application/json"})
|
||||||
public String batchDeleteResource(@PathVariable("apiName") String apiName,
|
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>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int delete = configResourceManager.batchDelete(apiName, ids, request);
|
int delete = configResourceManager.batchDelete(apiName, ids, request);
|
||||||
if(delete > 0) {
|
if(delete > 0) {
|
||||||
@@ -110,7 +113,7 @@ public class ResourceController {
|
|||||||
@GetMapping(value = "/{apiName}/checkIsNameExist")
|
@GetMapping(value = "/{apiName}/checkIsNameExist")
|
||||||
public String checkIsNameExist(@PathVariable("apiName") String apiName,
|
public String checkIsNameExist(@PathVariable("apiName") String apiName,
|
||||||
@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
|
@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request)throws Exception {
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
int exist = configResourceManager.checkIsNameExist(apiName, id, name);
|
int exist = configResourceManager.checkIsNameExist(apiName, id, name);
|
||||||
if(exist > 0) {
|
if(exist > 0) {
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.jsh.erp.service;
|
package com.jsh.erp.service;
|
||||||
|
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.datasource.entities.Log;
|
|
||||||
import com.jsh.erp.datasource.entities.User;
|
|
||||||
import com.jsh.erp.datasource.mappers.LogMapper;
|
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -12,12 +9,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.jsh.erp.utils.Tools.getLocalIp;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jishenghua 752718920 2018-10-7 15:25:58
|
* @author jishenghua 752718920 2018-10-7 15:25:58
|
||||||
*/
|
*/
|
||||||
@@ -36,7 +30,7 @@ public class CommonQueryManager {
|
|||||||
* @param apiName 接口名称
|
* @param apiName 接口名称
|
||||||
* @param id ID
|
* @param id ID
|
||||||
*/
|
*/
|
||||||
public Object selectOne(String apiName, String id) {
|
public Object selectOne(String apiName, String id) throws Exception{
|
||||||
if (StringUtil.isNotEmpty(apiName) && StringUtil.isNotEmpty(id)) {
|
if (StringUtil.isNotEmpty(apiName) && StringUtil.isNotEmpty(id)) {
|
||||||
return container.getCommonQuery(apiName).selectOne(id);
|
return container.getCommonQuery(apiName).selectOne(id);
|
||||||
}
|
}
|
||||||
@@ -49,7 +43,7 @@ public class CommonQueryManager {
|
|||||||
* @param parameterMap
|
* @param parameterMap
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<?> select(String apiName, Map<String, String> parameterMap) {
|
public List<?> select(String apiName, Map<String, String> parameterMap)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
return container.getCommonQuery(apiName).select(parameterMap);
|
return container.getCommonQuery(apiName).select(parameterMap);
|
||||||
}
|
}
|
||||||
@@ -62,7 +56,7 @@ public class CommonQueryManager {
|
|||||||
* @param parameterMap
|
* @param parameterMap
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Long counts(String apiName, Map<String, String> parameterMap) {
|
public Long counts(String apiName, Map<String, String> parameterMap)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
return container.getCommonQuery(apiName).counts(parameterMap);
|
return container.getCommonQuery(apiName).counts(parameterMap);
|
||||||
}
|
}
|
||||||
@@ -76,7 +70,7 @@ public class CommonQueryManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int insert(String apiName, String beanJson, HttpServletRequest request) {
|
public int insert(String apiName, String beanJson, HttpServletRequest request) throws Exception{
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
logService.insertLog(apiName, BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
logService.insertLog(apiName, BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||||
return container.getCommonQuery(apiName).insert(beanJson, request);
|
return container.getCommonQuery(apiName).insert(beanJson, request);
|
||||||
@@ -92,7 +86,7 @@ public class CommonQueryManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int update(String apiName, String beanJson, Long id, HttpServletRequest request) {
|
public int update(String apiName, String beanJson, Long id, HttpServletRequest request)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
logService.insertLog(apiName,
|
logService.insertLog(apiName,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
|
||||||
@@ -108,7 +102,7 @@ public class CommonQueryManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int delete(String apiName, Long id, HttpServletRequest request) {
|
public int delete(String apiName, Long id, HttpServletRequest request)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
logService.insertLog(apiName,
|
logService.insertLog(apiName,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
|
||||||
@@ -124,7 +118,7 @@ public class CommonQueryManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDelete(String apiName, String ids, HttpServletRequest request) {
|
public int batchDelete(String apiName, String ids, HttpServletRequest request)throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
logService.insertLog(apiName, "批量删除,id集:" + ids, request);
|
logService.insertLog(apiName, "批量删除,id集:" + ids, request);
|
||||||
return container.getCommonQuery(apiName).batchDelete(ids);
|
return container.getCommonQuery(apiName).batchDelete(ids);
|
||||||
@@ -139,7 +133,7 @@ public class CommonQueryManager {
|
|||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int checkIsNameExist(String apiName, Long id, String name) {
|
public int checkIsNameExist(String apiName, Long id, String name) throws Exception{
|
||||||
if (StringUtil.isNotEmpty(apiName)) {
|
if (StringUtil.isNotEmpty(apiName)) {
|
||||||
return container.getCommonQuery(apiName).checkIsNameExist(id, name);
|
return container.getCommonQuery(apiName).checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public interface ICommonQuery {
|
|||||||
* @param condition 资源id
|
* @param condition 资源id
|
||||||
* @return 资源
|
* @return 资源
|
||||||
*/
|
*/
|
||||||
Object selectOne(String condition);
|
Object selectOne(String condition) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义查询
|
* 自定义查询
|
||||||
@@ -26,7 +26,7 @@ public interface ICommonQuery {
|
|||||||
* @param parameterMap 查询参数
|
* @param parameterMap 查询参数
|
||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
List<?> select(Map<String, String> parameterMap);
|
List<?> select(Map<String, String> parameterMap) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数量
|
* 查询数量
|
||||||
@@ -34,7 +34,7 @@ public interface ICommonQuery {
|
|||||||
* @param parameterMap 查询参数
|
* @param parameterMap 查询参数
|
||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
Long counts(Map<String, String> parameterMap);
|
Long counts(Map<String, String> parameterMap) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
@@ -42,7 +42,7 @@ public interface ICommonQuery {
|
|||||||
* @param beanJson
|
* @param beanJson
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int insert(String beanJson, HttpServletRequest request);
|
int insert(String beanJson, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新数据
|
* 更新数据
|
||||||
@@ -50,7 +50,7 @@ public interface ICommonQuery {
|
|||||||
* @param beanJson
|
* @param beanJson
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int update(String beanJson, Long id);
|
int update(String beanJson, Long id) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除数据
|
* 删除数据
|
||||||
@@ -58,7 +58,7 @@ public interface ICommonQuery {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int delete(Long id);
|
int delete(Long id) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除数据
|
* 批量删除数据
|
||||||
@@ -66,7 +66,7 @@ public interface ICommonQuery {
|
|||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int batchDelete(String ids);
|
int batchDelete(String ids) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询名称是否存在
|
* 查询名称是否存在
|
||||||
@@ -74,5 +74,5 @@ public interface ICommonQuery {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int checkIsNameExist(Long id, String name);
|
int checkIsNameExist(Long id, String name) throws Exception;
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.jsh.erp.service.account;
|
package com.jsh.erp.service.account;
|
||||||
|
|
||||||
import com.jsh.erp.service.ICommonQuery;
|
import com.jsh.erp.service.ICommonQuery;
|
||||||
import com.jsh.erp.service.depot.DepotResource;
|
|
||||||
import com.jsh.erp.service.depot.DepotService;
|
|
||||||
import com.jsh.erp.utils.Constants;
|
import com.jsh.erp.utils.Constants;
|
||||||
import com.jsh.erp.utils.QueryUtils;
|
import com.jsh.erp.utils.QueryUtils;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
@@ -26,11 +24,11 @@ public class AccountComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<?> select(Map<String, String> map) {
|
public List<?> select(Map<String, String> map)throws Exception {
|
||||||
return getAccountList(map);
|
return getAccountList(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<?> getAccountList(Map<String, String> map) {
|
private List<?> getAccountList(Map<String, String> map) throws Exception{
|
||||||
String search = map.get(Constants.SEARCH);
|
String search = map.get(Constants.SEARCH);
|
||||||
String name = StringUtil.getInfo(search, "name");
|
String name = StringUtil.getInfo(search, "name");
|
||||||
String serialNo = StringUtil.getInfo(search, "serialNo");
|
String serialNo = StringUtil.getInfo(search, "serialNo");
|
||||||
@@ -40,7 +38,7 @@ public class AccountComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long counts(Map<String, String> map) {
|
public Long counts(Map<String, String> map) throws Exception{
|
||||||
String search = map.get(Constants.SEARCH);
|
String search = map.get(Constants.SEARCH);
|
||||||
String name = StringUtil.getInfo(search, "name");
|
String name = StringUtil.getInfo(search, "name");
|
||||||
String serialNo = StringUtil.getInfo(search, "serialNo");
|
String serialNo = StringUtil.getInfo(search, "serialNo");
|
||||||
@@ -49,27 +47,27 @@ public class AccountComponent implements ICommonQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(String beanJson, HttpServletRequest request) {
|
public int insert(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
return accountService.insertAccount(beanJson, request);
|
return accountService.insertAccount(beanJson, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(String beanJson, Long id) {
|
public int update(String beanJson, Long id)throws Exception {
|
||||||
return accountService.updateAccount(beanJson, id);
|
return accountService.updateAccount(beanJson, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id)throws Exception {
|
||||||
return accountService.deleteAccount(id);
|
return accountService.deleteAccount(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchDelete(String ids) {
|
public int batchDelete(String ids)throws Exception {
|
||||||
return accountService.batchDeleteAccount(ids);
|
return accountService.batchDeleteAccount(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
return accountService.checkIsNameExist(id, name);
|
return accountService.checkIsNameExist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,15 +62,33 @@ public class AccountService {
|
|||||||
return accountMapper.selectByPrimaryKey(id);
|
return accountMapper.selectByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Account> getAccount() {
|
public List<Account> getAccount() throws Exception{
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
return accountMapper.selectByExample(example);
|
List<Account> list=null;
|
||||||
|
try{
|
||||||
|
list=accountMapper.selectByExample(example);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AccountVo4List> select(String name, String serialNo, String remark, int offset, int rows) {
|
public List<AccountVo4List> select(String name, String serialNo, String remark, int offset, int rows) throws Exception{
|
||||||
List<AccountVo4List> resList = new ArrayList<AccountVo4List>();
|
List<AccountVo4List> resList = new ArrayList<AccountVo4List>();
|
||||||
List<AccountVo4List> list = accountMapperEx.selectByConditionAccount(name, serialNo, remark, offset, rows);
|
List<AccountVo4List> list=null;
|
||||||
|
try{
|
||||||
|
list = accountMapperEx.selectByConditionAccount(name, serialNo, remark, offset, rows);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
String timeStr = Tools.getCurrentMonth();
|
String timeStr = Tools.getCurrentMonth();
|
||||||
if (null != list && null !=timeStr) {
|
if (null != list && null !=timeStr) {
|
||||||
for (AccountVo4List al : list) {
|
for (AccountVo4List al : list) {
|
||||||
@@ -89,53 +107,114 @@ public class AccountService {
|
|||||||
return resList;
|
return resList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long countAccount(String name, String serialNo, String remark) {
|
public Long countAccount(String name, String serialNo, String remark)throws Exception {
|
||||||
return accountMapperEx.countsByAccount(name, serialNo, remark);
|
Long result=null;
|
||||||
|
try{
|
||||||
|
result=accountMapperEx.countsByAccount(name, serialNo, remark);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int insertAccount(String beanJson, HttpServletRequest request) {
|
public int insertAccount(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Account account = JSONObject.parseObject(beanJson, Account.class);
|
Account account = JSONObject.parseObject(beanJson, Account.class);
|
||||||
if(account.getInitialamount() == null) {
|
if(account.getInitialamount() == null) {
|
||||||
account.setInitialamount(BigDecimal.ZERO);
|
account.setInitialamount(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
account.setIsdefault(false);
|
account.setIsdefault(false);
|
||||||
return accountMapper.insertSelective(account);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.insertSelective(account);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int updateAccount(String beanJson, Long id) {
|
public int updateAccount(String beanJson, Long id)throws Exception {
|
||||||
Account account = JSONObject.parseObject(beanJson, Account.class);
|
Account account = JSONObject.parseObject(beanJson, Account.class);
|
||||||
account.setId(id);
|
account.setId(id);
|
||||||
return accountMapper.updateByPrimaryKeySelective(account);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.updateByPrimaryKeySelective(account);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int deleteAccount(Long id) {
|
public int deleteAccount(Long id) throws Exception{
|
||||||
return accountMapper.deleteByPrimaryKey(id);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.deleteByPrimaryKey(id);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteAccount(String ids) {
|
public int batchDeleteAccount(String ids)throws Exception {
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
return accountMapper.deleteByExample(example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.deleteByExample(example);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int checkIsNameExist(Long id, String name) {
|
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
|
List<Account> list=null;
|
||||||
List<Account> list = accountMapper.selectByExample(example);
|
try{
|
||||||
return list.size();
|
list = accountMapper.selectByExample(example);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return list==null?0:list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Account> findBySelect() {
|
public List<Account> findBySelect()throws Exception {
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
example.setOrderByClause("id desc");
|
example.setOrderByClause("id desc");
|
||||||
return accountMapper.selectByExample(example);
|
List<Account> list=null;
|
||||||
|
try{
|
||||||
|
list = accountMapper.selectByExample(example);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,7 +223,7 @@ public class AccountService {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getAccountSum(Long id, String timeStr, String type) {
|
public BigDecimal getAccountSum(Long id, String timeStr, String type) throws Exception{
|
||||||
BigDecimal accountSum = BigDecimal.ZERO;
|
BigDecimal accountSum = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
@@ -164,7 +243,15 @@ public class AccountService {
|
|||||||
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
|
example.createCriteria().andAccountidEqualTo(id).andPaytypeNotEqualTo("预付款")
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
List<DepotHead> dataList = depotHeadMapper.selectByExample(example);
|
List<DepotHead> dataList=null;
|
||||||
|
try{
|
||||||
|
dataList = depotHeadMapper.selectByExample(example);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
if (dataList != null) {
|
if (dataList != null) {
|
||||||
for (DepotHead depotHead : dataList) {
|
for (DepotHead depotHead : dataList) {
|
||||||
if(depotHead.getChangeamount()!=null) {
|
if(depotHead.getChangeamount()!=null) {
|
||||||
@@ -184,7 +271,7 @@ public class AccountService {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getAccountSumByHead(Long id, String timeStr, String type) {
|
public BigDecimal getAccountSumByHead(Long id, String timeStr, String type) throws Exception{
|
||||||
BigDecimal accountSum = BigDecimal.ZERO;
|
BigDecimal accountSum = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
AccountHeadExample example = new AccountHeadExample();
|
AccountHeadExample example = new AccountHeadExample();
|
||||||
@@ -205,7 +292,15 @@ public class AccountService {
|
|||||||
example.createCriteria().andAccountidEqualTo(id)
|
example.createCriteria().andAccountidEqualTo(id)
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
List<AccountHead> dataList = accountHeadMapper.selectByExample(example);
|
List<AccountHead> dataList=null;
|
||||||
|
try{
|
||||||
|
dataList = accountHeadMapper.selectByExample(example);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
if (dataList != null) {
|
if (dataList != null) {
|
||||||
for (AccountHead accountHead : dataList) {
|
for (AccountHead accountHead : dataList) {
|
||||||
if(accountHead.getChangeamount()!=null) {
|
if(accountHead.getChangeamount()!=null) {
|
||||||
@@ -225,7 +320,7 @@ public class AccountService {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getAccountSumByDetail(Long id, String timeStr, String type) {
|
public BigDecimal getAccountSumByDetail(Long id, String timeStr, String type)throws Exception {
|
||||||
BigDecimal accountSum =BigDecimal.ZERO ;
|
BigDecimal accountSum =BigDecimal.ZERO ;
|
||||||
try {
|
try {
|
||||||
AccountHeadExample example = new AccountHeadExample();
|
AccountHeadExample example = new AccountHeadExample();
|
||||||
@@ -241,7 +336,15 @@ public class AccountService {
|
|||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<AccountHead> dataList = accountHeadMapper.selectByExample(example);
|
List<AccountHead> dataList=null;
|
||||||
|
try{
|
||||||
|
dataList = accountHeadMapper.selectByExample(example);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
if (dataList != null) {
|
if (dataList != null) {
|
||||||
String ids = "";
|
String ids = "";
|
||||||
for (AccountHead accountHead : dataList) {
|
for (AccountHead accountHead : dataList) {
|
||||||
@@ -283,7 +386,7 @@ public class AccountService {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getManyAccountSum(Long id, String timeStr, String type) {
|
public BigDecimal getManyAccountSum(Long id, String timeStr, String type)throws Exception {
|
||||||
BigDecimal accountSum = BigDecimal.ZERO;
|
BigDecimal accountSum = BigDecimal.ZERO;
|
||||||
try {
|
try {
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
@@ -304,7 +407,15 @@ public class AccountService {
|
|||||||
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
|
example.createCriteria().andAccountidlistLike("%" +id.toString() + "%")
|
||||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
}
|
}
|
||||||
List<DepotHead> dataList = depotHeadMapper.selectByExample(example);
|
List<DepotHead> dataList=null;
|
||||||
|
try{
|
||||||
|
dataList = depotHeadMapper.selectByExample(example);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
if (dataList != null) {
|
if (dataList != null) {
|
||||||
for (DepotHead depotHead : dataList) {
|
for (DepotHead depotHead : dataList) {
|
||||||
String accountIdList = depotHead.getAccountidlist();
|
String accountIdList = depotHead.getAccountidlist();
|
||||||
@@ -326,32 +437,68 @@ public class AccountService {
|
|||||||
return accountSum;
|
return accountSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AccountVo4InOutList> findAccountInOutList(Long accountId, Integer offset, Integer rows) {
|
public List<AccountVo4InOutList> findAccountInOutList(Long accountId, Integer offset, Integer rows) throws Exception{
|
||||||
return accountMapperEx.findAccountInOutList(accountId, offset, rows);
|
List<AccountVo4InOutList> list=null;
|
||||||
|
try{
|
||||||
|
list = accountMapperEx.findAccountInOutList(accountId, offset, rows);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int findAccountInOutListCount(Long accountId) {
|
public int findAccountInOutListCount(Long accountId) throws Exception{
|
||||||
return accountMapperEx.findAccountInOutListCount(accountId);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapperEx.findAccountInOutListCount(accountId);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int updateAmountIsDefault(Boolean isDefault, Long accountId) {
|
public int updateAmountIsDefault(Boolean isDefault, Long accountId) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId,
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
account.setIsdefault(isDefault);
|
account.setIsdefault(isDefault);
|
||||||
AccountExample example = new AccountExample();
|
AccountExample example = new AccountExample();
|
||||||
example.createCriteria().andIdEqualTo(accountId);
|
example.createCriteria().andIdEqualTo(accountId);
|
||||||
return accountMapper.updateByExampleSelective(account, example);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapper.updateByExampleSelective(account, example);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteAccountByIds(String ids) {
|
public int batchDeleteAccountByIds(String ids) throws Exception{
|
||||||
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,
|
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
String [] idArray=ids.split(",");
|
String [] idArray=ids.split(",");
|
||||||
return accountMapperEx.batchDeleteAccountByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
int result=0;
|
||||||
|
try{
|
||||||
|
result = accountMapperEx.batchDeleteAccountByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* create by: qiankunpingtai
|
* create by: qiankunpingtai
|
||||||
@@ -379,7 +526,15 @@ public class AccountService {
|
|||||||
/**
|
/**
|
||||||
* 校验财务主表 jsh_accounthead
|
* 校验财务主表 jsh_accounthead
|
||||||
* */
|
* */
|
||||||
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByAccountIds(idArray);
|
List<AccountHead> accountHeadList=null;
|
||||||
|
try{
|
||||||
|
accountHeadList = accountHeadMapperEx.getAccountHeadListByAccountIds(idArray);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
if(accountHeadList!=null&&accountHeadList.size()>0){
|
if(accountHeadList!=null&&accountHeadList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
@@ -389,7 +544,15 @@ public class AccountService {
|
|||||||
/**
|
/**
|
||||||
* 校验财务子表 jsh_accountitem
|
* 校验财务子表 jsh_accountitem
|
||||||
* */
|
* */
|
||||||
List<AccountItem> accountItemList=accountItemMapperEx.getAccountItemListByAccountIds(idArray);
|
List<AccountItem> accountItemList=null;
|
||||||
|
try{
|
||||||
|
accountItemList = accountItemMapperEx.getAccountItemListByAccountIds(idArray);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
if(accountItemList!=null&&accountItemList.size()>0){
|
if(accountItemList!=null&&accountItemList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
@@ -399,7 +562,15 @@ public class AccountService {
|
|||||||
/**
|
/**
|
||||||
* 校验单据主表 jsh_depothead
|
* 校验单据主表 jsh_depothead
|
||||||
* */
|
* */
|
||||||
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByAccountIds(idArray);
|
List<DepotHead> depotHeadList =null;
|
||||||
|
try{
|
||||||
|
depotHeadList = depotHeadMapperEx.getDepotHeadListByAccountIds(idArray);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
|
||||||
|
ExceptionConstants.DATA_READ_FAIL_MSG);
|
||||||
|
}
|
||||||
if(depotHeadList!=null&&depotHeadList.size()>0){
|
if(depotHeadList!=null&&depotHeadList.size()>0){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
|
||||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
|||||||
Reference in New Issue
Block a user