Browse Source

志愿者模块-张勇

feature/dangjian
zhangyongzhangyong 6 years ago
parent
commit
19e749ceb7
  1. 197
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java
  2. 157
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcVolunteerInfoResultDTO.java
  3. 50
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java
  4. 199
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java
  5. 84
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerInfoDao.java
  6. 157
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerInfoEntity.java
  7. 125
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/VolunteerInfoExcel.java
  8. 47
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/VolunteerInfoRedis.java
  9. 137
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java
  10. 186
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java
  11. 145
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml

197
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 志愿者信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 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;
}

157
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;
}

50
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();
}*/
}

199
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.controller;
import 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<VolunteerInfoDTO> defaultValue(){
// Long userId = SecurityUser.getUserId();
// String id = "2303cb67e81d3163bdb15043baac7e27";
// VolunteerInfoDTO volunteerInfo = volunteerInfoService.get(id);
// if(volunteerInfo == null){ //返回 用户表 数据
// Result<VolunteerInfoDTO> userInfo = volunteerInfoService.getVolunteerUserDefaultValue(id);
// return userInfo;
// }
// return new Result<VolunteerInfoDTO>().ok(volunteerInfo);
// }
/**
* 查询列表数据
* @param params
* @return
*/
@GetMapping("page")
public Result<PageData<VolunteerInfoDTO>> page(@RequestParam Map<String, Object> params){
PageData<VolunteerInfoDTO> page = volunteerInfoService.volunteerInfo(params);
return new Result<PageData<VolunteerInfoDTO>>().ok(page);
}
/**
* 根据志愿者ID查询志愿者 单条详情
* 积分需要连user表查询
* @param id
* @return
*/
@GetMapping("getVolunteerDetail/{id}")
public Result<VolunteerInfoDTO> getVolunteerDetail(@PathVariable("id") String id){
VolunteerInfoDTO data = volunteerInfoService.getVolunteerDetail(id);
return new Result<VolunteerInfoDTO>().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<VolunteerInfoDTO> get(@PathVariable("id") String id){
VolunteerInfoDTO data = volunteerInfoService.get(id);
return new Result<VolunteerInfoDTO>().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<Object,Object> 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<String, Object> params, HttpServletResponse response) throws Exception {
List<VolunteerInfoDTO> list = volunteerInfoService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, VolunteerInfoExcel.class);
}
}

84
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.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<VolunteerInfoEntity> {
/**
* 志愿者申请根据用户表基础信息 赋默认值
* @param id
* @return VolunteerInfoDTO
* @author zy
* @date 2019-12-11
*/
VolunteerInfoDTO getVolunteerUserDefaultValue(String id);
/**
* 根据查询条件返回首页 志愿者信息列表
* @param params
* @return
*/
List<VolunteerInfoDTO> volunteerInfoList(Map<String, Object> params);
/**
* 根据志愿者ID查询志愿者 单条详情
* 积分需要连user表查询
*
* @param id
* @return VolunteerInfoDTO
* @author generator
* @date 2019-12-11
*/
VolunteerInfoDTO getVolunteerDetail(String id);
/**
* 根据查询条件返回首页 志愿者信息列表总数
* @param params
* @return
*/
int volunteerInfoCount(Map<String, Object> params);
/**
* 自定义 志愿者表修改方法
* @param dto
*/
void updateVolunteerInfo(VolunteerInfoDTO dto);
/**
* 向标签表中查询唯一志愿者标签tag_code = volunteer
* @param tagCode
* @return
*/
UserTagDTO volunteerTagQuery(String tagCode);
}

157
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 志愿者信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 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;
}

125
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
* <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.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;
}

47
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
* <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.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;
}
}

