fix bug
This commit is contained in:
parent
5fad8ac24e
commit
505341635d
|
|
@ -1,5 +1,6 @@
|
||||||
package com.playlet.web.controller.app;
|
package com.playlet.web.controller.app;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.playlet.common.core.domain.Result;
|
import com.playlet.common.core.domain.Result;
|
||||||
import com.playlet.system.domain.PlayletUser;
|
import com.playlet.system.domain.PlayletUser;
|
||||||
import com.playlet.web.req.PlayUserReq;
|
import com.playlet.web.req.PlayUserReq;
|
||||||
|
|
@ -23,10 +24,11 @@ public class PlayletUserAppController {
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping(value = "/loginByOpenid")
|
@PostMapping(value = "/loginByOpenid")
|
||||||
@ApiOperation(value = "小程序通过openid登录系统", httpMethod = "POST")
|
@ApiOperation(value = "小程序通过openid登录系统(可选择是否带分销入参)", httpMethod = "POST")
|
||||||
public Result<PlayletUser> loginByOpenid(@RequestParam(value = "openid") String openid){
|
public Result<PlayletUser> loginByOpenid(@RequestParam(value = "openid") String openid,
|
||||||
|
@RequestParam(value = "parentId", required = false) String parentId){
|
||||||
try {
|
try {
|
||||||
return Result.success(playletUserAppService.getByOpenId(openid));
|
return Result.success(playletUserAppService.getByOpenId(openid, parentId));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return Result.error(e.getMessage());
|
return Result.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -66,6 +68,19 @@ public class PlayletUserAppController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping(value = "/getPlayletUserPage")
|
||||||
|
@ApiOperation(value = "分页查询用户数据(暂分销列表使用)", httpMethod = "POST")
|
||||||
|
public Result<PageInfo<PlayletUser>> getPlayletUserPage(@RequestBody PlayletUser playletUser,
|
||||||
|
@RequestParam(value = "pageNum") Integer pageNum,
|
||||||
|
@RequestParam(value = "pageSize") Integer pageSize){
|
||||||
|
try {
|
||||||
|
return Result.success(playletUserAppService.getPlayletUserPage(playletUser, pageNum, pageSize));
|
||||||
|
}catch (Exception e){
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping(value = "/updatePasswordByCode")
|
@PostMapping(value = "/updatePasswordByCode")
|
||||||
@ApiOperation(value = "验证码修改密码", httpMethod = "POST")
|
@ApiOperation(value = "验证码修改密码", httpMethod = "POST")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.playlet.web.service.app;
|
package com.playlet.web.service.app;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.playlet.system.domain.PlayletUser;
|
import com.playlet.system.domain.PlayletUser;
|
||||||
import com.playlet.web.req.PlayUserReq;
|
import com.playlet.web.req.PlayUserReq;
|
||||||
|
|
||||||
|
|
@ -13,7 +14,7 @@ public interface PlayletUserAppService {
|
||||||
* @param openid 微信唯一凭证
|
* @param openid 微信唯一凭证
|
||||||
* @return 短剧用户
|
* @return 短剧用户
|
||||||
*/
|
*/
|
||||||
PlayletUser getByOpenId(String openid);
|
PlayletUser getByOpenId(String openid, String parentId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param playUserReq 手机号登陆
|
* @param playUserReq 手机号登陆
|
||||||
|
|
@ -37,4 +38,10 @@ public interface PlayletUserAppService {
|
||||||
*/
|
*/
|
||||||
void updatePasswordByCode(PlayUserReq playUserReq) throws Exception;
|
void updatePasswordByCode(PlayUserReq playUserReq) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param playletUser 分页查询列表
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
PageInfo<PlayletUser> getPlayletUserPage(PlayletUser playletUser, Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.playlet.web.service.app.impl;
|
package com.playlet.web.service.app.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.playlet.common.constant.PlayletConstants;
|
import com.playlet.common.constant.PlayletConstants;
|
||||||
import com.playlet.common.constant.RedisConstants;
|
import com.playlet.common.constant.RedisConstants;
|
||||||
import com.playlet.system.domain.PlayletUser;
|
import com.playlet.system.domain.PlayletUser;
|
||||||
|
|
@ -15,6 +17,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -26,13 +29,16 @@ public class PlayletUserAppServiceImpl implements PlayletUserAppService {
|
||||||
private final StringRedisTemplate stringRedisTemplate;
|
private final StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayletUser getByOpenId(String openid) {
|
public PlayletUser getByOpenId(String openid, String parentId) {
|
||||||
PlayletUser playletUser = iPlayletUserService.lambdaQuery().eq(PlayletUser::getOpenId, openid).one();
|
PlayletUser playletUser = iPlayletUserService.lambdaQuery().eq(PlayletUser::getOpenId, openid).one();
|
||||||
if(ObjectUtil.isNull(playletUser)){
|
if(ObjectUtil.isNull(playletUser)){
|
||||||
playletUser = new PlayletUser();
|
playletUser = new PlayletUser();
|
||||||
playletUser.setOpenId(openid);
|
playletUser.setOpenId(openid);
|
||||||
playletUser.setCreateBy(PlayletConstants.DEFAULT_CREATE);
|
playletUser.setCreateBy(PlayletConstants.DEFAULT_CREATE);
|
||||||
playletUser.setCreateTime(new Date());
|
playletUser.setCreateTime(new Date());
|
||||||
|
if(parentId != null){
|
||||||
|
playletUser.setParentId(parentId);
|
||||||
|
}
|
||||||
iPlayletUserService.save(playletUser);
|
iPlayletUserService.save(playletUser);
|
||||||
playletUser.setCode("PLAYLET_" + playletUser.getId());
|
playletUser.setCode("PLAYLET_" + playletUser.getId());
|
||||||
iPlayletUserService.updateById(playletUser);
|
iPlayletUserService.updateById(playletUser);
|
||||||
|
|
@ -89,4 +95,11 @@ public class PlayletUserAppServiceImpl implements PlayletUserAppService {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageInfo<PlayletUser> getPlayletUserPage(PlayletUser playletUser, Integer pageNum, Integer pageSize) {
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
List<PlayletUser> list = iPlayletUserService.selectPlayletUserList(playletUser);
|
||||||
|
return PageInfo.of(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,4 +49,13 @@ public class PlayletUserExpandAccount extends BaseEntity
|
||||||
@ApiModelProperty(value = "审核状态 01.待审核 02.审核通过 03.审核拒绝")
|
@ApiModelProperty(value = "审核状态 01.待审核 02.审核通过 03.审核拒绝")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "openId")
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "unionId")
|
||||||
|
private String unionId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "头像")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@
|
||||||
<result property="account" column="account" />
|
<result property="account" column="account" />
|
||||||
<result property="type" column="type" />
|
<result property="type" column="type" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
|
<result property="openId" column="open_id" />
|
||||||
|
<result property="unionId" column="union_id" />
|
||||||
|
<result property="avatar" column="avatar" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
|
|
@ -18,7 +21,7 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectPlayletUserExpandAccountVo">
|
<sql id="selectPlayletUserExpandAccountVo">
|
||||||
select id, name, account, type, status, create_by, create_time, update_by, update_time, remark from playlet_user_expand_account
|
select id, name, account, type, status,open_id, union_id, avatar, create_by, create_time, update_by, update_time, remark from playlet_user_expand_account
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPlayletUserExpandAccountList" parameterType="PlayletUserExpandAccount" resultMap="PlayletUserExpandAccountResult">
|
<select id="selectPlayletUserExpandAccountList" parameterType="PlayletUserExpandAccount" resultMap="PlayletUserExpandAccountResult">
|
||||||
|
|
@ -28,6 +31,7 @@
|
||||||
<if test="account != null and account != ''"> and account = #{account}</if>
|
<if test="account != null and account != ''"> and account = #{account}</if>
|
||||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||||
|
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -43,6 +47,9 @@
|
||||||
<if test="account != null">account,</if>
|
<if test="account != null">account,</if>
|
||||||
<if test="type != null">type,</if>
|
<if test="type != null">type,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
|
<if test="avatar != null">avatar,</if>
|
||||||
|
<if test="openId != null">open_id,</if>
|
||||||
|
<if test="unionId != null">union_id,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
|
@ -54,6 +61,9 @@
|
||||||
<if test="account != null">#{account},</if>
|
<if test="account != null">#{account},</if>
|
||||||
<if test="type != null">#{type},</if>
|
<if test="type != null">#{type},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="avatar != null">#{avatar},</if>
|
||||||
|
<if test="openId != null">#{openId},</if>
|
||||||
|
<if test="unionId != null">#{unionId},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue