| 
						
						
							
								
							
						
						
					 | 
					@ -17,7 +17,6 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					package com.elink.esua.epdc.service.impl; | 
					 | 
					 | 
					package com.elink.esua.epdc.service.impl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import cn.binarywang.wx.miniapp.api.WxMaQrcodeService; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import cn.hutool.core.collection.CollUtil; | 
					 | 
					 | 
					import cn.hutool.core.collection.CollUtil; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -64,6 +63,11 @@ public class DeptMaCodeServiceImpl extends BaseServiceImpl<DeptMaCodeDao, DeptMa | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private OssFeignClient ossFeignClient; | 
					 | 
					 | 
					    private OssFeignClient ossFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * 小程序首页 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private static String MA_FRONT_PAGE_URL = "pages/index/index"; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public PageData<DeptMaCodeDTO> page(Map<String, Object> params) { | 
					 | 
					 | 
					    public PageData<DeptMaCodeDTO> page(Map<String, Object> params) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        String leaderFlag = (String) params.get("leaderFlag"); | 
					 | 
					 | 
					        String leaderFlag = (String) params.get("leaderFlag"); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -143,31 +147,10 @@ public class DeptMaCodeServiceImpl extends BaseServiceImpl<DeptMaCodeDao, DeptMa | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (CollUtil.isEmpty(gridIdList)) { | 
					 | 
					 | 
					        if (CollUtil.isEmpty(gridIdList)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return new Result(); | 
					 | 
					 | 
					            return new Result(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        String page = "pages/index/index"; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Result<String> ossResult; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        File wxaCodeUnlimit; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        UploadToOssDTO uploadDto; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        DeptMaCodeEntity entity; | 
					 | 
					 | 
					        DeptMaCodeEntity entity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        WxMaQrcodeService qrcodeService = wxMaServiceUtils.normalWxMaService().getQrcodeService(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        for (Long gridId : gridIdList) { | 
					 | 
					 | 
					        for (Long gridId : gridIdList) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            try { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                wxaCodeUnlimit = qrcodeService.createWxaCodeUnlimit(String.valueOf(gridId), page); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } catch (WxErrorException e) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                log.error("->initDeptMaCode::createWxaCodeUnlimit error::deptId={}", gridId); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                continue; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            uploadDto = new UploadToOssDTO(); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            uploadDto.setFileByte(this.fileToByteArray(wxaCodeUnlimit)); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            uploadDto.setFileName(wxaCodeUnlimit.getName()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            ossResult = ossFeignClient.uploadFile(uploadDto); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (null == ossResult || !ossResult.success() || null == ossResult.getData()) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                log.error("->initDeptMaCode::oss uploadFile error::deptId={}", gridId); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                continue; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity = new DeptMaCodeEntity(); | 
					 | 
					 | 
					            entity = new DeptMaCodeEntity(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            entity.setCodeUrl(ossResult.getData()); | 
					 | 
					 | 
					            entity.setCodeUrl(this.createMaCode(String.valueOf(gridId), MA_FRONT_PAGE_URL)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            entity.setGridId(gridId); | 
					 | 
					 | 
					            entity.setGridId(gridId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            this.baseDao.insert(entity); | 
					 | 
					 | 
					            this.baseDao.insert(entity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -177,7 +160,7 @@ public class DeptMaCodeServiceImpl extends BaseServiceImpl<DeptMaCodeDao, DeptMa | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public Result createDeptMaCode(String gridId) { | 
					 | 
					 | 
					    public Result createDeptMaCode(String gridId) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        DeptMaCodeEntity entity = new DeptMaCodeEntity(); | 
					 | 
					 | 
					        DeptMaCodeEntity entity = new DeptMaCodeEntity(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        entity.setCodeUrl(this.createMaCode(gridId, "pages/index/index")); | 
					 | 
					 | 
					        entity.setCodeUrl(this.createMaCode(gridId, MA_FRONT_PAGE_URL)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        entity.setGridId(Long.parseLong(gridId)); | 
					 | 
					 | 
					        entity.setGridId(Long.parseLong(gridId)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        entity.setLeaderFlag(YesOrNoEnum.NO.value()); | 
					 | 
					 | 
					        entity.setLeaderFlag(YesOrNoEnum.NO.value()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        this.baseDao.insert(entity); | 
					 | 
					 | 
					        this.baseDao.insert(entity); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -193,7 +176,7 @@ public class DeptMaCodeServiceImpl extends BaseServiceImpl<DeptMaCodeDao, DeptMa | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return new Result(); | 
					 | 
					 | 
					            return new Result(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        DeptMaCodeEntity entity = new DeptMaCodeEntity(); | 
					 | 
					 | 
					        DeptMaCodeEntity entity = new DeptMaCodeEntity(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        entity.setCodeUrl(this.createMaCode("gridLeader", "pages/index/index")); | 
					 | 
					 | 
					        entity.setCodeUrl(this.createMaCode("gridLeader", MA_FRONT_PAGE_URL)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        entity.setLeaderFlag(YesOrNoEnum.YES.value()); | 
					 | 
					 | 
					        entity.setLeaderFlag(YesOrNoEnum.YES.value()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        this.baseDao.insert(entity); | 
					 | 
					 | 
					        this.baseDao.insert(entity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return new Result(); | 
					 | 
					 | 
					        return new Result(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -211,7 +194,8 @@ public class DeptMaCodeServiceImpl extends BaseServiceImpl<DeptMaCodeDao, DeptMa | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private String createMaCode(String param, String pageUrl) { | 
					 | 
					 | 
					    private String createMaCode(String param, String pageUrl) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        File wxaCodeUnlimit; | 
					 | 
					 | 
					        File wxaCodeUnlimit; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        try { | 
					 | 
					 | 
					        try { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            wxaCodeUnlimit = wxMaServiceUtils.normalWxMaService().getQrcodeService().createWxaCodeUnlimit(param, pageUrl); | 
					 | 
					 | 
					            wxaCodeUnlimit = wxMaServiceUtils.normalWxMaService().getQrcodeService() | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    .createWxaCodeUnlimit(param, pageUrl, 1280, true, null, false); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } catch (WxErrorException e) { | 
					 | 
					 | 
					        } catch (WxErrorException e) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new RenException("请求微信接口失败"); | 
					 | 
					 | 
					            throw new RenException("请求微信接口失败"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |