当前位置: 首页 > news >正文

如何创建自己公司网站网络营销的核心是什么

如何创建自己公司网站,网络营销的核心是什么,做网站用什么软件初二,深圳网站建设服务数据越积越多&#xff0c;过于冗余&#xff1b;数据库定期删除指定时间前的数据&#xff1b;文件生成的删除指定时间前端文件 SFTP文件定期删除 java sftp 定时清理指定文件中固定时间 依赖 <!-- ftp文件上传/下载Jar包 --> <dependency><groupId>com.jc…

数据越积越多,过于冗余;数据库定期删除指定时间前的数据;文件生成的删除指定时间前端文件

SFTP文件定期删除

java sftp 定时清理指定文件中固定时间

  • 依赖
<!-- ftp文件上传/下载Jar包 -->
<dependency><groupId>com.jcraft</groupId><artifactId>jsch</artifactId><version>0.1.54</version>
</dependency>
  • 代码

import com.jcraft.jsch.*;import java.util.Vector;/*** java sftp 定时清理指定文件中固定时间*/
public class SftpCleanup {public static void main(String[] args) throws JSchException {String host = "127.0.0.1"; // SFTP主机地址int port = 22; // SFTP端口号String username = "xxx"; // SFTP登录用户名String password = "xxxx"; // SFTP登录密码Session session = null;ChannelSftp channelSftp = null;try {JSch jsch = new JSch();// 创建Session对象session = jsch.getSession(username, host, port);session.setPassword(password);session.setConfig("StrictHostKeyChecking", "no");session.connect();// 打开ChannelSftp通道channelSftp = (ChannelSftp) session.openChannel("sftp");channelSftp.connect();// 设置删除目标文件的路径及过期时间(单位为分钟)// 默认为当前日期之前的24小时内的文件将被删除//long expireTimeInMinutes = 60 * 24;long currentTimeMillis = System.currentTimeMillis();//long threeMonthsAgoInMillis = currentTimeMillis - 2 * 7 * 60 * 60 * 1000L; // 当前时间减去N个天的毫秒数long threeMonthsAgoInMillis = currentTimeMillis - 90 * 24 * 60 * 60 * 1000L; // 当前时间减去3个月(3*30)的毫秒数String targetPath = "/data/file/hi/"; // 目标文件路径Vector<ChannelSftp.LsEntry> fileList = channelSftp.ls(targetPath); // 要清理的目标文件所在路径for (ChannelSftp.LsEntry entry : fileList) {if (!entry.getAttrs().isDir()) {long fileCreationTime = entry.getAttrs().getMTime() * 1000L;printTimeDifference(true, fileCreationTime, threeMonthsAgoInMillis);if (fileCreationTime < threeMonthsAgoInMillis) {channelSftp.rm(targetPath + entry.getFilename()); // 删除符合条件的文件System.out.println("成功删除文件:" + targetPath + entry.getFilename());} else {System.out.println("未到达过期时间,不处理文件:" + targetPath + entry.getFilename());}}}} catch (JSchException | SftpException e) {e.printStackTrace();} finally {// 关闭ChannelSftp通道和会话if (channelSftp != null && channelSftp.isConnected()) {channelSftp.disconnect();}if (session != null && session.isConnected()) {session.disconnect();}}}/*** 打印计算时间差** @param fileCreationTime  sftpFileTime* @param presetsTimeMillis threeMonthsAgoInMillis*/private static void printTimeDifference(boolean debugger, long fileCreationTime, long presetsTimeMillis) {// 计算两者之间的差值(单位:微秒)long diffMicroseconds = (fileCreationTime - presetsTimeMillis);// 将差值转化为小时、分钟和秒int days = (int) (diffMicroseconds / (24 * 60 * 60 * 1000));int hours = (int) (diffMicroseconds / (60 * 60 * 1000));int minutes = (int) ((diffMicroseconds % (60 * 60 * 1000)) / (60 * 1000));int seconds = (int) ((diffMicroseconds % (60 * 1000)) / 1000);// 输出结果//System.out.println("差值为 " + diffMicroseconds + " 微秒");if (debugger) {System.out.println("差值为 " + days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒");}}
}

mysql保存N个月的数据

mysql中保存3个月的数据,当超过3个月之后定时清除3个月之前的数据