137
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
* <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.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<VolunteerInfoEntity> {
/**
* 根据查询条件返回首页 志愿者信息列表,分页
* @param params
* @return
*/
PageData<VolunteerInfoDTO> volunteerInfo(Map<String, Object> params);
/**
* 根据志愿者ID查询志愿者 单条详情
* 积分需要连user表查询
* @param id
* @return VolunteerInfoDTO
* @author generator
* @date 2019-12-11
*/
VolunteerInfoDTO getVolunteerDetail(String id);
/**
* 默认分页
*
* @param params
* @return PageData<VolunteerInfoDTO>
* @author generator
* @date 2019-12-11
*/
PageData<VolunteerInfoDTO> page(Map<String, Object> params);
/**
* 自定义 志愿者表修改方法
* @param dto
*/
void updateVolunteerInfo(VolunteerInfoDTO dto);
/**
* 默认查询
*
* @param params
* @return java.util.List<VolunteerInfoDTO>
* @author generator
* @date 2019-12-11
*/
List<VolunteerInfoDTO> list(Map<String, Object> 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<VolunteerInfoDTO> getVolunteerUserDefaultValue(String id);
/**
* 向标签表中查询唯一志愿者标签tag_code = volunteer
* @param tagCode
* @return
*/
UserTagDTO volunteerTagQuery(String tagCode);
}

186
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.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<VolunteerInfoDao, VolunteerInfoEntity> implements VolunteerInfoService {
@Autowired
private VolunteerInfoRedis volunteerInfoRedis;
@Autowired
private VolunteerInfoDao volunteerInfoDao;
@Autowired
private UserService userService;
/**
* 根据查询条件返回首页 志愿者信息列表
* @param params
* @return
*/
@Override
public PageData<VolunteerInfoDTO> volunteerInfo(Map<String, Object> 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<VolunteerInfoDTO> list = volunteerInfoDao.volunteerInfoList(params);
PageData<VolunteerInfoDTO> pageDate = new PageData<VolunteerInfoDTO>(list,count);
return pageDate;
}
/**
* 根据志愿者ID查询志愿者 单条详情
* 积分需要连user表查询
* @param id
* @return
*/
@Override
public VolunteerInfoDTO getVolunteerDetail(String id) {
return volunteerInfoDao.getVolunteerDetail(id);
}
@Override
public PageData<VolunteerInfoDTO> page(Map<String, Object> params) {
IPage<VolunteerInfoEntity> 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<VolunteerInfoDTO> list(Map<String, Object> params) {
List<VolunteerInfoEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, VolunteerInfoDTO.class);
}
private QueryWrapper<VolunteerInfoEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<VolunteerInfoEntity> 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<VolunteerInfoDTO> getVolunteerUserDefaultValue(String id) {
VolunteerInfoDTO vo = volunteerInfoDao.getVolunteerUserDefaultValue(id);
return new Result<VolunteerInfoDTO>().ok(vo);
}
/**
* 向标签表中查询唯一志愿者标签tag_code = volunteer
* @param tagCode
* @return
*/
@Override
public UserTagDTO volunteerTagQuery(String tagCode) {
return volunteerInfoDao.volunteerTagQuery(tagCode);
}
}

145
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.VolunteerInfoDao">
<resultMap type="com.elink.esua.epdc.entity.VolunteerInfoEntity" id="volunteerInfoMap">
<result property="id" column="ID"/>
<result property="userId" column="USER_ID"/>
<result property="fullName" column="FULL_NAME"/>
<result property="sex" column="SEX"/>
<result property="birthday" column="BIRTHDAY"/>
<result property="mobile" column="MOBILE"/>
<result property="identityNo" column="IDENTITY_NO"/>
<result property="kindnessTime" column="KINDNESS_TIME"/>
<result property="participationNum" column="PARTICIPATION_NUM"/>
<result property="points" column="POINTS"/>
<result property="girdId" column="GIRD_ID"/>
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/>
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/>
<result property="allDeptIds" column="ALL_DEPT_IDS"/>
<result property="allDeptNames" column="ALL_DEPT_NAMES"/>
<result property="road" column="ROAD"/>
<result property="villageName" column="VILLAGE_NAME"/>
<result property="dwellingPlace" column="DWELLING_PLACE"/>
<result property="address" column="ADDRESS"/>
<result property="introduce" column="INTRODUCE"/>
<result property="registTime" column="REGIST_TIME"/>
<result property="auditStatus" column="AUDIT_STATUS"/>
<result property="failureReason" column="FAILURE_REASON"/>
<result property="auditTime" column="AUDIT_TIME"/>
<result property="auditor" column="AUDITOR"/>
<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"/>
</resultMap>
<!--根据查询条件,返回首页 志愿者信息列表-->
<select id="volunteerInfoList" resultType="com.elink.esua.epdc.dto.VolunteerInfoDTO">
SELECT
v.ID id,
v.USER_ID userId,
v.FULL_NAME fullName,
v.SEX sex,
v.BIRTHDAY birthday,
v.MOBILE mobile,
v.IDENTITY_NO identityNo,
v.KINDNESS_TIME kindnessTime,
u.POINTS points,
v.REGIST_TIME registTime,
v.AUDIT_STATUS auditStatus
FROM
epdc_volunteer_info v left join epdc_user u on v.USER_ID = u.ID
where 1=1
<if test="fullName !='' and fullName != null">
and v.FULL_NAME = #{fullName}
</if>
<if test="mobile !='' and mobile != null">
and v.MOBILE = #{mobile}
</if>
<if test="allDeptIds !='' and allDeptIds != null">
and v.ALL_DEPT_IDS like concat('%',#{allDeptIds},'%')
</if>
ORDER BY v.CREATED_TIME DESC
LIMIT #{page},#{limit}
</select>
<select id="volunteerInfoCount" resultType="int">
SELECT
count(1)
FROM
epdc_volunteer_info v left join epdc_user u on v.USER_ID = u.ID
where 1=1
<if test="fullName !='' and fullName != null">
and v.FULL_NAME = #{fullName}
</if>
<if test="mobile !='' and mobile != null">
and v.MOBILE = #{mobile}
</if>
<if test="allDeptIds !='' and allDeptIds != null">
and v.ALL_DEPT_IDS like concat('%',#{allDeptIds},'%')
</if>
</select>
<!--根据志愿者id,查询志愿者 单条详情-->
<select id="getVolunteerDetail" resultType="com.elink.esua.epdc.dto.VolunteerInfoDTO">
SELECT
v.ID id,
v.USER_ID userId,
v.FULL_NAME fullName,
v.SEX sex,
v.BIRTHDAY birthday,
v.MOBILE mobile,
v.IDENTITY_NO identityNo,
v.ADDRESS address,
v.INTRODUCE introduce,
u.POINTS points,
v.REGIST_TIME registTime
FROM
epdc_volunteer_info v left join epdc_user u on v.USER_ID = u.ID
where v.ID = #{id}
</select>
<select id="getVolunteerUserDefaultValue" resultType="com.elink.esua.epdc.dto.VolunteerInfoDTO">
SELECT
eu.ID userId,
eu.REAL_NAME fullName,
eu.MOBILE mobile,
eu.IDENTITY_NO identityNo,
eugr.GRID_ID girdId,
eu.PARENT_DEPT_IDS parentDeptIds,
eu.PARENT_DEPT_NAMES parentDeptNames,
eu.ALL_DEPT_IDS allDeptIds,
eu.ALL_DEPT_NAMES allDeptNames,
eu.ROAD road,
eu.VILLAGE_NAME villageName,
eu.DWELLING_PLACE dwellingPlace,
eu.ADDRESS address
FROM
epdc_user eu
Left Join (select * from epdc_user_grid_relation where USER_ID = #{id} order by UPDATED_TIME desc limit 0,1) eugr
on(eu.id=eugr.USER_ID)
WHERE
eu.ID = #{id}
</select>
<select id="volunteerTagQuery" resultType="com.elink.esua.epdc.dto.UserTagDTO">
select t.id,t.tag_name,t.tag_code
from epdc_user_tag t
where tag_code = #{tagCode} and del_flag = 0
</select>
<update id="updateVolunteerInfo" parameterType="com.elink.esua.epdc.dto.VolunteerInfoDTO">
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}
</update>
</mapper>
Loading…
Cancel
Save