diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java index 517bb39d..25b5f75e 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiAppUserController.java +++ b/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> + * @author Liuchuang + * @since 2021/1/25 15:03 + */ + @GetMapping("volunteer/tags") + public Result> getVolunteerTags() { + return appUserService.listOfVolunteerTags(); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java index 039d76d8..c7b33fa9 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClient.java +++ b/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 needCachingUserInfo(EpdcAppQueryUserInfoFormDTO formDTO); - /* + /** * 志愿者列表 v2 * @param dto * @return com.elink.esua.epdc.commons.tools.utils.Result> @@ -380,7 +380,7 @@ public interface UserFeignClient { Result listVolunteerV2(EpdcAppVolunteerListFormDTO dto); - /* + /** * 志愿者列表 * @param dto * @return com.elink.esua.epdc.commons.tools.utils.Result> @@ -594,4 +594,14 @@ public interface UserFeignClient { @PostMapping(value = "app-user/epdc-app/verificationqrcode/getuserinfobycode", consumes = MediaType.APPLICATION_JSON_VALUE) Result getUserInfoByCode(EpdcUserPointsVerificationCheckFormDTO formDto); + /** + * 志愿者标签 + * + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author Liuchuang + * @since 2021/1/25 15:03 + */ + @GetMapping("app-user/epdc-app/volunteerinfo/tags") + Result> getVolunteerTags(); + } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java index 0423fd86..e49cd132 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java +++ b/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 getUserInfoByCode(EpdcUserPointsVerificationCheckFormDTO formDto) { return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "getUserInfoByCode", formDto); } + + @Override + public Result> getVolunteerTags() { + return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "getVolunteerTags", null); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppUserService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppUserService.java index 00361109..4e44115b 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/AppUserService.java +++ b/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 getUserWxPhone(EpdcAppUserMaInfoFormDTO formDto); - /* + /** * 志愿者列表 v2 * @param tokenDto * @param dto @@ -272,7 +272,7 @@ public interface AppUserService { Result listVolunteerV2(TokenDto tokenDto, EpdcAppVolunteerListFormDTO dto); - /* + /** * 志愿者列表 * @param tokenDto * @param dto @@ -362,7 +362,7 @@ public interface AppUserService { **/ Result> gridRanking(EpdcScreenGridRankingFormDTO dto); /** - * @Description 以人找房 + * @Description 以人找房 * @Author songyunpeng * @Date 2020/9/19 * @Param [dto] @@ -370,7 +370,7 @@ public interface AppUserService { **/ Result> selectHouseByPeople(EpdcScreenHouseInfoByPeopleFormDTO dto); /** - * @Description 以房找人接口 + * @Description 以房找人接口 * @Author songyunpeng * @Date 2020/9/19 * @Param [dto] @@ -378,7 +378,7 @@ public interface AppUserService { **/ Result> selectPeopleByHouse(EpdcScreenPopulationInfoByHouseFormDTO dto); /** - * @Description 以人找人接口 + * @Description 以人找人接口 * @Author songyunpeng * @Date 2020/9/19 * @Param [dto] @@ -386,7 +386,7 @@ public interface AppUserService { **/ Result> 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 **/ Result getPointsByUserId(TokenDto userDetail); + + /** + * 志愿者标签 + * + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author Liuchuang + * @since 2021/1/25 15:03 + */ + Result> listOfVolunteerTags(); } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java index 6a5ca76f..7be1c77a 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java +++ b/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> listOfVolunteerTags() { + return userFeignClient.getVolunteerTags(); + } + } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java index 44df7742..914d6be1 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerInfoDTO.java @@ -217,4 +217,9 @@ public class VolunteerInfoDTO implements Serializable { * 志愿者排序 */ private Integer volunteerOrder; + + /** + * 志愿者标签ID + */ + private String tagId; } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerTagDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerTagDTO.java new file mode 100644 index 00000000..12408331 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 志愿者标签表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 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; + + /** + * 启用标识 0:否,1:是 + */ + private String enableFlag; + + /** + * 删除标识 0:否,1:是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerTagRelationDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/VolunteerTagRelationDTO.java new file mode 100644 index 00000000..be54f023 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 志愿者标签关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 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; + + /** + * 删除标识 0:否,1:是 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcAppVolunteerListFormDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcAppVolunteerListFormDTO.java index 1b27ed97..a76f1cfb 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcAppVolunteerListFormDTO.java +++ b/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; } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/v2/EpdcCompleteVolunteerInfoV2FormDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/v2/EpdcCompleteVolunteerInfoV2FormDTO.java index 59c2ea3c..2329a7d0 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/v2/EpdcCompleteVolunteerInfoV2FormDTO.java +++ b/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; } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/VolunteerTagsResultDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/VolunteerTagsResultDTO.java new file mode 100644 index 00000000..c17f3771 --- /dev/null +++ b/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; +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java index dd7ef36f..99898a5a 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppVolunteerInfoController.java @@ -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> + * @author Liuchuang + * @since 2021/1/25 15:03 + */ + @GetMapping("tags") + public Result> getVolunteerTags() { + List data = volunteerTagService.listOfVolunteerTags(); + return new Result>().ok(data); + } + } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java index bef629c1..8d8d6227 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerInfoController.java @@ -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> + * @author Liuchuang + * @since 2021/1/25 16:22 + */ + @GetMapping("getVolunteerTags") + public Result> getVolunteerTags() { + List data = volunteerTagService.listOfVolunteerTags(); + return new Result>().ok(data); + } + } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerTagController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerTagController.java new file mode 100644 index 00000000..2acd26b8 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.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> page(@RequestParam Map params){ + PageData page = volunteerTagService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + VolunteerTagDTO data = volunteerTagService.get(id); + return new Result().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(); + } + +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerTagRelationController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/VolunteerTagRelationController.java new file mode 100644 index 00000000..337ec687 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.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> page(@RequestParam Map params){ + PageData page = volunteerTagRelationService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + VolunteerTagRelationDTO data = volunteerTagRelationService.get(id); + return new Result().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(); + } + +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerTagDao.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerTagDao.java new file mode 100644 index 00000000..8b122dd9 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.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 { + + /** + * 志愿者标签 + * + * @return java.util.List + * @author Liuchuang + * @since 2021/1/25 15:11 + */ + List selectListOfVolunteerTags(); +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerTagRelationDao.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/VolunteerTagRelationDao.java new file mode 100644 index 00000000..ae09173d --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.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 { + + /** + * 根据志愿者ID删除志愿者标签 + * + * @param volunteerId 志愿者ID + * @return void + * @author Liuchuang + * @since 2021/1/25 15:47 + */ + void updateDelFlagByVolunteerId(String volunteerId); +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerTagEntity.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerTagEntity.java new file mode 100644 index 00000000..d959bda0 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 志愿者标签表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 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; + + /** + * 启用标识 0:否,1:是 + */ + private String enableFlag; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerTagRelationEntity.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/VolunteerTagRelationEntity.java new file mode 100644 index 00000000..3d4151cf --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 志愿者标签关系表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 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; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java index 1bb7769c..06d14863 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerInfoService.java @@ -211,7 +211,7 @@ public interface VolunteerInfoService extends BaseService { */ Result modifyVolunteerKindnessTime(EpdcVolunteerKindnessTimeFormDTO formDto); - /* + /** * 志愿者列表v2 * @param dto * @return com.elink.esua.epdc.commons.tools.utils.Result> @@ -221,7 +221,7 @@ public interface VolunteerInfoService extends BaseService { Result listVolunteerV2(EpdcAppVolunteerListFormDTO dto); - /* + /** * 志愿者列表 * @param dto * @return com.elink.esua.epdc.commons.tools.utils.Result> diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerTagRelationService.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerTagRelationService.java new file mode 100644 index 00000000..09714cfc --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service; + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-01-25 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-01-25 + */ + List list(Map 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); +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerTagService.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/VolunteerTagService.java new file mode 100644 index 00000000..1dc29840 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service; + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-01-25 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-01-25 + */ + List list(Map 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 + * @author Liuchuang + * @since 2021/1/25 15:09 + */ + List listOfVolunteerTags(); +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java index 500a09c2..c8d53b28 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java @@ -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 + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.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 implements VolunteerTagRelationService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, VolunteerTagRelationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, VolunteerTagRelationDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public 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); + } + +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerTagServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerTagServiceImpl.java new file mode 100644 index 00000000..0e4c627a --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.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 implements VolunteerTagService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, "", false), + getWrapper(params) + ); + return getPageData(page, VolunteerTagDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, VolunteerTagDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + 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 listOfVolunteerTags() { + return baseDao.selectListOfVolunteerTags(); + } + +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml index 02fb796f..327fa1f6 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerInfoDao.xml @@ -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} @@ -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 AND v.VOLUNTEER_NICKNAME like concat('%', #{nickname}, '%') + + AND vt.TAG_ID = #{volunteerTagId} + ORDER BY v.VOLUNTEER_ORDER ASC ,CONVERT(v.VOLUNTEER_NICKNAME USING gbk) LIMIT #{pageIndex},#{pageSize} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagDao.xml b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagDao.xml new file mode 100644 index 00000000..09ddc12b --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagRelationDao.xml b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagRelationDao.xml new file mode 100644 index 00000000..40ec1ae6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/VolunteerTagRelationDao.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + UPDATE epdc_volunteer_tag_relation SET DEL_FLAG = '1' WHERE VOLUNTEER_ID = #{volunteerId} + + +