| | |
| | | package com.dsh.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.account.entity.UserIntegral; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.model.IntegralListQuery; |
| | | import com.dsh.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.account.service.UserIntegralChangesService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/userIntegralChanges/list") |
| | | public List<UserIntegral> list(@RequestBody IntegralListQuery integralListQuery){ |
| | | try { |
| | | Page<UserIntegral> userIntegralPage = new Page<>(integralListQuery.getOffset(), integralListQuery.getLimit()); |
| | | |
| | | List<UserIntegral> list = userIntegralChangesService.listAll(userIntegralPage,integralListQuery); |
| | | return list; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户积分变动记录 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-10 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_user_integral_changes") |
| | | public class UserIntegral extends Model<UserIntegral> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | private String city; |
| | | private String province; |
| | | private String name; |
| | | private String phone; |
| | | private Integer type; |
| | | private Integer oldIntegral; |
| | | private Integer newIntegral; |
| | | private Integer integral; |
| | | private Integer category; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | private String remark; |
| | | |
| | | |
| | | } |
| | |
| | | package com.dsh.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.account.entity.UserIntegral; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.model.IntegralListQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface UserIntegralChangesMapper extends BaseMapper<UserIntegralChanges> { |
| | | |
| | | List<UserIntegral> listAll(@Param("userIntegralPage") Page<UserIntegral> userIntegralPage, @Param("query") IntegralListQuery integralListQuery, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | } |
New file |
| | |
| | | package com.dsh.account.model; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class IntegralListQuery { |
| | | private long offset; |
| | | private long limit; |
| | | |
| | | private String name; |
| | | |
| | | private String phone; |
| | | |
| | | private Integer type; |
| | | private Integer category; |
| | | private String time; |
| | | } |
| | |
| | | package com.dsh.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.account.entity.UserIntegral; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.model.IntegralListQuery; |
| | | import com.dsh.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.ExchangeDetailsResponse; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralsData; |
| | |
| | | |
| | | PointDetailsVo queryRedemptionDetails(Integer detailsId); |
| | | |
| | | List<UserIntegral> listAll(Page<UserIntegral> userIntegralPage, IntegralListQuery integralListQuery); |
| | | |
| | | |
| | | } |
| | |
| | | package com.dsh.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.UserIntegral; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.feignclient.activity.MerChandiseClient; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.mapper.UserIntegralChangesMapper; |
| | | import com.dsh.account.model.IntegralListQuery; |
| | | import com.dsh.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.ExchangeDetailsResponse; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralsData; |
| | |
| | | public PointDetailsVo queryRedemptionDetails(Integer detailsId) { |
| | | return mcClient.getSpecificsOfGoods(detailsId); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserIntegral> listAll(Page<UserIntegral> userIntegralPage, IntegralListQuery integralListQuery) { |
| | | String sTime =null; |
| | | String eTime =null; |
| | | if(ToolUtil.isNotEmpty(integralListQuery.getTime())){ |
| | | sTime = integralListQuery.getTime().split(" - ")[0]+" 00:00:00"; |
| | | eTime = integralListQuery.getTime().split(" - ")[1]+" 23:59:59"; |
| | | } |
| | | List<UserIntegral> userIntegrals = this.baseMapper.listAll(userIntegralPage, integralListQuery, sTime, eTime); |
| | | for (UserIntegral userIntegral : userIntegrals) { |
| | | if(userIntegral.getCategory()==1){ |
| | | userIntegral.setIntegral(userIntegral.getNewIntegral()-userIntegral.getOldIntegral()); |
| | | }else { |
| | | userIntegral.setIntegral(userIntegral.getOldIntegral()-userIntegral.getNewIntegral()); |
| | | } |
| | | } |
| | | return userIntegrals; |
| | | } |
| | | } |
| | |
| | | <mapper namespace="com.dsh.account.mapper.UserIntegralChangesMapper"> |
| | | |
| | | |
| | | <select id="listAll" resultType="com.dsh.account.entity.UserIntegral"> |
| | | select t1.id,t2.province,t2.city,t2.name,t2.phone,t1.type,t1.oldIntegral,t1.newIntegral,t1.category ,t1.insertTime,t1.remark from t_user_integral_changes t1 left join t_app_user t2 on t1.appUserId = t2.id |
| | | where 1=1 |
| | | <if test="query.name !=null and query.name !=''"> |
| | | and t2.name like concat("%",#{query.name},"%") |
| | | </if> |
| | | <if test="query.phone !=null and query.phone !=''"> |
| | | and t2.phone like concat("%",#{query.phone},"%") |
| | | </if> |
| | | <if test="query.type !=null "> |
| | | and t1.type like concat("%",#{query.type},"%") |
| | | </if> |
| | | <if test="query.category !=null "> |
| | | and t1.category like concat("%",#{query.category},"%") |
| | | </if> |
| | | <if test="sTime !=null "> |
| | | and t1.insertTime between #{sTime} and #{eTime} |
| | | </if> |
| | | </select> |
| | | </mapper> |