13 changed files with 475 additions and 5 deletions
@ -0,0 +1,59 @@ |
|||||
|
package com.elink.esua.epdc.dto.user.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author:liuchuang |
||||
|
* @Date:2021/7/15 13:41 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class DeptVolunteerResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 4029749279983587695L; |
||||
|
|
||||
|
/** |
||||
|
* 志愿者ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
private String realName; |
||||
|
|
||||
|
/** |
||||
|
* 身份证 |
||||
|
*/ |
||||
|
private String identityNo; |
||||
|
|
||||
|
/** |
||||
|
* 手机号 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 志愿者标签 |
||||
|
*/ |
||||
|
private String tagName; |
||||
|
|
||||
|
/** |
||||
|
* 志愿者签名 |
||||
|
*/ |
||||
|
private String volunteerSignature; |
||||
|
|
||||
|
/** |
||||
|
* 居住地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 公益积分 |
||||
|
*/ |
||||
|
private Integer volunteerPoints; |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package com.elink.esua.epdc.dto.user.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author:liuchuang |
||||
|
* @Date:2021/7/15 14:45 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class VolunteerPointsRecordsResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -286937478420813680L; |
||||
|
|
||||
|
/** |
||||
|
* 积分记录ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 昵称 |
||||
|
*/ |
||||
|
private String nickname; |
||||
|
|
||||
|
/** |
||||
|
* 活动名称 |
||||
|
*/ |
||||
|
private String actName; |
||||
|
|
||||
|
/** |
||||
|
* 积分记录时间 |
||||
|
*/ |
||||
|
private String operationTime; |
||||
|
|
||||
|
/** |
||||
|
* 积分 |
||||
|
*/ |
||||
|
private Integer volunteerPoints; |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.elink.esua.epdc.dto.user.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author:liuchuang |
||||
|
* @Date:2021/7/14 16:56 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class VolunteerPointsStaticResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 103978565192164909L; |
||||
|
|
||||
|
/** |
||||
|
* 志愿者部门ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 志愿者部门ID |
||||
|
*/ |
||||
|
private String deptName; |
||||
|
|
||||
|
/** |
||||
|
* 志愿者数量 |
||||
|
*/ |
||||
|
private String volunteerNum; |
||||
|
|
||||
|
/** |
||||
|
* 志愿者公益积分总数 |
||||
|
*/ |
||||
|
private String volunteerPoints; |
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package com.elink.esua.epdc.modules.user.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.user.result.DeptVolunteerResultDTO; |
||||
|
import com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO; |
||||
|
import com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO; |
||||
|
import com.elink.esua.epdc.modules.user.service.VolunteerPointsAnalysisService; |
||||
|
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:liuchuang |
||||
|
* @Date:2021/7/14 16:52 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("volunteer") |
||||
|
public class VolunteerPointsAnalysisCotroller { |
||||
|
|
||||
|
@Autowired |
||||
|
VolunteerPointsAnalysisService volunteerPointsAnalysisService; |
||||
|
|
||||
|
/** |
||||
|
* PC端志愿者公益积分管理列表 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO>> |
||||
|
* @author liuchuang |
||||
|
* @since 2021/7/14 17:06 |
||||
|
*/ |
||||
|
@GetMapping("volunteerpointsstatic") |
||||
|
public Result<PageData<VolunteerPointsStaticResultDTO>> volunteerPointsStatic(@RequestParam Map<String, Object> params) { |
||||
|
PageData<VolunteerPointsStaticResultDTO> data = volunteerPointsAnalysisService.volunteerPointsStatic(params); |
||||
|
return new Result<PageData<VolunteerPointsStaticResultDTO>>().ok(data); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 公益积分管理-志愿者列表 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO>> |
||||
|
* @author liuchuang |
||||
|
* @since 2021/7/15 13:35 |
||||
|
*/ |
||||
|
@GetMapping("volunteers") |
||||
|
public Result<PageData<DeptVolunteerResultDTO>> volunteers(@RequestParam Map<String, Object> params) { |
||||
|
PageData<DeptVolunteerResultDTO> data = volunteerPointsAnalysisService.listOfVolunteers(params); |
||||
|
return new Result<PageData<DeptVolunteerResultDTO>>().ok(data); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 公益积分管理-积分记录列表 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO>> |
||||
|
* @author liuchuang |
||||
|
* @since 2021/7/15 13:35 |
||||
|
*/ |
||||
|
@GetMapping("volunteerPointsRecords") |
||||
|
public Result<PageData<VolunteerPointsRecordsResultDTO>> volunteerPointsRecords(@RequestParam Map<String, Object> params) { |
||||
|
PageData<VolunteerPointsRecordsResultDTO> data = volunteerPointsAnalysisService.volunteerPointsRecords(params); |
||||
|
return new Result<PageData<VolunteerPointsRecordsResultDTO>>().ok(data); |
||||
|
} |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.elink.esua.epdc.modules.user.dao; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO; |
||||
|
import com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO; |
||||
|
import com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Author:liuchuang |
||||
|
* @Date:2021/7/14 17:02 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface VolunteerPointsAnalysisDao extends BaseMapper<VolunteerPointsStaticResultDTO> { |
||||
|
|
||||
|
/** |
||||
|
* PC端志愿者公益积分管理列表 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO> |
||||
|
* @author liuchuang |
||||
|
* @since 2021/7/14 17:12 |
||||
|
*/ |
||||
|
List<VolunteerPointsStaticResultDTO> volunteerPointsStatic(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 公益积分管理-志愿者列表 |
||||
|
* |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO> |
||||
|
* @author liuchuang |
||||
|
* @since 2021/7/15 13:38 |
||||
|
*/ |
||||
|
List<DeptVolunteerResultDTO> selectListOfVolunteers(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 公益积分管理-积分记录列表 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO> |
||||
|
* @author liuchuang |
||||
|
* @since 2021/7/15 14:51 |
||||
|
*/ |
||||
|
List<VolunteerPointsRecordsResultDTO> volunteerPointsRecords(Map<String, Object> params); |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package com.elink.esua.epdc.modules.user.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO; |
||||
|
import com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO; |
||||
|
import com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Author:liuchuang |
||||
|
* @Date:2021/7/14 17:00 |
||||
|
*/ |
||||
|
public interface VolunteerPointsAnalysisService { |
||||
|
|
||||
|
/** |
||||
|
* PC端志愿者公益积分管理列表 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO>> |
||||
|
* @author liuchuang |
||||
|
* @since 2021/7/14 17:06 |
||||
|
*/ |
||||
|
PageData<VolunteerPointsStaticResultDTO> volunteerPointsStatic(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 公益积分管理-志愿者列表 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO> |
||||
|
* @author liuchuang |
||||
|
* @since 2021/7/15 13:36 |
||||
|
*/ |
||||
|
PageData<DeptVolunteerResultDTO> listOfVolunteers(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 公益积分管理-积分记录列表 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO> |
||||
|
* @author liuchuang |
||||
|
* @since 2021/7/15 14:48 |
||||
|
*/ |
||||
|
PageData<VolunteerPointsRecordsResultDTO> volunteerPointsRecords(Map<String, Object> params); |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package com.elink.esua.epdc.modules.user.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.dto.user.result.DeptVolunteerResultDTO; |
||||
|
import com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO; |
||||
|
import com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO; |
||||
|
import com.elink.esua.epdc.modules.user.dao.VolunteerPointsAnalysisDao; |
||||
|
import com.elink.esua.epdc.modules.user.service.VolunteerPointsAnalysisService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Author:liuchuang |
||||
|
* @Date:2021/7/14 17:00 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class VolunteerPointsAnalysisServiceImpl extends BaseServiceImpl<VolunteerPointsAnalysisDao, VolunteerPointsStaticResultDTO> implements VolunteerPointsAnalysisService { |
||||
|
|
||||
|
@Override |
||||
|
public PageData<VolunteerPointsStaticResultDTO> volunteerPointsStatic(Map<String, Object> params) { |
||||
|
IPage<VolunteerPointsStaticResultDTO> iPage = this.getPage(params); |
||||
|
List<VolunteerPointsStaticResultDTO> list = baseDao.volunteerPointsStatic(params); |
||||
|
return new PageData<>(list, iPage.getTotal()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageData<DeptVolunteerResultDTO> listOfVolunteers(Map<String, Object> params) { |
||||
|
IPage<DeptVolunteerResultDTO> iPage = this.getPage(params); |
||||
|
List<DeptVolunteerResultDTO> list = baseDao.selectListOfVolunteers(params); |
||||
|
return new PageData<>(list, iPage.getTotal()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageData<VolunteerPointsRecordsResultDTO> volunteerPointsRecords(Map<String, Object> params) { |
||||
|
IPage<VolunteerPointsRecordsResultDTO> iPage = this.getPage(params); |
||||
|
List<VolunteerPointsRecordsResultDTO> list = baseDao.volunteerPointsRecords(params); |
||||
|
return new PageData<>(list, iPage.getTotal()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,124 @@ |
|||||
|
<?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.user.dao.VolunteerPointsAnalysisDao"> |
||||
|
|
||||
|
<select id="volunteerPointsStatic" resultType="com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO"> |
||||
|
SELECT |
||||
|
d.ID, |
||||
|
d.DEPT_NAME, |
||||
|
IFNULL(COUNT( DISTINCT v.ID ), 0) AS volunteerNum, |
||||
|
IFNULL(SUM( l.POINTS ), 0) AS volunteerPoints |
||||
|
FROM |
||||
|
js_esua_epdc_user.epdc_volunteer_dept d |
||||
|
LEFT JOIN js_esua_epdc_user.epdc_volunteer_info v ON v.VOLUNTEER_DEPT_ID = d.ID |
||||
|
AND v.DEL_FLAG = '0' |
||||
|
AND v.AUDIT_STATUS IN ( '0', '1' ) |
||||
|
<if test="startTime != null and startTime != ''"> |
||||
|
and DATE_FORMAT( v.REGIST_TIME, '%Y-%m-%d' ) >=#{startTime} |
||||
|
</if> |
||||
|
<if test="endTime != null and endTime != ''"> |
||||
|
and DATE_FORMAT( v.REGIST_TIME, '%Y-%m-%d' ) <=#{endTime} |
||||
|
</if> |
||||
|
LEFT JOIN js_esua_epdc_points.epdc_points_logs l ON l.USER_ID = v.USER_ID |
||||
|
AND l.DEL_FLAG = '0' |
||||
|
AND l.BEHAVIOR_CODE = 'join_act' |
||||
|
<if test="startTime != null and startTime != ''"> |
||||
|
and DATE_FORMAT( l.OPERATION_TIME, '%Y-%m-%d' ) >=#{startTime} |
||||
|
</if> |
||||
|
<if test="endTime != null and endTime != ''"> |
||||
|
and DATE_FORMAT( l.OPERATION_TIME, '%Y-%m-%d' ) <=#{endTime} |
||||
|
</if> |
||||
|
WHERE |
||||
|
d.DEL_FLAG = '0' |
||||
|
<if test="id != null and id != ''"> |
||||
|
AND d.ID = #{id} |
||||
|
</if> |
||||
|
GROUP BY |
||||
|
d.ID |
||||
|
ORDER BY |
||||
|
volunteerPoints DESC, |
||||
|
volunteerNum DESC, |
||||
|
d.DEPT_NAME |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectListOfVolunteers" resultType="com.elink.esua.epdc.dto.user.result.DeptVolunteerResultDTO"> |
||||
|
SELECT |
||||
|
tmp.ID, |
||||
|
tmp.USER_ID, |
||||
|
tmp.REAL_NAME, |
||||
|
tmp.IDENTITY_NO, |
||||
|
tmp.MOBILE, |
||||
|
tmp.TAG_NAME, |
||||
|
tmp.VOLUNTEER_SIGNATURE, |
||||
|
tmp.ADDRESS, |
||||
|
IFNULL( SUM( l.POINTS ), 0 ) AS volunteerPoints |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
v.ID, |
||||
|
v.USER_ID, |
||||
|
v.REAL_NAME, |
||||
|
v.IDENTITY_NO, |
||||
|
v.MOBILE, |
||||
|
t.TAG_NAME, |
||||
|
v.VOLUNTEER_SIGNATURE, |
||||
|
v.ADDRESS |
||||
|
FROM |
||||
|
js_esua_epdc_user.epdc_volunteer_info v |
||||
|
LEFT JOIN js_esua_epdc_user.epdc_volunteer_tag_relation r ON r.VOLUNTEER_ID = v.ID |
||||
|
AND r.DEL_FLAG = '0' |
||||
|
LEFT JOIN js_esua_epdc_user.epdc_volunteer_tag t ON t.ID = r.TAG_ID |
||||
|
WHERE |
||||
|
v.DEL_FLAG = '0' |
||||
|
AND v.AUDIT_STATUS IN ( '0', '1' ) |
||||
|
AND v.VOLUNTEER_DEPT_ID = #{volunteerDeptId} |
||||
|
<if test="startTime != null and startTime != ''"> |
||||
|
and DATE_FORMAT( v.REGIST_TIME, '%Y-%m-%d' ) >=#{startTime} |
||||
|
</if> |
||||
|
<if test="endTime != null and endTime != ''"> |
||||
|
and DATE_FORMAT( v.REGIST_TIME, '%Y-%m-%d' ) <=#{endTime} |
||||
|
</if> |
||||
|
) tmp |
||||
|
LEFT JOIN js_esua_epdc_points.epdc_points_logs l ON l.USER_ID = tmp.USER_ID |
||||
|
AND l.DEL_FLAG = '0' |
||||
|
AND l.BEHAVIOR_CODE = 'join_act' |
||||
|
<if test="startTime != null and startTime != ''"> |
||||
|
and DATE_FORMAT( l.OPERATION_TIME, '%Y-%m-%d' ) >=#{startTime} |
||||
|
</if> |
||||
|
<if test="endTime != null and endTime != ''"> |
||||
|
and DATE_FORMAT( l.OPERATION_TIME, '%Y-%m-%d' ) <=#{endTime} |
||||
|
</if> |
||||
|
GROUP BY |
||||
|
tmp.ID |
||||
|
ORDER BY |
||||
|
points DESC |
||||
|
</select> |
||||
|
|
||||
|
<select id="volunteerPointsRecords" resultType="com.elink.esua.epdc.dto.user.result.VolunteerPointsRecordsResultDTO"> |
||||
|
SELECT l.`ID`, |
||||
|
l.`NICKNAME`, |
||||
|
l.`POINTS` AS volunteerPoints, |
||||
|
CASE |
||||
|
WHEN ai.`TITLE` IS NULL or ai.`TITLE` = '' |
||||
|
THEN '人工审核积分' |
||||
|
ELSE ai.`TITLE` |
||||
|
END AS actName, |
||||
|
l.`OPERATION_TIME` |
||||
|
FROM `js_esua_epdc_points`.`epdc_points_logs` l |
||||
|
LEFT JOIN `js_esua_epdc_mutuality`.`epdc_act_user_points_log` aup on aup.`ID`= l.`REFERENCE_ID` |
||||
|
LEFT JOIN `js_esua_epdc_mutuality`.`epdc_act_user_relation` aur on aur.`ID`= aup.`ACT_USER_ID` |
||||
|
LEFT JOIN `js_esua_epdc_mutuality`.`epdc_act_info` ai on ai.`ID`= aur.`ACT_ID` |
||||
|
WHERE l.`DEL_FLAG`= '0' |
||||
|
AND l.`BEHAVIOR_CODE`= 'join_act' |
||||
|
AND l.USER_ID = #{userId} |
||||
|
<if test="startTime != null and startTime != ''"> |
||||
|
and DATE_FORMAT( l.OPERATION_TIME, '%Y-%m-%d' ) >=#{startTime} |
||||
|
</if> |
||||
|
<if test="endTime != null and endTime != ''"> |
||||
|
and DATE_FORMAT( l.OPERATION_TIME, '%Y-%m-%d' ) <=#{endTime} |
||||
|
</if> |
||||
|
ORDER BY l.`OPERATION_TIME` DESC |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue