Browse Source

Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

1098226878 4 years ago
parent
commit
95c301090d

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/assetImportLog/AssetImportLogDto.java

@@ -22,6 +22,7 @@ public class AssetImportLogDto extends PageDto implements Serializable {
     public static final String LOG_TYPE_HISTORY_FEE_IMPORT = "2002";
 
     private String logType;
+    private String logTypeName;
     private Long successCount;
     private String logId;
     private String remark;
@@ -112,4 +113,12 @@ public class AssetImportLogDto extends PageDto implements Serializable {
     public void setAssetImportLogDetailDtos(List<AssetImportLogDetailDto> assetImportLogDetailDtos) {
         this.assetImportLogDetailDtos = assetImportLogDetailDtos;
     }
+
+    public String getLogTypeName() {
+        return logTypeName;
+    }
+
+    public void setLogTypeName(String logTypeName) {
+        this.logTypeName = logTypeName;
+    }
 }

+ 2 - 1
java110-db/src/main/resources/mapper/common/AssetImportLogServiceDaoImplMapper.xml

@@ -19,8 +19,9 @@
     <select id="getAssetImportLogInfo" parameterType="Map" resultType="Map">
         select t.log_type,t.log_type logType,t.success_count,t.success_count successCount,t.log_id,t.log_id
         logId,t.remark,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id
-        communityId,t.error_count,t.error_count errorCount,t.create_time createTime
+        communityId,t.error_count,t.error_count errorCount,t.create_time createTime,td.name logTypeName
         from asset_import_log t
+        LEFT JOIN t_dict td on t.log_type = td.status_cd and td.table_name = 'asset_import_log' and td.table_columns = 'log_type'
         where 1 =1
         <if test="logType !=null and logType != ''">
             and t.log_type= #{logType}

+ 10 - 10
java110-db/src/main/resources/mapper/community/InitializeBuildingUnitDaoImplMapper.xml

@@ -6,8 +6,8 @@
 
     <!-- 初始化数据 add by wuxw 2018-07-03 -->
     <delete id="deleteBuildingUnit" parameterType="Map">
-         delete from building_unit t where 1=1
-            and t.floor_id in
+        delete from building_unit where 1=1
+            and floor_id in
             <foreach collection="floorIds" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
@@ -15,22 +15,22 @@
 
     <!-- 初始化数据 add by wuxw 2018-07-03 -->
     <delete id="deletefFloor" parameterType="Map">
-         delete from f_floor t where 1=1
-            and t.community_id = #{communityId}
+        delete from f_floor where 1=1
+            and community_id = #{communityId}
     </delete>
     <!-- 初始化数据 add by wuxw 2018-07-03 -->
     <delete id="deleteBuildingRoom" parameterType="Map">
-         delete from building_room t where 1=1
-            and t.community_id = #{communityId}
+        delete from building_room where 1=1
+            and community_id = #{communityId}
     </delete>
     <!-- 初始化数据 add by wuxw 2018-07-03 -->
     <delete id="deleteParkingArea" parameterType="Map">
-         delete from parking_area t where 1=1
-            and t.community_id = #{communityId}
+        delete from parking_area where 1=1
+            and community_id = #{communityId}
     </delete>
     <!-- 初始化数据 add by wuxw 2018-07-03 -->
     <delete id="deleteParkingSpace" parameterType="Map">
-         delete from parking_space t where 1=1
-            and t.community_id = #{communityId}
+        delete from parking_space where 1=1
+            and community_id = #{communityId}
     </delete>
 </mapper>

+ 2 - 2
java110-db/src/main/resources/mapper/user/InitializeOwnerServiceDaoImplMapper.xml

@@ -6,7 +6,7 @@
 
     <!-- 初始化数据 add by wuxw 2018-07-03 -->
     <delete id="deleteBuildingOwner" parameterType="Map">
-         delete from building_owner t where 1=1
-            and t.community_id = #{communityId}
+        delete from building_owner where 1=1
+            and community_id = #{communityId}
     </delete>
 </mapper>

+ 3 - 5
java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml

@@ -136,9 +136,9 @@
         from owner_car t
         left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
         left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
-        left join building_owner bow on t.owner_id = bow.owner_id and bow.status_cd = '0' and bow.community_id =
-        t.community_id
+        left join building_owner bow on t.owner_id = bow.member_id and bow.status_cd = '0' and bow.community_id = t.community_id
         where 1=1
+
         <if test="statusCd !=null and statusCd != ''">
             and t.status_cd = #{statusCd}
         </if>
@@ -223,7 +223,6 @@
         <if test="valid == 2">
             and t.ps_id= '-1'
         </if>
-        group by t.car_id
         order by t.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
@@ -296,7 +295,7 @@
         from owner_car t
         left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
         left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
-        left join building_owner bow on t.owner_id = bow.owner_id and bow.status_cd = '0' and bow.community_id =
+        left join building_owner bow on t.owner_id = bow.member_id and bow.status_cd = '0' and bow.community_id =
         t.community_id
         where 1=1
         <if test="statusCd !=null and statusCd != ''">
@@ -377,7 +376,6 @@
         <if test="valid == 2">
             and t.ps_id= '-1'
         </if>
-        group by t.car_id
 
     </select>
 

+ 3 - 6
service-api/src/main/java/com/java110/api/listener/owner/QueryOwnerCarsListener.java

@@ -99,16 +99,13 @@ public class QueryOwnerCarsListener extends AbstractServiceApiDataFlowListener {
 
         //查询总记录数
         int total = ownerCarInnerServiceSMOImpl.queryOwnerCarsCount(BeanConvertUtil.covertBean(reqJson, OwnerCarDto.class));
-        int count = 0;
+//        int count = 0;
         List<OwnerCarDto> ownerCarDtoList = null;
 
         if (total > 0) {
             OwnerCarDto ownerCarDto = BeanConvertUtil.covertBean(reqJson, OwnerCarDto.class);
             ownerCarDtoList = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
-            ownerCarDto.setPage(PageDto.DEFAULT_PAGE);
-            //查询所有业主车辆数据
-            List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
-            count = ownerCarDtos.size();
+
             //小区20条时刷房屋和车位信息
             if (row < 20) {
                 freshPs(ownerCarDtoList);
@@ -134,7 +131,7 @@ public class QueryOwnerCarsListener extends AbstractServiceApiDataFlowListener {
             }
         }
 
-        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) row), count, ownerCarDtoList);
+        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) total / (double) row), total, ownerCarDtoList);
         dataFlowContext.setResponseEntity(responseEntity);
     }
 

+ 1 - 2
service-community/src/main/java/com/java110/community/api/InitializeBuildingUnitApi.java

@@ -36,7 +36,6 @@ public class InitializeBuildingUnitApi {
         Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区ID");
         String communityId = reqJson.getString("communityId");
         String userPassword = reqJson.getString("devPassword");
-        initializeBuildingUnitBmoImpl.deleteBuildingUnit(communityId,userId,userPassword);
-        return null;
+        return initializeBuildingUnitBmoImpl.deleteBuildingUnit(communityId,userId,userPassword);
     }
 }

