调整WebBoService中的查询接口。主要是BusinessObject对象属性的赋值,以及BusinessObject和BaseModel之间的属性互相赋值
已修改11个文件
已删除1个文件
已添加5个文件
1236 ■■■■ 文件已修改
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/BaseLinkModelDTO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/BaseLinkModel.java 230 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/revision/service/RevisionModelUtil.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/model/BaseLinkModel.java 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/model/BaseModel.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/ApplicationContextProvider.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-permission/README.md 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/WebBoServiceI.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/util/WebUtil.java 495 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-permission/src/test/java/StrTest.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/pom.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/PlatformWebApplication.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/test/java/BoServiceTest.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/test/java/PartDO.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/test/java/WebUtilTest.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/BaseLinkModelDTO.java
@@ -2,7 +2,7 @@
import com.alibaba.fastjson.annotation.JSONField;
import com.vci.model.BaseLinkModel;
import com.vci.starter.web.model.BaseLinkModel;
import com.vci.starter.web.annotation.Column;
import java.util.ArrayList;
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/BaseLinkModel.java
ÎļþÒÑɾ³ý
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/revision/service/RevisionModelUtil.java
@@ -334,7 +334,7 @@
        linkModel.setCreateTime(currentDate);
        linkModel.setTs(currentDate);
        linkModel.setLastModifier(linkModel.getCreator());
        linkModel.setLastModifytime(currentDate);
        linkModel.setLastModifyTime(currentDate);
    }
    /**
@@ -365,7 +365,7 @@
        Date currentDate = new Date();
        linkModel.setTs(currentDate);
        linkModel.setLastModifier(VciBaseUtil.getCurrentUserId());
        linkModel.setLastModifytime(currentDate);
        linkModel.setLastModifyTime(currentDate);
    }
    /**
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/model/BaseLinkModel.java
@@ -65,7 +65,7 @@
    /**
     * from端业务类型
     */
    @Column(name="f_btmname",length = 30)
    @Column(name="f_btwname",length = 30)
    private String fbtmname;
    /**
@@ -89,7 +89,7 @@
    /**
     * to端业务类型
     */
    @Column(name="t_btmname",length = 30)
    @Column(name="t_btwname",length = 30)
    private String tbtmname;
    /**
@@ -135,12 +135,12 @@
        this.lastModifier = lastModifier;
    }
    public Date getLastModifytime() {
    public Date getLastModifyTime() {
        return lastModifyTime;
    }
    public void setLastModifytime(Date lastModifytime) {
        this.lastModifyTime = lastModifytime;
    public void setLastModifyTime(Date lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }
    public String getFoid() {
@@ -167,6 +167,13 @@
        this.fnameoid = fnameoid;
    }
    public String getFbtmname() {
        return fbtmname;
    }
    public void setFbtmname(String fbtmname) {
        this.fbtmname = fbtmname;
    }
    public String getToid() {
        return toid;
@@ -192,14 +199,6 @@
        this.tnameoid = tnameoid;
    }
    public String getFbtmname() {
        return fbtmname;
    }
    public void setFbtmname(String fbtmname) {
        this.fbtmname = fbtmname;
    }
    public String getTbtmname() {
        return tbtmname;
    }
@@ -216,40 +215,11 @@
        this.ts = ts;
    }
    public Date getLastModifyTime() {
        return lastModifyTime;
    }
    public void setLastModifyTime(Date lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }
    public Map<String, String> getData() {
        return data;
    }
    public void setData(Map<String, String> data) {
        this.data = data;
    }
    @Override
    public String toString() {
        return "BaseLinkModel{" +
                "oid='" + oid + '\'' +
                ", creator='" + creator + '\'' +
                ", createTime=" + createTime +
                ", lastModifier='" + lastModifier + '\'' +
                ", lastModifyTime=" + lastModifyTime +
                ", foid='" + foid + '\'' +
                ", frevisionoid='" + frevisionoid + '\'' +
                ", fnameoid='" + fnameoid + '\'' +
                ", fbtmname='" + fbtmname + '\'' +
                ", toid='" + toid + '\'' +
                ", trevisionoid='" + trevisionoid + '\'' +
                ", tnameoid='" + tnameoid + '\'' +
                ", tbtmname='" + tbtmname + '\'' +
                ", ts=" + ts +
                ", data=" + data +
                '}';
    }
}
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/model/BaseModel.java
@@ -133,7 +133,7 @@
    /**
     * ç”Ÿå‘½å‘¨æœŸçš„编号
     */
    @Transient()
    @Column()
    private String lctId;
    /**
@@ -146,6 +146,7 @@
     * æ—¶é—´æˆ³ï¼Œæ ¼å¼æ˜¯yyyy-MM-dd HH:mm:ss.SSS
     */
    @JsonFormat(pattern = VciDateUtil.DateTimeMillFormat)
    @VciFieldType(VciFieldTypeEnum.VTDateTime)
    private Date ts;
    /**
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/ApplicationContextProvider.java
@@ -1,36 +1,17 @@
package com.vci.starter.web.util;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.autoconfigure.AppAutoConfigure;
import com.vci.starter.web.pagemodel.BaseResult;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * spring的上下文工具,
 * æ³¨æ„springmvc中的controller不应该在这里获取,因为springmvc只应该被前端调用
 * æ²¡æœ‰ä½¿ç”¨springboot的main函数里设置并获取是因为可能会让多个服务合并到一起启动
 * @author weidy
 * @date 2019/10/31 9:02 AM
 * @author dangsn
 * @date 2024/12/3
 */
@RestController
@RequestMapping("/application")
@Component
public class ApplicationContextProvider implements ApplicationContextAware {
    /**
     * æœåŠ¡çš„é…ç½®
     */
    @Autowired
    private AppAutoConfigure appAutoConfigure;
    /**
     * åº”用的上下文
@@ -39,12 +20,12 @@
    /**
     * è®¾ç½®åº”用的上下文
     * @param applicationContext ä¸Šä¸‹æ–‡
     * @param context ä¸Šä¸‹æ–‡
     * @throws BeansException å‡ºçŽ°é”™è¯¯æ—¶éœ€è¦æŠ›å‡ºå¼‚å¸¸ç»™spring容器
     */
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        ApplicationContextProvider.applicationContext = applicationContext;
    public void setApplicationContext(ApplicationContext context) throws BeansException {
        applicationContext = context;
    }
    /**
@@ -75,33 +56,4 @@
    public static <T> T getBean(Class<T> c) throws BeansException{
        return applicationContext.getBean(c);
    }
    /**
     * å…³æœº
     * @return æ‰§è¡Œå®Œæˆ
     */
    @PostMapping("/shutDownContext")
    @VciUnLog
    @VciUnCheckRight
    public BaseResult shutDownContext(String privateKey){
        if( appAutoConfigure.getPrivateTokenKey().equalsIgnoreCase(privateKey)) {
            ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) applicationContext;
            ctx.close();
            return BaseResult.success("关闭服务成功");
        }else{
            return BaseResult.fail("您没有权限关闭服务");
        }
    }
    /**
     * æ£€æŸ¥æ˜¯å¦å®Œæˆ
     * @return è°ƒç”¨å°±è¯´æ˜ŽæˆåŠŸäº†
     */
    @PostMapping("/checkOnline")
    @VciUnLog
    @VciUnCheckRight
    public BaseResult checkOnline(){
        return BaseResult.success("启动完成");
    }
}
Source/plt-web/plt-web-parent/plt-web-permission/README.md
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
DO对象中,枚举和引用使用范例:
####
一、枚举的使用范例:
#####
```java
  @VciUseEnum(value = FrameWorkEnumConstant.SUPPLIER_TYPE,showTextField = "supplierTypeText")
  @Column(columnDefinition = "供应商类型")
  private String supplierType;
  @Column(columnDefinition = "供应商类型显示文本")
  @Transient
  private String supplierTypeText;
```
二、引用使用范例:
#####
```java
  @VciUseRefer(FrameWorkBtmTypeConstant.BD_SUPPLIER_CLASSIFY_BTM_TYPE)
  @Column(columnDefinition = "供应商基本分类",nullable = false)
  private String pkSupplierClassify;
  @Column(columnDefinition = "供应商基本分类显示名称")
  @Transient(referColumn = "pkSupplierClassify.name")
  private String pkSupplierClassifyText;
```
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/WebBoServiceI.java
@@ -67,7 +67,7 @@
     * @param btmType ä¸šåŠ¡ç±»åž‹
     * @param conditionMap æŸ¥è¯¢æ¡ä»¶
     * @param ph åˆ†é¡µå’ŒæŽ’序
     * @param clauseList æŸ¥è¯¢å­—段,参照字段使用xxxx.yy;枚举字段使用xxx_enumCode;生命周期会自动处理为lcStatus_text
     * @param clauseList æŸ¥è¯¢å­—段,参照字段使用field.yy;枚举字段使用enumCode_field;生命周期会自动处理为lcStatus_text。根据字段映射Map的key而来。
     * @return
     * @throws VciBaseException
     */
