Преглед на файлове

【NEW】地感器增加字段

zhaomn преди 3 години
родител
ревизия
30e3dcd28f
променени са 15 файла, в които са добавени 225 реда и са изтрити 117 реда
  1. 11 14
      railway-business/src/main/java/com/railway/business/baseinfo/controller/BusDmcgyqController.java
  2. 4 0
      railway-business/src/main/java/com/railway/business/baseinfo/domain/BusDmcgyq.java
  3. 25 0
      railway-business/src/main/java/com/railway/business/baseinfo/domain/query/DmcgyqQuery.java
  4. 7 0
      railway-business/src/main/java/com/railway/business/baseinfo/mapper/BusDmcgyqMapper.java
  5. 6 0
      railway-business/src/main/java/com/railway/business/baseinfo/service/IBusDmcgyqService.java
  6. 96 56
      railway-business/src/main/java/com/railway/business/baseinfo/service/impl/BusDmcgyqServiceImpl.java
  7. 2 2
      railway-business/src/main/java/com/railway/business/catenary/controller/BusJcbDmcgyqController.java
  8. 1 1
      railway-business/src/main/java/com/railway/business/catenary/mapper/BusJcbDmcgyqMapper.java
  9. 1 1
      railway-business/src/main/java/com/railway/business/catenary/service/IBusJcbDmcgyqService.java
  10. 2 2
      railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJcbDmcgyqServiceImpl.java
  11. 30 28
      railway-business/src/main/resources/mapper/baseinfo/BusDmcgyqMapper.xml
  12. 1 2
      railway-business/src/main/resources/mapper/catenary/BusJcbDmcgyqMapper.xml
  13. 4 4
      railway-common/src/main/java/com/railway/common/utils/sign/SignatureUtil.java
  14. 34 6
      railway-framework/src/main/java/com/railway/framework/aspectj/LogAspect.java
  15. 1 1
      railway-framework/src/main/java/com/railway/framework/interceptor/SignatureInterceptor.java

+ 11 - 14
railway-business/src/main/java/com/railway/business/baseinfo/controller/BusDmcgyqController.java

@@ -1,8 +1,7 @@
 package com.railway.business.baseinfo.controller;
 
-import com.railway.business.baseinfo.domain.BaseDeptStation;
 import com.railway.business.baseinfo.domain.BusDmcgyq;
-import com.railway.business.baseinfo.service.IBaseStationService;
+import com.railway.business.baseinfo.domain.query.DmcgyqQuery;
 import com.railway.business.baseinfo.service.IBusDmcgyqService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
