|
@@ -10,6 +10,7 @@ import com.kuaidi100.sdk.core.IBaseClient;
|
|
import com.kuaidi100.sdk.request.SubscribeParam;
|
|
import com.kuaidi100.sdk.request.SubscribeParam;
|
|
import com.kuaidi100.sdk.request.SubscribeParameters;
|
|
import com.kuaidi100.sdk.request.SubscribeParameters;
|
|
import com.kuaidi100.sdk.request.SubscribeReq;
|
|
import com.kuaidi100.sdk.request.SubscribeReq;
|
|
|
|
+import com.ruixuan.common.core.domain.entity.SysUser;
|
|
import com.ruixuan.common.utils.Check;
|
|
import com.ruixuan.common.utils.Check;
|
|
import com.ruixuan.common.utils.DateUtils;
|
|
import com.ruixuan.common.utils.DateUtils;
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSampleExpress;
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSampleExpress;
|
|
@@ -17,10 +18,16 @@ import com.ruixuan.isc.entity.KuaishouItemCollectSampleLog;
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSamples;
|
|
import com.ruixuan.isc.entity.KuaishouItemCollectSamples;
|
|
import com.ruixuan.isc.mapper.KuaishouItemCollectSamplesMapper;
|
|
import com.ruixuan.isc.mapper.KuaishouItemCollectSamplesMapper;
|
|
import com.ruixuan.isc.service.IKuaishouItemCollectSamplesService;
|
|
import com.ruixuan.isc.service.IKuaishouItemCollectSamplesService;
|
|
|
|
+import com.ruixuan.isc.service.IKuaishouPromoterService;
|
|
|
|
+import com.ruixuan.isc.service.ISupplyChainService;
|
|
|
|
+import com.ruixuan.system.service.ISysUserService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Collections;
|
|
|
|
+import java.util.Comparator;
|
|
|
|
+import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -37,6 +44,15 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
@Autowired
|
|
@Autowired
|
|
private KuaishouItemCollectSamplesMapper kuaishouItemCollectSamplesMapper;
|
|
private KuaishouItemCollectSamplesMapper kuaishouItemCollectSamplesMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysUserService userService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaishouPromoterService promoterService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISupplyChainService supplyChainService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询【请填写功能名称】
|
|
* 查询【请填写功能名称】
|
|
*
|
|
*
|
|
@@ -308,5 +324,126 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public JSONObject getPersonalInfo(Long userId) {
|
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
|
+ SysUser sysUser = userService.selectUserById(userId);
|
|
|
|
+ if (Check.isNotNull(sysUser)) {
|
|
|
|
+ data.put("userName", sysUser.getNickName());
|
|
|
|
+ }
|
|
|
|
+ Integer status = 1; //待审核领样数
|
|
|
|
+ data.put("toBeReviewed", kuaishouItemCollectSamplesMapper.getSampleCountByUserId(userId, status));
|
|
|
|
+ status = 3;//待发货领样数
|
|
|
|
+ data.put("toBeShipped", kuaishouItemCollectSamplesMapper.getSampleCountByUserId(userId, status));
|
|
|
|
+ status = 5;//待上传作业数
|
|
|
|
+ data.put("toBeUploaded", kuaishouItemCollectSamplesMapper.getSampleCountByUserId(userId, status));
|
|
|
|
+ returnJson.put("code", 0);
|
|
|
|
+ returnJson.put("message", "调用成功");
|
|
|
|
+ returnJson.put("data", data);
|
|
|
|
+ return returnJson;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public JSONObject getOrderData(Long userId, String statDate) {
|
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
|
+ List<Long> promoterIds = promoterService.selectPromoterIdList(userId);
|
|
|
|
+ if (Check.isNotNull(promoterIds)) {
|
|
|
|
+ data.put("promoterCount", promoterIds.size());//达人总数
|
|
|
|
+ JSONObject Sample = kuaishouItemCollectSamplesMapper.queryTheNumberOfCompletedJobs(promoterIds, statDate);
|
|
|
|
+ data.put("completeCount", Sample.getInteger("completeCount"));//完成作业数
|
|
|
|
+ data.put("completeRate", Sample.getString("completeRate"));//合格作业率
|
|
|
|
+ JSONObject order = supplyChainService.selectOrderInfo(promoterIds, statDate);
|
|
|
|
+ data.put("allNumber", order.getInteger("allNumber"));//订单总数
|
|
|
|
+ data.put("validOrderNUm", order.getInteger("validOrderNUm"));//有效订单数
|
|
|
|
+ data.put("inValidOrderNUm", order.getInteger("allNumber") - order.getInteger("validOrderNUm"));//失效订单数
|
|
|
|
+ data.put("orderAmount", order.getInteger("orderAmount"));//订单金额
|
|
|
|
+ data.put("regimentalPromotionAmount", order.getInteger("regimentalPromotionAmount"));//预估服务费
|
|
|
|
+ data.put("baseAmount", order.getInteger("baseAmount"));//累计货贷基数
|
|
|
|
+ //当天
|
|
|
|
+ String today = DateUtils.getNowDateStr();
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ //昨天
|
|
|
|
+ String yesterday = DateUtils.getSubtractTime(date, 1);
|
|
|
|
+ //上周的同一天(上个近七天的结束日期)
|
|
|
|
+ String todayOfLastWeek = DateUtils.getSubtractTime(date, 7);
|
|
|
|
+ //当前近七天的开始日期
|
|
|
|
+ String start = DateUtils.getSubtractTime(date, 6);
|
|
|
|
+ //上个近七天的开始日期
|
|
|
|
+ String LastStart = DateUtils.getSubtractTime(date, 13);
|
|
|
|
+
|
|
|
|
+ //日环比
|
|
|
|
+ JSONObject dateOrderRate = supplyChainService.selectOrderRate(promoterIds, today, today, yesterday, yesterday);
|
|
|
|
+ data.put("dateOrderRate", dateOrderRate.getString("orderRate"));
|
|
|
|
+ data.put("dateAmountRate", dateOrderRate.getString("amountRate"));
|
|
|
|
+ //周同比
|
|
|
|
+ JSONObject monthOrderRate = supplyChainService.selectOrderRate(promoterIds, today, today, todayOfLastWeek, todayOfLastWeek);
|
|
|
|
+ data.put("monthOrderRate", monthOrderRate.getString("orderRate"));
|
|
|
|
+ data.put("monthAmountRate", monthOrderRate.getString("amountRate"));
|
|
|
|
+ //数据对比
|
|
|
|
+ JSONObject dataOrderRate = supplyChainService.selectOrderRate(promoterIds, start, today, LastStart, todayOfLastWeek);
|
|
|
|
+ data.put("dataOrderRate", dataOrderRate.getString("orderRate"));
|
|
|
|
+ data.put("dataAmountRate", dataOrderRate.getString("amountRate"));
|
|
|
|
+ }
|
|
|
|
+ returnJson.put("code", 0);
|
|
|
|
+ returnJson.put("message", "调用成功");
|
|
|
|
+ returnJson.put("data", data);
|
|
|
|
+ return returnJson;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public JSONObject getDataAnalysis(Long userId) {
|
|
|
|
+ JSONObject returnJson = new JSONObject();
|
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
|
+ List<Long> promoterIds = promoterService.selectPromoterIdList(userId);
|
|
|
|
+ if (Check.isNotNull(promoterIds)) {
|
|
|
|
+ //当天
|
|
|
|
+ String end = DateUtils.getNowDateStr();
|
|
|
|
+ //当前月份第一天
|
|
|
|
+ String start = DateUtils.getFirstDayByMonth();
|
|
|
|
+ List<JSONObject> list = supplyChainService.getMonthOrderAmount(promoterIds, userId, start, end);
|
|
|
|
+ List<String> allDates = DateUtils.getAllDatesOfTwoTimes(start, end);
|
|
|
|
+ if (Check.isNull(list) || list.size() != allDates.size()) {
|
|
|
|
+ String orderAmountStr = JSONObject.toJSONString(list);
|
|
|
|
+ for (String date : allDates) {
|
|
|
|
+ if (!orderAmountStr.contains(date)) {
|
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
|
+ obj.put("date", date);
|
|
|
|
+ obj.put("orderAmount", 0);
|
|
|
|
+ obj.put("totalRegimentalSettleAmount", 0);
|
|
|
|
+ obj.put("promoterCount", 0);
|
|
|
|
+ list.add(obj);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //排序
|
|
|
|
+ Collections.sort(list, new Comparator<JSONObject>() {
|
|
|
|
+ @Override
|
|
|
|
+ public int compare(JSONObject o1, JSONObject o2) {
|
|
|
|
+ return o1.getString("date").compareTo(o2.getString("date"));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ data.put("list", list);
|
|
|
|
+ JSONObject amount = supplyChainService.getMonthOrderAmountTotal(promoterIds, start, end);
|
|
|
|
+ if (Check.isNotNull(amount)) {
|
|
|
|
+ data.put("orderAmount", amount.getInteger("orderAmount"));
|
|
|
|
+ data.put("totalRegimentalSettleAmount", amount.getInteger("totalRegimentalSettleAmount"));
|
|
|
|
+ data.put("orderAmountRate", amount.getString("orderAmountRate"));
|
|
|
|
+ data.put("totalRegimentalSettleAmountRate", amount.getString("totalRegimentalSettleAmountRate"));
|
|
|
|
+ }
|
|
|
|
+ JSONObject promoter = promoterService.getgetMonthPromoterTotal(userId, start, end);
|
|
|
|
+ if (Check.isNotNull(promoter)) {
|
|
|
|
+ data.put("promoterCount", promoter.getString("count"));
|
|
|
|
+ data.put("promoterRate", promoter.getString("rate"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ returnJson.put("code", 0);
|
|
|
|
+ returnJson.put("message", "调用成功");
|
|
|
|
+ returnJson.put("data", data);
|
|
|
|
+ return returnJson;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|