三七 hace 1 semana
padre
commit
bd526ccf20

+ 9 - 4
fs-service-system/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -37,6 +37,7 @@ import com.fs.qwApi.param.QwAddContactWayParam;
 import com.fs.qwApi.service.QwApiService;
 import com.fs.sop.mapper.QwSopLogsMapper;
 import com.fs.sop.mapper.SopUserLogsInfoMapper;
+import com.fs.sop.service.ISopUserLogsInfoService;
 import com.fs.store.domain.FsUser;
 import com.fs.store.domain.FsUserCompanyUser;
 import com.fs.store.domain.FsUserIntegralLogs;
@@ -91,6 +92,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
     @Autowired
     private FsCourseWatchLogMapper courseWatchLogMapper;
 
+
+    @Autowired
+    private ISopUserLogsInfoService iSopUserLogsInfoService;
+
     @Autowired
     private QwExternalContactMapper qwExternalContactMapper;
     @Autowired
@@ -469,6 +474,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
             }
             log.setUpdateTime(new Date());
             courseWatchLogMapper.updateFsCourseWatchLog(log);
+
+            iSopUserLogsInfoService.updateSopUserInfoByExternalId(externalContact.getId(),param.getUserId());
+
             return R.ok();
 
         }else {
@@ -483,10 +491,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
             user.setQwExtId(param.getQwExternalId());
             fsUserMapper.updateFsUser(user);
 
-            List<String> list= sopUserLogsInfoMapper.selectSopUserLogsInfoByExtId(contact.getId());
-            if (list!=null&& !list.isEmpty()){
-                sopUserLogsInfoMapper.updateSopUserLogsInfoFsUserIdById(list,param.getUserId());
-            }
+            iSopUserLogsInfoService.updateSopUserInfoByExternalId(externalContact.getId(),param.getUserId());
 
             //绑定上之后 更新观看记录
             //看课记录中userId为0绑定userId

+ 3 - 0
fs-service-system/src/main/java/com/fs/sop/mapper/SopUserLogsInfoMapper.java

@@ -192,6 +192,7 @@ public interface SopUserLogsInfoMapper {
     @Update("update sop_user_logs_info set fs_user_id=#{fsUserId} where external_id =#{externalId}")
     int updateQwExternalContactChangeUserId(@Param("externalId") Long externalId,@Param("fsUserId") Long fsUserId);
 
+
     @DataSource(DataSourceType.SOP)
     @Select("SELECT external_id  FROM `sop_user_logs_info` where sop_id = #{sopId}  and Date(create_time) = Date(#{minDay})")
     List<SopUserLogsInfo> selectDayBySopId(@Param("sopId")String sopId, @Param("minDay")String minDay);
@@ -206,9 +207,11 @@ public interface SopUserLogsInfoMapper {
 
     @DataSource(DataSourceType.SOP)
     List<SopUserLogsInfo> repeatProject(@Param("projects") List<Integer> projects, @Param("externalUserID") String externalUserID);
+
     @DataSource(DataSourceType.SOP)
     @Select("SELECT id  FROM sop_user_logs_info where external_id = #{extId} ")
     List<String> selectSopUserLogsInfoByExtId(@Param("extId")Long extId );
+
     @DataSource(DataSourceType.SOP)
     void updateSopUserLogsInfoFsUserIdById(@Param("data")List<String> list,  @Param("userId") Long userId);
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/sop/service/ISopUserLogsInfoService.java

@@ -21,6 +21,8 @@ public interface ISopUserLogsInfoService {
      */
     void update(SopUserLogsInfo info);
 
+    void updateSopUserInfoByExternalId(Long qwExternalId,Long userId);
+
     /**
      * 根据ID查询记录
      * @param id 主键ID

+ 5 - 0
fs-service-system/src/main/java/com/fs/sop/service/impl/SopUserLogsInfoServiceImpl.java

@@ -141,6 +141,11 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
         sopUserLogsInfoMapper.updateById(info);
     }
 
+    @Override
+    public void updateSopUserInfoByExternalId(Long qwExternalId, Long userId) {
+        sopUserLogsInfoMapper.updateQwExternalContactChangeUserId(qwExternalId,userId);
+    }
+
     @Override
     public SopUserLogsInfo getById(String id) {
         return sopUserLogsInfoMapper.selectById(id);

+ 2 - 1
fs-user-app/src/main/java/com/fs/core/config/DataSourceConfig.java

@@ -41,7 +41,8 @@ public class DataSourceConfig {
     public DynamicDataSource dataSource(@Qualifier("sopDataSource") DataSource sopDataSource,
                                         @Qualifier("masterDataSource") DataSource masterDataSource) {
         Map<Object, Object> targetDataSources = new HashMap<>();
-        targetDataSources.put(DataSourceType.SOP.name(), sopDataSource); // Ensure matching key
+        targetDataSources.put(DataSourceType.MASTER, masterDataSource);
+        targetDataSources.put(DataSourceType.SOP.name(), sopDataSource);
         return new DynamicDataSource(masterDataSource, targetDataSources);
     }
 

+ 2 - 2
fs-user-app/src/main/resources/application.yml

@@ -6,6 +6,6 @@ server:
 
 spring:
   profiles:
-    active: druid-fby
-    include: common,config-fby
+    active: dev
+    include: common,config-dev