Compare commits

...

4 Commits

  1. 64
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/points/result/PointDeptStatisticsResultDTO.java
  2. 32
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/points/result/PointsStatisticsListResultDTO.java
  3. 72
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/points/controller/PointsLogsAnalysisController.java
  4. 52
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/points/dao/PointsLogsAnalysisDao.java
  5. 34
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/points/service/PointsLogsAnalysisService.java
  6. 56
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/points/service/impl/PointsLogsAnalysisServiceImpl.java
  7. 2
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/application.yml
  8. 70
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/poins/PointsLogsAnalysisDao.xml

64
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/points/result/PointDeptStatisticsResultDTO.java

@ -0,0 +1,64 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto.points.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zhangyong
* @Date 15:45 2020-09-18
* @Description: 网格/社区 积分部门统计
*/
@Data
public class PointDeptStatisticsResultDTO implements Serializable {
private static final long serialVersionUID = -816829897801616059L;
/**
* 用户积分
*/
private Integer points;
/**
* 用户累计积分
*/
private Integer pointsTotle;
/**
* 父所有部门
*/
private String parentDeptIds;
/**
* 父所有部门
*/
private String parentDeptNames;
/**
* 所有部门ID
*/
private String allDeptIds;
/**
* 所有部门名称
*/
private String allDeptNames;
}

32
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/points/result/PointsStatisticsListResultDTO.java

@ -0,0 +1,32 @@
package com.elink.esua.epdc.dto.points.result;
import lombok.Data;
import java.io.Serializable;
@Data
public class PointsStatisticsListResultDTO implements Serializable {
private static final long serialVersionUID = 8249595537995735691L;
/**
* 总积分
*/
private int allPoints;
/**
* 积分操作类型
*/
private int pointsType;
/**
* 消耗积分
*/
private int residuePoints;
/**
* 操作描述
*/
private String operationDesc;
}

72
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/points/controller/PointsLogsAnalysisController.java

@ -0,0 +1,72 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.points.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.points.result.PointDeptStatisticsResultDTO;
import com.elink.esua.epdc.dto.points.result.PointsStatisticsListResultDTO;
import com.elink.esua.epdc.modules.points.service.PointsLogsAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 积分日志分析
*
* @author yujintao yujintao@elink-cn.com
* @since v1.0.0 2019-09-04
*/
@RestController
@RequestMapping("pointsLogAnalysis")
public class PointsLogsAnalysisController {
@Autowired
private PointsLogsAnalysisService pointsLogsAnalysisService;
/***
* 积分分类统计
* @param params
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.PointsStatisticsListResultDTO>>
* @author qushutong
* @date 2020/7/21 9:22
*/
@GetMapping("/point/pointsTypePage")
public Result<PageData<PointsStatisticsListResultDTO>> pointsTypePage(@RequestParam Map<String, Object> params) {
PageData<PointsStatisticsListResultDTO> list = pointsLogsAnalysisService.pointsTypePage(params);
return new Result<PageData<PointsStatisticsListResultDTO>>().ok(list);
}
/***
* 网格积分排名
* @param params
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.UserPointResultDTO>>
* @author songyunpeng
* @date 2020/8/4 13:44
*/
@GetMapping("/point/pointsDeptPage")
public Result<PageData<PointDeptStatisticsResultDTO>> pointsDeptPage(@RequestParam Map<String, Object> params) {
PageData<PointDeptStatisticsResultDTO> list = pointsLogsAnalysisService.pointsDeptPage(params);
return new Result<PageData<PointDeptStatisticsResultDTO>>().ok(list);
}
}

52
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/points/dao/PointsLogsAnalysisDao.java

@ -0,0 +1,52 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.points.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.points.result.PointDeptStatisticsResultDTO;
import com.elink.esua.epdc.dto.points.result.PointsStatisticsListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author syp
* @Date 2020/2/10 13:43
*/
@Mapper
public interface PointsLogsAnalysisDao extends BaseDao<PointsStatisticsListResultDTO> {
/***
* 积分分类统计
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.result.PointsStatisticsListResultDTO>
* @author qushutong
* @date 2020/7/21 10:37
*/
List<PointsStatisticsListResultDTO> selectPointsTypePage(Map<String, Object> params);
/**
* @Description 积分部门统计
* @Author songyunpeng
* @Date 2021/4/14
* @Param [params]
* @return java.util.List<com.elink.esua.epdc.dto.points.result.PointDeptStatisticsResultDTO>
**/
List<PointDeptStatisticsResultDTO> selectPointsDeptPage(Map<String, Object> params);
}

34
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/points/service/PointsLogsAnalysisService.java

@ -0,0 +1,34 @@
package com.elink.esua.epdc.modules.points.service;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.points.result.PointDeptStatisticsResultDTO;
import com.elink.esua.epdc.dto.points.result.PointsStatisticsListResultDTO;
import java.util.Map;
/**
* 积分日志分析
*
* @Author syp
* @Date 2020/2/10 13:43
*/
public interface PointsLogsAnalysisService {
/***
* 积分分类统计
* @param params
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.result.PointsStatisticsListResultDTO>
* @author qushutong
* @date 2020/7/21 10:36
*/
PageData<PointsStatisticsListResultDTO> pointsTypePage(Map<String, Object> params);
/**
* @Description 网格/社区 积分部门统计 - pc
* @Author songyunpeng
* @Date 2020/12/18
* @Param [params]
* @return java.util.List<com.elink.esua.epdc.dto.points.result.PointDeptStatisticsResultDTO>
**/
PageData<PointDeptStatisticsResultDTO> pointsDeptPage(Map<String, Object> params);
}

