Commit 281bd111 by giaogiao

添加或修改推送token

parent d65753d5
package com.jumeirah.api.app.controller;
import com.jumeirah.api.app.entity.param.DeviceTokenParam;
import com.jumeirah.api.app.service.AppUserApiService;
import com.jumeirah.common.entity.AppUser;
import com.jumeirah.common.param.app.AppSmsRegisterParam;
import com.jumeirah.common.param.app.AppUserInfoParam;
import com.jumeirah.common.param.app.AppUserPhoneUpdateParam;
......@@ -11,9 +13,11 @@ import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -42,6 +46,46 @@ public class AppUserController extends BaseController {
private AppUserApiService appUserApiService;
/**
* ios-添加或修改推送token
*/
@PostMapping("/iosDeviceToken")
@OperationLog(name = "ios-添加或修改推送token", type = OperationLogType.ADD)
@ApiOperation(value = "ios-添加或修改推送token", notes = "添加和修改都调用此接口", response = ApiResult.class)
public ApiResult<Boolean> addIosAppDeviceToken(@RequestBody DeviceTokenParam deviceToken) throws Exception {
AppUser appUser = new AppUser();
appUser.setDeviceToken(deviceToken.getDeviceToken());
appUser.setDeviceType(2);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
appUser.setId(jwtToken.getUserId());
boolean flag = appUserService.updateAppUser(appUser);
return ApiResult.result(flag);
}
/**
* android-添加或修改推送token
*/
@PostMapping("/androidDeviceToken")
@OperationLog(name = "android-添加或修改推送token", type = OperationLogType.ADD)
@ApiOperation(value = "android-添加或修改推送token", notes = "添加和修改都调用此接口", response = ApiResult.class)
public ApiResult<Boolean> addAppDeviceToken(@RequestBody DeviceTokenParam deviceToken) throws Exception {
AppUser appUser = new AppUser();
appUser.setDeviceToken(deviceToken.getDeviceToken());
appUser.setDeviceType(1);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
appUser.setId(jwtToken.getUserId());
boolean flag = appUserService.updateAppUser(appUser);
return ApiResult.result(flag);
}
/**
* 补充或修改APP用户信息
*/
@PostMapping("/updateAppUserInfo")
......
package com.jumeirah.api.app.entity.param;
import lombok.Data;
import java.io.Serializable;
@Data
public class DeviceTokenParam implements Serializable {
private String deviceToken;
}
......@@ -71,6 +71,9 @@ public class AppUser extends BaseEntity {
@ApiModelProperty("性别,0:女,1:男,默认1")
private Integer gender;
@ApiModelProperty("设备类型,1:安卓,2:ios")
private Integer deviceType;
@ApiModelProperty("头像")
private String head;
......
package com.jumeirah.common.param;
import com.jumeirah.common.entity.base.ImgJson;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -7,6 +8,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 包机介绍
*
......@@ -20,8 +23,11 @@ import lombok.experimental.Accessors;
public class CharterIntroductionUpdateParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "包机图片url, json字符串", example = "[{\"url\":\"https://picsum.photos/100/200/\",\"height\":200,\"width\":200},{\"url\":\"https://picsum.photos/100/200/\",\"height\":200,\"width\":200},{\"url\":\"https://picsum.photos/100/200/\",\"height\":200,\"width\":200}]")
private String imgUrl;
@ApiModelProperty("id")
private Integer id;
@ApiModelProperty("包机图片url")
private List<ImgJson> imgUrl;
@ApiModelProperty(value = "包机文字")
private String text;
......
......@@ -60,6 +60,9 @@ public class CharterIntroductionServiceImpl extends BaseServiceImpl<CharterIntro
CharterIntroduction charterIntroduction = new CharterIntroduction();
BeanUtils.copyProperties(charterIntroductionUpdateParam, charterIntroduction);
if (charterIntroductionUpdateParam.getImgUrl() != null) {
charterIntroduction.setImgUrl(Jackson.toJsonString(charterIntroductionUpdateParam.getImgUrl()));
}
return super.updateById(charterIntroduction);
}
......
......@@ -42,11 +42,10 @@ public class JwtTokenRedisVo implements Serializable {
@ApiModelProperty("设备推送token")
private String deviceToken;
/**
* 用户系统类型
*/
private String clientType;
private String deviceType;
/**
* mcId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment