Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/dev/one' into dev/one

wangyu 6 gadi atpakaļ
vecāks
revīzija
29736d7967

+ 26 - 5
diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

@@ -11,6 +11,7 @@ import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.OpenedProductsIndex;
 import com.diagbot.entity.wrapper.LantoneProductWrapper;
 import com.diagbot.entity.wrapper.OpendProductWrapper;
+import com.diagbot.enums.AccessTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.exception.CommonErrorCode;
@@ -26,6 +27,7 @@ import com.diagbot.vo.UpdateProductVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.lang.reflect.Array;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -112,9 +114,28 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
     public List<LantoneProductWrapper> opendedProductByCurrentUser() {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
         List<LantoneProductWrapper> list = this.opendedProductByUserId(userId);
+        List<Long> list1 = new ArrayList<>();
+        RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(list1);
+        if (mapRespDTO == null || !"0".equals(mapRespDTO.code)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "获取用户机构信息失败");
+        }
         for (LantoneProductWrapper product : list) {
-            product.setAccessTypeArray(product.getAccessType().split(",|,"));
-            product.setChargeTypeArray(product.getChargeType().split(",|,"));
+            product.setOrganizationName(mapRespDTO.data.get(userId).getOrgName());
+            String[] accessType = product.getAccessType().split(",|,");
+            String[] chargeType = product.getChargeType().split(",|,");
+            String[] accessTypeArray = new String[accessType.length];
+            String[] chargeTypeArray = new String[chargeType.length];
+
+            for (int i = 0; i < accessType.length; i++) {
+                accessTypeArray[i] = AccessTypeEnum.getName(Integer.parseInt(accessType[i]));
+            }
+            for (int i = 0; i < accessType.length; i++) {
+                chargeTypeArray[i] = AccessTypeEnum.getName(Integer.parseInt(chargeType[i]));
+            }
+
+            product.setAccessTypeArray(accessTypeArray);
+            product.setChargeTypeArray(chargeTypeArray);
         }
         return list;
     }
@@ -141,10 +162,10 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         OpenedProductsIndex openedProductsIndex = new OpenedProductsIndex();
         Long curren = oppendedProductVO.getCurrent();
         Long size = oppendedProductVO.getSize();
-        if (curren == null || curren==0) {
+        if (curren == null || curren == 0) {
             oppendedProductVO.setCurrent(1L);
         }
-        if (size == null || curren==0) {
+        if (size == null || curren == 0) {
             oppendedProductVO.setSize(10L);
         }
         BeanUtil.copyProperties(oppendedProductVO, openedProductsIndex);
@@ -164,7 +185,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         for (OpendProductWrapper bean : list) {
             UserOrgDTO uo = dataMap.get(bean.getUserId());
             if (uo != null) {
-                BeanUtil.copyProperties(uo,bean);
+                BeanUtil.copyProperties(uo, bean);
             }
         }
         return list;