修改查询会员充值bug

This commit is contained in:
GYJ 2024-07-10 13:37:39 +08:00
parent b3194b83dc
commit df6a41430e
8 changed files with 36 additions and 24 deletions

View File

@ -1,7 +1,5 @@
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.AnonymousAccess;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.dto.ShopSummaryDto;
import cn.ysk.cashier.service.SummaryService;
import cn.ysk.cashier.vo.TbOrderPayCountVo;

View File

@ -50,6 +50,7 @@ public class TbShopUserController {
@GetMapping("queryAllShopUser")
@ApiOperation("查询商家用户")
@AnonymousGetMapping
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria) {
return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria), HttpStatus.OK);
}

View File

@ -19,19 +19,16 @@ public interface ShopUserMapper extends BaseMapper<TbShopUser> {
"FROM tb_shop_user su " +
"LEFT JOIN tb_user_info u ON su.user_id = u.id " +
"<where> " +
"su.user_id is not null and su.user_id != ''" +
"<if test='param.shopId != null and param.shopId != &quot;&quot; and param.shopId != 1'>" +
"AND su.shop_id = #{param.shopId} " +
"</if>" +
"<if test='param.name != null and param.name != &quot;&quot;'>" +
"AND (u.nick_name like concat('%', #{param.name}, '%') or u.telephone like concat('%', #{param.name}, '%'))" +
"</if>" +
"<if test='param.isVip != null and param.isVip != &quot;&quot;'>" +
"AND su.is_vip=#{param.isVip}" +
"</if>" +
"AND su.is_vip=#{isVip}" +
"</where>" +
"</script>")
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Page pageInfo);
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Integer isVip, Page pageInfo);
@Select("<script> " +
"select " +

View File

@ -19,23 +19,26 @@ public interface TbShopUserFlowMapper extends BaseMapper<TbShopUserFlow> {
* @param shopId 店铺ID
* @param startTime 开始时间
* @param endTime 结束时间
* @param types 流水类型
* @return 用户流水总金额
*/
@Select("<script>" +
"SELECT IFNULL(SUM(uf.amount), 0) FROM tb_shop_user_flow as uf " +
"JOIN tb_shop_user su ON uf.shop_user_id = su.user_id " +
"WHERE su.shop_id = #{shopId} " +
"AND uf.create_time BETWEEN #{startTime} AND #{endTime} " +
"AND uf.biz_code IN " +
"<foreach collection='types' item='type' open='(' separator=',' close=')'> " +
"#{type} " +
"</foreach> " +
" SELECT \n" +
" COALESCE(SUM(flow.total_amount), 0) AS chageTotal\n" +
"FROM \n" +
" tb_shop_user AS a\n" +
" LEFT JOIN (\n" +
" SELECT shop_user_id, SUM(amount) AS total_amount \n" +
" FROM tb_shop_user_flow \n" +
" WHERE biz_code IN ('cashMemberIn','scanMemberIn') \n" +
" AND create_time BETWEEN #{startTime} AND #{endTime} \n" +
" GROUP BY shop_user_id\n" +
" ) AS flow ON flow.shop_user_id = a.id\n" +
"WHERE \n" +
" a.shop_id = #{shopId}" +
"</script>")
BigDecimal sumUserFlowAmountByConditions(@Param("shopId") Long shopId,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("types") List<String> types);
@Param("endTime") String endTime);
}

View File

@ -12,5 +12,5 @@ import java.util.List;
*/
public interface TbShopUserFlowService extends IService<TbShopUserFlow> {
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime, List<String> types);
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime);
}

View File

@ -15,7 +15,7 @@ import java.util.List;
@Service
public class TbShopUserFlowServiceImpl extends ServiceImpl<TbShopUserFlowMapper, TbShopUserFlow> implements TbShopUserFlowService {
@Override
public BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime, List<String> types) {
return baseMapper.sumUserFlowAmountByConditions(shopId, startTime, endTime, types);
public BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime) {
return baseMapper.sumUserFlowAmountByConditions(shopId, startTime, endTime);
}
}

View File

@ -379,8 +379,7 @@ public class SummaryServiceImpl implements SummaryService {
BigDecimal recharge = tbShopUserFlowService.sumUserFlowAmountByConditions(Long.valueOf(summaryDto.getShopId()),
tbOrderPayCountByDayVo.getTradeDay() + " 00:00:00",
tbOrderPayCountByDayVo.getTradeDay() + " 23:59:59",
Arrays.asList("cashMemberIn", "scanMemberIn"));
tbOrderPayCountByDayVo.getTradeDay() + " 23:59:59");
tbOrderPayCountByDayVo.setRecharge(recharge);
BigDecimal decimal = tbOrderInfoRepository.queryRefundOrderAmountByTradeDay(summaryDto.getShopId(), tbOrderPayCountByDayVo.getTradeDay());

View File

@ -1,6 +1,7 @@
package cn.ysk.cashier.service.impl.shopimpl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
import cn.ysk.cashier.dto.shop.TbShopUserDto;
@ -49,8 +50,21 @@ public class TbShopUserServiceImpl implements TbShopUserService {
@Override
public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria) {
IPage<ShopUserInfoVo> iPage = shopUserMapper.queryUser(criteria,
IPage<ShopUserInfoVo> iPage = shopUserMapper.queryUser(criteria, criteria.getIsVip(),
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(criteria.getPage(), criteria.getSize()));
for (ShopUserInfoVo shopUserInfoVo : iPage.getRecords()) {
if (StrUtil.isBlank(shopUserInfoVo.getNickName())) {
tbShopUserRepository.findById(shopUserInfoVo.getId()).ifPresent(tbShopUser -> {
shopUserInfoVo.setNickName(tbShopUser.getName());
shopUserInfoVo.setBirthDay(tbShopUser.getBirthDay());
shopUserInfoVo.setHeadImg(tbShopUser.getHeadImg());
shopUserInfoVo.setTelephone(tbShopUser.getTelephone());
shopUserInfoVo.setTotalScore(0);
});
}
}
return PageUtil.toPlusPage(iPage.getRecords(), Integer.valueOf(iPage.getTotal() + ""));
}