+ 54 - 36
service-community/src/main/java/com/java110/community/bmo/initializeBuildingUnit/impl/IinitializeBuildingUnitBmoImpl.java

@@ -70,52 +70,70 @@ public class IinitializeBuildingUnitBmoImpl implements IinitializeBuildingUnitBm
         floorDto.setCommunityId(communityId);
         List<FloorDto> floorDtos =  floorInnerServiceSMOImpl.queryFloors(floorDto);
         List floors = new ArrayList();
+        int communitys = 0;
         if(null != floorDtos && floorDtos.size() > 0){
             for (FloorDto floorDtotmp: floorDtos){
                 floors.add(floorDtotmp.getFloorId());
             }
+            Map floorIds = new HashMap<String,String []>();
+            floorIds.put("floorIds",floors.toArray(new String[floors.size()]));
+            massage.append( "开始格式化小区数据:" );
+            //单元
+            communitys = initializeBuildingUnitSMOImpl.deleteBuildingUnit(floorIds);
         }
-        Map floorIds = new HashMap<String,String []>();
-        floorIds.put("floorIds",floors.toArray(new String[floors.size()]));
-        //单元
-        int communitys = initializeBuildingUnitSMOImpl.deleteBuildingUnit(floorIds);
 
         if(communitys > 0){
             massage.append("单元初始化成功【"+communitys+"】");
-            Map communityIds = new HashMap<String,String []>();
-            floorIds.put("communityId",communityId);
-            //楼栋
-            int deleteFlag = initializeBuildingUnitSMOImpl.deletefFloor(communityIds);
-            if(deleteFlag > 0){
-                massage.append("楼栋初始化成功【"+deleteFlag+"】");
-            }
-            //房屋
-            int deleteFlagRoot = initializeBuildingUnitSMOImpl.deleteBuildingRoom(communityIds);
-            if(deleteFlagRoot > 0){
-                massage.append("房屋初始化成功【"+deleteFlagRoot+"】");
-            }
-            //业主
-            int deleteFlagOwner = initializeOwnerInnerServiceSMOImpl.deleteBuildingOwner(communityIds);
-            if(deleteFlagOwner > 0){
-                massage.append("业主初始化成功【"+deleteFlagOwner+"】");
-            }
-            //费用
-            int deleteFlagFee = initializePayFeeInnerServiceSMOImpl.deletePayFee(communityIds);
-            if(deleteFlagFee > 0){
-                massage.append("费用初始化成功【"+deleteFlagFee+"】");
-            }
+        }else {
+            massage.append("单元初始化失败");
+        }
 
-            //停车场
-            int deleteFlagArea = initializeBuildingUnitSMOImpl.deleteParkingArea(communityIds);
-            if(deleteFlagArea > 0){
-                massage.append("停车场初始化成功【"+deleteFlagArea+"】");
-            }
-            //停车位
-            int deleteFlagSpace = initializeBuildingUnitSMOImpl.deleteParkingSpace(communityIds);
-            if(deleteFlagSpace > 0){
-                massage.append("停车位初始化成功【"+deleteFlagSpace+"】");
-            }
+        Map communityIds = new HashMap<String,String []>();
+        communityIds.put("communityId",communityId);
+        //楼栋
+        int deleteFlag = initializeBuildingUnitSMOImpl.deletefFloor(communityIds);
+        if(deleteFlag > 0){
+            massage.append("楼栋初始化成功【"+deleteFlag+"】");
+        }else {
+            massage.append("楼栋初始化失败");
         }
+        //房屋
+        int deleteFlagRoot = initializeBuildingUnitSMOImpl.deleteBuildingRoom(communityIds);
+        if(deleteFlagRoot > 0){
+            massage.append("房屋初始化成功【"+deleteFlagRoot+"】");
+        }else {
+            massage.append("房屋初始化失败");
+        }
+        //业主
+        int deleteFlagOwner = initializeOwnerInnerServiceSMOImpl.deleteBuildingOwner(communityIds);
+        if(deleteFlagOwner > 0){
+            massage.append("业主初始化成功【"+deleteFlagOwner+"】");
+        }else {
+            massage.append("业主初始化失败");
+        }
+        //费用
+        int deleteFlagFee = initializePayFeeInnerServiceSMOImpl.deletePayFee(communityIds);
+        if(deleteFlagFee > 0){
+            massage.append("费用初始化成功【"+deleteFlagFee+"】");
+        }else {
+            massage.append("费用初始化失败");
+        }
+
+        //停车场
+        int deleteFlagArea = initializeBuildingUnitSMOImpl.deleteParkingArea(communityIds);
+        if(deleteFlagArea > 0){
+            massage.append("停车场初始化成功【"+deleteFlagArea+"】");
+        }else {
+            massage.append("停车场初始化失败");
+        }
+        //停车位
+        int deleteFlagSpace = initializeBuildingUnitSMOImpl.deleteParkingSpace(communityIds);
+        if(deleteFlagSpace > 0){
+            massage.append("停车位初始化成功【"+deleteFlagSpace+"】");
+        }else {
+            massage.append("停车位初始化失败");
+        }
+
         return ResultVo.createResponseEntity(massage);
     }
 

+ 10 - 10
service-community/src/main/java/com/java110/community/dao/impl/InitializeBuildingUnitDaoImpl.java

@@ -35,9 +35,9 @@ public class InitializeBuildingUnitDaoImpl extends BaseServiceDao implements IIn
 
         int deleteFlag = sqlSessionTemplate.delete("initializeBuildingUnitDaoImpl.deleteBuildingUnit", info);
 
-        if (deleteFlag < 1) {
+/*        if (deleteFlag < 1) {
             throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "building_unit初始化失败:" + JSONObject.toJSONString(info));
-        }
+        }*/
         return deleteFlag;
     }
     /**
@@ -51,9 +51,9 @@ public class InitializeBuildingUnitDaoImpl extends BaseServiceDao implements IIn
 
         int deleteFlag = sqlSessionTemplate.delete("initializeBuildingUnitDaoImpl.deletefFloor", info);
 
-        if (deleteFlag < 1) {
+/*        if (deleteFlag < 1) {
             throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "f_floor初始化失败:" + JSONObject.toJSONString(info));
-        }
+        }*/
         return deleteFlag;
     }
     /**
@@ -67,9 +67,9 @@ public class InitializeBuildingUnitDaoImpl extends BaseServiceDao implements IIn
 
         int deleteFlag = sqlSessionTemplate.delete("initializeBuildingUnitDaoImpl.deleteBuildingRoom", info);
 
-        if (deleteFlag < 1) {
+ /*       if (deleteFlag < 1) {
             throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "f_floor初始化失败:" + JSONObject.toJSONString(info));
-        }
+        }*/
         return deleteFlag;
     }
 