56
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/points/service/impl/PointsLogsAnalysisServiceImpl.java

@ -0,0 +1,56 @@
package com.elink.esua.epdc.modules.points.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser;
import com.elink.esua.epdc.commons.tools.security.user.UserDetail;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.datasources.DataSourceNames;
import com.elink.esua.epdc.datasources.annotation.DataSource;
import com.elink.esua.epdc.dto.points.result.PointDeptStatisticsResultDTO;
import com.elink.esua.epdc.dto.points.result.PointsStatisticsListResultDTO;
import com.elink.esua.epdc.modules.points.dao.PointsLogsAnalysisDao;
import com.elink.esua.epdc.modules.points.service.PointsLogsAnalysisService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author syp
* @Date 2020/2/10 13:43
*/
@Service
public class PointsLogsAnalysisServiceImpl extends BaseServiceImpl<PointsLogsAnalysisDao, PointsStatisticsListResultDTO> implements PointsLogsAnalysisService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Override
@DataSource(name = DataSourceNames.TWELVE)
public PageData<PointsStatisticsListResultDTO> pointsTypePage(Map<String, Object> params) {
IPage<PointsStatisticsListResultDTO> page = getPage(params);
List<PointsStatisticsListResultDTO> list = baseDao.selectPointsTypePage(params);
return new PageData(list, page.getTotal());
}
@Override
@DataSource(name = DataSourceNames.TWELVE)
public PageData<PointDeptStatisticsResultDTO> pointsDeptPage(Map<String, Object> params) {
//获取数据权限
UserDetail userDetail = SecurityUser.getUser();
if (null == userDetail.getDeptIdList() || userDetail.getDeptIdList().size() == 0) {
new Result<>().error("暂无权限,请联系管理员");
}
params.put("deptIdList",userDetail.getDeptIdList());
IPage<PointDeptStatisticsResultDTO> page = getPage(params);
List<PointDeptStatisticsResultDTO> list = baseDao.selectPointsDeptPage(params);
return new PageData(list, page.getTotal());
}
}

2
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/application.yml

@ -62,8 +62,6 @@ mybatis-plus:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
epmet:
config:

70
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/poins/PointsLogsAnalysisDao.xml

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.modules.points.dao.PointsLogsAnalysisDao">
<select id="selectPointsTypePage" resultType="com.elink.esua.epdc.dto.points.result.PointsStatisticsListResultDTO">
SELECT
SUM(lg.POINTS) allPoints,
lg.BEHAVIOR_POINTS_TYPE as pointsType,
SUM(
IF( lg.BEHAVIOR_POINTS_TYPE = '0', lg.POINTS, 0 )
) residuePoints,
lg.BEHAVIOR_DESC as operationDesc
FROM
epdc_points_type_statistics lg
WHERE 1=1
<if test="behaviorCode!= null and behaviorCode !=''">
and lg.BEHAVIOR_CODE = #{behaviorCode}
</if>
<if test="startTime!= null and startTime !=''">
and lg.STATISTICS_TIME between #{startTime} AND #{endTime}
</if>
GROUP BY
lg.BEHAVIOR_POINTS_TYPE,lg.BEHAVIOR_CODE
ORDER BY allPoints DESC
</select>
<select id="selectPointsDeptPage"
resultType="com.elink.esua.epdc.dto.points.result.PointDeptStatisticsResultDTO">
select ifnull(sum(POINTS),0) as pointsTotle,
ifnull(sum(POINTS_LEAVE),0) as points,
<choose>
<when test='type != "" and type != null and type=="1"'>
concat(district.NAME, '-', street.NAME, '-', community.NAME, '-', grid.NAME) as ALL_DEPT_NAMES
</when>
<otherwise>
concat(district.NAME, '-', street.NAME, '-', community.NAME) as ALL_DEPT_NAMES
</otherwise>
</choose>
from meta_sys_dept grid
left join meta_sys_dept community
on community.ID = grid.PID and community.DEL_FLAG = '0'
left join meta_sys_dept street
on street.ID = community.PID and street.DEL_FLAG = '0'
left join meta_sys_dept district
on district.ID = street.PID and district.DEL_FLAG = '0'
left join epdc_points_grid_statistics pl on grid.ID = pl.GRID_ID
where pl.GRID_ID is not null and pl.GRID_ID != ''
<if test="startTime != null and startTime != ''">
and DATE_FORMAT( pl.STATISTICS_TIME, '%Y-%m-%d' ) &gt;=#{startTime}
</if>
<if test="endTime != null and endTime != ''">
and DATE_FORMAT( pl.STATISTICS_TIME, '%Y-%m-%d' ) &lt;=#{endTime}
</if>
<if test="deptIdList!=null and deptIdList.size()>0">
and pl.GRID_ID IN
<foreach item="deptIdItem" collection="deptIdList" open="(" separator="," close=")">
#{deptIdItem}
</foreach>
</if>
<choose>
<when test='type != "" and type != null and type=="1"'>
group by grid.ID
</when>
<otherwise>
group by community.ID
</otherwise>
</choose>
ORDER BY points DESC
</select>
</mapper>
Loading…
Cancel
Save