| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -25,6 +25,7 @@ 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.enums.EnvEnum; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.ExceptionUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -40,13 +41,19 @@ import com.epmet.modules.group.dao.ResiGroupCodeDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.entity.ResiGroupCodeEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.redis.ResiGroupCodeRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.service.ResiGroupCodeService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.service.ResiGroupService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.invitation.service.GroupInvitationService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.utils.ModuleConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.constant.GroupCodeConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.QRCodeMultipartFileDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.group.ResiGroupCodeDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.group.form.GetGroupCodeFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.group.form.GroupCodeBasicInfoFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.group.result.GroupCodeBasicInfoResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.invitation.form.CreateGroupInvitationFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.invitation.result.CreateGroupInvitationResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.utils.ThirdUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.slf4j.Logger; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.slf4j.LoggerFactory; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -57,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.io.UnsupportedEncodingException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.concurrent.ExecutorService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -76,7 +84,13 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl<ResiGroupCodeDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private OssFeignClient ossFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetUserOpenFeignClient epmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ExecutorService executorService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private GroupInvitationService groupInvitationService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ResiGroupService resiGroupService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public PageData<ResiGroupCodeDTO> page(Map<String, Object> params) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -131,14 +145,68 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl<ResiGroupCodeDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param dto | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return void | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param dto, syncFlag(是否同步执行,true同步,false异步) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return String | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 创建群组二维码 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Author liushaowen | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Date 2020/11/13 16:32 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public String createGroupCode(CreateGroupCodeFormDTO dto) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public String createGroupCode(CreateGroupCodeFormDTO dto, boolean syncFlag) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (syncFlag){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return createCodeFunction(dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            executorService.execute(()->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    long startTs = System.currentTimeMillis(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    createCodeFunction(dto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    long endTs = System.currentTimeMillis(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    logger.info("异步创建群二维码成功,执行时长:{}", endTs - startTs); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } catch (Exception e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    logger.error("异步创建群二维码失败,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return ""; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param dto | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return com.epmet.commons.tools.utils.Result<java.lang.String> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 获取群组二维码 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Author liushaowen | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Date 2020/11/16 9:37 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public Result<String> getGroupCode(GetGroupCodeFormDTO dto) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (codeByGroupId != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //数据库有数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return new Result<String>().ok(codeByGroupId.getUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //从微信获取二维码并存储
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CreateGroupCodeFormDTO createDto = new CreateGroupCodeFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            BeanUtils.copyProperties(dto, createDto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String url = createGroupCode(createDto, true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isBlank(url)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException("获取二维码失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return new Result<String>().ok(url); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ResiGroupCodeEntity getCode(String groupId, String type) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (StringUtils.isBlank(groupId) || StringUtils.isBlank(type)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException("获取二维码失败,groupId或type为空"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        QueryWrapper<ResiGroupCodeEntity> queryWrapper = new QueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        queryWrapper.eq("DEL_FLAG", "0"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        queryWrapper.eq("GROUP_ID", groupId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        queryWrapper.eq("TYPE", type); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return baseDao.selectOne(queryWrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String createCodeFunction(CreateGroupCodeFormDTO dto){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String result = ""; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (codeByGroupId != null) { | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -148,14 +216,21 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl<ResiGroupCodeDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //向微信获取二维码
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 获取AccessToken
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String accessToken = getAccessToken(dto.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String accessToken = ThirdUtils.getAccessToken(dto.getCustomerId()).getResiToken(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isBlank(accessToken)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                logger.error("获取accessToken失败,customerId:{}", dto.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException("获取accessToken失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //跳转的页面
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            StringBuilder path = new StringBuilder(ModuleConstant.CODE_INVITE_PAGE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            path.append("?groupId=").append(dto.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //获取invitationId
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CreateGroupInvitationFormDTO invitationFormDTO = new CreateGroupInvitationFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //获取群主userId
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            invitationFormDTO.setUserId(resiGroupService.get(dto.getGroupId()).getCreatedBy()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            invitationFormDTO.setGroupId(dto.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CreateGroupInvitationResultDTO groupScanCodeInvitation = groupInvitationService.createGroupScanCodeInvitation(invitationFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            path.append("?invitationId=").append(groupScanCodeInvitation.getInvitationId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //需要发送的Json
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            JSONObject data = new JSONObject(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            data.put("path", path.toString()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -194,70 +269,6 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl<ResiGroupCodeDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param dto | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return com.epmet.commons.tools.utils.Result<java.lang.String> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 获取群组二维码 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Author liushaowen | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Date 2020/11/16 9:37 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public Result<String> getGroupCode(GetGroupCodeFormDTO dto) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (codeByGroupId != null) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //数据库有数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return new Result<String>().ok(codeByGroupId.getUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //从微信获取二维码并存储
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CreateGroupCodeFormDTO createDto = new CreateGroupCodeFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            BeanUtils.copyProperties(dto, createDto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String url = createGroupCode(createDto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isBlank(url)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException("获取二维码失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return new Result<String>().ok(url); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ResiGroupCodeEntity getCode(String groupId, String type) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (StringUtils.isBlank(groupId) || StringUtils.isBlank(type)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException("获取二维码失败,groupId或type为空"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        QueryWrapper<ResiGroupCodeEntity> queryWrapper = new QueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        queryWrapper.eq("DEL_FLAG", "0"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        queryWrapper.eq("GROUP_ID", groupId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        queryWrapper.eq("TYPE", type); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return baseDao.selectOne(queryWrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    //获取AccessToken
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String getAccessToken(String customerId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        EnvEnum envEnum = EnvEnum.getCurrentEnv(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String resiAccessToken = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (EnvEnum.PROD.getCode().equals(envEnum.getCode())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //居民端
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            StringBuilder resiKey = new StringBuilder(customerId).append(":resi"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, Object> authorizerRefreshToken = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            authorizerRefreshToken = resiGroupCodeRedis.getAuthorizerRefreshToken(resiKey.toString()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resiAccessToken = (String) authorizerRefreshToken.get("authorizerAccessToken"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String url = "https://epmet-cloud.elinkservice.cn/api/third/pacustomer/tokenlist"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            JSONObject postData = new JSONObject(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            postData.put("customerId", customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String data = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(postData)).getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            JSONObject toResult = JSON.parseObject(data); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (null != toResult.get("code")) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                mapToResult.setCode(((Integer) toResult.get("code")).intValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Object CustomerTokensResultDTO = mapToResult.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            JSONObject json = JSON.parseObject(CustomerTokensResultDTO.toString()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerTokensResultDTO customerTokensResultDTO = ConvertUtils.mapToEntity(json, com.epmet.dto.result.CustomerTokensResultDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resiAccessToken = customerTokensResultDTO.getResiAuthorizerToken(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return resiAccessToken; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param formDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 获取生成海报(小组码)信息 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -271,17 +282,16 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl<ResiGroupCodeDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            logger.error(String.format("获取小组码基本信息失败,小组Id:%s", formDTO.getGroupId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException("获取小组码基本信息失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //2.获取小组创建人称谓信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        UserResiInfoListFormDTO userResiInfoListFormDTO = new UserResiInfoListFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> userIdList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userIdList.add(resultDTO.getGroupUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userResiInfoListFormDTO.setUserIdList(userIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<List<UserResiInfoResultDTO>> resultList = epmetUserOpenFeignClient.getUserResiInfoList(userResiInfoListFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!resultList.success() || null == resultList.getData() || resultList.getData().size() < NumConstant.ONE) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            logger.error(String.format("调用user服务,查询用户基本信息失败,userId:%s", resultDTO.getGroupUserId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException("获取小组创建人基本信息失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (null == resultDTO.getGroupCodeUrl() || "".equals(resultDTO.getGroupCodeUrl())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CreateGroupCodeFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CreateGroupCodeFormDTO.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setType(GroupCodeConstant.CODE_TYPE_INVITE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String url = createGroupCode(dto, true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (StringUtils.isBlank(url)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                logger.error(String.format("生成小组二维码失败,小组Id:%s", formDTO.getGroupId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new RenException("获取小组码基本信息失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resultDTO.setGroupCodeUrl(url); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        resultDTO.setShowName(resultList.getData().get(NumConstant.ZERO).getShowName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return resultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |