Merge remote-tracking branch 'origin/feature-20240104' into feature-20240104

master
elliott 2 years ago
commit 958bc6e88e

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.annotation.Excel;
import com.flossom.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -43,7 +42,7 @@ public class WxUserMember extends BaseEntity {
*
*/
@Excel(name = "积分")
private BigDecimal credit;
private Integer credit;
/**
* openid
@ -199,11 +198,11 @@ public class WxUserMember extends BaseEntity {
return username;
}
public void setCredit(BigDecimal credit) {
public void setCredit(Integer credit) {
this.credit = credit;
}
public BigDecimal getCredit() {
public Integer getCredit() {
return credit;
}
@ -371,7 +370,7 @@ public class WxUserMember extends BaseEntity {
public WxUserMember() {
}
public WxUserMember(Long id, String nickname, String headimg, String username, BigDecimal credit, String openid, String unionid, Integer userType, Integer level, String mobile, String provinceId, String province, String cityId, String city, String areaId, String area, Date birthday, Integer clock, Integer activity, String wechat, Integer isAbutment, Integer isCompleteInformation, Integer devicesNum, Date loginTime, Integer status) {
public WxUserMember(Long id, String nickname, String headimg, String username, Integer credit, String openid, String unionid, Integer userType, Integer level, String mobile, String provinceId, String province, String cityId, String city, String areaId, String area, Date birthday, Integer clock, Integer activity, String wechat, Integer isAbutment, Integer isCompleteInformation, Integer devicesNum, Date loginTime, Integer status) {
this.id = id;
this.nickname = nickname;
this.headimg = headimg;

@ -0,0 +1,118 @@
package com.flossom.common.core.domain.entity;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* wx_user_tag
*
* @author flossom
* @date 2023-12-19
*/
public class WxUserTag extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* id
*/
private Long userId;
/**
*
*/
private String tagName;
/**
* id
*/
private Long tagId;
/**
* 1 2
*/
private Integer type;
/**
* 0 1
*/
private Long status;
public WxUserTag(Long id, Long userId, String tagName, Long tagId, Integer type, Long status) {
this.id = id;
this.userId = userId;
this.tagName = tagName;
this.tagId = tagId;
this.type = type;
this.status = status;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getUserId() {
return userId;
}
public void setTagName(String tagName) {
this.tagName = tagName;
}
public String getTagName() {
return tagName;
}
public void setTagId(Long tagId) {
this.tagId = tagId;
}
public Long getTagId() {
return tagId;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getType() {
return type;
}
public void setStatus(Long status) {
this.status = status;
}
public Long getStatus() {
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("tagName", getTagName())
.append("tagId", getTagId())
.append("type", getType())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,69 @@
package com.flossom.common.core.domain.req;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
*
* @author flossom
* @date 2023-12-14
*/
public class WxUserIntegralVm {
/**
* 1- 2-
*/
@NotBlank(message = "请选择积分操作类型")
private String source;
/**
*
*/
@NotNull(message = "积分变动值不能为空")
@Range(min = 0, max = 10000, message = "请正确输入积分变动值")
private Long floatScore;
/**
*
*/
@NotBlank(message = "请输入积分操作说明")
private String remarkContent;
public WxUserIntegralVm() {
}
public WxUserIntegralVm(String source, Long floatScore, String remarkContent) {
this.source = source;
this.floatScore = floatScore;
this.remarkContent = remarkContent;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public Long getFloatScore() {
return floatScore;
}
public void setFloatScore(Long floatScore) {
this.floatScore = floatScore;
}
public String getRemarkContent() {
return remarkContent;
}
public void setRemarkContent(String remarkContent) {
this.remarkContent = remarkContent;
}
}

@ -1,10 +1,7 @@
package com.flossom.common.core.domain.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.annotation.Excel;
import com.flossom.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -13,24 +10,22 @@ import java.util.Date;
* @author flossom
* @date 2023-12-08
*/
public class WxUserMemberVm {
public class WxUserMemberVm extends BaseEntity {
/**
*
* (``)
*/
private Long id;
private String id;
/**
*
*/
@Excel(name = "会员昵称")
private String nickname;
/**
*
*/
@Excel(name = "积分")
private Integer creditStart;
/**
@ -41,56 +36,76 @@ public class WxUserMemberVm {
/**
* 0 1
*/
@Excel(name = "用户类型0游客 1会员")
private Integer userType;
/**
*
*/
@Excel(name = "手机")
private String mobile;
/**
* id
*/
@Excel(name = "省id")
private String provinceId;
/**
* id
*/
@Excel(name = "市id")
private String cityId;
/**
* id
*/
@Excel(name = "区id")
private String areaId;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday;
/**
*
*/
private Date createTimeStart;
private Date beginTime;
/**
*
*/
private Date createTimeEnd;
private Date endTime;
/**
*
*/
private Integer deviceNumStart;
/**
*
*/
private Integer deviceNumEnd;
/**
*
*/
/**
*
*/
/**
*
*/
/**
*
*/
public WxUserMemberVm() {
}
public WxUserMemberVm(Long id, String nickname, Integer creditStart, Integer creditEnd, Integer userType, String mobile, String provinceId, String cityId, String areaId, Date birthday, Date createTimeStart, Date createTimeEnd) {
public WxUserMemberVm(String id, String nickname, Integer creditStart, Integer creditEnd, Integer userType, String mobile, String provinceId, String cityId, String areaId, Date birthday, Date beginTime, Date endTime) {
this.id = id;
this.nickname = nickname;
this.creditStart = creditStart;
@ -101,15 +116,15 @@ public class WxUserMemberVm {
this.cityId = cityId;
this.areaId = areaId;
this.birthday = birthday;
this.createTimeStart = createTimeStart;
this.createTimeEnd = createTimeEnd;
this.beginTime = beginTime;
this.endTime = endTime;
}
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
@ -185,19 +200,35 @@ public class WxUserMemberVm {
this.birthday = birthday;
}
public Date getCreateTimeStart() {
return createTimeStart;
public Date getBeginTime() {
return beginTime;
}
public void setBeginTime(Date beginTime) {
this.beginTime = beginTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Integer getDeviceNumStart() {
return deviceNumStart;
}
public void setCreateTimeStart(Date createTimeStart) {
this.createTimeStart = createTimeStart;
public void setDeviceNumStart(Integer deviceNumStart) {
this.deviceNumStart = deviceNumStart;
}
public Date getCreateTimeEnd() {
return createTimeEnd;
public Integer getDeviceNumEnd() {
return deviceNumEnd;
}
public void setCreateTimeEnd(Date createTimeEnd) {
this.createTimeEnd = createTimeEnd;
public void setDeviceNumEnd(Integer deviceNumEnd) {
this.deviceNumEnd = deviceNumEnd;
}
}

@ -0,0 +1,37 @@
package com.flossom.common.core.enums;
import java.util.Arrays;
/**
*
*
* @author flossom
*/
public enum IntegralChangeTypeEnum {
INCREASE("1", "增加"), REDUCE("2", "减少");
private final String code;
private final String info;
IntegralChangeTypeEnum(String code, String info) {
this.code = code;
this.info = info;
}
public String getCode() {
return code;
}
public String getInfo() {
return info;
}
public static Boolean isIntegralChangType(String code) {
for (IntegralChangeTypeEnum typeEnum : IntegralChangeTypeEnum.values()) {
if (typeEnum.getCode().equals(code)) {
return true;
}
}
return false;
}
}

@ -0,0 +1,26 @@
package com.flossom.common.core.enums;
/**
*
*
* @author flossom
*/
public enum TagTypeStatus {
ENTERPRISE_WECHAT(1, "正常"), MINI_PROGRAM(2, "停用");
private final Integer code;
private final String info;
TagTypeStatus(Integer code, String info) {
this.code = code;
this.info = info;
}
public Integer getCode() {
return code;
}
public String getInfo() {
return info;
}
}

@ -75,4 +75,11 @@ public interface WxUserMemberMapper {
void upgradeMember(@Param("phoneNumber") String phoneNumber, @Param("id") Integer id);
List<WxUserMember> selectWxUserMemberListByVm(WxUserMemberVm wxUserMemberVm);
List<Integer> selectUserCount();
List<Integer> selectWxUserMemberIdList();
}

@ -0,0 +1,69 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxUserTag;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2023-12-19
*/
public interface WxUserTagMapper {
/**
*
*
* @param id
* @return
*/
public WxUserTag selectWxUserTagById(Long id);
/**
*
*
* @param wxUserTag
* @return
*/
public List<WxUserTag> selectWxUserTagList(WxUserTag wxUserTag);
/**
*
*
* @param wxUserTag
* @return
*/
public int insertWxUserTag(WxUserTag wxUserTag);
/**
*
*
* @param wxUserTag
* @return
*/
public int updateWxUserTag(WxUserTag wxUserTag);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserTagById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserTagByIds(Long[] ids);
List<Integer> selectWxUserTagByTagId(@Param("tagId") Integer tagId, @Param("type") Integer type);
void insertBatch(@Param("list") List<WxUserTag> list);
void deleteBatch(@Param("tagIdList") List<Integer> tagIdList, @Param("userIdList") List<Integer> userIdList);
}

@ -84,15 +84,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWxUserMemberListByVm" parameterType="WxUserMemberVm" resultMap="WxUserMemberResult">
<include refid="selectWxUserMemberVo"/>
<where>
<if test="id != null" >id = #{id}</if>
<if test="id!=null and id !=''">
and
<foreach collection="id.split(',')" index="index" item="item" open="(" separator="OR"
close=")">
id = #{item}
</foreach>
</if>
<if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
<if test="creditStart != null and creditEnd != null"> and credit &gt;= #{creditStart} and credit &lt;= #{creditEnd}</if>
<if test="userType != null "> and user_type = #{userType}</if>
<if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
<if test="mobile!=null and mobile !=''">
and
<foreach collection="mobile.split(',')" index="index" item="item" open="(" separator="OR"
close=")">
mobile like concat('%', #{item}, '%')
</foreach>
</if>
<if test="provinceId != null and provinceId != ''"> and province = #{provinceId}</if>
<if test="cityId != null and cityId != ''"> and city = #{cityId}</if>
<if test="areaId != null and areaId != ''"> and area = #{areaId}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="params.beginTime != null and params.beginTime != ''">
and create_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and create_time &lt;= #{params.endTime}
</if>
and status = 0
</where>
</select>
@ -224,4 +242,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertTouristUser" parameterType="WxUserMember" useGeneratedKeys="true" keyProperty="id">
INSERT INTO `wx_user_member` (login_time, create_time) VALUES(sysdate(), sysdate());
</insert>
<select id="selectUserCount" resultType="integer">
SELECT count(1) as count FROM `wx_user_member`
union ALL
SELECT count(1) as count FROM `wx_user_member` WHERE mobile is not null
union ALL
SELECT count(1) as count FROM `wx_user_member` WHERE devices_num > 0
</select>
<select id="selectWxUserMemberIdList" resultType="java.lang.Integer">
SELECT id FROM `wx_user_member`
</select>
</mapper>

@ -0,0 +1,130 @@
<?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">
<mapper namespace="com.flossom.common.core.mapper.WxUserTagMapper">
<resultMap type="WxUserTag" id="WxUserTagResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="tagName" column="tag_name" />
<result property="tagId" column="tag_id" />
<result property="type" column="type" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectWxUserTagVo">
select id, user_id, tag_name, tag_id, type, status, create_by, create_time, update_by, update_time from wx_user_tag
</sql>
<select id="selectWxUserTagList" parameterType="WxUserTag" resultMap="WxUserTagResult">
<include refid="selectWxUserTagVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="tagName != null and tagName != ''"> and tag_name like concat('%', #{tagName}, '%')</if>
<if test="tagId != null "> and tag_id = #{tagId}</if>
<if test="type != null "> and type = #{type}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxUserTagById" parameterType="Long" resultMap="WxUserTagResult">
<include refid="selectWxUserTagVo"/>
where id = #{id}
</select>
<select id="selectWxUserTagByTagId" resultType="java.lang.Integer">
SELECT
user_id
FROM
`wx_user_tag`
WHERE
tag_id = #{tagId} AND type = #{type} AND status = 0
</select>
<insert id="insertWxUserTag" parameterType="WxUserTag" useGeneratedKeys="true" keyProperty="id">
insert into wx_user_tag
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="tagName != null">tag_name,</if>
<if test="tagId != null">tag_id,</if>
<if test="type != null">type,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="tagName != null">#{tagName},</if>
<if test="tagId != null">#{tagId},</if>
<if test="type != null">#{type},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
insert into wx_user_tag (user_id, tag_name, tag_id, `type`, create_time)
values
<foreach collection="list" item="userTag" separator="," >
(
#{userTag.userId},
#{userTag.tagName},
#{userTag.tagId},
#{userTag.type},
#{userTag.createTime}
)
</foreach>
</insert>
<update id="updateWxUserTag" parameterType="WxUserTag">
update wx_user_tag
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="tagName != null">tag_name = #{tagName},</if>
<if test="tagId != null">tag_id = #{tagId},</if>
<if test="type != null">type = #{type},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxUserTagById" parameterType="Long">
delete from wx_user_tag where id = #{id}
</delete>
<delete id="deleteWxUserTagByIds" parameterType="String">
delete from wx_user_tag where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteBatch">
DELETE
FROM
wx_user_tag
WHERE
tag_id IN
<foreach item="tagId" collection="tagIdList" open="(" separator="," close=")">
#{tagId}
</foreach>
AND user_id IN
<foreach item="userId" collection="userIdList" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>

@ -3,7 +3,6 @@ package com.flossom.miniProgram.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.flossom.common.core.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
public class LoginUserVo {
@ -35,7 +34,7 @@ public class LoginUserVo {
*
*/
@Excel(name = "积分")
private BigDecimal credit;
private Integer credit;
/**
*
@ -92,7 +91,7 @@ public class LoginUserVo {
public LoginUserVo() {
}
public LoginUserVo(Long id, String nickname, String headimg, String username, BigDecimal credit, String mobile, String provinceId, String province, String cityId, String city, String areaId, String area, Date birthday, String token) {
public LoginUserVo(Long id, String nickname, String headimg, String username, Integer credit, String mobile, String provinceId, String province, String cityId, String city, String areaId, String area, Date birthday, String token) {
this.id = id;
this.nickname = nickname;
this.headimg = headimg;
@ -141,11 +140,11 @@ public class LoginUserVo {
this.username = username;
}
public BigDecimal getCredit() {
public Integer getCredit() {
return credit;
}
public void setCredit(BigDecimal credit) {
public void setCredit(Integer credit) {
this.credit = credit;
}

@ -23,7 +23,3 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
org.springframework.jdbc.core.JdbcTemplate: DEBUG # 这里使用了Spring Boot默认的数据源连接池若使用其他连接池则根据对应的类名进行调整
com.flossom.miniProgram.mapper: TRACE # 将com.example.mapper替换为自定义Mapper接口的全限定名

@ -2,8 +2,13 @@ package com.flossom.system.controller;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.entity.WxUserMember;
import com.flossom.common.core.domain.req.WxUserIntegralVm;
import com.flossom.common.core.domain.req.WxUserMemberVm;
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
@ -13,16 +18,11 @@ import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
import com.flossom.system.service.IWxUserMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* Controller
@ -97,4 +97,108 @@ public class WxUserMemberController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wxUserMemberService.deleteWxUserMemberByIds(ids));
}
/**
*
*/
@GetMapping("/selectUserCount")
public R selectUserCount() {
return R.ok(wxUserMemberService.selectUserCount());
}
/**
*
*/
@PostMapping("/batchAddMiniProgramTag")
public R batchAddMiniProgramTag(@RequestParam("tagIdList") List<Integer> tagIdList,
@RequestParam(value = "userIdList") List<Integer> userIdList) {
if (tagIdList == null || tagIdList.size() == 0) {
logger.error("参数有误");
throw new ServiceException("参数有误");
}
wxUserMemberService.batchAddMiniProgramTag(tagIdList, userIdList);
return R.ok();
}
/**
*
*/
@PostMapping("/allAddMiniProgramTag")
public R allAddMiniProgramTag(@RequestParam("tagIdList") List<Integer> tagIdList, WxUserMemberVm wxUserMemberVm) {
if (tagIdList == null || tagIdList.size() == 0) {
logger.error("参数有误");
throw new ServiceException("参数有误");
}
List<WxUserMember> list = wxUserMemberService.selectWxUserMemberList(wxUserMemberVm);
if (list != null && list.size() > 0) {
List<Integer> collect = list.stream().map(wxUserMember -> wxUserMember.getId().intValue()).collect(Collectors.toList());
wxUserMemberService.batchAddMiniProgramTag(tagIdList, collect);
}
return R.ok();
}
/**
*
*/
@PostMapping("/batchDelMiniProgramTag")
public R batchDelMiniProgramTag(@RequestParam("tagIdList") List<Integer> tagIdList,
@RequestParam(value = "userIdList") List<Integer> userIdList) {
if (tagIdList == null || tagIdList.size() == 0
|| userIdList == null || userIdList.size() == 0) {
logger.error("参数有误");
throw new ServiceException("参数有误");
}
wxUserMemberService.batchDelMiniProgramTag(tagIdList, userIdList);
return R.ok();
}
/**
*
*/
@PostMapping("/allDelMiniProgramTag")
public R allDelMiniProgramTag(@RequestParam("tagIdList") List<Integer> tagIdList, WxUserMemberVm wxUserMemberVm) {
if (tagIdList == null || tagIdList.size() == 0) {
logger.error("参数有误");
throw new ServiceException("参数有误");
}
List<WxUserMember> list = wxUserMemberService.selectWxUserMemberList(wxUserMemberVm);
if (list != null && list.size() > 0) {
List<Integer> collect = list.stream().map(wxUserMember -> wxUserMember.getId().intValue()).collect(Collectors.toList());
wxUserMemberService.batchDelMiniProgramTag(tagIdList, collect);
}
return R.ok();
}
/**
*
*/
@PostMapping("/batchChangIntegral")
public R batchChangIntegral(@Validated WxUserIntegralVm wxUserIntegralVm, @RequestParam(value = "userIdList") List<Long> userIdList) {
if (userIdList == null || userIdList.size() == 0
|| !IntegralChangeTypeEnum.isIntegralChangType(wxUserIntegralVm.getSource())) {
logger.error("积分操作类型选择有误");
throw new ServiceException("积分操作类型选择有误");
}
wxUserMemberService.batchChangIntegral(wxUserIntegralVm, userIdList);
return R.ok();
}
/**
*
*/
@PostMapping("/allChangIntegral")
public R allChangIntegral(@Validated WxUserIntegralVm wxUserIntegralVm, WxUserMemberVm wxUserMemberVm) {
if (IntegralChangeTypeEnum.isIntegralChangType(wxUserIntegralVm.getSource())) {
logger.error("积分操作类型选择有误");
throw new ServiceException("积分操作类型选择有误");
}
List<WxUserMember> list = wxUserMemberService.selectWxUserMemberList(wxUserMemberVm);
if (list != null && list.size() > 0) {
List<Long> collect = list.stream().map(wxUserMember -> wxUserMember.getId()).collect(Collectors.toList());
wxUserMemberService.batchChangIntegral(wxUserIntegralVm, collect);
}
return R.ok();
}
}

@ -2,6 +2,7 @@ package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxUserMember;
import com.flossom.common.core.domain.req.WxUserIntegralVm;
import com.flossom.common.core.domain.req.WxUserMemberVm;
import java.util.List;
@ -69,4 +70,12 @@ public interface IWxUserMemberService
* @return
*/
public int deleteWxUserMemberById(Long id);
List<Integer> selectUserCount();
void batchAddMiniProgramTag(List<Integer> tagId, List<Integer> userIds);
void batchDelMiniProgramTag(List<Integer> tagIdList, List<Integer> userIdList);
void batchChangIntegral(WxUserIntegralVm wxUserIntegralVm, List<Long> userIdList);
}

@ -0,0 +1,61 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxUserTag;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2023-12-19
*/
public interface IWxUserTagService {
/**
*
*
* @param id
* @return
*/
public WxUserTag selectWxUserTagById(Long id);
/**
*
*
* @param wxUserTag
* @return
*/
public List<WxUserTag> selectWxUserTagList(WxUserTag wxUserTag);
/**
*
*
* @param wxUserTag
* @return
*/
public int insertWxUserTag(WxUserTag wxUserTag);
/**
*
*
* @param wxUserTag
* @return
*/
public int updateWxUserTag(WxUserTag wxUserTag);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserTagByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserTagById(Long id);
}

@ -1,14 +1,28 @@
package com.flossom.system.service.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.flossom.common.core.domain.entity.SysTag;
import com.flossom.common.core.domain.entity.WxUserIntegralLog;
import com.flossom.common.core.domain.entity.WxUserMember;
import com.flossom.common.core.domain.entity.WxUserTag;
import com.flossom.common.core.domain.req.WxUserIntegralVm;
import com.flossom.common.core.domain.req.WxUserMemberVm;
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
import com.flossom.common.core.enums.TagTypeStatus;
import com.flossom.common.core.mapper.SysTagMapper;
import com.flossom.common.core.mapper.WxUserIntegralLogMapper;
import com.flossom.common.core.mapper.WxUserMemberMapper;
import com.flossom.common.core.mapper.WxUserTagMapper;
import com.flossom.common.core.utils.DateUtils;
import com.flossom.common.security.utils.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxUserMemberService;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -17,11 +31,19 @@ import com.flossom.system.service.IWxUserMemberService;
* @date 2023-12-08
*/
@Service
public class WxUserMemberServiceImpl implements IWxUserMemberService
{
public class WxUserMemberServiceImpl implements IWxUserMemberService {
@Autowired
private WxUserMemberMapper wxUserMemberMapper;
@Autowired
private WxUserTagMapper wxUserTagMapper;
@Autowired
private SysTagMapper sysTagMapper;
@Autowired
private WxUserIntegralLogMapper wxUserIntegralLogMapper;
/**
*
*
@ -29,8 +51,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService
* @return
*/
@Override
public WxUserMember selectWxUserMemberById(Long id)
{
public WxUserMember selectWxUserMemberById(Long id) {
return wxUserMemberMapper.selectWxUserMemberById(id);
}
@ -41,8 +62,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService
* @return
*/
@Override
public List<WxUserMember> selectWxUserMemberList(WxUserMember wxUserMember)
{
public List<WxUserMember> selectWxUserMemberList(WxUserMember wxUserMember) {
return wxUserMemberMapper.selectWxUserMemberList(wxUserMember);
}
@ -53,8 +73,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService
* @return
*/
@Override
public List<WxUserMember> selectWxUserMemberList(WxUserMemberVm wxUserMemberVm)
{
public List<WxUserMember> selectWxUserMemberList(WxUserMemberVm wxUserMemberVm) {
return wxUserMemberMapper.selectWxUserMemberListByVm(wxUserMemberVm);
}
@ -65,8 +84,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService
* @return
*/
@Override
public int insertWxUserMember(WxUserMember wxUserMember)
{
public int insertWxUserMember(WxUserMember wxUserMember) {
wxUserMember.setCreateTime(DateUtils.getNowDate());
return wxUserMemberMapper.insertWxUserMember(wxUserMember);
}
@ -78,8 +96,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService
* @return
*/
@Override
public int updateWxUserMember(WxUserMember wxUserMember)
{
public int updateWxUserMember(WxUserMember wxUserMember) {
wxUserMember.setUpdateTime(DateUtils.getNowDate());
return wxUserMemberMapper.updateWxUserMember(wxUserMember);
}
@ -91,8 +108,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService
* @return
*/
@Override
public int deleteWxUserMemberByIds(Long[] ids)
{
public int deleteWxUserMemberByIds(Long[] ids) {
return wxUserMemberMapper.deleteWxUserMemberByIds(ids);
}
@ -103,8 +119,106 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService
* @return
*/
@Override
public int deleteWxUserMemberById(Long id)
{
public int deleteWxUserMemberById(Long id) {
return wxUserMemberMapper.deleteWxUserMemberById(id);
}
@Override
public List<Integer> selectUserCount() {
return wxUserMemberMapper.selectUserCount();
}
/**
*
*
* @param tagIdList
* @param userIdList
*/
@Override
public void batchAddMiniProgramTag(List<Integer> tagIdList, List<Integer> userIdList) {
// 对单个标签操作
for (Integer tagId : tagIdList) {
SysTag sysTag = sysTagMapper.selectDeptById(tagId.longValue());
if (sysTag != null) {
List<Integer> needAddIdList = new ArrayList<>();
// 1、查询该标签下有那些用户关联
List<Integer> existedUserList = wxUserTagMapper.selectWxUserTagByTagId(tagId, TagTypeStatus.MINI_PROGRAM.getCode());
if (existedUserList != null && existedUserList.size() > 0) {
Iterator<Integer> iterator = userIdList.iterator();
while (iterator.hasNext()) {
Integer element = iterator.next();
if (!existedUserList.contains(element)) {
needAddIdList.add(element);
}
}
}
// 2、添加用户与标签的关联
List<WxUserTag> list = new ArrayList<>();
WxUserTag wxUserTag;
if (needAddIdList != null && needAddIdList.size() > 0) {
for (Integer userId : needAddIdList) {
wxUserTag = new WxUserTag(null, userId.longValue(), sysTag.getTagName(), tagId.longValue(), TagTypeStatus.MINI_PROGRAM.getCode(), null);
wxUserTag.setCreateTime(DateUtils.getNowDate());
list.add(wxUserTag);
}
wxUserTagMapper.insertBatch(list);
}
}
}
// TODO: 对接数赢:批量添加小程序标签
}
/**
*
*
* @param tagIdList
* @param userIdList
*/
@Override
public void batchDelMiniProgramTag(List<Integer> tagIdList, List<Integer> userIdList) {
wxUserTagMapper.deleteBatch(tagIdList, userIdList);
// TODO: 对接数赢:批量删除小程序标签
}
/**
* /
*
* @param wxUserIntegralVm
* @param userIdList
*/
@Transactional
@Override
public void batchChangIntegral(WxUserIntegralVm wxUserIntegralVm, List<Long> userIdList) {
for (Long userId : userIdList) {
// 1、记录积分操作日志
WxUserMember wxUserMember = wxUserMemberMapper.selectWxUserMemberById(userId);
if (wxUserMember != null) {
WxUserIntegralLog wxUserIntegralLog = new WxUserIntegralLog();
wxUserIntegralLog.setUserId(userId);
wxUserIntegralLog.setUserName(wxUserMember.getNickname());
wxUserIntegralLog.setUserPhone(wxUserMember.getMobile());
BeanUtils.copyProperties(wxUserIntegralVm, wxUserIntegralLog);
wxUserIntegralLog.setCreateTime(DateUtils.getNowDate());
wxUserIntegralLog.setCreateBy(SecurityUtils.getUsername());
wxUserIntegralLogMapper.insertWxUserIntegralLog(wxUserIntegralLog);
}
// 2、变更总积分
WxUserMember changeUserMember = new WxUserMember();
if (wxUserIntegralVm.getSource().equals(IntegralChangeTypeEnum.INCREASE.getCode())) {
changeUserMember.setCredit(wxUserMember.getCredit() + wxUserIntegralVm.getFloatScore().intValue());
} else if (wxUserIntegralVm.getSource().equals(IntegralChangeTypeEnum.REDUCE.getCode())) {
if (wxUserMember.getCredit() < Integer.valueOf(wxUserIntegralVm.getSource())) {
changeUserMember.setCredit(0);
} else {
changeUserMember.setCredit(wxUserMember.getCredit() - wxUserIntegralVm.getFloatScore().intValue());
}
}
changeUserMember.setId(wxUserMember.getId());
changeUserMember.setUpdateTime(DateUtils.getNowDate());
changeUserMember.setUpdateBy(SecurityUtils.getUsername());
wxUserMemberMapper.updateWxUserMember(changeUserMember);
}
// TODO: 对接数赢:批量积分操作
}
}

@ -0,0 +1,90 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxUserTag;
import com.flossom.common.core.mapper.WxUserTagMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxUserTagService;
/**
* Service
*
* @author flossom
* @date 2023-12-19
*/
@Service
public class WxUserTagServiceImpl implements IWxUserTagService {
@Autowired
private WxUserTagMapper wxUserTagMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxUserTag selectWxUserTagById(Long id) {
return wxUserTagMapper.selectWxUserTagById(id);
}
/**
*
*
* @param wxUserTag
* @return
*/
@Override
public List<WxUserTag> selectWxUserTagList(WxUserTag wxUserTag) {
return wxUserTagMapper.selectWxUserTagList(wxUserTag);
}
/**
*
*
* @param wxUserTag
* @return
*/
@Override
public int insertWxUserTag(WxUserTag wxUserTag) {
wxUserTag.setCreateTime(DateUtils.getNowDate());
return wxUserTagMapper.insertWxUserTag(wxUserTag);
}
/**
*
*
* @param wxUserTag
* @return
*/
@Override
public int updateWxUserTag(WxUserTag wxUserTag) {
wxUserTag.setUpdateTime(DateUtils.getNowDate());
return wxUserTagMapper.updateWxUserTag(wxUserTag);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxUserTagByIds(Long[] ids) {
return wxUserTagMapper.deleteWxUserTagByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxUserTagById(Long id) {
return wxUserTagMapper.deleteWxUserTagById(id);
}
}

@ -1,11 +1,11 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="用户类型" prop="userType">
<el-select v-model="queryParams.userType" @keyup.enter.native="handleQuery">
<el-option label="全部" value=""></el-option>
<el-option label="会员" value="0"></el-option>
<el-option label="游客" value="1"></el-option>
<el-select v-model="queryParams.userType" @keyup.enter.native="handleQuery" style="width: 50%">
<el-option label="全部"></el-option>
<el-option label="会员" :value="1"></el-option>
<el-option label="游客" :value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item label="会员昵称" prop="nickname">
@ -61,7 +61,7 @@
</el-form-item>
<el-form-item label="用户注册时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
v-model="dateRange"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
@ -70,12 +70,9 @@
</el-date-picker>
</el-form-item>
<el-form-item label="积分范围" prop="credit">
<el-input
v-model="queryParams.credit"
placeholder="请输入积分"
clearable
@keyup.enter.native="handleQuery"
/>
<el-input-number v-model="queryParams.creditStart" @keyup.enter.native="handleQuery"></el-input-number>
<el-input-number v-model="queryParams.creditEnd" @keyup.enter.native="handleQuery"></el-input-number>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
@ -309,6 +306,8 @@ export default {
title: "",
//
open: false,
//
dateRange: [],
//
queryParams: {
pageNum: 1,
@ -316,7 +315,8 @@ export default {
nickname: null,
headimg: null,
username: null,
credit: null,
creditStart: undefined,
creditEnd: undefined,
openid: null,
unionid: null,
userType: null,
@ -340,7 +340,7 @@ export default {
collagenMount: null,
loginTime: null,
status: null,
createTime: null,
// createTime: [],
},
//
form: {},
@ -356,7 +356,7 @@ export default {
/** 查询用户列表 */
getList() {
this.loading = true;
listMember(this.queryParams).then(response => {
listMember(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.memberList = response.rows;
this.total = response.total;
this.loading = false;
@ -410,6 +410,7 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},

Loading…
Cancel
Save