Ver Fonte

Merge remote-tracking branch 'origin/master'

ct há 2 dias atrás
pai
commit
cc9162414b

+ 3 - 3
fs-admin/src/main/java/com/fs/live/controller/LiveDataController.java

@@ -133,7 +133,7 @@ public class LiveDataController extends BaseController {
     @PreAuthorize("@ss.hasPermi('liveData:liveData:query')")
     @GetMapping("/getLiveUserDetailListBySql")
     public R getLiveUserDetailListBySql(@RequestParam Long liveId) {
-        return liveDataService.getLiveUserDetailListBySql(liveId);
+        return liveDataService.getLiveUserDetailListBySql(liveId,null,null);
     }
 
     /**
@@ -167,11 +167,11 @@ public class LiveDataController extends BaseController {
     @Log(title = "直播间用户详情", businessType = BusinessType.EXPORT)
     @GetMapping("/exportLiveUserDetail")
     public AjaxResult exportLiveUserDetail(@RequestParam Long liveId) {
-        List<LiveUserDetailExportVO> list = liveDataService.exportLiveUserDetail(liveId);
+        List<LiveUserDetailExportVO> list = liveDataService.exportLiveUserDetail(liveId,null,null);
         if (list == null || list.isEmpty()) {
             return AjaxResult.error("未找到用户详情数据");
         }
-        
+
         ExcelUtil<LiveUserDetailExportVO> util = new ExcelUtil<>(LiveUserDetailExportVO.class);
         return util.exportExcel(list, "直播间用户详情数据");
     }

+ 68 - 0
fs-company/src/main/java/com/fs/company/controller/live/LiveDataController.java

@@ -7,6 +7,7 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.CompanyUser;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.security.SecurityUtils;
 import com.fs.framework.service.TokenService;
@@ -14,6 +15,7 @@ import com.fs.live.domain.LiveData;
 import com.fs.live.param.LiveDataParam;
 import com.fs.live.service.ILiveDataService;
 import com.fs.live.vo.ColumnsConfigVo;
+import com.fs.live.vo.LiveUserDetailExportVO;
 import com.github.pagehelper.PageHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -38,6 +40,72 @@ public class LiveDataController extends BaseController
     @Autowired
     private TokenService tokenService;
 
+    /**
+     * 查询直播间详情数据(SQL方式)
+     * @param liveId 直播间ID
+     * @return 详情数据
+     */
+    @PreAuthorize("@ss.hasPermi('liveData:liveData:query')")
+    @GetMapping("/getLiveDataDetailBySql")
+    public R getLiveDataDetailBySql(@RequestParam Long liveId) {
+        return liveDataService.getLiveDataDetailBySql(liveId);
+    }
+
+    /**
+     * 查询直播间用户详情列表(SQL方式)
+     * @param liveId 直播间ID
+     * @return 用户详情列表
+     */
+    @PreAuthorize("@ss.hasPermi('liveData:liveData:query')")
+    @GetMapping("/getLiveUserDetailListBySql")
+    public R getLiveUserDetailListBySql(@RequestParam Long liveId, HttpServletRequest request) {
+        CompanyUser user = tokenService.getLoginUser(request).getUser();
+
+        return liveDataService.getLiveUserDetailListBySql(liveId,user.getCompanyId(),user.getUserId());
+    }
+
+    /**
+     * 查询直播间详情数据(查询数据服务器处理方式)
+     * @param liveId 直播间ID
+     * @return 详情数据
+     */
+    @PreAuthorize("@ss.hasPermi('liveData:liveData:query')")
+    @GetMapping("/getLiveDataDetailByServer")
+    public R getLiveDataDetailByServer(@RequestParam Long liveId) {
+        return liveDataService.getLiveDataDetailByServer(liveId);
+    }
+
+    /**
+     * 查询直播间用户详情列表(查询数据服务器处理方式)
+     * @param liveId 直播间ID
+     * @return 用户详情列表
+     */
+    @PreAuthorize("@ss.hasPermi('liveData:liveData:query')")
+    @GetMapping("/getLiveUserDetailListByServer")
+    public R getLiveUserDetailListByServer(@RequestParam Long liveId) {
+        return liveDataService.getLiveUserDetailListByServer(liveId);
+    }
+
+
+    /**
+     * 导出直播间用户详情数据
+     * @param liveId 直播间ID
+     * @return Excel文件
+     */
+    @PreAuthorize("@ss.hasPermi('liveData:liveData:export')")
+    @Log(title = "直播间用户详情", businessType = BusinessType.EXPORT)
+    @GetMapping("/exportLiveUserDetail")
+    public AjaxResult exportLiveUserDetail(@RequestParam Long liveId, HttpServletRequest request) {
+        CompanyUser user = tokenService.getLoginUser(request).getUser();
+        List<LiveUserDetailExportVO> list = liveDataService.exportLiveUserDetail(liveId,user.getCompanyId(),user.getUserId());
+        if (list == null || list.isEmpty()) {
+            return AjaxResult.error("未找到用户详情数据");
+        }
+
+        ExcelUtil<LiveUserDetailExportVO> util = new ExcelUtil<>(LiveUserDetailExportVO.class);
+        return util.exportExcel(list, "直播间用户详情数据");
+    }
+
     /**
      * 直播数据页面卡片数据
      */

+ 1 - 1
fs-service/src/main/java/com/fs/live/mapper/LiveDataMapper.java

@@ -168,5 +168,5 @@ public interface LiveDataMapper {
      * @param liveId 直播间ID
      * @return 用户详情列表
      */
-    List<LiveUserDetailVo> selectLiveUserDetailListBySql(@Param("liveId") Long liveId);
+    List<LiveUserDetailVo> selectLiveUserDetailListBySql(@Param("liveId") Long liveId,@Param("companyId") Long companyId,@Param("companyUserId") Long companyUserId);
 }

+ 36 - 5
fs-service/src/main/java/com/fs/live/mapper/LiveMapper.java

@@ -138,15 +138,46 @@ public interface LiveMapper
             "select * from live where 1=1 " +
             " <if test='param.companyId!=null' > and company_id = #{param.companyId} </if> and live_type IN (1,2, 3) AND status IN (3, 4) AND is_del = 0 and is_audit=1 " +
             " <if test='param.liveName!=null' > and live_name like concat('%' ,#{param.liveName},'%') </if> " +
-            " order by create_time desc" +
+            " UNION " +
+            "select l.* from live l " +
+            "LEFT JOIN ( " +
+            "    SELECT live_id, SUM(COALESCE(duration, 0)) AS total_duration " +
+            "    FROM live_video " +
+            "    WHERE video_type IN (1, 2) " +
+            "    GROUP BY live_id " +
+            ") video_duration ON l.live_id = video_duration.live_id " +
+            "where 1=1 " +
+            " <if test='param.companyId!=null' > and l.company_id = #{param.companyId} </if> " +
+            "and l.live_type IN (1,2, 3) AND l.status = 2 AND l.is_del = 0 and l.is_audit=1 " +
+            "and l.start_time IS NOT NULL " +
+            "and TIMESTAMPDIFF(SECOND, l.start_time, NOW()) > COALESCE(video_duration.total_duration, 0) " +
+            "and COALESCE(video_duration.total_duration, 0) > 0 " +
+            " <if test='param.liveName!=null' > and l.live_name like concat('%' ,#{param.liveName},'%') </if> " +
+            "order by create_time desc" +
             " </script>"})
     List<Live> listLiveData(@Param("param") LiveDataParam param);
 
     @Select({"<script>" +
-            "select count(1) from live where 1=1 " +
-            " <if test='param.companyId!=null' > and company_id = #{param.companyId} </if> and live_type IN (1,2, 3) AND status IN (3, 4) AND is_del = 0 and is_audit=1" +
-            " <if test='param.liveName!=null' > and live_name like concat('%' ,#{param.liveName},'%') </if>" +
-            "  order by create_time desc " +
+            "select count(1) from ( " +
+            "select * from live where 1=1 " +
+            " <if test='param.companyId!=null' > and company_id = #{param.companyId} </if> and live_type IN (1,2, 3) AND status IN (3, 4) AND is_del = 0 and is_audit=1 " +
+            " <if test='param.liveName!=null' > and live_name like concat('%' ,#{param.liveName},'%') </if> " +
+            " UNION " +
+            "select l.* from live l " +
+            "LEFT JOIN ( " +
+            "    SELECT live_id, SUM(COALESCE(duration, 0)) AS total_duration " +
+            "    FROM live_video " +
+            "    WHERE video_type IN (1, 2) " +
+            "    GROUP BY live_id " +
+            ") video_duration ON l.live_id = video_duration.live_id " +
+            "where 1=1 " +
+            " <if test='param.companyId!=null' > and l.company_id = #{param.companyId} </if> " +
+            "and l.live_type IN (1,2, 3) AND l.status = 2 AND l.is_del = 0 and l.is_audit=1 " +
+            "and l.start_time IS NOT NULL " +
+            "and TIMESTAMPDIFF(SECOND, l.start_time, NOW()) > COALESCE(video_duration.total_duration, 0) " +
+            "and COALESCE(video_duration.total_duration, 0) > 0 " +
+            " <if test='param.liveName!=null' > and l.live_name like concat('%' ,#{param.liveName},'%') </if> " +
+            ") as temp " +
             " </script>"})
     int listLiveDataCount(@Param("param") LiveDataParam param);
 

