liujie
5 天以前 4e5dc43480d0ba45bdc13837d570840426600485
用户端修改 推广活动
3个文件已修改
81 ■■■■■ 已修改文件
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserInfoService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
@@ -7,12 +7,10 @@
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.service.IDriverService;
import com.stylefeng.guns.modular.system.service.ISmsrecordService;
import com.stylefeng.guns.modular.system.service.IUserInfoService;
import com.stylefeng.guns.modular.system.service.IVerifiedService;
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.warpper.LoginWarpper;
@@ -22,6 +20,7 @@
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
@@ -61,6 +60,9 @@
    
    @Autowired
    private HttpServletRequest request;
    @Autowired
    private TDriverPromotionActivityService driverPromotionActivityService;
    
    
    /**
@@ -106,11 +108,10 @@
            @ApiImplicitParam(value = "ip地址", name = "registIp", required = false, dataType = "String"),
            @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"),
            @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = false, dataType = "String"),
            @ApiImplicitParam(value = "司机id", name = "driverId", required = false, dataType = "int"),
    })
    public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType,String jsCode,Integer driverId){
    public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType,String jsCode){
        try {
            return userInfoService.captchaLogin(phone, code, registIp, registAreaCode,loginType,driverId);
            return userInfoService.captchaLogin(phone, code, registIp, registAreaCode,loginType);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
@@ -330,6 +331,46 @@
            return ResultUtil.runErr();
        }
    }
    /**
     * 设置绑定司机
     * @param driverId
     * @param request
     * @return
     */
    @ResponseBody
    @PostMapping("/api/user/bindingDriver")
    @ApiOperation(value = "绑定司机", tags = {"用户端-登录"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<LoginWarpper> bindingDriver(Integer driverId,HttpServletRequest request){
        try {
            Integer uid = userInfoService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            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"));
            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);
                    userInfoService.updateById(userInfo);
                }
            }
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    @Autowired
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserInfoService.java
@@ -36,7 +36,7 @@
     * @param code
     * @return
     */
    ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType,Integer driverId) throws Exception;
    ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType) throws Exception;
    /**
     * 手机一键登录
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java
@@ -128,8 +128,7 @@
    private PayMoneyUtil payMoneyUtil;
    @Autowired
    private TDriverPromotionActivityService driverPromotionActivityService;
    @Value("${callbackPath}")
    private String callbackPath;
@@ -227,7 +226,7 @@
     * @return
     */
    @Override
    public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType,Integer driverId) throws Exception {
    public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType) throws Exception {
        UserInfo userInfo = userInfoMapper.queryByPhone(phone);
        String nickName = null;
        if (null == userInfo) {
@@ -275,21 +274,6 @@
            }else {
                userInfo.setCompanyId(1);
            }
            // 是否需要绑定司机
            TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("districtCode", registAreaCode).ge("startTime", new Date()).lt("endTime", new Date()).last(" limit 1"));
            if(tDriverPromotionActivity!=null){
                Integer bindingDays = tDriverPromotionActivity.getBindingDays();
                // 当前时间+绑定天数
                Date endTime = DateUtils.addDays(new Date(), bindingDays);
                userInfo.setBindDriverId(driverId);
                userInfo.setBindExpireDate(endTime);
            }
@@ -403,7 +387,7 @@
    }
    @Override
    public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, Integer uid, Integer type, Integer userType,String loginType) throws Exception {
        ResultUtil<LoginWarpper> resultUtil = this.captchaLogin(phone, code, null, null,loginType,null);
        ResultUtil<LoginWarpper> resultUtil = this.captchaLogin(phone, code, null, null,loginType);
        if(resultUtil.getCode() == 200 && null != uid){
            if(type == 2){//司机分享
                Driver driver = driverMapper.selectById(uid);
@@ -1250,7 +1234,7 @@
            if(null == userInfo){
                return ResultUtil.error("获取用户信息失败");
            }
            return this.captchaLogin(userInfo.get("phone"), "1234", null, registAreaCode, loginType,null);
            return this.captchaLogin(userInfo.get("phone"), "1234", null, registAreaCode, loginType);
        }else{
            return ResultUtil.error(jsonObject.getString("msg"));
        }