Ver código fonte

Merge remote-tracking branch 'origin/master'

yuhongqi 2 semanas atrás
pai
commit
4f41032b58

+ 28 - 0
fs-admin/src/main/java/com/fs/his/task/userIntegralTask.java

@@ -0,0 +1,28 @@
+package com.fs.his.task;
+
+
+import com.fs.his.service.IFsIntegralCountService;
+import com.fs.his.service.IFsUserIntegralLogsService;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component("userIntegralTask")
+@AllArgsConstructor
+public class userIntegralTask {
+
+    @Autowired
+    private IFsUserIntegralLogsService integralLogsService;
+
+    @Autowired
+    private IFsIntegralCountService integralCountService;
+    /**
+    * 用户积分表 每日消耗统计 除掉看课获取的
+    */
+    public void UserIntegralCount(){
+
+    }
+
+}

+ 7 - 1
fs-company/src/main/java/com/fs/company/controller/company/CompanyVoiceRoboticController.java

@@ -311,7 +311,13 @@ public class CompanyVoiceRoboticController extends BaseController
      */
 	@GetMapping("/companyUserList")
     public R qwUserList(){
-        return R.ok().put("data", companyVoiceRoboticService.qwUserListCompany(new CompanyVoiceRobotic()));
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        Long companyId = loginUser.getCompany().getCompanyId();
+        Long userId = loginUser.getUser().getUserId();
+        CompanyVoiceRobotic robotic = new CompanyVoiceRobotic();
+        robotic.setCompanyId(companyId);
+        robotic.setCompanyUserId(userId);
+        return R.ok().put("data", companyVoiceRoboticService.qwUserListCompany(robotic));
     }
 
     /**

+ 1 - 1
fs-service/src/main/java/com/fs/course/mapper/FsUserVideoMapper.java

@@ -132,7 +132,7 @@ public interface FsUserVideoMapper
     int minusFavorite(Long videoId);
 
     @Select({"<script> " +
-            "select v.video_id as id,v.title,v.description as msg,t.nick_name as username,t.avatar as headImg, " +
+            "select v.video_id as id,v.title,v.description as msg,t.user_id,t.nick_name as username,t.avatar as headImg, " +
             "v.thumbnail as cover,v.url as src,v.likes as likeNum,v.comments as smsNum,v.favorite_num," +
             "v.create_time,v.views as playNumber,v.product_id,p.img_url,p.package_name,v.upload_type,v.shares,v.add_num from fs_user_video v " +
             "left join fs_user_talent t on t.talent_id = v.talent_id " +

+ 1 - 0
fs-service/src/main/java/com/fs/course/vo/FsUserVideoListUVO.java

@@ -9,6 +9,7 @@ import java.util.List;
 @Data
 public class FsUserVideoListUVO {
     private String id; // _id
+    private Long userId;
     private String username;//2.视频拥有者名称
     private String headImg;//3.发布者头像
     private String cover;//视频封面

+ 40 - 0
fs-service/src/main/java/com/fs/his/domain/FsIntegralCount.java

@@ -0,0 +1,40 @@
+package com.fs.his.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 通用积分消耗退还统计(不含看课领的积分)对象 fs_integral_count
+ *
+ * @author fs
+ * @date 2026-05-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FsIntegralCount extends BaseEntity{
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Date consumptionDate;
+
+    /** 通用的积分消耗 */
+    @Excel(name = "通用的积分消耗")
+    private String integralConsume;
+
+    /** $column.columnComment */
+    @Excel(name = "通用的积分消耗")
+    private String integralRefund;
+
+    @Excel(name = "积分类型",dictType="sys_integral_log_type")
+    private Integer logType;
+
+
+}

+ 63 - 0
fs-service/src/main/java/com/fs/his/mapper/FsIntegralCountMapper.java

