Procházet zdrojové kódy

接通互医芳华币获取

lmx před 3 dny
rodič
revize
3561f4c228

+ 14 - 2
fs-live-socket/src/main/java/com/fs/live/task/Task.java

@@ -19,6 +19,7 @@ import com.fs.erp.service.FsJstAftersalePushService;
 import com.fs.erp.service.IErpOrderService;
 import com.fs.erp.utils.ErpContextHolder;
 import com.fs.live.domain.*;
+import com.fs.live.enums.FsUserIntegralLogTypeEnum;
 import com.fs.live.mapper.LiveLotteryRegistrationMapper;
 import com.fs.live.param.LiveReplayParam;
 import com.fs.live.service.*;
@@ -29,6 +30,7 @@ import com.fs.live.vo.LotteryVo;
 import com.fs.live.websocket.bean.SendMsgVo;
 import com.fs.live.websocket.service.WebSocketServer;
 import com.fs.store.domain.FsExpress;
+import com.fs.store.domain.FsUser;
 import com.fs.store.enums.OrderLogEnum;
 import com.fs.store.mapper.FsWarehousesMapper;
 import com.fs.store.param.LiveAfterSalesAudit1Param;
@@ -358,7 +360,7 @@ public class Task {
         }
     }
 
-    @Scheduled(cron = "0 0/1 * * * ?")
+    @Scheduled(cron = "0/10 * * * * ?")
     @DistributeLock(key = "autoUpdateWatchReward", scene = "task")
     @Transactional
     public void autoUpdateWatchReward() {
@@ -386,6 +388,16 @@ public class Task {
                 saveUserRewardRecord(openRewardLive, userIds,config.getScoreAmount());
                 // 5.更新用户积分(芳华币
                 fsUserService.incrIntegral(userIds,config.getScoreAmount());
+                //&2025-10-21 新增调用接口新增用户云医芳华币数量
+                List<FsUser> fsUsers = userIds.stream()
+                        .map(userId -> {
+                            FsUser user = new FsUser();
+                            user.setUserId(userId);
+                            user.setIntegral(new BigDecimal(config.getScoreAmount()));
+                            return user;
+                        })
+                        .collect(Collectors.toList());
+                fsUserService.openPlatformGeneralUserIntegralHandle(fsUsers,openRewardLive.getLiveId(),config.getScoreAmount(), FsUserIntegralLogTypeEnum.TYPE_28.getValue());
                 // 6.发送websocket事件消息 通知用户自动领取成功
                 userIds.forEach(userId -> webSocketServer.sendIntegralMessage(openRewardLive.getLiveId(),userId,config.getScoreAmount()));
 
@@ -398,7 +410,7 @@ public class Task {
             record.setLiveId(live.getLiveId());
             record.setUserId(userId);
             record.setIncomeType(1L);
-            record.setSourceType(1L);
+            record.setSourceType(3L);
             record.setSourceId(live.getCompanyId() == null ? 0L : live.getCompanyId());
             record.setRewardType(2L);
             record.setNum(BigDecimal.valueOf(scoreAmount));

+ 60 - 0
fs-service-system/src/main/java/com/fs/live/domain/LiveRewardCompensation.java

@@ -0,0 +1,60 @@
+package com.fs.live.domain;
+
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
+/**
+ * 直播奖励补偿记录对象 live_reward_compensation
+ * 
+ * @author fs
+ * @date 2025-10-21
+ */
+@Data
+public class LiveRewardCompensation extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 芳华币补偿主键id */
+    private Long id;
+
+    /** 用户id */
+    @Excel(name = "用户id")
+    private Long userId;
+
+    /** 关联id */
+    @Excel(name = "关联id")
+    private String unionId;
+
+    /** 状态:0、待补偿 ,1、补偿完成,2、补偿失败 */
+    @Excel(name = "状态:0、待补偿 ,1、补偿完成,2、补偿失败")
+    private Integer status;
+
+    /** 日志类型 */
+    @Excel(name = "日志类型")
+    private Integer logType;
+
+    /** 业务id */
+    @Excel(name = "业务id")
+    private Long businessId;
+
+    /** 积分 */
+    @Excel(name = "积分")
+    private Long integral;
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("userId", getUserId())
+            .append("unionId", getUnionId())
+            .append("status", getStatus())
+            .append("logType", getLogType())
+            .append("businessId", getBusinessId())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 51 - 0
fs-service-system/src/main/java/com/fs/live/enums/FsUserIntegralLogTypeEnum.java

@@ -0,0 +1,51 @@
+package com.fs.live.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.stream.Stream;
+
+@Getter
+@AllArgsConstructor
+public enum FsUserIntegralLogTypeEnum {
+    TYPE_1(1,"签到获得积分"),
+    TYPE_2(2,"消费获得积分"),
+    TYPE_3(3,"分享获得积分"),
+    TYPE_4(4,"退款扣除积分"),
+    TYPE_5(5,"购买积分商品"),
+    TYPE_6(6,"平台取消售后"),
+    TYPE_7(7,"积分过期"),
+    TYPE_8(8,"螳螂同步积分"),
+    TYPE_9(9,"购买课程小节扣除"),
+    TYPE_10(10,"观看课程获取积分"),
+    TYPE_11(11,"新用户完善就诊人获得积分"),
+    TYPE_12(12,"新用户填写收货地址获取积分"),
+    TYPE_13(13,"浏览商品获得积分"),
+    TYPE_14(14,"浏览视频获得积分"),
+    TYPE_15(15,"首次下单疗法获得积分"),
+    TYPE_16(16,"点播看课获得积分"),
+    TYPE_17(17,"点播答题获得积分"),
+    TYPE_18(18,"邀请新用户获取积分"),
+    TYPE_19(19,"填写邀请码获取积分"),
+    TYPE_21(21,"发布短视频获得积分"),
+    TYPE_22(22,"天降宝箱获得芳华币"),
+    TYPE_23(23,"零利润订单消费积分"),
+    TYPE_24(24,"零利润订单退款返还积分"),
+    TYPE_25(25,"活动奖励"),
+    TYPE_26(26,"赠送礼物扣除积分"),
+    TYPE_27(27,"收到礼物增加积分"),
+    TYPE_28(28,"直播间奖励积分"),
+    TYPE_29(29,"直播间红包获取积分"),
+    ;
+
+
+    private Integer value;
+    private String desc;
+
+    public static FsUserIntegralLogTypeEnum toType(int value) {
+        return Stream.of(FsUserIntegralLogTypeEnum.values())
+                .filter(p -> p.value == value)
+                .findAny()
+                .orElse(null);
+    }
+}

+ 61 - 0
fs-service-system/src/main/java/com/fs/live/mapper/LiveRewardCompensationMapper.java

@@ -0,0 +1,61 @@
+package com.fs.live.mapper;
+
+import java.util.List;
+import com.fs.live.domain.LiveRewardCompensation;
+
+/**
+ * 直播奖励补偿记录Mapper接口
+ * 
+ * @author fs
+ * @date 2025-10-21
+ */
+public interface LiveRewardCompensationMapper 
+{
+    /**
+     * 查询直播奖励补偿记录
+     * 
+     * @param id 直播奖励补偿记录ID
+     * @return 直播奖励补偿记录
+     */
+    public LiveRewardCompensation selectLiveRewardCompensationById(Long id);
+
+    /**
+     * 查询直播奖励补偿记录列表
+     * 
+     * @param liveRewardCompensation 直播奖励补偿记录
+     * @return 直播奖励补偿记录集合
+     */
+    public List<LiveRewardCompensation> selectLiveRewardCompensationList(LiveRewardCompensation liveRewardCompensation);
+
+    /**
+     * 新增直播奖励补偿记录
+     * 
+     * @param liveRewardCompensation 直播奖励补偿记录
+     * @return 结果
+     */
+    public int insertLiveRewardCompensation(LiveRewardCompensation liveRewardCompensation);
+
+    /**
+     * 修改直播奖励补偿记录
+     * 
+     * @param liveRewardCompensation 直播奖励补偿记录
+     * @return 结果
+     */
+    public int updateLiveRewardCompensation(LiveRewardCompensation liveRewardCompensation);
+
+    /**
+     * 删除直播奖励补偿记录
+     * 
+     * @param id 直播奖励补偿记录ID
+     * @return 结果
+     */
+    public int deleteLiveRewardCompensationById(Long id);
+
+    /**
+     * 批量删除直播奖励补偿记录
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteLiveRewardCompensationByIds(Long[] ids);
+}

+ 10 - 1
fs-service-system/src/main/java/com/fs/live/service/impl/LiveRedConfServiceImpl.java

@@ -10,13 +10,16 @@ import com.fs.common.core.redis.RedisCache;
 import com.fs.common.core.redis.RedisUtil;
 import com.fs.common.utils.DateUtils;
 import com.fs.live.domain.*;
+import com.fs.live.enums.FsUserIntegralLogTypeEnum;
 import com.fs.live.mapper.LiveMapper;
 import com.fs.live.mapper.LiveRedConfMapper;
 import com.fs.live.mapper.LiveRewardRecordMapper;
 import com.fs.live.mapper.LiveUserRedRecordMapper;
 import com.fs.live.param.RedPO;
 import com.fs.live.service.ILiveRedConfService;
+import com.fs.store.domain.FsUser;
 import com.fs.store.service.IFsUserService;
+import com.fs.store.service.impl.FsUserServiceImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -62,6 +65,8 @@ public class LiveRedConfServiceImpl implements ILiveRedConfService {
 
     @Autowired
     private LiveRedConfMapper baseMapper;
+    @Autowired
+    private FsUserServiceImpl fsUserServiceImpl;
 
     /**
      * 查询直播红包记录配置
@@ -239,6 +244,10 @@ public class LiveRedConfServiceImpl implements ILiveRedConfService {
         //String msg = String.format("用户 %d 抢到了红包 %d,获得 %d 芳华币", userId, redId, integral);
         //WebSocketServer.notifyUsers(msg);
         redisUtil.hashPut(String.format(LiveKeysConstant.LIVE_HOME_PAGE_CONFIG_RED, red.getLiveId(), red.getRedId()), String.valueOf(red.getUserId()), JSONUtil.toJsonStr(record));
+        FsUser fsUser = new FsUser();
+        fsUser.setUserId(red.getUserId());
+        fsUser.setIntegral(new BigDecimal(integral));
+        fsUserServiceImpl.openPlatformGeneralUserIntegralHandle(Collections.singletonList(fsUser),red.getRedId(), 0L, FsUserIntegralLogTypeEnum.TYPE_29.getValue());
         return R.ok("恭喜您成功抢到" + integral + "芳华币");
 /*        } catch (Exception e) {
             e.printStackTrace();
@@ -314,7 +323,7 @@ public class LiveRedConfServiceImpl implements ILiveRedConfService {
         record.setLiveId(live.getLiveId());
         record.setUserId(liveUserRedRecord.getUserId());
         record.setIncomeType(1L);
-        record.setSourceType(1L);
+        record.setSourceType(2L);
         record.setSourceId(live.getCompanyId() == null ? 0L : live.getCompanyId());
         record.setRewardType(2L);
         record.setNum(BigDecimal.valueOf(liveUserRedRecord.getIntegral()));

+ 211 - 0
fs-service-system/src/main/java/com/fs/live/utils/CryptoUtil.java

@@ -0,0 +1,211 @@
+package com.fs.live.utils;
+
+import com.alibaba.fastjson.JSONObject;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+/**
+ * @author MixLiu
+ * @date 2025/9/9 下午3:07)
+ */
+public class CryptoUtil {
+
+    // 默认密钥
+    private static final String DEFAULT_SECRET_KEY = "8a3f7d1e4c9b2a6f5e8d3c7a1b9f2ed5";
+
+    // 加密算法
+    private static final String ALGORITHM = "AES";
+
+    // 签名算法
+    private static final String SIGN_ALGORITHM = "HmacSHA256";
+
+    public static void main(String[] args) {
+        JSONObject mp = new JSONObject();
+        mp.put("unionId", "012312312444");
+        SignedData signedData = JSONObject.parseObject("{\n" +
+                "\t\t\"data\": \"Q0NaCEMBVhdVDxtYBFEaREAWXRZ6BxVbBVIMVwdVXQAJVU4=\",\n" +
+                "\t\t\"signature\": \"WO7vzLZwGyFLLMvaMEDsn4+kUM9RyASMDR/eckKrWzg=\"\n" +
+                "\t}", SignedData.class);
+//        SignedData signedData = encryptAndSignRequest(mp.toString());
+//        System.out.println(signedData.toString());
+        String decryptedText = decryptAndVerifyResponse(signedData);
+        System.out.println(decryptedText);
+    }
+    /**
+     * 客户端:加密请求参数并签名
+     * @param plainText 明文参数
+     * @return 加密并签名后的数据对象
+     */
+    public static SignedData encryptAndSignRequest(String plainText) {
+        return encryptAndSign(plainText, DEFAULT_SECRET_KEY);
+    }
+
+    /**
+     * 客户端:解密并验证响应参数
+     * @param signedData 签名的数据对象
+     * @return 解密后的明文
+     * @throws SecurityException 验签失败时抛出异常
+     */
+    public static String decryptAndVerifyResponse(SignedData signedData) throws SecurityException {
+        return decryptAndVerify(signedData, DEFAULT_SECRET_KEY);
+    }
+
+    /**
+     * 服务端:解密并验证请求参数
+     * @param signedData 签名的数据对象
+     * @return 解密后的明文
+     * @throws SecurityException 验签失败时抛出异常
+     */
+    public static String decryptAndVerifyRequest(SignedData signedData) throws SecurityException {
+        return decryptAndVerify(signedData, DEFAULT_SECRET_KEY);
+    }
+
+    /**
+     * 服务端:加密并签名响应参数
+     * @param plainText 明文响应参数
+     * @return 加密并签名后的数据对象
+     */
+    public static SignedData encryptAndSignResponse(String plainText) {
+        return encryptAndSign(plainText, DEFAULT_SECRET_KEY);
+    }
+
+    /**
+     * 通用加密并签名方法
+     * @param plainText 明文
+     * @param secretKey 密钥
+     * @return 签名的数据对象
+     */
+    private static SignedData encryptAndSign(String plainText, String secretKey) {
+        try {
+            // 加密数据
+            String encryptedData = encrypt(plainText, secretKey);
+
+            // 生成签名
+            String signature = generateSignature(encryptedData, secretKey);
+
+            return new SignedData(encryptedData, signature);
+        } catch (Exception e) {
+            throw new RuntimeException("加密和签名失败", e);
+        }
+    }
+
+    /**
+     * 通用解密并验签方法
+     * @param signedData 签名的数据对象
+     * @param secretKey 密钥
+     * @return 解密后的明文
+     * @throws SecurityException 验签失败时抛出异常
+     */
+    private static String decryptAndVerify(SignedData signedData, String secretKey) throws SecurityException {
+        try {
+            // 验证签名
+            String computedSignature = generateSignature(signedData.getData(), secretKey);
+            if (!computedSignature.equals(signedData.getSignature())) {
+                throw new SecurityException("数据签名验证失败");
+            }
+
+            // 解密数据
+            return decrypt(signedData.getData(), secretKey);
+        } catch (Exception e) {
+            throw new RuntimeException("解密和验签失败", e);
+        }
+    }
+
+    /**
+     * 通用加密方法
+     * @param plainText 明文
+     * @param secretKey 密钥
+     * @return 加密后的密文
+     */
+    private static String encrypt(String plainText, String secretKey) {
+        try {
+            // 简化示例:这里使用简单的异或加密,实际应用中应该使用AES等标准加密算法
+            byte[] keyBytes = secretKey.getBytes(StandardCharsets.UTF_8);
+            byte[] textBytes = plainText.getBytes(StandardCharsets.UTF_8);
+            byte[] encryptedBytes = new byte[textBytes.length];
+
+            for (int i = 0; i < textBytes.length; i++) {
+                encryptedBytes[i] = (byte) (textBytes[i] ^ keyBytes[i % keyBytes.length]);
+            }
+
+            return Base64.getEncoder().encodeToString(encryptedBytes);
+        } catch (Exception e) {
+            throw new RuntimeException("加密失败", e);
+        }
+    }
+
+    /**
+     * 通用解密方法
+     * @param encryptedText 密文
+     * @param secretKey 密钥
+     * @return 解密后的明文
+     */
+    private static String decrypt(String encryptedText, String secretKey) {
+        try {
+            // 简化示例:对应上面的异或解密
+            byte[] keyBytes = secretKey.getBytes(StandardCharsets.UTF_8);
+            byte[] encryptedBytes = Base64.getDecoder().decode(encryptedText);
+            byte[] decryptedBytes = new byte[encryptedBytes.length];
+
+            for (int i = 0; i < encryptedBytes.length; i++) {
+                decryptedBytes[i] = (byte) (encryptedBytes[i] ^ keyBytes[i % keyBytes.length]);
+            }
+
+            return new String(decryptedBytes, StandardCharsets.UTF_8);
+        } catch (Exception e) {
+            throw new RuntimeException("解密失败", e);
+        }
+    }
+
+    /**
+     * 生成数据签名
+     * @param data 数据
+     * @param secretKey 密钥
+     * @return 签名
+     */
+    private static String generateSignature(String data, String secretKey) {
+        try {
+            Mac mac = Mac.getInstance(SIGN_ALGORITHM);
+            SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(StandardCharsets.UTF_8), SIGN_ALGORITHM);
+            mac.init(secretKeySpec);
+            byte[] signatureBytes = mac.doFinal(data.getBytes(StandardCharsets.UTF_8));
+            return Base64.getEncoder().encodeToString(signatureBytes);
+        } catch (Exception e) {
+            throw new RuntimeException("生成签名失败", e);
+        }
+    }
+
+    /**
+     * 签名数据类
+     */
+    public static class SignedData {
+        private String data;        // 加密后的数据
+        private String signature;   // 数据签名
+
+        public SignedData() {}
+
+        public SignedData(String data, String signature) {
+            this.data = data;
+            this.signature = signature;
+        }
+
+        public String getData() {
+            return data;
+        }
+
+        public void setData(String data) {
+            this.data = data;
+        }
+
+        public String getSignature() {
+            return signature;
+        }
+
+        public void setSignature(String signature) {
+            this.signature = signature;
+        }
+    }
+}

+ 42 - 0
fs-service-system/src/main/java/com/fs/live/vo/FsUserIntegralLogsListVO.java

@@ -0,0 +1,42 @@
+package com.fs.live.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class FsUserIntegralLogsListVO {
+    /** id */
+    private Long id;
+
+    /** 用户id */
+    @Excel(name = "用户id")
+    private Long userId;
+
+    /** 1 签到获得积分 2购买商品获得积分 3购买积分商品  */
+    @Excel(name = "类别",dictType = "sys_integral_log_type")
+    private String logType;
+
+    private String logTypeName;
+    /** 积分 正数表示增加积分,负数表示减少积分 */
+    @Excel(name = "积分")
+    private Long integral;
+
+    /** 积分余额 */
+    @Excel(name = "积分余额")
+    private Long balance;
+    @Excel(name = "用户昵称")
+    private String nickName;
+    @Excel(name = "用户电话")
+    private String phone;
+    /** 订单关联id */
+    @Excel(name = "订单关联id")
+    private String businessId;
+    @Excel(name = "订单关联订单编号")
+    private String businessCode;
+    @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+}

+ 581 - 0
fs-service-system/src/main/java/com/fs/live/vo/HisFsUserVO.java

@@ -0,0 +1,581 @@
+package com.fs.live.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import com.vdurmont.emoji.EmojiParser;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 用户对象 fs_user
+ *
+ * @author fs
+ * @date 2023-06-07
+ */
+public class HisFsUserVO extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 用户id */
+    private Long userId;
+
+    /** 用户昵称 */
+    @Excel(name = "用户昵称")
+    private String nickName;
+
+    /** 用户头像 */
+    @Excel(name = "用户头像")
+    private String avatar;
+
+    /** 手机号码 */
+    @Excel(name = "手机号码")
+    private String phone;
+
+    /** 用户积分 */
+    @Excel(name = "用户积分")
+    private Long integral;
+
+    /** 1为正常,0为禁止 */
+    @Excel(name = "1为正常,0为禁止")
+    private Integer status;
+
+    /** 推广上级用户ID */
+    @Excel(name = "推广上级用户ID")
+    private String tuiUserId;
+
+    /** 推广员关联时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "推广员关联时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date tuiTime;
+
+    /** 下级人数 */
+    @Excel(name = "下级人数")
+    private Long tuiUserCount;
+
+    /** 微信小程序OPENID */
+    @Excel(name = "微信小程序OPENID")
+    private String maOpenId;
+
+    /** 微信公众号OPENID */
+    @Excel(name = "微信公众号OPENID")
+    private String mpOpenId;
+
+    /** 关联ID */
+    @Excel(name = "关联ID")
+    private String unionId;
+
+    /** $column.columnComment */
+    @Excel(name = "关联ID")
+    private Integer isDel;
+
+    /** 邀请码 */
+    @Excel(name = "邀请码")
+    private String userCode;
+
+    /** 最后一次登录ip */
+    @Excel(name = "最后一次登录ip")
+    private String lastIp;
+
+    /** 余额 */
+    @Excel(name = "余额")
+    private BigDecimal balance;
+
+    /** 连续签到天数 */
+    @Excel(name = "连续签到天数")
+    private Long signNum;
+
+    private Integer integralStatus;
+
+    private String password;
+    private Integer isBuy;
+
+    private String jpushId;
+    private Integer isVip;
+    private Date  vipStartDate;
+    private Date  vipEndDate;
+    private Integer vipLevel;
+    private Integer vipStatus;
+
+    private Integer sex;
+    private String storeOpenId;
+
+    //是否关注公众号
+    private Integer isOfficialAccountAuth;
+    private Integer isPush; //是否消息通知
+
+    private Integer isIndividuationPush;//是否个性化推送
+
+    private Integer isWeixinAuth;
+
+    private String loginDevice;//当前登录设备
+
+    private String source;//app来源
+
+    private Integer isAddQw;//是否添加企微客服
+
+    private Long parentId; //邀请人id
+
+    private String courseMaOpenId; //彩虹汇医小程序openid
+
+    private String chhyMaOpenId;
+
+    private String appleKey; // 苹果key登陆验证
+
+    private String test;
+    private String uuid;
+    private Date  firstLoginTime;
+
+    /**
+     * 使用积分 [正数为消耗 负数为返还]
+     */
+    private Long useIntegral;
+    /**
+     * 日志类型
+     */
+    private Integer logType;
+    /**
+     * 业务id
+     */
+    private String businessId;
+
+    private List<FsUserIntegralLogsListVO> logs;
+
+    public Date getFirstLoginTime() {
+        return firstLoginTime;
+    }
+
+    public void setFirstLoginTime(Date firstLoginTime) {
+        this.firstLoginTime = firstLoginTime;
+    }
+
+    public String getAppleKey() {
+        return appleKey;
+    }
+
+    public void setAppleKey(String appleKey) {
+        this.appleKey = appleKey;
+    }
+
+    public String getTest() {
+        return test;
+    }
+
+    public void setTest(String test) {
+        this.test = test;
+    }
+
+    public String getChhyMaOpenId() {
+        return chhyMaOpenId;
+    }
+
+    public void setChhyMaOpenId(String chhyMaOpenId) {
+        this.chhyMaOpenId = chhyMaOpenId;
+    }
+
+    private String historyApp; //app登录后不为null(表示是否下载app)
+
+    public String getCourseMaOpenId() {
+        return courseMaOpenId;
+    }
+
+    public void setCourseMaOpenId(String courseMaOpenId) {
+        this.courseMaOpenId = courseMaOpenId;
+    }
+
+    public Integer getIsAddQw() {
+        return isAddQw;
+    }
+
+    public void setIsAddQw(Integer isAddQw) {
+        this.isAddQw = isAddQw;
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public String getLoginDevice() {
+        return loginDevice;
+    }
+
+    public void setLoginDevice(String loginDevice) {
+        this.loginDevice = loginDevice;
+    }
+
+    public Integer getIsWeixinAuth() {
+        return isWeixinAuth;
+    }
+
+    public void setIsWeixinAuth(Integer isWeixinAuth) {
+        this.isWeixinAuth = isWeixinAuth;
+    }
+
+    public Integer getIsIndividuationPush() {
+        return isIndividuationPush;
+    }
+
+    public void setIsIndividuationPush(Integer isIndividuationPush) {
+        this.isIndividuationPush = isIndividuationPush;
+    }
+
+    public Integer getIsPush() {
+        return isPush;
+    }
+
+    public void setIsPush(Integer isPush) {
+        this.isPush = isPush;
+    }
+
+    public Integer getIsOfficialAccountAuth() {
+        return isOfficialAccountAuth;
+    }
+
+    public void setIsOfficialAccountAuth(Integer isOfficialAccountAuth) {
+        this.isOfficialAccountAuth = isOfficialAccountAuth;
+    }
+
+
+    public String getStoreOpenId() {
+        return storeOpenId;
+    }
+
+    public void setStoreOpenId(String storeOpenId) {
+        this.storeOpenId = storeOpenId;
+    }
+
+    public Integer getSex() {
+        return sex;
+    }
+
+    public void setSex(Integer sex) {
+        this.sex = sex;
+    }
+
+    public Integer getIsVip() {
+        return isVip;
+    }
+
+    public void setIsVip(Integer isVip) {
+        this.isVip = isVip;
+    }
+
+    public Date getVipStartDate() {
+        return vipStartDate;
+    }
+
+    public void setVipStartDate(Date vipStartDate) {
+        this.vipStartDate = vipStartDate;
+    }
+
+    public Date getVipEndDate() {
+        return vipEndDate;
+    }
+
+    public void setVipEndDate(Date vipEndDate) {
+        this.vipEndDate = vipEndDate;
+    }
+
+    public Integer getVipLevel() {
+        return vipLevel;
+    }
+
+    public void setVipLevel(Integer vipLevel) {
+        this.vipLevel = vipLevel;
+    }
+
+    public Integer getVipStatus() {
+        return vipStatus;
+    }
+
+    public void setVipStatus(Integer vipStatus) {
+        this.vipStatus = vipStatus;
+    }
+
+    public String getJpushId() {
+        return jpushId;
+    }
+
+    public void setJpushId(String jpushId) {
+        this.jpushId = jpushId;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public Integer getIsBuy() {
+        return isBuy;
+    }
+
+    public void setIsBuy(Integer isBuy) {
+        this.isBuy = isBuy;
+    }
+
+    public Integer getIntegralStatus() {
+        return integralStatus;
+    }
+
+    public void setIntegralStatus(Integer integralStatus) {
+        this.integralStatus = integralStatus;
+    }
+
+    public Long getSignNum() {
+        return signNum;
+    }
+
+    public void setSignNum(Long signNum) {
+        this.signNum = signNum;
+    }
+
+    public void setUserId(Long userId)
+    {
+        this.userId = userId;
+    }
+
+    public Long getUserId()
+    {
+        return userId;
+    }
+    public void setNickName(String nickname)
+    {
+        if(StringUtils.isNotEmpty(nickname)){
+            this.nickName= EmojiParser.parseToHtmlDecimal(nickname);
+        }
+        else{
+            this.nickName= nickname;
+        }
+    }
+
+    public String getNickName()
+    {
+        if(StringUtils.isNotEmpty(nickName)){
+            return EmojiParser.parseToUnicode(nickName);
+        }
+        else{
+            return nickName;
+        }
+    }
+    public void setAvatar(String avatar)
+    {
+        this.avatar = avatar;
+    }
+
+    public String getAvatar()
+    {
+        return avatar;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public void setIntegral(Long integral)
+    {
+        this.integral = integral;
+    }
+
+    public Long getIntegral()
+    {
+        return integral;
+    }
+    public void setStatus(Integer status)
+    {
+        this.status = status;
+    }
+
+    public Integer getStatus()
+    {
+        return status;
+    }
+    public void setTuiUserId(String tuiUserId)
+    {
+        this.tuiUserId = tuiUserId;
+    }
+
+    public String getTuiUserId()
+    {
+        return tuiUserId;
+    }
+    public void setTuiTime(Date tuiTime)
+    {
+        this.tuiTime = tuiTime;
+    }
+
+    public Date getTuiTime()
+    {
+        return tuiTime;
+    }
+    public void setTuiUserCount(Long tuiUserCount)
+    {
+        this.tuiUserCount = tuiUserCount;
+    }
+
+    public Long getTuiUserCount()
+    {
+        return tuiUserCount;
+    }
+    public void setMaOpenId(String maOpenId)
+    {
+        this.maOpenId = maOpenId;
+    }
+
+    public String getMaOpenId()
+    {
+        return maOpenId;
+    }
+    public void setMpOpenId(String mpOpenId)
+    {
+        this.mpOpenId = mpOpenId;
+    }
+
+    public String getMpOpenId()
+    {
+        return mpOpenId;
+    }
+    public void setUnionId(String unionId)
+    {
+        this.unionId = unionId;
+    }
+
+    public String getUnionId()
+    {
+        return unionId;
+    }
+    public void setIsDel(Integer isDel)
+    {
+        this.isDel = isDel;
+    }
+
+    public Integer getIsDel()
+    {
+        return isDel;
+    }
+    public void setUserCode(String userCode)
+    {
+        this.userCode = userCode;
+    }
+
+    public String getUserCode()
+    {
+        return userCode;
+    }
+    public void setLastIp(String lastIp)
+    {
+        this.lastIp = lastIp;
+    }
+
+    public String getLastIp()
+    {
+        return lastIp;
+    }
+    public void setBalance(BigDecimal balance)
+    {
+        this.balance = balance;
+    }
+
+    public BigDecimal getBalance()
+    {
+        return balance;
+    }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getHistoryApp() {
+        return historyApp;
+    }
+
+    public void setHistoryApp(String historyApp) {
+        this.historyApp = historyApp;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+            .append("userId", getUserId())
+            .append("nickName", getNickName())
+            .append("avatar", getAvatar())
+            .append("phone", getPhone())
+            .append("integral", getIntegral())
+            .append("status", getStatus())
+            .append("tuiUserId", getTuiUserId())
+            .append("tuiTime", getTuiTime())
+            .append("tuiUserCount", getTuiUserCount())
+            .append("maOpenId", getMaOpenId())
+            .append("mpOpenId", getMpOpenId())
+            .append("unionId", getUnionId())
+            .append("isDel", getIsDel())
+            .append("userCode", getUserCode())
+            .append("remark", getRemark())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .append("lastIp", getLastIp())
+            .append("balance", getBalance())
+            .append("parentId", getParentId())
+            .append("historyApp", getHistoryApp())
+            .toString();
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public Long getUseIntegral() {
+        return useIntegral;
+    }
+
+    public void setUseIntegral(Long useIntegral) {
+        this.useIntegral = useIntegral;
+    }
+
+    public Integer getLogType() {
+        return logType;
+    }
+
+    public void setLogType(Integer logType) {
+        this.logType = logType;
+    }
+
+    public String getBusinessId() {
+        return businessId;
+    }
+
+    public void setBusinessId(String businessId) {
+        this.businessId = businessId;
+    }
+
+    public List<FsUserIntegralLogsListVO> getLogs() {
+        return logs;
+    }
+
+    public void setLogs(List<FsUserIntegralLogsListVO> logs) {
+        this.logs = logs;
+    }
+}

+ 10 - 0
fs-service-system/src/main/java/com/fs/store/mapper/FsUserMapper.java

@@ -207,4 +207,14 @@ public interface FsUserMapper
             "</foreach>" +
             " </script>"})
     void incrIntegral(@Param("userIds") List<Long> userIds,@Param("scoreAmount") Long scoreAmount);
+
+    @Select({ "<script> " +
+            " select user_id,union_id from fs_user " +
+            " where user_id in " +
+            " <foreach item='item' collection='map' open='(' separator=',' close=')'> " +
+            " #{item.userId} " +
+            " </foreach> " +
+            " </script> "
+    })
+    List<FsUser> selectFsUserByIds(@Param("map") List<FsUser> userIds);
 }

+ 5 - 0
fs-service-system/src/main/java/com/fs/store/service/IFsUserService.java

@@ -6,6 +6,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
 import com.fs.common.core.domain.R;
 import com.fs.live.domain.LiveOrder;
 import com.fs.live.domain.LiveOrderItem;
+import com.fs.live.vo.HisFsUserVO;
 import com.fs.store.domain.FsStoreOrder;
 import com.fs.store.domain.FsStoreOrderItem;
 import com.fs.store.domain.FsStoreProductAttrValue;
@@ -133,4 +134,8 @@ public interface IFsUserService
     void subLiveTuiMoney(LiveOrder order);
 
     void addTuiLiveMoney(LiveOrder order, List<FsStoreProductAttrValue> productAttrValues);
+
+    void openPlatformGeneralUserIntegralHandle(List<FsUser> userIds , Long businessId ,Long unifyIntegral,Integer logType);
+
+    HisFsUserVO getHisUserIntegralWithLogs(FsUser user);
 }

+ 195 - 2
fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java

@@ -1,9 +1,11 @@
 package com.fs.store.service.impl;
 
+import java.io.IOException;
 import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 import cn.binarywang.wx.miniapp.api.WxMaService;
 import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
@@ -11,11 +13,16 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.fs.common.core.domain.R;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.IpUtil;
 import com.fs.live.domain.LiveOrder;
 import com.fs.live.domain.LiveOrderItem;
+import com.fs.live.domain.LiveRewardCompensation;
+import com.fs.live.mapper.LiveRewardCompensationMapper;
+import com.fs.live.utils.CryptoUtil;
+import com.fs.live.vo.HisFsUserVO;
 import com.fs.store.domain.*;
 import com.fs.store.dto.FsStoreCartDTO;
 import com.fs.store.enums.BillDetailEnum;
@@ -35,6 +42,13 @@ import com.fs.wx.miniapp.config.WxMaProperties;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.mp.api.WxMpService;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.aop.framework.AopContext;
@@ -81,6 +95,9 @@ public class FsUserServiceImpl implements IFsUserService
     @Autowired
     private JwtUtils jwtUtils;
 
+    @Autowired
+    LiveRewardCompensationMapper liveRewardCompensationMapper;
+
 
 
     Logger logger =  LoggerFactory.getLogger(FsUserServiceImpl.class);
@@ -496,5 +513,181 @@ public class FsUserServiceImpl implements IFsUserService
         fsUserMapper.incrIntegral(userIds, scoreAmount);
     }
 
+    private final String requestBaseUrl = "http://127.0.0.1:8113";
+//    private final String requestBaseUrl = "https://13708196565.cdwjyyh.com";
+    private final String getHisUserIntegralWithLogs = requestBaseUrl + "/app/common/getHisUserIntegralWithLogs";
+    private final String openPlatformGeneralUserIntegralHandleUrl = requestBaseUrl + "/app/common/openPlatformGeneralUserIntegralHandle";
+
+
+    /**
+     * 批量处理通用用户芳华币
+     * @param userIds  传入参数为userId  integral[本次操作积分数量]
+     * @param businessId
+     * @param unifyIntegral
+     * @param logType
+     */
+    @Override
+    @Async
+    public void openPlatformGeneralUserIntegralHandle(List<FsUser> userIds , Long businessId ,Long unifyIntegral,Integer logType){
+        //根据用户id找到用户的unionIds信息
+        List<FsUser> fsUsers = fsUserMapper.selectFsUserByIds(userIds);
+        Map<Long, BigDecimal> userIdsMap = userIds.stream()
+                .collect(Collectors.toMap(FsUser::getUserId, FsUser::getIntegral));
+        for (FsUser fsUser : fsUsers) {
+            fsUser.setIntegral(userIdsMap.get(fsUser.getUserId()));
+        }
+        Set<String> collect = fsUsers.stream().map(fsUser -> fsUser.getUnionId()).collect(Collectors.toSet());
+        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
+            JSONObject param = new JSONObject();
+            if(unifyIntegral > 0){
+                param.put("integral", unifyIntegral);
+            }
+            param.put("userIntegralList", fsUsers);
+            param.put("unionIds", collect);
+            param.put("logType", logType);
+            param.put("businessId", businessId);
+            CryptoUtil.SignedData signedData = CryptoUtil.encryptAndSignRequest(param.toString());
+            HttpPost httpPost = new HttpPost(openPlatformGeneralUserIntegralHandleUrl);
+            String jsonString = JSONObject.toJSONString(signedData);
+            // 设置请求体和请求头
+            StringEntity entity = new StringEntity(jsonString, "UTF-8");
+            httpPost.setEntity(entity);
+            httpPost.setHeader("Content-Type", "application/json");
+            httpPost.setHeader("Accept", "application/json");
+
+            // 发送请求并获取响应
+            try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
+                String string = EntityUtils.toString(response.getEntity(), "UTF-8");
+                if(com.fs.common.utils.StringUtils.isNotBlank(string)){
+                    JSONObject responseObj = JSONObject.parseObject(string);
+                    if(responseObj.containsKey("code") && "200".equals(responseObj.getString("code"))){
+                        logger.info("统一处理积分结果:{}",responseObj.getString("msg"));
+                        //todo 记录发放失败的用户
+                        if(responseObj.containsKey("failUnionIds")){
+                            List<String> failUnionIds = responseObj.getJSONArray("failUnionIds").toJavaList(String.class);
+                            if(failUnionIds != null && failUnionIds.size() > 0) {
+                                Date date = new Date();
+                                for (String failUnionId : failUnionIds) {
+                                    Optional<FsUser> first = fsUsers.stream().filter(fsUser -> fsUser.getUnionId().equals(failUnionId)).findFirst();
+                                    if(null != first && first.isPresent()){
+                                        FsUser failUser = first.get();
+                                        LiveRewardCompensation  liveRewardCompensation = new LiveRewardCompensation();
+                                        liveRewardCompensation.setBusinessId(businessId);
+                                        liveRewardCompensation.setUserId(failUser.getUserId());
+                                        liveRewardCompensation.setUnionId(failUser.getUnionId());
+                                        liveRewardCompensation.setLogType(logType);
+                                        liveRewardCompensation.setStatus(0);
+                                        liveRewardCompensation.setCreateTime(date);
+                                        liveRewardCompensation.setIntegral(failUser.getIntegral().longValue());
+                                        liveRewardCompensationMapper.insertLiveRewardCompensation(liveRewardCompensation);
+                                    }
+                                }
+                            }
+                        }
+                    } else {
+                        logger.error("统一处理积分失败:{}",responseObj.getString("msg"));
+                    }
+                }
+
+            } catch (ClientProtocolException e) {
+                throw new RuntimeException(e);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+
+        } catch (Exception e){
+            throw new RuntimeException(e);
+        }
+
+    }
+
+
+    @Override
+    public HisFsUserVO getHisUserIntegralWithLogs(FsUser user){
+        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
+            JSONObject param = new JSONObject();
+            param.put("userId", user.getUserId());
+            param.put("phone", user.getPhone());
+            param.put("unionId", user.getUnionId());
+            CryptoUtil.SignedData signedData = CryptoUtil.encryptAndSignRequest(param.toString());
+            HttpPost httpPost = new HttpPost(getHisUserIntegralWithLogs);
+            String jsonString = JSONObject.toJSONString(signedData);
+
+            // 设置请求体和请求头
+            StringEntity entity = new StringEntity(jsonString, "UTF-8");
+            httpPost.setEntity(entity);
+            httpPost.setHeader("Content-Type", "application/json");
+            httpPost.setHeader("Accept", "application/json");
+
+            // 发送请求并获取响应
+            try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
+                String string = EntityUtils.toString(response.getEntity(), "UTF-8");
+                if(com.fs.common.utils.StringUtils.isNotBlank(string)){
+                    JSONObject responseObj = JSONObject.parseObject(string);
+                    if(responseObj.containsKey("code") && "200".equals(responseObj.getString("code"))){
+                        String data = responseObj.getString("data");
+                        CryptoUtil.SignedData responseSignedData = JSONObject.parseObject(data, CryptoUtil.SignedData.class);
+                        String s = CryptoUtil.decryptAndVerifyResponse(responseSignedData);
+                        HisFsUserVO hisFsUserVO = JSONObject.parseObject(s, HisFsUserVO.class);
+                        return hisFsUserVO;
+                    }
+                    return new HisFsUserVO();
+                }
+                return new HisFsUserVO();
+            } catch (ClientProtocolException e) {
+                throw new RuntimeException(e);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+//
+//    /**
+//     * 消费his用户积分
+//     * @param hisFsUserVO
+//     * @return 返回消费结果 消费成功或者失败
+//     */
+//    @Override
+//    public Boolean consumeHisUserIntegral(HisFsUserVO hisFsUserVO){
+//        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
+//            JSONObject param = new JSONObject();
+//            param.put("userId", hisFsUserVO.getUserId());
+//            param.put("useIntegral", hisFsUserVO.getUseIntegral());
+//            param.put("logType", hisFsUserVO.getLogType());
+//            param.put("businessId", hisFsUserVO.getBusinessId());
+//            CryptoUtil.SignedData signedData = CryptoUtil.encryptAndSignRequest(param.toString());
+//            HttpPost httpPost = new HttpPost(useIntegralUrl);
+//            String jsonString = JSONObject.toJSONString(signedData);
+//
+//            // 设置请求体和请求头
+//            StringEntity entity = new StringEntity(jsonString, "UTF-8");
+//            httpPost.setEntity(entity);
+//            httpPost.setHeader("Content-Type", "application/json");
+//            httpPost.setHeader("Accept", "application/json");
+//
+//            // 发送请求并获取响应
+//            try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
+//                String string = EntityUtils.toString(response.getEntity(), "UTF-8");
+//                if(com.fs.common.utils.StringUtils.isNotBlank(string)){
+//                    JSONObject responseObj = JSONObject.parseObject(string);
+//                    if(responseObj.containsKey("code") && "200".equals(responseObj.getString("code"))){
+//                        logger.info("成功消费/返还积分:{}",responseObj.getString("msg"));
+//                        return Boolean.TRUE;
+//                    }else{
+//                        return Boolean.FALSE;
+//                    }
+//                }
+//                return Boolean.FALSE;
+//            } catch (ClientProtocolException e) {
+//                throw new RuntimeException(e);
+//            } catch (IOException e) {
+//                throw new RuntimeException(e);
+//            }
+//        } catch (IOException e) {
+//            throw new RuntimeException(e);
+//        }
+//    }
 
 }

