Browse Source

1、红包记录数据备份问题调整2
2、app会员查询信息

yfh 1 week ago
parent
commit
4048b78791

+ 26 - 2
fs-company-app/src/main/java/com/fs/app/controller/FsUserController.java

@@ -21,6 +21,7 @@ import com.fs.course.param.newfs.FsUserCourseBeMemberImageParam;
 import com.fs.course.param.newfs.FsUserCourseBeMemberParam;
 import com.fs.course.service.IFsUserCompanyUserService;
 import com.fs.course.service.IFsUserCourseService;
+import com.fs.course.vo.FsUserCourseListPVO;
 import com.fs.course.vo.newfs.FsCourseAnalysisVO;
 import com.fs.his.domain.FsUser;
 import com.fs.his.service.IFsUserProjectTagService;
@@ -30,7 +31,9 @@ import com.fs.store.param.h5.TagListParam;
 import com.fs.store.param.h5.UserStatisticsCommonParam;
 import com.fs.store.service.IFsUserCourseCountService;
 import com.fs.store.vo.h5.*;
+import com.fs.system.mapper.SysDictDataMapper;
 import com.fs.system.service.ISysConfigService;
+import com.fs.system.vo.DictVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -46,6 +49,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.stream.Collectors;
 
 import static com.fs.his.utils.PhoneUtil.encryptPhone;
 
@@ -60,7 +64,8 @@ public class FsUserController extends AppBaseController {
 
     @Autowired
     private ICompanyUserService companyUserService;
-
+    @Autowired
+    private SysDictDataMapper dictDataMapper;
     @Autowired
     private ICompanyTagUserService companyTagUserService;
 
@@ -92,7 +97,26 @@ public class FsUserController extends AppBaseController {
 //        PageInfo<FsUserPageListVO> pageInfo = new PageInfo<>(list);
         return ResponseResult.ok(fsUserPageListVOPageInfo);
     }
-
+    @Login
+    @PostMapping("/pageListByApp")
+    @ApiOperation("用户会员分页列表")
+    public ResponseResult<PageInfo<FsUser>> pageListByApp(@RequestBody FsUser param) {
+        log.debug("用户会员分页列表 param: {}", JSON.toJSONString(param));
+        param.setUserId(Long.parseLong(getUserId()));
+        List<FsUser> fsUsers = fsUserService.selectFsUserList(param);
+        List<DictVO> dictVOS = dictDataMapper.selectDictDataListByType("sys_course_project");
+        Map<String, String> projectMap = dictVOS.stream()
+                .collect(Collectors.toMap(DictVO::getDictValue, DictVO::getDictLabel));
+        for (FsUser vo : fsUsers) {
+            if (vo.getProjectId() != null) {
+                String projectName = projectMap.get(vo.getProjectId().toString());
+                if (projectName != null) {
+                    vo.setProjectName(projectName);
+                }
+            }
+        }
+        return ResponseResult.ok( new PageInfo<>(fsUsers));
+    }
     @Login
     @GetMapping("/allCompanyUser")
     @ApiOperation("获取所有公司销售")

+ 18 - 9
fs-service/src/main/java/com/fs/course/service/impl/FsCourseAnswerLogsServiceImpl.java

@@ -287,7 +287,7 @@ public class FsCourseAnswerLogsServiceImpl implements IFsCourseAnswerLogsService
         queryLog.setBeginTime(getEarliestTimeString());
 
         // 设置结束时间为今年12月1日之前(包含历史所有年份的12月之前数据)
-        queryLog.setEndTime(getDecemberFirstTimeString());
+        queryLog.setEndTime(getLastYearDecemberFirstTimeString());
 
         return queryLog;
     }
@@ -374,25 +374,34 @@ public class FsCourseAnswerLogsServiceImpl implements IFsCourseAnswerLogsService
     }
 
     /**
-     * 获取今年12月1日之前的时间字符串
+     * 获取去年12月1日之前的时间字符串
+     * 注意:这个是时间上限,查询条件是小于这个时间的数据
      */
