From 1d16e7a91c2018d9b511669f8c2d3f7210beb9fd Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 24 四月 2024 10:20:36 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pms-SV
---
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaLog.java | 36 ++++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoBa/BaLogMapper.java | 20 ++
pms-parent/pms-global/src/main/resources/application-global.yml | 1
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/OperationDescription.java | 12 +
pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/RoleCtrl.java | 6
pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java | 4
pms-parent/pms-global/src/main/resources/mapper/BaLogMapper.xml | 111 ++++++++++++
pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/log/LogCtrl.java | 62 ++++++
pms-parent/pms-common/src/main/java/com/dy/common/util/ObjectToMapUtil.java | 35 +++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/OperationLogAspect.java | 117 +++++++++++++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogSv.java | 57 ++++++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/QueryVo.java | 14 +
pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java | 8
13 files changed, 483 insertions(+), 0 deletions(-)
diff --git a/pms-parent/pms-common/src/main/java/com/dy/common/util/ObjectToMapUtil.java b/pms-parent/pms-common/src/main/java/com/dy/common/util/ObjectToMapUtil.java
new file mode 100644
index 0000000..8165e98
--- /dev/null
+++ b/pms-parent/pms-common/src/main/java/com/dy/common/util/ObjectToMapUtil.java
@@ -0,0 +1,35 @@
+package com.dy.common.util;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ObjectToMapUtil {
+
+ /**
+ * 灏嗗璞¤浆鎹负Map銆�
+ *
+ * @param obj 瑕佽浆鎹㈢殑瀵硅薄銆�
+ * @return 鍖呭惈瀵硅薄瀛楁鍜屽�肩殑Map銆�
+ */
+ public static Map<String, Object> objectToMap(Object obj) {
+ if (obj == null) {
+ return null;
+ }
+
+ Map<String, Object> map = new HashMap<>();
+ Class<?> clazz = obj.getClass();
+ Field[] fields = clazz.getDeclaredFields();
+
+ for (Field field : fields) {
+ try {
+ field.setAccessible(true); // 璁剧疆瀛楁鍙闂�
+ map.put(field.getName(), field.get(obj));
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("Error accessing field: " + field.getName(), e);
+ }
+ }
+
+ return map;
+ }
+}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogSv.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogSv.java
new file mode 100644
index 0000000..838e72b
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogSv.java
@@ -0,0 +1,57 @@
+package com.dy.pmsGlobal.aop;
+
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pmsGlobal.daoBa.BaLogMapper;
+import com.dy.pmsGlobal.pojoBa.BaLog;
+import org.apache.dubbo.common.utils.PojoUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class LogSv {
+
+ @Autowired
+ private BaLogMapper dao;
+
+ public void save(long operator, String operation,String resIp) {
+ BaLog log = new BaLog();
+ log.setUserId(operator);
+ log.setContent(operation);
+ log.setCreateDt(new Date());
+ log.setResIp(resIp);
+ dao.insert(log);
+ }
+
+ /**
+ * 寰楀埌鏃ュ織
+ *
+ * @param id 鏃ュ織ID
+ * @return 瀹炰綋
+ */
+ public BaLog selectById(Long id) {
+ return dao.selectByPrimaryKey(id);
+ }
+
+
+ /**
+ * 鑾峰彇鏃ュ織鍒楄〃
+ */
+ public QueryResultVo<List<BaLog>> selectSome(QueryVo queryVo) {
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+
+ //鏌ヨ绗﹀悎鏉′欢鐨勮褰曟�绘暟
+ Long itemTotal = dao.selectSomeCount(params);
+
+ QueryResultVo<List<BaLog>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ;
+ //璁$畻鍒嗛〉绛変俊鎭�
+ rsVo.calculateAndSet(itemTotal, params);
+
+ //鏌ヨ绗﹀悎鏉′欢鐨勮褰�
+ rsVo.obj = this.dao.selectSome(params) ;
+ return rsVo ;
+ }
+}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/OperationDescription.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/OperationDescription.java
new file mode 100644
index 0000000..58c9bcd
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/OperationDescription.java
@@ -0,0 +1,12 @@
+package com.dy.pmsGlobal.aop;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface OperationDescription {
+ String value();
+}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/OperationLogAspect.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/OperationLogAspect.java
new file mode 100644
index 0000000..919556a
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/OperationLogAspect.java
@@ -0,0 +1,117 @@
+package com.dy.pmsGlobal.aop;
+
+import com.dy.common.util.ObjectToMapUtil;
+import com.dy.common.webFilter.UserTokenContext;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.pmsGlobal.pojoBa.BaUser;
+import com.mysql.cj.util.StringUtils;
+import jakarta.servlet.http.HttpServletRequest;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.util.UriComponentsBuilder;
+
+import java.util.Map;
+
+@Aspect
+@Component
+public class OperationLogAspect {
+
+ @Value("${pms.sso.curUserUrl}")
+ public String SsoCurUserUrl ;
+
+ private LogSv logSv;
+ @Autowired
+ public void setLogSv(LogSv logSv){
+ this.logSv = logSv;
+ }
+ private RestTemplate restTemplate;
+ @Autowired
+ public void setRestTemplate(RestTemplate restTemplate){
+ this.restTemplate = restTemplate ;
+ }
+
+ @AfterReturning(pointcut = "@annotation(com.dy.pmsGlobal.aop.OperationDescription)", returning = "result")
+ public void logAfterReturning(JoinPoint joinPoint, Object result) {
+ // 鑾峰彇鏂规硶鐨勪腑鏂囨弿杩�
+ MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
+ OperationDescription operationDescription = methodSignature.getMethod().getAnnotation(OperationDescription.class);
+ String operationName = operationDescription.value();
+ //缁撴灉
+ BaseResponse response = (BaseResponse)result;
+ response.isSuccess();
+ // 鑾峰彇鐢ㄦ埛淇℃伅
+ BaUser user = (BaUser)getCurUser(response);
+ Long operator = user!=null?user.id: 1l;
+
+ // 鑾峰彇IP鍦板潃
+ String ipAddress = getRemoteHost();
+ // 璁板綍鏃ュ織
+ logSv.save(operator, operationName,ipAddress);
+ }
+
+ /**
+ * 璋冪敤SSO鑾峰彇鐢ㄦ埛淇℃伅
+ * @param response (鑾峰彇token)
+ * @return 杩斿洖瀵硅薄
+ */
+ private Object getCurUser(BaseResponse response){
+ if(!StringUtils.isNullOrEmpty(SsoCurUserUrl)){
+ String token = UserTokenContext.get();
+ if(StringUtils.isNullOrEmpty(token)){
+ Map<String,Object> resMap = ObjectToMapUtil.objectToMap(response.getContent());
+ token =resMap.containsKey("token")?resMap.get("token").toString():"";
+ }
+
+ String url = UriComponentsBuilder.fromUriString(SsoCurUserUrl)
+ .queryParam("token", token)
+ .build()
+ .toUriString();
+ HttpHeaders headers = new HttpHeaders();
+ HttpEntity<?> httpEntity = new HttpEntity<>(headers);
+ ResponseEntity<BaUser> myResponse = null;
+ try {
+ // 閫氳繃Get鏂瑰紡璋冪敤鎺ュ彛
+ myResponse = restTemplate.exchange(url, HttpMethod.GET, httpEntity, BaUser.class);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ assert myResponse != null;
+ return myResponse.getBody();
+ }else {
+ return BaseResponseUtils.buildError("鍚庣绯荤粺鍑洪敊锛屾湭寰楀埌SsoCurUserUrl");
+ }
+ }
+
+ /**
+ * 鑾峰彇IP鍦板潃
+ * @return
+ */
+ private String getRemoteHost() {
+ // 鑾峰彇璇锋眰瀵硅薄
+ HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
+ String ip = request.getHeader("x-forwarded-for");
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("WL-Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getRemoteAddr();
+ }
+ return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
+ }
+}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/QueryVo.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/QueryVo.java
new file mode 100644
index 0000000..ee07597
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/QueryVo.java
@@ -0,0 +1,14 @@
+package com.dy.pmsGlobal.aop;
+
+import com.dy.common.webUtil.QueryConditionVo;
+import lombok.*;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ToString(callSuper = true)
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class QueryVo extends QueryConditionVo {
+ public String name;
+}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoBa/BaLogMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoBa/BaLogMapper.java
new file mode 100644
index 0000000..a9a0a60
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoBa/BaLogMapper.java
@@ -0,0 +1,20 @@
+package com.dy.pmsGlobal.daoBa;
+
+import com.dy.pmsGlobal.pojoBa.BaLog;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface BaLogMapper {
+ int insert(BaLog record);
+
+ int insertSelective(BaLog record);
+
+ BaLog selectByPrimaryKey(Long id);
+
+ List<BaLog> selectSome(Map<String, Object> params);
+
+ Long selectSomeCount(Map<String, Object> params);
+}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaLog.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaLog.java
new file mode 100644
index 0000000..dc0b617
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaLog.java
@@ -0,0 +1,36 @@
+package com.dy.pmsGlobal.pojoBa;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.util.Date;
+
+@TableName(value="ba_log", autoResultMap = true)
+@Data
+@Builder
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+public class BaLog {
+ private Long id;
+
+ /**
+ * 鐢ㄦ埛ID
+ */
+ private Long userId;
+
+ /**
+ * 鏃ュ織鍐呭
+ */
+ private String content;
+
+ /**
+ * 璇锋眰IP
+ */
+ private String resIp;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ private Date createDt;
+}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/application-global.yml b/pms-parent/pms-global/src/main/resources/application-global.yml
index 2b98a32..1a79b0a 100644
--- a/pms-parent/pms-global/src/main/resources/application-global.yml
+++ b/pms-parent/pms-global/src/main/resources/application-global.yml
@@ -53,6 +53,7 @@
webPort: 8000
sso:
checkUrl: http://127.0.0.1:12344/sso/sso/ssoCheck
+ curUserUrl: http://127.0.0.1:12344/sso/sso/ssoCurUser
webPort: 12344
idSuffix: 1
base:
diff --git a/pms-parent/pms-global/src/main/resources/mapper/BaLogMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/BaLogMapper.xml
new file mode 100644
index 0000000..c7cd531
--- /dev/null
+++ b/pms-parent/pms-global/src/main/resources/mapper/BaLogMapper.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dy.pmsGlobal.daoBa.BaLogMapper">
+ <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoBa.BaLog">
+ <!--@mbg.generated-->
+ <!--@Table ba_log-->
+ <id column="id" jdbcType="BIGINT" property="id" />
+ <result column="user_id" jdbcType="BIGINT" property="userId" />
+ <result column="content" jdbcType="VARCHAR" property="content" />
+ <result column="res_ip" jdbcType="VARCHAR" property="resIp" />
+ <result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--@mbg.generated-->
+ id, user_id, content, create_dt,res_ip
+ </sql>
+ <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+ <!--@mbg.generated-->
+ select
+ <include refid="Base_Column_List" />
+ from ba_log
+ where id = #{id,jdbcType=BIGINT}
+ </select>
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoBa.BaLog" useGeneratedKeys="true">
+ <!--@mbg.generated-->
+ insert into ba_log (user_id, content, create_dt,res_ip
+ )
+ values (#{userId,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, #{createDt,jdbcType=TIMESTAMP}
+ , #{resIp,jdbcType=VARCHAR}
+ )
+ </insert>
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoBa.BaLog" useGeneratedKeys="true">
+ <!--@mbg.generated-->
+ insert into ba_log
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="userId != null">
+ user_id,
+ </if>
+ <if test="content != null">
+ content,
+ </if>
+ <if test="createDt != null">
+ create_dt,
+ </if>
+ <if test="resIp != null">
+ res_ip,
+ </if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="userId != null">
+ #{userId,jdbcType=BIGINT},
+ </if>
+ <if test="content != null">
+ #{content,jdbcType=VARCHAR},
+ </if>
+ <if test="createDt != null">
+ #{createDt,jdbcType=TIMESTAMP},
+ </if>
+ <if test="resIp != null">
+ #{resIp,jdbcType=VARCHAR},
+ </if>
+ </trim>
+ </insert>
+
+ <select id="selectSome" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List" >
+ <property name="alias" value="r"/>
+ </include>
+ from ba_log r
+ <trim prefix="where " suffixOverrides="and">
+ <if test="userId != null and userId != ''">
+ user_id = #{userId,jdbcType=BIGINT} and
+ </if>
+ <if test="content != null and content != '' ">
+ content like concat('%', #{content}, '%') and
+ </if>
+ <if test="createDt != null and createDt != '' ">
+ create_dt = #{createDt,jdbcType=TIMESTAMP} and
+ </if>
+ <if test="resIp != null and resIp != '' ">
+ res_ip =#{resIp,jdbcType=VARCHAR} and
+ </if>
+ </trim>
+ order by id desc
+ <trim prefix="limit " >
+ <if test="start != null and count != null">
+ #{start}, #{count}
+ </if>
+ </trim>
+ </select>
+
+ <select id="selectSomeCount" resultType="java.lang.Long">
+ select count(1)
+ from ba_log r
+ <trim prefix="where " suffixOverrides="and">
+ <if test="userId != null and userId != ''">
+ user_id = #{userId,jdbcType=BIGINT} and
+ </if>
+ <if test="content != null and content != '' ">
+ content like concat('%', #{content}, '%') and
+ </if>
+ <if test="createDt != null and createDt != '' ">
+ create_dt = #{createDt,jdbcType=TIMESTAMP} and
+ </if>
+ <if test="resIp != null and resIp != '' ">
+ res_ip =#{resIp,jdbcType=VARCHAR} and
+ </if>
+ </trim>
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/log/LogCtrl.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/log/LogCtrl.java
new file mode 100644
index 0000000..a64949a
--- /dev/null
+++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/log/LogCtrl.java
@@ -0,0 +1,62 @@
+package com.dy.pmsBase.log;
+
+import com.dy.common.aop.SsoPowerAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pmsGlobal.aop.LogSv;
+import com.dy.pmsGlobal.aop.OperationDescription;
+import com.dy.pmsGlobal.aop.QueryVo;
+import com.dy.pmsGlobal.pojoBa.BaLog;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Slf4j
+@RestController
+@RequestMapping(path = "log")
+@SuppressWarnings("unchecked")
+public class LogCtrl {
+ private LogSv sv;
+ @Autowired
+ public void setSv(LogSv sv) {
+ this.sv = sv;
+ }
+
+ /**
+ * 鏍规嵁id鏌ヨ鏃ュ織
+ * @return
+ */
+ @GetMapping(path = "one")
+ @SsoPowerAop(power = "10100010") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
+ @OperationDescription("鏌ヨ鍗曟潯鏃ュ織")
+ public BaseResponse<BaLog> one(String id){
+ try {
+ return BaseResponseUtils.buildSuccess(sv.selectById(Long.parseLong(id)));
+ } catch (Exception e) {
+ log.error("鏌ヨ鍗曟潯鏃ュ織鏁版嵁寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage());
+ }
+ }
+
+ /**
+ * 鍒嗛〉鏌ヨ鏃ュ織
+ * @return
+ */
+ @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE)
+ @SsoPowerAop(power = "10100010") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
+ @OperationDescription("鍒嗛〉鏌ヨ鏃ュ織")
+ public BaseResponse<QueryResultVo<List<BaLog>>> some(@RequestBody QueryVo vo){
+ try {
+ QueryResultVo<List<BaLog>> res = sv.selectSome(vo);
+ return BaseResponseUtils.buildSuccess(res);
+ } catch (Exception e) {
+ log.error("鍒嗛〉鏌ヨ鏃ュ織寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage());
+ }
+ }
+
+}
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/RoleCtrl.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/RoleCtrl.java
index 3ff0904..0b31b90 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/RoleCtrl.java
+++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/role/RoleCtrl.java
@@ -5,6 +5,7 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pmsGlobal.aop.OperationDescription;
import com.dy.pmsGlobal.pojoBa.BaRole;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
@@ -36,6 +37,7 @@
*/
@PostMapping(path="save")
@SsoPowerAop(power = "10100011")
+ @OperationDescription("淇濆瓨瑙掕壊淇℃伅")
public BaseResponse<BaRole> save(@RequestBody @Valid BaRole role,BindingResult bindingResult){
try {
role.setDeleted(false);
@@ -56,6 +58,7 @@
*/
@PostMapping(path="update")
@SsoPowerAop(power = "10100011")
+ @OperationDescription("鏇存柊瑙掕壊淇℃伅")
public BaseResponse<BaRole> update(@RequestBody @Valid BaRole role,BindingResult bindingResult){
try {
return BaseResponseUtils.buildSuccess(roleSv.update(role));
@@ -73,6 +76,7 @@
*/
@PostMapping(path="delete")
@SsoPowerAop(power = "10100011")
+ @OperationDescription("鍒犻櫎瑙掕壊淇℃伅")
public BaseResponse<BaRole> delete(String id,BindingResult bindingResult){
try {
return BaseResponseUtils.buildSuccess(roleSv.delete(Long.parseLong(id)));
@@ -89,6 +93,7 @@
*/
@GetMapping(path="one")
@SsoPowerAop(power = "10100010") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
+ @OperationDescription("鏍规嵁ID鏌ヨ瑙掕壊淇℃伅")
public BaseResponse<BaRole> one(String id){
try{
BaRole role=roleSv.selectById(id);
@@ -106,6 +111,7 @@
*/
@PostMapping(path="some")
@SsoPowerAop(power = "10100010")
+ @OperationDescription("鍒嗛〉鏌ヨ瑙掕壊淇℃伅")
public BaseResponse<QueryResultVo<List<BaRole>>> some(@RequestBody QueryVo vo){
try {
QueryResultVo<List<BaRole>> list = roleSv.selectSome(vo) ;
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java
index 01bd5b6..603ad0d 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java
+++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserCtrl.java
@@ -6,6 +6,7 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pmsGlobal.aop.OperationDescription;
import com.dy.pmsGlobal.pojoBa.BaUser;
import com.dy.pmsGlobal.util.Constant;
import com.mysql.cj.util.StringUtils;
@@ -44,6 +45,7 @@
* @return 榛樿瀵嗙爜
*/
@GetMapping(path = "defaultPassword")
+ @OperationDescription("瀹㈡埛绔姹傚緱鍒伴粯璁ゅ瘑鐮�")
public BaseResponse<String> defaultPassword(){
if(defaultTrueRandomFalsePassword){
return BaseResponseUtils.buildSuccess(defaultPassword) ;
@@ -60,6 +62,7 @@
@PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE)
//@SsoAop() //鍙湁鐧诲綍楠岃瘉锛屾病鏈夋潈闄愰獙璇�
@SsoPowerAop(power = "10100010") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
+ @OperationDescription("鍒嗛〉鏌ヨ鐢ㄦ埛")
public BaseResponse<QueryResultVo<List<BaUser>>> some(@RequestBody QueryVo vo) {
try {
QueryResultVo<List<BaUser>> res = this.sv.selectSome(vo);
@@ -78,6 +81,7 @@
@GetMapping(path = "one")
//@SsoAop() //鍙湁鐧诲綍楠岃瘉锛屾病鏈夋潈闄愰獙璇�
@SsoPowerAop(power = "10100010") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
+ @OperationDescription("鏌ヨ鍗曚釜鐢ㄦ埛")
public BaseResponse<BaUser> one(String id) {
try {
return BaseResponseUtils.buildSuccess(this.sv.selectById(Long.parseLong(id)));
@@ -96,6 +100,7 @@
@PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE)
//@SsoAop() //鍙湁鐧诲綍楠岃瘉锛屾病鏈夋潈闄愰獙璇�
@SsoPowerAop(power = "10100011") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
+ @OperationDescription("淇濆瓨鐢ㄦ埛淇℃伅")
public BaseResponse<Boolean> save(@RequestBody @Valid BaUser po, BindingResult bindingResult) {
if (bindingResult != null && bindingResult.hasErrors()) {
return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
@@ -136,6 +141,7 @@
@PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
//@SsoAop() //鍙湁鐧诲綍楠岃瘉锛屾病鏈夋潈闄愰獙璇�
@SsoPowerAop(power = "10100011") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
+ @OperationDescription("鏇存柊鐢ㄦ埛淇℃伅")
public BaseResponse<Boolean> update(@RequestBody @Validated BaUser po, BindingResult bindingResult) {
int count;
try {
@@ -168,6 +174,7 @@
//@GetMapping(path = "changePassword", consumes = MediaType.TEXT_PLAIN_VALUE)
@GetMapping(path = "changePassword")
@SsoAop()
+ @OperationDescription("淇敼瀵嗙爜")
public BaseResponse<Boolean> changePassword(String id, String oldPassword, String newPassword) {
int count;
try {
@@ -220,6 +227,7 @@
@PostMapping(path = "resetPassword", consumes = MediaType.APPLICATION_JSON_VALUE)
//@SsoAop() //鍙湁鐧诲綍楠岃瘉锛屾病鏈夋潈闄愰獙璇�
@SsoPowerAop(power = "10100011") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇�
+ @OperationDescription("閲嶇疆瀵嗙爜")
public BaseResponse<Boolean> resetPassword(@RequestBody @Validated ResetPasswordVo vo, BindingResult bindingResult) {
int count;
try {
diff --git a/pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java b/pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
index 3bc9662..2e9b29c 100644
--- a/pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
+++ b/pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
@@ -4,6 +4,7 @@
import com.dy.common.util.MD5;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.pmsGlobal.aop.OperationDescription;
import com.dy.pmsGlobal.pojoBa.BaUser;
import com.mysql.cj.util.StringUtils;
import jakarta.servlet.http.HttpServletRequest;
@@ -45,6 +46,7 @@
* @return 鐧诲綍鐢ㄦ埛鍊煎璞�
*/
@PostMapping(path = "login", consumes = MediaType.APPLICATION_JSON_VALUE)//鍓嶇鎻愪氦json鏁版嵁
+ @OperationDescription("鐢ㄦ埛鐧诲綍(json)")
public BaseResponse<UserVo> login(@RequestBody @Valid LoginVo vo, BindingResult bindingResult) {
try {
if(bindingResult != null && bindingResult.hasErrors()){
@@ -63,6 +65,7 @@
* @return 鐧诲綍鐢ㄦ埛鍊煎璞�
*/
@PostMapping(path = "loginForm", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)//鍓嶇鎻愪氦form琛ㄥ崟鏁版嵁
+ @OperationDescription("鐢ㄦ埛鐧诲綍(form)")
public BaseResponse<UserVo> loginForm(@RequestBody @Valid LoginVo vo, BindingResult bindingResult){
try{
if(bindingResult != null && bindingResult.hasErrors()){
@@ -82,6 +85,7 @@
* @return 姝e父閫�鍑虹櫥褰曡繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse
*/
@GetMapping(path = "logout")
+ @OperationDescription("閫�鍑虹櫥褰�")
public BaseResponse<Boolean> logout(HttpServletRequest hr){
try{
String token = hr.getHeader("token") ;
--
Gitblit v1.8.0