@@ -78,9 +78,9 @@ public class InitializeBuildingUnitDaoImpl extends BaseServiceDao implements IIn
 
         int deleteFlag = sqlSessionTemplate.delete("initializeBuildingUnitDaoImpl.deleteParkingArea", info);
 
-        if (deleteFlag < 1) {
+  /*      if (deleteFlag < 1) {
             throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "f_floor初始化失败:" + JSONObject.toJSONString(info));
-        }
+        }*/
         return deleteFlag;
     }
     /**
@@ -94,9 +94,9 @@ public class InitializeBuildingUnitDaoImpl extends BaseServiceDao implements IIn
 
         int deleteFlag = sqlSessionTemplate.delete("initializeBuildingUnitDaoImpl.deleteParkingSpace", info);
 
-        if (deleteFlag < 1) {
+  /*      if (deleteFlag < 1) {
             throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "f_floor初始化失败:" + JSONObject.toJSONString(info));
-        }
+        }*/
         return deleteFlag;
     }
 

+ 1 - 1
service-community/src/main/java/com/java110/community/smo/impl/InitializeBuildingUnitSMOImpl.java

@@ -17,7 +17,7 @@ import java.util.Map;
  * 用户服务信息管理业务信息实现
  * Created by wuxw on 2017/4/5.
  */
-@Transactional
+@Service
 public class InitializeBuildingUnitSMOImpl extends BaseServiceSMO implements IinitializeBuildingUnitSMO {
 
     private static Logger logger = LoggerFactory.getLogger(InitializeBuildingUnitSMOImpl.class);

+ 1 - 1
service-front/src/main/java/com/java110/front/components/assetImport/AssetImportComponent.java

@@ -27,7 +27,7 @@ public class AssetImportComponent {
     private IAssetExportSMO assetExportSMOImpl;
 
     /**
-     * 添加应用数据
+     * 资产导入方法 将Excel中的数据直接导入到表里
      *
      * @param pd 页面数据封装
      * @return ResponseEntity 对象

+ 600 - 216
service-front/src/main/java/com/java110/front/smo/assetImport/impl/AssetImportSMOImpl.java

@@ -4,12 +4,23 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.component.BaseComponentSMO;
 import com.java110.core.context.IPageData;
+import com.java110.core.smo.ISaveTransactionLogSMO;
 import com.java110.dto.RoomDto;
-import com.java110.entity.assetImport.*;
+import com.java110.dto.assetImportLog.AssetImportLogDto;
+import com.java110.dto.assetImportLogDetail.AssetImportLogDetailDto;
+import com.java110.entity.assetImport.ImportFee;
+import com.java110.entity.assetImport.ImportFloor;
+import com.java110.entity.assetImport.ImportOwner;
+import com.java110.entity.assetImport.ImportParkingSpace;
+import com.java110.entity.assetImport.ImportRoom;
 import com.java110.entity.component.ComponentValidateResult;
 import com.java110.front.smo.assetImport.IAssetImportSMO;
 import com.java110.utils.constant.ServiceConstant;
-import com.java110.utils.util.*;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.CommonUtil;
+import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.ImportExcelUtils;
+import com.java110.utils.util.StringUtil;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.slf4j.Logger;
@@ -42,6 +53,9 @@ public class AssetImportSMOImpl extends BaseComponentSMO implements IAssetImport
     @Autowired
     private RestTemplate restTemplate;
 
+    @Autowired
+    private ISaveTransactionLogSMO saveTransactionLogSMOImpl;
+
     @Override
     public ResponseEntity<String> importExcelData(IPageData pd, MultipartFile uploadFile) throws Exception {
 
@@ -140,24 +154,69 @@ public class AssetImportSMOImpl extends BaseComponentSMO implements IAssetImport
         JSONObject paramIn = null;
         ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK);
         ImportOwner owner = null;
-        for (ImportFee fee : fees) {
-            JSONObject savedFeeConfigInfo = getExistsFee(pd, result, fee);
-            if (savedFeeConfigInfo != null) {
-                continue;
-            }
 
-            //paramIn = new JSONObject();
-            //保存 费用项
+        AssetImportLogDto assetImportLogDto = new AssetImportLogDto();
+        assetImportLogDto.setSuccessCount(0L);
+        assetImportLogDto.setErrorCount(0L);
+        assetImportLogDto.setCommunityId(result.getCommunityId());
+        assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_HISTORY_FEE_IMPORT);
+        List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>();
+        assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos);
+        long successCount = 0L;
+        long failCount = 0L;
+        AssetImportLogDetailDto assetImportLogDetailDto = null;
+        try {
+            for (ImportFee fee : fees) {
+                JSONObject savedFeeConfigInfo = getExistsFee(pd, result, fee);
+                if (savedFeeConfigInfo != null) {
+                    successCount += 1;
+                    assetImportLogDto.setSuccessCount(successCount);
+                    assetImportLogDto.setErrorCount(failCount);
+                    continue;
+                }
+                //paramIn = new JSONObject();
+                //保存 费用项
 
-            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeConfig.saveFeeConfig";
+                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeConfig.saveFeeConfig";
 
-            paramIn = JSONObject.parseObject(JSONObject.toJSONString(fee));
-            paramIn.put("communityId", result.getCommunityId());
+                paramIn = JSONObject.parseObject(JSONObject.toJSONString(fee));
+                paramIn.put("communityId", result.getCommunityId());
 
-            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
-            if (responseEntity.getStatusCode() != HttpStatus.OK) {
-                continue;
+                responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+                if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                    /***************************************导入日志记录****************************************************/
+                    failCount += 1;
+                    assetImportLogDetailDto = new AssetImportLogDetailDto();
+                    assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                    if (Assert.isJsonObject(responseEntity.getBody())) {
+                        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                        assetImportLogDetailDto.setState(paramOut.getString("code"));
+                        assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                    } else {
+                        assetImportLogDetailDto.setState("F");
+                        assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                    }
+                    assetImportLogDetailDto.setObjName(fee.getFeeName());
+                    assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                } else {
+                    JSONObject body = JSONObject.parseObject(responseEntity.getBody());
+                    if (body.containsKey("code") && body.getIntValue("code") != 0) {
+                        assetImportLogDetailDto = new AssetImportLogDetailDto();
+                        assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                        assetImportLogDetailDto.setState(body.getString("code"));
+                        assetImportLogDetailDto.setMessage(body.getString("msg"));
+                        assetImportLogDetailDto.setObjName(fee.getFeeName());
+                        assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                        failCount += 1;
+                    } else {
+                        successCount += 1;
+                    }
+                }
+                assetImportLogDto.setSuccessCount(successCount);
+                assetImportLogDto.setErrorCount(failCount);
             }
+        } finally {
+            saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto);
         }
 
         return responseEntity;
