JRT业务开发起步

这是一段充满挑战与奋斗的旅程,自第一行Java代码的写下起,便历经重重险阻。从细微的代码行,逐步汇聚成实用的工具类方法;从工具类方法的积累,逐渐构建起功能强大的工具包;再从工具包的整合,最终搭建起稳健的运行程序体系。这个过程,就像是一场从点到线、从线到面、从面到立体的华丽蜕变。如今,JRT已顺利迈入正常的业务开发阶段,这半年里日夜兼程、不懈努力的加班时光,终于换来了令人欣慰的效果,一切都是值得的。

演示视频

B站视频

目前已经具有以下部分(涉及网站、客户端、打印导出、运维、仪器连接的方方面面):
1.Web框架
2.JRTClient
3.JRTBrowser
4.模板设计器
5.JRTMachine
6.码表
7.代码生成器
8.jrt的linux命令
9.菜单体系
来满足Web业务开发、打印、打印pdf、生成pdf、导出Excel、在线预览、在线得到打印的pdf的Base64串、定制浏览器、模板设计、连设备程序、码表程序、代码生成工具、Linux运维命令、登录菜单和权限。

首先全新设计了登录体系,登录抽象各系统的差异性,提供各登录的共性实现,在保证登录差异性的情况下提供最大的登录共性。张弛有度、设计的首要目标就是在不入侵别人业务的情况下,最大程度为各模块提供公共逻辑,既不过度设计,也不揉成一团。任何使用该登录体系的人只要关注登录接口实现,然后把实现类配置到容器,在登录界面传入配置代码既是该系统的登录界面了。(使用面向接口和IOC)
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

登录接口

package JRT.Login;import java.util.List;import JRT.Login.SelectRoleDto;/*** 作为JRT实现登录的抽象接口,不同系统登录实现该接口,把接口实现类配置到容器里,通过给登录界面URL指定LoginType为配置对象ID实现不同系统的登录,* 从而方便各个依赖JRT开发的系统共享登录和菜单功能部分,可以快速把登录和菜单并入自己系统而又不需要介入太多,自己可以用自己的用户表和用户权限部分。*/
public interface ILogin {/*** 得到登录界面显示的大标题** @return 大标题*/String GetSystemTitle();/*** 得到登录界面用户密码框上面显示的系统名称** @return 系统名称*/String GetSystemName();/*** 得到登录界面Url显示的名称** @return URL名称*/String GetUrlTitle();/*** 得到登录的角色类型名称,如:工作组、科室、试剂组等** @return URL名称*/String GetRoleTypeName();/*** 返回空就是不要求密码强度,1,2,3密码要求加强** @return*/String GetSYSPasswordLevel() throws Exception;/*** 返回要求的密码长度限制,有密码级别要求才限制强度** @return*/int GetSYSPasswordLength() throws Exception;/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @param pass     用户在登录界面输入的密码* @return 是否验证通过*/boolean CheckUser(String userCode, String pass) throws Exception;/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @return 是否验证通过*/List<SelectRoleDto> GetSelectRole(String userCode) throws Exception;/*** 修改用户密码,用户密码强度不符合时候修改密码调用的接口** @param userCode 用户在登录界面输入的用户名* @param passOld  用户在登录界面输入的老密码* @param passNew  用户在登录界面输入的新密码* @return 成功返回空,否则返回失败原因*/String ChangePassword(String userCode, String passOld, String passNew) throws Exception;
}

检验登录实现实例

package JRT.Login;import JRT.Core.Dto.HashParam;
import JRT.Core.Util.LogUtils;
import JRT.Core.Util.PassWordUtil;
import JRT.DAL.ORM.EntityManager.EntityManagerFactory;
import JRT.DAL.ORM.EntityManager.IEntityManager;
import JRT.Login.SelectRoleDto;
import JRT.Model.Entity.*;
import JRTBLLBase.Helper;import java.util.ArrayList;
import java.util.List;/*** 作为登录到检验工作组的实现类,其他登录科室和试剂组的登录实现参照此类即可,由登录界面通过URL上的LoginType从容器获取登录实现类*/
public class LoginLIS implements JRT.Login.ILogin {/*** 访问数据库*/private IEntityManager entityManager = null;/*** 给业务脚本提供的操作数据库的对象*/public IEntityManager EntityManager() {if (entityManager == null) {entityManager = EntityManagerFactory.CreateEntityManager("");}return entityManager;}/*** 得到登录界面显示的大标题** @return 大标题*/@Overridepublic String GetSystemTitle() {return "检验信息管理系统";}/*** 得到登录界面用户密码框上面显示的系统名称** @return 系统名称*/@Overridepublic String GetSystemName() {return "检验系统";}/*** 得到登录界面Url显示的名称** @return URL名称*/@Overridepublic String GetUrlTitle() {return "JRTLIS © 1.0";}/*** 得到登录的角色类型名称,如:工作组、科室、试剂组等** @return URL名称*/@Overridepublic String GetRoleTypeName() {return "工作组";}/*** 返回空就是不要求密码强度,1,2,3密码要求加强** @return*/@Overridepublic String GetSYSPasswordLevel() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLevel");if (dto != null) {return dto.ParaValue;}return "";}/*** 返回要求的密码长度限制,有密码级别要求才限制强度** @return*/@Overridepublic int GetSYSPasswordLength() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLength");if (dto != null) {if (dto.ParaValue != null && !dto.ParaValue.isEmpty()) {return Integer.valueOf(dto.ParaValue);}}return 9;}/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @param pass     用户在登录界面输入的密码* @return 是否验证通过, 验证不通过的前端都统一返回用户名或密码错误*/@Overridepublic boolean CheckUser(String userCode, String pass) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {LogUtils.WriteDebugLog("用户:" + userCode + "不存在");return false;}//比较密码boolean checkRes = PassWordUtil.PassCompare(pass, user.Password);return checkRes;}/*** 获取用户角色** @param userCode 用户在登录界面输入的用户名* @return 是否验证通过*/@Overridepublic List<SelectRoleDto> GetSelectRole(String userCode) throws Exception {List<SelectRoleDto> retList = new ArrayList<>();//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return retList;}HashParam para = new HashParam();para.Add("UserDR", user.RowID);List<SYSUserRole> roleList = EntityManager().FindAllSimple(SYSUserRole.class, para);if (roleList != null && roleList.size() > 0) {for (SYSUserRole dto : roleList) {//取工作组数据BTWorkGroup wgDto = EntityManager().DolerGet(BTWorkGroup.class, dto.WorkGroupDR);//得到科室BTDepartment depDto = EntityManager().DolerGet(BTDepartment.class, wgDto.DepartmentDR);//得到医院BTHospital hosDto = EntityManager().DolerGet(BTHospital.class, depDto.HospitalDR);//岗位名称String postName = "";if (dto.PostDR != null) {//取岗位数据SYSPost postDto = EntityManager().DolerGet(SYSPost.class, dto.WorkGroupDR);postName = "[" + postDto.CName + "]";}SelectRoleDto role = new SelectRoleDto();role.RoleDR = dto.RoleDR;role.RoleName = wgDto.CName + postName;//放工作组role.GroupID = String.valueOf(dto.WorkGroupDR);role.UserID = String.valueOf(user.RowID);role.UserCode = user.Code;role.UserName = user.CName;role.SessionStr = user.RowID + "^" + dto.WorkGroupDR + "^" + depDto.RowID + "^" + dto.RoleDR + "^" + hosDto.RowID;retList.add(role);}}return retList;}/*** 修改用户密码,用户密码强度不符合时候修改密码调用的接口** @param userCode 用户在登录界面输入的用户名* @param passOld  用户在登录界面输入的老密码* @param passNew  用户在登录界面输入的新密码* @return 成功返回空,否则返回失败原因*/@Overridepublic String ChangePassword(String userCode, String passOld, String passNew) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return "用户:" + userCode + "不存在!";}//比较密码boolean checkRes = PassWordUtil.PassCompare(passOld, user.Password);if (checkRes == false) {return "用户名或密码不正确!";}//加密密码user.Password = PassWordUtil.PassEntry(passNew);//更新密码List<String> upCol = new ArrayList<>();upCol.add("Password");int ret = EntityManager().Update(user, upCol);if (ret == 1) {return "";} else {return "修改密码发送错误!";}}
}

试剂登录实现

