Commit c5fea700 by zhanghj

V1.5.1--地址解析异常加上异常捕获

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@25523 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent eb3241c7
......@@ -25,14 +25,17 @@
package com.glsx.usercenter.service.impl;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.glsx.usercenter.mapper.SysAreaMapper;
import com.glsx.usercenter.pojo.user.SysArea;
import com.glsx.usercenter.pojo.user.SysAreaExample;
import com.glsx.usercenter.service.IAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Zheng Xiajun
......@@ -43,7 +46,8 @@ import java.util.List;
@Service
public class AreaServiceImpl implements IAreaService {
public Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private SysAreaMapper sysAreaMapper;
......@@ -57,21 +61,24 @@ public class AreaServiceImpl implements IAreaService {
@Override
public SysArea getAllChargeItems(Integer id) {
SysArea prandPa = new SysArea();
SysAreaExample example = new SysAreaExample();
example.createCriteria().andIdEqualTo(id);
List<SysArea> child = sysAreaMapper.selectByExample(example);
example.clear();
example.createCriteria().andIdEqualTo(child.get(0).getParentId());
List<SysArea> parent = sysAreaMapper.selectByExample(example);
if (!parent.isEmpty()) {
example.clear();
example.createCriteria().andIdEqualTo(parent.get(0).getParentId());
prandPa = sysAreaMapper.selectByExample(example).get(0);
if (prandPa != null) {
parent.get(0).setChildren(child);
prandPa.setChildren(parent);
}
try{
SysAreaExample example = new SysAreaExample();
example.createCriteria().andIdEqualTo(id);
List<SysArea> child = sysAreaMapper.selectByExample(example);
example.clear();
example.createCriteria().andIdEqualTo(child.get(0).getParentId());
List<SysArea> parent = sysAreaMapper.selectByExample(example);
if (!parent.isEmpty()) {
example.clear();
example.createCriteria().andIdEqualTo(parent.get(0).getParentId());
prandPa = sysAreaMapper.selectByExample(example).get(0);
if (prandPa != null) {
parent.get(0).setChildren(child);
prandPa.setChildren(parent);
}
}
} catch (Exception e) {
logger.error("获取日志异常" + e);
}
return prandPa;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!