Browse Source

新增志愿者方法修改

feature/dangjian
yujintao 6 years ago
parent
commit
4222586598
  1. 66
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerInfoEntity.java
  2. 41
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java

66
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerInfoEntity.java

@ -19,7 +19,7 @@ package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; import com.elink.esua.epdc.commons.mybatis.entity.DeptScope;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -33,126 +33,106 @@ import java.util.Date;
* @since v1.0.0 2019-12-11 * @since v1.0.0 2019-12-11
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("epdc_volunteer_info") @TableName("epdc_volunteer_info")
public class VolunteerInfoEntity extends BaseEpdcEntity { public class VolunteerInfoEntity extends DeptScope {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = -4777998686764924965L;
/** /**
* 用户ID * 用户ID
*/ */
private String userId; private String userId;
/** /**
* 姓名 * 姓名
*/ */
private String realName; private String realName;
/** /**
* 性别(0-1-) * 性别(0-1-)
*/ */
private String sex; private String sex;
/** /**
* 出生日期 * 出生日期
*/ */
private Date birthday; private Date birthday;
/** /**
* 手机号 * 手机号
*/ */
private String mobile; private String mobile;
/** /**
* 身份证 * 身份证
*/ */
private String identityNo; private String identityNo;
/** /**
* 爱心时长(单位分钟) * 爱心时长(单位分钟)
*/ */
private BigDecimal kindnessTime; private BigDecimal kindnessTime;
/** /**
* 参加活动次数 * 参加活动次数
*/ */
private Integer participationNum; private Integer participationNum;
/** /**
* 网格ID * 网格ID
*/ */
private Long gridId; private Long gridId;
/**
* 父所有部门ID
*/
private String parentDeptIds;
/**
* 父所有部门名称
*/
private String parentDeptNames;
/**
* 所有部门ID
*/
private String allDeptIds;
/**
* 所有部门名称
*/
private String allDeptNames;
/** /**
* 所属道路 * 所属道路
*/ */
private String road; private String road;
/** /**
* 小区名称 * 小区名称
*/ */
private String villageName; private String villageName;
/** /**
* 住处 * 住处
*/ */
private String dwellingPlace; private String dwellingPlace;
/** /**
* 居住地址 * 居住地址
*/ */
private String address; private String address;
/** /**
* 自我介绍 * 自我介绍
*/ */
private String introduce; private String introduce;
/** /**
* 志愿者注册时间 * 志愿者注册时间
*/ */
private Date registTime; private Date registTime;
/** /**
* 审核状态0-未审核1-审核通过2-审核不通过 * 审核状态0-未审核1-审核通过2-审核不通过
*/ */
private String auditStatus; private String auditStatus;
/** /**
* 审核不通过的原因 * 审核不通过的原因
*/ */
private String failureReason; private String failureReason;
/** /**
* 审核时间 * 审核时间
*/ */
private Date auditTime; private Date auditTime;
/** /**
* 审核人 * 审核人
*/ */
private Long auditor; private Long auditor;
} }

41
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java

@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.async.NewsTask; import com.elink.esua.epdc.async.NewsTask;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.mybatis.utils.DeptEntityUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; 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.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.enums.UserTagEnum; import com.elink.esua.epdc.commons.tools.enums.UserTagEnum;
@ -219,28 +220,44 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result<Integer> insertVolunteerInfo(EpdcCompleteVolunteerInfoFormDTO epdcCompleteVolunteerInfoFormDTO) { public Result<Integer> insertVolunteerInfo(EpdcCompleteVolunteerInfoFormDTO epdcCompleteVolunteerInfoFormDTO) {
VolunteerInfoEntity volunteerEntity = ConvertUtils.sourceToTarget(epdcCompleteVolunteerInfoFormDTO, VolunteerInfoEntity.class); VolunteerInfoEntity volunteerEntity = ConvertUtils.sourceToTarget(epdcCompleteVolunteerInfoFormDTO, VolunteerInfoEntity.class);
// 补全其他字段 // 补全其他字段
volunteerEntity.setRegistTime(new Date());// 注册时间 volunteerEntity.setRegistTime(new Date());// 注册时间
volunteerEntity.setAuditStatus("1"); // 审核状态 默认审核通过 volunteerEntity.setAuditStatus(NumConstant.ONE_STR); // 审核状态 默认审核通过
volunteerEntity.setAuditTime(new Date()); // 审核时间 volunteerEntity.setAuditTime(volunteerEntity.getRegistTime()); // 审核时间
String address = volunteerEntity.getRoad() String address = volunteerEntity.getRoad()
.concat(StringUtils.isNotBlank(volunteerEntity.getVillageName()) ? volunteerEntity.getVillageName() : "") .concat(StringUtils.isNotBlank(volunteerEntity.getVillageName()) ? volunteerEntity.getVillageName() : StringUtils.EMPTY)
.concat(StringUtils.isNotBlank(volunteerEntity.getDwellingPlace()) ? volunteerEntity.getDwellingPlace() : ""); .concat(StringUtils.isNotBlank(volunteerEntity.getDwellingPlace()) ? volunteerEntity.getDwellingPlace() : StringUtils.EMPTY);
volunteerEntity.setAddress(address); // 居住地址 volunteerEntity.setAddress(address); // 居住地址
// 获取部门信息 // 获取部门信息
Result<ParentAndAllDeptDTO> dtoResult = adminFeignClient.getParentAndAllDept(volunteerEntity.getGridId() + ""); Result<ParentAndAllDeptDTO> dtoResult = adminFeignClient.getParentAndAllDept(String.valueOf(volunteerEntity.getGridId()));
ParentAndAllDeptDTO parentAndAllDeptDTO = dtoResult.getData();
volunteerEntity.setParentDeptIds(parentAndAllDeptDTO.getParentDeptIds()); // 父所有部门ID
volunteerEntity.setParentDeptNames(parentAndAllDeptDTO.getParentDeptNames());// 父所有部门
volunteerEntity.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds()); // 所有部门ID
volunteerEntity.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames()); // 所有部门
// 机构信息
DeptEntityUtils.loadDeptInfo(
ConvertUtils.sourceToTarget(dtoResult.getData(), DeptEntityUtils.DeptDto.class),
volunteerEntity
);
deleteVolunteerByUserId(volunteerEntity.getUserId());
insert(volunteerEntity); insert(volunteerEntity);
return new Result<Integer>().ok(1); return new Result().ok(NumConstant.ONE);
}
/**
* 清除志愿者认证历史
*
* @param userId
* @return void
* @author work@yujt.net.cn
* @date 2020/4/3 16:11
*/
private void deleteVolunteerByUserId(String userId) {
QueryWrapper<VolunteerInfoEntity> wrapper = new QueryWrapper<>();
wrapper.eq(UserFieldConsant.USER_ID, userId);
baseDao.delete(wrapper);
} }
/** /**

Loading…
Cancel
Save