提交 | 用户 | 时间
|
ed4f78
|
1 |
package com.iailab.module.data.api.plan; |
潘 |
2 |
|
|
3 |
import com.iailab.framework.common.util.object.ConvertUtils; |
a3a072
|
4 |
import com.iailab.module.data.api.plan.dto.ApiPlanDataDTO; |
ed4f78
|
5 |
import com.iailab.module.data.common.ApiDataQueryDTO; |
潘 |
6 |
import com.iailab.module.data.common.ApiDataValueDTO; |
|
7 |
import com.iailab.module.data.plan.item.collection.PlanItemCollector; |
a3a072
|
8 |
import com.iailab.module.data.plan.item.vo.PlanItemDataVO; |
ed4f78
|
9 |
import com.iailab.module.data.plan.item.vo.PlanItemValueVO; |
潘 |
10 |
import org.springframework.beans.factory.annotation.Autowired; |
a3a072
|
11 |
import org.springframework.util.CollectionUtils; |
ed4f78
|
12 |
import org.springframework.validation.annotation.Validated; |
潘 |
13 |
import org.springframework.web.bind.annotation.RestController; |
|
14 |
|
a3a072
|
15 |
import java.util.LinkedHashMap; |
ed4f78
|
16 |
import java.util.List; |
潘 |
17 |
|
|
18 |
/** |
|
19 |
* @author PanZhibao |
|
20 |
* @Description |
|
21 |
* @createTime 2024年11月03日 |
|
22 |
*/ |
|
23 |
@RestController // 提供 RESTful API 接口,给 Feign 调用 |
|
24 |
@Validated |
a3a072
|
25 |
public class PlanItemApiImpl implements PlanItemApi { |
ed4f78
|
26 |
|
潘 |
27 |
@Autowired |
|
28 |
private PlanItemCollector planItemCollector; |
|
29 |
|
|
30 |
public List<ApiDataValueDTO> queryPlanItemHistoryValue(ApiDataQueryDTO dto) { |
|
31 |
List<PlanItemValueVO> list = planItemCollector.queryValue(dto.getItemNo(), dto.getStart(), dto.getEnd()); |
|
32 |
return ConvertUtils.sourceToTarget(list, ApiDataValueDTO.class); |
|
33 |
} |
a3a072
|
34 |
|
潘 |
35 |
public LinkedHashMap<String, List<ApiPlanDataDTO>> queryPlanItemRecordValue(ApiDataQueryDTO dto) { |
|
36 |
LinkedHashMap<String, List<ApiPlanDataDTO>> result = new LinkedHashMap<>(); |
|
37 |
if (CollectionUtils.isEmpty(dto.getItemNos())) { |
|
38 |
return result; |
|
39 |
} |
|
40 |
dto.getItemNos().forEach(item -> { |
|
41 |
List<PlanItemDataVO> list = planItemCollector.getSourceValue(item, dto.getStart(), dto.getEnd()); |
|
42 |
result.put(item, ConvertUtils.sourceToTarget(list, ApiPlanDataDTO.class)); |
|
43 |
}); |
|
44 |
return result; |
|
45 |
} |
|
46 |
|
ed4f78
|
47 |
} |