@@ -176,75 +235,190 @@ public class AssetImportSMOImpl extends BaseComponentSMO implements IAssetImport
         JSONObject paramIn = null;
         ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK);
         ImportOwner owner = null;
-        for (ImportParkingSpace parkingSpace : parkingSpaces) {
-            responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK);
-            JSONObject savedParkingAreaInfo = getExistsParkingArea(pd, result, parkingSpace);
-            paramIn = new JSONObject();
-            // 如果不存在,才插入
-            if (savedParkingAreaInfo == null) {
-                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingArea.saveParkingArea";
+        AssetImportLogDto assetImportLogDto = new AssetImportLogDto();
+        assetImportLogDto.setSuccessCount(0L);
+        assetImportLogDto.setErrorCount(0L);
+        assetImportLogDto.setCommunityId(result.getCommunityId());
+        assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_HISTORY_FEE_IMPORT);
+        List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>();
+        assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos);
+        long successCount = 0L;
+        long failCount = 0L;
+        AssetImportLogDetailDto assetImportLogDetailDto = null;
+        try {
+            for (ImportParkingSpace parkingSpace : parkingSpaces) {
+                responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK);
+                JSONObject savedParkingAreaInfo = getExistsParkingArea(pd, result, parkingSpace);
+                paramIn = new JSONObject();
+                // 如果不存在,才插入
+                if (savedParkingAreaInfo == null) {
+                    apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingArea.saveParkingArea";
+                    paramIn.put("communityId", result.getCommunityId());
+                    paramIn.put("typeCd", parkingSpace.getTypeCd());
+                    paramIn.put("num", parkingSpace.getPaNum());
+
+                    responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+                    savedParkingAreaInfo = getExistsParkingArea(pd, result, parkingSpace);
+                }
+                if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
+                    failCount += 1;
+                    assetImportLogDetailDto = new AssetImportLogDetailDto();
+                    assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                    if (Assert.isJsonObject(responseEntity.getBody())) {
+                        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                        assetImportLogDetailDto.setState(paramOut.getString("code"));
+                        assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                    } else {
+                        assetImportLogDetailDto.setState("F");
+                        assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                    }
+                    assetImportLogDetailDto.setObjName(parkingSpace.getPaNum());
+                    assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                    assetImportLogDto.setSuccessCount(successCount);
+                    assetImportLogDto.setErrorCount(failCount);
+                    continue;
+                } else {
+                    JSONObject body = JSONObject.parseObject(responseEntity.getBody());
+                    if (body.containsKey("code") && body.getIntValue("code") != 0) {
+                        assetImportLogDetailDto = new AssetImportLogDetailDto();
+                        assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                        assetImportLogDetailDto.setState(body.getString("code"));
+                        assetImportLogDetailDto.setMessage(body.getString("msg"));
+                        assetImportLogDetailDto.setObjName(parkingSpace.getPaNum());
+                        assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                        failCount += 1;
+                        assetImportLogDto.setSuccessCount(successCount);
+                        assetImportLogDto.setErrorCount(failCount);
+                        continue;
+                    } else {
+                        successCount += 1;
+                    }
+                    assetImportLogDto.setSuccessCount(successCount);
+                    assetImportLogDto.setErrorCount(failCount);
+                }
+
+                JSONObject savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace);
+                if (savedParkingSpaceInfo != null) {
+                    continue;
+                }
+
+                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.saveParkingSpace";
+
+                paramIn.put("paId", savedParkingAreaInfo.getString("paId"));
                 paramIn.put("communityId", result.getCommunityId());
+                paramIn.put("userId", result.getUserId());
+                paramIn.put("num", parkingSpace.getPsNum());
+                paramIn.put("area", parkingSpace.getArea());
                 paramIn.put("typeCd", parkingSpace.getTypeCd());
-                paramIn.put("num", parkingSpace.getPaNum());
+                paramIn.put("parkingType", "1");
 
                 responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
-                savedParkingAreaInfo = getExistsParkingArea(pd, result, parkingSpace);
-            }
-            if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
-                continue;
-            }
+                if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                    assetImportLogDetailDto = new AssetImportLogDetailDto();
+                    assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                    if (Assert.isJsonObject(responseEntity.getBody())) {
+                        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                        assetImportLogDetailDto.setState(paramOut.getString("code"));
+                        assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                    } else {
+                        assetImportLogDetailDto.setState("F");
+                        assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                    }
+                    assetImportLogDetailDto.setObjName(parkingSpace.getPaNum());
+                    assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                    failCount +=1;
+                    successCount = successCount >0? successCount -1:successCount;
+                    assetImportLogDto.setSuccessCount(successCount);
+                    assetImportLogDto.setErrorCount(failCount);
+                    continue;
+                } else {
+                    JSONObject body = JSONObject.parseObject(responseEntity.getBody());
+                    if (body.containsKey("code") && body.getIntValue("code") != 0) {
+                        assetImportLogDetailDto = new AssetImportLogDetailDto();
+                        assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                        assetImportLogDetailDto.setState(body.getString("code"));
+                        assetImportLogDetailDto.setMessage(body.getString("msg"));
+                        assetImportLogDetailDto.setObjName(parkingSpace.getPaNum());
+                        assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                        assetImportLogDto.setSuccessCount(successCount);
+                        assetImportLogDto.setErrorCount(failCount);
+                        failCount +=1;
+                        successCount = successCount >0? successCount -1:successCount;
+                        assetImportLogDto.setSuccessCount(successCount);
+                        assetImportLogDto.setErrorCount(failCount);
+                        continue;
+                    }
+                }
 
-            JSONObject savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace);
-            if (savedParkingSpaceInfo != null) {
-                continue;
-            }
+                savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace);
+                if (savedParkingSpaceInfo == null) {
+                    continue;
+                }
 
-            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.saveParkingSpace";
+                //是否有业主信息
+                if (parkingSpace.getImportOwner() == null) {
+                    continue;
+                }
 
-            paramIn.put("paId", savedParkingAreaInfo.getString("paId"));
-            paramIn.put("communityId", result.getCommunityId());
-            paramIn.put("userId", result.getUserId());
-            paramIn.put("num", parkingSpace.getPsNum());
-            paramIn.put("area", parkingSpace.getArea());
-            paramIn.put("typeCd", parkingSpace.getTypeCd());
-            paramIn.put("parkingType", "1");
+                paramIn.clear();
 
