77 changed files with 1708 additions and 160 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> |
|||
@ -0,0 +1,25 @@ |
|||
package com.elink.esua.epdc.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.feign.fallback.PointsFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 积分管理模块 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/9/18 15:37 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_POINTS_SERVER, fallback = PointsFeignClientFallback.class) |
|||
public interface PointsFeignClient { |
|||
|
|||
|
|||
@PostMapping(value = "points/pointslogs/deletePointsByReferenceId", consumes = MediaType.APPLICATION_JSON_VALUE) |
|||
Result deletePointsByTopic(List<String> topicIdList); |
|||
|
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package com.elink.esua.epdc.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.PointsLogsBindUnIdDTO; |
|||
import com.elink.esua.epdc.feign.PointsFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/9/18 15:38 |
|||
*/ |
|||
@Component |
|||
public class PointsFeignClientFallback implements PointsFeignClient { |
|||
|
|||
@Override |
|||
public Result deletePointsByTopic(List<String> topicIdList) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_POINTS_SERVER, "deletePointsByTopic", topicIdList); |
|||
} |
|||
} |
|||
@ -0,0 +1,86 @@ |
|||
/** |
|||
* 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; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 志愿者部门管理 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-07-14 |
|||
*/ |
|||
@Data |
|||
public class VolunteerDeptDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 删除标记:0-否,1-是 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 启用标识 0:否,1:是 |
|||
*/ |
|||
private String enableFlag; |
|||
|
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
package com.elink.esua.epdc.dto.epdc.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @Description 根据操作类型更新志愿者积分 入参DTO |
|||
* @Author syp |
|||
* @Date 2019/12/13 13:57 |
|||
*/ |
|||
@Data |
|||
public class EpdcVolunteerPointsFormDTO { |
|||
/** |
|||
* 积分操作类型(加积分、减积分) |
|||
*/ |
|||
@NotBlank(message = "积分操作类型不能为空") |
|||
private String operationType; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
@NotBlank(message = "志愿者id不能为空") |
|||
private String volunteerId; |
|||
|
|||
@NotNull |
|||
/** |
|||
* 积分调整值 |
|||
*/ |
|||
private Integer points; |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
package com.elink.esua.epdc.dto.epdc.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.Size; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author:liuchuang |
|||
* @Date:2021/7/14 14:12 |
|||
*/ |
|||
@Data |
|||
public class VolunteerDeptModifyFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 2545685600843780773L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
@NotBlank(message = "部门名称不能为空") |
|||
@Size(min = 1, max = 100, message = "部门名称不能为空且在100个字以内") |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 启用标识 0:否,1:是 |
|||
*/ |
|||
@NotBlank(message = "启用标识不能为空") |
|||
private String enableFlag; |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
package com.elink.esua.epdc.dto.epdc.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author:liuchuang |
|||
* @Date:2021/7/14 14:32 |
|||
*/ |
|||
@Data |
|||
public class EpdcVolunteerDeptResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 2429674875574207951L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
private String deptName; |
|||
} |
|||
@ -0,0 +1,103 @@ |
|||
/** |
|||
* 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.controller; |
|||
|
|||
import cn.hutool.db.Page; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.dto.VolunteerDeptDTO; |
|||
import com.elink.esua.epdc.dto.VolunteerInfoDTO; |
|||
import com.elink.esua.epdc.dto.epdc.form.VolunteerDeptModifyFormDTO; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcVolunteerDeptResultDTO; |
|||
import com.elink.esua.epdc.service.VolunteerDeptService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 志愿者部门管理 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-07-14 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("volunteerdept") |
|||
public class VolunteerDeptController { |
|||
|
|||
@Autowired |
|||
private VolunteerDeptService volunteerDeptService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<VolunteerDeptDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<VolunteerDeptDTO> page = volunteerDeptService.page(params); |
|||
return new Result<PageData<VolunteerDeptDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<VolunteerDeptDTO> get(@PathVariable("id") String id){ |
|||
VolunteerDeptDTO data = volunteerDeptService.get(id); |
|||
return new Result<VolunteerDeptDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody VolunteerDeptModifyFormDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto); |
|||
volunteerDeptService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody VolunteerDeptModifyFormDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto); |
|||
volunteerDeptService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
volunteerDeptService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
/** |
|||
* 部门列表 |
|||
* |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcVolunteerDeptResultDTO>> |
|||
* @author liuchuang |
|||
* @since 2021/7/14 15:58 |
|||
*/ |
|||
@GetMapping("volunteerdepts") |
|||
public Result<List<EpdcVolunteerDeptResultDTO>> volunteerDepts() { |
|||
List<EpdcVolunteerDeptResultDTO> data = volunteerDeptService.listOfVolunteerDepts(); |
|||
return new Result<List<EpdcVolunteerDeptResultDTO>>().ok(data); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
/** |
|||
* 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.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.dto.VolunteerInfoDTO; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcVolunteerDeptResultDTO; |
|||
import com.elink.esua.epdc.entity.VolunteerDeptEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 志愿者部门管理 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-07-14 |
|||
*/ |
|||
@Mapper |
|||
public interface VolunteerDeptDao extends BaseDao<VolunteerDeptEntity> { |
|||
|
|||
/** |
|||
* 志愿者部门列表 |
|||
* |
|||
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcVolunteerDeptResultDTO> |
|||
* @author liuchuang |
|||
* @since 2021/7/14 14:37 |
|||
*/ |
|||
List<EpdcVolunteerDeptResultDTO> selectListOfVolunteerDepts(); |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
/** |
|||
* 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.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 志愿者部门管理 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-07-14 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_volunteer_dept") |
|||
public class VolunteerDeptEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 启用标识 0:否,1:是 |
|||
*/ |
|||
private String enableFlag; |
|||
|
|||
} |
|||
@ -0,0 +1,107 @@ |
|||
/** |
|||
* 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.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.dto.VolunteerDeptDTO; |
|||
import com.elink.esua.epdc.dto.VolunteerInfoDTO; |
|||
import com.elink.esua.epdc.dto.epdc.form.VolunteerDeptModifyFormDTO; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcVolunteerDeptResultDTO; |
|||
import com.elink.esua.epdc.entity.VolunteerDeptEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 志愿者部门管理 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-07-14 |
|||
*/ |
|||
public interface VolunteerDeptService extends BaseService<VolunteerDeptEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<VolunteerDeptDTO> |
|||
* @author generator |
|||
* @date 2021-07-14 |
|||
*/ |
|||
PageData<VolunteerDeptDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<VolunteerDeptDTO> |
|||
* @author generator |
|||
* @date 2021-07-14 |
|||
*/ |
|||
List<VolunteerDeptDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return VolunteerDeptDTO |
|||
* @author generator |
|||
* @date 2021-07-14 |
|||
*/ |
|||
VolunteerDeptDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-07-14 |
|||
*/ |
|||
void save(VolunteerDeptModifyFormDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-07-14 |
|||
*/ |
|||
void update(VolunteerDeptModifyFormDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-07-14 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 志愿者部门列表 |
|||
* |
|||
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcVolunteerDeptResultDTO> |
|||
* @author liuchuang |
|||
* @since 2021/7/14 14:36 |
|||
*/ |
|||
List<EpdcVolunteerDeptResultDTO> listOfVolunteerDepts(); |
|||
} |
|||
@ -0,0 +1,111 @@ |
|||
/** |
|||
* 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.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.dao.VolunteerDeptDao; |
|||
import com.elink.esua.epdc.dto.VolunteerDeptDTO; |
|||
import com.elink.esua.epdc.dto.VolunteerInfoDTO; |
|||
import com.elink.esua.epdc.dto.epdc.form.VolunteerDeptModifyFormDTO; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcVolunteerDeptResultDTO; |
|||
import com.elink.esua.epdc.dto.user.result.VolunteerPointsStaticResultDTO; |
|||
import com.elink.esua.epdc.entity.VolunteerDeptEntity; |
|||
import com.elink.esua.epdc.service.VolunteerDeptService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 志愿者部门管理 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-07-14 |
|||
*/ |
|||
@Service |
|||
public class VolunteerDeptServiceImpl extends BaseServiceImpl<VolunteerDeptDao, VolunteerDeptEntity> implements VolunteerDeptService { |
|||
|
|||
@Override |
|||
public PageData<VolunteerDeptDTO> page(Map<String, Object> params) { |
|||
IPage<VolunteerDeptEntity> page = baseDao.selectPage( |
|||
getPage(params), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, VolunteerDeptDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<VolunteerDeptDTO> list(Map<String, Object> params) { |
|||
List<VolunteerDeptEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, VolunteerDeptDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<VolunteerDeptEntity> getWrapper(Map<String, Object> params){ |
|||
String deptName = (String)params.get("deptName"); |
|||
|
|||
QueryWrapper<VolunteerDeptEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.like(StringUtils.isNotBlank(deptName), "DEPT_NAME", deptName); |
|||
wrapper.orderByAsc("SORT"); |
|||
wrapper.orderByDesc(FieldConstant.UPDATED_TIME); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public VolunteerDeptDTO get(String id) { |
|||
VolunteerDeptEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, VolunteerDeptDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(VolunteerDeptModifyFormDTO dto) { |
|||
VolunteerDeptEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerDeptEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(VolunteerDeptModifyFormDTO dto) { |
|||
VolunteerDeptEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerDeptEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public List<EpdcVolunteerDeptResultDTO> listOfVolunteerDepts() { |
|||
return baseDao.selectListOfVolunteerDepts(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
<?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.dao.VolunteerDeptDao"> |
|||
|
|||
<select id="selectListOfVolunteerDepts" resultType="com.elink.esua.epdc.dto.epdc.result.EpdcVolunteerDeptResultDTO"> |
|||
SELECT ID, DEPT_NAME FROM epdc_volunteer_dept WHERE DEL_FLAG = '0' AND ENABLE_FLAG = '1' |
|||
</select> |
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue