| 
						
						
						
					 | 
				
				 | 
				
					@ -1,6 +1,5 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					package com.epmet.service.impl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.toolkit.IdWorker; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.feignclient.dtos.JiMuPage; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -19,7 +18,6 @@ import com.epmet.commons.tools.exception.EpmetException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.redis.RedisUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.EpmetRequestHolder; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.HttpClientManager; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.CustomerFunctionConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.IcCustomerReportDao; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -44,8 +42,10 @@ import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.util.MultiValueMap; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.net.InetAddress; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.ArrayList; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Arrays; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.List; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Map; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -209,15 +209,16 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        recordIds.forEach(r -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            JiMuReportFormDTO form = new JiMuReportFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            form.setId(r); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            JiMuResult<Map<String, Object>> report = jiMuReportOpenFeignClient.getReport(form); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<String> url = getUrl(NumConstant.ONE, r); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.info("模板详情"+url); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String,Object> map = JSON.parseObject(url.getData(), Map.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!map.containsValue(true)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String authorization = EpmetRequestHolder.getHeader("Authorization"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 自定义header传递
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            MultiValueMap<String, String> headers = new HttpHeaders(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.add("token", authorization); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.add("Authorization", authorization); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            JiMuResult<Map<String, Object>> report = jiMuReportOpenFeignClient.getReport(r,"","",headers); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!report.isSuccess()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new EpmetException("获取jm报表详情失败:"+r); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String,Object> map2 = (Map<String,Object>)map.get("result"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            JiMuReportResultDTO data = ConvertUtils.mapToEntity(map2, JiMuReportResultDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            JiMuReportResultDTO data = ConvertUtils.mapToEntity(report.getResult(), JiMuReportResultDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            data.setReportId(data.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            data.setReportName(data.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            result.add(data); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -235,50 +236,4 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * Desc: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param type 1:代表根据ID查询;2查询全部 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2022/8/9 10:14 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public Result<String> getUrl(Integer type,String id) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String add = ""; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<String> result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            InetAddress localHost = InetAddress.getLocalHost(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					//            add = "http://"+localHost.getHostAddress()+":8118";
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            add = "http://"+"192.168.1.141"+":8118"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }catch (Exception e){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.warn("获取url失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (type.compareTo(NumConstant.TWO) == NumConstant.ZERO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            add = add.concat("/jmreport/excelQuery"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String,Object> params = new HashMap<>(16); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            params.put("pageNo",1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            params.put("pageSize",10000); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            params.put("reportType","datainfo"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            params.put("name",""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            params.put("token", EpmetRequestHolder.getHeader("Authorization")); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String,Object> headers = new HashMap<>(16); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.put("token", EpmetRequestHolder.getHeader("Authorization")); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.put("X-Access-Token", EpmetRequestHolder.getHeader("Authorization")); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.put("Accept", "application/json, text/plain, */*"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.put("Content-Type", "application/json;charset=utf-8"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            result = HttpClientManager.getInstance().sendGet(add, params, headers); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            add = add.concat("/jmreport/show"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String,Object> params = new HashMap<>(16); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            params.put("id",id); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            params.put("apiUrl",""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            params.put("params",""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String,String> headers = new HashMap<>(16); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.put("token", EpmetRequestHolder.getHeader("Authorization")); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.put("X-Access-Token", EpmetRequestHolder.getHeader("Authorization")); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.put("Accept", "application/json, text/plain, */*"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            headers.put("Content-Type", "application/json;charset=utf-8"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            result = HttpClientManager.getInstance().sendPostByJSONAndHeader(add, JSON.toJSONString(params), headers); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} |