7 Commits dbeb052dac ... 51a796a1fe

Tác giả SHA1 Thông báo Ngày
  zhujinghui 51a796a1fe 修改配置文件, 4 năm trước cách đây
  zhujinghui d317f3c9a2 修改配置文件, 4 năm trước cách đây
  zhujinghui b6e79f5d19 修改配置文件, 4 năm trước cách đây
  zhujinghui b149df7843 修改配置文件, 4 năm trước cách đây
  zhujinghui 692768f501 修改配置文件, 4 năm trước cách đây
  zhujinghui c49f2f975f 修改配置文件, 4 năm trước cách đây
  zhujinghui 511cdc38b8 修改配置文件, 4 năm trước cách đây

+ 31 - 0
fcb-project-application/src/test/java/fcb/project/manager/feignApi/PanoFeignTest.java

@@ -0,0 +1,31 @@
+package fcb.project.manager.feignApi;
+
+import fcb.project.manager.FcbProjectManagerApplication;
+import fcb.project.manager.core.feignInterfaces.PanoFeign;
+import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = FcbProjectManagerApplication.class)
+@AutoConfigureMockMvc
+@RequiredArgsConstructor
+public class PanoFeignTest {
+
+    private final PanoFeign panoFeign;
+
+    /**
+     * 单元测试
+     */
+    @Test
+    @SneakyThrows
+    public void test() {
+
+    }
+
+}

+ 6 - 2
fcb-project-application/src/test/java/fcb/project/manager/feignApi/SceneFeignTest.java

@@ -1,6 +1,8 @@
 package fcb.project.manager.feignApi;
 
 import fcb.project.manager.FcbProjectManagerApplication;
+import fcb.project.manager.core.feignInterfaces.SceneFeign;
+import lombok.RequiredArgsConstructor;
 import lombok.SneakyThrows;
 import org.junit.Assert;
 import org.junit.Test;
@@ -12,8 +14,11 @@ import org.springframework.test.context.junit4.SpringRunner;
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = FcbProjectManagerApplication.class)
 @AutoConfigureMockMvc
