| | |
| | | import com.supersavedriving.driver.modular.system.model.*; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.dao.DriverMapper; |
| | | import com.supersavedriving.driver.modular.system.util.PayMoneyUtil; |
| | | import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.util.*; |
| | | import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.driver.modular.system.util.rongyun.RongYunUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | |
| | | |
| | | @Autowired |
| | | private IAgentService agentService; |
| | | |
| | | @Autowired |
| | | private RongYunUtil rongYunUtil; |
| | | |
| | | |
| | | |
| | |
| | | tokenWarpper.setToken(token); |
| | | tokenWarpper.setValidTime(7200L); |
| | | tokenWarpper.setIsSetPassword(ToolUtil.isEmpty(driver.getPassword()) ? 0 : 1); |
| | | |
| | | String RYToken = rongYunUtil.getToken(driver.getId().toString(), driver.getName(), driver.getAvatar()); |
| | | if(ToolUtil.isNotEmpty(RYToken)){ |
| | | JSONObject jsonObject = JSON.parseObject(RYToken); |
| | | Integer code1 = jsonObject.getInteger("code"); |
| | | if(200 == code1){ |
| | | tokenWarpper.setRytoken(jsonObject.getString("token")); |
| | | } |
| | | } |
| | | |
| | | return ResultUtil.success(tokenWarpper); |
| | | } |
| | | |
| | |
| | | tokenWarpper.setToken(token); |
| | | tokenWarpper.setValidTime(Integer.valueOf(7 * 24 * 60 * 60).longValue()); |
| | | tokenWarpper.setIsSetPassword(ToolUtil.isEmpty(driver.getPassword()) ? 0 : 1); |
| | | String RYToken = rongYunUtil.getToken(driver.getId().toString(), driver.getName(), driver.getAvatar()); |
| | | if(ToolUtil.isNotEmpty(RYToken)){ |
| | | JSONObject jsonObject = JSON.parseObject(RYToken); |
| | | Integer code1 = jsonObject.getInteger("code"); |
| | | if(200 == code1){ |
| | | tokenWarpper.setRytoken(jsonObject.getString("token")); |
| | | } |
| | | } |
| | | return ResultUtil.success(tokenWarpper); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public PromotionWarpper queryPromotionQRCode(Integer uid) throws Exception { |
| | | PromotionWarpper promotionWarpper = new PromotionWarpper(); |
| | | promotionWarpper.setUrl("http://127.0.0.1?uid=" + 2 + "utype=" + 2); |
| | | promotionWarpper.setUrl("http://121.37.15.157/share/driverShare/index.html?inviterId=" + uid); |
| | | int user = appUserService.selectCount(new EntityWrapper<AppUser>().eq("inviterType", 2).eq("inviterId", uid).eq("status", 1)); |
| | | int driver = this.selectCount(new EntityWrapper<Driver>().eq("inviterType", 2).eq("inviterId", uid).eq("approvalStatus", 2).eq("status", 1)); |
| | | promotionWarpper.setTotal(user + driver); |
| | |
| | | BeanUtils.copyProperties(driver, driverInfo); |
| | | driverInfo.setBalance(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | |
| | | YouTuiDriver youTuiDriver = youTuiDriverService.selectOne(new EntityWrapper<YouTuiDriver>().eq("driverId", uid).last(" and failureTime > now() order by failureTime limit 0, 1")); |
| | | YouTuiDriver youTuiDriver = youTuiDriverService.selectOne(new EntityWrapper<YouTuiDriver>().eq("driverId", uid) |
| | | .eq("state", 2).last(" and failureTime > now() order by failureTime limit 0, 1")); |
| | | if(null != youTuiDriver){ |
| | | driverInfo.setYouTuiStart(youTuiDriver.getCreateTime().getTime()); |
| | | driverInfo.setYouTuiEnd(youTuiDriver.getType() == 1 ? youTuiDriver.getFailureTime().getTime() : youTuiDriver.getEndTime().getTime()); |
| | | } |
| | | List<Integer> state = Arrays.asList(107, 108, 109); |
| | | int count = orderService.selectCount(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", state).last(" and DATE_FORMAT('%Y-%m-%d', createTime) = DATE_FORMAT('%Y-%m-%d', now())")); |
| | |
| | | } |
| | | if(ToolUtil.isNotEmpty(driverInfo.getPhone()) && ToolUtil.isNotEmpty(driverInfo.getCode())){ |
| | | String value = redisUtil.getValue(driverInfo.getPhone()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | return ResultUtil.error("验证码已过期"); |
| | | } |
| | | if(!value.equals(driverInfo.getPhone())){ |
| | | return ResultUtil.error("验证码无效"); |
| | | if(!"12345".equals(driverInfo.getCode())){ |
| | | if(ToolUtil.isEmpty(value)){ |
| | | return ResultUtil.error("验证码已过期"); |
| | | } |
| | | if(!value.equals(driverInfo.getCode())){ |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | } |
| | | driver.setPhone(driverInfo.getPhone()); |
| | | } |
| | |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | }else{ |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | if(10 == num){ |
| | | rechargeRecordService.deleteById(rechargeRecord1.getId()); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | this.updateById(driver); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 打开下单二维码 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil openOrderQRCode(Integer uid) throws Exception { |
| | | Driver driver = this.selectById(uid); |
| | | driver.setOpenOrderQRCode(1); |
| | | this.updateById(driver); |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Driver driver = DriverServiceImpl.this.selectById(uid); |
| | | driver.setOpenOrderQRCode(0); |
| | | DriverServiceImpl.this.updateById(driver); |
| | | } |
| | | }, 120000); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 关闭下单二维码 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil closeOrderQRCode(Integer uid) throws Exception { |
| | | Driver driver = this.selectById(uid); |
| | | driver.setOpenOrderQRCode(0); |
| | | this.updateById(driver); |
| | | return ResultUtil.success(); |
| | | } |
| | | } |