+ 2 - 2
fs-service/src/main/java/com/fs/live/service/ILiveDataService.java

@@ -145,7 +145,7 @@ public interface ILiveDataService {
      * @param liveId 直播间ID
      * @return 用户详情列表
      */
-    R getLiveUserDetailListBySql(Long liveId);
+    R getLiveUserDetailListBySql(Long liveId, Long companyId, Long companyUserId);
 
     /**
      * 查询直播间详情数据(查询数据服务器处理方式)
@@ -166,5 +166,5 @@ public interface ILiveDataService {
      * @param liveId 直播间ID
      * @return 导出VO列表
      */
-    List<LiveUserDetailExportVO> exportLiveUserDetail(Long liveId);
+    List<LiveUserDetailExportVO> exportLiveUserDetail(Long liveId, Long companyId, Long companyUserId);
 }

+ 4 - 4
fs-service/src/main/java/com/fs/live/service/impl/LiveDataServiceImpl.java

@@ -695,8 +695,8 @@ public class LiveDataServiceImpl implements ILiveDataService {
     }
 
     @Override
-    public R getLiveUserDetailListBySql(Long liveId) {
-        List<LiveUserDetailVo> userDetailList = liveDataMapper.selectLiveUserDetailListBySql(liveId);
+    public R getLiveUserDetailListBySql(Long liveId, Long companyId, Long companyUserId ) {
+        List<LiveUserDetailVo> userDetailList = liveDataMapper.selectLiveUserDetailListBySql(liveId, companyId, companyUserId);
         return R.ok().put("data", userDetailList);
     }
 
@@ -1081,9 +1081,9 @@ public class LiveDataServiceImpl implements ILiveDataService {
      * @return 导出VO列表
      */
     @Override
-    public List<LiveUserDetailExportVO> exportLiveUserDetail(Long liveId) {
+    public List<LiveUserDetailExportVO> exportLiveUserDetail(Long liveId, Long companyId, Long companyUserId) {
         // 查询用户详情列表
-        List<LiveUserDetailVo> userDetailList = liveDataMapper.selectLiveUserDetailListBySql(liveId);
+        List<LiveUserDetailVo> userDetailList = liveDataMapper.selectLiveUserDetailListBySql(liveId, companyId, companyUserId);
         if (userDetailList == null || userDetailList.isEmpty()) {
             return new ArrayList<>();
         }

+ 1 - 0
fs-service/src/main/java/com/fs/live/vo/LiveDataDetailVo.java

@@ -99,3 +99,4 @@ public class LiveDataDetailVo {
 
 
 
+

+ 1 - 0
fs-service/src/main/java/com/fs/live/vo/LiveUserDetailVo.java

@@ -41,3 +41,4 @@ public class LiveUserDetailVo {
 
 
 
+

+ 1 - 0
fs-service/src/main/java/com/fs/live/vo/ProductSalesVo.java

@@ -29,3 +29,4 @@ public class ProductSalesVo {
 
 
 
+

+ 3 - 3
fs-service/src/main/resources/application-config-druid-gzzdy.yml

@@ -76,7 +76,7 @@ nuonuo:
 tencent_cloud_config:
   secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
   secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
-  bucket: gzzdy-1323137866
+  bucket: gzzdy1-1323137866
   app_id: 1323137866
   region: ap-chongqing
   proxy: gzzdy
@@ -87,8 +87,8 @@ cloud_host:
 headerImg:
   imgUrl:
 ipad:
-  ipadUrl: http://ipad.dyzkl.cn
-  aiApi: http://49.232.181.28:3000/api
+  ipadUrl: http://ipad.dingdangtcm.cn
+  aiApi: http://
   voiceApi: http://123.207.48.104:8009
   commonApi: http://123.207.48.104:7771
 wx_miniapp_temp:

+ 4 - 2
fs-service/src/main/resources/mapper/hisStore/FsStoreOrderScrmMapper.xml

@@ -1588,7 +1588,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 <!--    商城订单查询接口-->
     <select id="selectFsStoreOrderListVO" resultType="com.fs.hisStore.vo.FsStoreOrderVO">
-        select o.id,o.order_code,o.extend_order_id,o.pay_order_id,o.bank_order_id,o.user_id,o.real_name,o.user_phone,o.user_address,o.cart_id,o.freight_price,o.total_num,o.total_price,o.total_postage,o.pay_price,o.pay_postage,o.pay_delivery,o.pay_money,o.deduction_price,o.coupon_id,o.coupon_price,o.paid,o.pay_time,o.pay_type,o.create_time,o.update_time,o.status,o.refund_status,o.refund_reason_wap_img,o.refund_reason_wap_explain,o.refund_reason_time,o.refund_reason_wap,o.refund_reason,o.refund_price,o.delivery_sn,o.delivery_name,o.delivery_type,o.delivery_id,o.gain_integral,o.use_integral,o.pay_integral,o.back_integral,o.mark,o.is_del,o.remark,o.verify_code,o.store_id,o.shipping_type,o.is_channel,o.is_remind,o.is_sys_del,o.is_prescribe,o.prescribe_id,o.company_id,o.company_user_id,o.is_package,o.package_json,o.order_type,o.package_id,o.finish_time,o.delivery_status,o.delivery_pay_status,o.delivery_time,o.delivery_pay_time,o.delivery_pay_money,o.tui_money,o.tui_money_status,o.delivery_import_time,o.tui_user_id,o.tui_user_money_status,o.order_create_type,o.store_house_code,o.dept_id,o.is_edit_money,o.customer_id,o.is_pay_remain,o.delivery_send_time,o.certificates,o.upload_time,o.item_json,o.schedule_id,o.delivery_pay_type,o.order_visit,o.service_fee,o.cycle,o.prescribe_price,o.follow_doctor_id,o.follow_time,o.user_coupon_id,o.order_medium,o.erp_phone
+        select DISTINCT o.id,o.order_code,o.extend_order_id,o.pay_order_id,o.bank_order_id,o.user_id,o.real_name,o.user_phone,o.user_address,o.cart_id,o.freight_price,o.total_num,o.total_price,o.total_postage,o.pay_price,o.pay_postage,o.pay_delivery,o.pay_money,o.deduction_price,o.coupon_id,o.coupon_price,o.paid,o.pay_time,o.pay_type,o.create_time,o.update_time,o.status,o.refund_status,o.refund_reason_wap_img,o.refund_reason_wap_explain,o.refund_reason_time,o.refund_reason_wap,o.refund_reason,o.refund_price,o.delivery_sn,o.delivery_name,o.delivery_type,o.delivery_id,o.gain_integral,o.use_integral,o.pay_integral,o.back_integral,o.mark,o.is_del,o.remark,o.verify_code,o.store_id,o.shipping_type,o.is_channel,o.is_remind,o.is_sys_del,o.is_prescribe,o.prescribe_id,o.company_id,o.company_user_id,o.is_package,o.package_json,o.order_type,o.package_id,o.finish_time,o.delivery_status,o.delivery_pay_status,o.delivery_time,o.delivery_pay_time,o.delivery_pay_money,o.tui_money,o.tui_money_status,o.delivery_import_time,o.tui_user_id,o.tui_user_money_status,o.order_create_type,o.store_house_code,o.dept_id,o.is_edit_money,o.customer_id,o.is_pay_remain,o.delivery_send_time,o.certificates,o.upload_time,o.item_json,o.schedule_id,o.delivery_pay_type,o.order_visit,o.service_fee,o.cycle,o.prescribe_price,o.follow_doctor_id,o.follow_time,o.user_coupon_id,o.order_medium,o.erp_phone
         ,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber
         , csc.name miniProgramName,fsp.cost, fspc.cate_name,spavs.bar_code, sp_latest.bank_transaction_id as bankTransactionId
         from fs_store_order_scrm o
@@ -1602,7 +1602,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join fs_store_order_item_scrm oi on o.id = oi.order_id
         left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
         left join fs_store_product_category_scrm fspc on fspc.cate_id = fsp.cate_id
-        left join fs_store_product_attr_value_scrm spavs on fsp.product_id = spavs.product_id
+        LEFT JOIN fs_store_product_attr_value_scrm spavs
+        ON fsp.product_id = spavs.product_id
+        AND spavs.bar_code = JSON_UNQUOTE(JSON_EXTRACT(oi.json_info, '$.barCode'))
 
         LEFT JOIN (
         SELECT

+ 6 - 0
fs-service/src/main/resources/mapper/live/LiveDataMapper.xml

@@ -540,6 +540,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN company c ON lufe.company_id = c.company_id
         LEFT JOIN company_user cu ON lufe.company_user_id = cu.user_id
         WHERE lwu.live_id = #{liveId}
+        <if test="companyId != null">
+            and lufe.company_id = #{companyId}
+        </if>
+        <if test="companyUserId != null">
+            and lufe.company_user_id = #{companyUserId}
+        </if>
         GROUP BY u.user_id, u.nick_name, u.nickname, order_info.orderCount, order_info.orderAmount, c.company_name, cu.user_name
         ORDER BY order_info.orderAmount DESC, liveWatchDuration DESC
     </select>