Browse Source

志愿者标签管理 init

feature/syp_points
liuchuang 5 years ago
parent
commit
6e9e61bd05
  1. 12
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java
  2. 14
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java
  3. 5
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java
  4. 21
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppUserService.java
  5. 5
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java
  6. 5
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java
  7. 91
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerTagDTO.java
  8. 81
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerTagRelationDTO.java
  9. 5
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcAppVolunteerListFormDTO.java
  10. 5
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/v2/EpdcCompleteVolunteerInfoV2FormDTO.java
  11. 36
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/VolunteerTagsResultDTO.java
  12. 18
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java
  13. 19
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java
  14. 84
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerTagController.java
  15. 87
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerTagRelationController.java
  16. 44
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerTagDao.java
  17. 42
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerTagRelationDao.java
  18. 61
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerTagEntity.java
  19. 51
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerTagRelationEntity.java
  20. 4
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java
  21. 104
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerTagRelationService.java
  22. 105
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerTagService.java
  23. 23
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java
  24. 111
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerTagRelationServiceImpl.java
  25. 106
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerTagServiceImpl.java
  26. 9
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml
  27. 24
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagDao.xml
  28. 22
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagRelationDao.xml

12
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java

@ -415,4 +415,16 @@ public class ApiAppUserController {
}
return appUserService.getPointsByUserId(userDetail);
}
/**
* 志愿者标签
*
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO>>
* @author Liuchuang
* @since 2021/1/25 15:03
*/
@GetMapping("volunteer/tags")
public Result<List<VolunteerTagsResultDTO>> getVolunteerTags() {
return appUserService.listOfVolunteerTags();
}
}

14
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java

@ -369,7 +369,7 @@ public interface UserFeignClient {
@PostMapping(value = "app-user/epdc-app/user/needCachingUserInfo", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<CachingUserInfoDTO> needCachingUserInfo(EpdcAppQueryUserInfoFormDTO formDTO);
/*
/**
* 志愿者列表 v2
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcAppVolunteerListResultDTO>>
@ -380,7 +380,7 @@ public interface UserFeignClient {
Result<EpdcAppVolunteerListCountResultDTO> listVolunteerV2(EpdcAppVolunteerListFormDTO dto);
/*
/**
* 志愿者列表
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcAppVolunteerListResultDTO>>
@ -594,4 +594,14 @@ public interface UserFeignClient {
@PostMapping(value = "app-user/epdc-app/verificationqrcode/getuserinfobycode", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<EpdcUserPointsVerificationResultDTO> getUserInfoByCode(EpdcUserPointsVerificationCheckFormDTO formDto);
/**
* 志愿者标签
*
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO>>
* @author Liuchuang
* @since 2021/1/25 15:03
*/
@GetMapping("app-user/epdc-app/volunteerinfo/tags")
Result<List<VolunteerTagsResultDTO>> getVolunteerTags();
}

5
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java

@ -288,4 +288,9 @@ public class UserFeignClientFallback implements UserFeignClient {
public Result<EpdcUserPointsVerificationResultDTO> getUserInfoByCode(EpdcUserPointsVerificationCheckFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "getUserInfoByCode", formDto);
}
@Override
public Result<List<VolunteerTagsResultDTO>> getVolunteerTags() {
return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "getVolunteerTags", null);
}
}

21
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppUserService.java

