|  |  | @ -1,14 +1,21 @@ | 
			
		
	
		
			
				
					|  |  |  | package com.epmet.opendata.service.impl; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.fastjson.JSON; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.fastjson.JSONArray; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.fastjson.JSONObject; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.FieldConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.page.PageData; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.HttpClientManager; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dao.CaLoudongDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dto.CaLoudongDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dto.form.CaLoudongDetailsFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dto.form.CaLoudongFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dto.form.PreserVationFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dto.result.CaLoudongDetailsResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dto.result.CaLoudongResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.entity.CaLoudongEntity; | 
			
		
	
	
		
			
				
					|  |  | @ -16,14 +23,14 @@ import com.epmet.opendata.redis.CaLoudongRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.service.CaLoudongService; | 
			
		
	
		
			
				
					|  |  |  | import com.github.pagehelper.PageHelper; | 
			
		
	
		
			
				
					|  |  |  | import com.github.pagehelper.PageInfo; | 
			
		
	
		
			
				
					|  |  |  | import com.google.gson.JsonObject; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.util.Arrays; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  | import java.util.Map; | 
			
		
	
		
			
				
					|  |  |  | import java.text.SimpleDateFormat; | 
			
		
	
		
			
				
					|  |  |  | import java.util.*; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** | 
			
		
	
		
			
				
					|  |  |  |  * 楼栋基本信息表 | 
			
		
	
	
		
			
				
					|  |  | @ -111,5 +118,86 @@ public class CaLoudongServiceImpl extends BaseServiceImpl<CaLoudongDao, CaLoudon | 
			
		
	
		
			
				
					|  |  |  |         return result; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 楼栋调用ruoyi接口存储数据 | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param dto | 
			
		
	
		
			
				
					|  |  |  |      * @return void | 
			
		
	
		
			
				
					|  |  |  |      * @author LZN | 
			
		
	
		
			
				
					|  |  |  |      * @date 2022/6/2 10:03 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public void preserLouDongVation(PreserVationFormDTO dto) { | 
			
		
	
		
			
				
					|  |  |  |         baseDao.deleteAll(); | 
			
		
	
		
			
				
					|  |  |  |         dto.setPageNo(NumConstant.ONE); | 
			
		
	
		
			
				
					|  |  |  |         dto.setPageSize(NumConstant.FIFTY); | 
			
		
	
		
			
				
					|  |  |  |         dto.setTableSchema(loudongEnum.LD.name); | 
			
		
	
		
			
				
					|  |  |  |         dto.setTableName(loudongEnum.LD.code); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         dto.setWhereCase("delete_flag = 'normal'"); | 
			
		
	
		
			
				
					|  |  |  |         dto.setOrderBy("grid_id,update_date desc"); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         int pageNo = 1; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         int total = 0; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         do { | 
			
		
	
		
			
				
					|  |  |  |             total = listLouDong(dto); | 
			
		
	
		
			
				
					|  |  |  |             pageNo++; | 
			
		
	
		
			
				
					|  |  |  |             dto.setPageNo(pageNo); | 
			
		
	
		
			
				
					|  |  |  |         } while (total > (pageNo * NumConstant.FIFTY)); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     enum loudongEnum { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         LD("unicom", "ca_loudong"), | 
			
		
	
		
			
				
					|  |  |  |         ; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         private String name; | 
			
		
	
		
			
				
					|  |  |  |         private String code; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         loudongEnum(String name, String code) { | 
			
		
	
		
			
				
					|  |  |  |             this.name = name; | 
			
		
	
		
			
				
					|  |  |  |             this.code = code; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     private int listLouDong(PreserVationFormDTO dto) { | 
			
		
	
		
			
				
					|  |  |  |         String data = HttpClientManager.getInstance().sendPostByJSON("http://120.221.72.83:9090/bridge/unicom/page", JSON.toJSONString(dto)).getData(); | 
			
		
	
		
			
				
					|  |  |  |         JSONObject toResult = JSON.parseObject(data); | 
			
		
	
		
			
				
					|  |  |  |         Result result = ConvertUtils.mapToEntity(toResult, Result.class); | 
			
		
	
		
			
				
					|  |  |  |         if (!result.success()) { | 
			
		
	
		
			
				
					|  |  |  |             return dto.getPageNo() + 1; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         ReturnDate returnDate = JSONObject.parseObject(JSONObject.toJSONString(result.getData()), ReturnDate.class); | 
			
		
	
		
			
				
					|  |  |  |         this.insertBatch(returnDate.getList()); | 
			
		
	
		
			
				
					|  |  |  |         return returnDate.getTotal(); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     class ReturnDate { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         private int total; | 
			
		
	
		
			
				
					|  |  |  |         private List<CaLoudongEntity> list; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         public int getTotal() { | 
			
		
	
		
			
				
					|  |  |  |             return total; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         public void setTotal(int total) { | 
			
		
	
		
			
				
					|  |  |  |             this.total = total; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         public List<CaLoudongEntity> getList() { | 
			
		
	
		
			
				
					|  |  |  |             return list; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         public void setList(List<CaLoudongEntity> list) { | 
			
		
	
		
			
				
					|  |  |  |             this.list = list; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } |