liujie
7 天以前 4c532c217f3cd7b68597113c6d2c9e72e1d782aa
修改bug
1个文件已修改
20 ■■■■■ 已修改文件
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
@@ -56,6 +56,9 @@
    
    @Autowired
    private IDriverService driverService;
    @Autowired
    private IRegionService regionService;
    
    @Autowired
    private HttpServletRequest request;
@@ -353,6 +356,8 @@
            }
            UserInfo userInfo = userInfoService.selectById(uid);
            // 是否需要绑定司机
            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){
@@ -365,6 +370,21 @@
                    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);
                    }
                }
            }
            return ResultUtil.success();