+ 91 - 0
fs-service-system/src/main/resources/mapper/live/LiveRewardCompensationMapper.xml

@@ -0,0 +1,91 @@
+<?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.fs.live.mapper.LiveRewardCompensationMapper">
+    
+    <resultMap type="LiveRewardCompensation" id="LiveRewardCompensationResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="unionId"    column="union_id"    />
+        <result property="status"    column="status"    />
+        <result property="logType"    column="log_type"    />
+        <result property="businessId"    column="business_id"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="integral"    column="integral"    />
+    </resultMap>
+
+    <sql id="selectLiveRewardCompensationVo">
+        select id, user_id, union_id, status, log_type, business_id, create_time, update_time,integral from live_reward_compensation
+    </sql>
+
+    <select id="selectLiveRewardCompensationList" parameterType="LiveRewardCompensation" resultMap="LiveRewardCompensationResult">
+        <include refid="selectLiveRewardCompensationVo"/>
+        <where>  
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="unionId != null  and unionId != ''"> and union_id = #{unionId}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="logType != null "> and log_type = #{logType}</if>
+            <if test="businessId != null "> and business_id = #{businessId}</if>
+        </where>
+    </select>
+    
+    <select id="selectLiveRewardCompensationById" parameterType="Long" resultMap="LiveRewardCompensationResult">
+        <include refid="selectLiveRewardCompensationVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertLiveRewardCompensation" parameterType="LiveRewardCompensation">
+        insert into live_reward_compensation
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="unionId != null">union_id,</if>
+            <if test="status != null">status,</if>
+            <if test="logType != null">log_type,</if>
+            <if test="businessId != null">business_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="integral != null">integral,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="unionId != null">#{unionId},</if>
+            <if test="status != null">#{status},</if>
+            <if test="logType != null">#{logType},</if>
+            <if test="businessId != null">#{businessId},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="integral != null">#{integral},</if>
+         </trim>
+    </insert>
+
+    <update id="updateLiveRewardCompensation" parameterType="LiveRewardCompensation">
+        update live_reward_compensation
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="unionId != null">union_id = #{unionId},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="logType != null">log_type = #{logType},</if>
+            <if test="businessId != null">business_id = #{businessId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="integral != null">integral = #{integral},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteLiveRewardCompensationById" parameterType="Long">
+        delete from live_reward_compensation where id = #{id}
+    </delete>
+
+    <delete id="deleteLiveRewardCompensationByIds" parameterType="String">
+        delete from live_reward_compensation where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    
+</mapper>