@ -261,7 +261,7 @@ public interface AppUserService {
*/
Result<String> getUserWxPhone(EpdcAppUserMaInfoFormDTO formDto);
/*
/**
* 志愿者列表 v2
* @param tokenDto
* @param dto
@ -272,7 +272,7 @@ public interface AppUserService {
Result<EpdcAppVolunteerListCountResultDTO> listVolunteerV2(TokenDto tokenDto, EpdcAppVolunteerListFormDTO dto);
/*
/**
* 志愿者列表
* @param tokenDto
* @param dto
@ -362,7 +362,7 @@ public interface AppUserService {
**/
Result<PageData<EpdcScreenGridRankingResultDTO>> gridRanking(EpdcScreenGridRankingFormDTO dto);
/**
* @Description 以人找房
* @Description 以人找房
* @Author songyunpeng
* @Date 2020/9/19
* @Param [dto]
@ -370,7 +370,7 @@ public interface AppUserService {
**/
Result<PageData<EpdcScreenHouseInfoByPeopleResultDTO>> selectHouseByPeople(EpdcScreenHouseInfoByPeopleFormDTO dto);
/**
* @Description 以房找人接口
* @Description 以房找人接口
* @Author songyunpeng
* @Date 2020/9/19
* @Param [dto]
@ -378,7 +378,7 @@ public interface AppUserService {
**/
Result<PageData<EpdcScreenPopulationInfoByHouseResultDTO>> selectPeopleByHouse(EpdcScreenPopulationInfoByHouseFormDTO dto);
/**
* @Description 以人找人接口
* @Description 以人找人接口
* @Author songyunpeng
* @Date 2020/9/19
* @Param [dto]
@ -386,7 +386,7 @@ public interface AppUserService {
**/
Result<PageData<EpdcScreenResidentInfoByCurrentAddressResultDTO>> selectPeopleByCurrentAddress(EpdcScreenResidentInfoByCurrentAddressFormDTO dto);
/**
* @Description
* @Description
* @Author songyunpeng
* @Date 2020/12/9
* @Param [userDetail]
@ -401,4 +401,13 @@ public interface AppUserService {
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.epdc.result.EpdcAppUserPointsResultDTO>
**/
Result<EpdcAppUserPointsResultDTO> getPointsByUserId(TokenDto userDetail);
/**
* 志愿者标签
*
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO>>
* @author Liuchuang
* @since 2021/1/25 15:03
*/
Result<List<VolunteerTagsResultDTO>> listOfVolunteerTags();
}

5
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java

@ -1648,4 +1648,9 @@ public class AppUserServiceImpl implements AppUserService {
return userFeignClient.getPointsByUserId(userDetail.getUserId());
}
@Override
public Result<List<VolunteerTagsResultDTO>> listOfVolunteerTags() {
return userFeignClient.getVolunteerTags();
}
}

5
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java

@ -217,4 +217,9 @@ public class VolunteerInfoDTO implements Serializable {
* 志愿者排序
*/
private Integer volunteerOrder;
/**
* 志愿者标签ID
*/
private String tagId;
}

91
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerTagDTO.java

@ -0,0 +1,91 @@
/**
* 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 2021-01-25
*/
@Data
public class VolunteerTagDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 标签名称
*/
private String tagName;
/**
* 描述
*/
private String description;
/**
* 排序
*/
private Integer sort;
/**
* 启用标识 01
*/
private String enableFlag;
/**
* 删除标识 01
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

81
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerTagRelationDTO.java

@ -0,0 +1,81 @@
/**
* 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 2021-01-25
*/
@Data
public class VolunteerTagRelationDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 标签ID
*/
private String tagId;
/**
* 志愿者ID
*/
private String volunteerId;
/**
* 删除标识 01
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

5
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcAppVolunteerListFormDTO.java

@ -35,4 +35,9 @@ public class EpdcAppVolunteerListFormDTO {
* 搜索条件昵称
*/
private String nickname;
/**
* 志愿者标签ID
*/
private String volunteerTagId;
}

5
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/v2/EpdcCompleteVolunteerInfoV2FormDTO.java

@ -118,5 +118,10 @@ public class EpdcCompleteVolunteerInfoV2FormDTO implements Serializable {
* 志愿者签名
*/
private String volunteerSignature;
/**
* 标签ID
*/
private String volunteerTagId;
}

36
esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/VolunteerTagsResultDTO.java

@ -0,0 +1,36 @@
package com.elink.esua.epdc.dto.epdc.result;
import lombok.Data;
import java.io.Serializable;
/**
* 志愿者标签
*
* @author Liuchuang
* @since 2021/1/25 15:01
*/
@Data
public class VolunteerTagsResultDTO implements Serializable {
private static final long serialVersionUID = 8355829005926490150L;
/**
* ID
*/
private String id;
/**
* 标签名称
*/
private String tagName;
/**
* 描述
*/
private String description;
/**
* 排序
*/
private Integer sort;
}

18
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java

