|
|
@ -1,9 +1,12 @@ |
|
|
|
package com.epmet.controller; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.AgencySubTreeDto; |
|
|
|
import com.epmet.service.StatsDimService; |
|
|
|
import com.epmet.service.stats.*; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
@ -16,6 +19,8 @@ import java.util.List; |
|
|
|
@RequestMapping("dim") |
|
|
|
public class DimController { |
|
|
|
|
|
|
|
Logger logger = LoggerFactory.getLogger(getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private DimDateService dimDateService; |
|
|
|
|
|
|
@ -37,8 +42,82 @@ public class DimController { |
|
|
|
@Autowired |
|
|
|
private DimAgencyService dimAgencyService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 初始化所有维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/all/init") |
|
|
|
public Result initAll() { |
|
|
|
try { |
|
|
|
dimDateService.initDimDate(); |
|
|
|
logger.info("初始化按日维度成功"); |
|
|
|
} catch (Exception e) { |
|
|
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
logger.error(String.format("初始化按日维度失败:%s", errorStackTrace)); |
|
|
|
} |
|
|
|
try { |
|
|
|
statsDimService.initGridDim(); |
|
|
|
logger.info("初始化网格维度成功"); |
|
|
|
} catch (Exception e) { |
|
|
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
logger.error(String.format("初始化网格维度失败:%s", errorStackTrace)); |
|
|
|
} |
|
|
|
try { |
|
|
|
statsDimService.initAgencyDim(); |
|
|
|
logger.info("初始化机关维度成功"); |
|
|
|
} catch (Exception e) { |
|
|
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
logger.error(String.format("初始化机关维度失败:%s", errorStackTrace)); |
|
|
|
} |
|
|
|
try { |
|
|
|
statsDimService.initCustomerDim(); |
|
|
|
logger.info("初始化客户维度成功"); |
|
|
|
} catch (Exception e) { |
|
|
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
logger.error(String.format("初始化客户维度失败:%s", errorStackTrace)); |
|
|
|
} |
|
|
|
try { |
|
|
|
statsDimService.initDepartmentDim(); |
|
|
|
logger.info("初始化部门维度成功"); |
|
|
|
} catch (Exception e) { |
|
|
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
logger.error(String.format("初始化部门维度失败:%s", errorStackTrace)); |
|
|
|
} |
|
|
|
try { |
|
|
|
dimMonthService.initMonthDim(); |
|
|
|
logger.info("初始化按月维度成功"); |
|
|
|
} catch (Exception e) { |
|
|
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
logger.error(String.format("初始化按月维度失败:%s", errorStackTrace)); |
|
|
|
} |
|
|
|
try { |
|
|
|
quarterService.initQuarterDim(); |
|
|
|
logger.info("初始化季度维度成功"); |
|
|
|
} catch (Exception e) { |
|
|
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
logger.error(String.format("初始化季度维度失败:%s", errorStackTrace)); |
|
|
|
} |
|
|
|
try { |
|
|
|
dimYearService.initYearDim(); |
|
|
|
logger.info("初始化年度维度成功"); |
|
|
|
} catch (Exception e) { |
|
|
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
logger.error(String.format("初始化年度维度失败:%s", errorStackTrace)); |
|
|
|
} |
|
|
|
try { |
|
|
|
dimWeekService.initWeekDim(); |
|
|
|
logger.info("初始化按周维度成功"); |
|
|
|
} catch (Exception e) { |
|
|
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
logger.error(String.format("初始化按周维度失败:%s", errorStackTrace)); |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 初始化按日维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/date/init") |
|
|
@ -49,6 +128,7 @@ public class DimController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 初始化网格维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/grid/init") |
|
|
@ -59,6 +139,7 @@ public class DimController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 初始化机关单位维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/agency/init") |
|
|
@ -69,6 +150,7 @@ public class DimController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 客户维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/customer/init") |
|
|
@ -79,6 +161,7 @@ public class DimController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 部门维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/department/init") |
|
|
@ -89,6 +172,7 @@ public class DimController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 月维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/month/init") |
|
|
@ -99,6 +183,7 @@ public class DimController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 季度维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/quarter/init") |
|
|
@ -109,6 +194,7 @@ public class DimController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 年度维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/year/init") |
|
|
@ -119,6 +205,7 @@ public class DimController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 按周维度 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/week/init") |
|
|
@ -128,26 +215,26 @@ public class DimController { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 所有机构 |
|
|
|
* @param |
|
|
|
* @return |
|
|
|
* @Description 所有机构 |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.18 10:34 |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
@GetMapping("allagency") |
|
|
|
public List<AgencySubTreeDto> allAgency(){ |
|
|
|
public List<AgencySubTreeDto> allAgency() { |
|
|
|
return dimAgencyService.getAllAgency(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 顶级机构 |
|
|
|
* @param |
|
|
|
* @return |
|
|
|
* @Description 顶级机构 |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.18 10:34 |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
@GetMapping("topagency") |
|
|
|
public List<AgencySubTreeDto> topAgency(){ |
|
|
|
public List<AgencySubTreeDto> topAgency() { |
|
|
|
return dimAgencyService.getTopAgency(); |
|
|
|
} |
|
|
|
} |
|
|
|