1919import com .fasterxml .jackson .core .type .TypeReference ;
2020import com .fasterxml .jackson .databind .ObjectMapper ;
2121import com .flowci .core .common .helper .DateHelper ;
22- import com .flowci .core .flow .dao .StatsItemDao ;
22+ import com .flowci .core .flow .dao .MatrixItemDao ;
2323import com .flowci .core .flow .domain .*;
2424import com .flowci .core .flow .event .FlowDeletedEvent ;
2525import com .flowci .core .job .domain .Job ;
@@ -58,7 +58,7 @@ public class MatrixServiceImpl implements MatrixService {
5858 private ObjectMapper objectMapper ;
5959
6060 @ Autowired
61- private StatsItemDao statsItemDao ;
61+ private MatrixItemDao matrixItemDao ;
6262
6363 @ Autowired
6464 private YmlService ymlService ;
@@ -102,7 +102,7 @@ public void onJobStatusChange(JobStatusChangeEvent event) {
102102
103103 @ EventListener
104104 public void onFlowDelete (FlowDeletedEvent event ) {
105- statsItemDao .deleteByFlowId (event .getFlow ().getId ());
105+ matrixItemDao .deleteByFlowId (event .getFlow ().getId ());
106106 }
107107
108108 @ Override
@@ -139,15 +139,20 @@ public List<MatrixItem> list(String flowId, String type, int fromDay, int toDay)
139139 Sort sort = Sort .by (Sort .Direction .ASC , "day" );
140140
141141 if (StringHelper .hasValue (type )) {
142- return statsItemDao .findByFlowIdAndTypeDayBetween (flowId , type , fromDay , toDay , sort );
142+ return matrixItemDao .findByFlowIdAndTypeDayBetween (flowId , type , fromDay , toDay , sort );
143143 }
144144
145- return statsItemDao .findByFlowIdDayBetween (flowId , fromDay , toDay , sort );
145+ return matrixItemDao .findByFlowIdDayBetween (flowId , fromDay , toDay , sort );
146+ }
147+
148+ @ Override
149+ public List <MatrixItem > list (Collection <String > flowIdList , String type , int day ) {
150+ return matrixItemDao .findAllByFlowIdInAndDayAndType (flowIdList , day , type );
146151 }
147152
148153 @ Override
149154 public MatrixItem get (String flowId , String type , int day ) {
150- Optional <MatrixItem > item = statsItemDao .findByFlowIdAndDayAndType (flowId , day , type );
155+ Optional <MatrixItem > item = matrixItemDao .findByFlowIdAndDayAndType (flowId , day , type );
151156 if (item .isPresent ()) {
152157 return item .get ();
153158 }
@@ -168,13 +173,13 @@ public MatrixItem add(String flowId, int day, String type, MatrixCounter counter
168173 dayItem .setTotal (totalItem .getCounter ());
169174 dayItem .setNumOfTotal (totalItem .getNumOfToday ());
170175
171- statsItemDao .saveAll (Arrays .asList (dayItem , totalItem ));
176+ matrixItemDao .saveAll (Arrays .asList (dayItem , totalItem ));
172177 return dayItem ;
173178 }
174179 }
175180
176181 private MatrixItem getItem (String flowId , int day , String type ) {
177- Optional <MatrixItem > optional = statsItemDao .findByFlowIdAndDayAndType (flowId , day , type );
182+ Optional <MatrixItem > optional = matrixItemDao .findByFlowIdAndDayAndType (flowId , day , type );
178183
179184 return optional .orElseGet (() -> new MatrixItem ()
180185 .setDay (day )
0 commit comments