-            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
-            if (responseEntity.getStatusCode() != HttpStatus.OK) {
-                continue;
-            }
+                paramIn.put("communityId", result.getCommunityId());
+                paramIn.put("ownerId", parkingSpace.getImportOwner().getOwnerId());
+                paramIn.put("userId", result.getUserId());
+                paramIn.put("carNum", parkingSpace.getCarNum());
+                paramIn.put("carBrand", parkingSpace.getCarBrand());
+                paramIn.put("carType", parkingSpace.getCarType());
+                paramIn.put("carColor", parkingSpace.getCarColor());
+                paramIn.put("psId", savedParkingSpaceInfo.getString("psId"));
+                paramIn.put("storeId", result.getStoreId());
+                paramIn.put("sellOrHire", parkingSpace.getSellOrHire());
+                paramIn.put("startTime", parkingSpace.getStartTime());
+                paramIn.put("endTime", parkingSpace.getEndTime());
 
-            savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace);
-            if (savedParkingSpaceInfo == null) {
-                continue;
-            }
+                if ("H".equals(parkingSpace.getSellOrHire())) {
+                    paramIn.put("cycles", "0");
+                }
 
-            //是否有业主信息
-            if (parkingSpace.getImportOwner() == null) {
-                continue;
-            }
+                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.sellParkingSpace";
+                responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
 
-            paramIn.clear();
-
-            paramIn.put("communityId", result.getCommunityId());
-            paramIn.put("ownerId", parkingSpace.getImportOwner().getOwnerId());
-            paramIn.put("userId", result.getUserId());
-            paramIn.put("carNum", parkingSpace.getCarNum());
-            paramIn.put("carBrand", parkingSpace.getCarBrand());
-            paramIn.put("carType", parkingSpace.getCarType());
-            paramIn.put("carColor", parkingSpace.getCarColor());
-            paramIn.put("psId", savedParkingSpaceInfo.getString("psId"));
-            paramIn.put("storeId", result.getStoreId());
-            paramIn.put("sellOrHire", parkingSpace.getSellOrHire());
-            paramIn.put("startTime", parkingSpace.getStartTime());
-            paramIn.put("endTime", parkingSpace.getEndTime());
-
-            if ("H".equals(parkingSpace.getSellOrHire())) {
-                paramIn.put("cycles", "0");
+                if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                    /***************************************导入日志记录****************************************************/
+                    assetImportLogDetailDto = new AssetImportLogDetailDto();
+                    assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                    if (Assert.isJsonObject(responseEntity.getBody())) {
+                        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                        assetImportLogDetailDto.setState(paramOut.getString("code"));
+                        assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                    } else {
+                        assetImportLogDetailDto.setState("F");
+                        assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                    }
+                    assetImportLogDetailDto.setObjName(parkingSpace.getCarNum());
+                    assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                    failCount +=1;
+                    successCount = successCount >0? successCount -1:successCount;
+                    assetImportLogDto.setSuccessCount(successCount);
+                    assetImportLogDto.setErrorCount(failCount);
+                } else {
+                    JSONObject body = JSONObject.parseObject(responseEntity.getBody());
+                    if (body.containsKey("code") && body.getIntValue("code") != 0) {
+                        assetImportLogDetailDto = new AssetImportLogDetailDto();
+                        assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                        assetImportLogDetailDto.setState(body.getString("code"));
+                        assetImportLogDetailDto.setMessage(body.getString("msg"));
+                        assetImportLogDetailDto.setObjName(parkingSpace.getCarNum());
+                        assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                        failCount +=1;
+                        successCount = successCount >0? successCount -1:successCount;
+                        assetImportLogDto.setSuccessCount(successCount);
+                        assetImportLogDto.setErrorCount(failCount);
+                    }
+                }
             }
+        } catch (Exception e) {
+            saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto);
 
-            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.sellParkingSpace";
-            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
         }
 
         return responseEntity;
@@ -264,98 +438,200 @@ public class AssetImportSMOImpl extends BaseComponentSMO implements IAssetImport
         JSONObject paramIn = null;
         ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK);
         ImportOwner owner = null;
