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

网站建设皖icp免费单页网站在线制作

网站建设皖icp,免费单页网站在线制作,哈尔滨企业展示型网站建设,wordpress 附件上传插件下载失败本次设计避免以往设计缺陷,老的主要为了保持兼容性,在用的设计就不好调了。 首先,接口抽象时候就不在给参数放仪器ID和处理类了,直接放仪器配置实体,接口实现想用什么属性就用什么属性,避免老方式要扩参数时…

本次设计避免以往设计缺陷,老的主要为了保持兼容性,在用的设计就不好调了。

在这里插入图片描述

首先,接口抽象时候就不在给参数放仪器ID和处理类了,直接放仪器配置实体,接口实现想用什么属性就用什么属性,避免老方式要扩参数时候就波动接口定义,导致不兼容。
在这里插入图片描述

对返回命令取图或者上传文件等不在组串了,直接约定命令,返回查询上传数据或保存数据返回时候直接返回命令的JSON列表,再有监听提供的命令虚拟机执行命令

/*
本框架版权归属于JRT计划,任何单位或个人未经许可,不得以任何方式复制、传播、展示、发布、分发、重新分发、修改、反编译、
反向编译或以其他方式使用本框架的任何部分,包括但不限于源代码、二进制文件、文档、演示文稿、示例代码和API。
使用本框架的用户需遵守以下条款:
用户只能以个人学习和研究为目的使用本框架,不得将其用于商业用途。
用户在使用本框架时,应遵守所有适用的法律和法规,包括但不限于版权法、商标法、专利法和隐私权法。
用户在使用本框架时,应自行承担风险和责任,并确保不会侵犯任何知识产权或个人权利。
本框架的使用仅限于用户自己使用,不得将其分发给其他用户或将其用于任何形式的共享或传播。
在使用本框架时,用户应尊重和保护其他用户的隐私和个人信息,不得将其泄露给任何第三方。
违反以上条款将视为侵权行为,将采取法律手段维护JRT合法权益。*/
package JRTMachineImpl.Cmd;import java.util.List;
import JRTMachineImpl.Base.CmdDto;/*** 构造指令,监听再也不按以前固定拼串方式来实现附加功能了,转而提供一系列指令约定,让后台虚拟M按需要返回指令列表,* 由监听实现的简单指令执行虚拟机执行,从而达到解耦和实现更灵活和强大的功能*/
public class MakeCmd {/*** 添加一个SQL更新或者插入数据的指令到指令列表* @param cmdList 指令列表* @param setStatusKey 设置状态主键,有的话用该注解调用SetQryStatus设置状态* @param sql SQL语句* @param Address 连接串,如果上传要单独指定地址的话就传* @param UserName 用户名,如果上传要单独指定地址的话就传* @param UserPass 密码,如果上传要单独指定地址的话就传* @param Driver 驱动,如果上传要单独指定地址的话就传*/public static void AddSqlCmd(List<CmdDto> cmdList,String setStatusKey,String sql,String Address,String UserName,String UserPass,String Driver){CmdDto dto=new CmdDto();dto.Cmd="SQL";dto.P0=sql;dto.P1=Address;dto.P2=UserName;dto.P3=UserPass;dto.P4=Driver;dto.SetStatusKey=setStatusKey;cmdList.add(dto);}/*** 添加一个SQL更新或者插入数据的指令到指令列表* @param cmdList 指令列表* @param setStatusKey 设置状态主键,有的话用该注解调用SetQryStatus设置状态* @param sql SQL语句*/public static void AddSqlCmd(List<CmdDto> cmdList,String setStatusKey,String sql){AddSqlCmd(cmdList,setStatusKey,sql,"","","","");}/*** 添加一个写文本数据的指令到指令列表* @param cmdList 指令列表* @param setStatusKey 设置状态主键,有的话用该注解调用SetQryStatus设置状态* @param path 文本路径* @param str 写入的串* @param isAppend 是否追加* @param encode 编码 空默认系统编码,可为:UTF-8 UTF-16 ISO-8859-1 US-ASCII GB2312 GBK Big5 Shift-JIS EUC-KR Windows-1252*/public static void AddTxtCmd(List<CmdDto> cmdList,String setStatusKey,String path,String str,String isAppend,String encode){CmdDto dto=new CmdDto();dto.Cmd="TXT";dto.P0=path;dto.P1=str;dto.P2=isAppend;dto.P3=encode;dto.SetStatusKey=setStatusKey;cmdList.add(dto);}/*** 添加一个删除文件或者文件夹的指令到指令列表* @param cmdList 指令列表* @param path 路径*/public static void AddRMCmd(List<CmdDto> cmdList,String path){CmdDto dto=new CmdDto();dto.Cmd="RM";dto.P0=path;dto.SetStatusKey="";cmdList.add(dto);}/*** 添加一个拷贝文件的指令到指令列表* @param cmdList 指令列表* @param filePathOld 源文件路径* @param filePathNew 新文件路径*/public static void AddCPCmd(List<CmdDto> cmdList,String filePathOld,String filePathNew){CmdDto dto=new CmdDto();dto.Cmd="CP";dto.P0=filePathOld;dto.P1=filePathNew;dto.SetStatusKey="";cmdList.add(dto);}/*** 添加一个获取图片的指令到指令列表* @param cmdList 指令列表* @param epis 流水号* @param imgClass 图片类别代码* @param imgPath 图片路径* @param newName 新名称,不给的话就是文件名*/public static void AddGetImageCmd(List<CmdDto> cmdList,String epis,String imgClass,String imgPath,String newName){if(newName==null){newName="";}CmdDto dto=new CmdDto();dto.Cmd="GETIMAGE";dto.P0=epis;dto.P1=imgClass;dto.P2=imgPath;dto.P3=newName;dto.SetStatusKey="";cmdList.add(dto);}
}