-    private String getDecemberFirstTimeString() {
+    private String getLastYearDecemberFirstTimeString() {
         try {
             Calendar calendar = Calendar.getInstance();
             int currentYear = calendar.get(Calendar.YEAR);
 
-            // 获取当前年份的12月1日
-            calendar.set(currentYear, Calendar.DECEMBER, 1, 0, 0, 0);
+            // 🔴 关键修改:去年12月1日,不是今年
+            int lastYear = currentYear - 1;
+
+            // 设置去年12月1日 00:00:00
+            calendar.set(lastYear, Calendar.DECEMBER, 1, 0, 0, 0);
             calendar.set(Calendar.MILLISECOND, 0);
 
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            return sdf.format(calendar.getTime());
+            String result = sdf.format(calendar.getTime());
+
+            log.info("📅 设置查询结束时间:去年12月1日 = {}", result);
+            return result;
+
         } catch (Exception e) {
-            log.error("获取12月1日时间失败", e);
-            // 返回一个很早的时间作为兜底
-            return "2020-12-01 00:00:00";
+            log.error("获取去年12月1日时间失败", e);
+            // 兜底:返回前年12月1日,确保能查到历史数据
+            return (Calendar.getInstance().get(Calendar.YEAR) - 2) + "-12-01 00:00:00";
         }
     }
 
 
+
 }

+ 18 - 9
fs-service/src/main/java/com/fs/course/service/impl/FsCourseRedPacketLogServiceImpl.java

@@ -641,7 +641,7 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
         queryLog.setBeginTime(getEarliestTimeString());
 
         // 设置结束时间为今年12月1日之前(包含历史所有年份的12月之前数据)
-        queryLog.setEndTime(getDecemberFirstTimeString());
+        queryLog.setEndTime(getLastYearDecemberFirstTimeString());
 
         return queryLog;
     }
@@ -728,24 +728,33 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
     }
 
     /**
-     * 获取今年12月1日之前的时间字符串
+     * 获取去年12月1日之前的时间字符串
+     * 注意:这个是时间上限,查询条件是小于这个时间的数据
      */
-    private String getDecemberFirstTimeString() {
+    private String getLastYearDecemberFirstTimeString() {
         try {
             Calendar calendar = Calendar.getInstance();
             int currentYear = calendar.get(Calendar.YEAR);
 
-            // 获取当前年份的12月1日
-            calendar.set(currentYear, Calendar.DECEMBER, 1, 0, 0, 0);
+            // 🔴 关键修改:去年12月1日,不是今年
+            int lastYear = currentYear - 1;
+
+            // 设置去年12月1日 00:00:00
+            calendar.set(lastYear, Calendar.DECEMBER, 1, 0, 0, 0);
             calendar.set(Calendar.MILLISECOND, 0);
 
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            return sdf.format(calendar.getTime());
+            String result = sdf.format(calendar.getTime());
+
+            log.info("📅 设置查询结束时间:去年12月1日 = {}", result);
+            return result;
+
         } catch (Exception e) {
-            log.error("获取12月1日时间失败", e);
-            // 返回一个很早的时间作为兜底
-            return "2020-12-01 00:00:00";
+            log.error("获取去年12月1日时间失败", e);
+            // 兜底:返回前年12月1日,确保能查到历史数据
+            return (Calendar.getInstance().get(Calendar.YEAR) - 2) + "-12-01 00:00:00";
         }
     }
 
+
 }

+ 6 - 0
fs-service/src/main/java/com/fs/his/domain/FsUser.java

@@ -220,6 +220,12 @@ public class FsUser extends BaseEntity
      */
     private Long projectId;
 
+    /**
+     * 项目名称
+     */
+    @TableField(exist = false)
+    private String projectName;
+
     /**
      * 昵称
      * **/