forked from luyan/epmet-cloud-lingshan
38 changed files with 695 additions and 21 deletions
@ -0,0 +1,34 @@ |
|||||
|
package com.epmet.feign; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.CustomerAgencyDTO; |
||||
|
import com.epmet.dto.form.LatestGridFormDTO; |
||||
|
import com.epmet.dto.form.StaffInfoFromDTO; |
||||
|
import com.epmet.dto.result.CustomerGridByUserIdResultDTO; |
||||
|
import com.epmet.dto.result.LatestCustomerResultDTO; |
||||
|
import com.epmet.dto.result.MineResultDTO; |
||||
|
import com.epmet.feign.fallback.GovOrgFeignClientFallBack; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description url = "localhost:8092" |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) |
||||
|
public interface GovOrgFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* 根据staffId查询所属的组织机构 |
||||
|
* @param staffId |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/gov/org/agency/agencybystaff/{staffId}") |
||||
|
Result<CustomerAgencyDTO> getAgencyByStaff(@PathVariable("staffId") String staffId); |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
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.CustomerAgencyDTO; |
||||
|
import com.epmet.dto.form.LatestGridFormDTO; |
||||
|
import com.epmet.dto.form.StaffInfoFromDTO; |
||||
|
import com.epmet.dto.result.CustomerGridByUserIdResultDTO; |
||||
|
import com.epmet.dto.result.LatestCustomerResultDTO; |
||||
|
import com.epmet.dto.result.MineResultDTO; |
||||
|
import com.epmet.feign.GovOrgFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@Component |
||||
|
public class GovOrgFeignClientFallBack implements GovOrgFeignClient { |
||||
|
@Override |
||||
|
public Result<CustomerAgencyDTO> getAgencyByStaff(String staffId) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyByStaff", staffId); |
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/6/3 14:43 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class DraftListFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 7957826609741967502L; |
||||
|
/** |
||||
|
* 页码 |
||||
|
*/ |
||||
|
private Integer pageNo; |
||||
|
/** |
||||
|
* 每页显示数量 |
||||
|
*/ |
||||
|
private Integer pageSize; |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/6/3 14:47 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OfflineListFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -5928134434874117068L; |
||||
|
/** |
||||
|
* 页码 |
||||
|
*/ |
||||
|
private Integer pageNo; |
||||
|
/** |
||||
|
* 每页显示数量 |
||||
|
*/ |
||||
|
private Integer pageSize; |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/6/2 14:09 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PublishedListFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -8377558773628524229L; |
||||
|
/** |
||||
|
* 页码 |
||||
|
*/ |
||||
|
private Integer pageNo; |
||||
|
/** |
||||
|
* 每页显示数量 |
||||
|
*/ |
||||
|
private Integer pageSize; |
||||
|
/** |
||||
|
* 标签 |
||||
|
*/ |
||||
|
private List<String> tagIdList; |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/6/3 14:44 |
||||
|
*/ |
||||
|
@NoArgsConstructor |
||||
|
@Data |
||||
|
public class DraftListResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -3596277149943610099L; |
||||
|
/** |
||||
|
* 文章ID |
||||
|
*/ |
||||
|
private String draftId; |
||||
|
/** |
||||
|
* 文章标题 |
||||
|
*/ |
||||
|
private String title; |
||||
|
/** |
||||
|
* 文章内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Long createdTime; |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/6/3 14:48 |
||||
|
*/ |
||||
|
@NoArgsConstructor |
||||
|
@Data |
||||
|
public class OfflineListResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -5817451219557672084L; |
||||
|
/** |
||||
|
* 文章ID |
||||
|
*/ |
||||
|
private String articleId; |
||||
|
/** |
||||
|
* 文章标题 |
||||
|
*/ |
||||
|
private String title; |
||||
|
/** |
||||
|
* 发布单位 |
||||
|
*/ |
||||
|
private String publisherName; |
||||
|
/** |
||||
|
* 发布时间 |
||||
|
*/ |
||||
|
private String publishDate; |
||||
|
/** |
||||
|
* 概要内容 |
||||
|
*/ |
||||
|
private String previewContent; |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/6/2 14:12 |
||||
|
*/ |
||||
|
@NoArgsConstructor |
||||
|
@Data |
||||
|
public class PublishedListResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -8525181219822398750L; |
||||
|
/** |
||||
|
* 文章ID |
||||
|
*/ |
||||
|
private String articleId; |
||||
|
/** |
||||
|
* 文章标题 |
||||
|
*/ |
||||
|
private String title; |
||||
|
/** |
||||
|
* 发布单位 |
||||
|
*/ |
||||
|
private String publisherName; |
||||
|
/** |
||||
|
* 发布时间 |
||||
|
*/ |
||||
|
private String publishDate; |
||||
|
/** |
||||
|
* 文章标签串 |
||||
|
*/ |
||||
|
private String tags; |
||||
|
/** |
||||
|
* 概要内容 |
||||
|
*/ |
||||
|
private String previewContent; |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
import org.springframework.core.annotation.Order; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.web.context.request.RequestAttributes; |
||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
import org.springframework.core.annotation.Order; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.web.context.request.RequestAttributes; |
||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue