소스 검색

mongodb 增量备份

wukai 2 년 전
부모
커밋
2ead455a78

+ 9 - 8
sync-in/src/main/java/com/jjt/in/service/impl/InProcessServiceImpl.java

@@ -95,26 +95,27 @@ public class InProcessServiceImpl extends InBaseService implements IInProcessSer
                     if (md5.equals(desc.getMd5())) {
                         System.err.println("这个是正确的" + desc.toString());
                         switch (desc.getType()) {
+                            case crontab:
+                                handleCrontabType(zipFile);
+                                break;
                             case es:
                                 File targetDir = new File(tmpDir + "es/");
                                 CompressZip.unzip(zipFile, targetDir);
                                 String esDir = tmpDir + "es/" + desc.getName().split("\\.")[0].split("-")[2];
                                 esService.parseSyncFile(esDir);
                                 break;
+                            case mongo:
                             case mysql:
                                 handleMysqlType(zipFile);
-                            case shell:
-                                handleShellType(desc.getTarget(), zipFile);
-                                break;
-                            case php:
-                                handlePhpType(desc.getTarget(), zipFile);
                                 break;
-                            case mongo:
                             case other:
                                 handleOtherType(desc.getTarget(), zipFile);
                                 break;
-                            case crontab:
-                                handleCrontabType(zipFile);
+                            case php:
+                                handlePhpType(desc.getTarget(), zipFile);
+                                break;
+                            case shell:
+                                handleShellType(desc.getTarget(), zipFile);
                                 break;
                             default:
                                 break;

+ 127 - 0
sync-out/src/main/java/com/jjt/out/controller/OutProcessInfoController.java

@@ -0,0 +1,127 @@
+package com.jjt.out.controller;
+
+import java.util.List;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+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.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import com.jjt.common.annotation.Log;
+import com.jjt.common.enums.BusinessType;
+import com.jjt.out.domain.OutProcessInfo;
+import com.jjt.out.service.IOutProcessInfoService;
+import com.jjt.common.core.controller.BaseController;
+import com.jjt.common.core.domain.AjaxResult;
+import com.jjt.common.utils.poi.ExcelUtil;
+import com.jjt.common.core.page.TableDataInfo;
+
+/**
+ * 外网数据操作记录Controller
+ * 
+ * @author ruoyi
+ * @date 2023-06-20
+ */
+@Controller
+@RequestMapping("/out/process")
+public class OutProcessInfoController extends BaseController
+{
+    private String prefix = "out/process";
+
+    @Autowired
+    private IOutProcessInfoService outProcessInfoService;
+
+    @RequiresPermissions("out:process:view")
+    @GetMapping()
+    public String process()
+    {
+        return prefix + "/process";
+    }
+
+    /**
+     * 查询外网数据操作记录列表
+     */
+    @RequiresPermissions("out:process:list")
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(OutProcessInfo outProcessInfo)
+    {
+        startPage();
+        List<OutProcessInfo> list = outProcessInfoService.selectOutProcessInfoList(outProcessInfo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出外网数据操作记录列表
+     */
+    @RequiresPermissions("out:process:export")
+    @Log(title = "外网数据操作记录", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(OutProcessInfo outProcessInfo)
+    {
+        List<OutProcessInfo> list = outProcessInfoService.selectOutProcessInfoList(outProcessInfo);
+        ExcelUtil<OutProcessInfo> util = new ExcelUtil<OutProcessInfo>(OutProcessInfo.class);
+        return util.exportExcel(list, "外网数据操作记录数据");
+    }
+
+    /**
+     * 新增外网数据操作记录
+     */
+    @GetMapping("/add")
+    public String add()
+    {
+        return prefix + "/add";
+    }
+
+    /**
+     * 新增保存外网数据操作记录
+     */
+    @RequiresPermissions("out:process:add")
+    @Log(title = "外网数据操作记录", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(OutProcessInfo outProcessInfo)
+    {
+        return toAjax(outProcessInfoService.insertOutProcessInfo(outProcessInfo));
+    }
+
+    /**
+     * 修改外网数据操作记录
+     */
+    @RequiresPermissions("out:process:edit")
+    @GetMapping("/edit/{infoId}")
+    public String edit(@PathVariable("infoId") Long infoId, ModelMap mmap)
+    {
+        OutProcessInfo outProcessInfo = outProcessInfoService.selectOutProcessInfoByInfoId(infoId);
+        mmap.put("outProcessInfo", outProcessInfo);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 修改保存外网数据操作记录
+     */
+    @RequiresPermissions("out:process:edit")
+    @Log(title = "外网数据操作记录", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    @ResponseBody
+    public AjaxResult editSave(OutProcessInfo outProcessInfo)
+    {
+        return toAjax(outProcessInfoService.updateOutProcessInfo(outProcessInfo));
+    }
+
+    /**
+     * 删除外网数据操作记录
+     */
+    @RequiresPermissions("out:process:remove")
+    @Log(title = "外网数据操作记录", businessType = BusinessType.DELETE)
+    @PostMapping( "/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids)
+    {
+        return toAjax(outProcessInfoService.deleteOutProcessInfoByInfoIds(ids));
+    }
+}

+ 80 - 0
sync-out/src/main/java/com/jjt/out/domain/OutProcessInfo.java

@@ -0,0 +1,80 @@
+package com.jjt.out.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.jjt.common.annotation.Excel;
+import com.jjt.common.core.domain.BaseEntity;
+
+/**
+ * 外网数据操作记录对象 out_process_info
+ * 
+ * @author ruoyi
+ * @date 2023-06-20
+ */
+public class OutProcessInfo extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 操作ID */
+    private Long infoId;
+
+    /** 操作类型 */
+    @Excel(name = "操作类型")
+    private String processType;
+
+    /** 操作关键字;MONGO存储时间戳 */
+    @Excel(name = "操作关键字;MONGO存储时间戳")
+    private String processKey;
+
+    /** 操作花费时间 */
+    @Excel(name = "操作花费时间")
+    private Long costTime;
+
+    public void setInfoId(Long infoId) 
+    {
+        this.infoId = infoId;
+    }
+
+    public Long getInfoId() 
+    {
+        return infoId;
+    }
+    public void setProcessType(String processType) 
+    {
+        this.processType = processType;
+    }
+
+    public String getProcessType() 
+    {
+        return processType;
+    }
+    public void setProcessKey(String processKey) 
+    {
+        this.processKey = processKey;
+    }
+
+    public String getProcessKey() 
+    {
+        return processKey;
+    }
+    public void setCostTime(Long costTime) 
+    {
+        this.costTime = costTime;
+    }
+
+    public Long getCostTime() 
+    {
+        return costTime;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("infoId", getInfoId())
+            .append("processType", getProcessType())
+            .append("processKey", getProcessKey())
+            .append("costTime", getCostTime())
+            .append("createTime", getCreateTime())
+            .toString();
+    }
+}

+ 61 - 0
sync-out/src/main/java/com/jjt/out/mapper/OutProcessInfoMapper.java

@@ -0,0 +1,61 @@
+package com.jjt.out.mapper;
+
+import java.util.List;
+import com.jjt.out.domain.OutProcessInfo;
+
+/**
+ * 外网数据操作记录Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-06-20
+ */
+public interface OutProcessInfoMapper 
+{
+    /**
+     * 查询外网数据操作记录
+     * 
+     * @param infoId 外网数据操作记录主键
+     * @return 外网数据操作记录
+     */
+    public OutProcessInfo selectOutProcessInfoByInfoId(Long infoId);
+
+    /**
+     * 查询外网数据操作记录列表
+     * 
+     * @param outProcessInfo 外网数据操作记录
+     * @return 外网数据操作记录集合
+     */
+    public List<OutProcessInfo> selectOutProcessInfoList(OutProcessInfo outProcessInfo);
+
+    /**
+     * 新增外网数据操作记录
+     * 
+     * @param outProcessInfo 外网数据操作记录
+     * @return 结果
+     */
+    public int insertOutProcessInfo(OutProcessInfo outProcessInfo);
+
+    /**
+     * 修改外网数据操作记录
+     * 
+     * @param outProcessInfo 外网数据操作记录
+     * @return 结果
+     */
+    public int updateOutProcessInfo(OutProcessInfo outProcessInfo);
+
+    /**
+     * 删除外网数据操作记录
+     * 
+     * @param infoId 外网数据操作记录主键
+     * @return 结果
+     */
+    public int deleteOutProcessInfoByInfoId(Long infoId);
+
+    /**
+     * 批量删除外网数据操作记录
+     * 
+     * @param infoIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteOutProcessInfoByInfoIds(String[] infoIds);
+}

+ 18 - 0
sync-out/src/main/java/com/jjt/out/service/IOutMongoService.java

@@ -0,0 +1,18 @@
+package com.jjt.out.service;
+
+/**
+ * @author wukai
+ * @date 2023-06-06
+ */
+public interface IOutMongoService {
+
+    /**
+     * 全量导出
+     */
+    public void full();
+
+    /**
+     * 增量导出
+     */
+    public void inc();
+}

+ 61 - 0
sync-out/src/main/java/com/jjt/out/service/IOutProcessInfoService.java

@@ -0,0 +1,61 @@
+package com.jjt.out.service;
+
+import java.util.List;
+import com.jjt.out.domain.OutProcessInfo;
+
+/**
+ * 外网数据操作记录Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-06-20
+ */
+public interface IOutProcessInfoService 
+{
+    /**
+     * 查询外网数据操作记录
+     * 
+     * @param infoId 外网数据操作记录主键
+     * @return 外网数据操作记录
+     */
+    public OutProcessInfo selectOutProcessInfoByInfoId(Long infoId);
+
+    /**
+     * 查询外网数据操作记录列表
+     * 
+     * @param outProcessInfo 外网数据操作记录
+     * @return 外网数据操作记录集合
+     */
+    public List<OutProcessInfo> selectOutProcessInfoList(OutProcessInfo outProcessInfo);
+
+    /**
+     * 新增外网数据操作记录
+     * 
+     * @param outProcessInfo 外网数据操作记录
+     * @return 结果
+     */
+    public int insertOutProcessInfo(OutProcessInfo outProcessInfo);
+
+    /**
+     * 修改外网数据操作记录
+     * 
+     * @param outProcessInfo 外网数据操作记录
+     * @return 结果
+     */
+    public int updateOutProcessInfo(OutProcessInfo outProcessInfo);
+
+    /**
+     * 批量删除外网数据操作记录
+     * 
+     * @param infoIds 需要删除的外网数据操作记录主键集合
+     * @return 结果
+     */
+    public int deleteOutProcessInfoByInfoIds(String infoIds);
+
+    /**
+     * 删除外网数据操作记录信息
+     * 
+     * @param infoId 外网数据操作记录主键
+     * @return 结果
+     */
+    public int deleteOutProcessInfoByInfoId(Long infoId);
+}

+ 121 - 0
sync-out/src/main/java/com/jjt/out/service/impl/OutMongoServiceImpl.java

@@ -0,0 +1,121 @@
+package com.jjt.out.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jjt.common.domain.FileDesc;
+import com.jjt.common.enums.SyncType;
+import com.jjt.common.utils.CompressZip;
+import com.jjt.common.utils.DateUtils;
+import com.jjt.common.utils.LinuxCommand;
+import com.jjt.out.domain.OutProcessInfo;
+import com.jjt.out.service.IOutMongoService;
+import com.jjt.out.service.IOutMysqlService;
+import com.jjt.out.service.IOutProcessInfoService;
+import com.jjt.system.service.ISysConfigService;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 数据同步Service业务层处理
+ *
+ * @author wukai
+ * @date 2023-06-06
+ */
+@Service
+public class OutMongoServiceImpl extends OutBaseService implements IOutMongoService {
+    private static final Logger log = LoggerFactory.getLogger(OutMongoServiceImpl.class);
+    @Resource
+    private ISysConfigService sysConfigService;
+    @Resource
+    private IOutProcessInfoService processInfoService;
+
+
+    /**
+     * 导出数据库
+     */
+    @Override
+    public void full() {
+
+    }
+
+    /**
+     * 增量导出
+     */
+    @Override
+    public void inc() {
+        String params = sysConfigService.selectConfigByKey("out.mongo.info");
+
+        JSONObject mongoInfo = JSONObject.parseObject(params);
+        String host = mongoInfo.getString("host");
+        int port = mongoInfo.getIntValue("port");
+        String user = mongoInfo.getString("user");
+        String pass = mongoInfo.getString("pass");
+
+        String tmpDir = tmpDIr();
+        OutProcessInfo opi = new OutProcessInfo();
+        opi.setProcessType(SyncType.mongo.toString());
+        List<OutProcessInfo> list = processInfoService.selectOutProcessInfoList(opi);
+        String time = list.get(0).getProcessKey();
+
+        String nowTime = DateUtils.dateTimeNow();
+
+        tmpDir += "mongo/" + nowTime + "/";
+        String queryStr = String.format("{\"ts\":{\"$gt\":{\"$timestamp\":{\"t\":%s,\"i\":1}}},\"op\":{\"$ne\":\"d\"},\"op\":{\"$ne\":\"n\"}}", time);
+        String cmd = String.format("/usr/bin/mongodump --host %s --port %s  -d local -c oplog.rs -q '%s' -o %s", host, port, queryStr, tmpDir);
+        opi = new OutProcessInfo();
+        opi.setProcessType(SyncType.mongo.toString());
+        Date st = new Date();
+        opi.setCreateTime(st);
+        try {
+            LinuxCommand.exec(cmd);
+        } catch (Exception e) {
+            log.error("报错啦:{}", e.getMessage());
+            e.printStackTrace();
+        }
+        Date et = new Date();
+        opi.setCostTime(et.getTime() - st.getTime());
+        processInfoService.insertOutProcessInfo(opi);
+
+
+        //获取外网同步正式目录
+        String syncDir = syncDIr();
+
+        //打包文件--start
+        //生成zip文件全路径名
+        String zipName = "sync-mongo-" + time + ".zip";
+
+        //打包目标目录
+        File targetDir = new File(tmpDir);
+        File zipFile = new File(syncDir + zipName);
+        CompressZip.zip(targetDir, zipFile);
+        //打包文件--end
+
+        //生成描述json文件--start
+        try {
+            String descName = syncDir + "sync-70-" + time + ".json";
+            String md5 = DigestUtils.md5Hex(Files.newInputStream(zipFile.toPath()));
+            FileDesc desc = new FileDesc();
+            desc.setName(zipName);
+            desc.setMd5(md5);
+            desc.setType(SyncType.mongo);
+            File descFile = new File(descName);
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.writeValue(descFile, desc);
+        } catch (IOException e) {
+        }
+        //生成描述json文件--end
+    }
+}

+ 96 - 0
sync-out/src/main/java/com/jjt/out/service/impl/OutProcessInfoServiceImpl.java

@@ -0,0 +1,96 @@
+package com.jjt.out.service.impl;
+
+import java.util.List;
+import com.jjt.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.jjt.out.mapper.OutProcessInfoMapper;
+import com.jjt.out.domain.OutProcessInfo;
+import com.jjt.out.service.IOutProcessInfoService;
+import com.jjt.common.core.text.Convert;
+
+/**
+ * 外网数据操作记录Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-06-20
+ */
+@Service
+public class OutProcessInfoServiceImpl implements IOutProcessInfoService 
+{
+    @Autowired
+    private OutProcessInfoMapper outProcessInfoMapper;
+
+    /**
+     * 查询外网数据操作记录
+     * 
+     * @param infoId 外网数据操作记录主键
+     * @return 外网数据操作记录
+     */
+    @Override
+    public OutProcessInfo selectOutProcessInfoByInfoId(Long infoId)
+    {
+        return outProcessInfoMapper.selectOutProcessInfoByInfoId(infoId);
+    }
+
+    /**
+     * 查询外网数据操作记录列表
+     * 
+     * @param outProcessInfo 外网数据操作记录
+     * @return 外网数据操作记录
+     */
+    @Override
+    public List<OutProcessInfo> selectOutProcessInfoList(OutProcessInfo outProcessInfo)
+    {
+        return outProcessInfoMapper.selectOutProcessInfoList(outProcessInfo);
+    }
+
+    /**
+     * 新增外网数据操作记录
+     * 
+     * @param outProcessInfo 外网数据操作记录
+     * @return 结果
+     */
+    @Override
+    public int insertOutProcessInfo(OutProcessInfo outProcessInfo)
+    {
+        outProcessInfo.setCreateTime(DateUtils.getNowDate());
+        return outProcessInfoMapper.insertOutProcessInfo(outProcessInfo);
+    }
+
+    /**
+     * 修改外网数据操作记录
+     * 
+     * @param outProcessInfo 外网数据操作记录
+     * @return 结果
+     */
+    @Override
+    public int updateOutProcessInfo(OutProcessInfo outProcessInfo)
+    {
+        return outProcessInfoMapper.updateOutProcessInfo(outProcessInfo);
+    }
+
+    /**
+     * 批量删除外网数据操作记录
+     * 
+     * @param infoIds 需要删除的外网数据操作记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteOutProcessInfoByInfoIds(String infoIds)
+    {
+        return outProcessInfoMapper.deleteOutProcessInfoByInfoIds(Convert.toStrArray(infoIds));
+    }
+
+    /**
+     * 删除外网数据操作记录信息
+     * 
+     * @param infoId 外网数据操作记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteOutProcessInfoByInfoId(Long infoId)
+    {
+        return outProcessInfoMapper.deleteOutProcessInfoByInfoId(infoId);
+    }
+}

+ 22 - 0
sync-out/src/main/java/com/jjt/out/task/MongoOutTask.java

@@ -0,0 +1,22 @@
+package com.jjt.out.task;
+
+import com.jjt.out.service.IOutEsService;
+import com.jjt.out.service.IOutMongoService;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * Es定时任务
+ *
+ * @author ruoyi
+ */
+@Component("mongoOutTask")
+public class MongoOutTask {
+    @Resource
+    private IOutMongoService mongoService;
+
+    public void inc() {
+        mongoService.inc();
+    }
+}

+ 76 - 0
sync-out/src/main/resources/mapper/out/OutProcessInfoMapper.xml

@@ -0,0 +1,76 @@
+<?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.jjt.out.mapper.OutProcessInfoMapper">
+
+    <resultMap type="OutProcessInfo" id="OutProcessInfoResult">
+        <result property="infoId" column="INFO_ID"/>
+        <result property="processType" column="PROCESS_TYPE"/>
+        <result property="processKey" column="PROCESS_KEY"/>
+        <result property="costTime" column="COST_TIME"/>
+        <result property="createTime" column="CREATE_TIME"/>
+    </resultMap>
+
+    <sql id="selectOutProcessInfoVo">
+        select INFO_ID, PROCESS_TYPE, PROCESS_KEY, COST_TIME, CREATE_TIME
+        from out_process_info
+    </sql>
+
+    <select id="selectOutProcessInfoList" parameterType="OutProcessInfo" resultMap="OutProcessInfoResult">
+        <include refid="selectOutProcessInfoVo"/>
+        <where>
+            <if test="processType != null  and processType != ''">and PROCESS_TYPE = #{processType}</if>
+            <if test="processKey != null  and processKey != ''">and PROCESS_KEY = #{processKey}</if>
+            <if test="costTime != null ">and COST_TIME = #{costTime}</if>
+            <if test="createTime != null ">and CREATE_TIME = #{createTime}</if>
+        </where>
+        order by CREATE_TIME desc
+    </select>
+
+    <select id="selectOutProcessInfoByInfoId" parameterType="Long" resultMap="OutProcessInfoResult">
+        <include refid="selectOutProcessInfoVo"/>
+        where INFO_ID = #{infoId}
+    </select>
+
+    <insert id="insertOutProcessInfo" parameterType="OutProcessInfo" useGeneratedKeys="true" keyProperty="infoId">
+        insert into out_process_info
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="processType != null">PROCESS_TYPE,</if>
+            <if test="processKey != null">PROCESS_KEY,</if>
+            <if test="costTime != null">COST_TIME,</if>
+            <if test="createTime != null">CREATE_TIME,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="processType != null">#{processType},</if>
+            <if test="processKey != null">#{processKey},</if>
+            <if test="costTime != null">#{costTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateOutProcessInfo" parameterType="OutProcessInfo">
+        update out_process_info
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="processType != null">PROCESS_TYPE = #{processType},</if>
+            <if test="processKey != null">PROCESS_KEY = #{processKey},</if>
+            <if test="costTime != null">COST_TIME = #{costTime},</if>
+            <if test="createTime != null">CREATE_TIME = #{createTime},</if>
+        </trim>
+        where INFO_ID = #{infoId}
+    </update>
+
+    <delete id="deleteOutProcessInfoByInfoId" parameterType="Long">
+        delete
+        from out_process_info
+        where INFO_ID = #{infoId}
+    </delete>
+
+    <delete id="deleteOutProcessInfoByInfoIds" parameterType="String">
+        delete from out_process_info where INFO_ID in
+        <foreach item="infoId" collection="array" open="(" separator="," close=")">
+            #{infoId}
+        </foreach>
+    </delete>
+
+</mapper>

+ 45 - 0
sync-out/src/main/resources/templates/out/process/add.html

@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('新增外网数据操作记录')" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-process-add">
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">操作类型:</label>
+                <div class="col-sm-8">
+                    <select name="processType" class="form-control m-b" th:with="type=${@dict.getType('sync_type')}">
+                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
+                    </select>
+                </div>
+            </div>
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">操作关键字;MONGO存储时间戳:</label>
+                <div class="col-sm-8">
+                    <input name="processKey" class="form-control" type="text">
+                </div>
+            </div>
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">操作花费时间:</label>
+                <div class="col-sm-8">
+                    <input name="costTime" class="form-control" type="text">
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        var prefix = ctx + "out/process"
+        $("#form-process-add").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/add", $('#form-process-add').serialize());
+            }
+        }
+    </script>
+</body>
+</html>

+ 46 - 0
sync-out/src/main/resources/templates/out/process/edit.html

@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('修改外网数据操作记录')" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-process-edit" th:object="${outProcessInfo}">
+            <input name="infoId" th:field="*{infoId}" type="hidden">
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">操作类型:</label>
+                <div class="col-sm-8">
+                    <select name="processType" class="form-control m-b" th:with="type=${@dict.getType('sync_type')}">
+                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{processType}"></option>
+                    </select>
+                </div>
+            </div>
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">操作关键字;MONGO存储时间戳:</label>
+                <div class="col-sm-8">
+                    <input name="processKey" th:field="*{processKey}" class="form-control" type="text">
+                </div>
+            </div>
+            <div class="form-group">    
+                <label class="col-sm-3 control-label">操作花费时间:</label>
+                <div class="col-sm-8">
+                    <input name="costTime" th:field="*{costTime}" class="form-control" type="text">
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        var prefix = ctx + "out/process";
+        $("#form-process-edit").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/edit", $('#form-process-edit').serialize());
+            }
+        }
+    </script>
+</body>
+</html>

+ 117 - 0
sync-out/src/main/resources/templates/out/process/process.html

@@ -0,0 +1,117 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('外网数据操作记录列表')" />
+</head>
+<body class="gray-bg">
+     <div class="container-div">
+        <div class="row">
+            <div class="col-sm-12 search-collapse">
+                <form id="formId">
+                    <div class="select-list">
+                        <ul>
+                            <li>
+                                <label>操作类型:</label>
+                                <select name="processType" th:with="type=${@dict.getType('sync_type')}">
+                                    <option value="">所有</option>
+                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
+                                </select>
+                            </li>
+                            <li>
+                                <label>操作关键字;MONGO存储时间戳:</label>
+                                <input type="text" name="processKey"/>
+                            </li>
+                            <li>
+                                <label>操作花费时间:</label>
+                                <input type="text" name="costTime"/>
+                            </li>
+                            <li>
+                                <label>操作时间:</label>
+                                <input type="text" class="time-input" placeholder="请选择操作时间" name="createTime"/>
+                            </li>
+                            <li>
+                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+                            </li>
+                        </ul>
+                    </div>
+                </form>
+            </div>
+
+            <div class="btn-group-sm" id="toolbar" role="group">
+                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="out:process:add">
+                    <i class="fa fa-plus"></i> 添加
+                </a>
+                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="out:process:edit">
+                    <i class="fa fa-edit"></i> 修改
+                </a>
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="out:process:remove">
+                    <i class="fa fa-remove"></i> 删除
+                </a>
+                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="out:process:export">
+                    <i class="fa fa-download"></i> 导出
+                </a>
+            </div>
+            <div class="col-sm-12 select-table table-striped">
+                <table id="bootstrap-table"></table>
+            </div>
+        </div>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        var editFlag = [[${@permission.hasPermi('out:process:edit')}]];
+        var removeFlag = [[${@permission.hasPermi('out:process:remove')}]];
+        var processTypeDatas = [[${@dict.getType('sync_type')}]];
+        var prefix = ctx + "out/process";
+
+        $(function() {
+            var options = {
+                url: prefix + "/list",
+                createUrl: prefix + "/add",
+                updateUrl: prefix + "/edit/{id}",
+                removeUrl: prefix + "/remove",
+                exportUrl: prefix + "/export",
+                modalName: "外网数据操作记录",
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'infoId',
+                    title: '操作ID',
+                    visible: false
+                },
+                {
+                    field: 'processType',
+                    title: '操作类型',
+                    formatter: function(value, row, index) {
+                       return $.table.selectDictLabel(processTypeDatas, value);
+                    }
+                },
+                {
+                    field: 'processKey',
+                    title: '操作关键字;MONGO存储时间戳'
+                },
+                {
+                    field: 'costTime',
+                    title: '操作花费时间'
+                },
+                {
+                    field: 'createTime',
+                    title: '操作时间'
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function(value, row, index) {
+                        var actions = [];
+                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.infoId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.infoId + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        return actions.join('');
+                    }
+                }]
+            };
+            $.table.init(options);
+        });
+    </script>
+</body>
+</html>

+ 21 - 0
sync-out/src/test/java/Test.java

@@ -0,0 +1,21 @@
+import com.jjt.common.enums.SyncType;
+
+import java.io.IOException;
+
+public class Test {
+    public static void main(String[] args) {
+        System.err.println(SyncType.mysql.toString());
+
+        String s = "/usr/bin/mongodump --host localhost --port 27017  -d local -c oplog.rs -q '{\"ts\":{\"$gt\":{\"$timestamp\":{\"t\":1687157753,\"i\":1}}},\"op\":{\"$ne\":\"d\"},\"op\":{\"$ne\":\"n\"}}' -o /mnt/tt";
+        System.err.println(s);
+
+
+//        try {
+//            String cmd = "/usr/bin/mongodump --host 127.0.0.1 --port 27017 --oplog --out /mnt/bak";
+//            Process process = Runtime.getRuntime().exec(cmd);
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//            throw new RuntimeException(e);
+//        }
+    }
+}

+ 9 - 0
sync-out/src/test/java/com/test/Test.java

@@ -1,9 +1,18 @@
 package com.test;
 
 import java.io.File;
+import java.util.Date;
 
 public class Test {
     public static void main(String[] args) {
+
+
+
+        long t = 1687157753 * 1000;
+        Date d = new Date();
+
+        System.err.println(d.getTime());
+
         String x = "D:\\data\\sync\\in\\bak\\test.sh";
         File xf = new File(x);
         System.err.println(xf.getAbsolutePath());