From bf9a238e4b6db75c28ee9efae265f36f33301d83 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 15 Jul 2021 16:15:04 +0800
Subject: [PATCH] 202107015
---
gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java | 139 ++++++++++++++++++++++++++++++++++++++++------
1 files changed, 120 insertions(+), 19 deletions(-)
diff --git a/gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java b/gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java
index d8eeaed..a2078b6 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java
@@ -8,13 +8,12 @@
import com.github.pagehelper.PageInfo;
import com.xzx.gc.common.exception.RestException;
import com.xzx.gc.common.utils.StringUtils;
-import com.xzx.gc.entity.AccountInfo;
-import com.xzx.gc.entity.SysMessage;
-import com.xzx.gc.entity.UserHeadRelate;
-import com.xzx.gc.entity.UserShareInfo;
-import com.xzx.gc.user.dto.AdddistribDto;
-import com.xzx.gc.user.dto.DistribInfoListDto;
-import com.xzx.gc.user.dto.DistribListDto;
+import com.xzx.gc.entity.*;
+import com.xzx.gc.user.dto.*;
+import com.xzx.gc.user.mapper.*;
+import com.xzx.gc.user.vo.HeadInfoVo;
+import com.xzx.gc.user.vo.HeadProfitListVo;
+import com.xzx.gc.user.vo.HeadTeamVo;
import com.xzx.gc.user.mapper.AccountMapper;
import com.xzx.gc.user.mapper.SysMessageMapper;
import com.xzx.gc.user.mapper.UserHeadRelateMapper;
@@ -22,9 +21,7 @@
import com.xzx.gc.user.vo.*;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
-import com.xzx.gc.entity.RedPaperRule;
import com.xzx.gc.model.JsonResult;
-import com.xzx.gc.user.dto.UpdateSettingDto;
import com.xzx.gc.user.mapper.RedPaperRuleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -37,6 +34,7 @@
import java.math.BigDecimal;
import java.util.Date;
+import java.util.List;
import java.util.Map;
@Service
@@ -47,7 +45,8 @@
private RedPaperRuleMapper redPaperRuleMapper;
@Autowired
private UserHeadRelateMapper userHeadRelateMapper;
-
+ @Autowired
+ private UserHeadDetailsMapper userHeadDetailsMapper;
@Autowired
private AccountMapper accountMapper;
@Autowired
@@ -63,7 +62,7 @@
viewSettingVo.setOrderNumFrist(0);
viewSettingVo.setRegularPoint(0);
viewSettingVo.setRegularMoneyPercent(BigDecimal.ZERO);
- viewSettingVo.setFinishOrderNum(0);
+// viewSettingVo.setFinishOrderNum(0);
viewSettingVo.setPointReward(0);
viewSettingVo.setStatus((short) 0);
}else{
@@ -76,7 +75,7 @@
viewSettingVo.setOrderNumFrist(StrUtil.isEmpty(shareRatios.get(1))?0:Integer.parseInt(shareRatios.get(1)));
viewSettingVo.setRegularPoint(StrUtil.isEmpty(shareRatios.get(2))?0:Integer.parseInt(shareRatios.get(2)));
viewSettingVo.setRegularMoneyPercent(StrUtil.isEmpty(shareRatios.get(3))?BigDecimal.ZERO:new BigDecimal(shareRatios.get(3)));
- viewSettingVo.setFinishOrderNum(StrUtil.isEmpty(shareRatios.get(4))?0:Integer.parseInt(shareRatios.get(4)));
+// viewSettingVo.setFinishOrderNum(StrUtil.isEmpty(shareRatios.get(4))?0:Integer.parseInt(shareRatios.get(4)));
viewSettingVo.setPointReward(StrUtil.isEmpty(shareRatios.get(5))?0:Integer.parseInt(shareRatios.get(5)));
viewSettingVo.setStatus(redPaperRule.getStatus());
}
@@ -86,7 +85,7 @@
viewSettingVo.setOrderNumFrist(0);
viewSettingVo.setRegularPoint(0);
viewSettingVo.setRegularMoneyPercent(BigDecimal.ZERO);
- viewSettingVo.setFinishOrderNum(0);
+// viewSettingVo.setFinishOrderNum(0);
viewSettingVo.setPointReward(0);
viewSettingVo.setStatus((short) 0);
}
@@ -120,14 +119,17 @@
userHeadRelate.setHeadUserId(headId);
userHeadRelate.setUserId(userId);
userHeadRelate.setScore(BigDecimal.ZERO);
+ userHeadRelate.setCreatedTime(new Date());
userHeadRelate.setAmount(BigDecimal.ZERO);
userHeadRelateMapper.insert(userHeadRelate);
SysMessage sysMessage = new SysMessage();
sysMessage.setCreateTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
- sysMessage.setCreateUserId(userId);
+ sysMessage.setCreateUserId(headId);
+ sysMessage.setUserId(headId);
sysMessage.setMobilePhone(accountInfo.getAccountName());
sysMessage.setMessageType("4");
+ sysMessage.setMessageSubTypeName("团队消息");
sysMessage.setMessage("手机号:" + accountInfo.getAccountName() + "的用户, 成功加入您的团队");
sysMessage.setFlag("2");
sysMessageMapper.insert(sysMessage);
@@ -145,6 +147,16 @@
return headInfoVo;
}
+ public List<HeadProfitListVo> findHeadProfitListInPage(HeadProfitLitDto profitLitDto) {
+ PageHelper.startPage(profitLitDto.getPage(), profitLitDto.getLimit());
+ return userHeadDetailsMapper.selectHeadProfitListInPage(profitLitDto.getUserId());
+ }
+
+ public List<HeadTeamVo> findHeadTeamListInPage(HeadTeamDto teamDto) {
+ PageHelper.startPage(teamDto.getPage(), teamDto.getLimit());
+ return userHeadRelateMapper.selectHeadTeamListInPage(teamDto.getUserId());
+ }
+
public void addSetting(UpdateSettingDto model) {
RedPaperRule redPaperRule = new RedPaperRule();
StringBuffer stringBuffer = new StringBuffer();
@@ -156,8 +168,8 @@
stringBuffer.append(regularPoint+",");
BigDecimal regularMoneyPercent = ObjectUtil.isEmpty(model.getRegularMoneyPercent()) ? BigDecimal.ZERO : model.getRegularMoneyPercent();
stringBuffer.append(regularMoneyPercent+",");
- int finishOrderNum = ObjectUtil.isEmpty(model.getFinishOrderNum()) ? 0 : model.getFinishOrderNum();
- stringBuffer.append(finishOrderNum+",");
+// int finishOrderNum = ObjectUtil.isEmpty(model.getFinishOrderNum()) ? 0 : model.getFinishOrderNum();
+// stringBuffer.append(finishOrderNum+",");
int pointReward = ObjectUtil.isEmpty(model.getPointReward()) ? 0 : model.getPointReward();
stringBuffer.append(pointReward);
redPaperRule.setStatus((short) 0);
@@ -179,12 +191,12 @@
stringBuffer.append(regularPoint+",");
BigDecimal regularMoneyPercent = ObjectUtil.isEmpty(model.getRegularMoneyPercent()) ? BigDecimal.ZERO : model.getRegularMoneyPercent();
stringBuffer.append(regularMoneyPercent+",");
- int finishOrderNum = ObjectUtil.isEmpty(model.getFinishOrderNum()) ? 0 : model.getFinishOrderNum();
- stringBuffer.append(finishOrderNum+",");
+// int finishOrderNum = ObjectUtil.isEmpty(model.getFinishOrderNum()) ? 0 : model.getFinishOrderNum();
+// stringBuffer.append(finishOrderNum+",");
int pointReward = ObjectUtil.isEmpty(model.getPointReward()) ? 0 : model.getPointReward();
stringBuffer.append(pointReward);
redPaperRule.setStatus(model.getStatus());
- redPaperRule.setSharingProfitType("frist_reward,order_num_frist,regular_point,regular_money_percent,finish_order_num,point_reward");
+ redPaperRule.setSharingProfitType("first_reward,order_num_first,regular_point,regular_money_percent,finish_order_num,point_reward");
redPaperRule.setShareRatio(stringBuffer.toString());
redPaperRuleMapper.updateByPrimaryKey(redPaperRule);
}
@@ -244,4 +256,93 @@
return data;
}
+
+ public ViewDistribInfoVo viewDistribInfo(String id) {
+ //获取团长基本信息
+ return accountMapper.selectDistribByAccountId(id);
+ }
+
+ public Map<String, Object> userHeadInfoList(UserHeadInfoListDto userHeadInfoListDto) {
+ String id = userHeadInfoListDto.getId();
+ AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id);
+ String userId = accountInfo.getUserId();
+ PageHelper.startPage(userHeadInfoListDto.getPage(), userHeadInfoListDto.getLimit());
+ List<UserHeadInfoVo> userHeadInfoVos = accountMapper.selectUserHeadInfoByAccountId(userId);
+ if(CollUtil.isNotEmpty(userHeadInfoVos)){
+ for(UserHeadInfoVo userHeadInfoVo : userHeadInfoVos){
+ String nickname = userHeadInfoVo.getNickname();
+ String decode = StringUtils.decode(nickname);
+ userHeadInfoVo.setNickname(decode);
+ }
+ }
+ PageInfo<UserHeadInfoVo> pageInfo = new PageInfo<>(userHeadInfoVos);
+ Map<String, Object> data = new HashMap<>();
+ int count = Convert.toInt(pageInfo.getTotal());
+ data.put("data", userHeadInfoVos);
+ data.put("count", count);
+ data.put("code", 0);
+ return data;
+ }
+
+ public Map<String, Object> orderItemsList(UserHeadInfoListDto userHeadInfoListDto) {
+ String id = userHeadInfoListDto.getId();
+ AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id);
+ String userId = accountInfo.getUserId();
+ PageHelper.startPage(userHeadInfoListDto.getPage(), userHeadInfoListDto.getLimit());
+ List<OrderItemsVo> orderItemsVos = accountMapper.selectOrderItemsByUserId(userId);
+ if(CollUtil.isNotEmpty(orderItemsVos)){
+ for(OrderItemsVo orderItemsVo : orderItemsVos){
+ if(ObjectUtil.isNotEmpty(orderItemsVo)){
+ Long orderId = orderItemsVo.getOrderId();
+ List<JhyOrderItems> jhyOrderItems = accountMapper.selectOrderById(orderId);
+ if(CollUtil.isNotEmpty(jhyOrderItems)){
+ orderItemsVo.setOrderItems(jhyOrderItems);
+ }
+ }
+ }
+ }
+ PageInfo<OrderItemsVo> pageInfo = new PageInfo<>(orderItemsVos);
+ Map<String, Object> data = new HashMap<>();
+ int count = Convert.toInt(pageInfo.getTotal());
+ data.put("data", orderItemsVos);
+ data.put("count", count);
+ data.put("code", 0);
+ return data;
+ }
+
+ public void prohibitDistrib(ProhibitDistribDto model) {
+ Integer status = model.getStatus();
+ String id = model.getId();
+ AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id);
+ accountInfo.setIsProhibit(status.toString());
+ accountMapper.updateByPrimaryKey(accountInfo);
+ }
+
+
+ public Map<String, Object> distribDataList(DistribDataListDto distribDataListDto) {
+ PageHelper.startPage(distribDataListDto.getPage(), distribDataListDto.getLimit());
+ List<DistribDataListVo> distribDataListVos = accountMapper.distribDataList(distribDataListDto);
+ if(CollUtil.isNotEmpty(distribDataListVos)){
+ for(DistribDataListVo distribDataListVo : distribDataListVos){
+ if(ObjectUtil.isNotEmpty(distribDataListVo)){
+ String id = distribDataListVo.getId();
+ String kg = accountMapper.selectOrderByHeadUserId(id);
+ distribDataListVo.setKg(kg);
+ String jdsl = accountMapper.selectJDSLByHeadUserId(id);
+ distribDataListVo.setJdsl(jdsl);
+ }
+ }
+ }
+ PageInfo<DistribDataListVo> pageInfo = new PageInfo<>(distribDataListVos);
+ Map<String, Object> data = new HashMap<>();
+ int count = Convert.toInt(pageInfo.getTotal());
+ data.put("data", distribDataListVos);
+ data.put("count", count);
+ data.put("code", 0);
+ return data;
+ }
+
+ public DistribDataInfoVo distribDataInfo(DistribDataInfoDto distribDataInfoDto) {
+ return accountMapper.selectDistribDataInfoVo();
+ }
}
--
Gitblit v1.9.1