| | |
| | | public Result addPrizeNum( @RequestBody AddPrizeNumForm addPrizeNumForm) { |
| | | return prizeService.addPrizeNum(addPrizeNumForm); |
| | | } |
| | | /** |
| | | * 获取增加次数规则 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @GetMapping("/getPrizeRule") |
| | | public Result getPrizeRule() { |
| | | return prizeService.getPrizeRule(); |
| | | } |
| | | } |
| | |
| | | @ApiModel(value = "ActionRecord查询参数", description = "用户行为记录查询参数") |
| | | public class StayActionRecordQuery extends AbsQuery { |
| | | /** |
| | | * 用户id |
| | | * 用户昵称 |
| | | */ |
| | | private String userName; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private String userId; |
| | | /** |
| | | * 页面类型 |
| | | */ |
| | | private String pageCode; |
| New file |
| | |
| | | package cn.lili.modules.lmk.domain.vo; |
| | | |
| | | import cn.lili.mybatis.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * 用户行为记录 |
| | | * |
| | | * @author peng |
| | | * @since 2025-09-08 |
| | | */ |
| | | @Data |
| | | public class ActionRecordListVO extends BaseEntity { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 用户id */ |
| | | private String userId; |
| | | |
| | | /** 页面会话id */ |
| | | private String sessionId; |
| | | |
| | | /** 行为类型 */ |
| | | private String actionType; |
| | | |
| | | /** 触发时间 */ |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date startTime; |
| | | |
| | | /** 进入页面方式 */ |
| | | private String joinType; |
| | | |
| | | /** 上一个页面的会话id */ |
| | | private String previousSessionId; |
| | | |
| | | /** 分享id */ |
| | | private Long shareId; |
| | | |
| | | /** 页面编码 */ |
| | | private String pageCode; |
| | | |
| | | /** 昵称 */ |
| | | private String nickName; |
| | | |
| | | /** 页面详情参数(json格式) */ |
| | | private String pageParams; |
| | | |
| | | /** 页面类型 */ |
| | | private String pageType; |
| | | |
| | | /** 用户在页面状态 */ |
| | | private String pageStatus; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | Page<StayActionRecordVO> userStayList(@Param("page") IPage<StayActionRecordVO> page, @Param("req") StayActionRecordQuery param); |
| | | |
| | | Page<ActionRecord> userStayListRecord(@Param("page") IPage<ActionRecord> page, @Param("req") StayActionRecordQuery param); |
| | | |
| | | Page<ShareActionRecordVO> userShare(@Param("page") IPage<ShareActionRecordVO> page, @Param("req") StayActionRecordQuery param); |
| | | } |
| | |
| | | |
| | | Result userStayList(StayActionRecordQuery param); |
| | | |
| | | Result userStayListRecord(StayActionRecordQuery param); |
| | | |
| | | Result userShare(StayActionRecordQuery param); |
| | | |
| | | Result grantSessionId(); |
| | |
| | | |
| | | Result addPrizeNum(AddPrizeNumForm addPrizeNumForm); |
| | | |
| | | Result getPrizeRule(); |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result userStayListRecord(StayActionRecordQuery param) { |
| | | IPage<ActionRecord> page = PageUtil.getPage(param, ActionRecord.class); |
| | | Page<ActionRecord> stayActionRecordVOPage = baseMapper.userStayListRecord(page, param); |
| | | return Result.ok().data(stayActionRecordVOPage); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public Result userShare(StayActionRecordQuery param) { |
| | | IPage<ShareActionRecordVO> page = PageUtil.getPage(param, ShareActionRecordVO.class); |
| | | Page<ShareActionRecordVO> shareActionRecordVOPage = baseMapper.userShare(page, param); |
| | |
| | | LambdaQueryWrapper<AddPrizeRule> one = Wrappers.<AddPrizeRule>lambdaQuery().eq(AddPrizeRule::getRuleCode, ruleCode); |
| | | return addPrizeRuleService.getOne(one); |
| | | } |
| | | |
| | | @Override |
| | | public Result getPrizeRule() { |
| | | List<AddPrizeRule> list = addPrizeRuleService.list(Wrappers.<AddPrizeRule>lambdaQuery().orderByDesc(AddPrizeRule::getId)); |
| | | return Result.ok().data(list); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "用户手机号码") |
| | | private String mobile; |
| | | |
| | | @ApiModelProperty(value = "会员ID") |
| | | private String memberId; |
| | | |
| | | /** |
| | | * @see SwitchEnum |
| | | */ |
| | |
| | | queryWrapper.like(CharSequenceUtil.isNotBlank(memberSearchVO.getNickName()), "nick_name", memberSearchVO.getNickName()); |
| | | //按照电话号码查询 |
| | | queryWrapper.like(CharSequenceUtil.isNotBlank(memberSearchVO.getMobile()), "mobile", memberSearchVO.getMobile()); |
| | | //按照会员id查询 |
| | | queryWrapper.eq(CharSequenceUtil.isNotBlank(memberSearchVO.getMemberId()), "m.id", memberSearchVO.getMemberId()); |
| | | //按照会员状态查询 |
| | | queryWrapper.eq(CharSequenceUtil.isNotBlank(memberSearchVO.getDisabled()), "disabled", |
| | | memberSearchVO.getDisabled().equals(SwitchEnum.OPEN.name()) ? 1 : 0); |
| | |
| | | "LEFT JOIN li_member m on m.id = o.member_id " + |
| | | "${ew.customSqlSegment}") |
| | | List<OrderExportDTO> queryExportOrder(@Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper); |
| | | /** |
| | | * 查询导出订单DTO列表 |
| | | * |
| | | * @param queryWrapper 查询条件 |
| | | * @return 导出订单DTO列表 |
| | | */ |
| | | @Select("SELECT o.sn AS order_sn," + |
| | | "oi.sn AS order_item_sn," + |
| | | "oi.goods_name AS goods_name," + |
| | | "oi.num AS num," + |
| | | "oi.goods_id AS goods_id," + |
| | | "oi.unit_price AS unit_price," + |
| | | "oi.flow_price AS flow_price," + |
| | | "oi.price_detail AS price_detail," + |
| | | "o.payment_method AS payment_method," + |
| | | "o.consignee_name AS consignee_name," + |
| | | "o.consignee_mobile AS consignee_mobile," + |
| | | "o.consignee_address_path AS consignee_address_path," + |
| | | "o.consignee_detail AS consignee_detail," + |
| | | "o.remark AS remark," + |
| | | "o.create_time AS create_time," + |
| | | "o.payment_time AS payment_time," + |
| | | "o.client_type AS client_type," + |
| | | "o.order_status AS order_status," + |
| | | "o.order_type AS order_type," + |
| | | "oi.after_sale_status AS after_sale_status," + |
| | | "o.logistics_time AS logistics_time," + |
| | | "o.complete_time AS complete_time," + |
| | | "o.store_name AS store_name, " + |
| | | "m.nick_name AS nickName," + |
| | | "o.member_id AS memberId" + |
| | | " FROM li_order o LEFT JOIN li_order_item oi ON oi.order_sn = o.sn " + |
| | | "LEFT JOIN li_member m on m.id = o.member_id " + |
| | | "JOIN li_store ls ON ls.id = m.share_store_id " + |
| | | "${ew.customSqlSegment}") |
| | | List<OrderExportDTO> queryShareExportOrder(@Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper); |
| | | |
| | | /** |
| | | * 查询订单支付记录 |
| | |
| | | " FROM li_order o LEFT JOIN li_order_item AS oi on o.sn = oi.order_sn " + |
| | | "LEFT JOIN li_member m on m.id = o.member_id " + |
| | | "${ew.customSqlSegment}") |
| | | IPage<OrderSimpleVO> queryByParams(IPage<OrderSimpleVO> page, @Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper); |
| | | IPage<OrderSimpleVO> queryByParams(IPage<OrderSimpleVO> page, @Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper); /** |
| | | * 查询订单简短信息分页 |
| | | * |
| | | * @param page 分页 |
| | | * @param queryWrapper 查询条件 |
| | | * @return 简短订单分页 |
| | | */ |
| | | @Select("select o.sn,o.flow_price,o.create_time,o.order_status,o.pay_status,o.payment_method,o.payment_time,o.member_name,o.store_name as " + |
| | | "store_name,o.store_id as store_id,o.client_type,o.order_type,o.deliver_status,o.order_promotion_type,o.seller_remark, " + |
| | | "o.consignee_name AS consigneeName," + |
| | | "o.consignee_mobile AS consigneeMobile," + |
| | | "o.member_id AS memberId," + |
| | | "m.nick_name AS nickName," + |
| | | "o.customize_flag AS customizeFlag," + |
| | | "o.modify_address_flag AS modifyAddressFlag,"+ |
| | | " GROUP_CONCAT(oi.goods_id) as group_goods_id," + |
| | | " GROUP_CONCAT(oi.sku_id) as group_sku_id," + |
| | | " GROUP_CONCAT(oi.num) as group_num" + |
| | | ",GROUP_CONCAT(oi.image) as group_images" + |
| | | ",GROUP_CONCAT(oi.goods_name) as group_name " + |
| | | ",GROUP_CONCAT(oi.after_sale_status) as group_after_sale_status" + |
| | | ",GROUP_CONCAT(oi.complain_status) as group_complain_status" + |
| | | ",GROUP_CONCAT(oi.comment_status) as group_comment_status" + |
| | | ",GROUP_CONCAT(oi.sn) as group_order_items_sn " + |
| | | ",GROUP_CONCAT(oi.goods_price) as group_goods_price " + |
| | | ",GROUP_CONCAT(oi.is_refund) as group_is_refund " + |
| | | ",GROUP_CONCAT(oi.refund_price) as group_refund_price " + |
| | | " FROM li_order o LEFT JOIN li_order_item AS oi on o.sn = oi.order_sn " + |
| | | "LEFT JOIN li_member m on m.id = o.member_id " + |
| | | "JOIN li_store ls ON ls.id = m.share_store_id " + |
| | | "${ew.customSqlSegment}") |
| | | IPage<OrderSimpleVO> queryByShareParams(IPage<OrderSimpleVO> page, @Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper); |
| | | |
| | | /** |
| | | * 获得指定用户的订单 |
| | |
| | | * @return 简短订单分页 |
| | | */ |
| | | IPage<OrderSimpleVO> queryByParams(OrderSearchParams orderSearchParams,Boolean needHide); |
| | | |
| | | IPage<OrderSimpleVO> queryShareMineOrder(OrderSearchParams orderSearchParams,Boolean needHide); |
| | | /** |
| | | * 订单查询 |
| | | * |
| | |
| | | * @return 导出订单列表 |
| | | */ |
| | | void queryExportOrder(HttpServletResponse response,OrderSearchParams orderSearchParams) ; |
| | | /** |
| | | * 查询导出订单列表 |
| | | * |
| | | * @param orderSearchParams 查询参数 |
| | | * @return 导出订单列表 |
| | | */ |
| | | void queryShareExportOrder(HttpServletResponse response,OrderSearchParams orderSearchParams) ; |
| | | |
| | | |
| | | /** |
| | |
| | | return page; |
| | | } |
| | | @Override |
| | | public IPage<OrderSimpleVO> queryShareMineOrder(OrderSearchParams orderSearchParams,Boolean needHide) { |
| | | QueryWrapper queryWrapper = orderSearchParams.queryWrapper(); |
| | | queryWrapper.groupBy("o.id"); |
| | | queryWrapper.orderByDesc("o.id"); |
| | | IPage<OrderSimpleVO> page = this.baseMapper.queryByShareParams(PageUtil.initPage(orderSearchParams), queryWrapper); |
| | | if (needHide){ |
| | | if (!adminUserService.havePermissionRole(AdminRoleEnum.ORDER_INFO_PERMISSION)){ |
| | | for (OrderSimpleVO vo : page.getRecords()){ |
| | | vo.setConsigneeName(CommonUtil.maskName(vo.getConsigneeName())); |
| | | vo.setConsigneeMobile(CommonUtil.maskMobile(vo.getConsigneeMobile())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return page; |
| | | } |
| | | @Override |
| | | public IPage<OrderSimpleXcxVO> queryByXcxParams(OrderSearchXcxParams orderSearchParams) { |
| | | QueryWrapper queryWrapper = orderSearchParams.queryWrapper(); |
| | | queryWrapper.groupBy("o.id"); |
| | |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void queryShareExportOrder(HttpServletResponse response, OrderSearchParams orderSearchParams) { |
| | | List<OrderExportDTO> orderExportDTOS = this.baseMapper.queryShareExportOrder(orderSearchParams.queryWrapper()); |
| | | |
| | | if (!adminUserService.havePermissionRole(AdminRoleEnum.ORDER_INFO_PERMISSION)){ |
| | | for (OrderExportDTO vo : orderExportDTOS){ |
| | | vo.setConsigneeName(CommonUtil.maskName(vo.getConsigneeName())); |
| | | vo.setConsigneeMobile(CommonUtil.maskMobile(vo.getConsigneeMobile())); |
| | | } |
| | | } |
| | | XSSFWorkbook workbook = initOrderExportData(orderExportDTOS); |
| | | try { |
| | | // 设置响应头 |
| | | String fileName = URLEncoder.encode("订单列表", "UTF-8"); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | |
| | | ServletOutputStream out = response.getOutputStream(); |
| | | workbook.write(out); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | workbook.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetailVO queryDetail(String orderSn) { |
| | |
| | | <if test="req.pageCode != null and req.pageCode != ''"> |
| | | and t1.page_code = #{req.pageCode} |
| | | </if> |
| | | <if test="req.userId != null and req.userId != ''"> |
| | | and t1.user_id = #{req.userId} |
| | | </if> |
| | | ORDER BY |
| | | t1.user_id, |
| | | t1.start_time |
| | | t1.start_time desc |
| | | |
| | | </select> |
| | | <resultMap id="userShareMap" type="cn.lili.modules.lmk.domain.vo.ShareActionRecordVO"> |
| | | <result property="userId" column="user_id"/> |
| | |
| | | ORDER BY |
| | | lsa.create_time desc |
| | | </select> |
| | | <resultMap id="userStayListRecordMap" type="cn.lili.modules.lmk.domain.vo.ActionRecordListVO"> |
| | | <id column="id" property="id"/> |
| | | <result column="user_id" property="userId"/> |
| | | <result column="action_type" property="actionType"/> |
| | | <result column="start_time" property="startTime"/> |
| | | <result column="join_type" property="joinType"/> |
| | | <result column="previous_session_id" property="previousSessionId"/> |
| | | <result column="share_id" property="shareId"/> |
| | | <result column="page_code" property="pageCode"/> |
| | | <result column="page_params" property="pageParams"/> |
| | | <result column="page_type" property="pageType"/> |
| | | <result column="page_status" property="pageStatus"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="create_by" property="createBy"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_by" property="updateBy"/> |
| | | <result column="delete_flag" property="deleteFlag"/> |
| | | <result column="nick_name" property="nickName"/> |
| | | </resultMap> |
| | | <select id="userStayListRecord" resultMap="userStayListRecordMap"> |
| | | SELECT |
| | | t.id, |
| | | t.user_id, |
| | | t.action_type, |
| | | t.start_time, |
| | | t.join_type, |
| | | t.previous_session_id, |
| | | t.share_id, |
| | | t.page_code, |
| | | t.page_params, |
| | | t.page_type, |
| | | t.page_status, |
| | | t.update_time, |
| | | t.create_by, |
| | | t.create_time, |
| | | t.update_by, |
| | | t.delete_flag, |
| | | lm.nick_name |
| | | FROM |
| | | ( |
| | | SELECT |
| | | *, |
| | | ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY create_time DESC) AS rn |
| | | FROM |
| | | lmk_action_record |
| | | WHERE |
| | | user_id IS NOT NULL |
| | | AND page_status = 'JOIN') t |
| | | JOIN li_member lm ON lm.id = t.user_id |
| | | WHERE |
| | | rn = 1 AND lm.delete_flag = 0 |
| | | and t.create_time between #{req.beginDate} and #{req.endDate} |
| | | <if test="req.userName != null and req.userName != ''"> |
| | | and lm.nick_name like concat('%',#{req.userName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | LEFT JOIN |
| | | lmk_prize_draw LPD ON LARP.prize_id = LPD.id |
| | | where LARP.prize_activity_id = #{prizeActivityId} AND LARP.delete_flag = 0 |
| | | |
| | | order by |
| | | </select> |
| | | |
| | | |
| | |
| | | public Result userStayList(StayActionRecordQuery param) { |
| | | return actionRecordService.userStayList(param); |
| | | } |
| | | @GetMapping("/userStayListRecord") |
| | | @ApiOperation(value = "用户页面最后停留信息", notes = "用户页面最后停留信息") |
| | | public Result userStayListRecord(StayActionRecordQuery param) { |
| | | return actionRecordService.userStayListRecord(param); |
| | | } |
| | | @GetMapping("/userShare") |
| | | @ApiOperation(value = "用户分享", notes = "用户分享") |
| | | public Result userShare(StayActionRecordQuery param) { |
| | |
| | | Boolean needHide = true; |
| | | return ResultUtil.data(orderService.queryByParams(orderSearchParams,needHide)); |
| | | } |
| | | @ApiOperation(value = "查询订单列表分页") |
| | | @GetMapping("/share") |
| | | public ResultMessage<IPage<OrderSimpleVO>> queryShareMineOrder(OrderSearchParams orderSearchParams) { |
| | | Boolean needHide = true; |
| | | return ResultUtil.data(orderService.queryShareMineOrder(orderSearchParams,needHide)); |
| | | } |
| | | @ApiOperation(value = "查询订单并统计金额与订单数") |
| | | @GetMapping("/countOrder/{id}") |
| | | public ResultMessage<OrderCountVO> countByIdOrder(@PathVariable("id") String id){ |
| | |
| | | HttpServletResponse response = ThreadContextHolder.getHttpResponse(); |
| | | orderService.queryExportOrder(response,orderSearchParams); |
| | | } |
| | | @ApiOperation(value = "查询订单导出列表") |
| | | @GetMapping("/queryShareExportOrder") |
| | | public void queryShareExportOrder(OrderSearchParams orderSearchParams) { |
| | | |
| | | HttpServletResponse response = ThreadContextHolder.getHttpResponse(); |
| | | orderService.queryShareExportOrder(response,orderSearchParams); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "订单明细") |