Commit 6a80cfd7 by YG8429

修改小程序查询本人权益记录和上级用户权益记录,后台修改绑定人

parent 17da91c4
......@@ -42,13 +42,7 @@ public class EquityFundLogController extends BaseController {
return getDataTable(list);
}
@GetMapping("/query")
public AjaxResult query(EquityFundLog equityFundLog) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
equityFundLog.setNewUid(user.getId());
List<EquityFundLog> list = equityFundLogService.selectEquityFundLogList(equityFundLog);
return success(list);
}
}
package share.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.EquityFundLog;
import share.system.domain.SConsumer;
import share.system.domain.SharingActivities;
import share.system.domain.vo.FrontTokenComponent;
import share.system.service.SharingActivitiesService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 分享活动绑定关系Controller
*
* @author wuwenlong
* @date 2024-09-02
*/
@RestController
@RequestMapping("/activities")
public class SharingActivitiesController extends BaseController {
@Autowired
private SharingActivitiesService sharingActivitiesService;
/**
* 查询分享活动绑定关系列表
*/
@GetMapping("/list")
public TableDataInfo list(SharingActivities sharingActivities) {
startPage();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sharingActivities.setUid(user.getId());
List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
return getDataTable(list);
}
@GetMapping("/query")
public AjaxResult query(SharingActivities sharingActivities) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sharingActivities.setNewUid(user.getId());
List<SharingActivities> list = sharingActivitiesService.selectSharingActivitiesList(sharingActivities);
return success(list);
}
}
package share.system.domain;
import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
/**
* 分享活动绑定关系对象 s_sharing_activities
*
*
* @author wuwenlong
* @date 2024-09-02
* @date 2024-09-14
*/
@Data
@TableName("s_sharing_activities")
public class SharingActivities extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(type = IdType.AUTO)
private Long id;
/** 活动类型(0-新用户注册,1-权益金会员分享) */
......@@ -40,20 +39,50 @@ public class SharingActivities extends BaseEntity
@TableField(select = false)
private Long isDelete;
/** 上级用户头像 */
@Excel(name = "上级用户头像")
private String avatar;
/** 下级用户头像 */
@Excel(name = "下级用户头像")
private String newAvatar;
/** 上级用户昵称 */
@Excel(name = "上级用户昵称")
private String nickName;
/** 下级用户昵称 */
@Excel(name = "下级用户昵称")
private String newNickName;
/** 上级电话 */
@Excel(name = "上级电话")
private String phone;
/** 下级电话 */
@Excel(name = "下级电话")
private String newPhone;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("activityType", getActivityType())
.append("uid", getUid())
.append("newUid", getNewUid())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
.append("id", getId())
.append("activityType", getActivityType())
.append("uid", getUid())
.append("newUid", getNewUid())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("avatar", getAvatar())
.append("newAvatar", getNewAvatar())
.append("nickName", getNickName())
.append("newNickName", getNewNickName())
.append("phone", getPhone())
.append("newPhone", getNewPhone())
.toString();
}
}
......@@ -59,4 +59,6 @@ public interface SharingActivitiesMapper extends BaseMapper<SharingActivities>
* @return 结果
*/
public int deleteSharingActivitiesByIds(Long[] ids);
}
......@@ -312,8 +312,16 @@ public class SConsumerCenterServiceImpl extends ServiceImpl<SConsumerMapper, SCo
//判断是否为分享新用户
if (uid != null){
//添加绑定关系
SConsumer consumer = sConsumerService.selectSConsumerById(uid);
SConsumer newConsumer = sConsumerService.selectSConsumerById(id);
SharingActivities sharingActivities = new SharingActivities();
sharingActivities.setUid(uid);
sharingActivities.setPhone(consumer.getPhone());
sharingActivities.setAvatar(consumer.getAvatar());
sharingActivities.setNickName(consumer.getNickName());
sharingActivities.setNewPhone(newConsumer.getPhone());
sharingActivities.setNewAvatar(newConsumer.getAvatar());
sharingActivities.setNewNickName(newConsumer.getNickName());
sharingActivities.setNewUid(id);
sharingActivities.setCreateTime(DateUtils.getNowDate());
sharingActivitiesService.insertSharingActivities(sharingActivities);
......
......@@ -15,8 +15,10 @@ import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.SConsumer;
import share.system.mapper.SharingActivitiesMapper;
import share.system.domain.SharingActivities;
import share.system.service.SConsumerService;
import share.system.service.SharingActivitiesService;
/**
......@@ -32,6 +34,9 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
private SharingActivitiesMapper sharingActivitiesMapper;
@Autowired
private SConsumerService consumerService;
@Autowired
private RedisTemplate redisTemplate;
/**
......@@ -81,7 +86,11 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
@Override
public int updateSharingActivities(SharingActivities sharingActivities)
{
SConsumer consumer = consumerService.selectSConsumerById(sharingActivities.getUid());
sharingActivities.setUpdateTime(DateUtils.getNowDate());
sharingActivities.setAvatar(consumer.getAvatar());
sharingActivities.setPhone(consumer.getPhone());
sharingActivities.setNickName(consumer.getNickName());
return sharingActivitiesMapper.updateSharingActivities(sharingActivities);
}
......@@ -109,4 +118,6 @@ public class SharingActivitiesServiceImpl extends ServiceImpl<SharingActivitiesM
return sharingActivitiesMapper.deleteSharingActivitiesById(id);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.system.mapper.SharingActivitiesMapper">
<resultMap type="SharingActivities" id="SharingActivitiesResult">
<result property="id" column="id" />
<result property="activityType" column="activity_type" />
......@@ -15,27 +15,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="avatar" column="avatar" />
<result property="newAvatar" column="new_avatar" />
<result property="nickName" column="nick_name" />
<result property="newNickName" column="new_nick_name" />
<result property="phone" column="phone" />
<result property="newPhone" column="new_phone" />
</resultMap>
<sql id="selectSharingActivitiesVo">
select id, activity_type, uid, new_uid, is_delete, create_by, create_time, update_by, update_time, remark from s_sharing_activities
select id, activity_type, uid, new_uid, is_delete, create_by, create_time, update_by, update_time, remark, avatar, new_avatar, nick_name, new_nick_name, phone, new_phone from s_sharing_activities
</sql>
<select id="selectSharingActivitiesList" parameterType="SharingActivities" resultMap="SharingActivitiesResult">
<include refid="selectSharingActivitiesVo"/>
<where>
<where>
<if test="activityType != null and activityType != ''"> and activity_type = #{activityType}</if>
<if test="uid != null "> and uid = #{uid}</if>
<if test="newUid != null "> and new_uid = #{newUid}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
<if test="newAvatar != null and newAvatar != ''"> and new_avatar = #{newAvatar}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="newNickName != null and newNickName != ''"> and new_nick_name like concat('%', #{newNickName}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="newPhone != null and newPhone != ''"> and new_phone = #{newPhone}</if>
</where>
</select>
<select id="selectSharingActivitiesById" parameterType="Long" resultMap="SharingActivitiesResult">
<include refid="selectSharingActivitiesVo"/>
where id = #{id}
</select>
<insert id="insertSharingActivities" parameterType="SharingActivities" useGeneratedKeys="true" keyProperty="id">
insert into s_sharing_activities
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -48,7 +60,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<if test="avatar != null">avatar,</if>
<if test="newAvatar != null">new_avatar,</if>
<if test="nickName != null">nick_name,</if>
<if test="newNickName != null">new_nick_name,</if>
<if test="phone != null">phone,</if>
<if test="newPhone != null">new_phone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="activityType != null and activityType != ''">#{activityType},</if>
<if test="uid != null">#{uid},</if>
......@@ -59,7 +77,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
<if test="avatar != null">#{avatar},</if>
<if test="newAvatar != null">#{newAvatar},</if>
<if test="nickName != null">#{nickName},</if>
<if test="newNickName != null">#{newNickName},</if>
<if test="phone != null">#{phone},</if>
<if test="newPhone != null">#{newPhone},</if>
</trim>
</insert>
<update id="updateSharingActivities" parameterType="SharingActivities">
......@@ -74,6 +98,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="newAvatar != null">new_avatar = #{newAvatar},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="newNickName != null">new_nick_name = #{newNickName},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="newPhone != null">new_phone = #{newPhone},</if>
</trim>
where id = #{id}
</update>
......@@ -83,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteSharingActivitiesByIds" parameterType="String">
delete from s_sharing_activities where id in
delete from s_sharing_activities where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
......
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