|
|
@ -5,7 +5,6 @@ import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.dto.extract.form.ExtractFormDTO; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.*; |
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
@ -13,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -45,14 +44,12 @@ public class FactOriginExtractController { |
|
|
|
@PostMapping("extractall") |
|
|
|
public Result extractAll(@RequestBody ExtractFormDTO extractFormDTO) { |
|
|
|
if (StringUtils.isNotBlank(extractFormDTO.getStartDate()) && StringUtils.isNotBlank(extractFormDTO.getEndDate())) { |
|
|
|
Date startDate = DateUtils.stringToDate(extractFormDTO.getStartDate(), "yyyyMMdd"); |
|
|
|
Date endDate = DateUtils.stringToDate(extractFormDTO.getEndDate(), "yyyyMMdd"); |
|
|
|
do { |
|
|
|
String dateDimId = DimIdGenerator.getDateDimId(startDate); |
|
|
|
List<String> daysBetween = DateUtils.getDaysBetween(extractFormDTO.getStartDate(), extractFormDTO.getEndDate()); |
|
|
|
for (int i = 0; i < daysBetween.size(); i++) { |
|
|
|
String dateDimId = daysBetween.get(i); |
|
|
|
extractFormDTO.setDateId(dateDimId); |
|
|
|
factOriginExtractService.extractAll(extractFormDTO); |
|
|
|
startDate = DateUtils.addDateDays(DateUtils.stringToDate(extractFormDTO.getStartDate(), "yyyyMMdd"), 1); |
|
|
|
} while (endDate.compareTo(startDate) >= 0); |
|
|
|
} |
|
|
|
} else { |
|
|
|
factOriginExtractService.extractAll(extractFormDTO); |
|
|
|
} |
|
|
|