package JRT.Login;import JRT.Core.Dto.HashParam;
import JRT.Core.Util.LogUtils;
import JRT.Core.Util.PassWordUtil;
import JRT.DAL.ORM.EntityManager.EntityManagerFactory;
import JRT.DAL.ORM.EntityManager.IEntityManager;
import JRT.Login.SelectRoleDto;
import JRT.Model.Entity.*;
import JRTBLLBase.Helper;import java.util.ArrayList;
import java.util.List;/*** 作为登录到试剂的实现类,其他登录科室和护士站的登录实现参照此类即可,由登录界面通过URL上的LoginType从容器获取登录实现类*/
public class LoginRG implements JRT.Login.ILogin {/*** 访问数据库*/private IEntityManager entityManager = null;/*** 给业务脚本提供的操作数据库的对象*/public IEntityManager EntityManager() {if (entityManager == null) {entityManager = EntityManagerFactory.CreateEntityManager("");}return entityManager;}/*** 得到登录界面显示的大标题** @return 大标题*/@Overridepublic String GetSystemTitle() {return "试剂库存管理系统";}/*** 得到登录界面用户密码框上面显示的系统名称** @return 系统名称*/@Overridepublic String GetSystemName() {return "试剂系统";}/*** 得到登录界面Url显示的名称** @return URL名称*/@Overridepublic String GetUrlTitle() {return "JRTRG © 1.0";}/*** 得到登录的角色类型名称,如:工作组、科室、试剂组等** @return URL名称*/@Overridepublic String GetRoleTypeName() {return "试剂组";}/*** 返回空就是不要求密码强度,1,2,3密码要求加强** @return*/@Overridepublic String GetSYSPasswordLevel() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLevel");if (dto != null) {return dto.ParaValue;}return "";}/*** 返回要求的密码长度限制,有密码级别要求才限制强度** @return*/@Overridepublic int GetSYSPasswordLength() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLength");if (dto != null) {if (dto.ParaValue != null && !dto.ParaValue.isEmpty()) {return Integer.valueOf(dto.ParaValue);}}return 9;}/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @param pass     用户在登录界面输入的密码* @return 是否验证通过, 验证不通过的前端都统一返回用户名或密码错误*/@Overridepublic boolean CheckUser(String userCode, String pass) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {LogUtils.WriteDebugLog("用户:" + userCode + "不存在");return false;}//比较密码boolean checkRes = PassWordUtil.PassCompare(pass, user.Password);return checkRes;}/*** 获取用户角色** @param userCode 用户在登录界面输入的用户名* @return 是否验证通过*/@Overridepublic List<SelectRoleDto> GetSelectRole(String userCode) throws Exception {List<SelectRoleDto> retList = new ArrayList<>();//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return retList;}HashParam para = new HashParam();para.Add("UserDR", user.RowID);List<SYSUserReagentRole> roleList = EntityManager().FindAllSimple(SYSUserReagentRole.class, para);if (roleList != null && roleList.size() > 0) {for (SYSUserReagentRole dto : roleList) {//取试剂组数据SYSReagentGroup rgDto = EntityManager().DolerGet(SYSReagentGroup.class, dto.ReagentGroupDR);//得到科室BTDepartment depDto = EntityManager().DolerGet(BTDepartment.class, rgDto.DepartmentDR);//得到医院BTHospital hosDto = EntityManager().DolerGet(BTHospital.class, depDto.HospitalDR);SelectRoleDto role = new SelectRoleDto();role.RoleDR = dto.RoleDR;role.RoleName = rgDto.CName;//放工作组role.GroupID = String.valueOf(dto.ReagentGroupDR);role.UserID = String.valueOf(user.RowID);role.UserCode = user.Code;role.UserName = user.CName;role.SessionStr = user.RowID + "^" + dto.ReagentGroupDR + "^" + depDto.RowID + "^" + dto.RoleDR + "^" + hosDto.RowID;retList.add(role);}}return retList;}/*** 修改用户密码,用户密码强度不符合时候修改密码调用的接口** @param userCode 用户在登录界面输入的用户名* @param passOld  用户在登录界面输入的老密码* @param passNew  用户在登录界面输入的新密码* @return 成功返回空,否则返回失败原因*/@Overridepublic String ChangePassword(String userCode, String passOld, String passNew) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return "用户:" + userCode + "不存在!";}//比较密码boolean checkRes = PassWordUtil.PassCompare(passOld, user.Password);if (checkRes == false) {return "用户名或密码不正确!";}//加密密码user.Password = PassWordUtil.PassEntry(passNew);//更新密码List<String> upCol = new ArrayList<>();upCol.add("Password");int ret = EntityManager().Update(user, upCol);if (ret == 1) {return "";} else {return "修改密码发送错误!";}}
}

医生登录实现

package JRT.Login;import JRT.Core.Dto.HashParam;
import JRT.Core.Util.LogUtils;
import JRT.Core.Util.PassWordUtil;
import JRT.DAL.ORM.EntityManager.EntityManagerFactory;
import JRT.DAL.ORM.EntityManager.IEntityManager;
import JRT.Login.SelectRoleDto;
import JRT.Model.Entity.*;
import JRTBLLBase.Helper;import java.util.ArrayList;
import java.util.List;/*** 作为登录到医生科室的实现类,其他登录实现参照此类即可,由登录界面通过URL上的LoginType从容器获取登录实现类*/
public class LoginDOC implements JRT.Login.ILogin {/*** 访问数据库*/private IEntityManager entityManager = null;/*** 给业务脚本提供的操作数据库的对象*/public IEntityManager EntityManager() {if (entityManager == null) {entityManager = EntityManagerFactory.CreateEntityManager("");}return entityManager;}/*** 得到登录界面显示的大标题** @return 大标题*/@Overridepublic String GetSystemTitle() {return "医生站系统";}/*** 得到登录界面用户密码框上面显示的系统名称** @return 系统名称*/@Overridepublic String GetSystemName() {return "医生站";}/*** 得到登录界面Url显示的名称** @return URL名称*/@Overridepublic String GetUrlTitle() {return "JRTHIS © 1.0";}/*** 得到登录的角色类型名称,如:工作组、科室、试剂组等** @return URL名称*/@Overridepublic String GetRoleTypeName() {return "科室";}/*** 返回空就是不要求密码强度,1,2,3密码要求加强** @return*/@Overridepublic String GetSYSPasswordLevel() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLevel");if (dto != null) {return dto.ParaValue;}return "";}/*** 返回要求的密码长度限制,有密码级别要求才限制强度** @return*/@Overridepublic int GetSYSPasswordLength() throws Exception {//查询系统参数JRTParameter dto = EntityManager().GetByColVal(JRTParameter.class, "Code", "SYSPasswordLength");if (dto != null) {if (dto.ParaValue != null && !dto.ParaValue.isEmpty()) {return Integer.valueOf(dto.ParaValue);}}return 9;}/*** 检查用户名和密码** @param userCode 用户在登录界面输入的用户名* @param pass     用户在登录界面输入的密码* @return 是否验证通过, 验证不通过的前端都统一返回用户名或密码错误*/@Overridepublic boolean CheckUser(String userCode, String pass) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {LogUtils.WriteDebugLog("用户:" + userCode + "不存在");return false;}//比较密码boolean checkRes = PassWordUtil.PassCompare(pass, user.Password);return checkRes;}/*** 获取用户角色** @param userCode 用户在登录界面输入的用户名* @return 是否验证通过*/@Overridepublic List<SelectRoleDto> GetSelectRole(String userCode) throws Exception {List<SelectRoleDto> retList = new ArrayList<>();//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return retList;}HashParam para = new HashParam();para.Add("UserDR", user.RowID);List<SYSUserLocationRole> roleList = EntityManager().FindAllSimple(SYSUserLocationRole.class, para);if (roleList != null && roleList.size() > 0) {for (SYSUserLocationRole dto : roleList) {//取试剂组数据BTLocation locDto = EntityManager().DolerGet(BTLocation.class, dto.LocationDR);//得到医院BTHospital hosDto = EntityManager().DolerGet(BTHospital.class, locDto.HospitalDR);SelectRoleDto role = new SelectRoleDto();role.RoleDR = dto.RoleDR;role.RoleName = locDto.CName;//放工作组role.GroupID = String.valueOf(dto.LocationDR);role.UserID = String.valueOf(user.RowID);role.UserCode = user.Code;role.UserName = user.CName;role.SessionStr = user.RowID + "^" + dto.LocationDR + "^" + dto.LocationDR + "^" + dto.RoleDR + "^" + hosDto.RowID;retList.add(role);}}return retList;}/*** 修改用户密码,用户密码强度不符合时候修改密码调用的接口** @param userCode 用户在登录界面输入的用户名* @param passOld  用户在登录界面输入的老密码* @param passNew  用户在登录界面输入的新密码* @return 成功返回空,否则返回失败原因*/@Overridepublic String ChangePassword(String userCode, String passOld, String passNew) throws Exception {//按代码查询用户SYSUser user = EntityManager().GetByColVal(SYSUser.class, "Code", userCode);//没查到用户if (user == null) {return "用户:" + userCode + "不存在!";}//比较密码boolean checkRes = PassWordUtil.PassCompare(passOld, user.Password);if (checkRes == false) {return "用户名或密码不正确!";}//加密密码user.Password = PassWordUtil.PassEntry(passNew);//更新密码List<String> upCol = new ArrayList<>();upCol.add("Password");int ret = EntityManager().Update(user, upCol);if (ret == 1) {return "";} else {return "修改密码发送错误!";}}
}

