forked from luyan/epmet-cloud-lingshan
				
			
				 3 changed files with 148 additions and 12 deletions
			
			
		@ -0,0 +1,136 @@ | 
				
			|||
package com.epmet.controller; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.utils.DateUtils; | 
				
			|||
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.*; | 
				
			|||
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; | 
				
			|||
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; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 原始数据清洗 | 
				
			|||
 * | 
				
			|||
 * @author yinzuomei@elink-cn.com | 
				
			|||
 * @date 2020/9/15 11:06 | 
				
			|||
 */ | 
				
			|||
@RestController | 
				
			|||
@RequestMapping("factorigin") | 
				
			|||
public class FactOriginExtractController { | 
				
			|||
    @Autowired | 
				
			|||
    private FactOriginExtractService factOriginExtractService; | 
				
			|||
    @Autowired | 
				
			|||
    private IssueExtractService issueExtractService; | 
				
			|||
    @Autowired | 
				
			|||
    private FactOriginTopicMainDailyService factOriginTopicMainDailyService; | 
				
			|||
    @Autowired | 
				
			|||
    private ProjectExtractService projectExtractService; | 
				
			|||
    @Autowired | 
				
			|||
    private GroupExtractService groupExtractService; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * desc:抽取业务数据到统计库 | 
				
			|||
     * | 
				
			|||
     * @param extractFormDTO 默认统计前一天 | 
				
			|||
     * @return | 
				
			|||
     */ | 
				
			|||
    @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); | 
				
			|||
                extractFormDTO.setDateId(dateDimId); | 
				
			|||
                factOriginExtractService.extractAll(extractFormDTO); | 
				
			|||
                startDate = DateUtils.addDateDays(DateUtils.stringToDate(extractFormDTO.getStartDate(), "yyyyMMdd"), 1); | 
				
			|||
            } while (endDate.compareTo(startDate) >= 0); | 
				
			|||
        } else { | 
				
			|||
            factOriginExtractService.extractAll(extractFormDTO); | 
				
			|||
        } | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @param extractFormDTO | 
				
			|||
     * @Description 议题抽取(main) | 
				
			|||
     * @author zxc | 
				
			|||
     * @date 2020/9/15 2:02 下午 | 
				
			|||
     */ | 
				
			|||
    @PostMapping("issueextractmain") | 
				
			|||
    public Result issueExtractMain(@RequestBody ExtractFormDTO extractFormDTO) { | 
				
			|||
        ValidatorUtils.validateEntity(extractFormDTO, ExtractFormDTO.ExtractForm.class); | 
				
			|||
        issueExtractService.issueExtractMain(extractFormDTO); | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @param extractFormDTO | 
				
			|||
     * @Description 议题抽取(log) | 
				
			|||
     * @author zxc | 
				
			|||
     * @date 2020/9/16 9:41 上午 | 
				
			|||
     */ | 
				
			|||
    @PostMapping("issueextractlog") | 
				
			|||
    public Result issueExtractLog(@RequestBody ExtractFormDTO extractFormDTO) { | 
				
			|||
        ValidatorUtils.validateEntity(extractFormDTO, ExtractFormDTO.ExtractForm.class); | 
				
			|||
        issueExtractService.issueExtractLog(extractFormDTO); | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @param extractFormDTO | 
				
			|||
     * @return com.epmet.commons.tools.utils.Result | 
				
			|||
     * @author yinzuomei | 
				
			|||
     * @description 话题 (fact_origin_topic_main_daily	话题主表_日统计  fact_origin_topic_log_daily 话题明细_日统计) | 
				
			|||
     * @Date 2020/9/15 13:39 | 
				
			|||
     **/ | 
				
			|||
    @PostMapping("topic") | 
				
			|||
    public Result topicDataCleaning(@RequestBody ExtractFormDTO extractFormDTO) { | 
				
			|||
        if (StringUtils.isNotBlank(extractFormDTO.getCustomerId()) && StringUtils.isNotBlank(extractFormDTO.getDateId())) { | 
				
			|||
            factOriginTopicMainDailyService.topicCleaning(extractFormDTO); | 
				
			|||
        } | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    @PostMapping("project") | 
				
			|||
    public Result projectData(@RequestBody ExtractFormDTO extractFormDTO) { | 
				
			|||
        projectExtractService.saveOriginProjectDaily(extractFormDTO); | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @param param | 
				
			|||
     * @return | 
				
			|||
     * @Description 项目节点历时数据清洗 | 
				
			|||
     * @author wangc | 
				
			|||
     * @date 2020.09.20 16:11 | 
				
			|||
     **/ | 
				
			|||
    @PostMapping("projectorgperiodcleanning") | 
				
			|||
    public Result projectOrgPeriodCleaning(@RequestBody ExtractFormDTO param) { | 
				
			|||
        projectExtractService.extractProjectPeriodData(param); | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @param | 
				
			|||
     * @return | 
				
			|||
     * @Description 小组数据清洗 | 
				
			|||
     * @author wangc | 
				
			|||
     * @date 2020.09.20 16:11 | 
				
			|||
     **/ | 
				
			|||
    @PostMapping("groupdatacleaning") | 
				
			|||
    public Result groupDataCleaning(@RequestBody ExtractFormDTO param) { | 
				
			|||
        groupExtractService.extractGroupData(param); | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
 | 
				
			|||
					Loading…
					
					
				
		Reference in new issue