From 19e749ceb7f9c0203a54d1daea66da6ea42b0121 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Mon, 16 Dec 2019 13:41:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=97=E6=84=BF=E8=80=85=E6=A8=A1=E5=9D=97-?= =?UTF-8?q?=E5=BC=A0=E5=8B=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../elink/esua/epdc/dto/VolunteerInfoDTO.java | 197 +++++++++++++++++ .../result/EpdcVolunteerInfoResultDTO.java | 157 ++++++++++++++ .../EpdcAppVolunteerInfoController.java | 50 +++++ .../controller/VolunteerInfoController.java | 199 ++++++++++++++++++ .../elink/esua/epdc/dao/VolunteerInfoDao.java | 84 ++++++++ .../esua/epdc/entity/VolunteerInfoEntity.java | 157 ++++++++++++++ .../esua/epdc/excel/VolunteerInfoExcel.java | 125 +++++++++++ .../esua/epdc/redis/VolunteerInfoRedis.java | 47 +++++ .../epdc/service/VolunteerInfoService.java | 137 ++++++++++++ .../impl/VolunteerInfoServiceImpl.java | 186 ++++++++++++++++ .../resources/mapper/VolunteerInfoDao.xml | 145 +++++++++++++ 11 files changed, 1484 insertions(+) create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcVolunteerInfoResultDTO.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerInfoDao.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerInfoEntity.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/VolunteerInfoExcel.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/VolunteerInfoRedis.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java new file mode 100644 index 000000000..859c18809 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java @@ -0,0 +1,197 @@ +/** + * 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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 志愿者信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-11 + */ +@Data +public class VolunteerInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 用户ID + */ + private String userId; + + /** + * 姓名 + */ + private String fullName; + + /** + * 性别(0-女,1-男) + */ + private String sex; + + /** + * 出生日期 + */ + private Date birthday; + + /** + * 手机号 + */ + private String mobile; + + /** + * 身份证 + */ + private String identityNo; + + /** + * 爱心时长(单位:分钟) + */ + private Integer kindnessTime; + + /** + * 参加活动次数 + */ + private Integer participationNum; + + /** + * 网格ID + */ + private Long girdId; + + /** + * 父所有部门ID + */ + private String parentDeptIds; + + /** + * 父所有部门名称 + */ + private String parentDeptNames; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 所属道路 + */ + private String road; + + /** + * 小区名称 + */ + private String villageName; + + /** + * 住处 + */ + private String dwellingPlace; + + /** + * 居住地址 + */ + private String address; + + /** + * 自我介绍 + */ + private String introduce; + + /** + * 志愿者注册时间 + */ + private Date registTime; + + /** + * 审核状态(0-未审核,1-审核通过,2-审核不通过) + */ + private String auditStatus; + + /** + * 审核不通过的原因 + */ + private String failureReason; + + /** + * 审核时间 + */ + private Date auditTime; + + /** + * 审核人 + */ + private Long auditor; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + //虚字段 + + /** + * 积分,连user表查询 + */ + private int points; + + /** + * 出生日期 + */ + private String birthdayString; + + /** + * 志愿者注册时间 + */ + private String registTimeString; +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcVolunteerInfoResultDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcVolunteerInfoResultDTO.java new file mode 100644 index 000000000..44ab05e2c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcVolunteerInfoResultDTO.java @@ -0,0 +1,157 @@ +package com.elink.esua.epdc.dto.epdc.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class EpdcVolunteerInfoResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 用户ID + */ + private String userId; + + /** + * 姓名 + */ + private String fullName; + + /** + * 性别(0-女,1-男) + */ + private String sex; + + /** + * 出生日期 + */ + private Date birthday; + + /** + * 手机号 + */ + private String mobile; + + /** + * 身份证 + */ + private String identityNo; + + /** + * 爱心时长(单位:分钟) + */ + private Integer kindnessTime; + + /** + * 参加活动次数 + */ + private Integer participationNum; + + + /** + * 网格ID + */ + private Long girdId; + + /** + * 父所有部门ID + */ + private String parentDeptIds; + + /** + * 父所有部门名称 + */ + private String parentDeptNames; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 所属道路 + */ + private String road; + + /** + * 小区名称 + */ + private String villageName; + + /** + * 住处 + */ + private String dwellingPlace; + + /** + * 居住地址 + */ + private String address; + + /** + * 自我介绍 + */ + private String introduce; + + /** + * 志愿者注册时间 + */ + private Date registTime; + + /** + * 审核状态(0-未审核,1-审核通过,2-审核不通过) + */ + private String auditStatus; + + /** + * 审核不通过的原因 + */ + private String failureReason; + + /** + * 审核时间 + */ + private Date auditTime; + + /** + * 审核人 + */ + private Long auditor; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java new file mode 100644 index 000000000..596a0fbfa --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java @@ -0,0 +1,50 @@ +package com.elink.esua.epdc.controller; + +import com.elink.esua.epdc.commons.tools.constant.Constant; +import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +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.dto.VolunteerInfoDTO; +import com.elink.esua.epdc.modules.volunteer.service.VolunteerInfoService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping(Constant.EPDC_APP + "volunteerinfo") +public class EpdcAppVolunteerInfoController { + + @Autowired + private VolunteerInfoService volunteerInfoService; + + // ־Ը ѯǰˣ־Ըߣʶ־Ը֮ǰ޸䣬һ룬 + + // + //http://localhost:9094/epdc-api/heart/volunteerinfo/ + //http://localhost:9094/epdc-api/epdc-app/volunteerinfo/defaultValue + //http://localhost:9094/epdc-api/heart/epdc-app/volunteerinfo/defaultValue + //޸ + + + + + + /* *//*** + * һ + * @param dto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2019/9/26 14:25 + *//* + @PostMapping("save") + public Result save(@RequestBody EpdcUserSaveWxFormIdFormDTO dto) { + //Ч + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + UserWxFormIdDTO userWxFormIdDTO = new UserWxFormIdDTO(); + BeanUtils.copyProperties(dto, userWxFormIdDTO); + userWxFormIdService.save(userWxFormIdDTO); + return new Result(); + }*/ +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java new file mode 100644 index 000000000..ed8b864a2 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java @@ -0,0 +1,199 @@ +/** + * 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.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; +import com.elink.esua.epdc.commons.tools.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.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.UserTagDTO; +import com.elink.esua.epdc.dto.UserTagRelationDTO; +import com.elink.esua.epdc.dto.VolunteerInfoDTO; +import com.elink.esua.epdc.excel.VolunteerInfoExcel; +import com.elink.esua.epdc.modules.volunteer.service.VolunteerInfoService; +import com.elink.esua.epdc.service.UserTagRelationService; +import com.elink.esua.epdc.service.UserTagService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.List; +import java.util.Map; + + +/** + * 志愿者信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-11 + */ +@RestController +@RequestMapping("volunteerinfo") +public class VolunteerInfoController { + + @Autowired + private VolunteerInfoService volunteerInfoService; + + @Autowired + private UserTagService userTagService; //标签表 + + @Autowired + private UserTagRelationService userTagRelationService; //用户标签关系表 + /** + * 新增时 赋默认值 + * 查询到数据 返回的是志愿者表中的基础数据 + * 没查到数据 返回的是用户表中的数据 + * @return + */ +// @PostMapping("/defaultValue") +// public Result defaultValue(){ +// Long userId = SecurityUser.getUserId(); +// String id = "2303cb67e81d3163bdb15043baac7e27"; +// VolunteerInfoDTO volunteerInfo = volunteerInfoService.get(id); +// if(volunteerInfo == null){ //返回 用户表 数据 +// Result userInfo = volunteerInfoService.getVolunteerUserDefaultValue(id); +// return userInfo; +// } +// return new Result().ok(volunteerInfo); +// } + + /** + * 查询列表数据 + * @param params + * @return + */ + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = volunteerInfoService.volunteerInfo(params); + return new Result>().ok(page); + } + + /** + * 根据志愿者ID,查询志愿者 单条详情 + * 积分需要连user表查询 + * @param id + * @return + */ + @GetMapping("getVolunteerDetail/{id}") + public Result getVolunteerDetail(@PathVariable("id") String id){ + VolunteerInfoDTO data = volunteerInfoService.getVolunteerDetail(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody VolunteerInfoDTO dto){ + //效验数据 + //ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + //2019-12-10 09:16:39 +// Long userId = SecurityUser.getUserId(); +// dto.setRegistTime(new Date()); +// dto.setRevision(1); +// dto.setCreatedBy(userId.toString()); +// dto.setCreatedTime(new Date()); +// dto.setUpdatedTime(new Date()); +// dto.setUpdatedBy(userId.toString()); +// volunteerInfoService.save(dto); + return new Result(); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + VolunteerInfoDTO data = volunteerInfoService.get(id); + return new Result().ok(data); + } + + /** + * 志愿者 申请审批 + * 通过 更新user表 和 志愿者表 + * 不通过 更新user表 + * + * 向用户标签表epdc_user_tag 和 用户标签关系表epdc_user_tag_relation 添加用户身份 + * + * 消息进行推送 + * @param dto 志愿者表id,是否通过,审核不通过的原因 + * @return + */ + @PostMapping("volunteerInfoCheck") + public Result volunteerInfoCheck(@RequestBody VolunteerInfoDTO dto){ + Long userId = SecurityUser.getUserId(); + Date date = new Date(); + dto.setAuditor(userId); + dto.setAuditTime(date); + dto.setUpdatedBy(userId.toString()); + dto.setUpdatedTime(date); + //效验数据 + //ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + String auditStatus = dto.getAuditStatus(); //申请是否通过 + if (auditStatus.equals("1")){ //通过 + volunteerInfoService.updateVolunteerInfo(dto);//修改志愿者表 是否通过字段及更新时间 + VolunteerInfoDTO data = volunteerInfoService.get(dto.getId());//查询志愿者表,该志愿者的最新信息 + + //向标签表中,查询唯一志愿者标签:tag_code = volunteer + UserTagDTO userTag = volunteerInfoService.volunteerTagQuery("volunteer"); + UserTagRelationDTO userTagRelationDTO = new UserTagRelationDTO();//添加:用户标签关系表epdc_user_tag_relation + userTagRelationDTO.setUserId(data.getUserId()); + userTagRelationDTO.setTagId(userTag.getId()); + userTagRelationService.save(userTagRelationDTO); + }else if (auditStatus.equals("2")){ //不通过 + volunteerInfoService.updateVolunteerInfo(dto);//修改志愿者表 字段为:审核人 审核时间 审核状态 审核不通过原因 + } + return new Result(); + } + + /** + * 积分调整,对用户表总积分数进行修改 + * 向积分日志表插入积分调整信息 + * @param map 志愿者表id,志愿者用户id,志愿者表总积分,积分日志表积分操作 + * @return + */ + @PostMapping("pointsAdjust") + public Result pointsAdjust(@RequestBody Map map){ + + return new Result(); + } + + //----------------------------------------------------------------------------- + @PutMapping + public Result update(@RequestBody VolunteerInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + volunteerInfoService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + volunteerInfoService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = volunteerInfoService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, VolunteerInfoExcel.class); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerInfoDao.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerInfoDao.java new file mode 100644 index 000000000..15a5f6e88 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerInfoDao.java @@ -0,0 +1,84 @@ +/** + * 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.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.UserTagDTO; +import com.elink.esua.epdc.dto.VolunteerInfoDTO; +import com.elink.esua.epdc.entity.VolunteerInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 志愿者信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-11 + */ +@Mapper +public interface VolunteerInfoDao extends BaseDao { + /** + * 志愿者申请,根据用户表基础信息 赋默认值 + * @param id + * @return VolunteerInfoDTO + * @author zy + * @date 2019-12-11 + */ + VolunteerInfoDTO getVolunteerUserDefaultValue(String id); + + /** + * 根据查询条件,返回首页 志愿者信息列表 + * @param params + * @return + */ + List volunteerInfoList(Map params); + + /** + * 根据志愿者ID,查询志愿者 单条详情 + * 积分需要连user表查询 + * + * @param id + * @return VolunteerInfoDTO + * @author generator + * @date 2019-12-11 + */ + VolunteerInfoDTO getVolunteerDetail(String id); + + /** + * 根据查询条件,返回首页 志愿者信息列表总数 + * @param params + * @return + */ + int volunteerInfoCount(Map params); + + /** + * 自定义 志愿者表修改方法 + * @param dto + */ + void updateVolunteerInfo(VolunteerInfoDTO dto); + + /** + * 向标签表中,查询唯一志愿者标签:tag_code = volunteer + * @param tagCode + * @return + */ + UserTagDTO volunteerTagQuery(String tagCode); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerInfoEntity.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerInfoEntity.java new file mode 100644 index 000000000..cede16abb --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerInfoEntity.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.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 2019-12-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_volunteer_info") +public class VolunteerInfoEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private String userId; + + /** + * 姓名 + */ + private String fullName; + + /** + * 性别(0-女,1-男) + */ + private String sex; + + /** + * 出生日期 + */ + private Date birthday; + + /** + * 手机号 + */ + private String mobile; + + /** + * 身份证 + */ + private String identityNo; + + /** + * 爱心时长(单位:分钟) + */ + private Integer kindnessTime; + + /** + * 参加活动次数 + */ + private Integer participationNum; + + + /** + * 网格ID + */ + private Long girdId; + + /** + * 父所有部门ID + */ + private String parentDeptIds; + + /** + * 父所有部门名称 + */ + private String parentDeptNames; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + + /** + * 所属道路 + */ + private String road; + + /** + * 小区名称 + */ + private String villageName; + + /** + * 住处 + */ + private String dwellingPlace; + + /** + * 居住地址 + */ + private String address; + + /** + * 自我介绍 + */ + private String introduce; + + /** + * 志愿者注册时间 + */ + private Date registTime; + + /** + * 审核状态(0-未审核,1-审核通过,2-审核不通过) + */ + private String auditStatus; + + /** + * 审核不通过的原因 + */ + private String failureReason; + + /** + * 审核时间 + */ + private Date auditTime; + + /** + * 审核人 + */ + private Long auditor; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/VolunteerInfoExcel.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/VolunteerInfoExcel.java new file mode 100644 index 000000000..1e8ade20c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/VolunteerInfoExcel.java @@ -0,0 +1,125 @@ +/** + * 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.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 2019-12-11 + */ +@Data +public class VolunteerInfoExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "用户ID") + private String userId; + + @Excel(name = "姓名") + private String fullName; + + @Excel(name = "性别(0-女,1-男)") + private String sex; + + @Excel(name = "出生日期") + private Date birthday; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "身份证") + private String identityNo; + + @Excel(name = "爱心时长(单位:分钟)") + private Integer kindnessTime; + + @Excel(name = "参加活动次数") + private Integer participationNum; + + @Excel(name = "积分") + private Integer points; + + @Excel(name = "网格ID") + private Long girdId; + + @Excel(name = "父所有部门ID") + private String parentDeptIds; + + @Excel(name = "父所有部门名称") + private String parentDeptNames; + + @Excel(name = "所有部门ID") + private String allDeptIds; + + @Excel(name = "所有部门名称") + private String allDeptNames; + + @Excel(name = "所属道路") + private String road; + + @Excel(name = "小区名称") + private String villageName; + + @Excel(name = "住处") + private String dwellingPlace; + + @Excel(name = "居住地址") + private String address; + + @Excel(name = "自我介绍") + private String introduce; + + @Excel(name = "志愿者注册时间") + private Date registTime; + + @Excel(name = "审核状态(0-未审核,1-审核通过,2-审核不通过)") + private String auditStatus; + + @Excel(name = "审核不通过的原因") + private String failureReason; + + @Excel(name = "审核时间") + private Date auditTime; + + @Excel(name = "审核人") + private Long auditor; + + @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-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/VolunteerInfoRedis.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/VolunteerInfoRedis.java new file mode 100644 index 000000000..1c5d99cf0 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/VolunteerInfoRedis.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.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-11 + */ +@Component +public class VolunteerInfoRedis { + @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-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java new file mode 100644 index 000000000..0f2369cf1 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java @@ -0,0 +1,137 @@ +/** + * 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.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.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.UserTagDTO; +import com.elink.esua.epdc.dto.VolunteerInfoDTO; +import com.elink.esua.epdc.entity.VolunteerInfoEntity; + +import java.util.List; +import java.util.Map; + +/** + * 志愿者信息表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-12-11 + */ +public interface VolunteerInfoService extends BaseService { + + /** + * 根据查询条件,返回首页 志愿者信息列表,分页 + * @param params + * @return + */ + PageData volunteerInfo(Map params); + + /** + * 根据志愿者ID,查询志愿者 单条详情 + * 积分需要连user表查询 + * @param id + * @return VolunteerInfoDTO + * @author generator + * @date 2019-12-11 + */ + VolunteerInfoDTO getVolunteerDetail(String id); + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2019-12-11 + */ + PageData page(Map params); + + /** + * 自定义 志愿者表修改方法 + * @param dto + */ + void updateVolunteerInfo(VolunteerInfoDTO dto); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2019-12-11 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return VolunteerInfoDTO + * @author generator + * @date 2019-12-11 + */ + VolunteerInfoDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2019-12-11 + */ + void save(VolunteerInfoDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2019-12-11 + */ + void update(VolunteerInfoDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2019-12-11 + */ + void delete(String[] ids); + + + /** + * 志愿者申请,根据用户表基础信息 赋默认值 + * @param id + * @return VolunteerInfoDTO + * @author zy + * @date 2019-12-11 + */ + Result getVolunteerUserDefaultValue(String id); + + /** + * 向标签表中,查询唯一志愿者标签:tag_code = volunteer + * @param tagCode + * @return + */ + UserTagDTO volunteerTagQuery(String tagCode); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java new file mode 100644 index 000000000..9000da714 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java @@ -0,0 +1,186 @@ +/** + * 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.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.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.commons.tools.utils.Result; +import com.elink.esua.epdc.dao.VolunteerInfoDao; +import com.elink.esua.epdc.dto.UserTagDTO; +import com.elink.esua.epdc.dto.VolunteerInfoDTO; +import com.elink.esua.epdc.entity.VolunteerInfoEntity; +import com.elink.esua.epdc.modules.volunteer.service.VolunteerInfoService; +import com.elink.esua.epdc.redis.VolunteerInfoRedis; +import com.elink.esua.epdc.service.UserService; +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-11 + */ +@Service +public class VolunteerInfoServiceImpl extends BaseServiceImpl implements VolunteerInfoService { + + @Autowired + private VolunteerInfoRedis volunteerInfoRedis; + + @Autowired + private VolunteerInfoDao volunteerInfoDao; + + @Autowired + private UserService userService; + + /** + * 根据查询条件,返回首页 志愿者信息列表 + * @param params + * @return + */ + @Override + public PageData volunteerInfo(Map params) { + Integer page = Integer.parseInt(params.get("page").toString()); + Integer limit = Integer.parseInt(params.get("limit").toString()); + String allDeptIds = ""; + if (params.get("streetId") != "" && params.get("streetId") != null){ + allDeptIds = params.get("streetId").toString(); //查询条件 街道 + } + if (params.get("communityId") != "" && params.get("communityId") != null){ + allDeptIds = params.get("communityId").toString(); //查询条件 社区 + } + if (params.get("gridId") != "" && params.get("gridId") != null){ + allDeptIds = params.get("gridId").toString(); //查询条件 网格 + } + params.put("page",page - 1); + params.put("limit",limit); + params.put("allDeptIds",allDeptIds); + int count = volunteerInfoDao.volunteerInfoCount(params); + List list = volunteerInfoDao.volunteerInfoList(params); + PageData pageDate = new PageData(list,count); + return pageDate; + } + + /** + * 根据志愿者ID,查询志愿者 单条详情 + * 积分需要连user表查询 + * @param id + * @return + */ + @Override + public VolunteerInfoDTO getVolunteerDetail(String id) { + return volunteerInfoDao.getVolunteerDetail(id); + } + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, VolunteerInfoDTO.class); + } + + /** + * 自定义 志愿者表修改方法 + * @param dto + */ + @Override + public void updateVolunteerInfo(VolunteerInfoDTO dto) { + volunteerInfoDao.updateVolunteerInfo(dto); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, VolunteerInfoDTO.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 VolunteerInfoDTO get(String id) { + VolunteerInfoEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, VolunteerInfoDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(VolunteerInfoDTO dto) { + VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(VolunteerInfoDTO dto) { + VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 志愿者申请,根据用户表基础信息 赋默认值 + * @param id + * @return VolunteerInfoDTO + * @author zy + * @date 2019-12-11 + */ + @Override + public Result getVolunteerUserDefaultValue(String id) { + VolunteerInfoDTO vo = volunteerInfoDao.getVolunteerUserDefaultValue(id); + return new Result().ok(vo); + } + + /** + * 向标签表中,查询唯一志愿者标签:tag_code = volunteer + * @param tagCode + * @return + */ + @Override + public UserTagDTO volunteerTagQuery(String tagCode) { + return volunteerInfoDao.volunteerTagQuery(tagCode); + } + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml new file mode 100644 index 000000000..1cb028988 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE epdc_volunteer_info + SET + UPDATED_BY = #{updatedBy} + ,UPDATED_TIME = #{updatedTime} + ,AUDIT_STATUS = #{auditStatus} + ,FAILURE_REASON = #{failureReason} + ,AUDIT_TIME = #{auditTime} + ,AUDITOR = #{auditor} + WHERE ID = #{id} + + \ No newline at end of file