| | |
| | | package com.stylefeng.guns.modular.api; |
| | | import java.util.Date; |
| | | |
| | | 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.UserInfo; |
| | | import com.stylefeng.guns.modular.system.util.ALiSendSms; |
| | | import com.stylefeng.guns.modular.system.dao.DriverWorkMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SysReformistMapper; |
| | | import com.stylefeng.guns.modular.system.dao.TDriverFacialFailMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | //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 com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | |
| | | @Autowired |
| | | private SysReformistMapper sysReformistMapper; |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | @Resource |
| | | private DriverWorkMapper driverWorkMapper; |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | @Resource |
| | | private TDriverFacialFailMapper driverFacialFailMapper; |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/face") |
| | | @ApiOperation(value = "面容识别", tags = {"司机端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "面容文件地址", name = "url", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil<LoginWarpper> driverLogin(String url,HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | //通过第三方进行识别 |
| | | if (CompareFace.faceCompare(url, driver.getFaceImgUrl())){ |
| | | driver.setLastFacialTime(new Date()); |
| | | driver.setFailCount(0); |
| | | driverService.updateById(driver); |
| | | return ResultUtil.success(); |
| | | } |
| | | driver.setFailCount(driver.getFailCount()==null? 2: driver.getFailCount()+1); |
| | | driverService.updateById(driver); |
| | | if (driver.getFailCount()>6){ |
| | | DriverWork driverWork = driverWorkMapper.queryNewWork(uid, null, 1); |
| | | List<Map<String, Object>> list = orderService.queryOrderList(1, 1, 10, uid); |
| | | if(list.size() > 0){ |
| | | return ResultUtil.error("还有未完成的订单,不能进行下班操作"); |
| | | } |
| | | driverWork.setEndTime(new Date()); |
| | | driverWork.setState(2); |
| | | driverWorkMapper.updateById(driverWork); |
| | | driver.setState(1); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.operateLogout(uid); |
| | | } |
| | | } |
| | | }).start(); |
| | | |
| | | TDriverFacialFail tDriverFacialFail = new TDriverFacialFail(); |
| | | tDriverFacialFail.setDriverId(driver.getId()); |
| | | tDriverFacialFail.setCity("成都市"); |
| | | tDriverFacialFail.setCityCode("510100"); |
| | | tDriverFacialFail.setFacialPicture(url); |
| | | tDriverFacialFail.setCreateTime(new Date()); |
| | | driverFacialFailMapper.insert(tDriverFacialFail); |
| | | // tDriverFacialFail.setIsDelete(0); |
| | | |
| | | |
| | | |
| | | return new ResultUtil<>(-1,"已满五次,退回主页"); |
| | | } |
| | | //成功的话保存最后识别时间 |
| | | return ResultUtil.error("人脸认证失败,请重试"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | /** |
| | | * 获取个人中心详情 |
| | |
| | | }) |
| | | public ResultUtil<DriverInfoWarpper> queryInfo(HttpServletRequest request){ |
| | | try { |
| | | System.err.println("====="); |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> map = driverService.queryInfo(uid); |
| | | return ResultUtil.success(DriverInfoWarpper.getDriverInfoWarpper(map)); |
| | | DriverInfoWarpper driverInfoWarpper = DriverInfoWarpper.getDriverInfoWarpper(map); |
| | | if (driverInfoWarpper.getWechatPic()==null){ |
| | | Driver driver = driverService.selectById(uid); |
| | | String rid = weChatUtil.rid("/pages/home/scanPage/scanPage", uid); |
| | | driver.setWechatPic(rid); |
| | | driverService.updateById(driver); |
| | | driverInfoWarpper.setWechatPic(rid); |
| | | } |
| | | return ResultUtil.success(driverInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> map = driverService.queryPhone(uid); |
| | | String wechat = ""; |
| | | Driver driver = driverService.selectById(uid); |
| | | List<SysReformist> companyId = sysReformistMapper.selectList(new EntityWrapper<SysReformist>().eq("companyId", driver.getCompanyId())); |
| | | for (SysReformist sysReformist : companyId) { |
| | | wechat = sysReformist.getDriverQrCode(); |
| | | } |
| | | |
| | | Map<String, Object> map = driverService.queryPhone(uid,wechat); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private ITOrderTransferService orderTransferService; |
| | | |
| | | /** |
| | | * 获取收入明细 |
| | |
| | | baseWarpper.setAmount(Double.valueOf(String.valueOf(null != map.get("money") ? map.get("money") : 0))); |
| | | switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){ |
| | | case 1: |
| | | baseWarpper.setName("快车"); |
| | | baseWarpper.setName("专车"); |
| | | break; |
| | | case 2: |
| | | baseWarpper.setName("出租车"); |
| | | break; |
| | | case 3: |
| | | baseWarpper.setName("直通车"); |
| | | baseWarpper.setName("跨城"); |
| | | break; |
| | | case 4: |
| | | baseWarpper.setName("同城小件物流"); |
| | | break; |
| | | case 5: |
| | | baseWarpper.setName("跨城小件物流"); |
| | | break; |
| | | case 7: |
| | | baseWarpper.setName("接送机/站"); |
| | | break; |
| | | } |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | |
| | | map1.put("rakeMoney", incomes4.size() > 0 ? incomes4.get(0).getMoney() : 0);//抽成 |
| | | } |
| | | break; |
| | | case 7: |
| | | TOrderTransfer orderTransfer = orderTransferService.selectById(map.get("incomeId").toString()); |
| | | if(null != orderTransfer){ |
| | | List<Income> incomes = incomeService.queryData(1, null, 2, orderTransfer.getId(), 1); |
| | | map1.put("travelMoney", null != orderTransfer.getOrderMoney() ? orderTransfer.getOrderMoney() : 0);//行程费 |
| | | map1.put("parkMoney", null != orderTransfer.getParkMoney() ? orderTransfer.getParkMoney() : 0);//停车费 |
| | | map1.put("tipMoney", 0);//小费 |
| | | map1.put("roadTollMoney", null != orderTransfer.getRoadTollMoney() ? orderTransfer.getRoadTollMoney() : 0);//过路费 |
| | | map1.put("rakeMoney", incomes.size() > 0 ? incomes.get(0).getMoney() : 0);//抽成 |
| | | } |
| | | break; |
| | | } |
| | | |
| | | baseWarpper.setData(map1); |