基于JRT完备的脚本化和打印基础,基于JRT的业务可以轻松的实现想要的打效果,这次以质控图的失控处理打印和月报打印来分享基于JRT的打印业务实现。
演示视频链接
失控报告打印
失控处理打印的虚拟M
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.Bussiness.Parameters;
import JRT.Model.Entity.*;
import JRTBLLBase.BaseHttpHandler;
import JRTBLLBase.Helper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
/**
* 打印质控失控处理,实现打印失控处理报告单
*/
public class QCPrintTrancation extends BaseHttpHandler implements IGridChangePage {
/**
* 打印元素
*/
private List<PrintElement> retList = new ArrayList<>();
/**
* 打印模板数据
*/
JRTPrintTemplateDto template = null;
/**
* 存打印的Data数据
*/
Hashtable<String, String> printDataMap = new Hashtable<>();
/**
* 画多个表格增加的Y
*/
private int AddGridY = 0;
/**
* 表格换页之前要执行的逻辑
*
* @param gridKey
* @param maxY
*/
public void PreChangePageDo(String gridKey, int maxY) {
}
/**
* 表格换页之后要执行的逻辑
*
* @param gridKey
* @param maxY
*/
public void AfterChangePageDo(String gridKey, int maxY) {
try {
//画数据元素
PrintData(template, retList, printDataMap);
//画标签元素
PrintLabel(template, retList);
//画线元素
PrintLine(template, retList);
}
catch (Exception ex)
{
}
}
/**
* 执行质控打印绘制逻辑
*
* @param Param
* @param Session
* @param Output
* @return
*/
public String QueryPrintData(Parameters Param, OutValue Session, OutValue Output) throws Exception {
//质控结果主键
String RowIDS=Param.P0;
//查询模板数据
template = GetOneTemplate(null, "QCLossControl");
//控制纸张
if(template.PaperLayout.equals("Landscape"))
{
retList.add(PrintDrawProtocol.ControlPrinter(template.PaperCode, PrintDrawProtocol.PrintLayout.Landscape,"","",0,0));
}
else
{
retList.add(PrintDrawProtocol.ControlPrinter(template.PaperCode, PrintDrawProtocol.PrintLayout.Portrait,"","",0,0));
}
String [] rowIDArr=RowIDS.split(",");
//循环打印
for(String one:rowIDArr) {
int QcResDR=Convert.ToInt32(one);
QCTestResultTransaction transDto=EntityManager().GetByColVal(QCTestResultTransaction.class,"TestResultDR",QcResDR);
int transDR=transDto.RowID;
//构造Data
MakeDataData(transDR);
//画数据元素
PrintData(template, retList, printDataMap);
//画标签元素
PrintLabel(template, retList);
//画线元素
PrintLine(template, retList);
//打印的表格数据
List<Object> gridData=new ArrayList<>();
HashMap row1=new HashMap();
row1.put("Title","失控类型");
row1.put("Data","");
if(transDto.TransactionTypeDR!=null)
{
BTQCTransactionType typeDto=EntityManager().DolerGet(BTQCTransactionType.class,transDto.TransactionTypeDR);
row1.put("Data",typeDto.CName);
}
gridData.add(row1);
HashMap row2=new HashMap();
row2.put("Title","处理方法");
row2.put("Data",transDto.TransactionMethod);
gridData.add(row2);
HashMap row3=new HashMap();
row3.put("Title","处理结果");
row3.put("Data",transDto.TransactionRes);
gridData.add(row3);
HashMap row4=new HashMap();
row4.put("Title","临床影响");
row4.put("Data",transDto.ClinicaImpact);
gridData.add(row4);
HashMap row5=new HashMap();
row5.put("Title","预防措施");
row5.put("Data",transDto.Precaution);
gridData.add(row5);
//绘制表格数据
PrintGrid(template, retList,gridData);
//输出换页标识,这里不用考虑是否多输出了,打印会忽略空白
retList.add(PrintDrawProtocol.ChangePage());
}
return Helper.Object2Json(retList);
}
/**
* 构造数据
* @param transDR 失控数据主键
*/
private void MakeDataData(int transDR) throws Exception
{
QCTestResultTransaction transDto=EntityManager().DolerGet(QCTestResultTransaction.class,transDR);
QCTestResult resDto=EntityManager().DolerGet(QCTestResult.class,transDto.TestResultDR);
QCResMaterialTestCode para=EntityManager().DolerGet(QCResMaterialTestCode.class,resDto.ResMaterialTestCodeDR);
BTMIMachineParameter machDto=EntityManager().DolerGet(BTMIMachineParameter.class,resDto.MachineParameterDR);
BTHospital hosDto=EntityManager().DolerGet(BTHospital.class,machDto.HospitalDR);
BTTestCode tsDto=EntityManager().DolerGet(BTTestCode.class, resDto.TestCodeDR);
BTQCMaterial matDto=EntityManager().DolerGet(BTQCMaterial.class, resDto.MaterialDR);
HashParam hs=new HashParam();
hs.Add("MaterialDR",resDto.MaterialDR);
hs.Add("LevelNo",resDto.LevelNo);
List<BTQCMaterialLevel> levList=EntityManager().FindAllSimple(BTQCMaterialLevel.class,hs);
printDataMap.put("标题",hosDto.CName+"失控处理单");
printDataMap.put("仪器",machDto.CName);
printDataMap.put("项目名称",tsDto.CName);
printDataMap.put("浓度",levList.get(0).CName);
printDataMap.put("质控批次",para.LotNo);
printDataMap.put("靶值",String.valueOf(para.Mean));
printDataMap.put("SD",String.valueOf(para.SD));
printDataMap.put("质控物",matDto.CName);
printDataMap.put("结果",resDto.TextRes);
printDataMap.put("最后结果","");
printDataMap.put("质控规则","");
if(resDto.QCRulesDR!=null)
{
BTQCRules ruleDto=EntityManager().DolerGet(BTQCRules.class, resDto.QCRulesDR);
printDataMap.put("质控规则",ruleDto.CName);
}
printDataMap.put("测试日期",Helper.DateIntToStr(resDto.TestDate));
printDataMap.put("测试时间",Helper.TimeIntToStr(resDto.TestTime));
printDataMap.put("试剂批次",para.RgLot);
printDataMap.put("试剂有效期",Helper.DateIntToStr(para.RgEffectiveDate));
printDataMap.put("有效日期",Helper.DateIntToStr(para.ExpiryDate));
printDataMap.put("处理人","");
if(transDto.AddUserDR!=null)
{
SYSUser userDto=EntityManager().DolerGet(SYSUser.class, transDto.AddUserDR);
printDataMap.put("处理人",userDto.CName);
}
printDataMap.put("处理日期",Helper.DateIntToStr(transDto.AddDate));
printDataMap.put("处理时间",Helper.TimeIntToStr(transDto.AddTime));
printDataMap.put("小组负责人","");
printDataMap.put("小组负责人签名","");
if(transDto.InnerUserDR!=null)
{
SYSUser userDto=EntityManager().DolerGet(SYSUser.class, transDto.InnerUserDR);
printDataMap.put("小组负责人",userDto.CName);
printDataMap.put("小组负责人签名",userDto.Code);
}
printDataMap.put("专业负责人","");
printDataMap.put("专业负责人签名","");
if(transDto.ProfessionUserDR!=null)
{
SYSUser userDto=EntityManager().DolerGet(SYSUser.class, transDto.ProfessionUserDR);
printDataMap.put("专业负责人",userDto.CName);
printDataMap.put("专业负责人签名",userDto.Code);
}
printDataMap.put("打印时间",Helper.GetNowTimeStr());
}
/**
* 输出表格数据
*
* @param template 模板
* @param retList 元素集合
* @param datas 表格数据
* @throws Exception
*/
private void PrintGrid(JRTPrintTemplateDto template, List<PrintElement> retList, List<Object> datas) throws Exception {
for (JRTPrintTemplateEle ele : template.EleList) {
//输出表格
if (ele.PrintType.equals("DataGrid")) {
//得到表格定义
GridDto defGrid = (GridDto) Helper.Json2Object(ele.PrintText, GridDto.class);
//zw("数据",resGridData);
int lastY = PrintDrawProtocol.DrawGrid(retList, defGrid, null, datas, "grid", this);
}
}
}
/**
* 输出图片
*
* @param template
* @param template 模板
* @param retList 元素列表
* @param ImagePath 图片路径
*/
private void PrintImage(JRTPrintTemplateDto template, List<PrintElement> retList, String ImagePath) throws Exception {
for (JRTPrintTemplateEle ele : template.EleList) {
//输出图片
if (ele.PrintType.equals("Graph")) {
//不是图片元素退出
if (!ele.DataField.equals("P")) {
continue;
}
String[] arr = ImagePath.split(";");
int index = 0;
for (String one : arr) {
if (index > 0) {
AddGridY += ele.PrintHeight + 5;
}
PrintElement printEle = PrintDrawProtocol.DrawGraph(ele.PrintX, ele.PrintY + AddGridY, ele.PrintWidth, ele.PrintHeight, "CMD", false, false);
printEle.PrintFlag = one;
retList.add(printEle);
index++;
}
}
}
}
/**
* 输出数据
*
* @param template 模板
* @param retList 元素列表
* @param printDataMap 数据哈希
*/
private void PrintData(JRTPrintTemplateDto template, List<PrintElement> retList, Hashtable<String, String> printDataMap) throws Exception{
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 if (ele.PrintFlag.equals("D")) {
String iconCode = printDataMap.get(dataFiled);
JRTPrintImage img=EntityManager().GetByColVal(JRTPrintImage.class,"Code",iconCode);
//有签名图标就打印签名
if(img!=null)
{
PrintElement printEle = PrintDrawProtocol.DrawGraph(ele.PrintX, ele.PrintY + AddGridY, ele.PrintWidth, ele.PrintHeight, img.ImgBase64String, true, false);
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);
}
}
//画普通数据
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()) {
System.out.println(code);
retDto = EntityManager().GetByColVal(JRTPrintTemplateDto.class, "Code", code);
}
if (retDto != null) {
if(retDto.JRTPrintPaperDR!=null)
{
JRTPrintPaper paper=EntityManager().DolerGet(JRTPrintPaper.class,retDto.JRTPrintPaperDR);
retDto.PaperCode=paper.Code;
}
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 String PaperCode="";
/**
* 模板元素
*/
public List<JRTPrintTemplateEle> EleList;
}
}
质控月报打印
打印虚拟M
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.Bussiness.Parameters;
import JRT.Model.Entity.JRTPrintPaper;
import JRT.Model.Entity.JRTPrintTemplate;
import JRT.Model.Entity.JRTPrintTemplateEle;
import JRTBLLBase.BaseHttpHandler;
import JRTBLLBase.Helper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
/**
* 实现质控月报的打印
*/
public class QCPrintMonth extends BaseHttpHandler implements IGridChangePage {
/**
* 打印元素
*/
private List<PrintElement> retList = new ArrayList<>();
/**
* 打印模板数据
*/
JRTPrintTemplateDto template = null;
/**
* 存打印的Data数据
*/
Hashtable<String, String> printDataMap = new Hashtable<>();
/**
* 画多个表格增加的Y
*/
private int AddGridY = 0;
/**
* 表格换页之前要执行的逻辑
*
* @param gridKey
* @param maxY
*/
public void PreChangePageDo(String gridKey, int maxY) {
}
/**
* 表格换页之后要执行的逻辑
*
* @param gridKey
* @param maxY
*/
public void AfterChangePageDo(String gridKey, int maxY) {
//画数据元素
PrintData(template, retList, printDataMap);
//画标签元素
PrintLabel(template, retList);
//画线元素
PrintLine(template, retList);
}
/**
* 执行质控打印绘制逻辑
*
* @param Param
* @param Session
* @param Output
* @return
*/
public String QueryPrintData(Parameters Param, OutValue Session, OutValue Output) throws Exception {
String selectPara=Param.P0;
String userCode=Param.P1;
String paramList=Param.P2;
Parameters para=(Parameters)Helper.Json2Object(selectPara,Parameters.class);
//开始日期
String StartDate = para.P0;
//结束日期
String EndDate = para.P1;
//仪器
int MachineParameterDR = Helper.ValidParam(para.P2,0);
//浓度
String Leavel = para.P3;
//项目
String TestCodeDRS = para.P4;
//排除规则
String QcRule = para.P5;
//质控物
String MaterialDRS = para.P6;
String PointType = para.P7;
String LotType = para.P8;
String FLots = para.P9;
zw(paramList);
String [] paraArr=paramList.split("\\$SP\\$");
String templateCode=paraArr[0];
String sessionStr=paraArr[1];
//查询模板数据
template = GetOneTemplate(null, templateCode);
//控制纸张
if(template.PaperLayout.equals("Landscape"))
{
retList.add(PrintDrawProtocol.ControlPrinter(template.PaperCode, PrintDrawProtocol.PrintLayout.Landscape,"","",0,0));
}
else
{
retList.add(PrintDrawProtocol.ControlPrinter(template.PaperCode, PrintDrawProtocol.PrintLayout.Portrait,"","",0,0));
}
OutValue session=new OutValue();
session.Value=sessionStr;
OutValue output=new OutValue();
//查询月报数据
String datasJson=Helper.GetVMData("qc.ashx.ashQCDataCalMonth","QueryQCMonthData",para,session,output);
//转换成List
List<Object> gridData=Helper.Json2List(datasJson,HashMap.class);
//构造Data
MakeDataData(session);
//画数据元素
PrintData(template, retList, printDataMap);
//画标签元素
PrintLabel(template, retList);
//画线元素
PrintLine(template, retList);
//绘制表格数据
PrintGrid(template, retList,gridData);
return Helper.Object2Json(retList);
}
/**
* 构造数据
* @param session
*/
private void MakeDataData(OutValue session)
{
String sessionStr=session.GetString();
String [] arr=sessionStr.split("\\^");
printDataMap.put("标题",arr[0]);
printDataMap.put("打印日期",arr[1]);
printDataMap.put("说明",arr[2]);
printDataMap.put("报表",arr[3]);
printDataMap.put("用户",arr[4]);
printDataMap.put("年月",arr[5]);
printDataMap.put("仪器",arr[6]);
printDataMap.put("工作小组",arr[7]);
printDataMap.put("工作组",arr[8]);
printDataMap.put("规则",arr[9]);
}
/**
* 输出表格数据
*
* @param template 模板
* @param retList 元素集合
* @param datas 表格数据
* @throws Exception
*/
private void PrintGrid(JRTPrintTemplateDto template, List<PrintElement> retList, List<Object> datas) throws Exception {
for (JRTPrintTemplateEle ele : template.EleList) {
//输出表格
if (ele.PrintType.equals("DataGrid")) {
//得到表格定义
GridDto defGrid = (GridDto) Helper.Json2Object(ele.PrintText, GridDto.class);
//zw("数据",resGridData);
int lastY = PrintDrawProtocol.DrawGrid(retList, defGrid, null, datas, "grid", this);
}
}
}
/**
* 输出图片
*
* @param template
* @param template 模板
* @param retList 元素列表
* @param ImagePath 图片路径
*/
private void PrintImage(JRTPrintTemplateDto template, List<PrintElement> retList, String ImagePath) throws Exception {
for (JRTPrintTemplateEle ele : template.EleList) {
//输出图片
if (ele.PrintType.equals("Graph")) {
//不是图片元素退出
if (!ele.DataField.equals("P")) {
continue;
}
String[] arr = ImagePath.split(";");
int index = 0;
for (String one : arr) {
if (index > 0) {
AddGridY += ele.PrintHeight + 5;
}
PrintElement printEle = PrintDrawProtocol.DrawGraph(ele.PrintX, ele.PrintY + AddGridY, ele.PrintWidth, ele.PrintHeight, "CMD", false, false);
printEle.PrintFlag = one;
retList.add(printEle);
index++;
}
}
}
}
/**
* 输出数据
*
* @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()) {
System.out.println(code);
retDto = EntityManager().GetByColVal(JRTPrintTemplateDto.class, "Code", code);
}
if (retDto != null) {
if(retDto.JRTPrintPaperDR!=null)
{
JRTPrintPaper paper=EntityManager().DolerGet(JRTPrintPaper.class,retDto.JRTPrintPaperDR);
retDto.PaperCode=paper.Code;
}
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 String PaperCode="";
/**
* 模板元素
*/
public List<JRTPrintTemplateEle> EleList;
}
}
1.更高的性能
同等的Spring+mybats+radis的程序要3秒以上
2.更低的内存占用
数据库+web+svn+rsync占用低至几百兆
3.更少的依赖
仅需JDK和idea,不需要任何额外软件和插件
4.更快的开发效率
以一人敌两个团队的效率,同时业余开发架构和业务进度不输
5.更高效的维护
开发代码既发布,修改方便,调试方便
6.更多的数据库支持
基本支持所有关系库,而无需业务修改代码
7.Linux完整的支持
开发、打印、客户端、监听、初始化都完成了Linux支持和测试
基础的稳定为业务带来简化和稳定,可以看到我的速度是非常快的,而且写的代码就没准备大改重构,考虑的就是一次设计到位。准备信创接盘,先储备握住机会的实力。