分校明细
This commit is contained in:
parent
827cc937e1
commit
58f9622656
|
|
@ -1,10 +1,13 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.annotation.SaCheckMainShop;
|
||||
import com.czg.market.dto.MkDistributionConfigDTO;
|
||||
import com.czg.market.service.MkDistributionAmountFlowService;
|
||||
import com.czg.market.service.MkDistributionConfigService;
|
||||
import com.czg.market.service.MkDistributionFlowService;
|
||||
import com.czg.market.service.MkDistributionUserService;
|
||||
import com.czg.market.vo.*;
|
||||
import com.czg.order.dto.MkDistributionPayDTO;
|
||||
|
|
@ -34,6 +37,8 @@ public class DistributionController {
|
|||
private MkDistributionUserService distributionUserService;
|
||||
@Resource
|
||||
private MkDistributionAmountFlowService distributionAmountFlowService;
|
||||
@Resource
|
||||
private MkDistributionFlowService distributionFlowService;
|
||||
|
||||
/**
|
||||
* 配置信息详情
|
||||
|
|
@ -80,6 +85,37 @@ public class DistributionController {
|
|||
return CzgResult.success(distributionAmountFlowService.pageInfo(StpKit.USER.getShopId(), type, key));
|
||||
}
|
||||
|
||||
/**
|
||||
* 开通记录
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param key 用户id昵称
|
||||
*/
|
||||
@GetMapping("openFlow")
|
||||
public CzgResult<Map<String, Object>> openFlow(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String key) {
|
||||
return CzgResult.success(distributionAmountFlowService.openPageInfo(StpKit.USER.getShopId(),
|
||||
StrUtil.isNotBlank(startTime) ? DateUtil.parseLocalDateTime(startTime) : null, StrUtil.isNotBlank(endTime) ? DateUtil.parseLocalDateTime(endTime) : null, key));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分销明细
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param key 用户id昵称
|
||||
* @param status pending待入账 success已入账
|
||||
*/
|
||||
@GetMapping("distributionFlow")
|
||||
public CzgResult<Map<String, Object>> distributionFlow(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime,
|
||||
@RequestParam(required = false) String key, @RequestParam(required = false) String status) {
|
||||
return CzgResult.success(distributionFlowService.pageInfo(StpKit.USER.getShopId(),
|
||||
StrUtil.isNotBlank(startTime) ? DateUtil.parseLocalDateTime(startTime) : null, StrUtil.isNotBlank(endTime) ? DateUtil.parseLocalDateTime(endTime) : null, key, status));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,10 +62,6 @@ public class MkDistributionFlow implements Serializable {
|
|||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String nickname;
|
||||
private String sourceNickName;
|
||||
|
||||
/**
|
||||
|
|
@ -111,4 +107,5 @@ public class MkDistributionFlow implements Serializable {
|
|||
*/
|
||||
private Long sourceShopUserId;
|
||||
|
||||
private String nickName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.czg.market.service;
|
|||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.market.entity.MkDistributionAmountFlow;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -14,4 +15,6 @@ import java.util.Map;
|
|||
public interface MkDistributionAmountFlowService extends IService<MkDistributionAmountFlow> {
|
||||
|
||||
Map<String, Object> pageInfo(Long shopId, String type, String key);
|
||||
|
||||
Map<String, Object> openPageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package com.czg.market.service;
|
|||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.market.entity.MkDistributionFlow;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 分销记录表 服务层。
|
||||
*
|
||||
|
|
@ -11,4 +14,5 @@ import com.czg.market.entity.MkDistributionFlow;
|
|||
*/
|
||||
public interface MkDistributionFlowService extends IService<MkDistributionFlow> {
|
||||
|
||||
Map<String, Object> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key, String status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,4 +15,6 @@ import java.io.Serializable;
|
|||
@Accessors(chain = true)
|
||||
public class MkDistributionAmountFlowVO extends MkDistributionAmountFlow implements Serializable {
|
||||
private String orderNo;
|
||||
private String nickName;
|
||||
private String phone;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.czg.market.vo;
|
||||
|
||||
import com.czg.market.entity.MkDistributionAmountFlow;
|
||||
import com.czg.market.entity.MkDistributionFlow;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MkDistributionFlowVO extends MkDistributionFlow implements Serializable {
|
||||
private String orderNo;
|
||||
private String phone;
|
||||
private String sourcePhone;
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue