用户分账余额记录接口
This commit is contained in:
parent
5f78e3e0c2
commit
c199711e4d
|
|
@ -4,6 +4,7 @@ import com.czg.market.dto.MkDistributionWithdrawFlowDTO;
|
||||||
import com.czg.account.entity.UserInfo;
|
import com.czg.account.entity.UserInfo;
|
||||||
import com.czg.market.dto.MkDistributionUserDTO;
|
import com.czg.market.dto.MkDistributionUserDTO;
|
||||||
import com.czg.market.entity.MkDistributionWithdrawFlow;
|
import com.czg.market.entity.MkDistributionWithdrawFlow;
|
||||||
|
import com.czg.market.service.MkDistributionFlowService;
|
||||||
import com.czg.market.service.MkDistributionUserService;
|
import com.czg.market.service.MkDistributionUserService;
|
||||||
import com.czg.market.service.MkDistributionWithdrawFlowService;
|
import com.czg.market.service.MkDistributionWithdrawFlowService;
|
||||||
import com.czg.market.vo.DistributionCenterShopVO;
|
import com.czg.market.vo.DistributionCenterShopVO;
|
||||||
|
|
@ -36,6 +37,8 @@ public class UDistributionController {
|
||||||
private AppWxServiceImpl appWxService;
|
private AppWxServiceImpl appWxService;
|
||||||
@Resource
|
@Resource
|
||||||
private MkDistributionWithdrawFlowService withdrawFlowService;
|
private MkDistributionWithdrawFlowService withdrawFlowService;
|
||||||
|
@Resource
|
||||||
|
private MkDistributionFlowService distributionFlowService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员购买
|
* 分销员购买
|
||||||
|
|
@ -150,4 +153,18 @@ public class UDistributionController {
|
||||||
return CzgResult.success(withdrawFlowService.pageInfo(StpKit.USER.getLoginIdAsLong()));
|
return CzgResult.success(withdrawFlowService.pageInfo(StpKit.USER.getLoginIdAsLong()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收益明细
|
||||||
|
* @param startTime
|
||||||
|
* @param endTime
|
||||||
|
* @param shopId
|
||||||
|
* @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) Long shopId, @RequestParam(required = false) String status) {
|
||||||
|
return CzgResult.success(distributionFlowService.distributionFlow(StpKit.USER.getLoginIdAsLong(), startTime, endTime, shopId, status));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,6 @@ import java.util.Map;
|
||||||
public interface MkDistributionFlowService extends IService<MkDistributionFlow> {
|
public interface MkDistributionFlowService extends IService<MkDistributionFlow> {
|
||||||
|
|
||||||
Map<String, Object> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key, String status, Long id);
|
Map<String, Object> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key, String status, Long id);
|
||||||
|
|
||||||
|
Map<String, Object> distributionFlow(long loginIdAsLong, String startTime, String endTime, Long shopId, String status);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,5 @@ public class MkDistributionFlowVO extends MkDistributionFlow implements Serializ
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
private String phone;
|
private String phone;
|
||||||
private String sourcePhone;
|
private String sourcePhone;
|
||||||
|
private String shopName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.czg.market.vo.MkDistributionFlowVO;
|
||||||
import com.mybatisflex.core.BaseMapper;
|
import com.mybatisflex.core.BaseMapper;
|
||||||
import com.czg.market.entity.MkDistributionFlow;
|
import com.czg.market.entity.MkDistributionFlow;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -16,5 +17,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface MkDistributionFlowMapper extends BaseMapper<MkDistributionFlow> {
|
public interface MkDistributionFlowMapper extends BaseMapper<MkDistributionFlow> {
|
||||||
|
|
||||||
List<MkDistributionFlowVO> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String status, String key, Long id);
|
List<MkDistributionFlowVO> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String status, String key, Long id, String type);
|
||||||
|
BigDecimal totalAmount(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String status, String key, Long id, String type);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.czg.service.market.service.impl;
|
package com.czg.service.market.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.czg.account.entity.ShopUser;
|
import com.czg.account.entity.ShopUser;
|
||||||
import com.czg.account.service.ShopInfoService;
|
import com.czg.account.service.ShopInfoService;
|
||||||
|
|
@ -40,7 +41,7 @@ public class MkDistributionFlowServiceImpl extends ServiceImpl<MkDistributionFlo
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key, String status, Long id) {
|
public Map<String, Object> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key, String status, Long id) {
|
||||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||||
List<MkDistributionFlowVO> list = mapper.pageInfo(shopId, startTime, endTime, status, key, id);
|
List<MkDistributionFlowVO> list = mapper.pageInfo(shopId, startTime, endTime, status, key, id, null);
|
||||||
Page<MkDistributionFlowVO> page = PageUtil.convert(new PageInfo<>(list));
|
Page<MkDistributionFlowVO> page = PageUtil.convert(new PageInfo<>(list));
|
||||||
Map<String, Object> map = BeanUtil.beanToMap(page);
|
Map<String, Object> map = BeanUtil.beanToMap(page);
|
||||||
map.put("successAmount", getOne(new QueryWrapper().eq(MkDistributionFlow::getShopId, shopId)
|
map.put("successAmount", getOne(new QueryWrapper().eq(MkDistributionFlow::getShopId, shopId)
|
||||||
|
|
@ -52,4 +53,16 @@ public class MkDistributionFlowServiceImpl extends ServiceImpl<MkDistributionFlo
|
||||||
map.put("balanceAmount", shopInfoService.getById(shopId).getAmount());
|
map.put("balanceAmount", shopInfoService.getById(shopId).getAmount());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> distributionFlow(long loginIdAsLong, String startTime, String endTime, Long shopId, String status) {
|
||||||
|
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||||
|
List<MkDistributionFlowVO> list = mapper.pageInfo(shopId, StrUtil.isBlank(startTime) ? null : DateUtil.parseLocalDateTime(startTime),
|
||||||
|
StrUtil.isBlank(endTime) ? null : DateUtil.parseLocalDateTime(endTime), status,null, null, null);
|
||||||
|
Page<MkDistributionFlowVO> page = PageUtil.convert(new PageInfo<>(list));
|
||||||
|
Map<String, Object> map = BeanUtil.beanToMap(page);
|
||||||
|
map.put("totalAmount", mapper.totalAmount(shopId, StrUtil.isBlank(startTime) ? null : DateUtil.parseLocalDateTime(startTime),
|
||||||
|
StrUtil.isBlank(endTime) ? null : DateUtil.parseLocalDateTime(endTime), status,null, null, null));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,44 @@
|
||||||
<mapper namespace="com.czg.service.market.mapper.MkDistributionFlowMapper">
|
<mapper namespace="com.czg.service.market.mapper.MkDistributionFlowMapper">
|
||||||
|
|
||||||
<select id="pageInfo" resultType="com.czg.market.vo.MkDistributionFlowVO">
|
<select id="pageInfo" resultType="com.czg.market.vo.MkDistributionFlowVO">
|
||||||
select a.*, b.phone, c.phone as sourcePhone from mk_distribution_flow as a
|
select a.*, b.phone, c.phone as sourcePhone, e.shop_name from mk_distribution_flow as a
|
||||||
|
left join mk_distribution_user as d on d.id=a.distribution_user_id
|
||||||
|
left join tb_shop_info as e on e.id=a.shop_id
|
||||||
|
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>
|
||||||
|
<if test="shopId != null">
|
||||||
|
and a.shop_id=#{shopId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<if test="id != null">
|
||||||
|
and d.id=#{id}
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
and a.type=#{type}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by a.create_time desc
|
||||||
|
</select>
|
||||||
|
<select id="totalAmount" resultType="java.math.BigDecimal">
|
||||||
|
select sum(a.amount) from mk_distribution_flow as a
|
||||||
left join mk_distribution_user as d on d.id=a.distribution_user_id
|
left join mk_distribution_user as d on d.id=a.distribution_user_id
|
||||||
left join tb_shop_user as b on a.shop_user_id=b.id
|
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
|
left join tb_shop_user as c on c.id=a.shop_user_id
|
||||||
|
|
@ -21,15 +58,17 @@
|
||||||
</if>
|
</if>
|
||||||
<if test="key != null and key != ''">
|
<if test="key != null and key != ''">
|
||||||
and (
|
and (
|
||||||
b.nick_name like concat('%',#{key},'%')
|
b.nick_name like concat('%',#{key},'%')
|
||||||
or b.id like concat('%',#{key},'%')
|
or b.id like concat('%',#{key},'%')
|
||||||
or c.id like concat('%',#{key},'%')
|
or c.id like concat('%',#{key},'%')
|
||||||
or c.nick_name like concat('%',#{key},'%')
|
or c.nick_name like concat('%',#{key},'%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
and d.id=#{id}
|
and d.id=#{id}
|
||||||
</if>
|
</if>
|
||||||
order by a.create_time desc
|
<if test="type != null and type != ''">
|
||||||
|
and a.type=#{type}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue