| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.model.Income; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.util.ALiSendSms; |
| | | //import com.stylefeng.guns.modular.system.util.ICBCPayUtil; |
| | | import com.stylefeng.guns.modular.system.util.HuaWeiSMSUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.ActivityWarpper; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 司机控制器 |
| | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | |
| | | |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/getCompanyByCityCode") |
| | | @ApiOperation(value = "根据省市区编号获取可选择的企业", tags = {"司机端-注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "省编号", name = "provinceCode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "市编号", name = "cityCode", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "区编号", name = "districtCode", required = false, dataType = "String"), |
| | | }) |
| | | public ResultUtil<List<Map<String, Object>>> getCompanyByCityCode(String provinceCode, String cityCode, String districtCode){ |
| | | List<Integer> companyId = null; |
| | | if(ToolUtil.isNotEmpty(districtCode)){ |
| | | List<CompanyCity> areaCode = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("areaCode", districtCode)); |
| | | companyId = areaCode.stream().map(CompanyCity::getCompanyId).collect(Collectors.toList()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(cityCode) && (null == companyId || companyId.isEmpty())){ |
| | | List<CompanyCity> areaCode = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("cityCode", cityCode).isNull("areaCode")); |
| | | companyId = areaCode.stream().map(CompanyCity::getCompanyId).collect(Collectors.toList()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(provinceCode) && (null == companyId || companyId.isEmpty())){ |
| | | List<CompanyCity> areaCode = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("provinceCode", provinceCode).isNull("cityCode").isNull("areaCode")); |
| | | companyId = areaCode.stream().map(CompanyCity::getCompanyId).collect(Collectors.toList()); |
| | | } |
| | | if(null != companyId && !companyId.isEmpty()){ |
| | | List<Company> companies = companyService.selectBatchIds(companyId); |
| | | List<Map<String, Object>> collect = companies.stream().filter(s->0 == s.getState() && 3 != s.getFlag()).map(s -> { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", s.getId()); |
| | | map.put("name", s.getName()); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | return ResultUtil.success(collect); |
| | | } |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | } |