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