-        for (ImportRoom room : rooms) {
-            JSONObject savedRoomInfo = getExistsRoom(pd, result, room);
-            if (savedRoomInfo != null) {
-                continue;
-            }
-
-            paramIn = new JSONObject();
-
-
-            //保存 房屋
-            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.saveRoom";
+        AssetImportLogDto assetImportLogDto = new AssetImportLogDto();
+        assetImportLogDto.setSuccessCount(0L);
+        assetImportLogDto.setErrorCount(0L);
+        assetImportLogDto.setCommunityId(result.getCommunityId());
+        assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_HISTORY_FEE_IMPORT);
+        List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>();
+        assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos);
+        long successCount = 0L;
+        long failCount = 0L;
+        AssetImportLogDetailDto assetImportLogDetailDto = null;
+        try {
+            for (ImportRoom room : rooms) {
+                JSONObject savedRoomInfo = getExistsRoom(pd, result, room);
+                if (savedRoomInfo != null) {
+                    continue;
+                }
 
-            paramIn.put("communityId", result.getCommunityId());
-            paramIn.put("unitId", room.getFloor().getUnitId());
-            paramIn.put("roomNum", room.getRoomNum());
-            paramIn.put("layer", room.getLayer());
-            paramIn.put("section", "1");
-            paramIn.put("apartment", room.getSection());
-            paramIn.put("state", "2002");
-            paramIn.put("builtUpArea", room.getBuiltUpArea());
-            paramIn.put("feeCoefficient", "1.00");
-            paramIn.put("roomSubType", room.getRoomSubType());
-            paramIn.put("roomArea", room.getRoomArea());
-            paramIn.put("roomRent", room.getRoomRent());
-            paramIn.put("roomType", "0".equals(room.getFloor().getUnitNum()) ? RoomDto.ROOM_TYPE_SHOPS : RoomDto.ROOM_TYPE_SHOPS);
+                paramIn = new JSONObject();
 
 
+                //保存 房屋
+                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.saveRoom";
 
-            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
-            if (responseEntity.getStatusCode() != HttpStatus.OK) {
-                continue;
-            }
+                paramIn.put("communityId", result.getCommunityId());
+                paramIn.put("unitId", room.getFloor().getUnitId());
+                paramIn.put("roomNum", room.getRoomNum());
+                paramIn.put("layer", room.getLayer());
+                paramIn.put("section", "1");
+                paramIn.put("apartment", room.getSection());
+                paramIn.put("state", "2002");
+                paramIn.put("builtUpArea", room.getBuiltUpArea());
+                paramIn.put("feeCoefficient", "1.00");
+                paramIn.put("roomSubType", room.getRoomSubType());
+                paramIn.put("roomArea", room.getRoomArea());
+                paramIn.put("roomRent", room.getRoomRent());
+                paramIn.put("roomType", "0".equals(room.getFloor().getUnitNum()) ? RoomDto.ROOM_TYPE_SHOPS : RoomDto.ROOM_TYPE_SHOPS);
 
-            savedRoomInfo = getExistsRoom(pd, result, room);
-            if (savedRoomInfo == null) {
-                continue;
-            }
 
-            if (room.getImportOwner() == null) {
-                continue;
-            }
-            paramIn.clear();
-            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.sellRoom";
-            paramIn.put("communityId", result.getCommunityId());
-            paramIn.put("ownerId", room.getImportOwner().getOwnerId());
-            paramIn.put("roomId", savedRoomInfo.getString("roomId"));
-            paramIn.put("state", "2001");
-            paramIn.put("storeId", result.getStoreId());
-            if (!StringUtil.isEmpty(room.getRoomFeeId()) && "0".equals(room.getRoomFeeId())) {
-                paramIn.put("feeEndDate", room.getFeeEndDate());
-            }
-            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
-            if (responseEntity.getStatusCode() != HttpStatus.OK) {
-                continue;
-            }
-            //创建费用
-            if (StringUtil.isEmpty(room.getRoomFeeId()) || "0".equals(room.getRoomFeeId())) {
-                continue;
-            }
-            String[] feeIds = room.getRoomFeeId().split("#");
-
-            for (int feeIndex = 0; feeIndex < feeIds.length; feeIndex++) {
-                String feeId = feeIds[feeIndex];
-                ImportFee tmpFee = null;
-                for (ImportFee fee : fees) {
-                    if (feeId.equals(fee.getId())) {
-                        tmpFee = fee;
+                responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+                if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                    failCount += 1;
+                    assetImportLogDetailDto = new AssetImportLogDetailDto();
+                    assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                    if (Assert.isJsonObject(responseEntity.getBody())) {
+                        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                        assetImportLogDetailDto.setState(paramOut.getString("code"));
+                        assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                    } else {
+                        assetImportLogDetailDto.setState("F");
+                        assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                    }
+                    assetImportLogDetailDto.setObjName(room.getRoomNum() + "室");
+                    assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                    assetImportLogDto.setSuccessCount(successCount);
+                    assetImportLogDto.setErrorCount(failCount);
+                    continue;
+                } else {
+                    JSONObject body = JSONObject.parseObject(responseEntity.getBody());
+                    if (body.containsKey("code") && body.getIntValue("code") != 0) {
+                        assetImportLogDetailDto = new AssetImportLogDetailDto();
+                        assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                        assetImportLogDetailDto.setState(body.getString("code"));
+                        assetImportLogDetailDto.setMessage(body.getString("msg"));
+                        assetImportLogDetailDto.setObjName(room.getRoomNum() + "室");
+                        assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                        failCount += 1;
+                        assetImportLogDto.setSuccessCount(successCount);
+                        assetImportLogDto.setErrorCount(failCount);
+                        continue;
+                    } else {
+                        successCount += 1;
+                        assetImportLogDto.setSuccessCount(successCount);
+                        assetImportLogDto.setErrorCount(failCount);
                     }
                 }
 
-                if (tmpFee == null) {
-                    continue;//没有费用项,可能写错了
+                savedRoomInfo = getExistsRoom(pd, result, room);
+                if (savedRoomInfo == null) {
+                    continue;
                 }
-
-                JSONObject ttFee = getExistsFee(pd, result, tmpFee);
-
-                if (ttFee == null) {
-                    continue;//没有费用项,可能写错了
+                if (room.getImportOwner() == null) {
+                    continue;
                 }
-
-                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/fee.saveRoomCreateFee";
+                paramIn.clear();
+                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.sellRoom";
                 paramIn.put("communityId", result.getCommunityId());
-                paramIn.put("locationTypeCd", "3000");
-                paramIn.put("locationObjId", savedRoomInfo.getString("roomId"));
-                paramIn.put("configId", ttFee.getString("configId"));
+                paramIn.put("ownerId", room.getImportOwner().getOwnerId());
+                paramIn.put("roomId", savedRoomInfo.getString("roomId"));
+                paramIn.put("state", "2001");
                 paramIn.put("storeId", result.getStoreId());
-                paramIn.put("feeEndDate", room.getFeeEndDate().split("#")[feeIndex]);
-                paramIn.put("startTime", paramIn.getString("feeEndDate"));
-
+                if (!StringUtil.isEmpty(room.getRoomFeeId()) && "0".equals(room.getRoomFeeId())) {
+                    paramIn.put("feeEndDate", room.getFeeEndDate());
+                }
                 responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
-            }
+                if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                    assetImportLogDetailDto = new AssetImportLogDetailDto();
+                    assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                    if (Assert.isJsonObject(responseEntity.getBody())) {
+                        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                        assetImportLogDetailDto.setState(paramOut.getString("code"));
+                        assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                    } else {
+                        assetImportLogDetailDto.setState("F");
+                        assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                    }
+                    assetImportLogDetailDto.setObjName(room.getRoomNum() + "室");
+                    assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                    continue;
+                } else {
+                    JSONObject body = JSONObject.parseObject(responseEntity.getBody());
+                    if (body.containsKey("code") && body.getIntValue("code") != 0) {
+                        assetImportLogDetailDto = new AssetImportLogDetailDto();
+                        assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                        assetImportLogDetailDto.setState(body.getString("code"));
+                        assetImportLogDetailDto.setMessage(body.getString("msg"));
+                        assetImportLogDetailDto.setObjName(room.getRoomNum() + "室");
+                        assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                        continue;
+                    }
+                }
+                //创建费用
+                if (StringUtil.isEmpty(room.getRoomFeeId()) || "0".equals(room.getRoomFeeId())) {
+                    continue;
+                }
+                String[] feeIds = room.getRoomFeeId().split("#");
+
+                for (int feeIndex = 0; feeIndex < feeIds.length; feeIndex++) {
+                    String feeId = feeIds[feeIndex];
+                    ImportFee tmpFee = null;
+                    for (ImportFee fee : fees) {
+                        if (feeId.equals(fee.getId())) {
+                            tmpFee = fee;
+                        }
+                    }
+
+                    if (tmpFee == null) {
+                        continue;//没有费用项,可能写错了
+                    }
+
+                    JSONObject ttFee = getExistsFee(pd, result, tmpFee);
 
+                    if (ttFee == null) {
+                        continue;//没有费用项,可能写错了
+                    }
+
+                    apiUrl = ServiceConstant.SERVICE_API_URL + "/api/fee.saveRoomCreateFee";
+                    paramIn.put("communityId", result.getCommunityId());
+                    paramIn.put("locationTypeCd", "3000");
+                    paramIn.put("locationObjId", savedRoomInfo.getString("roomId"));
+                    paramIn.put("configId", ttFee.getString("configId"));
+                    paramIn.put("storeId", result.getStoreId());
+                    paramIn.put("feeEndDate", room.getFeeEndDate().split("#")[feeIndex]);
+                    paramIn.put("startTime", paramIn.getString("feeEndDate"));
+
+                    responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+
+                    if (responseEntity.getStatusCode() != HttpStatus.OK) {
+                        /***************************************导入日志记录****************************************************/
+                        assetImportLogDetailDto = new AssetImportLogDetailDto();
+                        assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                        if (Assert.isJsonObject(responseEntity.getBody())) {
+                            JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                            assetImportLogDetailDto.setState(paramOut.getString("code"));
+                            assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                        } else {
+                            assetImportLogDetailDto.setState("F");
+                            assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                        }
+                        assetImportLogDetailDto.setObjName(room.getRoomNum() + "室");
+                        assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                        failCount +=1;
+                        successCount = successCount >0? successCount -1:successCount;
+                        assetImportLogDto.setSuccessCount(successCount);
+                        assetImportLogDto.setErrorCount(failCount);
+                    } else {
+                        JSONObject body = JSONObject.parseObject(responseEntity.getBody());
+                        if (body.containsKey("code") && body.getIntValue("code") != 0) {
+                            assetImportLogDetailDto = new AssetImportLogDetailDto();
+                            assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                            assetImportLogDetailDto.setState(body.getString("code"));
+                            assetImportLogDetailDto.setMessage(body.getString("msg"));
+                            assetImportLogDetailDto.setObjName(room.getRoomNum() + "室");
+                            assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                            failCount +=1;
+                            successCount = successCount >0? successCount -1:successCount;
+                            assetImportLogDto.setSuccessCount(successCount);
+                            assetImportLogDto.setErrorCount(failCount);
+                        }
+                    }
+                }
+
+            }
+        } finally {
+            saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto);
         }
 
         return responseEntity;
@@ -473,37 +749,77 @@ public class AssetImportSMOImpl extends BaseComponentSMO implements IAssetImport
         String apiUrl = "";
         JSONObject paramIn = null;
         ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK);
