Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

dengweize před 3 dny
rodič
revize
353951c405

+ 10 - 0
fs-company/src/main/java/com/fs/company/controller/course/FsUserCoursePeriodController.java

@@ -145,6 +145,16 @@ public class FsUserCoursePeriodController extends BaseController {
         fsUserCoursePeriod.setCompanyId(loginUser.getCompany().getCompanyId().toString());
         return toAjax(fsUserCoursePeriodService.updateFsUserCoursePeriod(fsUserCoursePeriod));
     }
+    /**
+     * 修改会员营期单独注册状态
+     */
+    @PreAuthorize("@ss.hasPermi('course:period:edit')")
+    @Log(title = "会员营期", businessType = BusinessType.UPDATE)
+    @PutMapping("/editIsNeedRegisterMember")
+    public AjaxResult editIsNeedRegisterMember(@RequestBody FsUserCoursePeriod fsUserCoursePeriod)
+    {
+        return toAjax(fsUserCoursePeriodService.editIsNeedRegisterMember(fsUserCoursePeriod));
+    }
 
     /**
      * 删除会员营期

+ 9 - 0
fs-service/src/main/java/com/fs/course/mapper/FsUserCoursePeriodDaysMapper.java

@@ -122,4 +122,13 @@ public interface FsUserCoursePeriodDaysMapper extends BaseMapper<FsUserCoursePer
 
     @Select("SELECT distinct period_id from fs_user_course_period_days  where day_date >=#{periodSTime} and day_date <=#{periodETime} ")
     List<Long> selectFsUserCoursePeriodDaysByTime(@Param("periodSTime") String periodSTime,@Param("periodETime") String periodETime);
+
+    /**
+     * @Description: 根据id获取当前营期的所有的大于该id数据lesson的id
+     * @Param:
+     * @Return:
+     * @Author xgb
+     * @Date 2025/11/18 11:04
+     */
+    List<Long> selectFsUserCoursePeriodDaysForLastById(FsUserCoursePeriodDays param);
 }

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

@@ -101,4 +101,5 @@ public interface IFsUserCoursePeriodService
 
     List<Long> selectFsUserCoursePeriodListByPeriodId(List<Long> periodIds,Long companyId);
 
+    int editIsNeedRegisterMember(FsUserCoursePeriod fsUserCoursePeriod);
 }

+ 78 - 24
fs-service/src/main/java/com/fs/course/service/impl/FsUserCoursePeriodDaysServiceImpl.java

@@ -344,35 +344,89 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
 
     @Override
     public R updateCourseTime(UpdateCourseTimeVo vo) {
-        List<FsUserCoursePeriodDays> list = fsUserCoursePeriodDaysMapper.selectBatchIds(vo.getIds());
-        list.forEach(day -> {
+        // 批量更新
+        if(vo.getBatchUpdateSwitch()!=null && vo.getBatchUpdateSwitch()==1
+                && vo.getIds()!=null && vo.getIds().size()==1){
+            Long id=vo.getIds().get(0);
+
+            FsUserCoursePeriodDays info= fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysById(id);
+
+            if(info==null || info.getPeriodId()==null || info.getLesson()==null){
+                return R.error(400, "该课程参数异常,请联系管理员");
+            }
+            // 根据id获取当前营期的所有的大于该id数据lesson的id
+            FsUserCoursePeriodDays param = new FsUserCoursePeriodDays();
+            param.setPeriodId(info.getPeriodId());
+            param.setLesson(info.getLesson());
+            List<Long> ids = fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysForLastById(param);
+            List<FsUserCoursePeriodDays> list = fsUserCoursePeriodDaysMapper.selectBatchIds(ids);
+            list.forEach(day -> {
+
+                // 调整时间为直接接收前端传入的年月日,不使用营期的日期(2025年6月11日 10点41分)
+                day.setStartDateTime(vo.getStartTime());
+                day.setEndDateTime(vo.getEndTime1());
+
+
+                SysConfig config = sysConfigMapper.selectConfigByConfigKey("joinTime.switch.config");
+                if (ObjectUtils.isNotEmpty(config)&&config.getConfigValue().equals("1")){
+                    day.setLastJoinTime(vo.getEndTime1());
+                }else {
+                    day.setLastJoinTime(vo.getJoinTime());
+                }
+
+                // 把营期时间改成开始时间
+                day.setDayDate(vo.getStartTime().toLocalDate());
+                // 设置状态
+                LocalDateTime compareDayTime = LocalDateTime.now();
+                if(compareDayTime.isAfter(day.getStartDateTime()) && compareDayTime.isBefore(day.getEndDateTime())){
+                    day.setStatus(1);
+                } else if(compareDayTime.isBefore(day.getStartDateTime())){
+                    day.setStatus(0);
+                } else {
+                    day.setStatus(2);
+                }
+                fsUserCoursePeriodDaysMapper.updateById(day);
+
+                // 时间加一天
+                vo.setStartTime(vo.getStartTime().plusDays(1));
+                vo.setEndTime1(vo.getEndTime1().plusDays(1));
+                vo.setJoinTime(vo.getJoinTime().plusDays(1));
+            });
+
+        }else {
+            List<FsUserCoursePeriodDays> list = fsUserCoursePeriodDaysMapper.selectBatchIds(vo.getIds());
+            list.forEach(day -> {
 //            day.setStartDateTime(LocalDateTime.of(day.getDayDate(), vo.getStartTime()));
 //            day.setEndDateTime(LocalDateTime.of(day.getDayDate(), vo.getEndTime1()));
 //            day.setLastJoinTime(LocalDateTime.of(day.getDayDate(), vo.getJoinTime()));
-            // 调整时间为直接接收前端传入的年月日,不使用营期的日期(2025年6月11日 10点41分)
-            day.setStartDateTime(vo.getStartTime());
-            day.setEndDateTime(vo.getEndTime1());
+                // 调整时间为直接接收前端传入的年月日,不使用营期的日期(2025年6月11日 10点41分)
+                day.setStartDateTime(vo.getStartTime());
+                day.setEndDateTime(vo.getEndTime1());
+
+                SysConfig config = sysConfigMapper.selectConfigByConfigKey("joinTime.switch.config");
+                if (ObjectUtils.isNotEmpty(config)&&config.getConfigValue().equals("1")){
+                    day.setLastJoinTime(vo.getEndTime1());
+                }else {
+                    day.setLastJoinTime(vo.getJoinTime());
+                }
+
+                // 把营期时间改成开始时间
+                day.setDayDate(vo.getStartTime().toLocalDate());
+                // 设置状态
+                LocalDateTime compareDayTime = LocalDateTime.now();
+                if(compareDayTime.isAfter(day.getStartDateTime()) && compareDayTime.isBefore(day.getEndDateTime())){
+                    day.setStatus(1);
+                } else if(compareDayTime.isBefore(day.getStartDateTime())){
+                    day.setStatus(0);
+                } else {
+                    day.setStatus(2);
+                }
+                fsUserCoursePeriodDaysMapper.updateById(day);
+            });
+        }
+
 
-            SysConfig config = sysConfigMapper.selectConfigByConfigKey("joinTime.switch.config");
-            if (ObjectUtils.isNotEmpty(config)&&config.getConfigValue().equals("1")){
-                day.setLastJoinTime(vo.getEndTime1());
-            }else {
-                day.setLastJoinTime(vo.getJoinTime());
-            }
 
-            // 把营期时间改成开始时间
-            day.setDayDate(vo.getStartTime().toLocalDate());
-            // 设置状态
-            LocalDateTime compareDayTime = LocalDateTime.now();
-            if(compareDayTime.isAfter(day.getStartDateTime()) && compareDayTime.isBefore(day.getEndDateTime())){
-                day.setStatus(1);
-            } else if(compareDayTime.isBefore(day.getStartDateTime())){
-                day.setStatus(0);
-            } else {
-                day.setStatus(2);
-            }
-            fsUserCoursePeriodDaysMapper.updateById(day);
-        });
         return R.ok();
     }
 

