异常封装之经手人信息后台修改
This commit is contained in:
@@ -30,7 +30,7 @@ public class PersonController {
|
||||
private PersonService personService;
|
||||
|
||||
@GetMapping(value = "/getAllList")
|
||||
public BaseResponseInfo getAllList(HttpServletRequest request) {
|
||||
public BaseResponseInfo getAllList(HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
@@ -53,7 +53,8 @@ public class PersonController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getPersonByIds")
|
||||
public BaseResponseInfo getPersonByIds(@RequestParam("personIDs") String personIDs, HttpServletRequest request) {
|
||||
public BaseResponseInfo getPersonByIds(@RequestParam("personIDs") String personIDs,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
@@ -76,7 +77,8 @@ public class PersonController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getPersonByType")
|
||||
public BaseResponseInfo getPersonByType(@RequestParam("type") String type, HttpServletRequest request) {
|
||||
public BaseResponseInfo getPersonByType(@RequestParam("type") String type,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
@@ -99,7 +101,8 @@ public class PersonController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/getPersonByNumType")
|
||||
public JSONArray getPersonByNumType(@RequestParam("type") String typeNum, HttpServletRequest request) {
|
||||
public JSONArray getPersonByNumType(@RequestParam("type") String typeNum,
|
||||
HttpServletRequest request)throws Exception {
|
||||
JSONArray dataArray = new JSONArray();
|
||||
try {
|
||||
String type = "";
|
||||
|
||||
@@ -21,16 +21,16 @@ public class PersonComponent implements ICommonQuery {
|
||||
private PersonService personService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(String condition) {
|
||||
public Object selectOne(String condition)throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map) {
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getPersonList(map);
|
||||
}
|
||||
|
||||
private List<?> getPersonList(Map<String, String> map) {
|
||||
private List<?> getPersonList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
@@ -39,7 +39,7 @@ public class PersonComponent implements ICommonQuery {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map) {
|
||||
public Long counts(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
@@ -47,27 +47,27 @@ public class PersonComponent implements ICommonQuery {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(String beanJson, HttpServletRequest request) {
|
||||
public int insert(String beanJson, HttpServletRequest request)throws Exception {
|
||||
return personService.insertPerson(beanJson, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(String beanJson, Long id) {
|
||||
public int update(String beanJson, Long id)throws Exception {
|
||||
return personService.updatePerson(beanJson, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
public int delete(Long id)throws Exception {
|
||||
return personService.deletePerson(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchDelete(String ids) {
|
||||
public int batchDelete(String ids)throws Exception {
|
||||
return personService.batchDeletePerson(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name) {
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return personService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,63 +43,151 @@ public class PersonService {
|
||||
@Resource
|
||||
private DepotHeadMapperEx depotHeadMapperEx;
|
||||
|
||||
public Person getPerson(long id) {
|
||||
return personMapper.selectByPrimaryKey(id);
|
||||
public Person getPerson(long id)throws Exception {
|
||||
Person result=null;
|
||||
try{
|
||||
result=personMapper.selectByPrimaryKey(id);
|
||||
}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;
|
||||
}
|
||||
|
||||
public List<Person> getPerson() {
|
||||
public List<Person> getPerson()throws Exception {
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
return personMapper.selectByExample(example);
|
||||
List<Person> list=null;
|
||||
try{
|
||||
list=personMapper.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<Person> select(String name, String type, int offset, int rows) {
|
||||
return personMapperEx.selectByConditionPerson(name, type, offset, rows);
|
||||
public List<Person> select(String name, String type, int offset, int rows)throws Exception {
|
||||
List<Person> list=null;
|
||||
try{
|
||||
list=personMapperEx.selectByConditionPerson(name, type, 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 Long countPerson(String name, String type) {
|
||||
return personMapperEx.countsByPerson(name, type);
|
||||
public Long countPerson(String name, String type)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
result=personMapperEx.countsByPerson(name, type);
|
||||
}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)
|
||||
public int insertPerson(String beanJson, HttpServletRequest request) {
|
||||
public int insertPerson(String beanJson, HttpServletRequest request)throws Exception {
|
||||
Person person = JSONObject.parseObject(beanJson, Person.class);
|
||||
return personMapper.insertSelective(person);
|
||||
int result=0;
|
||||
try{
|
||||
result=personMapper.insertSelective(person);
|
||||
}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)
|
||||
public int updatePerson(String beanJson, Long id) {
|
||||
public int updatePerson(String beanJson, Long id)throws Exception {
|
||||
Person person = JSONObject.parseObject(beanJson, Person.class);
|
||||
person.setId(id);
|
||||
return personMapper.updateByPrimaryKeySelective(person);
|
||||
int result=0;
|
||||
try{
|
||||
result=personMapper.updateByPrimaryKeySelective(person);
|
||||
}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)
|
||||
public int deletePerson(Long id) {
|
||||
return personMapper.deleteByPrimaryKey(id);
|
||||
public int deletePerson(Long id)throws Exception {
|
||||
int result=0;
|
||||
try{
|
||||
result=personMapper.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)
|
||||
public int batchDeletePerson(String ids) {
|
||||
public int batchDeletePerson(String ids) throws Exception{
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andIdIn(idList);
|
||||
return personMapper.deleteByExample(example);
|
||||
int result=0;
|
||||
try{
|
||||
result=personMapper.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{
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<Person> list = personMapper.selectByExample(example);
|
||||
return list.size();
|
||||
List<Person> list =null;
|
||||
try{
|
||||
list=personMapper.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 String getPersonByIds(String personIDs) {
|
||||
public String getPersonByIds(String personIDs)throws Exception {
|
||||
List<Long> ids = StringUtil.strToLongList(personIDs);
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andIdIn(ids).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("Id asc");
|
||||
List<Person> list = personMapper.selectByExample(example);
|
||||
List<Person> list =null;
|
||||
try{
|
||||
list=personMapper.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);
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (null != list) {
|
||||
for (Person person : list) {
|
||||
@@ -109,11 +197,20 @@ public class PersonService {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public List<Person> getPersonByType(String type) {
|
||||
public List<Person> getPersonByType(String type)throws Exception {
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
example.setOrderByClause("Id asc");
|
||||
return personMapper.selectByExample(example);
|
||||
List<Person> list =null;
|
||||
try{
|
||||
list=personMapper.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;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
@@ -123,7 +220,16 @@ public class PersonService {
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
return personMapperEx.batchDeletePersonByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||
int result =0;
|
||||
try{
|
||||
result=personMapperEx.batchDeletePersonByIds(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
|
||||
@@ -150,7 +256,15 @@ public class PersonService {
|
||||
/**
|
||||
* 校验财务主表 jsh_accounthead
|
||||
* */
|
||||
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByHandsPersonIds(idArray);
|
||||
List<AccountHead> accountHeadList =null;
|
||||
try{
|
||||
accountHeadList=accountHeadMapperEx.getAccountHeadListByHandsPersonIds(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){
|
||||
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||
@@ -160,7 +274,15 @@ public class PersonService {
|
||||
/**
|
||||
* 校验单据主表 jsh_depothead
|
||||
* */
|
||||
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByHandsPersonIds(idArray);
|
||||
List<DepotHead> depotHeadList =null;
|
||||
try{
|
||||
depotHeadList=depotHeadMapperEx.getDepotHeadListByHandsPersonIds(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){
|
||||
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||
|
||||
Reference in New Issue
Block a user