|
|
@@ -5,11 +5,10 @@ import lombok.AllArgsConstructor;
|
|
|
import org.springblade.salesPart.brand.service.IBrandDescService;
|
|
|
import org.springblade.salesPart.corps.service.ICorpsDescService;
|
|
|
import org.springblade.salesPart.entity.*;
|
|
|
+import org.springblade.salesPart.goods.service.IGoodsDescService;
|
|
|
import org.springblade.salesPart.order.service.IOrderItemsService;
|
|
|
import org.springblade.salesPart.order.service.IOrderService;
|
|
|
-import org.springblade.salesPart.smartLargeScreenApi.dto.BrandSort;
|
|
|
-import org.springblade.salesPart.smartLargeScreenApi.dto.MonthlySalesTrend;
|
|
|
-import org.springblade.salesPart.smartLargeScreenApi.dto.WarehouseSort;
|
|
|
+import org.springblade.salesPart.smartLargeScreenApi.dto.*;
|
|
|
import org.springblade.salesPart.smartLargeScreenApi.service.ApiService;
|
|
|
import org.springblade.salesPart.stock.service.IStockDescService;
|
|
|
import org.springblade.salesPart.storage.service.IStorageDescService;
|
|
|
@@ -43,6 +42,8 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
private final IStockDescService stockDescService;
|
|
|
|
|
|
+ private final IGoodsDescService goodsDescService;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> getTotalYear(String year) {
|
|
|
String tenantId = sysClient.getTenantIds("whether.financing");
|
|
|
@@ -279,7 +280,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> averageSingleTireShippingFee(String tenantId) {
|
|
|
- String data = sysClient.getParamServiceShippingFee(tenantId, "large.screen.average.freight");
|
|
|
+ String data = sysClient.paramServiceValue(tenantId, "large.screen.average.freight");
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (ObjectUtils.isNotNull(data)) {
|
|
|
@@ -394,7 +395,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> salesTask(String tenantId) {
|
|
|
- String data = sysClient.getParamServiceShippingFee(tenantId, "sales.task");
|
|
|
+ String data = sysClient.paramServiceValue(tenantId, "sales.task");
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (ObjectUtils.isNotNull(data)) {
|
|
|
@@ -426,7 +427,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> salesPerformanceProportion(String tenantId) {
|
|
|
- String data = sysClient.getParamServiceShippingFee(tenantId, "sales.task");
|
|
|
+ String data = sysClient.paramServiceValue(tenantId, "sales.task");
|
|
|
List<PjOrder> orderList = orderService.selectPjOrderList(tenantId, "2");
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
@@ -450,7 +451,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> tyreQuantityTask(String tenantId) {
|
|
|
- String data = sysClient.getParamServiceShippingFee(tenantId, "tyre.quantity.task");
|
|
|
+ String data = sysClient.paramServiceValue(tenantId, "tyre.quantity.task");
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (ObjectUtils.isNotNull(data)) {
|
|
|
@@ -482,7 +483,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> tyreQuantityProportion(String tenantId) {
|
|
|
- String data = sysClient.getParamServiceShippingFee(tenantId, "tyre.quantity.task");
|
|
|
+ String data = sysClient.paramServiceValue(tenantId, "tyre.quantity.task");
|
|
|
List<PjOrder> orderList = orderService.selectPjOrderList(tenantId, "2");
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
@@ -506,7 +507,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> storeTransactionTask(String tenantId) {
|
|
|
- String data = sysClient.getParamServiceShippingFee(tenantId, "store.transaction.task");
|
|
|
+ String data = sysClient.paramServiceValue(tenantId, "store.transaction.task");
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (ObjectUtils.isNotNull(data)) {
|
|
|
@@ -538,7 +539,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> storeTransactionProportion(String tenantId) {
|
|
|
- String data = sysClient.getParamServiceShippingFee(tenantId, "store.transaction.task");
|
|
|
+ String data = sysClient.paramServiceValue(tenantId, "store.transaction.task");
|
|
|
List<PjOrder> orderList = orderService.selectPjOrderList(tenantId, "2");
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
@@ -619,7 +620,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
public List<Map<String, Object>> monthlySalesTrend(String tenantId) {
|
|
|
List<PjOrder> orderList = orderService.selectPjOrderList(tenantId, "2");
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
- if (!orderList.isEmpty()){
|
|
|
+ if (!orderList.isEmpty()) {
|
|
|
List<MonthlySalesTrend> list = new ArrayList<>();
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
for (PjOrder item : orderList) {
|
|
|
@@ -636,9 +637,9 @@ public class ApiServiceImpl implements ApiService {
|
|
|
for (Integer item : day) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("x", item);
|
|
|
- map.put("y", salesTrendList.stream().filter(e-> e.getDate().equals(item))
|
|
|
+ map.put("y", salesTrendList.stream().filter(e -> e.getDate().equals(item))
|
|
|
.map(MonthlySalesTrend::getAmount).max(BigDecimal::compareTo));
|
|
|
- map.put("z", salesTrendList.stream().filter(e-> e.getDate().equals(item))
|
|
|
+ map.put("z", salesTrendList.stream().filter(e -> e.getDate().equals(item))
|
|
|
.map(MonthlySalesTrend::getAmount).min(BigDecimal::compareTo));
|
|
|
mapList.add(map);
|
|
|
}
|
|
|
@@ -648,6 +649,217 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> corpTop(String tenantId) {
|
|
|
- return null;
|
|
|
+ List<PjOrder> orderList = orderService.selectPjOrderList(tenantId, "2");
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ if (!orderList.isEmpty()) {
|
|
|
+ List<String> corpIdList = orderList.stream().map(PjOrder::getCustomerName).distinct().collect(Collectors.toList());
|
|
|
+ List<TyreSaleCorp> saleCorpList = new ArrayList<>();
|
|
|
+ for (String item : corpIdList) {
|
|
|
+ TyreSaleCorp corp = new TyreSaleCorp();
|
|
|
+ corp.setCorpName(item);
|
|
|
+ corp.setNumber(orderList.stream().filter(e -> e.getCustomerName().equals(item)).map(PjOrder::getGoodsTotalNum)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ saleCorpList.add(corp);
|
|
|
+ }
|
|
|
+ List<TyreSaleCorp> itemsList = saleCorpList.stream()
|
|
|
+ .sorted(Comparator.comparing(TyreSaleCorp::getNumber))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<TyreSaleCorp> corpList = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= 4; i++) {
|
|
|
+ corpList.add(itemsList.get(i));
|
|
|
+ }
|
|
|
+ for (TyreSaleCorp item : corpList) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("name", item.getCorpName());
|
|
|
+ map.put("number", item.getNumber());
|
|
|
+ BigDecimal sumNumber = orderList.stream().map(PjOrder::getGoodsTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if (new BigDecimal("0.00").compareTo(sumNumber) != 0) {
|
|
|
+ map.put("proportion", item.getNumber().divide(sumNumber, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
|
|
+ } else {
|
|
|
+ map.put("proportion", new BigDecimal("0"));
|
|
|
+ }
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> tyreSaleSizeProportion(String tenantId) {
|
|
|
+ List<PjOrderItems> orderItemsList = orderItemsService.selectOrderItemsList(tenantId, "");
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ if (!orderItemsList.isEmpty()) {
|
|
|
+ List<TyreSaleSize> saleSizeList = new ArrayList<>();
|
|
|
+ List<Long> goodsId = orderItemsList.stream().map(PjOrderItems::getGoodsId).distinct().collect(Collectors.toList());
|
|
|
+ for (Long items : goodsId) {
|
|
|
+ TyreSaleSize detail = new TyreSaleSize();
|
|
|
+ detail.setGoodsId(items);
|
|
|
+ detail.setNumber(orderItemsList.stream().filter(e -> e.getGoodsId().equals(items)).map(PjOrderItems::getGoodsNum)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ saleSizeList.add(detail);
|
|
|
+ }
|
|
|
+ List<TyreSaleSize> itemsList = saleSizeList.stream()
|
|
|
+ .sorted(Comparator.comparing(TyreSaleSize::getNumber))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<TyreSaleSize> sizeList = new ArrayList<>();
|
|
|
+ StringBuilder goodsIds = new StringBuilder();
|
|
|
+ for (int i = 0; i <= 4; i++) {
|
|
|
+ goodsIds.append(itemsList.get(i).getGoodsId()).append(",");
|
|
|
+ sizeList.add(itemsList.get(i));
|
|
|
+ }
|
|
|
+ List<PjGoodsDesc> goodsDescList = goodsDescService.selectGoodsList(tenantId, goodsIds.toString());
|
|
|
+ for (TyreSaleSize item : sizeList) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (!goodsDescList.isEmpty()) {
|
|
|
+ PjGoodsDesc goodsDesc = goodsDescList.stream().filter(e -> e.getId().equals(item.getGoodsId())).findFirst().orElse(null);
|
|
|
+ if (goodsDesc != null) {
|
|
|
+ map.put("size", goodsDesc.getGoodsSize());
|
|
|
+ } else {
|
|
|
+ map.put("size", "");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ map.put("size", "");
|
|
|
+ }
|
|
|
+ map.put("number", item.getNumber());
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> tyreSaleSizeDetail(String tenantId) {
|
|
|
+ List<PjOrderItems> orderItemsList = orderItemsService.selectOrderItemsList(tenantId, "");
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ if (!orderItemsList.isEmpty()) {
|
|
|
+ List<TyreSaleSize> saleSizeList = new ArrayList<>();
|
|
|
+ List<Long> goodsId = orderItemsList.stream().map(PjOrderItems::getGoodsId).distinct().collect(Collectors.toList());
|
|
|
+ for (Long items : goodsId) {
|
|
|
+ TyreSaleSize detail = new TyreSaleSize();
|
|
|
+ detail.setGoodsId(items);
|
|
|
+ detail.setNumber(orderItemsList.stream().filter(e -> e.getGoodsId().equals(items)).map(PjOrderItems::getGoodsNum)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ saleSizeList.add(detail);
|
|
|
+ }
|
|
|
+ List<TyreSaleSize> itemsList = saleSizeList.stream()
|
|
|
+ .sorted(Comparator.comparing(TyreSaleSize::getNumber))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<TyreSaleSize> sizeList = new ArrayList<>();
|
|
|
+ StringBuilder goodsIds = new StringBuilder();
|
|
|
+ for (int i = 0; i <= 4; i++) {
|
|
|
+ goodsIds.append(itemsList.get(i).getGoodsId()).append(",");
|
|
|
+ sizeList.add(itemsList.get(i));
|
|
|
+ }
|
|
|
+ List<PjGoodsDesc> goodsDescList = goodsDescService.selectGoodsList(tenantId, goodsIds.toString());
|
|
|
+ for (TyreSaleSize item : sizeList) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (!goodsDescList.isEmpty()) {
|
|
|
+ PjGoodsDesc goodsDesc = goodsDescList.stream().filter(e -> e.getId().equals(item.getGoodsId())).findFirst().orElse(null);
|
|
|
+ if (goodsDesc != null) {
|
|
|
+ map.put("size", goodsDesc.getGoodsSize());
|
|
|
+ } else {
|
|
|
+ map.put("size", "");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ map.put("size", "");
|
|
|
+ }
|
|
|
+ map.put("number", item.getNumber());
|
|
|
+ BigDecimal sumNumber = orderItemsList.stream().map(PjOrderItems::getGoodsNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if (new BigDecimal("0.00").compareTo(sumNumber) != 0) {
|
|
|
+ map.put("proportion", item.getNumber().divide(sumNumber, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
|
|
+ } else {
|
|
|
+ map.put("proportion", new BigDecimal("0"));
|
|
|
+ }
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> tyreBrandSalesVolumeProportion(String tenantId) {
|
|
|
+ List<PjOrderItems> orderItemsList = orderItemsService.selectOrderItemsList(tenantId, "");
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ if (!orderItemsList.isEmpty()) {
|
|
|
+ List<TyreSaleBrand> saleBrandList = new ArrayList<>();
|
|
|
+ List<String> brandsList = orderItemsList.stream().map(PjOrderItems::getBrandName).distinct().collect(Collectors.toList());
|
|
|
+ for (String items : brandsList) {
|
|
|
+ TyreSaleBrand detail = new TyreSaleBrand();
|
|
|
+ detail.setBrand(items);
|
|
|
+ detail.setNumber(orderItemsList.stream().filter(e -> e.getBrandName().equals(items)).map(PjOrderItems::getGoodsNum)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ saleBrandList.add(detail);
|
|
|
+ }
|
|
|
+ List<TyreSaleBrand> itemsList = saleBrandList.stream()
|
|
|
+ .sorted(Comparator.comparing(TyreSaleBrand::getNumber))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<TyreSaleBrand> brandList = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= 4; i++) {
|
|
|
+ brandList.add(itemsList.get(i));
|
|
|
+ }
|
|
|
+ for (TyreSaleBrand item : brandList) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("brand", item.getBrand());
|
|
|
+ map.put("number", item.getNumber());
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> tyreBrandSalesVolumeDetail(String tenantId) {
|
|
|
+ List<PjOrderItems> orderItemsList = orderItemsService.selectOrderItemsList(tenantId, "");
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ if (!orderItemsList.isEmpty()) {
|
|
|
+ List<TyreSaleBrand> saleBrandList = new ArrayList<>();
|
|
|
+ List<String> brandsList = orderItemsList.stream().map(PjOrderItems::getBrandName).distinct().collect(Collectors.toList());
|
|
|
+ for (String items : brandsList) {
|
|
|
+ TyreSaleBrand detail = new TyreSaleBrand();
|
|
|
+ detail.setBrand(items);
|
|
|
+ detail.setNumber(orderItemsList.stream().filter(e -> e.getBrandName().equals(items)).map(PjOrderItems::getGoodsNum)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ saleBrandList.add(detail);
|
|
|
+ }
|
|
|
+ List<TyreSaleBrand> itemsList = saleBrandList.stream()
|
|
|
+ .sorted(Comparator.comparing(TyreSaleBrand::getNumber))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<TyreSaleBrand> brandList = new ArrayList<>();
|
|
|
+ for (int i = 0; i <= 4; i++) {
|
|
|
+ brandList.add(itemsList.get(i));
|
|
|
+ }
|
|
|
+ for (TyreSaleBrand item : brandList) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("brand", item.getBrand());
|
|
|
+ map.put("number", item.getNumber());
|
|
|
+ BigDecimal sumNumber = orderItemsList.stream().map(PjOrderItems::getGoodsNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if (new BigDecimal("0.00").compareTo(sumNumber) != 0) {
|
|
|
+ map.put("proportion", item.getNumber().divide(sumNumber, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
|
|
+ } else {
|
|
|
+ map.put("proportion", new BigDecimal("0"));
|
|
|
+ }
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> corpMap(String tenantId) {
|
|
|
+ List<PjCorpsDesc> corpsDescList = corpsDescService.selectCorpList(tenantId);
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ if (!corpsDescList.isEmpty()) {
|
|
|
+ for (PjCorpsDesc item : corpsDescList) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (ObjectUtils.isNotNull(item.getLongitude()) && ObjectUtils.isNotNull(item.getDimension())) {
|
|
|
+ map.put("name", item.getCname());
|
|
|
+ map.put("lat", item.getLongitude());
|
|
|
+ map.put("lng", item.getDimension());
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return mapList;
|
|
|
}
|
|
|
}
|