@@ -0,0 +1,63 @@
+package com.fs.his.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.his.domain.FsIntegralCount;
+
+import java.util.List;
+
+/**
+ * 通用积分消耗退还统计(不含看课领的积分)Mapper接口
+ *
+ * @author fs
+ * @date 2026-05-15
+ */
+public interface FsIntegralCountMapper extends BaseMapper<FsIntegralCount> {
+    /**
+     * 查询通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param id 通用积分消耗退还统计(不含看课领的积分)主键
+     * @return 通用积分消耗退还统计(不含看课领的积分)
+     */
+    FsIntegralCount selectFsIntegralCountById(Long id);
+
+    /**
+     * 查询通用积分消耗退还统计(不含看课领的积分)列表
+     *
+     * @param fsIntegralCount 通用积分消耗退还统计(不含看课领的积分)
+     * @return 通用积分消耗退还统计(不含看课领的积分)集合
+     */
+    List<FsIntegralCount> selectFsIntegralCountList(FsIntegralCount fsIntegralCount);
+
+    /**
+     * 新增通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param fsIntegralCount 通用积分消耗退还统计(不含看课领的积分)
+     * @return 结果
+     */
+    int insertFsIntegralCount(FsIntegralCount fsIntegralCount);
+
+    /**
+     * 修改通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param fsIntegralCount 通用积分消耗退还统计(不含看课领的积分)
+     * @return 结果
+     */
+    int updateFsIntegralCount(FsIntegralCount fsIntegralCount);
+
+    /**
+     * 删除通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param id 通用积分消耗退还统计(不含看课领的积分)主键
+     * @return 结果
+     */
+    int deleteFsIntegralCountById(Long id);
+
+    /**
+     * 批量删除通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteFsIntegralCountByIds(Long[] ids);
+}

+ 63 - 0
fs-service/src/main/java/com/fs/his/service/IFsIntegralCountService.java

@@ -0,0 +1,63 @@
+package com.fs.his.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.his.domain.FsIntegralCount;
+
+import java.util.List;
+
+/**
+ * 通用积分消耗退还统计(不含看课领的积分)Service接口
+ *
+ * @author fs
+ * @date 2026-05-15
+ */
+public interface IFsIntegralCountService extends IService<FsIntegralCount> {
+    /**
+     * 查询通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param id 通用积分消耗退还统计(不含看课领的积分)主键
+     * @return 通用积分消耗退还统计(不含看课领的积分)
+     */
+    FsIntegralCount selectFsIntegralCountById(Long id);
+
+    /**
+     * 查询通用积分消耗退还统计(不含看课领的积分)列表
+     *
+     * @param fsIntegralCount 通用积分消耗退还统计(不含看课领的积分)
+     * @return 通用积分消耗退还统计(不含看课领的积分)集合
+     */
+    List<FsIntegralCount> selectFsIntegralCountList(FsIntegralCount fsIntegralCount);
+
+    /**
+     * 新增通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param fsIntegralCount 通用积分消耗退还统计(不含看课领的积分)
+     * @return 结果
+     */
+    int insertFsIntegralCount(FsIntegralCount fsIntegralCount);
+
+    /**
+     * 修改通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param fsIntegralCount 通用积分消耗退还统计(不含看课领的积分)
+     * @return 结果
+     */
+    int updateFsIntegralCount(FsIntegralCount fsIntegralCount);
+
+    /**
+     * 批量删除通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param ids 需要删除的通用积分消耗退还统计(不含看课领的积分)主键集合
+     * @return 结果
+     */
+    int deleteFsIntegralCountByIds(Long[] ids);
+
+    /**
+     * 删除通用积分消耗退还统计(不含看课领的积分)信息
+     *
+     * @param id 通用积分消耗退还统计(不含看课领的积分)主键
+     * @return 结果
+     */
+    int deleteFsIntegralCountById(Long id);
+}

+ 94 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsIntegralCountServiceImpl.java

@@ -0,0 +1,94 @@
+package com.fs.his.service.impl;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.common.utils.DateUtils;
+import com.fs.his.domain.FsIntegralCount;
+import com.fs.his.mapper.FsIntegralCountMapper;
+import com.fs.his.service.IFsIntegralCountService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 通用积分消耗退还统计(不含看课领的积分)Service业务层处理
+ *
+ * @author fs
+ * @date 2026-05-15
+ */
+@Service
+public class FsIntegralCountServiceImpl extends ServiceImpl<FsIntegralCountMapper, FsIntegralCount> implements IFsIntegralCountService {
+
+    /**
+     * 查询通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param id 通用积分消耗退还统计(不含看课领的积分)主键
+     * @return 通用积分消耗退还统计(不含看课领的积分)
+     */
+    @Override
+    public FsIntegralCount selectFsIntegralCountById(Long id)
+    {
+        return baseMapper.selectFsIntegralCountById(id);
+    }
+
+    /**
+     * 查询通用积分消耗退还统计(不含看课领的积分)列表
+     *
+     * @param fsIntegralCount 通用积分消耗退还统计(不含看课领的积分)
+     * @return 通用积分消耗退还统计(不含看课领的积分)
+     */
+    @Override
+    public List<FsIntegralCount> selectFsIntegralCountList(FsIntegralCount fsIntegralCount)
+    {
+        return baseMapper.selectFsIntegralCountList(fsIntegralCount);
+    }
+
+    /**
+     * 新增通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param fsIntegralCount 通用积分消耗退还统计(不含看课领的积分)
+     * @return 结果
+     */
+    @Override
+    public int insertFsIntegralCount(FsIntegralCount fsIntegralCount)
+    {
+        fsIntegralCount.setCreateTime(DateUtils.getNowDate());
+        return baseMapper.insertFsIntegralCount(fsIntegralCount);
+    }
+
+    /**
+     * 修改通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param fsIntegralCount 通用积分消耗退还统计(不含看课领的积分)
+     * @return 结果
+     */
+    @Override
+    public int updateFsIntegralCount(FsIntegralCount fsIntegralCount)
+    {
+        return baseMapper.updateFsIntegralCount(fsIntegralCount);
+    }
+
+    /**
+     * 批量删除通用积分消耗退还统计(不含看课领的积分)
+     *
+     * @param ids 需要删除的通用积分消耗退还统计(不含看课领的积分)主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsIntegralCountByIds(Long[] ids)
+    {
+        return baseMapper.deleteFsIntegralCountByIds(ids);
+    }
+
+    /**
+     * 删除通用积分消耗退还统计(不含看课领的积分)信息
+     *
+     * @param id 通用积分消耗退还统计(不含看课领的积分)主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFsIntegralCountById(Long id)
+    {
+        return baseMapper.deleteFsIntegralCountById(id);
+    }
+}

+ 2 - 0
fs-service/src/main/resources/mapper/company/CompanyVoiceRoboticMapper.xml

@@ -108,6 +108,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        inner join company_user u on a.company_user_id = u.user_id
        inner join company_dept d on u.dept_id = d.dept_id
         <where>
+            <if test="companyId != null"> and a.company_id = #{companyId}</if>
+            <if test="companyUserId != null"> and a.company_user_id = #{companyUserId}</if>
             <if test="params != null">${params.dataScope}</if>
         </where>
     </select>

+ 77 - 0
fs-service/src/main/resources/mapper/his/FsIntegralCountMapper.xml

@@ -0,0 +1,77 @@
+<?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.his.mapper.FsIntegralCountMapper">
+
+    <resultMap type="FsIntegralCount" id="FsIntegralCountResult">
+        <result property="id"    column="id"    />
+        <result property="consumptionDate"    column="consumption_date"    />
+        <result property="integralConsume"    column="integral_consume"    />
+        <result property="integralRefund"    column="integral_refund"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="logType"    column="log_type"    />
+    </resultMap>
+
+    <sql id="selectFsIntegralCountVo">
+        select id, consumption_date, integral_consume, integral_refund, create_time,log_type from fs_integral_count
+    </sql>
+
+    <select id="selectFsIntegralCountList" parameterType="FsIntegralCount" resultMap="FsIntegralCountResult">
+        <include refid="selectFsIntegralCountVo"/>
+        <where>
+            <if test="consumptionDate != null "> and consumption_date = #{consumptionDate}</if>
+            <if test="integralConsume != null  and integralConsume != ''"> and integral_consume = #{integralConsume}</if>
+            <if test="integralRefund != null  and integralRefund != ''"> and integral_refund = #{integralRefund}</if>
+            <if test="logType != null  and logType != ''"> and log_type = #{logType}</if>
+        </where>
+    </select>
+
+    <select id="selectFsIntegralCountById" parameterType="Long" resultMap="FsIntegralCountResult">
+        <include refid="selectFsIntegralCountVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertFsIntegralCount" parameterType="FsIntegralCount">
+        insert into fs_integral_count
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="consumptionDate != null">consumption_date,</if>
+            <if test="integralConsume != null">integral_consume,</if>
+            <if test="integralRefund != null">integral_refund,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="logType != null">log_type,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="consumptionDate != null">#{consumptionDate},</if>
+            <if test="integralConsume != null">#{integralConsume},</if>
+            <if test="integralRefund != null">#{integralRefund},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="logType != null">#{logType},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFsIntegralCount" parameterType="FsIntegralCount">
+        update fs_integral_count
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="consumptionDate != null">consumption_date = #{consumptionDate},</if>
+            <if test="integralConsume != null">integral_consume = #{integralConsume},</if>
+            <if test="integralRefund != null">integral_refund = #{integralRefund},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="logType != null">logType = #{logType},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteFsIntegralCountById" parameterType="Long">
+        delete from fs_integral_count where id = #{id}
+    </delete>
+
+    <delete id="deleteFsIntegralCountByIds" parameterType="String">
+        delete from fs_integral_count where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 77 - 7
fs-user-app/src/main/java/com/fs/app/controller/AppLoginController.java

@@ -368,6 +368,43 @@ public class AppLoginController extends AppBaseController{
     @PostMapping("/loginByApple")
     @Transactional
     public R loginByApple(@Validated @RequestBody FsUserLoginByAppleParam param) {
+//        try {
+//            if (StringUtils.isEmpty(param.getAppleKey())) {
+//                return R.error("获取苹果key失败");
+//            }
+//            // 根据苹果key查询用户
+//            FsUser user = userMapper.findUserByAppleKey(param.getAppleKey());
+//            Map<String, Object> map = new HashMap<>();
+//            if (user == null) {
+//                map.put("isNew", true);
+//                return R.ok(map);
+//            } else {
+//                if (StringUtils.isNotEmpty(param.getJpushId())) {
+//                    updateExistingUserJpushId(user, param.getJpushId());
+//                }
+//                if (StringUtils.isEmpty(user.getPhone())) {
+//                    map.put("isNew", true);
+//                    return R.ok(map);
+//                }
+//            }
+//
+//            // 更新登录设备信息
+//            updateLoginDevice(user.getUserId(), param.getLoginDevice(), param.getSource());
+//
+//            /*if (user.getStatus()==0){
+//                return R.error("登录失败,账户被禁用");
+//            }*/
+//            int isFirstLogin = userNewTaskService.performTaskOne(user.getUserId());
+//            String token = jwtUtils.generateToken(user.getUserId());
+//            redisCache.setCacheObject("userToken:" + user.getUserId(), token, 604800, TimeUnit.SECONDS);
+//            map.put("token", token);
+//            map.put("user", user);
+//            map.put("isFirst",isFirstLogin);
+//            return R.ok(map);
+//        }catch (Exception e){
+//            logger.error("zyp 苹果登录失败:{}", e.getMessage());
+//            return R.error("登录失败");
+//        }
         try {
             if (StringUtils.isEmpty(param.getAppleKey())) {
                 return R.error("获取苹果key失败");
@@ -375,22 +412,54 @@ public class AppLoginController extends AppBaseController{
             // 根据苹果key查询用户
             FsUser user = userMapper.findUserByAppleKey(param.getAppleKey());
             Map<String, Object> map = new HashMap<>();
+            // 因苹果审核问题, 如果开关打开 则创建新用户 ,若开关关闭需要校验 unionId
+            String key="appleCheckFlag";
+            Boolean flag =redisCache.getCacheObject(key);
+            if(flag==null){
+                flag =false; // 默认关闭
+            }
+
             if (user == null) {
-                map.put("isNew", true);
-                return R.ok(map);
+                if( flag){
+                    user = new FsUser();
+                    user.setLoginDevice(param.getLoginDevice()!=null ? param.getLoginDevice() : null);
+                    user.setSource(param.getSource()!=null ? param.getSource() : null);
+                    user.setAppleKey(param.getAppleKey());
+                    user.setNickName("苹果用户");
+                    user.setCreateTime(new Date());
+                    user.setAppCreateTime(new Date());
+                    user.setStatus(1);
+                    user.setAvatar("https://cos.his.cdwjyyh.com/fs/20240926/420728ee06e54575ba82665dedb4756b.png");
+                    if (StringUtils.isNotEmpty(param.getJpushId())) {
+                        user.setJpushId(param.getJpushId());
+                    }
+                    userService.insertFsUser(user);
+                }else {
+                    map.put("isNew", true); // 新账户,使用微信登录绑定appleKey
+                    return R.ok(map);
+                }
             } else {
                 if (StringUtils.isNotEmpty(param.getJpushId())) {
                     updateExistingUserJpushId(user, param.getJpushId());
+                    try {
+                        //发送注册优惠券
+                        fsUserCouponService.sendRegisterCoupon(user);
+                    } catch (Exception e) {
+                        logger.error("发送注册优惠券失败:{}",e.getMessage());
+                    }
                 }
-                if (StringUtils.isEmpty(user.getPhone())) {
+                // 审核通过后才校验
+                if (!flag && StringUtils.isEmpty(user.getUnionId())) {
                     map.put("isNew", true);
                     return R.ok(map);
                 }
             }
-
-            // 更新登录设备信息
-            updateLoginDevice(user.getUserId(), param.getLoginDevice(), param.getSource());
-
+            if(user.getAppCreateTime()== null){
+                FsUser update = new FsUser();
+                update.setAppCreateTime(new Date());
+                update.setUserId(user.getUserId());
+                userService.updateFsUser(update);
+            }
             /*if (user.getStatus()==0){
                 return R.error("登录失败,账户被禁用");
             }*/
@@ -405,6 +474,7 @@ public class AppLoginController extends AppBaseController{
             logger.error("zyp 苹果登录失败:{}", e.getMessage());
             return R.error("登录失败");
         }
+
     }
 
     private FsUser createNewAppleUser(FsUserEditPhoneParam param, String phoneNumber) {