+ 1 - 0
fs-service-system/src/main/resources/mapper/live/LiveWatchUserMapper.xml

@@ -144,6 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             FROM live_reward_record lrr
             WHERE lrr.user_id = lwu.user_id
               AND lrr.live_id = lwu.live_id
+              and lrr.source_type = 3
               AND DATE(lrr.create_time) = DATE(#{now})
         )
     </select>

+ 21 - 0
fs-user-app/src/main/java/com/fs/app/controller/LiveDataController.java

@@ -5,7 +5,11 @@ import com.fs.common.core.domain.R;
 import com.fs.live.domain.LiveData;
 import com.fs.live.service.ILiveDataService;
 import com.fs.live.service.ILiveWatchUserService;
+import com.fs.live.vo.HisFsUserVO;
 import com.fs.live.vo.LiveWatchUserVO;
+import com.fs.store.domain.FsUser;
+import com.fs.store.service.IFsUserService;
+import com.hc.openapi.tool.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import springfox.documentation.annotations.ApiIgnore;
@@ -23,6 +27,9 @@ public class LiveDataController extends AppBaseController{
 
     @Autowired
     private ILiveWatchUserService liveWatchUserService;
+
+    @Autowired
+    IFsUserService fsUserService;
     /**
      * 查询直播数据列表
      * */
@@ -107,5 +114,19 @@ public class LiveDataController extends AppBaseController{
         return R.ok().put("recentLiveViewers", recentLiveViewers);
     }
 
+    /**
+     * 获取店铺收藏数
+     * */
+    @Login
+    @GetMapping("/getUserIntegralInfo")
+    public R getUserIntegralInfo() {
+        String userId = getUserId();
+        if (null == userId || StringUtils.isBlank(userId)) {
+            return R.error("未找到用户信息");
+        }
+        FsUser fsUser = fsUserService.selectFsUserById(Long.parseLong(userId));
+        HisFsUserVO hisUserIntegral = fsUserService.getHisUserIntegralWithLogs(fsUser);
+        return R.ok().put("data", hisUserIntegral);
+    }
 
 }