zhuang 9 小时之前
父节点
当前提交
645b0f65b3

+ 37 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxLogTotalDao.java

@@ -0,0 +1,37 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.rongwei.bsentity.domain.ZhcxLogTotalDo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Select;
+
+/**
+ * <p>
+ * 日志统计 Mapper 接口
+ * </p>
+ *
+ * @author dlc
+ * @since 2025-07-02
+ */
+public interface ZhcxLogTotalDao extends BaseMapper<ZhcxLogTotalDo> {
+
+    @Select("SELECT COUNT(ID) FROM SYS_MAIL_HISTORY where TRUNC(CREATEDATE) = TRUNC(SYSDATE())-1")
+    Integer getMailCount();
+
+    @Select("SELECT count(s.ID) \n" +
+            "from INCONTROL.ZHCX_PMQ_MANAGEMENT_SOURCE s\n" +
+            "LEFT JOIN (\n" +
+            "        SELECT\n" +
+            "                n.ID AS MACHINEID,\n" +
+            "                n.DEVICE_NUMBER AS MACHINENO,\n" +
+            "                p.PROJECT_CODE AS code\n" +
+            "        FROM \n" +
+            "                INCONTROL.ZHCX_PROJECT_DEVICE_NUMBER n\n" +
+            "        JOIN INCONTROL.ZHCX_PROJECT_MANAGE p ON\n" +
+            "                p.ID = n.PID\n" +
+            "                AND p.DELETED = '0'\n" +
+            "        WHERE\n" +
+            "                n.DELETED = '0' \n" +
+            "        )p ON p.code = s.PROJECTNO\n" +
+            "WHERE TRUNC(DISTRIBUTETIME) = TRUNC(SYSDATE())-1")
+    Integer getPmqCount();
+}

+ 18 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxLogTotalService.java

@@ -0,0 +1,18 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.rongwei.bsentity.domain.ZhcxLogTotalDo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 日志统计 服务类
+ * </p>
+ *
+ * @author dlc
+ * @since 2025-07-02
+ */
+public interface ZhcxLogTotalService extends IService<ZhcxLogTotalDo> {
+
+    void generateData();
+
+}

+ 52 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxLogTotalServiceImpl.java

@@ -0,0 +1,52 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.rongwei.bsentity.domain.ZhcxLogTotalDo;
+import com.rongwei.bscommon.sys.dao.ZhcxLogTotalDao;
+import com.rongwei.bscommon.sys.service.ZhcxLogTotalService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.rwadmincommon.system.domain.ModuleOperationRecordDo;
+import com.rongwei.rwadmincommon.system.service.ModuleOperationRecordService;
+import com.rongwei.rwcommoncomponent.file.service.SysFileItemService;
+import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+
+/**
+ * <p>
+ * 日志统计 服务实现类
+ * </p>
+ *
+ * @author dlc
+ * @since 2025-07-02
+ */
+@Service
+public class ZhcxLogTotalServiceImpl extends ServiceImpl<ZhcxLogTotalDao, ZhcxLogTotalDo> implements ZhcxLogTotalService {
+
+    @Autowired
+    private ModuleOperationRecordService moduleOperationRecordService;
+    @Autowired
+    private SysFileItemService fileItemService;
+    @Autowired
+    private ZhcxLogTotalDao dao;
+
+    @Override
+    public void generateData() {
+
+        int mailCount = dao.getMailCount();
+        int pmqCount = dao.getPmqCount();
+        QueryWrapper<SysFileItemDo> wrapper = new QueryWrapper<>();
+        wrapper.apply("TRUNC(CREATEDATE) = TRUNC(SYSDATE - 1)");
+        int uploadFileCount = fileItemService.count(wrapper);
+        QueryWrapper<ModuleOperationRecordDo> wrapper2 = new QueryWrapper<>();
+        wrapper2.in("EVENTTYPE", Arrays.asList("loginIn", "view", "info","insert","update","delete"));
+        wrapper2.apply("TRUNC(CREATEDATE) = TRUNC(SYSDATE - 1)");
+        int sysCount = moduleOperationRecordService.count(wrapper2);
+        QueryWrapper<ModuleOperationRecordDo> wrapper3 = new QueryWrapper<>();
+        wrapper3.in("EVENTTYPE",Arrays.asList("file-preview","file-download"));
+        wrapper3.apply("TRUNC(CREATEDATE) = TRUNC(SYSDATE - 1)");
+        int fileCount = moduleOperationRecordService.count(wrapper2);
+    }
+}

+ 89 - 0
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxLogTotalDo.java

@@ -0,0 +1,89 @@
+package com.rongwei.bsentity.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.rongwei.rwcommon.base.BaseDo;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 日志统计
+ * </p>
+ *
+ * @author dlc
+ * @since 2025-07-02
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("ZHCX_LOG_TOTAL")
+public class ZhcxLogTotalDo extends BaseDo {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键
+     */
+    @TableField("ID")
+    private String id;
+    /**
+     * 租户id
+     */
+    @TableField("TENANTID")
+    private String tenantid;
+    /**
+     * 扩展json格式配置
+     */
+    @TableField("ROPTION")
+    private String roption;
+    /**
+     * 系统访问量
+     */
+    @TableField("SYSLOGCOUNT")
+    private Integer syslogcount;
+    /**
+     * 文件上传量
+     */
+    @TableField("FILEUPLOADCOUNT")
+    private Integer fileuploadcount;
+    /**
+     * 文件下载量
+     */
+    @TableField("FILEDOWNLOADCOUNT")
+    private Integer filedownloadcount;
+    /**
+     * 整改变更量
+     */
+    @TableField("RECTIFYLOGCOUNT")
+    private Integer rectifylogcount;
+    /**
+     * 三单接口增量
+     */
+    @TableField("PMQLOGCOUNT")
+    private Integer pmqlogcount;
+    /**
+     * 总访问量
+     */
+    @TableField("TOTALCOUNT")
+    private Integer totalcount;
+    /**
+     * 日期
+     */
+    @TableField("DATE")
+    private Date date;
+    /**
+     * 接口访问量
+     */
+    @TableField("INTERFACECOUNT")
+    private Integer interfacecount;
+    /**
+     * 邮件发送量
+     */
+    @TableField("SENDMAILCOUNT")
+    private Integer sendmailcount;
+
+
+}

+ 36 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxLogTotalController.java

@@ -0,0 +1,36 @@
+package com.rongwei.bsserver.controller;
+
+
+import com.rongwei.bscommon.sys.service.ZhcxLogTotalService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * <p>
+ * 日志统计 前端控制器
+ * </p>
+ *
+ * @author dlc
+ * @since 2025-07-02
+ */
+@RestController
+@RequestMapping("/zhcxLogTotal")
+public class ZhcxLogTotalController {
+
+    @Autowired
+    private ZhcxLogTotalService service;
+
+    @PostMapping("generateData")
+    public void generateData(){
+        service.generateData();
+    }
+
+}
+