Browse Source
# Conflicts: # epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java # epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java # epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.javamaster
57 changed files with 1293 additions and 136 deletions
@ -0,0 +1,32 @@ |
|||
package com.epmet.dto.feign; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.feign.fallback.GovVoiceFeignClientFallBack; |
|||
import com.epmet.dto.form.ResiTagListFormDto; |
|||
import com.epmet.dto.result.TagInfoResultDto; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/2 16:05 |
|||
* , url = "localhost:8105" |
|||
*/ |
|||
//@FeignClient(name = ServiceConstant.GOV_VOICE_SERVER, fallback = GovVoiceFeignClientFallBack.class, url = "localhost:8105")
|
|||
@FeignClient(name = ServiceConstant.GOV_VOICE_SERVER, fallback = GovVoiceFeignClientFallBack.class) |
|||
public interface GovVoiceFeignClient { |
|||
|
|||
/** |
|||
* @Description 已发布列表页的标签——居民端 |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
@PostMapping("/gov/voice/tag/resitaglist") |
|||
Result<List<TagInfoResultDto>> resiTagList(@RequestBody ResiTagListFormDto formDto); |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.feign.fallback; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.ModuleUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.feign.GovVoiceFeignClient; |
|||
import com.epmet.dto.form.ResiTagListFormDto; |
|||
import com.epmet.dto.result.TagInfoResultDto; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/2 16:07 |
|||
*/ |
|||
@Component |
|||
public class GovVoiceFeignClientFallBack implements GovVoiceFeignClient { |
|||
@Override |
|||
public Result<List<TagInfoResultDto>> resiTagList(ResiTagListFormDto formDto) { |
|||
return ModuleUtils.feignConError(ServiceConstant.GOV_VOICE_SERVER, "resiTagList", formDto); |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 查询文章操作记录 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/6/2 16:42 |
|||
*/ |
|||
@Data |
|||
public class ArticleOperationFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -6659391832410565077L; |
|||
|
|||
public interface AddUserInternalGroup {} |
|||
|
|||
/** |
|||
* 文章id |
|||
*/ |
|||
@NotBlank(message = "文章id不能为空", groups = {ArticleOperationFormDTO.AddUserInternalGroup.class}) |
|||
private String articleId; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/3 9:39 |
|||
*/ |
|||
@Data |
|||
public class CorrelationTagListFormDto implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -1588825995685146967L; |
|||
|
|||
/** |
|||
* 标签id集合 |
|||
*/ |
|||
private List<String> tagIdList; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 政府端工作人员,删除草稿入参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/6/2 15:25 |
|||
*/ |
|||
@Data |
|||
public class DeleteDraftFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -2424432724401298206L; |
|||
|
|||
public interface AddUserInternalGroup {} |
|||
|
|||
/** |
|||
* 草稿id |
|||
*/ |
|||
@NotBlank(message = "草稿id不能为空", groups = {AddUserInternalGroup.class}) |
|||
private String draftId; |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 政府端:(已发布、已下线)文章详情 入参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/6/2 17:21 |
|||
*/ |
|||
@Data |
|||
public class GovArticleDetailFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 2149876964249893025L; |
|||
public interface AddUserInternalGroup {} |
|||
|
|||
/** |
|||
* 文章id |
|||
*/ |
|||
@NotBlank(message = "文章id不能为空", groups = {GovArticleDetailFormDTO.AddUserInternalGroup.class}) |
|||
private String articleId; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/2 15:50 |
|||
*/ |
|||
@Data |
|||
public class ResiTagListFormDto implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4337657473061285656L; |
|||
|
|||
public interface ResiTagListForm{} |
|||
public interface ResiTagListFormWeb extends CustomerClientShowGroup{} |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
@NotBlank(message = "网格id不能为空",groups = {ResiTagListForm.class,ResiTagListFormWeb.class}) |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 描述一下 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/6/2 16:44 |
|||
*/ |
|||
@Data |
|||
public class ArticleOperationResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -436748500797911121L; |
|||
private String id; |
|||
private String content; |
|||
private Long createdTime; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/3 9:41 |
|||
*/ |
|||
@JsonIgnoreProperties(ignoreUnknown = true) |
|||
@Data |
|||
public class CorrelationTagListResultDto implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 5536953304816455733L; |
|||
|
|||
/** |
|||
* 标签id |
|||
*/ |
|||
private String tagId; |
|||
|
|||
/** |
|||
* 标签名称 |
|||
*/ |
|||
private String tagName; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 政府端:(已发布、已下线)文章内容详情 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/6/3 9:39 |
|||
*/ |
|||
@Data |
|||
public class GovArticleContentDTO implements Serializable { |
|||
private static final long serialVersionUID = 1519014754254863006L; |
|||
/** |
|||
* 内容类型,图片:img;文字:text |
|||
*/ |
|||
private String contentType; |
|||
|
|||
/** |
|||
* 内容 |
|||
*/ |
|||
private String content; |
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 政府端:(已发布、已下线)文章详情 返参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/6/3 9:29 |
|||
*/ |
|||
@Data |
|||
public class GovArticleDetailResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -8328304788721564622L; |
|||
/** |
|||
* 文章id |
|||
*/ |
|||
private String articleId; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 发布单位名称 |
|||
*/ |
|||
private String publisherName; |
|||
|
|||
/** |
|||
* 发布日期 |
|||
*/ |
|||
@JsonFormat(pattern="yyyy-MM-dd") |
|||
private Date publishDate; |
|||
|
|||
/** |
|||
* 访问量 |
|||
*/ |
|||
private Integer visitRecordCount; |
|||
|
|||
/** |
|||
* 发布范围字符串 |
|||
*/ |
|||
private String publishRangeDesc; |
|||
|
|||
/** |
|||
* 标签字符串 |
|||
*/ |
|||
private String tags; |
|||
|
|||
/** |
|||
* 发布状态 已发布:published;已下线:offline |
|||
*/ |
|||
private String statusFlag; |
|||
|
|||
/** |
|||
* 草稿Id,重新编辑时使用 |
|||
*/ |
|||
private String draftId; |
|||
|
|||
/** |
|||
* 内容列表 |
|||
*/ |
|||
private List<GovArticleContentDTO> articleContentList; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/2 9:47 |
|||
*/ |
|||
@JsonIgnoreProperties(ignoreUnknown = true) |
|||
@Data |
|||
public class TagInfoResultDto implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4366515668545958124L; |
|||
|
|||
/** |
|||
* 标签id |
|||
*/ |
|||
private String tagId; |
|||
|
|||
/** |
|||
* 标签名称 |
|||
*/ |
|||
private String tagName; |
|||
} |
@ -1,9 +1,60 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.CorrelationTagListFormDto; |
|||
import com.epmet.dto.form.ResiTagListFormDto; |
|||
import com.epmet.dto.result.CorrelationTagListResultDto; |
|||
import com.epmet.dto.result.TagInfoResultDto; |
|||
import com.epmet.service.TagService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
@RestController |
|||
@RequestMapping("tag") |
|||
public class TagController { |
|||
|
|||
@Autowired |
|||
private TagService tagService; |
|||
|
|||
/** |
|||
* @Description 已发布列表页的标签——政府端 |
|||
* @param tokenDto |
|||
* @author zxc |
|||
*/ |
|||
@PostMapping("taglist") |
|||
public Result<List<TagInfoResultDto>> tagList(@LoginUser TokenDto tokenDto){ |
|||
ValidatorUtils.validateEntity(tokenDto); |
|||
return new Result<List<TagInfoResultDto>>().ok(tagService.tagList(tokenDto)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 已发布列表页的标签——居民端 |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
@PostMapping("resitaglist") |
|||
public Result<List<TagInfoResultDto>> resiTagList(@RequestBody ResiTagListFormDto formDto){ |
|||
ValidatorUtils.validateEntity(formDto, ResiTagListFormDto.ResiTagListForm.class, ResiTagListFormDto.ResiTagListFormWeb.class); |
|||
return new Result<List<TagInfoResultDto>>().ok(tagService.resiTagList(formDto)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 已发布列表页-获取关联标签——政府端 |
|||
* @param tokenDto |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
@PostMapping("correlationtaglist") |
|||
public Result<List<CorrelationTagListResultDto>> correlationTagList(@LoginUser TokenDto tokenDto, @RequestBody CorrelationTagListFormDto formDto){ |
|||
return new Result<List<CorrelationTagListResultDto>>().ok(tagService.correlationTagList(tokenDto,formDto)); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,123 @@ |
|||
/** |
|||
* 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.epmet.redis; |
|||
|
|||
import com.alibaba.druid.sql.visitor.functions.Concat; |
|||
import com.epmet.commons.tools.constant.Constant; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.constant.TagConstant; |
|||
import com.epmet.dto.form.CorrelationTagListFormDto; |
|||
import com.epmet.dto.result.CorrelationTagListResultDto; |
|||
import com.epmet.dto.result.TagInfoResultDto; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
@Component |
|||
public class TagRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public List<CorrelationTagListResultDto> get(String customerId, CorrelationTagListFormDto formDto){ |
|||
List<String> tagIdList = formDto.getTagIdList(); |
|||
Set<Object> objects ; |
|||
Collection<String> keys = new ArrayList<>(); |
|||
if (tagIdList.size() > 1){ |
|||
for (int i = NumConstant.ONE; i < tagIdList.size(); i++) { |
|||
String tagId = tagIdList.get(i); |
|||
tagId = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagId; |
|||
keys.add(tagId); |
|||
} |
|||
String key = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagIdList.get(0); |
|||
objects = redisUtils.sUnion(key, keys); |
|||
}else { |
|||
String key = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagIdList.get(0); |
|||
objects = redisUtils.sMembers(key); |
|||
} |
|||
List<CorrelationTagListResultDto> resultList = new ArrayList<>(); |
|||
if (objects.size()==NumConstant.ZERO){ |
|||
return resultList; |
|||
} |
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
for (Object object : objects) { |
|||
CorrelationTagListResultDto correlationTag = objectMapper.convertValue(object, CorrelationTagListResultDto.class); |
|||
resultList.add(correlationTag); |
|||
} |
|||
return resultList; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @Description 获取标签(政府端),按使用次数倒叙 |
|||
* @param key == customerId |
|||
* @author zxc |
|||
*/ |
|||
public List<TagInfoResultDto> zRevRange(String key){ |
|||
long start = 0; |
|||
long end = -1; |
|||
String tagKey = TagConstant.GOV_TAG_KEY+key; |
|||
Set<Object> objects = redisUtils.zRevRange(tagKey, start, end); |
|||
if (objects.size()== NumConstant.ZERO){ |
|||
return new ArrayList<>(); |
|||
} |
|||
List<TagInfoResultDto> result = new ArrayList<TagInfoResultDto>(); |
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
for (Object object : objects) { |
|||
TagInfoResultDto tagInfoResultDto = objectMapper.convertValue(object, TagInfoResultDto.class); |
|||
result.add(tagInfoResultDto); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* @Description 获取标签(居民端) |
|||
* @param key == gridId |
|||
* @author zxc |
|||
*/ |
|||
public List<TagInfoResultDto> zGridRevRange(String key){ |
|||
long start = 0; |
|||
long end = -1; |
|||
String tagKey = TagConstant.GRID_TAG_KEY+key; |
|||
Set<Object> objects = redisUtils.zRevRange(tagKey, start, end); |
|||
if (objects.size()== NumConstant.ZERO){ |
|||
return new ArrayList<>(); |
|||
} |
|||
List<TagInfoResultDto> result = new ArrayList<TagInfoResultDto>(); |
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
for (Object object : objects) { |
|||
TagInfoResultDto tagInfoResultDto = objectMapper.convertValue(object, TagInfoResultDto.class); |
|||
result.add(tagInfoResultDto); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.dto.form.CorrelationTagListFormDto; |
|||
import com.epmet.dto.form.ResiTagListFormDto; |
|||
import com.epmet.dto.result.CorrelationTagListResultDto; |
|||
import com.epmet.dto.result.TagInfoResultDto; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface TagService { |
|||
|
|||
/** |
|||
* @Description 已发布列表页的标签——政府端 |
|||
* @param tokenDto |
|||
* @author zxc |
|||
*/ |
|||
List<TagInfoResultDto> tagList(TokenDto tokenDto); |
|||
|
|||
/** |
|||
* @Description 已发布列表页的标签——居民端 |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
List<TagInfoResultDto> resiTagList( ResiTagListFormDto formDto); |
|||
|
|||
/** |
|||
* @Description 已发布列表页-获取关联标签——政府端 |
|||
* @param tokenDto |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
List<CorrelationTagListResultDto> correlationTagList(TokenDto tokenDto, CorrelationTagListFormDto formDto); |
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.dao.ArticleDao; |
|||
import com.epmet.dto.form.CorrelationTagListFormDto; |
|||
import com.epmet.dto.form.ResiTagListFormDto; |
|||
import com.epmet.dto.result.CorrelationTagListResultDto; |
|||
import com.epmet.dto.result.TagInfoResultDto; |
|||
import com.epmet.feign.EpmetUserFeignClient; |
|||
import com.epmet.redis.TagRedis; |
|||
import com.epmet.service.TagService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class TagServiceImpl implements TagService { |
|||
|
|||
@Autowired |
|||
private TagRedis tagRedis; |
|||
@Autowired |
|||
private EpmetUserFeignClient epmetUserFeignClient; |
|||
@Autowired |
|||
private ArticleDao articleDao; |
|||
|
|||
/** |
|||
* @Description 已发布列表页的标签——政府端 |
|||
* @param tokenDto |
|||
* @author zxc |
|||
*/ |
|||
@Override |
|||
public List<TagInfoResultDto> tagList(TokenDto tokenDto) { |
|||
String customerId = tokenDto.getCustomerId(); |
|||
List<TagInfoResultDto> resultDtos = tagRedis.zRevRange(customerId); |
|||
return resultDtos; |
|||
} |
|||
|
|||
/** |
|||
* @Description 已发布列表页的标签——居民端 |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
@Override |
|||
public List<TagInfoResultDto> resiTagList(ResiTagListFormDto formDto) { |
|||
//校验 在本网格是否发布过文章
|
|||
Integer articleCounts = articleDao.checkPublishArticle(formDto); |
|||
if (articleCounts== NumConstant.ZERO){ |
|||
return new ArrayList<>(); |
|||
} |
|||
return tagRedis.zGridRevRange(formDto.getGridId()); |
|||
} |
|||
|
|||
/** |
|||
* @Description 已发布列表页-获取关联标签——政府端 |
|||
* @param tokenDto |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
@Override |
|||
public List<CorrelationTagListResultDto> correlationTagList(TokenDto tokenDto, CorrelationTagListFormDto formDto) { |
|||
String customerId = tokenDto.getCustomerId(); |
|||
return tagRedis.get(customerId,formDto); |
|||
} |
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/2 15:50 |
|||
*/ |
|||
@Data |
|||
public class ResiTagListFormDto implements Serializable { |
|||
private static final long serialVersionUID = -794399801200532922L; |
|||
|
|||
public interface ResiTagList{} |
|||
public interface ResiTagListWeb extends CustomerClientShowGroup {} |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
@NotBlank(message = "网格id不能为空",groups = {ResiTagList.class,ResiTagListWeb.class}) |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
} |
@ -1,9 +1,36 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.ResiTagListFormDto; |
|||
import com.epmet.dto.result.TagInfoResultDto; |
|||
import com.epmet.service.ArticleService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
@RestController |
|||
@RequestMapping("article") |
|||
public class ArticleController { |
|||
|
|||
@Autowired |
|||
private ArticleService articleService; |
|||
|
|||
/** |
|||
* @Description 首页标签及更多——居民端 |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
@PostMapping("taglist") |
|||
public Result<List<TagInfoResultDto>> resiTagList(@LoginUser TokenDto tokenDto, @RequestBody ResiTagListFormDto formDto){ |
|||
ValidatorUtils.validateEntity(formDto, ResiTagListFormDto.ResiTagList.class, ResiTagListFormDto.ResiTagListWeb.class); |
|||
return new Result<List<TagInfoResultDto>>().ok(articleService.resiTagList(tokenDto,formDto)); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,21 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.dto.form.ResiTagListFormDto; |
|||
import com.epmet.dto.result.TagInfoResultDto; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/2 15:59 |
|||
*/ |
|||
public interface ArticleService { |
|||
|
|||
/** |
|||
* @Description 首页标签及更多——居民端 |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
List<TagInfoResultDto> resiTagList(TokenDto tokenDto, ResiTagListFormDto formDto); |
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.dto.feign.GovVoiceFeignClient; |
|||
import com.epmet.dto.form.ResiTagListFormDto; |
|||
import com.epmet.dto.result.TagInfoResultDto; |
|||
import com.epmet.service.ArticleService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/2 16:00 |
|||
*/ |
|||
@Service |
|||
public class ArticleServiceImpl implements ArticleService { |
|||
|
|||
@Autowired |
|||
private GovVoiceFeignClient govVoiceFeignClient; |
|||
|
|||
/** |
|||
* @Description 首页标签及更多——居民端 |
|||
* @param formDto |
|||
* @author zxc |
|||
*/ |
|||
@Override |
|||
public List<TagInfoResultDto> resiTagList(TokenDto tokenDto, ResiTagListFormDto formDto) { |
|||
formDto.setCustomerId(tokenDto.getCustomerId()); |
|||
formDto.setUserId(tokenDto.getUserId()); |
|||
return govVoiceFeignClient.resiTagList(formDto).getData(); |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class LoginUserDetailsFormDTO { |
|||
private String app; |
|||
private String client; |
|||
private String userId; |
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
public class TagCustomerFormDTO implements Serializable{ |
|||
|
|||
private static final long serialVersionUID = -6722269597588807655L; |
|||
/** |
|||
* 用户Id |
|||
* */ |
|||
private String userId; |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zxc |
|||
*/ |
|||
@Data |
|||
public class TagCustomerResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4890020932450803062L; |
|||
/** |
|||
* 客户id |
|||
* */ |
|||
private String customerId; |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.epmet.feign; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.TagCustomerFormDTO; |
|||
import com.epmet.dto.result.TagCustomerResultDTO; |
|||
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/6/2 14:05 |
|||
* , url = "localhost:8087" |
|||
*/ |
|||
//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class, url = "localhost:8087")
|
|||
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class) |
|||
public interface EpmetUserFeignClient { |
|||
|
|||
/** |
|||
* @Description 根据userId获取customerId |
|||
* @param formDTO |
|||
* @author zxc |
|||
*/ |
|||
@PostMapping("/epmetuser/user/getcustomeridbyuserid") |
|||
Result<TagCustomerResultDTO> getCustomerIdByUserId(@RequestBody TagCustomerFormDTO formDTO); |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.feign.fallback; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.ModuleUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.TagCustomerFormDTO; |
|||
import com.epmet.dto.result.TagCustomerResultDTO; |
|||
import com.epmet.feign.EpmetUserFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @Description 居民端-陌生人导览 调用gov-org服务 |
|||
* @Author sun |
|||
* @Date 2020/3/16 |
|||
*/ |
|||
@Component |
|||
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { |
|||
|
|||
@Override |
|||
public Result<TagCustomerResultDTO> getCustomerIdByUserId(TagCustomerFormDTO formDTO) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerIdByUserId", formDTO); |
|||
} |
|||
} |
Loading…
Reference in new issue