配置登录实现类
在这里插入图片描述

全java化的打印导出支持
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

jrt命令支持
在这里插入图片描述

监听支持
在这里插入图片描述
Windows和Linux下的浏览器支持
在这里插入图片描述

在这里插入图片描述

超低占用资源,在腾讯云2G内存下运行数据库、web、svn服务器的内存占用情况

在这里插入图片描述

在这里插入图片描述

极少开发环境依赖
开发环境只需要idea+jdk,在Windows和Linux都很容易准备好,不需要额外的配置

极低的上手门槛
无需精通Maven管理、无需繁琐配置IDEA插件、无需深入学习Spring框架,更无需掌握MyBatis写SQL与Mapper设置。只需在具备开发环境的基础上,轻松更新代码并一键运行,掌握以下代码知识,即可轻松驾驭JRT。简洁明了的代码设计,实现了打印、导出、上传Excel、生成PDF、文件服务操作以及摄像头调用等诸多功能。JRT的魅力正在于它的去繁就简,让编程回归本真,为您带来高效且愉悦的开发体验。

界面示例

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>JRTPrintTemplateEle供拷贝代码使用</title><link rel="shortcut icon" href="../../resource/common/images/favicon.ico" /><script src="../../resource/common/js/JRTBSBase.js" type="text/javascript"></script><script src="../../jrtprint/js/JRTPrint.js" type="text/javascript"></script><script language="javascript" type="text/javascript">SYSPageCommonInfo.Init();var BasePath = '';var ResourcePath = '';var WebServicAddress = SYSPageCommonInfo.Data.WebServicAddress;var UserDR = SYSPageCommonInfo.Data.Sesssion.UserDR;var GroupID = SYSPageCommonInfo.Data.Sesssion.GroupID;var SessionStr = SYSPageCommonInfo.Data.SessionStr;</script><script type="text/javascript">//全局变量var me = {actionUrl: '../ashx/ashJRTPrintTemplateEle.ashx'};//jquery入口$(function () {//导出Excel$("#btnExport").click(function () {var para = {};var tempPath = DealExportExcelTMPName("打印元素.xls");JRTBasePrint('Export@' + WebServicAddress + '@vm.test.QryPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');});//导出Excel多模板$("#btnExport1").click(function () {var para = {};var tempPath = DealExportExcelTMPName("打印元素多模板");JRTBasePrint('Export@' + WebServicAddress + '@vm.test.QryPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');});//导出Excel无模板$("#btnExport0").click(function () {var para = {};var tempPath = "";JRTBasePrint('Export@' + WebServicAddress + '@vm.test.QryPrintTemplateEle@QryPrintEle@' + JSON.stringify(para) + '@' + SessionStr + '@' + tempPath + '@0');});//打印预览$("#btnPrintPreview").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintPreview";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//打印表格$("#btnPrintPreviewGrid").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.DrawGrid@GetData";JRTBasePrint(Param);});//打印报告$("#btnPrintReport").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintTemplateTest@GetData";JRTBasePrint(Param);});//集中打印$("#btnCenterPrint").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.CenterPrintTest@GetData";JRTBasePrint(Param);});//在线预览$("#btnPrintPreviewInline").click(function () {showwin("#winPrintPreview", "在线打印预览", '../../facade/form/frmJRTPrintDrawView.aspx?PrintDR=' + 1 + '&PrintClassName=vm.test.PrintBarCodeTest', 950, $(window).height() - 20, true, "10px");});//打印$("#btnPrint").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PrintOut";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//PDF$("#btnPDF").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PDF#-1";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//PDF弹窗$("#btnPDFSave").click(function () {//0:打印所有报告 1:循环打印每一份报告var printFlag = "0";var userCode = "";//打印参数var paramList = "";//PrintOut:打印  PrintPreview打印预览var printType = "PDF#0";var printPara = "1";var Param = printFlag + "@" + WebServicAddress + "@" + printPara + "@" + userCode + "@" + printType + "@" + paramList + "@vm.test.PrintBarCodeTest@GetData";JRTBasePrint(Param);});//上传文件到文件服务$("#btnUpfile").click(function () {$("#file_upload").click();});//改名文件$("#btnRenamefile").click(function () {//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=ReNameImageFile',success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}alert("成功");}});});//删除文件$("#btnDeletefile").click(function () {//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=DeleteImageFile',success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}alert("成功");}});});//Excel得到JSON$("#btnExcelGetJson").click(function () {JRTGetExcelFileJson(function (retJson) {alert(JSON.stringify(retJson));});});//新增数据点击$("#btnAddJRTPrintTemplateEle").click(function () {$("#txtJRTPrintTemplateEleRowID").val(""); $('#winEditJRTPrintTemplateEle').window({title: TranslateDataMTHD('Add Data', '新增数据', ''),modal: true});});//修改数据点击$("#btnUpdateJRTPrintTemplateEle").click(function () {UpdateJRTPrintTemplateEle();});//修改数据function UpdateJRTPrintTemplateEle(row){var selectRow = $('#dgJRTPrintTemplateEle').datagrid("getSelected");if(row!=null){selectRow=row;}if (selectRow == null) {$.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to modify', '请选择要修改的数据!', ''), 'info');return;}$("#formJRTPrintTemplateEle").form('load', selectRow);$('#winEditJRTPrintTemplateEle').window({title: TranslateDataMTHD('Update Data', '修改数据', ''),modal: true});}//删除数据点击$("#btnDeleteJRTPrintTemplateEle").click(function () {var checkRow = $('#dgJRTPrintTemplateEle').datagrid("getChecked");var selectRow = $('#dgJRTPrintTemplateEle').datagrid("getSelected");if ((checkRow == null || checkRow.length == 0)&&selectRow==null) {$.messager.alert(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Please select the data to delete', '请勾选要删除的数据!', ''), 'info');return;}if ((checkRow == null || checkRow.length == 0)) {checkRow=[selectRow];}var RowIDS = "";for (var i = 0; i < checkRow.length; i++) {if (i == 0) {RowIDS = checkRow[i].RowID;}else {RowIDS += "^" + checkRow[i].RowID;}}$.messager.confirm(TranslateDataMTHD('Info', '提示', ''), TranslateDataMTHD('Do you want to delete the selected data', '是否要删除选择的数据?', '') , function (r) {if (r) {//开启等待$.messager.progress({ text: TranslateDataMTHD("Deleting data","正在删除数据", ""), interval: 500 });setTimeout(function () {$.messager.progress('close');}, 8000);//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=DeleteJRTPrintTemplateEle',data: { RowIDS: RowIDS },success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}if (!data.IsOk) {$.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);}else {QryJRTPrintTemplateEle();$.messager.show({title: TranslateDataMTHD("Info", "提示", ""),msg: TranslateDataMTHD("Successfully deleted!", "删除成功!", ""),timeout: 500,showType: 'slide'});}}});}});});//保存数据$("#btnSaveJRTPrintTemplateEle").click(function () {var saveData = jQuery.parseJSON($("#formJRTPrintTemplateEle").serializeObject());//开启等待$.messager.progress({ text: TranslateDataMTHD("Saving data","正在保存数据", ""), interval: 500 });setTimeout(function () {$.messager.progress('close');}, 8000);//往后台提交数据$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=SaveJRTPrintTemplateEle',data: saveData,success: function (data, status) {$.messager.progress('close');if (!FilterBackData(data)) {return;}if (!data.IsOk) {$.messager.alert(TranslateDataMTHD("Error message", "错误提示", ""), TranslateDataMTHD("failed to dalete data, error message:", "删除失败,错误信息:", "") + data.Message);}else {QryJRTPrintTemplateEle();$.messager.show({title: TranslateDataMTHD("Info", "提示", ""),msg: TranslateDataMTHD("Successfully saveed!", "保存成功!", ""),timeout: 500,showType: 'slide'});$('#winEditJRTPrintTemplateEle').window("close");}}});});//关闭窗口$("#btnCloseJRTPrintTemplateEle").click(function () {$('#winEditJRTPrintTemplateEle').window("close");});//构造查询事件$("#txtFilterJRTPrintTemplateEle").searchbox({searcher: function (value, name) {QryJRTPrintTemplateEle();},prompt: TranslateDataMTHD('Enter query', '回车查询', '')});//模板下拉表格渲染$('#txtJRTPrintTemplateElePrintTemplateDR').combogrid({panelWidth: 350,idField: 'RowID',width: 205,textField: 'CName',url: me.actionUrl + '?Method=CommonQueryView&data='+JSON.stringify({ ModelName: "JRTPrintTemplate", Pram: [], IsDisplayCount: false, Joiner: [], Operators: [] }),columns: [[{ field: 'RowID', title: '主键', width: 60 },{ field: 'CName', title: '名称', width: 260 }]]});$('#txtJRTPrintTemplateElePrintTemplateDR').combogrid("showSelectWin");//JRTPrintTemplateEle表格$('#dgJRTPrintTemplateEle').datagrid({remoteSort:false,singleSelect: true,toolbar: "#dgJRTPrintTemplateEleToolBar",fit: true,onSelect: function (index, row) {//方便拷贝到子表查询用var selectJRTPrintTemplateEle=$('#dgJRTPrintTemplateEle').datagrid("getSelected");},onDblClickRow: function (index, row) {UpdateJRTPrintTemplateEle(row);},columns: [[{ field: 'ChkFlag', title: TranslateDataMTHD('Check', '选择', ''), width: 20, sortable: true, align: 'center', checkbox: true },{ field: 'RowID', title: TranslateDataMTHD('RowID', '主键', '') , width: 150, sortable: true },{ field: 'PrintTemplateDRName', title: TranslateDataMTHD('PrintTemplateDRName', '模板', '') , width: 150, sortable: true },{ field: 'PrintType', title: TranslateDataMTHD('PrintType', '元素类型', '') , width: 150, sortable: true },{ field: 'PrintX', title: TranslateDataMTHD('PrintX', 'X坐标', '') , width: 150, sortable: true },{ field: 'PrintY', title: TranslateDataMTHD('PrintY', 'Y坐标', '') , width: 150, sortable: true },{ field: 'PrintFont', title: TranslateDataMTHD('PrintFont', '打印字体', '') , width: 150, sortable: true },{ field: 'PrintFontSize', title: TranslateDataMTHD('PrintFontSize', '打印字体大小', '') , width: 150, sortable: true },{ field: 'PrintFontStyle', title: TranslateDataMTHD('PrintFontStyle', '打印字体样式', '') , width: 150, sortable: true },{ field: 'PrintLength', title: TranslateDataMTHD('PrintLength', '打印长度', '') , width: 150, sortable: true },{ field: 'PrintWidth', title: TranslateDataMTHD('PrintWidth', '元素宽度', '') , width: 150, sortable: true },{ field: 'PrintHeight', title: TranslateDataMTHD('PrintHeight', '元素高度', '') , width: 150, sortable: true },{ field: 'PrintText', title: TranslateDataMTHD('PrintText', '元素文本', '') , width: 150, sortable: true },{ field: 'DataField', title: TranslateDataMTHD('DataField', '绑定属性', '') , width: 150, sortable: true },{ field: 'PrintFlag', title: TranslateDataMTHD('PrintFlag', '特殊标志', '') , width: 150, sortable: true },{ field: 'PrintAlignment', title: TranslateDataMTHD('PrintAlignment', '停靠方向', '') , width: 150, sortable: true },{ field: 'LayOut', title: TranslateDataMTHD('LayOut', '布局方式', '') , width: 150, sortable: true },{ field: 'Angle', title: TranslateDataMTHD('Angle', '旋转角度', '') , width: 150, sortable: true },{ field: 'IsVShow', title: TranslateDataMTHD('IsVShow', '是否垂直显示', '') , width: 150, sortable: true },{ field: 'Color', title: TranslateDataMTHD('Color', '颜色', '') , width: 150, sortable: true },{ field: 'FixedReport', title: TranslateDataMTHD('FixedReport', '固定元素', '') , width: 150, sortable: true }]]});//查询JRTPrintTemplateElefunction QryJRTPrintTemplateEle() {var Filter = $("#txtFilterJRTPrintTemplateEle").searchbox("getValue");//开启等待,默认注释,在单击事件调用的逻辑启用等待会冲掉双击事件,按需要开启//$.messager.progress({ text: TranslateDataMTHD("Querying data","正在查询数据", ""), interval: 500 });//setTimeout(function () {//$.messager.progress('close');//}, 8000);$.ajax({type: "post",dataType: "json",cache: false, //async: true, //为true时,异步,不等待后台返回值,为false时强制等待;-asirurl: me.actionUrl + '?Method=QryJRTPrintTemplateEle',data: { Filter: Filter },success: function (data, status) {//结束等待//$.messager.progress('close');if (!FilterBackData(data)) {return;}$('#dgJRTPrintTemplateEle').datagrid("loadData", data);}});};//执行查询数据QryJRTPrintTemplateEle();});//上传文件function UpFile(a) {var selectFiles = document.getElementById('file_upload').files;if (selectFiles != null && selectFiles.length > 0) {for (var i = 0; i < selectFiles.length; i++) {var data = new FormData();var file = selectFiles[i];data.append("file", file);ajaxLoading();setTimeout(function () {ajaxLoadEnd();}, 4000);var url = me.actionUrl + "?Method=UpImageFile";var callback = function (retData) {retData = JSON.parse(retData);if (retData.IsOk) {showInfo("上传成功!");}else {showError(retData["Message"]);}ajaxLoadEnd();};JRTHttpSys(data, url, callback);}$("#file_upload").val("");}}</script>
</head>
<body><div class="easyui-layout" fit="true" style="border: none;"><div data-options="region:'center',title:''" style="border: none;"><div id="dgJRTPrintTemplateEleToolBar" style="padding: 3px 0px 3px 10px;"><a id="btnAddJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" plain="true" listranslate="html~Add">新增</a><a id="btnUpdateJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-write-order'" plain="true" listranslate="html~Mod">修改</a><a id="btnDeleteJRTPrintTemplateEle" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" plain="true" listranslate="html~Del">删除</a><input id="txtFilterJRTPrintTemplateEle" style="margin-left: 14px; width: 240px;"></input><a id="btnExport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">导出</a><a id="btnExport1" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">多模板</a><a id="btnExport0" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~Export">无模板</a><a id="btnPrintPreview" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintPreview">打印预览</a><a id="btnPrintPreviewInline" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintPreview">在线预览</a><a id="btnPrint" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~Print">打印</a><a id="btnPDF" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PDF">PDF</a><a id="btnPDFSave" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PDF">PDF弹</a><a id="btnPrintPreviewGrid" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintGrid">打表格</a><a id="btnPrintReport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~PrintReport">打报告</a><a id="btnCenterPrint" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print'" plain="true" listranslate="html~CenterPrint">集中打印</a><a id="btnUpfile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">上传文件</a><input type="file" id="file_upload" name="f" onchange="UpFile(this);" accept="image/png,image/gif,image/jp2,image/jpeg,image/bmp" style="display: none" multiple="multiple" /><a id="btnExcelGetJson" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" plain="true" listranslate="html~ExcelJson">ExcelJson</a><a id="btnRenamefile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">改名</a><a id="btnDeletefile" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-file'" plain="true" listranslate="html~File">删除</a></div><table id="dgJRTPrintTemplateEle" title="" iconcls="icon-paper" listranslate="title~JRTPrintTemplateEle"></table></div><div id="winEditJRTPrintTemplateEle" style="padding: 10px 0px 0px 10px;width:1140px;height:366.6666666666666667px;display: none;"><form id="formJRTPrintTemplateEle" name="edit_form" method="post"><input type="hidden" id="txtJRTPrintTemplateEleRowID" name="RowID" value="0" /><table><tr><td class="lisar" jrttranslate="html~PrintTemplateDR">模板</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintTemplateDR" type="text" name="PrintTemplateDR" style="width:200px;"/></td><td class="lisar" jrttranslate="html~PrintType">元素类型</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintType" type="text" name="PrintType" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td><td class="lisar" jrttranslate="html~PrintX">X坐标</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintX" type="text" name="PrintX" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintY">Y坐标</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintY" type="text" name="PrintY" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~PrintFont">打印字体</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFont" type="text" name="PrintFont" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td><td class="lisar" jrttranslate="html~PrintFontSize">打印字体大小</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFontSize" type="text" name="PrintFontSize" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintFontStyle">打印字体样式</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFontStyle" type="text" name="PrintFontStyle" style="width:200px;" class="easyui-validatebox"  maxlength="20"/></td><td class="lisar" jrttranslate="html~PrintLength">打印长度</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintLength" type="text" name="PrintLength" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~PrintWidth">元素宽度</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintWidth" type="text" name="PrintWidth" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintHeight">元素高度</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintHeight" type="text" name="PrintHeight" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~PrintText">元素文本</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintText" type="text" name="PrintText" style="width:200px;" class="easyui-validatebox"  maxlength="2000"/></td><td class="lisar" jrttranslate="html~DataField">绑定属性</td><td class="lisal"><input id="txtJRTPrintTemplateEleDataField" type="text" name="DataField" style="width:200px;" class="easyui-validatebox"  maxlength="500"/></td></tr><tr><td class="lisar" jrttranslate="html~PrintFlag">特殊标志</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintFlag" type="text" name="PrintFlag" style="width:200px;" class="easyui-validatebox"  maxlength="50"/></td><td class="lisar" jrttranslate="html~PrintAlignment">停靠方向</td><td class="lisal"><input id="txtJRTPrintTemplateElePrintAlignment" type="text" name="PrintAlignment" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~LayOut">布局方式</td><td class="lisal"><input id="txtJRTPrintTemplateEleLayOut" type="text" name="LayOut" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></tr><tr><td class="lisar" jrttranslate="html~Angle">旋转角度</td><td class="lisal"><input id="txtJRTPrintTemplateEleAngle" type="text" name="Angle" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~IsVShow">是否垂直显示</td><td class="lisal"><input id="txtJRTPrintTemplateEleIsVShow" type="text" name="IsVShow" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td><td class="lisar" jrttranslate="html~Color">颜色</td><td class="lisal"><input id="txtJRTPrintTemplateEleColor" type="text" name="Color" style="width:200px;" class="easyui-validatebox"  maxlength="30"/></td></tr><tr><td class="lisar" jrttranslate="html~FixedReport">固定元素</td><td class="lisal"><input id="txtJRTPrintTemplateEleFixedReport" type="text" name="FixedReport" style="width:200px;" class="easyui-validatebox"  maxlength="10"/></td></table><div region="south" border="fale" style="text-align: center; padding: 5px 0 0;"><a id="btnSaveJRTPrintTemplateEle" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Save">保存</a><span class="sp6"></span><a id="btnCloseJRTPrintTemplateEle" href="#" class="easyui-linkbutton" plain="false" listranslate="html~Cancel">取消</a></div></form></div><div id="winPrintPreview" style="padding: 10px 0px 0px 10px; width: 1140px; height: 786px; display: none;"></div></div>
</body>
</html>

