Commit 4ca75060 authored by hezhen's avatar hezhen

123

parent 50f06362
...@@ -59,4 +59,5 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf ...@@ -59,4 +59,5 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf
} }
} }
...@@ -77,6 +77,8 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -77,6 +77,8 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
@Autowired @Autowired
private VehicleBiz vehicleBiz; private VehicleBiz vehicleBiz;
/** /**
* 按主键获取公司 * 按主键获取公司
* *
...@@ -172,7 +174,7 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -172,7 +174,7 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
criteria.andIn(ID, userDTO.dataCompany2List()); criteria.andIn(ID, userDTO.dataCompany2List());
} }
} }
example.setOrderByClause("`id` asc"); example.setOrderByClause("`id` desc");
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
PageInfo<BranchCompany> branchCompanyPageInfo = new PageInfo<>(mapper.selectByExample(example)); PageInfo<BranchCompany> branchCompanyPageInfo = new PageInfo<>(mapper.selectByExample(example));
return PageDataVO.pageInfo(branchCompanyPageInfo); return PageDataVO.pageInfo(branchCompanyPageInfo);
......
...@@ -6,11 +6,14 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; ...@@ -6,11 +6,14 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.vehicle.biz.AreaBiz;
import com.xxfc.platform.vehicle.biz.BranchCompanyBiz; import com.xxfc.platform.vehicle.biz.BranchCompanyBiz;
import com.xxfc.platform.vehicle.biz.VehicleBiz; import com.xxfc.platform.vehicle.biz.VehicleBiz;
import com.xxfc.platform.vehicle.common.BaseController; import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode; import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.Area;
import com.xxfc.platform.vehicle.entity.BranchCompany; import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVo; import com.xxfc.platform.vehicle.pojo.BranchCompanyVo;
import com.xxfc.platform.vehicle.pojo.CompanyDetail; import com.xxfc.platform.vehicle.pojo.CompanyDetail;
...@@ -49,6 +52,9 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> { ...@@ -49,6 +52,9 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
@Autowired @Autowired
private UserAuthConfig userAuthConfig; private UserAuthConfig userAuthConfig;
@Autowired
private AreaBiz areaBiz;
@RequestMapping(value ="/page",method = RequestMethod.GET) @RequestMapping(value ="/page",method = RequestMethod.GET)
public RestResponse<PageDataVO<BranchCompany>> page(@RequestParam Integer page, @RequestParam Integer limit, 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 addrProvince, @RequestParam(required = false) Integer addrCity,
...@@ -89,8 +95,16 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> { ...@@ -89,8 +95,16 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
} }
@RequestMapping(value ="",method = RequestMethod.POST) @RequestMapping(value ="",method = RequestMethod.POST)
public RestResponse<Integer> add(@RequestBody BranchCompanyVo branchCompanyVo) { public ObjectRestResponse<Integer> add(@RequestBody BranchCompanyVo branchCompanyVo) {
return RestResponse.data(baseBiz.add(branchCompanyVo)); if (branchCompanyVo==null){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"参数不能为空");
}
Area area=areaBiz.selectById(branchCompanyVo.getZoneId());
Integer provinc=branchCompanyVo.getAddrProvince()==null?0:branchCompanyVo.getAddrProvince();
if (area==null||StringUtils.isBlank(area.getProvinceIds())||!area.getProvinceIds().contains(provinc+"")){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"片区和省份不一致");
}
return ObjectRestResponse.succ(baseBiz.add(branchCompanyVo));
} }
@RequestMapping(value ="/app/unauth/getByZone",method = RequestMethod.GET) @RequestMapping(value ="/app/unauth/getByZone",method = RequestMethod.GET)
...@@ -113,9 +127,17 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> { ...@@ -113,9 +127,17 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
} }
@RequestMapping(value ="",method = RequestMethod.PUT) @RequestMapping(value ="",method = RequestMethod.PUT)
public RestResponse update(@RequestBody BranchCompany branchCompany) { public ObjectRestResponse update(@RequestBody BranchCompany branchCompany) {
if (branchCompany==null){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"参数不能为空");
}
Area area=areaBiz.selectById(branchCompany.getZoneId());
Integer provinc=branchCompany.getAddrProvince()==null?0:branchCompany.getAddrProvince();
if (area==null||StringUtils.isBlank(area.getProvinceIds())||!area.getProvinceIds().contains(provinc+"")){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"片区和省份不一致");
}
baseBiz.update(branchCompany); baseBiz.update(branchCompany);
return RestResponse.sucResponse(); return ObjectRestResponse.succ();
} }
@RequestMapping(value ="/{id}",method = RequestMethod.DELETE) @RequestMapping(value ="/{id}",method = RequestMethod.DELETE)
......
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