dev-discount
parent
281cc423e0
commit
80f1ec3403
@ -0,0 +1,47 @@ |
||||
package com.hai.service; |
||||
|
||||
import com.hai.entity.BsDistributionRebate; |
||||
import com.hai.entity.BsDistributionUserRel; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @serviceName BsDistributionUserRelService.java |
||||
* @author Sum1Dream |
||||
* @version 1.0.0 |
||||
* @Description // 分销用户关联接口
|
||||
* @createTime 17:47 2022/8/11 |
||||
**/ |
||||
public interface BsDistributionUserRelService { |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @name insertDistributionRebate.java |
||||
* @Description // 新增关联关系
|
||||
* @Date 17:55 2022/8/11 |
||||
* @Param [java.lang.Long, java.lang.Long] |
||||
* @return void |
||||
*/ |
||||
void insertDistributionRebate(Long userId , String userName, Long popularizeUserId); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @name getDistributionRebateList.java |
||||
* @Description // 查询关联列表
|
||||
* @Date 17:51 2022/8/11 |
||||
* @Param [java.util.Map<java.lang.String,java.lang.Object>] |
||||
* @return java.util.List<com.hai.entity.BsDistributionRebate> |
||||
*/ |
||||
List<BsDistributionUserRel> getDistributionUserRelList(Map<String, Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @name findDistributionUserRel.java |
||||
* @Description // 查询关联关系详情
|
||||
* @Date 18:00 2022/8/11 |
||||
* @Param [java.util.Map<java.lang.String,java.lang.Object>] |
||||
* @return com.hai.entity.BsDistributionUserRel |
||||
*/ |
||||
BsDistributionUserRel findDistributionUserRel(Map<String, Object> map); |
||||
} |
@ -0,0 +1,73 @@ |
||||
package com.hai.service.impl; |
||||
|
||||
import com.hai.dao.BsDistributionRebateMapper; |
||||
import com.hai.dao.BsDistributionUserRelMapper; |
||||
import com.hai.entity.BsDistributionRebate; |
||||
import com.hai.entity.BsDistributionUserRel; |
||||
import com.hai.entity.BsDistributionUserRelExample; |
||||
import com.hai.service.BsDistributionUserRelService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("bsDistributionUserRelService") |
||||
public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelService { |
||||
|
||||
@Resource |
||||
private BsDistributionUserRelMapper bsDistributionUserRelMapper; |
||||
|
||||
@Override |
||||
public void insertDistributionRebate(Long userId, String userName , Long popularizeUserId) { |
||||
|
||||
// 定义分销关联关系
|
||||
BsDistributionUserRel distributionUserRel = new BsDistributionUserRel(); |
||||
|
||||
// 查询推广员信息
|
||||
Map<String, Object> map = new HashMap<>(); |
||||
map.put("userId" , popularizeUserId); |
||||
|
||||
BsDistributionUserRel popularizeUser = findDistributionUserRel(map); |
||||
|
||||
distributionUserRel.setUserId(userId); |
||||
distributionUserRel.setUserName(userName); |
||||
distributionUserRel.setAgentId(popularizeUser.getAgentId()); |
||||
distributionUserRel.setAgentName(popularizeUser.getAgentName()); |
||||
distributionUserRel.setPopularizeUserId(popularizeUserId); |
||||
distributionUserRel.setPopularizeUserName(popularizeUser.getUserName()); |
||||
distributionUserRel.setCreateTime(new Date()); |
||||
distributionUserRel.setUpdateTime(new Date()); |
||||
distributionUserRel.setStatus(100); |
||||
|
||||
bsDistributionUserRelMapper.insert(distributionUserRel); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public List<BsDistributionUserRel> getDistributionUserRelList(Map<String, Object> map) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public BsDistributionUserRel findDistributionUserRel(Map<String, Object> map) { |
||||
|
||||
BsDistributionUserRelExample example = new BsDistributionUserRelExample(); |
||||
BsDistributionUserRelExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map , "userId") != null) { |
||||
criteria.andUserIdEqualTo(MapUtils.getLong(map , "userId")); |
||||
} |
||||
|
||||
List<BsDistributionUserRel> list = bsDistributionUserRelMapper.selectByExample(example); |
||||
|
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
} |
Loading…
Reference in new issue