|  | @ -1,6 +1,8 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.security.service;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.iot.common.UploadVO;
 | 
	
	
		
			
				|  | @ -20,8 +22,10 @@ import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | import org.springframework.mock.web.MockMultipartFile;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  | import sun.misc.BASE64Encoder;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.io.InputStream;
 | 
	
	
		
			
				|  | @ -47,6 +51,15 @@ public class OauthYlzConfigService {
 | 
	
		
			
				|  |  |     @Value("${fastDFS.fastdfs_file_url}")
 | 
	
		
			
				|  |  |     private String fastdfs_file_url;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${testPattern.sign}")
 | 
	
		
			
				|  |  |     private String isClose;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${testPattern.remote_inner_url}")
 | 
	
		
			
				|  |  |     private String remote_inner_url;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ObjectMapper objectMapper;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> getOauthQRCode(){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config");
 | 
	
	
		
			
				|  | @ -63,26 +76,54 @@ public class OauthYlzConfigService {
 | 
	
		
			
				|  |  |             bizContent.put("out_authorize_no", no);
 | 
	
		
			
				|  |  |             bizContent.put("out_authorize_time", DateUtils.getOutTradeTime());
 | 
	
		
			
				|  |  |             e.setBiz_content(JSON.toJSONString(bizContent));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String param = com.alibaba.fastjson.JSONObject.toJSONString(e);
 | 
	
		
			
				|  |  |             logger.info("TransRequest :"+param);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
 | 
	
		
			
				|  |  |             TransResponse re = ehcHandler.execute(e);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
 | 
	
		
			
				|  |  |             logger.info("TransResponse:"+rs);
 | 
	
		
			
				|  |  |             logger.info("TransResponse :"+rs);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
 | 
	
		
			
				|  |  |             InputStream qrcode = QrcodeUtil.createQrcode(biz.getString("ehealth_authurl"),300,"jpg");
 | 
	
		
			
				|  |  |             logger.info("fastdfs_file_url:"+fastdfs_file_url);
 | 
	
		
			
				|  |  |             UploadVO uploadVO = fileUploadService.uploadStream(qrcode,"qrcode.jpg",fastdfs_file_url);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             Map<String,Object> map = new HashedMap();
 | 
	
		
			
				|  |  |             map.put("fileName",uploadVO.getFileName());
 | 
	
		
			
				|  |  |             map.put("fileType",uploadVO.getFileType());
 | 
	
		
			
				|  |  |             map.put("fullUrl",uploadVO.getFullUrl());
 | 
	
		
			
				|  |  |             map.put("fullUri",uploadVO.getFullUri());
 | 
	
		
			
				|  |  |             map.put("out_authorize_no",no);
 | 
	
		
			
				|  |  |             logger.info("fileUploadService:"+map.toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if(isClose.equals("2")){
 | 
	
		
			
				|  |  |                 //内网上传
 | 
	
		
			
				|  |  |                 MultipartFile file = new MockMultipartFile("qrcode.jpg","qrcode.jpg","qrcode.jpg",qrcode);
 | 
	
		
			
				|  |  |                 String rsJson = fileUploadService.request(remote_inner_url,file,null);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 logger.info("内网上传"+rsJson);
 | 
	
		
			
				|  |  |                 JSONObject uploadJson = JSON.parseObject(rsJson);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 UploadVO uploadVO = objectMapper.readValue(uploadJson.getJSONObject("obj").toJSONString(),UploadVO.class);
 | 
	
		
			
				|  |  |                 map.put("fileName",uploadVO.getFileName());
 | 
	
		
			
				|  |  |                 map.put("fileType",uploadVO.getFileType());
 | 
	
		
			
				|  |  |                 map.put("fullUrl",uploadVO.getFullUrl());
 | 
	
		
			
				|  |  |                 map.put("fullUri",uploadVO.getFullUri());
 | 
	
		
			
				|  |  |                 map.put("out_authorize_no",no);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 logger.info("fileUploadService:"+map.toString());
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 // 得到文件的完整名称  xxx.txt
 | 
	
		
			
				|  |  |                 logger.info("fastdfs_file_url:"+fastdfs_file_url);
 | 
	
		
			
				|  |  |                 UploadVO uploadVO = fileUploadService.uploadStream(qrcode,"qrcode.jpg",fastdfs_file_url);
 | 
	
		
			
				|  |  |                 map = new HashedMap();
 | 
	
		
			
				|  |  |                 map.put("fileName",uploadVO.getFileName());
 | 
	
		
			
				|  |  |                 map.put("fileType",uploadVO.getFileType());
 | 
	
		
			
				|  |  |                 map.put("fullUrl",uploadVO.getFullUrl());
 | 
	
		
			
				|  |  |                 map.put("fullUri",uploadVO.getFullUri());
 | 
	
		
			
				|  |  |                 map.put("out_authorize_no",no);
 | 
	
		
			
				|  |  |                 logger.info("fileUploadService:"+map.toString());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return map;
 | 
	
		
			
				|  |  |         } catch (Exception var5) {
 | 
	
		
			
				|  |  |             logger.info("获取电子健康卡图片异常");
 | 
	
		
			
				|  |  |             var5.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -107,10 +148,15 @@ public class OauthYlzConfigService {
 | 
	
		
			
				|  |  |             bizContent.put("out_authorize_no", no);
 | 
	
		
			
				|  |  |             bizContent.put("out_authorize_time", DateUtils.getOutTradeTime());
 | 
	
		
			
				|  |  |             e.setBiz_content(JSON.toJSONString(bizContent));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String param = com.alibaba.fastjson.JSONObject.toJSONString(e);
 | 
	
		
			
				|  |  |             logger.info("TransRequest :"+param);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
 | 
	
		
			
				|  |  |             TransResponse re = ehcHandler.execute(e);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             logger.info("TransResponse:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS")+" "+rs);
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
 |