去除页面切换时弹出的问题对话框,并为产品增加缓存
This commit is contained in:
parent
1b27eda27f
commit
0f4479df46
@ -413,7 +413,7 @@ function showItemRequired(dwname,sColName){
|
||||
data: "DataObject=" + $("#SERIALIZED_ASD").val() + "&ColName="+ sColName + "&Required=1",
|
||||
success: function(msg){
|
||||
if(msg.substring(0,5)=="fail:"){
|
||||
alert('校验更新失败:' +msg.substring(5));
|
||||
//alert('校验更新失败:' +msg.substring(5)); 2018/07/08 by zhulh 找不到校验文件没啥好大惊小怪的
|
||||
return;
|
||||
}
|
||||
$("#SERIALIZED_ASD").val(msg);
|
||||
|
||||
@ -25,7 +25,8 @@ try{
|
||||
ObjectConverts.saveObject(new java.io.File(Component.getDWTmpPath(asObj.getSerializableName())), asObj);
|
||||
out.print(sDataObject);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
//e.printStackTrace();2018/07/08 by zhulh 找不到校验文件没啥好大惊小怪的
|
||||
ARE.getLog().error(e.getMessage());
|
||||
out.print("fail:"+ e.toString());
|
||||
}
|
||||
%>
|
||||
@ -22,7 +22,7 @@ import org.dom4j.io.XMLWriter;
|
||||
import jbo.prd.PRD_SPECIFIC_LIBRARY;
|
||||
import jbo.sys.LB_PRODUCT_INFO;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.amarsoft.app.als.prd.config.loader.ProductConfig;
|
||||
import com.amarsoft.app.base.businessobject.BusinessObject;
|
||||
import com.amarsoft.app.base.businessobject.BusinessObjectHelper;
|
||||
import com.amarsoft.app.base.util.XMLHelper;
|
||||
@ -253,9 +253,10 @@ public class ProductParamUtil {
|
||||
public static List<Object> getProductDocInfo(String productId,String componentType) throws Exception{
|
||||
List<Object> docInfo = new ArrayList<Object>();
|
||||
String realXmlPath = getProductValueXmlBySql(productId);
|
||||
BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME);
|
||||
/*BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME);
|
||||
BizObject boLPI = bomLPI.createQuery("ID=:ID").setParameter("ID", realXmlPath).getSingleResult(true);
|
||||
String pData = boLPI.getAttribute("PRODUCT_DATA").getString();
|
||||
String pData = boLPI.getAttribute("PRODUCT_DATA").getString();*/
|
||||
String pData = ProductConfig.getProductData(realXmlPath);
|
||||
String type = componentType;
|
||||
if("".equals(pData)){
|
||||
}else{
|
||||
@ -392,7 +393,7 @@ public class ProductParamUtil {
|
||||
* @throws Exception
|
||||
* @author zhulh
|
||||
*/
|
||||
public static Map<String,List<Map<String,String>>> getProductComponentDecisionTable(String productId,String componentType,String paramName1,String paramName2) throws Exception{
|
||||
public static Map<String,List<Map<String,String>>> getProductComponentDecisionTable(String productId,String componentType,String... paramNames) throws Exception{
|
||||
Map<String,List<Map<String,String>>> productComponent = new HashMap<String,List<Map<String,String>>>();
|
||||
String realXmlPath = getProductValueXmlBySql(productId);
|
||||
//List<BusinessObject> componentList = XMLHelper.getBusinessObjectList(realXmlPath,"Component||Status='1'","ID");
|
||||
@ -406,24 +407,19 @@ public class ProductParamUtil {
|
||||
List<Map<String,String>> parameValues = new ArrayList<Map<String,String>>();
|
||||
for(BusinessObject boP:parameters){
|
||||
Map<String,String> parameValue = new HashMap<String,String>();
|
||||
String paramValue1 = "";
|
||||
String paramValue2 = "";
|
||||
if(boP.containsAttribute("OPTIONALVALUE_"+(paramName1.toUpperCase()))){
|
||||
paramValue1 = boP.getString("OPTIONALVALUE_"+(paramName1.toUpperCase()));
|
||||
}else if(boP.containsAttribute("VALUE_"+(paramName1.toUpperCase()))){
|
||||
paramValue1 = boP.getString("VALUE_"+(paramName1.toUpperCase()));
|
||||
}else if(boP.containsAttribute("MANDATORYVALUE_"+(paramName1.toUpperCase()))){
|
||||
paramValue1 = boP.getString("MANDATORYVALUE_"+(paramName1.toUpperCase()));
|
||||
String paramValue = "";
|
||||
for(String paramName : paramNames) {
|
||||
if(boP.containsAttribute("OPTIONALVALUE_"+(paramName.toUpperCase()))){
|
||||
paramValue = boP.getString("OPTIONALVALUE_"+(paramName.toUpperCase()));
|
||||
}else if(boP.containsAttribute("VALUE_"+(paramName.toUpperCase()))){
|
||||
paramValue = boP.getString("VALUE_"+(paramName.toUpperCase()));
|
||||
}else if(boP.containsAttribute("MANDATORYVALUE_"+(paramName.toUpperCase()))){
|
||||
paramValue = boP.getString("MANDATORYVALUE_"+(paramName.toUpperCase()));
|
||||
} else {
|
||||
paramValue = boP.getString(paramName.toUpperCase());
|
||||
}
|
||||
parameValue.put(paramName, paramValue);
|
||||
}
|
||||
if(boP.containsAttribute("OPTIONALVALUE_"+(paramName2.toUpperCase()))){
|
||||
paramValue2 = boP.getString("OPTIONALVALUE_"+(paramName2.toUpperCase()));
|
||||
}else if(boP.containsAttribute("VALUE_"+(paramName2.toUpperCase()))){
|
||||
paramValue2 = boP.getString("VALUE_"+(paramName2.toUpperCase()));
|
||||
}else if(boP.containsAttribute("MANDATORYVALUE_"+(paramName2.toUpperCase()))){
|
||||
paramValue2 = boP.getString("MANDATORYVALUE_"+(paramName2.toUpperCase()));
|
||||
}
|
||||
parameValue.put(paramName1, paramValue1);
|
||||
parameValue.put(paramName2, paramValue2);
|
||||
parameValues.add(parameValue);
|
||||
}
|
||||
productComponent.put(bo.getString("ID"), parameValues);
|
||||
@ -464,9 +460,10 @@ public class ProductParamUtil {
|
||||
}*/
|
||||
String parameterValue = "";
|
||||
String realXmlPath = getProductValueXmlBySql(productId);
|
||||
BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME);
|
||||
/*BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME);
|
||||
BizObject boLPI = bomLPI.createQuery("ID=:ID").setParameter("ID", realXmlPath).getSingleResult(true);
|
||||
String pData = boLPI.getAttribute("PRODUCT_DATA").getString();
|
||||
String pData = boLPI.getAttribute("PRODUCT_DATA").getString();*/
|
||||
String pData = ProductConfig.getProductData(realXmlPath);
|
||||
String type = componentType;
|
||||
if("".equals(pData)){
|
||||
}else{
|
||||
@ -508,30 +505,28 @@ public class ProductParamUtil {
|
||||
List<BusinessObject> exists = getBusinessObject(realXmlPath, "PRD0201");
|
||||
String result="";
|
||||
for(BusinessObject bo:exists){
|
||||
List<Map> list = com.alibaba.fastjson.JSONArray.parseArray(bo.getObject("DecisionTable").toString(), Map.class);
|
||||
List<BusinessObject> parameters = bo.getBusinessObjects("DecisionTable");
|
||||
if("ExpenseType".equals(bo.getString("ID"))){
|
||||
continue;
|
||||
}
|
||||
for (Map map : list) {
|
||||
String key = map.get("jbo.sample.DecisionTable").toString();
|
||||
Map mapValue = (Map)JSON.parse(key);
|
||||
for(BusinessObject boP:parameters){
|
||||
String maxDays = "";
|
||||
String minDays = "";
|
||||
if(mapValue.containsKey("MINIMUMVALUE_"+(paramName1.toUpperCase()))){
|
||||
minDays = mapValue.get("MINIMUMVALUE_"+(paramName1.toUpperCase())).toString();
|
||||
}else if(mapValue.containsKey("MINIMUMVALUE_"+(paramName2.toUpperCase()))){
|
||||
minDays = mapValue.get("MINIMUMVALUE_"+(paramName2.toUpperCase())).toString();
|
||||
if(boP.containsAttribute("MINIMUMVALUE_"+(paramName1.toUpperCase()))){
|
||||
minDays = boP.getString("MINIMUMVALUE_"+(paramName1.toUpperCase()));
|
||||
}else if(boP.containsAttribute("MINIMUMVALUE_"+(paramName2.toUpperCase()))){
|
||||
minDays = boP.getString("MINIMUMVALUE_"+(paramName2.toUpperCase()));
|
||||
}
|
||||
if(mapValue.containsKey("MAXIMUMVALUE_"+(paramName1.toUpperCase()))){
|
||||
maxDays = mapValue.get("MAXIMUMVALUE_"+(paramName1.toUpperCase())).toString();
|
||||
}else if(mapValue.containsKey("MAXIMUMVALUE_"+(paramName2.toUpperCase()))){
|
||||
maxDays = mapValue.get("MAXIMUMVALUE_"+(paramName2.toUpperCase())).toString();
|
||||
if(boP.containsAttribute("MAXIMUMVALUE_"+(paramName1.toUpperCase()))){
|
||||
maxDays = boP.getString("MAXIMUMVALUE_"+(paramName1.toUpperCase()));
|
||||
}else if(boP.containsAttribute("MAXIMUMVALUE_"+(paramName2.toUpperCase()))){
|
||||
maxDays = boP.getString("MAXIMUMVALUE_"+(paramName2.toUpperCase()));
|
||||
}
|
||||
if(Integer.parseInt(minDays)<=Integer.parseInt(overDays)&& Integer.parseInt(maxDays)>=Integer.parseInt(overDays)){
|
||||
if(mapValue.containsKey("VALUE_"+(paramName1.toUpperCase()))){
|
||||
result = mapValue.get("VALUE_"+(paramName1.toUpperCase())).toString();
|
||||
}else if(mapValue.containsKey("VALUE_"+(paramName2.toUpperCase()))){
|
||||
result = mapValue.get("VALUE_"+(paramName2.toUpperCase())).toString();
|
||||
if(boP.containsAttribute("VALUE_"+(paramName1.toUpperCase()))){
|
||||
result = boP.getString("VALUE_"+(paramName1.toUpperCase()));
|
||||
}else if(boP.containsAttribute("VALUE_"+(paramName2.toUpperCase()))){
|
||||
result = boP.getString("VALUE_"+(paramName2.toUpperCase()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -547,20 +542,20 @@ public class ProductParamUtil {
|
||||
* @author zhulh
|
||||
*/
|
||||
public static String getProductValueXmlBySql(String productId) throws JBOException{
|
||||
BizObject bo = JBOFactory.getBizObjectManager(PRD_SPECIFIC_LIBRARY.CLASS_NAME).createQuery("productid=:ProductId").setParameter("ProductId", productId).getSingleResult(false);
|
||||
/*BizObject bo = JBOFactory.getBizObjectManager(PRD_SPECIFIC_LIBRARY.CLASS_NAME).createQuery("productid=:ProductId").setParameter("ProductId", productId).getSingleResult(false);
|
||||
String realXmlPath = "";
|
||||
if(bo != null){
|
||||
//String path = ProductParamUtil.class.getResource("/").toString();
|
||||
String configfile = bo.getAttribute("configfile").toString();
|
||||
/*if(path.startsWith("file:/home")){
|
||||
if(path.startsWith("file:/home")){
|
||||
path = path.substring(5, path.length()-9);
|
||||
}else{
|
||||
path = path.substring(6, path.length()-9);
|
||||
}*/
|
||||
}
|
||||
//realXmlPath = path+configfile.substring(configfile.indexOf("/"));
|
||||
realXmlPath = configfile;
|
||||
}
|
||||
return realXmlPath;
|
||||
}*/
|
||||
return productId;
|
||||
}
|
||||
|
||||
public static String getProductValueXml(String productId) throws JBOException{
|
||||
@ -581,12 +576,11 @@ public class ProductParamUtil {
|
||||
|
||||
public static List<BusinessObject> getBusinessObject(String realXmlPath,String componentType) throws Exception{
|
||||
List<BusinessObject> exists = new ArrayList<BusinessObject>();
|
||||
BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME);
|
||||
BizObject boLPI = bomLPI.createQuery("ID=:ID").setParameter("ID", realXmlPath).getSingleResult(true);
|
||||
if (boLPI == null) {
|
||||
return exists;
|
||||
}
|
||||
String pData = boLPI.getAttribute("PRODUCT_DATA").getString();
|
||||
//BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME);
|
||||
//BizObject boLPI = bomLPI.createQuery("ID=:ID").setParameter("ID", realXmlPath).getSingleResult(true);
|
||||
//String pData = boLPI.getAttribute("PRODUCT_DATA").getString();
|
||||
//Çл»¶ÁÈ¡»º´æ
|
||||
String pData = ProductConfig.getProductData(realXmlPath);
|
||||
String type = componentType;
|
||||
if("".equals(pData)){
|
||||
}else{
|
||||
@ -607,9 +601,6 @@ public class ProductParamUtil {
|
||||
Map<String,Object> valMap = new HashMap<String,Object>();
|
||||
Set<Entry> vSet = value.entrySet();
|
||||
for(Entry v:vSet){
|
||||
if (v.getKey().toString().equals("DecisionTable")) {
|
||||
System.out.println(v.getKey().toString());
|
||||
}
|
||||
valMap.put(v.getKey().toString(), v.getValue());
|
||||
}
|
||||
bos[i] = BusinessObject.createBusinessObject("jbo.sample.Parameter",valMap);
|
||||
@ -624,9 +615,10 @@ public class ProductParamUtil {
|
||||
|
||||
public static List<BusinessObject> getBusinessObjectWithDecisionTable(String realXmlPath,String componentType) throws Exception{
|
||||
List<BusinessObject> exists = new ArrayList<BusinessObject>();
|
||||
BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME);
|
||||
/*BizObjectManager bomLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME);
|
||||
BizObject boLPI = bomLPI.createQuery("ID=:ID").setParameter("ID", realXmlPath).getSingleResult(true);
|
||||
String pData = boLPI.getAttribute("PRODUCT_DATA").getString();
|
||||
String pData = boLPI.getAttribute("PRODUCT_DATA").getString();*/
|
||||
String pData = ProductConfig.getProductData(realXmlPath);
|
||||
String type = componentType;
|
||||
if("".equals(pData)){
|
||||
}else{
|
||||
|
||||
@ -2,6 +2,8 @@ package com.amarsoft.app.als.prd.config.loader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import jbo.prd.BUSINESS_TYPE;
|
||||
import jbo.prd.PRD_SPECIFIC_LIBRARY;
|
||||
@ -13,23 +15,80 @@ import com.amarsoft.app.base.config.impl.BusinessComponentConfig;
|
||||
import com.amarsoft.app.base.exception.ALSException;
|
||||
import com.amarsoft.app.base.util.DateHelper;
|
||||
import com.amarsoft.app.base.util.XMLHelper;
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.amarsoft.are.lang.StringX;
|
||||
import com.amarsoft.awe.util.ASResultSet;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.amarsoft.dict.als.cache.AbstractCache;
|
||||
//import com.tenwa.httpclient.resources.BigDataPropertiesUtil;
|
||||
import com.tenwa.httpclient.resources.GPSConfigure;
|
||||
import com.tenwa.httpclient.resources.QuartzPropertiesUtil;
|
||||
|
||||
public class ProductConfig extends AbstractCache{
|
||||
|
||||
private static BusinessObjectCache productCache = null;
|
||||
private static Map<String, String> productInfos;
|
||||
private static Map<String, String> holidays;
|
||||
|
||||
public void clear() throws Exception {
|
||||
productCache.clear();
|
||||
productInfos.clear();
|
||||
holidays.clear();
|
||||
}
|
||||
|
||||
public synchronized boolean load(Transaction transaction) throws Exception {
|
||||
//»º´æ²úÆ·
|
||||
ARE.getLog().info("[CACHE] ProductInfo bulid Begin .................");
|
||||
cacheProduct(transaction);
|
||||
ARE.getLog().info("[CACHE] ProductInfo bulid End ...................");
|
||||
ARE.getLog().info("[CACHE] Holiday bulid Begin .................");
|
||||
cacheHoliday(transaction);
|
||||
ARE.getLog().info("[CACHE] Holiday bulid End ...................");
|
||||
/*ARE.getLog().info("[CACHE] BigDataParams bulid Begin .................");
|
||||
BigDataPropertiesUtil.destroy();
|
||||
BigDataPropertiesUtil.load();
|
||||
ARE.getLog().info("[CACHE] BigDataParams bulid End ...................");*/
|
||||
ARE.getLog().info("[CACHE] GPSParams bulid Begin .................");
|
||||
GPSConfigure.destroy();
|
||||
GPSConfigure.load();
|
||||
ARE.getLog().info("[CACHE] GPSParams bulid End ...................");
|
||||
ARE.getLog().info("[CACHE] GPSParams bulid Begin .................");
|
||||
QuartzPropertiesUtil.destroy();
|
||||
QuartzPropertiesUtil.load();
|
||||
ARE.getLog().info("[CACHE] GPSParams bulid End ...................");
|
||||
productCache=new BusinessObjectCache(500);
|
||||
return true;
|
||||
}
|
||||
|
||||
private synchronized void cacheHoliday(Transaction transaction) throws Exception{
|
||||
holidays = new ConcurrentHashMap<String, String>();
|
||||
ASResultSet rs = null;
|
||||
rs = transaction.getASResultSet(new SqlObject("select c_date, otype from bt_holiday"));
|
||||
while(rs.next()) {
|
||||
holidays.put(rs.getString("c_date"), rs.getString("otype"));
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
|
||||
private synchronized void cacheProduct(Transaction transaction) throws Exception{
|
||||
productInfos = new ConcurrentHashMap<String, String>();
|
||||
ASResultSet rs = null;
|
||||
rs = transaction.getASResultSet(new SqlObject("select lpi.product_id,lpi.product_data,bt.typename from lb_product_info lpi left join business_type bt on lpi.product_id = bt.typeno"));
|
||||
while(rs.next()) {
|
||||
productInfos.put(rs.getString("product_id"), rs.getString("product_data"));
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
|
||||
public synchronized static String getProductData(String specificSerialNo) {
|
||||
return productInfos.get(specificSerialNo);
|
||||
}
|
||||
|
||||
public synchronized static String getHoliday(String cdate) {
|
||||
return holidays.get(cdate);
|
||||
}
|
||||
|
||||
/**
|
||||
* »ñÈ¡²úÆ·¶¨Òå
|
||||
* @param productID
|
||||
|
||||
@ -7,13 +7,11 @@ import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.amarsoft.are.ARE;
|
||||
import com.tenwa.httpclient.ResultMessage;
|
||||
|
||||
|
||||
public class GPSConfigure {
|
||||
private static final Map<String, String> attributes;
|
||||
private static Map<String, String> attributes;
|
||||
|
||||
static{
|
||||
public static void load() {
|
||||
attributes = new ConcurrentHashMap<String, String>();
|
||||
Properties prop = new Properties();
|
||||
try {
|
||||
@ -31,7 +29,12 @@ public class GPSConfigure {
|
||||
ARE.getLog().info("init GPSConfigure info success");
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
if(attributes != null) attributes.clear();
|
||||
}
|
||||
|
||||
public static String get(String propName) {
|
||||
if(attributes == null) load();
|
||||
return attributes.get(propName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,9 +9,9 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.amarsoft.are.ARE;
|
||||
|
||||
public class QuartzPropertiesUtil {
|
||||
private static final Map<String, String> attributes;
|
||||
private static Map<String, String> attributes;
|
||||
|
||||
static{
|
||||
public static void load() {
|
||||
attributes = new ConcurrentHashMap<String, String>();
|
||||
Properties prop = new Properties();
|
||||
try {
|
||||
@ -29,7 +29,12 @@ public class QuartzPropertiesUtil {
|
||||
ARE.getLog().info("init QuartzPropertiesUtil info success");
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
if(attributes != null) attributes.clear();
|
||||
}
|
||||
|
||||
public static String get(String propName) {
|
||||
if(attributes == null) load();
|
||||
return attributes.get(propName);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user