Commit cdb3c751 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/dev' into jrz_dev

parents 8543716f f2cf11e1
......@@ -5,11 +5,18 @@ import com.github.wxiaoqi.security.admin.dto.BaseUserMemberVO;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserManage;
import com.github.wxiaoqi.security.admin.entity.BaseUserMember;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.InvocationTargetException;
import java.util.Objects;
/**
* 用户会员
......@@ -17,20 +24,45 @@ import java.lang.reflect.InvocationTargetException;
*/
@RestController
@RequestMapping("baseUserMember")
@Api(tags = "后台获取和修改用户会员信息")
public class BaseUserMemberController extends BaseController<BaseUserMemberBiz, BaseUserMember> {
@Autowired
private UserFeign userFeign;
@Autowired
private UserAuthConfig userAuthConfig;
/**
* 获取用户会员
* @param userId
* @return
*/
@ApiOperation(value = "根据用户id获取用户会员信息")
@RequestMapping("/findOne/{userId}")
public ObjectRestResponse<BaseUserMemberVO> findOneByUserId(@PathVariable Integer userId){
return ObjectRestResponse.succ(baseBiz.findOneByUserId(userId));
}
/**
* 根据token获取用户会员信息
* @return
*/
@RequestMapping("/getUserMember")
@ApiOperation(value = "根据token获取用户会员信息")
public ObjectRestResponse<BaseUserMemberVO> findOneByToken(){
try {
AppUserDTO user = userFeign.userDetailByToken(userAuthConfig.getToken(request)).getData();
return ObjectRestResponse.succ(baseBiz.findOneByUserId(user.getUserid()));
} catch (Exception e) {
e.printStackTrace();
return ObjectRestResponse.createDefaultFail();
}
}
// /**
// * 设置用户会员
......@@ -51,12 +83,21 @@ public class BaseUserMemberController extends BaseController<BaseUserMemberBiz,
* @return
*/
@PutMapping("/setUserMember")
@ApiOperation(value = "修改用户会员信息")
public ObjectRestResponse UpdateUserMember(@RequestBody UserMemberDTO userMemberDTO)
throws Exception {
if (userMemberDTO==null||userMemberDTO.getRentFreeDays()<0||userMemberDTO.getTotalNumber()<0) {
if (userMemberDTO==null) {
return ObjectRestResponse.createDefaultFail();
}
if (Objects.nonNull(userMemberDTO.getRentFreeDays())&&userMemberDTO.getRentFreeDays()<0){
return ObjectRestResponse.createDefaultFail();
}
if (Objects.nonNull(userMemberDTO.getTotalNumber())&& userMemberDTO.getTotalNumber()<0){
return ObjectRestResponse.createDefaultFail();
}
baseBiz.UpdateUserMember(userMemberDTO);
return ObjectRestResponse.succ();
......
......@@ -68,26 +68,28 @@
m.total_number as totalNumber,
m.rent_free_days as rentFreeDays,
m.crt_time as timeOfMembership,
m.recent_recharge as recentRecharge,
m.recent_recharge as recentRecharge,
m.name as memberName,
ul.username as inviter,
aup.name as `positionName`
from
app_user_login l
inner join
(select * from app_user_detail where 1=1 <if test="postionState != null">
<choose>
<when test="postionState == 6">
and `position_id`=#{postionState}
</when>
<otherwise>
and <![CDATA[`position_id`<>6]]>
</otherwise>
</choose>
</if>) d
(select * from app_user_detail where 1=1
<if test="postionState != null">
<choose>
<when test="postionState == 6">
and `position_id`=#{postionState}
</when>
<otherwise>
and <![CDATA[`position_id`<>6]]>
</otherwise>
</choose>
</if>
) d
on
d.userid = l.id
left join
left join
app_user_login ul
on
ul.id=d.inviter_account
......@@ -110,7 +112,7 @@
on aup.id = d.position_id
where l.isdel = 0
<if test="mobile !=null and mobile !='' ">
and l.username like CONCAT('%',#{mobile},'%')
and l.username like CONCAT('%',#{mobile},'%')
</if>
<if test="channel !=null ">
and d.channel=#{channel}
......@@ -131,10 +133,10 @@
<if test="source !=null ">
and d.source = #{source}
</if>
order by l.id ASC
order by l.id ASC
</select>
<update id="updateUserMemberStatusByUserId">
<update id="updateUserMemberStatusByUserId">
update `app_user_detail` set `is_member`={status} where `userid`=#{userId}
</update>
<update id="updateUserPositionByUserId">
......
......@@ -49,6 +49,8 @@
m.user_id=#{userId}
and
m.is_del=0
limit 1
</select>
</mapper>
\ No newline at end of file
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