分校明细
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
package com.czg.service.market.mapper;
|
||||
|
||||
import com.czg.market.vo.MkDistributionAmountFlowVO;
|
||||
import com.czg.market.vo.MkDistributionFlowVO;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.market.entity.MkDistributionFlow;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分销记录表 映射层。
|
||||
*
|
||||
@@ -11,4 +16,5 @@ import com.czg.market.entity.MkDistributionFlow;
|
||||
*/
|
||||
public interface MkDistributionFlowMapper extends BaseMapper<MkDistributionFlow> {
|
||||
|
||||
List<MkDistributionFlowVO> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String status, String key);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.czg.market.service.MkDistributionAmountFlowService;
|
||||
import com.czg.service.market.mapper.MkDistributionAmountFlowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -64,6 +65,47 @@ public class MkDistributionAmountFlowServiceImpl extends ServiceImpl<MkDistribut
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> openPageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key) {
|
||||
QueryWrapper queryWrapper = new MyQueryWrapper()
|
||||
.selectAll(MkDistributionAmountFlow.class)
|
||||
.leftJoin(OrderInfo.class).on(OrderInfo::getId, MkDistributionAmountFlow::getSourceId)
|
||||
.leftJoin(ShopUser.class).on(ShopUser::getId, OrderInfo::getUserId)
|
||||
.eq(MkDistributionAmountFlow::getShopId, shopId)
|
||||
.select(OrderInfo::getOrderNo)
|
||||
.select(ShopUser::getPhone, ShopUser::getNickName);
|
||||
if (startTime != null) {
|
||||
queryWrapper.ge(MkDistributionAmountFlow::getCreateTime, startTime);
|
||||
}
|
||||
|
||||
if (endTime != null) {
|
||||
queryWrapper.le(MkDistributionAmountFlow::getCreateTime, endTime);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(key)) {
|
||||
queryWrapper.and(and -> {
|
||||
and.or(or -> {
|
||||
or.like(OrderInfo::getOrderNo, key);
|
||||
});
|
||||
and.or(or -> {
|
||||
or.like(ShopUser::getNickName, key);
|
||||
});
|
||||
and.or(or -> {
|
||||
or.like(ShopUser::getPhone, key);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Page<MkDistributionAmountFlowVO> pageInfo = pageAs(PageUtil.buildPage(), queryWrapper, MkDistributionAmountFlowVO.class);
|
||||
Map<String, Object> map = BeanUtil.beanToMap(pageInfo);
|
||||
map.put("totalAmount", getOne(new QueryWrapper().eq(MkDistributionAmountFlow::getShopId, shopId)
|
||||
.in(MkDistributionAmountFlow::getType, TableValueConstant.DistributionAmountFlow.Type.MANUAL_RECHARGE.getCode(), TableValueConstant.DistributionAmountFlow.Type.SELF_RECHARGE.getCode())
|
||||
.select("sum(change_amount)")));
|
||||
map.put("totalCount", count(new QueryWrapper().eq(MkDistributionAmountFlow::getShopId, shopId)
|
||||
.in(MkDistributionAmountFlow::getType, TableValueConstant.DistributionAmountFlow.Type.SUB.getCode(), TableValueConstant.DistributionAmountFlow.Type.MANUAL_SUB.getCode())));
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
QueryWrapper queryWrapper = new MyQueryWrapper()
|
||||
.selectAll(MkDistributionAmountFlow.class)
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
package com.czg.service.market.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
import com.czg.market.entity.MkDistributionAmountFlow;
|
||||
import com.czg.market.vo.MkDistributionAmountFlowVO;
|
||||
import com.czg.market.vo.MkDistributionFlowVO;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.utils.MyQueryWrapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.market.entity.MkDistributionFlow;
|
||||
import com.czg.market.service.MkDistributionFlowService;
|
||||
import com.czg.service.market.mapper.MkDistributionFlowMapper;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 分销记录表 服务层实现。
|
||||
*
|
||||
@@ -14,5 +34,22 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class MkDistributionFlowServiceImpl extends ServiceImpl<MkDistributionFlowMapper, MkDistributionFlow> implements MkDistributionFlowService{
|
||||
@DubboReference
|
||||
private ShopInfoService shopInfoService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key, String status) {
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
List<MkDistributionFlowVO> list = mapper.pageInfo(shopId, startTime, endTime, status, key);
|
||||
Page<MkDistributionFlowVO> page = PageUtil.convert(new PageInfo<>(list));
|
||||
Map<String, Object> map = BeanUtil.beanToMap(page);
|
||||
map.put("successAmount", getOne(new QueryWrapper().eq(MkDistributionFlow::getShopId, shopId)
|
||||
.eq(MkDistributionFlow::getType, TableValueConstant.DistributionFlow.Status.SUCCESS.getCode())
|
||||
.select("sum(reward_amount)")));
|
||||
map.put("pendingAmount", getOne(new QueryWrapper().eq(MkDistributionFlow::getShopId, shopId)
|
||||
.eq(MkDistributionFlow::getType, TableValueConstant.DistributionFlow.Status.PENDING.getCode())
|
||||
.select("sum(reward_amount)")));
|
||||
map.put("balanceAmount", shopInfoService.getById(shopId).getAmount());
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,28 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.market.mapper.MkDistributionFlowMapper">
|
||||
|
||||
<select id="pageInfo" resultType="com.czg.market.vo.MkDistributionFlowVO">
|
||||
select a.*, b.phone, c.phone as sourcePhone from mk_distribution_flow as a
|
||||
left join tb_shop_user as b on a.shop_user_id=b.id
|
||||
left join tb_shop_user as c on c.id=a.shop_user_id
|
||||
where a.shop_id=#{shopId}
|
||||
<if test="startTime != null">
|
||||
and a.create_time>=#{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and a.create_time<=#{endTime}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and a.status=#{status}
|
||||
</if>
|
||||
<if test="key != null and key != ''">
|
||||
and (
|
||||
b.nick_name like concat('%',#{key},'%')
|
||||
or b.id like concat('%',#{key},'%')
|
||||
or c.id like concat('%',#{key},'%')
|
||||
or c.nick_name like concat('%',#{key},'%')
|
||||
)
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user