| | |
| | | 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; |
| | | |
| | | /** |
| | | * 司机控制器 |
| | | */ |
| | | @Api |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class DriverController { |
| | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | |
| | | |
| | |
| | | templateCode = "a8af3c2972db4c9e91add990dff22f65";//司机注册失败 |
| | | break; |
| | | } |
| | | HuaWeiSMSUtil.sendSms("", driver.getPhone(), "8822061324669", templateCode); |
| | | // String s = aLiSendSms.sendSms(driver.getPhone(), templateCode, "{}"); |
| | | // HuaWeiSMSUtil.sendSms("", driver.getPhone(), "8822061324669", templateCode); |
| | | String s = aLiSendSms.sendSms(driver.getPhone(), "SMS_485340165", "{}"); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 注销账号 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/cancelAccount") |
| | | @ApiOperation(value = "注销账号", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil cancelAccount(HttpServletRequest request){ |
| | | try { |
| | | Integer driverId = driverService.getUserIdFormRedis(request); |
| | | if(null == driverId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(driverId); |
| | | driver.setFlag(3); |
| | | driverService.updateById(driver); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | 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().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<>()); |
| | | } |
| | | } |