@ -11,7 +11,9 @@ import com.elink.esua.epdc.dto.epdc.form.v2.EpdcCompleteVolunteerInfoV2FormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcAppVolunteerListCountResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcAppVolunteerListResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcGetVolunteerRankDTO;
import com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO;
import com.elink.esua.epdc.service.VolunteerInfoService;
import com.elink.esua.epdc.service.VolunteerTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -29,6 +31,9 @@ public class EpdcAppVolunteerInfoController {
@Autowired
private VolunteerInfoService volunteerInfoService;
@Autowired
private VolunteerTagService volunteerTagService;
/**
* 根据用户id 进行志愿者认证
* @param userId
@ -93,4 +98,17 @@ public class EpdcAppVolunteerInfoController {
return result;
}
/**
* 志愿者标签
*
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO>>
* @author Liuchuang
* @since 2021/1/25 15:03
*/
@GetMapping("tags")
public Result<List<VolunteerTagsResultDTO>> getVolunteerTags() {
List<VolunteerTagsResultDTO> data = volunteerTagService.listOfVolunteerTags();
return new Result<List<VolunteerTagsResultDTO>>().ok(data);
}
}

19
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java

@ -29,9 +29,11 @@ import com.elink.esua.epdc.dto.VolunteerInfoDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcVolunteerKindnessTimeFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcVolunteerKindnessTimeUpdateFormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcAdjustVolunteerPointsDTO;
import com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO;
import com.elink.esua.epdc.excel.VolunteerInfoExcel;
import com.elink.esua.epdc.service.UserTagService;
import com.elink.esua.epdc.service.VolunteerInfoService;
import com.elink.esua.epdc.service.VolunteerTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -59,6 +61,9 @@ public class VolunteerInfoController {
@Autowired
private UserTagService userTagService; //标签表
@Autowired
private VolunteerTagService volunteerTagService;
/**
* @Description: 查询志愿者列表数据
* @Param: [params]
@ -126,6 +131,7 @@ public class VolunteerInfoController {
VolunteerInfoDTO dto = new VolunteerInfoDTO();
dto.setVolunteerOrder(formDto.getVolunteerOrder());
dto.setId(formDto.getId());
dto.setTagId(formDto.getTagId());
volunteerInfoService.update(dto);
return new Result();
}
@ -238,4 +244,17 @@ public class VolunteerInfoController {
return volunteerInfoService.updateKindnessTime(formDto);
}
/**
* 志愿者标签
*
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO>>
* @author Liuchuang
* @since 2021/1/25 16:22
*/
@GetMapping("getVolunteerTags")
public Result<List<VolunteerTagsResultDTO>> getVolunteerTags() {
List<VolunteerTagsResultDTO> data = volunteerTagService.listOfVolunteerTags();
return new Result<List<VolunteerTagsResultDTO>>().ok(data);
}
}

84
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerTagController.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.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
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.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.VolunteerTagDTO;
import com.elink.esua.epdc.service.VolunteerTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 志愿者标签表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-01-25
*/
@RestController
@RequestMapping("volunteertag")
public class VolunteerTagController {
@Autowired
private VolunteerTagService volunteerTagService;
@GetMapping("page")
public Result<PageData<VolunteerTagDTO>> page(@RequestParam Map<String, Object> params){
PageData<VolunteerTagDTO> page = volunteerTagService.page(params);
return new Result<PageData<VolunteerTagDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<VolunteerTagDTO> get(@PathVariable("id") String id){
VolunteerTagDTO data = volunteerTagService.get(id);
return new Result<VolunteerTagDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody VolunteerTagDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
volunteerTagService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody VolunteerTagDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
volunteerTagService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
volunteerTagService.delete(ids);
return new Result();
}
}

87
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerTagRelationController.java

@ -0,0 +1,87 @@
/**
* 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.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.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.VolunteerTagRelationDTO;
import com.elink.esua.epdc.service.VolunteerTagRelationService;
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 2021-01-25
*/
@RestController
@RequestMapping("volunteertagrelation")
public class VolunteerTagRelationController {
@Autowired
private VolunteerTagRelationService volunteerTagRelationService;
@GetMapping("page")
public Result<PageData<VolunteerTagRelationDTO>> page(@RequestParam Map<String, Object> params){
PageData<VolunteerTagRelationDTO> page = volunteerTagRelationService.page(params);
return new Result<PageData<VolunteerTagRelationDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<VolunteerTagRelationDTO> get(@PathVariable("id") String id){
VolunteerTagRelationDTO data = volunteerTagRelationService.get(id);
return new Result<VolunteerTagRelationDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody VolunteerTagRelationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
volunteerTagRelationService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody VolunteerTagRelationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
volunteerTagRelationService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
volunteerTagRelationService.delete(ids);
return new Result();
}
}

44
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerTagDao.java

@ -0,0 +1,44 @@
/**
* 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.dto.epdc.result.VolunteerTagsResultDTO;
import com.elink.esua.epdc.entity.VolunteerTagEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 志愿者标签表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-01-25
*/
@Mapper
public interface VolunteerTagDao extends BaseDao<VolunteerTagEntity> {
/**
* 志愿者标签
*
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO>
* @author Liuchuang
* @since 2021/1/25 15:11
*/
List<VolunteerTagsResultDTO> selectListOfVolunteerTags();
}

42
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerTagRelationDao.java

@ -0,0 +1,42 @@
/**
* 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.entity.VolunteerTagRelationEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 志愿者标签关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-01-25
*/
@Mapper
public interface VolunteerTagRelationDao extends BaseDao<VolunteerTagRelationEntity> {
/**
* 根据志愿者ID删除志愿者标签
*
* @param volunteerId 志愿者ID
* @return void
* @author Liuchuang
* @since 2021/1/25 15:47
*/
void updateDelFlagByVolunteerId(String volunteerId);
}

61
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerTagEntity.java

@ -0,0 +1,61 @@
/**
* 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 2021-01-25
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_volunteer_tag")
public class VolunteerTagEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 标签名称
*/
private String tagName;
/**
* 描述
*/
private String description;
/**
* 排序
*/
private Integer sort;
/**
* 启用标识 01
*/
private String enableFlag;
}

51
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerTagRelationEntity.java

@ -0,0 +1,51 @@
/**
* 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 2021-01-25
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_volunteer_tag_relation")
public class VolunteerTagRelationEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 标签ID
*/
private String tagId;
/**
* 志愿者ID
*/
private String volunteerId;
}

