21 changed files with 404 additions and 85 deletions
@ -0,0 +1,41 @@ |
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.common.token.dto.TokenDto; |
|||
import com.elink.esua.epdc.commons.tools.annotation.LoginUser; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeFormDTO; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeResultDTO; |
|||
import com.elink.esua.epdc.service.NewsService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* news模块,移动端接口 |
|||
* |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/5 20:11 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("news") |
|||
public class ApiNewsController { |
|||
|
|||
@Autowired |
|||
private NewsService newsService; |
|||
|
|||
/** |
|||
* 移动端通知列表接口 |
|||
* |
|||
* @param userDetail |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcNoticeResultDTO>> |
|||
* @author yujintao |
|||
* @date 2019/9/5 20:17 |
|||
*/ |
|||
@GetMapping("notice/list") |
|||
public Result<List<EpdcNoticeResultDTO>> noticeList(@LoginUser TokenDto userDetail, EpdcNoticeFormDTO formDto) { |
|||
return newsService.noticeList(userDetail, formDto); |
|||
} |
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.elink.esua.epdc.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeFormDTO; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeResultDTO; |
|||
import com.elink.esua.epdc.feign.fallback.NewsFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 新闻模块调用 |
|||
* |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/5 19:20 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_NEWS_SERVER, fallback = NewsFeignClientFallback.class) |
|||
public interface NewsFeignClient { |
|||
|
|||
/** |
|||
* 获取通知列表 |
|||
* |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcNoticeResultDTO>> |
|||
* @author yujintao |
|||
* @date 2019/9/5 20:07 |
|||
*/ |
|||
@GetMapping(value = "news/notice/listNoticeForApp", consumes = MediaType.APPLICATION_JSON_VALUE) |
|||
Result<List<EpdcNoticeResultDTO>> listNoticeForApp(EpdcNoticeFormDTO formDto); |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.elink.esua.epdc.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeFormDTO; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeResultDTO; |
|||
import com.elink.esua.epdc.feign.NewsFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/5 19:28 |
|||
*/ |
|||
@Component |
|||
public class NewsFeignClientFallback implements NewsFeignClient { |
|||
|
|||
@Override |
|||
public Result<List<EpdcNoticeResultDTO>> listNoticeForApp(EpdcNoticeFormDTO formDto) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "listNoticeForApp", formDto); |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.elink.esua.epdc.dto.epdc.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* 移动端通知列表,查询条件 |
|||
* |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/5 19:40 |
|||
*/ |
|||
@Data |
|||
public class EpdcNoticeFormDTO { |
|||
|
|||
/** |
|||
* 用户所属网格ID |
|||
*/ |
|||
@NotBlank(message = "用户网格ID不能为空") |
|||
private String deptId; |
|||
|
|||
/** |
|||
* 页码 |
|||
*/ |
|||
@NotNull(message = "页码不能为空") |
|||
private Integer pageIndex; |
|||
|
|||
/** |
|||
* 页容量 |
|||
*/ |
|||
@NotNull(message = "页容量不能为空") |
|||
private Integer pageSize; |
|||
|
|||
/** |
|||
* 第一页查询发起时的时间 |
|||
*/ |
|||
@NotBlank(message = "时间戳不能为空") |
|||
private String timestamp; |
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.elink.esua.epdc.dto.epdc.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 用于移动端获取通知列表 |
|||
* |
|||
* @author yujintao |
|||
* @email yujintao@elink-cn.com |
|||
* @date 2019/9/5 19:30 |
|||
*/ |
|||
@Data |
|||
public class EpdcNoticeResultDTO { |
|||
|
|||
/** |
|||
* 通知ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 通知标题 |
|||
*/ |
|||
private String noticeTitle; |
|||
|
|||
/** |
|||
* 通知发布时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
|||
private Date noticeTime; |
|||
|
|||
/** |
|||
* 通知发布部门 |
|||
*/ |
|||
private String deptName; |
|||
} |
Loading…
Reference in new issue