+        AssetImportLogDto assetImportLogDto = new AssetImportLogDto();
+        assetImportLogDto.setSuccessCount(0L);
+        assetImportLogDto.setErrorCount(0L);
+        assetImportLogDto.setCommunityId(result.getCommunityId());
+        assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_HISTORY_FEE_IMPORT);
+        List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>();
+        assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos);
+        long successCount = 0L;
+        long failCount = 0L;
+        AssetImportLogDetailDto assetImportLogDetailDto = null;
+        try {
+            for (ImportOwner owner : owners) {
+                JSONObject savedOwnerInfo = getExistsOwner(pd, result, owner);
+
+                if (savedOwnerInfo != null) {
+                    owner.setOwnerId(savedOwnerInfo.getString("ownerId"));
+                    continue;
+                }
+                paramIn = new JSONObject();
 
-        for (ImportOwner owner : owners) {
-            JSONObject savedOwnerInfo = getExistsOwner(pd, result, owner);
+                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/owner.saveOwner";
 
-            if (savedOwnerInfo != null) {
-                owner.setOwnerId(savedOwnerInfo.getString("ownerId"));
-                continue;
-            }
-            paramIn = new JSONObject();
-
-            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/owner.saveOwner";
-
-            paramIn.put("communityId", result.getCommunityId());
-            paramIn.put("userId", result.getUserId());
-            paramIn.put("name", owner.getOwnerName());
-            paramIn.put("age", owner.getAge());
-            paramIn.put("link", owner.getTel());
-            paramIn.put("sex", owner.getSex());
-            paramIn.put("ownerTypeCd", "1001");
-            paramIn.put("idCard", owner.getIdCard());
-            paramIn.put("source","BatchImport");
-            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
-
-            if (responseEntity.getStatusCode() == HttpStatus.OK) {
-                JSONObject body = JSONObject.parseObject(responseEntity.getBody());
-                if (body.containsKey("code") && body.getIntValue("code") != 0) {
-                    throw new IllegalArgumentException(body.getString("msg"));
-                }
-                savedOwnerInfo = getExistsOwner(pd, result, owner);
-                owner.setOwnerId(savedOwnerInfo.getString("ownerId"));
+                paramIn.put("communityId", result.getCommunityId());
+                paramIn.put("userId", result.getUserId());
+                paramIn.put("name", owner.getOwnerName());
+                paramIn.put("age", owner.getAge());
+                paramIn.put("link", owner.getTel());
+                paramIn.put("sex", owner.getSex());
+                paramIn.put("ownerTypeCd", "1001");
+                paramIn.put("idCard", owner.getIdCard());
+                paramIn.put("source", "BatchImport");
+                responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+
+                /***************************************导入日志记录****************************************************/
+                if (responseEntity.getStatusCode() == HttpStatus.OK) {
+                    JSONObject body = JSONObject.parseObject(responseEntity.getBody());
+                    if (body.containsKey("code") && body.getIntValue("code") != 0) {
+                        assetImportLogDetailDto = new AssetImportLogDetailDto();
+                        assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                        assetImportLogDetailDto.setState(body.getString("code"));
+                        assetImportLogDetailDto.setMessage(body.getString("msg"));
+                        assetImportLogDetailDto.setObjName(owner.getOwnerName());
+                        assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                        failCount += 1;
+                        assetImportLogDto.setSuccessCount(successCount);
+                        assetImportLogDto.setErrorCount(failCount);
+                        throw new IllegalArgumentException(body.getString("msg"));
+                    }
+                    savedOwnerInfo = getExistsOwner(pd, result, owner);
+                    owner.setOwnerId(savedOwnerInfo.getString("ownerId"));
+                    successCount += 1;
+                } else {
+                    failCount += 1;
+                    assetImportLogDetailDto = new AssetImportLogDetailDto();
+                    assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                    if (Assert.isJsonObject(responseEntity.getBody())) {
+                        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                        assetImportLogDetailDto.setState(paramOut.getString("code"));
+                        assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                    } else {
+                        assetImportLogDetailDto.setState("F");
+                        assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                    }
+                    assetImportLogDetailDto.setObjName(owner.getOwnerName());
+                    assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                }
+                assetImportLogDto.setSuccessCount(successCount);
+                assetImportLogDto.setErrorCount(failCount);
             }
+        } finally {
+            saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto);
         }
 
         return responseEntity;
@@ -521,53 +837,121 @@ public class AssetImportSMOImpl extends BaseComponentSMO implements IAssetImport
         String apiUrl = "";
         JSONObject paramIn = null;
         ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK);