4
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java

@ -211,7 +211,7 @@ public interface VolunteerInfoService extends BaseService<VolunteerInfoEntity> {
*/
Result modifyVolunteerKindnessTime(EpdcVolunteerKindnessTimeFormDTO formDto);
/*
/**
* 志愿者列表v2
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcAppVolunteerListResultDTO>>
@ -221,7 +221,7 @@ public interface VolunteerInfoService extends BaseService<VolunteerInfoEntity> {
Result<EpdcAppVolunteerListCountResultDTO> listVolunteerV2(EpdcAppVolunteerListFormDTO dto);
/*
/**
* 志愿者列表
* @param dto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcAppVolunteerListResultDTO>>

104
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerTagRelationService.java

@ -0,0 +1,104 @@
/**
* 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;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.VolunteerTagRelationDTO;
import com.elink.esua.epdc.entity.VolunteerTagRelationEntity;
import java.util.List;
import java.util.Map;
/**
* 志愿者标签关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-01-25
*/
public interface VolunteerTagRelationService extends BaseService<VolunteerTagRelationEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<VolunteerTagRelationDTO>
* @author generator
* @date 2021-01-25
*/
PageData<VolunteerTagRelationDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<VolunteerTagRelationDTO>
* @author generator
* @date 2021-01-25
*/
List<VolunteerTagRelationDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return VolunteerTagRelationDTO
* @author generator
* @date 2021-01-25
*/
VolunteerTagRelationDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-01-25
*/
void save(VolunteerTagRelationDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-01-25
*/
void update(VolunteerTagRelationDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-01-25
*/
void delete(String[] ids);
/**
* 更新志愿者标签
*
* @return boolean
* @author Liuchuang
* @since 2021/1/25 15:42
*/
boolean insertOrUpdateVolunteerTag(VolunteerTagRelationDTO tagDto);
}

105
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerTagService.java

@ -0,0 +1,105 @@
/**
* 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;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.VolunteerTagDTO;
import com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO;
import com.elink.esua.epdc.entity.VolunteerTagEntity;
import java.util.List;
import java.util.Map;
/**
* 志愿者标签表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-01-25
*/
public interface VolunteerTagService extends BaseService<VolunteerTagEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<VolunteerTagDTO>
* @author generator
* @date 2021-01-25
*/
PageData<VolunteerTagDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<VolunteerTagDTO>
* @author generator
* @date 2021-01-25
*/
List<VolunteerTagDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return VolunteerTagDTO
* @author generator
* @date 2021-01-25
*/
VolunteerTagDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-01-25
*/
void save(VolunteerTagDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-01-25
*/
void update(VolunteerTagDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-01-25
*/
void delete(String[] ids);
/**
* 志愿者标签
*
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO>
* @author Liuchuang
* @since 2021/1/25 15:09
*/
List<VolunteerTagsResultDTO> listOfVolunteerTags();
}

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

@ -33,9 +33,7 @@ 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;
import com.elink.esua.epdc.dto.UserTagDTO;
import com.elink.esua.epdc.dto.VolunteerInfoDTO;
import com.elink.esua.epdc.dto.*;
import com.elink.esua.epdc.dto.epdc.form.*;
import com.elink.esua.epdc.dto.epdc.form.v2.EpdcCompleteVolunteerInfoV2FormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcAdjustVolunteerPointsDTO;
@ -47,6 +45,8 @@ import com.elink.esua.epdc.feign.AdminFeignClient;
import com.elink.esua.epdc.rocketmq.dto.OrganizationModifyDTO;
import com.elink.esua.epdc.service.UserTagRelationService;
import com.elink.esua.epdc.service.VolunteerInfoService;
import com.elink.esua.epdc.service.VolunteerTagRelationService;
import com.elink.esua.epdc.service.VolunteerTagService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -70,7 +70,10 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
private AdminFeignClient adminFeignClient;
@Autowired
private UserTagRelationService userTagRelationService; //用户标签关系表
private UserTagRelationService userTagRelationService;
@Autowired
private VolunteerTagRelationService volunteerTagRelationService;
/**
* 根据查询条件返回首页 志愿者信息列表
@ -147,6 +150,12 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
public void update(VolunteerInfoDTO dto) {
VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class);
updateById(entity);
// 更新志愿者标签
VolunteerTagRelationDTO tagDto = new VolunteerTagRelationDTO();
tagDto.setVolunteerId(dto.getId());
tagDto.setTagId(dto.getTagId());
volunteerTagRelationService.insertOrUpdateVolunteerTag(tagDto);
}
@Override
@ -437,6 +446,12 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
this.sendNotice(volunteerEntity);
userTagRelationService.addUserTagRelation(volunteerEntity.getUserId(), UserTagEnum.VOLUNTEER.value());
}
// 更新志愿者标签
VolunteerTagRelationDTO tagDto = new VolunteerTagRelationDTO();
tagDto.setVolunteerId(volunteerEntity.getId());
tagDto.setTagId(formDTO.getVolunteerTagId());
volunteerTagRelationService.insertOrUpdateVolunteerTag(tagDto);
return new Result().ok(NumConstant.ONE);
}

111
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerTagRelationServiceImpl.java

@ -0,0 +1,111 @@
/**
* 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.dao.VolunteerTagRelationDao;
import com.elink.esua.epdc.dto.VolunteerTagRelationDTO;
import com.elink.esua.epdc.entity.VolunteerTagRelationEntity;
import com.elink.esua.epdc.service.VolunteerTagRelationService;
import org.apache.commons.lang3.StringUtils;
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 2021-01-25
*/
@Service
public class VolunteerTagRelationServiceImpl extends BaseServiceImpl<VolunteerTagRelationDao, VolunteerTagRelationEntity> implements VolunteerTagRelationService {
@Override
public PageData<VolunteerTagRelationDTO> page(Map<String, Object> params) {
IPage<VolunteerTagRelationEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, VolunteerTagRelationDTO.class);
}
@Override
public List<VolunteerTagRelationDTO> list(Map<String, Object> params) {
List<VolunteerTagRelationEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, VolunteerTagRelationDTO.class);
}
private QueryWrapper<VolunteerTagRelationEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<VolunteerTagRelationEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public VolunteerTagRelationDTO get(String id) {
VolunteerTagRelationEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, VolunteerTagRelationDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(VolunteerTagRelationDTO dto) {
VolunteerTagRelationEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerTagRelationEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(VolunteerTagRelationDTO dto) {
VolunteerTagRelationEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerTagRelationEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean insertOrUpdateVolunteerTag(VolunteerTagRelationDTO tagDto) {
// 删除已绑定志愿者标签
baseDao.updateDelFlagByVolunteerId(tagDto.getVolunteerId());
// 插入新志愿者标签
VolunteerTagRelationEntity entity = new VolunteerTagRelationEntity();
entity.setVolunteerId(tagDto.getVolunteerId());
entity.setTagId(tagDto.getTagId());
return insert(entity);
}
}

106
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerTagServiceImpl.java

@ -0,0 +1,106 @@
/**
* 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.dao.VolunteerTagDao;
import com.elink.esua.epdc.dto.VolunteerTagDTO;
import com.elink.esua.epdc.dto.epdc.result.VolunteerTagsResultDTO;
import com.elink.esua.epdc.entity.VolunteerTagEntity;
import com.elink.esua.epdc.service.VolunteerTagService;
import org.apache.commons.lang3.StringUtils;
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 2021-01-25
*/
@Service
public class VolunteerTagServiceImpl extends BaseServiceImpl<VolunteerTagDao, VolunteerTagEntity> implements VolunteerTagService {
@Override
public PageData<VolunteerTagDTO> page(Map<String, Object> params) {
IPage<VolunteerTagEntity> page = baseDao.selectPage(
getPage(params, "", false),
getWrapper(params)
);
return getPageData(page, VolunteerTagDTO.class);
}
@Override
public List<VolunteerTagDTO> list(Map<String, Object> params) {
List<VolunteerTagEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, VolunteerTagDTO.class);
}
private QueryWrapper<VolunteerTagEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<VolunteerTagEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.orderByAsc("SORT");
return wrapper;
}
@Override
public VolunteerTagDTO get(String id) {
VolunteerTagEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, VolunteerTagDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(VolunteerTagDTO dto) {
VolunteerTagEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerTagEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(VolunteerTagDTO dto) {
VolunteerTagEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerTagEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public List<VolunteerTagsResultDTO> listOfVolunteerTags() {
return baseDao.selectListOfVolunteerTags();
}
}

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

@ -110,9 +110,11 @@
u.POINTS points,
date_format(v.REGIST_TIME,'%Y.%m.%d %H.%i') registTimeString,
v.REGIST_TIME registTime,
v.VOLUNTEER_ORDER volunteerOrder
v.VOLUNTEER_ORDER volunteerOrder,
vt.TAG_ID
FROM
epdc_volunteer_info v left join epdc_user u on v.USER_ID = u.ID
left join epdc_volunteer_tag_relation vt on vt.VOLUNTEER_ID = v.ID and vt.DEL_FLAG = '0'
where v.ID = #{id}
</select>
@ -225,12 +227,17 @@
v.VOLUNTEER_SIGNATURE volunteerSignature
FROM
epdc_volunteer_info v
LEFT JOIN epdc_volunteer_tag_relation vt ON vt.VOLUNTEER_ID = v.ID
AND vt.DEL_FLAG = '0'
WHERE
v.DEL_FLAG = 0
AND v.AUDIT_STATUS != 2
<if test="nickname != null and nickname != '' ">
AND v.VOLUNTEER_NICKNAME like concat('%', #{nickname}, '%')
</if>
<if test="volunteerTagId != null and volunteerTagId != '' ">
AND vt.TAG_ID = #{volunteerTagId}
</if>
ORDER BY v.VOLUNTEER_ORDER ASC ,CONVERT(v.VOLUNTEER_NICKNAME USING gbk)
LIMIT #{pageIndex},#{pageSize}
</select>

24
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagDao.xml

@ -0,0 +1,24 @@
<?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.VolunteerTagDao">
<resultMap type="com.elink.esua.epdc.entity.VolunteerTagEntity" id="volunteerTagMap">
<result property="id" column="ID"/>
<result property="tagName" column="TAG_NAME"/>
<result property="description" column="DESCRIPTION"/>
<result property="sort" column="SORT"/>
<result property="enableFlag" column="ENABLE_FLAG"/>
<result property="delFlag" column="DEL_FLAG"/>
<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="selectListOfVolunteerTags" resultType="com.elink.esua.epdc.entity.VolunteerTagEntity">
SELECT ID, TAG_NAME, DESCRIPTION, SORT FROM epdc_volunteer_tag WHERE DEL_FLAG = '0' AND ENABLE_FLAG = '1' ORDER BY SORT
</select>
</mapper>

22
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagRelationDao.xml

@ -0,0 +1,22 @@
<?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.VolunteerTagRelationDao">
<resultMap type="com.elink.esua.epdc.entity.VolunteerTagRelationEntity" id="volunteerTagRelationMap">
<result property="id" column="ID"/>
<result property="tagId" column="TAG_ID"/>
<result property="volunteerId" column="VOLUNTEER_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<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>
<update id="updateDelFlagByVolunteerId">
UPDATE epdc_volunteer_tag_relation SET DEL_FLAG = '1' WHERE VOLUNTEER_ID = #{volunteerId}
</update>
</mapper>
Loading…
Cancel
Save