|
|
@@ -1,9 +1,20 @@
|
|
|
package com.sckw.report.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.sckw.core.model.constant.Global;
|
|
|
+import com.sckw.core.model.page.PageHelperUtil;
|
|
|
+import com.sckw.core.model.page.PageResult;
|
|
|
+import com.sckw.core.utils.NumberUtils;
|
|
|
+import com.sckw.fleet.api.RemoteFleetService;
|
|
|
import com.sckw.report.model.vo.KwfCapacityVo;
|
|
|
+import com.sckw.system.api.RemoteUserService;
|
|
|
+import com.sckw.system.api.model.dto.res.KwsEnterpriseResDto;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author zk
|
|
|
@@ -13,14 +24,55 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class KwFleetService {
|
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
+ RemoteUserService userService;
|
|
|
+
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
+ RemoteFleetService fleetService;
|
|
|
+
|
|
|
/**
|
|
|
* @param params {page:页数、pageSize:每页条数、。。。}
|
|
|
* @desc 分页查询
|
|
|
* @author zk
|
|
|
* @date 2023/9/1
|
|
|
**/
|
|
|
- public List<KwfCapacityVo> capacity(HashMap params) {
|
|
|
+ public PageResult capacity(HashMap<String, Object> params) {
|
|
|
+ //企业数据查询
|
|
|
+ List<KwfCapacityVo> list = new ArrayList<>();
|
|
|
+ List<Long> entIds = new ArrayList<>();
|
|
|
+ Integer cityCode = NumberUtils.parseIntV1(params.get("cityCode"));
|
|
|
+ List<Integer> entTypes = new ArrayList<>(Arrays.asList(3, 4));
|
|
|
+ Integer page = PageResult.getPage(params);
|
|
|
+ Integer pageSize = PageResult.getPageSize(params);
|
|
|
+ PageResult pageResult = userService.queryEntInfoByCityCodeAndEntTypesWithPage(cityCode, entTypes, page, pageSize);
|
|
|
+ List<KwsEnterpriseResDto> ents = JSON.parseArray(JSON.toJSONString(pageResult.getList()), KwsEnterpriseResDto.class);
|
|
|
+ for (KwsEnterpriseResDto ent:ents) {
|
|
|
+ KwfCapacityVo capacity = new KwfCapacityVo();
|
|
|
+ capacity.setEntId(ent.getId());
|
|
|
+ capacity.setFirmName(ent.getFirmName());
|
|
|
+ capacity.setCityCode(ent.getCityCode());
|
|
|
+ capacity.setCityName(ent.getCityName());
|
|
|
+ capacity.setDetailAddress(ent.getDetailAddress());
|
|
|
+ list.add(capacity);
|
|
|
+ entIds.add(ent.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ //企业运力统计
|
|
|
+ List<Map<String, Object>> statistics = fleetService.capacityStatistics(entIds);
|
|
|
+ Map<Long, Map<String, Object>> entMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
+ for (Map<String, Object> statistic:statistics) {
|
|
|
+ entMap.put(NumberUtils.parseLong(statistic.get("entId")), statistic);
|
|
|
+ }
|
|
|
|
|
|
- return null;
|
|
|
+ //企业运力统计查询
|
|
|
+ for (KwfCapacityVo capacity:list) {
|
|
|
+ Map<String, Object> statistic = entMap.get(capacity.getEntId());
|
|
|
+ capacity.setCapacityTotal(statistic != null ? NumberUtils.parseInt(statistic.get("capacityTotal")) : Global.NUMERICAL_ZERO);
|
|
|
+ capacity.setCapacityAmount(statistic != null ? NumberUtils.parseDouble(statistic.get("capacityAmount")) : Global.NUMERICAL_ZERO);
|
|
|
+ }
|
|
|
+ pageResult.setList(list);
|
|
|
+ /*PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
|
|
|
+ pageResult = PageHelperUtil.getPageResult(new PageInfo<>(list));*/
|
|
|
+ return pageResult;
|
|
|
}
|
|
|
}
|