添加地纬同步数据近15天
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.StaticsHl;
|
||||
import com.ruoyi.cms.domain.StaticsJob;
|
||||
import com.ruoyi.cms.domain.query.Staticsquery;
|
||||
import com.ruoyi.cms.service.StaticsqueryService;
|
||||
@@ -140,4 +141,16 @@ public class StaticsController extends BaseController {
|
||||
excelUtil.exportEmploymentExcel(response, timeRange, statLabels, statValues, regionList,
|
||||
"岗位归集统计", 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* 为推挤数据统计
|
||||
*/
|
||||
@GetMapping("/getDwgjsjtj")
|
||||
public AjaxResult getDwgjsjtj(Staticsquery staticsquery){
|
||||
if(staticsquery==null){
|
||||
return error("参数为空!");
|
||||
}
|
||||
List<StaticsHl> result = service.getDwgjsjtj(staticsquery);
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统计回流数据
|
||||
*/
|
||||
@Data
|
||||
public class StaticsHl
|
||||
{
|
||||
@ApiModelProperty("时间")
|
||||
private String time;
|
||||
@ApiModelProperty("人员数量")
|
||||
private String rysl;
|
||||
@ApiModelProperty("企业数量")
|
||||
private String qysl;
|
||||
@ApiModelProperty("岗位数量")
|
||||
private String gwsl;
|
||||
}
|
||||
@@ -3,10 +3,12 @@ package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cms.domain.Statics;
|
||||
import com.ruoyi.cms.domain.StaticsHl;
|
||||
import com.ruoyi.cms.domain.StaticsJob;
|
||||
import com.ruoyi.cms.domain.query.Staticsquery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface StaticsMapper extends BaseMapper<Statics>
|
||||
{
|
||||
@@ -14,4 +16,6 @@ public interface StaticsMapper extends BaseMapper<Statics>
|
||||
public StaticsJob qygwtjCount(Staticsquery staticsquery);
|
||||
|
||||
public List<StaticsJob> getGroutCityJobs(Staticsquery staticsquery);
|
||||
|
||||
public List<StaticsHl> getDwgjsjtj(Staticsquery staticsquery);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.StaticsHl;
|
||||
import com.ruoyi.cms.domain.query.Staticsquery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface StaticsqueryService {
|
||||
@@ -29,4 +31,6 @@ public interface StaticsqueryService {
|
||||
Map<String, Object> educationSalary(Staticsquery staticsquery);
|
||||
|
||||
Map<String,Object> qygwtjCount(Staticsquery staticsquery);
|
||||
|
||||
List<StaticsHl> getDwgjsjtj(Staticsquery staticsquery);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.cms.service.impl;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.Statics;
|
||||
import com.ruoyi.cms.domain.StaticsHl;
|
||||
import com.ruoyi.cms.domain.StaticsJob;
|
||||
import com.ruoyi.cms.domain.query.Staticsquery;
|
||||
import com.ruoyi.cms.mapper.StaticsMapper;
|
||||
@@ -564,4 +565,13 @@ public class StaticsqueryServiceImpl extends ServiceImpl<StaticsMapper, Statics>
|
||||
result.put("group",list);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaticsHl> getDwgjsjtj(Staticsquery staticsquery) {
|
||||
//如果时间为空,默认今天
|
||||
if(StringUtils.isBlank(staticsquery.getStartTime())){
|
||||
staticsquery.setStartTime(DateUtils.getDate());
|
||||
}
|
||||
return staticsMapper.getDwgjsjtj(staticsquery);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,4 +102,56 @@
|
||||
ORDER BY bdd.dict_sort
|
||||
</select>
|
||||
|
||||
<select id="getDwgjsjtj" parameterType="com.ruoyi.cms.domain.query.Staticsquery" resultType="com.ruoyi.cms.domain.StaticsHl">
|
||||
WITH params AS (
|
||||
SELECT
|
||||
CAST(#{startTime} AS date) AS target_date,
|
||||
CAST(#{startTime} AS date) - 14 AS s_date,
|
||||
CAST(TO_CHAR(CAST(#{startTime} AS date) - 14, 'YYYYMMDD') AS bigint) AS min_id,
|
||||
CAST(TO_CHAR(CAST(#{startTime} AS date), 'YYYYMMDD') AS bigint) AS max_id
|
||||
),
|
||||
date_range AS (
|
||||
SELECT
|
||||
d.day AS stat_day
|
||||
FROM params p
|
||||
CROSS JOIN generate_series(p.s_date, p.target_date, '1 day') d(day)
|
||||
),
|
||||
user_stats AS (
|
||||
SELECT
|
||||
CAST(DATE_TRUNC('day', create_time) AS date) AS stat_day,
|
||||
COUNT(*) AS user_count
|
||||
FROM app_user
|
||||
WHERE dw_userid IS NOT NULL
|
||||
AND create_time >= (SELECT s_date FROM params)
|
||||
AND create_time < (SELECT target_date FROM params) + 1
|
||||
GROUP BY CAST(DATE_TRUNC('day', create_time) AS date)
|
||||
),
|
||||
job_stats AS (
|
||||
SELECT
|
||||
TO_DATE(CAST(row_id AS TEXT), 'YYYYMMDD') AS stat_day,
|
||||
COUNT(*) AS job_count
|
||||
FROM job
|
||||
WHERE row_id BETWEEN (SELECT min_id FROM params) AND (SELECT max_id FROM params)
|
||||
GROUP BY TO_DATE(CAST(row_id AS TEXT), 'YYYYMMDD')
|
||||
),
|
||||
company_stats AS (
|
||||
SELECT
|
||||
TO_DATE(CAST(user_id AS TEXT), 'YYYYMMDD') AS stat_day,
|
||||
COUNT(*) AS company_count
|
||||
FROM company
|
||||
WHERE user_id BETWEEN (SELECT min_id FROM params) AND (SELECT max_id FROM params)
|
||||
GROUP BY TO_DATE(CAST(user_id AS TEXT), 'YYYYMMDD')
|
||||
)
|
||||
SELECT
|
||||
TO_CHAR(d.stat_day, 'YYYY-MM-DD') AS time,
|
||||
COALESCE(u.user_count, 0) AS rysl,
|
||||
COALESCE(j.job_count, 0) AS gwsl,
|
||||
COALESCE(c.company_count, 0) AS qysl
|
||||
FROM date_range d
|
||||
LEFT JOIN user_stats u ON d.stat_day = u.stat_day
|
||||
LEFT JOIN job_stats j ON d.stat_day = j.stat_day
|
||||
LEFT JOIN company_stats c ON d.stat_day = c.stat_day
|
||||
ORDER BY d.stat_day DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user