-        for (ImportFloor importFloor : floors) {
-            paramIn = new JSONObject();
-            //先保存 楼栋信息
-            JSONObject savedFloorInfo = getExistsFloor(pd, result, importFloor);
-            // 如果不存在,才插入
-            if (savedFloorInfo == null) {
-                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.saveFloor";
-                paramIn.put("communityId", result.getCommunityId());
-                paramIn.put("floorNum", importFloor.getFloorNum());
-                paramIn.put("userId", result.getUserId());
-                paramIn.put("name", importFloor.getFloorNum() + "栋");
-                paramIn.put("floorArea", 1.00);
 
-                responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
-                savedFloorInfo = getExistsFloor(pd, result, importFloor);
-            }
-            if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
-                continue;
-            }
+        AssetImportLogDto assetImportLogDto = new AssetImportLogDto();
+        assetImportLogDto.setSuccessCount(0L);
+        assetImportLogDto.setErrorCount(0L);
+        assetImportLogDto.setCommunityId(result.getCommunityId());
+        assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_HISTORY_FEE_IMPORT);
+        List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>();
+        assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos);
+        long successCount = 0L;
+        long failCount = 0L;
+        AssetImportLogDetailDto assetImportLogDetailDto = null;
+        try {
+            for (ImportFloor importFloor : floors) {
+                paramIn = new JSONObject();
+                //先保存 楼栋信息
+                JSONObject savedFloorInfo = getExistsFloor(pd, result, importFloor);
+                // 如果不存在,才插入
+                if (savedFloorInfo == null) {
+                    apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.saveFloor";
+                    paramIn.put("communityId", result.getCommunityId());
+                    paramIn.put("floorNum", importFloor.getFloorNum());
+                    paramIn.put("userId", result.getUserId());
+                    paramIn.put("name", importFloor.getFloorNum() + "栋");
+                    paramIn.put("floorArea", 1.00);
+
+                    responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+                    savedFloorInfo = getExistsFloor(pd, result, importFloor);
+                }
 
+                /***************************************导入日志记录****************************************************/
+                if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
+                    failCount += 1;
+                    assetImportLogDetailDto = new AssetImportLogDetailDto();
+                    assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                    if (Assert.isJsonObject(responseEntity.getBody())) {
+                        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                        assetImportLogDetailDto.setState(paramOut.getString("code"));
+                        assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                    } else {
+                        assetImportLogDetailDto.setState("F");
+                        assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                    }
+                    assetImportLogDetailDto.setObjName(importFloor.getFloorNum() + "栋");
+                    assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                    assetImportLogDto.setSuccessCount(successCount);
+                    assetImportLogDto.setErrorCount(failCount);
+                    continue;
+                } else {
+                    successCount += 1;
+                    assetImportLogDto.setSuccessCount(successCount);
+                    assetImportLogDto.setErrorCount(failCount);
+                }
 
-            if (savedFloorInfo == null) {
-                continue;
-            }
-            importFloor.setFloorId(savedFloorInfo.getString("floorId"));
-            paramIn.clear();
-            //判断单元信息是否已经存在,如果存在则不保存数据unit.queryUnits
-            JSONObject savedUnitInfo = getExistsUnit(pd, result, importFloor);
-            if (savedUnitInfo != null) {
-                importFloor.setUnitId(savedUnitInfo.getString("unitId"));
-                continue;
-            }
 
-            apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.saveUnit";
+                if (savedFloorInfo == null) {
+                    continue;
+                }
+                importFloor.setFloorId(savedFloorInfo.getString("floorId"));
+                paramIn.clear();
+                //判断单元信息是否已经存在,如果存在则不保存数据unit.queryUnits
+                JSONObject savedUnitInfo = getExistsUnit(pd, result, importFloor);
+                if (savedUnitInfo != null) {
+                    importFloor.setUnitId(savedUnitInfo.getString("unitId"));
+                    continue;
+                }
 
-            paramIn.put("communityId", result.getCommunityId());
-            paramIn.put("floorId", savedFloorInfo.getString("floorId"));
-            paramIn.put("unitNum", importFloor.getUnitNum());
-            paramIn.put("layerCount", importFloor.getLayerCount());
-            paramIn.put("lift", importFloor.getLift());
-            paramIn.put("unitArea", 1.00);
-            responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+                apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.saveUnit";
 
-            //将unitId 刷入ImportFloor对象
-            savedUnitInfo = getExistsUnit(pd, result, importFloor);
-            importFloor.setUnitId(savedUnitInfo.getString("unitId"));
+                paramIn.put("communityId", result.getCommunityId());
+                paramIn.put("floorId", savedFloorInfo.getString("floorId"));
+                paramIn.put("unitNum", importFloor.getUnitNum());
+                paramIn.put("layerCount", importFloor.getLayerCount());
+                paramIn.put("lift", importFloor.getLift());
+                paramIn.put("unitArea", 1.00);
+                responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST);
+                /****************************** 开始记录失败日志 *******************************/
+                if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
+                    assetImportLogDetailDto = new AssetImportLogDetailDto();
+                    assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                    if (Assert.isJsonObject(responseEntity.getBody())) {
+                        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+                        assetImportLogDetailDto.setState(paramOut.getString("code"));
+                        assetImportLogDetailDto.setMessage(paramOut.getString("msg"));
+                    } else {
+                        assetImportLogDetailDto.setState("F");
+                        assetImportLogDetailDto.setMessage(responseEntity.getBody());
+                    }
+                    assetImportLogDetailDto.setObjName(importFloor.getFloorNum() + "栋" + importFloor.getUnitNum() + "单元");
+                    assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                    failCount +=1;
+                    successCount = successCount >0? successCount -1:successCount;
+                    assetImportLogDto.setSuccessCount(successCount);
+                    assetImportLogDto.setErrorCount(failCount);
+                } else {
+                    JSONObject body = JSONObject.parseObject(responseEntity.getBody());
+                    if (body.containsKey("code") && body.getIntValue("code") != 0) {
+                        assetImportLogDetailDto = new AssetImportLogDetailDto();
+                        assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId());
+                        assetImportLogDetailDto.setState(body.getString("code"));
+                        assetImportLogDetailDto.setMessage(body.getString("msg"));
+                        assetImportLogDetailDto.setObjName(importFloor.getFloorNum() + "栋" + importFloor.getUnitNum() + "单元");
+                        assetImportLogDetailDtos.add(assetImportLogDetailDto);
+                        failCount +=1;
+                        successCount = successCount >0? successCount -1:successCount;
+                        assetImportLogDto.setSuccessCount(successCount);
+                        assetImportLogDto.setErrorCount(failCount);
+                    }
+                }
+                //将unitId 刷入ImportFloor对象
+                savedUnitInfo = getExistsUnit(pd, result, importFloor);
+                importFloor.setUnitId(savedUnitInfo.getString("unitId"));
 
+            }
+        } finally {
+            saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto);
         }
         return responseEntity;
     }

+ 2 - 2
service-user/src/main/java/com/java110/user/dao/impl/InitializeOwnerServiceDaoImpl.java

@@ -31,9 +31,9 @@ public class InitializeOwnerServiceDaoImpl extends BaseServiceDao implements IIn
 
         int deleteFlag = sqlSessionTemplate.delete("initializeOwnerServiceDaoImpl.deleteBuildingOwner", info);
 
-        if (deleteFlag < 1) {
+    /*    if (deleteFlag < 1) {
             throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "building_owner初始化失败:" + JSONObject.toJSONString(info));
-        }
+        }*/
         return deleteFlag;
     }
 }