From 6d85e681bb7a4c2aba7558b943f84741be1416bf Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 07 三月 2025 18:34:06 +0800 Subject: [PATCH] 2.0新增 --- DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java | 29 ++++ UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java | 8 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TNotices.java | 152 +++++++++++++++++++-- DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java | 18 -- UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java | 2 DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java | 2 UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java | 32 ++++ ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/AddNotice.java | 100 +++++++------- ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TNoticesController.java | 69 +++++++++ UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserInfoService.java | 2 10 files changed, 324 insertions(+), 90 deletions(-) diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java index 1d415f9..6a82ee6 100644 --- a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java +++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java @@ -9,6 +9,7 @@ import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; +import com.stylefeng.guns.modular.system.dao.TNoticesMapper; import com.stylefeng.guns.modular.system.dao.TUseMoneyMapper; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.util.ALiSendSms; @@ -77,7 +78,24 @@ private IOrderLogisticsService orderLogisticsService; @Autowired private IInviteService inviteService; + @Autowired + private TNoticesMapper noticesMapper; + @ResponseBody + @PostMapping("/api/user/allert") + @ApiOperation(value = "获取公告弹窗", tags = {"司机端-2.0新增"}, notes = "") + public ResultUtil<List<TNotices>> allert(){ + try { + List<TNotices> tNotices = noticesMapper.selectList(new EntityWrapper<TNotices>() + .eq("type", 2).eq("isDriver",2) + .eq("isShow", 1).ne("flag", 3).eq("isAlert",1).eq("isDelete", 1) + ); + return ResultUtil.success(tNotices); + }catch (Exception e){ + e.printStackTrace(); + return ResultUtil.runErr(); + } + } /** * 获取用户邀请二维码 * @param request @@ -113,6 +131,17 @@ return ResultUtil.runErr(); } } + @ResponseBody + @PostMapping("/api/auser/testCode") + @ApiOperation(value = "测试小程序二维码", tags = {"司机端-2.0新增"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResultUtil testCode(){ + String s = driverService.generateQrCodeTemp(); + return ResultUtil.success(s); + + } /** * 获取用户邀请二维码 diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TNotices.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TNotices.java index e06e11e..dcc5943 100644 --- a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TNotices.java +++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TNotices.java @@ -1,48 +1,117 @@ package com.stylefeng.guns.modular.system.model; -import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.activerecord.Model; +import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; /** - * 通知 + * <p> + * 发布公告和滚动消息 + * </p> + * + * @author 吕雪 + * @since 2020-06-10 */ @TableName("t_notices") -public class TNotices extends BaseBean { +@Data +public class TNotices extends Model<TNotices> { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; /** * 标题 */ - @TableField("title") private String title; /** * 内容 */ - @TableField("content") private String content; /** * 排序 */ - @TableField("sort") private Integer sort; /** * 是否显示/发布(1=是,2=否) */ - @TableField("isShow") private Integer isShow; + /** + * 是否首页弹框(1=否,2=是) + */ + private Integer isAlert; /** * 是否播报(1=是,2=否) */ - @TableField("isBroadcast") private Integer isBroadcast; /** * 公告类型(1=滚动消息,2=公告) */ - @TableField("type") private Integer type; /** - * 图片地址 + * 图片路径 */ - @TableField("imgUrl") private String imgUrl; + /** + * 1:创建,2:修改,3:删除 + */ + private String flag; + private Date insertTime; + private Integer insertUser; + private Date updateTime; + private Integer updateUser; + /** + * 是否删除 1=否 2=是 + */ + private Integer isDelete; + /** + * 是否发布用户 1=否 2=是 + */ + private Integer isUser; + /** + * 是否发布司机 1=否 2=是 + */ + private Integer isDriver; + + public Integer getIsUser() { + return isUser; + } + + public void setIsUser(Integer isUser) { + this.isUser = isUser; + } + + public Integer getIsDriver() { + return isDriver; + } + + public void setIsDriver(Integer isDriver) { + this.isDriver = isDriver; + } + + public Integer getIsDelete() { + return isDelete; + } + + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } public String getTitle() { return title; @@ -100,16 +169,67 @@ this.imgUrl = imgUrl; } + public String getFlag() { + return flag; + } + + public void setFlag(String flag) { + this.flag = flag; + } + + public Date getInsertTime() { + return insertTime; + } + + public void setInsertTime(Date insertTime) { + this.insertTime = insertTime; + } + + public Integer getInsertUser() { + return insertUser; + } + + public void setInsertUser(Integer insertUser) { + this.insertUser = insertUser; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Integer getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(Integer updateUser) { + this.updateUser = updateUser; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + @Override public String toString() { - return "TNotice{" + - "title='" + title + '\'' + - ", content='" + content + '\'' + + return "TNotices{" + + "id=" + id + + ", title=" + title + + ", content=" + content + ", sort=" + sort + ", isShow=" + isShow + ", isBroadcast=" + isBroadcast + ", type=" + type + - ", imgUrl='" + imgUrl + '\'' + - '}'; + ", imgUrl=" + imgUrl + + ", flag=" + flag + + ", insertTime=" + insertTime + + ", insertUser=" + insertUser + + ", updateTime=" + updateTime + + ", updateUser=" + updateUser + + "}"; } } diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java index d2cd7d2..1330167 100644 --- a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java +++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java @@ -1583,7 +1583,7 @@ param.put("check_path", false); // 用户id 用于分享 param.put("scene", "uid="+userInfo.getId()+"userType=2"); - param.put("env_version", "trial"); + param.put("env_version", "release"); param.put("width", 200); //二维码尺寸 param.put("is_hyaline", true); // 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码 参数仅对小程序码生效 param.put("auto_color", true); // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 参数仅对小程序码生效 @@ -1643,21 +1643,11 @@ InputStream inputStream = null; OutputStream outputStream = null; try { - String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; + String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + accessToken; Map<String, Object> param = new HashMap<>(); // param.put("page", "pageA/houseDetail"); - param.put("check_path", false); // 用户id 用于分享 - param.put("scene", "uid="+1+"userType=1"); -// param.put("env_version", "trial"); -// param.put("width", 200); //二维码尺寸 -// param.put("is_hyaline", true); // 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码 参数仅对小程序码生效 -// param.put("auto_color", true); // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 参数仅对小程序码生效 -// Map<String, Object> line_color = new HashMap<>(); -// line_color.put("r", 0); -// line_color.put("g", 0); -// line_color.put("b", 0); -// param.put("line_color", line_color); + param.put("path", "pages/home/home?uid=1userType=2"); System.err.println("调用生成微信URL接口传参:" + param); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); @@ -1680,7 +1670,7 @@ MultipartFile file = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), byteArrayInputStream); String pictureName = OssUploadUtil.ossUploadCode(file,finalFileName); System.err.println(pictureName); - return Base64.encodeBase64String(result); + return pictureName; } catch (Exception e) { System.err.println("调用小程序生成微信永久小程序码URL接口异常" + e); diff --git a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java index 02a1557..3b6a0aa 100644 --- a/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java +++ b/DriverOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java @@ -12,7 +12,7 @@ public class OssUploadUtil { //OSS图片访问域名 public static String oss_domain = "https://xv95128.oss-cn-wuhan-lr.aliyuncs.com/"; - public static String oss_domain_cdn = "http://cdn.xn95128.cn/"; + public static String oss_domain_cdn = "https://cdn.xn95128.cn/"; public static String accessKeyId = "LTAI5tEQarpMqRDNnSuj2mCE"; public static String accessKeySecret = "6lBQHFh4XRaIytR5mQ6wDjAbIWmDok"; public static String bucketName="xv95128"; diff --git a/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TNoticesController.java b/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TNoticesController.java index 20a80f3..5917201 100644 --- a/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TNoticesController.java +++ b/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TNoticesController.java @@ -1,11 +1,19 @@ package com.stylefeng.guns.modular.system.controller.general; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.stylefeng.guns.core.base.controller.BaseController; import com.stylefeng.guns.core.common.constant.factory.PageFactory; import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.util.DateUtil; import com.stylefeng.guns.core.util.SinataUtil; +import com.stylefeng.guns.modular.system.model.TDriver; +import com.stylefeng.guns.modular.system.model.TSystemNotice; +import com.stylefeng.guns.modular.system.model.TUser; +import com.stylefeng.guns.modular.system.service.ITDriverService; +import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; +import com.stylefeng.guns.modular.system.service.ITUserService; +import com.stylefeng.guns.modular.system.util.JpushUtil; import com.stylefeng.guns.modular.system.util.task.base.QuartzManager; import com.stylefeng.guns.modular.system.util.task.base.TimeJobType; import com.stylefeng.guns.modular.system.util.task.jobs.AddNotice; @@ -22,6 +30,7 @@ import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -151,6 +160,14 @@ return SUCCESS_TIP; } + @Autowired + private ITDriverService driverService; + + @Autowired + private ITUserService tUserService; + + @Autowired + private ITSystemNoticeService noticeService; /** * 新增系统公告 */ @@ -167,6 +184,58 @@ tNotices.setIsUser(isUser); tNotices.setIsDriver(isDriver); tNoticesService.insert(tNotices); + if (tNotices.getIsUser() == 2){ + List<TUser> tUsers = tUserService.selectList(new EntityWrapper<TUser>().eq("state",1) + .ne("flag",3)); + //发送公告给用户 + for (TUser user : tUsers){ + TSystemNotice notice = new TSystemNotice(); + notice.setType(1); + notice.setUserType(1); + notice.setNoticesId(tNotices.getId()); + notice.setContent(tNotices.getContent()); + notice.setUserId(user.getId()); + notice.setInsertTime(new Date()); + notice.setRead(1); + noticeService.insert(notice); + + /*Map<String,Object> map = new HashMap<String,Object>(); + map.put("sound", userInfo.getIsVoice()); //是否有声音 1=否 2=是 + map.put("vibrate", userInfo.getIsShake()); //是否有震动 1=否 2=是 + map.put("type", 2); //消息类型 1=互动 2=公告 + map.put("id", record.getId()); //对象ID + JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/ + } + } + if (tNotices.getIsDriver() == 2){ + List<TDriver> tDrivers = driverService.selectList(new EntityWrapper<TDriver>().eq("authState",2) + .ne("flag",3)); + //发送公告给用户 + for (TDriver driver : tDrivers){ + TSystemNotice notice = new TSystemNotice(); + notice.setType(1); + notice.setUserType(2); + notice.setNoticesId(tNotices.getId()); + notice.setContent(tNotices.getContent()); + notice.setUserId(driver.getId()); + notice.setInsertTime(new Date()); + notice.setRead(1); + noticeService.insert(notice); + + /*Map<String,Object> map = new HashMap<String,Object>(); + map.put("sound", userInfo.getIsVoice()); //是否有声音 1=否 2=是 + map.put("vibrate", userInfo.getIsShake()); //是否有震动 1=否 2=是 + map.put("type", 2); //消息类型 1=互动 2=公告 + map.put("id", record.getId()); //对象ID + JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/ + +// if (tNotices.getIsBroadcast() == 1){ +// //增加极光推送 +// JpushUtil.SendPushWithCustomForSh("DRIVER"+driver.getId().toString(),tNotices.getTitle(),"通知消息",null); +// } + + } + } if (tNotices.getIsShow() == 1){ //发布 //定时1秒后执行 Map<String,Object> maps=new HashMap<>(); diff --git a/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/AddNotice.java b/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/AddNotice.java index c4628ba..e88306d 100644 --- a/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/AddNotice.java +++ b/ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/task/jobs/AddNotice.java @@ -33,56 +33,56 @@ System.err.println(("----定时1秒后生成公告记录-----")); TNotices tNotices = tNoticesService.selectById(noticeId); if (SinataUtil.isNotEmpty(tNotices)){ - if (tNotices.getIsUser() == 2){ - List<TUser> tUsers = tUserService.selectList(new EntityWrapper<TUser>().eq("state",1)); - //发送公告给用户 - for (TUser user : tUsers){ - TSystemNotice notice = new TSystemNotice(); - notice.setType(1); - notice.setUserType(1); - notice.setNoticesId(noticeId); - notice.setContent(tNotices.getContent()); - notice.setUserId(user.getId()); - notice.setInsertTime(new Date()); - notice.setRead(1); - tSystemNoticeService.insert(notice); - - /*Map<String,Object> map = new HashMap<String,Object>(); - map.put("sound", userInfo.getIsVoice()); //是否有声音 1=否 2=是 - map.put("vibrate", userInfo.getIsShake()); //是否有震动 1=否 2=是 - map.put("type", 2); //消息类型 1=互动 2=公告 - map.put("id", record.getId()); //对象ID - JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/ - } - } - if (tNotices.getIsDriver() == 2){ - List<TDriver> tDrivers = tDriverService.selectList(new EntityWrapper<TDriver>().eq("authState",2)); - //发送公告给用户 - for (TDriver driver : tDrivers){ - TSystemNotice notice = new TSystemNotice(); - notice.setType(1); - notice.setUserType(2); - notice.setNoticesId(noticeId); - notice.setContent(tNotices.getContent()); - notice.setUserId(driver.getId()); - notice.setInsertTime(new Date()); - notice.setRead(1); - tSystemNoticeService.insert(notice); - - /*Map<String,Object> map = new HashMap<String,Object>(); - map.put("sound", userInfo.getIsVoice()); //是否有声音 1=否 2=是 - map.put("vibrate", userInfo.getIsShake()); //是否有震动 1=否 2=是 - map.put("type", 2); //消息类型 1=互动 2=公告 - map.put("id", record.getId()); //对象ID - JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/ - - if (tNotices.getIsBroadcast() == 1){ - //增加极光推送 - JpushUtil.SendPushWithCustomForSh("DRIVER"+driver.getId().toString(),tNotices.getTitle(),"通知消息",null); - } - - } - } +// if (tNotices.getIsUser() == 2){ +// List<TUser> tUsers = tUserService.selectList(new EntityWrapper<TUser>().eq("state",1)); +// //发送公告给用户 +// for (TUser user : tUsers){ +// TSystemNotice notice = new TSystemNotice(); +// notice.setType(1); +// notice.setUserType(1); +// notice.setNoticesId(noticeId); +// notice.setContent(tNotices.getContent()); +// notice.setUserId(user.getId()); +// notice.setInsertTime(new Date()); +// notice.setRead(1); +// tSystemNoticeService.insert(notice); +// +// /*Map<String,Object> map = new HashMap<String,Object>(); +// map.put("sound", userInfo.getIsVoice()); //是否有声音 1=否 2=是 +// map.put("vibrate", userInfo.getIsShake()); //是否有震动 1=否 2=是 +// map.put("type", 2); //消息类型 1=互动 2=公告 +// map.put("id", record.getId()); //对象ID +// JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/ +// } +// } +// if (tNotices.getIsDriver() == 2){ +// List<TDriver> tDrivers = tDriverService.selectList(new EntityWrapper<TDriver>().eq("authState",2)); +// //发送公告给用户 +// for (TDriver driver : tDrivers){ +// TSystemNotice notice = new TSystemNotice(); +// notice.setType(1); +// notice.setUserType(2); +// notice.setNoticesId(noticeId); +// notice.setContent(tNotices.getContent()); +// notice.setUserId(driver.getId()); +// notice.setInsertTime(new Date()); +// notice.setRead(1); +// tSystemNoticeService.insert(notice); +// +// /*Map<String,Object> map = new HashMap<String,Object>(); +// map.put("sound", userInfo.getIsVoice()); //是否有声音 1=否 2=是 +// map.put("vibrate", userInfo.getIsShake()); //是否有震动 1=否 2=是 +// map.put("type", 2); //消息类型 1=互动 2=公告 +// map.put("id", record.getId()); //对象ID +// JpushUtil.SendPushWithCustomForTransmission(String.valueOf(userInfo.getId()),"【超级过客】提醒您,您有一条新的公告消息。","通知消息",map);*/ +// +// if (tNotices.getIsBroadcast() == 1){ +// //增加极光推送 +// JpushUtil.SendPushWithCustomForSh("DRIVER"+driver.getId().toString(),tNotices.getTitle(),"通知消息",null); +// } +// +// } +// } } } catch (Exception e) { e.printStackTrace(); diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java index 1c20c21..97c1c53 100644 --- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java +++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java @@ -321,12 +321,14 @@ @ApiImplicitParam(value = "头像", name = "avatar", required = false, dataType = "String"), @ApiImplicitParam(value = "昵称", name = "nickName", required = false, dataType = "String"), @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"), - @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int") + @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int"), + @ApiImplicitParam(value = "手机号 获取微信号用", name = "phone", required = false, dataType = "String") + }) public ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, String registAreaCode, Integer sex, String nickName, String avatar,String loginType - ,Integer uid,Integer userType){ + ,Integer uid,Integer userType,String phone){ try { - return userInfoService.wxLogin(type, openid, unionid, jscode, registIp, registAreaCode, sex, nickName, avatar,loginType,uid,userType); + return userInfoService.wxLogin(type, openid, unionid, jscode, registIp, registAreaCode, sex, nickName, avatar,loginType,uid,userType,phone); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserInfoService.java b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserInfoService.java index 207bc5e..c80e64d 100644 --- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserInfoService.java +++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserInfoService.java @@ -84,7 +84,7 @@ * @return */ ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, String registAreaCode, Integer sex, String nickName, String avatar,String loginType - ,Integer uid ,Integer userType + ,Integer uid ,Integer userType,String phone ) throws Exception; diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java index 2739ae5..1bb9c24 100644 --- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java +++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java @@ -32,6 +32,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.client.RestTemplate; import org.springframework.web.multipart.MultipartFile; @@ -507,7 +508,8 @@ @Override public ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, String registAreaCode, Integer sex, String nickName, String avatar,String loginType, - Integer uid,Integer userType) throws Exception { + Integer uid,Integer userType,String phone) throws Exception { + System.err.println("手机号+++++"+phone); UserInfo userInfo = null; if(type == 2){//小程序 if(ToolUtil.isEmpty(jscode)){ @@ -520,10 +522,19 @@ System.out.println("unionid===="+unionid); userInfo = userInfoMapper.queryByOpenid2(openid); + }else{//APP userInfo = userInfoMapper.queryByOpenid(openid); } + if (StringUtils.hasLength(phone)){ + UserInfo userInfo1 = userInfoMapper.queryByPhone(phone); + if (null != userInfo1){ + userInfo = userInfo1; + userInfo.setAppletsOpenId(openid); + } + } if(null == userInfo){ + // 如果为空 需要生成小程序二维码并携带用户id userInfo = new UserInfo(); userInfo.setPassWord(ShiroKit.md5("", salt)); @@ -652,8 +663,8 @@ // 用户id 用于分享 param.put("scene", "uid="+userInfo.getId()+"userType=1"); - param.put("env_version", "trial");// 体验版 -// param.put("env_version", "release");// 正式版 +// param.put("env_version", "trial");// 体验版 + param.put("env_version", "release");// 正式版 param.put("width", 200); //二维码尺寸 param.put("is_hyaline", true); // 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码 参数仅对小程序码生效 param.put("auto_color", true); // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 参数仅对小程序码生效 @@ -739,6 +750,7 @@ } + /** * 设置手机号码操作 * @param uid @@ -818,6 +830,18 @@ this.updateById(userInfo); smsrecordService.saveData(2, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); + List<Invite> invites = inviteMapper.selectList(null); + List<UserInfo> userInfos = this.selectList(null); + List<Integer> integers = new ArrayList<>(); + for (Invite invite : invites) { + UserInfo userInfo2 = userInfos.stream().filter(e -> e.getId().equals(invite.getUserId())).findFirst().orElse(null); + if (userInfo2==null){ + integers.add(invite.getId()); + } + } + if (!integers.isEmpty()){ + inviteMapper.deleteBatchIds(integers); + } return ResultUtil.success(new LoginWarpper()); } @@ -1295,7 +1319,7 @@ * @return */ public String getDefaultName(){ - int num = this.selectCount(new EntityWrapper<UserInfo>().ne("flag", 3)) + 1000001; + int num = this.selectCount(new EntityWrapper<UserInfo>()) + 1000001; return "XN" + String.valueOf(num).substring(1); } diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java index b80ed24..7e716c8 100644 --- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java +++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java @@ -12,7 +12,7 @@ public class OssUploadUtil { //OSS图片访问域名 public static String oss_domain = "https://xv95128.oss-cn-wuhan-lr.aliyuncs.com/"; - public static String oss_domain_cdn = "http://cdn.xn95128.cn/"; + public static String oss_domain_cdn = "https://cdn.xn95128.cn/"; public static String accessKeyId = "LTAI5tEQarpMqRDNnSuj2mCE"; public static String accessKeySecret = "6lBQHFh4XRaIytR5mQ6wDjAbIWmDok"; public static String bucketName="xv95128"; -- Gitblit v1.7.1