命令执行器

/*
本框架版权归属于JRT计划,任何单位或个人未经许可,不得以任何方式复制、传播、展示、发布、分发、重新分发、修改、反编译、
反向编译或以其他方式使用本框架的任何部分,包括但不限于源代码、二进制文件、文档、演示文稿、示例代码和API。
使用本框架的用户需遵守以下条款:
用户只能以个人学习和研究为目的使用本框架,不得将其用于商业用途。
用户在使用本框架时,应遵守所有适用的法律和法规,包括但不限于版权法、商标法、专利法和隐私权法。
用户在使用本框架时,应自行承担风险和责任,并确保不会侵犯任何知识产权或个人权利。
本框架的使用仅限于用户自己使用,不得将其分发给其他用户或将其用于任何形式的共享或传播。
在使用本框架时,用户应尊重和保护其他用户的隐私和个人信息,不得将其泄露给任何第三方。
违反以上条款将视为侵权行为,将采取法律手段维护JRT合法权益。*/
package JRTMachineImpl.Cmd;import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.List;import JRTMachineImpl.Base.BaseDeal;
import JRTMachineImpl.Base.CmdDto;
import JRTMachineImpl.Base.ConfDto;
import JRTMachineImpl.Util.FileService;
import JRTMachineImpl.Util.LogUtils;
import JRTMachineImpl.WebService.OutValue;
import JRTMachineImpl.WebService.Parameters;
import JRTMachineImpl.WebService.WebGetData;
import JRTMachineImpl.DB.DBHelper;/*** 指令执行的虚拟机,按指令约定执行指令*/
public class CmdVM {/*** 执行指令* @param cmdList 指令列表* @param conf 监听配置* @return 返回值,正常返回空,否则返回错误*/public static String ExeCmd(List<CmdDto> cmdList, JRTMachineImpl.Base.ConfDto conf) throws Exception{//循环执行指令for(CmdDto cmd:cmdList){try {ExeOneCmd(cmd, conf);}catch (Exception ex){StringWriter stringWriter = new StringWriter();ex.printStackTrace(new PrintWriter(stringWriter));LogUtils.WriteDebugLog("执行命令异常:" + stringWriter.toString());LogUtils.WriteExceptionLog("执行命令异常", ex);}}return "";}/*** 执行指令* @param cmd 指令* @param conf 监听配置* @return 返回值,正常返回空,否则返回错误*/public static String ExeOneCmd(CmdDto cmd, JRTMachineImpl.Base.ConfDto conf) throws Exception{//执行SQLif(cmd.Cmd.equals("SQL")){ConfDto confNew=new ConfDto();confNew.Address=conf.Address;confNew.UserName=conf.UserName;confNew.UserPass=conf.UserPass;confNew.Driver=conf.Driver;//命令指定了要换驱动if(cmd.P1!=null&&!cmd.P1.isEmpty()){confNew.Address=cmd.P1;confNew.UserName=cmd.P2;confNew.UserPass=cmd.P3;confNew.Driver=cmd.P4;}JRTMachineImpl.DB.DBHelper dbHelper=new DBHelper(confNew);LogUtils.WriteDebugLog("执行SQL:"+cmd.P0);//执行SQL语句int ret=dbHelper.ExecUpdateSQL(cmd.P0);LogUtils.WriteDebugLog("执行SQL返回:"+ret);//设置状态if(ret==1&&!cmd.SetStatusKey.isEmpty()){Parameters param=new Parameters();param.P0=conf.MachID;param.P1=cmd.SetStatusKey;OutValue session = new OutValue();OutValue out = new OutValue();LogUtils.WriteDebugLog("调用:"+conf.DealProcess+"的:SetQryStatus设置状态");String setStatusRet=WebGetData.GetData(BaseDeal.WebServicAddress,conf.DealProcess,"SetQryStatus",param,session,out);LogUtils.WriteDebugLog("设置状态返回:"+setStatusRet);}}//写文件else if(cmd.Cmd.equals("TXT")){File fi=new File(cmd.P0);boolean isAppend=false;if(cmd.P2.equals("1")){isAppend=true;}String model=",模式:覆盖";if(isAppend==true){model=",模式:追加";}LogUtils.WriteDebugLog("往文件:"+cmd.P0+",写入:"+cmd.P1+model+",编码:"+cmd.P3);JRTMachineImpl.Util.TxtUtil.WriteText2File(fi,cmd.P1,isAppend,cmd.P3);//设置状态if(!cmd.SetStatusKey.isEmpty()){Parameters param=new Parameters();param.P0=conf.MachID;param.P1=cmd.SetStatusKey;OutValue session = new OutValue();OutValue out = new OutValue();LogUtils.WriteDebugLog("调用:"+conf.DealProcess+"的:SetQryStatus设置状态");String setStatusRet=WebGetData.GetData(BaseDeal.WebServicAddress,conf.DealProcess,"SetQryStatus",param,session,out);LogUtils.WriteDebugLog("设置状态返回:"+setStatusRet);}}//删除文件和目录else if(cmd.Cmd.equals("RM")){LogUtils.WriteDebugLog("删除:"+cmd.P0);JRTMachineImpl.Util.DirUtil.DeleteFileOrDir(new File(cmd.P0));}//拷贝文件else if(cmd.Cmd.equals("CP")){Path source = Paths.get(cmd.P0);Path target = Paths.get(cmd.P1);LogUtils.WriteDebugLog("拷贝:"+cmd.P0+"到:"+cmd.P1);Files.copy(source,target, StandardCopyOption.REPLACE_EXISTING);}//得到图片else if(cmd.Cmd.equals("GETIMAGE")){FileService fileService=new FileService();Parameters param=new Parameters();param.P0=conf.MachID;OutValue session = new OutValue();OutValue out = new OutValue();LogUtils.WriteDebugLog("调用:"+conf.DealProcess+"的:GetFileService得到文件服务路径");String fileServerPath=WebGetData.GetData(BaseDeal.WebServicAddress,conf.DealProcess,"GetFileService",param,session,out);LogUtils.WriteDebugLog("文件服务路径:"+fileServerPath);File fi=new File(cmd.P2);if(fi.exists()){String [] arr=fileServerPath.split("\\^");LogUtils.WriteDebugLog("准备上传:"+cmd.P2+",新名称:"+cmd.P3+",相对路径:"+arr[1]+"到:"+arr[0]);String ret=fileService.Upload(arr[0],cmd.P2,cmd.P3,arr[1]);LogUtils.WriteDebugLog("上传返回:"+ret);if(ret.isEmpty()){param=new Parameters();param.P0=conf.MachID;param.P1=cmd.P0;param.P2=cmd.P1;param.P3=fi.getName();param.P4=fi.getAbsolutePath();LogUtils.WriteDebugLog("调用:"+conf.DealProcess+"的:SaveImage保存文件路径");String saveRet=WebGetData.GetData(BaseDeal.WebServicAddress,conf.DealProcess,"SaveImage",param,session,out);LogUtils.WriteDebugLog("保存文件返回:"+saveRet);}else{LogUtils.WriteDebugLog("上传文件服务失败:"+ret);}}else{LogUtils.WriteDebugLog("文件:"+cmd.P2+"不存在");}}return "";}
}

定时上传执行命令
在这里插入图片描述

保存返回执行命令
在这里插入图片描述

仪器业务处理示例

import JRT.Core.Dto.CmdDto;
import JRT.Core.Dto.OutValue;
import JRT.Core.Util.LogUtils;
import JRT.Core.Util.MakeCmdUtil;
import JRT.Core.Util.TimeParser;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;/*** 监听模式的仪器测试*/
public class JRTMachineTest extends BaseHttpHandlerNoSession {/*** 记录已经上传的数据*/private static HashMap<String, Boolean> hasUpData = new HashMap();/*** 保存仪器数据** @param mi        仪器主键* @param data      数据* @param epis      流水号* @param fileName  文件全名* @param DBColName 数据库列名* @param index     序号,-1为最后一行* @param P6* @param P7* @param P8* @param P9* @param P10* @param P11* @param P12* @param P13* @param Session* @param Output* @return* @throws Exception*/public String SaveData(String mi, String data, String epis, String fileName, String DBColName, String index, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {//先写Log测试LogUtils.WriteDebugLog("mi:" + mi + ",data:" + data + ",epis:" + epis + ",fileName:" + fileName + ",DBColName:" + DBColName);//返回的数据List<CmdDto> cmdList = new ArrayList<>();MakeCmdUtil.AddGetImageCmd(cmdList, "998", "P2", "D:\\OUT\\2.bmp", "");return Helper.Object2Json(cmdList);}/*** 得到文件服务地址供接口上传图片** @param mi* @param P1* @param P2* @param P3* @param P4* @param P5* @param P6* @param P7* @param P8* @param P9* @param P10* @param P11* @param P12* @param P13* @param Session* @param Output* @return* @throws Exception*/public String GetFileService(String mi, String P1, String P2, String P3, String P4, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {//返回文件服务路径return "http://localhost:8080/JRTWeb/FileService/^/zlzmach/" + TimeParser.GetNowDate();}/*** 保存文件到数据库** @param mi* @param epis* @param ImageClass* @param fileName* @param FullName* @param P5* @param P6* @param P7* @param P8* @param P9* @param P10* @param P11* @param P12* @param P13* @param Session* @param Output* @return* @throws Exception*/public String SaveImage(String mi, String epis, String ImageClass, String fileName, String FullName, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {//先写Log测试LogUtils.WriteDebugLog("mi:" + mi + ",epis:" + epis + ",ImageClass:" + ImageClass + ",fileName:" + fileName + ",FullName:" + FullName);return "";}/*** 查询要上传的指令** @param mi      仪器* @param P1* @param P2* @param P3* @param P4* @param P5* @param P6* @param P7* @param P8* @param P9* @param P10* @param P11* @param P12* @param P13* @param Session* @param Output* @return* @throws Exception*/public String QryUpdata(String mi, String P1, String P2, String P3, String P4, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {//先写Log测试LogUtils.WriteDebugLog("mi:" + mi + ",调用上传查询");//返回的数据List<CmdDto> cmdList = new ArrayList<>();//读文本仪器if (mi.equals("1")) {if (!hasUpData.containsKey("0947809")) {MakeCmdUtil.AddTxtCmd(cmdList, "0947809", "D:\\OUT\\uptxt.dttmp", "这是JRT上传的文本串", "0", "");MakeCmdUtil.AddCPCmd(cmdList, "D:\\OUT\\uptxt.dttmp", "D:\\OUT\\uptxt.dt");MakeCmdUtil.AddRMCmd(cmdList, "D:\\OUT\\uptxt.dttmp");}}//读数据库仪器else if (mi.equals("2")) {if (!hasUpData.containsKey("0947810")) {MakeCmdUtil.AddSqlCmd(cmdList, "0947810", "insert into DBUpHistory(DataCode,KeyData,DateStr,Data) values('0947809','1','这是JRT用SQL插入的数据','1')");}}MakeCmdUtil.AddGetImageCmd(cmdList, "999", "P1", "D:\\OUT\\1.bmp", "");return Helper.Object2Json(cmdList);}/*** 设置上传指令执行状态** @param mi           仪器* @param setStatusKey 设置状态的主键* @param P2* @param P3* @param P4* @param P5* @param P6* @param P7* @param P8* @param P9* @param P10* @param P11* @param P12* @param P13* @param Session* @param Output* @return* @throws Exception*/public String SetQryStatus(String mi, String setStatusKey, String P2, String P3, String P4, String P5, String P6, String P7, String P8, String P9, String P10, String P11, String P12, String P13, OutValue Session, OutValue Output) throws Exception {//先写Log测试LogUtils.WriteDebugLog("mi:" + mi + ",setStatusKey:" + setStatusKey + "设置状态");hasUpData.put(setStatusKey, true);return "";}
}

这样,一套超越以前设计的监听架构就出来了。JRT拥有Web、打印导出Client、JRT浏览器、JRTMachine、jrt运维命令、齐全了

http://www.hkea.cn/news/343637/

相关文章:

  • 厦门园网站忱建设百度推广怎么联系
  • 网站优化页面动态网站建设
  • 做网站域名公司每日重大军事新闻
  • 网站改版数据来源表改怎么做外链百科
  • wordpress怎样做单页网站谷歌查询关键词的工具叫什么
  • 县城做二手车网站自己建网站需要多少钱
  • 有没有专业做挂的网站引流推广方案
  • 购物网站开发文献综述百度收录需要多久
  • 营销型企业网站建设案例设计公司网站
  • 国际外贸网站电子商务
  • 南充做网站 www.xinbay.com全国免费发布广告信息
  • 备案 个人网站软件开发培训中心
  • 江苏网站建设网络推广关键词批量调词 软件
  • 东莞企业网站建设价格怎么在百度发布免费广告
  • 网站后台地址一般是在线seo优化工具
  • 海曙区住房和建设局网站备案域名
  • 网站建设硬件环境志鸿优化设计答案
  • 网页游戏网址推荐宁波网站推广网站优化
  • 福建就福建省住房与城乡建设厅网站高端网站建设企业
  • 网站如何做seo规划app怎么开发出来的
  • 吴江住房和城乡建设局官方网站产品软文是什么
  • 公司网站制作设谷歌seo是什么职业
  • 北京品牌高端网站建设公司燕郊今日头条
  • 网站制作公司徐州宁波网站seo哪家好
  • 做网站基本费用大概需要多少全媒体运营师报考官网在哪里
  • 网站建设款属于什么科目营业推广策划
  • 建设网站查证书网络广告有哪些形式
  • 分布式网站开发网络销售平台排名
  • 网站建设模板购买品牌seo培训
  • 深圳网站建设 cms网站推广交换链接