@@ -137,8 +137,9 @@
     * @return
     * @throws VciBaseException
     */
     List<BusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, Object> replaceMap, PageHelper ph, List<String> clauseList) throws VciBaseException;
     List<BusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, Object> replaceMap,
                                           PageHelper ph, List<String> clauseList) throws VciBaseException;
    /**
     * æŸ¥è¯¢æ•°é‡
     * @param btmType ä¸šåŠ¡ç±»åž‹åç§°
@@ -196,7 +197,7 @@
    /**
     * åªç”¨sql语句查询,这个和queryBySqlForMap区别是,特殊的sql(如包含有函数的)可以用这个方法,但是有sql注入风险
     * @param sql sql语句,查询条件必须自行在其中处理完成
     * @return æ•°æ®æ˜ å°„
     * @return æ•°æ®æ˜ å°„。Map中,key值为大写。
     * @throws VciBaseException æŸ¥è¯¢å‡ºé”™æ´»æŠ›å‡ºå¼‚常
     */
    List<Map> queryByOnlySqlForMap(String sql) throws VciBaseException;
@@ -212,7 +213,7 @@
    <T> List<T> queryByOnlySqlForObj(String sql, Class<T> tClass) throws VciBaseException;
    /**
     * æ ¹æ®sql语句来查询内容,返回Map
     * æ ¹æ®sql语句来查询内容,返回Map。sql不能是select * æˆ–者 select t.*
     * @param sql ä¸ºäº†é˜²æ­¢SQL注入,值必须在sql语句里以:xxx格式,如 id =:idvalue,然后在conditionMap中添加建为idvalue的格式
     * @param conditionMap  æŸ¥è¯¢æ¡ä»¶ï¼Œå¿…须与sql里对应
     * @return map数据
@@ -220,7 +221,7 @@
     */
     List<Map> queryBySqlForMap(String sql, Map<String, String> conditionMap) throws VciBaseException;
    /**
     * æ ¹æ®sql语句来查询内容,返回Map
     * æ ¹æ®sql语句来查询内容,返回Map。sql不能是select * æˆ–者 select t.*
     * @param sql ä¸ºäº†é˜²æ­¢SQL注入,值必须在sql语句里以:xxx格式,如 id =:idvalue,然后在conditionMap中添加建为idvalue的格式
     * @param conditionMap  æŸ¥è¯¢æ¡ä»¶ï¼Œå¿…须与sql里对应
     * @param selectKeys æŸ¥è¯¢çš„字段
@@ -288,7 +289,6 @@
     */
    <T> BatchCBO batchAddSave(List<T> list) throws VciBaseException;
    /**
     * ä¿®æ”¹æ•°æ®ï¼Œå¯ä»¥åœ¨request里设置不持久化
     * @param obj ä¿®æ”¹æ•°æ®å¯¹è±¡
@@ -305,6 +305,14 @@
     */
    <T> BatchCBO batchEditSave(List<T> list) throws VciBaseException;
    /**
     * åˆ é™¤æ•°æ®ï¼Œå¯ä»¥åœ¨request里设置不持久化
     * @param obj åˆ é™¤æ•°æ®å¯¹è±¡
     * @param checkRefered æ˜¯å¦åˆ é™¤å¼•用的数据
     * @return éœ€è¦åˆ›å»ºçš„CBO,CLO;需要修改的CBO,CLO;需要删除的CBO,CLO
     * @throws VciBaseException
     */
    <T> BatchCBO delete(T obj,boolean checkRefered) throws VciBaseException;
    /**
     * åˆ é™¤æ•°æ®ï¼Œå¯ä»¥åœ¨request里设置不持久化
@@ -312,8 +320,16 @@
     * @return éœ€è¦åˆ›å»ºçš„CBO,CLO;需要修改的CBO,CLO;需要删除的CBO,CLO
     * @throws VciBaseException
     */
    <T> BatchCBO delete(T obj,boolean checkRefered) throws VciBaseException;
    <T> BatchCBO delete(T obj) throws VciBaseException;
    /**
     * æ‰¹é‡åˆ é™¤æ•°æ®ï¼Œå¯ä»¥åœ¨request里设置不持久化
     * @param list éœ€è¦åˆ é™¤æ•°æ®å¯¹è±¡åˆ—表
     * @param checkRefered æ˜¯å¦åˆ é™¤å¼•用的数据
     * @return éœ€è¦åˆ›å»ºçš„CBO,CLO;需要修改的CBO,CLO;需要删除的CBO,CLO,checkRefered:[false/true]是否检查被引用,默认不检查
     * @throws VciBaseException
     */
    <T> BatchCBO batchDelete(List<T> list,boolean checkRefered) throws VciBaseException;
    /**
     * æ‰¹é‡åˆ é™¤æ•°æ®ï¼Œå¯ä»¥åœ¨request里设置不持久化
@@ -321,12 +337,8 @@
     * @return éœ€è¦åˆ›å»ºçš„CBO,CLO;需要修改的CBO,CLO;需要删除的CBO,CLO,checkRefered:[false/true]是否检查被引用,默认不检查
     * @throws VciBaseException
     */
    <T> BatchCBO batchDelete(List<T> list,boolean checkRefered) throws VciBaseException;
    <T> BatchCBO batchDelete(List<T> list) throws VciBaseException;
    /**
     * æ ¹æ®æŸ¥è¯¢æ¡ä»¶æ¥åˆ é™¤æ•°æ®
     * @param c åˆ é™¤æ•°æ®å¯¹è±¡æ‰€å±žç±»
@@ -420,7 +432,8 @@
     * @return åˆ—表数据,数据是Map形式的,包含分页信息
     * @throws VciBaseException
     */
     DataGrid queryGridByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, Object> replaceMap, PageHelper ph) throws VciBaseException;
     DataGrid queryGridByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, Object> replaceMap,
                                PageHelper ph) throws VciBaseException;
    
    /**
     * æ ¹æ®æŸ¥è¯¢æ–¹æ¡ˆæ¥æŸ¥è¯¢åˆ—表数据,可以自定义查询的列,包括参照和枚举
@@ -432,8 +445,9 @@
     * @return åˆ—表数据,数据是Map形式的,包含分页信息
     * @throws VciBaseException
     */
     DataGrid queryGridByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, Object> replaceMap, PageHelper ph, List<String> clauseList) throws VciBaseException;
     DataGrid queryGridByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, Object> replaceMap,
                                PageHelper ph, List<String> clauseList) throws VciBaseException;
    /**
     * æŸ¥è¯¢å¯¹è±¡çš„列表数据 
     * @param c æŸ¥è¯¢å¯¹è±¡æ‰€å±žç±»
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/SmUserQueryServiceImpl.java
@@ -959,7 +959,7 @@
                tree.setOid(cbo.oid);
                tree.setText(cbo.id + " " + cbo.name);
                Map<String,String> attributeMap = new HashMap<>();
                WebUtil.copyValueToCboFromMap(cbo,attributeMap);
                WebUtil.copyValueToMapFromBos(cbo,attributeMap);
                tree.setAttributes(attributeMap);
                tree.setLeaf(true);
                treeList.add(tree);
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java
@@ -15,21 +15,23 @@
import com.vci.omd.utils.ObjectTool;
import com.vci.pagemodel.*;
import com.vci.starter.web.annotation.Column;
import com.vci.starter.web.annotation.VciFieldType;
import com.vci.starter.web.constant.QueryOptionConstant;
import com.vci.starter.web.enumpck.BooleanEnum;
import com.vci.starter.web.enumpck.VciFieldTypeEnum;
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.BeanUtilForVCI;
import com.vci.starter.web.util.Lcm.Func;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.starter.web.util.VciDateUtil;
import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
import com.vci.web.properties.WebProperties;
import com.vci.web.service.*;
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.math3.distribution.TDistribution;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.slf4j.Logger;
@@ -553,7 +555,7 @@
                        // ä¸€å±‚参照 a.b
                        // ç¬¬äºŒä¸ªå‚数给空,是此不处从属性中查其参数的业务类型,由下下专用掊中进行处理
                        BtmRefQueryOption refOpt = new BtmRefQueryOption(
                        kvs[0], "", new String[]{kvs[1]}
                                kvs[0], "", new String[]{kvs[1]}
                        );
                        refOpts.add(refOpt);
                    } else if(len == 3){
@@ -563,7 +565,7 @@
                        // ä¸‰å±‚以的参照 a.b.c.d a.b.c.d.e
                        // TODO éœ€è¦æ”¯æŒä¸‰å±‚以及以上的参照
                    }
                }else if(attrName.indexOf("_")>-1
                }else if(attrName.indexOf("_")>-1
                        && !"lcStatus_text".toLowerCase().equalsIgnoreCase(attrName.toLowerCase())){
                    enumAttrName.add(attrName);
                }else{
@@ -596,8 +598,6 @@
            ObjectQueryService.FindBTMObjectsV3Result bos = qtService.findBTMObjectsV3(qt.getId(), OQTool.qtTOXMl(qt).asXML(), refOpts.toArray(new BtmRefQueryOption[refOpts.size()]));
            if (bos != null && bos.count > 0) {
                for (BusinessObject bo : bos.returnValue) {
//                    BusinessObject cbo = new BusinessObject();
//                    cbo = bo;
                    queryEnumText(bo,enumAttrName);
                    allCbos.add(bo);
                }
@@ -700,7 +700,7 @@
            Map<String, OsStatusVO> statusVOMap = statusService.selectAllStatusMap();
            cbos.stream().forEach(cbo->{
                try{
                    ObjectTool.setBOAttributeValue(cbo,"lcStatus_text", statusVOMap.getOrDefault(cbo.lcStatus,new OsStatusVO()).getName());
                    ObjectTool.setBOAttributeValue(cbo,"lcStatus_text".toLowerCase(), statusVOMap.getOrDefault(cbo.lcStatus,new OsStatusVO()).getName());
                }catch(Exception e){
                    logger.error("获取生命周期中状态的显示文本出错",e);
                }
@@ -728,7 +728,7 @@
    @Override
    public void queryEnumText(BusinessObject cbo, LinkObject clo, List<String> enumAttrName) throws VciBaseException{
        if(enumAttrName.size()>0){//查询枚举
            for(String enumAttr:enumAttrName){//格式为   code_field  code是枚举的编码,field是当前业务类型存储枚举值的字段
            for(String enumAttr : enumAttrName){//格式为   code_field  code是枚举的编码,field是当前业务类型存储枚举值的字段
                if(enumAttr.toLowerCase().equals("creator_name")){
                    //创建人的名称
                    String creator = "";
@@ -770,18 +770,20 @@
                    String enumCode = tempArray[0];//枚举编码
                    if (tempArray.length > 1) {
                        //从枚举中获取值
                        String valueFieldName = tempArray[1];
                        String valueFieldName = tempArray[1];//枚举在业务类型上存放的属性
                        String comboxField = "";
                        if(valueFieldName.contains("#")){
                            valueFieldName = tempArray[1].split("#")[0];
                            comboxField = tempArray[1].split("#")[1];
                        }
                        //获取枚举项
                        String enumKey = "";
                        if (cbo != null) {
                            enumKey = ObjectTool.getBOAttributeValue(cbo,valueFieldName);
                        } else if (clo != null) {
                            enumKey = ObjectTool.getLOAttributeValue(clo,valueFieldName);
                        }
                        //获取枚举项的中文显示
                        String enumText = "";
                        if (WebUtil.isNotNull(enumKey)) {
                            enumText = enumService.getValue(enumCode, enumKey);
@@ -994,9 +996,8 @@
     * @throws VciBaseException æŸ¥è¯¢å‡ºé”™ä¼šæŠ›å‡ºå¼‚常
     */
    @Override
    public List<BusinessObject> queryCBOByScheme(String queryScheme,
            Map<String, String> conditionMap, Map<String, Object> replaceMap,
            PageHelper ph, List<String> clauseList) throws VciBaseException {
    public List<BusinessObject> queryCBOByScheme(String queryScheme, 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);
    }
