ÎļþÃû´Ó Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java ÐÞ¸Ä |
| | |
| | | import com.vci.corba.query.ObjectQueryServicePrx; |
| | | import com.vci.corba.query.data.BtmRefQueryOption; |
| | | import com.vci.corba.query.data.KV; |
| | | import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; |
| | | import com.vci.omd.utils.ObjectTool; |
| | | import com.vci.pagemodel.*; |
| | | import com.vci.starter.web.annotation.Column; |
| | |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.pagemodel.PageHelper; |
| | | import com.vci.starter.web.util.BeanUtil; |
| | | import com.vci.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.starter.web.util.Lcm.Func; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.wrapper.VciQueryWrapperForDO; |
| | | import com.vci.web.properties.WebProperties; |
| | | import com.vci.web.service.*; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | | import com.vci.web.util.WebUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | import org.dom4j.DocumentHelper; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | * @author weidy |
| | | */ |
| | | @Service |
| | | public class WebBoServiceImpl implements WebBoServiceI{ |
| | | |
| | | /** |
| | | * æä¸¾æå¡ |
| | | */ |
| | | @Autowired |
| | | private OsEnumServiceI enumService;//æä¸¾æå¡ |
| | | |
| | | /** |
| | | * 屿§æå¡ |
| | | */ |
| | | @Autowired |
| | | private OsAttributeServiceI attrService;//屿§æå¡ |
| | | public class WebBoServiceImpl implements WebBoServiceI { |
| | | |
| | | /** |
| | | * çå½å¨æçæå¡ |
| | | */ |
| | | @Autowired |
| | | private OsLifeCycleServiceI lifeService;//çå½å¨ææå¡ |
| | | |
| | | /** |
| | | * ç¶æçæå¡ |
| | | */ |
| | | @Autowired |
| | | private OsStatusServiceI statusService; |
| | | |
| | | /** |
| | | * ç¨æ·æ¥è¯¢æå¡ |
| | | */ |
| | | @Autowired |
| | | private SmUserQueryServiceI userQueryService; |
| | | |
| | | /** |
| | | * 龿¥ç±»åæå¡ |
| | | */ |
| | | @Autowired |
| | | private WebLoServiceI loService; |
| | | |
| | | /** |
| | | * é
ç½®ä¿¡æ¯ |
| | | */ |
| | | @Autowired |
| | | private WebProperties webProperties; |
| | | |
| | | /** |
| | | * å¤è¯è¨åç¼ |
| | | */ |
| | | private final String msgCodePrefix = "com.vci.web.boService."; |
| | | |
| | | /** |
| | | * æ¥å¿å¯¹è±¡ |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * å¤è¯è¨åç¼ |
| | | */ |
| | | private final String msgCodePrefix = "com.vci.web.boService."; |
| | | |
| | | /** |
| | | * æä¸¾æå¡ |
| | | */ |
| | | @Resource |
| | | private WebEnumServiceI enumService;//æä¸¾æå¡ |
| | | |
| | | /** |
| | | * çå½å¨æçæå¡ |
| | | */ |
| | | @Resource |
| | | private WebLifeCycleServiceI lifeService;//çå½å¨ææå¡ |
| | | |
| | | /** |
| | | * ç¶æçæå¡ |
| | | */ |
| | | @Resource |
| | | private WebStatusServiceI statusService; |
| | | |
| | | /** |
| | | * ç¨æ·æ¥è¯¢æå¡ |
| | | */ |
| | | @Resource |
| | | private SmUserQueryServiceI userQueryService; |
| | | |
| | | /** |
| | | * é
ç½®ä¿¡æ¯ |
| | | */ |
| | | @Resource |
| | | private WebProperties webProperties; |
| | | |
| | | /** |
| | | * ä¸å¡ç±»åçæå¡ |
| | | */ |
| | | @Autowired |
| | | private OsBtmServiceI btmService; |
| | | @Resource |
| | | private WebBtmServiceI btmService; |
| | | |
| | | /** |
| | | * çæ¬è§åçæå¡ |
| | | */ |
| | | @Autowired |
| | | private OsRevisionRuleServiceI revisionRuleService; |
| | | @Resource |
| | | private WebRevisionRuleServiceI revisionRuleService; |
| | | |
| | | /** |
| | | * å¹³å°è°ç¨å®¢æ·ç«¯ |
| | | */ |
| | | @Autowired |
| | | @Resource |
| | | private PlatformClientUtil platformClientUtil; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public List<BusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap) |
| | | Map<String, String> conditionMap, Map<String, Object> replaceMap) |
| | | throws VciBaseException { |
| | | PageHelper ph = new PageHelper(-1); |
| | | return queryCBOByScheme(queryScheme,conditionMap,replaceMap,ph); |
| | |
| | | */ |
| | | @Override |
| | | public List<BusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap, |
| | | Map<String, String> conditionMap, Map<String, Object> replaceMap, |
| | | PageHelper ph) throws VciBaseException { |
| | | List<String> clauseList = new ArrayList<String>(); |
| | | clauseList.add("*"); |
| | |
| | | * @throws VciBaseException æ¥è¯¢åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public QueryTemplate getQtByName(String name, Map<String, String> replaceMap) throws VciBaseException{ |
| | | public QueryTemplate getQtByName(String name, Map<String, Object> replaceMap) throws VciBaseException{ |
| | | QueryTemplate qt = null; |
| | | try{ |
| | | VciBaseUtil.alertNotNull(name,"æ¥è¯¢æ¨¡æ¿çåç§°"); |
| | |
| | | //å 为ä¹åå¹³å°çTool.replaceQTValues 没æå¤ç ${xxx}ãï¼ ä¸ºäºå¿½ç¥å¤§å°åï¼æä»¬è¿éåç¬å¤ç weidy@2021-3-10 |
| | | //æä»¬è½¬æ¢ä¸ºå°å |
| | | Condition condition = qt.getCondition(); |
| | | Map<String,String> replaceLowMap = new HashMap<>(); |
| | | Map<String,Object> replaceLowMap = new HashMap<>(); |
| | | if(condition !=null && condition.getCIMap()!=null){ |
| | | // Map<String, String> systemVarValueMap = VciSystemVarConstants.getSystemVarValueMap(); |
| | | //转å°å |
| | | if(!CollectionUtils.isEmpty(replaceMap)){ |
| | | replaceMap.forEach((key,value)->{ |
| | | replaceLowMap.put(key.toLowerCase(),value); |
| | |
| | | * @param qt |
| | | * @param replaceLowMap |
| | | */ |
| | | private void recurReplaceCiMap(QueryTemplate qt, Map<String,String> replaceLowMap){ |
| | | private void recurReplaceCiMap(QueryTemplate qt, Map<String,Object> replaceLowMap){ |
| | | //è·³åºéå½ |
| | | if(Func.isEmpty(qt)){ |
| | | return; |
| | |
| | | } |
| | | } |
| | | }else if(replaceLowMap.containsKey(value.toLowerCase())){ |
| | | lInfo.getValue().setOrdinaryValue(replaceLowMap.get(value.toLowerCase())); |
| | | lInfo.getValue().setOrdinaryValue((String) replaceLowMap.get(value.toLowerCase())); |
| | | } |
| | | }else { |
| | | recurReplaceCiMap(lInfo.getValue().getQueryTemplate(),replaceLowMap); |
| | |
| | | */ |
| | | @Override |
| | | public List<BusinessObject> queryCBOByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap, |
| | | Map<String, String> conditionMap, Map<String, Object> replaceMap, |
| | | PageHelper ph, List<String> clauseList) throws VciBaseException { |
| | | QueryTemplate qt = getQtByName(queryScheme,replaceMap); |
| | | return baseQueryCBO(qt,conditionMap,ph,clauseList); |
| | |
| | | */ |
| | | @Override |
| | | public int queryCountByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap) |
| | | Map<String, String> conditionMap, Map<String, Object> replaceMap) |
| | | throws VciBaseException { |
| | | QueryTemplate qt = getQtByName(queryScheme,replaceMap); |
| | | return baseQueryCount(qt,conditionMap); |
| | |
| | | @Override |
| | | public <T> List<T> queryObjectByScheme(String queryScheme, Class<T> c, |
| | | Map<String, String> conditionMap, PageHelper ph, |
| | | Map<String, String> replaceMap) throws VciBaseException { |
| | | Map<String, Object> replaceMap) throws VciBaseException { |
| | | WebUtil.alertNotNull(queryScheme,"æ¥è¯¢æ¹æ¡"); |
| | | //ç´æ¥ä»å¯¹è±¡é廿¥è¯¢ä¸å¡ç±»åçåç§° |
| | | swapConditionMap(c,conditionMap); |
| | |
| | | */ |
| | | @Override |
| | | public DataGrid queryGridByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap) |
| | | Map<String, String> conditionMap, Map<String, Object> replaceMap) |
| | | throws VciBaseException { |
| | | return queryGridByScheme(queryScheme,conditionMap,replaceMap,new PageHelper(-1,true),null); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public DataGrid queryGridByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap, |
| | | Map<String, String> conditionMap, Map<String, Object> replaceMap, |
| | | PageHelper ph) throws VciBaseException { |
| | | return queryGridByScheme(queryScheme,conditionMap,replaceMap,ph,null); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public DataGrid queryGridByScheme(String queryScheme, |
| | | Map<String, String> conditionMap, Map<String, String> replaceMap, |
| | | Map<String, String> conditionMap, Map<String, Object> replaceMap, |
| | | PageHelper ph, List<String> clauseList) throws VciBaseException { |
| | | if(ph == null){ |
| | | ph = new PageHelper(-1,true); |
| | |
| | | */ |
| | | @Override |
| | | public DataGrid queryGridClassByScheme(String queryScheme, Class c, |
| | | Map<String, String> conditionMap,Map<String,String> replaceMap) throws VciBaseException { |
| | | Map<String, String> conditionMap,Map<String,Object> replaceMap) throws VciBaseException { |
| | | return queryGridClassByScheme(queryScheme,c,conditionMap,replaceMap,new PageHelper(-1,true)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public DataGrid queryGridClassByScheme(String queryScheme, Class c, |
| | | Map<String, String> conditionMap, Map<String,String> replaceMap,PageHelper ph) |
| | | Map<String, String> conditionMap, Map<String,Object> replaceMap,PageHelper ph) |
| | | throws VciBaseException { |
| | | if(ph == null){ |
| | | ph = new PageHelper(-1,true); |
| | |
| | | public Map cbo2Map(BusinessObject cbo) throws VciBaseException { |
| | | Map<String,String> map = new HashMap<String, String>(); |
| | | WebUtil.copyValueToMapFromCbos(cbo, map); |
| | | return map; |
| | | //TODOï¼20241128 è¿æ»¤æç©ºkeyå空value |
| | | Map<String, Object> filteredCbo2Map = map.entrySet() |
| | | .stream() |
| | | .filter(entry -> entry.getKey() != null && !entry.getKey().isEmpty() && entry.getValue() != null && !entry.getValue().toString().isEmpty()) |
| | | .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); |
| | | return filteredCbo2Map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * map转为BusinessObject |
| | |
| | | @Override |
| | | public <T> int countByQueryWrapper(VciQueryWrapperForDO queryWrapper, Class<T> doClass) throws VciBaseException { |
| | | VciQueryWrapperForDO queryWrapperForDO = new VciQueryWrapperForDO(null,doClass); |
| | | BeanUtil.convert(queryWrapper,queryWrapperForDO); |
| | | BeanUtilForVCI.convert(queryWrapper,queryWrapperForDO); |
| | | queryWrapperForDO.clearPage(); |
| | | queryWrapperForDO.wrapperSql(); |
| | | String sql= queryWrapperForDO.getSelectFieldSql() + " from " + queryWrapperForDO.getTableName() + " " + queryWrapperForDO.getTableNick() + queryWrapperForDO.getLinkTableSql() ; |