yuhongqi 1 месяц назад
Родитель
Сommit
17a44479af

+ 1 - 1
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreOrderScrmController.java

@@ -679,7 +679,7 @@ public class FsStoreOrderScrmController extends BaseController {
         if (order.getCompanyUserId() != null) {
             CompanyUser companyUser = companyUserService.selectCompanyUserByUserId(order.getCompanyUserId());
             Company company = companyService.selectCompanyById(companyUser.getCompanyId());
-            order.setCompanyUserName(companyUser.getUserName());
+            order.setCompanyUserName(companyUser.getNickName());
             order.setCompanyName(company.getCompanyName());
         } else if (order.getCompanyId() != null) {
             Company company = companyService.selectCompanyById(order.getCompanyId());

+ 1 - 1
fs-company/src/main/java/com/fs/hisStore/controller/FsStoreOrderScrmController.java

@@ -258,7 +258,7 @@ public class FsStoreOrderScrmController extends BaseController
         if (order.getCompanyUserId() != null) {
             CompanyUser companyUser = companyUserService.selectCompanyUserByUserId(order.getCompanyUserId());
             Company company = companyService.selectCompanyById(companyUser.getCompanyId());
-            order.setCompanyUserName(companyUser.getUserName());
+            order.setCompanyUserName(companyUser.getNickName());
             order.setCompanyName(company.getCompanyName());
         } else if (order.getCompanyId() != null) {
             Company company = companyService.selectCompanyById(order.getCompanyId());

+ 3 - 2
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.course.domain.FsCourseWatchLog;
 import com.fs.course.dto.WatchLogDTO;
 import com.fs.course.param.*;
+import com.fs.course.param.newfs.FsUserCourseVideoRemainTimeParam;
 import com.fs.course.vo.*;
 import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.param.QwSidebarStatsParam;
@@ -755,8 +756,8 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
 
     List<FsSopMyCourseH5LinkVO> getSopCourseH5StudyListByQwExId(@Param("qwExternalId") Long qwExternalId);
 
-    @Select("select * from fs_course_watch_log where user_id=#{userId} and company_user_id=#{companyUserId} and course_id=#{courseId} and video_id=#{videoId} limit 1")
-    FsCourseWatchLog selectFsCourseWatchLogWithUCCV(@Param("userId") Long userId,@Param("companyUserId") Long companyUserId,@Param("courseId") Integer courseId,@Param("videoId") Integer videoId);
+    @Select("select * from fs_course_watch_log where user_id=#{param.fsUserId} and company_user_id=#{param.companyUserId} and course_id=#{param.courseId} and video_id=#{param.videoId} and project=#{param.projectId} and period_id=#{param.periodId} limit 1")
+    FsCourseWatchLog selectFsCourseWatchLogWithUCCV(@Param("param") FsUserCourseVideoRemainTimeParam param);
 
     /**
      * 查询视频时长(只返回duration字段)

+ 8 - 0
fs-service/src/main/java/com/fs/course/param/newfs/FsUserCourseVideoRemainTimeParam.java

@@ -24,4 +24,12 @@ public class FsUserCourseVideoRemainTimeParam implements Serializable {
     @ApiModelProperty(value = "销售id")
     private Long companyUserId;
 
+    @NotNull(message = "项目id不能为空")
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+
+    @NotNull(message = "营期id不能为空")
+    @ApiModelProperty(value = "营期id")
+    private Long periodId;
+
 }

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

@@ -172,7 +172,6 @@ public interface IFsCourseWatchLogService extends IService<FsCourseWatchLog> {
 
     List<FsCourseWatchLog> selectFsUserWatchLogByExtId(QwExternalContact qwExternalContact);
 
-    FsCourseWatchLog selectFsCourseWatchLogWithUCCV(Long userId, Long companyUserId, Integer courseId, Integer videoId);
 
     /**
      * 查询课程小结详情总体数据

+ 0 - 4
fs-service/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -1757,10 +1757,6 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
         return fsCourseWatchLogMapper.selectFsUserWatchLogByExtId(qwExternalContact);
     }
 
-    @Override
-    public FsCourseWatchLog selectFsCourseWatchLogWithUCCV(Long userId, Long companyUserId, Integer courseId, Integer videoId) {
-        return fsCourseWatchLogMapper.selectFsCourseWatchLogWithUCCV(userId, companyUserId, courseId, videoId);
-    }
 
     @Override
     public CourseStatisticsDetailVO getCourseStatisticsDetail(Long videoId, Long periodId) {

+ 3 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductUserEndCategoryMapper.java

@@ -24,4 +24,7 @@ public interface FsStoreProductUserEndCategoryMapper {
 
     /** 关联表内全部去重商品ID(不按分类,配合 PageHelper 用于「全部」) */
     List<Long> selectDistinctProductIds(@Param("keyword") String keyword);
+
+    /** 按区域位置查询商品ID:1=金刚区 2=瀑布区,配合 keyword 筛选,支持 storeId */
+    List<Long> selectDistinctProductIdsByPosition(@Param("id") Long id,@Param("storeId") Long storeId, @Param("position") Integer position, @Param("keyword") String keyword);
 }

+ 2 - 2
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreUserEndCategoryScrmService.java

@@ -26,8 +26,8 @@ public interface IFsStoreUserEndCategoryScrmService {
     /** 按用户端分类ID分页查询关联商品(去重商品ID分页,再查商品简表+标签并组装) */
     List<FsStoreUserEndCategoryProductVO> listProductsByCategoryId(Long categoryId, String keyword);
 
-    /** 首页商品列表:id 为空查全部(分页商品ID后查简表+标签),id 不为空按用户端分类查;返回 list+total */
-    java.util.Map<String, Object> listProductsForApp(Long id, String keyword, Integer pageNum, Integer pageSize);
+    /** 首页商品列表:id 为空查全部(分页商品ID后查简表+标签),id 不为空按用户端分类查;position=1金刚区/2瀑布区 时按区域查全部;返回 list+total */
+    java.util.Map<String, Object> listProductsForApp(Long id, String keyword, Integer pageNum, Integer pageSize, Long storeId, Integer position);
 
     int insert(FsStoreUserEndCategoryScrm entity);
 

+ 20 - 5
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreUserEndCategoryScrmServiceImpl.java

@@ -57,6 +57,9 @@ public class FsStoreUserEndCategoryScrmServiceImpl implements IFsStoreUserEndCat
         if (categoryId == null) return new ArrayList<>();
         List<Long> productIds = productUserEndCategoryMapper.selectDistinctProductIdsByCategoryId(categoryId, keyword);
         if (productIds == null || productIds.isEmpty()) return new ArrayList<>();
+        long total = (productIds instanceof Page) ? ((Page<?>) productIds).getTotal() : productIds.size();
+        int pageNum = (productIds instanceof Page) ? ((Page<?>) productIds).getPageNum() : 1;
+        int pageSize = (productIds instanceof Page) ? ((Page<?>) productIds).getPageSize() : 10;
         List<FsStoreProductScrm> products = fsStoreProductScrmMapper.getStoreProductInProductIds(productIds);
         Map<Long, FsStoreProductScrm> productMap = products.stream().collect(Collectors.toMap(FsStoreProductScrm::getProductId, p -> p, (a, b) -> a));
         List<FsStoreProductTagNameVO> tagNames = productTagRelationMapper.selectProductTagNamesByProductIds(productIds);
@@ -87,19 +90,31 @@ public class FsStoreUserEndCategoryScrmServiceImpl implements IFsStoreUserEndCat
             vo.setTagList(tagMap.getOrDefault(pid, new ArrayList<>()));
             result.add(vo);
         }
-        return result;
+        // 包装为 Page 以携带正确的 total,供 getDataTable 使用
+        Page<FsStoreUserEndCategoryProductVO> pageResult = new Page<>(pageNum, pageSize);
+        pageResult.setTotal(total);
+        pageResult.addAll(result);
+        return pageResult;
     }
 
     @Override
-    public Map<String, Object> listProductsForApp(Long id, String keyword, Integer pageNum, Integer pageSize) {
+    public Map<String, Object> listProductsForApp(Long id, String keyword, Integer pageNum, Integer pageSize, Long storeId, Integer position) {
         Map<String, Object> out = new HashMap<>();
         out.put("list", new ArrayList<FsStoreUserEndCategoryProductVO>());
         out.put("total", 0L);
         if (pageNum == null || pageSize == null || pageSize <= 0) return out;
         PageHelper.startPage(pageNum, pageSize);
-        List<Long> productIds = (id != null && id != 0L)
-                ? productUserEndCategoryMapper.selectDistinctProductIdsByCategoryId(id, keyword)
-                : productUserEndCategoryMapper.selectDistinctProductIds(keyword);
+        List<Long> productIds;
+        if (position == null) {
+            position = 1;
+        }
+        if (position == 1 || position == 2) {
+            productIds = productUserEndCategoryMapper.selectDistinctProductIdsByPosition(id,storeId, position, keyword);
+        } else if (id != null && id != 0L) {
+            productIds = productUserEndCategoryMapper.selectDistinctProductIdsByCategoryId(id, keyword);
+        } else {
+            productIds = productUserEndCategoryMapper.selectDistinctProductIds(keyword);
+        }
         long total = productIds instanceof Page ? ((Page<?>) productIds).getTotal() : (productIds != null ? productIds.size() : 0);
         if (productIds == null || productIds.isEmpty()) {
             out.put("total", total);

+ 0 - 3
fs-service/src/main/resources/mapper/hisStore/FsStoreOrderScrmMapper.xml

@@ -1824,9 +1824,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.payCode != null and maps.payCode != ''">
                 and sp_latest.pay_code like CONCAT('%', #{maps.payCode}, '%')
             </if>
-            <if test="maps.companyUserNickName != null and  maps.companyUserNickName !=  '' ">
-                and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
-            </if>
             <if test="maps.productName != null and  maps.productName !=  '' ">
                 and fsp.product_name like concat('%', #{maps.productName}, '%')
             </if>

+ 15 - 0
fs-service/src/main/resources/mapper/hisStore/FsStoreProductUserEndCategoryMapper.xml

@@ -37,4 +37,19 @@
         </if>
         order by c.sort asc, c.create_time desc, a.product_id
     </select>
+
+    <!-- 按区域位置(1金刚区 2瀑布区)查询商品ID,支持 keyword、storeId -->
+    <select id="selectDistinctProductIdsByPosition" resultType="java.lang.Long">
+        select distinct a.product_id from fs_store_product_user_end_category a
+        left join fs_store_product_scrm c on a.product_id = c.product_id
+        left join fs_store_user_end_category_scrm uec on a.user_end_category_id = uec.id
+        where uec.status = 1 and uec.position = #{position}
+        and c.is_del = 0 and c.is_show = 1 and c.is_display = 1 and c.is_audit = 1
+        <if test="id != null and id != 0">and a.user_end_category_id = #{id}</if>
+        <if test="storeId != null">and uec.store_id = #{storeId}</if>
+        <if test="keyword != null and keyword != ''">
+            and c.product_name like CONCAT('%', #{keyword}, '%')
+        </if>
+        order by c.sort asc, c.create_time desc, a.product_id
+    </select>
 </mapper>

+ 1 - 1
fs-user-app/src/main/java/com/fs/app/controller/course/CourseFsUserController.java

@@ -128,7 +128,7 @@ public class CourseFsUserController extends AppBaseController {
         CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
         Integer remainTime = 0;
         if (config.getCompletionCountdown() != null && config.getCompletionCountdown()) {
-            FsCourseWatchLog fsCourseWatchLog = fsCourseWatchLogMapper.selectFsCourseWatchLogWithUCCV(param.getFsUserId(), param.getCompanyUserId(), param.getCourseId(), param.getVideoId());
+            FsCourseWatchLog fsCourseWatchLog = fsCourseWatchLogMapper.selectFsCourseWatchLogWithUCCV(param);
             if (fsCourseWatchLog == null) {
                 return R.error("");
             }

+ 7 - 2
fs-user-app/src/main/java/com/fs/app/controller/store/IndexScrmController.java

@@ -114,16 +114,21 @@ public class IndexScrmController extends AppBaseController {
 	}
 
 	/**
-	 * 首页商品列表(支持用户端分类 id,id 为空查全部)
+	 * 首页商品列表(支持用户端分类 id、区域 position、关键字 keyword)
+	 * id:用户端分类ID,为空时按 position 或查全部
+	 * position:1=金刚区 2=瀑布区,传入时查询该区域下全部产品(支持 keyword)
+	 * keyword:商品名称模糊搜索
 	 * 去重分页查商品ID → 查商品简表+标签 → 返回 productId、productName、image、price、otPrice、sales、tagList
 	 */
 	@ApiOperation("首页商品列表")
 	@GetMapping("/home/goods")
 	public R homeGoods(@RequestParam(value = "id", required = false) Long id,
 					   @RequestParam(value = "keyword", required = false) String keyword,
+					   @RequestParam(value = "storeId", required = false) Long storeId,
+					   @RequestParam(value = "position", required = false) Integer position,
 					   @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
 					   @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-		java.util.Map<String, Object> data = userEndCategoryScrmService.listProductsForApp(id, keyword, pageNum, pageSize);
+		java.util.Map<String, Object> data = userEndCategoryScrmService.listProductsForApp(id, keyword, pageNum, pageSize, storeId, position);
 		return R.ok().put("data", data);
 	}