From adaa1d256fb85d2769b2be867b7071a660996c59 Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期四, 04 七月 2024 16:54:38 +0800
Subject: [PATCH] 增加变更所有者、状态跃迁等功能

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java         |   15 +++++++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java |   36 ++++++++++++++++++
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java |   44 +++++++++++++++++++++
 3 files changed, 94 insertions(+), 1 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java
index 63796de..6c19aeb 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebUIDataController.java
@@ -210,4 +210,40 @@
         re.setData(dataMapList);
         return re;
     }
+    /**
+     * 鍙樻洿鎵�鏈夎��
+     * @param btmname 涓氬姟绫诲瀷
+     * @param oid 涓婚敭
+     * @return 鎵ц鐨勭粨鏋�
+     */
+    @PutMapping("/changeBusinessObjectOwner")
+    public BaseResult changeBusinessObjectOwner(String btmname , String oid) {
+        try {
+            return uiDataService.changeBusinessObjectOwner(btmname, oid);
+        } catch (PLException e) {
+            BaseResult<Object> objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
+
+    /**
+     * 鐘舵�佽穬杩�
+     * @param btmname 涓氬姟绫诲瀷
+     * @param oid 涓婚敭
+     * @param releaseStatus 鍙戝竷鐘舵��
+     * @return 鎵ц鐨勭粨鏋�
+     */
+    @PutMapping("/transferBusinessObject")
+    public BaseResult transferBusinessObject(String btmname , String oid, String toStatus, String releaseStatus) {
+        try {
+            return uiDataService.transferBusinessObject(btmname, oid, toStatus, releaseStatus);
+        } catch (PLException e) {
+            BaseResult<Object> objectBaseResult = new BaseResult<>();
+            objectBaseResult.setCode(Integer.parseInt(e.code));
+            objectBaseResult.setMsg(Arrays.toString(e.messages));
+            return objectBaseResult;
+        }
+    }
 }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java
index e5a20a8..dc2df3b 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIDataServiceI.java
@@ -258,4 +258,19 @@
      * @return 鎵ц鐨勭粨鏋�
      */
     BaseResult deleteBusinessObject(String btmname, String oid, int type) throws PLException;
+    /**
+     * 鍙樻洿鎵�鏈夎��
+     * @param btmname 涓氬姟绫诲瀷
+     * @param oid 涓婚敭
+     * @return 鎵ц鐨勭粨鏋�
+     */
+    BaseResult changeBusinessObjectOwner(String btmname, String oid) throws PLException;
+    /**
+     * 鐘舵�佽穬杩�
+     * @param btmname 涓氬姟绫诲瀷
+     * @param oid 涓婚敭
+     * @param releaseStatus 鍙戝竷鐘舵��
+     * @return 鎵ц鐨勭粨鏋�
+     */
+    BaseResult transferBusinessObject(String btmname, String oid, String toStatus, String releaseStatus) throws PLException;
 }
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
index a9e66f5..8f0443d 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java
@@ -2,6 +2,7 @@
 
 import com.vci.client.common.providers.ClientServiceProvider;
 import com.vci.corba.common.PLException;
+import com.vci.corba.framework.data.UserInfo;
 import com.vci.corba.omd.data.*;
 import com.vci.corba.omd.lcm.LifeCycle;
 import com.vci.file.pagemodel.VciFileObjectVO;
@@ -34,6 +35,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.lang.reflect.Method;
@@ -2484,7 +2486,6 @@
                 String revisionoid = Arrays.stream(cbo.hisAttrValList).filter(e -> e.attrName.equals("REVISIONOID")).findFirst().map(e -> e.attrVal).orElse("");
                 cbo.revisionid = revisionoid;
             }
-//            cbo.revisionid = hisAttrValList.
             boolean b = platformClientUtil.getBOFService().deleteBusinessObject(cbo,type);
             if(!b){
                 throw new PLException("500", new String[]{"鏁版嵁鍒犻櫎澶辫触锛侊紒"});
@@ -2492,4 +2493,45 @@
         }
         return BaseResult.success();
     }
+    /**
+     * 鍙樻洿鎵�鏈夎��
+     * @param btmname 涓氬姟绫诲瀷
+     * @param oid 涓婚敭
+     * @return 鎵ц鐨勭粨鏋�
+     */
+    @Override
+    public BaseResult changeBusinessObjectOwner(String btmname, String oid) throws PLException {
+        List<BusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid));
+        BaseResult<Object> objectBaseResult = new BaseResult<>();
+        if(cbos.size() == 0){
+            objectBaseResult.setSuccess(false);
+            throw new PLException("500", new String[]{"娌℃湁鑾峰彇鍒版暟鎹殑涓婚敭"});
+        }
+        UserInfo userInfo = platformClientUtil.getFrameworkService().getUserObjectByUserName(WebUtil.getCurrentUserId());
+        for (BusinessObject cbo : cbos) {
+            platformClientUtil.getBOFService().changeBusinessObjectOwner(cbo,userInfo);
+        }
+        return BaseResult.success();
+    }
+    /**
+     * 鍙樻洿鎵�鏈夎��
+     * @param btmname 涓氬姟绫诲瀷
+     * @param oid 涓婚敭
+     * @param releaseStatus 鍙戝竷鐘舵��
+     * @return 鎵ц鐨勭粨鏋�
+     */
+    @Override
+    @Transactional
+    public BaseResult transferBusinessObject(String btmname, String oid, String toStatus,String releaseStatus) throws PLException {
+        List<BusinessObject> cbos = boService.queryCBO(btmname,WebUtil.getOidQuery(oid));
+        BaseResult<Object> objectBaseResult = new BaseResult<>();
+        if(cbos.size() == 0){
+            objectBaseResult.setSuccess(false);
+            throw new PLException("500", new String[]{"娌℃湁鑾峰彇鍒版暟鎹殑涓婚敭"});
+        }
+        for (BusinessObject cbo : cbos) {
+            platformClientUtil.getBOFService().transferBusinessObjectAndRelease(cbo, toStatus, releaseStatus);
+        }
+        return BaseResult.success();
+    }
 }

--
Gitblit v1.9.3