@@ -32,20 +31,14 @@ import org.springframework.web.bind.annotation.RestController;
 public class BusDmcgyqController extends BaseController {
 
   private final IBusDmcgyqService busDmcgyqService;
-  private final IBaseStationService stationService;
 
-  public BusDmcgyqController(IBusDmcgyqService busDmcgyqService,
-      IBaseStationService stationService) {
+  public BusDmcgyqController(IBusDmcgyqService busDmcgyqService) {
     this.busDmcgyqService = busDmcgyqService;
-    this.stationService = stationService;
   }
 
   @ApiOperation(value = "新增")
   @PostMapping("/add")
   public AjaxResult add(@Validated @RequestBody BusDmcgyq busDmcgyq) {
-    BaseDeptStation deptStation = stationService.getInfo(busDmcgyq.getDeptId(),
-        busDmcgyq.getLineId(), busDmcgyq.getStationId());
-    busDmcgyq.setDeptStationId(deptStation.getId());
     return toAjax(busDmcgyqService.create(busDmcgyq));
   }
 
@@ -58,9 +51,6 @@ public class BusDmcgyqController extends BaseController {
   @ApiOperation(value = "更新")
   @PutMapping("/update")
   public AjaxResult update(@RequestBody @Valid BusDmcgyq busDmcgyq) {
-    BaseDeptStation deptStation = stationService.getInfo(busDmcgyq.getDeptId(),
-        busDmcgyq.getLineId(), busDmcgyq.getStationId());
-    busDmcgyq.setDeptStationId(deptStation.getId());
     return toAjax(busDmcgyqService.update(busDmcgyq));
   }
 
@@ -81,15 +71,22 @@ public class BusDmcgyqController extends BaseController {
     return getDataTable(list);
   }
 
+  @ApiOperation(value = "分组名称列表")
+  @GetMapping(value = "listTeam")
+  public AjaxResult listTeam(DmcgyqQuery query) {
+    List<String> list = busDmcgyqService.listTeam(query);
+    return AjaxResult.success(list);
+  }
+
   @ApiOperation(value = "支柱号范围-合并")
   @GetMapping(value = "combinedPillarArea")
   public AjaxResult combinedPillarArea(BusDmcgyq busDmcgyq) {
     List<BusDmcgyq> list = busDmcgyqService.getList(busDmcgyq);
     StringBuilder combinedPillarArea = new StringBuilder();
-    for(BusDmcgyq data : list) {
+    for (BusDmcgyq data : list) {
       combinedPillarArea.append(data.getPillarArea()).append(",");
     }
-    if(StringUtils.isNotBlank(combinedPillarArea.toString())) {
+    if (StringUtils.isNotBlank(combinedPillarArea.toString())) {
       combinedPillarArea = new StringBuilder(
           combinedPillarArea.substring(0, combinedPillarArea.lastIndexOf(",")));
     }

+ 4 - 0
railway-business/src/main/java/com/railway/business/baseinfo/domain/BusDmcgyq.java

@@ -68,6 +68,10 @@ public class BusDmcgyq extends BaseEntity {
   @Length(min = 1, max = 100, message = "【分相名称】长度必须介于 {min} 和 {max} 之间")
   private String fxmc;
 
+  @ApiModelProperty(value = "分组编号")
+  @Length(min = 1, max = 255, message = "【分组编号】长度必须介于 {min} 和 {max} 之间")
+  private String team;
+
   @ApiModelProperty(value = "锚段号")
   @Length(max = 50, message = "【锚段号】长度必须介于 {min} 和 {max} 之间")
   private String mdh;

+ 25 - 0
railway-business/src/main/java/com/railway/business/baseinfo/domain/query/DmcgyqQuery.java

@@ -0,0 +1,25 @@
+package com.railway.business.baseinfo.domain.query;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 基础数据-地面磁感应器
+ *
+ * @author zhaomn
+ */
+@Data
+@ApiModel("基础数据 - 地面磁感应器查询条件")
+public class DmcgyqQuery {
+
+  @ApiModelProperty(value = "车间ID")
+  private Long deptId;
+
+  @ApiModelProperty(value = "线别ID")
+  private Long lineId;
+
+  @ApiModelProperty(value = "区间ID")
+  private Long stationId;
+
+}

+ 7 - 0
railway-business/src/main/java/com/railway/business/baseinfo/mapper/BusDmcgyqMapper.java

@@ -2,6 +2,8 @@ package com.railway.business.baseinfo.mapper;
 
 import com.github.pagehelper.Page;
 import com.railway.business.baseinfo.domain.BusDmcgyq;
+import com.railway.business.baseinfo.domain.query.DmcgyqQuery;
+import java.util.List;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -40,4 +42,9 @@ public interface BusDmcgyqMapper {
     */
     Page<BusDmcgyq> getList(BusDmcgyq busDmcgyq);
 
+    /**
+     * 查询设备分组名称列表
+     */
+    List<String> listTeam(DmcgyqQuery query);
+
 }

+ 6 - 0
railway-business/src/main/java/com/railway/business/baseinfo/service/IBusDmcgyqService.java

@@ -1,6 +1,7 @@
 package com.railway.business.baseinfo.service;
 
 import com.railway.business.baseinfo.domain.BusDmcgyq;
+import com.railway.business.baseinfo.domain.query.DmcgyqQuery;
 import java.util.List;
 /**
 * 基础数据-地面磁感应器
@@ -34,4 +35,9 @@ public interface IBusDmcgyqService{
     */
     List<BusDmcgyq> getList(BusDmcgyq busDmcgyq);
 
+    /**
+     * 查询设备分组名称列表
+     */
+    List<String> listTeam(DmcgyqQuery query);
+
 }

+ 96 - 56
railway-business/src/main/java/com/railway/business/baseinfo/service/impl/BusDmcgyqServiceImpl.java

@@ -1,77 +1,117 @@
 package com.railway.business.baseinfo.service.impl;
 
+import com.railway.business.baseinfo.domain.BaseDeptStation;
 import com.railway.business.baseinfo.domain.BusDmcgyq;
+import com.railway.business.baseinfo.domain.query.DmcgyqQuery;
 import com.railway.business.baseinfo.mapper.BusDmcgyqMapper;
+import com.railway.business.baseinfo.service.IBaseStationService;
 import com.railway.business.baseinfo.service.IBusDmcgyqService;
+import com.railway.common.exception.ServiceException;
 import com.railway.common.utils.SecurityUtils;
 import java.util.Date;
 import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 /**
-* 基础数据-地面磁感应器
-* @author zcf
-* @date 2021/10/26
-*/
+ * 基础数据-地面磁感应器
+ *
+ * @author zcf
+ * @date 2021/10/26
+ */
 @Service
 @Transactional(readOnly = true)
-public class BusDmcgyqServiceImpl implements IBusDmcgyqService{
+public class BusDmcgyqServiceImpl implements IBusDmcgyqService {
+
+  private final IBaseStationService stationService;
+  private final BusDmcgyqMapper busDmcgyqMapper;
+
+  public BusDmcgyqServiceImpl(IBaseStationService stationService, BusDmcgyqMapper busDmcgyqMapper) {
+    this.stationService = stationService;
+    this.busDmcgyqMapper = busDmcgyqMapper;
+  }
 
-	private final BusDmcgyqMapper busDmcgyqMapper;
+  /**
+   * 新增
+   */
+  @Override
+  @Transactional(rollbackFor = Exception.class)
+  public int create(BusDmcgyq busDmcgyq) {
+    // 校验设备是否已经存在
+    checkDmcgyq(busDmcgyq);
+    // 设置默认字段值
+    BaseDeptStation deptStation = stationService.getInfo(busDmcgyq.getDeptId(),
+        busDmcgyq.getLineId(), busDmcgyq.getStationId());
+    busDmcgyq.setDeptStationId(deptStation.getId());
+    busDmcgyq.setCreateTime(new Date());
+    busDmcgyq.setCreateBy(SecurityUtils.getUserIdString());
+    return busDmcgyqMapper.insert(busDmcgyq);
+  }
 
-	public BusDmcgyqServiceImpl(BusDmcgyqMapper busDmcgyqMapper) {
-		this.busDmcgyqMapper = busDmcgyqMapper;
-	}
+  /**
+   * 删除
+   */
+  @Override
+  @Transactional(rollbackFor = Exception.class)
+  public int delete(Long[] ids) {
+    int r = 0;
+    for (Long id : ids) {
+      int j = busDmcgyqMapper.delete(id);
+      r = r + j;
+    }
+    return r;
+  }
 
-	/**
-	* 新增
-	*/
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public int create(BusDmcgyq busDmcgyq) {
-	    busDmcgyq.setCreateTime(new Date());
-	    busDmcgyq.setCreateBy(SecurityUtils.getUserIdString());
-		return busDmcgyqMapper.insert(busDmcgyq);
-	}
+  /**
+   * 更新
+   */
+  @Override
+  @Transactional(rollbackFor = Exception.class)
+  public int update(BusDmcgyq busDmcgyq) {
+    // 校验设备是否已经存在
+    checkDmcgyq(busDmcgyq);
+    // 设置默认字段值
+    BaseDeptStation deptStation = stationService.getInfo(busDmcgyq.getDeptId(),
+        busDmcgyq.getLineId(), busDmcgyq.getStationId());
+    busDmcgyq.setDeptStationId(deptStation.getId());
+    busDmcgyq.setUpdateTime(new Date());
+    busDmcgyq.setUpdateBy(SecurityUtils.getUserIdString());
+    return busDmcgyqMapper.update(busDmcgyq);
+  }
 
-	/**
-	* 删除
-	*/
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public int delete(Long[] ids) {
-		int r =0;
-		for (Long id : ids) {
-			int j= busDmcgyqMapper.delete(id);
-			r = r + j;
-		}
-		return	r;
-	}
+  /**
+   * 获取单个
+   */
+  @Override
+  public BusDmcgyq getInfo(Long id) {
+    return busDmcgyqMapper.getInfo(id);
+  }
 
-	/**
-	* 更新
-	*/
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public int update(BusDmcgyq busDmcgyq) {
-		busDmcgyq.setUpdateTime(new Date());
-    	busDmcgyq.setUpdateBy(SecurityUtils.getUserIdString());
-		return busDmcgyqMapper.update(busDmcgyq);
-	}
+  /**
+   * 查询列表
+   */
+  @Override
+  public List<BusDmcgyq> getList(BusDmcgyq busDmcgyq) {
+    return busDmcgyqMapper.getList(busDmcgyq);
+  }
 
-	/**
-	* 获取单个
-	*/
-	@Override
-	public BusDmcgyq getInfo(Long id) {
-		return busDmcgyqMapper.getInfo(id);
-	}
+  @Override
+  public List<String> listTeam(DmcgyqQuery query) {
+    return busDmcgyqMapper.listTeam(query);
+  }
 
-	/**
-	* 查询列表
-	*/
-	@Override
-	public List<BusDmcgyq> getList(BusDmcgyq busDmcgyq) {
-		return busDmcgyqMapper.getList(busDmcgyq);
-	}
+  private void checkDmcgyq(BusDmcgyq busDmcgyq){
+    BusDmcgyq query = new BusDmcgyq();
+    query.setTeam(busDmcgyq.getTeam());
+    query.setSbbh(busDmcgyq.getSbbh());
+    List<BusDmcgyq> dmcgyqList = this.getList(query);
+    if (CollectionUtils.isNotEmpty(dmcgyqList)) {
+      // 如果按照组号和设备编号查询的结果大于1,或者仅1条时,主键字段是新的,表示已经存在
+      if(dmcgyqList.size() > 1 || !dmcgyqList.get(0).getId().equals(busDmcgyq.getId())) {
+        throw new ServiceException("地面磁感应器设备组“" + busDmcgyq.getTeam() + "”已经存在编号为"
+            + busDmcgyq.getSbbh() + "的设备,请检查!");
+      }
+    }
+  }
 }

+ 2 - 2
railway-business/src/main/java/com/railway/business/catenary/controller/BusJcbDmcgyqController.java

@@ -84,8 +84,8 @@ public class BusJcbDmcgyqController extends BaseController {
 
   @ApiOperation(value = "获取上次检测值")
   @GetMapping(value = "/getLastOne")
-  public AjaxResult getLastOne() {
-    BusJcbDmcgyq info = busJcbDmcgyqService.getLastRecord();
+  public AjaxResult getLastOne(BusJcbDmcgyq busJcbDmcgyq) {
+    BusJcbDmcgyq info = busJcbDmcgyqService.getLastRecord(busJcbDmcgyq);
     AjaxResult ajax = AjaxResult.success();
     ajax.put("info", info);
     return ajax;

+ 1 - 1
railway-business/src/main/java/com/railway/business/catenary/mapper/BusJcbDmcgyqMapper.java

@@ -58,7 +58,7 @@ public interface BusJcbDmcgyqMapper {
     /**
      * 获取上次检查记录
      */
-    BusJcbDmcgyq getLastRecord(Long userId);
+    BusJcbDmcgyq getLastRecord(BusJcbDmcgyq busJcbDmcgyq);
 
     /**
      * 查询列表

+ 1 - 1
railway-business/src/main/java/com/railway/business/catenary/service/IBusJcbDmcgyqService.java

@@ -52,7 +52,7 @@ public interface IBusJcbDmcgyqService{
     /**
      * 获取上次检查记录
      */
-    BusJcbDmcgyq getLastRecord();
+    BusJcbDmcgyq getLastRecord(BusJcbDmcgyq busJcbDmcgyq);
 
     /**
      * 提交

+ 2 - 2
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJcbDmcgyqServiceImpl.java

@@ -130,8 +130,8 @@ public class BusJcbDmcgyqServiceImpl extends BusJcabServiceImpl implements IBusJ
    * 获取上次检查记录
    */
   @Override
-  public BusJcbDmcgyq getLastRecord() {
-    return busJcbDmcgyqMapper.getLastRecord(SecurityUtils.getUserId());
+  public BusJcbDmcgyq getLastRecord(BusJcbDmcgyq busJcbDmcgyq) {
+    return busJcbDmcgyqMapper.getLastRecord(busJcbDmcgyq);
   }
 
   /**

+ 30 - 28
railway-business/src/main/resources/mapper/baseinfo/BusDmcgyqMapper.xml

@@ -36,10 +36,14 @@
     <result column="update_by" property="updateBy"/>
     <result column="update_time" property="updateTime"/>
     <result column="sjbh" property="sjbh"/>
+    <result column="team" property="team"/>
   </resultMap>
 
   <sql id="Base_Column_List">
-    t.id,
+    t
+    .
+    id
+    ,
     v.dept_id,
     v.dept_name,
     v.line_id,
@@ -53,6 +57,7 @@
     t.gxms,
     t.fxcs,
     t.fxmc,
+    t.team,
     t.mdh,
     t.sbbh,
     t.gzlx,
@@ -96,6 +101,9 @@
       <if test='null != fxmc'>
         fxmc,
       </if>
+      <if test='null != team'>
+        team,
+      </if>
       <if test='null != mdh'>
         mdh,
       </if>
@@ -158,6 +166,9 @@
       <if test='null != fxmc'>
         #{fxmc},
       </if>
+      <if test='null != team'>
+        #{team},
+      </if>
       <if test='null != mdh'>
         #{mdh},
       </if>
@@ -216,6 +227,7 @@
       <if test='null != gxms'>gxms = #{gxms},</if>
       <if test='null != fxcs'>fxcs = #{fxcs},</if>
       <if test='null != fxmc'>fxmc = #{fxmc},</if>
+      <if test='null != team'>team = #{team},</if>
       <if test='null != mdh'>mdh = #{mdh},</if>
       <if test='null != sbbh'>sbbh = #{sbbh},</if>
       <if test='null != gzlx'>gzlx = #{gzlx},</if>
@@ -268,56 +280,46 @@
       <if test="pillarArea!=null and pillarArea!=''">
         and t.pillar_area=#{pillarArea}
       </if>
-      <if test="stationTrack!=null and stationTrack!=''">
-        and t.station_track=#{stationTrack}
-      </if>
-      <if test="gxms!=null and gxms!=''">
-        and t.gxms=#{gxms}
-      </if>
       <if test="fxcs!=null and fxcs!=''">
         and t.fxcs=#{fxcs}
       </if>
       <if test="fxmc!=null and fxmc!=''">
         and t.fxmc=#{fxmc}
       </if>
+      <if test="team!=null and team!=''">
+        and t.team=#{team}
+      </if>
       <if test="mdh!=null and mdh!=''">
         and t.mdh=#{mdh}
       </if>
       <if test="sbbh!=null and sbbh!=''">
         and t.sbbh=#{sbbh}
       </if>
-      <if test="gzlx!=null and gzlx!=''">
-        and t.gzlx=#{gzlx}
-      </if>
       <if test="czlc!=null and czlc!=''">
         and t.marker=#{czlc}
       </if>
-      <if test="fxzxlc!=null and fxzxlc!=''">
-        and t.fxzxlc=#{fxzxlc}
-      </if>
-      <if test="sccj!=null and sccj!=''">
-        and t.sccj=#{sccj}
-      </if>
-      <if test="xh!=null and xh!=''">
-        and t.xh=#{xh}
-      </if>
-      <if test="delFlag!=null and delFlag!=''">
-        and t.del_flag=#{delFlag}
-      </if>
       <if test="createBy!=null and createBy!=''">
         and t.create_by=#{createBy}
       </if>
       <if test="createTime!=null">
         and DATE_FORMAT(t.create_time, '%Y-%m-%d') = #{createTime}
       </if>
-      <if test="updateBy!=null and updateBy!=''">
-        and t.update_by=#{updateBy}
+    </where>
+  </select>
+
+  <select id="listTeam" resultType="java.lang.String">
+    SELECT distinct team FROM base_dmcgyq t
+    LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
+    <where>
+      t.del_flag='0'
+      <if test="deptId!=null and deptId!=''">
+        and v.dept_id=#{deptId}
       </if>
-      <if test="updateTime!=null">
-        and DATE_FORMAT(t.update_time, '%Y-%m-%d') = #{updateTime}
+      <if test="lineId!=null and lineId!=''">
+        and v.line_id=#{lineId}
       </if>
-      <if test="sjbh!=null and sjbh!=''">
-        and t.sjbh=#{sjbh}
+      <if test="stationId!=null and stationId!=''">
+        and v.station_id=#{stationId}
       </if>
     </where>
   </select>

+ 1 - 2
railway-business/src/main/resources/mapper/catenary/BusJcbDmcgyqMapper.xml

@@ -375,8 +375,7 @@
   </select>
 
   <select id="getLastRecord" resultMap="BaseResultMap">
-    SELECT
-    a.DGQCL_G1, a.DGQCL_G2, a.DGQCL_G3, a.DGQCL_G4
+    SELECT a.DGQCL_G1, a.DGQCL_G2, a.DGQCL_G3, a.DGQCL_G4
     FROM bus_jcb_dmcgyq a,
     (
     select max(update_time) as lastTime

+ 4 - 4
railway-common/src/main/java/com/railway/common/utils/sign/SignatureUtil.java

@@ -45,7 +45,7 @@ public class SignatureUtil {
     String[] sortedKeys = paramMap.keySet().toArray(new String[]{});
     Arrays.sort(sortedKeys);
 
-    final String SEPARATOR = "&";
+    final String separator = "&";
     // 生成stringToSign字符串
     StringBuilder stringToSign = new StringBuilder();
     StringBuilder canonicalizedQueryString = new StringBuilder();
@@ -54,7 +54,7 @@ public class SignatureUtil {
       if (isFirst) {
         isFirst = false;
       } else {
-        canonicalizedQueryString.append(SEPARATOR);
+        canonicalizedQueryString.append(separator);
       }
       log.debug("@@key {}, value {}@@", key, paramMap.get(key));
       // 这里注意对key和value进行编码
@@ -127,8 +127,8 @@ public class SignatureUtil {
       Mac mac = Mac.getInstance(SignatureUtil.HMAC_SHA256);
       mac.init(signingKey);
       byte[] rawHmac = mac.doFinal(strToSign.getBytes(ENCODING));
-      log.debug("printHexBinary= {}", DatatypeConverter.printHexBinary(rawHmac));
-      log.debug("printBase64Binary= {}", DatatypeConverter.printBase64Binary(rawHmac));
+      // log.debug("printHexBinary= {}", DatatypeConverter.printHexBinary(rawHmac))
+      // log.debug("printBase64Binary= {}", DatatypeConverter.printBase64Binary(rawHmac))
       return DatatypeConverter.printBase64Binary(rawHmac);
     } catch (NoSuchAlgorithmException | InvalidKeyException | UnsupportedEncodingException ignore) {
     }

+ 34 - 6
railway-framework/src/main/java/com/railway/framework/aspectj/LogAspect.java

@@ -2,6 +2,7 @@ package com.railway.framework.aspectj;
 
 import com.alibaba.fastjson.JSON;
 import com.railway.common.annotation.Log;
+import com.railway.common.core.domain.entity.SysUser;
 import com.railway.common.core.domain.model.LoginUser;
 import com.railway.common.enums.BusinessStatus;
 import com.railway.common.enums.HttpMethod;
@@ -12,17 +13,21 @@ import com.railway.common.utils.ip.IpUtils;
 import com.railway.framework.manager.AsyncManager;
 import com.railway.framework.manager.factory.AsyncFactory;
 import com.railway.system.domain.SysOperLog;
+import java.lang.reflect.Method;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
 import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
 import org.aspectj.lang.annotation.AfterReturning;
 import org.aspectj.lang.annotation.AfterThrowing;
+import org.aspectj.lang.annotation.Around;
 import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Pointcut;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.aspectj.lang.reflect.MethodSignature;
 import org.springframework.stereotype.Component;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.multipart.MultipartFile;
@@ -33,12 +38,11 @@ import org.springframework.web.servlet.HandlerMapping;
  *
  * @author railway
  */
+@Slf4j
 @Aspect
 @Component
 public class LogAspect {
 
-  private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
-
   /**
    * 定义默认切入点
    */
@@ -46,13 +50,37 @@ public class LogAspect {
   private void controllerMethod() {
   }
 
+  /**
+   * 处理完请求前执行
+   *
+   * @param point 切点
+   */
+  @Around("controllerMethod()")
+  public Object around(ProceedingJoinPoint point) {
+    MethodSignature signature = (MethodSignature) point.getSignature();
+    Method method = signature.getMethod();
+    // 请求的类名
+    String className = point.getTarget().getClass().getName();
+    // 请求的方法名
+    String methodName = signature.getName();
+    // 请求的方法参数值
+    String args = Arrays.toString(point.getArgs());
+    //从session中获取当前登陆人id
+    SysUser user = SecurityUtils.getLoginUser().getUser();
+    log.info("className = {}", className);
+    log.info("method = {}", method);
+    log.info("methodName = {}", methodName);
+    log.info("args = {}", args);
+    log.info("user.getUserName = {}", user.getUserName());
+    return null;
+  }
+
   /**
    * 处理完请求后执行
    *
    * @param joinPoint 切点
    */
-  @AfterReturning(value = "controllerMethod()",
-      pointcut = "@annotation(controllerLog)", returning = "jsonResult")
+  @AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult")
   public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult) {
     handleLog(joinPoint, controllerLog, null, jsonResult);
   }

+ 1 - 1
railway-framework/src/main/java/com/railway/framework/interceptor/SignatureInterceptor.java

@@ -44,7 +44,7 @@ public class SignatureInterceptor extends HandlerInterceptorAdapter {
       @Nonnull Object handler) throws Exception {
     // 限制GET和DELETE请求接口,取参模式不一样
     String method = request.getMethod();
-    log.info("method = {}", method);
+    // log.info("method = {}", method)
     if (!method.equals(RequestMethod.GET.name()) && !method.equals(RequestMethod.DELETE.name())) {
       return true;
     }