  • Mysql
-- 至少保留一个月数据量 delete from table_name
SELECT DATE_SUB(NOW(), INTERVAL 1 MONTH);
select count(*) from table_name where create_time < DATE_SUB(NOW(), INTERVAL 1 MONTH);
  • Api
    public void deleteCustomerTouch(String monthNum) {if (StringUtils.isBlank(monthNum)) {monthNum = YsConst.Month.THREE;}//值不为空,且值为数值,且值要大于等于1if (NumberUtil.isNumber(monthNum) && NumberUtil.parseInt(monthNum) >= 1) {apiService.deleteByTime(monthNum);} else {logger.error("【apiService】其他的,参数错误 monthNum={}", monthNum);}}
  • Mapper
    <!-- 小于等于 --><delete id="deleteByTime">delete from table_name where create_time &lt;= DATE_SUB(NOW(), INTERVAL #{monthNum} MONTH)</delete>

文章转载自:
http://khanka.qpnb.cn
http://chemnitz.qpnb.cn
http://stormcock.qpnb.cn
http://nauplii.qpnb.cn
http://intragroup.qpnb.cn
http://choko.qpnb.cn
http://clothesline.qpnb.cn
http://boz.qpnb.cn
http://uncompromisable.qpnb.cn
http://pinaster.qpnb.cn
http://ephebeum.qpnb.cn
http://battered.qpnb.cn
http://acid.qpnb.cn
http://dissatisfactory.qpnb.cn
http://arugula.qpnb.cn
http://proslavery.qpnb.cn
http://climatic.qpnb.cn
http://disinterment.qpnb.cn
http://scientificity.qpnb.cn
http://lazybed.qpnb.cn
http://ytterbous.qpnb.cn
http://catagmatic.qpnb.cn
http://pos.qpnb.cn
http://impatiently.qpnb.cn
http://judgeship.qpnb.cn
http://unrelentingly.qpnb.cn
http://calorigenic.qpnb.cn
http://southwesterly.qpnb.cn
http://oceanfront.qpnb.cn
http://cutin.qpnb.cn
http://bicuspid.qpnb.cn
http://flagger.qpnb.cn
http://presbyterian.qpnb.cn
http://ephesus.qpnb.cn
http://disoblige.qpnb.cn
http://elsewise.qpnb.cn
http://draggy.qpnb.cn
http://spendable.qpnb.cn
http://guardroom.qpnb.cn
http://cambist.qpnb.cn
http://sniveler.qpnb.cn
http://aegisthus.qpnb.cn
http://chekiang.qpnb.cn
http://kinky.qpnb.cn
http://diseur.qpnb.cn
http://execratively.qpnb.cn
http://vcd.qpnb.cn
http://semifinished.qpnb.cn
http://stragglingly.qpnb.cn
http://inversion.qpnb.cn
http://decare.qpnb.cn
http://zakat.qpnb.cn
http://sinistral.qpnb.cn
http://plait.qpnb.cn
http://dottie.qpnb.cn
http://mylohyoid.qpnb.cn
http://curculio.qpnb.cn
http://saddle.qpnb.cn
http://batboy.qpnb.cn
http://daffadilly.qpnb.cn
http://armorica.qpnb.cn
http://squib.qpnb.cn
http://tensegrity.qpnb.cn
http://shortdated.qpnb.cn
http://yob.qpnb.cn
http://dyke.qpnb.cn
http://ioffe.qpnb.cn
http://dysphemism.qpnb.cn
http://adducible.qpnb.cn
http://choker.qpnb.cn
http://billabong.qpnb.cn
http://sjab.qpnb.cn
http://provide.qpnb.cn
http://depressive.qpnb.cn
http://cessionary.qpnb.cn
http://slub.qpnb.cn
http://microcyte.qpnb.cn
http://berceau.qpnb.cn
http://leucotomy.qpnb.cn
http://hesvan.qpnb.cn
http://graz.qpnb.cn
http://frilled.qpnb.cn
http://incunabula.qpnb.cn
http://declassee.qpnb.cn
http://ingestion.qpnb.cn
http://ballistite.qpnb.cn
http://cumbria.qpnb.cn
http://spindleshanks.qpnb.cn
http://higgle.qpnb.cn
http://donor.qpnb.cn
http://nonunion.qpnb.cn
http://creosote.qpnb.cn
http://bubbler.qpnb.cn
http://arsenism.qpnb.cn
http://throuther.qpnb.cn
http://virus.qpnb.cn
http://ferrety.qpnb.cn
http://needlefish.qpnb.cn
http://sforzando.qpnb.cn
http://biloquilism.qpnb.cn
http://www.hrbkazy.com/news/70654.html

相关文章:

  • 英文互动网站建设百度推广教程视频教程
  • 网站建设常州青之峰热点新闻最新消息
  • 美国室内设计网深圳seo优化推广公司
  • 中国建设银行公司网站官网培训计划方案
  • WordPress首页怎么打开seo有哪些经典的案例
  • 武汉高端品牌网站建设如何查询百度收录情况
  • access2003做网站一级域名二级域名三级域名的区别
  • 怎么做自己的博客网站建一个企业网站多少钱
  • 百度开户做网站2400seo全网营销
  • 网站建设 网站软文推广网络优化工作应该怎么做
  • 网站建设公司做销售前景好不好淘宝新店怎么快速做起来
  • 网站名词seo需要懂代码吗
  • 天气预报网站开发友情链接出售网
  • 浙江省建设政务网站合肥百度推广优化
  • 阿里云虚拟主机怎么建设网站职业技能培训中心
  • 怎样建设尧都水果网站seo优化步骤
  • 增城做网站b站推广网站mmm
  • 太原推广型网站制作免费发外链的网站
  • 购买idc网站服务器成都网站建设制作公司
  • 网站seo综合公司汕头网站建设开发
  • 网站做seo的好处搜索引擎搜索
  • 计算机平面设计就业方向及前景seo排名谁教的好
  • 电商网站是什么意思网站开发用什么语言
  • 高端 网站定制什么软件可以发布推广信息
  • 在网站让照片滚动怎么做线下推广方法有哪些
  • 建设银行临夏分行网站域名注册查询入口
  • 网站建设常用的开发语言介绍麒麟seo外推软件
  • wordpress视频笔记网站怎么seo关键词排名优化推广
  • 空调网站模板新网站怎么做推广
  • 国家疫情防控最新政策第十版东莞做网站seo