30 changed files with 978 additions and 89 deletions
@ -0,0 +1,42 @@ |
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.result.EpdcAppVolunteerRankDTO; |
|||
import com.elink.esua.epdc.service.AppVolunteerRankService; |
|||
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; |
|||
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.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* APP爱心排名 |
|||
* |
|||
* @author wanggongfeng |
|||
* @date 2019/12/17 10:30 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("heart/volunteer") |
|||
public class ApiVolunteerRankController { |
|||
|
|||
@Autowired |
|||
private AppVolunteerRankService appVolunteerRankService; |
|||
|
|||
/** |
|||
* 获取排行榜 |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @author wanggongfeng |
|||
* @date 2019/12/13 14:41 |
|||
*/ |
|||
@GetMapping("leaderboard") |
|||
public Result<List<EpdcAppVolunteerRankDTO>> leaderboard() { |
|||
Result<List<EpdcVolunteerRankDTO>> data = appVolunteerRankService.leaderboard(); |
|||
List<EpdcAppVolunteerRankDTO> list2 = ConvertUtils.sourceToTarget(data.getData(), EpdcAppVolunteerRankDTO.class); |
|||
return new Result().ok(list2); |
|||
|
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
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.AppVolunteerRankFeignClientFallback; |
|||
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* 活动报名管理 |
|||
* |
|||
* @Author:wanggongfeng |
|||
* @Date:2019/12/16 17:36 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_HEART_SERVER, fallback = AppVolunteerRankFeignClientFallback.class,url = "http://127.0.0.1:9060") |
|||
public interface AppVolunteerRankFeignClient { |
|||
|
|||
/** |
|||
* 获取排行榜 |
|||
* @return |
|||
*/ |
|||
@GetMapping("heart/volunteer/leaderboard") |
|||
Result<List<EpdcVolunteerRankDTO>> leaderboard(); |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
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.feign.AppVolunteerRankFeignClient; |
|||
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author:wanggongfeng |
|||
* @Date:2019/12/16 15:11 |
|||
*/ |
|||
@Component |
|||
public class AppVolunteerRankFeignClientFallback implements AppVolunteerRankFeignClient { |
|||
|
|||
@Override |
|||
public Result<List<EpdcVolunteerRankDTO>> leaderboard() { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_HEART_SERVER, "leaderboard"); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wanggongfeng |
|||
* @date 2019/12/17 9:50 |
|||
*/ |
|||
public interface AppVolunteerRankService { |
|||
|
|||
/** |
|||
* 获取排行榜 |
|||
* @Author wanggongfeng |
|||
* @return |
|||
*/ |
|||
Result<List<EpdcVolunteerRankDTO>> leaderboard(); |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.feign.AppVolunteerRankFeignClient; |
|||
import com.elink.esua.epdc.service.AppVolunteerRankService; |
|||
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* @author wanggongfeng |
|||
* @date 2019/12/16 17:50 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class AppVolunteerRankServiceImpl implements AppVolunteerRankService { |
|||
|
|||
@Autowired |
|||
private AppVolunteerRankFeignClient appVolunteerRankFeignClient; |
|||
|
|||
/** |
|||
* 获取排行榜 |
|||
* @Author wanggongfeng |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Result<List<EpdcVolunteerRankDTO>> leaderboard() { |
|||
Result<List<EpdcVolunteerRankDTO>> dataResult = appVolunteerRankFeignClient.leaderboard(); |
|||
return dataResult; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,122 @@ |
|||
/** |
|||
* 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.volunteer; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 志愿者排名 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-19 |
|||
*/ |
|||
@Data |
|||
public class VolunteerRankDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 排名 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 志愿者ID |
|||
*/ |
|||
private String volunteerId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String faceImg; |
|||
|
|||
/** |
|||
* 用户名 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 是否党员(0-否,1-是) |
|||
*/ |
|||
private String partyFlag; |
|||
|
|||
/** |
|||
* 爱心时长(单位:小时) |
|||
*/ |
|||
private BigDecimal kindnessTime; |
|||
|
|||
/** |
|||
* 参加次数 |
|||
*/ |
|||
private Integer participationNum; |
|||
|
|||
/** |
|||
* 排行生成日期 |
|||
*/ |
|||
private Date generateDate; |
|||
|
|||
/** |
|||
* 是否显示(0-不显示,1-显示) |
|||
*/ |
|||
private String showFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 删除标志 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
/** |
|||
* 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.volunteer.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.modules.volunteer.service.VolunteerRankService; |
|||
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; |
|||
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.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 志愿者排名接口 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("volunteer") |
|||
public class AppVolunteerRankController { |
|||
|
|||
@Autowired |
|||
private VolunteerRankService volunteerRankService; |
|||
|
|||
/** |
|||
* 获取排行榜 |
|||
* @return |
|||
*/ |
|||
@GetMapping(value="leaderboard") |
|||
public Result<List<EpdcVolunteerRankDTO>> leaderboard() { |
|||
List<EpdcVolunteerRankDTO> list = volunteerRankService.leaderboard(); |
|||
return new Result().ok(list); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
/** |
|||
* 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.volunteer.controller; |
|||
|
|||
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.volunteer.VolunteerRankDTO; |
|||
import com.elink.esua.epdc.modules.volunteer.excel.VolunteerRankExcel; |
|||
import com.elink.esua.epdc.modules.volunteer.service.VolunteerRankService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 志愿者排名 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("volunteerrank") |
|||
public class VolunteerRankController { |
|||
|
|||
@Autowired |
|||
private VolunteerRankService volunteerRankService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<VolunteerRankDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<VolunteerRankDTO> page = volunteerRankService.page(params); |
|||
return new Result<PageData<VolunteerRankDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<VolunteerRankDTO> get(@PathVariable("id") String id){ |
|||
VolunteerRankDTO data = volunteerRankService.get(id); |
|||
return new Result<VolunteerRankDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody VolunteerRankDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
volunteerRankService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody VolunteerRankDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
volunteerRankService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
volunteerRankService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<VolunteerRankDTO> list = volunteerRankService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, VolunteerRankExcel.class); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
/** |
|||
* 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.volunteer.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.modules.volunteer.entity.VolunteerRankEntity; |
|||
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 志愿者排名 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-19 |
|||
*/ |
|||
@Mapper |
|||
public interface VolunteerRankDao extends BaseDao<VolunteerRankEntity> { |
|||
/** |
|||
* 获取排行榜 |
|||
* @Author wanggongfeng |
|||
* @return |
|||
*/ |
|||
List<EpdcVolunteerRankDTO> leaderboard(); |
|||
} |
|||
@ -0,0 +1,92 @@ |
|||
/** |
|||
* 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.volunteer.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 志愿者排名 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_volunteer_rank") |
|||
public class VolunteerRankEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 排名 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 志愿者ID |
|||
*/ |
|||
private String volunteerId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String faceImg; |
|||
|
|||
/** |
|||
* 用户名 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 是否党员(0-否,1-是) |
|||
*/ |
|||
private String partyFlag; |
|||
|
|||
/** |
|||
* 爱心时长(单位:小时) |
|||
*/ |
|||
private BigDecimal kindnessTime; |
|||
|
|||
/** |
|||
* 参加次数 |
|||
*/ |
|||
private Integer participationNum; |
|||
|
|||
/** |
|||
* 排行生成日期 |
|||
*/ |
|||
private Date generateDate; |
|||
|
|||
/** |
|||
* 是否显示(0-不显示,1-显示) |
|||
*/ |
|||
private String showFlag; |
|||
|
|||
} |
|||
@ -0,0 +1,87 @@ |
|||
/** |
|||
* 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.volunteer.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 志愿者排名 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-19 |
|||
*/ |
|||
@Data |
|||
public class VolunteerRankExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "排名") |
|||
private Integer sort; |
|||
|
|||
@Excel(name = "志愿者ID") |
|||
private String volunteerId; |
|||
|
|||
@Excel(name = "用户ID") |
|||
private String userId; |
|||
|
|||
@Excel(name = "头像") |
|||
private String faceImg; |
|||
|
|||
@Excel(name = "用户名") |
|||
private String nickname; |
|||
|
|||
@Excel(name = "是否党员(0-否,1-是)") |
|||
private String partyFlag; |
|||
|
|||
@Excel(name = "爱心时长(单位:小时)") |
|||
private BigDecimal kindnessTime; |
|||
|
|||
@Excel(name = "参加次数") |
|||
private Integer participationNum; |
|||
|
|||
@Excel(name = "排行生成日期") |
|||
private Date generateDate; |
|||
|
|||
@Excel(name = "是否显示(0-不显示,1-显示)") |
|||
private String showFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
@Excel(name = "删除标志") |
|||
private String delFlag; |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
/** |
|||
* 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.volunteer.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 志愿者排名 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-19 |
|||
*/ |
|||
@Component |
|||
public class VolunteerRankRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
|||
@ -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.modules.volunteer.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.modules.volunteer.entity.VolunteerRankEntity; |
|||
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; |
|||
import com.elink.esua.epdc.volunteer.VolunteerRankDTO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 志愿者排名 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-19 |
|||
*/ |
|||
public interface VolunteerRankService extends BaseService<VolunteerRankEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<VolunteerRankDTO> |
|||
* @author generator |
|||
* @date 2019-12-19 |
|||
*/ |
|||
PageData<VolunteerRankDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<VolunteerRankDTO> |
|||
* @author generator |
|||
* @date 2019-12-19 |
|||
*/ |
|||
List<VolunteerRankDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return VolunteerRankDTO |
|||
* @author generator |
|||
* @date 2019-12-19 |
|||
*/ |
|||
VolunteerRankDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-12-19 |
|||
*/ |
|||
void save(VolunteerRankDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-12-19 |
|||
*/ |
|||
void update(VolunteerRankDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-12-19 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 获取排行榜 |
|||
* @Author wanggongfeng |
|||
* @return |
|||
*/ |
|||
List<EpdcVolunteerRankDTO> leaderboard(); |
|||
} |
|||
@ -0,0 +1,116 @@ |
|||
/** |
|||
* 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.volunteer.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.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.modules.volunteer.dao.VolunteerRankDao; |
|||
import com.elink.esua.epdc.modules.volunteer.entity.VolunteerRankEntity; |
|||
import com.elink.esua.epdc.modules.volunteer.redis.VolunteerRankRedis; |
|||
import com.elink.esua.epdc.modules.volunteer.service.VolunteerRankService; |
|||
import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; |
|||
import com.elink.esua.epdc.volunteer.VolunteerRankDTO; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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 2019-12-19 |
|||
*/ |
|||
@Service |
|||
public class VolunteerRankServiceImpl extends BaseServiceImpl<VolunteerRankDao, VolunteerRankEntity> implements VolunteerRankService { |
|||
|
|||
@Autowired |
|||
private VolunteerRankRedis volunteerRankRedis; |
|||
|
|||
@Override |
|||
public PageData<VolunteerRankDTO> page(Map<String, Object> params) { |
|||
IPage<VolunteerRankEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, VolunteerRankDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<VolunteerRankDTO> list(Map<String, Object> params) { |
|||
List<VolunteerRankEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, VolunteerRankDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<VolunteerRankEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<VolunteerRankEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public VolunteerRankDTO get(String id) { |
|||
VolunteerRankEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, VolunteerRankDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(VolunteerRankDTO dto) { |
|||
VolunteerRankEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerRankEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(VolunteerRankDTO dto) { |
|||
VolunteerRankEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerRankEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 获取排行榜 |
|||
* @Author wanggongfeng |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<EpdcVolunteerRankDTO> leaderboard(){ |
|||
List<EpdcVolunteerRankDTO> list = baseDao.leaderboard(); |
|||
return list; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
<?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.volunteer.dao.VolunteerRankDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.volunteer.entity.VolunteerRankEntity" id="volunteerRankMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="sort" column="SORT"/> |
|||
<result property="volunteerId" column="VOLUNTEER_ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="faceImg" column="FACE_IMG"/> |
|||
<result property="nickname" column="NICKNAME"/> |
|||
<result property="partyFlag" column="PARTY_FLAG"/> |
|||
<result property="kindnessTime" column="KINDNESS_TIME"/> |
|||
<result property="participationNum" column="PARTICIPATION_NUM"/> |
|||
<result property="generateDate" column="GENERATE_DATE"/> |
|||
<result property="showFlag" column="SHOW_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
</resultMap> |
|||
|
|||
<select id="leaderboard" resultType="com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO"> |
|||
select NICKNAME,FACE_IMG,PARTY_FLAG,KINDNESS_TIME,PARTICIPATION_NUM,SORT from epdc_volunteer_rank order by sort |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue