| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.common.constant.JwtConstants; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.TDriverPromotionActivity; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.WeChatUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.UserInfoWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.VerifiedWarpper; |
| | |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private IRegionService regionService; |
| | | |
| | | @Autowired |
| | | private HttpServletRequest request; |
| | | |
| | | private String salt = "&a.s"; |
| | | |
| | | @Autowired |
| | | private TDriverPromotionActivityService driverPromotionActivityService; |
| | |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | |
| | | |
| | | |
| | | // 是否需要绑定司机 |
| | | TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("districtCode", registAreaCode).ge("startTime", new Date()).lt("endTime", new Date()).last(" limit 1")); |
| | | TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("districtCode", userInfo.getRegistAreaCode()).ge("startTime", new Date()).lt("endTime", new Date()).last(" limit 1")); |
| | | if(tDriverPromotionActivity!=null){ |
| | | if(userInfo.getBindDriverId()==null || userInfo.getBindExpireDate().getTime()<=System.currentTimeMillis()){ |
| | | Integer bindingDays = tDriverPromotionActivity.getBindingDays(); |
| | |
| | | Date endTime = DateUtils.addDays(new Date(), bindingDays); |
| | | userInfo.setBindDriverId(driverId); |
| | | userInfo.setBindExpireDate(endTime); |
| | | userInfo.setBindDate(new Date()); |
| | | userInfoService.updateById(userInfo); |
| | | } |
| | | }else { |
| | | Region code = regionService.selectOne(new EntityWrapper<Region>().eq("code", userInfo.getRegistAreaCode())); |
| | | Region region = regionService.selectById(code.getParentId()); |
| | | TDriverPromotionActivity tDriverPromotionActivity1 = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("cityCode", region.getCode()).ge("startTime", new Date()).lt("endTime", new Date()).last(" limit 1")); |
| | | if(tDriverPromotionActivity1!=null) { |
| | | if (userInfo.getBindDriverId() == null || userInfo.getBindExpireDate().getTime() <= System.currentTimeMillis()) { |
| | | Integer bindingDays = tDriverPromotionActivity1.getBindingDays(); |
| | | // 当前时间+绑定天数 |
| | | Date endTime = DateUtils.addDays(new Date(), bindingDays); |
| | | userInfo.setBindDriverId(driverId); |
| | | userInfo.setBindExpireDate(endTime); |
| | | userInfo.setBindDate(new Date()); |
| | | userInfoService.updateById(userInfo); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | if(ToolUtil.isEmpty(userInfo.getOnconUUID())){ |
| | | String onconUUIDByMobile = UserUtil.getOnconUUIDByMobile("15828353127"); |
| | | userInfo.setOnconUUID(onconUUIDByMobile); |
| | | userInfoService.updateById(userInfo); |
| | | } |
| | | Map<String, Object> map = userInfoService.queryUserInfo(uid); |
| | | UserWithdrawal userWithdrawal1 = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 代驾系统添加用户接口 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/user/addAppUser") |
| | | public String addAppUser(String phone, String code, String areaCode){ |
| | | try { |
| | | return userInfoService.addAppUser(phone, code, areaCode); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 代驾系统验证短信验证码 |
| | | * @param phone |
| | | * @param code |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/user/checkCaptcha") |
| | | public Boolean checkCaptcha1(String phone, String code, HttpServletRequest request){ |
| | | try { |
| | | String device = request.getHeader("device"); |
| | | if(ToolUtil.isEmpty(device)){ |
| | | return false; |
| | | } |
| | | boolean b = userInfoService.checkCaptcha(phone, code); |
| | | return b; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 代驾系统验根据用户id获取电话号码 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/base/user/getUserPhone/{id}") |
| | | public String getUserPhone(@PathVariable("id") Integer id){ |
| | | UserInfo userInfo = userInfoService.selectById(id); |
| | | if(null != userInfo){ |
| | | return userInfo.getPhone(); |
| | | } |
| | | return null; |
| | | } |
| | | } |