Browse Source

修改查询用户志愿者身份状态的方法,添加查询条排序条件

feature/dangjian
yujintao 6 years ago
parent
commit
5941642fa6
  1. 53
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java

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

@ -17,6 +17,7 @@
package com.elink.esua.epdc.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.async.NewsTask;
@ -27,6 +28,7 @@ import com.elink.esua.epdc.commons.tools.enums.UserTagEnum;
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.constant.UserFieldConsant;
import com.elink.esua.epdc.constant.VolunteerInfoNoticeConstant;
import com.elink.esua.epdc.dao.VolunteerInfoDao;
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO;
@ -87,27 +89,28 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
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){
if (params.get("streetId") != "" && params.get("streetId") != null) {
allDeptIds = params.get("streetId").toString(); //查询条件 街道
}
if (params.get("communityId") != "" && params.get("communityId") != null){
if (params.get("communityId") != "" && params.get("communityId") != null) {
allDeptIds = params.get("communityId").toString(); //查询条件 社区
}
if (params.get("gridId") != "" && params.get("gridId") != null){
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);
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);
PageData<VolunteerInfoDTO> pageDate = new PageData<VolunteerInfoDTO>(list, count);
return pageDate;
}
/**
* 根据志愿者ID查询志愿者 单条详情
* 积分需要连user表查询
* 积分需要连user表查询
*
* @param id
* @return
*/
@ -132,8 +135,8 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
return ConvertUtils.sourceToTarget(entityList, VolunteerInfoDTO.class);
}
private QueryWrapper<VolunteerInfoEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
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);
@ -170,6 +173,7 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
/**
* 志愿者申请根据用户表基础信息 赋默认值
*
* @param id
* @return VolunteerInfoDTO
* @author zy
@ -183,6 +187,7 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
/**
* 向标签表中查询唯一志愿者标签tag_code = volunteer
*
* @param tagCode
* @return
*/
@ -193,9 +198,10 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
/**
* 根据用户id 进行志愿者认证
*
* @param userId
* @author wanggongfeng
* @return
* @author wanggongfeng
* @Date 2019/12/13 16:39
*/
@Override
@ -205,9 +211,10 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
/**
* 新增志愿者
*
* @param epdcCompleteVolunteerInfoFormDTO
* @author wanggongfeng
* @return
* @author wanggongfeng
*/
@Override
@Transactional(rollbackFor = Exception.class)
@ -223,7 +230,7 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
volunteerEntity.setAddress(address); // 居住地址
// 获取部门信息
Result<ParentAndAllDeptDTO> dtoResult = adminFeignClient.getParentAndAllDept(volunteerEntity.getGridId()+"");
Result<ParentAndAllDeptDTO> dtoResult = adminFeignClient.getParentAndAllDept(volunteerEntity.getGridId() + "");
ParentAndAllDeptDTO parentAndAllDeptDTO = dtoResult.getData();
volunteerEntity.setParentDeptIds(parentAndAllDeptDTO.getParentDeptIds()); // 父所有部门ID
@ -245,7 +252,7 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
**/
@Override
public Result<EpdcAdjustVolunteerPointsDTO> getAdjustVolunteerPointsDTO(String id) {
if(StringUtils.isBlank(id) ){
if (StringUtils.isBlank(id)) {
return new Result<EpdcAdjustVolunteerPointsDTO>().error("志愿者主键不能为空");
}
EpdcAdjustVolunteerPointsDTO adjustVolunteerPointsDTO = baseDao.selectAdjustVolunteerPointsDTO(id);
@ -254,8 +261,9 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
/**
* 获取排行榜
* @author wanggongfeng
*
* @return
* @author wanggongfeng
*/
@Override
public Result<List<EpdcGetVolunteerRankDTO>> getRankingList() {
@ -272,13 +280,16 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
**/
@Override
public Result<String> queryUserVolunteerFlag(String userId) {
QueryWrapper<VolunteerInfoEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(userId), "USER_ID", userId);
List<VolunteerInfoEntity> list = baseDao.selectList(wrapper);
if (null == list || list.size() == 0) {
return new Result<String>().ok("2");
if (StringUtils.isNotBlank(userId)) {
QueryWrapper<VolunteerInfoEntity> wrapper = new QueryWrapper<>();
wrapper.eq(UserFieldConsant.USER_ID, userId)
.orderByDesc(FieldConstant.UPDATED_TIME);
List<VolunteerInfoEntity> list = baseDao.selectList(wrapper);
if (CollUtil.isNotEmpty(list)) {
return new Result().ok(list.get(NumConstant.ZERO).getAuditStatus());
}
}
return new Result<String>().ok(list.get(0).getAuditStatus());
return new Result().ok(NumConstant.TWO_STR);
}
/**

Loading…
Cancel
Save