|  |  | @ -1,16 +1,25 @@ | 
			
		
	
		
			
				
					|  |  |  | package com.epmet.opendata.service.impl; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.fastjson.JSON; | 
			
		
	
		
			
				
					|  |  |  | import com.alibaba.fastjson.JSONObject; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
			
		
	
		
			
				
					|  |  |  | 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.WghJdbDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dto.constant.CaWghDataConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dto.form.PreserVationFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.dto.wgh.WghJdbDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.entity.CaLoudongEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.entity.WghJdbEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.redis.WghJdbRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.service.WghJdbService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.opendata.util.AesUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
	
		
			
				
					|  |  | @ -48,8 +57,8 @@ public class WghJdbServiceImpl extends BaseServiceImpl<WghJdbDao, WghJdbEntity> | 
			
		
	
		
			
				
					|  |  |  |         return ConvertUtils.sourceToTarget(entityList, WghJdbDTO.class); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     private QueryWrapper<WghJdbEntity> getWrapper(Map<String, Object> params){ | 
			
		
	
		
			
				
					|  |  |  |         String id = (String)params.get(FieldConstant.ID_HUMP); | 
			
		
	
		
			
				
					|  |  |  |     private QueryWrapper<WghJdbEntity> getWrapper(Map<String, Object> params) { | 
			
		
	
		
			
				
					|  |  |  |         String id = (String) params.get(FieldConstant.ID_HUMP); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         QueryWrapper<WghJdbEntity> wrapper = new QueryWrapper<>(); | 
			
		
	
		
			
				
					|  |  |  |         wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | 
			
		
	
	
		
			
				
					|  |  | @ -84,4 +93,79 @@ public class WghJdbServiceImpl extends BaseServiceImpl<WghJdbDao, WghJdbEntity> | 
			
		
	
		
			
				
					|  |  |  |         baseDao.deleteBatchIds(Arrays.asList(ids)); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * 调用ruoyi接口获取wgh_jdb数据 | 
			
		
	
		
			
				
					|  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |      * @param dto | 
			
		
	
		
			
				
					|  |  |  |      * @return void | 
			
		
	
		
			
				
					|  |  |  |      * @author LZN | 
			
		
	
		
			
				
					|  |  |  |      * @date 2022/6/14 15:31 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public void getPreserWghJdbVation(PreserVationFormDTO dto) { | 
			
		
	
		
			
				
					|  |  |  |         int i = baseDao.deleteAll(); | 
			
		
	
		
			
				
					|  |  |  |         if (i >= 0) { | 
			
		
	
		
			
				
					|  |  |  |             dto.setPageNo(NumConstant.ONE); | 
			
		
	
		
			
				
					|  |  |  |             dto.setPageSize(NumConstant.FIFTY); | 
			
		
	
		
			
				
					|  |  |  |             dto.setTableSchema(CaWghDataConstant.TABLESCHEMA_SHARE); | 
			
		
	
		
			
				
					|  |  |  |             dto.setTableName(CaWghDataConstant.SHARE_WGH_JDB); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             dto.setWhereCase("1=1"); | 
			
		
	
		
			
				
					|  |  |  |             dto.setOrderBy("insert_time"); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             int pageNo = 1; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             int total = 0; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             do { | 
			
		
	
		
			
				
					|  |  |  |                 try { | 
			
		
	
		
			
				
					|  |  |  |                     total = listWghJdb(dto); | 
			
		
	
		
			
				
					|  |  |  |                     pageNo++; | 
			
		
	
		
			
				
					|  |  |  |                     dto.setPageNo(pageNo); | 
			
		
	
		
			
				
					|  |  |  |                 } catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |                     e.printStackTrace(); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             } while (total > (pageNo * NumConstant.FIFTY)); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     private int listWghJdb(PreserVationFormDTO dto) throws Exception { | 
			
		
	
		
			
				
					|  |  |  |         String aes = AesUtils.encryptByAES(JSONObject.toJSONString(dto), CaWghDataConstant.AESKEY); | 
			
		
	
		
			
				
					|  |  |  |         JSONObject obj = new JSONObject(); | 
			
		
	
		
			
				
					|  |  |  |         obj.put(CaWghDataConstant.SHARE_CONDITION, aes); | 
			
		
	
		
			
				
					|  |  |  |         String data = HttpClientManager.getInstance().sendPostByJSON(CaWghDataConstant.DATA_URL_SHARE, obj.toJSONString()).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(); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     static class ReturnDate { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         private int total; | 
			
		
	
		
			
				
					|  |  |  |         private List<WghJdbEntity> list; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         public int getTotal() { | 
			
		
	
		
			
				
					|  |  |  |             return total; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         public void setTotal(int total) { | 
			
		
	
		
			
				
					|  |  |  |             this.total = total; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         public List<WghJdbEntity> getList() { | 
			
		
	
		
			
				
					|  |  |  |             return list; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         public void setList(List<WghJdbEntity> list) { | 
			
		
	
		
			
				
					|  |  |  |             this.list = list; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |