| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -211,8 +211,7 @@ public class EpidemicSentryPostServiceImpl extends BaseServiceImpl<EpidemicSentr | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (StringUtils.isNotBlank(entity.getMaCodeUrl())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException("该小程序码已经存在!"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String param = String.valueOf(entity.getGridId()).concat("-").concat(entity.getSentryPostCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        entity.setMaCodeUrl(this.createMaCode(param, MA_FRONT_PAGE_URL)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        entity.setMaCodeUrl(this.createAndSaveMaCode(String.valueOf(entity.getGridId()), entity.getSentryPostCode())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        baseDao.updateById(entity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result().ok("生成单个小程序码成功。"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -235,8 +234,7 @@ public class EpidemicSentryPostServiceImpl extends BaseServiceImpl<EpidemicSentr | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isNotBlank(entity.getMaCodeUrl())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                continue; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String param = String.valueOf(entity.getGridId()).concat("-").concat(entity.getSentryPostCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            entity.setMaCodeUrl(this.createMaCode(param, MA_FRONT_PAGE_URL)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            entity.setMaCodeUrl(this.createAndSaveMaCode(String.valueOf(entity.getGridId()), entity.getSentryPostCode())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            baseDao.updateById(entity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            isHave = true; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -247,23 +245,47 @@ public class EpidemicSentryPostServiceImpl extends BaseServiceImpl<EpidemicSentr | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 创建微信小程序码,并上传到oss | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 拼接生成小程序码字符串 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param param   小程序码的参数 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param pageUrl 小程序码的跳转链接 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return java.lang.String 小程序码的下载抵制 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param gridId   网格id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param postCode 哨卡编码 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return java.lang.String | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author work@yujt.net.cn | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2019/10/22 10:14 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2020/2/17 16:49 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String createMaCode(String param, String pageUrl) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String concatStrForMaCode(String gridId, String postCode) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return gridId.concat("-").concat(postCode); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 拼接url的方式生成小程序码 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param gridId   网格id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param postCode 哨卡编码 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return java.lang.String | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author work@yujt.net.cn | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2020/2/17 19:16 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String createAndSaveMaCode(String gridId, String postCode) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String url = MA_FRONT_PAGE_URL.concat("?G=").concat(gridId).concat("&P=").concat(postCode); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        File wxaCodeUnlimit; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wxaCodeUnlimit = wxMaServiceUtils.normalWxMaService().getQrcodeService() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    .createWxaCodeUnlimit(param, pageUrl, 1280, true, null, false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wxaCodeUnlimit = wxMaServiceUtils.normalWxMaService().getQrcodeService().createWxaCode(url, 1280); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } catch (WxErrorException e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException("请求微信接口失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return uploadFile(wxaCodeUnlimit); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 将小程序码上传到oss,返回访问url | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param wxaCodeUnlimit 图片文件 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return java.lang.String | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author work@yujt.net.cn | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2020/2/17 19:16 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String uploadFile(File wxaCodeUnlimit) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        UploadToOssDTO dto = new UploadToOssDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        dto.setFileByte(this.fileToByteArray(wxaCodeUnlimit)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        dto.setFileName(wxaCodeUnlimit.getName()); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -275,6 +297,27 @@ public class EpidemicSentryPostServiceImpl extends BaseServiceImpl<EpidemicSentr | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return ossResult.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 创建微信小程序码,并上传到oss | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param param   小程序码的参数 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param pageUrl 小程序码的跳转链接 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return java.lang.String 小程序码的下载抵制 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author work@yujt.net.cn | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2019/10/22 10:14 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String createMaCode(String param, String pageUrl) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        File wxaCodeUnlimit; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wxaCodeUnlimit = wxMaServiceUtils.normalWxMaService().getQrcodeService() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    .createWxaCodeUnlimit(param, pageUrl, 1280, true, null, false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } catch (WxErrorException e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException("请求微信接口失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return uploadFile(wxaCodeUnlimit); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * File文件转为byte[] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |