|
|
@@ -21,6 +21,7 @@ import com.ydtech.modules.esm.model.EsmUserImage;
|
|
|
import com.ydtech.modules.order.dao.InsUploadFilesMapper;
|
|
|
import com.ydtech.modules.order.entity.api.zhongmei.constants.TimeConstants;
|
|
|
import com.ydtech.modules.order.entity.po.InsUploadFiles;
|
|
|
+import com.ydtech.modules.partner.CalculateCommissionUtils;
|
|
|
import com.ydtech.modules.partner.dao.PartnerPartnerAccountMapper;
|
|
|
import com.ydtech.modules.partner.dao.PartnerUserMapper;
|
|
|
import com.ydtech.modules.partner.model.*;
|
|
|
@@ -403,23 +404,13 @@ public class PartnerUserServiceImpl extends ServiceImpl<PartnerUserMapper, Partn
|
|
|
|
|
|
@Override
|
|
|
public Object myPerformance(Map<String, String> map) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("numberOrders","订单笔数");
|
|
|
- jsonObject.put("totalPremium",0.00);
|
|
|
- jsonObject.put("commission",0.00);
|
|
|
-
|
|
|
- JSONObject jsonObject1 = new JSONObject();
|
|
|
- jsonObject1.put("carId","京K85699");
|
|
|
- jsonObject1.put("issuanceTime","2024-07-02 09:21:57");
|
|
|
- jsonObject1.put("agent","代理人");
|
|
|
- jsonObject1.put("premium",1);
|
|
|
- jsonObject1.put("commission",0.00);
|
|
|
- jsonObject1.put("ordersNo","订单号");
|
|
|
- ArrayList<Object> list = new ArrayList<>();
|
|
|
- list.add(jsonObject1);
|
|
|
+ Set<String> setList = new HashSet<>();
|
|
|
+ getLevelUserId(map.get("userId"),setList);
|
|
|
+ JSONObject totalMap = baseMapper.myPerformanceTotal(map,setList);
|
|
|
+ List<JSONObject> datalist = baseMapper.queryDataList(map,setList);
|
|
|
HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
- hashMap.put("data",list);
|
|
|
- hashMap.put("total",jsonObject);
|
|
|
+ hashMap.put("data",datalist);
|
|
|
+ hashMap.put("total",totalMap);
|
|
|
return hashMap;
|
|
|
}
|
|
|
|
|
|
@@ -742,8 +733,11 @@ public class PartnerUserServiceImpl extends ServiceImpl<PartnerUserMapper, Partn
|
|
|
Map<String, Object> voMap = new HashMap<>();
|
|
|
voMap.put("grade", grade);
|
|
|
voMap.put("gradeName", rule.getOrDefault(grade, ""));
|
|
|
+ List<Map<String, String>> maps = new ArrayList<>(0);
|
|
|
+ if (CollectionUtil.isNotEmpty(currentUserIds)){
|
|
|
+ maps = baseMapper.userCountVo2(currentUserIds, params);
|
|
|
+ }
|
|
|
|
|
|
- List<Map<String, String>> maps = baseMapper.userCountVo2(currentUserIds, params);
|
|
|
|
|
|
// Map<String, Integer> mergedMap = arrayList.stream()
|
|
|
// .flatMap(map -> map.entrySet().stream())
|
|
|
@@ -812,11 +806,16 @@ public class PartnerUserServiceImpl extends ServiceImpl<PartnerUserMapper, Partn
|
|
|
if (CollectionUtil.isEmpty(partnerUsers)){
|
|
|
return HttpResult.error("用户无权益信息");
|
|
|
}
|
|
|
- BigDecimal totalAmountSafe = partnerUsers.stream()
|
|
|
- .map(PartnerUser::getCommissionRate)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+// BigDecimal totalAmountSafe = partnerUsers.stream()
|
|
|
+// .map(PartnerUser::getCommissionRate)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
+ BigDecimal totalAmountSafe = BigDecimal.ZERO;
|
|
|
+ for (PartnerUser partnerUser : partnerUsers) {
|
|
|
+ BigDecimal bigDecimal = CalculateCommissionUtils.calculateCommission(String.valueOf(partnerUser.getGrade()));
|
|
|
+ totalAmountSafe = totalAmountSafe.add(bigDecimal);
|
|
|
+ }
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("totalRate",totalAmountSafe);
|
|
|
|
|
|
@@ -827,7 +826,7 @@ public class PartnerUserServiceImpl extends ServiceImpl<PartnerUserMapper, Partn
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("grade",user.getGrade());
|
|
|
object.put("gradeName",rule.getOrDefault(user.getGrade(),""));
|
|
|
- object.put("commissionRate",user.getCommissionRate());
|
|
|
+ object.put("commissionRate",CalculateCommissionUtils.calculateCommission(String.valueOf(user.getGrade())));
|
|
|
list.add(object);
|
|
|
}
|
|
|
jsonObject.put("data",list);
|