+@RequiredArgsConstructor
 public class SceneFeignTest {
 
+    private final SceneFeign sceneFeign;
+
 
     /**
      * 单元测试
@@ -21,8 +26,7 @@ public class SceneFeignTest {
     @Test
     @SneakyThrows
     public void test() {
-        String a = null;
-        Assert.assertTrue("a为空",a != null);
+
     }
 
 }

+ 42 - 35
fcb-project-manager-core/src/main/java/fcb/project/manager/base/service/impl/TmEstateServiceImpl.java

@@ -21,10 +21,13 @@ import fcb.project.manager.base.enums.SysUserRoleEnums;
 import fcb.project.manager.base.param.house.QueryHouseParam;
 import fcb.project.manager.base.service.ITmEstateService;
 import fcb.project.manager.base.service.custom.PanoService;
+import fcb.project.manager.base.utils.BeanUtils;
 import fcb.project.manager.base.utils.DateUtil;
 import fcb.project.manager.base.utils.ExcelUtil;
 import fcb.project.manager.base.vo.house.HouseVO;
 import fcb.project.manager.core.feignInterfaces.SceneFeign;
+import fdage.back.sdk.base.entity.Result;
+import fdage.back.sdk.base.entity.ViewResult;
 import fdage.back.sdk.base.enums.ResultCodeEnum;
 import fdage.back.sdk.base.exception.CommonBaseException;
 import fdage.back.sdk.base.uuid.SnowFlakeUUidUtils;
@@ -33,7 +36,6 @@ import lombok.extern.log4j.Log4j2;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -90,29 +92,29 @@ public class TmEstateServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> impl
         List<Map> dataList = new ArrayList<>();
         int num = 0;
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        List<String> cols = Arrays.asList("序号", "楼盘编码", "楼盘名称", "航拍数量", "景观图数量", "售楼处数量", "样板间数量", "讲房售楼处数量", "讲房样板间数量", "讲房点位数量",
-                "创建时间", "更新时间", "状态", "审核人", "审核时间");
+        List<String> cols = Arrays.asList("楼盘编码", "楼盘名称", "航拍数量", "景观图数量", "售楼处数量", "样板间数量", "讲房售楼处数量", "讲房样板间数量",
+                "讲房点位数量", "创建人","创建时间", "更新时间", "状态", "审核人", "审核时间");
         ExcelUtil excelUtil = new ExcelUtil(cols);
         for(HouseVO house : houseList){
             int index = 0;
             num += 1;
             //楼盘数据
             item = new HashMap(20);
-            item.put(excelUtil.getColeNames().get(index++), String.valueOf(num));
             item.put(excelUtil.getColeNames().get(index++), house.getFcbEstateId());
             item.put(excelUtil.getColeNames().get(index++), house.getEstateName());
             item.put(excelUtil.getColeNames().get(index++), house.getBuilding() != null ? house.getBuilding().toString() : "0");
             item.put(excelUtil.getColeNames().get(index++), house.getGarden() != null ? house.getGarden().toString() : "0");
             item.put(excelUtil.getColeNames().get(index++), house.getSales() != null ? house.getSales().toString() : "0");
             item.put(excelUtil.getColeNames().get(index++), house.getHouse() != null ? house.getHouse().toString() : "0");
-            item.put(excelUtil.getColeNames().get(index++), house.getSaleVideos().toString());
-            item.put(excelUtil.getColeNames().get(index++), house.getHouseVideos().toString());
+            item.put(excelUtil.getColeNames().get(index++), house.getSaleVideos() != null ? house.getSaleVideos().toString() : "0");
+            item.put(excelUtil.getColeNames().get(index++), house.getHouseVideos() != null ? house.getHouseVideos().toString() : "0");
             item.put(excelUtil.getColeNames().get(index++), house.getPoints() != null ? house.getPoints().toString() : "0");
+            item.put(excelUtil.getColeNames().get(index++), house.getCreateByName());
             item.put(excelUtil.getColeNames().get(index++), house.getCreateTime().format(df));
             item.put(excelUtil.getColeNames().get(index++), house.getUpdateTime().format(df));
             item.put(excelUtil.getColeNames().get(index++), HouseStatus.get(house.getStatus()).getDesc());
             item.put(excelUtil.getColeNames().get(index++), house.getAuditorName());
-            item.put(excelUtil.getColeNames().get(index++), house.getAuditTime().format(df));
+            item.put(excelUtil.getColeNames().get(index++), house.getAuditTime() != null ? house.getAuditTime().format(df) : "");
             dataList.add(item);
         }
 
@@ -129,7 +131,9 @@ public class TmEstateServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> impl
         }
 
         excelUtil.writeExcel(dataList, excelUtil.getColeNames().size(), fcbConfig.getExcelLocalPath() + fileName, dateStr);
-        return fcbConfig.getOuterSceneVrHost() + "excel/" + dateStr + ".xls";
+        String url = fcbConfig.getOuterSceneVrHost() + "excel/" + dateStr + ".xls";
+        log.info("导出路径-{}", url);
+        return url;
     }
 
 
@@ -194,36 +198,37 @@ public class TmEstateServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> impl
                 panoSceneWithTypesMap = panoService.listPanoSceneWithTypes(houseVOS.get(i).getHouseId(), token);
 
                 if (MapUtils.isNotEmpty(panoSceneWithTypesMap)) {
-                    List<String> nums = panoSceneWithTypesMap.entrySet().stream().map(e -> e.getValue().toString()).collect(Collectors.toList());
+                    List<String> nums = panoSceneWithTypesMap.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toList());
 
                     sceneRspBean = sceneFeign.listScenesInNums(nums, token);
-                    List<SceneProEntity> scenes = (List<SceneProEntity>) sceneRspBean.getData();
+                    List<Map<String, Object>> scenes = (List<Map<String, Object>>) sceneRspBean.getData();
                     log.info("远程调用listScenesInNums接口,入参-{}", nums);
                     log.info("远程调用listScenesInNums接口,返回数据-{}", new Gson().toJson(scenes));
-                    for (SceneProEntity scene : scenes) {
-                        String videoStr = scene.getVideos();
-                        JSONObject scenejson = new JSONObject();
-                        if(videoStr != null) {
-                            scenejson = JSONObject.parseObject(videoStr);
-                        }
-                        Object data = scenejson.get("data");
-                        if (data != null && data instanceof JSONArray) {
-                            JSONArray jsonArray = (JSONArray) data;
-                            if (jsonArray.size() != 0) {
+                    for (Map<String, Object> scene : scenes) {
+                        if (scene.get("videos") != null) {
+                            String videoStr = scene.get("videos").toString();
+                            log.info("videos-{}", videoStr);
+                            JSONObject scenejson = new JSONObject();
+                            if(videoStr != null) {
+                                scenejson = JSONObject.parseObject(videoStr);
+                            }
+                            Object data = scenejson.get("data");
+                            if (data != null && data instanceof JSONArray && ((JSONArray) data).size() != 0) {
                                 Optional<Map.Entry<String, Object>> existData = panoSceneWithTypesMap.entrySet().stream().filter(m ->
-                                        "sales".equals(m.getKey()) && scene.getNum().equals(m.getValue().toString())).findAny();
+                                        "sales".equals(m.getValue()) && scene.get("num").toString().equals(m.getKey())).findAny();
                                 if (existData.isPresent()) {
-                                    salesVideos += jsonArray.size();
+                                    salesVideos++;
                                 }
                                 existData = panoSceneWithTypesMap.entrySet().stream().filter(m ->
-                                        "room".equals(m.getKey()) && scene.getNum().equals(m.getValue().toString())).findAny();
+                                        "room".equals(m.getValue()) && scene.get("num").toString().equals(m.getKey())).findAny();
                                 if (existData.isPresent()) {
-                                    houseVideos += jsonArray.size();
+                                    houseVideos++;
                                 }
-
                             }
                         }
                     }
+                    log.info("salesVideos-{}", salesVideos);
+                    log.info("houseVideos-{}", houseVideos);
                     houseVOS.get(i).setSaleVideos(salesVideos);
                     houseVOS.get(i).setHouseVideos(houseVideos);
                 }
@@ -232,10 +237,12 @@ public class TmEstateServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> impl
                 if(allSceneNums != null){
                     param.put("sceneNum", allSceneNums.stream().filter(string ->!string.isEmpty()).collect(Collectors.joining(";")));
                     sceneRspBean = sceneFeign.statisticsPoints(param, token);
-
+                    log.info("远程调用statisticsPoints接口,入参-{}", param);
+                    log.info("远程调用statisticsPoints接口,返回数据-{}", new Gson().toJson(sceneRspBean));
                     if(null == sceneRspBean || sceneRspBean.getCode() != 0){
-                        log.info("调用四维看看获取所有场景点位数失败,场景码是:" + param.get("sceneNum"));
+                        log.info("调用四维看看获取所有场景点位数失败,场景码是:{}" + param.get("sceneNum"));
                     }else {
+                        log.info("points-{}", sceneRspBean.getData());
                         houseVOS.get(i).setPoints(sceneRspBean.getData());
                     }
                 }
@@ -329,17 +336,17 @@ public class TmEstateServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> impl
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public String delete(String estateId, ContextTokenBean contextTokenBean, String token) {
+    public ViewResult delete(String estateId, ContextTokenBean contextTokenBean, String token) {
         TmEstate dbEstate = getById(estateId);
         if(null == dbEstate){
-            return "楼盘不存在或已被删除";
+            return ViewResult.error("楼盘不存在或已被删除");
         }
 
         LambdaQueryWrapper<TmHouse> qw = new LambdaQueryWrapper();
         qw.eq(TmHouse::getIsDelete, 0).eq(TmHouse::getEstateId, estateId);
         TmHouse dbHouse = tmHouseService.getOne(qw);
         if (dbHouse == null) {
-            return "楼盘项目不存在或已被删除";
+            return ViewResult.error("楼盘项目不存在或已被删除");
         }
 
         deleteEstateById(estateId);
@@ -349,15 +356,15 @@ public class TmEstateServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> impl
         if(null != dbHouse.getStatus()){
             //除了草稿、未通过状态,其他状态都不能删除
             if(!HouseStatus.canDelete(dbHouse.getStatus())){
-                return "存在待审核/已审核数据,无法删除";
+                return ViewResult.error("存在待审核/已审核数据,无法删除");
             }
         }
 
         if(!isCanDelete(dbHouse, contextTokenBean)){
-            return "暂无删除权限";
+            return ViewResult.error("暂无删除权限");
         }
 
-        int delete = tmHouseService.deleteHouseById(dbHouse.getId());
+        tmHouseService.deleteHouseById(dbHouse.getId());
 
         List<TmHouse> houseList = tmHouseService.getListByEstate(estateId);
         if(!org.apache.commons.collections.CollectionUtils.isEmpty(houseList)){
@@ -366,7 +373,7 @@ public class TmEstateServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> impl
                     List<String> sceneNumList = panoService.getKanKanSceneNums(house.getId() , token);
                     log.info("720返回的房源的[{}]对应的四维场景码列表为:{}" , house.getId() , JSON.toJSONString(sceneNumList));
                     if(!org.apache.commons.collections.CollectionUtils.isEmpty(sceneNumList)){
-                        return "楼盘下存在未解绑的VR项目,请解绑后删除";
+                        return ViewResult.error("楼盘下存在未解绑的VR项目,请解绑后删除");
                     }
                 }
             }
@@ -397,7 +404,7 @@ public class TmEstateServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> impl
         //panoService.noticeVrAuditStatus(houseId , getToken() , 3);
 
         panoService.noticeDeleteVr(dbHouse.getId(), token);
-        return "删除房源成功";
+        return ViewResult.success("删除房源成功");
 
     }
 

+ 89 - 0
fcb-project-manager-core/src/main/java/fcb/project/manager/base/utils/BeanUtils.java

@@ -0,0 +1,89 @@
+package fcb.project.manager.base.utils;
+
+import org.springframework.cglib.beans.BeanMap;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+public class BeanUtils extends org.springframework.beans.BeanUtils {
+    public BeanUtils() {
+    }
+
+    /**
+     * 实例化对象:传入类对类进行实例化对象
+     *
+     * @param clazz 类
+     * @return 对象
+     * @author Lius
+     * @date 2018/10/26 13:49
+     */
+    public static <T> T newInstance(Class<?> clazz) {
+        return (T) instantiateClass(clazz);
+    }
+
+    /**
+     * 实例化对象,传入类名对该类进行实例化对象
+     *
+     * @param clazzStr 类名,传入是必须传入全路径,com...
+     * @return 对象
+     * @author Lius
+     * @date 2018/10/26 13:54
+     */
+    public static <T> T newInstance(String clazzStr) {
+        try {
+            Class<?> clazz = Class.forName(clazzStr);
+            return newInstance(clazz);
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException();
+        }
+    }
+
+    /**
+     * 把对象封装成Map形式
+     *
+     * @param src 需要封装的实体对象
+     * @author Lius
+     * @date 2018/10/26 14:08
+     */
+    public static Map toMap(Object src) {
+        return BeanMap.create(src);
+    }
+
+    /**
+     * 把Map转换成bean对象
+     *
+     * @author Lius
+     * @date 2018/10/26 14:09
+     */
+    public static <T> T toBean(Map<String, Object> beanMap, Class<T> valueType) {
+        // 对象实例化
+        T bean = BeanUtils.newInstance(valueType);
+        PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(valueType);
+        for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+            String properName = propertyDescriptor.getName();
+            // 过滤class属性
+            if ("class".equals(properName)) {
+                continue;
+            }
+            if (beanMap.containsKey(properName)) {
+                Method writeMethod = propertyDescriptor.getWriteMethod();
+                if (null == writeMethod) {
+                    continue;
+                }
+                Object value = beanMap.get(properName);
+                if (!writeMethod.isAccessible()) {
+                    writeMethod.setAccessible(true);
+                }
+                try {
+                    writeMethod.invoke(bean, value);
+                } catch (Throwable throwable) {
+                    throw new RuntimeException("Could not set property '" + properName + " ' to bean" + throwable);
+                }
+            }
+        }
+        return bean;
+    }
+
+
+}

