| | |
| | | @Autowired |
| | | private ICustomerReceiveService iCustomerReceiveService; |
| | | |
| | | @Autowired |
| | | private IOrderLogService iOrderLogService; |
| | | |
| | | |
| | | //2.微信登陆 |
| | | @RequestMapping(value = "/login", method = RequestMethod.POST) |
| | |
| | | //openId:微信id |
| | | @RequestMapping(value = "/bindWx", method = RequestMethod.POST) |
| | | @ApiOperation(value = "微信绑定零售许可证") |
| | | public Object bindWx(String licence,String openId){ |
| | | public Object bindWx(String licence,String openId,String linker,String phone){ |
| | | QueryWrapper<Customer> wrapper2 = new QueryWrapper<>(); |
| | | wrapper2.eq("open_id",openId); |
| | | Customer c = iCustomerService.getOne(wrapper2); |
| | |
| | | |
| | | QueryWrapper<Customer> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("licence",licence); |
| | | if(StrUtil.isNotEmpty(linker)){ |
| | | wrapper.eq("linker",linker); |
| | | } |
| | | if(StrUtil.isNotEmpty(phone)){ |
| | | wrapper.eq("phone",phone); |
| | | } |
| | | Customer one = iCustomerService.getOne(wrapper); |
| | | if(one==null){ |
| | | return ResultUtil.error("零售许可证无效");//首次登陆需绑定零售许可证 |
| | | return ResultUtil.error("请检查输入信息是否正确");//首次登陆需绑定零售许可证 |
| | | }else { |
| | | one.setOpenId(openId); |
| | | iCustomerService.saveOrUpdate(one); |
| | |
| | | } |
| | | String carId = orderTask.getCarId(); |
| | | Car car = iCarService.getById(carId); |
| | | String[] carids = new String[1]; |
| | | carids[0]= car.getCode(); |
| | | String latestGps = haiKangPost.findLatestGps(carids); |
| | | JSONObject jsonObject = JSONUtil.parseObj(latestGps); |
| | | String data = jsonObject.getStr("data"); |
| | | JSONArray objects = JSONUtil.parseArray(data); |
| | | JSONObject jsonObject2 = objects.getJSONObject(0); |
| | | Integer lng = jsonObject2.getInt("longitude"); |
| | | Integer lat = jsonObject2.getInt("latitude"); |
| | | |
| | | DecimalFormat df = new DecimalFormat("#.000000"); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("lng",df.format(lng/360000.0)); |
| | | map.put("lat",df.format(lat/360000.0)); |
| | | map.put("content","还有3单,预计10:22送达"); |
| | | map.put("lng",118.167491); |
| | | map.put("lat",39.651253); |
| | | map.put("content","暂无车辆数据"); |
| | | if(StrUtil.isEmpty(car.getCode())){ |
| | | return ResultUtil.data(map); |
| | | } |
| | | try { |
| | | String[] carids = new String[1]; |
| | | carids[0]= car.getCode(); |
| | | String latestGps = haiKangPost.findLatestGps(carids); |
| | | JSONObject jsonObject = JSONUtil.parseObj(latestGps); |
| | | String data = jsonObject.getStr("data"); |
| | | JSONArray objects = JSONUtil.parseArray(data); |
| | | JSONObject jsonObject2 = objects.getJSONObject(0); |
| | | Integer lng = jsonObject2.getInt("longitude"); |
| | | Integer lat = jsonObject2.getInt("latitude"); |
| | | |
| | | DecimalFormat df = new DecimalFormat("#.000000"); |
| | | map.put("lng",df.format(lng/360000.0)); |
| | | map.put("lat",df.format(lat/360000.0)); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | QueryWrapper<OrderTask> wrapper = new QueryWrapper<OrderTask>(); |
| | | wrapper.eq("area_id",orderTask.getAreaId()); |
| | | wrapper.eq("send_date",format); |
| | | wrapper.eq("status",0); |
| | | wrapper.orderByAsc("seq"); |
| | | List<OrderTask> list = iOrderTaskService.list(wrapper); |
| | | |
| | | if(list.size()>0){ |
| | | if(list.get(0).getSeq()<orderTask.getSeq()){ |
| | | int i = orderTask.getSeq() - list.get(0).getSeq(); |
| | | map.put("content","还有"+i+"单,预计"+(i*5)+"分钟后送达"); |
| | | } |
| | | if(list.get(0).getSeq()==orderTask.getSeq()){ |
| | | int i = orderTask.getSeq() - list.get(0).getSeq(); |
| | | map.put("content","预计5分钟内送达"); |
| | | } |
| | | } |
| | | return ResultUtil.data(map); |
| | | } |
| | | |
| | |
| | | public Object likes(String customerId){ |
| | | OrderTask order = getOrder(customerId); |
| | | if(order==null){ |
| | | ResultUtil.error("今日无订单"); |
| | | return ResultUtil.error("今日无订单"); |
| | | } |
| | | order.setLikes(1); |
| | | iOrderTaskService.saveOrUpdate(order); |
| | | |
| | | saveLog(); |
| | | return ResultUtil.success("助力成功"); |
| | | } |
| | | |
| | | private void saveLog(){ |
| | | QueryWrapper<OrderLog> wp = new QueryWrapper<>(); |
| | | wp.eq("type",1); |
| | | OrderLog one = iOrderLogService.getOne(wp); |
| | | if(one!=null){ |
| | | one.setNum(one.getNum()+1); |
| | | }else{ |
| | | one = new OrderLog(); |
| | | one.setNum(1); |
| | | one.setType(1); |
| | | } |
| | | iOrderLogService.saveOrUpdate(one); |
| | | } |
| | | |
| | | //7.获取订单列表 |
| | | @RequestMapping(value = "/getOrderList", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取订单列表") |