Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -16,5 +16,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface MkDistributionFlowMapper extends BaseMapper<MkDistributionFlow> {
|
||||
|
||||
List<MkDistributionFlowVO> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String status, String key);
|
||||
List<MkDistributionFlowVO> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String status, String key, Long id);
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ public class MkDistributionFlowServiceImpl extends ServiceImpl<MkDistributionFlo
|
||||
private ShopInfoService shopInfoService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key, String status) {
|
||||
public Map<String, Object> pageInfo(Long shopId, LocalDateTime startTime, LocalDateTime endTime, String key, String status, Long id) {
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
List<MkDistributionFlowVO> list = mapper.pageInfo(shopId, startTime, endTime, status, key);
|
||||
List<MkDistributionFlowVO> list = mapper.pageInfo(shopId, startTime, endTime, status, key, id);
|
||||
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)
|
||||
|
||||
@@ -3,10 +3,13 @@ package com.czg.service.market.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.market.dto.MkDistributionUserDTO;
|
||||
@@ -27,8 +30,8 @@ import com.czg.order.dto.MkDistributionPayDTO;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.Impl.AppWxServiceImpl;
|
||||
import com.czg.service.market.mapper.MkDistributionUserMapper;
|
||||
import com.czg.system.service.WxService;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.utils.CzgRandomUtils;
|
||||
import com.czg.utils.PageUtil;
|
||||
@@ -70,15 +73,18 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
private MkDistributionAmountFlowService distributionAmountFlowService;
|
||||
@Resource
|
||||
private MkDistributionFlowService distributionFlowService;
|
||||
@DubboReference
|
||||
private AppWxServiceImpl appWxService;
|
||||
|
||||
|
||||
@DubboReference
|
||||
private ShopUserService shopUserService;
|
||||
@DubboReference
|
||||
private UserInfoService userInfoService;
|
||||
@DubboReference
|
||||
private OrderPaymentService orderPaymentService;
|
||||
@DubboReference
|
||||
private ShopInfoService shopInfoService;
|
||||
@DubboReference
|
||||
private WxService wxService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> centerUser(Long userId) {
|
||||
@@ -365,15 +371,27 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
.setLevelId(distributionUser.getDistributionLevelId()).setLevel(level.getLevel()).setSourceNickName(sourceShopUser.getNickName()).setOrderNo(orderNo)
|
||||
.setSourceId(sourceId).setAmount(amount).setType(type).setStatus(flag ? TableValueConstant.DistributionFlow.Status.SUCCESS.getCode() :
|
||||
TableValueConstant.DistributionFlow.Status.PENDING.getCode())
|
||||
.setRewardAmount(rewardAmount);
|
||||
distributionFlowService.save(mkDistributionFlow);
|
||||
.setRewardAmount(rewardAmount).setBillNo(IdUtil.simpleUUID());
|
||||
|
||||
|
||||
if (flag) {
|
||||
ShopUser shopUser = shopUserService.getById(distributionUser.getShopUserId());
|
||||
UserInfo userInfo = userInfoService.getById(shopUser.getUserId());
|
||||
distributionAmountFlowService.save(new MkDistributionAmountFlow()
|
||||
.setType(TableValueConstant.DistributionAmountFlow.Type.SELF_RECHARGE.getCode())
|
||||
.setShopId(config.getShopId()).setAmount(finalAmount).setChangeAmount(amount).setSourceId(mkDistributionFlow.getId())
|
||||
.setRemark("自助充值").setOpAccount(StpKit.USER.getAccount()));
|
||||
try {
|
||||
JSONObject jsonObject = appWxService.transferBalance(userInfo.getWechatOpenId(), userInfo.getRealName(), rewardAmount, "分销奖励", mkDistributionFlow.getBillNo());
|
||||
mkDistributionFlow.setPackageInfo(jsonObject.getString("package_info"));
|
||||
mkDistributionFlow.setResp(jsonObject.toJSONString());
|
||||
}catch (Exception e) {
|
||||
mkDistributionFlow.setResp(e.getMessage());
|
||||
mkDistributionFlow.setStatus(TableValueConstant.DistributionFlow.Status.FAIL.getCode());
|
||||
}
|
||||
}
|
||||
distributionFlowService.save(mkDistributionFlow);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
<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 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 c on c.id=a.shop_user_id
|
||||
where a.shop_id=#{shopId}
|
||||
@@ -26,6 +27,9 @@
|
||||
or c.nick_name like concat('%',#{key},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="id != null">
|
||||
and d.id=#{id}
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user