后台

import JRT.Core.MultiPlatform.FileCollection;
import JRT.Model.Bussiness.Parameters;
import JRTBLLBase.BaseHttpHandler;
import JRTBLLBase.Helper;
import JRT.Core.Dto.HashParam;
import JRT.Core.Dto.ParamDto;
import JRT.Core.Dto.OutParam;
import JRT.Model.Entity.*;
import JRT.Core.Util.Convert;
import JRT.Core.MultiPlatform.JRTContext;import java.util.ArrayList;
import java.util.List;/**
*由代码生成器生成的后台代码
*/
public class ashJRTPrintTemplateEle extends BaseHttpHandler {/*** 保存数据,前台按表的属性名提交* @return 字符串*/public String SaveJRTPrintTemplateEle() throws Exception{JRTPrintTemplateEle dto=new JRTPrintTemplateEle();//主键dto.RowID=Helper.ValidParam(JRTContext.GetRequest(Request, "RowID"), dto.RowID);//模板dto.PrintTemplateDR=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintTemplateDR"), dto.PrintTemplateDR);//元素类型dto.PrintType=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintType"), dto.PrintType);//X坐标dto.PrintX=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintX"), dto.PrintX);//Y坐标dto.PrintY=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintY"), dto.PrintY);//打印字体dto.PrintFont=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFont"), dto.PrintFont);//打印字体大小dto.PrintFontSize=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFontSize"), dto.PrintFontSize);//打印字体样式dto.PrintFontStyle=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFontStyle"), dto.PrintFontStyle);//打印长度dto.PrintLength=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintLength"), dto.PrintLength);//元素宽度dto.PrintWidth=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintWidth"), dto.PrintWidth);//元素高度dto.PrintHeight=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintHeight"), dto.PrintHeight);//元素文本dto.PrintText=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintText"), dto.PrintText);//绑定属性dto.DataField=Helper.ValidParam(JRTContext.GetRequest(Request, "DataField"), dto.DataField);//特殊标志dto.PrintFlag=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintFlag"), dto.PrintFlag);//停靠方向dto.PrintAlignment=Helper.ValidParam(JRTContext.GetRequest(Request, "PrintAlignment"), dto.PrintAlignment);//布局方式dto.LayOut=Helper.ValidParam(JRTContext.GetRequest(Request, "LayOut"), dto.LayOut);//旋转角度dto.Angle=Helper.ValidParam(JRTContext.GetRequest(Request, "Angle"), dto.Angle);//是否垂直显示dto.IsVShow=Helper.ValidParam(JRTContext.GetRequest(Request, "IsVShow"), dto.IsVShow);//颜色dto.Color=Helper.ValidParam(JRTContext.GetRequest(Request, "Color"), dto.Color);//固定元素dto.FixedReport=Helper.ValidParam(JRTContext.GetRequest(Request, "FixedReport"), dto.FixedReport);OutParam out=new OutParam();int ret=0;//更新if(dto.RowID>0){ret=EntityManager().Update(dto,null, out, null, null, null);}//插入数据else{ret=EntityManager().Save(dto,out);}if(ret==1){return Helper.Success();}else{return Helper.Error(out);}}/*** 删除数据,多个RowID以上尖号分割* @return 字符串*/public String DeleteJRTPrintTemplateEle() throws Exception{String RowIDS=Helper.ValidParam(JRTContext.GetRequest(Request, "RowIDS"), "");if(RowIDS.isEmpty()){return Helper.Error("请传入要删除数据的RowID,多个以^分割!");}//分割主键String [] arr=RowIDS.split("^");//out参数OutParam out=new OutParam();//循环删除数据for(int i=0;i<arr.length;i++){int ret=EntityManager().RemoveById(JRTPrintTemplateEle.class,Convert.ToInt32(arr[i]),out);if(ret!=1){return Helper.Error(out);}}return Helper.Success();}/*** 查询数据,前台按表的属性名提交* @return 字符串*/public String QryJRTPrintTemplateEle() throws Exception{//模糊查询String Filter=Helper.ValidParam(JRTContext.GetRequest(Request, "Filter"), "");Parameters para=new Parameters();para.P0=Filter;para.P1="1";//调虚拟M查询数据,和导出共用逻辑return Helper.GetVMData("vm.test.QryPrintTemplateEle","QryPrintEle",para,null,null);}/*** 上传文件到文件服务* @return*/public String UpImageFile() throws Exception{//得到文件List<FileCollection> fileList=JRT.Core.MultiPlatform.JRTWebFile.GetFiles(Request);if(fileList!=null&&fileList.size()>0){JRT.Core.MultiPlatform.FileService fileService=new JRT.Core.MultiPlatform.FileService();fileService.Upload("http://localhost:8080/JRTWeb/FileService/",fileList.get(0).GetInputStream(),fileList.get(0).GetFileName(),"/zlz");}return Helper.Success();}/*** 改名文件* @return*/public String ReNameImageFile() throws Exception{JRT.Core.MultiPlatform.FileService fileService=new JRT.Core.MultiPlatform.FileService();fileService.ReName("http://localhost:8080/JRTWeb/FileService/","logo.png","logo1.png","zlz/");return Helper.Success();}/*** 删除文件* @return*/public String DeleteImageFile() throws Exception{JRT.Core.MultiPlatform.FileService fileService=new JRT.Core.MultiPlatform.FileService();fileService.Delete("http://localhost:8080/JRTWeb/FileService/zlz/logo.png");fileService.Delete("http://localhost:8080/JRTWeb/FileService/zlz/logo1.png");return Helper.Success();}/*** 测试日期时间转JSON* @return* @throws Exception*/public String JsonTest() throws Exception{List<JRTPrintTemplate> list=EntityManager().FindAllSimple(JRTPrintTemplate.class,null);return Helper.Object2Json(list);}}

打印后台

import JRT.Core.Dto.OutParam;
import JRT.Core.Dto.OutValue;
import JRT.Core.Dto.PrintElement;
import JRT.Core.Util.PrintDrawProtocol;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;import java.awt.*;
import java.util.ArrayList;
import java.util.List;/*** 输出符合打印元素绘制协议的打印元素数据,来供打印执行层打印*/
public class PrintBarCodeTest extends BaseHttpHandlerNoSession {/*** 按传入的RowID输出符合打印元素绘制协议的数据来实现打印控制** @param RowID   业务主键* @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*/public String GetData(String RowID, 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 {List<PrintElement> retList = new ArrayList<>();//控制打印机//retList.add(PrintDrawProtocol.ControlPrinter("A5", PrintDrawProtocol.PrintLayout.Portrait,"pdf","",0,0));//标志A4打印两个//retList.add(PrintDrawProtocol.A4Double(true));//打印PDF文件//retList.add(PrintDrawProtocol.DrawFile("http://localhost:8080/JRTWeb/FileService/test.pdf"));retList.add(PrintDrawProtocol.DrawPDF("http://localhost:8080/JRTWeb/FileService/test.pdf"));//换页retList.add(PrintDrawProtocol.ChangePage());//换页retList.add(PrintDrawProtocol.ChangePage());//换页retList.add(PrintDrawProtocol.ChangePage());//页码retList.add(PrintDrawProtocol.DrawPageNum(720, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));//画logoretList.add(PrintDrawProtocol.DrawLabel(420, 10, "http的logn图", "宋体", 22, "", null, "", "#fda632", "0"));retList.add(PrintDrawProtocol.DrawGraph(420, 30, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));retList.add(PrintDrawProtocol.DrawLabel(420, 150, "ftp的logn图", "宋体", 12, "", null, "", "#fda632", "0"));//retList.add(PrintDrawProtocol.DrawGraph(420,180,64,64,"ftp://zlz:zlz@127.0.0.1:21/ftp.png",false,null));//画一个文本retList.add(PrintDrawProtocol.DrawLabel(20, 20, "zhanglianzhu", "宋体", 12, "", null, "", "#ff5252", "0"));//画一个条码retList.add(PrintDrawProtocol.DrawBarCode(20, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));//换一根横线retList.add(PrintDrawProtocol.DrawLine(20, 70, 70, 70, 1, "", ""));//换一根竖线retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));//绘制一个条码retList.add(PrintDrawProtocol.DrawQRCode(20, 90, "jbase", 90, 90));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(20, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(20, 230, "20231118 22:49", "宋体", 12, "", null, "", "", "0"));//画一个点retList.add(PrintDrawProtocol.DrawPoint(20, 270, 10, 10, "o", ""));retList.add(PrintDrawProtocol.DrawPoint(100, 270, 10, 10, "[]", ""));retList.add(PrintDrawProtocol.DrawPoint(200, 270, 10, 10, "<>", ""));//画多边形List<Point> pointList = new ArrayList<>();Point p1 = new Point();p1.x = 10;p1.y = 300;pointList.add(p1);Point p2 = new Point();p2.x = 100;p2.y = 310;pointList.add(p2);Point p3 = new Point();p3.x = 50;p3.y = 360;pointList.add(p3);retList.add(PrintDrawProtocol.DrawPoly(pointList, ""));//画复选框retList.add(PrintDrawProtocol.DrawCheckBox(10, 400, true, 30, 30));//画单选框retList.add(PrintDrawProtocol.DrawRadio(60, 400, true, 30, 30));//画复选框retList.add(PrintDrawProtocol.DrawCheckBox(110, 400, false, 30, 30));//画单选框retList.add(PrintDrawProtocol.DrawRadio(160, 400, false, 30, 30));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(20, 1010, "页尾", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLabel(20, 900, "A4纸张打印", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLine(20, 920, 700, 920, 1, "0", ""));retList.add(PrintDrawProtocol.DrawLine(20, 940, 700, 940, 1, "1", ""));retList.add(PrintDrawProtocol.DrawLine(20, 960, 700, 960, 1, "2", ""));retList.add(PrintDrawProtocol.DrawLine(20, 980, 700, 980, 1, "3", ""));retList.add(PrintDrawProtocol.DrawLine(20, 1000, 700, 1000, 1, "4", ""));//换一根横线retList.add(PrintDrawProtocol.DrawLine(20, 1025, 700, 1025, 1, "", ""));//换页retList.add(PrintDrawProtocol.ChangePage());//页码retList.add(PrintDrawProtocol.DrawPageNum(520, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));//画logoretList.add(PrintDrawProtocol.DrawLabel(420, 10, "logn图", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawGraph(420, 20, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));//画一个文本retList.add(PrintDrawProtocol.DrawLabel(10, 10, "这是打印的第二页", "宋体", 12, "", null, "", "", "0"));//画一个条码retList.add(PrintDrawProtocol.DrawBarCode(10, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));//换一根横线retList.add(PrintDrawProtocol.DrawLine(10, 70, 70, 70, 1, "", ""));//换一根竖线retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));//绘制一个条码retList.add(PrintDrawProtocol.DrawQRCode(10, 90, "jbase", 90, 90));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 230, "20231119", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLabel(20, 500, "A5纸张打印", "宋体", 12, "", null, "", "", "0"));//画一根横线retList.add(PrintDrawProtocol.DrawLine(20, 525, 700, 525, 1, "", ""));//换页retList.add(PrintDrawProtocol.ChangePage());//页码retList.add(PrintDrawProtocol.DrawPageNum(520, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));//画logoretList.add(PrintDrawProtocol.DrawLabel(420, 10, "logn图", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawGraph(420, 20, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));//画一个文本retList.add(PrintDrawProtocol.DrawLabel(10, 10, "这是打印的第三页", "宋体", 12, "", null, "", "", "0"));//画一个条码retList.add(PrintDrawProtocol.DrawBarCode(10, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));//换一根横线retList.add(PrintDrawProtocol.DrawLine(10, 70, 70, 70, 1, "", ""));//换一根竖线retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));//绘制一个条码retList.add(PrintDrawProtocol.DrawQRCode(10, 90, "jbase", 90, 90));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 230, "20231119", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLabel(20, 500, "A5纸张打印", "宋体", 12, "", null, "", "", "0"));//画一根横线retList.add(PrintDrawProtocol.DrawLine(20, 525, 700, 525, 1, "", ""));//换页retList.add(PrintDrawProtocol.ChangePage());//页码retList.add(PrintDrawProtocol.DrawPageNum(520, 10, "", "宋体", 12, "", null, "", "#fda632", "0"));//画logoretList.add(PrintDrawProtocol.DrawLabel(420, 10, "logn图", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawGraph(420, 20, 64, 64, "http://localhost:8080/JRTWeb/FileService/logo.png", false, null));//画一个文本retList.add(PrintDrawProtocol.DrawLabel(10, 10, "这是打印的第四页", "宋体", 12, "", null, "", "", "0"));//画一个条码retList.add(PrintDrawProtocol.DrawBarCode(10, 50, "0947809", true, 5, 30, "", "宋体", 12, "", null, "", "0"));//换一根横线retList.add(PrintDrawProtocol.DrawLine(10, 70, 70, 70, 1, "", ""));//换一根竖线retList.add(PrintDrawProtocol.DrawLine(50, 10, 50, 470, 1, "", ""));//绘制一个条码retList.add(PrintDrawProtocol.DrawQRCode(10, 90, "jbase", 90, 90));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 210, "jbase打印支持", "宋体", 12, "", null, "", "", "0"));//绘制一个条码retList.add(PrintDrawProtocol.DrawLabel(10, 230, "20231206", "宋体", 12, "", null, "", "", "0"));retList.add(PrintDrawProtocol.DrawLabel(20, 500, "A5纸张打印", "宋体", 12, "", null, "", "", "0"));//画一根横线retList.add(PrintDrawProtocol.DrawLine(20, 525, 700, 525, 1, "", ""));//先包一个打印元素绘制协议数据生成的工具类来解决元素约束问题,工具类实现了调用工具类得到标签,条码,文本等return Helper.Object2Json(retList);}
}

模板打印后台

import JRT.Core.DataGrid.GridDto;
import JRT.Core.DataGrid.IGridChangePage;
import JRT.Core.Dto.HashParam;
import JRT.Core.Dto.OutValue;
import JRT.Core.Dto.PrintElement;
import JRT.Core.Util.Convert;
import JRT.Core.Util.PrintDrawProtocol;
import JRT.Model.Entity.JRTPrintTemplate;
import JRT.Model.Entity.JRTPrintTemplateEle;
import JRTBLLBase.BaseHttpHandlerNoSession;
import JRTBLLBase.Helper;import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;/*** 调用模板数据来打印,这是一个模拟打印的demo,调用模板数据组装打印数据*/
public class PrintTemplateTest extends BaseHttpHandlerNoSession implements IGridChangePage {/*** 打印元素*/private List<PrintElement> retList = new ArrayList<>();/*** 打印模板数据*/JRTPrintTemplateDto template =null;/*** 存打印的Data数据*/Hashtable<String, String> printDataMap =null;/*** 表格换页之前要执行的逻辑* @param gridKey* @param maxY*/public void PreChangePageDo(String gridKey,int maxY){}/*** 表格换页之后要执行的逻辑* @param gridKey* @param maxY*/public void AfterChangePageDo(String gridKey,int maxY){System.out.println("换页后执行逻辑");//画数据元素PrintData(template, retList, printDataMap);//画标签元素PrintLabel(template, retList);//画线元素PrintLine(template, retList);}/*** 按传入的RowID输出符合打印元素绘制协议的数据来实现打印控制** @param RowID   业务主键* @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*/public String GetData(String RowID, 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 {//查询模板数据template = GetOneTemplate(null, "JRTReport");//存打印的Data数据printDataMap = new Hashtable<>();printDataMap.put("姓名", "小乌鱼");printDataMap.put("性别", "男");printDataMap.put("年龄", "32岁");printDataMap.put("登记号", "0947809");printDataMap.put("检验号", "24011901");printDataMap.put("科室", "体检科");printDataMap.put("标本", "全血");printDataMap.put("床号", "");printDataMap.put("诊断", "体检");printDataMap.put("采集日期", "2024-01-19");printDataMap.put("采集时间", "16:00");printDataMap.put("医嘱备注", "体检");printDataMap.put("医嘱名称", "血细胞分析五分类");printDataMap.put("申请医生", "乌鱼");printDataMap.put("申请日期", "2024-01-19");printDataMap.put("操作者", "李四");printDataMap.put("审核日期", "2024-01-19");printDataMap.put("审核时间", "17:00");printDataMap.put("审核者", "张三");//存打印的图数据Hashtable<String, String> printImgMap = new Hashtable<>();printImgMap.put("RPC", "http://localhost:8080/JRTWeb/FileService/zlz/logo.png");//存项目结果数据List<Object> repResList = new ArrayList<>();RepResPrintDto oneRes = new RepResPrintDto();oneRes.AbFlag = "*";oneRes.RefRange = "12-34um/ml";oneRes.Result = "50";oneRes.Seq = "1";oneRes.TestCodeName = "白细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "*";oneRes.RefRange = "12-34um/ml";oneRes.Result = "50";oneRes.Seq = "2";oneRes.TestCodeName = "红细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "";oneRes.RefRange = "12-34um/ml";oneRes.Result = "33";oneRes.Seq = "3";oneRes.TestCodeName = "淋巴细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "4";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "5";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "6";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "7";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = "8";oneRes.TestCodeName = "单核细胞计数";repResList.add(oneRes);for(int k=9;k<40;k++){oneRes = new RepResPrintDto();oneRes.AbFlag = "↓";oneRes.RefRange = "22-34um/ml";oneRes.Result = "5";oneRes.Seq = String.valueOf(k);oneRes.TestCodeName = "项目"+k;repResList.add(oneRes);}//画图片元素PrintImage(template, retList, printImgMap);//画数据元素PrintData(template, retList, printDataMap);//画标签元素PrintLabel(template, retList);//画线元素PrintLine(template, retList);//画表格元素PrintDataGrid(template, retList, repResList);return Helper.Object2Json(retList);}/*** 输出报告结果** @param template* @param template   模板* @param retList    元素列表* @param repResList 报告结果列表*/private void PrintDataGrid(JRTPrintTemplateDto template, List<PrintElement> retList, List<Object> repResList) throws Exception {for (JRTPrintTemplateEle ele : template.EleList) {//输出表格if (ele.PrintType.equals("DataGrid")) {//得到表格定义GridDto defGrid = (GridDto) Helper.Json2Object(ele.PrintText, GridDto.class);int lastY = PrintDrawProtocol.DrawGrid(retList, defGrid, null, repResList, "ReportRes", this);}}}/*** 输出图片** @param template* @param template     模板* @param retList      元素列表* @param printDataMap 数据哈希*/private void PrintImage(JRTPrintTemplateDto template, List<PrintElement> retList, Hashtable<String, String> printDataMap) {for (JRTPrintTemplateEle ele : template.EleList) {//输出图片if (ele.PrintType.equals("Graph")) {boolean isSign = false;if (ele.PrintFlag.equals("D")) {isSign = true;}String dataField = ele.DataField;if (!ele.DataField.isEmpty() && printDataMap.containsKey(ele.DataField)) {dataField = printDataMap.get(ele.DataField);}PrintElement printEle = PrintDrawProtocol.DrawGraph(ele.PrintX, ele.PrintY, ele.PrintWidth, ele.PrintHeight, dataField, isSign, false);retList.add(printEle);}}}/*** 输出数据** @param template     模板* @param retList      元素列表* @param printDataMap 数据哈希*/private void PrintData(JRTPrintTemplateDto template, List<PrintElement> retList, Hashtable<String, String> printDataMap) {for (JRTPrintTemplateEle ele : template.EleList) {//输出标签if (ele.PrintType.equals("Data")) {String dataFiled = ele.DataField;if (!dataFiled.isEmpty() && printDataMap.containsKey(dataFiled)) {//带字的条码if (ele.PrintFlag.contains("BarCode")) {String BarType = ele.PrintFlag.replace("BarCode", "");PrintElement printEle = PrintDrawProtocol.DrawBarCode(ele.PrintX, ele.PrintY, printDataMap.get(dataFiled), true, ele.PrintWidth, ele.PrintHeight, BarType, ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, ele.Angle);retList.add(printEle);}//不带字的条码else if (ele.PrintFlag.contains("BarCodeN")) {String BarType = ele.PrintFlag.replace("BarCodeN", "");PrintElement printEle = PrintDrawProtocol.DrawBarCode(ele.PrintX, ele.PrintY, printDataMap.get(dataFiled), false, ele.PrintWidth, ele.PrintHeight, BarType, ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, ele.Angle);retList.add(printEle);}//画普通数据else {PrintElement printEle = PrintDrawProtocol.DrawLabel(ele.PrintX, ele.PrintY, printDataMap.get(dataFiled), ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, "", ele.Angle);retList.add(printEle);}}}}}/*** 输出标签** @param template* @param retList*/private void PrintLabel(JRTPrintTemplateDto template, List<PrintElement> retList) {for (JRTPrintTemplateEle ele : template.EleList) {//输出标签if (ele.PrintType.equals("Label")) {PrintElement printEle = PrintDrawProtocol.DrawLabel(ele.PrintX, ele.PrintY, ele.PrintText, ele.PrintFont, Convert.ToDouble(ele.PrintFontSize).intValue(), ele.PrintFontStyle, PrintDrawProtocol.GetPrintAlignment(ele.PrintAlignment), ele.Color, "", ele.Angle);retList.add(printEle);}}}/*** 输出线** @param template* @param retList*/private void PrintLine(JRTPrintTemplateDto template, List<PrintElement> retList) {for (JRTPrintTemplateEle ele : template.EleList) {//输出先if (ele.PrintType.equals("ILineN")) {int width = ele.PrintWidth;int height = ele.PrintHeight;int endX = ele.PrintX + width;int endY = ele.PrintY;int lineWidth = height;if (height > width) {endX = ele.PrintX;endY = ele.PrintY;lineWidth = width;}PrintElement printEle = PrintDrawProtocol.DrawLine(ele.PrintX, ele.PrintY, endX, endY, lineWidth, ele.PrintFlag, ele.Color);retList.add(printEle);}}}/*** 通过模板主键或者代码得到模板数据供打印使用** @param rowID* @param code* @return*/private JRTPrintTemplateDto GetOneTemplate(Integer rowID, String code) throws Exception {JRTPrintTemplateDto retDto = null;//按主键取if (rowID != null) {retDto = EntityManager().GetById(JRTPrintTemplateDto.class, rowID);}//按代码取else if (code != null && !code.isEmpty()) {retDto = EntityManager().GetByColVal(JRTPrintTemplateDto.class, "Code", code);}if (retDto != null) {HashParam hs = new HashParam();hs.Add("PrintTemplateDR", retDto.RowID);retDto.EleList = EntityManager().FindAllSimple(JRTPrintTemplateEle.class, hs);}return retDto;}/*** 存获得的一个模板数据*/public static class JRTPrintTemplateDto extends JRTPrintTemplate {/*** 模板元素*/public List<JRTPrintTemplateEle> EleList;}/*** 打印的报告结果实体*/public static class RepResPrintDto {/*** 序号*/public String Seq;/*** 项目名称*/public String TestCodeName;/*** 结果*/public String Result;/*** 标志*/public String AbFlag;/*** 参考范围*/public String RefRange;}
}

摄像头调用

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>JRT摄像头测试</title><link rel="shortcut icon" href="../../resource/common/images/favicon.ico" /><script src="../../resource/common/js/JRTBSBase.js" type="text/javascript"></script><script src="../../jrtprint/js/JRTPrint.js" type="text/javascript"></script><script language="javascript" type="text/javascript">SYSPageCommonInfo.Init();var BasePath = '';var ResourcePath = '';var WebServicAddress = SYSPageCommonInfo.Data.WebServicAddress;var UserDR = SYSPageCommonInfo.Data.Sesssion.UserDR;var GroupID = SYSPageCommonInfo.Data.Sesssion.GroupID;var SessionStr = SYSPageCommonInfo.Data.SessionStr;</script><script type="text/javascript">//jquery入口$(function () {//驱动摄像头,弹出CS窗口模式$("#btnCameral").click(function () {//#跟上0就代表截图后不关闭窗口,跟1就代表截图后自动关闭窗口JRTBaseMsg.Subscribe("CameralBase64#0", CameraMsgCallBack, NoConnCallBack, true);});//启动内嵌摄像头$("#btnStartCameral").click(function () {//#跟上0就代表截图后不关闭窗口,跟1就代表截图后自动关闭窗口JRTBaseMsg.StartCameral($("#divCamera"));});//从内嵌摄像头抓图$("#btnCutImg").click(function () {var base64=JRTBaseMsg.GetCameralImg();$("#divImgShow").append('<img src="' + "data:image/png;base64," + base64 + '" alt="截图" style="margin-bottom:10px;width:400px;height: 300px;margin:10px;"/>');});//停止内嵌摄像头$("#btnStopCameral").click(function () {//#跟上0就代表截图后不关闭窗口,跟1就代表截图后自动关闭窗口JRTBaseMsg.Send("StopCameral#0");});});//截图回调,截图后会把图片Base64串回调到此方法function CameraMsgCallBack(base64) {$("#divImgShow").append('<img src="' + "data:image/png;base64," + base64 + '" alt="截图" style="margin-bottom:10px;width:400px;height: 300px;margin:10px;"/>');}//失败回调function NoConnCallBack() {$.messager.alert(TranslateDataMTHD("Info", "提示", ""), TranslateDataMTHD("Unable to connect to the messaging service!", "无法连接消息服务!", ""));}</script>
</head>
<body><div class="easyui-layout" fit="true" style="border: none;"><div data-options="region:'north',title:'',split:true" style="height:48px;padding: 5px 0 0 10px;"><a id="btnCameral" href="#" class="easyui-linkbutton" data-options="" plain="false" listranslate="html~Cameral">驱动CS摄像头</a><span class="lissp6"></span><a id="btnStartCameral" href="#" class="easyui-linkbutton" data-options="" plain="false" listranslate="html~Cameral">启动内嵌摄像头</a><span class="lissp6"></span><a id="btnCutImg" href="#" class="easyui-linkbutton" data-options="" plain="false" listranslate="html~Cameral">抓图</a><span class="lissp6"></span><a id="btnStopCameral" href="#" class="easyui-linkbutton" data-options="" plain="false" listranslate="html~Cameral">停止内嵌摄像头</a><span class="lissp6"></span><span>此界面用来测试JRT驱动摄像头截图的示例,驱动摄像头请参照该界面实现</span></div><div data-options="region:'center',title:''"><div class="easyui-layout" fit="true"><div data-options="region:'east',title:'JRTCameralVedio',split:true" style="width:950px;padding: 10px;"><div id="divCamera" style="width: 900px;height: 700px;background-color:#333333;"></div></div><div data-options="region:'center',title:'CutImage'"><div id="divImgShow" style="padding: 10px;"></div></div></div></div></div>
</body>
</html>

jrtlis业务开发正式提上日程,有没有人支持JRT一样稳步向前推进,直到实现整套检验系统。JRT对开发人员和维护人员优化,不代表框架实现起来很简单,融合了我十年的技术记录和经验探索,有:web技术、画图、打印、tcp、excel、Webservice、码表、代码生成器、c、Linux、shell、gcc、docker、脚本化、ORM、负载、Electron、https、文件服务、bs-cs交互、base64、rsa、缓存等等。半年内在java上释放。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/587136.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SpringBoot+ECharts+Html 地图案例详解

1. 技术点 SpringBoot、MyBatis、thymeleaf、MySQL、ECharts 等 此案例使用的地图是在ECharts社区中查找的&#xff1a;makeapie echarts社区图表可视化案例 2. 准备条件 在mysql中创建数据库echartsdb&#xff0c;数据库中创建表t_location_count表&#xff0c;表中设置两个…

InternLM

任务一 运行1.8B模型&#xff0c;并对话 User >>> 请创作一个 300 字的小故事 在一片茂密的森林里&#xff0c;住着一只小松鼠&#xff0c;它的名字叫做小雪。小雪非常活泼好动&#xff0c;经常在树上跳跃玩耍。有一天&#xff0c;小雪发现了一个神秘的洞穴&#xf…

大数据学习-2024/3/30-MySQL5.6版本的安装

1、下载好文件后打开bin目录&#xff1a; 2、在这个位置进入输入cmd进入命令行界面&#xff0c;进入命令行界面后输入如下&#xff1a;mysqld install 进行数据库安装&#xff1a; 注意&#xff1a;显示Service successfully installed表示安装成功 3、安装好后启动服务&…

人工智能|深度学习——基于Xception算法模型实现一个图像分类识别系统

一、Xception简介 在计算机视觉领域&#xff0c;图像识别是一个非常重要的任务&#xff0c;其应用涵盖了人脸识别、物体检测、场景理解等众多领域。随着深度学习技术的发展&#xff0c;深度卷积神经网络&#xff08;Convolutional Neural Networks&#xff0c;简称CNN&#xff…

java字符串(一)-- 字符串API,StringBuffer 和 StringBuilder,Object

String字符串相关的类 String的特性 String类&#xff1a;代表字符串。Java 程序中的所有字符串字面值&#xff08;如"abc" &#xff09;都作为此类的实例实现。String类是引用数据类型。 在 Java 8 中&#xff0c;String 内部使用 char 数组存储数据。 public fi…

mysql锁表问题

问题描述 偶尔应用日志会打印锁表超时回滚 org.springframework.dao.CannotAcquireLockException: ### Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transactionmysql锁…

128Days

今天是我踏上创作之路的第128天&#xff0c;回首过去的这些日子&#xff0c;心中充满了感慨和喜悦。我想&#xff0c;每一个热爱创作的人&#xff0c;都会珍惜自己走过的每一天&#xff0c;因为每一天都充满了新的灵感和挑战。 从最初的懵懂无知&#xff0c;到现在对创作的热情…

2023年第十四届蓝桥杯 - 省赛 - C/C++大学A组 - B.有奖问答

Idea 一共 30 道题&#xff0c;得分情况为 0 ~ 100 分。 创建一个 30 行 100 列的 dp 数组&#xff0c;dp[i][j] 表示做完第 i 题&#xff0c;得分为 j 的方案数。 Code Python dp [[0 for _ in range(100)] for _ in range(31)] # dp[i][j] 表示做完第 i 题得分为 j 的…

MyBatis-Plus04(条件构造器)

条件构造器和常用接口 wrapper介绍 Wrapper &#xff1a; 条件构造抽象类&#xff0c;最顶端父类 AbstractWrapper &#xff1a; 用于查询条件封装&#xff0c;生成 sql 的 where 条件 QueryWrapper &#xff1a; 查询条件封装 UpdateWrapper &#xff1a; Update 条件封装 A…

【嵌入式智能产品开发实战】(十四)—— 政安晨:通过ARM-Linux掌握基本技能【链接静态库与动态库】

目录 链接静态库 动态链接 与地址无关的代码 全局偏移表 延迟绑定 共享库 政安晨的个人主页&#xff1a;政安晨 欢迎 &#x1f44d;点赞✍评论⭐收藏 收录专栏: 嵌入式智能产品开发实战 希望政安晨的博客能够对您有所裨益&#xff0c;如有不足之处&#xff0c;欢迎在评论…

数据结构进阶篇 之 【插入排序】详细讲解(直接插入排序,希尔排序)

千万不要因为一件事不会做而失去信心&#xff0c;你又不是只有这一件事不会&#xff0c;你还有很多呢 一、插入排序 1.直接插入排序 InsertSort 1.1 基本思想 1.2 实现原理 1.3 代码实现 1.4 直接插入排序的特性总结 2.希尔排序 ShellSort 2.1 基本思想 2.2 实现原理 …

思腾合力与中科创达联合推出的迅思代码生成一体机产品

思腾合力与中科创达联合推出的迅思代码生成一体机产品&#xff0c;基于思腾合力强大算力底座&#xff0c;搭载中科创达自研国产大模型&#xff0c;面向众多有编程开发需求的客户&#xff0c;简化编程和软件开发过程 &#xff0c;降低编程门槛&#xff0c;全方位提升开发和生产效…