From e23023b93f34286f5a807b0b85e9a0619a297ed7 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期二, 21 二月 2023 23:25:34 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

---
 service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListOwnerRepairsCmd.java |   54 ++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 42 insertions(+), 12 deletions(-)

diff --git a/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListOwnerRepairsCmd.java b/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListOwnerRepairsCmd.java
index af92dc0..f9bf01d 100644
--- a/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListOwnerRepairsCmd.java
+++ b/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListOwnerRepairsCmd.java
@@ -6,13 +6,17 @@
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.dto.file.FileRelDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.repair.RepairDto;
 import com.java110.dto.repair.RepairUserDto;
 import com.java110.intf.common.IFileRelInnerServiceSMO;
 import com.java110.intf.community.IRepairInnerServiceSMO;
 import com.java110.intf.community.IRepairUserInnerServiceSMO;
+import com.java110.intf.user.IOwnerV1InnerServiceSMO;
 import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.MappingConstant;
 import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
@@ -38,13 +42,21 @@
     @Autowired
     private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl;
 
+    @Autowired
+    private IOwnerV1InnerServiceSMO ownerV1InnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
         super.validatePageInfo(reqJson);
+        Assert.hasKeyAndValue(reqJson, "communityId", "蹇呭~锛岃濉啓灏忓尯淇℃伅");
+
     }
 
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+
+        hasOwnerId(reqJson);
+
         RepairDto ownerRepairDto = BeanConvertUtil.covertBean(reqJson, RepairDto.class);
 
         if (!StringUtil.isEmpty(ownerRepairDto.getRoomId()) && ownerRepairDto.getRoomId().contains(",")) {
@@ -108,6 +120,18 @@
         context.setResponseEntity(responseEntity);
     }
 
+    private void hasOwnerId(JSONObject reqJson) {
+        if(reqJson.containsKey("ownerId") && !StringUtil.isEmpty(reqJson.getString("ownerId"))){
+            OwnerDto ownerDto = new OwnerDto();
+            ownerDto.setMemberId(reqJson.getString("ownerId"));
+            ownerDto.setCommunityId(reqJson.getString("communityId"));
+            List<OwnerDto> ownerDtos = ownerV1InnerServiceSMOImpl.queryOwners(ownerDto);
+            if(ownerDtos != null && ownerDtos.size() > 0){
+                reqJson.put("tel",ownerDtos.get(0).getLink());
+            }
+        }
+    }
+
     private void refreshRepair(List<RepairDto> ownerRepairs) {
 
         List<String> repairIds = new ArrayList<>();
@@ -137,7 +161,8 @@
         List<PhotoVo> beforePhotos = null;  //缁翠慨鍓嶅浘鐗�
         List<PhotoVo> afterPhotos = null;  //缁翠慨鍚庡浘鐗�
         PhotoVo photoVo = null;
-        String imgUrl = MappingCache.getValue("IMG_PATH");
+        String imgUrl = MappingCache.getValue(MappingConstant.FILE_DOMAIN,"IMG_PATH");
+
         for (RepairDto repairDto : ownerRepairs) {
             FileRelDto fileRelDto = new FileRelDto();
             fileRelDto.setObjId(repairDto.getRepairId());
@@ -148,27 +173,33 @@
             afterPhotos = new ArrayList<>();
             for (FileRelDto tmpFileRelDto : fileRelDtos) {
                 photoVo = new PhotoVo();
-                //photoVo.setUrl("/callComponent/download/getFile/file?fileId=" + tmpFileRelDto.getFileRealName() + "&communityId=" + repairDto.getCommunityId());
-                photoVo.setUrl(imgUrl + tmpFileRelDto.getFileRealName());
+                photoVo.setUrl(tmpFileRelDto.getFileRealName());
                 photoVo.setRelTypeCd(tmpFileRelDto.getRelTypeCd());
                 photoVos.add(photoVo);
                 if (tmpFileRelDto.getRelTypeCd().equals(FileRelDto.REL_TYPE_CD_REPAIR)) {  //缁翠慨鍥剧墖
                     photoVo = new PhotoVo();
-                    // photoVo.setUrl("/callComponent/download/getFile/file?fileId=" + tmpFileRelDto.getFileRealName() + "&communityId=" + repairDto.getCommunityId());
-                    photoVo.setUrl(imgUrl + tmpFileRelDto.getFileRealName());
+                    if(!tmpFileRelDto.getFileRealName().startsWith("http")){
+                        photoVo.setUrl(imgUrl+tmpFileRelDto.getFileRealName());
+                    }else{
+                        photoVo.setUrl(tmpFileRelDto.getFileRealName());
+                    }
                     photoVo.setRelTypeCd(tmpFileRelDto.getRelTypeCd());
                     repairPhotos.add(photoVo);  //缁翠慨鍥剧墖
                 } else if (tmpFileRelDto.getRelTypeCd().equals(FileRelDto.BEFORE_REPAIR_PHOTOS)) {  //缁翠慨鍓嶅浘鐗�
                     photoVo = new PhotoVo();
-                    //photoVo.setUrl("/callComponent/download/getFile/file?fileId=" + tmpFileRelDto.getFileRealName() + "&communityId=" + repairDto.getCommunityId());
-                    photoVo.setUrl(imgUrl + tmpFileRelDto.getFileRealName());
-                    photoVo.setRelTypeCd(tmpFileRelDto.getRelTypeCd());
+                    if(!tmpFileRelDto.getFileRealName().startsWith("http")){
+                        photoVo.setUrl(imgUrl+tmpFileRelDto.getFileRealName());
+                    }else{
+                        photoVo.setUrl(tmpFileRelDto.getFileRealName());
+                    }                    photoVo.setRelTypeCd(tmpFileRelDto.getRelTypeCd());
                     beforePhotos.add(photoVo);  //缁翠慨鍓嶅浘鐗�
                 } else if (tmpFileRelDto.getRelTypeCd().equals(FileRelDto.AFTER_REPAIR_PHOTOS)) {  //缁翠慨鍚庡浘鐗�
                     photoVo = new PhotoVo();
-                    //photoVo.setUrl("/callComponent/download/getFile/file?fileId=" + tmpFileRelDto.getFileRealName() + "&communityId=" + repairDto.getCommunityId());
-                    photoVo.setUrl(imgUrl + tmpFileRelDto.getFileRealName());
-                    photoVo.setRelTypeCd(tmpFileRelDto.getRelTypeCd());
+                    if(!tmpFileRelDto.getFileRealName().startsWith("http")){
+                        photoVo.setUrl(imgUrl+tmpFileRelDto.getFileRealName());
+                    }else{
+                        photoVo.setUrl(tmpFileRelDto.getFileRealName());
+                    }                    photoVo.setRelTypeCd(tmpFileRelDto.getRelTypeCd());
                     afterPhotos.add(photoVo);
                 }
             }
@@ -177,6 +208,5 @@
             repairDto.setBeforePhotos(beforePhotos);
             repairDto.setAfterPhotos(afterPhotos);
         }
-
     }
 }

--
Gitblit v1.8.0