+ 7 - 5
fcb-project-manager-core/src/main/java/fcb/project/manager/core/controller/HouseManagerController.java

@@ -248,15 +248,17 @@ public class HouseManagerController extends BaseController{
         }
 
         excelUtil.writeExcel(dataList, excelUtil.getColeNames().size(), excelLocalPath + fileName, dateStr);
-        return Result.success((Object) (outerSceneVrHost + "excel/" + dateStr + ".xls"));
+        String url = outerSceneVrHost + "excel/" + dateStr + ".xls";
+        log.info("导出路径-{}", url);
+        return Result.success((Object) url);
     }
 
 
     @GetMapping("/exportProjectList")
     @ApiOperation(value = "vr项目导出")
-    public ViewResult<String> exportProjectList(QueryHouseParam queryHouseParam) throws Exception{
+    public Result exportProjectList(QueryHouseParam queryHouseParam) throws Exception{
         String url = tmEstateService.exportProjectList(queryHouseParam, getContextUserInfo(), getToken());
-        return ViewResult.success(url);
+        return Result.success((Object) url);
     }
 
 
@@ -531,8 +533,8 @@ public class HouseManagerController extends BaseController{
     public ViewResult deleteHouse(@ApiParam(name="estateId", value = "楼盘id")
                                       @NotBlank(message = "楼盘id不能为空")
                                       @RequestParam("estateId") String estateId){
-        String msg = tmEstateService.delete(estateId, getContextUserInfo(), getToken());
-        return ViewResult.success(msg);
+        ViewResult rs = tmEstateService.delete(estateId, getContextUserInfo(), getToken());
+        return rs;
     }