From ba5a9965c582933f1afc51e097d5654cf9ffd124 Mon Sep 17 00:00:00 2001 From: songyunpeng Date: Wed, 28 Oct 2020 10:09:37 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=20=E6=88=91=E8=A6=81?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApiActApplyController.java | 67 ++++++++ .../feign/AppVolunteerRankFeignClient.java | 35 ++++ .../AppVolunteerRankFeignClientFallback.java | 19 +++ .../epdc/service/AppVolunteerRankService.java | 30 +++- .../impl/AppVolunteerRankServiceImpl.java | 45 ++++- .../esua/epdc/activity/ActApplyInfoDTO.java | 157 +++++++++++++++++ .../activity/form/ActApplyInfoFormDTO.java | 126 ++++++++++++++ .../activity/form/ActApplyRecordFormDTO.java | 33 ++++ .../result/ActApplyDetailResultDTO.java | 88 ++++++++++ .../result/ActApplyRecordResultDTO.java | 56 +++++++ .../controller/ActApplyInfoController.java | 158 ++++++++++++++++++ .../modules/activity/dao/ActApplyInfoDao.java | 44 +++++ .../activity/entity/ActApplyInfoEntity.java | 126 ++++++++++++++ .../activity/excel/ActApplyInfoExcel.java | 107 ++++++++++++ .../activity/redis/ActApplyInfoRedis.java | 47 ++++++ .../activity/service/ActApplyInfoService.java | 123 ++++++++++++++ .../service/impl/ActApplyInfoServiceImpl.java | 138 +++++++++++++++ .../mapper/activity/ActApplyInfoDao.xml | 48 ++++++ 18 files changed, 1445 insertions(+), 2 deletions(-) create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiActApplyController.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/ActApplyInfoDTO.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/form/ActApplyInfoFormDTO.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/form/ActApplyRecordFormDTO.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/result/ActApplyDetailResultDTO.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/result/ActApplyRecordResultDTO.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/ActApplyInfoController.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActApplyInfoDao.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActApplyInfoEntity.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/excel/ActApplyInfoExcel.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/redis/ActApplyInfoRedis.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActApplyInfoService.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActApplyInfoServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActApplyInfoDao.xml diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiActApplyController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiActApplyController.java new file mode 100644 index 00000000..a19a951c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiActApplyController.java @@ -0,0 +1,67 @@ +package com.elink.esua.epdc.controller; + +import com.elink.esua.epdc.activity.form.ActApplyInfoFormDTO; +import com.elink.esua.epdc.activity.form.ActApplyRecordFormDTO; +import com.elink.esua.epdc.activity.result.ActApplyDetailResultDTO; +import com.elink.esua.epdc.activity.result.ActApplyRecordResultDTO; +import com.elink.esua.epdc.common.token.dto.TokenDto; +import com.elink.esua.epdc.commons.tools.annotation.LoginUser; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.service.AppVolunteerRankService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * APP爱心排名 + * + * @author wanggongfeng + * @date 2019/12/17 10:30 + */ +@RestController +@RequestMapping("heart/actApply") +public class ApiActApplyController { + + @Autowired + private AppVolunteerRankService appVolunteerRankService; + + /** + * @Description 我要申请 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [dto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @PostMapping("applyAct") + public Result addApply(@LoginUser TokenDto userDetail, @RequestBody ActApplyInfoFormDTO dto){ + ValidatorUtils.validateEntity(dto); + return appVolunteerRankService.addApply(userDetail,dto); + } + /** + * @Description 活动申请记录 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [userId] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @GetMapping("applyRecord") + public Result> applyRecord(@LoginUser TokenDto userDetail,ActApplyRecordFormDTO actApplyRecordFormDTO){ + ValidatorUtils.validateEntity(actApplyRecordFormDTO); + return appVolunteerRankService.applyRecord(userDetail,actApplyRecordFormDTO); + } + /** + * @Description 活动详情 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [id] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @GetMapping("applyActDetail/{id}") + public Result applyActDetail(@PathVariable String id){ + return appVolunteerRankService.applyActDetail(id); + } + + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AppVolunteerRankFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AppVolunteerRankFeignClient.java index be3999ed..a67d7e8b 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AppVolunteerRankFeignClient.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AppVolunteerRankFeignClient.java @@ -1,11 +1,18 @@ package com.elink.esua.epdc.feign; +import com.elink.esua.epdc.activity.form.ActApplyInfoFormDTO; +import com.elink.esua.epdc.activity.form.ActApplyRecordFormDTO; +import com.elink.esua.epdc.activity.result.ActApplyDetailResultDTO; +import com.elink.esua.epdc.activity.result.ActApplyRecordResultDTO; 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 org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -25,4 +32,32 @@ public interface AppVolunteerRankFeignClient { */ @GetMapping("heart/volunteer/leaderboard") Result> leaderboard(); + + /** + * @Description 我要申请 + * @Author songyunpeng + * @Date 2020/10/27 + * @Param [dto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @PostMapping("heart/actapplyinfo/addApply") + Result addApply(@RequestBody ActApplyInfoFormDTO dto); + /** + * @Description 活动申请记录 + * @Author songyunpeng + * @Date 2020/10/27 + * @Param [actApplyRecordFormDTO] + * @return com.elink.esua.epdc.commons.tools.utils.Result> + **/ + @GetMapping("heart/actapplyinfo/applyRecord") + Result> applyRecord(@RequestBody ActApplyRecordFormDTO actApplyRecordFormDTO); + /** + * @Description 活动详情 + * @Author songyunpeng + * @Date 2020/10/27 + * @Param [id] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @GetMapping("heart/actapplyinfo/applyActDetail/{id}") + Result applyActDetail(@PathVariable String id); } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AppVolunteerRankFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AppVolunteerRankFeignClientFallback.java index 831adce1..22307e93 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AppVolunteerRankFeignClientFallback.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AppVolunteerRankFeignClientFallback.java @@ -1,5 +1,9 @@ package com.elink.esua.epdc.feign.fallback; +import com.elink.esua.epdc.activity.form.ActApplyInfoFormDTO; +import com.elink.esua.epdc.activity.form.ActApplyRecordFormDTO; +import com.elink.esua.epdc.activity.result.ActApplyDetailResultDTO; +import com.elink.esua.epdc.activity.result.ActApplyRecordResultDTO; 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; @@ -21,5 +25,20 @@ public class AppVolunteerRankFeignClientFallback implements AppVolunteerRankFeig return ModuleUtils.feignConError(ServiceConstant.EPDC_HEART_SERVER, "leaderboard"); } + @Override + public Result addApply(ActApplyInfoFormDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_HEART_SERVER, "addApply",dto); + } + + @Override + public Result> applyRecord(ActApplyRecordFormDTO actApplyRecordFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_HEART_SERVER, "applyRecord",actApplyRecordFormDTO); + } + + @Override + public Result applyActDetail(String id) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_HEART_SERVER, "applyActDetail",id); + } + } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppVolunteerRankService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppVolunteerRankService.java index 1457bf53..1c52520c 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppVolunteerRankService.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppVolunteerRankService.java @@ -1,5 +1,10 @@ package com.elink.esua.epdc.service; +import com.elink.esua.epdc.activity.form.ActApplyInfoFormDTO; +import com.elink.esua.epdc.activity.form.ActApplyRecordFormDTO; +import com.elink.esua.epdc.activity.result.ActApplyDetailResultDTO; +import com.elink.esua.epdc.activity.result.ActApplyRecordResultDTO; +import com.elink.esua.epdc.common.token.dto.TokenDto; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; @@ -18,5 +23,28 @@ public interface AppVolunteerRankService { */ Result> leaderboard(); - + /** + * @Description 我要申请 + * @Author songyunpeng + * @Date 2020/10/27 + * @Param [dto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + Result addApply(TokenDto tokenDto, ActApplyInfoFormDTO dto); + /** + * @Description 审核记录 + * @Author songyunpeng + * @Date 2020/10/27 + * @Param [actApplyRecordFormDTO] + * @return com.elink.esua.epdc.commons.tools.utils.Result> + **/ + Result> applyRecord(TokenDto userDetail,ActApplyRecordFormDTO actApplyRecordFormDTO); + /** + * @Description 活动详情 + * @Author songyunpeng + * @Date 2020/10/27 + * @Param [id] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + Result applyActDetail(String id); } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppVolunteerRankServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppVolunteerRankServiceImpl.java index 2f501227..0ea50ec1 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppVolunteerRankServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppVolunteerRankServiceImpl.java @@ -1,6 +1,13 @@ package com.elink.esua.epdc.service.impl; +import com.elink.esua.epdc.activity.form.ActApplyInfoFormDTO; +import com.elink.esua.epdc.activity.form.ActApplyRecordFormDTO; +import com.elink.esua.epdc.activity.result.ActApplyDetailResultDTO; +import com.elink.esua.epdc.activity.result.ActApplyRecordResultDTO; +import com.elink.esua.epdc.common.token.dto.TokenDto; import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; +import com.elink.esua.epdc.feign.AdminFeignClient; import com.elink.esua.epdc.feign.AppVolunteerRankFeignClient; import com.elink.esua.epdc.service.AppVolunteerRankService; import com.elink.esua.epdc.volunteer.EpdcVolunteerRankDTO; @@ -21,7 +28,8 @@ public class AppVolunteerRankServiceImpl implements AppVolunteerRankService { @Autowired private AppVolunteerRankFeignClient appVolunteerRankFeignClient; - + @Autowired + private AdminFeignClient adminFeignClient; /** * 获取排行榜 * @Author wanggongfeng @@ -33,4 +41,39 @@ public class AppVolunteerRankServiceImpl implements AppVolunteerRankService { return dataResult; } + @Override + public Result addApply(TokenDto userDetail, ActApplyInfoFormDTO dto) { + if (null == userDetail.getUserId()) { + return new Result().error("获取用户信息失败"); + } + //获取所有上级机构名称和ID拼接 + Result dtoResult = adminFeignClient.getParentAndAllDept(userDetail.getGridId()); + ParentAndAllDeptDTO deptDTO = dtoResult.getData(); + // 父所有部门 + dto.setParentDeptIds(deptDTO.getParentDeptIds()); + dto.setParentDeptNames(deptDTO.getParentDeptNames()); + // 所有部门 + dto.setAllDeptIds(deptDTO.getAllDeptIds()); + dto.setAllDeptNames(deptDTO.getAllDeptNames()); + // 网格 + dto.setGrid(deptDTO.getGrid()); + dto.setGridId(deptDTO.getGridId()); + dto.setApplyUserId(userDetail.getUserId()); + return appVolunteerRankFeignClient.addApply(dto); + } + + @Override + public Result> applyRecord(TokenDto userDetail,ActApplyRecordFormDTO actApplyRecordFormDTO) { + if (null == userDetail.getUserId()) { + return new Result().error("获取用户信息失败"); + } + actApplyRecordFormDTO.setUserId(userDetail.getUserId()); + return appVolunteerRankFeignClient.applyRecord(actApplyRecordFormDTO); + } + + @Override + public Result applyActDetail(String id) { + return appVolunteerRankFeignClient.applyActDetail(id); + } + } diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/ActApplyInfoDTO.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/ActApplyInfoDTO.java new file mode 100644 index 00000000..be3d83aa --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/ActApplyInfoDTO.java @@ -0,0 +1,157 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.activity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 活动申请信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-10-22 + */ +@Data +public class ActApplyInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 申请人ID + */ + private String applyUserId; + + /** + * 志愿服务标题 + */ + private String actTitle; + + /** + * 志愿服务内容 + */ + private String actContent; + + /** + * 地点 + */ + private String actAddress; + + /** + * 活动开始时间 + */ + private Date actStartTime; + + /** + * 活动结束时间 + */ + private Date actEndTime; + + /** + * 需要人数 + */ + private Integer actPeopleNum; + + /** + * 联系人 + */ + private String actContacts; + + /** + * 联系电话 + */ + private String actTel; + + /** + * 活动状态 0:待审核 1:审核通过 2:审核不通过 + */ + private String actStatus; + + /** + * 不通过原因 + */ + private String noPassReason; + + /** + * 申请网格ID + */ + private Long gridId; + + /** + * 网格名 + */ + private String grid; + + /** + * 父所有部门 + */ + private String parentDeptIds; + + /** + * 父所有部门 + */ + private String parentDeptNames; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 删除标识 0:未删除 1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/form/ActApplyInfoFormDTO.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/form/ActApplyInfoFormDTO.java new file mode 100644 index 00000000..4f77d60f --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/form/ActApplyInfoFormDTO.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.activity.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.Date; + + +/** + * 活动申请信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-10-22 + */ +@Data +public class ActApplyInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 申请人ID + */ + private String applyUserId; + + /** + * 志愿服务标题 + */ + @NotBlank(message = "志愿服务标题不能为空") + @Size(min = 0,max = 40,message = "志愿服务标题在40字以内") + private String actTitle; + + /** + * 志愿服务内容 + */ + @NotBlank(message = "志愿服务内容不能为空") + @Size(min = 0,max = 40,message = "志愿服务内容在500字以内") + private String actContent; + + /** + * 地点 + */ + @NotBlank(message = "地点不能为空") + private String actAddress; + + /** + * 活动开始时间 + */ + @NotNull(message = "活动开始时间不能为空") + private Date actStartTime; + + /** + * 活动结束时间 + */ + @NotNull(message = "活动结束时间不能为空") + private Date actEndTime; + + /** + * 需要人数 + */ + @NotNull(message = "需要人数不能为空") + private Integer actPeopleNum; + + /** + * 联系人 + */ + @NotBlank(message = "联系人不能为空") + private String actContacts; + + /** + * 联系电话 + */ + @NotBlank(message = "联系电话不能为空") + @Size(min = 0,max = 20,message = "联系电话在20字以内") + private String actTel; + + /** + * 申请网格ID + */ + private Long gridId; + + /** + * 网格名 + */ + private String grid; + + /** + * 父所有部门 + */ + private String parentDeptIds; + + /** + * 父所有部门 + */ + private String parentDeptNames; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/form/ActApplyRecordFormDTO.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/form/ActApplyRecordFormDTO.java new file mode 100644 index 00000000..8e6d404c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/form/ActApplyRecordFormDTO.java @@ -0,0 +1,33 @@ +package com.elink.esua.epdc.activity.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import java.io.Serializable; + +/** + * 申请记录查询表单 + * + * @author zhangyong + * @since v1.0.0 2020-05-20 + */ +@Data +public class ActApplyRecordFormDTO implements Serializable { + private static final long serialVersionUID = 2379520294973498819L; + /** + * 用户ID + */ + private String userId; + + /** + * 页码 + */ + @Min(value = 1, message = "页码必须大于0") + private Integer pageIndex; + + /** + * 页容量 + */ + @Min(value = 1, message = "页容量必须大于0") + private Integer pageSize; +} diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/result/ActApplyDetailResultDTO.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/result/ActApplyDetailResultDTO.java new file mode 100644 index 00000000..5c8aff08 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/result/ActApplyDetailResultDTO.java @@ -0,0 +1,88 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.activity.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 活动申请信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-10-22 + */ +@Data +public class ActApplyDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 志愿服务标题 + */ + private String actTitle; + + /** + * 志愿服务内容 + */ + private String actContent; + + /** + * 地点 + */ + private String actAddress; + + /** + * 活动开始时间 + */ + private Date actStartTime; + + /** + * 活动结束时间 + */ + private Date actEndTime; + + /** + * 需要人数 + */ + private Integer actPeopleNum; + + /** + * 联系人 + */ + private String actContacts; + + /** + * 联系电话 + */ + private String actTel; + + /** + * 活动状态 0:待审核 1:审核通过 2:审核不通过 + */ + private String actStatus; + + /** + * 不通过原因 + */ + private String noPassReason; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/result/ActApplyRecordResultDTO.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/result/ActApplyRecordResultDTO.java new file mode 100644 index 00000000..b1663f41 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-client/src/main/java/com/elink/esua/epdc/activity/result/ActApplyRecordResultDTO.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.activity.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 活动申请记录结果 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-10-22 + */ +@Data +public class ActApplyRecordResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * ID + */ + private String id; + + /** + * 活动标题 + */ + private String actTitle; + + /** + * 活动申请时间 + */ + private Date createdTime; + + /** + * 审核状态 + */ + private String actStatus; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/ActApplyInfoController.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/ActApplyInfoController.java new file mode 100644 index 00000000..e1b5ec1a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/controller/ActApplyInfoController.java @@ -0,0 +1,158 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.activity.controller; + +import com.elink.esua.epdc.activity.ActApplyInfoDTO; +import com.elink.esua.epdc.activity.form.ActApplyInfoFormDTO; +import com.elink.esua.epdc.activity.form.ActApplyRecordFormDTO; +import com.elink.esua.epdc.activity.result.ActApplyDetailResultDTO; +import com.elink.esua.epdc.activity.result.ActApplyRecordResultDTO; +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.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.DefaultGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.modules.activity.excel.ActApplyInfoExcel; +import com.elink.esua.epdc.modules.activity.service.ActApplyInfoService; +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 2020-10-22 + */ +@RestController +@RequestMapping("actapplyinfo") +public class ActApplyInfoController { + + @Autowired + private ActApplyInfoService actApplyInfoService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = actApplyInfoService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ActApplyInfoDTO data = actApplyInfoService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ActApplyInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + actApplyInfoService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ActApplyInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + actApplyInfoService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + actApplyInfoService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = actApplyInfoService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ActApplyInfoExcel.class); + } + /** + * @Description 审核 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [dto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @PostMapping("review") + public Result reviewApply(@RequestBody ActApplyInfoDTO dto){ + return actApplyInfoService.reviewApply(dto); + } + /** + * @Description 我要申请 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [dto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @PostMapping("addApply") + public Result addApply(@RequestBody ActApplyInfoFormDTO dto){ + return actApplyInfoService.addApply(dto); + } + /** + * @Description 活动申请记录 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [userId] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @GetMapping("applyRecord") + public Result> applyRecord(@RequestBody ActApplyRecordFormDTO actApplyRecordFormDTO){ + return actApplyInfoService.applyRecord(actApplyRecordFormDTO); + } + /** + * @Description 活动详情 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [id] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + @GetMapping("applyActDetail/{id}") + public Result applyActDetail(@PathVariable String id){ + ActApplyDetailResultDTO actApplyDetailResultDTO = ConvertUtils.sourceToTarget(actApplyInfoService.get(id), ActApplyDetailResultDTO.class); + switch(actApplyDetailResultDTO.getActStatus()){ + case "0": + actApplyDetailResultDTO.setActStatus("待审核"); + break; + case "1": + actApplyDetailResultDTO.setActStatus("审核通过"); + break; + case "2": + actApplyDetailResultDTO.setActStatus("审核不通过"); + break; + default: + actApplyDetailResultDTO.setActStatus(""); + break; + } + return new Result().ok(actApplyDetailResultDTO); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActApplyInfoDao.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActApplyInfoDao.java new file mode 100644 index 00000000..9832eb3b --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActApplyInfoDao.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.activity.dao; + +import com.elink.esua.epdc.activity.form.ActApplyRecordFormDTO; +import com.elink.esua.epdc.activity.result.ActApplyRecordResultDTO; +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.modules.activity.entity.ActApplyInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 活动申请信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-10-22 + */ +@Mapper +public interface ActApplyInfoDao extends BaseDao { + /** + * @Description 查询活动申请记录 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [actApplyRecordFormDTO] + * @return java.util.List + **/ + List selectListActApplyRecord(ActApplyRecordFormDTO actApplyRecordFormDTO); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActApplyInfoEntity.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActApplyInfoEntity.java new file mode 100644 index 00000000..2b48c106 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/entity/ActApplyInfoEntity.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.activity.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 2020-10-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_act_apply_info") +public class ActApplyInfoEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 申请人ID + */ + private String applyUserId; + + /** + * 志愿服务标题 + */ + private String actTitle; + + /** + * 志愿服务内容 + */ + private String actContent; + + /** + * 地点 + */ + private String actAddress; + + /** + * 活动开始时间 + */ + private Date actStartTime; + + /** + * 活动结束时间 + */ + private Date actEndTime; + + /** + * 需要人数 + */ + private Integer actPeopleNum; + + /** + * 联系人 + */ + private String actContacts; + + /** + * 联系电话 + */ + private String actTel; + + /** + * 活动状态 0:待审核 1:审核通过 2:审核不通过 + */ + private String actStatus; + + /** + * 不通过原因 + */ + private String noPassReason; + + /** + * 申请网格ID + */ + private Long gridId; + + /** + * 网格名 + */ + private String grid; + + /** + * 父所有部门 + */ + private String parentDeptIds; + + /** + * 父所有部门 + */ + private String parentDeptNames; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/excel/ActApplyInfoExcel.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/excel/ActApplyInfoExcel.java new file mode 100644 index 00000000..c1c82d0c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/excel/ActApplyInfoExcel.java @@ -0,0 +1,107 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.activity.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 活动申请信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-10-22 + */ +@Data +public class ActApplyInfoExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "申请人ID") + private String applyUserId; + + @Excel(name = "志愿服务标题") + private String actTitle; + + @Excel(name = "志愿服务内容") + private String actContent; + + @Excel(name = "地点") + private String actAddress; + + @Excel(name = "活动开始时间") + private Date actStartTime; + + @Excel(name = "活动结束时间") + private Date actEndTime; + + @Excel(name = "需要人数") + private Integer actPeopleNum; + + @Excel(name = "联系人") + private String actContacts; + + @Excel(name = "联系电话") + private String actTel; + + @Excel(name = "活动状态 0:待审核 1:审核通过 2:审核不通过") + private String actStatus; + + @Excel(name = "不通过原因") + private String noPassReason; + + @Excel(name = "申请网格ID") + private String gridId; + + @Excel(name = "网格名") + private String grid; + + @Excel(name = "父所有部门") + private String parentDeptIds; + + @Excel(name = "父所有部门") + private String parentDeptNames; + + @Excel(name = "所有部门ID") + private String allDeptIds; + + @Excel(name = "所有部门名称") + private String allDeptNames; + + @Excel(name = "删除标识 0:未删除 1:已删除") + private String delFlag; + + @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; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/redis/ActApplyInfoRedis.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/redis/ActApplyInfoRedis.java new file mode 100644 index 00000000..0db57ea6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/redis/ActApplyInfoRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.activity.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 2020-10-22 + */ +@Component +public class ActApplyInfoRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActApplyInfoService.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActApplyInfoService.java new file mode 100644 index 00000000..f869a204 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActApplyInfoService.java @@ -0,0 +1,123 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.activity.service; + +import com.elink.esua.epdc.activity.ActApplyInfoDTO; +import com.elink.esua.epdc.activity.form.ActApplyInfoFormDTO; +import com.elink.esua.epdc.activity.form.ActApplyRecordFormDTO; +import com.elink.esua.epdc.activity.result.ActApplyRecordResultDTO; +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.modules.activity.entity.ActApplyInfoEntity; + +import java.util.List; +import java.util.Map; + +/** + * 活动申请信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-10-22 + */ +public interface ActApplyInfoService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-10-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-10-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ActApplyInfoDTO + * @author generator + * @date 2020-10-22 + */ + ActApplyInfoDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-22 + */ + void save(ActApplyInfoDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-22 + */ + void update(ActApplyInfoDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-10-22 + */ + void delete(String[] ids); + /** + * @Description 审核 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [dto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + Result reviewApply(ActApplyInfoDTO dto); + /** + * @Description 我要申请 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [dto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + Result addApply(ActApplyInfoFormDTO dto); + /** + * @Description 活动申请记录 + * @Author songyunpeng + * @Date 2020/10/26 + * @Param [userId] + * @return com.elink.esua.epdc.commons.tools.utils.Result + **/ + Result> applyRecord(ActApplyRecordFormDTO actApplyRecordFormDTO); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActApplyInfoServiceImpl.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActApplyInfoServiceImpl.java new file mode 100644 index 00000000..90a3f3e7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActApplyInfoServiceImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.activity.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.activity.ActApplyInfoDTO; +import com.elink.esua.epdc.activity.form.ActApplyInfoFormDTO; +import com.elink.esua.epdc.activity.form.ActApplyRecordFormDTO; +import com.elink.esua.epdc.activity.result.ActApplyRecordResultDTO; +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.constant.NumConstant; +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.utils.Result; +import com.elink.esua.epdc.modules.activity.dao.ActApplyInfoDao; +import com.elink.esua.epdc.modules.activity.entity.ActApplyInfoEntity; +import com.elink.esua.epdc.modules.activity.redis.ActApplyInfoRedis; +import com.elink.esua.epdc.modules.activity.service.ActApplyInfoService; +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 2020-10-22 + */ +@Service +public class ActApplyInfoServiceImpl extends BaseServiceImpl implements ActApplyInfoService { + + @Autowired + private ActApplyInfoRedis actApplyInfoRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ActApplyInfoDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ActApplyInfoDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ActApplyInfoDTO get(String id) { + ActApplyInfoEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ActApplyInfoDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ActApplyInfoDTO dto) { + ActApplyInfoEntity entity = ConvertUtils.sourceToTarget(dto, ActApplyInfoEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ActApplyInfoDTO dto) { + ActApplyInfoEntity entity = ConvertUtils.sourceToTarget(dto, ActApplyInfoEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result reviewApply(ActApplyInfoDTO dto) { + if("2".equals(dto.getActStatus()) && "".equals(dto.getNoPassReason())){ + return new Result().error("请填写不通过理由!"); + } + ActApplyInfoEntity entity = ConvertUtils.sourceToTarget(dto, ActApplyInfoEntity.class); + updateById(entity); + return new Result(); + } + + @Override + public Result addApply(ActApplyInfoFormDTO dto) { + if(dto.getActStartTime().after(dto.getActEndTime())){ + return new Result().error("开始时间不能大于结束时间"); + } + ActApplyInfoEntity entity = ConvertUtils.sourceToTarget(dto, ActApplyInfoEntity.class); + insert(entity); + return new Result(); + } + + @Override + public Result> applyRecord(ActApplyRecordFormDTO actApplyRecordFormDTO) { + int pageIndex = (actApplyRecordFormDTO.getPageIndex() - NumConstant.ONE) * actApplyRecordFormDTO.getPageSize(); + actApplyRecordFormDTO.setPageIndex(pageIndex); + + List actApplyRecordResultDTOS = this.baseDao.selectListActApplyRecord(actApplyRecordFormDTO); + return new Result>().ok(actApplyRecordResultDTOS); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActApplyInfoDao.xml b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActApplyInfoDao.xml new file mode 100644 index 00000000..d8e32653 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActApplyInfoDao.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From c9d59401a51c8a252c947e57e37133bc56fc9095 Mon Sep 17 00:00:00 2001 From: songyunpeng Date: Wed, 28 Oct 2020 14:40:03 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=20=E6=88=91=E8=A6=81?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=20sql=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/activity/ActApplyInfoDao.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActApplyInfoDao.xml b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActApplyInfoDao.xml index d8e32653..b98434d2 100644 --- a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActApplyInfoDao.xml +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActApplyInfoDao.xml @@ -32,12 +32,7 @@