Commit 9bc6b75e authored by libin's avatar libin

分公司查询bug修复

parent 50f06362
......@@ -13,6 +13,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.entity.Area;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.BranchCompanyStockInfo;
import com.xxfc.platform.vehicle.entity.SysRegion;
......@@ -65,6 +66,9 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
@Autowired
UserFeign userFeign;
@Autowired
private AreaBiz areaBiz;
@Override
public UserFeign getUserFeign() {
return userFeign;
......@@ -152,17 +156,35 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
}
public PageDataVO<BranchCompany> getAll(Integer page, Integer limit, Integer addrProvince, Integer addrCity,
Integer addrTown, UserDTO userDTO) {
Integer addrTown,Integer zoneId, UserDTO userDTO) {
Example example = new Example(BranchCompany.class);
Example.Criteria criteria = example.createCriteria();
if (addrProvince != null) {
criteria.andCondition(" addr_province = '" + addrProvince + "'");
String provinceIds="";
if (Objects.nonNull(zoneId)){
Area area = areaBiz.selectById(zoneId);
provinceIds = area.getProvinceIds();
}
if (StringUtils.isNotEmpty(provinceIds)){
List<String> provinceIdList = Arrays.asList(provinceIds.split(","));
if (Objects.nonNull(addrProvince)){
if (provinceIdList.contains(String.valueOf(addrProvince))){
criteria.andEqualTo("addrProvince",addrProvince);
}else {
return new PageDataVO<BranchCompany>();
}
}else {
criteria.andIn("addrProvince",provinceIdList);
}
}else {
if (addrProvince != null) {
criteria.andEqualTo("addrProvince",addrProvince);
}
}
if (addrCity != null) {
criteria.andCondition(" addr_city = '" + addrCity + "'");
criteria.andEqualTo("addrCity",addrCity);
}
if (addrTown != null) {
criteria.andCondition(" addr_town = '" + addrTown + "'");
criteria.andEqualTo("addrTown",addrTown);
}
if (userDTO != null && DATA_ALL_FALSE.equals(userDTO.getDataAll())) {
if (StringUtils.isNotBlank(userDTO.getDataZone())) {
......
......@@ -52,9 +52,9 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
@RequestMapping(value ="/page",method = RequestMethod.GET)
public RestResponse<PageDataVO<BranchCompany>> page(@RequestParam Integer page, @RequestParam Integer limit,
@RequestParam(required = false) Integer addrProvince, @RequestParam(required = false) Integer addrCity,
@RequestParam(required = false) Integer addrTown, @RequestParam(required = false) String location) {
@RequestParam(required = false) Integer addrTown, @RequestParam(required = false) Integer zoneId) {
UserDTO userDTO = userFeign.userinfoByToken(userAuthConfig.getToken(request)).getData();
return RestResponse.data(baseBiz.getAll(page,limit,addrProvince, addrCity, addrTown, userDTO));
return RestResponse.data(baseBiz.getAll(page,limit,addrProvince, addrCity, addrTown, zoneId,userDTO));
}
@IgnoreUserToken
......@@ -62,7 +62,7 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
public RestResponse<PageDataVO<BranchCompany>> allPage(@RequestParam Integer page, @RequestParam Integer limit,
@RequestParam(required = false) Integer addrProvince, @RequestParam(required = false) Integer addrCity,
@RequestParam(required = false) Integer addrTown) {
return RestResponse.data(baseBiz.getAll(page,limit,addrProvince, addrCity, addrTown, null));
return RestResponse.data(baseBiz.getAll(page,limit,addrProvince, addrCity, addrTown, null,null));
}
@RequestMapping(value ="/search",method = RequestMethod.GET)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment