/* *
ClassName: LCCustomerImpartBL
*Description: LCCustomerImpartSchemaBL类文件
*Copyright: Copyright (c) 2002
*Company: sinosoft
* @Database: LIS * @CreateDate:2002-04-01 */ package com.sinosoft.lis.bl; import com.sinosoft.lis.i18n.I18nMessage; import com.sinosoft.lis.db.LBCustomerImpartDB; import com.sinosoft.lis.db.LCCustomerImpartDB; import com.sinosoft.lis.pubfun.GlobalInput; import com.sinosoft.lis.pubfun.MMap; import com.sinosoft.lis.pubfun.PubFun; import com.sinosoft.lis.controller.Action; import com.sinosoft.lis.pubfun.PubSubmit; import com.sinosoft.lis.schema.LBCustomerImpartSchema; import com.sinosoft.lis.schema.LCCustomerImpartSchema; import com.sinosoft.lis.sql.repository.LCCustomerImpartSQL; import com.sinosoft.lis.vschema.LBCustomerImpartSet; import com.sinosoft.lis.vschema.LCCustomerImpartSet; import com.sinosoft.persistence.SQLProxy; import com.sinosoft.utility.*; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import java.util.Objects; import java.util.regex.Pattern; public class LCCustomerImpartBL { private static final Logger logger = LoggerFactory.getLogger(LCCustomerImpartBL.class); private LCCustomerImpartSQL lCCustomerImpartSQL = SQLProxy.getInstance(LCCustomerImpartSQL.class); /** 投保单号 */ private String grpContNo; /** 错误处理类,每个需要错误处理的类中都放置该类 */ private CErrors mErrors = new CErrors(); /** 提交数据的容器 */ private MMap mMMap = new MMap(); /** 操作变量 */ private String mOperate; private String mCurrentDate; private String mCurrentTime; /** 传入数据的容器 */ private VData mInputData = new VData(); public LCCustomerImpartBL() { mCurrentDate = PubFun.getCurrentDate(); mCurrentTime = PubFun.getCurrentTime(); } // @Constructor public static LCCustomerImpartSchema get() { LCCustomerImpartSchema schema = new LCCustomerImpartSchema(); schema.setModifyDate(PubFun.getCurrentDate()); schema.setModifyDate(PubFun.getCurrentTime()); return schema; } /** * 设置默认的字段属性 */ public static void setDefaultFields(LCCustomerImpartSchema schema) { schema.setModifyDate(PubFun.getCurrentDate()); schema.setModifyTime(PubFun.getCurrentTime()); } /** * 从客户告知表和客户告知备份表读取信息 返回true或false */ public static boolean getInfo(LCCustomerImpartSchema schema) { Reflections tR = new Reflections(); LCCustomerImpartDB tDB = new LCCustomerImpartDB(); tDB.setSchema(schema); if (!tDB.getInfo()) // 如果查询失败,查询B表 { LBCustomerImpartDB tDBB = new LBCustomerImpartDB(); LBCustomerImpartSchema tLBCustomerImpartSchema = new LBCustomerImpartSchema(); tR.transFields(tLBCustomerImpartSchema, schema.getSchema()); tDBB.setSchema(tLBCustomerImpartSchema); if (!tDBB.getInfo()) { // @@错误处理 CError tError = new CError(); tError.moduleName = "LCCustomerImpartBL"; tError.functionName = "getInfo"; tError.errorMessage(new I18nMessage("没有查询到客户告知表", "LIS-14541")); schema.mErrors.addOneError(tError); return false; } else { LCCustomerImpartSchema tS = new LCCustomerImpartSchema(); tR.transFields(tS, tDBB.getSchema()); schema.setSchema(tS); } } else { schema.setSchema(tDB.getSchema()); } return true; } /** * 从客户告知表和客户告知备份表读取信息 返回LCCustomerImpartSet * */ public static LCCustomerImpartSet query(LCCustomerImpartSchema schema) { Reflections tR = new Reflections(); LCCustomerImpartSet tLCCustomerImpartSet = new LCCustomerImpartSet(); LCCustomerImpartDB tLCCustomerImpartDB = new LCCustomerImpartDB(); tLCCustomerImpartDB.setSchema(schema.getSchema()); tLCCustomerImpartSet = tLCCustomerImpartDB.query(); if (tLCCustomerImpartSet.size() == 0) { LBCustomerImpartSet tLBCustomerImpartSet = new LBCustomerImpartSet(); LBCustomerImpartDB tLBCustomerImpartDB1 = new LBCustomerImpartDB(); tR.transFields(tLBCustomerImpartDB1.getSchema(), schema.getSchema()); tLBCustomerImpartSet = tLBCustomerImpartDB1.query(); if (tLBCustomerImpartSet.size() == 0) { // @@错误处理 CError tError = new CError(); tError.moduleName = "LCCustomerImpartBL"; tError.functionName = "query"; tError.errorMessage(new I18nMessage("没有查询到客户告知表", "LIS-14541")); schema.mErrors.addOneError(tError); return tLCCustomerImpartSet; } else { tLCCustomerImpartSet.add(schema.getSchema()); tR.transFields(tLCCustomerImpartSet, tLBCustomerImpartSet); } } return tLCCustomerImpartSet; } /** * 从客户告知表和客户告知备份表读取信息 返回LCCustomerImpartSet * */ public static LCCustomerImpartSet executeQuery(LCCustomerImpartSchema schema, SQLwithBindVariables sql) { Reflections tR = new Reflections(); LCCustomerImpartSet tLCCustomerImpartSet = new LCCustomerImpartSet(); LCCustomerImpartDB tLCCustomerImpartDB = new LCCustomerImpartDB(); tLCCustomerImpartDB.setSchema(schema.getSchema()); tLCCustomerImpartSet = tLCCustomerImpartDB.executeQuery(sql); if (tLCCustomerImpartSet.size() == 0) { LBCustomerImpartSet tLBCustomerImpartSet = new LBCustomerImpartSet(); LBCustomerImpartDB tLBCustomerImpartDB1 = new LBCustomerImpartDB(); tR.transFields(tLBCustomerImpartDB1.getSchema(), schema.getSchema()); tLBCustomerImpartSet = tLBCustomerImpartDB1.executeQuery(sql); if (tLBCustomerImpartSet.size() == 0) { // @@错误处理 CError tError = new CError(); tError.moduleName = "LCCustomerImpartBL"; tError.functionName = "query"; tError.errorMessage(new I18nMessage("没有查询到客户告知表", "LIS-14541")); schema.mErrors.addOneError(tError); return tLCCustomerImpartSet; } else { tLCCustomerImpartSet.add(schema.getSchema()); tR.transFields(tLCCustomerImpartSet, tLBCustomerImpartSet); } } return tLCCustomerImpartSet; } public boolean submitData(List