提交 | 用户 | 时间
|
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; |
e78121
|
5 |
import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO; |
8bf553
|
6 |
import com.iailab.module.data.api.point.dto.ApiPointDTO; |
ed4f78
|
7 |
import com.iailab.module.data.common.ApiDataQueryDTO; |
潘 |
8 |
import com.iailab.module.data.common.ApiDataValueDTO; |
|
9 |
import com.iailab.module.data.plan.item.collection.PlanItemCollector; |
e78121
|
10 |
import com.iailab.module.data.plan.item.entity.PlanItemEntity; |
潘 |
11 |
import com.iailab.module.data.plan.item.service.PlanItemService; |
a3a072
|
12 |
import com.iailab.module.data.plan.item.vo.PlanItemDataVO; |
ed4f78
|
13 |
import com.iailab.module.data.plan.item.vo.PlanItemValueVO; |
潘 |
14 |
import org.springframework.beans.factory.annotation.Autowired; |
a3a072
|
15 |
import org.springframework.util.CollectionUtils; |
ed4f78
|
16 |
import org.springframework.validation.annotation.Validated; |
e78121
|
17 |
import org.springframework.web.bind.annotation.PathVariable; |
ed4f78
|
18 |
import org.springframework.web.bind.annotation.RestController; |
潘 |
19 |
|
8bf553
|
20 |
import java.util.ArrayList; |
a3a072
|
21 |
import java.util.LinkedHashMap; |
ed4f78
|
22 |
import java.util.List; |
8bf553
|
23 |
import java.util.Set; |
ed4f78
|
24 |
|
潘 |
25 |
/** |
|
26 |
* @author PanZhibao |
|
27 |
* @Description |
|
28 |
* @createTime 2024年11月03日 |
|
29 |
*/ |
|
30 |
@RestController // 提供 RESTful API 接口,给 Feign 调用 |
|
31 |
@Validated |
a3a072
|
32 |
public class PlanItemApiImpl implements PlanItemApi { |
ed4f78
|
33 |
|
潘 |
34 |
@Autowired |
|
35 |
private PlanItemCollector planItemCollector; |
|
36 |
|
e78121
|
37 |
@Autowired |
潘 |
38 |
private PlanItemService planItemService; |
|
39 |
|
|
40 |
@Override |
ed4f78
|
41 |
public List<ApiDataValueDTO> queryPlanItemHistoryValue(ApiDataQueryDTO dto) { |
潘 |
42 |
List<PlanItemValueVO> list = planItemCollector.queryValue(dto.getItemNo(), dto.getStart(), dto.getEnd()); |
|
43 |
return ConvertUtils.sourceToTarget(list, ApiDataValueDTO.class); |
|
44 |
} |
a3a072
|
45 |
|
e78121
|
46 |
@Override |
a3a072
|
47 |
public LinkedHashMap<String, List<ApiPlanDataDTO>> queryPlanItemRecordValue(ApiDataQueryDTO dto) { |
潘 |
48 |
LinkedHashMap<String, List<ApiPlanDataDTO>> result = new LinkedHashMap<>(); |
|
49 |
if (CollectionUtils.isEmpty(dto.getItemNos())) { |
|
50 |
return result; |
|
51 |
} |
|
52 |
dto.getItemNos().forEach(item -> { |
|
53 |
List<PlanItemDataVO> list = planItemCollector.getSourceValue(item, dto.getStart(), dto.getEnd()); |
|
54 |
result.put(item, ConvertUtils.sourceToTarget(list, ApiPlanDataDTO.class)); |
|
55 |
}); |
|
56 |
return result; |
|
57 |
} |
|
58 |
|
e78121
|
59 |
@Override |
潘 |
60 |
public ApiPlanItemDTO getInfoByNo(String itemNo){ |
|
61 |
PlanItemEntity entity = planItemService.getInfoByNo(itemNo); |
|
62 |
return ConvertUtils.sourceToTarget(entity, ApiPlanItemDTO.class); |
|
63 |
} |
|
64 |
|
808189
|
65 |
@Override |
潘 |
66 |
public ApiPlanItemDTO getInfoById(String itemNo){ |
|
67 |
PlanItemEntity entity = planItemService.get(itemNo); |
|
68 |
return ConvertUtils.sourceToTarget(entity, ApiPlanItemDTO.class); |
|
69 |
} |
|
70 |
|
8bf553
|
71 |
@Override |
D |
72 |
public List<ApiPlanItemDTO> getInfoByIds(Set<String> planIds) { |
c9dd12
|
73 |
if (CollectionUtils.isEmpty(planIds)) { |
D |
74 |
return new ArrayList<>(); |
|
75 |
} |
8bf553
|
76 |
List<PlanItemEntity> plans = planItemService.getInfoByIds(planIds); |
D |
77 |
return ConvertUtils.sourceToTarget(plans,ApiPlanItemDTO.class); |
|
78 |
} |
|
79 |
|
ed4f78
|
80 |
} |