+ 5 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsUserCoursePeriodServiceImpl.java

@@ -310,4 +310,9 @@ public class FsUserCoursePeriodServiceImpl implements IFsUserCoursePeriodService
     public List<Long> selectFsUserCoursePeriodListByPeriodId(List<Long> periodIds, Long companyId) {
         return fsUserCoursePeriodMapper.selectFsUserCoursePeriodListByPeriodId(periodIds,companyId);
     }
+
+    @Override
+    public int editIsNeedRegisterMember(FsUserCoursePeriod fsUserCoursePeriod) {
+        return fsUserCoursePeriodMapper.updateFsUserCoursePeriod(fsUserCoursePeriod);
+    }
 }

+ 3 - 0
fs-service/src/main/java/com/fs/course/vo/UpdateCourseTimeVo.java

@@ -21,4 +21,7 @@ public class UpdateCourseTimeVo {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime joinTime;
     private LocalDate dayDate;
+
+    // 批量修改开关 0 关闭 1 开启 默认关闭 打开的话修改时间,后续的时间会一起改变
+    private Integer batchUpdateSwitch;
 }

+ 2 - 2
fs-service/src/main/java/com/fs/qw/mapper/QwExternalContactMapper.java

@@ -404,8 +404,8 @@ public interface QwExternalContactMapper extends BaseMapper<QwExternalContact> {
     @Select("SELECT id,external_user_id,name,avatar,remark,description,fs_user_id FROM  qw_external_contact " +
             " WHERE user_id = #{map.userId}   " +
             "AND corp_id =#{map.corpId} " +
-            "AND external_user_id = #{map.externalUserId}" +
-            "AND `status` != 4 AND `status` != 5" +
+            "AND external_user_id = #{map.externalUserId} " +
+            "AND `status` != 4 AND `status` != 5 " +
             "ORDER BY id desc " +
             "limit 1 ")
     QwExternalContact getQwExternalContactDetails(@Param("map")QwExternalContactHParam param);

+ 4 - 0
fs-service/src/main/resources/mapper/course/FsUserCoursePeriodDaysMapper.xml

@@ -239,4 +239,8 @@
         ORDER BY
             a.day_date
     </select>
+
+    <select id="selectFsUserCoursePeriodDaysForLastById" resultType="java.lang.Long">
+       select id from fs_user_course_period_days where del_flag ='0' and period_id = #{periodId} and lesson &gt;= #{lesson} order by lesson
+    </select>
 </mapper>