forked from luyan/epmet-cloud-lingshan
17 changed files with 295 additions and 13 deletions
@ -0,0 +1,31 @@ |
|||
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") |
|||
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,30 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
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; |
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
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; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
@NotBlank(message = "网格id不能为空") |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
} |
@ -1,9 +1,34 @@ |
|||
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.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){ |
|||
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(); |
|||
} |
|||
} |
Loading…
Reference in new issue