@@ -1155,7 +1156,7 @@
    /**
     * åªç”¨sql语句查询,这个和queryBySqlForMap区别是,特殊的sql(如包含有函数的)可以用这个方法,但是有sql注入风险
     * @param sql sql语句,查询条件必须自行在其中处理完成
     * @return æ•°æ®æ˜ å°„
     * @return æ•°æ®æ˜ å°„。Map中,key值为大写。
     * @throws VciBaseException æŸ¥è¯¢å‡ºé”™æ´»æŠ›å‡ºå¼‚常
     */
    @Override
@@ -1198,13 +1199,32 @@
        List<Map> allData = queryByOnlySqlForMap(sql);
        //需要转换一下cbo的那个属性
        Map<String/**业务类型中的字段*/, String/**属性里的字段**/> fieldNameMap = WebUtil.getFieldNameMap(tClass);
        Map<String, Field> fieldMap = WebUtil.getFieldMapForObject(tClass);
        List<T> dataList = new ArrayList<>();
        if(!CollectionUtils.isEmpty(allData)){
            allData.stream().forEach(data->{
                Map thisData = new HashMap();
                if(!CollectionUtils.isEmpty(data)){
                    data.forEach((key,value)->{
                        thisData.put(fieldNameMap.getOrDefault(((String)key).toLowerCase(Locale.ROOT), (String) key),value);
                        String fieldName = fieldNameMap.getOrDefault(((String)key).toLowerCase(Locale.ROOT), (String) key);
                        String fieldValue = String.valueOf(value);
                        if(fieldMap.containsKey(fieldName)){
                            Field field = fieldMap.get(fieldName);
                            if(field.isAnnotationPresent(VciFieldType.class)){
                                VciFieldType vciFieldType = field.getAnnotation(VciFieldType.class);
                                VciFieldTypeEnum vciFieldTypeEnum = vciFieldType.value();
                                if(VciFieldTypeEnum.VTDateTime.equals(vciFieldTypeEnum) && StringUtils.isNotBlank(fieldValue)){
                                    fieldValue = VciDateUtil.date2Str(VciDateUtil.long2Date(Long.parseLong(fieldValue)), VciDateUtil.DateTimeFormat);
                                }
                                if(VciFieldTypeEnum.VTDate.equals(vciFieldTypeEnum) && StringUtils.isNotBlank(fieldValue)){
                                    fieldValue = VciDateUtil.date2Str(VciDateUtil.long2Date(Long.parseLong(fieldValue)), VciDateUtil.DateFormat);
                                }
                                if(VciFieldTypeEnum.VTTime.equals(vciFieldTypeEnum) && StringUtils.isNotBlank(fieldValue)){
                                    fieldValue = VciDateUtil.date2Str(VciDateUtil.long2Date(Long.parseLong(fieldValue)), VciDateUtil.TimeFormat);
                                }
                            }
                        }
                        thisData.put(fieldName,fieldValue);
                    });
                }
                try {
@@ -1224,7 +1244,7 @@
     * æ ¹æ®sql语句来查询内容,返回Map----sql不能是select * æˆ–者 select t.* 
     * @param sql ä¸ºäº†é˜²æ­¢SQL注入,值必须在sql语句里以:xxx格式,如 id =:idvalue,然后在conditionMap中添加建为idvalue的格式
     * @param conditionMap  æŸ¥è¯¢æ¡ä»¶ï¼Œå¿…须与sql里对应
     * @return ä¸šåŠ¡æ•°æ®çš„æ˜ å°„
     * @return ä¸šåŠ¡æ•°æ®çš„æ˜ å°„ã€‚
     * @throws VciBaseException æŸ¥è¯¢å‡ºé”™ä¼šæŠ›å‡ºå¼‚常
     */
    @Override
@@ -1234,7 +1254,7 @@
    }
    /**
     * å’Œä¸Šä¸ªæ–¹æ³•一样,多传了查询字段 selectKeys
     * å’Œä¸Šä¸ªæ–¹æ³•一样,多传了查询字段 selectKeys。sql不能是select * æˆ–者 select t.*
     * @param sql sql语句
     * @param conditionMap æŸ¥è¯¢æ¡ä»¶
     * @param selectKeys æŸ¥è¯¢çš„字段
@@ -1272,7 +1292,7 @@
            ava = new AttributeValue[0];
        }
        try {
            String[][] results =platformClientUtil.getSqlQueryService(sql, ava);
            String[][] results = platformClientUtil.getSqlQueryService(sql, ava);
            if(results.length>0){
                if(selectKeys==null) {
                    String selectSql = sql.substring(sql.toLowerCase(Locale.ROOT).indexOf("select") + 6, sql.toLowerCase(Locale.ROOT).indexOf(" from")).trim();
@@ -1345,35 +1365,32 @@
        swapConditionMap(c,conditionMap);
        //获取要查询的所有的列
        Map<String,String> allFieldAttrMap = WebUtil.getFieldNameMap(c);
        if(!allFieldAttrMap.containsKey("lctid")){
            allFieldAttrMap.put("lctid","lctid");
        //修改allFieldAttrMap集合中的key的大小写
        List<String> queryAttr = new ArrayList<String>();
        Iterator<String> it = allFieldAttrMap.keySet().iterator();
        while(it.hasNext()){
            queryAttr.add(it.next());
        }
        List<String> queryAttr = new ArrayList<String>();
        Iterator<String> it = allFieldAttrMap.keySet().iterator();
        while(it.hasNext()){
            queryAttr.add(it.next());
        }
        for(String columnName:queryAttr){
            String fieldName = allFieldAttrMap.get(columnName);
            allFieldAttrMap.remove(columnName);
        for(String columnName : queryAttr){
            String fieldName = allFieldAttrMap.get(columnName);
            allFieldAttrMap.remove(columnName);
            allFieldAttrMap.put(columnName.toLowerCase(),fieldName);
        }
        List<T> allObject = new ArrayList<T>();
        List<BusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//执行查询
        List<String> oids = new ArrayList<String>();
        if(allCbos!=null&&allCbos.size()>0){
        List<String> clauseList = new ArrayList<>(allFieldAttrMap.keySet());
        List<BusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c).toLowerCase(), conditionMap, ph, clauseList);
        if(!CollectionUtils.isEmpty(allCbos)){
            for(BusinessObject cbo : allCbos){
                T obj  = null;
                try {
                    obj = c.newInstance();
                    WebUtil.copyValueToObjectFromCbos(cbo, obj,allFieldAttrMap);//为了少去查询一次字段
                } catch (InstantiationException e) {
                    WebUtil.copyValueToObjectFromCbos(cbo, obj, allFieldAttrMap);//为了少去查询一次字段
                } catch (Exception e) {
                    
                } catch (IllegalAccessException e) {
                }
                if(obj !=null){
                    oids.add(cbo.oid);
                    allObject.add(obj);
                }
            }
@@ -1453,6 +1470,7 @@
        swapConditionMap(c,conditionMap);
        //获取要查询的所有的列
        Map<String,String> allFieldAttrMap = WebUtil.getFieldNameMap(c);
        //修改allFieldAttrMap集合中的key的大小写
        List<String> queryAttr = new ArrayList<String>();
        Iterator<String> it = allFieldAttrMap.keySet().iterator();
        while(it.hasNext()){
@@ -1463,18 +1481,18 @@
            allFieldAttrMap.remove(columnName);
            allFieldAttrMap.put(columnName.toLowerCase(),fieldName);
        }
        List<String> clauseList = new ArrayList<>(allFieldAttrMap.keySet());
        List<T> allObject = new ArrayList<T>();
        List<BusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));
        List<BusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, clauseList);
        List<String> oids = new ArrayList<String>();
        if(allCbos!=null&&allCbos.size()>0){
        if(allCbos != null && allCbos.size() > 0){
            for(BusinessObject cbo : allCbos){
                T obj  = null;
                try {
                    obj = c.newInstance();
                    WebUtil.copyValueToObjectFromCbos(cbo, obj,allFieldAttrMap);//为了少去查询一次字段
                } catch (InstantiationException e) {
                } catch (Exception e) {
                    
                } catch (IllegalAccessException e) {
                }
                if(obj !=null){
                    oids.add(cbo.oid);
@@ -1598,12 +1616,10 @@
                    //编辑的时候,TS和OID不能设置.因为平台那接口设置了就会报错
                }else {
                    //需要判断是否默认的属性,如果是默认属性,则使用对象的赋值的方式
                    if (WebUtil.isDefaultField(fieldName) && WebUtil.inArray(new String[]{"id", "name", "description","lcstatus","revisionvalue","versionvalue"}, fieldName.toLowerCase())) {
                        WebUtil.setValueToField(fieldName, cbo, value);
                        ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value);
                    } else {
                        ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value);
                    if (WebUtil.isDefaultField(fieldName.toLowerCase()) && WebUtil.inArray(new String[]{"id", "name", "description","lcstatus","revisionvalue","versionvalue"}, fieldName.toLowerCase())) {
                        WebUtil.setValueToCboField(fieldName, cbo, value);
                    }
                    ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value);
                }
            }
        }
@@ -1752,13 +1768,20 @@
    public <T> BatchCBO delete(T obj) throws VciBaseException {
        return delete(obj,true);
    }
    /**
     * åˆ é™¤æ•°æ®ï¼Œå¯ä»¥åœ¨request里设置不持久化
     * @param obj åˆ é™¤æ•°æ®å¯¹è±¡
     * @param checkRefered æ˜¯å¦åˆ é™¤å¼•用的数据
     * @return éœ€è¦åˆ›å»ºçš„CBO,CLO;需要修改的CBO,CLO;需要删除的CBO,CLO
     * @throws VciBaseException
     */
    @Override
    public <T> BatchCBO delete(T obj,boolean checkRefered) throws VciBaseException{
        List<T> list = new ArrayList<T>();
        list.add(obj);
        return batchDelete(list,checkRefered);
    }
    /**
     * æ‰¹é‡åˆ é™¤æ•°æ®ï¼Œå¯ä»¥åœ¨request里设置不持久化
@@ -1796,9 +1819,8 @@
            String btmType = WebUtil.getBtmTypeByObject(obj.getClass());
            String pkValue = WebUtil.getValueFromFieldForCbo(pkField, obj);
            //所以这里也是直接查询的单个'
            List<BusinessObject> deleteCbos = queryCBO(btmType, getOneQuery(
                    WebUtil.getCboAttrNameFromField(pkField, obj.getClass()), pkValue));
            if(deleteCbos!=null){
            List<BusinessObject> deleteCbos = queryCBO(btmType, getOneQuery(WebUtil.getCboAttrNameFromField(pkField, obj.getClass()), pkValue));
            if(!CollectionUtils.isEmpty(deleteCbos)){
                allDeleteCbos.addAll(deleteCbos);
                if(!btmBos.containsKey(btmType)){
                    btmBos.put(btmType, deleteCbos);
@@ -1894,15 +1916,14 @@
        conditionMap.put(QUERY_FILTER_SECRET,BooleanEnum.FASLE.getValue());//查询的时候不能查询密级
        List<BusinessObject> allCbos = queryCBO(btmType, conditionMap);
        BatchCBO batchCbo = new BatchCBO();
        if(allCbos.size()>0){
        if(!CollectionUtils.isEmpty(allCbos)){
            Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>();
            btmBos.put(btmType, allCbos);
            checkCanDelete(btmBos);
            Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>();
            allDeleteCbos.addAll(allCbos);
            Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(allCbos);
            batchCbo.setDeleteCbos(allDeleteCbos);
        }
        if(allCbos.size()>0 && WebUtil.isPersistence()){
        if(!CollectionUtils.isEmpty(allCbos) && WebUtil.isPersistence()){
            persistenceBatch(batchCbo);
        }
        return batchCbo;
@@ -1931,7 +1952,7 @@
            selectSql += ",btmname ";
        }
        sql = selectSql + fromSql;
        List<BusinessObject> allDelete =queryBySql(sql, conditionMap);
        List<BusinessObject> allDelete = queryBySql(sql, conditionMap);
        if(allDelete.size() == 0){
            return batchCbo;//没有删除任何数据
        }
@@ -2002,7 +2023,6 @@
        return queryGridByBo(btmType,conditionMap,new PageHelper(-1,true));
    }
     /**
     * æ ¹æ®ä¸šåŠ¡ç±»åž‹æ¥æŸ¥è¯¢åˆ—è¡¨æ•°æ®ï¼›å¯ä»¥åœ¨pageHelper中设置是否查询总数
     * @param btmType ä¸šåŠ¡ç±»åž‹åç§°
@@ -2015,7 +2035,7 @@
    public DataGrid queryGridByBo(String btmType,
            Map<String, String> conditionMap, PageHelper ph)
            throws VciBaseException {
        return queryGridByBo(btmType,conditionMap,ph,null);
        return queryGridByBo(btmType,conditionMap,ph,new ArrayList<String>());
    }
    /**
@@ -2037,7 +2057,7 @@
        }
        List<BusinessObject> allCbos = queryCBO(btmType, conditionMap, ph, clauseList);
        DataGrid dg = new DataGrid();
        if(allCbos.size()>0){
        if(!CollectionUtils.isEmpty(allCbos)){
            List<Map> mapList = cbos2Map(allCbos);
            dg.setData(mapList);
            //肯定是当前分页有值,才会有总数
Source/plt-web/plt-web-parent/plt-web-permission/src/main/java/com/vci/web/util/WebUtil.java
@@ -303,7 +303,7 @@
            String jsonString = JSONObject.toJSONStringWithDateFormat(o, VciDateUtil.DateTimeMillFormat, SerializerFeature.WriteDateUseDateFormat);
            if(StringUtils.isNotBlank(jsonString)) {
                JSONObject jsonObject = JSONObject.parseObject(jsonString);
                if(jsonObject!=null){
                if(jsonObject != null){
                    for(String key : jsonObject.keySet()){
                        map.put(key,jsonObject.get(key));
                    }
@@ -324,7 +324,7 @@
            String jsonString = JSONObject.toJSONStringWithDateFormat(o, VciDateUtil.DateTimeMillFormat, SerializerFeature.WriteDateUseDateFormat);
            if(StringUtils.isNotBlank(jsonString)) {
                JSONObject jsonObject = JSONObject.parseObject(jsonString);
                if(jsonObject!=null){
                if(jsonObject != null){
                    for(String key : jsonObject.keySet()){
                        map.put(key,jsonObject.getString(key));
                    }
@@ -457,7 +457,7 @@
            Object key = it.next();
            String newKey = key.toString().toLowerCase();
            Object value = map.get(key);
            if(value !=null){
            if(value != null){
                if(value instanceof String && WebUtil.isNotNull(value.toString())){
                    unNullMap.put(newKey, value);
                }else if(!(value instanceof String)){
@@ -476,7 +476,7 @@
    public static Map<String,String> getReferAttrName(Class c){
        Map<String,String> fieldMap = new HashMap<String, String>();
        List<Field> allField = getAllFieldForObj(c);
        if(allField!=null&&allField.size()>0){
        if(!CollectionUtils.isEmpty(allField)){
            for(Field field : allField){
                if (field.isAnnotationPresent(Transient.class)){
                    //有参照或者枚举
@@ -508,7 +508,7 @@
    public static List<String> getReferBoAttrName(Class c,boolean isNotHasEnum){
        List<String> fieldMap = new ArrayList<String>();
        List<Field> allField = getAllFieldForObj(c);
        if(allField!=null&&allField.size()>0){
        if(!CollectionUtils.isEmpty(allField)){
            for(Field field : allField){
                if (field.isAnnotationPresent(Transient.class)){
                    //有参照或者枚举
@@ -524,18 +524,18 @@
    }
    
    /**
     * èŽ·å–å¯¹è±¡ä¸Žä¸šåŠ¡ç±»åž‹é‡Œçš„å±žæ€§æ˜ å°„
     * @param c å¯¹è±¡æ‰€å±žç±»
     * @return Map<String,String> ä¸šåŠ¡ç±»åž‹çš„å­—æ®µï¼šå¯¹è±¡ä¸Šçš„å±žæ€§
     * èŽ·å–DO对象与业务类型里的属性映射
     * @param c DO对象所属类
     * @return Map<String,String> ä¸šåŠ¡ç±»åž‹çš„å­—æ®µ(key):DO对象上的属性(value)
     */
    public static Map<String/*业务类型中的字段*/,String/*对象上的属性*/> getFieldNameMap(Class c){
    public static Map<String/*业务类型中的字段*/,String/*DO对象上的属性*/> getFieldNameMap(Class c){
        Map<String,String> fieldMap = new HashMap<String, String>();
        List<Field> allField = getAllFieldForObj(c);
        if(allField!=null&&allField.size()>0){
        if(!CollectionUtils.isEmpty(allField)){
            for(Field field : allField){
                if(!field.getName().equals("serialVersionUID")){
                    if(!field.isAnnotationPresent(Transient.class) ){
                        String clientBoAttrName = getCboAttrNameFromField(field,c);
                        String clientBoAttrName = getCboAttrNameFromField(field, c);
                        fieldMap.put(clientBoAttrName, field.getName());
                        if(field.isAnnotationPresent(VciUseEnum.class)){
                            //这个是枚举,需要
@@ -555,10 +555,10 @@
            }
        }
        if(!CollectionUtils.isEmpty(fieldMap)){
            //看看有没有null
            //看看有没有null,过滤掉value为null的
            Map<String,String> fieldMapNotNull = new HashMap<>();
            fieldMap.forEach((key,value)->{
                if(value!=null){
                if(value != null){
                    fieldMapNotNull.put(key,value);
                }
            });
@@ -608,14 +608,14 @@
        if(!isFindColumn){
            //找一下Get方法上..set方法上肯定是不支持的,
            Method getMethod = getGetmethod(c, field);
            if(getMethod!=null && !getMethod.isAnnotationPresent(Transient.class)){
            if(getMethod != null && !getMethod.isAnnotationPresent(Transient.class)){
                if(getMethod.isAnnotationPresent(Column.class)){
                    String name = ((Column)getMethod.getAnnotation(Column.class)).name();
                    if(isNotNull(name)){
                        clientBoAttrName = name.toLowerCase();
                    }
                }
            }else if(getMethod!=null && getMethod.isAnnotationPresent(Transient.class)){
            }else if(getMethod != null && getMethod.isAnnotationPresent(Transient.class)){
                //说明不是持久化的属性,但是从平台中查询出来后可能得需要显示
                String referColumn = ((Transient)field.getAnnotation(Transient.class)).referColumn();
                if(isNotNull(referColumn)){
@@ -623,7 +623,9 @@
                }
            }
        }
        return VciQueryWrapperForDO.BASE_MODEL_COMPATIBILITY_MAP.getOrDefault(clientBoAttrName.toLowerCase(Locale.ROOT),clientBoAttrName);
        //如果版本本次序号的属性,需要从属性的映射中,获取业务类型中的字段名称
        clientBoAttrName = VciQueryWrapperForDO.BASE_MODEL_COMPATIBILITY_MAP.getOrDefault(clientBoAttrName.toLowerCase(Locale.ROOT),clientBoAttrName);
        return clientBoAttrName;
    }
    
    /**
@@ -653,7 +655,7 @@
     */
    public static Field getPkFieldForObj(Class c){
        List<Field> allField = getAllFieldForObj(c);
        if(allField!=null&&allField.size()>0){
        if(!CollectionUtils.isEmpty(allField)){
            for(Field field : allField){
                if(field.isAnnotationPresent(Id.class)){
                    return  field;
@@ -676,7 +678,7 @@
     */
    public static Field getTsField(Class c){
        List<Field> allField = getAllFieldForObj(c);
        if(allField!=null&&allField.size()>0){
        if(!CollectionUtils.isEmpty(allField)){
            for(Field field : allField){
                if(field.getName().equals("ts")){
                    return  field;
@@ -707,10 +709,10 @@
     */
    public static Field getFieldForObject(String fieldName,Class c){
        List<Field> allField = getAllFieldForObj(c);
        if(allField!=null&&allField.size()>0){
        if(!CollectionUtils.isEmpty(allField)){
            for(Field field : allField){
                if(field.getName().toLowerCase().equalsIgnoreCase(fieldName.toLowerCase())){
                    return  field;
                    return field;
                }
            }
        }
@@ -770,8 +772,8 @@
            try {
                PropertyDescriptor pd = new PropertyDescriptor(fieldName, c);
                return pd.getReadMethod();
            } catch (SecurityException e) {
            } catch (IntrospectionException e) {
            } catch (Exception e) {
                //TODO ä¸åšä»»ä½•处理
            }
        }
        return null;
@@ -815,87 +817,80 @@
    public static void setValueForFieldFromCbo(String fieldName,Object obj,String value){
        try{
            Field field = getFieldForObject(fieldName,obj);
            if(field!=null){
                 field.setAccessible(true);
                    Method setMethod = getSetmethod(field.getDeclaringClass(), fieldName);
                    if(setMethod ==null) {
                            logger.error(obj.getClass().getName() + "中属性" + fieldName + "没有setter方法");
                    }
                    Class type = field.getType();
                    //从平台读取到的值不会为null,为空时为"";所以不处理空值
                    if(type.equals(int.class) || type.equals(Integer.class)){
                        int valueObj = getInt(value);
                        if(setMethod !=null) {
                            setMethod.invoke(obj,valueObj);
                        }else{
                            field.set(obj,valueObj);
                        }
                    }else if(type.equals(float.class) || type.equals(Float.class)){
                        float valueObj = getFloat(value);
                        if(setMethod !=null) {
                            setMethod.invoke(obj, valueObj);
                        }else{
                            field.set(obj,valueObj);
                        }
                    }else if(type.equals(long.class) || type.equals(Long.class)){
                        long valueObj = getLong(value);
                        if(setMethod !=null) {
                            setMethod.invoke(obj, valueObj);
                        }else{
                            field.set(obj,valueObj);
                        }
                    }else if(type.equals(Double.class) || type.equals(double.class)){
                        double valueObj = getDouble(value);
                        if(setMethod !=null) {
                            setMethod.invoke(obj, valueObj);
                        }else{
                            field.set(obj,valueObj);
                        }
                        //从平台中查询出来就不用处理精度了,因为平台会自行处理
                    }else if(type.equals(Short.class) || type.equals(short.class)){
                        short valueObject = getShort(value);
                        if(setMethod !=null) {
                            setMethod.invoke(obj, valueObject);
                        }else{
                            field.set(obj,valueObject);
                        }
                    }else if(type.equals(Date.class)){
                        //平台实际存储的都是Timestamp,不论是日期,日期时间,都是。如果仅是时间,需要用字符串来存储。
                        Date d = null;
                        if(StringUtils.isNotBlank(value)){
                                try {
                                if (value.indexOf("-") > -1 && value.indexOf(".") > -1 && value.indexOf(" ") > -1 && value.substring(value.lastIndexOf(".") + 1).length() == 9) {
                                    //2013-4-19.14.5. 45. 734000000  è¿™ç§æ ¼å¼ï¼Œè¿™ä¸ªåœ¨ä½¿ç”¨SQL语句直接查询出时间字段的时候就会显示成这样
                                    String ymd = value.substring(0, value.indexOf("."));
                                    value = value.substring(value.indexOf(".") + 1);
                                    if (value.indexOf(".") > -1) {
                                        String hms = value.substring(0, value.lastIndexOf("."));
                                        String nano = value.substring(value.lastIndexOf(".") + 1).trim();
                                        hms = hms.replace(".", ":").replace(" ", "");
                                        Date tempDate = VciDateUtil.str2Date(ymd + " " + hms, "yyyy-M-d h:m:s");
                                        if (tempDate != null) {
                                            Timestamp ts = Timestamp.valueOf(VciDateUtil.date2Str(tempDate, VciDateUtil.DateTimeFormat) + "." + nano);
                                            d = ts;
                                        }
            if(field != null){
                field.setAccessible(true);
                Method setMethod = getSetmethod(field.getDeclaringClass(), fieldName);
                if(setMethod == null) {
                    logger.error(obj.getClass().getName() + "中属性" + fieldName + "没有setter方法");
                }
                Class type = field.getType();
                //从平台读取到的值不会为null,为空时为"";所以不处理空值
                if(type.equals(int.class) || type.equals(Integer.class)){
                    int valueObj = getInt(value);
                    if(setMethod != null) {
                        setMethod.invoke(obj,valueObj);
                    }else{
                        field.set(obj,valueObj);
                    }
                }else if(type.equals(float.class) || type.equals(Float.class)){
                    float valueObj = getFloat(value);
                    if(setMethod != null) {
                        setMethod.invoke(obj, valueObj);
                    }else{
                        field.set(obj,valueObj);
                    }
                }else if(type.equals(long.class) || type.equals(Long.class)){
                    long valueObj = getLong(value);
                    if(setMethod != null) {
                        setMethod.invoke(obj, valueObj);
                    }else{
                        field.set(obj,valueObj);
                    }
                }else if(type.equals(Double.class) || type.equals(double.class)){
                    double valueObj = getDouble(value);
                    if(setMethod != null) {
                        setMethod.invoke(obj, valueObj);
                    }else{
                        field.set(obj,valueObj);
                    }
                    //从平台中查询出来就不用处理精度了,因为平台会自行处理
                }else if(type.equals(Short.class) || type.equals(short.class)){
                    short valueObject = getShort(value);
                    if(setMethod != null) {
                        setMethod.invoke(obj, valueObject);
                    }else{
                        field.set(obj,valueObject);
                    }
                }else if(type.equals(Date.class)){
                    //平台实际存储的都是Timestamp,不论是日期,日期时间,都是。如果仅是时间,需要用字符串来存储。
                    Date d = null;
                    if(StringUtils.isNotBlank(value)){
                            try {
                            if (value.indexOf("-") > -1 && value.indexOf(".") > -1 && value.indexOf(" ") > -1 && value.substring(value.lastIndexOf(".") + 1).length() == 9) {
                                //2013-4-19.14.5. 45. 734000000  è¿™ç§æ ¼å¼ï¼Œè¿™ä¸ªåœ¨ä½¿ç”¨SQL语句直接查询出时间字段的时候就会显示成这样
                                String ymd = value.substring(0, value.indexOf("."));
                                value = value.substring(value.indexOf(".") + 1);
                                if (value.indexOf(".") > -1) {
                                    String hms = value.substring(0, value.lastIndexOf("."));
                                    String nano = value.substring(value.lastIndexOf(".") + 1).trim();
                                    hms = hms.replace(".", ":").replace(" ", "");
                                    Date tempDate = VciDateUtil.str2Date(ymd + " " + hms, "yyyy-M-d h:m:s");
                                    if (tempDate != null) {
                                        Timestamp ts = Timestamp.valueOf(VciDateUtil.date2Str(tempDate, VciDateUtil.DateTimeFormat) + "." + nano);
                                        d = ts;
                                    }
                                } else if (value.matches("\\d+\\.?\\d*")) {
                                    //还有坑爹的是给的long型的字符串
                                    d = new Date();
                                    d.setTime(getLong(value));
                                } else {
                                    if(field.isAnnotationPresent(VciFieldType.class)) {
                                        VciFieldType vciFieldType = field.getAnnotation(VciFieldType.class);
                                        if(VciFieldTypeEnum.VTDate.equals(vciFieldType.value())) {
                                            d = VciDateUtil.str2Date(value, VciDateUtil.DateFormat);
                                        }else if(VciFieldTypeEnum.VTDateTime.equals(vciFieldType.value())){
                                            d = VciDateUtil.str2Date(value, VciDateUtil.DateTimeFormat);
                                        }else {
                                            if(value.indexOf("-") > -1 &&value.length() == 10 ) {
                                                d = VciDateUtil.str2Date(value, VciDateUtil.DateFormat);
                                            }else {
                                                d = VciDateUtil.str2Date(value, VciDateUtil.DateTimeMillFormat);
                                            }
                                        }
                                }
                            } else if (value.matches("\\d+\\.?\\d*")) {
                                //还有坑爹的是给的long型的字符串
                                d = new Date();
                                d.setTime(getLong(value));
                            } else {
                                if(field.isAnnotationPresent(VciFieldType.class)) {
                                    VciFieldType vciFieldType = field.getAnnotation(VciFieldType.class);
                                    if(VciFieldTypeEnum.VTDate.equals(vciFieldType.value())) {
                                        d = VciDateUtil.str2Date(value, VciDateUtil.DateFormat);
                                    }else if(VciFieldTypeEnum.VTDateTime.equals(vciFieldType.value())){
                                        d = VciDateUtil.str2Date(value, VciDateUtil.DateTimeFormat);
                                    }else {
                                        if(value.indexOf("-") > -1 &&value.length() == 10 ) {
                                            d = VciDateUtil.str2Date(value, VciDateUtil.DateFormat);
@@ -903,34 +898,41 @@
                                            d = VciDateUtil.str2Date(value, VciDateUtil.DateTimeMillFormat);
                                        }
                                    }
                                }
                            } catch (Exception e) {
                                try {
                                    d = VciDateUtil.str2Date(value, VciDateUtil.DateTimeMillFormat);
                                } catch (Exception e1) {
                                }else {
                                    if(value.indexOf("-") > -1 &&value.length() == 10 ) {
                                        d = VciDateUtil.str2Date(value, VciDateUtil.DateFormat);
                                    }else {
                                        d = VciDateUtil.str2Date(value, VciDateUtil.DateTimeMillFormat);
                                    }
                                }
                            }
                        }
                        try {
                            if(d != null ){
                                if(setMethod !=null) {
                                    setMethod.invoke(obj, d);
                                }else{
                                    field.set(obj,d);
                                }
                            }
                        } catch (Exception e) {
                        }
                    }else if(type.equals(String.class)){
                        if(setMethod != null) {
                            setMethod.invoke(obj, value);
                        }else{
                            field.set(obj,value);
                        }
                    }else{
                        logger.info("WebUtil.setValueForFieldForCbo:不支持的类型" + type.toString());
                    }
                        } catch (Exception e) {
                            try {
                                d = VciDateUtil.str2Date(value, VciDateUtil.DateTimeMillFormat);
                            } catch (Exception e1) {
                            }
                        }
                    }
                    try {
                        if(d != null ){
                            if(setMethod !=null) {
                                setMethod.invoke(obj, d);
                            }else{
                                field.set(obj,d);
                            }
                        }
                    } catch (Exception e) {
                    }
                }else if(type.equals(String.class)){
                    if(setMethod != null) {
                        setMethod.invoke(obj, value);
                    }else{
                        field.set(obj,value);
                    }
                }else{
                    logger.info("WebUtil.setValueForFieldForCbo:不支持的类型" + type.toString());
                }
            }
        }catch (Exception e) {
            if(logger.isErrorEnabled()){
@@ -1009,7 +1011,7 @@
                    setMethod.invoke(targetObject, value);
                }else{
                    Field field = getFieldForObject(fieldName, targetObject);
                    if(field !=null){
                    if(field != null){
                        field.setAccessible(true);
                        field.set(targetObject, value);
                    }
@@ -1040,12 +1042,12 @@
        if(isNotNull(fieldName)){
            try {
                Method getMethod = getGetmethod(sourceObject.getClass(), fieldName);
                if(getMethod !=null){
                if(getMethod != null){
                    return getMethod.invoke(sourceObject);
                }else{
                    //说明没有设置getter,比如BO和LO对象这种
                    Field field = getFieldForObject(fieldName, sourceObject);
                    if(field !=null){
                    if(field != null){
                        field.setAccessible(true);
                        return field.get(sourceObject);
                    }
@@ -1089,7 +1091,7 @@
     * @param fieldAttrMap å±žæ€§æ˜ å°„
     */
    public static void copyValueToObjectFromCbos(BusinessObject cbo,Object obj,Map<String,String> fieldAttrMap){
        if(cbo!=null){
        if(cbo != null){
            copyValueToObjectFromBos(cbo,obj,fieldAttrMap);
        }
    }
@@ -1140,7 +1142,7 @@
     * @param bo ä¸šåŠ¡æ•°æ®
     * @param obj å¯¹è±¡
     */
    public static void copyValueToObjectFromBos(com.vci.corba.omd.data.BusinessObject bo ,Object obj){
    public static void copyValueToObjectFromBos(BusinessObject bo ,Object obj){
        copyValueToObjectFromBos(bo,obj,null);
    }
@@ -1150,59 +1152,83 @@
     * @param obj å¯¹è±¡
     * @param fieldAttrMap å±žæ€§æ˜ å°„
     */
    public static void copyValueToObjectFromBos(com.vci.corba.omd.data.BusinessObject bo , Object obj, Map<String,String> fieldAttrMap){
        if(bo!=null && obj != null){
    public static void copyValueToObjectFromBos(BusinessObject bo , Object obj, Map<String,String> fieldAttrMap){
        if(bo != null && obj != null){
            //先把所有的字段映射找到
            if(fieldAttrMap == null){
                fieldAttrMap = getFieldNameMap(obj.getClass());
            }
            com.vci.corba.omd.data.AttributeValue[] newAList = bo.newAttrValList;
            com.vci.corba.omd.data.AttributeValue[] hisAList = bo.hisAttrValList;
            AttributeValue[] newAList = bo.newAttrValList;
            AttributeValue[] hisAList = bo.hisAttrValList;
            //要先把BO对象上的值拷贝过去
            List<Field> boFields = getAllFieldForObj(bo.getClass());
            if(boFields!=null){
                for(Field field :boFields){
                    if(fieldAttrMap.containsKey(field.getName().toLowerCase())){
                        //说明这个就是在BO对象上的
                        Object value = getValueFromField(field.getName(), bo);
                        if(value !=null){
                            setValueForFieldFromCbo(fieldAttrMap.get(field.getName().toLowerCase()), obj, getStringValueFromObject(value));
            if(!CollectionUtils.isEmpty(boFields)){
                for(Field field : boFields){
                    //说明这个就是在BO对象上的
                    Object value = getValueFromField(field.getName(), bo);
                    if(value != null){
                        //BusinessObject和BaseModel中,以下的属性,不相同,需要单独处理
                        switch (field.getName().toLowerCase()){
                            case "revoid":
                                setValueForFieldFromCbo("revisionOid", obj, getStringValueFromObject(value));
                                break;
                            case "btname":
                                setValueForFieldFromCbo("btmName", obj, getStringValueFromObject(value));
                                break;
                            case "islastr":
                                setValueForFieldFromCbo("lastr", obj, getStringValueFromObject(value).equalsIgnoreCase("true")?"1":"0");
                                break;
                            case "isfirstr":
                                setValueForFieldFromCbo("firstr", obj, getStringValueFromObject(value).equalsIgnoreCase("true")?"1":"0");
                                break;
                            case "islastv":
                                setValueForFieldFromCbo("lastv", obj, getStringValueFromObject(value).equalsIgnoreCase("true")?"1":"0");
                                break;
                            case "isfirstv":
                                setValueForFieldFromCbo("firstv", obj, getStringValueFromObject(value).equalsIgnoreCase("true")?"1":"0");
                                break;
                            case "modifytime":
                                setValueForFieldFromCbo("lastmodifytime", obj, getStringValueFromObject(value));
                                break;
                            case "fromversion":
                                setValueForFieldFromCbo("copyFromVersion", obj, getStringValueFromObject(value));
                                break;
                            default:
                                setValueForFieldFromCbo(fieldAttrMap.get(field.getName().toLowerCase()), obj, getStringValueFromObject(value));
                                break;
                        }
                    }
                }
            }
            if(newAList!=null&&newAList.length>0){
            if(newAList != null && newAList.length > 0){
                for(int i = 0 ; i < newAList.length;i++){
                    com.vci.corba.omd.data.AttributeValue av = newAList[i];
                    AttributeValue av = newAList[i];
                    String attrName = av.name.toLowerCase();
                    if(fieldAttrMap.containsKey(attrName)) {
                        String fieldName = fieldAttrMap.get(attrName);
                        setValueForFieldFromCbo(fieldName, obj, av.value);
                    }else{
                        fieldAttrMap.forEach((cboField,fieldName)->{
                            if(fieldName!=null && fieldName.equalsIgnoreCase(attrName) && cboField.contains(".")){
                            if(fieldName != null && fieldName.equalsIgnoreCase(attrName) && cboField.contains(".")){
                                //参照的时候
                                setValueForFieldFromCbo(fieldName, obj, av.value);
                                return;
                            }
                        });
                    }
                }
            }
            if(hisAList!=null&&hisAList.length>0){
            if(hisAList != null && hisAList.length > 0){
                for(int i = 0 ; i < hisAList.length;i++){
                    com.vci.corba.omd.data.AttributeValue av = hisAList[i];
                    AttributeValue av = hisAList[i];
                    String attrName = av.name.toLowerCase();
                    String fieldName = fieldAttrMap.get(attrName);
                    if(fieldName!=null){
                    if(fieldName != null){
                        setValueForFieldFromCbo(fieldName, obj, av.value);
                    }else{
                        fieldAttrMap.forEach((cboField,field)->{
                            if(field!=null && field.equalsIgnoreCase(attrName) && cboField.contains(".")){
                            if(field != null && field.equalsIgnoreCase(attrName) && cboField.contains(".")){
                                //参照的时候
                                setValueForFieldFromCbo(field, obj, av.value);
                                return;
                            }
                        });
                    }
@@ -1217,7 +1243,7 @@
     * @param map map
     */
    public static void copyValueToMapFromCbos(BusinessObject cbo,Map<String,String> map){
        if(cbo!=null){
        if(cbo != null){
            copyValueToMapFromBos(cbo,map);
        }
    }
@@ -1227,21 +1253,21 @@
     * @param bo ä¸šåŠ¡æ•°æ®
     * @param map map
     */
    public static void copyValueToMapFromBos(com.vci.corba.omd.data.BusinessObject bo, Map<String,String> map){
    public static void copyValueToMapFromBos(BusinessObject bo, Map<String,String> map){
        if(bo!=null ){
            //先把所有的字段映射找到
            com.vci.corba.omd.data.AttributeValue[] newAList = bo.newAttrValList;
            com.vci.corba.omd.data.AttributeValue[] hisAList = bo.hisAttrValList;
            if(hisAList!=null&&hisAList.length>0){//
            AttributeValue[] newAList = bo.newAttrValList;
            AttributeValue[] hisAList = bo.hisAttrValList;
            if(hisAList != null && hisAList.length > 0){//
                for(int i = 0 ; i < hisAList.length;i++){
                    com.vci.corba.omd.data.AttributeValue av = hisAList[i];
                    AttributeValue av = hisAList[i];
                    String attrName = av.name.toLowerCase();
                    map.put(attrName, av.value);
                }
            }
            if(newAList!=null&&newAList.length>0){//NEW的优先级高些
            if(newAList != null && newAList.length > 0){//NEW的优先级高些
                for(int i = 0 ; i < newAList.length;i++){
                    com.vci.corba.omd.data.AttributeValue av = newAList[i];
                    AttributeValue av = newAList[i];
                    String attrName = av.name.toLowerCase();
                    map.put(attrName, av.value);
                }
@@ -1358,13 +1384,132 @@
                if(value == null){
                    value = "";
                }
                if(isDefaultField(key)){
                    setValueToField(key, cbo, value);
                if(isDefaultField(key.toLowerCase())){
                    //重新单独处理。因为BaseModel的基础属性和BusinessObject中的有所差异
                    setValueToCboField(key.toLowerCase(), cbo, value);
                }
                ObjectTool.setBOAttributeValue(cbo,key.toLowerCase(), value);
            }
        }
    }
    /**
     * ç»™BusinessObject对象中的属性设置值
     * @param fieldName è¡¨ä¸­å­—段或DO对象中的属性
     * @param bo BusinessObject
     * @param value å±žæ€§å€¼
     */
    public static void setValueToCboField(String fieldName, BusinessObject bo, String value){
        switch (fieldName){
            case "oid":
                bo.oid = value;
                break;
            case "revisionoid":
                bo.revoid = value;
                break;
            case "nameoid":
                bo.nameoid = value;
                break;
            case "btmname":
                bo.btName = value;
                break;
            case "lastr":
                bo.isLastR = "1".equals(value);
                break;
            case "firstr":
                bo.isFirstR = "1".equals(value);
                break;
            case "lastv":
                bo.isLastV = "1".equals(value);
                break;
            case "firstv":
                bo.isFirstV = "1".equals(value);
                break;
            case "creator":
                bo.creator = value;
                break;
            case "createtime":
                try {
                    long createTime = Long.parseLong(value);
                    bo.createTime = createTime;
                } catch (NumberFormatException e) {
                    try {
                        bo.createTime = VciDateUtil.str2Date(value, VciDateUtil.DateTimeFormat).getTime();
                    } catch (Exception e2) {
                        //TODO
                    }
                }
                break;
            case "lastmodifier":
                bo.modifier = value;
                break;
            case "lastmodifytime":
                try {
                    long lastModifyTime = Long.parseLong(value);
                    bo.modifyTime = lastModifyTime;
                } catch (NumberFormatException e) {
                    try {
                        bo.modifyTime = VciDateUtil.str2Date(value, VciDateUtil.DateTimeFormat).getTime();
                    } catch (Exception e2) {
                        //TODO
                    }
                }
                break;
            case "revisionrule":
                bo.revisionRule = value;
                break;
            case "versionrule":
                bo.versionRule = value;
                break;
            case "revisionseq":
                bo.revisionSeq = Short.parseShort(value);
                break;
            case "revisionvalue":
                bo.revisionValue = value;
                break;
            case "versionseq":
                bo.versionSeq = Short.parseShort(value);
                break;
            case "versionvalue":
                bo.versionValue = value;
                break;
            case "lctid":
                bo.lctId = value;
                break;
            case "lcstatus":
                bo.lcStatus = value;
                break;
            case "ts":
                try {
                    long ts = Long.parseLong(value);
                    bo.ts = ts;
                } catch (NumberFormatException e) {
                    try {
                        bo.ts = VciDateUtil.str2Date(value, VciDateUtil.DateTimeFormat).getTime();
                    } catch (Exception e2) {
                        //TODO
                    }
                }
                break;
            case "id":
                bo.id = value;
                break;
            case "name":
                bo.name = value;
                break;
            case "description":
                bo.description = value;
                break;
            case "owner":
                bo.owner = value;
                break;
            case "copyfromversion":
                bo.fromVersion = value;
                break;
            default:
                break;
        }
    }
    /**
     * æ‹·è´é“¾æŽ¥ç±»åž‹çš„值到map
@@ -1380,7 +1525,7 @@
                if(value == null){
                    value = "";
                }
                if(isDefaultField(key)){
                if(isDefaultField(key.toLowerCase())){
                    setValueToField(key, clo, value);
                }else {
                    ObjectTool.setLOAttributeValue(clo,key.toLowerCase(), value);
@@ -1420,7 +1565,7 @@
                if(value==null){
                    value = "";
                }
                if(isDefaultField(fieldName)){
                if(isDefaultField(fieldName.toLowerCase())){
                    setValueToField(fieldName, cbo, value);
                }
                ObjectTool.setBOAttributeValue(cbo,attrName.toLowerCase(), value);
@@ -1435,7 +1580,7 @@
     */
    public static boolean isDefaultField(String fieldNames){
        if(VciQueryWrapperForDO.BASIC_FIELD_MAP.containsKey(fieldNames) || VciQueryWrapperForDO.LIFECYCLE_MANAGE_FIELD_MAP.containsKey(fieldNames)
        || VciQueryWrapperForDO.REVISION_MANAGE_FIELD_MAP.containsKey(fieldNames) ) {
        || VciQueryWrapperForDO.REVISION_MANAGE_FIELD_MAP.containsKey(fieldNames) || VciQueryWrapperForDO.BASE_MODEL_COMPATIBILITY_MAP.containsValue(fieldNames)) {
            return true;
        }
        return false;
@@ -1729,4 +1874,20 @@
        }
        return BusinessObject;
    }
    /**
     * èŽ·å–å¯¹è±¡ä¸­çš„å±žæ€§é›†åˆã€‚
     * @param tClass å¯¹è±¡
     * @return å±žæ€§é›†åˆMap。key:属性名称,value:属性
     */
    public static Map<String, Field> getFieldMapForObject(Class tClass) {
        Map<String, Field> fieldMap = new HashMap<>();
        List<Field> allField = getAllFieldForObj(tClass);
        if(!CollectionUtils.isEmpty(allField)){
            for(Field field : allField){
                fieldMap.put(field.getName(), field);
            }
        }
        return fieldMap;
    }
}
Source/plt-web/plt-web-parent/plt-web-permission/src/test/java/StrTest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
import com.vci.web.util.WebUtil;
import java.util.Locale;
/**
 * @Description
 * @Author dangsn
 * @Date 2024/12/3 17:07
 */
public class StrTest {
    public static void main(String[] args) {
        String sql = "select AA AS AB FROM dual";
        String selectSql = sql.substring(sql.toLowerCase(Locale.ROOT).indexOf("select") + 6, sql.toLowerCase(Locale.ROOT).indexOf(" from")).trim();
        String[] selectKeys = selectSql.split(",");
        for(int j = 0 ; j < selectKeys.length; j ++){
            String field = selectKeys[j];
            if(WebUtil.isNotNull(field)){
                //field = field.toLowerCase();
                //有可能有as的情况  æˆ–者空格 æˆ–者有.的情况
                //必须优先处理as和空格的情况,最后处理.
                if(field.indexOf(" as ")>-1){
                    field = field.substring(field.lastIndexOf(" as ") + 4);
                }else if(field.indexOf(" ")>-1){
                    field =field.substring(field.lastIndexOf(" ") + 1);
                }else if(field.indexOf(".")>-1){
                    field = field.substring(field.lastIndexOf(".") + 1);
                }
                System.out.println(field);
            }
        }
    }
}
Source/plt-web/plt-web-parent/plt-web/pom.xml
@@ -69,6 +69,13 @@
            <artifactId>xstream</artifactId>
            <version>1.4.10</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/PlatformWebApplication.java
@@ -8,6 +8,7 @@
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import javax.annotation.PreDestroy;
import java.io.File;
Source/plt-web/plt-web-parent/plt-web/src/test/java/BoServiceTest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
import com.vci.PlatformWebApplication;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
import com.vci.web.service.WebBoServiceI;
import com.vci.web.util.WebUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @Description
 * @Author dangsn
 * @Date 2024/12/3 17:28
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = PlatformWebApplication.class)//应用的主程序
public class BoServiceTest {
    @Resource
    private WebBoServiceI boServiceI;
    @Test
    public void test(){
        String sql = "select * from platformbtm_part where oid = 'E2ADEE0E-20F9-4CE2-A904-114460B01EB7'";
        //List<BusinessObject> list = boServiceI.queryByOnlySql(sql);
        //List<PartDO> list = boServiceI.queryByOnlySqlForObj(sql, PartDO.class);
        Map<String, String> conditonMap = new HashMap<>();
        conditonMap.put("oid", "E2ADEE0E-20F9-4CE2-A904-114460B01EB7");
        List<PartDO> list = boServiceI.queryObject(PartDO.class, conditonMap);
        //DataGrid dataGrid = boServiceI.queryGridByBo("part", conditonMap);
        //DataGrid dataGrid = boServiceI.queryGridClass(PartDO.class, conditonMap);
        //VciQueryWrapperForDO wrapper = new VciQueryWrapperForDO(conditonMap, PartDO.class);
        //List<PartDO> list = boServiceI.selectByQueryWrapper(wrapper, PartDO.class);
        System.out.println(WebUtil.getJSONStringWithDateFormat(list));
    }
}
Source/plt-web/plt-web-parent/plt-web/src/test/java/PartDO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,76 @@
import com.vci.starter.web.annotation.Transient;
import com.vci.starter.web.annotation.VciBtmType;
import com.vci.starter.web.annotation.VciUseRefer;
import com.vci.starter.web.constant.FrameWorkLcStatusConstant;
import com.vci.starter.web.model.BaseModel;
/**
 * @Description
 * @Author dangsn
 * @Date 2024/12/9 11:05
 */
@VciBtmType(name = "part", lifeCycle = FrameWorkLcStatusConstant.RELEASE_LIFE_CYCLE)
public class PartDO extends BaseModel {
    private String code;
    private int partType;
    private double weight;
    @VciUseRefer("workcontext")
    private String ownProduct;
    private double thickNess;
    @Transient(referColumn = "ownProduct.name")
    private String productName;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public int getPartType() {
        return partType;
    }
    public void setPartType(int partType) {
        this.partType = partType;
    }
    public double getWeight() {
        return weight;
    }
    public void setWeight(double weight) {
        this.weight = weight;
    }
    public String getOwnProduct() {
        return ownProduct;
    }
    public void setOwnProduct(String ownProduct) {
        this.ownProduct = ownProduct;
    }
    public double getThickNess() {
        return thickNess;
    }
    public void setThickNess(double thickNess) {
        this.thickNess = thickNess;
    }
    public String getProductName() {
        return productName;
    }
    public void setProductName(String productName) {
        this.productName = productName;
    }
}
Source/plt-web/plt-web-parent/plt-web/src/test/java/WebUtilTest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
import com.vci.corba.omd.data.BusinessObject;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.util.WebUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @Description
 * @Author dangsn
 * @Date 2024/12/4 10:00
 */
public class WebUtilTest {
    public static void main(String[] args) {
        Map thisData = new HashMap();
        thisData.put("btmname", "dangsn");
        thisData.put("oid","XXXAAA");
        thisData.put("createtime", "2024-12-09 10:10:10");
        try {
            Object o = VciBaseUtil.mapToBean(thisData, PartDO.class);
            System.out.println(WebUtil.getJSONStringWithDateFormat(o));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}