java110 лет назад: 2
Родитель
Сommit
ed1246a15b

+ 19 - 0
java110-bean/src/main/java/com/java110/dto/log/TransactionOutLogDto.java

@@ -46,6 +46,9 @@ public class TransactionOutLogDto extends PageDto implements Serializable {
 
     private String logType;
 
+    private String startTime;
+    private String endTime;
+
 
     public String getRequestMessage() {
         return requestMessage;
@@ -143,4 +146,20 @@ public class TransactionOutLogDto extends PageDto implements Serializable {
     public void setLogType(String logType) {
         this.logType = logType;
     }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
 }

+ 8 - 0
java110-db/src/main/resources/mapper/common/TransactionOutLogV1ServiceDaoImplMapper.xml

@@ -60,6 +60,10 @@
         <if test="responseMessage !=null and responseMessage != ''">
             and t.response_message= #{responseMessage}
         </if>
+        <if test="startTime != null and startTime != ''">
+            and t.create_time &gt; #{startTime}
+            and t.create_time &lt; #{endTime}
+        </if>
         order by t.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
@@ -140,6 +144,10 @@
         <if test="responseMessage !=null and responseMessage != ''">
             and t.response_message= #{responseMessage}
         </if>
+        <if test="startTime != null and startTime != ''">
+            and t.create_time &gt; #{startTime}
+            and t.create_time &lt; #{endTime}
+        </if>
 
 
     </select>

+ 54 - 0
service-common/src/main/java/com/java110/common/cmd/log/QueryTransactionOutLogCmd.java

@@ -0,0 +1,54 @@
+package com.java110.common.cmd.log;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.accessControl.AccessControlWhiteAuthDto;
+import com.java110.dto.log.TransactionOutLogDto;
+import com.java110.intf.common.ITransactionOutLogV1ServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Java110Cmd(serviceCode = "log.queryTransactionOutLog")
+public class QueryTransactionOutLogCmd extends Cmd {
+
+    @Autowired
+    private ITransactionOutLogV1ServiceSMO transactionOutLogV1ServiceSMOImpl;
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        Assert.hasKeyAndValue(reqJson,"logType","未包含日志类型");
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+
+        TransactionOutLogDto transactionOutLogDto = BeanConvertUtil.covertBean(reqJson, TransactionOutLogDto.class);
+
+        int count = transactionOutLogV1ServiceSMOImpl.queryTransactionOutLogsCount(transactionOutLogDto);
+
+        List<TransactionOutLogDto> transactionOutLogDtos = null;
+
+        if (count > 0) {
+            transactionOutLogDtos = transactionOutLogV1ServiceSMOImpl.queryTransactionOutLogs(transactionOutLogDto);
+        } else {
+            transactionOutLogDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, transactionOutLogDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+    }
+}